diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c2d6f8bd14..1b5001eeb44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: echo "$HOME/.rye/shims" >> $GITHUB_PATH env: RYE_VERSION: 0.24.0 - RYE_INSTALL_OPTION: "--yes" + RYE_INSTALL_OPTION: '--yes' - name: Install dependencies run: | @@ -39,3 +39,29 @@ jobs: - name: Ensure importable run: | rye run python -c 'import cloudflare' + + examples: + name: examples + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye-up.com/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: 0.24.0 + RYE_INSTALL_OPTION: "--yes" + - name: Install dependencies + run: | + rye sync --all-features + + - env: + CLOUDFLARE_ACCOUNT_ID: f037e56e89293a057740de681ac9abbe + CLOUDFLARE_EMAIL: terraform-acceptance-test@cfapi.net + CLOUDFLARE_ZONE_ID: 0da42c8d2132a9ddaf714f9e7c92011 + CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} + run: | + rye run python ./examples/workers/ai/demo.py diff --git a/.release-please-manifest.json b/.release-please-manifest.json index beb0318b90a..e26e1bb3495 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.0.0-beta.7" + ".": "3.0.0-beta.8" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index de12921cd5a..860345bb66e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1292 +configured_endpoints: 1266 diff --git a/CHANGELOG.md b/CHANGELOG.md index f2701a3df42..0e131be0957 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,170 @@ # Changelog +## 3.0.0-beta.8 (2024-04-24) + +Full Changelog: [v3.0.0-beta.7...v3.0.0-beta.8](https://github.com/cloudflare/cloudflare-python/compare/v3.0.0-beta.7...v3.0.0-beta.8) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#196](https://github.com/cloudflare/cloudflare-python/issues/196)) ([ac53439](https://github.com/cloudflare/cloudflare-python/commit/ac534395d4df4399d88690e63e9363b9f1efeccd)) +* **api:** OpenAPI spec update via Stainless API ([#198](https://github.com/cloudflare/cloudflare-python/issues/198)) ([436ce30](https://github.com/cloudflare/cloudflare-python/commit/436ce30103c5db2251599ceff7b58ca03f039a02)) +* **api:** OpenAPI spec update via Stainless API ([#199](https://github.com/cloudflare/cloudflare-python/issues/199)) ([6c908fc](https://github.com/cloudflare/cloudflare-python/commit/6c908fc3bac7cdf0bd79e7753d49d081f1e13119)) +* **api:** OpenAPI spec update via Stainless API ([#200](https://github.com/cloudflare/cloudflare-python/issues/200)) ([683552a](https://github.com/cloudflare/cloudflare-python/commit/683552a810b1619f4de9c27dcea155e772347b95)) +* **api:** OpenAPI spec update via Stainless API ([#201](https://github.com/cloudflare/cloudflare-python/issues/201)) ([c2b9b35](https://github.com/cloudflare/cloudflare-python/commit/c2b9b354458ccec2c7b77306077385a26a6a2225)) +* **api:** OpenAPI spec update via Stainless API ([#202](https://github.com/cloudflare/cloudflare-python/issues/202)) ([3a3a661](https://github.com/cloudflare/cloudflare-python/commit/3a3a661f25fe70a4d5b7e3515414932658499364)) +* **api:** OpenAPI spec update via Stainless API ([#212](https://github.com/cloudflare/cloudflare-python/issues/212)) ([c3f0e24](https://github.com/cloudflare/cloudflare-python/commit/c3f0e2403bb33942466a2f422133aaef844ea162)) +* **api:** OpenAPI spec update via Stainless API ([#213](https://github.com/cloudflare/cloudflare-python/issues/213)) ([e612347](https://github.com/cloudflare/cloudflare-python/commit/e6123474838034fb2d6a74c9040a11935a2b03b7)) +* **api:** OpenAPI spec update via Stainless API ([#214](https://github.com/cloudflare/cloudflare-python/issues/214)) ([51159f5](https://github.com/cloudflare/cloudflare-python/commit/51159f56ac80116c286524f22ed871911f9bf647)) +* **api:** OpenAPI spec update via Stainless API ([#215](https://github.com/cloudflare/cloudflare-python/issues/215)) ([6bf76e3](https://github.com/cloudflare/cloudflare-python/commit/6bf76e3521120dd7ed201cd498fa95811744ccba)) +* **api:** OpenAPI spec update via Stainless API ([#224](https://github.com/cloudflare/cloudflare-python/issues/224)) ([e06ef4e](https://github.com/cloudflare/cloudflare-python/commit/e06ef4ece8e9bf99bba088fa30b7bdcbff2b8792)) +* **api:** OpenAPI spec update via Stainless API ([#246](https://github.com/cloudflare/cloudflare-python/issues/246)) ([3ea7393](https://github.com/cloudflare/cloudflare-python/commit/3ea7393919e9d6ea24de0542073fa6cc6f4cddf3)) +* **api:** OpenAPI spec update via Stainless API ([#267](https://github.com/cloudflare/cloudflare-python/issues/267)) ([89f4f0c](https://github.com/cloudflare/cloudflare-python/commit/89f4f0c2a0e68cfa4679dc60a9b5bdc59053d8c1)) +* **api:** OpenAPI spec update via Stainless API ([#272](https://github.com/cloudflare/cloudflare-python/issues/272)) ([cbbb0be](https://github.com/cloudflare/cloudflare-python/commit/cbbb0be05a757a661092cfecd18927c6f6ca724e)) +* **api:** OpenAPI spec update via Stainless API ([#273](https://github.com/cloudflare/cloudflare-python/issues/273)) ([72a3b86](https://github.com/cloudflare/cloudflare-python/commit/72a3b864aa2de37fb576934d3ff9343a51436b60)) +* **api:** OpenAPI spec update via Stainless API ([#274](https://github.com/cloudflare/cloudflare-python/issues/274)) ([2a11bb1](https://github.com/cloudflare/cloudflare-python/commit/2a11bb192211357e0c122f131f5f84782e69f0bb)) +* **api:** OpenAPI spec update via Stainless API ([#275](https://github.com/cloudflare/cloudflare-python/issues/275)) ([9683250](https://github.com/cloudflare/cloudflare-python/commit/96832503a555a976ffafde3c6bbebf55fd5f296b)) +* **api:** OpenAPI spec update via Stainless API ([#276](https://github.com/cloudflare/cloudflare-python/issues/276)) ([02dc91c](https://github.com/cloudflare/cloudflare-python/commit/02dc91c727d7c01b8d0fe3be2a920e9cff5031d0)) +* **api:** OpenAPI spec update via Stainless API ([#277](https://github.com/cloudflare/cloudflare-python/issues/277)) ([f3e3ce8](https://github.com/cloudflare/cloudflare-python/commit/f3e3ce861d66d402f4577b0406586d96087b0e05)) +* **api:** OpenAPI spec update via Stainless API ([#295](https://github.com/cloudflare/cloudflare-python/issues/295)) ([db173b7](https://github.com/cloudflare/cloudflare-python/commit/db173b7b12320a0ee07de447124ee998721caf21)) +* **api:** OpenAPI spec update via Stainless API ([#296](https://github.com/cloudflare/cloudflare-python/issues/296)) ([bef513f](https://github.com/cloudflare/cloudflare-python/commit/bef513fbe9c99abc3fcac9bae5661bdaca516493)) +* **api:** OpenAPI spec update via Stainless API ([#297](https://github.com/cloudflare/cloudflare-python/issues/297)) ([f408b80](https://github.com/cloudflare/cloudflare-python/commit/f408b80215d98169e47be32bf5afaf9dc7975d27)) +* **api:** OpenAPI spec update via Stainless API ([#309](https://github.com/cloudflare/cloudflare-python/issues/309)) ([ddd0ea3](https://github.com/cloudflare/cloudflare-python/commit/ddd0ea3624922ec4a12284b6c8838b301804abb9)) +* **api:** OpenAPI spec update via Stainless API ([#310](https://github.com/cloudflare/cloudflare-python/issues/310)) ([6fedcdb](https://github.com/cloudflare/cloudflare-python/commit/6fedcdb6fc05c2a63fa63118bf2a52d624c68fe1)) +* **api:** OpenAPI spec update via Stainless API ([#311](https://github.com/cloudflare/cloudflare-python/issues/311)) ([6bc0063](https://github.com/cloudflare/cloudflare-python/commit/6bc0063cabc235bbf664322e53473c989a1e9030)) +* **api:** OpenAPI spec update via Stainless API ([#312](https://github.com/cloudflare/cloudflare-python/issues/312)) ([b0fa819](https://github.com/cloudflare/cloudflare-python/commit/b0fa819bc0e5a89a18dca07d5ba154126cf9def2)) +* **api:** OpenAPI spec update via Stainless API ([#313](https://github.com/cloudflare/cloudflare-python/issues/313)) ([df9cab4](https://github.com/cloudflare/cloudflare-python/commit/df9cab4ec5d39b154c368bdd0d732e54ddea7722)) +* **api:** OpenAPI spec update via Stainless API ([#314](https://github.com/cloudflare/cloudflare-python/issues/314)) ([51169d3](https://github.com/cloudflare/cloudflare-python/commit/51169d3b8ef3004959b81ef1e7b8713177b48a6e)) +* **api:** OpenAPI spec update via Stainless API ([#315](https://github.com/cloudflare/cloudflare-python/issues/315)) ([d42b574](https://github.com/cloudflare/cloudflare-python/commit/d42b574176c2adb67d22473f210da9663335a285)) +* **api:** OpenAPI spec update via Stainless API ([#316](https://github.com/cloudflare/cloudflare-python/issues/316)) ([032d4ea](https://github.com/cloudflare/cloudflare-python/commit/032d4ea77e666d175088bc09af3d302fd2ccf926)) +* **api:** OpenAPI spec update via Stainless API ([#317](https://github.com/cloudflare/cloudflare-python/issues/317)) ([e553303](https://github.com/cloudflare/cloudflare-python/commit/e553303aa8bce8e31e8ab3c19334c6618b6bafc2)) +* **api:** OpenAPI spec update via Stainless API ([#318](https://github.com/cloudflare/cloudflare-python/issues/318)) ([8766ffb](https://github.com/cloudflare/cloudflare-python/commit/8766ffb81abdad21f59091bf4f1a4f42a301218d)) +* **api:** OpenAPI spec update via Stainless API ([#319](https://github.com/cloudflare/cloudflare-python/issues/319)) ([f8b8339](https://github.com/cloudflare/cloudflare-python/commit/f8b8339988f4834a9372e5d0e034104cbdc8c853)) +* **api:** OpenAPI spec update via Stainless API ([#320](https://github.com/cloudflare/cloudflare-python/issues/320)) ([9a5ecf5](https://github.com/cloudflare/cloudflare-python/commit/9a5ecf542934b991c1a695faf0d001771f21ae8d)) +* **api:** OpenAPI spec update via Stainless API ([#321](https://github.com/cloudflare/cloudflare-python/issues/321)) ([49fca30](https://github.com/cloudflare/cloudflare-python/commit/49fca3098d2869b63c025a91a667f00996964a1b)) +* **api:** OpenAPI spec update via Stainless API ([#322](https://github.com/cloudflare/cloudflare-python/issues/322)) ([9e78a68](https://github.com/cloudflare/cloudflare-python/commit/9e78a68d881b4274d89f1fae0692c10ce9b7eafa)) +* **api:** OpenAPI spec update via Stainless API ([#323](https://github.com/cloudflare/cloudflare-python/issues/323)) ([c9914bc](https://github.com/cloudflare/cloudflare-python/commit/c9914bcd420ec35260ed22fef282c6a5fe4b3356)) +* **api:** OpenAPI spec update via Stainless API ([#324](https://github.com/cloudflare/cloudflare-python/issues/324)) ([e3a9d7f](https://github.com/cloudflare/cloudflare-python/commit/e3a9d7ff46edc3ec7e86f50f7f2936cf49d59a75)) +* **api:** OpenAPI spec update via Stainless API ([#325](https://github.com/cloudflare/cloudflare-python/issues/325)) ([892540a](https://github.com/cloudflare/cloudflare-python/commit/892540a6e2c3fc01be3313dbb37a151e4d998058)) +* **api:** OpenAPI spec update via Stainless API ([#326](https://github.com/cloudflare/cloudflare-python/issues/326)) ([a8d801a](https://github.com/cloudflare/cloudflare-python/commit/a8d801a93318aa7c91ea9644b693f6f548d366b4)) +* **api:** OpenAPI spec update via Stainless API ([#327](https://github.com/cloudflare/cloudflare-python/issues/327)) ([1740e2f](https://github.com/cloudflare/cloudflare-python/commit/1740e2f667f6adb32cc56b0a9edb202b79ed81bb)) +* **api:** OpenAPI spec update via Stainless API ([#328](https://github.com/cloudflare/cloudflare-python/issues/328)) ([dff460b](https://github.com/cloudflare/cloudflare-python/commit/dff460bb4d024c3dbc08cde8607ac5009e1d7375)) +* **api:** OpenAPI spec update via Stainless API ([#329](https://github.com/cloudflare/cloudflare-python/issues/329)) ([0c0db5b](https://github.com/cloudflare/cloudflare-python/commit/0c0db5b10da5f1092c337b21f71acf2a284bb63d)) +* **api:** OpenAPI spec update via Stainless API ([#330](https://github.com/cloudflare/cloudflare-python/issues/330)) ([4c6b0ce](https://github.com/cloudflare/cloudflare-python/commit/4c6b0ce1d9d4486be7bfc59537fcc2ce914a07ee)) +* **api:** OpenAPI spec update via Stainless API ([#331](https://github.com/cloudflare/cloudflare-python/issues/331)) ([dc9f277](https://github.com/cloudflare/cloudflare-python/commit/dc9f277c142af2eac5fe626bed1d0fb53306dfec)) +* **api:** OpenAPI spec update via Stainless API ([#333](https://github.com/cloudflare/cloudflare-python/issues/333)) ([81d95a5](https://github.com/cloudflare/cloudflare-python/commit/81d95a51ae5617f6d91c92fbc53e39ab66c45a92)) +* **api:** OpenAPI spec update via Stainless API ([#337](https://github.com/cloudflare/cloudflare-python/issues/337)) ([0b41651](https://github.com/cloudflare/cloudflare-python/commit/0b416515225e190c527319d3c608c103910b6843)) +* **api:** OpenAPI spec update via Stainless API ([#338](https://github.com/cloudflare/cloudflare-python/issues/338)) ([8aa19d4](https://github.com/cloudflare/cloudflare-python/commit/8aa19d4eb56567851b667fedaa5991d5349d1032)) +* **api:** OpenAPI spec update via Stainless API ([#340](https://github.com/cloudflare/cloudflare-python/issues/340)) ([9f6893c](https://github.com/cloudflare/cloudflare-python/commit/9f6893c71fe9163b625d782fa0da31be057d7c84)) +* **api:** OpenAPI spec update via Stainless API ([#341](https://github.com/cloudflare/cloudflare-python/issues/341)) ([3d2205f](https://github.com/cloudflare/cloudflare-python/commit/3d2205f292a1ef3c7f71cab7b2ec43fc3f56446b)) +* **api:** OpenAPI spec update via Stainless API ([#350](https://github.com/cloudflare/cloudflare-python/issues/350)) ([55a52b3](https://github.com/cloudflare/cloudflare-python/commit/55a52b3e56bb691c9b0d57191458154afc28f7d4)) +* **api:** OpenAPI spec update via Stainless API ([#351](https://github.com/cloudflare/cloudflare-python/issues/351)) ([5683c75](https://github.com/cloudflare/cloudflare-python/commit/5683c7571f675f949dde17fb7adc75b86bb9eccb)) +* **api:** OpenAPI spec update via Stainless API ([#352](https://github.com/cloudflare/cloudflare-python/issues/352)) ([42e0458](https://github.com/cloudflare/cloudflare-python/commit/42e04581041efd0ad1cf956a486ef565fa93b87c)) +* **api:** OpenAPI spec update via Stainless API ([#355](https://github.com/cloudflare/cloudflare-python/issues/355)) ([f168068](https://github.com/cloudflare/cloudflare-python/commit/f1680687486e5e6fbef8ccf618605718f41e86fd)) +* **api:** OpenAPI spec update via Stainless API ([#358](https://github.com/cloudflare/cloudflare-python/issues/358)) ([0c9946d](https://github.com/cloudflare/cloudflare-python/commit/0c9946daa1ea73c41e5abb10ce33e35c914c7b48)) +* **api:** OpenAPI spec update via Stainless API ([#359](https://github.com/cloudflare/cloudflare-python/issues/359)) ([5467248](https://github.com/cloudflare/cloudflare-python/commit/54672482f5923187d12e6bdbcf8aff955c6f13a0)) +* **api:** update via SDK Studio ([#203](https://github.com/cloudflare/cloudflare-python/issues/203)) ([7ecac59](https://github.com/cloudflare/cloudflare-python/commit/7ecac5941855b0bdd4b5bb0b692d039315daf09b)) +* **api:** update via SDK Studio ([#207](https://github.com/cloudflare/cloudflare-python/issues/207)) ([9e8b61a](https://github.com/cloudflare/cloudflare-python/commit/9e8b61a01a4893aa7e59cf0c72f54124b06a532a)) +* **api:** update via SDK Studio ([#208](https://github.com/cloudflare/cloudflare-python/issues/208)) ([9a2ec53](https://github.com/cloudflare/cloudflare-python/commit/9a2ec5309e7d6630bf7e1280b9e2ffc0d8d38b23)) +* **api:** update via SDK Studio ([#209](https://github.com/cloudflare/cloudflare-python/issues/209)) ([70bd1e4](https://github.com/cloudflare/cloudflare-python/commit/70bd1e4cb34e6320d3415a8b7819316d7f6ad2e8)) +* **api:** update via SDK Studio ([#210](https://github.com/cloudflare/cloudflare-python/issues/210)) ([033c962](https://github.com/cloudflare/cloudflare-python/commit/033c962142b78ebc8b55bd74062d36142388bb85)) +* **api:** update via SDK Studio ([#211](https://github.com/cloudflare/cloudflare-python/issues/211)) ([87add37](https://github.com/cloudflare/cloudflare-python/commit/87add37925e39073bf880b062c25c02f72a0ba4a)) +* **api:** update via SDK Studio ([#216](https://github.com/cloudflare/cloudflare-python/issues/216)) ([f1c1451](https://github.com/cloudflare/cloudflare-python/commit/f1c145118f2a0717361ed08de091eb8919cb19d0)) +* **api:** update via SDK Studio ([#217](https://github.com/cloudflare/cloudflare-python/issues/217)) ([9b10753](https://github.com/cloudflare/cloudflare-python/commit/9b10753553afe631509fc5711ec335c4d0a6cbe1)) +* **api:** update via SDK Studio ([#218](https://github.com/cloudflare/cloudflare-python/issues/218)) ([c1e3025](https://github.com/cloudflare/cloudflare-python/commit/c1e3025ace99b487e5db205b567a0325ae3d9979)) +* **api:** update via SDK Studio ([#219](https://github.com/cloudflare/cloudflare-python/issues/219)) ([23e38ea](https://github.com/cloudflare/cloudflare-python/commit/23e38ea1de70d202bddc0226a905539381b7e5dd)) +* **api:** update via SDK Studio ([#220](https://github.com/cloudflare/cloudflare-python/issues/220)) ([df86b06](https://github.com/cloudflare/cloudflare-python/commit/df86b067c027779da989b236bae9a7635a955df7)) +* **api:** update via SDK Studio ([#221](https://github.com/cloudflare/cloudflare-python/issues/221)) ([737e6e4](https://github.com/cloudflare/cloudflare-python/commit/737e6e45729579e125c027ad8c24e3331c238863)) +* **api:** update via SDK Studio ([#222](https://github.com/cloudflare/cloudflare-python/issues/222)) ([522d336](https://github.com/cloudflare/cloudflare-python/commit/522d336a746e44d40249c995df0164cba1047b35)) +* **api:** update via SDK Studio ([#223](https://github.com/cloudflare/cloudflare-python/issues/223)) ([dfa9884](https://github.com/cloudflare/cloudflare-python/commit/dfa9884af530e37d51f58edac5be4e7f03ad28c5)) +* **api:** update via SDK Studio ([#225](https://github.com/cloudflare/cloudflare-python/issues/225)) ([5dadedb](https://github.com/cloudflare/cloudflare-python/commit/5dadedbe26889e699652ea3928ca5f17c7a9af20)) +* **api:** update via SDK Studio ([#226](https://github.com/cloudflare/cloudflare-python/issues/226)) ([dc229bd](https://github.com/cloudflare/cloudflare-python/commit/dc229bdd5b0e921e85b1f973dbb13b17397d538b)) +* **api:** update via SDK Studio ([#227](https://github.com/cloudflare/cloudflare-python/issues/227)) ([fba97f2](https://github.com/cloudflare/cloudflare-python/commit/fba97f2258212f565300a04d78280f488ba8b3b3)) +* **api:** update via SDK Studio ([#228](https://github.com/cloudflare/cloudflare-python/issues/228)) ([c774af3](https://github.com/cloudflare/cloudflare-python/commit/c774af3e25c470342493c03fb33b62421f7d5ef1)) +* **api:** update via SDK Studio ([#229](https://github.com/cloudflare/cloudflare-python/issues/229)) ([dd6a5b7](https://github.com/cloudflare/cloudflare-python/commit/dd6a5b707307ee105f9937bc0c2ac0ed2656e640)) +* **api:** update via SDK Studio ([#230](https://github.com/cloudflare/cloudflare-python/issues/230)) ([f90dc3a](https://github.com/cloudflare/cloudflare-python/commit/f90dc3aea9a047b95667313eb68331d4477f325f)) +* **api:** update via SDK Studio ([#233](https://github.com/cloudflare/cloudflare-python/issues/233)) ([defd55e](https://github.com/cloudflare/cloudflare-python/commit/defd55e51765a3f9ba1fceea112fb1d6ec610382)) +* **api:** update via SDK Studio ([#234](https://github.com/cloudflare/cloudflare-python/issues/234)) ([27c7d71](https://github.com/cloudflare/cloudflare-python/commit/27c7d71f276ea8330a9aeee0f011a34e39f85759)) +* **api:** update via SDK Studio ([#235](https://github.com/cloudflare/cloudflare-python/issues/235)) ([47f9f56](https://github.com/cloudflare/cloudflare-python/commit/47f9f568cac93e8a4252724e116aefabc7602ac6)) +* **api:** update via SDK Studio ([#236](https://github.com/cloudflare/cloudflare-python/issues/236)) ([8ba08ef](https://github.com/cloudflare/cloudflare-python/commit/8ba08ef334e411aa3d8f7a9f0a70d8f166017097)) +* **api:** update via SDK Studio ([#237](https://github.com/cloudflare/cloudflare-python/issues/237)) ([a333132](https://github.com/cloudflare/cloudflare-python/commit/a3331321ce02a9652e76a0bb28654cab4d0b4b8a)) +* **api:** update via SDK Studio ([#238](https://github.com/cloudflare/cloudflare-python/issues/238)) ([b4310a5](https://github.com/cloudflare/cloudflare-python/commit/b4310a5b02956bf51995521376ba7299339de0e8)) +* **api:** update via SDK Studio ([#239](https://github.com/cloudflare/cloudflare-python/issues/239)) ([f44f877](https://github.com/cloudflare/cloudflare-python/commit/f44f8775470d00c1acd6eb194bf16f3bf39a5e35)) +* **api:** update via SDK Studio ([#240](https://github.com/cloudflare/cloudflare-python/issues/240)) ([dd33a93](https://github.com/cloudflare/cloudflare-python/commit/dd33a931a6ae83ec5348aa6740386f866a303a9c)) +* **api:** update via SDK Studio ([#241](https://github.com/cloudflare/cloudflare-python/issues/241)) ([9e1e430](https://github.com/cloudflare/cloudflare-python/commit/9e1e43003451f49637a449afbbd2e3c5d6a44ef7)) +* **api:** update via SDK Studio ([#242](https://github.com/cloudflare/cloudflare-python/issues/242)) ([7eba978](https://github.com/cloudflare/cloudflare-python/commit/7eba9787b411d8b40ca721a23853b6f2bdf1580c)) +* **api:** update via SDK Studio ([#243](https://github.com/cloudflare/cloudflare-python/issues/243)) ([cc646b9](https://github.com/cloudflare/cloudflare-python/commit/cc646b935d7367471dbc03a4cbe4cbcc60c9874a)) +* **api:** update via SDK Studio ([#244](https://github.com/cloudflare/cloudflare-python/issues/244)) ([268e06c](https://github.com/cloudflare/cloudflare-python/commit/268e06ce5e360c93bbf3fdac4d4bac3fe6f50201)) +* **api:** update via SDK Studio ([#245](https://github.com/cloudflare/cloudflare-python/issues/245)) ([2ed1953](https://github.com/cloudflare/cloudflare-python/commit/2ed1953f5b6c73448ecc43440597c96c224b5ee7)) +* **api:** update via SDK Studio ([#247](https://github.com/cloudflare/cloudflare-python/issues/247)) ([eee2f14](https://github.com/cloudflare/cloudflare-python/commit/eee2f142875c5f13a16197946d86be1c93317665)) +* **api:** update via SDK Studio ([#248](https://github.com/cloudflare/cloudflare-python/issues/248)) ([d17c894](https://github.com/cloudflare/cloudflare-python/commit/d17c8943cfe687ef8c9d58f8beb2aca64d96d2b0)) +* **api:** update via SDK Studio ([#249](https://github.com/cloudflare/cloudflare-python/issues/249)) ([7ad459c](https://github.com/cloudflare/cloudflare-python/commit/7ad459c05e7c2a1c10c5b6b7b0aa0d4737461733)) +* **api:** update via SDK Studio ([#250](https://github.com/cloudflare/cloudflare-python/issues/250)) ([b4fbc33](https://github.com/cloudflare/cloudflare-python/commit/b4fbc3392079fc1544de0bd64c8fce2b05d5e64f)) +* **api:** update via SDK Studio ([#251](https://github.com/cloudflare/cloudflare-python/issues/251)) ([4964d0e](https://github.com/cloudflare/cloudflare-python/commit/4964d0eabb87c8d17be15ab9166d0087a3d88026)) +* **api:** update via SDK Studio ([#252](https://github.com/cloudflare/cloudflare-python/issues/252)) ([d4bfe4e](https://github.com/cloudflare/cloudflare-python/commit/d4bfe4efbe9b21dc8bf855b9919013f3f7299a6e)) +* **api:** update via SDK Studio ([#253](https://github.com/cloudflare/cloudflare-python/issues/253)) ([124a709](https://github.com/cloudflare/cloudflare-python/commit/124a7098e025d456de1cee15f6a59985b0f5f12c)) +* **api:** update via SDK Studio ([#254](https://github.com/cloudflare/cloudflare-python/issues/254)) ([04f7e9d](https://github.com/cloudflare/cloudflare-python/commit/04f7e9d1ac6b696fe5042f5c2554dbd4e8d4b0ae)) +* **api:** update via SDK Studio ([#255](https://github.com/cloudflare/cloudflare-python/issues/255)) ([a9f75be](https://github.com/cloudflare/cloudflare-python/commit/a9f75be0b5a6d6f01f07a718929a8bce3278500b)) +* **api:** update via SDK Studio ([#256](https://github.com/cloudflare/cloudflare-python/issues/256)) ([c31e274](https://github.com/cloudflare/cloudflare-python/commit/c31e2749e3b33fb3cf7bdc8d3d8d23a33909d642)) +* **api:** update via SDK Studio ([#257](https://github.com/cloudflare/cloudflare-python/issues/257)) ([a138540](https://github.com/cloudflare/cloudflare-python/commit/a13854073aaea4ef65d3da1365f778d7955551cd)) +* **api:** update via SDK Studio ([#258](https://github.com/cloudflare/cloudflare-python/issues/258)) ([33da158](https://github.com/cloudflare/cloudflare-python/commit/33da1589061bca6a35fb856f485849184f4a0b48)) +* **api:** update via SDK Studio ([#259](https://github.com/cloudflare/cloudflare-python/issues/259)) ([1e66658](https://github.com/cloudflare/cloudflare-python/commit/1e66658d44652c592c52d6363ec22b7ae6036e39)) +* **api:** update via SDK Studio ([#260](https://github.com/cloudflare/cloudflare-python/issues/260)) ([ec56e67](https://github.com/cloudflare/cloudflare-python/commit/ec56e6778fa17e2e7d0169be8a7fd7754590ffe8)) +* **api:** update via SDK Studio ([#261](https://github.com/cloudflare/cloudflare-python/issues/261)) ([952514e](https://github.com/cloudflare/cloudflare-python/commit/952514ea2d59fae4326b896da800398192190bc6)) +* **api:** update via SDK Studio ([#262](https://github.com/cloudflare/cloudflare-python/issues/262)) ([df8af97](https://github.com/cloudflare/cloudflare-python/commit/df8af972998ade946f05319d4936c33fc406f556)) +* **api:** update via SDK Studio ([#263](https://github.com/cloudflare/cloudflare-python/issues/263)) ([dfc5fef](https://github.com/cloudflare/cloudflare-python/commit/dfc5fef143398129927d5f01cb20bc14d8cc6101)) +* **api:** update via SDK Studio ([#264](https://github.com/cloudflare/cloudflare-python/issues/264)) ([adeb5fa](https://github.com/cloudflare/cloudflare-python/commit/adeb5faa6f4d5e2cfdd64d652ceb219905d7886d)) +* **api:** update via SDK Studio ([#265](https://github.com/cloudflare/cloudflare-python/issues/265)) ([4cdc7ea](https://github.com/cloudflare/cloudflare-python/commit/4cdc7ea999bdacc99986310a05ed217b74b97e79)) +* **api:** update via SDK Studio ([#266](https://github.com/cloudflare/cloudflare-python/issues/266)) ([45906d2](https://github.com/cloudflare/cloudflare-python/commit/45906d23ad740951b38a4d9476946d21ca816598)) +* **api:** update via SDK Studio ([#268](https://github.com/cloudflare/cloudflare-python/issues/268)) ([7006adb](https://github.com/cloudflare/cloudflare-python/commit/7006adbef8391a216a11f4fb971e6ef2f271d059)) +* **api:** update via SDK Studio ([#269](https://github.com/cloudflare/cloudflare-python/issues/269)) ([947dd45](https://github.com/cloudflare/cloudflare-python/commit/947dd45bf4f36b1cbdd14b5dfb44bd315218e587)) +* **api:** update via SDK Studio ([#270](https://github.com/cloudflare/cloudflare-python/issues/270)) ([794ddc0](https://github.com/cloudflare/cloudflare-python/commit/794ddc052cc033e2365e8b9c05277adc739a9df1)) +* **api:** update via SDK Studio ([#271](https://github.com/cloudflare/cloudflare-python/issues/271)) ([11d4f1d](https://github.com/cloudflare/cloudflare-python/commit/11d4f1de055f5e55279519723e4280153a821368)) +* **api:** update via SDK Studio ([#278](https://github.com/cloudflare/cloudflare-python/issues/278)) ([192ef64](https://github.com/cloudflare/cloudflare-python/commit/192ef64dcf6dc38f2ea250ef31e907860fce5d9d)) +* **api:** update via SDK Studio ([#279](https://github.com/cloudflare/cloudflare-python/issues/279)) ([e2478c5](https://github.com/cloudflare/cloudflare-python/commit/e2478c520118901aa7bba9c99c3a9f8b7ba963b7)) +* **api:** update via SDK Studio ([#280](https://github.com/cloudflare/cloudflare-python/issues/280)) ([2fc1388](https://github.com/cloudflare/cloudflare-python/commit/2fc138870646d8a790f7c6d450eb6dac9668a4e4)) +* **api:** update via SDK Studio ([#281](https://github.com/cloudflare/cloudflare-python/issues/281)) ([2c2219f](https://github.com/cloudflare/cloudflare-python/commit/2c2219fa1e30c1a40926b0c72e3d65b68e1bd0e7)) +* **api:** update via SDK Studio ([#282](https://github.com/cloudflare/cloudflare-python/issues/282)) ([17adfbc](https://github.com/cloudflare/cloudflare-python/commit/17adfbca0b1c0d3677a302f3f367e4cd27b99847)) +* **api:** update via SDK Studio ([#283](https://github.com/cloudflare/cloudflare-python/issues/283)) ([9b2178a](https://github.com/cloudflare/cloudflare-python/commit/9b2178ac60ba5ddfe16a2df2f9c9c80d53c5cb7f)) +* **api:** update via SDK Studio ([#284](https://github.com/cloudflare/cloudflare-python/issues/284)) ([f46eebe](https://github.com/cloudflare/cloudflare-python/commit/f46eebe1cab65fcab4992872664c70b3d1ae20c5)) +* **api:** update via SDK Studio ([#285](https://github.com/cloudflare/cloudflare-python/issues/285)) ([ad4380d](https://github.com/cloudflare/cloudflare-python/commit/ad4380d9df7eae780e329141b185d7de4020f6f1)) +* **api:** update via SDK Studio ([#286](https://github.com/cloudflare/cloudflare-python/issues/286)) ([e4f36e1](https://github.com/cloudflare/cloudflare-python/commit/e4f36e18a3e5939cc9c3045a6606ce37ece5c952)) +* **api:** update via SDK Studio ([#287](https://github.com/cloudflare/cloudflare-python/issues/287)) ([14b8cac](https://github.com/cloudflare/cloudflare-python/commit/14b8cacf52a513b21eacb435ebe766057c4a6242)) +* **api:** update via SDK Studio ([#288](https://github.com/cloudflare/cloudflare-python/issues/288)) ([f4891c0](https://github.com/cloudflare/cloudflare-python/commit/f4891c0a1b26fc2f1da94f42de3d5782940ab3cb)) +* **api:** update via SDK Studio ([#289](https://github.com/cloudflare/cloudflare-python/issues/289)) ([b6008f2](https://github.com/cloudflare/cloudflare-python/commit/b6008f288434b60852c589aa55f511b132687ed6)) +* **api:** update via SDK Studio ([#290](https://github.com/cloudflare/cloudflare-python/issues/290)) ([c6c81d4](https://github.com/cloudflare/cloudflare-python/commit/c6c81d4d82a072945d4a8a3582afe6b9f8d43e1f)) +* **api:** update via SDK Studio ([#291](https://github.com/cloudflare/cloudflare-python/issues/291)) ([39eabf7](https://github.com/cloudflare/cloudflare-python/commit/39eabf704918bffe3fb8328d07c05c4eafc5ccb0)) +* **api:** update via SDK Studio ([#292](https://github.com/cloudflare/cloudflare-python/issues/292)) ([39eb096](https://github.com/cloudflare/cloudflare-python/commit/39eb096e42f95c1a9a949991ec8e22909bc21970)) +* **api:** update via SDK Studio ([#293](https://github.com/cloudflare/cloudflare-python/issues/293)) ([f7797bc](https://github.com/cloudflare/cloudflare-python/commit/f7797bcde70567d145f7bd01385187b759b942e5)) +* **api:** update via SDK Studio ([#294](https://github.com/cloudflare/cloudflare-python/issues/294)) ([f01d46e](https://github.com/cloudflare/cloudflare-python/commit/f01d46e18df0a590ffa1c189bb7e442542f42bae)) +* **api:** update via SDK Studio ([#298](https://github.com/cloudflare/cloudflare-python/issues/298)) ([413836b](https://github.com/cloudflare/cloudflare-python/commit/413836ba4a24f6ffcee7677666ec339a617a0c79)) +* **api:** update via SDK Studio ([#299](https://github.com/cloudflare/cloudflare-python/issues/299)) ([fb43f24](https://github.com/cloudflare/cloudflare-python/commit/fb43f2409b92d7b209d8ab3cc9678c2a4548dc07)) +* **api:** update via SDK Studio ([#300](https://github.com/cloudflare/cloudflare-python/issues/300)) ([0e084cf](https://github.com/cloudflare/cloudflare-python/commit/0e084cf7237b36fe2c27ced366bc98aa2b99084b)) +* **api:** update via SDK Studio ([#301](https://github.com/cloudflare/cloudflare-python/issues/301)) ([c5ea97f](https://github.com/cloudflare/cloudflare-python/commit/c5ea97f6737613d657df507012f59361cdcb8c05)) +* **api:** update via SDK Studio ([#302](https://github.com/cloudflare/cloudflare-python/issues/302)) ([6be0122](https://github.com/cloudflare/cloudflare-python/commit/6be012210168b0881bff84a405d40d0e2251ba3f)) +* **api:** update via SDK Studio ([#303](https://github.com/cloudflare/cloudflare-python/issues/303)) ([8e31a5a](https://github.com/cloudflare/cloudflare-python/commit/8e31a5a886dca29818caf58b2dd777d23481d888)) +* **api:** update via SDK Studio ([#304](https://github.com/cloudflare/cloudflare-python/issues/304)) ([6ca31f1](https://github.com/cloudflare/cloudflare-python/commit/6ca31f15f455196c5aeda63976211a624941e8f0)) +* **api:** update via SDK Studio ([#305](https://github.com/cloudflare/cloudflare-python/issues/305)) ([8e45d94](https://github.com/cloudflare/cloudflare-python/commit/8e45d94577bdd2b3940ac79c97cfb32ba3cfdaaa)) +* **api:** update via SDK Studio ([#306](https://github.com/cloudflare/cloudflare-python/issues/306)) ([f74e151](https://github.com/cloudflare/cloudflare-python/commit/f74e151ded6be0e02863e32fd69d3af02f59b7b9)) +* **api:** update via SDK Studio ([#307](https://github.com/cloudflare/cloudflare-python/issues/307)) ([289d760](https://github.com/cloudflare/cloudflare-python/commit/289d7601d509522196ebb33047fbf093c1e5c01a)) +* **api:** update via SDK Studio ([#308](https://github.com/cloudflare/cloudflare-python/issues/308)) ([5a49713](https://github.com/cloudflare/cloudflare-python/commit/5a497132195d7c1b63775c9aa3b649490000019d)) +* **api:** update via SDK Studio ([#332](https://github.com/cloudflare/cloudflare-python/issues/332)) ([8b4c1a0](https://github.com/cloudflare/cloudflare-python/commit/8b4c1a01af3b35de9bf4f416b5e88633535e4e6a)) +* **api:** update via SDK Studio ([#334](https://github.com/cloudflare/cloudflare-python/issues/334)) ([9bf6572](https://github.com/cloudflare/cloudflare-python/commit/9bf65720396f6aec80f115919389475c0d0bd668)) +* **api:** update via SDK Studio ([#335](https://github.com/cloudflare/cloudflare-python/issues/335)) ([266c0dc](https://github.com/cloudflare/cloudflare-python/commit/266c0dcc20cfe75610ecf21598b2c4ae33602d6f)) +* **api:** update via SDK Studio ([#336](https://github.com/cloudflare/cloudflare-python/issues/336)) ([0b9bdab](https://github.com/cloudflare/cloudflare-python/commit/0b9bdab39018ce07f8cc4298c211391ee56cd5a2)) +* **api:** update via SDK Studio ([#339](https://github.com/cloudflare/cloudflare-python/issues/339)) ([13403a2](https://github.com/cloudflare/cloudflare-python/commit/13403a2410e6a5ec98e7dc9bbb7d3b0e750eb9a6)) +* **api:** update via SDK Studio ([#342](https://github.com/cloudflare/cloudflare-python/issues/342)) ([91dbab3](https://github.com/cloudflare/cloudflare-python/commit/91dbab32a6e306d47a5e6c0aaff76ec74f345668)) +* **api:** update via SDK Studio ([#343](https://github.com/cloudflare/cloudflare-python/issues/343)) ([ac1e643](https://github.com/cloudflare/cloudflare-python/commit/ac1e643ce90a4aad902bf27e01c73df9b838e1e1)) +* **api:** update via SDK Studio ([#344](https://github.com/cloudflare/cloudflare-python/issues/344)) ([3ba27b3](https://github.com/cloudflare/cloudflare-python/commit/3ba27b3a8415e27cde3c0c42c13010f6731b09bc)) +* **api:** update via SDK Studio ([#345](https://github.com/cloudflare/cloudflare-python/issues/345)) ([50a9207](https://github.com/cloudflare/cloudflare-python/commit/50a920779df46fd600bbc0d077ecaab79fcb3a55)) +* **api:** update via SDK Studio ([#346](https://github.com/cloudflare/cloudflare-python/issues/346)) ([b6f0062](https://github.com/cloudflare/cloudflare-python/commit/b6f0062cc6db00e9d424bd9082ba3e4c284ae241)) +* **api:** update via SDK Studio ([#348](https://github.com/cloudflare/cloudflare-python/issues/348)) ([5b9a07e](https://github.com/cloudflare/cloudflare-python/commit/5b9a07e11f2eb2ff1f59d64171b22689d9a6590f)) +* **api:** update via SDK Studio ([#349](https://github.com/cloudflare/cloudflare-python/issues/349)) ([5a4d204](https://github.com/cloudflare/cloudflare-python/commit/5a4d204a475cbcc5692fc9cf617e873601db08db)) +* **api:** update via SDK Studio ([#353](https://github.com/cloudflare/cloudflare-python/issues/353)) ([477c21a](https://github.com/cloudflare/cloudflare-python/commit/477c21ab02daceb7db34531f45ce74b44b5495d0)) +* **api:** update via SDK Studio ([#354](https://github.com/cloudflare/cloudflare-python/issues/354)) ([c0f7159](https://github.com/cloudflare/cloudflare-python/commit/c0f7159e0e37f0bcaf0d514df29b18d45c4b8034)) +* **api:** update via SDK Studio ([#356](https://github.com/cloudflare/cloudflare-python/issues/356)) ([e6e5f2d](https://github.com/cloudflare/cloudflare-python/commit/e6e5f2d835f7108bedfdc17255223241c25cf726)) +* **api:** update via SDK Studio ([#357](https://github.com/cloudflare/cloudflare-python/issues/357)) ([d7aa7ad](https://github.com/cloudflare/cloudflare-python/commit/d7aa7ad0d70f5716a0476330b1e382706ca51857)) +* **api:** update via SDK Studio ([#360](https://github.com/cloudflare/cloudflare-python/issues/360)) ([327dd08](https://github.com/cloudflare/cloudflare-python/commit/327dd08f4a69d2b9667c7c46c4fb110eb0f92cfa)) + ## 3.0.0-beta.7 (2024-04-01) Full Changelog: [v3.0.0-beta.6...v3.0.0-beta.7](https://github.com/cloudflare/cloudflare-python/compare/v3.0.0-beta.6...v3.0.0-beta.7) diff --git a/README.md b/README.md index 41f43f1232d..b906c8581bf 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ from cloudflare import Cloudflare client = Cloudflare( # This is the default and can be omitted api_email=os.environ.get("CLOUDFLARE_EMAIL"), + # This is the default and can be omitted + api_key=os.environ.get("CLOUDFLARE_API_KEY"), ) zone = client.zones.create( @@ -57,6 +59,8 @@ from cloudflare import AsyncCloudflare client = AsyncCloudflare( # This is the default and can be omitted api_email=os.environ.get("CLOUDFLARE_EMAIL"), + # This is the default and can be omitted + api_key=os.environ.get("CLOUDFLARE_API_KEY"), ) @@ -76,10 +80,10 @@ Functionality between the synchronous and asynchronous clients is otherwise iden ## Using types -Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev), which provide helper methods for things like: +Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like: -- Serializing back into JSON, `model.model_dump_json(indent=2, exclude_unset=True)` -- Converting to a dictionary, `model.model_dump(exclude_unset=True)` +- Serializing back into JSON, `model.to_json()` +- Converting to a dictionary, `model.to_dict()` Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. @@ -352,13 +356,12 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c - Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality ```python -import httpx -from cloudflare import Cloudflare +from cloudflare import Cloudflare, DefaultHttpxClient client = Cloudflare( # Or use the `CLOUDFLARE_BASE_URL` env var base_url="http://my.test.server.example.com:8083", - http_client=httpx.Client( + http_client=DefaultHttpxClient( proxies="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), diff --git a/api.md b/api.md index 503c59f2ae6..c71a3bef468 100644 --- a/api.md +++ b/api.md @@ -1,7 +1,21 @@ # Shared Types ```python -from cloudflare.types import ErrorData +from cloudflare.types import ( + ASN, + AuditLog, + CloudflareTunnel, + ErrorData, + Identifier, + LoadBalancerPreview, + Member, + PaginationInfo, + Permission, + PermissionGrant, + ResponseInfo, + Result, + Role, +) ``` # Accounts @@ -9,47 +23,47 @@ from cloudflare.types import ErrorData Types: ```python -from cloudflare.types import Account, AccountUpdateResponse, AccountListResponse, AccountGetResponse +from cloudflare.types.accounts import ( + Account, + AccountUpdateResponse, + AccountListResponse, + AccountGetResponse, +) ``` Methods: -- client.accounts.update(\*, account_id, \*\*params) -> AccountUpdateResponse -- client.accounts.list(\*\*params) -> SyncV4PagePaginationArray[object] -- client.accounts.get(\*, account_id) -> AccountGetResponse +- client.accounts.update(\*, account_id, \*\*params) -> AccountUpdateResponse +- client.accounts.list(\*\*params) -> SyncV4PagePaginationArray[object] +- client.accounts.get(\*, account_id) -> AccountGetResponse ## Members Types: ```python -from cloudflare.types.accounts import ( - AccountMember, - AccountMemberWithID, - MemberListResponse, - MemberDeleteResponse, -) +from cloudflare.types.accounts import UserWithInviteCode, MemberListResponse, MemberDeleteResponse ``` Methods: -- client.accounts.members.create(\*, account_id, \*\*params) -> AccountMemberWithID -- client.accounts.members.update(member_id, \*, account_id, \*\*params) -> AccountMember +- client.accounts.members.create(\*, account_id, \*\*params) -> UserWithInviteCode +- client.accounts.members.update(member_id, \*, account_id, \*\*params) -> Member - client.accounts.members.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[MemberListResponse] -- client.accounts.members.delete(member_id, \*, account_id) -> Optional -- client.accounts.members.get(member_id, \*, account_id) -> AccountMember +- client.accounts.members.delete(member_id, \*, account_id, \*\*params) -> Optional +- client.accounts.members.get(member_id, \*, account_id) -> Member ## Roles Types: ```python -from cloudflare.types.accounts import Role, RoleGetResponse +from cloudflare.types.accounts import RoleGetResponse ``` Methods: -- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[Role] +- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[Role] - client.accounts.roles.get(role_id, \*, account_id) -> RoleGetResponse # OriginCACertificates @@ -57,7 +71,7 @@ Methods: Types: ```python -from cloudflare.types import ( +from cloudflare.types.origin_ca_certificates import ( OriginCACertificate, OriginCACertificateCreateResponse, OriginCACertificateDeleteResponse, @@ -67,29 +81,29 @@ from cloudflare.types import ( Methods: -- client.origin_ca_certificates.create(\*\*params) -> OriginCACertificateCreateResponse -- client.origin_ca_certificates.list() -> SyncSinglePage[OriginCACertificate] -- client.origin_ca_certificates.delete(certificate_id) -> OriginCACertificateDeleteResponse -- client.origin_ca_certificates.get(certificate_id) -> OriginCACertificateGetResponse +- client.origin_ca_certificates.create(\*\*params) -> OriginCACertificateCreateResponse +- client.origin_ca_certificates.list(\*\*params) -> SyncSinglePage[OriginCACertificate] +- client.origin_ca_certificates.delete(certificate_id, \*\*params) -> OriginCACertificateDeleteResponse +- client.origin_ca_certificates.get(certificate_id) -> OriginCACertificateGetResponse # IPs Types: ```python -from cloudflare.types import IPs, JDCloudIPs, IPListResponse +from cloudflare.types.ips import IPs, JDCloudIPs, IPListResponse ``` Methods: -- client.ips.list(\*\*params) -> IPListResponse +- client.ips.list(\*\*params) -> Optional # Memberships Types: ```python -from cloudflare.types import ( +from cloudflare.types.memberships import ( Membership, MembershipUpdateResponse, MembershipDeleteResponse, @@ -99,35 +113,29 @@ from cloudflare.types import ( Methods: -- client.memberships.update(membership_id, \*\*params) -> MembershipUpdateResponse -- client.memberships.list(\*\*params) -> SyncV4PagePaginationArray[Membership] -- client.memberships.delete(membership_id) -> MembershipDeleteResponse -- client.memberships.get(membership_id) -> MembershipGetResponse +- client.memberships.update(membership_id, \*\*params) -> MembershipUpdateResponse +- client.memberships.list(\*\*params) -> SyncV4PagePaginationArray[Membership] +- client.memberships.delete(membership_id, \*\*params) -> MembershipDeleteResponse +- client.memberships.get(membership_id) -> MembershipGetResponse -# UserResource +# User Types: ```python -from cloudflare.types import User, UserEditResponse, UserGetResponse +from cloudflare.types.user import UserEditResponse, UserGetResponse ``` Methods: -- client.user.edit(\*\*params) -> UserEditResponse -- client.user.get() -> UserGetResponse +- client.user.edit(\*\*params) -> UserEditResponse +- client.user.get() -> UserGetResponse ## AuditLogs -Types: - -```python -from cloudflare.types.user import AuditLogListResponse -``` - Methods: -- client.user.audit_logs.list(\*\*params) -> SyncV4PagePaginationArray[AuditLogListResponse] +- client.user.audit_logs.list(\*\*params) -> SyncV4PagePaginationArray[AuditLog] ## Billing @@ -136,12 +144,12 @@ Methods: Types: ```python -from cloudflare.types.user.billing import BillingHistory, HistoryGetResponse +from cloudflare.types.user.billing import BillingHistory ``` Methods: -- client.user.billing.history.get(\*\*params) -> Optional +- client.user.billing.history.list(\*\*params) -> SyncV4PagePaginationArray[BillingHistory] ### Profile @@ -155,120 +163,20 @@ Methods: - client.user.billing.profile.get() -> ProfileGetResponse -## Firewall - -### AccessRules - -Types: - -```python -from cloudflare.types.user.firewall import FirewallRule, AccessRuleDeleteResponse -``` - -Methods: - -- client.user.firewall.access_rules.create(\*\*params) -> Optional -- client.user.firewall.access_rules.list(\*\*params) -> SyncV4PagePaginationArray[FirewallRule] -- client.user.firewall.access_rules.delete(identifier) -> Optional -- client.user.firewall.access_rules.edit(identifier, \*\*params) -> Optional - ## Invites Types: ```python -from cloudflare.types.user import ( - UserInvite, - InviteListResponse, - InviteEditResponse, - InviteGetResponse, -) +from cloudflare.types.user import Invite, InviteEditResponse, InviteGetResponse ``` Methods: -- client.user.invites.list() -> SyncSinglePage[InviteListResponse] +- client.user.invites.list() -> SyncSinglePage[Invite] - client.user.invites.edit(invite_id, \*\*params) -> InviteEditResponse - client.user.invites.get(invite_id) -> InviteGetResponse -## LoadBalancers - -### Monitors - -Types: - -```python -from cloudflare.types.user.load_balancers import ( - LoadBalancingMonitor, - MonitorDeleteResponse, - MonitorPreviewResponse, - MonitorReferencesResponse, -) -``` - -Methods: - -- client.user.load_balancers.monitors.create(\*\*params) -> LoadBalancingMonitor -- client.user.load_balancers.monitors.update(monitor_id, \*\*params) -> LoadBalancingMonitor -- client.user.load_balancers.monitors.list() -> SyncSinglePage[LoadBalancingMonitor] -- client.user.load_balancers.monitors.delete(monitor_id) -> MonitorDeleteResponse -- client.user.load_balancers.monitors.edit(monitor_id, \*\*params) -> LoadBalancingMonitor -- client.user.load_balancers.monitors.get(monitor_id) -> LoadBalancingMonitor -- client.user.load_balancers.monitors.preview(monitor_id, \*\*params) -> MonitorPreviewResponse -- client.user.load_balancers.monitors.references(monitor_id) -> Optional - -### Pools - -Types: - -```python -from cloudflare.types.user.load_balancers import ( - LoadBalancingPool, - PoolDeleteResponse, - PoolHealthResponse, - PoolPreviewResponse, - PoolReferencesResponse, -) -``` - -Methods: - -- client.user.load_balancers.pools.create(\*\*params) -> LoadBalancingPool -- client.user.load_balancers.pools.update(pool_id, \*\*params) -> LoadBalancingPool -- client.user.load_balancers.pools.list(\*\*params) -> SyncSinglePage[LoadBalancingPool] -- client.user.load_balancers.pools.delete(pool_id) -> PoolDeleteResponse -- client.user.load_balancers.pools.edit(pool_id, \*\*params) -> LoadBalancingPool -- client.user.load_balancers.pools.get(pool_id) -> LoadBalancingPool -- client.user.load_balancers.pools.health(pool_id) -> PoolHealthResponse -- client.user.load_balancers.pools.preview(pool_id, \*\*params) -> PoolPreviewResponse -- client.user.load_balancers.pools.references(pool_id) -> Optional - -### Preview - -Types: - -```python -from cloudflare.types.user.load_balancers import LoadBalancingPreview -``` - -Methods: - -- client.user.load_balancers.preview.get(preview_id) -> LoadBalancingPreview - -### Analytics - -#### Events - -Types: - -```python -from cloudflare.types.user.load_balancers.analytics import LoadBalancingAnalytics -``` - -Methods: - -- client.user.load_balancers.analytics.events.list(\*\*params) -> SyncSinglePage[LoadBalancingAnalytics] - ## Organizations Types: @@ -280,7 +188,7 @@ from cloudflare.types.user import Organization, OrganizationDeleteResponse, Orga Methods: - client.user.organizations.list(\*\*params) -> SyncV4PagePaginationArray[Organization] -- client.user.organizations.delete(organization_id) -> OrganizationDeleteResponse +- client.user.organizations.delete(organization_id, \*\*params) -> OrganizationDeleteResponse - client.user.organizations.get(organization_id) -> OrganizationGetResponse ## Subscriptions @@ -289,7 +197,10 @@ Types: ```python from cloudflare.types.user import ( + RatePlan, Subscription, + SubscriptionComponent, + SubscriptionZone, SubscriptionUpdateResponse, SubscriptionDeleteResponse, SubscriptionEditResponse, @@ -300,7 +211,7 @@ from cloudflare.types.user import ( Methods: - client.user.subscriptions.update(identifier, \*\*params) -> SubscriptionUpdateResponse -- client.user.subscriptions.delete(identifier) -> SubscriptionDeleteResponse +- client.user.subscriptions.delete(identifier, \*\*params) -> SubscriptionDeleteResponse - client.user.subscriptions.edit(identifier, \*\*params) -> SubscriptionEditResponse - client.user.subscriptions.get() -> Optional @@ -310,6 +221,9 @@ Types: ```python from cloudflare.types.user import ( + CIDRList, + Policy, + Token, TokenCreateResponse, TokenUpdateResponse, TokenListResponse, @@ -324,7 +238,7 @@ Methods: - client.user.tokens.create(\*\*params) -> TokenCreateResponse - client.user.tokens.update(token_id, \*\*params) -> TokenUpdateResponse - client.user.tokens.list(\*\*params) -> SyncV4PagePaginationArray[object] -- client.user.tokens.delete(token_id) -> Optional +- client.user.tokens.delete(token_id, \*\*params) -> Optional - client.user.tokens.get(token_id) -> TokenGetResponse - client.user.tokens.verify() -> TokenVerifyResponse @@ -345,28 +259,28 @@ Methods: Types: ```python -from cloudflare.types.user.tokens import TokenValue +from cloudflare.types.user.tokens import Value ``` Methods: -- client.user.tokens.value.update(token_id, \*\*params) -> str +- client.user.tokens.value.update(token_id, \*\*params) -> str # Zones Types: ```python -from cloudflare.types import Zone, ZoneDeleteResponse +from cloudflare.types.zones import Zone, ZoneDeleteResponse ``` Methods: -- client.zones.create(\*\*params) -> Optional -- client.zones.list(\*\*params) -> SyncV4PagePaginationArray[Zone] -- client.zones.delete(\*, zone_id) -> Optional -- client.zones.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.get(\*, zone_id) -> Optional +- client.zones.create(\*\*params) -> Optional +- client.zones.list(\*\*params) -> SyncV4PagePaginationArray[Zone] +- client.zones.delete(\*, zone_id) -> Optional +- client.zones.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.get(\*, zone_id) -> Optional ## ActivationCheck @@ -378,435 +292,424 @@ from cloudflare.types.zones import ActivationCheckTriggerResponse Methods: -- client.zones.activation_check.trigger(\*, zone_id) -> ActivationCheckTriggerResponse +- client.zones.activation_check.trigger(\*, zone_id) -> Optional ## DNSSettings Types: ```python -from cloudflare.types.zones import DNSSettingEditResponse, DNSSettingGetResponse +from cloudflare.types.zones import DNSSetting, Nameserver ``` Methods: -- client.zones.dns_settings.edit(\*, zone_id, \*\*params) -> DNSSettingEditResponse -- client.zones.dns_settings.get(\*, zone_id) -> DNSSettingGetResponse +- client.zones.dns_settings.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.dns_settings.get(\*, zone_id) -> Optional ## Settings -Types: - -```python -from cloudflare.types.zones import SettingEditResponse, SettingGetResponse -``` - -Methods: - -- client.zones.settings.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.get(\*, zone_id) -> Optional - ### ZeroRTT Types: ```python -from cloudflare.types.zones.settings import ZoneSetting0rtt +from cloudflare.types.zones.settings import ZeroRTT ``` Methods: -- client.zones.settings.zero_rtt.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.zero_rtt.get(\*, zone_id) -> Optional +- client.zones.settings.zero_rtt.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.zero_rtt.get(\*, zone_id) -> Optional ### AdvancedDDoS Types: ```python -from cloudflare.types.zones.settings import ZoneSettingAdvancedDDoS +from cloudflare.types.zones.settings import AdvancedDDoS ``` Methods: -- client.zones.settings.advanced_ddos.get(\*, zone_id) -> Optional +- client.zones.settings.advanced_ddos.get(\*, zone_id) -> Optional ### AlwaysOnline Types: ```python -from cloudflare.types.zones.settings import ZoneSettingAlwaysOnline +from cloudflare.types.zones.settings import AlwaysOnline ``` Methods: -- client.zones.settings.always_online.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.always_online.get(\*, zone_id) -> Optional +- client.zones.settings.always_online.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.always_online.get(\*, zone_id) -> Optional ### AlwaysUseHTTPS Types: ```python -from cloudflare.types.zones.settings import ZoneSettingAlwaysUseHTTPS +from cloudflare.types.zones.settings import AlwaysUseHTTPS ``` Methods: -- client.zones.settings.always_use_https.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.always_use_https.get(\*, zone_id) -> Optional +- client.zones.settings.always_use_https.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.always_use_https.get(\*, zone_id) -> Optional ### AutomaticHTTPSRewrites Types: ```python -from cloudflare.types.zones.settings import ZoneSettingAutomaticHTTPSRewrites +from cloudflare.types.zones.settings import AutomaticHTTPSRewrites ``` Methods: -- client.zones.settings.automatic_https_rewrites.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.automatic_https_rewrites.get(\*, zone_id) -> Optional +- client.zones.settings.automatic_https_rewrites.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.automatic_https_rewrites.get(\*, zone_id) -> Optional ### AutomaticPlatformOptimization Types: ```python -from cloudflare.types.zones.settings import ZoneSettingAutomaticPlatformOptimization +from cloudflare.types.zones.settings import AutomaticPlatformOptimization ``` Methods: -- client.zones.settings.automatic_platform_optimization.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.automatic_platform_optimization.get(\*, zone_id) -> Optional +- client.zones.settings.automatic_platform_optimization.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.automatic_platform_optimization.get(\*, zone_id) -> Optional ### Brotli Types: ```python -from cloudflare.types.zones.settings import ZoneSettingBrotli +from cloudflare.types.zones.settings import Brotli ``` Methods: -- client.zones.settings.brotli.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.brotli.get(\*, zone_id) -> Optional +- client.zones.settings.brotli.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.brotli.get(\*, zone_id) -> Optional ### BrowserCacheTTL Types: ```python -from cloudflare.types.zones.settings import ZoneSettingBrowserCacheTTL +from cloudflare.types.zones.settings import BrowserCacheTTL ``` Methods: -- client.zones.settings.browser_cache_ttl.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.browser_cache_ttl.get(\*, zone_id) -> Optional +- client.zones.settings.browser_cache_ttl.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.browser_cache_ttl.get(\*, zone_id) -> Optional ### BrowserCheck Types: ```python -from cloudflare.types.zones.settings import ZoneSettingBrowserCheck +from cloudflare.types.zones.settings import BrowserCheck ``` Methods: -- client.zones.settings.browser_check.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.browser_check.get(\*, zone_id) -> Optional +- client.zones.settings.browser_check.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.browser_check.get(\*, zone_id) -> Optional ### CacheLevel Types: ```python -from cloudflare.types.zones.settings import ZoneSettingCacheLevel +from cloudflare.types.zones.settings import CacheLevel ``` Methods: -- client.zones.settings.cache_level.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.cache_level.get(\*, zone_id) -> Optional +- client.zones.settings.cache_level.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.cache_level.get(\*, zone_id) -> Optional ### ChallengeTTL Types: ```python -from cloudflare.types.zones.settings import ZoneSettingChallengeTTL +from cloudflare.types.zones.settings import ChallengeTTL ``` Methods: -- client.zones.settings.challenge_ttl.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.challenge_ttl.get(\*, zone_id) -> Optional +- client.zones.settings.challenge_ttl.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.challenge_ttl.get(\*, zone_id) -> Optional ### Ciphers Types: ```python -from cloudflare.types.zones.settings import ZoneSettingCiphers +from cloudflare.types.zones.settings import Ciphers ``` Methods: -- client.zones.settings.ciphers.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ciphers.get(\*, zone_id) -> Optional +- client.zones.settings.ciphers.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.ciphers.get(\*, zone_id) -> Optional ### DevelopmentMode Types: ```python -from cloudflare.types.zones.settings import ZoneSettingDevelopmentMode +from cloudflare.types.zones.settings import DevelopmentMode ``` Methods: -- client.zones.settings.development_mode.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.development_mode.get(\*, zone_id) -> Optional +- client.zones.settings.development_mode.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.development_mode.get(\*, zone_id) -> Optional ### EarlyHints Types: ```python -from cloudflare.types.zones.settings import ZoneSettingEarlyHints +from cloudflare.types.zones.settings import EarlyHints ``` Methods: -- client.zones.settings.early_hints.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.early_hints.get(\*, zone_id) -> Optional +- client.zones.settings.early_hints.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.early_hints.get(\*, zone_id) -> Optional ### EmailObfuscation Types: ```python -from cloudflare.types.zones.settings import ZoneSettingEmailObfuscation +from cloudflare.types.zones.settings import EmailObfuscation ``` Methods: -- client.zones.settings.email_obfuscation.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.email_obfuscation.get(\*, zone_id) -> Optional +- client.zones.settings.email_obfuscation.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.email_obfuscation.get(\*, zone_id) -> Optional ### H2Prioritization Types: ```python -from cloudflare.types.zones.settings import ZoneSettingH2Prioritization +from cloudflare.types.zones.settings import H2Prioritization ``` Methods: -- client.zones.settings.h2_prioritization.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.h2_prioritization.get(\*, zone_id) -> Optional +- client.zones.settings.h2_prioritization.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.h2_prioritization.get(\*, zone_id) -> Optional ### HotlinkProtection Types: ```python -from cloudflare.types.zones.settings import ZoneSettingHotlinkProtection +from cloudflare.types.zones.settings import HotlinkProtection ``` Methods: -- client.zones.settings.hotlink_protection.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.hotlink_protection.get(\*, zone_id) -> Optional +- client.zones.settings.hotlink_protection.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.hotlink_protection.get(\*, zone_id) -> Optional ### HTTP2 Types: ```python -from cloudflare.types.zones.settings import ZoneSettingHTTP2 +from cloudflare.types.zones.settings import HTTP2 ``` Methods: -- client.zones.settings.http2.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.http2.get(\*, zone_id) -> Optional +- client.zones.settings.http2.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.http2.get(\*, zone_id) -> Optional ### HTTP3 Types: ```python -from cloudflare.types.zones.settings import ZoneSettingHTTP3 +from cloudflare.types.zones.settings import HTTP3 ``` Methods: -- client.zones.settings.http3.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.http3.get(\*, zone_id) -> Optional +- client.zones.settings.http3.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.http3.get(\*, zone_id) -> Optional ### ImageResizing Types: ```python -from cloudflare.types.zones.settings import ZoneSettingImageResizing +from cloudflare.types.zones.settings import ImageResizing ``` Methods: -- client.zones.settings.image_resizing.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.image_resizing.get(\*, zone_id) -> Optional +- client.zones.settings.image_resizing.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.image_resizing.get(\*, zone_id) -> Optional ### IPGeolocation Types: ```python -from cloudflare.types.zones.settings import ZoneSettingIPGeolocation +from cloudflare.types.zones.settings import IPGeolocation ``` Methods: -- client.zones.settings.ip_geolocation.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ip_geolocation.get(\*, zone_id) -> Optional +- client.zones.settings.ip_geolocation.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.ip_geolocation.get(\*, zone_id) -> Optional ### IPV6 Types: ```python -from cloudflare.types.zones.settings import ZoneSettingIPV6 +from cloudflare.types.zones.settings import IPV6 ``` Methods: -- client.zones.settings.ipv6.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ipv6.get(\*, zone_id) -> Optional +- client.zones.settings.ipv6.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.ipv6.get(\*, zone_id) -> Optional ### MinTLSVersion Types: ```python -from cloudflare.types.zones.settings import ZoneSettingMinTLSVersion +from cloudflare.types.zones.settings import MinTLSVersion ``` Methods: -- client.zones.settings.min_tls_version.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.min_tls_version.get(\*, zone_id) -> Optional +- client.zones.settings.min_tls_version.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.min_tls_version.get(\*, zone_id) -> Optional ### Minify Types: ```python -from cloudflare.types.zones.settings import ZoneSettingMinify +from cloudflare.types.zones.settings import Minify ``` Methods: -- client.zones.settings.minify.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.minify.get(\*, zone_id) -> Optional +- client.zones.settings.minify.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.minify.get(\*, zone_id) -> Optional ### Mirage Types: ```python -from cloudflare.types.zones.settings import ZoneSettingMirage +from cloudflare.types.zones.settings import Mirage ``` Methods: -- client.zones.settings.mirage.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.mirage.get(\*, zone_id) -> Optional +- client.zones.settings.mirage.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.mirage.get(\*, zone_id) -> Optional ### MobileRedirect Types: ```python -from cloudflare.types.zones.settings import ZoneSettingMobileRedirect +from cloudflare.types.zones.settings import MobileRedirect ``` Methods: -- client.zones.settings.mobile_redirect.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.mobile_redirect.get(\*, zone_id) -> Optional +- client.zones.settings.mobile_redirect.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.mobile_redirect.get(\*, zone_id) -> Optional ### NEL Types: ```python -from cloudflare.types.zones.settings import ZoneSettingNEL +from cloudflare.types.zones.settings import NEL ``` Methods: -- client.zones.settings.nel.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.nel.get(\*, zone_id) -> Optional +- client.zones.settings.nel.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.nel.get(\*, zone_id) -> Optional ### OpportunisticEncryption Types: ```python -from cloudflare.types.zones.settings import ZoneSettingOpportunisticEncryption +from cloudflare.types.zones.settings import OpportunisticEncryption ``` Methods: -- client.zones.settings.opportunistic_encryption.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.opportunistic_encryption.get(\*, zone_id) -> Optional +- client.zones.settings.opportunistic_encryption.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.opportunistic_encryption.get(\*, zone_id) -> Optional ### OpportunisticOnion Types: ```python -from cloudflare.types.zones.settings import ZoneSettingOpportunisticOnion +from cloudflare.types.zones.settings import OpportunisticOnion ``` Methods: -- client.zones.settings.opportunistic_onion.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.opportunistic_onion.get(\*, zone_id) -> Optional +- client.zones.settings.opportunistic_onion.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.opportunistic_onion.get(\*, zone_id) -> Optional ### OrangeToOrange Types: ```python -from cloudflare.types.zones.settings import ZoneSettingOrangeToOrange +from cloudflare.types.zones.settings import OrangeToOrange ``` Methods: -- client.zones.settings.orange_to_orange.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.orange_to_orange.get(\*, zone_id) -> Optional +- client.zones.settings.orange_to_orange.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.orange_to_orange.get(\*, zone_id) -> Optional ### OriginErrorPagePassThru Types: ```python -from cloudflare.types.zones.settings import ZoneSettingOriginErrorPagePassThru +from cloudflare.types.zones.settings import OriginErrorPagePassThru ``` Methods: -- client.zones.settings.origin_error_page_pass_thru.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.origin_error_page_pass_thru.get(\*, zone_id) -> Optional +- client.zones.settings.origin_error_page_pass_thru.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.origin_error_page_pass_thru.get(\*, zone_id) -> Optional ### OriginMaxHTTPVersion @@ -814,6 +717,7 @@ Types: ```python from cloudflare.types.zones.settings import ( + OriginMaxHTTPVersion, OriginMaxHTTPVersionEditResponse, OriginMaxHTTPVersionGetResponse, ) @@ -829,247 +733,247 @@ Methods: Types: ```python -from cloudflare.types.zones.settings import ZoneSettingPolish +from cloudflare.types.zones.settings import Polish ``` Methods: -- client.zones.settings.polish.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.polish.get(\*, zone_id) -> Optional +- client.zones.settings.polish.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.polish.get(\*, zone_id) -> Optional ### PrefetchPreload Types: ```python -from cloudflare.types.zones.settings import ZoneSettingPrefetchPreload +from cloudflare.types.zones.settings import PrefetchPreload ``` Methods: -- client.zones.settings.prefetch_preload.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.prefetch_preload.get(\*, zone_id) -> Optional +- client.zones.settings.prefetch_preload.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.prefetch_preload.get(\*, zone_id) -> Optional ### ProxyReadTimeout Types: ```python -from cloudflare.types.zones.settings import ZoneSettingProxyReadTimeout +from cloudflare.types.zones.settings import ProxyReadTimeout ``` Methods: -- client.zones.settings.proxy_read_timeout.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.proxy_read_timeout.get(\*, zone_id) -> Optional +- client.zones.settings.proxy_read_timeout.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.proxy_read_timeout.get(\*, zone_id) -> Optional ### PseudoIPV4 Types: ```python -from cloudflare.types.zones.settings import ZoneSettingPseudoIPV4 +from cloudflare.types.zones.settings import PseudoIPV4 ``` Methods: -- client.zones.settings.pseudo_ipv4.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.pseudo_ipv4.get(\*, zone_id) -> Optional +- client.zones.settings.pseudo_ipv4.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.pseudo_ipv4.get(\*, zone_id) -> Optional ### ResponseBuffering Types: ```python -from cloudflare.types.zones.settings import ZoneSettingBuffering +from cloudflare.types.zones.settings import ResponseBuffering ``` Methods: -- client.zones.settings.response_buffering.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.response_buffering.get(\*, zone_id) -> Optional +- client.zones.settings.response_buffering.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.response_buffering.get(\*, zone_id) -> Optional ### RocketLoader Types: ```python -from cloudflare.types.zones.settings import ZoneSettingRocketLoader +from cloudflare.types.zones.settings import RocketLoader ``` Methods: -- client.zones.settings.rocket_loader.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.rocket_loader.get(\*, zone_id) -> Optional +- client.zones.settings.rocket_loader.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.rocket_loader.get(\*, zone_id) -> Optional ### SecurityHeaders Types: ```python -from cloudflare.types.zones.settings import ZoneSettingSecurityHeader +from cloudflare.types.zones.settings import SecurityHeaders ``` Methods: -- client.zones.settings.security_headers.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.security_headers.get(\*, zone_id) -> Optional +- client.zones.settings.security_headers.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.security_headers.get(\*, zone_id) -> Optional ### SecurityLevel Types: ```python -from cloudflare.types.zones.settings import ZoneSettingSecurityLevel +from cloudflare.types.zones.settings import SecurityLevel ``` Methods: -- client.zones.settings.security_level.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.security_level.get(\*, zone_id) -> Optional +- client.zones.settings.security_level.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.security_level.get(\*, zone_id) -> Optional ### ServerSideExcludes Types: ```python -from cloudflare.types.zones.settings import ZoneSettingServerSideExclude +from cloudflare.types.zones.settings import ServerSideExcludes ``` Methods: -- client.zones.settings.server_side_excludes.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.server_side_excludes.get(\*, zone_id) -> Optional +- client.zones.settings.server_side_excludes.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.server_side_excludes.get(\*, zone_id) -> Optional ### SortQueryStringForCache Types: ```python -from cloudflare.types.zones.settings import ZoneSettingSortQueryStringForCache +from cloudflare.types.zones.settings import SortQueryStringForCache ``` Methods: -- client.zones.settings.sort_query_string_for_cache.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.sort_query_string_for_cache.get(\*, zone_id) -> Optional +- client.zones.settings.sort_query_string_for_cache.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.sort_query_string_for_cache.get(\*, zone_id) -> Optional ### SSL Types: ```python -from cloudflare.types.zones.settings import ZoneSettingSSL +from cloudflare.types.zones.settings import SSL ``` Methods: -- client.zones.settings.ssl.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ssl.get(\*, zone_id) -> Optional +- client.zones.settings.ssl.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.ssl.get(\*, zone_id) -> Optional ### SSLRecommender Types: ```python -from cloudflare.types.zones.settings import ZoneSettingSSLRecommender +from cloudflare.types.zones.settings import SSLRecommender ``` Methods: -- client.zones.settings.ssl_recommender.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ssl_recommender.get(\*, zone_id) -> Optional +- client.zones.settings.ssl_recommender.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.ssl_recommender.get(\*, zone_id) -> Optional ### TLS1_3 Types: ```python -from cloudflare.types.zones.settings import ZoneSettingTLS1_3 +from cloudflare.types.zones.settings import TLS1_3 ``` Methods: -- client.zones.settings.tls_1_3.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.tls_1_3.get(\*, zone_id) -> Optional +- client.zones.settings.tls_1_3.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.tls_1_3.get(\*, zone_id) -> Optional ### TLSClientAuth Types: ```python -from cloudflare.types.zones.settings import ZoneSettingTLSClientAuth +from cloudflare.types.zones.settings import TLSClientAuth ``` Methods: -- client.zones.settings.tls_client_auth.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.tls_client_auth.get(\*, zone_id) -> Optional +- client.zones.settings.tls_client_auth.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.tls_client_auth.get(\*, zone_id) -> Optional ### TrueClientIPHeader Types: ```python -from cloudflare.types.zones.settings import ZoneSettingTrueClientIPHeader +from cloudflare.types.zones.settings import TrueClientIPHeader ``` Methods: -- client.zones.settings.true_client_ip_header.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.true_client_ip_header.get(\*, zone_id) -> Optional +- client.zones.settings.true_client_ip_header.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.true_client_ip_header.get(\*, zone_id) -> Optional ### WAF Types: ```python -from cloudflare.types.zones.settings import ZoneSettingWAF +from cloudflare.types.zones.settings import WAF ``` Methods: -- client.zones.settings.waf.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.waf.get(\*, zone_id) -> Optional +- client.zones.settings.waf.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.waf.get(\*, zone_id) -> Optional ### WebP Types: ```python -from cloudflare.types.zones.settings import ZoneSettingWebP +from cloudflare.types.zones.settings import WebP ``` Methods: -- client.zones.settings.webp.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.webp.get(\*, zone_id) -> Optional +- client.zones.settings.webp.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.webp.get(\*, zone_id) -> Optional ### Websocket Types: ```python -from cloudflare.types.zones.settings import ZoneSettingWebsockets +from cloudflare.types.zones.settings import Websocket ``` Methods: -- client.zones.settings.websocket.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.websocket.get(\*, zone_id) -> Optional +- client.zones.settings.websocket.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.websocket.get(\*, zone_id) -> Optional ### FontSettings Types: ```python -from cloudflare.types.zones.settings import ZoneSettingFonts +from cloudflare.types.zones.settings import FontSettings ``` Methods: -- client.zones.settings.font_settings.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.font_settings.get(\*, zone_id) -> Optional +- client.zones.settings.font_settings.edit(\*, zone_id, \*\*params) -> Optional +- client.zones.settings.font_settings.get(\*, zone_id) -> Optional ## CustomNameservers @@ -1089,47 +993,27 @@ Methods: Types: ```python -from cloudflare.types.zones import HoldCreateResponse, HoldDeleteResponse, HoldGetResponse +from cloudflare.types.zones import ZoneHold ``` Methods: -- client.zones.holds.create(\*, zone_id, \*\*params) -> HoldCreateResponse -- client.zones.holds.delete(\*, zone_id, \*\*params) -> Optional -- client.zones.holds.get(\*, zone_id) -> HoldGetResponse - -## Workers - -### Script - -Types: - -```python -from cloudflare.types.zones.workers import ScriptUpdateResponse -``` - -Methods: - -- client.zones.workers.script.update(\*, zone_id) -> ScriptUpdateResponse -- client.zones.workers.script.delete(\*, zone_id) -> None -- client.zones.workers.script.get(\*, zone_id) -> BinaryAPIResponse +- client.zones.holds.create(\*, zone_id, \*\*params) -> ZoneHold +- client.zones.holds.delete(\*, zone_id, \*\*params) -> Optional +- client.zones.holds.get(\*, zone_id) -> ZoneHold ## Subscriptions Types: ```python -from cloudflare.types.zones import ( - SubscriptionCreateResponse, - SubscriptionListResponse, - SubscriptionGetResponse, -) +from cloudflare.types.zones import SubscriptionCreateResponse, SubscriptionGetResponse ``` Methods: - client.zones.subscriptions.create(identifier, \*\*params) -> SubscriptionCreateResponse -- client.zones.subscriptions.list(account_identifier) -> SyncSinglePage[SubscriptionListResponse] +- client.zones.subscriptions.list(account_identifier) -> SyncSinglePage[Subscription] - client.zones.subscriptions.get(identifier) -> SubscriptionGetResponse # LoadBalancers @@ -1137,34 +1021,51 @@ Methods: Types: ```python -from cloudflare.types import LoadBalancer, LoadBalancerDeleteResponse +from cloudflare.types.load_balancers import ( + AdaptiveRouting, + CheckRegion, + DefaultPools, + FilterOptions, + Header, + Host, + LoadBalancer, + LoadShedding, + LocationStrategy, + NotificationFilter, + Origin, + OriginSteering, + RandomSteering, + Rules, + SessionAffinityAttributes, + LoadBalancerDeleteResponse, +) ``` Methods: -- client.load_balancers.create(\*, zone_id, \*\*params) -> LoadBalancer -- client.load_balancers.update(load_balancer_id, \*, zone_id, \*\*params) -> LoadBalancer -- client.load_balancers.list(\*, zone_id) -> SyncSinglePage[LoadBalancer] -- client.load_balancers.delete(load_balancer_id, \*, zone_id) -> LoadBalancerDeleteResponse -- client.load_balancers.edit(load_balancer_id, \*, zone_id, \*\*params) -> LoadBalancer -- client.load_balancers.get(load_balancer_id, \*, zone_id) -> LoadBalancer +- client.load_balancers.create(\*, zone_id, \*\*params) -> LoadBalancer +- client.load_balancers.update(load_balancer_id, \*, zone_id, \*\*params) -> LoadBalancer +- client.load_balancers.list(\*, zone_id) -> SyncSinglePage[LoadBalancer] +- client.load_balancers.delete(load_balancer_id, \*, zone_id, \*\*params) -> LoadBalancerDeleteResponse +- client.load_balancers.edit(load_balancer_id, \*, zone_id, \*\*params) -> LoadBalancer +- client.load_balancers.get(load_balancer_id, \*, zone_id) -> LoadBalancer ## Monitors Types: ```python -from cloudflare.types.load_balancers import MonitorDeleteResponse +from cloudflare.types.load_balancers import Monitor, MonitorDeleteResponse ``` Methods: -- client.load_balancers.monitors.create(\*, account_id, \*\*params) -> LoadBalancingMonitor -- client.load_balancers.monitors.update(monitor_id, \*, account_id, \*\*params) -> LoadBalancingMonitor -- client.load_balancers.monitors.list(\*, account_id) -> SyncSinglePage[LoadBalancingMonitor] -- client.load_balancers.monitors.delete(monitor_id, \*, account_id) -> MonitorDeleteResponse -- client.load_balancers.monitors.edit(monitor_id, \*, account_id, \*\*params) -> LoadBalancingMonitor -- client.load_balancers.monitors.get(monitor_id, \*, account_id) -> LoadBalancingMonitor +- client.load_balancers.monitors.create(\*, account_id, \*\*params) -> Monitor +- client.load_balancers.monitors.update(monitor_id, \*, account_id, \*\*params) -> Monitor +- client.load_balancers.monitors.list(\*, account_id) -> SyncSinglePage[Monitor] +- client.load_balancers.monitors.delete(monitor_id, \*, account_id, \*\*params) -> MonitorDeleteResponse +- client.load_balancers.monitors.edit(monitor_id, \*, account_id, \*\*params) -> Monitor +- client.load_balancers.monitors.get(monitor_id, \*, account_id) -> Monitor ### Previews @@ -1195,17 +1096,17 @@ Methods: Types: ```python -from cloudflare.types.load_balancers import PoolDeleteResponse +from cloudflare.types.load_balancers import Pool, PoolDeleteResponse ``` Methods: -- client.load_balancers.pools.create(\*, account_id, \*\*params) -> LoadBalancingPool -- client.load_balancers.pools.update(pool_id, \*, account_id, \*\*params) -> LoadBalancingPool -- client.load_balancers.pools.list(\*, account_id, \*\*params) -> SyncSinglePage[LoadBalancingPool] -- client.load_balancers.pools.delete(pool_id, \*, account_id) -> PoolDeleteResponse -- client.load_balancers.pools.edit(pool_id, \*, account_id, \*\*params) -> LoadBalancingPool -- client.load_balancers.pools.get(pool_id, \*, account_id) -> LoadBalancingPool +- client.load_balancers.pools.create(\*, account_id, \*\*params) -> Pool +- client.load_balancers.pools.update(pool_id, \*, account_id, \*\*params) -> Pool +- client.load_balancers.pools.list(\*, account_id, \*\*params) -> SyncSinglePage[Pool] +- client.load_balancers.pools.delete(pool_id, \*, account_id, \*\*params) -> PoolDeleteResponse +- client.load_balancers.pools.edit(pool_id, \*, account_id, \*\*params) -> Pool +- client.load_balancers.pools.get(pool_id, \*, account_id) -> Pool ### Health @@ -1234,9 +1135,15 @@ Methods: ## Previews +Types: + +```python +from cloudflare.types.load_balancers import PreviewGetResponse +``` + Methods: -- client.load_balancers.previews.get(preview_id, \*, account_id) -> LoadBalancingPreview +- client.load_balancers.previews.get(preview_id, \*, account_id) -> PreviewGetResponse ## Regions @@ -1268,12 +1175,12 @@ Methods: Types: ```python -from cloudflare.types import CachePurgeResponse +from cloudflare.types.cache import CachePurgeResponse ``` Methods: -- client.cache.purge(\*, zone_id, \*\*params) -> Optional +- client.cache.purge(\*, zone_id, \*\*params) -> Optional ## CacheReserve @@ -1281,6 +1188,8 @@ Types: ```python from cloudflare.types.cache import ( + CacheReserve, + CacheReserveClear, CacheReserveClearResponse, CacheReserveEditResponse, CacheReserveGetResponse, @@ -1290,7 +1199,7 @@ from cloudflare.types.cache import ( Methods: -- client.cache.cache_reserve.clear(\*, zone_id) -> CacheReserveClearResponse +- 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 @@ -1309,7 +1218,7 @@ from cloudflare.types.cache import ( Methods: -- client.cache.smart_tiered_cache.delete(\*, zone_id) -> SmartTieredCacheDeleteResponse +- client.cache.smart_tiered_cache.delete(\*, zone_id, \*\*params) -> SmartTieredCacheDeleteResponse - client.cache.smart_tiered_cache.edit(\*, zone_id, \*\*params) -> SmartTieredCacheEditResponse - client.cache.smart_tiered_cache.get(\*, zone_id) -> SmartTieredCacheGetResponse @@ -1318,12 +1227,17 @@ Methods: Types: ```python -from cloudflare.types.cache import CacheVariants, VariantEditResponse, VariantGetResponse +from cloudflare.types.cache import ( + CacheVariant, + CacheVariantIdentifier, + VariantEditResponse, + VariantGetResponse, +) ``` Methods: -- client.cache.variants.delete(\*, zone_id) -> CacheVariants +- client.cache.variants.delete(\*, zone_id, \*\*params) -> CacheVariant - client.cache.variants.edit(\*, zone_id, \*\*params) -> VariantEditResponse - client.cache.variants.get(\*, zone_id) -> VariantGetResponse @@ -1332,7 +1246,11 @@ Methods: Types: ```python -from cloudflare.types.cache import RegionalTieredCacheEditResponse, RegionalTieredCacheGetResponse +from cloudflare.types.cache import ( + RegionalTieredCache, + RegionalTieredCacheEditResponse, + RegionalTieredCacheGetResponse, +) ``` Methods: @@ -1360,6 +1278,7 @@ Types: ```python from cloudflare.types.ssl import ( + Host, CertificatePackListResponse, CertificatePackDeleteResponse, CertificatePackEditResponse, @@ -1370,8 +1289,8 @@ from cloudflare.types.ssl import ( Methods: - client.ssl.certificate_packs.list(\*, zone_id, \*\*params) -> SyncSinglePage[object] -- client.ssl.certificate_packs.delete(certificate_pack_id, \*, zone_id) -> CertificatePackDeleteResponse -- client.ssl.certificate_packs.edit(certificate_pack_id, \*, zone_id) -> CertificatePackEditResponse +- client.ssl.certificate_packs.delete(certificate_pack_id, \*, zone_id, \*\*params) -> CertificatePackDeleteResponse +- client.ssl.certificate_packs.edit(certificate_pack_id, \*, zone_id, \*\*params) -> CertificatePackEditResponse - client.ssl.certificate_packs.get(certificate_pack_id, \*, zone_id) -> CertificatePackGetResponse ### Order @@ -1430,11 +1349,7 @@ Methods: Types: ```python -from cloudflare.types.ssl import ( - TLSVerificationSetting, - VerificationEditResponse, - VerificationGetResponse, -) +from cloudflare.types.ssl import Verification, VerificationEditResponse, VerificationGetResponse ``` Methods: @@ -1447,10 +1362,9 @@ Methods: Types: ```python -from cloudflare.types import ( +from cloudflare.types.subscriptions import ( SubscriptionCreateResponse, SubscriptionUpdateResponse, - SubscriptionListResponse, SubscriptionDeleteResponse, SubscriptionGetResponse, ) @@ -1458,11 +1372,11 @@ from cloudflare.types import ( Methods: -- client.subscriptions.create(identifier, \*\*params) -> SubscriptionCreateResponse -- client.subscriptions.update(subscription_identifier, \*, account_identifier, \*\*params) -> SubscriptionUpdateResponse -- client.subscriptions.list(account_identifier) -> SyncSinglePage[SubscriptionListResponse] -- client.subscriptions.delete(subscription_identifier, \*, account_identifier) -> SubscriptionDeleteResponse -- client.subscriptions.get(identifier) -> SubscriptionGetResponse +- client.subscriptions.create(identifier, \*\*params) -> SubscriptionCreateResponse +- client.subscriptions.update(subscription_identifier, \*, account_identifier, \*\*params) -> SubscriptionUpdateResponse +- client.subscriptions.list(account_identifier) -> SyncSinglePage[Subscription] +- client.subscriptions.delete(subscription_identifier, \*, account_identifier, \*\*params) -> SubscriptionDeleteResponse +- client.subscriptions.get(identifier) -> SubscriptionGetResponse # ACM @@ -1512,25 +1426,25 @@ Methods: Types: ```python -from cloudflare.types import AvailableRatePlan +from cloudflare.types.plans import AvailableRatePlan ``` Methods: -- client.plans.list(zone_identifier) -> SyncSinglePage[AvailableRatePlan] -- client.plans.get(plan_identifier, \*, zone_identifier) -> AvailableRatePlan +- client.plans.list(zone_identifier) -> SyncSinglePage[AvailableRatePlan] +- client.plans.get(plan_identifier, \*, zone_identifier) -> AvailableRatePlan # RatePlans Types: ```python -from cloudflare.types import RatePlan, RatePlanGetResponse +from cloudflare.types.rate_plans import RatePlan, RatePlanGetResponse ``` Methods: -- client.rate_plans.get(zone_identifier) -> Optional +- client.rate_plans.get(zone_identifier) -> Optional # CertificateAuthorities @@ -1539,37 +1453,43 @@ Methods: Types: ```python -from cloudflare.types.certificate_authorities import TLSHostnameAssociation +from cloudflare.types.certificate_authorities import ( + HostnameAssociation, + TLSHostnameAssociation, + HostnameAssociationUpdateResponse, + HostnameAssociationGetResponse, +) ``` Methods: -- client.certificate_authorities.hostname_associations.update(\*, zone_id, \*\*params) -> TLSHostnameAssociation -- client.certificate_authorities.hostname_associations.get(\*, zone_id, \*\*params) -> TLSHostnameAssociation +- client.certificate_authorities.hostname_associations.update(\*, zone_id, \*\*params) -> HostnameAssociationUpdateResponse +- client.certificate_authorities.hostname_associations.get(\*, zone_id, \*\*params) -> HostnameAssociationGetResponse # ClientCertificates Types: ```python -from cloudflare.types import ClientCertificate +from cloudflare.types.client_certificates import ClientCertificate ``` Methods: -- client.client_certificates.create(\*, zone_id, \*\*params) -> ClientCertificate -- client.client_certificates.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[ClientCertificate] -- client.client_certificates.delete(client_certificate_id, \*, zone_id) -> ClientCertificate -- client.client_certificates.edit(client_certificate_id, \*, zone_id) -> ClientCertificate -- client.client_certificates.get(client_certificate_id, \*, zone_id) -> ClientCertificate +- client.client_certificates.create(\*, zone_id, \*\*params) -> ClientCertificate +- client.client_certificates.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[ClientCertificate] +- client.client_certificates.delete(client_certificate_id, \*, zone_id) -> ClientCertificate +- client.client_certificates.edit(client_certificate_id, \*, zone_id) -> ClientCertificate +- client.client_certificates.get(client_certificate_id, \*, zone_id) -> ClientCertificate # CustomCertificates Types: ```python -from cloudflare.types import ( +from cloudflare.types.custom_certificates import ( CustomCertificate, + GeoRestrictions, CustomCertificateCreateResponse, CustomCertificateDeleteResponse, CustomCertificateEditResponse, @@ -1579,11 +1499,11 @@ from cloudflare.types import ( Methods: -- client.custom_certificates.create(\*, zone_id, \*\*params) -> CustomCertificateCreateResponse -- client.custom_certificates.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[CustomCertificate] -- client.custom_certificates.delete(custom_certificate_id, \*, zone_id) -> CustomCertificateDeleteResponse -- client.custom_certificates.edit(custom_certificate_id, \*, zone_id, \*\*params) -> CustomCertificateEditResponse -- client.custom_certificates.get(custom_certificate_id, \*, zone_id) -> CustomCertificateGetResponse +- client.custom_certificates.create(\*, zone_id, \*\*params) -> CustomCertificateCreateResponse +- client.custom_certificates.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[CustomCertificate] +- client.custom_certificates.delete(custom_certificate_id, \*, zone_id, \*\*params) -> CustomCertificateDeleteResponse +- client.custom_certificates.edit(custom_certificate_id, \*, zone_id, \*\*params) -> CustomCertificateEditResponse +- client.custom_certificates.get(custom_certificate_id, \*, zone_id) -> CustomCertificateGetResponse ## Prioritize @@ -1602,8 +1522,11 @@ Methods: Types: ```python -from cloudflare.types import ( +from cloudflare.types.custom_hostnames import ( + BundleMethod, CustomHostname, + DCVMethod, + DomainValidationType, CustomHostnameCreateResponse, CustomHostnameListResponse, CustomHostnameDeleteResponse, @@ -1614,11 +1537,11 @@ from cloudflare.types import ( Methods: -- client.custom_hostnames.create(\*, zone_id, \*\*params) -> CustomHostnameCreateResponse -- client.custom_hostnames.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[CustomHostnameListResponse] -- client.custom_hostnames.delete(custom_hostname_id, \*, zone_id) -> CustomHostnameDeleteResponse -- client.custom_hostnames.edit(custom_hostname_id, \*, zone_id, \*\*params) -> CustomHostnameEditResponse -- client.custom_hostnames.get(custom_hostname_id, \*, zone_id) -> CustomHostnameGetResponse +- client.custom_hostnames.create(\*, zone_id, \*\*params) -> CustomHostnameCreateResponse +- client.custom_hostnames.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[CustomHostnameListResponse] +- client.custom_hostnames.delete(custom_hostname_id, \*, zone_id, \*\*params) -> CustomHostnameDeleteResponse +- client.custom_hostnames.edit(custom_hostname_id, \*, zone_id, \*\*params) -> CustomHostnameEditResponse +- client.custom_hostnames.get(custom_hostname_id, \*, zone_id) -> CustomHostnameGetResponse ## FallbackOrigin @@ -1635,7 +1558,7 @@ from cloudflare.types.custom_hostnames import ( Methods: - client.custom_hostnames.fallback_origin.update(\*, zone_id, \*\*params) -> FallbackOriginUpdateResponse -- client.custom_hostnames.fallback_origin.delete(\*, zone_id) -> FallbackOriginDeleteResponse +- client.custom_hostnames.fallback_origin.delete(\*, zone_id, \*\*params) -> FallbackOriginDeleteResponse - client.custom_hostnames.fallback_origin.get(\*, zone_id) -> FallbackOriginGetResponse # CustomNameservers @@ -1643,7 +1566,7 @@ Methods: Types: ```python -from cloudflare.types import ( +from cloudflare.types.custom_nameservers import ( CustomNameserver, CustomNameserverDeleteResponse, CustomNameserverAvailabiltyResponse, @@ -1654,21 +1577,51 @@ from cloudflare.types import ( Methods: -- client.custom_nameservers.create(\*, account_id, \*\*params) -> CustomNameserver -- client.custom_nameservers.delete(custom_ns_id, \*, account_id) -> Optional -- client.custom_nameservers.availabilty(\*, account_id) -> Optional -- client.custom_nameservers.get(\*, account_id) -> Optional -- client.custom_nameservers.verify(\*, account_id) -> Optional +- client.custom_nameservers.create(\*, account_id, \*\*params) -> CustomNameserver +- client.custom_nameservers.delete(custom_ns_id, \*, account_id, \*\*params) -> Optional +- client.custom_nameservers.availabilty(\*, account_id) -> Optional +- client.custom_nameservers.get(\*, account_id) -> Optional +- client.custom_nameservers.verify(\*, account_id, \*\*params) -> Optional # DNS +Types: + +```python +from cloudflare.types.dns import DNSAnalyticsNominalMetric, DNSAnalyticsQuery +``` + ## Records Types: ```python from cloudflare.types.dns import ( - DNSRecord, + ARecord, + AAAARecord, + CAARecord, + CERTRecord, + CNAMERecord, + DNSKEYRecord, + DSRecord, + HTTPSRecord, + LOCRecord, + MXRecord, + NAPTRRecord, + NSRecord, + PTRRecord, + Record, + RecordMetadata, + RecordProcessTiming, + RecordTags, + SMIMEARecord, + SRVRecord, + SSHFPRecord, + SVCBRecord, + TLSARecord, + TTL, + TXTRecord, + URIRecord, RecordDeleteResponse, RecordExportResponse, RecordImportResponse, @@ -1678,15 +1631,15 @@ from cloudflare.types.dns import ( Methods: -- client.dns.records.create(\*, zone_id, \*\*params) -> DNSRecord -- client.dns.records.update(dns_record_id, \*, zone_id, \*\*params) -> DNSRecord -- client.dns.records.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[DNSRecord] -- client.dns.records.delete(dns_record_id, \*, zone_id) -> Optional -- client.dns.records.edit(dns_record_id, \*, zone_id, \*\*params) -> DNSRecord +- client.dns.records.create(\*, zone_id, \*\*params) -> Optional +- client.dns.records.update(dns_record_id, \*, zone_id, \*\*params) -> Optional +- client.dns.records.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[Record] +- client.dns.records.delete(dns_record_id, \*, zone_id, \*\*params) -> Optional +- client.dns.records.edit(dns_record_id, \*, zone_id, \*\*params) -> Optional - client.dns.records.export(\*, zone_id) -> str -- client.dns.records.get(dns_record_id, \*, zone_id) -> DNSRecord -- client.dns.records.import\_(\*, zone_id, \*\*params) -> RecordImportResponse -- client.dns.records.scan(\*, zone_id) -> RecordScanResponse +- client.dns.records.get(dns_record_id, \*, zone_id) -> Optional +- client.dns.records.import\_(\*, zone_id, \*\*params) -> Optional +- client.dns.records.scan(\*, zone_id, \*\*params) -> Optional ## Analytics @@ -1695,40 +1648,46 @@ Methods: Types: ```python -from cloudflare.types.dns.analytics import DNSAnalyticsReport +from cloudflare.types.dns.analytics import Report ``` Methods: -- client.dns.analytics.reports.get(\*, zone_id, \*\*params) -> DNSAnalyticsReport +- client.dns.analytics.reports.get(\*, zone_id, \*\*params) -> Optional #### Bytimes Types: ```python -from cloudflare.types.dns.analytics.reports import DNSAnalyticsReportByTime +from cloudflare.types.dns.analytics.reports import ByTime ``` Methods: -- client.dns.analytics.reports.bytimes.get(\*, zone_id, \*\*params) -> DNSAnalyticsReportByTime +- client.dns.analytics.reports.bytimes.get(\*, zone_id, \*\*params) -> Optional ## Firewall Types: ```python -from cloudflare.types.dns import DNSFirewall, FirewallDeleteResponse +from cloudflare.types.dns import ( + AttackMitigation, + Firewall, + FirewallIPs, + UpstreamIPs, + FirewallDeleteResponse, +) ``` Methods: -- client.dns.firewall.create(\*, account_id, \*\*params) -> DNSFirewall -- client.dns.firewall.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DNSFirewall] -- client.dns.firewall.delete(dns_firewall_id, \*, account_id) -> FirewallDeleteResponse -- client.dns.firewall.edit(dns_firewall_id, \*, account_id, \*\*params) -> DNSFirewall -- client.dns.firewall.get(dns_firewall_id, \*, account_id) -> DNSFirewall +- client.dns.firewall.create(\*, account_id, \*\*params) -> Firewall +- client.dns.firewall.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Firewall] +- client.dns.firewall.delete(dns_firewall_id, \*, account_id, \*\*params) -> FirewallDeleteResponse +- client.dns.firewall.edit(dns_firewall_id, \*, account_id, \*\*params) -> Firewall +- client.dns.firewall.get(dns_firewall_id, \*, account_id) -> Firewall ### Analytics @@ -1736,53 +1695,48 @@ Methods: Methods: -- client.dns.firewall.analytics.reports.get(dns_firewall_id, \*, account_id, \*\*params) -> DNSAnalyticsReport +- client.dns.firewall.analytics.reports.get(dns_firewall_id, \*, account_id, \*\*params) -> Optional ##### Bytimes Methods: -- client.dns.firewall.analytics.reports.bytimes.get(dns_firewall_id, \*, account_id, \*\*params) -> DNSAnalyticsReportByTime +- client.dns.firewall.analytics.reports.bytimes.get(dns_firewall_id, \*, account_id, \*\*params) -> Optional -# DNSSECResource +# DNSSEC Types: ```python -from cloudflare.types import DNSSEC, DNSSECDeleteResponse +from cloudflare.types.dnssec import DNSSEC, DNSSECDeleteResponse ``` Methods: -- client.dnssec.delete(\*, zone_id) -> DNSSECDeleteResponse -- client.dnssec.edit(\*, zone_id, \*\*params) -> DNSSEC -- client.dnssec.get(\*, zone_id) -> DNSSEC +- client.dnssec.delete(\*, zone_id, \*\*params) -> Optional +- client.dnssec.edit(\*, zone_id, \*\*params) -> Optional +- client.dnssec.get(\*, zone_id) -> Optional # EmailRouting Types: ```python -from cloudflare.types import ( - EmailSettings, - EmailRoutingDisableResponse, - EmailRoutingEnableResponse, - EmailRoutingGetResponse, -) +from cloudflare.types.email_routing import Settings ``` Methods: -- client.email_routing.disable(zone_identifier) -> EmailRoutingDisableResponse -- client.email_routing.enable(zone_identifier) -> EmailRoutingEnableResponse -- client.email_routing.get(zone_identifier) -> EmailRoutingGetResponse +- client.email_routing.disable(zone_identifier, \*\*params) -> Settings +- client.email_routing.enable(zone_identifier, \*\*params) -> Settings +- client.email_routing.get(zone_identifier) -> Settings ## DNS Types: ```python -from cloudflare.types.email_routing import EmailDNSRecord, DNSGetResponse +from cloudflare.types.email_routing import DNSRecord, DNSGetResponse ``` Methods: @@ -1794,73 +1748,65 @@ Methods: Types: ```python -from cloudflare.types.email_routing import ( - EmailRules, - RuleCreateResponse, - RuleUpdateResponse, - RuleListResponse, - RuleDeleteResponse, - RuleGetResponse, -) +from cloudflare.types.email_routing import Action, EmailRoutingRule, Matcher ``` Methods: -- client.email_routing.rules.create(zone_identifier, \*\*params) -> RuleCreateResponse -- client.email_routing.rules.update(rule_identifier, \*, zone_identifier, \*\*params) -> RuleUpdateResponse -- client.email_routing.rules.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[RuleListResponse] -- client.email_routing.rules.delete(rule_identifier, \*, zone_identifier) -> RuleDeleteResponse -- client.email_routing.rules.get(rule_identifier, \*, zone_identifier) -> RuleGetResponse +- client.email_routing.rules.create(zone_identifier, \*\*params) -> EmailRoutingRule +- client.email_routing.rules.update(rule_identifier, \*, zone_identifier, \*\*params) -> EmailRoutingRule +- client.email_routing.rules.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[EmailRoutingRule] +- client.email_routing.rules.delete(rule_identifier, \*, zone_identifier) -> EmailRoutingRule +- client.email_routing.rules.get(rule_identifier, \*, zone_identifier) -> EmailRoutingRule ### CatchAlls Types: ```python -from cloudflare.types.email_routing.rules import EmailCatchAllRule +from cloudflare.types.email_routing.rules import ( + CatchAllAction, + CatchAllMatcher, + CatchAllUpdateResponse, + CatchAllGetResponse, +) ``` Methods: -- client.email_routing.rules.catch_alls.update(zone_identifier, \*\*params) -> EmailCatchAllRule -- client.email_routing.rules.catch_alls.get(zone_identifier) -> EmailCatchAllRule +- client.email_routing.rules.catch_alls.update(zone_identifier, \*\*params) -> CatchAllUpdateResponse +- client.email_routing.rules.catch_alls.get(zone_identifier) -> CatchAllGetResponse ## Addresses Types: ```python -from cloudflare.types.email_routing import ( - EmailAddresses, - AddressCreateResponse, - AddressListResponse, - AddressDeleteResponse, - AddressGetResponse, -) +from cloudflare.types.email_routing import Address ``` Methods: -- client.email_routing.addresses.create(account_identifier, \*\*params) -> AddressCreateResponse -- client.email_routing.addresses.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[AddressListResponse] -- client.email_routing.addresses.delete(destination_address_identifier, \*, account_identifier) -> AddressDeleteResponse -- client.email_routing.addresses.get(destination_address_identifier, \*, account_identifier) -> AddressGetResponse +- client.email_routing.addresses.create(account_identifier, \*\*params) -> Address +- client.email_routing.addresses.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[Address] +- client.email_routing.addresses.delete(destination_address_identifier, \*, account_identifier) -> Address +- client.email_routing.addresses.get(destination_address_identifier, \*, account_identifier) -> Address # Filters Types: ```python -from cloudflare.types import FirewallFilter, FilterCreateResponse +from cloudflare.types.filters import FirewallFilter, FilterCreateResponse ``` Methods: -- client.filters.create(zone_identifier, \*\*params) -> Optional -- client.filters.update(id, \*, zone_identifier, \*\*params) -> Optional -- client.filters.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[FirewallFilter] -- client.filters.delete(id, \*, zone_identifier) -> Optional -- client.filters.get(id, \*, zone_identifier) -> Optional +- client.filters.create(zone_identifier, \*\*params) -> Optional +- client.filters.update(id, \*, zone_identifier, \*\*params) -> FirewallFilter +- client.filters.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[FirewallFilter] +- client.filters.delete(id, \*, zone_identifier, \*\*params) -> FirewallFilter +- client.filters.get(id, \*, zone_identifier) -> FirewallFilter # Firewall @@ -1869,33 +1815,46 @@ Methods: Types: ```python -from cloudflare.types.firewall import FirewallZoneLockdown, LockdownDeleteResponse +from cloudflare.types.firewall import ( + Configuration, + Lockdown, + LockdownCIDRConfiguration, + LockdownIPConfiguration, + LockdownURL, + LockdownDeleteResponse, +) ``` Methods: -- client.firewall.lockdowns.create(zone_identifier, \*\*params) -> Optional -- client.firewall.lockdowns.update(id, \*, zone_identifier, \*\*params) -> Optional -- client.firewall.lockdowns.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[FirewallZoneLockdown] -- client.firewall.lockdowns.delete(id, \*, zone_identifier) -> Optional -- client.firewall.lockdowns.get(id, \*, zone_identifier) -> Optional +- client.firewall.lockdowns.create(zone_identifier, \*\*params) -> Lockdown +- client.firewall.lockdowns.update(id, \*, zone_identifier, \*\*params) -> Lockdown +- client.firewall.lockdowns.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[Lockdown] +- client.firewall.lockdowns.delete(id, \*, zone_identifier, \*\*params) -> Optional +- client.firewall.lockdowns.get(id, \*, zone_identifier) -> Lockdown ## Rules Types: ```python -from cloudflare.types.firewall import FirewallFilterRule, RuleCreateResponse, RuleEditResponse +from cloudflare.types.firewall import ( + FirewallRule, + Products, + DeletedFilter, + RuleCreateResponse, + RuleEditResponse, +) ``` Methods: - client.firewall.rules.create(zone_identifier, \*\*params) -> Optional -- client.firewall.rules.update(id, \*, zone_identifier, \*\*params) -> Optional -- client.firewall.rules.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[FirewallFilterRule] -- client.firewall.rules.delete(id, \*, zone_identifier, \*\*params) -> Optional +- client.firewall.rules.update(id, \*, zone_identifier, \*\*params) -> FirewallRule +- client.firewall.rules.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[FirewallRule] +- client.firewall.rules.delete(id, \*, zone_identifier, \*\*params) -> FirewallRule - client.firewall.rules.edit(id, \*, zone_identifier, \*\*params) -> Optional -- client.firewall.rules.get(id, \*, zone_identifier) -> Optional +- client.firewall.rules.get(zone_identifier, \*, path_id, \*\*params) -> FirewallRule ## AccessRules @@ -1903,6 +1862,11 @@ Types: ```python from cloudflare.types.firewall import ( + AccessRuleCIDRConfiguration, + AccessRuleIPConfiguration, + ASNConfiguration, + CountryConfiguration, + IPV6Configuration, AccessRuleCreateResponse, AccessRuleListResponse, AccessRuleDeleteResponse, @@ -1913,11 +1877,11 @@ from cloudflare.types.firewall import ( Methods: -- client.firewall.access_rules.create(\*, account_id, zone_id, \*\*params) -> Optional +- client.firewall.access_rules.create(\*, account_id, zone_id, \*\*params) -> AccessRuleCreateResponse - client.firewall.access_rules.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[object] -- client.firewall.access_rules.delete(identifier, \*, account_id, zone_id) -> Optional -- client.firewall.access_rules.edit(identifier, \*, account_id, zone_id, \*\*params) -> Optional -- client.firewall.access_rules.get(identifier, \*, account_id, zone_id) -> Optional +- client.firewall.access_rules.delete(identifier, \*, account_id, zone_id, \*\*params) -> Optional +- client.firewall.access_rules.edit(identifier, \*, account_id, zone_id, \*\*params) -> AccessRuleEditResponse +- client.firewall.access_rules.get(identifier, \*, account_id, zone_id) -> AccessRuleGetResponse ## UARules @@ -1925,7 +1889,6 @@ Types: ```python from cloudflare.types.firewall import ( - FirewallUserAgentRule, UARuleCreateResponse, UARuleUpdateResponse, UARuleListResponse, @@ -1936,11 +1899,11 @@ from cloudflare.types.firewall import ( Methods: -- client.firewall.ua_rules.create(zone_identifier, \*\*params) -> Optional -- client.firewall.ua_rules.update(id, \*, zone_identifier, \*\*params) -> Optional +- client.firewall.ua_rules.create(zone_identifier, \*\*params) -> UARuleCreateResponse +- client.firewall.ua_rules.update(id, \*, zone_identifier, \*\*params) -> UARuleUpdateResponse - client.firewall.ua_rules.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[UARuleListResponse] -- client.firewall.ua_rules.delete(id, \*, zone_identifier) -> Optional -- client.firewall.ua_rules.get(id, \*, zone_identifier) -> Optional +- client.firewall.ua_rules.delete(id, \*, zone_identifier, \*\*params) -> UARuleDeleteResponse +- client.firewall.ua_rules.get(id, \*, zone_identifier) -> UARuleGetResponse ## WAF @@ -1949,16 +1912,22 @@ Methods: Types: ```python -from cloudflare.types.firewall.waf import WAFOverride, OverrideDeleteResponse +from cloudflare.types.firewall.waf import ( + Override, + OverrideURL, + RewriteAction, + WAFRule, + OverrideDeleteResponse, +) ``` Methods: -- client.firewall.waf.overrides.create(zone_identifier, \*\*params) -> Optional -- client.firewall.waf.overrides.update(id, \*, zone_identifier, \*\*params) -> Optional -- client.firewall.waf.overrides.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[WAFOverride] -- client.firewall.waf.overrides.delete(id, \*, zone_identifier) -> Optional -- client.firewall.waf.overrides.get(id, \*, zone_identifier) -> Optional +- client.firewall.waf.overrides.create(zone_identifier, \*\*params) -> Override +- client.firewall.waf.overrides.update(id, \*, zone_identifier, \*\*params) -> Override +- client.firewall.waf.overrides.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[Override] +- client.firewall.waf.overrides.delete(id, \*, zone_identifier, \*\*params) -> Optional +- client.firewall.waf.overrides.get(id, \*, zone_identifier) -> Override ### Packages @@ -1978,16 +1947,12 @@ Methods: Types: ```python -from cloudflare.types.firewall.waf.packages import ( - WAFManagedRulesGroup, - GroupEditResponse, - GroupGetResponse, -) +from cloudflare.types.firewall.waf.packages import Group, GroupEditResponse, GroupGetResponse ``` Methods: -- client.firewall.waf.packages.groups.list(package_id, \*, zone_id, \*\*params) -> SyncV4PagePaginationArray[WAFManagedRulesGroup] +- client.firewall.waf.packages.groups.list(package_id, \*, zone_id, \*\*params) -> SyncV4PagePaginationArray[Group] - client.firewall.waf.packages.groups.edit(group_id, \*, zone_id, package_id, \*\*params) -> GroupEditResponse - client.firewall.waf.packages.groups.get(group_id, \*, zone_id, package_id) -> GroupGetResponse @@ -1997,7 +1962,9 @@ Types: ```python from cloudflare.types.firewall.waf.packages import ( - WAFManagedRulesRule, + AllowedModesAnomaly, + WAFRuleGroup, + RuleListResponse, RuleEditResponse, RuleGetResponse, ) @@ -2005,7 +1972,7 @@ from cloudflare.types.firewall.waf.packages import ( Methods: -- client.firewall.waf.packages.rules.list(package_id, \*, zone_id, \*\*params) -> SyncV4PagePaginationArray[WAFManagedRulesRule] +- client.firewall.waf.packages.rules.list(package_id, \*, zone_id, \*\*params) -> SyncV4PagePaginationArray[RuleListResponse] - client.firewall.waf.packages.rules.edit(rule_id, \*, zone_id, package_id, \*\*params) -> RuleEditResponse - client.firewall.waf.packages.rules.get(rule_id, \*, zone_id, package_id) -> RuleGetResponse @@ -2014,17 +1981,24 @@ Methods: Types: ```python -from cloudflare.types import Healthcheck, HealthcheckDeleteResponse +from cloudflare.types.healthchecks import ( + CheckRegion, + Healthcheck, + HTTPConfiguration, + QueryHealthcheck, + TCPConfiguration, + HealthcheckDeleteResponse, +) ``` Methods: -- client.healthchecks.create(\*, zone_id, \*\*params) -> Healthcheck -- client.healthchecks.update(healthcheck_id, \*, zone_id, \*\*params) -> Healthcheck -- client.healthchecks.list(\*, zone_id) -> SyncSinglePage[Healthcheck] -- client.healthchecks.delete(healthcheck_id, \*, zone_id) -> HealthcheckDeleteResponse -- client.healthchecks.edit(healthcheck_id, \*, zone_id, \*\*params) -> Healthcheck -- client.healthchecks.get(healthcheck_id, \*, zone_id) -> Healthcheck +- client.healthchecks.create(\*, zone_id, \*\*params) -> Healthcheck +- client.healthchecks.update(healthcheck_id, \*, zone_id, \*\*params) -> Healthcheck +- client.healthchecks.list(\*, zone_id, \*\*params) -> SyncSinglePage[Healthcheck] +- client.healthchecks.delete(healthcheck_id, \*, zone_id, \*\*params) -> HealthcheckDeleteResponse +- client.healthchecks.edit(healthcheck_id, \*, zone_id, \*\*params) -> Healthcheck +- client.healthchecks.get(healthcheck_id, \*, zone_id) -> Healthcheck ## Previews @@ -2036,29 +2010,29 @@ from cloudflare.types.healthchecks import PreviewDeleteResponse Methods: -- client.healthchecks.previews.create(\*, zone_id, \*\*params) -> Healthcheck -- client.healthchecks.previews.delete(healthcheck_id, \*, zone_id) -> PreviewDeleteResponse -- client.healthchecks.previews.get(healthcheck_id, \*, zone_id) -> Healthcheck +- client.healthchecks.previews.create(\*, zone_id, \*\*params) -> Healthcheck +- client.healthchecks.previews.delete(healthcheck_id, \*, zone_id, \*\*params) -> PreviewDeleteResponse +- client.healthchecks.previews.get(healthcheck_id, \*, zone_id) -> Healthcheck # KeylessCertificates Types: ```python -from cloudflare.types import ( +from cloudflare.types.keyless_certificates import ( KeylessCertificate, - KeylessCertificateHostname, + Tunnel, KeylessCertificateDeleteResponse, ) ``` Methods: -- client.keyless_certificates.create(\*, zone_id, \*\*params) -> KeylessCertificateHostname -- client.keyless_certificates.list(\*, zone_id) -> SyncSinglePage[KeylessCertificateHostname] -- client.keyless_certificates.delete(keyless_certificate_id, \*, zone_id) -> KeylessCertificateDeleteResponse -- client.keyless_certificates.edit(keyless_certificate_id, \*, zone_id, \*\*params) -> KeylessCertificateHostname -- client.keyless_certificates.get(keyless_certificate_id, \*, zone_id) -> KeylessCertificateHostname +- client.keyless_certificates.create(\*, zone_id, \*\*params) -> KeylessCertificate +- client.keyless_certificates.list(\*, zone_id) -> SyncSinglePage[KeylessCertificate] +- client.keyless_certificates.delete(keyless_certificate_id, \*, zone_id, \*\*params) -> KeylessCertificateDeleteResponse +- client.keyless_certificates.edit(keyless_certificate_id, \*, zone_id, \*\*params) -> KeylessCertificate +- client.keyless_certificates.get(keyless_certificate_id, \*, zone_id) -> KeylessCertificate # Logpush @@ -2081,12 +2055,12 @@ Methods: Types: ```python -from cloudflare.types.logpush.datasets import LogpushJob, JobGetResponse +from cloudflare.types.logpush.datasets import JobGetResponse ``` Methods: -- client.logpush.datasets.jobs.get(dataset_id, \*, account_id, zone_id) -> JobGetResponse +- client.logpush.datasets.jobs.get(dataset_id, \*, account_id, zone_id) -> Optional ## Edge @@ -2099,36 +2073,36 @@ from cloudflare.types.logpush import InstantLogpushJob, EdgeGetResponse Methods: - client.logpush.edge.create(\*, zone_id, \*\*params) -> Optional -- client.logpush.edge.get(\*, zone_id) -> EdgeGetResponse +- client.logpush.edge.get(\*, zone_id) -> Optional ## Jobs Types: ```python -from cloudflare.types.logpush import JobDeleteResponse +from cloudflare.types.logpush import LogpushJob, OutputOptions, JobDeleteResponse ``` Methods: -- client.logpush.jobs.create(\*, account_id, zone_id, \*\*params) -> Optional -- client.logpush.jobs.update(job_id, \*, account_id, zone_id, \*\*params) -> Optional -- client.logpush.jobs.list(\*, account_id, zone_id) -> SyncSinglePage[Optional] -- client.logpush.jobs.delete(job_id, \*, account_id, zone_id) -> Optional -- client.logpush.jobs.get(job_id, \*, account_id, zone_id) -> Optional +- client.logpush.jobs.create(\*, account_id, zone_id, \*\*params) -> Optional +- client.logpush.jobs.update(job_id, \*, account_id, zone_id, \*\*params) -> Optional +- client.logpush.jobs.list(\*, account_id, zone_id) -> SyncSinglePage[Optional] +- client.logpush.jobs.delete(job_id, \*, account_id, zone_id, \*\*params) -> object +- client.logpush.jobs.get(job_id, \*, account_id, zone_id) -> Optional ## Ownership Types: ```python -from cloudflare.types.logpush import OwnershipCreateResponse, OwnershipValidateResponse +from cloudflare.types.logpush import OwnershipValidation, OwnershipCreateResponse ``` Methods: - client.logpush.ownership.create(\*, account_id, zone_id, \*\*params) -> Optional -- client.logpush.ownership.validate(\*, account_id, zone_id, \*\*params) -> Optional +- client.logpush.ownership.validate(\*, account_id, zone_id, \*\*params) -> Optional ## Validate @@ -2175,7 +2149,7 @@ from cloudflare.types.logs.control.cmb import CmbConfig, ConfigDeleteResponse Methods: - client.logs.control.cmb.config.create(\*, account_id, \*\*params) -> Optional -- client.logs.control.cmb.config.delete(\*, account_id) -> Optional +- client.logs.control.cmb.config.delete(\*, account_id, \*\*params) -> object - client.logs.control.cmb.config.get(\*, account_id) -> Optional ## RayID @@ -2219,10 +2193,9 @@ Methods: Types: ```python -from cloudflare.types import ( - OriginTLSClientCertificateZoneAuthenticatedOriginPull, +from cloudflare.types.origin_tls_client_auth import ( + ZoneAuthenticatedOriginPull, OriginTLSClientAuthCreateResponse, - OriginTLSClientAuthListResponse, OriginTLSClientAuthDeleteResponse, OriginTLSClientAuthGetResponse, ) @@ -2230,42 +2203,43 @@ from cloudflare.types import ( Methods: -- client.origin_tls_client_auth.create(\*, zone_id, \*\*params) -> OriginTLSClientAuthCreateResponse -- client.origin_tls_client_auth.list(\*, zone_id) -> SyncSinglePage[OriginTLSClientAuthListResponse] -- client.origin_tls_client_auth.delete(certificate_id, \*, zone_id) -> OriginTLSClientAuthDeleteResponse -- client.origin_tls_client_auth.get(certificate_id, \*, zone_id) -> OriginTLSClientAuthGetResponse +- client.origin_tls_client_auth.create(\*, zone_id, \*\*params) -> OriginTLSClientAuthCreateResponse +- client.origin_tls_client_auth.list(\*, zone_id) -> SyncSinglePage[ZoneAuthenticatedOriginPull] +- client.origin_tls_client_auth.delete(certificate_id, \*, zone_id, \*\*params) -> OriginTLSClientAuthDeleteResponse +- client.origin_tls_client_auth.get(certificate_id, \*, zone_id) -> OriginTLSClientAuthGetResponse ## Hostnames Types: ```python -from cloudflare.types.origin_tls_client_auth import ( - OriginTLSClientCertificateAuthenticatedOriginPull, - OriginTLSClientCertificateID, - HostnameUpdateResponse, -) +from cloudflare.types.origin_tls_client_auth import AuthenticatedOriginPull, HostnameUpdateResponse ``` Methods: - client.origin_tls_client_auth.hostnames.update(\*, zone_id, \*\*params) -> Optional -- client.origin_tls_client_auth.hostnames.get(hostname, \*, zone_id) -> OriginTLSClientCertificateID +- client.origin_tls_client_auth.hostnames.get(hostname, \*, zone_id) -> AuthenticatedOriginPull ### Certificates Types: ```python -from cloudflare.types.origin_tls_client_auth.hostnames import OriginTLSClientCertificate +from cloudflare.types.origin_tls_client_auth.hostnames import ( + Certificate, + CertificateCreateResponse, + CertificateDeleteResponse, + CertificateGetResponse, +) ``` Methods: -- client.origin_tls_client_auth.hostnames.certificates.create(\*, zone_id, \*\*params) -> OriginTLSClientCertificate -- client.origin_tls_client_auth.hostnames.certificates.list(\*, zone_id) -> SyncSinglePage[OriginTLSClientCertificateID] -- client.origin_tls_client_auth.hostnames.certificates.delete(certificate_id, \*, zone_id) -> OriginTLSClientCertificate -- client.origin_tls_client_auth.hostnames.certificates.get(certificate_id, \*, zone_id) -> OriginTLSClientCertificate +- client.origin_tls_client_auth.hostnames.certificates.create(\*, zone_id, \*\*params) -> CertificateCreateResponse +- client.origin_tls_client_auth.hostnames.certificates.list(\*, zone_id) -> SyncSinglePage[AuthenticatedOriginPull] +- client.origin_tls_client_auth.hostnames.certificates.delete(certificate_id, \*, zone_id, \*\*params) -> CertificateDeleteResponse +- client.origin_tls_client_auth.hostnames.certificates.get(certificate_id, \*, zone_id) -> CertificateGetResponse ## Settings @@ -2285,8 +2259,11 @@ Methods: Types: ```python -from cloudflare.types import ( - ZonesPagerule, +from cloudflare.types.pagerules import ( + PageRule, + Route, + Target, + URLTarget, PageruleCreateResponse, PageruleUpdateResponse, PageruleListResponse, @@ -2298,34 +2275,35 @@ from cloudflare.types import ( Methods: -- client.pagerules.create(\*, zone_id, \*\*params) -> PageruleCreateResponse -- client.pagerules.update(pagerule_id, \*, zone_id, \*\*params) -> PageruleUpdateResponse -- client.pagerules.list(\*, zone_id, \*\*params) -> PageruleListResponse -- client.pagerules.delete(pagerule_id, \*, zone_id) -> Optional -- client.pagerules.edit(pagerule_id, \*, zone_id, \*\*params) -> PageruleEditResponse -- client.pagerules.get(pagerule_id, \*, zone_id) -> PageruleGetResponse +- client.pagerules.create(\*, zone_id, \*\*params) -> PageruleCreateResponse +- client.pagerules.update(pagerule_id, \*, zone_id, \*\*params) -> PageruleUpdateResponse +- client.pagerules.list(\*, zone_id, \*\*params) -> PageruleListResponse +- client.pagerules.delete(pagerule_id, \*, zone_id, \*\*params) -> Optional +- client.pagerules.edit(pagerule_id, \*, zone_id, \*\*params) -> PageruleEditResponse +- client.pagerules.get(pagerule_id, \*, zone_id) -> PageruleGetResponse ## Settings Types: ```python -from cloudflare.types.pagerules import ZonePageruleSettings +from cloudflare.types.pagerules import SettingListResponse ``` Methods: -- client.pagerules.settings.list(\*, zone_id) -> ZonePageruleSettings +- client.pagerules.settings.list(\*, zone_id) -> SettingListResponse # RateLimits Types: ```python -from cloudflare.types import ( +from cloudflare.types.rate_limits import ( + Action, + Methods, RateLimit, RateLimitCreateResponse, - RateLimitListResponse, RateLimitDeleteResponse, RateLimitEditResponse, RateLimitGetResponse, @@ -2334,11 +2312,11 @@ from cloudflare.types import ( Methods: -- client.rate_limits.create(zone_identifier, \*\*params) -> Optional -- client.rate_limits.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[RateLimitListResponse] -- client.rate_limits.delete(id, \*, zone_identifier) -> Optional -- client.rate_limits.edit(id, \*, zone_identifier, \*\*params) -> Optional -- client.rate_limits.get(id, \*, zone_identifier) -> Optional +- client.rate_limits.create(zone_identifier, \*\*params) -> RateLimitCreateResponse +- client.rate_limits.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[RateLimit] +- client.rate_limits.delete(id, \*, zone_identifier, \*\*params) -> RateLimitDeleteResponse +- client.rate_limits.edit(id, \*, zone_identifier, \*\*params) -> RateLimitEditResponse +- client.rate_limits.get(id, \*, zone_identifier) -> RateLimitGetResponse # SecondaryDNS @@ -2347,12 +2325,12 @@ Methods: Types: ```python -from cloudflare.types.secondary_dns import SecondaryDNSForce +from cloudflare.types.secondary_dns import ForceAXFR ``` Methods: -- client.secondary_dns.force_axfr.create(\*, zone_id) -> str +- client.secondary_dns.force_axfr.create(\*, zone_id, \*\*params) -> str ## Incoming @@ -2360,6 +2338,7 @@ Types: ```python from cloudflare.types.secondary_dns import ( + Incoming, IncomingCreateResponse, IncomingUpdateResponse, IncomingDeleteResponse, @@ -2369,10 +2348,10 @@ from cloudflare.types.secondary_dns import ( Methods: -- client.secondary_dns.incoming.create(\*, zone_id, \*\*params) -> IncomingCreateResponse -- client.secondary_dns.incoming.update(\*, zone_id, \*\*params) -> IncomingUpdateResponse -- client.secondary_dns.incoming.delete(\*, zone_id) -> IncomingDeleteResponse -- client.secondary_dns.incoming.get(\*, zone_id) -> IncomingGetResponse +- client.secondary_dns.incoming.create(\*, zone_id, \*\*params) -> Optional +- client.secondary_dns.incoming.update(\*, zone_id, \*\*params) -> Optional +- client.secondary_dns.incoming.delete(\*, zone_id, \*\*params) -> Optional +- client.secondary_dns.incoming.get(\*, zone_id) -> Optional ## Outgoing @@ -2380,8 +2359,10 @@ Types: ```python from cloudflare.types.secondary_dns import ( - SecondaryDNSDisableTransfer, - SecondaryDNSEnableTransfer, + DisableTransfer, + EnableTransfer, + Outgoing, + OutgoingStatus, OutgoingCreateResponse, OutgoingUpdateResponse, OutgoingDeleteResponse, @@ -2392,84 +2373,90 @@ from cloudflare.types.secondary_dns import ( Methods: -- client.secondary_dns.outgoing.create(\*, zone_id, \*\*params) -> OutgoingCreateResponse -- client.secondary_dns.outgoing.update(\*, zone_id, \*\*params) -> OutgoingUpdateResponse -- client.secondary_dns.outgoing.delete(\*, zone_id) -> OutgoingDeleteResponse -- client.secondary_dns.outgoing.disable(\*, zone_id) -> str -- client.secondary_dns.outgoing.enable(\*, zone_id) -> str -- client.secondary_dns.outgoing.force_notify(\*, zone_id) -> str -- client.secondary_dns.outgoing.get(\*, zone_id) -> OutgoingGetResponse +- client.secondary_dns.outgoing.create(\*, zone_id, \*\*params) -> Optional +- client.secondary_dns.outgoing.update(\*, zone_id, \*\*params) -> Optional +- client.secondary_dns.outgoing.delete(\*, zone_id, \*\*params) -> Optional +- client.secondary_dns.outgoing.disable(\*, zone_id, \*\*params) -> str +- client.secondary_dns.outgoing.enable(\*, zone_id, \*\*params) -> str +- client.secondary_dns.outgoing.force_notify(\*, zone_id, \*\*params) -> str +- client.secondary_dns.outgoing.get(\*, zone_id) -> Optional ### Status Methods: -- client.secondary_dns.outgoing.status.get(\*, zone_id) -> str +- client.secondary_dns.outgoing.status.get(\*, zone_id) -> str ## ACLs Types: ```python -from cloudflare.types.secondary_dns import SecondaryDNSACL, ACLDeleteResponse +from cloudflare.types.secondary_dns import ACL, ACLDeleteResponse ``` Methods: -- client.secondary_dns.acls.create(\*, account_id, \*\*params) -> SecondaryDNSACL -- client.secondary_dns.acls.update(acl_id, \*, account_id, \*\*params) -> SecondaryDNSACL -- client.secondary_dns.acls.list(\*, account_id) -> SyncSinglePage[SecondaryDNSACL] -- client.secondary_dns.acls.delete(acl_id, \*, account_id) -> ACLDeleteResponse -- client.secondary_dns.acls.get(acl_id, \*, account_id) -> SecondaryDNSACL +- client.secondary_dns.acls.create(\*, account_id, \*\*params) -> Optional +- client.secondary_dns.acls.update(acl_id, \*, account_id, \*\*params) -> Optional +- client.secondary_dns.acls.list(\*, account_id) -> SyncSinglePage[ACL] +- client.secondary_dns.acls.delete(acl_id, \*, account_id, \*\*params) -> Optional +- client.secondary_dns.acls.get(acl_id, \*, account_id) -> Optional ## Peers Types: ```python -from cloudflare.types.secondary_dns import SecondaryDNSPeer, PeerDeleteResponse +from cloudflare.types.secondary_dns import Peer, PeerDeleteResponse ``` Methods: -- client.secondary_dns.peers.create(\*, account_id, \*\*params) -> SecondaryDNSPeer -- client.secondary_dns.peers.update(peer_id, \*, account_id, \*\*params) -> SecondaryDNSPeer -- client.secondary_dns.peers.list(\*, account_id) -> SyncSinglePage[SecondaryDNSPeer] -- client.secondary_dns.peers.delete(peer_id, \*, account_id) -> PeerDeleteResponse -- client.secondary_dns.peers.get(peer_id, \*, account_id) -> SecondaryDNSPeer +- client.secondary_dns.peers.create(\*, account_id, \*\*params) -> Optional +- client.secondary_dns.peers.update(peer_id, \*, account_id, \*\*params) -> Optional +- client.secondary_dns.peers.list(\*, account_id) -> SyncSinglePage[Peer] +- client.secondary_dns.peers.delete(peer_id, \*, account_id, \*\*params) -> Optional +- client.secondary_dns.peers.get(peer_id, \*, account_id) -> Optional ## TSIGs Types: ```python -from cloudflare.types.secondary_dns import SecondaryDNSTSIG, TSIGDeleteResponse +from cloudflare.types.secondary_dns import TSIG, TSIGDeleteResponse ``` Methods: -- client.secondary_dns.tsigs.create(\*, account_id, \*\*params) -> SecondaryDNSTSIG -- client.secondary_dns.tsigs.update(tsig_id, \*, account_id, \*\*params) -> SecondaryDNSTSIG -- client.secondary_dns.tsigs.list(\*, account_id) -> SyncSinglePage[SecondaryDNSTSIG] -- client.secondary_dns.tsigs.delete(tsig_id, \*, account_id) -> TSIGDeleteResponse -- client.secondary_dns.tsigs.get(tsig_id, \*, account_id) -> SecondaryDNSTSIG +- client.secondary_dns.tsigs.create(\*, account_id, \*\*params) -> Optional +- client.secondary_dns.tsigs.update(tsig_id, \*, account_id, \*\*params) -> Optional +- client.secondary_dns.tsigs.list(\*, account_id) -> SyncSinglePage[TSIG] +- client.secondary_dns.tsigs.delete(tsig_id, \*, account_id, \*\*params) -> Optional +- client.secondary_dns.tsigs.get(tsig_id, \*, account_id) -> Optional # WaitingRooms Types: ```python -from cloudflare.types import WaitingRoom, WaitingRoomDeleteResponse +from cloudflare.types.waiting_rooms import ( + AdditionalRoutes, + CookieAttributes, + Query, + WaitingRoom, + WaitingRoomDeleteResponse, +) ``` Methods: -- client.waiting_rooms.create(zone_identifier, \*\*params) -> WaitingRoom -- client.waiting_rooms.update(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingRoom -- client.waiting_rooms.list(zone_identifier) -> SyncSinglePage[WaitingRoom] -- client.waiting_rooms.delete(waiting_room_id, \*, zone_identifier) -> WaitingRoomDeleteResponse -- client.waiting_rooms.edit(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingRoom -- client.waiting_rooms.get(waiting_room_id, \*, zone_identifier) -> WaitingRoom +- client.waiting_rooms.create(\*, zone_id, \*\*params) -> WaitingRoom +- client.waiting_rooms.update(waiting_room_id, \*, zone_id, \*\*params) -> WaitingRoom +- client.waiting_rooms.list(\*, zone_id, \*\*params) -> SyncSinglePage[WaitingRoom] +- client.waiting_rooms.delete(waiting_room_id, \*, zone_id, \*\*params) -> WaitingRoomDeleteResponse +- client.waiting_rooms.edit(waiting_room_id, \*, zone_id, \*\*params) -> WaitingRoom +- client.waiting_rooms.get(waiting_room_id, \*, zone_id) -> WaitingRoom ## Page @@ -2481,36 +2468,36 @@ from cloudflare.types.waiting_rooms import PagePreviewResponse Methods: -- client.waiting_rooms.page.preview(zone_identifier, \*\*params) -> PagePreviewResponse +- client.waiting_rooms.page.preview(\*, zone_id, \*\*params) -> PagePreviewResponse ## Events Types: ```python -from cloudflare.types.waiting_rooms import WaitingroomEvent, EventDeleteResponse +from cloudflare.types.waiting_rooms import Event, EventDeleteResponse ``` Methods: -- client.waiting_rooms.events.create(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingroomEvent -- client.waiting_rooms.events.update(event_id, \*, zone_identifier, waiting_room_id, \*\*params) -> WaitingroomEvent -- client.waiting_rooms.events.list(waiting_room_id, \*, zone_identifier) -> SyncSinglePage[WaitingroomEvent] -- client.waiting_rooms.events.delete(event_id, \*, zone_identifier, waiting_room_id) -> EventDeleteResponse -- client.waiting_rooms.events.edit(event_id, \*, zone_identifier, waiting_room_id, \*\*params) -> WaitingroomEvent -- client.waiting_rooms.events.get(event_id, \*, zone_identifier, waiting_room_id) -> WaitingroomEvent +- client.waiting_rooms.events.create(waiting_room_id, \*, zone_id, \*\*params) -> Event +- client.waiting_rooms.events.update(event_id, \*, zone_id, waiting_room_id, \*\*params) -> Event +- client.waiting_rooms.events.list(waiting_room_id, \*, zone_id, \*\*params) -> SyncSinglePage[Event] +- client.waiting_rooms.events.delete(event_id, \*, zone_id, waiting_room_id, \*\*params) -> EventDeleteResponse +- client.waiting_rooms.events.edit(event_id, \*, zone_id, waiting_room_id, \*\*params) -> Event +- client.waiting_rooms.events.get(event_id, \*, zone_id, waiting_room_id) -> Event ### Details Types: ```python -from cloudflare.types.waiting_rooms.events import WaitingroomEventDetails +from cloudflare.types.waiting_rooms.events import EventQuery, DetailGetResponse ``` Methods: -- client.waiting_rooms.events.details.get(event_id, \*, zone_identifier, waiting_room_id) -> WaitingroomEventDetails +- client.waiting_rooms.events.details.get(event_id, \*, zone_id, waiting_room_id) -> DetailGetResponse ## Rules @@ -2518,7 +2505,7 @@ Types: ```python from cloudflare.types.waiting_rooms import ( - WaitingroomRule, + WaitingRoomRule, RuleCreateResponse, RuleUpdateResponse, RuleDeleteResponse, @@ -2528,11 +2515,11 @@ from cloudflare.types.waiting_rooms import ( Methods: -- client.waiting_rooms.rules.create(waiting_room_id, \*, zone_identifier, \*\*params) -> Optional -- client.waiting_rooms.rules.update(waiting_room_id, \*, zone_identifier, \*\*params) -> Optional -- client.waiting_rooms.rules.list(waiting_room_id, \*, zone_identifier) -> SyncSinglePage[WaitingroomRule] -- client.waiting_rooms.rules.delete(rule_id, \*, zone_identifier, waiting_room_id) -> Optional -- client.waiting_rooms.rules.edit(rule_id, \*, zone_identifier, waiting_room_id, \*\*params) -> Optional +- client.waiting_rooms.rules.create(waiting_room_id, \*, zone_id, \*\*params) -> Optional +- client.waiting_rooms.rules.update(waiting_room_id, \*, zone_id, \*\*params) -> Optional +- client.waiting_rooms.rules.list(waiting_room_id, \*, zone_id) -> SyncSinglePage[WaitingRoomRule] +- client.waiting_rooms.rules.delete(rule_id, \*, zone_id, waiting_room_id, \*\*params) -> Optional +- client.waiting_rooms.rules.edit(rule_id, \*, zone_id, waiting_room_id, \*\*params) -> Optional ## Statuses @@ -2544,7 +2531,7 @@ from cloudflare.types.waiting_rooms import StatusGetResponse Methods: -- client.waiting_rooms.statuses.get(waiting_room_id, \*, zone_identifier) -> StatusGetResponse +- client.waiting_rooms.statuses.get(waiting_room_id, \*, zone_id) -> StatusGetResponse ## Settings @@ -2552,6 +2539,7 @@ Types: ```python from cloudflare.types.waiting_rooms import ( + Setting, SettingUpdateResponse, SettingEditResponse, SettingGetResponse, @@ -2560,9 +2548,9 @@ from cloudflare.types.waiting_rooms import ( Methods: -- client.waiting_rooms.settings.update(zone_identifier, \*\*params) -> SettingUpdateResponse -- client.waiting_rooms.settings.edit(zone_identifier, \*\*params) -> SettingEditResponse -- client.waiting_rooms.settings.get(zone_identifier) -> SettingGetResponse +- client.waiting_rooms.settings.update(\*, zone_id, \*\*params) -> SettingUpdateResponse +- client.waiting_rooms.settings.edit(\*, zone_id, \*\*params) -> SettingEditResponse +- client.waiting_rooms.settings.get(\*, zone_id) -> SettingGetResponse # Web3 @@ -2571,16 +2559,16 @@ Methods: Types: ```python -from cloudflare.types.web3 import DistributedWebHostname, HostnameDeleteResponse +from cloudflare.types.web3 import Hostname, HostnameDeleteResponse ``` Methods: -- client.web3.hostnames.create(zone_identifier, \*\*params) -> DistributedWebHostname -- client.web3.hostnames.list(zone_identifier) -> SyncSinglePage[DistributedWebHostname] -- client.web3.hostnames.delete(identifier, \*, zone_identifier) -> Optional -- client.web3.hostnames.edit(identifier, \*, zone_identifier, \*\*params) -> DistributedWebHostname -- client.web3.hostnames.get(identifier, \*, zone_identifier) -> DistributedWebHostname +- client.web3.hostnames.create(zone_identifier, \*\*params) -> Hostname +- client.web3.hostnames.list(zone_identifier) -> SyncSinglePage[Hostname] +- client.web3.hostnames.delete(identifier, \*, zone_identifier, \*\*params) -> Optional +- client.web3.hostnames.edit(identifier, \*, zone_identifier, \*\*params) -> Hostname +- client.web3.hostnames.get(identifier, \*, zone_identifier) -> Hostname ### IPFSUniversalPaths @@ -2589,13 +2577,13 @@ Methods: Types: ```python -from cloudflare.types.web3.hostnames.ipfs_universal_paths import DistributedWebConfigContentList +from cloudflare.types.web3.hostnames.ipfs_universal_paths import ContentList ``` Methods: -- client.web3.hostnames.ipfs_universal_paths.content_lists.update(identifier, \*, zone_identifier, \*\*params) -> DistributedWebConfigContentList -- client.web3.hostnames.ipfs_universal_paths.content_lists.get(identifier, \*, zone_identifier) -> DistributedWebConfigContentList +- client.web3.hostnames.ipfs_universal_paths.content_lists.update(identifier, \*, zone_identifier, \*\*params) -> ContentList +- client.web3.hostnames.ipfs_universal_paths.content_lists.get(identifier, \*, zone_identifier) -> ContentList ##### Entries @@ -2603,22 +2591,44 @@ Types: ```python from cloudflare.types.web3.hostnames.ipfs_universal_paths.content_lists import ( - DistributedWebConfigContentListEntry, + EntryCreateResponse, + EntryUpdateResponse, EntryListResponse, EntryDeleteResponse, + EntryGetResponse, ) ``` Methods: -- client.web3.hostnames.ipfs_universal_paths.content_lists.entries.create(identifier, \*, zone_identifier, \*\*params) -> DistributedWebConfigContentListEntry -- client.web3.hostnames.ipfs_universal_paths.content_lists.entries.update(content_list_entry_identifier, \*, zone_identifier, identifier, \*\*params) -> DistributedWebConfigContentListEntry +- client.web3.hostnames.ipfs_universal_paths.content_lists.entries.create(identifier, \*, zone_identifier, \*\*params) -> EntryCreateResponse +- client.web3.hostnames.ipfs_universal_paths.content_lists.entries.update(content_list_entry_identifier, \*, zone_identifier, identifier, \*\*params) -> EntryUpdateResponse - client.web3.hostnames.ipfs_universal_paths.content_lists.entries.list(identifier, \*, zone_identifier) -> Optional -- client.web3.hostnames.ipfs_universal_paths.content_lists.entries.delete(content_list_entry_identifier, \*, zone_identifier, identifier) -> Optional -- client.web3.hostnames.ipfs_universal_paths.content_lists.entries.get(content_list_entry_identifier, \*, zone_identifier, identifier) -> DistributedWebConfigContentListEntry +- client.web3.hostnames.ipfs_universal_paths.content_lists.entries.delete(content_list_entry_identifier, \*, zone_identifier, identifier, \*\*params) -> Optional +- client.web3.hostnames.ipfs_universal_paths.content_lists.entries.get(content_list_entry_identifier, \*, zone_identifier, identifier) -> EntryGetResponse # Workers +Types: + +```python +from cloudflare.types.workers import ( + Binding, + D1Binding, + DispatchNamespaceBinding, + DurableObjectBinding, + KVNamespaceBinding, + MigrationStep, + MTLSCERTBinding, + PlacementConfiguration, + R2Binding, + ServiceBinding, + SingleStepMigration, + SteppedMigration, + WorkerMetadata, +) +``` + ## AI Types: @@ -2636,123 +2646,96 @@ Methods: Types: ```python -from cloudflare.types.workers import WorkersScript +from cloudflare.types.workers import Script, ScriptSetting ``` Methods: -- client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> WorkersScript -- client.workers.scripts.list(\*, account_id) -> SyncSinglePage[WorkersScript] +- client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> Optional +- 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 -### Bindings - -Types: - -```python -from cloudflare.types.workers.scripts import WorkersBinding, BindingGetResponse -``` - -Methods: - -- client.workers.scripts.bindings.get(\*, zone_id) -> BindingGetResponse - ### Schedules Types: ```python -from cloudflare.types.workers.scripts import ScheduleUpdateResponse, ScheduleGetResponse +from cloudflare.types.workers.scripts import Schedule, ScheduleUpdateResponse, ScheduleGetResponse ``` Methods: -- client.workers.scripts.schedules.update(script_name, \*, account_id, \*\*params) -> ScheduleUpdateResponse -- client.workers.scripts.schedules.get(script_name, \*, account_id) -> ScheduleGetResponse +- client.workers.scripts.schedules.update(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.schedules.get(script_name, \*, account_id) -> Optional ### Tail Types: ```python -from cloudflare.types.workers.scripts import TailCreateResponse, TailDeleteResponse, TailGetResponse -``` - -Methods: - -- client.workers.scripts.tail.create(script_name, \*, account_id) -> TailCreateResponse -- client.workers.scripts.tail.delete(id, \*, account_id, script_name) -> TailDeleteResponse -- client.workers.scripts.tail.get(script_name, \*, account_id) -> TailGetResponse - -### UsageModel - -Types: - -```python -from cloudflare.types.workers.scripts import UsageModelUpdateResponse, UsageModelGetResponse +from cloudflare.types.workers.scripts import ( + ConsumerScript, + TailCreateResponse, + TailDeleteResponse, + TailGetResponse, +) ``` Methods: -- client.workers.scripts.usage_model.update(script_name, \*, account_id, \*\*params) -> UsageModelUpdateResponse -- client.workers.scripts.usage_model.get(script_name, \*, account_id) -> UsageModelGetResponse +- client.workers.scripts.tail.create(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.tail.delete(id, \*, account_id, script_name, \*\*params) -> TailDeleteResponse +- client.workers.scripts.tail.get(script_name, \*, account_id) -> Optional ### Content Methods: -- client.workers.scripts.content.update(script_name, \*, account_id, \*\*params) -> WorkersScript - -### ContentV2 - -Methods: - -- client.workers.scripts.content_v2.get(script_name, \*, account_id) -> BinaryAPIResponse +- client.workers.scripts.content.update(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.content.get(script_name, \*, account_id) -> BinaryAPIResponse ### Settings -Types: - -```python -from cloudflare.types.workers.scripts import SettingEditResponse, SettingGetResponse -``` - Methods: -- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> SettingEditResponse -- client.workers.scripts.settings.get(script_name, \*, account_id) -> SettingGetResponse +- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.settings.get(script_name, \*, account_id) -> Optional -## Filters +### Deployments Types: ```python -from cloudflare.types.workers import WorkersFilter, FilterCreateResponse, FilterDeleteResponse +from cloudflare.types.workers.scripts import ( + Deployment, + DeploymentCreateResponse, + DeploymentGetResponse, +) ``` Methods: -- client.workers.filters.create(\*, zone_id, \*\*params) -> Optional -- client.workers.filters.update(filter_id, \*, zone_id, \*\*params) -> WorkersFilter -- client.workers.filters.list(\*, zone_id) -> SyncSinglePage[WorkersFilter] -- client.workers.filters.delete(filter_id, \*, zone_id) -> Optional +- client.workers.scripts.deployments.create(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.deployments.get(script_name, \*, account_id) -> Optional -## Routes +### Versions Types: ```python -from cloudflare.types.workers import WorkersRoute, RouteCreateResponse, RouteDeleteResponse +from cloudflare.types.workers.scripts import ( + VersionCreateResponse, + VersionListResponse, + VersionGetResponse, +) ``` Methods: -- client.workers.routes.create(\*, zone_id, \*\*params) -> RouteCreateResponse -- client.workers.routes.update(route_id, \*, zone_id, \*\*params) -> WorkersRoute -- client.workers.routes.list(\*, zone_id) -> SyncSinglePage[WorkersRoute] -- client.workers.routes.delete(route_id, \*, zone_id) -> RouteDeleteResponse -- client.workers.routes.get(route_id, \*, zone_id) -> WorkersRoute +- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.versions.list(script_name, \*, account_id) -> Optional +- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> Optional ## AccountSettings @@ -2764,49 +2747,23 @@ from cloudflare.types.workers import AccountSettingUpdateResponse, AccountSettin Methods: -- client.workers.account_settings.update(\*, account_id, \*\*params) -> AccountSettingUpdateResponse -- client.workers.account_settings.get(\*, account_id) -> AccountSettingGetResponse - -## Deployments - -### ByScripts - -Types: - -```python -from cloudflare.types.workers.deployments import ByScriptGetResponse -``` - -Methods: - -- client.workers.deployments.by_scripts.get(script_id, \*, account_id) -> ByScriptGetResponse - -#### Details - -Types: - -```python -from cloudflare.types.workers.deployments.by_scripts import DetailGetResponse -``` - -Methods: - -- client.workers.deployments.by_scripts.details.get(deployment_id, \*, account_id, script_id) -> DetailGetResponse +- client.workers.account_settings.update(\*, account_id, \*\*params) -> Optional +- client.workers.account_settings.get(\*, account_id) -> Optional ## Domains Types: ```python -from cloudflare.types.workers import WorkersDomain +from cloudflare.types.workers import Domain ``` Methods: -- client.workers.domains.update(\*, account_id, \*\*params) -> WorkersDomain -- client.workers.domains.list(\*, account_id, \*\*params) -> SyncSinglePage[WorkersDomain] -- client.workers.domains.delete(domain_id, \*, account_id) -> None -- client.workers.domains.get(domain_id, \*, account_id) -> WorkersDomain +- client.workers.domains.update(\*, account_id, \*\*params) -> Optional +- client.workers.domains.list(\*, account_id, \*\*params) -> SyncSinglePage[Domain] +- client.workers.domains.delete(domain_id, \*, account_id, \*\*params) -> None +- client.workers.domains.get(domain_id, \*, account_id) -> Optional ## Subdomains @@ -2818,32 +2775,8 @@ from cloudflare.types.workers import SubdomainUpdateResponse, SubdomainGetRespon Methods: -- client.workers.subdomains.update(\*, account_id, \*\*params) -> SubdomainUpdateResponse -- client.workers.subdomains.get(\*, account_id) -> SubdomainGetResponse - -## Services - -### Environments - -#### Content - -Methods: - -- client.workers.services.environments.content.update(environment_name, \*, account_id, service_name, \*\*params) -> WorkersScript -- client.workers.services.environments.content.get(environment_name, \*, account_id, service_name) -> BinaryAPIResponse - -#### Settings - -Types: - -```python -from cloudflare.types.workers.services.environments import SettingEditResponse, SettingGetResponse -``` - -Methods: - -- client.workers.services.environments.settings.edit(environment_name, \*, account_id, service_name, \*\*params) -> SettingEditResponse -- client.workers.services.environments.settings.get(environment_name, \*, account_id, service_name) -> SettingGetResponse +- client.workers.subdomains.update(\*, account_id, \*\*params) -> Optional +- client.workers.subdomains.get(\*, account_id) -> Optional # KV @@ -2852,15 +2785,15 @@ Methods: Types: ```python -from cloudflare.types.kv import WorkersKVNamespace, NamespaceUpdateResponse, NamespaceDeleteResponse +from cloudflare.types.kv import Namespace, NamespaceUpdateResponse, NamespaceDeleteResponse ``` Methods: -- client.kv.namespaces.create(\*, account_id, \*\*params) -> WorkersKVNamespace +- client.kv.namespaces.create(\*, account_id, \*\*params) -> Namespace - client.kv.namespaces.update(namespace_id, \*, account_id, \*\*params) -> NamespaceUpdateResponse -- client.kv.namespaces.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WorkersKVNamespace] -- client.kv.namespaces.delete(namespace_id, \*, account_id) -> NamespaceDeleteResponse +- client.kv.namespaces.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Namespace] +- client.kv.namespaces.delete(namespace_id, \*, account_id, \*\*params) -> NamespaceDeleteResponse ### Bulk @@ -2880,12 +2813,12 @@ Methods: Types: ```python -from cloudflare.types.kv.namespaces import WorkersKVKey +from cloudflare.types.kv.namespaces import Key ``` Methods: -- client.kv.namespaces.keys.list(namespace_id, \*, account_id, \*\*params) -> SyncCursorLimitPagination[WorkersKVKey] +- client.kv.namespaces.keys.list(namespace_id, \*, account_id, \*\*params) -> SyncCursorLimitPagination[Key] ### Metadata @@ -2914,7 +2847,7 @@ from cloudflare.types.kv.namespaces import ( Methods: - client.kv.namespaces.values.update(key_name, \*, account_id, namespace_id, \*\*params) -> ValueUpdateResponse -- client.kv.namespaces.values.delete(key_name, \*, account_id, namespace_id) -> ValueDeleteResponse +- client.kv.namespaces.values.delete(key_name, \*, account_id, namespace_id, \*\*params) -> ValueDeleteResponse - client.kv.namespaces.values.get(key_name, \*, account_id, namespace_id) -> str # DurableObjects @@ -2924,12 +2857,12 @@ Methods: Types: ```python -from cloudflare.types.durable_objects import DurableObjectNamespace +from cloudflare.types.durable_objects import Namespace ``` Methods: -- client.durable_objects.namespaces.list(\*, account_id) -> SyncSinglePage[DurableObjectNamespace] +- client.durable_objects.namespaces.list(\*, account_id) -> SyncSinglePage[Namespace] ### Objects @@ -2948,25 +2881,16 @@ Methods: Types: ```python -from cloudflare.types import ( - Queue, - QueueCreated, - QueueUpdated, - QueueCreateResponse, - QueueUpdateResponse, - QueueListResponse, - QueueDeleteResponse, - QueueGetResponse, -) +from cloudflare.types.queues import Queue, QueueCreated, QueueUpdated, QueueDeleteResponse ``` Methods: -- client.queues.create(\*, account_id, \*\*params) -> Optional -- client.queues.update(queue_id, \*, account_id, \*\*params) -> Optional -- client.queues.list(\*, account_id) -> SyncSinglePage[QueueListResponse] -- client.queues.delete(queue_id, \*, account_id) -> Optional -- client.queues.get(queue_id, \*, account_id) -> Optional +- client.queues.create(\*, account_id, \*\*params) -> Optional +- client.queues.update(queue_id, \*, account_id, \*\*params) -> Optional +- client.queues.list(\*, account_id) -> SyncSinglePage[Queue] +- client.queues.delete(queue_id, \*, account_id, \*\*params) -> Optional +- client.queues.get(queue_id, \*, account_id) -> Optional ## Consumers @@ -2974,6 +2898,7 @@ Types: ```python from cloudflare.types.queues import ( + Consumer, ConsumerCreateResponse, ConsumerUpdateResponse, ConsumerDeleteResponse, @@ -2985,7 +2910,7 @@ Methods: - client.queues.consumers.create(queue_id, \*, account_id, \*\*params) -> Optional - client.queues.consumers.update(consumer_id, \*, account_id, queue_id, \*\*params) -> Optional -- client.queues.consumers.delete(consumer_id, \*, account_id, queue_id) -> Optional +- client.queues.consumers.delete(consumer_id, \*, account_id, queue_id, \*\*params) -> Optional - client.queues.consumers.get(queue_id, \*, account_id) -> Optional ## Messages @@ -2993,13 +2918,7 @@ Methods: Types: ```python -from cloudflare.types.queues import ( - QueueConsumer, - QueueConsumerCreated, - QueueConsumerUpdated, - MessageAckResponse, - MessagePullResponse, -) +from cloudflare.types.queues import MessageAckResponse, MessagePullResponse ``` Methods: @@ -3012,67 +2931,71 @@ Methods: Types: ```python -from cloudflare.types import ManagedHeaderListResponse, ManagedHeaderEditResponse +from cloudflare.types.managed_headers import ( + RequestModel, + ManagedHeaderListResponse, + ManagedHeaderEditResponse, +) ``` Methods: -- client.managed_headers.list(\*, zone_id) -> ManagedHeaderListResponse -- client.managed_headers.edit(\*, zone_id, \*\*params) -> ManagedHeaderEditResponse +- client.managed_headers.list(\*, zone_id) -> ManagedHeaderListResponse +- client.managed_headers.edit(\*, zone_id, \*\*params) -> ManagedHeaderEditResponse # PageShield Types: ```python -from cloudflare.types import PageShieldSetting, PageShieldUpdateResponse +from cloudflare.types.page_shield import Setting, PageShieldUpdateResponse ``` Methods: -- client.page_shield.update(\*, zone_id, \*\*params) -> PageShieldUpdateResponse -- client.page_shield.get(\*, zone_id) -> PageShieldSetting +- client.page_shield.update(\*, zone_id, \*\*params) -> PageShieldUpdateResponse +- client.page_shield.get(\*, zone_id) -> Setting ## Policies Types: ```python -from cloudflare.types.page_shield import PageShieldPolicy +from cloudflare.types.page_shield import Policy ``` Methods: -- client.page_shield.policies.create(\*, zone_id, \*\*params) -> PageShieldPolicy -- client.page_shield.policies.update(policy_id, \*, zone_id, \*\*params) -> PageShieldPolicy -- client.page_shield.policies.list(\*, zone_id) -> SyncSinglePage[PageShieldPolicy] +- client.page_shield.policies.create(\*, zone_id, \*\*params) -> Policy +- client.page_shield.policies.update(policy_id, \*, zone_id, \*\*params) -> Policy +- client.page_shield.policies.list(\*, zone_id) -> SyncSinglePage[Policy] - client.page_shield.policies.delete(policy_id, \*, zone_id) -> None -- client.page_shield.policies.get(policy_id, \*, zone_id) -> PageShieldPolicy +- client.page_shield.policies.get(policy_id, \*, zone_id) -> Policy ## Connections Types: ```python -from cloudflare.types.page_shield import PageShieldConnection +from cloudflare.types.page_shield import Connection ``` Methods: -- client.page_shield.connections.list(\*, zone_id, \*\*params) -> SyncSinglePage[PageShieldConnection] -- client.page_shield.connections.get(connection_id, \*, zone_id) -> PageShieldConnection +- client.page_shield.connections.list(\*, zone_id, \*\*params) -> SyncSinglePage[Connection] +- client.page_shield.connections.get(connection_id, \*, zone_id) -> Connection ## Scripts Types: ```python -from cloudflare.types.page_shield import PageShieldScript, ScriptGetResponse +from cloudflare.types.page_shield import Script, ScriptGetResponse ``` Methods: -- client.page_shield.scripts.list(\*, zone_id, \*\*params) -> SyncSinglePage[PageShieldScript] +- client.page_shield.scripts.list(\*, zone_id, \*\*params) -> SyncSinglePage[Script] - client.page_shield.scripts.get(script_id, \*, zone_id) -> ScriptGetResponse # Rulesets @@ -3080,80 +3003,134 @@ Methods: Types: ```python -from cloudflare.types import Ruleset, RulesetListResponse +from cloudflare.types.rulesets import ( + Ruleset, + RulesetCreateResponse, + RulesetUpdateResponse, + RulesetGetResponse, +) ``` Methods: -- client.rulesets.create(\*, account_id, zone_id, \*\*params) -> Ruleset -- client.rulesets.update(ruleset_id, \*, account_id, zone_id, \*\*params) -> Ruleset -- client.rulesets.list(\*, account_id, zone_id) -> SyncSinglePage[RulesetListResponse] +- client.rulesets.create(\*, account_id, zone_id, \*\*params) -> RulesetCreateResponse +- client.rulesets.update(ruleset_id, \*, account_id, zone_id, \*\*params) -> RulesetUpdateResponse +- client.rulesets.list(\*, account_id, zone_id) -> SyncSinglePage[Ruleset] - client.rulesets.delete(ruleset_id, \*, account_id, zone_id) -> None -- client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> Ruleset +- client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> RulesetGetResponse ## Phases +Types: + +```python +from cloudflare.types.rulesets import PhaseUpdateResponse, PhaseGetResponse +``` + Methods: -- client.rulesets.phases.update(ruleset_phase, \*, account_id, zone_id, \*\*params) -> Ruleset -- client.rulesets.phases.get(ruleset_phase, \*, account_id, zone_id) -> Ruleset +- client.rulesets.phases.update(ruleset_phase, \*, account_id, zone_id, \*\*params) -> PhaseUpdateResponse +- client.rulesets.phases.get(ruleset_phase, \*, account_id, zone_id) -> PhaseGetResponse ### Versions Types: ```python -from cloudflare.types.rulesets.phases import VersionListResponse +from cloudflare.types.rulesets.phases import VersionGetResponse ``` Methods: -- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] -- client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> Ruleset +- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[Ruleset] +- client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> VersionGetResponse ## Rules +Types: + +```python +from cloudflare.types.rulesets import ( + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + Logging, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RewriteURIPart, + RouteRule, + RulesetRule, + ScoreRule, + ServeErrorRule, + SetCacheSettingsRule, + SetConfigRule, + SkipRule, + RuleCreateResponse, + RuleDeleteResponse, + RuleEditResponse, +) +``` + Methods: -- client.rulesets.rules.create(ruleset_id, \*, account_id, zone_id, \*\*params) -> Ruleset -- client.rulesets.rules.delete(rule_id, \*, ruleset_id, account_id, zone_id) -> Ruleset -- client.rulesets.rules.edit(rule_id, \*, ruleset_id, account_id, zone_id, \*\*params) -> Ruleset +- client.rulesets.rules.create(ruleset_id, \*, account_id, zone_id, \*\*params) -> RuleCreateResponse +- client.rulesets.rules.delete(rule_id, \*, ruleset_id, account_id, zone_id) -> RuleDeleteResponse +- client.rulesets.rules.edit(rule_id, \*, ruleset_id, account_id, zone_id, \*\*params) -> RuleEditResponse ## Versions Types: ```python -from cloudflare.types.rulesets import VersionListResponse +from cloudflare.types.rulesets import VersionGetResponse ``` Methods: -- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] +- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[Ruleset] - client.rulesets.versions.delete(ruleset_version, \*, ruleset_id, account_id, zone_id) -> None -- client.rulesets.versions.get(ruleset_version, \*, ruleset_id, account_id, zone_id) -> Ruleset +- client.rulesets.versions.get(ruleset_version, \*, ruleset_id, account_id, zone_id) -> VersionGetResponse ### ByTag +Types: + +```python +from cloudflare.types.rulesets.versions import ByTagGetResponse +``` + Methods: -- client.rulesets.versions.by_tag.get(rule_tag, \*, account_id, ruleset_id, ruleset_version) -> Ruleset +- client.rulesets.versions.by_tag.get(rule_tag, \*, account_id, ruleset_id, ruleset_version) -> ByTagGetResponse # URLNormalization Types: ```python -from cloudflare.types import URLNormalizationUpdateResponse, URLNormalizationGetResponse +from cloudflare.types.url_normalization import ( + URLNormalizationUpdateResponse, + URLNormalizationGetResponse, +) ``` Methods: -- client.url_normalization.update(\*, zone_id, \*\*params) -> URLNormalizationUpdateResponse -- client.url_normalization.get(\*, zone_id) -> URLNormalizationGetResponse +- client.url_normalization.update(\*, zone_id, \*\*params) -> URLNormalizationUpdateResponse +- client.url_normalization.get(\*, zone_id) -> URLNormalizationGetResponse # Spectrum +Types: + +```python +from cloudflare.types.spectrum import DNS, EdgeIPs, OriginDNS, OriginPort +``` + ## Analytics ### Aggregates @@ -3172,6 +3149,12 @@ Methods: ### Events +Types: + +```python +from cloudflare.types.spectrum.analytics import Dimension +``` + #### Bytimes Types: @@ -3215,8 +3198,8 @@ Methods: - client.spectrum.apps.create(zone, \*\*params) -> Optional - client.spectrum.apps.update(app_id, \*, zone, \*\*params) -> Optional - client.spectrum.apps.list(zone, \*\*params) -> SyncV4PagePaginationArray[object] -- client.spectrum.apps.delete(app_id, \*, zone) -> Optional -- client.spectrum.apps.get(app_id, \*, zone) -> Optional +- client.spectrum.apps.delete(app_id, \*, zone, \*\*params) -> Optional +- client.spectrum.apps.get(app_id, \*, zone) -> AppGetResponse # Addressing @@ -3238,7 +3221,7 @@ Types: ```python from cloudflare.types.addressing import ( - AddressingAddressMaps, + AddressMap, AddressMapCreateResponse, AddressMapDeleteResponse, AddressMapGetResponse, @@ -3247,11 +3230,11 @@ from cloudflare.types.addressing import ( Methods: -- client.addressing.address_maps.create(\*, account_id, \*\*params) -> AddressMapCreateResponse -- client.addressing.address_maps.list(\*, account_id) -> SyncSinglePage[AddressingAddressMaps] -- client.addressing.address_maps.delete(address_map_id, \*, account_id) -> Optional -- client.addressing.address_maps.edit(address_map_id, \*, account_id, \*\*params) -> AddressingAddressMaps -- client.addressing.address_maps.get(address_map_id, \*, account_id) -> AddressMapGetResponse +- client.addressing.address_maps.create(\*, account_id, \*\*params) -> Optional +- client.addressing.address_maps.list(\*, account_id) -> SyncSinglePage[AddressMap] +- client.addressing.address_maps.delete(address_map_id, \*, account_id, \*\*params) -> Optional +- client.addressing.address_maps.edit(address_map_id, \*, account_id, \*\*params) -> Optional +- client.addressing.address_maps.get(address_map_id, \*, account_id) -> Optional ### Accounts @@ -3263,8 +3246,8 @@ from cloudflare.types.addressing.address_maps import AccountUpdateResponse, Acco Methods: -- client.addressing.address_maps.accounts.update(address_map_id, \*, account_id) -> Optional -- client.addressing.address_maps.accounts.delete(address_map_id, \*, account_id) -> Optional +- client.addressing.address_maps.accounts.update(address_map_id, \*, account_id, \*\*params) -> Optional +- client.addressing.address_maps.accounts.delete(address_map_id, \*, account_id, \*\*params) -> Optional ### IPs @@ -3276,8 +3259,8 @@ from cloudflare.types.addressing.address_maps import IPUpdateResponse, IPDeleteR Methods: -- client.addressing.address_maps.ips.update(ip_address, \*, account_id, address_map_id) -> Optional -- client.addressing.address_maps.ips.delete(ip_address, \*, account_id, address_map_id) -> Optional +- client.addressing.address_maps.ips.update(ip_address, \*, account_id, address_map_id, \*\*params) -> Optional +- client.addressing.address_maps.ips.delete(ip_address, \*, account_id, address_map_id, \*\*params) -> Optional ### Zones @@ -3289,8 +3272,8 @@ from cloudflare.types.addressing.address_maps import ZoneUpdateResponse, ZoneDel Methods: -- client.addressing.address_maps.zones.update(address_map_id, \*, zone_id, account_id) -> Optional -- client.addressing.address_maps.zones.delete(address_map_id, \*, zone_id, account_id) -> Optional +- client.addressing.address_maps.zones.update(address_map_id, \*, zone_id, account_id, \*\*params) -> Optional +- client.addressing.address_maps.zones.delete(address_map_id, \*, zone_id, account_id, \*\*params) -> Optional ## LOADocuments @@ -3302,7 +3285,7 @@ from cloudflare.types.addressing import LOADocumentCreateResponse Methods: -- client.addressing.loa_documents.create(\*, account_id, \*\*params) -> LOADocumentCreateResponse +- client.addressing.loa_documents.create(\*, account_id, \*\*params) -> Optional ### Downloads @@ -3321,16 +3304,16 @@ Methods: Types: ```python -from cloudflare.types.addressing import AddressingIpamPrefixes, PrefixDeleteResponse +from cloudflare.types.addressing import Prefix, PrefixDeleteResponse ``` Methods: -- client.addressing.prefixes.create(\*, account_id, \*\*params) -> AddressingIpamPrefixes -- client.addressing.prefixes.list(\*, account_id) -> SyncSinglePage[AddressingIpamPrefixes] -- client.addressing.prefixes.delete(prefix_id, \*, account_id) -> Optional -- client.addressing.prefixes.edit(prefix_id, \*, account_id, \*\*params) -> AddressingIpamPrefixes -- client.addressing.prefixes.get(prefix_id, \*, account_id) -> AddressingIpamPrefixes +- client.addressing.prefixes.create(\*, account_id, \*\*params) -> Optional +- client.addressing.prefixes.list(\*, account_id) -> SyncSinglePage[Prefix] +- client.addressing.prefixes.delete(prefix_id, \*, account_id, \*\*params) -> Optional +- client.addressing.prefixes.edit(prefix_id, \*, account_id, \*\*params) -> Optional +- client.addressing.prefixes.get(prefix_id, \*, account_id) -> Optional ### BGP @@ -3339,29 +3322,29 @@ Methods: Types: ```python -from cloudflare.types.addressing.prefixes.bgp import AddressingServiceBinding, BindingDeleteResponse +from cloudflare.types.addressing.prefixes.bgp import ServiceBinding, BindingDeleteResponse ``` Methods: -- client.addressing.prefixes.bgp.bindings.create(prefix_id, \*, account_id, \*\*params) -> AddressingServiceBinding -- client.addressing.prefixes.bgp.bindings.list(prefix_id, \*, account_id) -> SyncSinglePage[AddressingServiceBinding] +- client.addressing.prefixes.bgp.bindings.create(prefix_id, \*, account_id, \*\*params) -> Optional +- 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) -> AddressingServiceBinding +- client.addressing.prefixes.bgp.bindings.get(binding_id, \*, account_id, prefix_id) -> Optional #### Prefixes Types: ```python -from cloudflare.types.addressing.prefixes.bgp import AddressingIpamBGPPrefixes +from cloudflare.types.addressing.prefixes.bgp import BGPPrefix ``` Methods: -- client.addressing.prefixes.bgp.prefixes.list(prefix_id, \*, account_id) -> SyncSinglePage[AddressingIpamBGPPrefixes] -- client.addressing.prefixes.bgp.prefixes.edit(bgp_prefix_id, \*, account_id, prefix_id, \*\*params) -> AddressingIpamBGPPrefixes -- client.addressing.prefixes.bgp.prefixes.get(bgp_prefix_id, \*, account_id, prefix_id) -> AddressingIpamBGPPrefixes +- 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 +- client.addressing.prefixes.bgp.prefixes.get(bgp_prefix_id, \*, account_id, prefix_id) -> Optional #### Statuses @@ -3373,34 +3356,28 @@ from cloudflare.types.addressing.prefixes.bgp import StatusEditResponse, StatusG Methods: -- client.addressing.prefixes.bgp.statuses.edit(prefix_id, \*, account_id, \*\*params) -> StatusEditResponse -- client.addressing.prefixes.bgp.statuses.get(prefix_id, \*, account_id) -> StatusGetResponse +- client.addressing.prefixes.bgp.statuses.edit(prefix_id, \*, account_id, \*\*params) -> Optional +- client.addressing.prefixes.bgp.statuses.get(prefix_id, \*, account_id) -> Optional ### Delegations Types: ```python -from cloudflare.types.addressing.prefixes import AddressingIpamDelegations, DelegationDeleteResponse +from cloudflare.types.addressing.prefixes import Delegations, DelegationDeleteResponse ``` Methods: -- client.addressing.prefixes.delegations.create(prefix_id, \*, account_id, \*\*params) -> AddressingIpamDelegations -- client.addressing.prefixes.delegations.list(prefix_id, \*, account_id) -> SyncSinglePage[AddressingIpamDelegations] -- client.addressing.prefixes.delegations.delete(delegation_id, \*, account_id, prefix_id) -> DelegationDeleteResponse +- client.addressing.prefixes.delegations.create(prefix_id, \*, account_id, \*\*params) -> Optional +- client.addressing.prefixes.delegations.list(prefix_id, \*, account_id) -> SyncSinglePage[Delegations] +- client.addressing.prefixes.delegations.delete(delegation_id, \*, account_id, prefix_id, \*\*params) -> Optional # AuditLogs -Types: - -```python -from cloudflare.types import AuditLogListResponse -``` - Methods: -- client.audit_logs.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[AuditLogListResponse] +- client.audit_logs.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[AuditLog] # Billing @@ -3421,13 +3398,19 @@ Methods: Types: ```python -from cloudflare.types import IntelPhishingURLInfo, IntelPhishingURLSubmit +from cloudflare.types.brand_protection import ( + Info, + RuleMatch, + ScanStatus, + Submit, + URLInfoModelResults, +) ``` Methods: -- client.brand_protection.submit(\*, account_id, \*\*params) -> IntelPhishingURLSubmit -- client.brand_protection.url_info(\*, account_id, \*\*params) -> IntelPhishingURLInfo +- client.brand_protection.submit(\*, account_id, \*\*params) -> Submit +- client.brand_protection.url_info(\*, account_id, \*\*params) -> Info # Diagnostics @@ -3436,7 +3419,7 @@ Methods: Types: ```python -from cloudflare.types.diagnostics import MagicTransitTargetResult, TracerouteCreateResponse +from cloudflare.types.diagnostics import Traceroute, TracerouteCreateResponse ``` Methods: @@ -3457,7 +3440,7 @@ Methods: - client.images.v1.create(\*, account_id, \*\*params) -> Image - client.images.v1.list(\*, account_id, \*\*params) -> SyncV4PagePagination[V1ListResponse] -- client.images.v1.delete(image_id, \*, account_id) -> V1DeleteResponse +- client.images.v1.delete(image_id, \*, account_id, \*\*params) -> V1DeleteResponse - client.images.v1.edit(image_id, \*, account_id, \*\*params) -> Image - client.images.v1.get(image_id, \*, account_id) -> Image @@ -3466,42 +3449,48 @@ Methods: Types: ```python -from cloudflare.types.images.v1 import ImagesImageKeys +from cloudflare.types.images.v1 import Key, KeyUpdateResponse, KeyListResponse, KeyDeleteResponse ``` Methods: -- client.images.v1.keys.update(signing_key_name, \*, account_id) -> ImagesImageKeys -- client.images.v1.keys.list(\*, account_id) -> ImagesImageKeys -- client.images.v1.keys.delete(signing_key_name, \*, account_id) -> ImagesImageKeys +- client.images.v1.keys.update(signing_key_name, \*, account_id) -> KeyUpdateResponse +- client.images.v1.keys.list(\*, account_id) -> KeyListResponse +- client.images.v1.keys.delete(signing_key_name, \*, account_id) -> KeyDeleteResponse ### Stats Types: ```python -from cloudflare.types.images.v1 import ImagesImagesStats +from cloudflare.types.images.v1 import Stat ``` Methods: -- client.images.v1.stats.get(\*, account_id) -> ImagesImagesStats +- client.images.v1.stats.get(\*, account_id) -> Stat ### Variants Types: ```python -from cloudflare.types.images.v1 import V1ImageVariant, V1ImageVariants, VariantDeleteResponse +from cloudflare.types.images.v1 import ( + Variant, + VariantCreateResponse, + VariantDeleteResponse, + VariantEditResponse, + VariantGetResponse, +) ``` Methods: -- client.images.v1.variants.create(\*, account_id, \*\*params) -> V1ImageVariant -- client.images.v1.variants.list(\*, account_id) -> V1ImageVariants -- client.images.v1.variants.delete(variant_id, \*, account_id) -> VariantDeleteResponse -- client.images.v1.variants.edit(variant_id, \*, account_id, \*\*params) -> V1ImageVariant -- client.images.v1.variants.get(variant_id, \*, account_id) -> V1ImageVariant +- client.images.v1.variants.create(\*, account_id, \*\*params) -> VariantCreateResponse +- client.images.v1.variants.list(\*, account_id) -> Variant +- client.images.v1.variants.delete(variant_id, \*, account_id, \*\*params) -> VariantDeleteResponse +- client.images.v1.variants.edit(variant_id, \*, account_id, \*\*params) -> VariantEditResponse +- client.images.v1.variants.get(variant_id, \*, account_id) -> VariantGetResponse ### Blobs @@ -3537,15 +3526,9 @@ Methods: ## ASN -Types: - -```python -from cloudflare.types.intel import IntelASN -``` - Methods: -- client.intel.asn.get(asn, \*, account_id) -> IntelASN +- client.intel.asn.get(asn, \*, account_id) -> ASN ### Subnets @@ -3564,24 +3547,24 @@ Methods: Types: ```python -from cloudflare.types.intel import IntelPassiveDNSByIP +from cloudflare.types.intel import DNS, DNSListResponse ``` Methods: -- client.intel.dns.get(\*, account_id, \*\*params) -> IntelPassiveDNSByIP +- client.intel.dns.list(\*, account_id, \*\*params) -> SyncV4PagePagination[DNSListResponse] ## Domains Types: ```python -from cloudflare.types.intel import IntelDomain +from cloudflare.types.intel import Domain ``` Methods: -- client.intel.domains.get(\*, account_id, \*\*params) -> IntelDomain +- client.intel.domains.get(\*, account_id, \*\*params) -> Domain ### Bulks @@ -3600,7 +3583,7 @@ Methods: Types: ```python -from cloudflare.types.intel import IntelDomainHistory, DomainHistoryGetResponse +from cloudflare.types.intel import DomainHistory, DomainHistoryGetResponse ``` Methods: @@ -3612,7 +3595,7 @@ Methods: Types: ```python -from cloudflare.types.intel import IntelSchemasIP, IPGetResponse +from cloudflare.types.intel import IP, IPGetResponse ``` Methods: @@ -3624,7 +3607,7 @@ Methods: Types: ```python -from cloudflare.types.intel import IntelIPList, IPListGetResponse +from cloudflare.types.intel import IPList, IPListGetResponse ``` Methods: @@ -3648,12 +3631,12 @@ Methods: Types: ```python -from cloudflare.types.intel import IntelWhois +from cloudflare.types.intel import Whois ``` Methods: -- client.intel.whois.get(\*, account_id, \*\*params) -> IntelWhois +- client.intel.whois.get(\*, account_id, \*\*params) -> Whois ## IndicatorFeeds @@ -3700,12 +3683,12 @@ Methods: Types: ```python -from cloudflare.types.intel import IntelSinkholeItem +from cloudflare.types.intel import Sinkhole ``` Methods: -- client.intel.sinkholes.list(\*, account_id) -> SyncSinglePage[IntelSinkholeItem] +- client.intel.sinkholes.list(\*, account_id) -> SyncSinglePage[Sinkhole] ## AttackSurfaceReport @@ -3727,6 +3710,11 @@ Types: ```python from cloudflare.types.intel.attack_surface_report import ( + IssueClass, + IssueType, + Product, + SeverityQueryParam, + Subject, IssueListResponse, IssueClassResponse, IssueDismissResponse, @@ -3745,6 +3733,12 @@ Methods: # MagicTransit +Types: + +```python +from cloudflare.types.magic_transit import HealthCheck, HealthCheckRate, HealthCheckType +``` + ## CfInterconnects Types: @@ -3782,7 +3776,7 @@ Methods: - client.magic_transit.gre_tunnels.create(\*, account_id, \*\*params) -> GRETunnelCreateResponse - client.magic_transit.gre_tunnels.update(tunnel_identifier, \*, account_id, \*\*params) -> GRETunnelUpdateResponse - client.magic_transit.gre_tunnels.list(\*, account_id) -> GRETunnelListResponse -- client.magic_transit.gre_tunnels.delete(tunnel_identifier, \*, account_id) -> GRETunnelDeleteResponse +- client.magic_transit.gre_tunnels.delete(tunnel_identifier, \*, account_id, \*\*params) -> GRETunnelDeleteResponse - client.magic_transit.gre_tunnels.get(tunnel_identifier, \*, account_id) -> GRETunnelGetResponse ## IPSECTunnels @@ -3791,6 +3785,7 @@ Types: ```python from cloudflare.types.magic_transit import ( + PSKMetadata, IPSECTunnelCreateResponse, IPSECTunnelUpdateResponse, IPSECTunnelListResponse, @@ -3805,9 +3800,9 @@ Methods: - client.magic_transit.ipsec_tunnels.create(\*, account_id, \*\*params) -> IPSECTunnelCreateResponse - client.magic_transit.ipsec_tunnels.update(tunnel_identifier, \*, account_id, \*\*params) -> IPSECTunnelUpdateResponse - client.magic_transit.ipsec_tunnels.list(\*, account_id) -> IPSECTunnelListResponse -- client.magic_transit.ipsec_tunnels.delete(tunnel_identifier, \*, account_id) -> IPSECTunnelDeleteResponse +- client.magic_transit.ipsec_tunnels.delete(tunnel_identifier, \*, account_id, \*\*params) -> IPSECTunnelDeleteResponse - client.magic_transit.ipsec_tunnels.get(tunnel_identifier, \*, account_id) -> IPSECTunnelGetResponse -- client.magic_transit.ipsec_tunnels.psk_generate(tunnel_identifier, \*, account_id) -> IPSECTunnelPSKGenerateResponse +- client.magic_transit.ipsec_tunnels.psk_generate(tunnel_identifier, \*, account_id, \*\*params) -> IPSECTunnelPSKGenerateResponse ## Routes @@ -3815,6 +3810,9 @@ Types: ```python from cloudflare.types.magic_transit import ( + ColoName, + ColoRegion, + Scope, RouteCreateResponse, RouteUpdateResponse, RouteListResponse, @@ -3829,7 +3827,7 @@ Methods: - client.magic_transit.routes.create(\*, account_id, \*\*params) -> RouteCreateResponse - client.magic_transit.routes.update(route_identifier, \*, account_id, \*\*params) -> RouteUpdateResponse - client.magic_transit.routes.list(\*, account_id) -> RouteListResponse -- client.magic_transit.routes.delete(route_identifier, \*, account_id) -> RouteDeleteResponse +- client.magic_transit.routes.delete(route_identifier, \*, account_id, \*\*params) -> RouteDeleteResponse - client.magic_transit.routes.empty(\*, account_id, \*\*params) -> RouteEmptyResponse - client.magic_transit.routes.get(route_identifier, \*, account_id) -> RouteGetResponse @@ -3838,44 +3836,32 @@ Methods: Types: ```python -from cloudflare.types.magic_transit import ( - SiteCreateResponse, - SiteUpdateResponse, - SiteListResponse, - SiteDeleteResponse, - SiteGetResponse, -) +from cloudflare.types.magic_transit import Site, SiteLocation ``` Methods: -- client.magic_transit.sites.create(\*, account_id, \*\*params) -> SiteCreateResponse -- client.magic_transit.sites.update(site_id, \*, account_id, \*\*params) -> SiteUpdateResponse -- client.magic_transit.sites.list(\*, account_id) -> SiteListResponse -- client.magic_transit.sites.delete(site_id, \*, account_id) -> SiteDeleteResponse -- client.magic_transit.sites.get(site_id, \*, account_id) -> SiteGetResponse +- client.magic_transit.sites.create(\*, account_id, \*\*params) -> Site +- client.magic_transit.sites.update(site_id, \*, account_id, \*\*params) -> Site +- client.magic_transit.sites.list(\*, account_id, \*\*params) -> SyncSinglePage[Site] +- client.magic_transit.sites.delete(site_id, \*, account_id, \*\*params) -> Site +- client.magic_transit.sites.get(site_id, \*, account_id) -> Site ### ACLs Types: ```python -from cloudflare.types.magic_transit.sites import ( - ACLCreateResponse, - ACLUpdateResponse, - ACLListResponse, - ACLDeleteResponse, - ACLGetResponse, -) +from cloudflare.types.magic_transit.sites import ACL, ACLConfiguration, AllowedProtocol, Subnet ``` Methods: -- client.magic_transit.sites.acls.create(site_id, \*, account_id, \*\*params) -> ACLCreateResponse -- client.magic_transit.sites.acls.update(acl_identifier, \*, account_id, site_id, \*\*params) -> ACLUpdateResponse -- client.magic_transit.sites.acls.list(site_id, \*, account_id) -> ACLListResponse -- client.magic_transit.sites.acls.delete(acl_identifier, \*, account_id, site_id) -> ACLDeleteResponse -- client.magic_transit.sites.acls.get(acl_identifier, \*, account_id, site_id) -> ACLGetResponse +- client.magic_transit.sites.acls.create(site_id, \*, account_id, \*\*params) -> ACL +- client.magic_transit.sites.acls.update(acl_identifier, \*, account_id, site_id, \*\*params) -> ACL +- client.magic_transit.sites.acls.list(site_id, \*, account_id) -> SyncSinglePage[ACL] +- client.magic_transit.sites.acls.delete(acl_identifier, \*, account_id, site_id, \*\*params) -> ACL +- client.magic_transit.sites.acls.get(acl_identifier, \*, account_id, site_id) -> ACL ### LANs @@ -3883,43 +3869,39 @@ Types: ```python from cloudflare.types.magic_transit.sites import ( + DHCPRelay, + DHCPServer, + LAN, + LANStaticAddressing, + Nat, + RoutedSubnet, LANCreateResponse, - LANUpdateResponse, - LANListResponse, - LANDeleteResponse, - LANGetResponse, ) ``` Methods: - client.magic_transit.sites.lans.create(site_id, \*, account_id, \*\*params) -> LANCreateResponse -- client.magic_transit.sites.lans.update(lan_id, \*, account_id, site_id, \*\*params) -> LANUpdateResponse -- client.magic_transit.sites.lans.list(site_id, \*, account_id) -> LANListResponse -- client.magic_transit.sites.lans.delete(lan_id, \*, account_id, site_id) -> LANDeleteResponse -- client.magic_transit.sites.lans.get(lan_id, \*, account_id, site_id) -> LANGetResponse +- client.magic_transit.sites.lans.update(lan_id, \*, account_id, site_id, \*\*params) -> LAN +- client.magic_transit.sites.lans.list(site_id, \*, account_id) -> SyncSinglePage[LAN] +- client.magic_transit.sites.lans.delete(lan_id, \*, account_id, site_id, \*\*params) -> LAN +- client.magic_transit.sites.lans.get(lan_id, \*, account_id, site_id) -> LAN ### WANs Types: ```python -from cloudflare.types.magic_transit.sites import ( - WANCreateResponse, - WANUpdateResponse, - WANListResponse, - WANDeleteResponse, - WANGetResponse, -) +from cloudflare.types.magic_transit.sites import WAN, WANStaticAddressing, WANCreateResponse ``` Methods: - client.magic_transit.sites.wans.create(site_id, \*, account_id, \*\*params) -> WANCreateResponse -- client.magic_transit.sites.wans.update(wan_id, \*, account_id, site_id, \*\*params) -> WANUpdateResponse -- client.magic_transit.sites.wans.list(site_id, \*, account_id) -> WANListResponse -- client.magic_transit.sites.wans.delete(wan_id, \*, account_id, site_id) -> WANDeleteResponse -- client.magic_transit.sites.wans.get(wan_id, \*, account_id, site_id) -> WANGetResponse +- client.magic_transit.sites.wans.update(wan_id, \*, account_id, site_id, \*\*params) -> WAN +- client.magic_transit.sites.wans.list(site_id, \*, account_id) -> SyncSinglePage[WAN] +- client.magic_transit.sites.wans.delete(wan_id, \*, account_id, site_id, \*\*params) -> WAN +- client.magic_transit.sites.wans.get(wan_id, \*, account_id, site_id) -> WAN # MagicNetworkMonitoring @@ -3928,22 +3910,22 @@ Methods: Types: ```python -from cloudflare.types.magic_network_monitoring import MagicNetworkMonitoringConfig +from cloudflare.types.magic_network_monitoring import Configuration ``` Methods: -- client.magic_network_monitoring.configs.create(\*, account_id) -> MagicNetworkMonitoringConfig -- client.magic_network_monitoring.configs.update(\*, account_id) -> MagicNetworkMonitoringConfig -- client.magic_network_monitoring.configs.delete(\*, account_id) -> MagicNetworkMonitoringConfig -- client.magic_network_monitoring.configs.edit(\*, account_id) -> MagicNetworkMonitoringConfig -- client.magic_network_monitoring.configs.get(\*, account_id) -> MagicNetworkMonitoringConfig +- client.magic_network_monitoring.configs.create(\*, account_id, \*\*params) -> Configuration +- client.magic_network_monitoring.configs.update(\*, account_id, \*\*params) -> Configuration +- client.magic_network_monitoring.configs.delete(\*, account_id, \*\*params) -> Configuration +- client.magic_network_monitoring.configs.edit(\*, account_id, \*\*params) -> Configuration +- client.magic_network_monitoring.configs.get(\*, account_id) -> Configuration ### Full Methods: -- client.magic_network_monitoring.configs.full.get(\*, account_id) -> MagicNetworkMonitoringConfig +- client.magic_network_monitoring.configs.full.get(\*, account_id) -> Configuration ## Rules @@ -3955,11 +3937,11 @@ from cloudflare.types.magic_network_monitoring import MagicNetworkMonitoringRule Methods: -- client.magic_network_monitoring.rules.create(\*, account_id) -> Optional -- client.magic_network_monitoring.rules.update(\*, account_id) -> Optional +- client.magic_network_monitoring.rules.create(\*, account_id, \*\*params) -> Optional +- client.magic_network_monitoring.rules.update(\*, account_id, \*\*params) -> Optional - client.magic_network_monitoring.rules.list(\*, account_id) -> SyncSinglePage[Optional] -- client.magic_network_monitoring.rules.delete(rule_id, \*, account_id) -> Optional -- client.magic_network_monitoring.rules.edit(rule_id, \*, account_id) -> Optional +- client.magic_network_monitoring.rules.delete(rule_id, \*, account_id, \*\*params) -> Optional +- client.magic_network_monitoring.rules.edit(rule_id, \*, account_id, \*\*params) -> Optional - client.magic_network_monitoring.rules.get(rule_id, \*, account_id) -> Optional ### Advertisements @@ -3967,34 +3949,34 @@ Methods: Types: ```python -from cloudflare.types.magic_network_monitoring.rules import MagicNetworkMonitoringRuleAdvertisable +from cloudflare.types.magic_network_monitoring.rules import Advertisement ``` Methods: -- client.magic_network_monitoring.rules.advertisements.edit(rule_id, \*, account_id) -> Optional +- client.magic_network_monitoring.rules.advertisements.edit(rule_id, \*, account_id, \*\*params) -> Optional # MTLSCertificates Types: ```python -from cloudflare.types import MTLSCertificate, MTLSCertificateUpdate +from cloudflare.types.mtls_certificates import MTLSCertificate, MTLSCertificateCreateResponse ``` Methods: -- client.mtls_certificates.create(\*, account_id, \*\*params) -> MTLSCertificateUpdate -- client.mtls_certificates.list(\*, account_id) -> SyncSinglePage[MTLSCertificate] -- client.mtls_certificates.delete(mtls_certificate_id, \*, account_id) -> MTLSCertificate -- client.mtls_certificates.get(mtls_certificate_id, \*, account_id) -> MTLSCertificate +- client.mtls_certificates.create(\*, account_id, \*\*params) -> MTLSCertificateCreateResponse +- client.mtls_certificates.list(\*, account_id) -> SyncSinglePage[MTLSCertificate] +- client.mtls_certificates.delete(mtls_certificate_id, \*, account_id, \*\*params) -> MTLSCertificate +- client.mtls_certificates.get(mtls_certificate_id, \*, account_id) -> MTLSCertificate ## Associations Types: ```python -from cloudflare.types.mtls_certificates import MTLSCertificateAsssociation, AssociationGetResponse +from cloudflare.types.mtls_certificates import CertificateAsssociation, AssociationGetResponse ``` Methods: @@ -4009,8 +3991,9 @@ Types: ```python from cloudflare.types.pages import ( - PagesDeployments, - PagesProjects, + Deployment, + Project, + Stage, ProjectCreateResponse, ProjectDeleteResponse, ProjectEditResponse, @@ -4021,10 +4004,10 @@ from cloudflare.types.pages import ( Methods: - client.pages.projects.create(\*, account_id, \*\*params) -> ProjectCreateResponse -- client.pages.projects.list(\*, account_id) -> SyncSinglePage[PagesDeployments] -- client.pages.projects.delete(project_name, \*, account_id) -> object +- client.pages.projects.list(\*, account_id) -> SyncSinglePage[Deployment] +- client.pages.projects.delete(project_name, \*, account_id, \*\*params) -> object - client.pages.projects.edit(project_name, \*, account_id, \*\*params) -> ProjectEditResponse -- client.pages.projects.get(project_name, \*, account_id) -> PagesProjects +- client.pages.projects.get(project_name, \*, account_id) -> Project - client.pages.projects.purge_build_cache(project_name, \*, account_id) -> object ### Deployments @@ -4037,12 +4020,12 @@ from cloudflare.types.pages.projects import DeploymentDeleteResponse Methods: -- client.pages.projects.deployments.create(project_name, \*, account_id, \*\*params) -> PagesDeployments -- client.pages.projects.deployments.list(project_name, \*, account_id, \*\*params) -> SyncSinglePage[PagesDeployments] -- client.pages.projects.deployments.delete(deployment_id, \*, account_id, project_name) -> object -- client.pages.projects.deployments.get(deployment_id, \*, account_id, project_name) -> PagesDeployments -- client.pages.projects.deployments.retry(deployment_id, \*, account_id, project_name) -> PagesDeployments -- client.pages.projects.deployments.rollback(deployment_id, \*, account_id, project_name) -> PagesDeployments +- client.pages.projects.deployments.create(project_name, \*, account_id, \*\*params) -> Deployment +- client.pages.projects.deployments.list(project_name, \*, account_id, \*\*params) -> SyncSinglePage[Deployment] +- client.pages.projects.deployments.delete(deployment_id, \*, account_id, project_name, \*\*params) -> object +- client.pages.projects.deployments.get(deployment_id, \*, account_id, project_name) -> Deployment +- client.pages.projects.deployments.retry(deployment_id, \*, account_id, project_name, \*\*params) -> Deployment +- client.pages.projects.deployments.rollback(deployment_id, \*, account_id, project_name, \*\*params) -> Deployment #### History @@ -4076,8 +4059,8 @@ Methods: - client.pages.projects.domains.create(project_name, \*, account_id, \*\*params) -> Optional - client.pages.projects.domains.list(project_name, \*, account_id) -> SyncSinglePage[object] -- client.pages.projects.domains.delete(domain_name, \*, account_id, project_name) -> object -- client.pages.projects.domains.edit(domain_name, \*, account_id, project_name) -> Optional +- client.pages.projects.domains.delete(domain_name, \*, account_id, project_name, \*\*params) -> object +- client.pages.projects.domains.edit(domain_name, \*, account_id, project_name, \*\*params) -> Optional - client.pages.projects.domains.get(domain_name, \*, account_id, project_name) -> Optional # PCAPs @@ -4085,29 +4068,35 @@ Methods: Types: ```python -from cloudflare.types import PCAPCreateResponse, PCAPListResponse, PCAPGetResponse +from cloudflare.types.pcaps import ( + PCAP, + PCAPFilter, + PCAPCreateResponse, + PCAPListResponse, + PCAPGetResponse, +) ``` Methods: -- client.pcaps.create(\*, account_id, \*\*params) -> PCAPCreateResponse -- client.pcaps.list(\*, account_id) -> SyncSinglePage[PCAPListResponse] -- client.pcaps.get(pcap_id, \*, account_id) -> PCAPGetResponse +- client.pcaps.create(\*, account_id, \*\*params) -> PCAPCreateResponse +- client.pcaps.list(\*, account_id) -> SyncSinglePage[PCAPListResponse] +- client.pcaps.get(pcap_id, \*, account_id) -> PCAPGetResponse ## Ownership Types: ```python -from cloudflare.types.pcaps import MagicVisibilityPCAPsOwnership, OwnershipGetResponse +from cloudflare.types.pcaps import Ownership, OwnershipGetResponse ``` Methods: -- client.pcaps.ownership.create(\*, account_id, \*\*params) -> MagicVisibilityPCAPsOwnership +- client.pcaps.ownership.create(\*, account_id, \*\*params) -> Ownership - client.pcaps.ownership.delete(ownership_id, \*, account_id) -> None - client.pcaps.ownership.get(\*, account_id) -> Optional -- client.pcaps.ownership.validate(\*, account_id, \*\*params) -> MagicVisibilityPCAPsOwnership +- client.pcaps.ownership.validate(\*, account_id, \*\*params) -> Ownership ## Download @@ -4122,18 +4111,13 @@ Methods: Types: ```python -from cloudflare.types.registrar import ( - RegistrarDomains, - DomainUpdateResponse, - DomainListResponse, - DomainGetResponse, -) +from cloudflare.types.registrar import Domain, DomainUpdateResponse, DomainGetResponse ``` Methods: - client.registrar.domains.update(domain_name, \*, account_id, \*\*params) -> Optional -- client.registrar.domains.list(\*, account_id) -> SyncSinglePage[DomainListResponse] +- client.registrar.domains.list(\*, account_id) -> SyncSinglePage[Domain] - client.registrar.domains.get(domain_name, \*, account_id) -> Optional # RequestTracers @@ -4148,7 +4132,7 @@ from cloudflare.types.request_tracers import Trace, TraceItem, TraceCreateRespon Methods: -- client.request_tracers.traces.create(account_identifier, \*\*params) -> TraceCreateResponse +- client.request_tracers.traces.create(\*, account_id, \*\*params) -> Optional # Rules @@ -4157,7 +4141,7 @@ Methods: Types: ```python -from cloudflare.types.rules import ListsList, ListDeleteResponse +from cloudflare.types.rules import Hostname, ListsList, Redirect, ListDeleteResponse ``` Methods: @@ -4165,7 +4149,7 @@ Methods: - client.rules.lists.create(\*, account_id, \*\*params) -> Optional - client.rules.lists.update(list_id, \*, account_id, \*\*params) -> Optional - client.rules.lists.list(\*, account_id) -> SyncSinglePage[ListsList] -- client.rules.lists.delete(list_id, \*, account_id) -> Optional +- client.rules.lists.delete(list_id, \*, account_id, \*\*params) -> Optional - client.rules.lists.get(list_id, \*, account_id) -> Optional ### BulkOperations @@ -4173,7 +4157,7 @@ Methods: Types: ```python -from cloudflare.types.rules.lists import BulkOperationGetResponse +from cloudflare.types.rules.lists import OperationStatus, BulkOperationGetResponse ``` Methods: @@ -4186,6 +4170,8 @@ Types: ```python from cloudflare.types.rules.lists import ( + ListCursor, + ListItem, ItemCreateResponse, ItemUpdateResponse, ItemListResponse, @@ -4209,43 +4195,43 @@ Methods: Types: ```python -from cloudflare.types.storage import WorkersKVComponentsSchemasResult, WorkersKVSchemasResult +from cloudflare.types.storage import Components, Schema ``` Methods: -- client.storage.analytics.list(\*, account_id, \*\*params) -> WorkersKVSchemasResult -- client.storage.analytics.stored(\*, account_id, \*\*params) -> WorkersKVComponentsSchemasResult +- client.storage.analytics.list(\*, account_id, \*\*params) -> Schema +- client.storage.analytics.stored(\*, account_id, \*\*params) -> Components # Stream Types: ```python -from cloudflare.types import StreamVideos +from cloudflare.types.stream import AllowedOrigins, Video ``` Methods: -- client.stream.create(\*, account_id) -> None -- client.stream.list(\*, account_id, \*\*params) -> SyncSinglePage[StreamVideos] -- client.stream.delete(identifier, \*, account_id) -> None -- client.stream.get(identifier, \*, account_id) -> StreamVideos +- client.stream.create(\*, account_id, \*\*params) -> None +- client.stream.list(\*, account_id, \*\*params) -> SyncSinglePage[Video] +- client.stream.delete(identifier, \*, account_id, \*\*params) -> None +- client.stream.get(identifier, \*, account_id) -> Optional ## AudioTracks Types: ```python -from cloudflare.types.stream import StreamAudio, AudioTrackDeleteResponse, AudioTrackGetResponse +from cloudflare.types.stream import Audio, AudioTrackDeleteResponse, AudioTrackGetResponse ``` Methods: -- client.stream.audio_tracks.delete(audio_identifier, \*, account_id, identifier) -> AudioTrackDeleteResponse -- client.stream.audio_tracks.copy(identifier, \*, account_id, \*\*params) -> StreamAudio -- client.stream.audio_tracks.edit(audio_identifier, \*, account_id, identifier, \*\*params) -> StreamAudio -- client.stream.audio_tracks.get(identifier, \*, account_id) -> AudioTrackGetResponse +- client.stream.audio_tracks.delete(audio_identifier, \*, account_id, identifier) -> Optional +- client.stream.audio_tracks.copy(identifier, \*, account_id, \*\*params) -> Optional +- client.stream.audio_tracks.edit(audio_identifier, \*, account_id, identifier, \*\*params) -> Optional +- client.stream.audio_tracks.get(identifier, \*, account_id) -> Optional ## Videos @@ -4257,25 +4243,25 @@ from cloudflare.types.stream import VideoStorageUsageResponse Methods: -- client.stream.videos.storage_usage(\*, account_id, \*\*params) -> VideoStorageUsageResponse +- client.stream.videos.storage_usage(\*, account_id, \*\*params) -> Optional ## Clip Types: ```python -from cloudflare.types.stream import StreamClipping +from cloudflare.types.stream import Clip ``` Methods: -- client.stream.clip.create(\*, account_id, \*\*params) -> StreamClipping +- client.stream.clip.create(\*, account_id, \*\*params) -> Optional ## Copy Methods: -- client.stream.copy.create(\*, account_id, \*\*params) -> StreamVideos +- client.stream.copy.create(\*, account_id, \*\*params) -> Optional ## DirectUpload @@ -4287,72 +4273,67 @@ from cloudflare.types.stream import DirectUploadCreateResponse Methods: -- client.stream.direct_upload.create(\*, account_id, \*\*params) -> DirectUploadCreateResponse +- client.stream.direct_upload.create(\*, account_id, \*\*params) -> Optional ## Keys Types: ```python -from cloudflare.types.stream import StreamKeys, KeyDeleteResponse, KeyGetResponse +from cloudflare.types.stream import Keys, KeyDeleteResponse, KeyGetResponse ``` Methods: -- client.stream.keys.create(\*, account_id) -> StreamKeys -- client.stream.keys.delete(identifier, \*, account_id) -> KeyDeleteResponse -- client.stream.keys.get(\*, account_id) -> KeyGetResponse +- client.stream.keys.create(\*, account_id, \*\*params) -> Optional +- client.stream.keys.delete(identifier, \*, account_id, \*\*params) -> Optional +- client.stream.keys.get(\*, account_id) -> Optional ## LiveInputs Types: ```python -from cloudflare.types.stream import StreamLiveInput, LiveInputListResponse +from cloudflare.types.stream import LiveInput, LiveInputListResponse ``` Methods: -- client.stream.live_inputs.create(\*, account_id, \*\*params) -> StreamLiveInput -- client.stream.live_inputs.update(live_input_identifier, \*, account_id, \*\*params) -> StreamLiveInput -- client.stream.live_inputs.list(\*, account_id, \*\*params) -> LiveInputListResponse -- client.stream.live_inputs.delete(live_input_identifier, \*, account_id) -> None -- client.stream.live_inputs.get(live_input_identifier, \*, account_id) -> StreamLiveInput +- client.stream.live_inputs.create(\*, account_id, \*\*params) -> Optional +- client.stream.live_inputs.update(live_input_identifier, \*, account_id, \*\*params) -> Optional +- client.stream.live_inputs.list(\*, account_id, \*\*params) -> Optional +- client.stream.live_inputs.delete(live_input_identifier, \*, account_id, \*\*params) -> None +- client.stream.live_inputs.get(live_input_identifier, \*, account_id) -> Optional ### Outputs Types: ```python -from cloudflare.types.stream.live_inputs import StreamOutput +from cloudflare.types.stream.live_inputs import Output ``` Methods: -- client.stream.live_inputs.outputs.create(live_input_identifier, \*, account_id, \*\*params) -> StreamOutput -- client.stream.live_inputs.outputs.update(output_identifier, \*, account_id, live_input_identifier, \*\*params) -> StreamOutput -- client.stream.live_inputs.outputs.list(live_input_identifier, \*, account_id) -> SyncSinglePage[StreamOutput] -- client.stream.live_inputs.outputs.delete(output_identifier, \*, account_id, live_input_identifier) -> None +- client.stream.live_inputs.outputs.create(live_input_identifier, \*, account_id, \*\*params) -> Optional +- client.stream.live_inputs.outputs.update(output_identifier, \*, account_id, live_input_identifier, \*\*params) -> Optional +- client.stream.live_inputs.outputs.list(live_input_identifier, \*, account_id) -> SyncSinglePage[Output] +- client.stream.live_inputs.outputs.delete(output_identifier, \*, account_id, live_input_identifier, \*\*params) -> None ## Watermarks Types: ```python -from cloudflare.types.stream import ( - StreamWatermarks, - WatermarkCreateResponse, - WatermarkDeleteResponse, - WatermarkGetResponse, -) +from cloudflare.types.stream import Watermark, WatermarkDeleteResponse ``` Methods: -- client.stream.watermarks.create(\*, account_id, \*\*params) -> WatermarkCreateResponse -- client.stream.watermarks.list(\*, account_id) -> SyncSinglePage[StreamWatermarks] -- client.stream.watermarks.delete(identifier, \*, account_id) -> WatermarkDeleteResponse -- client.stream.watermarks.get(identifier, \*, account_id) -> WatermarkGetResponse +- client.stream.watermarks.create(\*, account_id, \*\*params) -> Optional +- client.stream.watermarks.list(\*, account_id) -> SyncSinglePage[Watermark] +- client.stream.watermarks.delete(identifier, \*, account_id, \*\*params) -> Optional +- client.stream.watermarks.get(identifier, \*, account_id) -> Optional ## Webhooks @@ -4364,28 +4345,47 @@ from cloudflare.types.stream import WebhookUpdateResponse, WebhookDeleteResponse Methods: -- client.stream.webhooks.update(\*, account_id, \*\*params) -> WebhookUpdateResponse -- client.stream.webhooks.delete(\*, account_id) -> WebhookDeleteResponse -- client.stream.webhooks.get(\*, account_id) -> WebhookGetResponse +- client.stream.webhooks.update(\*, account_id, \*\*params) -> Optional +- client.stream.webhooks.delete(\*, account_id, \*\*params) -> Optional +- client.stream.webhooks.get(\*, account_id) -> Optional ## Captions Types: ```python -from cloudflare.types.stream import ( - StreamCaptions, - CaptionUpdateResponse, - CaptionDeleteResponse, - CaptionGetResponse, -) +from cloudflare.types.stream import Caption, CaptionGetResponse +``` + +Methods: + +- client.stream.captions.get(identifier, \*, account_id) -> Optional + +### Language + +Types: + +```python +from cloudflare.types.stream.captions import LanguageDeleteResponse ``` Methods: -- client.stream.captions.update(language, \*, account_id, identifier, \*\*params) -> CaptionUpdateResponse -- client.stream.captions.delete(language, \*, account_id, identifier) -> CaptionDeleteResponse -- client.stream.captions.get(identifier, \*, account_id) -> CaptionGetResponse +- client.stream.captions.language.update(language, \*, account_id, identifier, \*\*params) -> Optional +- client.stream.captions.language.delete(language, \*, account_id, identifier, \*\*params) -> str +- client.stream.captions.language.get(language, \*, account_id, identifier) -> Optional + +#### Vtt + +Types: + +```python +from cloudflare.types.stream.captions.language import VttGetResponse +``` + +Methods: + +- client.stream.captions.language.vtt.get(language, \*, account_id, identifier) -> str ## Downloads @@ -4401,9 +4401,9 @@ from cloudflare.types.stream import ( Methods: -- client.stream.downloads.create(identifier, \*, account_id) -> DownloadCreateResponse -- client.stream.downloads.delete(identifier, \*, account_id) -> DownloadDeleteResponse -- client.stream.downloads.get(identifier, \*, account_id) -> DownloadGetResponse +- client.stream.downloads.create(identifier, \*, account_id, \*\*params) -> Optional +- client.stream.downloads.delete(identifier, \*, account_id) -> Optional +- client.stream.downloads.get(identifier, \*, account_id) -> Optional ## Embed @@ -4427,10 +4427,16 @@ from cloudflare.types.stream import TokenCreateResponse Methods: -- client.stream.token.create(identifier, \*, account_id, \*\*params) -> TokenCreateResponse +- client.stream.token.create(identifier, \*, account_id, \*\*params) -> Optional # Alerting +Types: + +```python +from cloudflare.types.alerting import Alert +``` + ## AvailableAlerts Types: @@ -4463,7 +4469,7 @@ Types: ```python from cloudflare.types.alerting.destinations import ( - AlertingPagerduty, + Pagerduty, PagerdutyCreateResponse, PagerdutyDeleteResponse, PagerdutyGetResponse, @@ -4484,7 +4490,7 @@ Types: ```python from cloudflare.types.alerting.destinations import ( - AlertingWebhooks, + Webhooks, WebhookCreateResponse, WebhookUpdateResponse, WebhookDeleteResponse, @@ -4495,21 +4501,21 @@ Methods: - client.alerting.destinations.webhooks.create(\*, account_id, \*\*params) -> WebhookCreateResponse - client.alerting.destinations.webhooks.update(webhook_id, \*, account_id, \*\*params) -> WebhookUpdateResponse -- client.alerting.destinations.webhooks.list(\*, account_id) -> SyncSinglePage[AlertingWebhooks] +- client.alerting.destinations.webhooks.list(\*, account_id) -> SyncSinglePage[Webhooks] - client.alerting.destinations.webhooks.delete(webhook_id, \*, account_id) -> Optional -- client.alerting.destinations.webhooks.get(webhook_id, \*, account_id) -> AlertingWebhooks +- client.alerting.destinations.webhooks.get(webhook_id, \*, account_id) -> Webhooks ## History Types: ```python -from cloudflare.types.alerting import AlertingHistory +from cloudflare.types.alerting import History ``` Methods: -- client.alerting.history.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[AlertingHistory] +- client.alerting.history.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[History] ## Policies @@ -4517,7 +4523,9 @@ Types: ```python from cloudflare.types.alerting import ( - AlertingPolicies, + Mechanism, + Policy, + PolicyFilter, PolicyCreateResponse, PolicyUpdateResponse, PolicyDeleteResponse, @@ -4528,21 +4536,27 @@ Methods: - client.alerting.policies.create(\*, account_id, \*\*params) -> PolicyCreateResponse - client.alerting.policies.update(policy_id, \*, account_id, \*\*params) -> PolicyUpdateResponse -- client.alerting.policies.list(\*, account_id) -> SyncSinglePage[AlertingPolicies] +- client.alerting.policies.list(\*, account_id) -> SyncSinglePage[Policy] - client.alerting.policies.delete(policy_id, \*, account_id) -> Optional -- client.alerting.policies.get(policy_id, \*, account_id) -> AlertingPolicies +- client.alerting.policies.get(policy_id, \*, account_id) -> Policy # D1 +Types: + +```python +from cloudflare.types.d1 import D1 +``` + ## Database Types: ```python from cloudflare.types.d1 import ( - D1CreateDatabase, - D1DatabaseDetails, - D1QueryResult, + QueryResult, + DatabaseCreateResponse, + DatabaseListResponse, DatabaseDeleteResponse, DatabaseQueryResponse, ) @@ -4550,10 +4564,10 @@ from cloudflare.types.d1 import ( Methods: -- client.d1.database.create(\*, account_id, \*\*params) -> D1CreateDatabase -- client.d1.database.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[D1CreateDatabase] -- client.d1.database.delete(database_identifier, \*, account_identifier) -> Optional -- client.d1.database.get(database_identifier, \*, account_identifier) -> D1DatabaseDetails +- client.d1.database.create(\*, account_id, \*\*params) -> DatabaseCreateResponse +- client.d1.database.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DatabaseListResponse] +- client.d1.database.delete(database_identifier, \*, account_identifier) -> DatabaseDeleteResponse +- client.d1.database.get(database_identifier, \*, account_identifier) -> D1 - client.d1.database.query(database_identifier, \*, account_identifier, \*\*params) -> DatabaseQueryResponse # R2 @@ -4563,36 +4577,36 @@ Methods: Types: ```python -from cloudflare.types.r2 import R2Bucket, BucketDeleteResponse +from cloudflare.types.r2 import Bucket, BucketDeleteResponse ``` Methods: -- client.r2.buckets.create(\*, account_id, \*\*params) -> R2Bucket -- client.r2.buckets.list(\*, account_id, \*\*params) -> SyncCursorPagination[R2Bucket] +- client.r2.buckets.create(\*, account_id, \*\*params) -> Bucket +- client.r2.buckets.list(\*, account_id, \*\*params) -> SyncCursorPagination[Bucket] - client.r2.buckets.delete(bucket_name, \*, account_id) -> object -- client.r2.buckets.get(bucket_name, \*, account_id) -> R2Bucket +- client.r2.buckets.get(bucket_name, \*, account_id) -> Bucket ## Sippy Types: ```python -from cloudflare.types.r2 import R2Sippy, SippyDeleteResponse +from cloudflare.types.r2 import Provider, Sippy, SippyDeleteResponse ``` Methods: -- client.r2.sippy.update(bucket_name, \*, account_id, \*\*params) -> R2Sippy +- client.r2.sippy.update(bucket_name, \*, account_id, \*\*params) -> Sippy - client.r2.sippy.delete(bucket_name, \*, account_id) -> SippyDeleteResponse -- client.r2.sippy.get(bucket_name, \*, account_id) -> R2Sippy +- client.r2.sippy.get(bucket_name, \*, account_id) -> Sippy # WARPConnector Types: ```python -from cloudflare.types import ( +from cloudflare.types.warp_connector import ( WARPConnectorCreateResponse, WARPConnectorListResponse, WARPConnectorDeleteResponse, @@ -4604,12 +4618,12 @@ from cloudflare.types import ( Methods: -- client.warp_connector.create(\*, account_id, \*\*params) -> WARPConnectorCreateResponse -- client.warp_connector.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WARPConnectorListResponse] -- client.warp_connector.delete(tunnel_id, \*, account_id, \*\*params) -> WARPConnectorDeleteResponse -- client.warp_connector.edit(tunnel_id, \*, account_id, \*\*params) -> WARPConnectorEditResponse -- client.warp_connector.get(tunnel_id, \*, account_id) -> WARPConnectorGetResponse -- client.warp_connector.token(tunnel_id, \*, account_id) -> WARPConnectorTokenResponse +- client.warp_connector.create(\*, account_id, \*\*params) -> WARPConnectorCreateResponse +- client.warp_connector.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WARPConnectorListResponse] +- client.warp_connector.delete(tunnel_id, \*, account_id, \*\*params) -> WARPConnectorDeleteResponse +- client.warp_connector.edit(tunnel_id, \*, account_id, \*\*params) -> WARPConnectorEditResponse +- client.warp_connector.get(tunnel_id, \*, account_id) -> WARPConnectorGetResponse +- client.warp_connector.token(tunnel_id, \*, account_id) -> WARPConnectorTokenResponse # WorkersForPlatforms @@ -4630,32 +4644,30 @@ from cloudflare.types.workers_for_platforms.dispatch import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.create(\*, account_id, \*\*params) -> NamespaceCreateResponse +- client.workers_for_platforms.dispatch.namespaces.create(\*, account_id, \*\*params) -> Optional - client.workers_for_platforms.dispatch.namespaces.list(\*, account_id) -> SyncSinglePage[NamespaceListResponse] - client.workers_for_platforms.dispatch.namespaces.delete(dispatch_namespace, \*, account_id) -> object -- client.workers_for_platforms.dispatch.namespaces.get(dispatch_namespace, \*, account_id) -> NamespaceGetResponse +- client.workers_for_platforms.dispatch.namespaces.get(dispatch_namespace, \*, account_id) -> Optional #### Scripts Types: ```python -from cloudflare.types.workers_for_platforms.dispatch.namespaces import ( - WorkersForPlatformsNamespaceScript, -) +from cloudflare.types.workers_for_platforms.dispatch.namespaces import Script ``` Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> WorkersScript +- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional - 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) -> WorkersForPlatformsNamespaceScript +- client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> Optional ##### Content Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> WorkersScript +- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional - client.workers_for_platforms.dispatch.namespaces.scripts.content.get(script_name, \*, account_id, dispatch_namespace) -> BinaryAPIResponse ##### Settings @@ -4671,8 +4683,8 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SettingEditResponse -- client.workers_for_platforms.dispatch.namespaces.scripts.settings.get(script_name, \*, account_id, dispatch_namespace) -> SettingGetResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional +- client.workers_for_platforms.dispatch.namespaces.scripts.settings.get(script_name, \*, account_id, dispatch_namespace) -> Optional ##### Bindings @@ -4684,7 +4696,41 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import B Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> BindingGetResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> Optional + +##### Secrets + +Types: + +```python +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( + SecretUpdateResponse, + SecretListResponse, +) +``` + +Methods: + +- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional +- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[SecretListResponse] + +##### Tags + +Types: + +```python +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( + TagUpdateResponse, + TagListResponse, + TagDeleteResponse, +) +``` + +Methods: + +- client.workers_for_platforms.dispatch.namespaces.scripts.tags.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional +- client.workers_for_platforms.dispatch.namespaces.scripts.tags.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[TagListResponse] +- client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete(tag, \*, account_id, dispatch_namespace, script_name) -> object # ZeroTrust @@ -4693,61 +4739,66 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import ZeroTrustDevices, DeviceGetResponse +from cloudflare.types.zero_trust import Device, DeviceGetResponse ``` Methods: -- client.zero_trust.devices.list(\*, account_id) -> SyncSinglePage[ZeroTrustDevices] -- client.zero_trust.devices.get(device_id, \*, account_id) -> Optional +- client.zero_trust.devices.list(\*, account_id) -> SyncSinglePage[Device] +- client.zero_trust.devices.get(device_id, \*, account_id) -> DeviceGetResponse ### DEXTests Types: ```python -from cloudflare.types.zero_trust.devices import DEXTestSchemasHTTP, DEXTestDeleteResponse +from cloudflare.types.zero_trust.devices import ( + DEXTest, + SchemaData, + SchemaHTTP, + DEXTestDeleteResponse, +) ``` Methods: -- client.zero_trust.devices.dex_tests.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.dex_tests.update(dex_test_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.dex_tests.list(\*, account_id) -> SyncSinglePage[DEXTestSchemasHTTP] +- client.zero_trust.devices.dex_tests.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.dex_tests.update(dex_test_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.dex_tests.list(\*, account_id) -> SyncSinglePage[SchemaHTTP] - client.zero_trust.devices.dex_tests.delete(dex_test_id, \*, account_id) -> Optional -- client.zero_trust.devices.dex_tests.get(dex_test_id, \*, account_id) -> Optional +- client.zero_trust.devices.dex_tests.get(dex_test_id, \*, account_id) -> Optional ### Networks Types: ```python -from cloudflare.types.zero_trust.devices import DeviceManagedNetworks, NetworkDeleteResponse +from cloudflare.types.zero_trust.devices import DeviceNetwork, NetworkDeleteResponse ``` Methods: -- client.zero_trust.devices.networks.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.networks.update(network_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.networks.list(\*, account_id) -> SyncSinglePage[DeviceManagedNetworks] -- client.zero_trust.devices.networks.delete(network_id, \*, account_id) -> Optional -- client.zero_trust.devices.networks.get(network_id, \*, account_id) -> Optional +- client.zero_trust.devices.networks.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.networks.update(network_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.networks.list(\*, account_id) -> SyncSinglePage[DeviceNetwork] +- client.zero_trust.devices.networks.delete(network_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.networks.get(network_id, \*, account_id) -> Optional ### Policies Types: ```python -from cloudflare.types.zero_trust.devices import DevicesDeviceSettingsPolicy, PolicyDeleteResponse +from cloudflare.types.zero_trust.devices import SettingsPolicy, PolicyDeleteResponse ``` Methods: -- client.zero_trust.devices.policies.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.list(\*, account_id) -> SyncSinglePage[DevicesDeviceSettingsPolicy] -- client.zero_trust.devices.policies.delete(policy_id, \*, account_id) -> Optional -- client.zero_trust.devices.policies.edit(policy_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.get(policy_id, \*, account_id) -> Optional +- client.zero_trust.devices.policies.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.policies.list(\*, account_id) -> SyncSinglePage[SettingsPolicy] +- client.zero_trust.devices.policies.delete(policy_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.policies.edit(policy_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.policies.get(policy_id, \*, account_id) -> Optional #### DefaultPolicy @@ -4767,7 +4818,7 @@ Types: ```python from cloudflare.types.zero_trust.devices.policies import ( - DevicesSplitTunnel, + SplitTunnelExclude, ExcludeUpdateResponse, ExcludeGetResponse, ) @@ -4776,7 +4827,7 @@ from cloudflare.types.zero_trust.devices.policies import ( Methods: - client.zero_trust.devices.policies.excludes.update(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.excludes.list(\*, account_id) -> SyncSinglePage[DevicesSplitTunnel] +- client.zero_trust.devices.policies.excludes.list(\*, account_id) -> SyncSinglePage[SplitTunnelExclude] - client.zero_trust.devices.policies.excludes.get(policy_id, \*, account_id) -> Optional #### FallbackDomains @@ -4785,7 +4836,8 @@ Types: ```python from cloudflare.types.zero_trust.devices.policies import ( - DevicesFallbackDomain, + FallbackDomain, + FallbackDomainPolicy, FallbackDomainUpdateResponse, FallbackDomainGetResponse, ) @@ -4794,7 +4846,7 @@ from cloudflare.types.zero_trust.devices.policies import ( Methods: - client.zero_trust.devices.policies.fallback_domains.update(policy_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.fallback_domains.list(\*, account_id) -> SyncSinglePage[DevicesFallbackDomain] +- client.zero_trust.devices.policies.fallback_domains.list(\*, account_id) -> SyncSinglePage[FallbackDomain] - client.zero_trust.devices.policies.fallback_domains.get(policy_id, \*, account_id) -> Optional #### Includes @@ -4803,7 +4855,7 @@ Types: ```python from cloudflare.types.zero_trust.devices.policies import ( - DevicesSplitTunnelInclude, + SplitTunnelInclude, IncludeUpdateResponse, IncludeGetResponse, ) @@ -4812,7 +4864,7 @@ from cloudflare.types.zero_trust.devices.policies import ( Methods: - client.zero_trust.devices.policies.includes.update(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.includes.list(\*, account_id) -> SyncSinglePage[DevicesSplitTunnelInclude] +- client.zero_trust.devices.policies.includes.list(\*, account_id) -> SyncSinglePage[SplitTunnelInclude] - client.zero_trust.devices.policies.includes.get(policy_id, \*, account_id) -> Optional ### Posture @@ -4820,35 +4872,52 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.devices import DevicePostureRules, PostureDeleteResponse +from cloudflare.types.zero_trust.devices import ( + CarbonblackInput, + ClientCertificateInput, + CrowdstrikeInput, + DeviceInput, + DeviceMatch, + DevicePostureRule, + DiskEncryptionInput, + DomainJoinedInput, + FileInput, + FirewallInput, + IntuneInput, + KolideInput, + OSVersionInput, + SentineloneInput, + SentineloneS2sInput, + TaniumInput, + UniqueClientIDInput, + WorkspaceOneInput, + PostureDeleteResponse, +) ``` Methods: -- client.zero_trust.devices.posture.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.posture.update(rule_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.posture.list(\*, account_id) -> SyncSinglePage[DevicePostureRules] -- client.zero_trust.devices.posture.delete(rule_id, \*, account_id) -> Optional -- client.zero_trust.devices.posture.get(rule_id, \*, account_id) -> Optional +- client.zero_trust.devices.posture.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.posture.update(rule_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.posture.list(\*, account_id) -> SyncSinglePage[DevicePostureRule] +- client.zero_trust.devices.posture.delete(rule_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.posture.get(rule_id, \*, account_id) -> Optional #### Integrations Types: ```python -from cloudflare.types.zero_trust.devices.posture import ( - DevicePostureIntegrations, - IntegrationDeleteResponse, -) +from cloudflare.types.zero_trust.devices.posture import Integration, IntegrationDeleteResponse ``` Methods: -- client.zero_trust.devices.posture.integrations.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.posture.integrations.list(\*, account_id) -> SyncSinglePage[DevicePostureIntegrations] -- client.zero_trust.devices.posture.integrations.delete(integration_id, \*, account_id) -> Optional -- client.zero_trust.devices.posture.integrations.edit(integration_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.posture.integrations.get(integration_id, \*, account_id) -> Optional +- client.zero_trust.devices.posture.integrations.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.posture.integrations.list(\*, account_id) -> SyncSinglePage[Integration] +- client.zero_trust.devices.posture.integrations.delete(integration_id, \*, account_id, \*\*params) -> IntegrationDeleteResponse +- client.zero_trust.devices.posture.integrations.edit(integration_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.posture.integrations.get(integration_id, \*, account_id) -> Optional ### Revoke @@ -4860,20 +4929,20 @@ from cloudflare.types.zero_trust.devices import RevokeCreateResponse Methods: -- client.zero_trust.devices.revoke.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.revoke.create(\*, account_id, \*\*params) -> RevokeCreateResponse ### Settings Types: ```python -from cloudflare.types.zero_trust.devices import ZeroTrustAccountDeviceSettings +from cloudflare.types.zero_trust.devices import DeviceSettings ``` Methods: -- client.zero_trust.devices.settings.update(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.settings.list(\*, account_id) -> Optional +- client.zero_trust.devices.settings.update(\*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.settings.list(\*, account_id) -> Optional ### Unrevoke @@ -4885,7 +4954,7 @@ from cloudflare.types.zero_trust.devices import UnrevokeCreateResponse Methods: -- client.zero_trust.devices.unrevoke.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.devices.unrevoke.create(\*, account_id, \*\*params) -> UnrevokeCreateResponse ### OverrideCodes @@ -4905,7 +4974,11 @@ Types: ```python from cloudflare.types.zero_trust import ( - ZeroTrustIdentityProviders, + AzureAD, + GenericOAuthConfig, + IdentityProvider, + IdentityProviderType, + ScimConfig, IdentityProviderListResponse, IdentityProviderDeleteResponse, ) @@ -4913,25 +4986,25 @@ from cloudflare.types.zero_trust import ( Methods: -- client.zero_trust.identity_providers.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustIdentityProviders -- client.zero_trust.identity_providers.update(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustIdentityProviders +- client.zero_trust.identity_providers.create(\*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.identity_providers.update(uuid, \*, account_id, zone_id, \*\*params) -> Optional - client.zero_trust.identity_providers.list(\*, account_id, zone_id) -> SyncSinglePage[IdentityProviderListResponse] -- client.zero_trust.identity_providers.delete(uuid, \*, account_id, zone_id) -> IdentityProviderDeleteResponse -- client.zero_trust.identity_providers.get(uuid, \*, account_id, zone_id) -> ZeroTrustIdentityProviders +- client.zero_trust.identity_providers.delete(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.identity_providers.get(uuid, \*, account_id, zone_id) -> Optional ## Organizations Types: ```python -from cloudflare.types.zero_trust import ZeroTrustOrganizations, OrganizationRevokeUsersResponse +from cloudflare.types.zero_trust import LoginDesign, Organization, OrganizationRevokeUsersResponse ``` Methods: -- client.zero_trust.organizations.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustOrganizations -- client.zero_trust.organizations.update(\*, account_id, zone_id, \*\*params) -> ZeroTrustOrganizations -- client.zero_trust.organizations.list(\*, account_id, zone_id) -> ZeroTrustOrganizations +- client.zero_trust.organizations.create(\*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.organizations.update(\*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.organizations.list(\*, account_id, zone_id) -> Optional - client.zero_trust.organizations.revoke_users(\*, account_id, zone_id, \*\*params) -> Optional ## Seats @@ -4939,7 +5012,7 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import ZeroTrustSeats, SeatEditResponse +from cloudflare.types.zero_trust import Seat, SeatEditResponse ``` Methods: @@ -4948,13 +5021,52 @@ Methods: ## Access +Types: + +```python +from cloudflare.types.zero_trust import ( + AccessDevicePostureRule, + AccessRule, + AnyValidServiceTokenRule, + AuthenticationMethodRule, + AzureGroupRule, + CertificateRule, + CountryRule, + DomainRule, + EmailListRule, + EmailRule, + EveryoneRule, + ExternalEvaluationRule, + GitHubOrganizationRule, + GroupRule, + GSuiteGroupRule, + IPListRule, + IPRule, + OktaGroupRule, + SAMLGroupRule, + ServiceTokenRule, +) +``` + ### Applications Types: ```python from cloudflare.types.zero_trust.access import ( - ZeroTrustApps, + AllowedHeadersh, + AllowedIdpsh, + AllowedMethodsh, + AllowedOriginsh, + AppID, + Application, + CORSHeaders, + CustomPagesh, + SaaSAppNameFormat, + SaaSAppNameIDFormat, + SaaSAppSource, + SAMLSaaSApp, + SelfHostedDomainsh, ApplicationDeleteResponse, ApplicationRevokeTokensResponse, ) @@ -4962,11 +5074,11 @@ from cloudflare.types.zero_trust.access import ( Methods: -- client.zero_trust.access.applications.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustApps -- client.zero_trust.access.applications.update(app_id, \*, account_id, zone_id, \*\*params) -> ZeroTrustApps -- client.zero_trust.access.applications.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustApps] -- client.zero_trust.access.applications.delete(app_id, \*, account_id, zone_id) -> ApplicationDeleteResponse -- client.zero_trust.access.applications.get(app_id, \*, account_id, zone_id) -> ZeroTrustApps +- client.zero_trust.access.applications.create(\*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.applications.update(app_id, \*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.applications.list(\*, account_id, zone_id) -> SyncSinglePage[Application] +- client.zero_trust.access.applications.delete(app_id, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.get(app_id, \*, account_id, zone_id) -> Optional - client.zero_trust.access.applications.revoke_tokens(app_id, \*, account_id, zone_id) -> object #### CAs @@ -4975,7 +5087,7 @@ Types: ```python from cloudflare.types.zero_trust.access.applications import ( - ZeroTrustCA, + CA, CACreateResponse, CADeleteResponse, CAGetResponse, @@ -4984,54 +5096,65 @@ from cloudflare.types.zero_trust.access.applications import ( Methods: -- client.zero_trust.access.applications.cas.create(uuid, \*, account_id, zone_id) -> CACreateResponse -- client.zero_trust.access.applications.cas.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustCA] -- client.zero_trust.access.applications.cas.delete(uuid, \*, account_id, zone_id) -> CADeleteResponse -- client.zero_trust.access.applications.cas.get(uuid, \*, account_id, zone_id) -> CAGetResponse +- client.zero_trust.access.applications.cas.create(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.cas.list(\*, account_id, zone_id) -> SyncSinglePage[CA] +- client.zero_trust.access.applications.cas.delete(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.cas.get(uuid, \*, account_id, zone_id) -> Optional #### UserPolicyChecks Types: ```python -from cloudflare.types.zero_trust.access.applications import UserPolicyCheckListResponse +from cloudflare.types.zero_trust.access.applications import ( + UserPolicyCheckGeo, + UserPolicyCheckListResponse, +) ``` Methods: -- client.zero_trust.access.applications.user_policy_checks.list(app_id, \*, account_id, zone_id) -> UserPolicyCheckListResponse +- client.zero_trust.access.applications.user_policy_checks.list(app_id, \*, account_id, zone_id) -> Optional #### Policies Types: ```python -from cloudflare.types.zero_trust.access.applications import ZeroTrustPolicies, PolicyDeleteResponse +from cloudflare.types.zero_trust.access.applications import ( + ApprovalGroup, + Policy, + PolicyDeleteResponse, +) ``` Methods: -- client.zero_trust.access.applications.policies.create(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustPolicies -- client.zero_trust.access.applications.policies.update(uuid, \*, uuid1, account_id, zone_id, \*\*params) -> ZeroTrustPolicies -- client.zero_trust.access.applications.policies.list(uuid, \*, account_id, zone_id) -> SyncSinglePage[ZeroTrustPolicies] -- client.zero_trust.access.applications.policies.delete(uuid, \*, uuid1, account_id, zone_id) -> PolicyDeleteResponse -- client.zero_trust.access.applications.policies.get(uuid, \*, uuid1, account_id, zone_id) -> ZeroTrustPolicies +- client.zero_trust.access.applications.policies.create(uuid, \*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.applications.policies.update(uuid, \*, uuid1, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.applications.policies.list(uuid, \*, account_id, zone_id) -> SyncSinglePage[Policy] +- client.zero_trust.access.applications.policies.delete(uuid, \*, uuid1, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.policies.get(uuid, \*, uuid1, account_id, zone_id) -> Optional ### Certificates Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustCertificates, CertificateDeleteResponse +from cloudflare.types.zero_trust.access import ( + AssociatedHostnames, + Certificate, + CertificateDeleteResponse, +) ``` Methods: -- client.zero_trust.access.certificates.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustCertificates -- client.zero_trust.access.certificates.update(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustCertificates -- client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustCertificates] -- client.zero_trust.access.certificates.delete(uuid, \*, account_id, zone_id) -> CertificateDeleteResponse -- client.zero_trust.access.certificates.get(uuid, \*, account_id, zone_id) -> ZeroTrustCertificates +- client.zero_trust.access.certificates.create(\*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.certificates.update(uuid, \*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> SyncSinglePage[Certificate] +- client.zero_trust.access.certificates.delete(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.certificates.get(uuid, \*, account_id, zone_id) -> Optional #### Settings @@ -5039,7 +5162,7 @@ Types: ```python from cloudflare.types.zero_trust.access.certificates import ( - ZeroTrustSettings, + CertificateSettings, SettingUpdateResponse, SettingGetResponse, ) @@ -5055,16 +5178,16 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustGroups, GroupDeleteResponse +from cloudflare.types.zero_trust.access import ZeroTrustGroup, GroupDeleteResponse ``` Methods: -- client.zero_trust.access.groups.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustGroups -- client.zero_trust.access.groups.update(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustGroups -- client.zero_trust.access.groups.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustGroups] -- client.zero_trust.access.groups.delete(uuid, \*, account_id, zone_id) -> GroupDeleteResponse -- client.zero_trust.access.groups.get(uuid, \*, account_id, zone_id) -> ZeroTrustGroups +- client.zero_trust.access.groups.create(\*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.groups.update(uuid, \*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.groups.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustGroup] +- client.zero_trust.access.groups.delete(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.groups.get(uuid, \*, account_id, zone_id) -> Optional ### ServiceTokens @@ -5072,7 +5195,7 @@ Types: ```python from cloudflare.types.zero_trust.access import ( - ZeroTrustServiceTokens, + ServiceToken, ServiceTokenCreateResponse, ServiceTokenRotateResponse, ) @@ -5080,28 +5203,28 @@ from cloudflare.types.zero_trust.access import ( Methods: -- client.zero_trust.access.service_tokens.create(\*, account_id, zone_id, \*\*params) -> ServiceTokenCreateResponse -- client.zero_trust.access.service_tokens.update(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustServiceTokens -- client.zero_trust.access.service_tokens.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustServiceTokens] -- client.zero_trust.access.service_tokens.delete(uuid, \*, account_id, zone_id) -> ZeroTrustServiceTokens -- client.zero_trust.access.service_tokens.refresh(uuid, \*, identifier) -> ZeroTrustServiceTokens -- client.zero_trust.access.service_tokens.rotate(uuid, \*, identifier) -> ServiceTokenRotateResponse +- client.zero_trust.access.service_tokens.create(\*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.service_tokens.update(uuid, \*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.service_tokens.list(\*, account_id, zone_id) -> SyncSinglePage[ServiceToken] +- client.zero_trust.access.service_tokens.delete(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.service_tokens.refresh(uuid, \*, identifier) -> Optional +- client.zero_trust.access.service_tokens.rotate(uuid, \*, identifier) -> Optional ### Bookmarks Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustBookmarks, BookmarkDeleteResponse +from cloudflare.types.zero_trust.access import Bookmark, BookmarkDeleteResponse ``` Methods: -- client.zero_trust.access.bookmarks.create(uuid, \*, identifier) -> ZeroTrustBookmarks -- client.zero_trust.access.bookmarks.update(uuid, \*, identifier) -> ZeroTrustBookmarks -- client.zero_trust.access.bookmarks.list(identifier) -> SyncSinglePage[ZeroTrustBookmarks] -- client.zero_trust.access.bookmarks.delete(uuid, \*, identifier) -> BookmarkDeleteResponse -- client.zero_trust.access.bookmarks.get(uuid, \*, identifier) -> ZeroTrustBookmarks +- client.zero_trust.access.bookmarks.create(uuid, \*, identifier, \*\*params) -> Optional +- client.zero_trust.access.bookmarks.update(uuid, \*, identifier, \*\*params) -> Optional +- client.zero_trust.access.bookmarks.list(identifier) -> SyncSinglePage[Bookmark] +- client.zero_trust.access.bookmarks.delete(uuid, \*, identifier, \*\*params) -> Optional +- client.zero_trust.access.bookmarks.get(uuid, \*, identifier) -> Optional ### Keys @@ -5113,9 +5236,9 @@ from cloudflare.types.zero_trust.access import KeyUpdateResponse, KeyGetResponse Methods: -- client.zero_trust.access.keys.update(identifier, \*\*params) -> KeyUpdateResponse -- client.zero_trust.access.keys.get(identifier) -> KeyGetResponse -- client.zero_trust.access.keys.rotate(identifier) -> KeyRotateResponse +- client.zero_trust.access.keys.update(identifier, \*\*params) -> Optional +- client.zero_trust.access.keys.get(identifier) -> Optional +- client.zero_trust.access.keys.rotate(identifier) -> Optional ### Logs @@ -5124,10 +5247,7 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access.logs import ( - ZeroTrustAccessRequests, - AccessRequestListResponse, -) +from cloudflare.types.zero_trust.access.logs import AccessRequests, AccessRequestListResponse ``` Methods: @@ -5139,12 +5259,12 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustUsers +from cloudflare.types.zero_trust.access import AccessUser ``` Methods: -- client.zero_trust.access.users.list(identifier) -> SyncSinglePage[ZeroTrustUsers] +- client.zero_trust.access.users.list(identifier) -> SyncSinglePage[AccessUser] #### ActiveSessions @@ -5160,19 +5280,19 @@ from cloudflare.types.zero_trust.access.users import ( Methods: - client.zero_trust.access.users.active_sessions.list(id, \*, identifier) -> SyncSinglePage[ActiveSessionListResponse] -- client.zero_trust.access.users.active_sessions.get(nonce, \*, identifier, id) -> ActiveSessionGetResponse +- client.zero_trust.access.users.active_sessions.get(nonce, \*, identifier, id) -> Optional #### LastSeenIdentity Types: ```python -from cloudflare.types.zero_trust.access.users import ZeroTrustIdentity +from cloudflare.types.zero_trust.access.users import Identity ``` Methods: -- client.zero_trust.access.users.last_seen_identity.get(id, \*, identifier) -> ZeroTrustIdentity +- client.zero_trust.access.users.last_seen_identity.get(id, \*, identifier) -> Optional #### FailedLogins @@ -5192,38 +5312,49 @@ Types: ```python from cloudflare.types.zero_trust.access import ( - ZeroTrustCustomPage, - ZeroTrustCustomPageWithoutHTML, + CustomPage, + CustomPageWithoutHTML, CustomPageDeleteResponse, ) ``` Methods: -- client.zero_trust.access.custom_pages.create(identifier, \*\*params) -> ZeroTrustCustomPageWithoutHTML -- client.zero_trust.access.custom_pages.update(uuid, \*, identifier, \*\*params) -> ZeroTrustCustomPageWithoutHTML -- client.zero_trust.access.custom_pages.list(identifier) -> SyncSinglePage[ZeroTrustCustomPageWithoutHTML] -- client.zero_trust.access.custom_pages.delete(uuid, \*, identifier) -> CustomPageDeleteResponse -- client.zero_trust.access.custom_pages.get(uuid, \*, identifier) -> ZeroTrustCustomPage +- client.zero_trust.access.custom_pages.create(identifier, \*\*params) -> Optional +- client.zero_trust.access.custom_pages.update(uuid, \*, identifier, \*\*params) -> Optional +- client.zero_trust.access.custom_pages.list(identifier) -> SyncSinglePage[CustomPageWithoutHTML] +- client.zero_trust.access.custom_pages.delete(uuid, \*, identifier) -> Optional +- client.zero_trust.access.custom_pages.get(uuid, \*, identifier) -> Optional ### Tags Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustTag, TagDeleteResponse +from cloudflare.types.zero_trust.access import Tag, TagDeleteResponse ``` Methods: -- client.zero_trust.access.tags.create(identifier, \*\*params) -> ZeroTrustTag -- client.zero_trust.access.tags.update(tag_name, \*, identifier, \*\*params) -> ZeroTrustTag -- client.zero_trust.access.tags.list(identifier) -> SyncSinglePage[ZeroTrustTag] -- client.zero_trust.access.tags.delete(name, \*, identifier) -> TagDeleteResponse -- client.zero_trust.access.tags.get(name, \*, identifier) -> ZeroTrustTag +- client.zero_trust.access.tags.create(identifier, \*\*params) -> Optional +- client.zero_trust.access.tags.update(tag_name, \*, identifier, \*\*params) -> Optional +- client.zero_trust.access.tags.list(identifier) -> SyncSinglePage[Tag] +- client.zero_trust.access.tags.delete(name, \*, identifier) -> Optional +- client.zero_trust.access.tags.get(name, \*, identifier) -> Optional ## DEX +Types: + +```python +from cloudflare.types.zero_trust import ( + DeviceExperienceMonitor, + NetworkPath, + NetworkPathResponse, + Percentiles, +) +``` + ### Colos Types: @@ -5241,12 +5372,12 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.dex import FleetStatusLiveResponse +from cloudflare.types.zero_trust.dex import LiveStat, FleetStatusLiveResponse ``` Methods: -- client.zero_trust.dex.fleet_status.live(\*, account_id, \*\*params) -> FleetStatusLiveResponse +- client.zero_trust.dex.fleet_status.live(\*, account_id, \*\*params) -> Optional - client.zero_trust.dex.fleet_status.over_time(\*, account_id, \*\*params) -> None #### Devices @@ -5254,45 +5385,43 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.dex.fleet_status import DigitalExperienceMonitoringDevice +from cloudflare.types.zero_trust.dex.fleet_status import DeviceListResponse ``` Methods: -- client.zero_trust.dex.fleet_status.devices.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DigitalExperienceMonitoringDevice] +- client.zero_trust.dex.fleet_status.devices.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DeviceListResponse] ### HTTPTests Types: ```python -from cloudflare.types.zero_trust.dex import DigitalExperienceMonitoringHTTPDetails +from cloudflare.types.zero_trust.dex import HTTPDetails ``` Methods: -- client.zero_trust.dex.http_tests.get(test_id, \*, account_id, \*\*params) -> DigitalExperienceMonitoringHTTPDetails +- client.zero_trust.dex.http_tests.get(test_id, \*, account_id, \*\*params) -> Optional #### Percentiles Types: ```python -from cloudflare.types.zero_trust.dex.http_tests import ( - DigitalExperienceMonitoringHTTPDetailsPercentiles, -) +from cloudflare.types.zero_trust.dex.http_tests import HTTPDetailsPercentiles, TestStatOverTime ``` Methods: -- client.zero_trust.dex.http_tests.percentiles.get(test_id, \*, account_id, \*\*params) -> DigitalExperienceMonitoringHTTPDetailsPercentiles +- client.zero_trust.dex.http_tests.percentiles.get(test_id, \*, account_id, \*\*params) -> Optional ### Tests Types: ```python -from cloudflare.types.zero_trust.dex import DigitalExperienceMonitoringTests, TestListResponse +from cloudflare.types.zero_trust.dex import AggregateTimePeriod, Tests, TestListResponse ``` Methods: @@ -5304,12 +5433,12 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.dex.tests import DigitalExperienceMonitoringUniqueDevices +from cloudflare.types.zero_trust.dex.tests import UniqueDevices ``` Methods: -- client.zero_trust.dex.tests.unique_devices.list(\*, account_id, \*\*params) -> DigitalExperienceMonitoringUniqueDevices +- client.zero_trust.dex.tests.unique_devices.list(\*, account_id, \*\*params) -> Optional ### TracerouteTestResults @@ -5318,48 +5447,49 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.dex.traceroute_test_results import ( - DigitalExperienceMonitoringTracerouteTestResultNetworkPath, -) +from cloudflare.types.zero_trust.dex.traceroute_test_results import NetworkPathGetResponse ``` Methods: -- client.zero_trust.dex.traceroute_test_results.network_path.get(test_result_id, \*, account_id) -> DigitalExperienceMonitoringTracerouteTestResultNetworkPath +- client.zero_trust.dex.traceroute_test_results.network_path.get(test_result_id, \*, account_id) -> Optional ### TracerouteTests Types: ```python -from cloudflare.types.zero_trust.dex import ( - DigitalExperienceMonitoringTracerouteDetails, - DigitalExperienceMonitoringTracerouteDetailsPercentiles, - DigitalExperienceMonitoringTracerouteTestNetworkPath, -) +from cloudflare.types.zero_trust.dex import Traceroute, TracerouteTestPercentilesResponse ``` Methods: -- client.zero_trust.dex.traceroute_tests.get(test_id, \*, account_id, \*\*params) -> DigitalExperienceMonitoringTracerouteDetails -- client.zero_trust.dex.traceroute_tests.network_path(test_id, \*, account_id, \*\*params) -> DigitalExperienceMonitoringTracerouteTestNetworkPath -- client.zero_trust.dex.traceroute_tests.percentiles(test_id, \*, account_id, \*\*params) -> DigitalExperienceMonitoringTracerouteDetailsPercentiles +- client.zero_trust.dex.traceroute_tests.get(test_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.dex.traceroute_tests.network_path(test_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.dex.traceroute_tests.percentiles(test_id, \*, account_id, \*\*params) -> Optional ## Tunnels Types: ```python -from cloudflare.types.zero_trust import TunnelArgoTunnel, TunnelListResponse, TunnelEditResponse +from cloudflare.types.zero_trust import ( + Connection, + TunnelCreateResponse, + TunnelListResponse, + TunnelDeleteResponse, + TunnelEditResponse, + TunnelGetResponse, +) ``` Methods: -- client.zero_trust.tunnels.create(\*, account_id, \*\*params) -> TunnelArgoTunnel +- client.zero_trust.tunnels.create(\*, account_id, \*\*params) -> TunnelCreateResponse - client.zero_trust.tunnels.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TunnelListResponse] -- client.zero_trust.tunnels.delete(tunnel_id, \*, account_id, \*\*params) -> TunnelArgoTunnel +- client.zero_trust.tunnels.delete(tunnel_id, \*, account_id, \*\*params) -> TunnelDeleteResponse - client.zero_trust.tunnels.edit(tunnel_id, \*, account_id, \*\*params) -> TunnelEditResponse -- client.zero_trust.tunnels.get(tunnel_id, \*, account_id) -> TunnelArgoTunnel +- client.zero_trust.tunnels.get(tunnel_id, \*, account_id) -> TunnelGetResponse ### Configurations @@ -5383,7 +5513,7 @@ Types: ```python from cloudflare.types.zero_trust.tunnels import ( - TunnelTunnelClient, + Client, ConnectionDeleteResponse, ConnectionGetResponse, ) @@ -5410,7 +5540,7 @@ Methods: Methods: -- client.zero_trust.tunnels.connectors.get(connector_id, \*, account_id, tunnel_id) -> TunnelTunnelClient +- client.zero_trust.tunnels.connectors.get(connector_id, \*, account_id, tunnel_id) -> Client ### Management @@ -5447,41 +5577,35 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.dlp import DLPDataset, DLPDatasetArray, DLPDatasetCreation +from cloudflare.types.zero_trust.dlp import Dataset, DatasetArray, DatasetCreation ``` Methods: -- client.zero_trust.dlp.datasets.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.dlp.datasets.update(dataset_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.dlp.datasets.list(\*, account_id) -> SyncSinglePage[DLPDataset] +- client.zero_trust.dlp.datasets.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.dlp.datasets.update(dataset_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.dlp.datasets.list(\*, account_id) -> SyncSinglePage[Dataset] - client.zero_trust.dlp.datasets.delete(dataset_id, \*, account_id) -> None -- client.zero_trust.dlp.datasets.get(dataset_id, \*, account_id) -> Optional +- client.zero_trust.dlp.datasets.get(dataset_id, \*, account_id) -> Optional #### Upload Types: ```python -from cloudflare.types.zero_trust.dlp.datasets import DLPDatasetNewVersion +from cloudflare.types.zero_trust.dlp.datasets import NewVersion ``` Methods: -- client.zero_trust.dlp.datasets.upload.create(dataset_id, \*, account_id) -> Optional -- client.zero_trust.dlp.datasets.upload.edit(version, \*, account_id, dataset_id) -> Optional +- client.zero_trust.dlp.datasets.upload.create(dataset_id, \*, account_id) -> Optional +- client.zero_trust.dlp.datasets.upload.edit(version, \*, account_id, dataset_id, \*\*params) -> Optional ### Patterns -Types: - -```python -from cloudflare.types.zero_trust.dlp import PatternValidateResponse -``` - Methods: -- client.zero_trust.dlp.patterns.validate(\*, account_id, \*\*params) -> PatternValidateResponse +- client.zero_trust.dlp.patterns.validate(\*, account_id, \*\*params) -> Optional ### PayloadLogs @@ -5501,12 +5625,17 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.dlp import DLPProfiles, ProfileGetResponse +from cloudflare.types.zero_trust.dlp import ( + ContextAwareness, + Profile, + SkipConfiguration, + ProfileGetResponse, +) ``` Methods: -- client.zero_trust.dlp.profiles.list(\*, account_id) -> SyncSinglePage[DLPProfiles] +- client.zero_trust.dlp.profiles.list(\*, account_id) -> SyncSinglePage[Profile] - client.zero_trust.dlp.profiles.get(profile_id, \*, account_id) -> ProfileGetResponse #### Custom @@ -5515,7 +5644,8 @@ Types: ```python from cloudflare.types.zero_trust.dlp.profiles import ( - DLPCustomProfile, + CustomProfile, + Pattern, CustomCreateResponse, CustomDeleteResponse, ) @@ -5524,22 +5654,22 @@ from cloudflare.types.zero_trust.dlp.profiles import ( Methods: - client.zero_trust.dlp.profiles.custom.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.dlp.profiles.custom.update(profile_id, \*, account_id, \*\*params) -> DLPCustomProfile -- client.zero_trust.dlp.profiles.custom.delete(profile_id, \*, account_id) -> CustomDeleteResponse -- client.zero_trust.dlp.profiles.custom.get(profile_id, \*, account_id) -> DLPCustomProfile +- client.zero_trust.dlp.profiles.custom.update(profile_id, \*, account_id, \*\*params) -> CustomProfile +- client.zero_trust.dlp.profiles.custom.delete(profile_id, \*, account_id, \*\*params) -> CustomDeleteResponse +- client.zero_trust.dlp.profiles.custom.get(profile_id, \*, account_id) -> CustomProfile #### Predefined Types: ```python -from cloudflare.types.zero_trust.dlp.profiles import DLPPredefinedProfile +from cloudflare.types.zero_trust.dlp.profiles import PredefinedProfile ``` Methods: -- client.zero_trust.dlp.profiles.predefined.update(profile_id, \*, account_id, \*\*params) -> DLPPredefinedProfile -- client.zero_trust.dlp.profiles.predefined.get(profile_id, \*, account_id) -> DLPPredefinedProfile +- client.zero_trust.dlp.profiles.predefined.update(profile_id, \*, account_id, \*\*params) -> PredefinedProfile +- client.zero_trust.dlp.profiles.predefined.get(profile_id, \*, account_id) -> PredefinedProfile ## Gateway @@ -5551,45 +5681,45 @@ from cloudflare.types.zero_trust import GatewayCreateResponse, GatewayListRespon Methods: -- client.zero_trust.gateway.create(\*, account_id) -> GatewayCreateResponse -- client.zero_trust.gateway.list(\*, account_id) -> GatewayListResponse +- client.zero_trust.gateway.create(\*, account_id) -> Optional +- client.zero_trust.gateway.list(\*, account_id) -> Optional ### AuditSSHSettings Types: ```python -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewaySettings +from cloudflare.types.zero_trust.gateway import GatewaySettings ``` Methods: -- client.zero_trust.gateway.audit_ssh_settings.update(\*, account_id, \*\*params) -> ZeroTrustGatewaySettings -- client.zero_trust.gateway.audit_ssh_settings.get(\*, account_id) -> ZeroTrustGatewaySettings +- client.zero_trust.gateway.audit_ssh_settings.update(\*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.audit_ssh_settings.get(\*, account_id) -> Optional ### Categories Types: ```python -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayCategories +from cloudflare.types.zero_trust.gateway import Category ``` Methods: -- client.zero_trust.gateway.categories.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayCategories] +- client.zero_trust.gateway.categories.list(\*, account_id) -> SyncSinglePage[Category] ### AppTypes Types: ```python -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayAppTypes +from cloudflare.types.zero_trust.gateway import AppType ``` Methods: -- client.zero_trust.gateway.app_types.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayAppTypes] +- client.zero_trust.gateway.app_types.list(\*, account_id) -> SyncSinglePage[AppType] ### Configurations @@ -5597,6 +5727,18 @@ Types: ```python from cloudflare.types.zero_trust.gateway import ( + ActivityLogSettings, + AntiVirusSettings, + BlockPageSettings, + BodyScanningSettings, + BrowserIsolationSettings, + CustomCertificateSettings, + ExtendedEmailMatching, + FipsSettings, + GatewayConfigurationSettings, + NotificationSettings, + ProtocolDetection, + TLSSettings, ConfigurationUpdateResponse, ConfigurationEditResponse, ConfigurationGetResponse, @@ -5605,9 +5747,9 @@ from cloudflare.types.zero_trust.gateway import ( Methods: -- client.zero_trust.gateway.configurations.update(\*, account_id, \*\*params) -> ConfigurationUpdateResponse -- client.zero_trust.gateway.configurations.edit(\*, account_id, \*\*params) -> ConfigurationEditResponse -- client.zero_trust.gateway.configurations.get(\*, account_id) -> ConfigurationGetResponse +- client.zero_trust.gateway.configurations.update(\*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.configurations.edit(\*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.configurations.get(\*, account_id) -> Optional ### Lists @@ -5615,7 +5757,8 @@ Types: ```python from cloudflare.types.zero_trust.gateway import ( - ZeroTrustGatewayLists, + GatewayItem, + GatewayList, ListCreateResponse, ListDeleteResponse, ) @@ -5623,12 +5766,12 @@ from cloudflare.types.zero_trust.gateway import ( Methods: -- client.zero_trust.gateway.lists.create(\*, account_id, \*\*params) -> ListCreateResponse -- client.zero_trust.gateway.lists.update(list_id, \*, account_id, \*\*params) -> ZeroTrustGatewayLists -- client.zero_trust.gateway.lists.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayLists] -- client.zero_trust.gateway.lists.delete(list_id, \*, account_id) -> ListDeleteResponse -- client.zero_trust.gateway.lists.edit(list_id, \*, account_id, \*\*params) -> ZeroTrustGatewayLists -- client.zero_trust.gateway.lists.get(list_id, \*, account_id) -> ZeroTrustGatewayLists +- client.zero_trust.gateway.lists.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.lists.update(list_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.lists.list(\*, account_id) -> SyncSinglePage[GatewayList] +- client.zero_trust.gateway.lists.delete(list_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.lists.edit(list_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.lists.get(list_id, \*, account_id) -> Optional #### Items @@ -5647,29 +5790,29 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayLocations, LocationDeleteResponse +from cloudflare.types.zero_trust.gateway import Location, LocationNetwork, LocationDeleteResponse ``` Methods: -- client.zero_trust.gateway.locations.create(\*, account_id, \*\*params) -> ZeroTrustGatewayLocations -- client.zero_trust.gateway.locations.update(location_id, \*, account_id, \*\*params) -> ZeroTrustGatewayLocations -- client.zero_trust.gateway.locations.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayLocations] -- client.zero_trust.gateway.locations.delete(location_id, \*, account_id) -> LocationDeleteResponse -- client.zero_trust.gateway.locations.get(location_id, \*, account_id) -> ZeroTrustGatewayLocations +- client.zero_trust.gateway.locations.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.locations.update(location_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.locations.list(\*, account_id) -> SyncSinglePage[Location] +- client.zero_trust.gateway.locations.delete(location_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.locations.get(location_id, \*, account_id) -> Optional ### Logging Types: ```python -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayGatewayAccountLoggingSettings +from cloudflare.types.zero_trust.gateway import LoggingSetting ``` Methods: -- client.zero_trust.gateway.logging.update(\*, account_id, \*\*params) -> ZeroTrustGatewayGatewayAccountLoggingSettings -- client.zero_trust.gateway.logging.get(\*, account_id) -> ZeroTrustGatewayGatewayAccountLoggingSettings +- client.zero_trust.gateway.logging.update(\*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.logging.get(\*, account_id) -> Optional ### ProxyEndpoints @@ -5677,34 +5820,43 @@ Types: ```python from cloudflare.types.zero_trust.gateway import ( - ZeroTrustGatewayProxyEndpoints, + GatewayIPs, + ProxyEndpoint, ProxyEndpointDeleteResponse, ) ``` Methods: -- client.zero_trust.gateway.proxy_endpoints.create(\*, account_id, \*\*params) -> ZeroTrustGatewayProxyEndpoints -- client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayProxyEndpoints] -- client.zero_trust.gateway.proxy_endpoints.delete(proxy_endpoint_id, \*, account_id) -> ProxyEndpointDeleteResponse -- client.zero_trust.gateway.proxy_endpoints.edit(proxy_endpoint_id, \*, account_id, \*\*params) -> ZeroTrustGatewayProxyEndpoints -- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> ZeroTrustGatewayProxyEndpoints +- client.zero_trust.gateway.proxy_endpoints.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> SyncSinglePage[ProxyEndpoint] +- client.zero_trust.gateway.proxy_endpoints.delete(proxy_endpoint_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.proxy_endpoints.edit(proxy_endpoint_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> Optional ### Rules Types: ```python -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayRules, RuleDeleteResponse +from cloudflare.types.zero_trust.gateway import ( + DNSResolverSettingsV4, + DNSResolverSettingsV6, + GatewayFilter, + GatewayRule, + RuleSetting, + Schedule, + RuleDeleteResponse, +) ``` Methods: -- client.zero_trust.gateway.rules.create(\*, account_id, \*\*params) -> ZeroTrustGatewayRules -- client.zero_trust.gateway.rules.update(rule_id, \*, account_id, \*\*params) -> ZeroTrustGatewayRules -- client.zero_trust.gateway.rules.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayRules] -- client.zero_trust.gateway.rules.delete(rule_id, \*, account_id) -> RuleDeleteResponse -- client.zero_trust.gateway.rules.get(rule_id, \*, account_id) -> ZeroTrustGatewayRules +- client.zero_trust.gateway.rules.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.rules.update(rule_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.rules.list(\*, account_id) -> SyncSinglePage[GatewayRule] +- client.zero_trust.gateway.rules.delete(rule_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.gateway.rules.get(rule_id, \*, account_id) -> Optional ## Networks @@ -5713,29 +5865,29 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.networks import TunnelRoute, TunnelTeamnet +from cloudflare.types.zero_trust.networks import NetworkRoute, Route, Teamnet ``` Methods: -- client.zero_trust.networks.routes.create(\*, account_id, \*\*params) -> TunnelRoute -- client.zero_trust.networks.routes.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TunnelTeamnet] -- client.zero_trust.networks.routes.delete(route_id, \*, account_id) -> TunnelRoute -- client.zero_trust.networks.routes.edit(route_id, \*, account_id, \*\*params) -> TunnelRoute +- client.zero_trust.networks.routes.create(\*, account_id, \*\*params) -> Route +- client.zero_trust.networks.routes.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Teamnet] +- client.zero_trust.networks.routes.delete(route_id, \*, account_id) -> Route +- client.zero_trust.networks.routes.edit(route_id, \*, account_id, \*\*params) -> Route #### IPs Methods: -- client.zero_trust.networks.routes.ips.get(ip, \*, account_id, \*\*params) -> TunnelTeamnet +- client.zero_trust.networks.routes.ips.get(ip, \*, account_id, \*\*params) -> Teamnet #### Networks Methods: -- client.zero_trust.networks.routes.networks.create(ip_network_encoded, \*, account_id, \*\*params) -> TunnelRoute -- client.zero_trust.networks.routes.networks.delete(ip_network_encoded, \*, account_id, \*\*params) -> TunnelRoute -- client.zero_trust.networks.routes.networks.edit(ip_network_encoded, \*, account_id) -> TunnelRoute +- client.zero_trust.networks.routes.networks.create(ip_network_encoded, \*, account_id, \*\*params) -> Route +- client.zero_trust.networks.routes.networks.delete(ip_network_encoded, \*, account_id, \*\*params) -> Route +- client.zero_trust.networks.routes.networks.edit(ip_network_encoded, \*, account_id) -> Route ### VirtualNetworks @@ -5743,7 +5895,7 @@ Types: ```python from cloudflare.types.zero_trust.networks import ( - TunnelVirtualNetwork, + VirtualNetwork, VirtualNetworkCreateResponse, VirtualNetworkDeleteResponse, VirtualNetworkEditResponse, @@ -5753,10 +5905,48 @@ from cloudflare.types.zero_trust.networks import ( Methods: - client.zero_trust.networks.virtual_networks.create(\*, account_id, \*\*params) -> VirtualNetworkCreateResponse -- client.zero_trust.networks.virtual_networks.list(\*, account_id, \*\*params) -> SyncSinglePage[TunnelVirtualNetwork] -- client.zero_trust.networks.virtual_networks.delete(virtual_network_id, \*, account_id) -> VirtualNetworkDeleteResponse +- client.zero_trust.networks.virtual_networks.list(\*, account_id, \*\*params) -> SyncSinglePage[VirtualNetwork] +- client.zero_trust.networks.virtual_networks.delete(virtual_network_id, \*, account_id, \*\*params) -> VirtualNetworkDeleteResponse - client.zero_trust.networks.virtual_networks.edit(virtual_network_id, \*, account_id, \*\*params) -> VirtualNetworkEditResponse +## RiskScoring + +Types: + +```python +from cloudflare.types.zero_trust import RiskScoringGetResponse, RiskScoringResetResponse +``` + +Methods: + +- client.zero_trust.risk_scoring.get(user_id, \*, account_identifier, \*\*params) -> RiskScoringGetResponse +- client.zero_trust.risk_scoring.reset(user_id, \*, account_identifier) -> RiskScoringResetResponse + +### Behaviours + +Types: + +```python +from cloudflare.types.zero_trust.risk_scoring import BehaviourUpdateResponse, BehaviourGetResponse +``` + +Methods: + +- client.zero_trust.risk_scoring.behaviours.update(account_identifier, \*\*params) -> BehaviourUpdateResponse +- client.zero_trust.risk_scoring.behaviours.get(account_identifier) -> BehaviourGetResponse + +### Summary + +Types: + +```python +from cloudflare.types.zero_trust.risk_scoring import SummaryGetResponse +``` + +Methods: + +- client.zero_trust.risk_scoring.summary.get(account_identifier, \*\*params) -> SummaryGetResponse + # Challenges ## Widgets @@ -5764,24 +5954,24 @@ Methods: Types: ```python -from cloudflare.types.challenges import ChallengesWidget, ChallengesWidgetList +from cloudflare.types.challenges import Widget, WidgetDomain, WidgetListResponse ``` Methods: -- client.challenges.widgets.create(\*, account_id, \*\*params) -> Optional -- client.challenges.widgets.update(sitekey, \*, account_id, \*\*params) -> Optional -- client.challenges.widgets.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[ChallengesWidgetList] -- client.challenges.widgets.delete(sitekey, \*, account_id) -> Optional -- client.challenges.widgets.get(sitekey, \*, account_id) -> Optional -- client.challenges.widgets.rotate_secret(sitekey, \*, account_id, \*\*params) -> Optional +- client.challenges.widgets.create(\*, account_id, \*\*params) -> Optional +- client.challenges.widgets.update(sitekey, \*, account_id, \*\*params) -> Optional +- client.challenges.widgets.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WidgetListResponse] +- client.challenges.widgets.delete(sitekey, \*, account_id) -> Optional +- client.challenges.widgets.get(sitekey, \*, account_id) -> Optional +- client.challenges.widgets.rotate_secret(sitekey, \*, account_id, \*\*params) -> Optional -# HyperdriveResource +# Hyperdrive Types: ```python -from cloudflare.types import Hyperdrive +from cloudflare.types.hyperdrive import Configuration, Hyperdrive ``` ## Configs @@ -5789,24 +5979,17 @@ from cloudflare.types import Hyperdrive Types: ```python -from cloudflare.types.hyperdrive import ( - ConfigCreateResponse, - ConfigUpdateResponse, - ConfigListResponse, - ConfigDeleteResponse, - ConfigEditResponse, - ConfigGetResponse, -) +from cloudflare.types.hyperdrive import ConfigDeleteResponse ``` Methods: -- client.hyperdrive.configs.create(\*, account_id, \*\*params) -> Optional -- client.hyperdrive.configs.update(hyperdrive_id, \*, account_id, \*\*params) -> Optional -- client.hyperdrive.configs.list(\*, account_id) -> SyncSinglePage[ConfigListResponse] -- client.hyperdrive.configs.delete(hyperdrive_id, \*, account_id) -> Optional -- client.hyperdrive.configs.edit(hyperdrive_id, \*, account_id, \*\*params) -> Optional -- client.hyperdrive.configs.get(hyperdrive_id, \*, account_id) -> Optional +- client.hyperdrive.configs.create(\*, account_id, \*\*params) -> Optional +- client.hyperdrive.configs.update(hyperdrive_id, \*, account_id, \*\*params) -> Optional +- client.hyperdrive.configs.list(\*, account_id) -> SyncSinglePage[Hyperdrive] +- client.hyperdrive.configs.delete(hyperdrive_id, \*, account_id) -> ConfigDeleteResponse +- client.hyperdrive.configs.edit(hyperdrive_id, \*, account_id, \*\*params) -> Optional +- client.hyperdrive.configs.get(hyperdrive_id, \*, account_id) -> Optional # RUM @@ -5815,16 +5998,16 @@ Methods: Types: ```python -from cloudflare.types.rum import RUMSite, SiteInfoDeleteResponse +from cloudflare.types.rum import Site, SiteInfoDeleteResponse ``` Methods: -- client.rum.site_info.create(\*, account_id, \*\*params) -> Optional -- client.rum.site_info.update(site_id, \*, account_id, \*\*params) -> Optional -- client.rum.site_info.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[RUMSite] +- client.rum.site_info.create(\*, account_id, \*\*params) -> Optional +- client.rum.site_info.update(site_id, \*, account_id, \*\*params) -> Optional +- client.rum.site_info.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Site] - client.rum.site_info.delete(site_id, \*, account_id) -> Optional -- client.rum.site_info.get(site_id, \*, account_id) -> Optional +- client.rum.site_info.get(site_id, \*, account_id) -> Optional ## Rules @@ -5849,11 +6032,12 @@ Types: ```python from cloudflare.types.vectorize import ( - VectorizeCreateIndex, - VectorizeIndexDeleteVectorsByID, - VectorizeIndexInsert, - VectorizeIndexQuery, - VectorizeIndexUpsert, + CreateIndex, + IndexDeleteVectorsByID, + IndexDimensionConfiguration, + IndexInsert, + IndexQuery, + IndexUpsert, IndexDeleteResponse, IndexGetByIDsResponse, ) @@ -5861,35 +6045,41 @@ from cloudflare.types.vectorize import ( Methods: -- client.vectorize.indexes.create(account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.update(index_name, \*, account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.list(account_identifier) -> SyncSinglePage[VectorizeCreateIndex] -- client.vectorize.indexes.delete(index_name, \*, account_identifier) -> Optional -- client.vectorize.indexes.delete_by_ids(index_name, \*, account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.get(index_name, \*, account_identifier) -> Optional -- client.vectorize.indexes.get_by_ids(index_name, \*, account_identifier, \*\*params) -> object -- client.vectorize.indexes.insert(index_name, \*, account_identifier) -> Optional -- client.vectorize.indexes.query(index_name, \*, account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.upsert(index_name, \*, account_identifier) -> Optional +- client.vectorize.indexes.create(\*, account_id, \*\*params) -> Optional +- client.vectorize.indexes.update(index_name, \*, account_id, \*\*params) -> Optional +- client.vectorize.indexes.list(\*, account_id) -> SyncSinglePage[CreateIndex] +- client.vectorize.indexes.delete(index_name, \*, account_id) -> IndexDeleteResponse +- client.vectorize.indexes.delete_by_ids(index_name, \*, account_id, \*\*params) -> Optional +- client.vectorize.indexes.get(index_name, \*, account_id) -> Optional +- client.vectorize.indexes.get_by_ids(index_name, \*, account_id, \*\*params) -> object +- client.vectorize.indexes.insert(index_name, \*, account_id, \*\*params) -> Optional +- client.vectorize.indexes.query(index_name, \*, account_id, \*\*params) -> Optional +- client.vectorize.indexes.upsert(index_name, \*, account_id, \*\*params) -> Optional # URLScanner Types: ```python -from cloudflare.types import URLScannerScanResponse +from cloudflare.types.url_scanner import URLScannerScanResponse ``` Methods: -- client.url_scanner.scan(account_id, \*\*params) -> URLScannerScanResponse +- client.url_scanner.scan(account_id, \*\*params) -> URLScannerScanResponse ## Scans Types: ```python -from cloudflare.types.url_scanner import ScanCreateResponse, ScanGetResponse, ScanHarResponse +from cloudflare.types.url_scanner import ( + URLScannerDomain, + URLScannerTask, + ScanCreateResponse, + ScanGetResponse, + ScanHarResponse, +) ``` Methods: @@ -5930,15 +6120,17 @@ Methods: ### Leaks +#### Events + Types: ```python -from cloudflare.types.radar.bgp import LeakEventsResponse +from cloudflare.types.radar.bgp.leaks import EventListResponse ``` Methods: -- client.radar.bgp.leaks.events(\*\*params) -> LeakEventsResponse +- client.radar.bgp.leaks.events.list(\*\*params) -> SyncV4PagePagination[EventListResponse] ### Top @@ -5967,15 +6159,17 @@ Methods: ### Hijacks +#### Events + Types: ```python -from cloudflare.types.radar.bgp import HijackEventsResponse +from cloudflare.types.radar.bgp.hijacks import EventListResponse ``` Methods: -- client.radar.bgp.hijacks.events(\*\*params) -> HijackEventsResponse +- client.radar.bgp.hijacks.events.list(\*\*params) -> SyncV4PagePagination[EventListResponse] ### Routes @@ -6176,6 +6370,12 @@ Methods: ## Email +Types: + +```python +from cloudflare.types.radar import RadarEmailSeries, RadarEmailSummary +``` + ### Routing #### Summary @@ -6594,7 +6794,7 @@ Methods: Types: ```python -from cloudflare.types.radar.http import TopBrowserFamiliesResponse, TopBrowsersResponse +from cloudflare.types.radar.http import Browser, TopBrowserFamiliesResponse, TopBrowsersResponse ``` Methods: @@ -6945,20 +7145,27 @@ Methods: Types: ```python -from cloudflare.types import BotManagementUpdateResponse, BotManagementGetResponse +from cloudflare.types.bot_management import ( + BotFightModeConfiguration, + SubscriptionConfiguration, + SuperBotFightModeDefinitelyConfiguration, + SuperBotFightModeLikelyConfiguration, + BotManagementUpdateResponse, + BotManagementGetResponse, +) ``` Methods: -- client.bot_management.update(\*, zone_id, \*\*params) -> BotManagementUpdateResponse -- client.bot_management.get(\*, zone_id) -> BotManagementGetResponse +- client.bot_management.update(\*, zone_id, \*\*params) -> BotManagementUpdateResponse +- client.bot_management.get(\*, zone_id) -> BotManagementGetResponse # OriginPostQuantumEncryption Types: ```python -from cloudflare.types import ( +from cloudflare.types.origin_post_quantum_encryption import ( OriginPostQuantumEncryptionUpdateResponse, OriginPostQuantumEncryptionGetResponse, ) @@ -6966,44 +7173,44 @@ from cloudflare.types 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) -> OriginPostQuantumEncryptionUpdateResponse +- client.origin_post_quantum_encryption.get(\*, zone_id) -> OriginPostQuantumEncryptionGetResponse # Speed Types: ```python -from cloudflare.types import ObservatorySchedule, ObservatoryTrend, SpeedDeleteResponse +from cloudflare.types.speed import LabeledRegion, LighthouseReport, Trend, SpeedDeleteResponse ``` Methods: -- client.speed.delete(url, \*, zone_id, \*\*params) -> Optional -- client.speed.schedule_get(url, \*, zone_id, \*\*params) -> Optional -- client.speed.trends_list(url, \*, zone_id, \*\*params) -> Optional +- client.speed.delete(url, \*, zone_id, \*\*params) -> Optional +- client.speed.schedule_get(url, \*, zone_id, \*\*params) -> Optional +- client.speed.trends_list(url, \*, zone_id, \*\*params) -> Optional ## Tests Types: ```python -from cloudflare.types.speed import ObservatoryPageTest, TestListResponse, TestDeleteResponse +from cloudflare.types.speed import Test, TestListResponse, TestDeleteResponse ``` Methods: -- client.speed.tests.create(url, \*, zone_id, \*\*params) -> Optional +- client.speed.tests.create(url, \*, zone_id, \*\*params) -> Optional - client.speed.tests.list(url, \*, zone_id, \*\*params) -> TestListResponse - client.speed.tests.delete(url, \*, zone_id, \*\*params) -> Optional -- client.speed.tests.get(test_id, \*, zone_id, url) -> Optional +- client.speed.tests.get(test_id, \*, zone_id, url) -> Optional ## Schedule Types: ```python -from cloudflare.types.speed import ScheduleCreateResponse +from cloudflare.types.speed import Schedule, ScheduleCreateResponse ``` Methods: @@ -7015,12 +7222,12 @@ Methods: Types: ```python -from cloudflare.types.speed import ObservatoryAvailabilities +from cloudflare.types.speed import Availability ``` Methods: -- client.speed.availabilities.list(\*, zone_id) -> Optional +- client.speed.availabilities.list(\*, zone_id) -> Optional ## Pages @@ -7058,16 +7265,17 @@ Types: ```python from cloudflare.types.hostnames.settings import ( - HostnameSettingDelete, - HostnameStting, + Setting, + SettingValue, + TLSDeleteResponse, TLSGetResponse, ) ``` Methods: -- client.hostnames.settings.tls.update(hostname, \*, zone_id, setting_id, \*\*params) -> HostnameStting -- client.hostnames.settings.tls.delete(hostname, \*, zone_id, setting_id) -> HostnameSettingDelete +- client.hostnames.settings.tls.update(hostname, \*, zone_id, setting_id, \*\*params) -> Setting +- client.hostnames.settings.tls.delete(hostname, \*, zone_id, setting_id) -> TLSDeleteResponse - client.hostnames.settings.tls.get(setting_id, \*, zone_id) -> Optional # Snippets @@ -7075,15 +7283,15 @@ Methods: Types: ```python -from cloudflare.types import Snippet, SnippetDeleteResponse +from cloudflare.types.snippets import Snippet, SnippetDeleteResponse ``` Methods: -- client.snippets.update(snippet_name, \*, zone_identifier, \*\*params) -> Snippet -- client.snippets.list(zone_identifier) -> SyncSinglePage[Snippet] -- client.snippets.delete(snippet_name, \*, zone_identifier) -> SnippetDeleteResponse -- client.snippets.get(snippet_name, \*, zone_identifier) -> Snippet +- client.snippets.update(snippet_name, \*, zone_identifier, \*\*params) -> Snippet +- client.snippets.list(zone_identifier) -> SyncSinglePage[Snippet] +- client.snippets.delete(snippet_name, \*, zone_identifier) -> SnippetDeleteResponse +- client.snippets.get(snippet_name, \*, zone_identifier) -> Snippet ## Content @@ -7109,16 +7317,16 @@ Methods: Types: ```python -from cloudflare.types import CallsApp, CallsAppWithSecret +from cloudflare.types.calls import CallsApp, CallsAppWithSecret ``` Methods: -- client.calls.create(\*, account_id, \*\*params) -> CallsAppWithSecret -- client.calls.update(app_id, \*, account_id, \*\*params) -> CallsApp -- client.calls.list(\*, account_id) -> SyncSinglePage[CallsApp] -- client.calls.delete(app_id, \*, account_id) -> CallsApp -- client.calls.get(app_id, \*, account_id) -> CallsApp +- client.calls.create(\*, account_id, \*\*params) -> Optional +- client.calls.update(app_id, \*, account_id, \*\*params) -> Optional +- client.calls.list(\*, account_id) -> SyncSinglePage[CallsApp] +- client.calls.delete(app_id, \*, account_id) -> Optional +- client.calls.get(app_id, \*, account_id) -> Optional # CloudforceOne @@ -7128,25 +7336,25 @@ Types: ```python from cloudflare.types.cloudforce_one import ( - CloudforceOneQuota, - CloudforceOneRequestConstants, - CloudforceOneRequestItem, - CloudforceOneRequestListItem, - CloudforceOneRequestTypes, + Item, + ListItem, + Quota, + RequestConstants, + RequestTypes, RequestDeleteResponse, ) ``` Methods: -- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> CloudforceOneRequestItem -- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> CloudforceOneRequestItem -- client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[CloudforceOneRequestListItem] +- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Item +- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Item +- client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[ListItem] - client.cloudforce_one.requests.delete(request_identifier, \*, account_identifier) -> RequestDeleteResponse -- client.cloudforce_one.requests.constants(account_identifier) -> CloudforceOneRequestConstants -- client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> CloudforceOneRequestItem -- client.cloudforce_one.requests.quota(account_identifier) -> CloudforceOneQuota -- client.cloudforce_one.requests.types(account_identifier) -> CloudforceOneRequestTypes +- client.cloudforce_one.requests.constants(account_identifier) -> RequestConstants +- client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> Item +- client.cloudforce_one.requests.quota(account_identifier) -> Quota +- client.cloudforce_one.requests.types(account_identifier) -> RequestTypes ### Message @@ -7154,7 +7362,7 @@ Types: ```python from cloudflare.types.cloudforce_one.requests import ( - CloudforceOneRequestMessageItem, + Message, MessageDeleteResponse, MessageGetResponse, ) @@ -7162,8 +7370,8 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- client.cloudforce_one.requests.message.create(request_identifier, \*, account_identifier, \*\*params) -> CloudforceOneRequestMessageItem -- client.cloudforce_one.requests.message.update(message_identifer, \*, account_identifier, request_identifier, \*\*params) -> CloudforceOneRequestMessageItem +- client.cloudforce_one.requests.message.create(request_identifier, \*, account_identifier, \*\*params) -> Message +- client.cloudforce_one.requests.message.update(message_identifer, \*, account_identifier, request_identifier, \*\*params) -> Message - client.cloudforce_one.requests.message.delete(message_identifer, \*, account_identifier, request_identifier) -> MessageDeleteResponse - client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> MessageGetResponse @@ -7173,15 +7381,49 @@ Types: ```python from cloudflare.types.cloudforce_one.requests import ( - CloudforceOnePriorityItem, + Label, + Priority, + PriorityEdit, PriorityDeleteResponse, ) ``` Methods: -- client.cloudforce_one.requests.priority.create(account_identifier, \*\*params) -> CloudforceOnePriorityItem -- client.cloudforce_one.requests.priority.update(priority_identifer, \*, account_identifier, \*\*params) -> CloudforceOneRequestItem +- client.cloudforce_one.requests.priority.create(account_identifier, \*\*params) -> Priority +- client.cloudforce_one.requests.priority.update(priority_identifer, \*, account_identifier, \*\*params) -> Item - client.cloudforce_one.requests.priority.delete(priority_identifer, \*, account_identifier) -> PriorityDeleteResponse -- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> CloudforceOneRequestItem -- client.cloudforce_one.requests.priority.quota(account_identifier) -> CloudforceOneQuota +- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> Item +- client.cloudforce_one.requests.priority.quota(account_identifier) -> Quota + +# EventNotifications + +## R2 + +### Configuration + +Types: + +```python +from cloudflare.types.event_notifications.r2 import ConfigurationGetResponse +``` + +Methods: + +- client.event_notifications.r2.configuration.get(bucket_name, \*, account_id) -> ConfigurationGetResponse + +#### Queues + +Types: + +```python +from cloudflare.types.event_notifications.r2.configuration import ( + QueueUpdateResponse, + QueueDeleteResponse, +) +``` + +Methods: + +- client.event_notifications.r2.configuration.queues.update(queue_id, \*, account_id, bucket_name, \*\*params) -> QueueUpdateResponse +- client.event_notifications.r2.configuration.queues.delete(queue_id, \*, account_id, bucket_name) -> QueueDeleteResponse diff --git a/pyproject.toml b/pyproject.toml index e7932554a83..fda2de82ca4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cloudflare" -version = "3.0.0-beta.7" +version = "3.0.0-beta.8" description = "The official Python library for the cloudflare API" dynamic = ["readme"] license = "Apache-2.0" @@ -48,7 +48,7 @@ Repository = "https://github.com/cloudflare/cloudflare-python" managed = true # version pins are in requirements-dev.lock dev-dependencies = [ - "pyright", + "pyright>=1.1.359", "mypy", "respx", "pytest", @@ -162,7 +162,9 @@ select = [ "T201", "T203", # misuse of typing.TYPE_CHECKING - "TCH004" + "TCH004", + # import rules + "TID251", ] ignore = [ # mutable defaults @@ -178,6 +180,9 @@ ignore-init-module-imports = true [tool.ruff.format] docstring-code-format = true +[tool.ruff.lint.flake8-tidy-imports.banned-api] +"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" + [tool.ruff.lint.isort] length-sort = true length-sort-straight = true diff --git a/requirements-dev.lock b/requirements-dev.lock index 8defb8a6d15..736dff54fa6 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -63,7 +63,7 @@ pydantic==2.4.2 # via cloudflare pydantic-core==2.10.1 # via pydantic -pyright==1.1.353 +pyright==1.1.359 pytest==7.1.1 # via pytest-asyncio pytest-asyncio==0.21.1 diff --git a/src/cloudflare/__init__.py b/src/cloudflare/__init__.py index c68ec60b863..bd005a22911 100644 --- a/src/cloudflare/__init__.py +++ b/src/cloudflare/__init__.py @@ -34,6 +34,7 @@ UnprocessableEntityError, APIResponseValidationError, ) +from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient from ._utils._logs import setup_logging as _setup_logging __all__ = [ @@ -72,6 +73,8 @@ "DEFAULT_TIMEOUT", "DEFAULT_MAX_RETRIES", "DEFAULT_CONNECTION_LIMITS", + "DefaultHttpxClient", + "DefaultAsyncHttpxClient", ] _setup_logging() diff --git a/src/cloudflare/_base_client.py b/src/cloudflare/_base_client.py index 21c336d5fe8..142430df21a 100644 --- a/src/cloudflare/_base_client.py +++ b/src/cloudflare/_base_client.py @@ -29,7 +29,6 @@ cast, overload, ) -from functools import lru_cache from typing_extensions import Literal, override, get_origin import anyio @@ -61,7 +60,7 @@ RequestOptions, ModelBuilderProtocol, ) -from ._utils import is_dict, is_list, is_given, is_mapping +from ._utils import is_dict, is_list, is_given, lru_cache, is_mapping from ._compat import model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( @@ -715,7 +714,27 @@ def _idempotency_key(self) -> str: return f"stainless-python-retry-{uuid.uuid4()}" -class SyncHttpxClientWrapper(httpx.Client): +class _DefaultHttpxClient(httpx.Client): + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + super().__init__(**kwargs) + + +if TYPE_CHECKING: + DefaultHttpxClient = httpx.Client + """An alias to `httpx.Client` that provides the same defaults that this SDK + uses internally. + + This is useful because overriding the `http_client` with your own instance of + `httpx.Client` will result in httpx's defaults being used, not ours. + """ +else: + DefaultHttpxClient = _DefaultHttpxClient + + +class SyncHttpxClientWrapper(DefaultHttpxClient): def __del__(self) -> None: try: self.close() @@ -1248,7 +1267,27 @@ def get_api_list( return self._request_api_list(model, page, opts) -class AsyncHttpxClientWrapper(httpx.AsyncClient): +class _DefaultAsyncHttpxClient(httpx.AsyncClient): + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + super().__init__(**kwargs) + + +if TYPE_CHECKING: + DefaultAsyncHttpxClient = httpx.AsyncClient + """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK + uses internally. + + This is useful because overriding the `http_client` with your own instance of + `httpx.AsyncClient` will result in httpx's defaults being used, not ours. + """ +else: + DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient + + +class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient): def __del__(self) -> None: try: # TODO(someday): support non asyncio runtimes here diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index 8951d5319e1..41a4fcfac22 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -47,108 +47,111 @@ class Cloudflare(SyncAPIClient): - accounts: resources.Accounts - origin_ca_certificates: resources.OriginCACertificates - ips: resources.IPs - memberships: resources.Memberships + accounts: resources.AccountsResource + origin_ca_certificates: resources.OriginCACertificatesResource + ips: resources.IPsResource + memberships: resources.MembershipsResource user: resources.UserResource - zones: resources.Zones - load_balancers: resources.LoadBalancers - cache: resources.Cache - ssl: resources.SSL - subscriptions: resources.Subscriptions - acm: resources.ACM - argo: resources.Argo - plans: resources.Plans - rate_plans: resources.RatePlans - certificate_authorities: resources.CertificateAuthorities - client_certificates: resources.ClientCertificates - custom_certificates: resources.CustomCertificates - custom_hostnames: resources.CustomHostnames - custom_nameservers: resources.CustomNameservers - dns: resources.DNS + zones: resources.ZonesResource + load_balancers: resources.LoadBalancersResource + cache: resources.CacheResource + ssl: resources.SSLResource + subscriptions: resources.SubscriptionsResource + acm: resources.ACMResource + argo: resources.ArgoResource + plans: resources.PlansResource + rate_plans: resources.RatePlansResource + certificate_authorities: resources.CertificateAuthoritiesResource + client_certificates: resources.ClientCertificatesResource + custom_certificates: resources.CustomCertificatesResource + custom_hostnames: resources.CustomHostnamesResource + custom_nameservers: resources.CustomNameserversResource + dns: resources.DNSResource dnssec: resources.DNSSECResource - email_routing: resources.EmailRouting - filters: resources.Filters - firewall: resources.Firewall - healthchecks: resources.Healthchecks - keyless_certificates: resources.KeylessCertificates - logpush: resources.Logpush - logs: resources.Logs - origin_tls_client_auth: resources.OriginTLSClientAuth - pagerules: resources.Pagerules - rate_limits: resources.RateLimits - secondary_dns: resources.SecondaryDNS - waiting_rooms: resources.WaitingRooms - web3: resources.Web3 - workers: resources.Workers - kv: resources.KV - durable_objects: resources.DurableObjects - queues: resources.Queues - managed_headers: resources.ManagedHeaders - page_shield: resources.PageShield - rulesets: resources.Rulesets - url_normalization: resources.URLNormalization - spectrum: resources.Spectrum - addressing: resources.Addressing - audit_logs: resources.AuditLogs - billing: resources.Billing - brand_protection: resources.BrandProtection - diagnostics: resources.Diagnostics - images: resources.Images - intel: resources.Intel - magic_transit: resources.MagicTransit - magic_network_monitoring: resources.MagicNetworkMonitoring - mtls_certificates: resources.MTLSCertificates - pages: resources.Pages - pcaps: resources.PCAPs - registrar: resources.Registrar - request_tracers: resources.RequestTracers - rules: resources.Rules - storage: resources.Storage - stream: resources.Stream - alerting: resources.Alerting - d1: resources.D1 - r2: resources.R2 - warp_connector: resources.WARPConnector - workers_for_platforms: resources.WorkersForPlatforms - zero_trust: resources.ZeroTrust - challenges: resources.Challenges + email_routing: resources.EmailRoutingResource + filters: resources.FiltersResource + firewall: resources.FirewallResource + healthchecks: resources.HealthchecksResource + keyless_certificates: resources.KeylessCertificatesResource + logpush: resources.LogpushResource + logs: resources.LogsResource + origin_tls_client_auth: resources.OriginTLSClientAuthResource + pagerules: resources.PagerulesResource + rate_limits: resources.RateLimitsResource + secondary_dns: resources.SecondaryDNSResource + waiting_rooms: resources.WaitingRoomsResource + web3: resources.Web3Resource + workers: resources.WorkersResource + kv: resources.KVResource + durable_objects: resources.DurableObjectsResource + queues: resources.QueuesResource + managed_headers: resources.ManagedHeadersResource + page_shield: resources.PageShieldResource + rulesets: resources.RulesetsResource + url_normalization: resources.URLNormalizationResource + spectrum: resources.SpectrumResource + addressing: resources.AddressingResource + audit_logs: resources.AuditLogsResource + billing: resources.BillingResource + brand_protection: resources.BrandProtectionResource + diagnostics: resources.DiagnosticsResource + images: resources.ImagesResource + intel: resources.IntelResource + magic_transit: resources.MagicTransitResource + magic_network_monitoring: resources.MagicNetworkMonitoringResource + mtls_certificates: resources.MTLSCertificatesResource + pages: resources.PagesResource + pcaps: resources.PCAPsResource + registrar: resources.RegistrarResource + request_tracers: resources.RequestTracersResource + rules: resources.RulesResource + storage: resources.StorageResource + stream: resources.StreamResource + alerting: resources.AlertingResource + d1: resources.D1Resource + r2: resources.R2Resource + warp_connector: resources.WARPConnectorResource + workers_for_platforms: resources.WorkersForPlatformsResource + zero_trust: resources.ZeroTrustResource + challenges: resources.ChallengesResource hyperdrive: resources.HyperdriveResource - rum: resources.RUM - vectorize: resources.Vectorize - url_scanner: resources.URLScanner - radar: resources.Radar - bot_management: resources.BotManagement - origin_post_quantum_encryption: resources.OriginPostQuantumEncryption - speed: resources.Speed - dcv_delegation: resources.DCVDelegation - hostnames: resources.Hostnames - snippets: resources.Snippets - calls: resources.Calls - cloudforce_one: resources.CloudforceOne + rum: resources.RUMResource + vectorize: resources.VectorizeResource + url_scanner: resources.URLScannerResource + radar: resources.RadarResource + bot_management: resources.BotManagementResource + origin_post_quantum_encryption: resources.OriginPostQuantumEncryptionResource + speed: resources.SpeedResource + dcv_delegation: resources.DCVDelegationResource + hostnames: resources.HostnamesResource + snippets: resources.SnippetsResource + calls: resources.CallsResource + cloudforce_one: resources.CloudforceOneResource + event_notifications: resources.EventNotificationsResource with_raw_response: CloudflareWithRawResponse with_streaming_response: CloudflareWithStreamedResponse # client options + api_token: str | None api_key: str | None api_email: str | None - api_token: str | None user_service_key: str | None def __init__( self, *, + api_token: str | None = None, api_key: str | None = None, api_email: str | None = None, - api_token: str | None = None, user_service_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. + # Configure a custom httpx client. + # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. http_client: httpx.Client | None = None, # Enable or disable schema validation for data returned by the API. # When enabled an error APIResponseValidationError is raised @@ -163,11 +166,15 @@ def __init__( """Construct a new synchronous cloudflare client instance. This automatically infers the following arguments from their corresponding environment variables if they are not provided: + - `api_token` from `CLOUDFLARE_API_TOKEN` - `api_key` from `CLOUDFLARE_API_KEY` - `api_email` from `CLOUDFLARE_EMAIL` - - `api_token` from `CLOUDFLARE_API_TOKEN` - `user_service_key` from `CLOUDFLARE_API_USER_SERVICE_KEY` """ + if api_token is None: + api_token = os.environ.get("CLOUDFLARE_API_TOKEN") + self.api_token = api_token + if api_key is None: api_key = os.environ.get("CLOUDFLARE_API_KEY") self.api_key = api_key @@ -176,10 +183,6 @@ def __init__( api_email = os.environ.get("CLOUDFLARE_EMAIL") self.api_email = api_email - if api_token is None: - api_token = os.environ.get("CLOUDFLARE_API_TOKEN") - self.api_token = api_token - if user_service_key is None: user_service_key = os.environ.get("CLOUDFLARE_API_USER_SERVICE_KEY") self.user_service_key = user_service_key @@ -200,93 +203,94 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.accounts = resources.Accounts(self) - self.origin_ca_certificates = resources.OriginCACertificates(self) - self.ips = resources.IPs(self) - self.memberships = resources.Memberships(self) + self.accounts = resources.AccountsResource(self) + self.origin_ca_certificates = resources.OriginCACertificatesResource(self) + self.ips = resources.IPsResource(self) + self.memberships = resources.MembershipsResource(self) self.user = resources.UserResource(self) - self.zones = resources.Zones(self) - self.load_balancers = resources.LoadBalancers(self) - self.cache = resources.Cache(self) - self.ssl = resources.SSL(self) - self.subscriptions = resources.Subscriptions(self) - self.acm = resources.ACM(self) - self.argo = resources.Argo(self) - self.plans = resources.Plans(self) - self.rate_plans = resources.RatePlans(self) - self.certificate_authorities = resources.CertificateAuthorities(self) - self.client_certificates = resources.ClientCertificates(self) - self.custom_certificates = resources.CustomCertificates(self) - self.custom_hostnames = resources.CustomHostnames(self) - self.custom_nameservers = resources.CustomNameservers(self) - self.dns = resources.DNS(self) + self.zones = resources.ZonesResource(self) + self.load_balancers = resources.LoadBalancersResource(self) + self.cache = resources.CacheResource(self) + self.ssl = resources.SSLResource(self) + self.subscriptions = resources.SubscriptionsResource(self) + self.acm = resources.ACMResource(self) + self.argo = resources.ArgoResource(self) + self.plans = resources.PlansResource(self) + self.rate_plans = resources.RatePlansResource(self) + self.certificate_authorities = resources.CertificateAuthoritiesResource(self) + self.client_certificates = resources.ClientCertificatesResource(self) + self.custom_certificates = resources.CustomCertificatesResource(self) + self.custom_hostnames = resources.CustomHostnamesResource(self) + self.custom_nameservers = resources.CustomNameserversResource(self) + self.dns = resources.DNSResource(self) self.dnssec = resources.DNSSECResource(self) - self.email_routing = resources.EmailRouting(self) - self.filters = resources.Filters(self) - self.firewall = resources.Firewall(self) - self.healthchecks = resources.Healthchecks(self) - self.keyless_certificates = resources.KeylessCertificates(self) - self.logpush = resources.Logpush(self) - self.logs = resources.Logs(self) - self.origin_tls_client_auth = resources.OriginTLSClientAuth(self) - self.pagerules = resources.Pagerules(self) - self.rate_limits = resources.RateLimits(self) - self.secondary_dns = resources.SecondaryDNS(self) - self.waiting_rooms = resources.WaitingRooms(self) - self.web3 = resources.Web3(self) - self.workers = resources.Workers(self) - self.kv = resources.KV(self) - self.durable_objects = resources.DurableObjects(self) - self.queues = resources.Queues(self) - self.managed_headers = resources.ManagedHeaders(self) - self.page_shield = resources.PageShield(self) - self.rulesets = resources.Rulesets(self) - self.url_normalization = resources.URLNormalization(self) - self.spectrum = resources.Spectrum(self) - self.addressing = resources.Addressing(self) - self.audit_logs = resources.AuditLogs(self) - self.billing = resources.Billing(self) - self.brand_protection = resources.BrandProtection(self) - self.diagnostics = resources.Diagnostics(self) - self.images = resources.Images(self) - self.intel = resources.Intel(self) - self.magic_transit = resources.MagicTransit(self) - self.magic_network_monitoring = resources.MagicNetworkMonitoring(self) - self.mtls_certificates = resources.MTLSCertificates(self) - self.pages = resources.Pages(self) - self.pcaps = resources.PCAPs(self) - self.registrar = resources.Registrar(self) - self.request_tracers = resources.RequestTracers(self) - self.rules = resources.Rules(self) - self.storage = resources.Storage(self) - self.stream = resources.Stream(self) - self.alerting = resources.Alerting(self) - self.d1 = resources.D1(self) - self.r2 = resources.R2(self) - self.warp_connector = resources.WARPConnector(self) - self.workers_for_platforms = resources.WorkersForPlatforms(self) - self.zero_trust = resources.ZeroTrust(self) - self.challenges = resources.Challenges(self) + self.email_routing = resources.EmailRoutingResource(self) + self.filters = resources.FiltersResource(self) + self.firewall = resources.FirewallResource(self) + self.healthchecks = resources.HealthchecksResource(self) + self.keyless_certificates = resources.KeylessCertificatesResource(self) + self.logpush = resources.LogpushResource(self) + self.logs = resources.LogsResource(self) + self.origin_tls_client_auth = resources.OriginTLSClientAuthResource(self) + self.pagerules = resources.PagerulesResource(self) + self.rate_limits = resources.RateLimitsResource(self) + self.secondary_dns = resources.SecondaryDNSResource(self) + self.waiting_rooms = resources.WaitingRoomsResource(self) + self.web3 = resources.Web3Resource(self) + self.workers = resources.WorkersResource(self) + self.kv = resources.KVResource(self) + self.durable_objects = resources.DurableObjectsResource(self) + self.queues = resources.QueuesResource(self) + self.managed_headers = resources.ManagedHeadersResource(self) + self.page_shield = resources.PageShieldResource(self) + self.rulesets = resources.RulesetsResource(self) + self.url_normalization = resources.URLNormalizationResource(self) + self.spectrum = resources.SpectrumResource(self) + self.addressing = resources.AddressingResource(self) + self.audit_logs = resources.AuditLogsResource(self) + self.billing = resources.BillingResource(self) + self.brand_protection = resources.BrandProtectionResource(self) + self.diagnostics = resources.DiagnosticsResource(self) + self.images = resources.ImagesResource(self) + self.intel = resources.IntelResource(self) + self.magic_transit = resources.MagicTransitResource(self) + self.magic_network_monitoring = resources.MagicNetworkMonitoringResource(self) + self.mtls_certificates = resources.MTLSCertificatesResource(self) + self.pages = resources.PagesResource(self) + self.pcaps = resources.PCAPsResource(self) + self.registrar = resources.RegistrarResource(self) + self.request_tracers = resources.RequestTracersResource(self) + self.rules = resources.RulesResource(self) + self.storage = resources.StorageResource(self) + self.stream = resources.StreamResource(self) + self.alerting = resources.AlertingResource(self) + self.d1 = resources.D1Resource(self) + self.r2 = resources.R2Resource(self) + self.warp_connector = resources.WARPConnectorResource(self) + self.workers_for_platforms = resources.WorkersForPlatformsResource(self) + self.zero_trust = resources.ZeroTrustResource(self) + self.challenges = resources.ChallengesResource(self) self.hyperdrive = resources.HyperdriveResource(self) - self.rum = resources.RUM(self) - self.vectorize = resources.Vectorize(self) - self.url_scanner = resources.URLScanner(self) - self.radar = resources.Radar(self) - self.bot_management = resources.BotManagement(self) - self.origin_post_quantum_encryption = resources.OriginPostQuantumEncryption(self) - self.speed = resources.Speed(self) - self.dcv_delegation = resources.DCVDelegation(self) - self.hostnames = resources.Hostnames(self) - self.snippets = resources.Snippets(self) - self.calls = resources.Calls(self) - self.cloudforce_one = resources.CloudforceOne(self) + self.rum = resources.RUMResource(self) + self.vectorize = resources.VectorizeResource(self) + self.url_scanner = resources.URLScannerResource(self) + self.radar = resources.RadarResource(self) + self.bot_management = resources.BotManagementResource(self) + self.origin_post_quantum_encryption = resources.OriginPostQuantumEncryptionResource(self) + self.speed = resources.SpeedResource(self) + self.dcv_delegation = resources.DCVDelegationResource(self) + self.hostnames = resources.HostnamesResource(self) + self.snippets = resources.SnippetsResource(self) + self.calls = resources.CallsResource(self) + self.cloudforce_one = resources.CloudforceOneResource(self) + self.event_notifications = resources.EventNotificationsResource(self) self.with_raw_response = CloudflareWithRawResponse(self) self.with_streaming_response = CloudflareWithStreamedResponse(self) @property @override def qs(self) -> Querystring: - return Querystring(array_format="comma") + return Querystring(array_format="repeat") @property @override @@ -369,9 +373,9 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: def copy( self, *, + api_token: str | None = None, api_key: str | None = None, api_email: str | None = None, - api_token: str | None = None, user_service_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, @@ -406,9 +410,9 @@ def copy( http_client = http_client or self._client return self.__class__( + api_token=api_token or self.api_token, api_key=api_key or self.api_key, api_email=api_email or self.api_email, - api_token=api_token or self.api_token, user_service_key=user_service_key or self.user_service_key, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, @@ -458,108 +462,111 @@ def _make_status_error( class AsyncCloudflare(AsyncAPIClient): - accounts: resources.AsyncAccounts - origin_ca_certificates: resources.AsyncOriginCACertificates - ips: resources.AsyncIPs - memberships: resources.AsyncMemberships + accounts: resources.AsyncAccountsResource + origin_ca_certificates: resources.AsyncOriginCACertificatesResource + ips: resources.AsyncIPsResource + memberships: resources.AsyncMembershipsResource user: resources.AsyncUserResource - zones: resources.AsyncZones - load_balancers: resources.AsyncLoadBalancers - cache: resources.AsyncCache - ssl: resources.AsyncSSL - subscriptions: resources.AsyncSubscriptions - acm: resources.AsyncACM - argo: resources.AsyncArgo - plans: resources.AsyncPlans - rate_plans: resources.AsyncRatePlans - certificate_authorities: resources.AsyncCertificateAuthorities - client_certificates: resources.AsyncClientCertificates - custom_certificates: resources.AsyncCustomCertificates - custom_hostnames: resources.AsyncCustomHostnames - custom_nameservers: resources.AsyncCustomNameservers - dns: resources.AsyncDNS + zones: resources.AsyncZonesResource + load_balancers: resources.AsyncLoadBalancersResource + cache: resources.AsyncCacheResource + ssl: resources.AsyncSSLResource + subscriptions: resources.AsyncSubscriptionsResource + acm: resources.AsyncACMResource + argo: resources.AsyncArgoResource + plans: resources.AsyncPlansResource + rate_plans: resources.AsyncRatePlansResource + certificate_authorities: resources.AsyncCertificateAuthoritiesResource + client_certificates: resources.AsyncClientCertificatesResource + custom_certificates: resources.AsyncCustomCertificatesResource + custom_hostnames: resources.AsyncCustomHostnamesResource + custom_nameservers: resources.AsyncCustomNameserversResource + dns: resources.AsyncDNSResource dnssec: resources.AsyncDNSSECResource - email_routing: resources.AsyncEmailRouting - filters: resources.AsyncFilters - firewall: resources.AsyncFirewall - healthchecks: resources.AsyncHealthchecks - keyless_certificates: resources.AsyncKeylessCertificates - logpush: resources.AsyncLogpush - logs: resources.AsyncLogs - origin_tls_client_auth: resources.AsyncOriginTLSClientAuth - pagerules: resources.AsyncPagerules - rate_limits: resources.AsyncRateLimits - secondary_dns: resources.AsyncSecondaryDNS - waiting_rooms: resources.AsyncWaitingRooms - web3: resources.AsyncWeb3 - workers: resources.AsyncWorkers - kv: resources.AsyncKV - durable_objects: resources.AsyncDurableObjects - queues: resources.AsyncQueues - managed_headers: resources.AsyncManagedHeaders - page_shield: resources.AsyncPageShield - rulesets: resources.AsyncRulesets - url_normalization: resources.AsyncURLNormalization - spectrum: resources.AsyncSpectrum - addressing: resources.AsyncAddressing - audit_logs: resources.AsyncAuditLogs - billing: resources.AsyncBilling - brand_protection: resources.AsyncBrandProtection - diagnostics: resources.AsyncDiagnostics - images: resources.AsyncImages - intel: resources.AsyncIntel - magic_transit: resources.AsyncMagicTransit - magic_network_monitoring: resources.AsyncMagicNetworkMonitoring - mtls_certificates: resources.AsyncMTLSCertificates - pages: resources.AsyncPages - pcaps: resources.AsyncPCAPs - registrar: resources.AsyncRegistrar - request_tracers: resources.AsyncRequestTracers - rules: resources.AsyncRules - storage: resources.AsyncStorage - stream: resources.AsyncStream - alerting: resources.AsyncAlerting - d1: resources.AsyncD1 - r2: resources.AsyncR2 - warp_connector: resources.AsyncWARPConnector - workers_for_platforms: resources.AsyncWorkersForPlatforms - zero_trust: resources.AsyncZeroTrust - challenges: resources.AsyncChallenges + email_routing: resources.AsyncEmailRoutingResource + filters: resources.AsyncFiltersResource + firewall: resources.AsyncFirewallResource + healthchecks: resources.AsyncHealthchecksResource + keyless_certificates: resources.AsyncKeylessCertificatesResource + logpush: resources.AsyncLogpushResource + logs: resources.AsyncLogsResource + origin_tls_client_auth: resources.AsyncOriginTLSClientAuthResource + pagerules: resources.AsyncPagerulesResource + rate_limits: resources.AsyncRateLimitsResource + secondary_dns: resources.AsyncSecondaryDNSResource + waiting_rooms: resources.AsyncWaitingRoomsResource + web3: resources.AsyncWeb3Resource + workers: resources.AsyncWorkersResource + kv: resources.AsyncKVResource + durable_objects: resources.AsyncDurableObjectsResource + queues: resources.AsyncQueuesResource + managed_headers: resources.AsyncManagedHeadersResource + page_shield: resources.AsyncPageShieldResource + rulesets: resources.AsyncRulesetsResource + url_normalization: resources.AsyncURLNormalizationResource + spectrum: resources.AsyncSpectrumResource + addressing: resources.AsyncAddressingResource + audit_logs: resources.AsyncAuditLogsResource + billing: resources.AsyncBillingResource + brand_protection: resources.AsyncBrandProtectionResource + diagnostics: resources.AsyncDiagnosticsResource + images: resources.AsyncImagesResource + intel: resources.AsyncIntelResource + magic_transit: resources.AsyncMagicTransitResource + magic_network_monitoring: resources.AsyncMagicNetworkMonitoringResource + mtls_certificates: resources.AsyncMTLSCertificatesResource + pages: resources.AsyncPagesResource + pcaps: resources.AsyncPCAPsResource + registrar: resources.AsyncRegistrarResource + request_tracers: resources.AsyncRequestTracersResource + rules: resources.AsyncRulesResource + storage: resources.AsyncStorageResource + stream: resources.AsyncStreamResource + alerting: resources.AsyncAlertingResource + d1: resources.AsyncD1Resource + r2: resources.AsyncR2Resource + warp_connector: resources.AsyncWARPConnectorResource + workers_for_platforms: resources.AsyncWorkersForPlatformsResource + zero_trust: resources.AsyncZeroTrustResource + challenges: resources.AsyncChallengesResource hyperdrive: resources.AsyncHyperdriveResource - rum: resources.AsyncRUM - vectorize: resources.AsyncVectorize - url_scanner: resources.AsyncURLScanner - radar: resources.AsyncRadar - bot_management: resources.AsyncBotManagement - origin_post_quantum_encryption: resources.AsyncOriginPostQuantumEncryption - speed: resources.AsyncSpeed - dcv_delegation: resources.AsyncDCVDelegation - hostnames: resources.AsyncHostnames - snippets: resources.AsyncSnippets - calls: resources.AsyncCalls - cloudforce_one: resources.AsyncCloudforceOne + rum: resources.AsyncRUMResource + vectorize: resources.AsyncVectorizeResource + url_scanner: resources.AsyncURLScannerResource + radar: resources.AsyncRadarResource + bot_management: resources.AsyncBotManagementResource + origin_post_quantum_encryption: resources.AsyncOriginPostQuantumEncryptionResource + speed: resources.AsyncSpeedResource + dcv_delegation: resources.AsyncDCVDelegationResource + hostnames: resources.AsyncHostnamesResource + snippets: resources.AsyncSnippetsResource + calls: resources.AsyncCallsResource + cloudforce_one: resources.AsyncCloudforceOneResource + event_notifications: resources.AsyncEventNotificationsResource with_raw_response: AsyncCloudflareWithRawResponse with_streaming_response: AsyncCloudflareWithStreamedResponse # client options + api_token: str | None api_key: str | None api_email: str | None - api_token: str | None user_service_key: str | None def __init__( self, *, + api_token: str | None = None, api_key: str | None = None, api_email: str | None = None, - api_token: str | None = None, user_service_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. + # Configure a custom httpx client. + # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. http_client: httpx.AsyncClient | None = None, # Enable or disable schema validation for data returned by the API. # When enabled an error APIResponseValidationError is raised @@ -574,11 +581,15 @@ def __init__( """Construct a new async cloudflare client instance. This automatically infers the following arguments from their corresponding environment variables if they are not provided: + - `api_token` from `CLOUDFLARE_API_TOKEN` - `api_key` from `CLOUDFLARE_API_KEY` - `api_email` from `CLOUDFLARE_EMAIL` - - `api_token` from `CLOUDFLARE_API_TOKEN` - `user_service_key` from `CLOUDFLARE_API_USER_SERVICE_KEY` """ + if api_token is None: + api_token = os.environ.get("CLOUDFLARE_API_TOKEN") + self.api_token = api_token + if api_key is None: api_key = os.environ.get("CLOUDFLARE_API_KEY") self.api_key = api_key @@ -587,10 +598,6 @@ def __init__( api_email = os.environ.get("CLOUDFLARE_EMAIL") self.api_email = api_email - if api_token is None: - api_token = os.environ.get("CLOUDFLARE_API_TOKEN") - self.api_token = api_token - if user_service_key is None: user_service_key = os.environ.get("CLOUDFLARE_API_USER_SERVICE_KEY") self.user_service_key = user_service_key @@ -611,93 +618,94 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.accounts = resources.AsyncAccounts(self) - self.origin_ca_certificates = resources.AsyncOriginCACertificates(self) - self.ips = resources.AsyncIPs(self) - self.memberships = resources.AsyncMemberships(self) + self.accounts = resources.AsyncAccountsResource(self) + self.origin_ca_certificates = resources.AsyncOriginCACertificatesResource(self) + self.ips = resources.AsyncIPsResource(self) + self.memberships = resources.AsyncMembershipsResource(self) self.user = resources.AsyncUserResource(self) - self.zones = resources.AsyncZones(self) - self.load_balancers = resources.AsyncLoadBalancers(self) - self.cache = resources.AsyncCache(self) - self.ssl = resources.AsyncSSL(self) - self.subscriptions = resources.AsyncSubscriptions(self) - self.acm = resources.AsyncACM(self) - self.argo = resources.AsyncArgo(self) - self.plans = resources.AsyncPlans(self) - self.rate_plans = resources.AsyncRatePlans(self) - self.certificate_authorities = resources.AsyncCertificateAuthorities(self) - self.client_certificates = resources.AsyncClientCertificates(self) - self.custom_certificates = resources.AsyncCustomCertificates(self) - self.custom_hostnames = resources.AsyncCustomHostnames(self) - self.custom_nameservers = resources.AsyncCustomNameservers(self) - self.dns = resources.AsyncDNS(self) + self.zones = resources.AsyncZonesResource(self) + self.load_balancers = resources.AsyncLoadBalancersResource(self) + self.cache = resources.AsyncCacheResource(self) + self.ssl = resources.AsyncSSLResource(self) + self.subscriptions = resources.AsyncSubscriptionsResource(self) + self.acm = resources.AsyncACMResource(self) + self.argo = resources.AsyncArgoResource(self) + self.plans = resources.AsyncPlansResource(self) + self.rate_plans = resources.AsyncRatePlansResource(self) + self.certificate_authorities = resources.AsyncCertificateAuthoritiesResource(self) + self.client_certificates = resources.AsyncClientCertificatesResource(self) + self.custom_certificates = resources.AsyncCustomCertificatesResource(self) + self.custom_hostnames = resources.AsyncCustomHostnamesResource(self) + self.custom_nameservers = resources.AsyncCustomNameserversResource(self) + self.dns = resources.AsyncDNSResource(self) self.dnssec = resources.AsyncDNSSECResource(self) - self.email_routing = resources.AsyncEmailRouting(self) - self.filters = resources.AsyncFilters(self) - self.firewall = resources.AsyncFirewall(self) - self.healthchecks = resources.AsyncHealthchecks(self) - self.keyless_certificates = resources.AsyncKeylessCertificates(self) - self.logpush = resources.AsyncLogpush(self) - self.logs = resources.AsyncLogs(self) - self.origin_tls_client_auth = resources.AsyncOriginTLSClientAuth(self) - self.pagerules = resources.AsyncPagerules(self) - self.rate_limits = resources.AsyncRateLimits(self) - self.secondary_dns = resources.AsyncSecondaryDNS(self) - self.waiting_rooms = resources.AsyncWaitingRooms(self) - self.web3 = resources.AsyncWeb3(self) - self.workers = resources.AsyncWorkers(self) - self.kv = resources.AsyncKV(self) - self.durable_objects = resources.AsyncDurableObjects(self) - self.queues = resources.AsyncQueues(self) - self.managed_headers = resources.AsyncManagedHeaders(self) - self.page_shield = resources.AsyncPageShield(self) - self.rulesets = resources.AsyncRulesets(self) - self.url_normalization = resources.AsyncURLNormalization(self) - self.spectrum = resources.AsyncSpectrum(self) - self.addressing = resources.AsyncAddressing(self) - self.audit_logs = resources.AsyncAuditLogs(self) - self.billing = resources.AsyncBilling(self) - self.brand_protection = resources.AsyncBrandProtection(self) - self.diagnostics = resources.AsyncDiagnostics(self) - self.images = resources.AsyncImages(self) - self.intel = resources.AsyncIntel(self) - self.magic_transit = resources.AsyncMagicTransit(self) - self.magic_network_monitoring = resources.AsyncMagicNetworkMonitoring(self) - self.mtls_certificates = resources.AsyncMTLSCertificates(self) - self.pages = resources.AsyncPages(self) - self.pcaps = resources.AsyncPCAPs(self) - self.registrar = resources.AsyncRegistrar(self) - self.request_tracers = resources.AsyncRequestTracers(self) - self.rules = resources.AsyncRules(self) - self.storage = resources.AsyncStorage(self) - self.stream = resources.AsyncStream(self) - self.alerting = resources.AsyncAlerting(self) - self.d1 = resources.AsyncD1(self) - self.r2 = resources.AsyncR2(self) - self.warp_connector = resources.AsyncWARPConnector(self) - self.workers_for_platforms = resources.AsyncWorkersForPlatforms(self) - self.zero_trust = resources.AsyncZeroTrust(self) - self.challenges = resources.AsyncChallenges(self) + self.email_routing = resources.AsyncEmailRoutingResource(self) + self.filters = resources.AsyncFiltersResource(self) + self.firewall = resources.AsyncFirewallResource(self) + self.healthchecks = resources.AsyncHealthchecksResource(self) + self.keyless_certificates = resources.AsyncKeylessCertificatesResource(self) + self.logpush = resources.AsyncLogpushResource(self) + self.logs = resources.AsyncLogsResource(self) + self.origin_tls_client_auth = resources.AsyncOriginTLSClientAuthResource(self) + self.pagerules = resources.AsyncPagerulesResource(self) + self.rate_limits = resources.AsyncRateLimitsResource(self) + self.secondary_dns = resources.AsyncSecondaryDNSResource(self) + self.waiting_rooms = resources.AsyncWaitingRoomsResource(self) + self.web3 = resources.AsyncWeb3Resource(self) + self.workers = resources.AsyncWorkersResource(self) + self.kv = resources.AsyncKVResource(self) + self.durable_objects = resources.AsyncDurableObjectsResource(self) + self.queues = resources.AsyncQueuesResource(self) + self.managed_headers = resources.AsyncManagedHeadersResource(self) + self.page_shield = resources.AsyncPageShieldResource(self) + self.rulesets = resources.AsyncRulesetsResource(self) + self.url_normalization = resources.AsyncURLNormalizationResource(self) + self.spectrum = resources.AsyncSpectrumResource(self) + self.addressing = resources.AsyncAddressingResource(self) + self.audit_logs = resources.AsyncAuditLogsResource(self) + self.billing = resources.AsyncBillingResource(self) + self.brand_protection = resources.AsyncBrandProtectionResource(self) + self.diagnostics = resources.AsyncDiagnosticsResource(self) + self.images = resources.AsyncImagesResource(self) + self.intel = resources.AsyncIntelResource(self) + self.magic_transit = resources.AsyncMagicTransitResource(self) + self.magic_network_monitoring = resources.AsyncMagicNetworkMonitoringResource(self) + self.mtls_certificates = resources.AsyncMTLSCertificatesResource(self) + self.pages = resources.AsyncPagesResource(self) + self.pcaps = resources.AsyncPCAPsResource(self) + self.registrar = resources.AsyncRegistrarResource(self) + self.request_tracers = resources.AsyncRequestTracersResource(self) + self.rules = resources.AsyncRulesResource(self) + self.storage = resources.AsyncStorageResource(self) + self.stream = resources.AsyncStreamResource(self) + self.alerting = resources.AsyncAlertingResource(self) + self.d1 = resources.AsyncD1Resource(self) + self.r2 = resources.AsyncR2Resource(self) + self.warp_connector = resources.AsyncWARPConnectorResource(self) + self.workers_for_platforms = resources.AsyncWorkersForPlatformsResource(self) + self.zero_trust = resources.AsyncZeroTrustResource(self) + self.challenges = resources.AsyncChallengesResource(self) self.hyperdrive = resources.AsyncHyperdriveResource(self) - self.rum = resources.AsyncRUM(self) - self.vectorize = resources.AsyncVectorize(self) - self.url_scanner = resources.AsyncURLScanner(self) - self.radar = resources.AsyncRadar(self) - self.bot_management = resources.AsyncBotManagement(self) - self.origin_post_quantum_encryption = resources.AsyncOriginPostQuantumEncryption(self) - self.speed = resources.AsyncSpeed(self) - self.dcv_delegation = resources.AsyncDCVDelegation(self) - self.hostnames = resources.AsyncHostnames(self) - self.snippets = resources.AsyncSnippets(self) - self.calls = resources.AsyncCalls(self) - self.cloudforce_one = resources.AsyncCloudforceOne(self) + self.rum = resources.AsyncRUMResource(self) + self.vectorize = resources.AsyncVectorizeResource(self) + self.url_scanner = resources.AsyncURLScannerResource(self) + self.radar = resources.AsyncRadarResource(self) + self.bot_management = resources.AsyncBotManagementResource(self) + self.origin_post_quantum_encryption = resources.AsyncOriginPostQuantumEncryptionResource(self) + self.speed = resources.AsyncSpeedResource(self) + self.dcv_delegation = resources.AsyncDCVDelegationResource(self) + self.hostnames = resources.AsyncHostnamesResource(self) + self.snippets = resources.AsyncSnippetsResource(self) + self.calls = resources.AsyncCallsResource(self) + self.cloudforce_one = resources.AsyncCloudforceOneResource(self) + self.event_notifications = resources.AsyncEventNotificationsResource(self) self.with_raw_response = AsyncCloudflareWithRawResponse(self) self.with_streaming_response = AsyncCloudflareWithStreamedResponse(self) @property @override def qs(self) -> Querystring: - return Querystring(array_format="comma") + return Querystring(array_format="repeat") @property @override @@ -780,9 +788,9 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: def copy( self, *, + api_token: str | None = None, api_key: str | None = None, api_email: str | None = None, - api_token: str | None = None, user_service_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, @@ -817,9 +825,9 @@ def copy( http_client = http_client or self._client return self.__class__( + api_token=api_token or self.api_token, api_key=api_key or self.api_key, api_email=api_email or self.api_email, - api_token=api_token or self.api_token, user_service_key=user_service_key or self.user_service_key, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, @@ -870,364 +878,402 @@ def _make_status_error( class CloudflareWithRawResponse: def __init__(self, client: Cloudflare) -> None: - self.accounts = resources.AccountsWithRawResponse(client.accounts) - self.origin_ca_certificates = resources.OriginCACertificatesWithRawResponse(client.origin_ca_certificates) - self.ips = resources.IPsWithRawResponse(client.ips) - self.memberships = resources.MembershipsWithRawResponse(client.memberships) + self.accounts = resources.AccountsResourceWithRawResponse(client.accounts) + self.origin_ca_certificates = resources.OriginCACertificatesResourceWithRawResponse( + client.origin_ca_certificates + ) + self.ips = resources.IPsResourceWithRawResponse(client.ips) + self.memberships = resources.MembershipsResourceWithRawResponse(client.memberships) self.user = resources.UserResourceWithRawResponse(client.user) - self.zones = resources.ZonesWithRawResponse(client.zones) - self.load_balancers = resources.LoadBalancersWithRawResponse(client.load_balancers) - self.cache = resources.CacheWithRawResponse(client.cache) - self.ssl = resources.SSLWithRawResponse(client.ssl) - self.subscriptions = resources.SubscriptionsWithRawResponse(client.subscriptions) - self.acm = resources.ACMWithRawResponse(client.acm) - self.argo = resources.ArgoWithRawResponse(client.argo) - self.plans = resources.PlansWithRawResponse(client.plans) - self.rate_plans = resources.RatePlansWithRawResponse(client.rate_plans) - self.certificate_authorities = resources.CertificateAuthoritiesWithRawResponse(client.certificate_authorities) - self.client_certificates = resources.ClientCertificatesWithRawResponse(client.client_certificates) - self.custom_certificates = resources.CustomCertificatesWithRawResponse(client.custom_certificates) - self.custom_hostnames = resources.CustomHostnamesWithRawResponse(client.custom_hostnames) - self.custom_nameservers = resources.CustomNameserversWithRawResponse(client.custom_nameservers) - self.dns = resources.DNSWithRawResponse(client.dns) + self.zones = resources.ZonesResourceWithRawResponse(client.zones) + self.load_balancers = resources.LoadBalancersResourceWithRawResponse(client.load_balancers) + self.cache = resources.CacheResourceWithRawResponse(client.cache) + self.ssl = resources.SSLResourceWithRawResponse(client.ssl) + self.subscriptions = resources.SubscriptionsResourceWithRawResponse(client.subscriptions) + self.acm = resources.ACMResourceWithRawResponse(client.acm) + self.argo = resources.ArgoResourceWithRawResponse(client.argo) + self.plans = resources.PlansResourceWithRawResponse(client.plans) + self.rate_plans = resources.RatePlansResourceWithRawResponse(client.rate_plans) + self.certificate_authorities = resources.CertificateAuthoritiesResourceWithRawResponse( + client.certificate_authorities + ) + self.client_certificates = resources.ClientCertificatesResourceWithRawResponse(client.client_certificates) + self.custom_certificates = resources.CustomCertificatesResourceWithRawResponse(client.custom_certificates) + self.custom_hostnames = resources.CustomHostnamesResourceWithRawResponse(client.custom_hostnames) + self.custom_nameservers = resources.CustomNameserversResourceWithRawResponse(client.custom_nameservers) + self.dns = resources.DNSResourceWithRawResponse(client.dns) self.dnssec = resources.DNSSECResourceWithRawResponse(client.dnssec) - self.email_routing = resources.EmailRoutingWithRawResponse(client.email_routing) - self.filters = resources.FiltersWithRawResponse(client.filters) - self.firewall = resources.FirewallWithRawResponse(client.firewall) - self.healthchecks = resources.HealthchecksWithRawResponse(client.healthchecks) - self.keyless_certificates = resources.KeylessCertificatesWithRawResponse(client.keyless_certificates) - self.logpush = resources.LogpushWithRawResponse(client.logpush) - self.logs = resources.LogsWithRawResponse(client.logs) - self.origin_tls_client_auth = resources.OriginTLSClientAuthWithRawResponse(client.origin_tls_client_auth) - self.pagerules = resources.PagerulesWithRawResponse(client.pagerules) - self.rate_limits = resources.RateLimitsWithRawResponse(client.rate_limits) - self.secondary_dns = resources.SecondaryDNSWithRawResponse(client.secondary_dns) - self.waiting_rooms = resources.WaitingRoomsWithRawResponse(client.waiting_rooms) - self.web3 = resources.Web3WithRawResponse(client.web3) - self.workers = resources.WorkersWithRawResponse(client.workers) - self.kv = resources.KVWithRawResponse(client.kv) - self.durable_objects = resources.DurableObjectsWithRawResponse(client.durable_objects) - self.queues = resources.QueuesWithRawResponse(client.queues) - self.managed_headers = resources.ManagedHeadersWithRawResponse(client.managed_headers) - self.page_shield = resources.PageShieldWithRawResponse(client.page_shield) - self.rulesets = resources.RulesetsWithRawResponse(client.rulesets) - self.url_normalization = resources.URLNormalizationWithRawResponse(client.url_normalization) - self.spectrum = resources.SpectrumWithRawResponse(client.spectrum) - self.addressing = resources.AddressingWithRawResponse(client.addressing) - self.audit_logs = resources.AuditLogsWithRawResponse(client.audit_logs) - self.billing = resources.BillingWithRawResponse(client.billing) - self.brand_protection = resources.BrandProtectionWithRawResponse(client.brand_protection) - self.diagnostics = resources.DiagnosticsWithRawResponse(client.diagnostics) - self.images = resources.ImagesWithRawResponse(client.images) - self.intel = resources.IntelWithRawResponse(client.intel) - self.magic_transit = resources.MagicTransitWithRawResponse(client.magic_transit) - self.magic_network_monitoring = resources.MagicNetworkMonitoringWithRawResponse(client.magic_network_monitoring) - self.mtls_certificates = resources.MTLSCertificatesWithRawResponse(client.mtls_certificates) - self.pages = resources.PagesWithRawResponse(client.pages) - self.pcaps = resources.PCAPsWithRawResponse(client.pcaps) - self.registrar = resources.RegistrarWithRawResponse(client.registrar) - self.request_tracers = resources.RequestTracersWithRawResponse(client.request_tracers) - self.rules = resources.RulesWithRawResponse(client.rules) - self.storage = resources.StorageWithRawResponse(client.storage) - self.stream = resources.StreamWithRawResponse(client.stream) - self.alerting = resources.AlertingWithRawResponse(client.alerting) - self.d1 = resources.D1WithRawResponse(client.d1) - self.r2 = resources.R2WithRawResponse(client.r2) - self.warp_connector = resources.WARPConnectorWithRawResponse(client.warp_connector) - self.workers_for_platforms = resources.WorkersForPlatformsWithRawResponse(client.workers_for_platforms) - self.zero_trust = resources.ZeroTrustWithRawResponse(client.zero_trust) - self.challenges = resources.ChallengesWithRawResponse(client.challenges) + self.email_routing = resources.EmailRoutingResourceWithRawResponse(client.email_routing) + self.filters = resources.FiltersResourceWithRawResponse(client.filters) + self.firewall = resources.FirewallResourceWithRawResponse(client.firewall) + self.healthchecks = resources.HealthchecksResourceWithRawResponse(client.healthchecks) + self.keyless_certificates = resources.KeylessCertificatesResourceWithRawResponse(client.keyless_certificates) + self.logpush = resources.LogpushResourceWithRawResponse(client.logpush) + self.logs = resources.LogsResourceWithRawResponse(client.logs) + self.origin_tls_client_auth = resources.OriginTLSClientAuthResourceWithRawResponse( + client.origin_tls_client_auth + ) + self.pagerules = resources.PagerulesResourceWithRawResponse(client.pagerules) + self.rate_limits = resources.RateLimitsResourceWithRawResponse(client.rate_limits) + self.secondary_dns = resources.SecondaryDNSResourceWithRawResponse(client.secondary_dns) + self.waiting_rooms = resources.WaitingRoomsResourceWithRawResponse(client.waiting_rooms) + self.web3 = resources.Web3ResourceWithRawResponse(client.web3) + self.workers = resources.WorkersResourceWithRawResponse(client.workers) + self.kv = resources.KVResourceWithRawResponse(client.kv) + self.durable_objects = resources.DurableObjectsResourceWithRawResponse(client.durable_objects) + self.queues = resources.QueuesResourceWithRawResponse(client.queues) + self.managed_headers = resources.ManagedHeadersResourceWithRawResponse(client.managed_headers) + self.page_shield = resources.PageShieldResourceWithRawResponse(client.page_shield) + self.rulesets = resources.RulesetsResourceWithRawResponse(client.rulesets) + self.url_normalization = resources.URLNormalizationResourceWithRawResponse(client.url_normalization) + self.spectrum = resources.SpectrumResourceWithRawResponse(client.spectrum) + self.addressing = resources.AddressingResourceWithRawResponse(client.addressing) + self.audit_logs = resources.AuditLogsResourceWithRawResponse(client.audit_logs) + self.billing = resources.BillingResourceWithRawResponse(client.billing) + self.brand_protection = resources.BrandProtectionResourceWithRawResponse(client.brand_protection) + self.diagnostics = resources.DiagnosticsResourceWithRawResponse(client.diagnostics) + self.images = resources.ImagesResourceWithRawResponse(client.images) + self.intel = resources.IntelResourceWithRawResponse(client.intel) + self.magic_transit = resources.MagicTransitResourceWithRawResponse(client.magic_transit) + self.magic_network_monitoring = resources.MagicNetworkMonitoringResourceWithRawResponse( + client.magic_network_monitoring + ) + self.mtls_certificates = resources.MTLSCertificatesResourceWithRawResponse(client.mtls_certificates) + self.pages = resources.PagesResourceWithRawResponse(client.pages) + self.pcaps = resources.PCAPsResourceWithRawResponse(client.pcaps) + self.registrar = resources.RegistrarResourceWithRawResponse(client.registrar) + self.request_tracers = resources.RequestTracersResourceWithRawResponse(client.request_tracers) + self.rules = resources.RulesResourceWithRawResponse(client.rules) + self.storage = resources.StorageResourceWithRawResponse(client.storage) + self.stream = resources.StreamResourceWithRawResponse(client.stream) + self.alerting = resources.AlertingResourceWithRawResponse(client.alerting) + self.d1 = resources.D1ResourceWithRawResponse(client.d1) + self.r2 = resources.R2ResourceWithRawResponse(client.r2) + self.warp_connector = resources.WARPConnectorResourceWithRawResponse(client.warp_connector) + self.workers_for_platforms = resources.WorkersForPlatformsResourceWithRawResponse(client.workers_for_platforms) + self.zero_trust = resources.ZeroTrustResourceWithRawResponse(client.zero_trust) + self.challenges = resources.ChallengesResourceWithRawResponse(client.challenges) self.hyperdrive = resources.HyperdriveResourceWithRawResponse(client.hyperdrive) - self.rum = resources.RUMWithRawResponse(client.rum) - self.vectorize = resources.VectorizeWithRawResponse(client.vectorize) - self.url_scanner = resources.URLScannerWithRawResponse(client.url_scanner) - self.radar = resources.RadarWithRawResponse(client.radar) - self.bot_management = resources.BotManagementWithRawResponse(client.bot_management) - self.origin_post_quantum_encryption = resources.OriginPostQuantumEncryptionWithRawResponse( + self.rum = resources.RUMResourceWithRawResponse(client.rum) + self.vectorize = resources.VectorizeResourceWithRawResponse(client.vectorize) + self.url_scanner = resources.URLScannerResourceWithRawResponse(client.url_scanner) + self.radar = resources.RadarResourceWithRawResponse(client.radar) + self.bot_management = resources.BotManagementResourceWithRawResponse(client.bot_management) + self.origin_post_quantum_encryption = resources.OriginPostQuantumEncryptionResourceWithRawResponse( client.origin_post_quantum_encryption ) - self.speed = resources.SpeedWithRawResponse(client.speed) - self.dcv_delegation = resources.DCVDelegationWithRawResponse(client.dcv_delegation) - self.hostnames = resources.HostnamesWithRawResponse(client.hostnames) - self.snippets = resources.SnippetsWithRawResponse(client.snippets) - self.calls = resources.CallsWithRawResponse(client.calls) - self.cloudforce_one = resources.CloudforceOneWithRawResponse(client.cloudforce_one) + self.speed = resources.SpeedResourceWithRawResponse(client.speed) + self.dcv_delegation = resources.DCVDelegationResourceWithRawResponse(client.dcv_delegation) + self.hostnames = resources.HostnamesResourceWithRawResponse(client.hostnames) + self.snippets = resources.SnippetsResourceWithRawResponse(client.snippets) + self.calls = resources.CallsResourceWithRawResponse(client.calls) + self.cloudforce_one = resources.CloudforceOneResourceWithRawResponse(client.cloudforce_one) + self.event_notifications = resources.EventNotificationsResourceWithRawResponse(client.event_notifications) class AsyncCloudflareWithRawResponse: def __init__(self, client: AsyncCloudflare) -> None: - self.accounts = resources.AsyncAccountsWithRawResponse(client.accounts) - self.origin_ca_certificates = resources.AsyncOriginCACertificatesWithRawResponse(client.origin_ca_certificates) - self.ips = resources.AsyncIPsWithRawResponse(client.ips) - self.memberships = resources.AsyncMembershipsWithRawResponse(client.memberships) + self.accounts = resources.AsyncAccountsResourceWithRawResponse(client.accounts) + self.origin_ca_certificates = resources.AsyncOriginCACertificatesResourceWithRawResponse( + client.origin_ca_certificates + ) + self.ips = resources.AsyncIPsResourceWithRawResponse(client.ips) + self.memberships = resources.AsyncMembershipsResourceWithRawResponse(client.memberships) self.user = resources.AsyncUserResourceWithRawResponse(client.user) - self.zones = resources.AsyncZonesWithRawResponse(client.zones) - self.load_balancers = resources.AsyncLoadBalancersWithRawResponse(client.load_balancers) - self.cache = resources.AsyncCacheWithRawResponse(client.cache) - self.ssl = resources.AsyncSSLWithRawResponse(client.ssl) - self.subscriptions = resources.AsyncSubscriptionsWithRawResponse(client.subscriptions) - self.acm = resources.AsyncACMWithRawResponse(client.acm) - self.argo = resources.AsyncArgoWithRawResponse(client.argo) - self.plans = resources.AsyncPlansWithRawResponse(client.plans) - self.rate_plans = resources.AsyncRatePlansWithRawResponse(client.rate_plans) - self.certificate_authorities = resources.AsyncCertificateAuthoritiesWithRawResponse( + self.zones = resources.AsyncZonesResourceWithRawResponse(client.zones) + self.load_balancers = resources.AsyncLoadBalancersResourceWithRawResponse(client.load_balancers) + self.cache = resources.AsyncCacheResourceWithRawResponse(client.cache) + self.ssl = resources.AsyncSSLResourceWithRawResponse(client.ssl) + self.subscriptions = resources.AsyncSubscriptionsResourceWithRawResponse(client.subscriptions) + self.acm = resources.AsyncACMResourceWithRawResponse(client.acm) + self.argo = resources.AsyncArgoResourceWithRawResponse(client.argo) + self.plans = resources.AsyncPlansResourceWithRawResponse(client.plans) + self.rate_plans = resources.AsyncRatePlansResourceWithRawResponse(client.rate_plans) + self.certificate_authorities = resources.AsyncCertificateAuthoritiesResourceWithRawResponse( client.certificate_authorities ) - self.client_certificates = resources.AsyncClientCertificatesWithRawResponse(client.client_certificates) - self.custom_certificates = resources.AsyncCustomCertificatesWithRawResponse(client.custom_certificates) - self.custom_hostnames = resources.AsyncCustomHostnamesWithRawResponse(client.custom_hostnames) - self.custom_nameservers = resources.AsyncCustomNameserversWithRawResponse(client.custom_nameservers) - self.dns = resources.AsyncDNSWithRawResponse(client.dns) + self.client_certificates = resources.AsyncClientCertificatesResourceWithRawResponse(client.client_certificates) + self.custom_certificates = resources.AsyncCustomCertificatesResourceWithRawResponse(client.custom_certificates) + self.custom_hostnames = resources.AsyncCustomHostnamesResourceWithRawResponse(client.custom_hostnames) + self.custom_nameservers = resources.AsyncCustomNameserversResourceWithRawResponse(client.custom_nameservers) + self.dns = resources.AsyncDNSResourceWithRawResponse(client.dns) self.dnssec = resources.AsyncDNSSECResourceWithRawResponse(client.dnssec) - self.email_routing = resources.AsyncEmailRoutingWithRawResponse(client.email_routing) - self.filters = resources.AsyncFiltersWithRawResponse(client.filters) - self.firewall = resources.AsyncFirewallWithRawResponse(client.firewall) - self.healthchecks = resources.AsyncHealthchecksWithRawResponse(client.healthchecks) - self.keyless_certificates = resources.AsyncKeylessCertificatesWithRawResponse(client.keyless_certificates) - self.logpush = resources.AsyncLogpushWithRawResponse(client.logpush) - self.logs = resources.AsyncLogsWithRawResponse(client.logs) - self.origin_tls_client_auth = resources.AsyncOriginTLSClientAuthWithRawResponse(client.origin_tls_client_auth) - self.pagerules = resources.AsyncPagerulesWithRawResponse(client.pagerules) - self.rate_limits = resources.AsyncRateLimitsWithRawResponse(client.rate_limits) - self.secondary_dns = resources.AsyncSecondaryDNSWithRawResponse(client.secondary_dns) - self.waiting_rooms = resources.AsyncWaitingRoomsWithRawResponse(client.waiting_rooms) - self.web3 = resources.AsyncWeb3WithRawResponse(client.web3) - self.workers = resources.AsyncWorkersWithRawResponse(client.workers) - self.kv = resources.AsyncKVWithRawResponse(client.kv) - self.durable_objects = resources.AsyncDurableObjectsWithRawResponse(client.durable_objects) - self.queues = resources.AsyncQueuesWithRawResponse(client.queues) - self.managed_headers = resources.AsyncManagedHeadersWithRawResponse(client.managed_headers) - self.page_shield = resources.AsyncPageShieldWithRawResponse(client.page_shield) - self.rulesets = resources.AsyncRulesetsWithRawResponse(client.rulesets) - self.url_normalization = resources.AsyncURLNormalizationWithRawResponse(client.url_normalization) - self.spectrum = resources.AsyncSpectrumWithRawResponse(client.spectrum) - self.addressing = resources.AsyncAddressingWithRawResponse(client.addressing) - self.audit_logs = resources.AsyncAuditLogsWithRawResponse(client.audit_logs) - self.billing = resources.AsyncBillingWithRawResponse(client.billing) - self.brand_protection = resources.AsyncBrandProtectionWithRawResponse(client.brand_protection) - self.diagnostics = resources.AsyncDiagnosticsWithRawResponse(client.diagnostics) - self.images = resources.AsyncImagesWithRawResponse(client.images) - self.intel = resources.AsyncIntelWithRawResponse(client.intel) - self.magic_transit = resources.AsyncMagicTransitWithRawResponse(client.magic_transit) - self.magic_network_monitoring = resources.AsyncMagicNetworkMonitoringWithRawResponse( + self.email_routing = resources.AsyncEmailRoutingResourceWithRawResponse(client.email_routing) + self.filters = resources.AsyncFiltersResourceWithRawResponse(client.filters) + self.firewall = resources.AsyncFirewallResourceWithRawResponse(client.firewall) + self.healthchecks = resources.AsyncHealthchecksResourceWithRawResponse(client.healthchecks) + self.keyless_certificates = resources.AsyncKeylessCertificatesResourceWithRawResponse( + client.keyless_certificates + ) + self.logpush = resources.AsyncLogpushResourceWithRawResponse(client.logpush) + self.logs = resources.AsyncLogsResourceWithRawResponse(client.logs) + self.origin_tls_client_auth = resources.AsyncOriginTLSClientAuthResourceWithRawResponse( + client.origin_tls_client_auth + ) + self.pagerules = resources.AsyncPagerulesResourceWithRawResponse(client.pagerules) + self.rate_limits = resources.AsyncRateLimitsResourceWithRawResponse(client.rate_limits) + self.secondary_dns = resources.AsyncSecondaryDNSResourceWithRawResponse(client.secondary_dns) + self.waiting_rooms = resources.AsyncWaitingRoomsResourceWithRawResponse(client.waiting_rooms) + self.web3 = resources.AsyncWeb3ResourceWithRawResponse(client.web3) + self.workers = resources.AsyncWorkersResourceWithRawResponse(client.workers) + self.kv = resources.AsyncKVResourceWithRawResponse(client.kv) + self.durable_objects = resources.AsyncDurableObjectsResourceWithRawResponse(client.durable_objects) + self.queues = resources.AsyncQueuesResourceWithRawResponse(client.queues) + self.managed_headers = resources.AsyncManagedHeadersResourceWithRawResponse(client.managed_headers) + self.page_shield = resources.AsyncPageShieldResourceWithRawResponse(client.page_shield) + self.rulesets = resources.AsyncRulesetsResourceWithRawResponse(client.rulesets) + self.url_normalization = resources.AsyncURLNormalizationResourceWithRawResponse(client.url_normalization) + self.spectrum = resources.AsyncSpectrumResourceWithRawResponse(client.spectrum) + self.addressing = resources.AsyncAddressingResourceWithRawResponse(client.addressing) + self.audit_logs = resources.AsyncAuditLogsResourceWithRawResponse(client.audit_logs) + self.billing = resources.AsyncBillingResourceWithRawResponse(client.billing) + self.brand_protection = resources.AsyncBrandProtectionResourceWithRawResponse(client.brand_protection) + self.diagnostics = resources.AsyncDiagnosticsResourceWithRawResponse(client.diagnostics) + self.images = resources.AsyncImagesResourceWithRawResponse(client.images) + self.intel = resources.AsyncIntelResourceWithRawResponse(client.intel) + self.magic_transit = resources.AsyncMagicTransitResourceWithRawResponse(client.magic_transit) + self.magic_network_monitoring = resources.AsyncMagicNetworkMonitoringResourceWithRawResponse( client.magic_network_monitoring ) - self.mtls_certificates = resources.AsyncMTLSCertificatesWithRawResponse(client.mtls_certificates) - self.pages = resources.AsyncPagesWithRawResponse(client.pages) - self.pcaps = resources.AsyncPCAPsWithRawResponse(client.pcaps) - self.registrar = resources.AsyncRegistrarWithRawResponse(client.registrar) - self.request_tracers = resources.AsyncRequestTracersWithRawResponse(client.request_tracers) - self.rules = resources.AsyncRulesWithRawResponse(client.rules) - self.storage = resources.AsyncStorageWithRawResponse(client.storage) - self.stream = resources.AsyncStreamWithRawResponse(client.stream) - self.alerting = resources.AsyncAlertingWithRawResponse(client.alerting) - self.d1 = resources.AsyncD1WithRawResponse(client.d1) - self.r2 = resources.AsyncR2WithRawResponse(client.r2) - self.warp_connector = resources.AsyncWARPConnectorWithRawResponse(client.warp_connector) - self.workers_for_platforms = resources.AsyncWorkersForPlatformsWithRawResponse(client.workers_for_platforms) - self.zero_trust = resources.AsyncZeroTrustWithRawResponse(client.zero_trust) - self.challenges = resources.AsyncChallengesWithRawResponse(client.challenges) + self.mtls_certificates = resources.AsyncMTLSCertificatesResourceWithRawResponse(client.mtls_certificates) + self.pages = resources.AsyncPagesResourceWithRawResponse(client.pages) + self.pcaps = resources.AsyncPCAPsResourceWithRawResponse(client.pcaps) + self.registrar = resources.AsyncRegistrarResourceWithRawResponse(client.registrar) + self.request_tracers = resources.AsyncRequestTracersResourceWithRawResponse(client.request_tracers) + self.rules = resources.AsyncRulesResourceWithRawResponse(client.rules) + self.storage = resources.AsyncStorageResourceWithRawResponse(client.storage) + self.stream = resources.AsyncStreamResourceWithRawResponse(client.stream) + self.alerting = resources.AsyncAlertingResourceWithRawResponse(client.alerting) + self.d1 = resources.AsyncD1ResourceWithRawResponse(client.d1) + self.r2 = resources.AsyncR2ResourceWithRawResponse(client.r2) + self.warp_connector = resources.AsyncWARPConnectorResourceWithRawResponse(client.warp_connector) + self.workers_for_platforms = resources.AsyncWorkersForPlatformsResourceWithRawResponse( + client.workers_for_platforms + ) + self.zero_trust = resources.AsyncZeroTrustResourceWithRawResponse(client.zero_trust) + self.challenges = resources.AsyncChallengesResourceWithRawResponse(client.challenges) self.hyperdrive = resources.AsyncHyperdriveResourceWithRawResponse(client.hyperdrive) - self.rum = resources.AsyncRUMWithRawResponse(client.rum) - self.vectorize = resources.AsyncVectorizeWithRawResponse(client.vectorize) - self.url_scanner = resources.AsyncURLScannerWithRawResponse(client.url_scanner) - self.radar = resources.AsyncRadarWithRawResponse(client.radar) - self.bot_management = resources.AsyncBotManagementWithRawResponse(client.bot_management) - self.origin_post_quantum_encryption = resources.AsyncOriginPostQuantumEncryptionWithRawResponse( + self.rum = resources.AsyncRUMResourceWithRawResponse(client.rum) + self.vectorize = resources.AsyncVectorizeResourceWithRawResponse(client.vectorize) + self.url_scanner = resources.AsyncURLScannerResourceWithRawResponse(client.url_scanner) + self.radar = resources.AsyncRadarResourceWithRawResponse(client.radar) + self.bot_management = resources.AsyncBotManagementResourceWithRawResponse(client.bot_management) + self.origin_post_quantum_encryption = resources.AsyncOriginPostQuantumEncryptionResourceWithRawResponse( client.origin_post_quantum_encryption ) - self.speed = resources.AsyncSpeedWithRawResponse(client.speed) - self.dcv_delegation = resources.AsyncDCVDelegationWithRawResponse(client.dcv_delegation) - self.hostnames = resources.AsyncHostnamesWithRawResponse(client.hostnames) - self.snippets = resources.AsyncSnippetsWithRawResponse(client.snippets) - self.calls = resources.AsyncCallsWithRawResponse(client.calls) - self.cloudforce_one = resources.AsyncCloudforceOneWithRawResponse(client.cloudforce_one) + self.speed = resources.AsyncSpeedResourceWithRawResponse(client.speed) + self.dcv_delegation = resources.AsyncDCVDelegationResourceWithRawResponse(client.dcv_delegation) + self.hostnames = resources.AsyncHostnamesResourceWithRawResponse(client.hostnames) + self.snippets = resources.AsyncSnippetsResourceWithRawResponse(client.snippets) + self.calls = resources.AsyncCallsResourceWithRawResponse(client.calls) + self.cloudforce_one = resources.AsyncCloudforceOneResourceWithRawResponse(client.cloudforce_one) + self.event_notifications = resources.AsyncEventNotificationsResourceWithRawResponse(client.event_notifications) class CloudflareWithStreamedResponse: def __init__(self, client: Cloudflare) -> None: - self.accounts = resources.AccountsWithStreamingResponse(client.accounts) - self.origin_ca_certificates = resources.OriginCACertificatesWithStreamingResponse(client.origin_ca_certificates) - self.ips = resources.IPsWithStreamingResponse(client.ips) - self.memberships = resources.MembershipsWithStreamingResponse(client.memberships) + self.accounts = resources.AccountsResourceWithStreamingResponse(client.accounts) + self.origin_ca_certificates = resources.OriginCACertificatesResourceWithStreamingResponse( + client.origin_ca_certificates + ) + self.ips = resources.IPsResourceWithStreamingResponse(client.ips) + self.memberships = resources.MembershipsResourceWithStreamingResponse(client.memberships) self.user = resources.UserResourceWithStreamingResponse(client.user) - self.zones = resources.ZonesWithStreamingResponse(client.zones) - self.load_balancers = resources.LoadBalancersWithStreamingResponse(client.load_balancers) - self.cache = resources.CacheWithStreamingResponse(client.cache) - self.ssl = resources.SSLWithStreamingResponse(client.ssl) - self.subscriptions = resources.SubscriptionsWithStreamingResponse(client.subscriptions) - self.acm = resources.ACMWithStreamingResponse(client.acm) - self.argo = resources.ArgoWithStreamingResponse(client.argo) - self.plans = resources.PlansWithStreamingResponse(client.plans) - self.rate_plans = resources.RatePlansWithStreamingResponse(client.rate_plans) - self.certificate_authorities = resources.CertificateAuthoritiesWithStreamingResponse( + self.zones = resources.ZonesResourceWithStreamingResponse(client.zones) + self.load_balancers = resources.LoadBalancersResourceWithStreamingResponse(client.load_balancers) + self.cache = resources.CacheResourceWithStreamingResponse(client.cache) + self.ssl = resources.SSLResourceWithStreamingResponse(client.ssl) + self.subscriptions = resources.SubscriptionsResourceWithStreamingResponse(client.subscriptions) + self.acm = resources.ACMResourceWithStreamingResponse(client.acm) + self.argo = resources.ArgoResourceWithStreamingResponse(client.argo) + self.plans = resources.PlansResourceWithStreamingResponse(client.plans) + self.rate_plans = resources.RatePlansResourceWithStreamingResponse(client.rate_plans) + self.certificate_authorities = resources.CertificateAuthoritiesResourceWithStreamingResponse( client.certificate_authorities ) - self.client_certificates = resources.ClientCertificatesWithStreamingResponse(client.client_certificates) - self.custom_certificates = resources.CustomCertificatesWithStreamingResponse(client.custom_certificates) - self.custom_hostnames = resources.CustomHostnamesWithStreamingResponse(client.custom_hostnames) - self.custom_nameservers = resources.CustomNameserversWithStreamingResponse(client.custom_nameservers) - self.dns = resources.DNSWithStreamingResponse(client.dns) + self.client_certificates = resources.ClientCertificatesResourceWithStreamingResponse(client.client_certificates) + self.custom_certificates = resources.CustomCertificatesResourceWithStreamingResponse(client.custom_certificates) + self.custom_hostnames = resources.CustomHostnamesResourceWithStreamingResponse(client.custom_hostnames) + self.custom_nameservers = resources.CustomNameserversResourceWithStreamingResponse(client.custom_nameservers) + self.dns = resources.DNSResourceWithStreamingResponse(client.dns) self.dnssec = resources.DNSSECResourceWithStreamingResponse(client.dnssec) - self.email_routing = resources.EmailRoutingWithStreamingResponse(client.email_routing) - self.filters = resources.FiltersWithStreamingResponse(client.filters) - self.firewall = resources.FirewallWithStreamingResponse(client.firewall) - self.healthchecks = resources.HealthchecksWithStreamingResponse(client.healthchecks) - self.keyless_certificates = resources.KeylessCertificatesWithStreamingResponse(client.keyless_certificates) - self.logpush = resources.LogpushWithStreamingResponse(client.logpush) - self.logs = resources.LogsWithStreamingResponse(client.logs) - self.origin_tls_client_auth = resources.OriginTLSClientAuthWithStreamingResponse(client.origin_tls_client_auth) - self.pagerules = resources.PagerulesWithStreamingResponse(client.pagerules) - self.rate_limits = resources.RateLimitsWithStreamingResponse(client.rate_limits) - self.secondary_dns = resources.SecondaryDNSWithStreamingResponse(client.secondary_dns) - self.waiting_rooms = resources.WaitingRoomsWithStreamingResponse(client.waiting_rooms) - self.web3 = resources.Web3WithStreamingResponse(client.web3) - self.workers = resources.WorkersWithStreamingResponse(client.workers) - self.kv = resources.KVWithStreamingResponse(client.kv) - self.durable_objects = resources.DurableObjectsWithStreamingResponse(client.durable_objects) - self.queues = resources.QueuesWithStreamingResponse(client.queues) - self.managed_headers = resources.ManagedHeadersWithStreamingResponse(client.managed_headers) - self.page_shield = resources.PageShieldWithStreamingResponse(client.page_shield) - self.rulesets = resources.RulesetsWithStreamingResponse(client.rulesets) - self.url_normalization = resources.URLNormalizationWithStreamingResponse(client.url_normalization) - self.spectrum = resources.SpectrumWithStreamingResponse(client.spectrum) - self.addressing = resources.AddressingWithStreamingResponse(client.addressing) - self.audit_logs = resources.AuditLogsWithStreamingResponse(client.audit_logs) - self.billing = resources.BillingWithStreamingResponse(client.billing) - self.brand_protection = resources.BrandProtectionWithStreamingResponse(client.brand_protection) - self.diagnostics = resources.DiagnosticsWithStreamingResponse(client.diagnostics) - self.images = resources.ImagesWithStreamingResponse(client.images) - self.intel = resources.IntelWithStreamingResponse(client.intel) - self.magic_transit = resources.MagicTransitWithStreamingResponse(client.magic_transit) - self.magic_network_monitoring = resources.MagicNetworkMonitoringWithStreamingResponse( + self.email_routing = resources.EmailRoutingResourceWithStreamingResponse(client.email_routing) + self.filters = resources.FiltersResourceWithStreamingResponse(client.filters) + self.firewall = resources.FirewallResourceWithStreamingResponse(client.firewall) + self.healthchecks = resources.HealthchecksResourceWithStreamingResponse(client.healthchecks) + self.keyless_certificates = resources.KeylessCertificatesResourceWithStreamingResponse( + client.keyless_certificates + ) + self.logpush = resources.LogpushResourceWithStreamingResponse(client.logpush) + self.logs = resources.LogsResourceWithStreamingResponse(client.logs) + self.origin_tls_client_auth = resources.OriginTLSClientAuthResourceWithStreamingResponse( + client.origin_tls_client_auth + ) + self.pagerules = resources.PagerulesResourceWithStreamingResponse(client.pagerules) + self.rate_limits = resources.RateLimitsResourceWithStreamingResponse(client.rate_limits) + self.secondary_dns = resources.SecondaryDNSResourceWithStreamingResponse(client.secondary_dns) + self.waiting_rooms = resources.WaitingRoomsResourceWithStreamingResponse(client.waiting_rooms) + self.web3 = resources.Web3ResourceWithStreamingResponse(client.web3) + self.workers = resources.WorkersResourceWithStreamingResponse(client.workers) + self.kv = resources.KVResourceWithStreamingResponse(client.kv) + self.durable_objects = resources.DurableObjectsResourceWithStreamingResponse(client.durable_objects) + self.queues = resources.QueuesResourceWithStreamingResponse(client.queues) + self.managed_headers = resources.ManagedHeadersResourceWithStreamingResponse(client.managed_headers) + self.page_shield = resources.PageShieldResourceWithStreamingResponse(client.page_shield) + self.rulesets = resources.RulesetsResourceWithStreamingResponse(client.rulesets) + self.url_normalization = resources.URLNormalizationResourceWithStreamingResponse(client.url_normalization) + self.spectrum = resources.SpectrumResourceWithStreamingResponse(client.spectrum) + self.addressing = resources.AddressingResourceWithStreamingResponse(client.addressing) + self.audit_logs = resources.AuditLogsResourceWithStreamingResponse(client.audit_logs) + self.billing = resources.BillingResourceWithStreamingResponse(client.billing) + self.brand_protection = resources.BrandProtectionResourceWithStreamingResponse(client.brand_protection) + self.diagnostics = resources.DiagnosticsResourceWithStreamingResponse(client.diagnostics) + self.images = resources.ImagesResourceWithStreamingResponse(client.images) + self.intel = resources.IntelResourceWithStreamingResponse(client.intel) + self.magic_transit = resources.MagicTransitResourceWithStreamingResponse(client.magic_transit) + self.magic_network_monitoring = resources.MagicNetworkMonitoringResourceWithStreamingResponse( client.magic_network_monitoring ) - self.mtls_certificates = resources.MTLSCertificatesWithStreamingResponse(client.mtls_certificates) - self.pages = resources.PagesWithStreamingResponse(client.pages) - self.pcaps = resources.PCAPsWithStreamingResponse(client.pcaps) - self.registrar = resources.RegistrarWithStreamingResponse(client.registrar) - self.request_tracers = resources.RequestTracersWithStreamingResponse(client.request_tracers) - self.rules = resources.RulesWithStreamingResponse(client.rules) - self.storage = resources.StorageWithStreamingResponse(client.storage) - self.stream = resources.StreamWithStreamingResponse(client.stream) - self.alerting = resources.AlertingWithStreamingResponse(client.alerting) - self.d1 = resources.D1WithStreamingResponse(client.d1) - self.r2 = resources.R2WithStreamingResponse(client.r2) - self.warp_connector = resources.WARPConnectorWithStreamingResponse(client.warp_connector) - self.workers_for_platforms = resources.WorkersForPlatformsWithStreamingResponse(client.workers_for_platforms) - self.zero_trust = resources.ZeroTrustWithStreamingResponse(client.zero_trust) - self.challenges = resources.ChallengesWithStreamingResponse(client.challenges) + self.mtls_certificates = resources.MTLSCertificatesResourceWithStreamingResponse(client.mtls_certificates) + self.pages = resources.PagesResourceWithStreamingResponse(client.pages) + self.pcaps = resources.PCAPsResourceWithStreamingResponse(client.pcaps) + self.registrar = resources.RegistrarResourceWithStreamingResponse(client.registrar) + self.request_tracers = resources.RequestTracersResourceWithStreamingResponse(client.request_tracers) + self.rules = resources.RulesResourceWithStreamingResponse(client.rules) + self.storage = resources.StorageResourceWithStreamingResponse(client.storage) + self.stream = resources.StreamResourceWithStreamingResponse(client.stream) + self.alerting = resources.AlertingResourceWithStreamingResponse(client.alerting) + self.d1 = resources.D1ResourceWithStreamingResponse(client.d1) + self.r2 = resources.R2ResourceWithStreamingResponse(client.r2) + self.warp_connector = resources.WARPConnectorResourceWithStreamingResponse(client.warp_connector) + self.workers_for_platforms = resources.WorkersForPlatformsResourceWithStreamingResponse( + client.workers_for_platforms + ) + self.zero_trust = resources.ZeroTrustResourceWithStreamingResponse(client.zero_trust) + self.challenges = resources.ChallengesResourceWithStreamingResponse(client.challenges) self.hyperdrive = resources.HyperdriveResourceWithStreamingResponse(client.hyperdrive) - self.rum = resources.RUMWithStreamingResponse(client.rum) - self.vectorize = resources.VectorizeWithStreamingResponse(client.vectorize) - self.url_scanner = resources.URLScannerWithStreamingResponse(client.url_scanner) - self.radar = resources.RadarWithStreamingResponse(client.radar) - self.bot_management = resources.BotManagementWithStreamingResponse(client.bot_management) - self.origin_post_quantum_encryption = resources.OriginPostQuantumEncryptionWithStreamingResponse( + self.rum = resources.RUMResourceWithStreamingResponse(client.rum) + self.vectorize = resources.VectorizeResourceWithStreamingResponse(client.vectorize) + self.url_scanner = resources.URLScannerResourceWithStreamingResponse(client.url_scanner) + self.radar = resources.RadarResourceWithStreamingResponse(client.radar) + self.bot_management = resources.BotManagementResourceWithStreamingResponse(client.bot_management) + self.origin_post_quantum_encryption = resources.OriginPostQuantumEncryptionResourceWithStreamingResponse( client.origin_post_quantum_encryption ) - self.speed = resources.SpeedWithStreamingResponse(client.speed) - self.dcv_delegation = resources.DCVDelegationWithStreamingResponse(client.dcv_delegation) - self.hostnames = resources.HostnamesWithStreamingResponse(client.hostnames) - self.snippets = resources.SnippetsWithStreamingResponse(client.snippets) - self.calls = resources.CallsWithStreamingResponse(client.calls) - self.cloudforce_one = resources.CloudforceOneWithStreamingResponse(client.cloudforce_one) + self.speed = resources.SpeedResourceWithStreamingResponse(client.speed) + self.dcv_delegation = resources.DCVDelegationResourceWithStreamingResponse(client.dcv_delegation) + self.hostnames = resources.HostnamesResourceWithStreamingResponse(client.hostnames) + self.snippets = resources.SnippetsResourceWithStreamingResponse(client.snippets) + self.calls = resources.CallsResourceWithStreamingResponse(client.calls) + self.cloudforce_one = resources.CloudforceOneResourceWithStreamingResponse(client.cloudforce_one) + self.event_notifications = resources.EventNotificationsResourceWithStreamingResponse(client.event_notifications) class AsyncCloudflareWithStreamedResponse: def __init__(self, client: AsyncCloudflare) -> None: - self.accounts = resources.AsyncAccountsWithStreamingResponse(client.accounts) - self.origin_ca_certificates = resources.AsyncOriginCACertificatesWithStreamingResponse( + self.accounts = resources.AsyncAccountsResourceWithStreamingResponse(client.accounts) + self.origin_ca_certificates = resources.AsyncOriginCACertificatesResourceWithStreamingResponse( client.origin_ca_certificates ) - self.ips = resources.AsyncIPsWithStreamingResponse(client.ips) - self.memberships = resources.AsyncMembershipsWithStreamingResponse(client.memberships) + self.ips = resources.AsyncIPsResourceWithStreamingResponse(client.ips) + self.memberships = resources.AsyncMembershipsResourceWithStreamingResponse(client.memberships) self.user = resources.AsyncUserResourceWithStreamingResponse(client.user) - self.zones = resources.AsyncZonesWithStreamingResponse(client.zones) - self.load_balancers = resources.AsyncLoadBalancersWithStreamingResponse(client.load_balancers) - self.cache = resources.AsyncCacheWithStreamingResponse(client.cache) - self.ssl = resources.AsyncSSLWithStreamingResponse(client.ssl) - self.subscriptions = resources.AsyncSubscriptionsWithStreamingResponse(client.subscriptions) - self.acm = resources.AsyncACMWithStreamingResponse(client.acm) - self.argo = resources.AsyncArgoWithStreamingResponse(client.argo) - self.plans = resources.AsyncPlansWithStreamingResponse(client.plans) - self.rate_plans = resources.AsyncRatePlansWithStreamingResponse(client.rate_plans) - self.certificate_authorities = resources.AsyncCertificateAuthoritiesWithStreamingResponse( + self.zones = resources.AsyncZonesResourceWithStreamingResponse(client.zones) + self.load_balancers = resources.AsyncLoadBalancersResourceWithStreamingResponse(client.load_balancers) + self.cache = resources.AsyncCacheResourceWithStreamingResponse(client.cache) + self.ssl = resources.AsyncSSLResourceWithStreamingResponse(client.ssl) + self.subscriptions = resources.AsyncSubscriptionsResourceWithStreamingResponse(client.subscriptions) + self.acm = resources.AsyncACMResourceWithStreamingResponse(client.acm) + self.argo = resources.AsyncArgoResourceWithStreamingResponse(client.argo) + self.plans = resources.AsyncPlansResourceWithStreamingResponse(client.plans) + self.rate_plans = resources.AsyncRatePlansResourceWithStreamingResponse(client.rate_plans) + self.certificate_authorities = resources.AsyncCertificateAuthoritiesResourceWithStreamingResponse( client.certificate_authorities ) - self.client_certificates = resources.AsyncClientCertificatesWithStreamingResponse(client.client_certificates) - self.custom_certificates = resources.AsyncCustomCertificatesWithStreamingResponse(client.custom_certificates) - self.custom_hostnames = resources.AsyncCustomHostnamesWithStreamingResponse(client.custom_hostnames) - self.custom_nameservers = resources.AsyncCustomNameserversWithStreamingResponse(client.custom_nameservers) - self.dns = resources.AsyncDNSWithStreamingResponse(client.dns) + self.client_certificates = resources.AsyncClientCertificatesResourceWithStreamingResponse( + client.client_certificates + ) + self.custom_certificates = resources.AsyncCustomCertificatesResourceWithStreamingResponse( + client.custom_certificates + ) + self.custom_hostnames = resources.AsyncCustomHostnamesResourceWithStreamingResponse(client.custom_hostnames) + self.custom_nameservers = resources.AsyncCustomNameserversResourceWithStreamingResponse( + client.custom_nameservers + ) + self.dns = resources.AsyncDNSResourceWithStreamingResponse(client.dns) self.dnssec = resources.AsyncDNSSECResourceWithStreamingResponse(client.dnssec) - self.email_routing = resources.AsyncEmailRoutingWithStreamingResponse(client.email_routing) - self.filters = resources.AsyncFiltersWithStreamingResponse(client.filters) - self.firewall = resources.AsyncFirewallWithStreamingResponse(client.firewall) - self.healthchecks = resources.AsyncHealthchecksWithStreamingResponse(client.healthchecks) - self.keyless_certificates = resources.AsyncKeylessCertificatesWithStreamingResponse(client.keyless_certificates) - self.logpush = resources.AsyncLogpushWithStreamingResponse(client.logpush) - self.logs = resources.AsyncLogsWithStreamingResponse(client.logs) - self.origin_tls_client_auth = resources.AsyncOriginTLSClientAuthWithStreamingResponse( + self.email_routing = resources.AsyncEmailRoutingResourceWithStreamingResponse(client.email_routing) + self.filters = resources.AsyncFiltersResourceWithStreamingResponse(client.filters) + self.firewall = resources.AsyncFirewallResourceWithStreamingResponse(client.firewall) + self.healthchecks = resources.AsyncHealthchecksResourceWithStreamingResponse(client.healthchecks) + self.keyless_certificates = resources.AsyncKeylessCertificatesResourceWithStreamingResponse( + client.keyless_certificates + ) + self.logpush = resources.AsyncLogpushResourceWithStreamingResponse(client.logpush) + self.logs = resources.AsyncLogsResourceWithStreamingResponse(client.logs) + self.origin_tls_client_auth = resources.AsyncOriginTLSClientAuthResourceWithStreamingResponse( client.origin_tls_client_auth ) - self.pagerules = resources.AsyncPagerulesWithStreamingResponse(client.pagerules) - self.rate_limits = resources.AsyncRateLimitsWithStreamingResponse(client.rate_limits) - self.secondary_dns = resources.AsyncSecondaryDNSWithStreamingResponse(client.secondary_dns) - self.waiting_rooms = resources.AsyncWaitingRoomsWithStreamingResponse(client.waiting_rooms) - self.web3 = resources.AsyncWeb3WithStreamingResponse(client.web3) - self.workers = resources.AsyncWorkersWithStreamingResponse(client.workers) - self.kv = resources.AsyncKVWithStreamingResponse(client.kv) - self.durable_objects = resources.AsyncDurableObjectsWithStreamingResponse(client.durable_objects) - self.queues = resources.AsyncQueuesWithStreamingResponse(client.queues) - self.managed_headers = resources.AsyncManagedHeadersWithStreamingResponse(client.managed_headers) - self.page_shield = resources.AsyncPageShieldWithStreamingResponse(client.page_shield) - self.rulesets = resources.AsyncRulesetsWithStreamingResponse(client.rulesets) - self.url_normalization = resources.AsyncURLNormalizationWithStreamingResponse(client.url_normalization) - self.spectrum = resources.AsyncSpectrumWithStreamingResponse(client.spectrum) - self.addressing = resources.AsyncAddressingWithStreamingResponse(client.addressing) - self.audit_logs = resources.AsyncAuditLogsWithStreamingResponse(client.audit_logs) - self.billing = resources.AsyncBillingWithStreamingResponse(client.billing) - self.brand_protection = resources.AsyncBrandProtectionWithStreamingResponse(client.brand_protection) - self.diagnostics = resources.AsyncDiagnosticsWithStreamingResponse(client.diagnostics) - self.images = resources.AsyncImagesWithStreamingResponse(client.images) - self.intel = resources.AsyncIntelWithStreamingResponse(client.intel) - self.magic_transit = resources.AsyncMagicTransitWithStreamingResponse(client.magic_transit) - self.magic_network_monitoring = resources.AsyncMagicNetworkMonitoringWithStreamingResponse( + self.pagerules = resources.AsyncPagerulesResourceWithStreamingResponse(client.pagerules) + self.rate_limits = resources.AsyncRateLimitsResourceWithStreamingResponse(client.rate_limits) + self.secondary_dns = resources.AsyncSecondaryDNSResourceWithStreamingResponse(client.secondary_dns) + self.waiting_rooms = resources.AsyncWaitingRoomsResourceWithStreamingResponse(client.waiting_rooms) + self.web3 = resources.AsyncWeb3ResourceWithStreamingResponse(client.web3) + self.workers = resources.AsyncWorkersResourceWithStreamingResponse(client.workers) + self.kv = resources.AsyncKVResourceWithStreamingResponse(client.kv) + self.durable_objects = resources.AsyncDurableObjectsResourceWithStreamingResponse(client.durable_objects) + self.queues = resources.AsyncQueuesResourceWithStreamingResponse(client.queues) + self.managed_headers = resources.AsyncManagedHeadersResourceWithStreamingResponse(client.managed_headers) + self.page_shield = resources.AsyncPageShieldResourceWithStreamingResponse(client.page_shield) + self.rulesets = resources.AsyncRulesetsResourceWithStreamingResponse(client.rulesets) + self.url_normalization = resources.AsyncURLNormalizationResourceWithStreamingResponse(client.url_normalization) + self.spectrum = resources.AsyncSpectrumResourceWithStreamingResponse(client.spectrum) + self.addressing = resources.AsyncAddressingResourceWithStreamingResponse(client.addressing) + self.audit_logs = resources.AsyncAuditLogsResourceWithStreamingResponse(client.audit_logs) + self.billing = resources.AsyncBillingResourceWithStreamingResponse(client.billing) + self.brand_protection = resources.AsyncBrandProtectionResourceWithStreamingResponse(client.brand_protection) + self.diagnostics = resources.AsyncDiagnosticsResourceWithStreamingResponse(client.diagnostics) + self.images = resources.AsyncImagesResourceWithStreamingResponse(client.images) + self.intel = resources.AsyncIntelResourceWithStreamingResponse(client.intel) + self.magic_transit = resources.AsyncMagicTransitResourceWithStreamingResponse(client.magic_transit) + self.magic_network_monitoring = resources.AsyncMagicNetworkMonitoringResourceWithStreamingResponse( client.magic_network_monitoring ) - self.mtls_certificates = resources.AsyncMTLSCertificatesWithStreamingResponse(client.mtls_certificates) - self.pages = resources.AsyncPagesWithStreamingResponse(client.pages) - self.pcaps = resources.AsyncPCAPsWithStreamingResponse(client.pcaps) - self.registrar = resources.AsyncRegistrarWithStreamingResponse(client.registrar) - self.request_tracers = resources.AsyncRequestTracersWithStreamingResponse(client.request_tracers) - self.rules = resources.AsyncRulesWithStreamingResponse(client.rules) - self.storage = resources.AsyncStorageWithStreamingResponse(client.storage) - self.stream = resources.AsyncStreamWithStreamingResponse(client.stream) - self.alerting = resources.AsyncAlertingWithStreamingResponse(client.alerting) - self.d1 = resources.AsyncD1WithStreamingResponse(client.d1) - self.r2 = resources.AsyncR2WithStreamingResponse(client.r2) - self.warp_connector = resources.AsyncWARPConnectorWithStreamingResponse(client.warp_connector) - self.workers_for_platforms = resources.AsyncWorkersForPlatformsWithStreamingResponse( + self.mtls_certificates = resources.AsyncMTLSCertificatesResourceWithStreamingResponse(client.mtls_certificates) + self.pages = resources.AsyncPagesResourceWithStreamingResponse(client.pages) + self.pcaps = resources.AsyncPCAPsResourceWithStreamingResponse(client.pcaps) + self.registrar = resources.AsyncRegistrarResourceWithStreamingResponse(client.registrar) + self.request_tracers = resources.AsyncRequestTracersResourceWithStreamingResponse(client.request_tracers) + self.rules = resources.AsyncRulesResourceWithStreamingResponse(client.rules) + self.storage = resources.AsyncStorageResourceWithStreamingResponse(client.storage) + self.stream = resources.AsyncStreamResourceWithStreamingResponse(client.stream) + self.alerting = resources.AsyncAlertingResourceWithStreamingResponse(client.alerting) + self.d1 = resources.AsyncD1ResourceWithStreamingResponse(client.d1) + self.r2 = resources.AsyncR2ResourceWithStreamingResponse(client.r2) + self.warp_connector = resources.AsyncWARPConnectorResourceWithStreamingResponse(client.warp_connector) + self.workers_for_platforms = resources.AsyncWorkersForPlatformsResourceWithStreamingResponse( client.workers_for_platforms ) - self.zero_trust = resources.AsyncZeroTrustWithStreamingResponse(client.zero_trust) - self.challenges = resources.AsyncChallengesWithStreamingResponse(client.challenges) + self.zero_trust = resources.AsyncZeroTrustResourceWithStreamingResponse(client.zero_trust) + self.challenges = resources.AsyncChallengesResourceWithStreamingResponse(client.challenges) self.hyperdrive = resources.AsyncHyperdriveResourceWithStreamingResponse(client.hyperdrive) - self.rum = resources.AsyncRUMWithStreamingResponse(client.rum) - self.vectorize = resources.AsyncVectorizeWithStreamingResponse(client.vectorize) - self.url_scanner = resources.AsyncURLScannerWithStreamingResponse(client.url_scanner) - self.radar = resources.AsyncRadarWithStreamingResponse(client.radar) - self.bot_management = resources.AsyncBotManagementWithStreamingResponse(client.bot_management) - self.origin_post_quantum_encryption = resources.AsyncOriginPostQuantumEncryptionWithStreamingResponse( + self.rum = resources.AsyncRUMResourceWithStreamingResponse(client.rum) + self.vectorize = resources.AsyncVectorizeResourceWithStreamingResponse(client.vectorize) + self.url_scanner = resources.AsyncURLScannerResourceWithStreamingResponse(client.url_scanner) + self.radar = resources.AsyncRadarResourceWithStreamingResponse(client.radar) + self.bot_management = resources.AsyncBotManagementResourceWithStreamingResponse(client.bot_management) + self.origin_post_quantum_encryption = resources.AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse( client.origin_post_quantum_encryption ) - self.speed = resources.AsyncSpeedWithStreamingResponse(client.speed) - self.dcv_delegation = resources.AsyncDCVDelegationWithStreamingResponse(client.dcv_delegation) - self.hostnames = resources.AsyncHostnamesWithStreamingResponse(client.hostnames) - self.snippets = resources.AsyncSnippetsWithStreamingResponse(client.snippets) - self.calls = resources.AsyncCallsWithStreamingResponse(client.calls) - self.cloudforce_one = resources.AsyncCloudforceOneWithStreamingResponse(client.cloudforce_one) + self.speed = resources.AsyncSpeedResourceWithStreamingResponse(client.speed) + self.dcv_delegation = resources.AsyncDCVDelegationResourceWithStreamingResponse(client.dcv_delegation) + self.hostnames = resources.AsyncHostnamesResourceWithStreamingResponse(client.hostnames) + self.snippets = resources.AsyncSnippetsResourceWithStreamingResponse(client.snippets) + self.calls = resources.AsyncCallsResourceWithStreamingResponse(client.calls) + self.cloudforce_one = resources.AsyncCloudforceOneResourceWithStreamingResponse(client.cloudforce_one) + self.event_notifications = resources.AsyncEventNotificationsResourceWithStreamingResponse( + client.event_notifications + ) Client = Cloudflare diff --git a/src/cloudflare/_exceptions.py b/src/cloudflare/_exceptions.py index 5c2b9e5a263..e96c32acd1d 100644 --- a/src/cloudflare/_exceptions.py +++ b/src/cloudflare/_exceptions.py @@ -9,7 +9,7 @@ from ._utils import is_dict from ._models import construct_type -from .types.shared import ErrorData +from .types.shared.error_data import ErrorData __all__ = [ "BadRequestError", diff --git a/src/cloudflare/_models.py b/src/cloudflare/_models.py index 77c755b1358..ff3f54e2cdc 100644 --- a/src/cloudflare/_models.py +++ b/src/cloudflare/_models.py @@ -1,9 +1,9 @@ from __future__ import annotations +import os import inspect from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast from datetime import date, datetime -from functools import lru_cache from typing_extensions import ( Unpack, Literal, @@ -36,8 +36,10 @@ PropertyInfo, is_list, is_given, + lru_cache, is_mapping, parse_date, + coerce_boolean, parse_datetime, strip_not_given, extract_type_arg, @@ -74,7 +76,9 @@ class _ConfigProtocol(Protocol): class BaseModel(pydantic.BaseModel): if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") + model_config: ClassVar[ConfigDict] = ConfigDict( + extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) + ) else: @property @@ -86,6 +90,79 @@ def model_fields_set(self) -> set[str]: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] extra: Any = pydantic.Extra.allow # type: ignore + def to_dict( + self, + *, + mode: Literal["json", "python"] = "python", + use_api_names: bool = True, + exclude_unset: bool = True, + exclude_defaults: bool = False, + exclude_none: bool = False, + warnings: bool = True, + ) -> dict[str, object]: + """Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + + By default, fields that were not set by the API will not be included, + and keys will match the API response, *not* the property names from the model. + + For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, + the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). + + Args: + mode: + If mode is 'json', the dictionary will only contain JSON serializable types. e.g. `datetime` will be turned into a string, `"2024-3-22T18:11:19.117000Z"`. + If mode is 'python', the dictionary may contain any Python objects. e.g. `datetime(2024, 3, 22)` + + use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value from the output. + exclude_none: Whether to exclude fields that have a value of `None` from the output. + warnings: Whether to log warnings when invalid fields are encountered. This is only supported in Pydantic v2. + """ + return self.model_dump( + mode=mode, + by_alias=use_api_names, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + warnings=warnings, + ) + + def to_json( + self, + *, + indent: int | None = 2, + use_api_names: bool = True, + exclude_unset: bool = True, + exclude_defaults: bool = False, + exclude_none: bool = False, + warnings: bool = True, + ) -> str: + """Generates a JSON string representing this model as it would be received from or sent to the API (but with indentation). + + By default, fields that were not set by the API will not be included, + and keys will match the API response, *not* the property names from the model. + + For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, + the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). + + Args: + indent: Indentation to use in the JSON output. If `None` is passed, the output will be compact. Defaults to `2` + use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that have the default value. + exclude_none: Whether to exclude fields that have a value of `None`. + warnings: Whether to show any warnings that occurred during serialization. This is only supported in Pydantic v2. + """ + return self.model_dump_json( + indent=indent, + by_alias=use_api_names, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + warnings=warnings, + ) + @override def __str__(self) -> str: # mypy complains about an invalid self arg @@ -301,7 +378,7 @@ def construct_type(*, value: object, type_: object) -> object: # unwrap `Annotated[T, ...]` -> `T` if is_annotated_type(type_): - meta = get_args(type_)[1:] + meta: tuple[Any, ...] = get_args(type_)[1:] type_ = extract_type_arg(type_, 0) else: meta = tuple() diff --git a/src/cloudflare/_streaming.py b/src/cloudflare/_streaming.py index fe697d1216b..0be44fec67a 100644 --- a/src/cloudflare/_streaming.py +++ b/src/cloudflare/_streaming.py @@ -23,7 +23,7 @@ class Stream(Generic[_T]): response: httpx.Response - _decoder: SSEDecoder | SSEBytesDecoder + _decoder: SSEBytesDecoder def __init__( self, @@ -46,10 +46,7 @@ def __iter__(self) -> Iterator[_T]: yield item def _iter_events(self) -> Iterator[ServerSentEvent]: - if isinstance(self._decoder, SSEBytesDecoder): - yield from self._decoder.iter_bytes(self.response.iter_bytes()) - else: - yield from self._decoder.iter(self.response.iter_lines()) + yield from self._decoder.iter_bytes(self.response.iter_bytes()) def __stream__(self) -> Iterator[_T]: cast_to = cast(Any, self._cast_to) @@ -112,12 +109,8 @@ async def __aiter__(self) -> AsyncIterator[_T]: yield item async def _iter_events(self) -> AsyncIterator[ServerSentEvent]: - if isinstance(self._decoder, SSEBytesDecoder): - async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()): - yield sse - else: - async for sse in self._decoder.aiter(self.response.aiter_lines()): - yield sse + async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()): + yield sse async def __stream__(self) -> AsyncIterator[_T]: cast_to = cast(Any, self._cast_to) @@ -205,21 +198,49 @@ def __init__(self) -> None: self._last_event_id = None self._retry = None - def iter(self, iterator: Iterator[str]) -> Iterator[ServerSentEvent]: - """Given an iterator that yields lines, iterate over it & yield every event encountered""" - for line in iterator: - line = line.rstrip("\n") - sse = self.decode(line) - if sse is not None: - yield sse - - async def aiter(self, iterator: AsyncIterator[str]) -> AsyncIterator[ServerSentEvent]: - """Given an async iterator that yields lines, iterate over it & yield every event encountered""" - async for line in iterator: - line = line.rstrip("\n") - sse = self.decode(line) - if sse is not None: - yield sse + def iter_bytes(self, iterator: Iterator[bytes]) -> Iterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + for chunk in self._iter_chunks(iterator): + # Split before decoding so splitlines() only uses \r and \n + for raw_line in chunk.splitlines(): + line = raw_line.decode("utf-8") + sse = self.decode(line) + if sse: + yield sse + + def _iter_chunks(self, iterator: Iterator[bytes]) -> Iterator[bytes]: + """Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks""" + data = b"" + for chunk in iterator: + for line in chunk.splitlines(keepends=True): + data += line + if data.endswith((b"\r\r", b"\n\n", b"\r\n\r\n")): + yield data + data = b"" + if data: + yield data + + async def aiter_bytes(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + async for chunk in self._aiter_chunks(iterator): + # Split before decoding so splitlines() only uses \r and \n + for raw_line in chunk.splitlines(): + line = raw_line.decode("utf-8") + sse = self.decode(line) + if sse: + yield sse + + async def _aiter_chunks(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[bytes]: + """Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks""" + data = b"" + async for chunk in iterator: + for line in chunk.splitlines(keepends=True): + data += line + if data.endswith((b"\r\r", b"\n\n", b"\r\n\r\n")): + yield data + data = b"" + if data: + yield data def decode(self, line: str) -> ServerSentEvent | None: # See: https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation # noqa: E501 diff --git a/src/cloudflare/_utils/__init__.py b/src/cloudflare/_utils/__init__.py index 5697894192b..31b5b22799e 100644 --- a/src/cloudflare/_utils/__init__.py +++ b/src/cloudflare/_utils/__init__.py @@ -6,6 +6,7 @@ is_list as is_list, is_given as is_given, is_tuple as is_tuple, + lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, parse_date as parse_date, diff --git a/src/cloudflare/_utils/_proxy.py b/src/cloudflare/_utils/_proxy.py index b9c12dc3f49..c46a62a6982 100644 --- a/src/cloudflare/_utils/_proxy.py +++ b/src/cloudflare/_utils/_proxy.py @@ -10,7 +10,7 @@ class LazyProxy(Generic[T], ABC): """Implements data methods to pretend that an instance is another instance. - This includes forwarding attribute access and othe methods. + This includes forwarding attribute access and other methods. """ # Note: we have to special case proxies that themselves return proxies diff --git a/src/cloudflare/_utils/_utils.py b/src/cloudflare/_utils/_utils.py index 93c95517a94..17904ce60d3 100644 --- a/src/cloudflare/_utils/_utils.py +++ b/src/cloudflare/_utils/_utils.py @@ -265,6 +265,8 @@ def wrapper(*args: object, **kwargs: object) -> object: ) msg = f"Missing required arguments; Expected either {variations} arguments to be given" else: + assert len(variants) > 0 + # TODO: this error message is not deterministic missing = list(set(variants[0]) - given_params) if len(missing) > 1: @@ -389,3 +391,13 @@ def get_async_library() -> str: return sniffio.current_async_library() except Exception: return "false" + + +def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]: + """A version of functools.lru_cache that retains the type signature + for the wrapped function arguments. + """ + wrapper = functools.lru_cache( # noqa: TID251 + maxsize=maxsize, + ) + return cast(Any, wrapper) # type: ignore[no-any-return] diff --git a/src/cloudflare/_version.py b/src/cloudflare/_version.py index 86a48234c39..897784b082e 100644 --- a/src/cloudflare/_version.py +++ b/src/cloudflare/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "cloudflare" -__version__ = "3.0.0-beta.7" # x-release-please-version +__version__ = "3.0.0-beta.8" # x-release-please-version diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 84e182ac364..e4d0f926f5d 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -1,84 +1,84 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .d1 import ( - D1, - AsyncD1, - D1WithRawResponse, - AsyncD1WithRawResponse, - D1WithStreamingResponse, - AsyncD1WithStreamingResponse, + D1Resource, + AsyncD1Resource, + D1ResourceWithRawResponse, + AsyncD1ResourceWithRawResponse, + D1ResourceWithStreamingResponse, + AsyncD1ResourceWithStreamingResponse, ) from .kv import ( - KV, - AsyncKV, - KVWithRawResponse, - AsyncKVWithRawResponse, - KVWithStreamingResponse, - AsyncKVWithStreamingResponse, + KVResource, + AsyncKVResource, + KVResourceWithRawResponse, + AsyncKVResourceWithRawResponse, + KVResourceWithStreamingResponse, + AsyncKVResourceWithStreamingResponse, ) from .r2 import ( - R2, - AsyncR2, - R2WithRawResponse, - AsyncR2WithRawResponse, - R2WithStreamingResponse, - AsyncR2WithStreamingResponse, + R2Resource, + AsyncR2Resource, + R2ResourceWithRawResponse, + AsyncR2ResourceWithRawResponse, + R2ResourceWithStreamingResponse, + AsyncR2ResourceWithStreamingResponse, ) from .acm import ( - ACM, - AsyncACM, - ACMWithRawResponse, - AsyncACMWithRawResponse, - ACMWithStreamingResponse, - AsyncACMWithStreamingResponse, + ACMResource, + AsyncACMResource, + ACMResourceWithRawResponse, + AsyncACMResourceWithRawResponse, + ACMResourceWithStreamingResponse, + AsyncACMResourceWithStreamingResponse, ) from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .ips import ( - IPs, - AsyncIPs, - IPsWithRawResponse, - AsyncIPsWithRawResponse, - IPsWithStreamingResponse, - AsyncIPsWithStreamingResponse, + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, ) from .rum import ( - RUM, - AsyncRUM, - RUMWithRawResponse, - AsyncRUMWithRawResponse, - RUMWithStreamingResponse, - AsyncRUMWithStreamingResponse, + RUMResource, + AsyncRUMResource, + RUMResourceWithRawResponse, + AsyncRUMResourceWithRawResponse, + RUMResourceWithStreamingResponse, + AsyncRUMResourceWithStreamingResponse, ) from .ssl import ( - SSL, - AsyncSSL, - SSLWithRawResponse, - AsyncSSLWithRawResponse, - SSLWithStreamingResponse, - AsyncSSLWithStreamingResponse, + SSLResource, + AsyncSSLResource, + SSLResourceWithRawResponse, + AsyncSSLResourceWithRawResponse, + SSLResourceWithStreamingResponse, + AsyncSSLResourceWithStreamingResponse, ) from .argo import ( - Argo, - AsyncArgo, - ArgoWithRawResponse, - AsyncArgoWithRawResponse, - ArgoWithStreamingResponse, - AsyncArgoWithStreamingResponse, + ArgoResource, + AsyncArgoResource, + ArgoResourceWithRawResponse, + AsyncArgoResourceWithRawResponse, + ArgoResourceWithStreamingResponse, + AsyncArgoResourceWithStreamingResponse, ) from .logs import ( - Logs, - AsyncLogs, - LogsWithRawResponse, - AsyncLogsWithRawResponse, - LogsWithStreamingResponse, - AsyncLogsWithStreamingResponse, + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, ) from .user import ( UserResource, @@ -89,92 +89,92 @@ AsyncUserResourceWithStreamingResponse, ) from .web3 import ( - Web3, - AsyncWeb3, - Web3WithRawResponse, - AsyncWeb3WithRawResponse, - Web3WithStreamingResponse, - AsyncWeb3WithStreamingResponse, + Web3Resource, + AsyncWeb3Resource, + Web3ResourceWithRawResponse, + AsyncWeb3ResourceWithRawResponse, + Web3ResourceWithStreamingResponse, + AsyncWeb3ResourceWithStreamingResponse, ) from .cache import ( - Cache, - AsyncCache, - CacheWithRawResponse, - AsyncCacheWithRawResponse, - CacheWithStreamingResponse, - AsyncCacheWithStreamingResponse, + CacheResource, + AsyncCacheResource, + CacheResourceWithRawResponse, + AsyncCacheResourceWithRawResponse, + CacheResourceWithStreamingResponse, + AsyncCacheResourceWithStreamingResponse, ) from .calls import ( - Calls, - AsyncCalls, - CallsWithRawResponse, - AsyncCallsWithRawResponse, - CallsWithStreamingResponse, - AsyncCallsWithStreamingResponse, + CallsResource, + AsyncCallsResource, + CallsResourceWithRawResponse, + AsyncCallsResourceWithRawResponse, + CallsResourceWithStreamingResponse, + AsyncCallsResourceWithStreamingResponse, ) from .intel import ( - Intel, - AsyncIntel, - IntelWithRawResponse, - AsyncIntelWithRawResponse, - IntelWithStreamingResponse, - AsyncIntelWithStreamingResponse, + IntelResource, + AsyncIntelResource, + IntelResourceWithRawResponse, + AsyncIntelResourceWithRawResponse, + IntelResourceWithStreamingResponse, + AsyncIntelResourceWithStreamingResponse, ) from .pages import ( - Pages, - AsyncPages, - PagesWithRawResponse, - AsyncPagesWithRawResponse, - PagesWithStreamingResponse, - AsyncPagesWithStreamingResponse, + PagesResource, + AsyncPagesResource, + PagesResourceWithRawResponse, + AsyncPagesResourceWithRawResponse, + PagesResourceWithStreamingResponse, + AsyncPagesResourceWithStreamingResponse, ) from .pcaps import ( - PCAPs, - AsyncPCAPs, - PCAPsWithRawResponse, - AsyncPCAPsWithRawResponse, - PCAPsWithStreamingResponse, - AsyncPCAPsWithStreamingResponse, + PCAPsResource, + AsyncPCAPsResource, + PCAPsResourceWithRawResponse, + AsyncPCAPsResourceWithRawResponse, + PCAPsResourceWithStreamingResponse, + AsyncPCAPsResourceWithStreamingResponse, ) from .plans import ( - Plans, - AsyncPlans, - PlansWithRawResponse, - AsyncPlansWithRawResponse, - PlansWithStreamingResponse, - AsyncPlansWithStreamingResponse, + PlansResource, + AsyncPlansResource, + PlansResourceWithRawResponse, + AsyncPlansResourceWithRawResponse, + PlansResourceWithStreamingResponse, + AsyncPlansResourceWithStreamingResponse, ) from .radar import ( - Radar, - AsyncRadar, - RadarWithRawResponse, - AsyncRadarWithRawResponse, - RadarWithStreamingResponse, - AsyncRadarWithStreamingResponse, + RadarResource, + AsyncRadarResource, + RadarResourceWithRawResponse, + AsyncRadarResourceWithRawResponse, + RadarResourceWithStreamingResponse, + AsyncRadarResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .speed import ( - Speed, - AsyncSpeed, - SpeedWithRawResponse, - AsyncSpeedWithRawResponse, - SpeedWithStreamingResponse, - AsyncSpeedWithStreamingResponse, + SpeedResource, + AsyncSpeedResource, + SpeedResourceWithRawResponse, + AsyncSpeedResourceWithRawResponse, + SpeedResourceWithStreamingResponse, + AsyncSpeedResourceWithStreamingResponse, ) from .zones import ( - Zones, - AsyncZones, - ZonesWithRawResponse, - AsyncZonesWithRawResponse, - ZonesWithStreamingResponse, - AsyncZonesWithStreamingResponse, + ZonesResource, + AsyncZonesResource, + ZonesResourceWithRawResponse, + AsyncZonesResourceWithRawResponse, + ZonesResourceWithStreamingResponse, + AsyncZonesResourceWithStreamingResponse, ) from .dnssec import ( DNSSECResource, @@ -185,172 +185,172 @@ AsyncDNSSECResourceWithStreamingResponse, ) from .images import ( - Images, - AsyncImages, - ImagesWithRawResponse, - AsyncImagesWithRawResponse, - ImagesWithStreamingResponse, - AsyncImagesWithStreamingResponse, + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, ) from .queues import ( - Queues, - AsyncQueues, - QueuesWithRawResponse, - AsyncQueuesWithRawResponse, - QueuesWithStreamingResponse, - AsyncQueuesWithStreamingResponse, + QueuesResource, + AsyncQueuesResource, + QueuesResourceWithRawResponse, + AsyncQueuesResourceWithRawResponse, + QueuesResourceWithStreamingResponse, + AsyncQueuesResourceWithStreamingResponse, ) from .stream import ( - Stream, - AsyncStream, - StreamWithRawResponse, - AsyncStreamWithRawResponse, - StreamWithStreamingResponse, - AsyncStreamWithStreamingResponse, + StreamResource, + AsyncStreamResource, + StreamResourceWithRawResponse, + AsyncStreamResourceWithRawResponse, + StreamResourceWithStreamingResponse, + AsyncStreamResourceWithStreamingResponse, ) from .billing import ( - Billing, - AsyncBilling, - BillingWithRawResponse, - AsyncBillingWithRawResponse, - BillingWithStreamingResponse, - AsyncBillingWithStreamingResponse, + BillingResource, + AsyncBillingResource, + BillingResourceWithRawResponse, + AsyncBillingResourceWithRawResponse, + BillingResourceWithStreamingResponse, + AsyncBillingResourceWithStreamingResponse, ) from .filters import ( - Filters, - AsyncFilters, - FiltersWithRawResponse, - AsyncFiltersWithRawResponse, - FiltersWithStreamingResponse, - AsyncFiltersWithStreamingResponse, + FiltersResource, + AsyncFiltersResource, + FiltersResourceWithRawResponse, + AsyncFiltersResourceWithRawResponse, + FiltersResourceWithStreamingResponse, + AsyncFiltersResourceWithStreamingResponse, ) from .logpush import ( - Logpush, - AsyncLogpush, - LogpushWithRawResponse, - AsyncLogpushWithRawResponse, - LogpushWithStreamingResponse, - AsyncLogpushWithStreamingResponse, + LogpushResource, + AsyncLogpushResource, + LogpushResourceWithRawResponse, + AsyncLogpushResourceWithRawResponse, + LogpushResourceWithStreamingResponse, + AsyncLogpushResourceWithStreamingResponse, ) from .storage import ( - Storage, - AsyncStorage, - StorageWithRawResponse, - AsyncStorageWithRawResponse, - StorageWithStreamingResponse, - AsyncStorageWithStreamingResponse, + StorageResource, + AsyncStorageResource, + StorageResourceWithRawResponse, + AsyncStorageResourceWithRawResponse, + StorageResourceWithStreamingResponse, + AsyncStorageResourceWithStreamingResponse, ) from .workers import ( - Workers, - AsyncWorkers, - WorkersWithRawResponse, - AsyncWorkersWithRawResponse, - WorkersWithStreamingResponse, - AsyncWorkersWithStreamingResponse, + WorkersResource, + AsyncWorkersResource, + WorkersResourceWithRawResponse, + AsyncWorkersResourceWithRawResponse, + WorkersResourceWithStreamingResponse, + AsyncWorkersResourceWithStreamingResponse, ) from .accounts import ( - Accounts, - AsyncAccounts, - AccountsWithRawResponse, - AsyncAccountsWithRawResponse, - AccountsWithStreamingResponse, - AsyncAccountsWithStreamingResponse, + AccountsResource, + AsyncAccountsResource, + AccountsResourceWithRawResponse, + AsyncAccountsResourceWithRawResponse, + AccountsResourceWithStreamingResponse, + AsyncAccountsResourceWithStreamingResponse, ) from .alerting import ( - Alerting, - AsyncAlerting, - AlertingWithRawResponse, - AsyncAlertingWithRawResponse, - AlertingWithStreamingResponse, - AsyncAlertingWithStreamingResponse, + AlertingResource, + AsyncAlertingResource, + AlertingResourceWithRawResponse, + AsyncAlertingResourceWithRawResponse, + AlertingResourceWithStreamingResponse, + AsyncAlertingResourceWithStreamingResponse, ) from .firewall import ( - Firewall, - AsyncFirewall, - FirewallWithRawResponse, - AsyncFirewallWithRawResponse, - FirewallWithStreamingResponse, - AsyncFirewallWithStreamingResponse, + FirewallResource, + AsyncFirewallResource, + FirewallResourceWithRawResponse, + AsyncFirewallResourceWithRawResponse, + FirewallResourceWithStreamingResponse, + AsyncFirewallResourceWithStreamingResponse, ) from .rulesets import ( - Rulesets, - AsyncRulesets, - RulesetsWithRawResponse, - AsyncRulesetsWithRawResponse, - RulesetsWithStreamingResponse, - AsyncRulesetsWithStreamingResponse, + RulesetsResource, + AsyncRulesetsResource, + RulesetsResourceWithRawResponse, + AsyncRulesetsResourceWithRawResponse, + RulesetsResourceWithStreamingResponse, + AsyncRulesetsResourceWithStreamingResponse, ) from .snippets import ( - Snippets, - AsyncSnippets, - SnippetsWithRawResponse, - AsyncSnippetsWithRawResponse, - SnippetsWithStreamingResponse, - AsyncSnippetsWithStreamingResponse, + SnippetsResource, + AsyncSnippetsResource, + SnippetsResourceWithRawResponse, + AsyncSnippetsResourceWithRawResponse, + SnippetsResourceWithStreamingResponse, + AsyncSnippetsResourceWithStreamingResponse, ) from .spectrum import ( - Spectrum, - AsyncSpectrum, - SpectrumWithRawResponse, - AsyncSpectrumWithRawResponse, - SpectrumWithStreamingResponse, - AsyncSpectrumWithStreamingResponse, + SpectrumResource, + AsyncSpectrumResource, + SpectrumResourceWithRawResponse, + AsyncSpectrumResourceWithRawResponse, + SpectrumResourceWithStreamingResponse, + AsyncSpectrumResourceWithStreamingResponse, ) from .hostnames import ( - Hostnames, - AsyncHostnames, - HostnamesWithRawResponse, - AsyncHostnamesWithRawResponse, - HostnamesWithStreamingResponse, - AsyncHostnamesWithStreamingResponse, + HostnamesResource, + AsyncHostnamesResource, + HostnamesResourceWithRawResponse, + AsyncHostnamesResourceWithRawResponse, + HostnamesResourceWithStreamingResponse, + AsyncHostnamesResourceWithStreamingResponse, ) from .pagerules import ( - Pagerules, - AsyncPagerules, - PagerulesWithRawResponse, - AsyncPagerulesWithRawResponse, - PagerulesWithStreamingResponse, - AsyncPagerulesWithStreamingResponse, + PagerulesResource, + AsyncPagerulesResource, + PagerulesResourceWithRawResponse, + AsyncPagerulesResourceWithRawResponse, + PagerulesResourceWithStreamingResponse, + AsyncPagerulesResourceWithStreamingResponse, ) from .registrar import ( - Registrar, - AsyncRegistrar, - RegistrarWithRawResponse, - AsyncRegistrarWithRawResponse, - RegistrarWithStreamingResponse, - AsyncRegistrarWithStreamingResponse, + RegistrarResource, + AsyncRegistrarResource, + RegistrarResourceWithRawResponse, + AsyncRegistrarResourceWithRawResponse, + RegistrarResourceWithStreamingResponse, + AsyncRegistrarResourceWithStreamingResponse, ) from .vectorize import ( - Vectorize, - AsyncVectorize, - VectorizeWithRawResponse, - AsyncVectorizeWithRawResponse, - VectorizeWithStreamingResponse, - AsyncVectorizeWithStreamingResponse, + VectorizeResource, + AsyncVectorizeResource, + VectorizeResourceWithRawResponse, + AsyncVectorizeResourceWithRawResponse, + VectorizeResourceWithStreamingResponse, + AsyncVectorizeResourceWithStreamingResponse, ) from .addressing import ( - Addressing, - AsyncAddressing, - AddressingWithRawResponse, - AsyncAddressingWithRawResponse, - AddressingWithStreamingResponse, - AsyncAddressingWithStreamingResponse, + AddressingResource, + AsyncAddressingResource, + AddressingResourceWithRawResponse, + AsyncAddressingResourceWithRawResponse, + AddressingResourceWithStreamingResponse, + AsyncAddressingResourceWithStreamingResponse, ) from .audit_logs import ( - AuditLogs, - AsyncAuditLogs, - AuditLogsWithRawResponse, - AsyncAuditLogsWithRawResponse, - AuditLogsWithStreamingResponse, - AsyncAuditLogsWithStreamingResponse, + AuditLogsResource, + AsyncAuditLogsResource, + AuditLogsResourceWithRawResponse, + AsyncAuditLogsResourceWithRawResponse, + AuditLogsResourceWithStreamingResponse, + AsyncAuditLogsResourceWithStreamingResponse, ) from .challenges import ( - Challenges, - AsyncChallenges, - ChallengesWithRawResponse, - AsyncChallengesWithRawResponse, - ChallengesWithStreamingResponse, - AsyncChallengesWithStreamingResponse, + ChallengesResource, + AsyncChallengesResource, + ChallengesResourceWithRawResponse, + AsyncChallengesResourceWithRawResponse, + ChallengesResourceWithStreamingResponse, + AsyncChallengesResourceWithStreamingResponse, ) from .hyperdrive import ( HyperdriveResource, @@ -361,765 +361,779 @@ AsyncHyperdriveResourceWithStreamingResponse, ) from .rate_plans import ( - RatePlans, - AsyncRatePlans, - RatePlansWithRawResponse, - AsyncRatePlansWithRawResponse, - RatePlansWithStreamingResponse, - AsyncRatePlansWithStreamingResponse, + RatePlansResource, + AsyncRatePlansResource, + RatePlansResourceWithRawResponse, + AsyncRatePlansResourceWithRawResponse, + RatePlansResourceWithStreamingResponse, + AsyncRatePlansResourceWithStreamingResponse, ) from .zero_trust import ( - ZeroTrust, - AsyncZeroTrust, - ZeroTrustWithRawResponse, - AsyncZeroTrustWithRawResponse, - ZeroTrustWithStreamingResponse, - AsyncZeroTrustWithStreamingResponse, + ZeroTrustResource, + AsyncZeroTrustResource, + ZeroTrustResourceWithRawResponse, + AsyncZeroTrustResourceWithRawResponse, + ZeroTrustResourceWithStreamingResponse, + AsyncZeroTrustResourceWithStreamingResponse, ) from .diagnostics import ( - Diagnostics, - AsyncDiagnostics, - DiagnosticsWithRawResponse, - AsyncDiagnosticsWithRawResponse, - DiagnosticsWithStreamingResponse, - AsyncDiagnosticsWithStreamingResponse, + DiagnosticsResource, + AsyncDiagnosticsResource, + DiagnosticsResourceWithRawResponse, + AsyncDiagnosticsResourceWithRawResponse, + DiagnosticsResourceWithStreamingResponse, + AsyncDiagnosticsResourceWithStreamingResponse, ) from .memberships import ( - Memberships, - AsyncMemberships, - MembershipsWithRawResponse, - AsyncMembershipsWithRawResponse, - MembershipsWithStreamingResponse, - AsyncMembershipsWithStreamingResponse, + MembershipsResource, + AsyncMembershipsResource, + MembershipsResourceWithRawResponse, + AsyncMembershipsResourceWithRawResponse, + MembershipsResourceWithStreamingResponse, + AsyncMembershipsResourceWithStreamingResponse, ) from .page_shield import ( - PageShield, - AsyncPageShield, - PageShieldWithRawResponse, - AsyncPageShieldWithRawResponse, - PageShieldWithStreamingResponse, - AsyncPageShieldWithStreamingResponse, + PageShieldResource, + AsyncPageShieldResource, + PageShieldResourceWithRawResponse, + AsyncPageShieldResourceWithRawResponse, + PageShieldResourceWithStreamingResponse, + AsyncPageShieldResourceWithStreamingResponse, ) from .rate_limits import ( - RateLimits, - AsyncRateLimits, - RateLimitsWithRawResponse, - AsyncRateLimitsWithRawResponse, - RateLimitsWithStreamingResponse, - AsyncRateLimitsWithStreamingResponse, + RateLimitsResource, + AsyncRateLimitsResource, + RateLimitsResourceWithRawResponse, + AsyncRateLimitsResourceWithRawResponse, + RateLimitsResourceWithStreamingResponse, + AsyncRateLimitsResourceWithStreamingResponse, ) from .url_scanner import ( - URLScanner, - AsyncURLScanner, - URLScannerWithRawResponse, - AsyncURLScannerWithRawResponse, - URLScannerWithStreamingResponse, - AsyncURLScannerWithStreamingResponse, + URLScannerResource, + AsyncURLScannerResource, + URLScannerResourceWithRawResponse, + AsyncURLScannerResourceWithRawResponse, + URLScannerResourceWithStreamingResponse, + AsyncURLScannerResourceWithStreamingResponse, ) from .healthchecks import ( - Healthchecks, - AsyncHealthchecks, - HealthchecksWithRawResponse, - AsyncHealthchecksWithRawResponse, - HealthchecksWithStreamingResponse, - AsyncHealthchecksWithStreamingResponse, + HealthchecksResource, + AsyncHealthchecksResource, + HealthchecksResourceWithRawResponse, + AsyncHealthchecksResourceWithRawResponse, + HealthchecksResourceWithStreamingResponse, + AsyncHealthchecksResourceWithStreamingResponse, ) from .email_routing import ( - EmailRouting, - AsyncEmailRouting, - EmailRoutingWithRawResponse, - AsyncEmailRoutingWithRawResponse, - EmailRoutingWithStreamingResponse, - AsyncEmailRoutingWithStreamingResponse, + EmailRoutingResource, + AsyncEmailRoutingResource, + EmailRoutingResourceWithRawResponse, + AsyncEmailRoutingResourceWithRawResponse, + EmailRoutingResourceWithStreamingResponse, + AsyncEmailRoutingResourceWithStreamingResponse, ) from .magic_transit import ( - MagicTransit, - AsyncMagicTransit, - MagicTransitWithRawResponse, - AsyncMagicTransitWithRawResponse, - MagicTransitWithStreamingResponse, - AsyncMagicTransitWithStreamingResponse, + MagicTransitResource, + AsyncMagicTransitResource, + MagicTransitResourceWithRawResponse, + AsyncMagicTransitResourceWithRawResponse, + MagicTransitResourceWithStreamingResponse, + AsyncMagicTransitResourceWithStreamingResponse, ) from .secondary_dns import ( - SecondaryDNS, - AsyncSecondaryDNS, - SecondaryDNSWithRawResponse, - AsyncSecondaryDNSWithRawResponse, - SecondaryDNSWithStreamingResponse, - AsyncSecondaryDNSWithStreamingResponse, + SecondaryDNSResource, + AsyncSecondaryDNSResource, + SecondaryDNSResourceWithRawResponse, + AsyncSecondaryDNSResourceWithRawResponse, + SecondaryDNSResourceWithStreamingResponse, + AsyncSecondaryDNSResourceWithStreamingResponse, ) from .subscriptions import ( - Subscriptions, - AsyncSubscriptions, - SubscriptionsWithRawResponse, - AsyncSubscriptionsWithRawResponse, - SubscriptionsWithStreamingResponse, - AsyncSubscriptionsWithStreamingResponse, + SubscriptionsResource, + AsyncSubscriptionsResource, + SubscriptionsResourceWithRawResponse, + AsyncSubscriptionsResourceWithRawResponse, + SubscriptionsResourceWithStreamingResponse, + AsyncSubscriptionsResourceWithStreamingResponse, ) from .waiting_rooms import ( - WaitingRooms, - AsyncWaitingRooms, - WaitingRoomsWithRawResponse, - AsyncWaitingRoomsWithRawResponse, - WaitingRoomsWithStreamingResponse, - AsyncWaitingRoomsWithStreamingResponse, + WaitingRoomsResource, + AsyncWaitingRoomsResource, + WaitingRoomsResourceWithRawResponse, + AsyncWaitingRoomsResourceWithRawResponse, + WaitingRoomsResourceWithStreamingResponse, + AsyncWaitingRoomsResourceWithStreamingResponse, ) from .bot_management import ( - BotManagement, - AsyncBotManagement, - BotManagementWithRawResponse, - AsyncBotManagementWithRawResponse, - BotManagementWithStreamingResponse, - AsyncBotManagementWithStreamingResponse, + BotManagementResource, + AsyncBotManagementResource, + BotManagementResourceWithRawResponse, + AsyncBotManagementResourceWithRawResponse, + BotManagementResourceWithStreamingResponse, + AsyncBotManagementResourceWithStreamingResponse, ) from .cloudforce_one import ( - CloudforceOne, - AsyncCloudforceOne, - CloudforceOneWithRawResponse, - AsyncCloudforceOneWithRawResponse, - CloudforceOneWithStreamingResponse, - AsyncCloudforceOneWithStreamingResponse, + CloudforceOneResource, + AsyncCloudforceOneResource, + CloudforceOneResourceWithRawResponse, + AsyncCloudforceOneResourceWithRawResponse, + CloudforceOneResourceWithStreamingResponse, + AsyncCloudforceOneResourceWithStreamingResponse, ) from .dcv_delegation import ( - DCVDelegation, - AsyncDCVDelegation, - DCVDelegationWithRawResponse, - AsyncDCVDelegationWithRawResponse, - DCVDelegationWithStreamingResponse, - AsyncDCVDelegationWithStreamingResponse, + DCVDelegationResource, + AsyncDCVDelegationResource, + DCVDelegationResourceWithRawResponse, + AsyncDCVDelegationResourceWithRawResponse, + DCVDelegationResourceWithStreamingResponse, + AsyncDCVDelegationResourceWithStreamingResponse, ) from .load_balancers import ( - LoadBalancers, - AsyncLoadBalancers, - LoadBalancersWithRawResponse, - AsyncLoadBalancersWithRawResponse, - LoadBalancersWithStreamingResponse, - AsyncLoadBalancersWithStreamingResponse, + LoadBalancersResource, + AsyncLoadBalancersResource, + LoadBalancersResourceWithRawResponse, + AsyncLoadBalancersResourceWithRawResponse, + LoadBalancersResourceWithStreamingResponse, + AsyncLoadBalancersResourceWithStreamingResponse, ) from .warp_connector import ( - WARPConnector, - AsyncWARPConnector, - WARPConnectorWithRawResponse, - AsyncWARPConnectorWithRawResponse, - WARPConnectorWithStreamingResponse, - AsyncWARPConnectorWithStreamingResponse, + WARPConnectorResource, + AsyncWARPConnectorResource, + WARPConnectorResourceWithRawResponse, + AsyncWARPConnectorResourceWithRawResponse, + WARPConnectorResourceWithStreamingResponse, + AsyncWARPConnectorResourceWithStreamingResponse, ) from .durable_objects import ( - DurableObjects, - AsyncDurableObjects, - DurableObjectsWithRawResponse, - AsyncDurableObjectsWithRawResponse, - DurableObjectsWithStreamingResponse, - AsyncDurableObjectsWithStreamingResponse, + DurableObjectsResource, + AsyncDurableObjectsResource, + DurableObjectsResourceWithRawResponse, + AsyncDurableObjectsResourceWithRawResponse, + DurableObjectsResourceWithStreamingResponse, + AsyncDurableObjectsResourceWithStreamingResponse, ) from .managed_headers import ( - ManagedHeaders, - AsyncManagedHeaders, - ManagedHeadersWithRawResponse, - AsyncManagedHeadersWithRawResponse, - ManagedHeadersWithStreamingResponse, - AsyncManagedHeadersWithStreamingResponse, + ManagedHeadersResource, + AsyncManagedHeadersResource, + ManagedHeadersResourceWithRawResponse, + AsyncManagedHeadersResourceWithRawResponse, + ManagedHeadersResourceWithStreamingResponse, + AsyncManagedHeadersResourceWithStreamingResponse, ) from .request_tracers import ( - RequestTracers, - AsyncRequestTracers, - RequestTracersWithRawResponse, - AsyncRequestTracersWithRawResponse, - RequestTracersWithStreamingResponse, - AsyncRequestTracersWithStreamingResponse, + RequestTracersResource, + AsyncRequestTracersResource, + RequestTracersResourceWithRawResponse, + AsyncRequestTracersResourceWithRawResponse, + RequestTracersResourceWithStreamingResponse, + AsyncRequestTracersResourceWithStreamingResponse, ) from .brand_protection import ( - BrandProtection, - AsyncBrandProtection, - BrandProtectionWithRawResponse, - AsyncBrandProtectionWithRawResponse, - BrandProtectionWithStreamingResponse, - AsyncBrandProtectionWithStreamingResponse, + BrandProtectionResource, + AsyncBrandProtectionResource, + BrandProtectionResourceWithRawResponse, + AsyncBrandProtectionResourceWithRawResponse, + BrandProtectionResourceWithStreamingResponse, + AsyncBrandProtectionResourceWithStreamingResponse, ) from .custom_hostnames import ( - CustomHostnames, - AsyncCustomHostnames, - CustomHostnamesWithRawResponse, - AsyncCustomHostnamesWithRawResponse, - CustomHostnamesWithStreamingResponse, - AsyncCustomHostnamesWithStreamingResponse, + CustomHostnamesResource, + AsyncCustomHostnamesResource, + CustomHostnamesResourceWithRawResponse, + AsyncCustomHostnamesResourceWithRawResponse, + CustomHostnamesResourceWithStreamingResponse, + AsyncCustomHostnamesResourceWithStreamingResponse, ) from .mtls_certificates import ( - MTLSCertificates, - AsyncMTLSCertificates, - MTLSCertificatesWithRawResponse, - AsyncMTLSCertificatesWithRawResponse, - MTLSCertificatesWithStreamingResponse, - AsyncMTLSCertificatesWithStreamingResponse, + MTLSCertificatesResource, + AsyncMTLSCertificatesResource, + MTLSCertificatesResourceWithRawResponse, + AsyncMTLSCertificatesResourceWithRawResponse, + MTLSCertificatesResourceWithStreamingResponse, + AsyncMTLSCertificatesResourceWithStreamingResponse, ) from .url_normalization import ( - URLNormalization, - AsyncURLNormalization, - URLNormalizationWithRawResponse, - AsyncURLNormalizationWithRawResponse, - URLNormalizationWithStreamingResponse, - AsyncURLNormalizationWithStreamingResponse, + URLNormalizationResource, + AsyncURLNormalizationResource, + URLNormalizationResourceWithRawResponse, + AsyncURLNormalizationResourceWithRawResponse, + URLNormalizationResourceWithStreamingResponse, + AsyncURLNormalizationResourceWithStreamingResponse, ) from .custom_nameservers import ( - CustomNameservers, - AsyncCustomNameservers, - CustomNameserversWithRawResponse, - AsyncCustomNameserversWithRawResponse, - CustomNameserversWithStreamingResponse, - AsyncCustomNameserversWithStreamingResponse, + CustomNameserversResource, + AsyncCustomNameserversResource, + CustomNameserversResourceWithRawResponse, + AsyncCustomNameserversResourceWithRawResponse, + CustomNameserversResourceWithStreamingResponse, + AsyncCustomNameserversResourceWithStreamingResponse, ) from .client_certificates import ( - ClientCertificates, - AsyncClientCertificates, - ClientCertificatesWithRawResponse, - AsyncClientCertificatesWithRawResponse, - ClientCertificatesWithStreamingResponse, - AsyncClientCertificatesWithStreamingResponse, + ClientCertificatesResource, + AsyncClientCertificatesResource, + ClientCertificatesResourceWithRawResponse, + AsyncClientCertificatesResourceWithRawResponse, + ClientCertificatesResourceWithStreamingResponse, + AsyncClientCertificatesResourceWithStreamingResponse, ) from .custom_certificates import ( - CustomCertificates, - AsyncCustomCertificates, - CustomCertificatesWithRawResponse, - AsyncCustomCertificatesWithRawResponse, - CustomCertificatesWithStreamingResponse, - AsyncCustomCertificatesWithStreamingResponse, + CustomCertificatesResource, + AsyncCustomCertificatesResource, + CustomCertificatesResourceWithRawResponse, + AsyncCustomCertificatesResourceWithRawResponse, + CustomCertificatesResourceWithStreamingResponse, + AsyncCustomCertificatesResourceWithStreamingResponse, +) +from .event_notifications import ( + EventNotificationsResource, + AsyncEventNotificationsResource, + EventNotificationsResourceWithRawResponse, + AsyncEventNotificationsResourceWithRawResponse, + EventNotificationsResourceWithStreamingResponse, + AsyncEventNotificationsResourceWithStreamingResponse, ) from .keyless_certificates import ( - KeylessCertificates, - AsyncKeylessCertificates, - KeylessCertificatesWithRawResponse, - AsyncKeylessCertificatesWithRawResponse, - KeylessCertificatesWithStreamingResponse, - AsyncKeylessCertificatesWithStreamingResponse, + KeylessCertificatesResource, + AsyncKeylessCertificatesResource, + KeylessCertificatesResourceWithRawResponse, + AsyncKeylessCertificatesResourceWithRawResponse, + KeylessCertificatesResourceWithStreamingResponse, + AsyncKeylessCertificatesResourceWithStreamingResponse, ) from .workers_for_platforms import ( - WorkersForPlatforms, - AsyncWorkersForPlatforms, - WorkersForPlatformsWithRawResponse, - AsyncWorkersForPlatformsWithRawResponse, - WorkersForPlatformsWithStreamingResponse, - AsyncWorkersForPlatformsWithStreamingResponse, + WorkersForPlatformsResource, + AsyncWorkersForPlatformsResource, + WorkersForPlatformsResourceWithRawResponse, + AsyncWorkersForPlatformsResourceWithRawResponse, + WorkersForPlatformsResourceWithStreamingResponse, + AsyncWorkersForPlatformsResourceWithStreamingResponse, ) from .origin_ca_certificates import ( - OriginCACertificates, - AsyncOriginCACertificates, - OriginCACertificatesWithRawResponse, - AsyncOriginCACertificatesWithRawResponse, - OriginCACertificatesWithStreamingResponse, - AsyncOriginCACertificatesWithStreamingResponse, + OriginCACertificatesResource, + AsyncOriginCACertificatesResource, + OriginCACertificatesResourceWithRawResponse, + AsyncOriginCACertificatesResourceWithRawResponse, + OriginCACertificatesResourceWithStreamingResponse, + AsyncOriginCACertificatesResourceWithStreamingResponse, ) from .origin_tls_client_auth import ( - OriginTLSClientAuth, - AsyncOriginTLSClientAuth, - OriginTLSClientAuthWithRawResponse, - AsyncOriginTLSClientAuthWithRawResponse, - OriginTLSClientAuthWithStreamingResponse, - AsyncOriginTLSClientAuthWithStreamingResponse, + OriginTLSClientAuthResource, + AsyncOriginTLSClientAuthResource, + OriginTLSClientAuthResourceWithRawResponse, + AsyncOriginTLSClientAuthResourceWithRawResponse, + OriginTLSClientAuthResourceWithStreamingResponse, + AsyncOriginTLSClientAuthResourceWithStreamingResponse, ) from .certificate_authorities import ( - CertificateAuthorities, - AsyncCertificateAuthorities, - CertificateAuthoritiesWithRawResponse, - AsyncCertificateAuthoritiesWithRawResponse, - CertificateAuthoritiesWithStreamingResponse, - AsyncCertificateAuthoritiesWithStreamingResponse, + CertificateAuthoritiesResource, + AsyncCertificateAuthoritiesResource, + CertificateAuthoritiesResourceWithRawResponse, + AsyncCertificateAuthoritiesResourceWithRawResponse, + CertificateAuthoritiesResourceWithStreamingResponse, + AsyncCertificateAuthoritiesResourceWithStreamingResponse, ) from .magic_network_monitoring import ( - MagicNetworkMonitoring, - AsyncMagicNetworkMonitoring, - MagicNetworkMonitoringWithRawResponse, - AsyncMagicNetworkMonitoringWithRawResponse, - MagicNetworkMonitoringWithStreamingResponse, - AsyncMagicNetworkMonitoringWithStreamingResponse, + MagicNetworkMonitoringResource, + AsyncMagicNetworkMonitoringResource, + MagicNetworkMonitoringResourceWithRawResponse, + AsyncMagicNetworkMonitoringResourceWithRawResponse, + MagicNetworkMonitoringResourceWithStreamingResponse, + AsyncMagicNetworkMonitoringResourceWithStreamingResponse, ) from .origin_post_quantum_encryption import ( - OriginPostQuantumEncryption, - AsyncOriginPostQuantumEncryption, - OriginPostQuantumEncryptionWithRawResponse, - AsyncOriginPostQuantumEncryptionWithRawResponse, - OriginPostQuantumEncryptionWithStreamingResponse, - AsyncOriginPostQuantumEncryptionWithStreamingResponse, + OriginPostQuantumEncryptionResource, + AsyncOriginPostQuantumEncryptionResource, + OriginPostQuantumEncryptionResourceWithRawResponse, + AsyncOriginPostQuantumEncryptionResourceWithRawResponse, + OriginPostQuantumEncryptionResourceWithStreamingResponse, + AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse, ) __all__ = [ - "Accounts", - "AsyncAccounts", - "AccountsWithRawResponse", - "AsyncAccountsWithRawResponse", - "AccountsWithStreamingResponse", - "AsyncAccountsWithStreamingResponse", - "OriginCACertificates", - "AsyncOriginCACertificates", - "OriginCACertificatesWithRawResponse", - "AsyncOriginCACertificatesWithRawResponse", - "OriginCACertificatesWithStreamingResponse", - "AsyncOriginCACertificatesWithStreamingResponse", - "IPs", - "AsyncIPs", - "IPsWithRawResponse", - "AsyncIPsWithRawResponse", - "IPsWithStreamingResponse", - "AsyncIPsWithStreamingResponse", - "Memberships", - "AsyncMemberships", - "MembershipsWithRawResponse", - "AsyncMembershipsWithRawResponse", - "MembershipsWithStreamingResponse", - "AsyncMembershipsWithStreamingResponse", + "AccountsResource", + "AsyncAccountsResource", + "AccountsResourceWithRawResponse", + "AsyncAccountsResourceWithRawResponse", + "AccountsResourceWithStreamingResponse", + "AsyncAccountsResourceWithStreamingResponse", + "OriginCACertificatesResource", + "AsyncOriginCACertificatesResource", + "OriginCACertificatesResourceWithRawResponse", + "AsyncOriginCACertificatesResourceWithRawResponse", + "OriginCACertificatesResourceWithStreamingResponse", + "AsyncOriginCACertificatesResourceWithStreamingResponse", + "IPsResource", + "AsyncIPsResource", + "IPsResourceWithRawResponse", + "AsyncIPsResourceWithRawResponse", + "IPsResourceWithStreamingResponse", + "AsyncIPsResourceWithStreamingResponse", + "MembershipsResource", + "AsyncMembershipsResource", + "MembershipsResourceWithRawResponse", + "AsyncMembershipsResourceWithRawResponse", + "MembershipsResourceWithStreamingResponse", + "AsyncMembershipsResourceWithStreamingResponse", "UserResource", "AsyncUserResource", "UserResourceWithRawResponse", "AsyncUserResourceWithRawResponse", "UserResourceWithStreamingResponse", "AsyncUserResourceWithStreamingResponse", - "Zones", - "AsyncZones", - "ZonesWithRawResponse", - "AsyncZonesWithRawResponse", - "ZonesWithStreamingResponse", - "AsyncZonesWithStreamingResponse", - "LoadBalancers", - "AsyncLoadBalancers", - "LoadBalancersWithRawResponse", - "AsyncLoadBalancersWithRawResponse", - "LoadBalancersWithStreamingResponse", - "AsyncLoadBalancersWithStreamingResponse", - "Cache", - "AsyncCache", - "CacheWithRawResponse", - "AsyncCacheWithRawResponse", - "CacheWithStreamingResponse", - "AsyncCacheWithStreamingResponse", - "SSL", - "AsyncSSL", - "SSLWithRawResponse", - "AsyncSSLWithRawResponse", - "SSLWithStreamingResponse", - "AsyncSSLWithStreamingResponse", - "Subscriptions", - "AsyncSubscriptions", - "SubscriptionsWithRawResponse", - "AsyncSubscriptionsWithRawResponse", - "SubscriptionsWithStreamingResponse", - "AsyncSubscriptionsWithStreamingResponse", - "ACM", - "AsyncACM", - "ACMWithRawResponse", - "AsyncACMWithRawResponse", - "ACMWithStreamingResponse", - "AsyncACMWithStreamingResponse", - "Argo", - "AsyncArgo", - "ArgoWithRawResponse", - "AsyncArgoWithRawResponse", - "ArgoWithStreamingResponse", - "AsyncArgoWithStreamingResponse", - "Plans", - "AsyncPlans", - "PlansWithRawResponse", - "AsyncPlansWithRawResponse", - "PlansWithStreamingResponse", - "AsyncPlansWithStreamingResponse", - "RatePlans", - "AsyncRatePlans", - "RatePlansWithRawResponse", - "AsyncRatePlansWithRawResponse", - "RatePlansWithStreamingResponse", - "AsyncRatePlansWithStreamingResponse", - "CertificateAuthorities", - "AsyncCertificateAuthorities", - "CertificateAuthoritiesWithRawResponse", - "AsyncCertificateAuthoritiesWithRawResponse", - "CertificateAuthoritiesWithStreamingResponse", - "AsyncCertificateAuthoritiesWithStreamingResponse", - "ClientCertificates", - "AsyncClientCertificates", - "ClientCertificatesWithRawResponse", - "AsyncClientCertificatesWithRawResponse", - "ClientCertificatesWithStreamingResponse", - "AsyncClientCertificatesWithStreamingResponse", - "CustomCertificates", - "AsyncCustomCertificates", - "CustomCertificatesWithRawResponse", - "AsyncCustomCertificatesWithRawResponse", - "CustomCertificatesWithStreamingResponse", - "AsyncCustomCertificatesWithStreamingResponse", - "CustomHostnames", - "AsyncCustomHostnames", - "CustomHostnamesWithRawResponse", - "AsyncCustomHostnamesWithRawResponse", - "CustomHostnamesWithStreamingResponse", - "AsyncCustomHostnamesWithStreamingResponse", - "CustomNameservers", - "AsyncCustomNameservers", - "CustomNameserversWithRawResponse", - "AsyncCustomNameserversWithRawResponse", - "CustomNameserversWithStreamingResponse", - "AsyncCustomNameserversWithStreamingResponse", - "DNS", - "AsyncDNS", - "DNSWithRawResponse", - "AsyncDNSWithRawResponse", - "DNSWithStreamingResponse", - "AsyncDNSWithStreamingResponse", + "ZonesResource", + "AsyncZonesResource", + "ZonesResourceWithRawResponse", + "AsyncZonesResourceWithRawResponse", + "ZonesResourceWithStreamingResponse", + "AsyncZonesResourceWithStreamingResponse", + "LoadBalancersResource", + "AsyncLoadBalancersResource", + "LoadBalancersResourceWithRawResponse", + "AsyncLoadBalancersResourceWithRawResponse", + "LoadBalancersResourceWithStreamingResponse", + "AsyncLoadBalancersResourceWithStreamingResponse", + "CacheResource", + "AsyncCacheResource", + "CacheResourceWithRawResponse", + "AsyncCacheResourceWithRawResponse", + "CacheResourceWithStreamingResponse", + "AsyncCacheResourceWithStreamingResponse", + "SSLResource", + "AsyncSSLResource", + "SSLResourceWithRawResponse", + "AsyncSSLResourceWithRawResponse", + "SSLResourceWithStreamingResponse", + "AsyncSSLResourceWithStreamingResponse", + "SubscriptionsResource", + "AsyncSubscriptionsResource", + "SubscriptionsResourceWithRawResponse", + "AsyncSubscriptionsResourceWithRawResponse", + "SubscriptionsResourceWithStreamingResponse", + "AsyncSubscriptionsResourceWithStreamingResponse", + "ACMResource", + "AsyncACMResource", + "ACMResourceWithRawResponse", + "AsyncACMResourceWithRawResponse", + "ACMResourceWithStreamingResponse", + "AsyncACMResourceWithStreamingResponse", + "ArgoResource", + "AsyncArgoResource", + "ArgoResourceWithRawResponse", + "AsyncArgoResourceWithRawResponse", + "ArgoResourceWithStreamingResponse", + "AsyncArgoResourceWithStreamingResponse", + "PlansResource", + "AsyncPlansResource", + "PlansResourceWithRawResponse", + "AsyncPlansResourceWithRawResponse", + "PlansResourceWithStreamingResponse", + "AsyncPlansResourceWithStreamingResponse", + "RatePlansResource", + "AsyncRatePlansResource", + "RatePlansResourceWithRawResponse", + "AsyncRatePlansResourceWithRawResponse", + "RatePlansResourceWithStreamingResponse", + "AsyncRatePlansResourceWithStreamingResponse", + "CertificateAuthoritiesResource", + "AsyncCertificateAuthoritiesResource", + "CertificateAuthoritiesResourceWithRawResponse", + "AsyncCertificateAuthoritiesResourceWithRawResponse", + "CertificateAuthoritiesResourceWithStreamingResponse", + "AsyncCertificateAuthoritiesResourceWithStreamingResponse", + "ClientCertificatesResource", + "AsyncClientCertificatesResource", + "ClientCertificatesResourceWithRawResponse", + "AsyncClientCertificatesResourceWithRawResponse", + "ClientCertificatesResourceWithStreamingResponse", + "AsyncClientCertificatesResourceWithStreamingResponse", + "CustomCertificatesResource", + "AsyncCustomCertificatesResource", + "CustomCertificatesResourceWithRawResponse", + "AsyncCustomCertificatesResourceWithRawResponse", + "CustomCertificatesResourceWithStreamingResponse", + "AsyncCustomCertificatesResourceWithStreamingResponse", + "CustomHostnamesResource", + "AsyncCustomHostnamesResource", + "CustomHostnamesResourceWithRawResponse", + "AsyncCustomHostnamesResourceWithRawResponse", + "CustomHostnamesResourceWithStreamingResponse", + "AsyncCustomHostnamesResourceWithStreamingResponse", + "CustomNameserversResource", + "AsyncCustomNameserversResource", + "CustomNameserversResourceWithRawResponse", + "AsyncCustomNameserversResourceWithRawResponse", + "CustomNameserversResourceWithStreamingResponse", + "AsyncCustomNameserversResourceWithStreamingResponse", + "DNSResource", + "AsyncDNSResource", + "DNSResourceWithRawResponse", + "AsyncDNSResourceWithRawResponse", + "DNSResourceWithStreamingResponse", + "AsyncDNSResourceWithStreamingResponse", "DNSSECResource", "AsyncDNSSECResource", "DNSSECResourceWithRawResponse", "AsyncDNSSECResourceWithRawResponse", "DNSSECResourceWithStreamingResponse", "AsyncDNSSECResourceWithStreamingResponse", - "EmailRouting", - "AsyncEmailRouting", - "EmailRoutingWithRawResponse", - "AsyncEmailRoutingWithRawResponse", - "EmailRoutingWithStreamingResponse", - "AsyncEmailRoutingWithStreamingResponse", - "Filters", - "AsyncFilters", - "FiltersWithRawResponse", - "AsyncFiltersWithRawResponse", - "FiltersWithStreamingResponse", - "AsyncFiltersWithStreamingResponse", - "Firewall", - "AsyncFirewall", - "FirewallWithRawResponse", - "AsyncFirewallWithRawResponse", - "FirewallWithStreamingResponse", - "AsyncFirewallWithStreamingResponse", - "Healthchecks", - "AsyncHealthchecks", - "HealthchecksWithRawResponse", - "AsyncHealthchecksWithRawResponse", - "HealthchecksWithStreamingResponse", - "AsyncHealthchecksWithStreamingResponse", - "KeylessCertificates", - "AsyncKeylessCertificates", - "KeylessCertificatesWithRawResponse", - "AsyncKeylessCertificatesWithRawResponse", - "KeylessCertificatesWithStreamingResponse", - "AsyncKeylessCertificatesWithStreamingResponse", - "Logpush", - "AsyncLogpush", - "LogpushWithRawResponse", - "AsyncLogpushWithRawResponse", - "LogpushWithStreamingResponse", - "AsyncLogpushWithStreamingResponse", - "Logs", - "AsyncLogs", - "LogsWithRawResponse", - "AsyncLogsWithRawResponse", - "LogsWithStreamingResponse", - "AsyncLogsWithStreamingResponse", - "OriginTLSClientAuth", - "AsyncOriginTLSClientAuth", - "OriginTLSClientAuthWithRawResponse", - "AsyncOriginTLSClientAuthWithRawResponse", - "OriginTLSClientAuthWithStreamingResponse", - "AsyncOriginTLSClientAuthWithStreamingResponse", - "Pagerules", - "AsyncPagerules", - "PagerulesWithRawResponse", - "AsyncPagerulesWithRawResponse", - "PagerulesWithStreamingResponse", - "AsyncPagerulesWithStreamingResponse", - "RateLimits", - "AsyncRateLimits", - "RateLimitsWithRawResponse", - "AsyncRateLimitsWithRawResponse", - "RateLimitsWithStreamingResponse", - "AsyncRateLimitsWithStreamingResponse", - "SecondaryDNS", - "AsyncSecondaryDNS", - "SecondaryDNSWithRawResponse", - "AsyncSecondaryDNSWithRawResponse", - "SecondaryDNSWithStreamingResponse", - "AsyncSecondaryDNSWithStreamingResponse", - "WaitingRooms", - "AsyncWaitingRooms", - "WaitingRoomsWithRawResponse", - "AsyncWaitingRoomsWithRawResponse", - "WaitingRoomsWithStreamingResponse", - "AsyncWaitingRoomsWithStreamingResponse", - "Web3", - "AsyncWeb3", - "Web3WithRawResponse", - "AsyncWeb3WithRawResponse", - "Web3WithStreamingResponse", - "AsyncWeb3WithStreamingResponse", - "Workers", - "AsyncWorkers", - "WorkersWithRawResponse", - "AsyncWorkersWithRawResponse", - "WorkersWithStreamingResponse", - "AsyncWorkersWithStreamingResponse", - "KV", - "AsyncKV", - "KVWithRawResponse", - "AsyncKVWithRawResponse", - "KVWithStreamingResponse", - "AsyncKVWithStreamingResponse", - "DurableObjects", - "AsyncDurableObjects", - "DurableObjectsWithRawResponse", - "AsyncDurableObjectsWithRawResponse", - "DurableObjectsWithStreamingResponse", - "AsyncDurableObjectsWithStreamingResponse", - "Queues", - "AsyncQueues", - "QueuesWithRawResponse", - "AsyncQueuesWithRawResponse", - "QueuesWithStreamingResponse", - "AsyncQueuesWithStreamingResponse", - "ManagedHeaders", - "AsyncManagedHeaders", - "ManagedHeadersWithRawResponse", - "AsyncManagedHeadersWithRawResponse", - "ManagedHeadersWithStreamingResponse", - "AsyncManagedHeadersWithStreamingResponse", - "PageShield", - "AsyncPageShield", - "PageShieldWithRawResponse", - "AsyncPageShieldWithRawResponse", - "PageShieldWithStreamingResponse", - "AsyncPageShieldWithStreamingResponse", - "Rulesets", - "AsyncRulesets", - "RulesetsWithRawResponse", - "AsyncRulesetsWithRawResponse", - "RulesetsWithStreamingResponse", - "AsyncRulesetsWithStreamingResponse", - "URLNormalization", - "AsyncURLNormalization", - "URLNormalizationWithRawResponse", - "AsyncURLNormalizationWithRawResponse", - "URLNormalizationWithStreamingResponse", - "AsyncURLNormalizationWithStreamingResponse", - "Spectrum", - "AsyncSpectrum", - "SpectrumWithRawResponse", - "AsyncSpectrumWithRawResponse", - "SpectrumWithStreamingResponse", - "AsyncSpectrumWithStreamingResponse", - "Addressing", - "AsyncAddressing", - "AddressingWithRawResponse", - "AsyncAddressingWithRawResponse", - "AddressingWithStreamingResponse", - "AsyncAddressingWithStreamingResponse", - "AuditLogs", - "AsyncAuditLogs", - "AuditLogsWithRawResponse", - "AsyncAuditLogsWithRawResponse", - "AuditLogsWithStreamingResponse", - "AsyncAuditLogsWithStreamingResponse", - "Billing", - "AsyncBilling", - "BillingWithRawResponse", - "AsyncBillingWithRawResponse", - "BillingWithStreamingResponse", - "AsyncBillingWithStreamingResponse", - "BrandProtection", - "AsyncBrandProtection", - "BrandProtectionWithRawResponse", - "AsyncBrandProtectionWithRawResponse", - "BrandProtectionWithStreamingResponse", - "AsyncBrandProtectionWithStreamingResponse", - "Diagnostics", - "AsyncDiagnostics", - "DiagnosticsWithRawResponse", - "AsyncDiagnosticsWithRawResponse", - "DiagnosticsWithStreamingResponse", - "AsyncDiagnosticsWithStreamingResponse", - "Images", - "AsyncImages", - "ImagesWithRawResponse", - "AsyncImagesWithRawResponse", - "ImagesWithStreamingResponse", - "AsyncImagesWithStreamingResponse", - "Intel", - "AsyncIntel", - "IntelWithRawResponse", - "AsyncIntelWithRawResponse", - "IntelWithStreamingResponse", - "AsyncIntelWithStreamingResponse", - "MagicTransit", - "AsyncMagicTransit", - "MagicTransitWithRawResponse", - "AsyncMagicTransitWithRawResponse", - "MagicTransitWithStreamingResponse", - "AsyncMagicTransitWithStreamingResponse", - "MagicNetworkMonitoring", - "AsyncMagicNetworkMonitoring", - "MagicNetworkMonitoringWithRawResponse", - "AsyncMagicNetworkMonitoringWithRawResponse", - "MagicNetworkMonitoringWithStreamingResponse", - "AsyncMagicNetworkMonitoringWithStreamingResponse", - "MTLSCertificates", - "AsyncMTLSCertificates", - "MTLSCertificatesWithRawResponse", - "AsyncMTLSCertificatesWithRawResponse", - "MTLSCertificatesWithStreamingResponse", - "AsyncMTLSCertificatesWithStreamingResponse", - "Pages", - "AsyncPages", - "PagesWithRawResponse", - "AsyncPagesWithRawResponse", - "PagesWithStreamingResponse", - "AsyncPagesWithStreamingResponse", - "PCAPs", - "AsyncPCAPs", - "PCAPsWithRawResponse", - "AsyncPCAPsWithRawResponse", - "PCAPsWithStreamingResponse", - "AsyncPCAPsWithStreamingResponse", - "Registrar", - "AsyncRegistrar", - "RegistrarWithRawResponse", - "AsyncRegistrarWithRawResponse", - "RegistrarWithStreamingResponse", - "AsyncRegistrarWithStreamingResponse", - "RequestTracers", - "AsyncRequestTracers", - "RequestTracersWithRawResponse", - "AsyncRequestTracersWithRawResponse", - "RequestTracersWithStreamingResponse", - "AsyncRequestTracersWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "Storage", - "AsyncStorage", - "StorageWithRawResponse", - "AsyncStorageWithRawResponse", - "StorageWithStreamingResponse", - "AsyncStorageWithStreamingResponse", - "Stream", - "AsyncStream", - "StreamWithRawResponse", - "AsyncStreamWithRawResponse", - "StreamWithStreamingResponse", - "AsyncStreamWithStreamingResponse", - "Alerting", - "AsyncAlerting", - "AlertingWithRawResponse", - "AsyncAlertingWithRawResponse", - "AlertingWithStreamingResponse", - "AsyncAlertingWithStreamingResponse", - "D1", - "AsyncD1", - "D1WithRawResponse", - "AsyncD1WithRawResponse", - "D1WithStreamingResponse", - "AsyncD1WithStreamingResponse", - "R2", - "AsyncR2", - "R2WithRawResponse", - "AsyncR2WithRawResponse", - "R2WithStreamingResponse", - "AsyncR2WithStreamingResponse", - "WARPConnector", - "AsyncWARPConnector", - "WARPConnectorWithRawResponse", - "AsyncWARPConnectorWithRawResponse", - "WARPConnectorWithStreamingResponse", - "AsyncWARPConnectorWithStreamingResponse", - "WorkersForPlatforms", - "AsyncWorkersForPlatforms", - "WorkersForPlatformsWithRawResponse", - "AsyncWorkersForPlatformsWithRawResponse", - "WorkersForPlatformsWithStreamingResponse", - "AsyncWorkersForPlatformsWithStreamingResponse", - "ZeroTrust", - "AsyncZeroTrust", - "ZeroTrustWithRawResponse", - "AsyncZeroTrustWithRawResponse", - "ZeroTrustWithStreamingResponse", - "AsyncZeroTrustWithStreamingResponse", - "Challenges", - "AsyncChallenges", - "ChallengesWithRawResponse", - "AsyncChallengesWithRawResponse", - "ChallengesWithStreamingResponse", - "AsyncChallengesWithStreamingResponse", + "EmailRoutingResource", + "AsyncEmailRoutingResource", + "EmailRoutingResourceWithRawResponse", + "AsyncEmailRoutingResourceWithRawResponse", + "EmailRoutingResourceWithStreamingResponse", + "AsyncEmailRoutingResourceWithStreamingResponse", + "FiltersResource", + "AsyncFiltersResource", + "FiltersResourceWithRawResponse", + "AsyncFiltersResourceWithRawResponse", + "FiltersResourceWithStreamingResponse", + "AsyncFiltersResourceWithStreamingResponse", + "FirewallResource", + "AsyncFirewallResource", + "FirewallResourceWithRawResponse", + "AsyncFirewallResourceWithRawResponse", + "FirewallResourceWithStreamingResponse", + "AsyncFirewallResourceWithStreamingResponse", + "HealthchecksResource", + "AsyncHealthchecksResource", + "HealthchecksResourceWithRawResponse", + "AsyncHealthchecksResourceWithRawResponse", + "HealthchecksResourceWithStreamingResponse", + "AsyncHealthchecksResourceWithStreamingResponse", + "KeylessCertificatesResource", + "AsyncKeylessCertificatesResource", + "KeylessCertificatesResourceWithRawResponse", + "AsyncKeylessCertificatesResourceWithRawResponse", + "KeylessCertificatesResourceWithStreamingResponse", + "AsyncKeylessCertificatesResourceWithStreamingResponse", + "LogpushResource", + "AsyncLogpushResource", + "LogpushResourceWithRawResponse", + "AsyncLogpushResourceWithRawResponse", + "LogpushResourceWithStreamingResponse", + "AsyncLogpushResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", + "OriginTLSClientAuthResource", + "AsyncOriginTLSClientAuthResource", + "OriginTLSClientAuthResourceWithRawResponse", + "AsyncOriginTLSClientAuthResourceWithRawResponse", + "OriginTLSClientAuthResourceWithStreamingResponse", + "AsyncOriginTLSClientAuthResourceWithStreamingResponse", + "PagerulesResource", + "AsyncPagerulesResource", + "PagerulesResourceWithRawResponse", + "AsyncPagerulesResourceWithRawResponse", + "PagerulesResourceWithStreamingResponse", + "AsyncPagerulesResourceWithStreamingResponse", + "RateLimitsResource", + "AsyncRateLimitsResource", + "RateLimitsResourceWithRawResponse", + "AsyncRateLimitsResourceWithRawResponse", + "RateLimitsResourceWithStreamingResponse", + "AsyncRateLimitsResourceWithStreamingResponse", + "SecondaryDNSResource", + "AsyncSecondaryDNSResource", + "SecondaryDNSResourceWithRawResponse", + "AsyncSecondaryDNSResourceWithRawResponse", + "SecondaryDNSResourceWithStreamingResponse", + "AsyncSecondaryDNSResourceWithStreamingResponse", + "WaitingRoomsResource", + "AsyncWaitingRoomsResource", + "WaitingRoomsResourceWithRawResponse", + "AsyncWaitingRoomsResourceWithRawResponse", + "WaitingRoomsResourceWithStreamingResponse", + "AsyncWaitingRoomsResourceWithStreamingResponse", + "Web3Resource", + "AsyncWeb3Resource", + "Web3ResourceWithRawResponse", + "AsyncWeb3ResourceWithRawResponse", + "Web3ResourceWithStreamingResponse", + "AsyncWeb3ResourceWithStreamingResponse", + "WorkersResource", + "AsyncWorkersResource", + "WorkersResourceWithRawResponse", + "AsyncWorkersResourceWithRawResponse", + "WorkersResourceWithStreamingResponse", + "AsyncWorkersResourceWithStreamingResponse", + "KVResource", + "AsyncKVResource", + "KVResourceWithRawResponse", + "AsyncKVResourceWithRawResponse", + "KVResourceWithStreamingResponse", + "AsyncKVResourceWithStreamingResponse", + "DurableObjectsResource", + "AsyncDurableObjectsResource", + "DurableObjectsResourceWithRawResponse", + "AsyncDurableObjectsResourceWithRawResponse", + "DurableObjectsResourceWithStreamingResponse", + "AsyncDurableObjectsResourceWithStreamingResponse", + "QueuesResource", + "AsyncQueuesResource", + "QueuesResourceWithRawResponse", + "AsyncQueuesResourceWithRawResponse", + "QueuesResourceWithStreamingResponse", + "AsyncQueuesResourceWithStreamingResponse", + "ManagedHeadersResource", + "AsyncManagedHeadersResource", + "ManagedHeadersResourceWithRawResponse", + "AsyncManagedHeadersResourceWithRawResponse", + "ManagedHeadersResourceWithStreamingResponse", + "AsyncManagedHeadersResourceWithStreamingResponse", + "PageShieldResource", + "AsyncPageShieldResource", + "PageShieldResourceWithRawResponse", + "AsyncPageShieldResourceWithRawResponse", + "PageShieldResourceWithStreamingResponse", + "AsyncPageShieldResourceWithStreamingResponse", + "RulesetsResource", + "AsyncRulesetsResource", + "RulesetsResourceWithRawResponse", + "AsyncRulesetsResourceWithRawResponse", + "RulesetsResourceWithStreamingResponse", + "AsyncRulesetsResourceWithStreamingResponse", + "URLNormalizationResource", + "AsyncURLNormalizationResource", + "URLNormalizationResourceWithRawResponse", + "AsyncURLNormalizationResourceWithRawResponse", + "URLNormalizationResourceWithStreamingResponse", + "AsyncURLNormalizationResourceWithStreamingResponse", + "SpectrumResource", + "AsyncSpectrumResource", + "SpectrumResourceWithRawResponse", + "AsyncSpectrumResourceWithRawResponse", + "SpectrumResourceWithStreamingResponse", + "AsyncSpectrumResourceWithStreamingResponse", + "AddressingResource", + "AsyncAddressingResource", + "AddressingResourceWithRawResponse", + "AsyncAddressingResourceWithRawResponse", + "AddressingResourceWithStreamingResponse", + "AsyncAddressingResourceWithStreamingResponse", + "AuditLogsResource", + "AsyncAuditLogsResource", + "AuditLogsResourceWithRawResponse", + "AsyncAuditLogsResourceWithRawResponse", + "AuditLogsResourceWithStreamingResponse", + "AsyncAuditLogsResourceWithStreamingResponse", + "BillingResource", + "AsyncBillingResource", + "BillingResourceWithRawResponse", + "AsyncBillingResourceWithRawResponse", + "BillingResourceWithStreamingResponse", + "AsyncBillingResourceWithStreamingResponse", + "BrandProtectionResource", + "AsyncBrandProtectionResource", + "BrandProtectionResourceWithRawResponse", + "AsyncBrandProtectionResourceWithRawResponse", + "BrandProtectionResourceWithStreamingResponse", + "AsyncBrandProtectionResourceWithStreamingResponse", + "DiagnosticsResource", + "AsyncDiagnosticsResource", + "DiagnosticsResourceWithRawResponse", + "AsyncDiagnosticsResourceWithRawResponse", + "DiagnosticsResourceWithStreamingResponse", + "AsyncDiagnosticsResourceWithStreamingResponse", + "ImagesResource", + "AsyncImagesResource", + "ImagesResourceWithRawResponse", + "AsyncImagesResourceWithRawResponse", + "ImagesResourceWithStreamingResponse", + "AsyncImagesResourceWithStreamingResponse", + "IntelResource", + "AsyncIntelResource", + "IntelResourceWithRawResponse", + "AsyncIntelResourceWithRawResponse", + "IntelResourceWithStreamingResponse", + "AsyncIntelResourceWithStreamingResponse", + "MagicTransitResource", + "AsyncMagicTransitResource", + "MagicTransitResourceWithRawResponse", + "AsyncMagicTransitResourceWithRawResponse", + "MagicTransitResourceWithStreamingResponse", + "AsyncMagicTransitResourceWithStreamingResponse", + "MagicNetworkMonitoringResource", + "AsyncMagicNetworkMonitoringResource", + "MagicNetworkMonitoringResourceWithRawResponse", + "AsyncMagicNetworkMonitoringResourceWithRawResponse", + "MagicNetworkMonitoringResourceWithStreamingResponse", + "AsyncMagicNetworkMonitoringResourceWithStreamingResponse", + "MTLSCertificatesResource", + "AsyncMTLSCertificatesResource", + "MTLSCertificatesResourceWithRawResponse", + "AsyncMTLSCertificatesResourceWithRawResponse", + "MTLSCertificatesResourceWithStreamingResponse", + "AsyncMTLSCertificatesResourceWithStreamingResponse", + "PagesResource", + "AsyncPagesResource", + "PagesResourceWithRawResponse", + "AsyncPagesResourceWithRawResponse", + "PagesResourceWithStreamingResponse", + "AsyncPagesResourceWithStreamingResponse", + "PCAPsResource", + "AsyncPCAPsResource", + "PCAPsResourceWithRawResponse", + "AsyncPCAPsResourceWithRawResponse", + "PCAPsResourceWithStreamingResponse", + "AsyncPCAPsResourceWithStreamingResponse", + "RegistrarResource", + "AsyncRegistrarResource", + "RegistrarResourceWithRawResponse", + "AsyncRegistrarResourceWithRawResponse", + "RegistrarResourceWithStreamingResponse", + "AsyncRegistrarResourceWithStreamingResponse", + "RequestTracersResource", + "AsyncRequestTracersResource", + "RequestTracersResourceWithRawResponse", + "AsyncRequestTracersResourceWithRawResponse", + "RequestTracersResourceWithStreamingResponse", + "AsyncRequestTracersResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "StorageResource", + "AsyncStorageResource", + "StorageResourceWithRawResponse", + "AsyncStorageResourceWithRawResponse", + "StorageResourceWithStreamingResponse", + "AsyncStorageResourceWithStreamingResponse", + "StreamResource", + "AsyncStreamResource", + "StreamResourceWithRawResponse", + "AsyncStreamResourceWithRawResponse", + "StreamResourceWithStreamingResponse", + "AsyncStreamResourceWithStreamingResponse", + "AlertingResource", + "AsyncAlertingResource", + "AlertingResourceWithRawResponse", + "AsyncAlertingResourceWithRawResponse", + "AlertingResourceWithStreamingResponse", + "AsyncAlertingResourceWithStreamingResponse", + "D1Resource", + "AsyncD1Resource", + "D1ResourceWithRawResponse", + "AsyncD1ResourceWithRawResponse", + "D1ResourceWithStreamingResponse", + "AsyncD1ResourceWithStreamingResponse", + "R2Resource", + "AsyncR2Resource", + "R2ResourceWithRawResponse", + "AsyncR2ResourceWithRawResponse", + "R2ResourceWithStreamingResponse", + "AsyncR2ResourceWithStreamingResponse", + "WARPConnectorResource", + "AsyncWARPConnectorResource", + "WARPConnectorResourceWithRawResponse", + "AsyncWARPConnectorResourceWithRawResponse", + "WARPConnectorResourceWithStreamingResponse", + "AsyncWARPConnectorResourceWithStreamingResponse", + "WorkersForPlatformsResource", + "AsyncWorkersForPlatformsResource", + "WorkersForPlatformsResourceWithRawResponse", + "AsyncWorkersForPlatformsResourceWithRawResponse", + "WorkersForPlatformsResourceWithStreamingResponse", + "AsyncWorkersForPlatformsResourceWithStreamingResponse", + "ZeroTrustResource", + "AsyncZeroTrustResource", + "ZeroTrustResourceWithRawResponse", + "AsyncZeroTrustResourceWithRawResponse", + "ZeroTrustResourceWithStreamingResponse", + "AsyncZeroTrustResourceWithStreamingResponse", + "ChallengesResource", + "AsyncChallengesResource", + "ChallengesResourceWithRawResponse", + "AsyncChallengesResourceWithRawResponse", + "ChallengesResourceWithStreamingResponse", + "AsyncChallengesResourceWithStreamingResponse", "HyperdriveResource", "AsyncHyperdriveResource", "HyperdriveResourceWithRawResponse", "AsyncHyperdriveResourceWithRawResponse", "HyperdriveResourceWithStreamingResponse", "AsyncHyperdriveResourceWithStreamingResponse", - "RUM", - "AsyncRUM", - "RUMWithRawResponse", - "AsyncRUMWithRawResponse", - "RUMWithStreamingResponse", - "AsyncRUMWithStreamingResponse", - "Vectorize", - "AsyncVectorize", - "VectorizeWithRawResponse", - "AsyncVectorizeWithRawResponse", - "VectorizeWithStreamingResponse", - "AsyncVectorizeWithStreamingResponse", - "URLScanner", - "AsyncURLScanner", - "URLScannerWithRawResponse", - "AsyncURLScannerWithRawResponse", - "URLScannerWithStreamingResponse", - "AsyncURLScannerWithStreamingResponse", - "Radar", - "AsyncRadar", - "RadarWithRawResponse", - "AsyncRadarWithRawResponse", - "RadarWithStreamingResponse", - "AsyncRadarWithStreamingResponse", - "BotManagement", - "AsyncBotManagement", - "BotManagementWithRawResponse", - "AsyncBotManagementWithRawResponse", - "BotManagementWithStreamingResponse", - "AsyncBotManagementWithStreamingResponse", - "OriginPostQuantumEncryption", - "AsyncOriginPostQuantumEncryption", - "OriginPostQuantumEncryptionWithRawResponse", - "AsyncOriginPostQuantumEncryptionWithRawResponse", - "OriginPostQuantumEncryptionWithStreamingResponse", - "AsyncOriginPostQuantumEncryptionWithStreamingResponse", - "Speed", - "AsyncSpeed", - "SpeedWithRawResponse", - "AsyncSpeedWithRawResponse", - "SpeedWithStreamingResponse", - "AsyncSpeedWithStreamingResponse", - "DCVDelegation", - "AsyncDCVDelegation", - "DCVDelegationWithRawResponse", - "AsyncDCVDelegationWithRawResponse", - "DCVDelegationWithStreamingResponse", - "AsyncDCVDelegationWithStreamingResponse", - "Hostnames", - "AsyncHostnames", - "HostnamesWithRawResponse", - "AsyncHostnamesWithRawResponse", - "HostnamesWithStreamingResponse", - "AsyncHostnamesWithStreamingResponse", - "Snippets", - "AsyncSnippets", - "SnippetsWithRawResponse", - "AsyncSnippetsWithRawResponse", - "SnippetsWithStreamingResponse", - "AsyncSnippetsWithStreamingResponse", - "Calls", - "AsyncCalls", - "CallsWithRawResponse", - "AsyncCallsWithRawResponse", - "CallsWithStreamingResponse", - "AsyncCallsWithStreamingResponse", - "CloudforceOne", - "AsyncCloudforceOne", - "CloudforceOneWithRawResponse", - "AsyncCloudforceOneWithRawResponse", - "CloudforceOneWithStreamingResponse", - "AsyncCloudforceOneWithStreamingResponse", + "RUMResource", + "AsyncRUMResource", + "RUMResourceWithRawResponse", + "AsyncRUMResourceWithRawResponse", + "RUMResourceWithStreamingResponse", + "AsyncRUMResourceWithStreamingResponse", + "VectorizeResource", + "AsyncVectorizeResource", + "VectorizeResourceWithRawResponse", + "AsyncVectorizeResourceWithRawResponse", + "VectorizeResourceWithStreamingResponse", + "AsyncVectorizeResourceWithStreamingResponse", + "URLScannerResource", + "AsyncURLScannerResource", + "URLScannerResourceWithRawResponse", + "AsyncURLScannerResourceWithRawResponse", + "URLScannerResourceWithStreamingResponse", + "AsyncURLScannerResourceWithStreamingResponse", + "RadarResource", + "AsyncRadarResource", + "RadarResourceWithRawResponse", + "AsyncRadarResourceWithRawResponse", + "RadarResourceWithStreamingResponse", + "AsyncRadarResourceWithStreamingResponse", + "BotManagementResource", + "AsyncBotManagementResource", + "BotManagementResourceWithRawResponse", + "AsyncBotManagementResourceWithRawResponse", + "BotManagementResourceWithStreamingResponse", + "AsyncBotManagementResourceWithStreamingResponse", + "OriginPostQuantumEncryptionResource", + "AsyncOriginPostQuantumEncryptionResource", + "OriginPostQuantumEncryptionResourceWithRawResponse", + "AsyncOriginPostQuantumEncryptionResourceWithRawResponse", + "OriginPostQuantumEncryptionResourceWithStreamingResponse", + "AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse", + "SpeedResource", + "AsyncSpeedResource", + "SpeedResourceWithRawResponse", + "AsyncSpeedResourceWithRawResponse", + "SpeedResourceWithStreamingResponse", + "AsyncSpeedResourceWithStreamingResponse", + "DCVDelegationResource", + "AsyncDCVDelegationResource", + "DCVDelegationResourceWithRawResponse", + "AsyncDCVDelegationResourceWithRawResponse", + "DCVDelegationResourceWithStreamingResponse", + "AsyncDCVDelegationResourceWithStreamingResponse", + "HostnamesResource", + "AsyncHostnamesResource", + "HostnamesResourceWithRawResponse", + "AsyncHostnamesResourceWithRawResponse", + "HostnamesResourceWithStreamingResponse", + "AsyncHostnamesResourceWithStreamingResponse", + "SnippetsResource", + "AsyncSnippetsResource", + "SnippetsResourceWithRawResponse", + "AsyncSnippetsResourceWithRawResponse", + "SnippetsResourceWithStreamingResponse", + "AsyncSnippetsResourceWithStreamingResponse", + "CallsResource", + "AsyncCallsResource", + "CallsResourceWithRawResponse", + "AsyncCallsResourceWithRawResponse", + "CallsResourceWithStreamingResponse", + "AsyncCallsResourceWithStreamingResponse", + "CloudforceOneResource", + "AsyncCloudforceOneResource", + "CloudforceOneResourceWithRawResponse", + "AsyncCloudforceOneResourceWithRawResponse", + "CloudforceOneResourceWithStreamingResponse", + "AsyncCloudforceOneResourceWithStreamingResponse", + "EventNotificationsResource", + "AsyncEventNotificationsResource", + "EventNotificationsResourceWithRawResponse", + "AsyncEventNotificationsResourceWithRawResponse", + "EventNotificationsResourceWithStreamingResponse", + "AsyncEventNotificationsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/accounts/__init__.py b/src/cloudflare/resources/accounts/__init__.py index 3425c5347c0..4e9d5ed34dd 100644 --- a/src/cloudflare/resources/accounts/__init__.py +++ b/src/cloudflare/resources/accounts/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .roles import ( - Roles, - AsyncRoles, - RolesWithRawResponse, - AsyncRolesWithRawResponse, - RolesWithStreamingResponse, - AsyncRolesWithStreamingResponse, + RolesResource, + AsyncRolesResource, + RolesResourceWithRawResponse, + AsyncRolesResourceWithRawResponse, + RolesResourceWithStreamingResponse, + AsyncRolesResourceWithStreamingResponse, ) from .members import ( - Members, - AsyncMembers, - MembersWithRawResponse, - AsyncMembersWithRawResponse, - MembersWithStreamingResponse, - AsyncMembersWithStreamingResponse, + MembersResource, + AsyncMembersResource, + MembersResourceWithRawResponse, + AsyncMembersResourceWithRawResponse, + MembersResourceWithStreamingResponse, + AsyncMembersResourceWithStreamingResponse, ) from .accounts import ( - Accounts, - AsyncAccounts, - AccountsWithRawResponse, - AsyncAccountsWithRawResponse, - AccountsWithStreamingResponse, - AsyncAccountsWithStreamingResponse, + AccountsResource, + AsyncAccountsResource, + AccountsResourceWithRawResponse, + AsyncAccountsResourceWithRawResponse, + AccountsResourceWithStreamingResponse, + AsyncAccountsResourceWithStreamingResponse, ) __all__ = [ - "Members", - "AsyncMembers", - "MembersWithRawResponse", - "AsyncMembersWithRawResponse", - "MembersWithStreamingResponse", - "AsyncMembersWithStreamingResponse", - "Roles", - "AsyncRoles", - "RolesWithRawResponse", - "AsyncRolesWithRawResponse", - "RolesWithStreamingResponse", - "AsyncRolesWithStreamingResponse", - "Accounts", - "AsyncAccounts", - "AccountsWithRawResponse", - "AsyncAccountsWithRawResponse", - "AccountsWithStreamingResponse", - "AsyncAccountsWithStreamingResponse", + "MembersResource", + "AsyncMembersResource", + "MembersResourceWithRawResponse", + "AsyncMembersResourceWithRawResponse", + "MembersResourceWithStreamingResponse", + "AsyncMembersResourceWithStreamingResponse", + "RolesResource", + "AsyncRolesResource", + "RolesResourceWithRawResponse", + "AsyncRolesResourceWithRawResponse", + "RolesResourceWithStreamingResponse", + "AsyncRolesResourceWithStreamingResponse", + "AccountsResource", + "AsyncAccountsResource", + "AccountsResourceWithRawResponse", + "AsyncAccountsResourceWithRawResponse", + "AccountsResourceWithStreamingResponse", + "AsyncAccountsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/accounts/accounts.py b/src/cloudflare/resources/accounts/accounts.py index 3518f488a3d..f2778f600c0 100644 --- a/src/cloudflare/resources/accounts/accounts.py +++ b/src/cloudflare/resources/accounts/accounts.py @@ -8,26 +8,20 @@ import httpx from .roles import ( - Roles, - AsyncRoles, - RolesWithRawResponse, - AsyncRolesWithRawResponse, - RolesWithStreamingResponse, - AsyncRolesWithStreamingResponse, -) -from ...types import ( - AccountGetResponse, - AccountUpdateResponse, - account_list_params, - account_update_params, + RolesResource, + AsyncRolesResource, + RolesResourceWithRawResponse, + AsyncRolesResourceWithRawResponse, + RolesResourceWithStreamingResponse, + AsyncRolesResourceWithStreamingResponse, ) from .members import ( - Members, - AsyncMembers, - MembersWithRawResponse, - AsyncMembersWithRawResponse, - MembersWithStreamingResponse, - AsyncMembersWithStreamingResponse, + MembersResource, + AsyncMembersResource, + MembersResourceWithRawResponse, + AsyncMembersResourceWithRawResponse, + MembersResourceWithStreamingResponse, + AsyncMembersResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( @@ -48,26 +42,29 @@ AsyncPaginator, make_request_options, ) +from ...types.accounts import account_list_params, account_update_params +from ...types.accounts.account_get_response import AccountGetResponse +from ...types.accounts.account_update_response import AccountUpdateResponse -__all__ = ["Accounts", "AsyncAccounts"] +__all__ = ["AccountsResource", "AsyncAccountsResource"] -class Accounts(SyncAPIResource): +class AccountsResource(SyncAPIResource): @cached_property - def members(self) -> Members: - return Members(self._client) + def members(self) -> MembersResource: + return MembersResource(self._client) @cached_property - def roles(self) -> Roles: - return Roles(self._client) + def roles(self) -> RolesResource: + return RolesResource(self._client) @cached_property - def with_raw_response(self) -> AccountsWithRawResponse: - return AccountsWithRawResponse(self) + def with_raw_response(self) -> AccountsResourceWithRawResponse: + return AccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountsWithStreamingResponse: - return AccountsWithStreamingResponse(self) + def with_streaming_response(self) -> AccountsResourceWithStreamingResponse: + return AccountsResourceWithStreamingResponse(self) def update( self, @@ -114,7 +111,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccountUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccountUpdateResponse] @@ -126,6 +123,7 @@ def list( self, *, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -141,6 +139,8 @@ def list( Args: direction: Direction to order results. + name: Name of the account. + page: Page number of paginated results. per_page: Maximum number of results per page. @@ -164,6 +164,7 @@ def list( query=maybe_transform( { "direction": direction, + "name": name, "page": page, "per_page": per_page, }, @@ -205,7 +206,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccountGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccountGetResponse] @@ -214,22 +215,22 @@ def get( ) -class AsyncAccounts(AsyncAPIResource): +class AsyncAccountsResource(AsyncAPIResource): @cached_property - def members(self) -> AsyncMembers: - return AsyncMembers(self._client) + def members(self) -> AsyncMembersResource: + return AsyncMembersResource(self._client) @cached_property - def roles(self) -> AsyncRoles: - return AsyncRoles(self._client) + def roles(self) -> AsyncRolesResource: + return AsyncRolesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAccountsWithRawResponse: - return AsyncAccountsWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: + return AsyncAccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountsWithStreamingResponse: - return AsyncAccountsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountsResourceWithStreamingResponse: + return AsyncAccountsResourceWithStreamingResponse(self) async def update( self, @@ -276,7 +277,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccountUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccountUpdateResponse] @@ -288,6 +289,7 @@ def list( self, *, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -303,6 +305,8 @@ def list( Args: direction: Direction to order results. + name: Name of the account. + page: Page number of paginated results. per_page: Maximum number of results per page. @@ -326,6 +330,7 @@ def list( query=maybe_transform( { "direction": direction, + "name": name, "page": page, "per_page": per_page, }, @@ -367,7 +372,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccountGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccountGetResponse] @@ -376,8 +381,8 @@ async def get( ) -class AccountsWithRawResponse: - def __init__(self, accounts: Accounts) -> None: +class AccountsResourceWithRawResponse: + def __init__(self, accounts: AccountsResource) -> None: self._accounts = accounts self.update = to_raw_response_wrapper( @@ -391,16 +396,16 @@ def __init__(self, accounts: Accounts) -> None: ) @cached_property - def members(self) -> MembersWithRawResponse: - return MembersWithRawResponse(self._accounts.members) + def members(self) -> MembersResourceWithRawResponse: + return MembersResourceWithRawResponse(self._accounts.members) @cached_property - def roles(self) -> RolesWithRawResponse: - return RolesWithRawResponse(self._accounts.roles) + def roles(self) -> RolesResourceWithRawResponse: + return RolesResourceWithRawResponse(self._accounts.roles) -class AsyncAccountsWithRawResponse: - def __init__(self, accounts: AsyncAccounts) -> None: +class AsyncAccountsResourceWithRawResponse: + def __init__(self, accounts: AsyncAccountsResource) -> None: self._accounts = accounts self.update = async_to_raw_response_wrapper( @@ -414,16 +419,16 @@ def __init__(self, accounts: AsyncAccounts) -> None: ) @cached_property - def members(self) -> AsyncMembersWithRawResponse: - return AsyncMembersWithRawResponse(self._accounts.members) + def members(self) -> AsyncMembersResourceWithRawResponse: + return AsyncMembersResourceWithRawResponse(self._accounts.members) @cached_property - def roles(self) -> AsyncRolesWithRawResponse: - return AsyncRolesWithRawResponse(self._accounts.roles) + def roles(self) -> AsyncRolesResourceWithRawResponse: + return AsyncRolesResourceWithRawResponse(self._accounts.roles) -class AccountsWithStreamingResponse: - def __init__(self, accounts: Accounts) -> None: +class AccountsResourceWithStreamingResponse: + def __init__(self, accounts: AccountsResource) -> None: self._accounts = accounts self.update = to_streamed_response_wrapper( @@ -437,16 +442,16 @@ def __init__(self, accounts: Accounts) -> None: ) @cached_property - def members(self) -> MembersWithStreamingResponse: - return MembersWithStreamingResponse(self._accounts.members) + def members(self) -> MembersResourceWithStreamingResponse: + return MembersResourceWithStreamingResponse(self._accounts.members) @cached_property - def roles(self) -> RolesWithStreamingResponse: - return RolesWithStreamingResponse(self._accounts.roles) + def roles(self) -> RolesResourceWithStreamingResponse: + return RolesResourceWithStreamingResponse(self._accounts.roles) -class AsyncAccountsWithStreamingResponse: - def __init__(self, accounts: AsyncAccounts) -> None: +class AsyncAccountsResourceWithStreamingResponse: + def __init__(self, accounts: AsyncAccountsResource) -> None: self._accounts = accounts self.update = async_to_streamed_response_wrapper( @@ -460,9 +465,9 @@ def __init__(self, accounts: AsyncAccounts) -> None: ) @cached_property - def members(self) -> AsyncMembersWithStreamingResponse: - return AsyncMembersWithStreamingResponse(self._accounts.members) + def members(self) -> AsyncMembersResourceWithStreamingResponse: + return AsyncMembersResourceWithStreamingResponse(self._accounts.members) @cached_property - def roles(self) -> AsyncRolesWithStreamingResponse: - return AsyncRolesWithStreamingResponse(self._accounts.roles) + def roles(self) -> AsyncRolesResourceWithStreamingResponse: + return AsyncRolesResourceWithStreamingResponse(self._accounts.roles) diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py index d3a414d4032..487213e8949 100644 --- a/src/cloudflare/resources/accounts/members.py +++ b/src/cloudflare/resources/accounts/members.py @@ -26,27 +26,23 @@ AsyncPaginator, make_request_options, ) -from ...types.accounts import ( - AccountMember, - MemberListResponse, - AccountMemberWithID, - MemberDeleteResponse, - member_list_params, - member_create_params, - member_update_params, -) +from ...types.accounts import member_list_params, member_create_params, member_delete_params, member_update_params +from ...types.shared.member import Member +from ...types.accounts.member_list_response import MemberListResponse +from ...types.accounts.user_with_invite_code import UserWithInviteCode +from ...types.accounts.member_delete_response import MemberDeleteResponse -__all__ = ["Members", "AsyncMembers"] +__all__ = ["MembersResource", "AsyncMembersResource"] -class Members(SyncAPIResource): +class MembersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MembersWithRawResponse: - return MembersWithRawResponse(self) + def with_raw_response(self) -> MembersResourceWithRawResponse: + return MembersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MembersWithStreamingResponse: - return MembersWithStreamingResponse(self) + def with_streaming_response(self) -> MembersResourceWithStreamingResponse: + return MembersResourceWithStreamingResponse(self) def create( self, @@ -61,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountMemberWithID: + ) -> UserWithInviteCode: """ Add a user to the list of members for this account. @@ -93,9 +89,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UserWithInviteCode]._unwrapper, ), - cast_to=cast(Type[AccountMemberWithID], ResultWrapper[AccountMemberWithID]), + cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]), ) def update( @@ -110,7 +106,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountMember: + ) -> Member: """ Modify an account member. @@ -137,9 +133,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Member]._unwrapper, ), - cast_to=cast(Type[AccountMember], ResultWrapper[AccountMember]), + cast_to=cast(Type[Member], ResultWrapper[Member]), ) def list( @@ -207,6 +203,7 @@ def delete( member_id: str, *, account_id: object, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -232,12 +229,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( f"/accounts/{account_id}/members/{member_id}", + body=maybe_transform(body, member_delete_params.MemberDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MemberDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[MemberDeleteResponse]], ResultWrapper[MemberDeleteResponse]), ) @@ -253,7 +251,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountMember: + ) -> Member: """ Get information about a specific member of an account. @@ -277,20 +275,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Member]._unwrapper, ), - cast_to=cast(Type[AccountMember], ResultWrapper[AccountMember]), + cast_to=cast(Type[Member], ResultWrapper[Member]), ) -class AsyncMembers(AsyncAPIResource): +class AsyncMembersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMembersWithRawResponse: - return AsyncMembersWithRawResponse(self) + def with_raw_response(self) -> AsyncMembersResourceWithRawResponse: + return AsyncMembersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMembersWithStreamingResponse: - return AsyncMembersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMembersResourceWithStreamingResponse: + return AsyncMembersResourceWithStreamingResponse(self) async def create( self, @@ -305,7 +303,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountMemberWithID: + ) -> UserWithInviteCode: """ Add a user to the list of members for this account. @@ -337,9 +335,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UserWithInviteCode]._unwrapper, ), - cast_to=cast(Type[AccountMemberWithID], ResultWrapper[AccountMemberWithID]), + cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]), ) async def update( @@ -354,7 +352,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountMember: + ) -> Member: """ Modify an account member. @@ -381,9 +379,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Member]._unwrapper, ), - cast_to=cast(Type[AccountMember], ResultWrapper[AccountMember]), + cast_to=cast(Type[Member], ResultWrapper[Member]), ) def list( @@ -451,6 +449,7 @@ async def delete( member_id: str, *, account_id: object, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -476,12 +475,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( f"/accounts/{account_id}/members/{member_id}", + body=await async_maybe_transform(body, member_delete_params.MemberDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MemberDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[MemberDeleteResponse]], ResultWrapper[MemberDeleteResponse]), ) @@ -497,7 +497,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountMember: + ) -> Member: """ Get information about a specific member of an account. @@ -521,14 +521,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Member]._unwrapper, ), - cast_to=cast(Type[AccountMember], ResultWrapper[AccountMember]), + cast_to=cast(Type[Member], ResultWrapper[Member]), ) -class MembersWithRawResponse: - def __init__(self, members: Members) -> None: +class MembersResourceWithRawResponse: + def __init__(self, members: MembersResource) -> None: self._members = members self.create = to_raw_response_wrapper( @@ -548,8 +548,8 @@ def __init__(self, members: Members) -> None: ) -class AsyncMembersWithRawResponse: - def __init__(self, members: AsyncMembers) -> None: +class AsyncMembersResourceWithRawResponse: + def __init__(self, members: AsyncMembersResource) -> None: self._members = members self.create = async_to_raw_response_wrapper( @@ -569,8 +569,8 @@ def __init__(self, members: AsyncMembers) -> None: ) -class MembersWithStreamingResponse: - def __init__(self, members: Members) -> None: +class MembersResourceWithStreamingResponse: + def __init__(self, members: MembersResource) -> None: self._members = members self.create = to_streamed_response_wrapper( @@ -590,8 +590,8 @@ def __init__(self, members: Members) -> None: ) -class AsyncMembersWithStreamingResponse: - def __init__(self, members: AsyncMembers) -> None: +class AsyncMembersResourceWithStreamingResponse: + def __init__(self, members: AsyncMembersResource) -> None: self._members = members self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/accounts/roles.py b/src/cloudflare/resources/accounts/roles.py index 0bfc6405723..35a5ac1b607 100644 --- a/src/cloudflare/resources/accounts/roles.py +++ b/src/cloudflare/resources/accounts/roles.py @@ -21,19 +21,20 @@ AsyncPaginator, make_request_options, ) -from ...types.accounts import Role, RoleGetResponse +from ...types.shared.role import Role +from ...types.accounts.role_get_response import RoleGetResponse -__all__ = ["Roles", "AsyncRoles"] +__all__ = ["RolesResource", "AsyncRolesResource"] -class Roles(SyncAPIResource): +class RolesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RolesWithRawResponse: - return RolesWithRawResponse(self) + def with_raw_response(self) -> RolesResourceWithRawResponse: + return RolesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RolesWithStreamingResponse: - return RolesWithStreamingResponse(self) + def with_streaming_response(self) -> RolesResourceWithStreamingResponse: + return RolesResourceWithStreamingResponse(self) def list( self, @@ -100,7 +101,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RoleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RoleGetResponse] @@ -109,14 +110,14 @@ def get( ) -class AsyncRoles(AsyncAPIResource): +class AsyncRolesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRolesWithRawResponse: - return AsyncRolesWithRawResponse(self) + def with_raw_response(self) -> AsyncRolesResourceWithRawResponse: + return AsyncRolesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRolesWithStreamingResponse: - return AsyncRolesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRolesResourceWithStreamingResponse: + return AsyncRolesResourceWithStreamingResponse(self) def list( self, @@ -183,7 +184,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RoleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RoleGetResponse] @@ -192,8 +193,8 @@ async def get( ) -class RolesWithRawResponse: - def __init__(self, roles: Roles) -> None: +class RolesResourceWithRawResponse: + def __init__(self, roles: RolesResource) -> None: self._roles = roles self.list = to_raw_response_wrapper( @@ -204,8 +205,8 @@ def __init__(self, roles: Roles) -> None: ) -class AsyncRolesWithRawResponse: - def __init__(self, roles: AsyncRoles) -> None: +class AsyncRolesResourceWithRawResponse: + def __init__(self, roles: AsyncRolesResource) -> None: self._roles = roles self.list = async_to_raw_response_wrapper( @@ -216,8 +217,8 @@ def __init__(self, roles: AsyncRoles) -> None: ) -class RolesWithStreamingResponse: - def __init__(self, roles: Roles) -> None: +class RolesResourceWithStreamingResponse: + def __init__(self, roles: RolesResource) -> None: self._roles = roles self.list = to_streamed_response_wrapper( @@ -228,8 +229,8 @@ def __init__(self, roles: Roles) -> None: ) -class AsyncRolesWithStreamingResponse: - def __init__(self, roles: AsyncRoles) -> None: +class AsyncRolesResourceWithStreamingResponse: + def __init__(self, roles: AsyncRolesResource) -> None: self._roles = roles self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/acm/__init__.py b/src/cloudflare/resources/acm/__init__.py index 6853040a532..ed969a286c5 100644 --- a/src/cloudflare/resources/acm/__init__.py +++ b/src/cloudflare/resources/acm/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .acm import ( - ACM, - AsyncACM, - ACMWithRawResponse, - AsyncACMWithRawResponse, - ACMWithStreamingResponse, - AsyncACMWithStreamingResponse, + ACMResource, + AsyncACMResource, + ACMResourceWithRawResponse, + AsyncACMResourceWithRawResponse, + ACMResourceWithStreamingResponse, + AsyncACMResourceWithStreamingResponse, ) from .total_tls import ( - TotalTLS, - AsyncTotalTLS, - TotalTLSWithRawResponse, - AsyncTotalTLSWithRawResponse, - TotalTLSWithStreamingResponse, - AsyncTotalTLSWithStreamingResponse, + TotalTLSResource, + AsyncTotalTLSResource, + TotalTLSResourceWithRawResponse, + AsyncTotalTLSResourceWithRawResponse, + TotalTLSResourceWithStreamingResponse, + AsyncTotalTLSResourceWithStreamingResponse, ) __all__ = [ - "TotalTLS", - "AsyncTotalTLS", - "TotalTLSWithRawResponse", - "AsyncTotalTLSWithRawResponse", - "TotalTLSWithStreamingResponse", - "AsyncTotalTLSWithStreamingResponse", - "ACM", - "AsyncACM", - "ACMWithRawResponse", - "AsyncACMWithRawResponse", - "ACMWithStreamingResponse", - "AsyncACMWithStreamingResponse", + "TotalTLSResource", + "AsyncTotalTLSResource", + "TotalTLSResourceWithRawResponse", + "AsyncTotalTLSResourceWithRawResponse", + "TotalTLSResourceWithStreamingResponse", + "AsyncTotalTLSResourceWithStreamingResponse", + "ACMResource", + "AsyncACMResource", + "ACMResourceWithRawResponse", + "AsyncACMResourceWithRawResponse", + "ACMResourceWithStreamingResponse", + "AsyncACMResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/acm/acm.py b/src/cloudflare/resources/acm/acm.py index 59f0468eb3b..ad401c45360 100644 --- a/src/cloudflare/resources/acm/acm.py +++ b/src/cloudflare/resources/acm/acm.py @@ -4,77 +4,77 @@ from ..._compat import cached_property from .total_tls import ( - TotalTLS, - AsyncTotalTLS, - TotalTLSWithRawResponse, - AsyncTotalTLSWithRawResponse, - TotalTLSWithStreamingResponse, - AsyncTotalTLSWithStreamingResponse, + TotalTLSResource, + AsyncTotalTLSResource, + TotalTLSResourceWithRawResponse, + AsyncTotalTLSResourceWithRawResponse, + TotalTLSResourceWithStreamingResponse, + AsyncTotalTLSResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["ACM", "AsyncACM"] +__all__ = ["ACMResource", "AsyncACMResource"] -class ACM(SyncAPIResource): +class ACMResource(SyncAPIResource): @cached_property - def total_tls(self) -> TotalTLS: - return TotalTLS(self._client) + def total_tls(self) -> TotalTLSResource: + return TotalTLSResource(self._client) @cached_property - def with_raw_response(self) -> ACMWithRawResponse: - return ACMWithRawResponse(self) + def with_raw_response(self) -> ACMResourceWithRawResponse: + return ACMResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ACMWithStreamingResponse: - return ACMWithStreamingResponse(self) + def with_streaming_response(self) -> ACMResourceWithStreamingResponse: + return ACMResourceWithStreamingResponse(self) -class AsyncACM(AsyncAPIResource): +class AsyncACMResource(AsyncAPIResource): @cached_property - def total_tls(self) -> AsyncTotalTLS: - return AsyncTotalTLS(self._client) + def total_tls(self) -> AsyncTotalTLSResource: + return AsyncTotalTLSResource(self._client) @cached_property - def with_raw_response(self) -> AsyncACMWithRawResponse: - return AsyncACMWithRawResponse(self) + def with_raw_response(self) -> AsyncACMResourceWithRawResponse: + return AsyncACMResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncACMWithStreamingResponse: - return AsyncACMWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncACMResourceWithStreamingResponse: + return AsyncACMResourceWithStreamingResponse(self) -class ACMWithRawResponse: - def __init__(self, acm: ACM) -> None: +class ACMResourceWithRawResponse: + def __init__(self, acm: ACMResource) -> None: self._acm = acm @cached_property - def total_tls(self) -> TotalTLSWithRawResponse: - return TotalTLSWithRawResponse(self._acm.total_tls) + def total_tls(self) -> TotalTLSResourceWithRawResponse: + return TotalTLSResourceWithRawResponse(self._acm.total_tls) -class AsyncACMWithRawResponse: - def __init__(self, acm: AsyncACM) -> None: +class AsyncACMResourceWithRawResponse: + def __init__(self, acm: AsyncACMResource) -> None: self._acm = acm @cached_property - def total_tls(self) -> AsyncTotalTLSWithRawResponse: - return AsyncTotalTLSWithRawResponse(self._acm.total_tls) + def total_tls(self) -> AsyncTotalTLSResourceWithRawResponse: + return AsyncTotalTLSResourceWithRawResponse(self._acm.total_tls) -class ACMWithStreamingResponse: - def __init__(self, acm: ACM) -> None: +class ACMResourceWithStreamingResponse: + def __init__(self, acm: ACMResource) -> None: self._acm = acm @cached_property - def total_tls(self) -> TotalTLSWithStreamingResponse: - return TotalTLSWithStreamingResponse(self._acm.total_tls) + def total_tls(self) -> TotalTLSResourceWithStreamingResponse: + return TotalTLSResourceWithStreamingResponse(self._acm.total_tls) -class AsyncACMWithStreamingResponse: - def __init__(self, acm: AsyncACM) -> None: +class AsyncACMResourceWithStreamingResponse: + def __init__(self, acm: AsyncACMResource) -> None: self._acm = acm @cached_property - def total_tls(self) -> AsyncTotalTLSWithStreamingResponse: - return AsyncTotalTLSWithStreamingResponse(self._acm.total_tls) + def total_tls(self) -> AsyncTotalTLSResourceWithStreamingResponse: + return AsyncTotalTLSResourceWithStreamingResponse(self._acm.total_tls) diff --git a/src/cloudflare/resources/acm/total_tls.py b/src/cloudflare/resources/acm/total_tls.py index ad2a1361603..4795b7d6275 100644 --- a/src/cloudflare/resources/acm/total_tls.py +++ b/src/cloudflare/resources/acm/total_tls.py @@ -21,22 +21,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.acm import TotalTLSGetResponse, TotalTLSCreateResponse, total_tls_create_params +from ...types.acm import total_tls_create_params from ..._base_client import ( make_request_options, ) +from ...types.acm.total_tls_get_response import TotalTLSGetResponse +from ...types.acm.total_tls_create_response import TotalTLSCreateResponse -__all__ = ["TotalTLS", "AsyncTotalTLS"] +__all__ = ["TotalTLSResource", "AsyncTotalTLSResource"] -class TotalTLS(SyncAPIResource): +class TotalTLSResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TotalTLSWithRawResponse: - return TotalTLSWithRawResponse(self) + def with_raw_response(self) -> TotalTLSResourceWithRawResponse: + return TotalTLSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TotalTLSWithStreamingResponse: - return TotalTLSWithStreamingResponse(self) + def with_streaming_response(self) -> TotalTLSResourceWithStreamingResponse: + return TotalTLSResourceWithStreamingResponse(self) def create( self, @@ -86,7 +88,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TotalTLSCreateResponse]._unwrapper, ), cast_to=cast(Type[TotalTLSCreateResponse], ResultWrapper[TotalTLSCreateResponse]), ) @@ -125,20 +127,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TotalTLSGetResponse]._unwrapper, ), cast_to=cast(Type[TotalTLSGetResponse], ResultWrapper[TotalTLSGetResponse]), ) -class AsyncTotalTLS(AsyncAPIResource): +class AsyncTotalTLSResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTotalTLSWithRawResponse: - return AsyncTotalTLSWithRawResponse(self) + def with_raw_response(self) -> AsyncTotalTLSResourceWithRawResponse: + return AsyncTotalTLSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTotalTLSWithStreamingResponse: - return AsyncTotalTLSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTotalTLSResourceWithStreamingResponse: + return AsyncTotalTLSResourceWithStreamingResponse(self) async def create( self, @@ -188,7 +190,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TotalTLSCreateResponse]._unwrapper, ), cast_to=cast(Type[TotalTLSCreateResponse], ResultWrapper[TotalTLSCreateResponse]), ) @@ -227,14 +229,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TotalTLSGetResponse]._unwrapper, ), cast_to=cast(Type[TotalTLSGetResponse], ResultWrapper[TotalTLSGetResponse]), ) -class TotalTLSWithRawResponse: - def __init__(self, total_tls: TotalTLS) -> None: +class TotalTLSResourceWithRawResponse: + def __init__(self, total_tls: TotalTLSResource) -> None: self._total_tls = total_tls self.create = to_raw_response_wrapper( @@ -245,8 +247,8 @@ def __init__(self, total_tls: TotalTLS) -> None: ) -class AsyncTotalTLSWithRawResponse: - def __init__(self, total_tls: AsyncTotalTLS) -> None: +class AsyncTotalTLSResourceWithRawResponse: + def __init__(self, total_tls: AsyncTotalTLSResource) -> None: self._total_tls = total_tls self.create = async_to_raw_response_wrapper( @@ -257,8 +259,8 @@ def __init__(self, total_tls: AsyncTotalTLS) -> None: ) -class TotalTLSWithStreamingResponse: - def __init__(self, total_tls: TotalTLS) -> None: +class TotalTLSResourceWithStreamingResponse: + def __init__(self, total_tls: TotalTLSResource) -> None: self._total_tls = total_tls self.create = to_streamed_response_wrapper( @@ -269,8 +271,8 @@ def __init__(self, total_tls: TotalTLS) -> None: ) -class AsyncTotalTLSWithStreamingResponse: - def __init__(self, total_tls: AsyncTotalTLS) -> None: +class AsyncTotalTLSResourceWithStreamingResponse: + def __init__(self, total_tls: AsyncTotalTLSResource) -> None: self._total_tls = total_tls self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/__init__.py b/src/cloudflare/resources/addressing/__init__.py index b8d5272513d..662ac0127d3 100644 --- a/src/cloudflare/resources/addressing/__init__.py +++ b/src/cloudflare/resources/addressing/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .prefixes import ( - Prefixes, - AsyncPrefixes, - PrefixesWithRawResponse, - AsyncPrefixesWithRawResponse, - PrefixesWithStreamingResponse, - AsyncPrefixesWithStreamingResponse, + PrefixesResource, + AsyncPrefixesResource, + PrefixesResourceWithRawResponse, + AsyncPrefixesResourceWithRawResponse, + PrefixesResourceWithStreamingResponse, + AsyncPrefixesResourceWithStreamingResponse, ) from .services import ( - Services, - AsyncServices, - ServicesWithRawResponse, - AsyncServicesWithRawResponse, - ServicesWithStreamingResponse, - AsyncServicesWithStreamingResponse, + ServicesResource, + AsyncServicesResource, + ServicesResourceWithRawResponse, + AsyncServicesResourceWithRawResponse, + ServicesResourceWithStreamingResponse, + AsyncServicesResourceWithStreamingResponse, ) from .addressing import ( - Addressing, - AsyncAddressing, - AddressingWithRawResponse, - AsyncAddressingWithRawResponse, - AddressingWithStreamingResponse, - AsyncAddressingWithStreamingResponse, + AddressingResource, + AsyncAddressingResource, + AddressingResourceWithRawResponse, + AsyncAddressingResourceWithRawResponse, + AddressingResourceWithStreamingResponse, + AsyncAddressingResourceWithStreamingResponse, ) from .address_maps import ( - AddressMaps, - AsyncAddressMaps, - AddressMapsWithRawResponse, - AsyncAddressMapsWithRawResponse, - AddressMapsWithStreamingResponse, - AsyncAddressMapsWithStreamingResponse, + AddressMapsResource, + AsyncAddressMapsResource, + AddressMapsResourceWithRawResponse, + AsyncAddressMapsResourceWithRawResponse, + AddressMapsResourceWithStreamingResponse, + AsyncAddressMapsResourceWithStreamingResponse, ) from .loa_documents import ( - LOADocuments, - AsyncLOADocuments, - LOADocumentsWithRawResponse, - AsyncLOADocumentsWithRawResponse, - LOADocumentsWithStreamingResponse, - AsyncLOADocumentsWithStreamingResponse, + LOADocumentsResource, + AsyncLOADocumentsResource, + LOADocumentsResourceWithRawResponse, + AsyncLOADocumentsResourceWithRawResponse, + LOADocumentsResourceWithStreamingResponse, + AsyncLOADocumentsResourceWithStreamingResponse, ) __all__ = [ - "Services", - "AsyncServices", - "ServicesWithRawResponse", - "AsyncServicesWithRawResponse", - "ServicesWithStreamingResponse", - "AsyncServicesWithStreamingResponse", - "AddressMaps", - "AsyncAddressMaps", - "AddressMapsWithRawResponse", - "AsyncAddressMapsWithRawResponse", - "AddressMapsWithStreamingResponse", - "AsyncAddressMapsWithStreamingResponse", - "LOADocuments", - "AsyncLOADocuments", - "LOADocumentsWithRawResponse", - "AsyncLOADocumentsWithRawResponse", - "LOADocumentsWithStreamingResponse", - "AsyncLOADocumentsWithStreamingResponse", - "Prefixes", - "AsyncPrefixes", - "PrefixesWithRawResponse", - "AsyncPrefixesWithRawResponse", - "PrefixesWithStreamingResponse", - "AsyncPrefixesWithStreamingResponse", - "Addressing", - "AsyncAddressing", - "AddressingWithRawResponse", - "AsyncAddressingWithRawResponse", - "AddressingWithStreamingResponse", - "AsyncAddressingWithStreamingResponse", + "ServicesResource", + "AsyncServicesResource", + "ServicesResourceWithRawResponse", + "AsyncServicesResourceWithRawResponse", + "ServicesResourceWithStreamingResponse", + "AsyncServicesResourceWithStreamingResponse", + "AddressMapsResource", + "AsyncAddressMapsResource", + "AddressMapsResourceWithRawResponse", + "AsyncAddressMapsResourceWithRawResponse", + "AddressMapsResourceWithStreamingResponse", + "AsyncAddressMapsResourceWithStreamingResponse", + "LOADocumentsResource", + "AsyncLOADocumentsResource", + "LOADocumentsResourceWithRawResponse", + "AsyncLOADocumentsResourceWithRawResponse", + "LOADocumentsResourceWithStreamingResponse", + "AsyncLOADocumentsResourceWithStreamingResponse", + "PrefixesResource", + "AsyncPrefixesResource", + "PrefixesResourceWithRawResponse", + "AsyncPrefixesResourceWithRawResponse", + "PrefixesResourceWithStreamingResponse", + "AsyncPrefixesResourceWithStreamingResponse", + "AddressingResource", + "AsyncAddressingResource", + "AddressingResourceWithRawResponse", + "AsyncAddressingResourceWithRawResponse", + "AddressingResourceWithStreamingResponse", + "AsyncAddressingResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/addressing/address_maps/__init__.py b/src/cloudflare/resources/addressing/address_maps/__init__.py index 8cf8d6c46e5..2e3ff1b5938 100644 --- a/src/cloudflare/resources/addressing/address_maps/__init__.py +++ b/src/cloudflare/resources/addressing/address_maps/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .ips import ( - IPs, - AsyncIPs, - IPsWithRawResponse, - AsyncIPsWithRawResponse, - IPsWithStreamingResponse, - AsyncIPsWithStreamingResponse, + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, ) from .zones import ( - Zones, - AsyncZones, - ZonesWithRawResponse, - AsyncZonesWithRawResponse, - ZonesWithStreamingResponse, - AsyncZonesWithStreamingResponse, + ZonesResource, + AsyncZonesResource, + ZonesResourceWithRawResponse, + AsyncZonesResourceWithRawResponse, + ZonesResourceWithStreamingResponse, + AsyncZonesResourceWithStreamingResponse, ) from .accounts import ( - Accounts, - AsyncAccounts, - AccountsWithRawResponse, - AsyncAccountsWithRawResponse, - AccountsWithStreamingResponse, - AsyncAccountsWithStreamingResponse, + AccountsResource, + AsyncAccountsResource, + AccountsResourceWithRawResponse, + AsyncAccountsResourceWithRawResponse, + AccountsResourceWithStreamingResponse, + AsyncAccountsResourceWithStreamingResponse, ) from .address_maps import ( - AddressMaps, - AsyncAddressMaps, - AddressMapsWithRawResponse, - AsyncAddressMapsWithRawResponse, - AddressMapsWithStreamingResponse, - AsyncAddressMapsWithStreamingResponse, + AddressMapsResource, + AsyncAddressMapsResource, + AddressMapsResourceWithRawResponse, + AsyncAddressMapsResourceWithRawResponse, + AddressMapsResourceWithStreamingResponse, + AsyncAddressMapsResourceWithStreamingResponse, ) __all__ = [ - "Accounts", - "AsyncAccounts", - "AccountsWithRawResponse", - "AsyncAccountsWithRawResponse", - "AccountsWithStreamingResponse", - "AsyncAccountsWithStreamingResponse", - "IPs", - "AsyncIPs", - "IPsWithRawResponse", - "AsyncIPsWithRawResponse", - "IPsWithStreamingResponse", - "AsyncIPsWithStreamingResponse", - "Zones", - "AsyncZones", - "ZonesWithRawResponse", - "AsyncZonesWithRawResponse", - "ZonesWithStreamingResponse", - "AsyncZonesWithStreamingResponse", - "AddressMaps", - "AsyncAddressMaps", - "AddressMapsWithRawResponse", - "AsyncAddressMapsWithRawResponse", - "AddressMapsWithStreamingResponse", - "AsyncAddressMapsWithStreamingResponse", + "AccountsResource", + "AsyncAccountsResource", + "AccountsResourceWithRawResponse", + "AsyncAccountsResourceWithRawResponse", + "AccountsResourceWithStreamingResponse", + "AsyncAccountsResourceWithStreamingResponse", + "IPsResource", + "AsyncIPsResource", + "IPsResourceWithRawResponse", + "AsyncIPsResourceWithRawResponse", + "IPsResourceWithStreamingResponse", + "AsyncIPsResourceWithStreamingResponse", + "ZonesResource", + "AsyncZonesResource", + "ZonesResourceWithRawResponse", + "AsyncZonesResourceWithRawResponse", + "ZonesResourceWithStreamingResponse", + "AsyncZonesResourceWithStreamingResponse", + "AddressMapsResource", + "AsyncAddressMapsResource", + "AddressMapsResourceWithRawResponse", + "AsyncAddressMapsResourceWithRawResponse", + "AddressMapsResourceWithStreamingResponse", + "AsyncAddressMapsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/addressing/address_maps/accounts.py b/src/cloudflare/resources/addressing/address_maps/accounts.py index d6811437a37..17d49b29ca7 100644 --- a/src/cloudflare/resources/addressing/address_maps/accounts.py +++ b/src/cloudflare/resources/addressing/address_maps/accounts.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing import Any, Optional, cast +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 ( @@ -19,25 +23,28 @@ from ...._base_client import ( make_request_options, ) -from ....types.addressing.address_maps import AccountDeleteResponse, AccountUpdateResponse +from ....types.addressing.address_maps import account_delete_params, account_update_params +from ....types.addressing.address_maps.account_delete_response import AccountDeleteResponse +from ....types.addressing.address_maps.account_update_response import AccountUpdateResponse -__all__ = ["Accounts", "AsyncAccounts"] +__all__ = ["AccountsResource", "AsyncAccountsResource"] -class Accounts(SyncAPIResource): +class AccountsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountsWithRawResponse: - return AccountsWithRawResponse(self) + def with_raw_response(self) -> AccountsResourceWithRawResponse: + return AccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountsWithStreamingResponse: - return AccountsWithStreamingResponse(self) + def with_streaming_response(self) -> AccountsResourceWithStreamingResponse: + return AccountsResourceWithStreamingResponse(self) def update( self, address_map_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -65,21 +72,17 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AccountUpdateResponse], - self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", + body=maybe_transform(body, account_update_params.AccountUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AccountUpdateResponse]], ResultWrapper[AccountUpdateResponse]), ) def delete( @@ -87,6 +90,7 @@ def delete( address_map_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -114,38 +118,35 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AccountDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", + body=maybe_transform(body, account_delete_params.AccountDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AccountDeleteResponse]], ResultWrapper[AccountDeleteResponse]), ) -class AsyncAccounts(AsyncAPIResource): +class AsyncAccountsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountsWithRawResponse: - return AsyncAccountsWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: + return AsyncAccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountsWithStreamingResponse: - return AsyncAccountsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountsResourceWithStreamingResponse: + return AsyncAccountsResourceWithStreamingResponse(self) async def update( self, address_map_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -173,21 +174,17 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AccountUpdateResponse], - await self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", + body=await async_maybe_transform(body, account_update_params.AccountUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AccountUpdateResponse]], ResultWrapper[AccountUpdateResponse]), ) async def delete( @@ -195,6 +192,7 @@ async def delete( address_map_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -222,26 +220,22 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AccountDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", + body=await async_maybe_transform(body, account_delete_params.AccountDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AccountDeleteResponse]], ResultWrapper[AccountDeleteResponse]), ) -class AccountsWithRawResponse: - def __init__(self, accounts: Accounts) -> None: +class AccountsResourceWithRawResponse: + def __init__(self, accounts: AccountsResource) -> None: self._accounts = accounts self.update = to_raw_response_wrapper( @@ -252,8 +246,8 @@ def __init__(self, accounts: Accounts) -> None: ) -class AsyncAccountsWithRawResponse: - def __init__(self, accounts: AsyncAccounts) -> None: +class AsyncAccountsResourceWithRawResponse: + def __init__(self, accounts: AsyncAccountsResource) -> None: self._accounts = accounts self.update = async_to_raw_response_wrapper( @@ -264,8 +258,8 @@ def __init__(self, accounts: AsyncAccounts) -> None: ) -class AccountsWithStreamingResponse: - def __init__(self, accounts: Accounts) -> None: +class AccountsResourceWithStreamingResponse: + def __init__(self, accounts: AccountsResource) -> None: self._accounts = accounts self.update = to_streamed_response_wrapper( @@ -276,8 +270,8 @@ def __init__(self, accounts: Accounts) -> None: ) -class AsyncAccountsWithStreamingResponse: - def __init__(self, accounts: AsyncAccounts) -> None: +class AsyncAccountsResourceWithStreamingResponse: + def __init__(self, accounts: AsyncAccountsResource) -> None: self._accounts = accounts self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/address_maps/address_maps.py b/src/cloudflare/resources/addressing/address_maps/address_maps.py index f892395f3cc..548ce6e7002 100644 --- a/src/cloudflare/resources/addressing/address_maps/address_maps.py +++ b/src/cloudflare/resources/addressing/address_maps/address_maps.py @@ -2,33 +2,33 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast import httpx from .ips import ( - IPs, - AsyncIPs, - IPsWithRawResponse, - AsyncIPsWithRawResponse, - IPsWithStreamingResponse, - AsyncIPsWithStreamingResponse, + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, ) from .zones import ( - Zones, - AsyncZones, - ZonesWithRawResponse, - AsyncZonesWithRawResponse, - ZonesWithStreamingResponse, - AsyncZonesWithStreamingResponse, + ZonesResource, + AsyncZonesResource, + ZonesResourceWithRawResponse, + AsyncZonesResourceWithRawResponse, + ZonesResourceWithStreamingResponse, + AsyncZonesResourceWithStreamingResponse, ) from .accounts import ( - Accounts, - AsyncAccounts, - AccountsWithRawResponse, - AsyncAccountsWithRawResponse, - AccountsWithStreamingResponse, - AsyncAccountsWithStreamingResponse, + AccountsResource, + AsyncAccountsResource, + AccountsResourceWithRawResponse, + AsyncAccountsResourceWithRawResponse, + AccountsResourceWithStreamingResponse, + AsyncAccountsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -49,38 +49,35 @@ AsyncPaginator, make_request_options, ) -from ....types.addressing import ( - AddressingAddressMaps, - AddressMapGetResponse, - AddressMapCreateResponse, - AddressMapDeleteResponse, - address_map_edit_params, - address_map_create_params, -) +from ....types.addressing import address_map_edit_params, address_map_create_params, address_map_delete_params +from ....types.addressing.address_map import AddressMap +from ....types.addressing.address_map_get_response import AddressMapGetResponse +from ....types.addressing.address_map_create_response import AddressMapCreateResponse +from ....types.addressing.address_map_delete_response import AddressMapDeleteResponse -__all__ = ["AddressMaps", "AsyncAddressMaps"] +__all__ = ["AddressMapsResource", "AsyncAddressMapsResource"] -class AddressMaps(SyncAPIResource): +class AddressMapsResource(SyncAPIResource): @cached_property - def accounts(self) -> Accounts: - return Accounts(self._client) + def accounts(self) -> AccountsResource: + return AccountsResource(self._client) @cached_property - def ips(self) -> IPs: - return IPs(self._client) + def ips(self) -> IPsResource: + return IPsResource(self._client) @cached_property - def zones(self) -> Zones: - return Zones(self._client) + def zones(self) -> ZonesResource: + return ZonesResource(self._client) @cached_property - def with_raw_response(self) -> AddressMapsWithRawResponse: - return AddressMapsWithRawResponse(self) + def with_raw_response(self) -> AddressMapsResourceWithRawResponse: + return AddressMapsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AddressMapsWithStreamingResponse: - return AddressMapsWithStreamingResponse(self) + def with_streaming_response(self) -> AddressMapsResourceWithStreamingResponse: + return AddressMapsResourceWithStreamingResponse(self) def create( self, @@ -94,7 +91,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMapCreateResponse: + ) -> Optional[AddressMapCreateResponse]: """ Create a new address map under the account. @@ -131,9 +128,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AddressMapCreateResponse]]._unwrapper, ), - cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]), + cast_to=cast(Type[Optional[AddressMapCreateResponse]], ResultWrapper[AddressMapCreateResponse]), ) def list( @@ -146,7 +143,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AddressingAddressMaps]: + ) -> SyncSinglePage[AddressMap]: """ List all address maps owned by the account. @@ -165,11 +162,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/address_maps", - page=SyncSinglePage[AddressingAddressMaps], + page=SyncSinglePage[AddressMap], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingAddressMaps, + model=AddressMap, ) def delete( @@ -177,6 +174,7 @@ def delete( address_map_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,21 +204,17 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AddressMapDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AddressMapDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}", + body=maybe_transform(body, address_map_delete_params.AddressMapDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AddressMapDeleteResponse]], ResultWrapper[AddressMapDeleteResponse]), ) def edit( @@ -237,7 +231,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingAddressMaps: + ) -> Optional[AddressMap]: """ Modify properties of an address map owned by the account. @@ -285,9 +279,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AddressMap]]._unwrapper, ), - cast_to=cast(Type[AddressingAddressMaps], ResultWrapper[AddressingAddressMaps]), + cast_to=cast(Type[Optional[AddressMap]], ResultWrapper[AddressMap]), ) def get( @@ -301,7 +295,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMapGetResponse: + ) -> Optional[AddressMapGetResponse]: """ Show a particular address map owned by the account. @@ -329,32 +323,32 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AddressMapGetResponse]]._unwrapper, ), - cast_to=cast(Type[AddressMapGetResponse], ResultWrapper[AddressMapGetResponse]), + cast_to=cast(Type[Optional[AddressMapGetResponse]], ResultWrapper[AddressMapGetResponse]), ) -class AsyncAddressMaps(AsyncAPIResource): +class AsyncAddressMapsResource(AsyncAPIResource): @cached_property - def accounts(self) -> AsyncAccounts: - return AsyncAccounts(self._client) + def accounts(self) -> AsyncAccountsResource: + return AsyncAccountsResource(self._client) @cached_property - def ips(self) -> AsyncIPs: - return AsyncIPs(self._client) + def ips(self) -> AsyncIPsResource: + return AsyncIPsResource(self._client) @cached_property - def zones(self) -> AsyncZones: - return AsyncZones(self._client) + def zones(self) -> AsyncZonesResource: + return AsyncZonesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAddressMapsWithRawResponse: - return AsyncAddressMapsWithRawResponse(self) + def with_raw_response(self) -> AsyncAddressMapsResourceWithRawResponse: + return AsyncAddressMapsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAddressMapsWithStreamingResponse: - return AsyncAddressMapsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAddressMapsResourceWithStreamingResponse: + return AsyncAddressMapsResourceWithStreamingResponse(self) async def create( self, @@ -368,7 +362,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMapCreateResponse: + ) -> Optional[AddressMapCreateResponse]: """ Create a new address map under the account. @@ -405,9 +399,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AddressMapCreateResponse]]._unwrapper, ), - cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]), + cast_to=cast(Type[Optional[AddressMapCreateResponse]], ResultWrapper[AddressMapCreateResponse]), ) def list( @@ -420,7 +414,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AddressingAddressMaps, AsyncSinglePage[AddressingAddressMaps]]: + ) -> AsyncPaginator[AddressMap, AsyncSinglePage[AddressMap]]: """ List all address maps owned by the account. @@ -439,11 +433,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/address_maps", - page=AsyncSinglePage[AddressingAddressMaps], + page=AsyncSinglePage[AddressMap], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingAddressMaps, + model=AddressMap, ) async def delete( @@ -451,6 +445,7 @@ async def delete( address_map_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -480,21 +475,17 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AddressMapDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AddressMapDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}", + body=await async_maybe_transform(body, address_map_delete_params.AddressMapDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AddressMapDeleteResponse]], ResultWrapper[AddressMapDeleteResponse]), ) async def edit( @@ -511,7 +502,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingAddressMaps: + ) -> Optional[AddressMap]: """ Modify properties of an address map owned by the account. @@ -559,9 +550,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AddressMap]]._unwrapper, ), - cast_to=cast(Type[AddressingAddressMaps], ResultWrapper[AddressingAddressMaps]), + cast_to=cast(Type[Optional[AddressMap]], ResultWrapper[AddressMap]), ) async def get( @@ -575,7 +566,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMapGetResponse: + ) -> Optional[AddressMapGetResponse]: """ Show a particular address map owned by the account. @@ -603,14 +594,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AddressMapGetResponse]]._unwrapper, ), - cast_to=cast(Type[AddressMapGetResponse], ResultWrapper[AddressMapGetResponse]), + cast_to=cast(Type[Optional[AddressMapGetResponse]], ResultWrapper[AddressMapGetResponse]), ) -class AddressMapsWithRawResponse: - def __init__(self, address_maps: AddressMaps) -> None: +class AddressMapsResourceWithRawResponse: + def __init__(self, address_maps: AddressMapsResource) -> None: self._address_maps = address_maps self.create = to_raw_response_wrapper( @@ -630,20 +621,20 @@ def __init__(self, address_maps: AddressMaps) -> None: ) @cached_property - def accounts(self) -> AccountsWithRawResponse: - return AccountsWithRawResponse(self._address_maps.accounts) + def accounts(self) -> AccountsResourceWithRawResponse: + return AccountsResourceWithRawResponse(self._address_maps.accounts) @cached_property - def ips(self) -> IPsWithRawResponse: - return IPsWithRawResponse(self._address_maps.ips) + def ips(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self._address_maps.ips) @cached_property - def zones(self) -> ZonesWithRawResponse: - return ZonesWithRawResponse(self._address_maps.zones) + def zones(self) -> ZonesResourceWithRawResponse: + return ZonesResourceWithRawResponse(self._address_maps.zones) -class AsyncAddressMapsWithRawResponse: - def __init__(self, address_maps: AsyncAddressMaps) -> None: +class AsyncAddressMapsResourceWithRawResponse: + def __init__(self, address_maps: AsyncAddressMapsResource) -> None: self._address_maps = address_maps self.create = async_to_raw_response_wrapper( @@ -663,20 +654,20 @@ def __init__(self, address_maps: AsyncAddressMaps) -> None: ) @cached_property - def accounts(self) -> AsyncAccountsWithRawResponse: - return AsyncAccountsWithRawResponse(self._address_maps.accounts) + def accounts(self) -> AsyncAccountsResourceWithRawResponse: + return AsyncAccountsResourceWithRawResponse(self._address_maps.accounts) @cached_property - def ips(self) -> AsyncIPsWithRawResponse: - return AsyncIPsWithRawResponse(self._address_maps.ips) + def ips(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self._address_maps.ips) @cached_property - def zones(self) -> AsyncZonesWithRawResponse: - return AsyncZonesWithRawResponse(self._address_maps.zones) + def zones(self) -> AsyncZonesResourceWithRawResponse: + return AsyncZonesResourceWithRawResponse(self._address_maps.zones) -class AddressMapsWithStreamingResponse: - def __init__(self, address_maps: AddressMaps) -> None: +class AddressMapsResourceWithStreamingResponse: + def __init__(self, address_maps: AddressMapsResource) -> None: self._address_maps = address_maps self.create = to_streamed_response_wrapper( @@ -696,20 +687,20 @@ def __init__(self, address_maps: AddressMaps) -> None: ) @cached_property - def accounts(self) -> AccountsWithStreamingResponse: - return AccountsWithStreamingResponse(self._address_maps.accounts) + def accounts(self) -> AccountsResourceWithStreamingResponse: + return AccountsResourceWithStreamingResponse(self._address_maps.accounts) @cached_property - def ips(self) -> IPsWithStreamingResponse: - return IPsWithStreamingResponse(self._address_maps.ips) + def ips(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self._address_maps.ips) @cached_property - def zones(self) -> ZonesWithStreamingResponse: - return ZonesWithStreamingResponse(self._address_maps.zones) + def zones(self) -> ZonesResourceWithStreamingResponse: + return ZonesResourceWithStreamingResponse(self._address_maps.zones) -class AsyncAddressMapsWithStreamingResponse: - def __init__(self, address_maps: AsyncAddressMaps) -> None: +class AsyncAddressMapsResourceWithStreamingResponse: + def __init__(self, address_maps: AsyncAddressMapsResource) -> None: self._address_maps = address_maps self.create = async_to_streamed_response_wrapper( @@ -729,13 +720,13 @@ def __init__(self, address_maps: AsyncAddressMaps) -> None: ) @cached_property - def accounts(self) -> AsyncAccountsWithStreamingResponse: - return AsyncAccountsWithStreamingResponse(self._address_maps.accounts) + def accounts(self) -> AsyncAccountsResourceWithStreamingResponse: + return AsyncAccountsResourceWithStreamingResponse(self._address_maps.accounts) @cached_property - def ips(self) -> AsyncIPsWithStreamingResponse: - return AsyncIPsWithStreamingResponse(self._address_maps.ips) + def ips(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self._address_maps.ips) @cached_property - def zones(self) -> AsyncZonesWithStreamingResponse: - return AsyncZonesWithStreamingResponse(self._address_maps.zones) + def zones(self) -> AsyncZonesResourceWithStreamingResponse: + return AsyncZonesResourceWithStreamingResponse(self._address_maps.zones) diff --git a/src/cloudflare/resources/addressing/address_maps/ips.py b/src/cloudflare/resources/addressing/address_maps/ips.py index 9158077ee9d..a6bb3f55c6c 100644 --- a/src/cloudflare/resources/addressing/address_maps/ips.py +++ b/src/cloudflare/resources/addressing/address_maps/ips.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing import Any, Optional, cast +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 ( @@ -19,19 +23,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.addressing.address_maps import IPDeleteResponse, IPUpdateResponse +from ....types.addressing.address_maps import ip_delete_params, ip_update_params +from ....types.addressing.address_maps.ip_delete_response import IPDeleteResponse +from ....types.addressing.address_maps.ip_update_response import IPUpdateResponse -__all__ = ["IPs", "AsyncIPs"] +__all__ = ["IPsResource", "AsyncIPsResource"] -class IPs(SyncAPIResource): +class IPsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPsWithRawResponse: - return IPsWithRawResponse(self) + def with_raw_response(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPsWithStreamingResponse: - return IPsWithStreamingResponse(self) + def with_streaming_response(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self) def update( self, @@ -39,6 +45,7 @@ def update( *, account_id: str, address_map_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -70,21 +77,17 @@ def update( raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") if not ip_address: raise ValueError(f"Expected a non-empty value for `ip_address` but received {ip_address!r}") - return cast( - Optional[IPUpdateResponse], - self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IPUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", + body=maybe_transform(body, ip_update_params.IPUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IPUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[IPUpdateResponse]], ResultWrapper[IPUpdateResponse]), ) def delete( @@ -93,6 +96,7 @@ def delete( *, account_id: str, address_map_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -124,32 +128,28 @@ def delete( raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") if not ip_address: raise ValueError(f"Expected a non-empty value for `ip_address` but received {ip_address!r}") - return cast( - Optional[IPDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IPDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", + body=maybe_transform(body, ip_delete_params.IPDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IPDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[IPDeleteResponse]], ResultWrapper[IPDeleteResponse]), ) -class AsyncIPs(AsyncAPIResource): +class AsyncIPsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPsWithRawResponse: - return AsyncIPsWithRawResponse(self) + def with_raw_response(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPsWithStreamingResponse: - return AsyncIPsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self) async def update( self, @@ -157,6 +157,7 @@ async def update( *, account_id: str, address_map_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -188,21 +189,17 @@ async def update( raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") if not ip_address: raise ValueError(f"Expected a non-empty value for `ip_address` but received {ip_address!r}") - return cast( - Optional[IPUpdateResponse], - await self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IPUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", + body=await async_maybe_transform(body, ip_update_params.IPUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IPUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[IPUpdateResponse]], ResultWrapper[IPUpdateResponse]), ) async def delete( @@ -211,6 +208,7 @@ async def delete( *, account_id: str, address_map_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -242,26 +240,22 @@ async def delete( raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") if not ip_address: raise ValueError(f"Expected a non-empty value for `ip_address` but received {ip_address!r}") - return cast( - Optional[IPDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IPDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", + body=await async_maybe_transform(body, ip_delete_params.IPDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IPDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[IPDeleteResponse]], ResultWrapper[IPDeleteResponse]), ) -class IPsWithRawResponse: - def __init__(self, ips: IPs) -> None: +class IPsResourceWithRawResponse: + def __init__(self, ips: IPsResource) -> None: self._ips = ips self.update = to_raw_response_wrapper( @@ -272,8 +266,8 @@ def __init__(self, ips: IPs) -> None: ) -class AsyncIPsWithRawResponse: - def __init__(self, ips: AsyncIPs) -> None: +class AsyncIPsResourceWithRawResponse: + def __init__(self, ips: AsyncIPsResource) -> None: self._ips = ips self.update = async_to_raw_response_wrapper( @@ -284,8 +278,8 @@ def __init__(self, ips: AsyncIPs) -> None: ) -class IPsWithStreamingResponse: - def __init__(self, ips: IPs) -> None: +class IPsResourceWithStreamingResponse: + def __init__(self, ips: IPsResource) -> None: self._ips = ips self.update = to_streamed_response_wrapper( @@ -296,8 +290,8 @@ def __init__(self, ips: IPs) -> None: ) -class AsyncIPsWithStreamingResponse: - def __init__(self, ips: AsyncIPs) -> None: +class AsyncIPsResourceWithStreamingResponse: + def __init__(self, ips: AsyncIPsResource) -> None: self._ips = ips self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/address_maps/zones.py b/src/cloudflare/resources/addressing/address_maps/zones.py index a0d067990d2..c3f12537e44 100644 --- a/src/cloudflare/resources/addressing/address_maps/zones.py +++ b/src/cloudflare/resources/addressing/address_maps/zones.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing import Any, Optional, cast +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 ( @@ -19,19 +23,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.addressing.address_maps import ZoneDeleteResponse, ZoneUpdateResponse +from ....types.addressing.address_maps import zone_delete_params, zone_update_params +from ....types.addressing.address_maps.zone_delete_response import ZoneDeleteResponse +from ....types.addressing.address_maps.zone_update_response import ZoneUpdateResponse -__all__ = ["Zones", "AsyncZones"] +__all__ = ["ZonesResource", "AsyncZonesResource"] -class Zones(SyncAPIResource): +class ZonesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ZonesWithRawResponse: - return ZonesWithRawResponse(self) + def with_raw_response(self) -> ZonesResourceWithRawResponse: + return ZonesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ZonesWithStreamingResponse: - return ZonesWithStreamingResponse(self) + def with_streaming_response(self) -> ZonesResourceWithStreamingResponse: + return ZonesResourceWithStreamingResponse(self) def update( self, @@ -39,6 +45,7 @@ def update( *, zone_id: str, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -70,32 +77,17 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") - 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: - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[ZoneUpdateResponse], - self._put( - f"/accounts/{account_or_zone}/addressing/address_maps/{address_map_id}/zones/{account_or_zone_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ZoneUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", + body=maybe_transform(body, zone_update_params.ZoneUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ZoneUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ZoneUpdateResponse]], ResultWrapper[ZoneUpdateResponse]), ) def delete( @@ -104,6 +96,7 @@ def delete( *, zone_id: str, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,43 +128,28 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") - 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: - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[ZoneDeleteResponse], - self._delete( - f"/accounts/{account_or_zone}/addressing/address_maps/{address_map_id}/zones/{account_or_zone_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ZoneDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", + body=maybe_transform(body, zone_delete_params.ZoneDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ZoneDeleteResponse]], ResultWrapper[ZoneDeleteResponse]), ) -class AsyncZones(AsyncAPIResource): +class AsyncZonesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncZonesWithRawResponse: - return AsyncZonesWithRawResponse(self) + def with_raw_response(self) -> AsyncZonesResourceWithRawResponse: + return AsyncZonesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncZonesWithStreamingResponse: - return AsyncZonesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncZonesResourceWithStreamingResponse: + return AsyncZonesResourceWithStreamingResponse(self) async def update( self, @@ -179,6 +157,7 @@ async def update( *, zone_id: str, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -210,32 +189,17 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") - 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: - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[ZoneUpdateResponse], - await self._put( - f"/accounts/{account_or_zone}/addressing/address_maps/{address_map_id}/zones/{account_or_zone_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ZoneUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", + body=await async_maybe_transform(body, zone_update_params.ZoneUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ZoneUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ZoneUpdateResponse]], ResultWrapper[ZoneUpdateResponse]), ) async def delete( @@ -244,6 +208,7 @@ async def delete( *, zone_id: str, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,37 +240,22 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") - 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: - account_or_zone = "zones" - account_or_zone_id = zone_id - return cast( - Optional[ZoneDeleteResponse], - await self._delete( - f"/accounts/{account_or_zone}/addressing/address_maps/{address_map_id}/zones/{account_or_zone_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ZoneDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", + body=await async_maybe_transform(body, zone_delete_params.ZoneDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ZoneDeleteResponse]], ResultWrapper[ZoneDeleteResponse]), ) -class ZonesWithRawResponse: - def __init__(self, zones: Zones) -> None: +class ZonesResourceWithRawResponse: + def __init__(self, zones: ZonesResource) -> None: self._zones = zones self.update = to_raw_response_wrapper( @@ -316,8 +266,8 @@ def __init__(self, zones: Zones) -> None: ) -class AsyncZonesWithRawResponse: - def __init__(self, zones: AsyncZones) -> None: +class AsyncZonesResourceWithRawResponse: + def __init__(self, zones: AsyncZonesResource) -> None: self._zones = zones self.update = async_to_raw_response_wrapper( @@ -328,8 +278,8 @@ def __init__(self, zones: AsyncZones) -> None: ) -class ZonesWithStreamingResponse: - def __init__(self, zones: Zones) -> None: +class ZonesResourceWithStreamingResponse: + def __init__(self, zones: ZonesResource) -> None: self._zones = zones self.update = to_streamed_response_wrapper( @@ -340,8 +290,8 @@ def __init__(self, zones: Zones) -> None: ) -class AsyncZonesWithStreamingResponse: - def __init__(self, zones: AsyncZones) -> None: +class AsyncZonesResourceWithStreamingResponse: + def __init__(self, zones: AsyncZonesResource) -> None: self._zones = zones self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/addressing.py b/src/cloudflare/resources/addressing/addressing.py index acc9f6e8ebb..c0e0cd3b374 100644 --- a/src/cloudflare/resources/addressing/addressing.py +++ b/src/cloudflare/resources/addressing/addressing.py @@ -3,177 +3,177 @@ from __future__ import annotations from .prefixes import ( - Prefixes, - AsyncPrefixes, - PrefixesWithRawResponse, - AsyncPrefixesWithRawResponse, - PrefixesWithStreamingResponse, - AsyncPrefixesWithStreamingResponse, + PrefixesResource, + AsyncPrefixesResource, + PrefixesResourceWithRawResponse, + AsyncPrefixesResourceWithRawResponse, + PrefixesResourceWithStreamingResponse, + AsyncPrefixesResourceWithStreamingResponse, ) from .services import ( - Services, - AsyncServices, - ServicesWithRawResponse, - AsyncServicesWithRawResponse, - ServicesWithStreamingResponse, - AsyncServicesWithStreamingResponse, + ServicesResource, + AsyncServicesResource, + ServicesResourceWithRawResponse, + AsyncServicesResourceWithRawResponse, + ServicesResourceWithStreamingResponse, + AsyncServicesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from .address_maps import ( - AddressMaps, - AsyncAddressMaps, - AddressMapsWithRawResponse, - AsyncAddressMapsWithRawResponse, - AddressMapsWithStreamingResponse, - AsyncAddressMapsWithStreamingResponse, + AddressMapsResource, + AsyncAddressMapsResource, + AddressMapsResourceWithRawResponse, + AsyncAddressMapsResourceWithRawResponse, + AddressMapsResourceWithStreamingResponse, + AsyncAddressMapsResourceWithStreamingResponse, ) from .loa_documents import ( - LOADocuments, - AsyncLOADocuments, - LOADocumentsWithRawResponse, - AsyncLOADocumentsWithRawResponse, - LOADocumentsWithStreamingResponse, - AsyncLOADocumentsWithStreamingResponse, + LOADocumentsResource, + AsyncLOADocumentsResource, + LOADocumentsResourceWithRawResponse, + AsyncLOADocumentsResourceWithRawResponse, + LOADocumentsResourceWithStreamingResponse, + AsyncLOADocumentsResourceWithStreamingResponse, ) -from .prefixes.prefixes import Prefixes, AsyncPrefixes -from .address_maps.address_maps import AddressMaps, AsyncAddressMaps -from .loa_documents.loa_documents import LOADocuments, AsyncLOADocuments +from .prefixes.prefixes import PrefixesResource, AsyncPrefixesResource +from .address_maps.address_maps import AddressMapsResource, AsyncAddressMapsResource +from .loa_documents.loa_documents import LOADocumentsResource, AsyncLOADocumentsResource -__all__ = ["Addressing", "AsyncAddressing"] +__all__ = ["AddressingResource", "AsyncAddressingResource"] -class Addressing(SyncAPIResource): +class AddressingResource(SyncAPIResource): @cached_property - def services(self) -> Services: - return Services(self._client) + def services(self) -> ServicesResource: + return ServicesResource(self._client) @cached_property - def address_maps(self) -> AddressMaps: - return AddressMaps(self._client) + def address_maps(self) -> AddressMapsResource: + return AddressMapsResource(self._client) @cached_property - def loa_documents(self) -> LOADocuments: - return LOADocuments(self._client) + def loa_documents(self) -> LOADocumentsResource: + return LOADocumentsResource(self._client) @cached_property - def prefixes(self) -> Prefixes: - return Prefixes(self._client) + def prefixes(self) -> PrefixesResource: + return PrefixesResource(self._client) @cached_property - def with_raw_response(self) -> AddressingWithRawResponse: - return AddressingWithRawResponse(self) + def with_raw_response(self) -> AddressingResourceWithRawResponse: + return AddressingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AddressingWithStreamingResponse: - return AddressingWithStreamingResponse(self) + def with_streaming_response(self) -> AddressingResourceWithStreamingResponse: + return AddressingResourceWithStreamingResponse(self) -class AsyncAddressing(AsyncAPIResource): +class AsyncAddressingResource(AsyncAPIResource): @cached_property - def services(self) -> AsyncServices: - return AsyncServices(self._client) + def services(self) -> AsyncServicesResource: + return AsyncServicesResource(self._client) @cached_property - def address_maps(self) -> AsyncAddressMaps: - return AsyncAddressMaps(self._client) + def address_maps(self) -> AsyncAddressMapsResource: + return AsyncAddressMapsResource(self._client) @cached_property - def loa_documents(self) -> AsyncLOADocuments: - return AsyncLOADocuments(self._client) + def loa_documents(self) -> AsyncLOADocumentsResource: + return AsyncLOADocumentsResource(self._client) @cached_property - def prefixes(self) -> AsyncPrefixes: - return AsyncPrefixes(self._client) + def prefixes(self) -> AsyncPrefixesResource: + return AsyncPrefixesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAddressingWithRawResponse: - return AsyncAddressingWithRawResponse(self) + def with_raw_response(self) -> AsyncAddressingResourceWithRawResponse: + return AsyncAddressingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAddressingWithStreamingResponse: - return AsyncAddressingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAddressingResourceWithStreamingResponse: + return AsyncAddressingResourceWithStreamingResponse(self) -class AddressingWithRawResponse: - def __init__(self, addressing: Addressing) -> None: +class AddressingResourceWithRawResponse: + def __init__(self, addressing: AddressingResource) -> None: self._addressing = addressing @cached_property - def services(self) -> ServicesWithRawResponse: - return ServicesWithRawResponse(self._addressing.services) + def services(self) -> ServicesResourceWithRawResponse: + return ServicesResourceWithRawResponse(self._addressing.services) @cached_property - def address_maps(self) -> AddressMapsWithRawResponse: - return AddressMapsWithRawResponse(self._addressing.address_maps) + def address_maps(self) -> AddressMapsResourceWithRawResponse: + return AddressMapsResourceWithRawResponse(self._addressing.address_maps) @cached_property - def loa_documents(self) -> LOADocumentsWithRawResponse: - return LOADocumentsWithRawResponse(self._addressing.loa_documents) + def loa_documents(self) -> LOADocumentsResourceWithRawResponse: + return LOADocumentsResourceWithRawResponse(self._addressing.loa_documents) @cached_property - def prefixes(self) -> PrefixesWithRawResponse: - return PrefixesWithRawResponse(self._addressing.prefixes) + def prefixes(self) -> PrefixesResourceWithRawResponse: + return PrefixesResourceWithRawResponse(self._addressing.prefixes) -class AsyncAddressingWithRawResponse: - def __init__(self, addressing: AsyncAddressing) -> None: +class AsyncAddressingResourceWithRawResponse: + def __init__(self, addressing: AsyncAddressingResource) -> None: self._addressing = addressing @cached_property - def services(self) -> AsyncServicesWithRawResponse: - return AsyncServicesWithRawResponse(self._addressing.services) + def services(self) -> AsyncServicesResourceWithRawResponse: + return AsyncServicesResourceWithRawResponse(self._addressing.services) @cached_property - def address_maps(self) -> AsyncAddressMapsWithRawResponse: - return AsyncAddressMapsWithRawResponse(self._addressing.address_maps) + def address_maps(self) -> AsyncAddressMapsResourceWithRawResponse: + return AsyncAddressMapsResourceWithRawResponse(self._addressing.address_maps) @cached_property - def loa_documents(self) -> AsyncLOADocumentsWithRawResponse: - return AsyncLOADocumentsWithRawResponse(self._addressing.loa_documents) + def loa_documents(self) -> AsyncLOADocumentsResourceWithRawResponse: + return AsyncLOADocumentsResourceWithRawResponse(self._addressing.loa_documents) @cached_property - def prefixes(self) -> AsyncPrefixesWithRawResponse: - return AsyncPrefixesWithRawResponse(self._addressing.prefixes) + def prefixes(self) -> AsyncPrefixesResourceWithRawResponse: + return AsyncPrefixesResourceWithRawResponse(self._addressing.prefixes) -class AddressingWithStreamingResponse: - def __init__(self, addressing: Addressing) -> None: +class AddressingResourceWithStreamingResponse: + def __init__(self, addressing: AddressingResource) -> None: self._addressing = addressing @cached_property - def services(self) -> ServicesWithStreamingResponse: - return ServicesWithStreamingResponse(self._addressing.services) + def services(self) -> ServicesResourceWithStreamingResponse: + return ServicesResourceWithStreamingResponse(self._addressing.services) @cached_property - def address_maps(self) -> AddressMapsWithStreamingResponse: - return AddressMapsWithStreamingResponse(self._addressing.address_maps) + def address_maps(self) -> AddressMapsResourceWithStreamingResponse: + return AddressMapsResourceWithStreamingResponse(self._addressing.address_maps) @cached_property - def loa_documents(self) -> LOADocumentsWithStreamingResponse: - return LOADocumentsWithStreamingResponse(self._addressing.loa_documents) + def loa_documents(self) -> LOADocumentsResourceWithStreamingResponse: + return LOADocumentsResourceWithStreamingResponse(self._addressing.loa_documents) @cached_property - def prefixes(self) -> PrefixesWithStreamingResponse: - return PrefixesWithStreamingResponse(self._addressing.prefixes) + def prefixes(self) -> PrefixesResourceWithStreamingResponse: + return PrefixesResourceWithStreamingResponse(self._addressing.prefixes) -class AsyncAddressingWithStreamingResponse: - def __init__(self, addressing: AsyncAddressing) -> None: +class AsyncAddressingResourceWithStreamingResponse: + def __init__(self, addressing: AsyncAddressingResource) -> None: self._addressing = addressing @cached_property - def services(self) -> AsyncServicesWithStreamingResponse: - return AsyncServicesWithStreamingResponse(self._addressing.services) + def services(self) -> AsyncServicesResourceWithStreamingResponse: + return AsyncServicesResourceWithStreamingResponse(self._addressing.services) @cached_property - def address_maps(self) -> AsyncAddressMapsWithStreamingResponse: - return AsyncAddressMapsWithStreamingResponse(self._addressing.address_maps) + def address_maps(self) -> AsyncAddressMapsResourceWithStreamingResponse: + return AsyncAddressMapsResourceWithStreamingResponse(self._addressing.address_maps) @cached_property - def loa_documents(self) -> AsyncLOADocumentsWithStreamingResponse: - return AsyncLOADocumentsWithStreamingResponse(self._addressing.loa_documents) + def loa_documents(self) -> AsyncLOADocumentsResourceWithStreamingResponse: + return AsyncLOADocumentsResourceWithStreamingResponse(self._addressing.loa_documents) @cached_property - def prefixes(self) -> AsyncPrefixesWithStreamingResponse: - return AsyncPrefixesWithStreamingResponse(self._addressing.prefixes) + def prefixes(self) -> AsyncPrefixesResourceWithStreamingResponse: + return AsyncPrefixesResourceWithStreamingResponse(self._addressing.prefixes) diff --git a/src/cloudflare/resources/addressing/loa_documents/__init__.py b/src/cloudflare/resources/addressing/loa_documents/__init__.py index 97ad83a5220..72f6dbba90c 100644 --- a/src/cloudflare/resources/addressing/loa_documents/__init__.py +++ b/src/cloudflare/resources/addressing/loa_documents/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .downloads import ( - Downloads, - AsyncDownloads, - DownloadsWithRawResponse, - AsyncDownloadsWithRawResponse, - DownloadsWithStreamingResponse, - AsyncDownloadsWithStreamingResponse, + DownloadsResource, + AsyncDownloadsResource, + DownloadsResourceWithRawResponse, + AsyncDownloadsResourceWithRawResponse, + DownloadsResourceWithStreamingResponse, + AsyncDownloadsResourceWithStreamingResponse, ) from .loa_documents import ( - LOADocuments, - AsyncLOADocuments, - LOADocumentsWithRawResponse, - AsyncLOADocumentsWithRawResponse, - LOADocumentsWithStreamingResponse, - AsyncLOADocumentsWithStreamingResponse, + LOADocumentsResource, + AsyncLOADocumentsResource, + LOADocumentsResourceWithRawResponse, + AsyncLOADocumentsResourceWithRawResponse, + LOADocumentsResourceWithStreamingResponse, + AsyncLOADocumentsResourceWithStreamingResponse, ) __all__ = [ - "Downloads", - "AsyncDownloads", - "DownloadsWithRawResponse", - "AsyncDownloadsWithRawResponse", - "DownloadsWithStreamingResponse", - "AsyncDownloadsWithStreamingResponse", - "LOADocuments", - "AsyncLOADocuments", - "LOADocumentsWithRawResponse", - "AsyncLOADocumentsWithRawResponse", - "LOADocumentsWithStreamingResponse", - "AsyncLOADocumentsWithStreamingResponse", + "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 index 6a663672f66..b29d0888acd 100644 --- a/src/cloudflare/resources/addressing/loa_documents/downloads.py +++ b/src/cloudflare/resources/addressing/loa_documents/downloads.py @@ -19,17 +19,17 @@ make_request_options, ) -__all__ = ["Downloads", "AsyncDownloads"] +__all__ = ["DownloadsResource", "AsyncDownloadsResource"] -class Downloads(SyncAPIResource): +class DownloadsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DownloadsWithRawResponse: - return DownloadsWithRawResponse(self) + def with_raw_response(self) -> DownloadsResourceWithRawResponse: + return DownloadsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DownloadsWithStreamingResponse: - return DownloadsWithStreamingResponse(self) + def with_streaming_response(self) -> DownloadsResourceWithStreamingResponse: + return DownloadsResourceWithStreamingResponse(self) def get( self, @@ -72,14 +72,14 @@ def get( ) -class AsyncDownloads(AsyncAPIResource): +class AsyncDownloadsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDownloadsWithRawResponse: - return AsyncDownloadsWithRawResponse(self) + def with_raw_response(self) -> AsyncDownloadsResourceWithRawResponse: + return AsyncDownloadsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDownloadsWithStreamingResponse: - return AsyncDownloadsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDownloadsResourceWithStreamingResponse: + return AsyncDownloadsResourceWithStreamingResponse(self) async def get( self, @@ -122,8 +122,8 @@ async def get( ) -class DownloadsWithRawResponse: - def __init__(self, downloads: Downloads) -> None: +class DownloadsResourceWithRawResponse: + def __init__(self, downloads: DownloadsResource) -> None: self._downloads = downloads self.get = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, downloads: Downloads) -> None: ) -class AsyncDownloadsWithRawResponse: - def __init__(self, downloads: AsyncDownloads) -> None: +class AsyncDownloadsResourceWithRawResponse: + def __init__(self, downloads: AsyncDownloadsResource) -> None: self._downloads = downloads self.get = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, downloads: AsyncDownloads) -> None: ) -class DownloadsWithStreamingResponse: - def __init__(self, downloads: Downloads) -> None: +class DownloadsResourceWithStreamingResponse: + def __init__(self, downloads: DownloadsResource) -> None: self._downloads = downloads self.get = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, downloads: Downloads) -> None: ) -class AsyncDownloadsWithStreamingResponse: - def __init__(self, downloads: AsyncDownloads) -> None: +class AsyncDownloadsResourceWithStreamingResponse: + def __init__(self, downloads: AsyncDownloadsResource) -> None: self._downloads = downloads self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/loa_documents/loa_documents.py b/src/cloudflare/resources/addressing/loa_documents/loa_documents.py index 8a25428cfe4..7080381886a 100644 --- a/src/cloudflare/resources/addressing/loa_documents/loa_documents.py +++ b/src/cloudflare/resources/addressing/loa_documents/loa_documents.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -12,12 +12,12 @@ async_maybe_transform, ) from .downloads import ( - Downloads, - AsyncDownloads, - DownloadsWithRawResponse, - AsyncDownloadsWithRawResponse, - DownloadsWithStreamingResponse, - AsyncDownloadsWithStreamingResponse, + DownloadsResource, + AsyncDownloadsResource, + DownloadsResourceWithRawResponse, + AsyncDownloadsResourceWithRawResponse, + DownloadsResourceWithStreamingResponse, + AsyncDownloadsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -31,23 +31,24 @@ from ...._base_client import ( make_request_options, ) -from ....types.addressing import LOADocumentCreateResponse, loa_document_create_params +from ....types.addressing import loa_document_create_params +from ....types.addressing.loa_document_create_response import LOADocumentCreateResponse -__all__ = ["LOADocuments", "AsyncLOADocuments"] +__all__ = ["LOADocumentsResource", "AsyncLOADocumentsResource"] -class LOADocuments(SyncAPIResource): +class LOADocumentsResource(SyncAPIResource): @cached_property - def downloads(self) -> Downloads: - return Downloads(self._client) + def downloads(self) -> DownloadsResource: + return DownloadsResource(self._client) @cached_property - def with_raw_response(self) -> LOADocumentsWithRawResponse: - return LOADocumentsWithRawResponse(self) + def with_raw_response(self) -> LOADocumentsResourceWithRawResponse: + return LOADocumentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LOADocumentsWithStreamingResponse: - return LOADocumentsWithStreamingResponse(self) + def with_streaming_response(self) -> LOADocumentsResourceWithStreamingResponse: + return LOADocumentsResourceWithStreamingResponse(self) def create( self, @@ -60,7 +61,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LOADocumentCreateResponse: + ) -> Optional[LOADocumentCreateResponse]: """ Submit LOA document (pdf format) under the account. @@ -87,24 +88,24 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LOADocumentCreateResponse]]._unwrapper, ), - cast_to=cast(Type[LOADocumentCreateResponse], ResultWrapper[LOADocumentCreateResponse]), + cast_to=cast(Type[Optional[LOADocumentCreateResponse]], ResultWrapper[LOADocumentCreateResponse]), ) -class AsyncLOADocuments(AsyncAPIResource): +class AsyncLOADocumentsResource(AsyncAPIResource): @cached_property - def downloads(self) -> AsyncDownloads: - return AsyncDownloads(self._client) + def downloads(self) -> AsyncDownloadsResource: + return AsyncDownloadsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLOADocumentsWithRawResponse: - return AsyncLOADocumentsWithRawResponse(self) + def with_raw_response(self) -> AsyncLOADocumentsResourceWithRawResponse: + return AsyncLOADocumentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLOADocumentsWithStreamingResponse: - return AsyncLOADocumentsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLOADocumentsResourceWithStreamingResponse: + return AsyncLOADocumentsResourceWithStreamingResponse(self) async def create( self, @@ -117,7 +118,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LOADocumentCreateResponse: + ) -> Optional[LOADocumentCreateResponse]: """ Submit LOA document (pdf format) under the account. @@ -146,14 +147,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LOADocumentCreateResponse]]._unwrapper, ), - cast_to=cast(Type[LOADocumentCreateResponse], ResultWrapper[LOADocumentCreateResponse]), + cast_to=cast(Type[Optional[LOADocumentCreateResponse]], ResultWrapper[LOADocumentCreateResponse]), ) -class LOADocumentsWithRawResponse: - def __init__(self, loa_documents: LOADocuments) -> None: +class LOADocumentsResourceWithRawResponse: + def __init__(self, loa_documents: LOADocumentsResource) -> None: self._loa_documents = loa_documents self.create = to_raw_response_wrapper( @@ -161,12 +162,12 @@ def __init__(self, loa_documents: LOADocuments) -> None: ) @cached_property - def downloads(self) -> DownloadsWithRawResponse: - return DownloadsWithRawResponse(self._loa_documents.downloads) + def downloads(self) -> DownloadsResourceWithRawResponse: + return DownloadsResourceWithRawResponse(self._loa_documents.downloads) -class AsyncLOADocumentsWithRawResponse: - def __init__(self, loa_documents: AsyncLOADocuments) -> None: +class AsyncLOADocumentsResourceWithRawResponse: + def __init__(self, loa_documents: AsyncLOADocumentsResource) -> None: self._loa_documents = loa_documents self.create = async_to_raw_response_wrapper( @@ -174,12 +175,12 @@ def __init__(self, loa_documents: AsyncLOADocuments) -> None: ) @cached_property - def downloads(self) -> AsyncDownloadsWithRawResponse: - return AsyncDownloadsWithRawResponse(self._loa_documents.downloads) + def downloads(self) -> AsyncDownloadsResourceWithRawResponse: + return AsyncDownloadsResourceWithRawResponse(self._loa_documents.downloads) -class LOADocumentsWithStreamingResponse: - def __init__(self, loa_documents: LOADocuments) -> None: +class LOADocumentsResourceWithStreamingResponse: + def __init__(self, loa_documents: LOADocumentsResource) -> None: self._loa_documents = loa_documents self.create = to_streamed_response_wrapper( @@ -187,12 +188,12 @@ def __init__(self, loa_documents: LOADocuments) -> None: ) @cached_property - def downloads(self) -> DownloadsWithStreamingResponse: - return DownloadsWithStreamingResponse(self._loa_documents.downloads) + def downloads(self) -> DownloadsResourceWithStreamingResponse: + return DownloadsResourceWithStreamingResponse(self._loa_documents.downloads) -class AsyncLOADocumentsWithStreamingResponse: - def __init__(self, loa_documents: AsyncLOADocuments) -> None: +class AsyncLOADocumentsResourceWithStreamingResponse: + def __init__(self, loa_documents: AsyncLOADocumentsResource) -> None: self._loa_documents = loa_documents self.create = async_to_streamed_response_wrapper( @@ -200,5 +201,5 @@ def __init__(self, loa_documents: AsyncLOADocuments) -> None: ) @cached_property - def downloads(self) -> AsyncDownloadsWithStreamingResponse: - return AsyncDownloadsWithStreamingResponse(self._loa_documents.downloads) + def downloads(self) -> AsyncDownloadsResourceWithStreamingResponse: + return AsyncDownloadsResourceWithStreamingResponse(self._loa_documents.downloads) diff --git a/src/cloudflare/resources/addressing/prefixes/__init__.py b/src/cloudflare/resources/addressing/prefixes/__init__.py index 59a101dad99..baf5dcefd16 100644 --- a/src/cloudflare/resources/addressing/prefixes/__init__.py +++ b/src/cloudflare/resources/addressing/prefixes/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .bgp import ( - BGP, - AsyncBGP, - BGPWithRawResponse, - AsyncBGPWithRawResponse, - BGPWithStreamingResponse, - AsyncBGPWithStreamingResponse, + BGPResource, + AsyncBGPResource, + BGPResourceWithRawResponse, + AsyncBGPResourceWithRawResponse, + BGPResourceWithStreamingResponse, + AsyncBGPResourceWithStreamingResponse, ) from .prefixes import ( - Prefixes, - AsyncPrefixes, - PrefixesWithRawResponse, - AsyncPrefixesWithRawResponse, - PrefixesWithStreamingResponse, - AsyncPrefixesWithStreamingResponse, + PrefixesResource, + AsyncPrefixesResource, + PrefixesResourceWithRawResponse, + AsyncPrefixesResourceWithRawResponse, + PrefixesResourceWithStreamingResponse, + AsyncPrefixesResourceWithStreamingResponse, ) from .delegations import ( - Delegations, - AsyncDelegations, - DelegationsWithRawResponse, - AsyncDelegationsWithRawResponse, - DelegationsWithStreamingResponse, - AsyncDelegationsWithStreamingResponse, + DelegationsResource, + AsyncDelegationsResource, + DelegationsResourceWithRawResponse, + AsyncDelegationsResourceWithRawResponse, + DelegationsResourceWithStreamingResponse, + AsyncDelegationsResourceWithStreamingResponse, ) __all__ = [ - "BGP", - "AsyncBGP", - "BGPWithRawResponse", - "AsyncBGPWithRawResponse", - "BGPWithStreamingResponse", - "AsyncBGPWithStreamingResponse", - "Delegations", - "AsyncDelegations", - "DelegationsWithRawResponse", - "AsyncDelegationsWithRawResponse", - "DelegationsWithStreamingResponse", - "AsyncDelegationsWithStreamingResponse", - "Prefixes", - "AsyncPrefixes", - "PrefixesWithRawResponse", - "AsyncPrefixesWithRawResponse", - "PrefixesWithStreamingResponse", - "AsyncPrefixesWithStreamingResponse", + "BGPResource", + "AsyncBGPResource", + "BGPResourceWithRawResponse", + "AsyncBGPResourceWithRawResponse", + "BGPResourceWithStreamingResponse", + "AsyncBGPResourceWithStreamingResponse", + "DelegationsResource", + "AsyncDelegationsResource", + "DelegationsResourceWithRawResponse", + "AsyncDelegationsResourceWithRawResponse", + "DelegationsResourceWithStreamingResponse", + "AsyncDelegationsResourceWithStreamingResponse", + "PrefixesResource", + "AsyncPrefixesResource", + "PrefixesResourceWithRawResponse", + "AsyncPrefixesResourceWithRawResponse", + "PrefixesResourceWithStreamingResponse", + "AsyncPrefixesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/__init__.py b/src/cloudflare/resources/addressing/prefixes/bgp/__init__.py index e4e13b859a5..8c3709d72cc 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/__init__.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .bgp import ( - BGP, - AsyncBGP, - BGPWithRawResponse, - AsyncBGPWithRawResponse, - BGPWithStreamingResponse, - AsyncBGPWithStreamingResponse, + BGPResource, + AsyncBGPResource, + BGPResourceWithRawResponse, + AsyncBGPResourceWithRawResponse, + BGPResourceWithStreamingResponse, + AsyncBGPResourceWithStreamingResponse, ) from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, + BindingsResource, + AsyncBindingsResource, + BindingsResourceWithRawResponse, + AsyncBindingsResourceWithRawResponse, + BindingsResourceWithStreamingResponse, + AsyncBindingsResourceWithStreamingResponse, ) from .prefixes import ( - Prefixes, - AsyncPrefixes, - PrefixesWithRawResponse, - AsyncPrefixesWithRawResponse, - PrefixesWithStreamingResponse, - AsyncPrefixesWithStreamingResponse, + PrefixesResource, + AsyncPrefixesResource, + PrefixesResourceWithRawResponse, + AsyncPrefixesResourceWithRawResponse, + PrefixesResourceWithStreamingResponse, + AsyncPrefixesResourceWithStreamingResponse, ) from .statuses import ( - Statuses, - AsyncStatuses, - StatusesWithRawResponse, - AsyncStatusesWithRawResponse, - StatusesWithStreamingResponse, - AsyncStatusesWithStreamingResponse, + StatusesResource, + AsyncStatusesResource, + StatusesResourceWithRawResponse, + AsyncStatusesResourceWithRawResponse, + StatusesResourceWithStreamingResponse, + AsyncStatusesResourceWithStreamingResponse, ) __all__ = [ - "Bindings", - "AsyncBindings", - "BindingsWithRawResponse", - "AsyncBindingsWithRawResponse", - "BindingsWithStreamingResponse", - "AsyncBindingsWithStreamingResponse", - "Prefixes", - "AsyncPrefixes", - "PrefixesWithRawResponse", - "AsyncPrefixesWithRawResponse", - "PrefixesWithStreamingResponse", - "AsyncPrefixesWithStreamingResponse", - "Statuses", - "AsyncStatuses", - "StatusesWithRawResponse", - "AsyncStatusesWithRawResponse", - "StatusesWithStreamingResponse", - "AsyncStatusesWithStreamingResponse", - "BGP", - "AsyncBGP", - "BGPWithRawResponse", - "AsyncBGPWithRawResponse", - "BGPWithStreamingResponse", - "AsyncBGPWithStreamingResponse", + "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 index 739d3def292..4b5ec4fa6d6 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/bgp.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/bgp.py @@ -3,142 +3,142 @@ from __future__ import annotations from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, + BindingsResource, + AsyncBindingsResource, + BindingsResourceWithRawResponse, + AsyncBindingsResourceWithRawResponse, + BindingsResourceWithStreamingResponse, + AsyncBindingsResourceWithStreamingResponse, ) from .prefixes import ( - Prefixes, - AsyncPrefixes, - PrefixesWithRawResponse, - AsyncPrefixesWithRawResponse, - PrefixesWithStreamingResponse, - AsyncPrefixesWithStreamingResponse, + PrefixesResource, + AsyncPrefixesResource, + PrefixesResourceWithRawResponse, + AsyncPrefixesResourceWithRawResponse, + PrefixesResourceWithStreamingResponse, + AsyncPrefixesResourceWithStreamingResponse, ) from .statuses import ( - Statuses, - AsyncStatuses, - StatusesWithRawResponse, - AsyncStatusesWithRawResponse, - StatusesWithStreamingResponse, - AsyncStatusesWithStreamingResponse, + StatusesResource, + AsyncStatusesResource, + StatusesResourceWithRawResponse, + AsyncStatusesResourceWithRawResponse, + StatusesResourceWithStreamingResponse, + AsyncStatusesResourceWithStreamingResponse, ) from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["BGP", "AsyncBGP"] +__all__ = ["BGPResource", "AsyncBGPResource"] -class BGP(SyncAPIResource): +class BGPResource(SyncAPIResource): @cached_property - def bindings(self) -> Bindings: - return Bindings(self._client) + def bindings(self) -> BindingsResource: + return BindingsResource(self._client) @cached_property - def prefixes(self) -> Prefixes: - return Prefixes(self._client) + def prefixes(self) -> PrefixesResource: + return PrefixesResource(self._client) @cached_property - def statuses(self) -> Statuses: - return Statuses(self._client) + def statuses(self) -> StatusesResource: + return StatusesResource(self._client) @cached_property - def with_raw_response(self) -> BGPWithRawResponse: - return BGPWithRawResponse(self) + def with_raw_response(self) -> BGPResourceWithRawResponse: + return BGPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BGPWithStreamingResponse: - return BGPWithStreamingResponse(self) + def with_streaming_response(self) -> BGPResourceWithStreamingResponse: + return BGPResourceWithStreamingResponse(self) -class AsyncBGP(AsyncAPIResource): +class AsyncBGPResource(AsyncAPIResource): @cached_property - def bindings(self) -> AsyncBindings: - return AsyncBindings(self._client) + def bindings(self) -> AsyncBindingsResource: + return AsyncBindingsResource(self._client) @cached_property - def prefixes(self) -> AsyncPrefixes: - return AsyncPrefixes(self._client) + def prefixes(self) -> AsyncPrefixesResource: + return AsyncPrefixesResource(self._client) @cached_property - def statuses(self) -> AsyncStatuses: - return AsyncStatuses(self._client) + def statuses(self) -> AsyncStatusesResource: + return AsyncStatusesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncBGPWithRawResponse: - return AsyncBGPWithRawResponse(self) + def with_raw_response(self) -> AsyncBGPResourceWithRawResponse: + return AsyncBGPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBGPWithStreamingResponse: - return AsyncBGPWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBGPResourceWithStreamingResponse: + return AsyncBGPResourceWithStreamingResponse(self) -class BGPWithRawResponse: - def __init__(self, bgp: BGP) -> None: +class BGPResourceWithRawResponse: + def __init__(self, bgp: BGPResource) -> None: self._bgp = bgp @cached_property - def bindings(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self._bgp.bindings) + def bindings(self) -> BindingsResourceWithRawResponse: + return BindingsResourceWithRawResponse(self._bgp.bindings) @cached_property - def prefixes(self) -> PrefixesWithRawResponse: - return PrefixesWithRawResponse(self._bgp.prefixes) + def prefixes(self) -> PrefixesResourceWithRawResponse: + return PrefixesResourceWithRawResponse(self._bgp.prefixes) @cached_property - def statuses(self) -> StatusesWithRawResponse: - return StatusesWithRawResponse(self._bgp.statuses) + def statuses(self) -> StatusesResourceWithRawResponse: + return StatusesResourceWithRawResponse(self._bgp.statuses) -class AsyncBGPWithRawResponse: - def __init__(self, bgp: AsyncBGP) -> None: +class AsyncBGPResourceWithRawResponse: + def __init__(self, bgp: AsyncBGPResource) -> None: self._bgp = bgp @cached_property - def bindings(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self._bgp.bindings) + def bindings(self) -> AsyncBindingsResourceWithRawResponse: + return AsyncBindingsResourceWithRawResponse(self._bgp.bindings) @cached_property - def prefixes(self) -> AsyncPrefixesWithRawResponse: - return AsyncPrefixesWithRawResponse(self._bgp.prefixes) + def prefixes(self) -> AsyncPrefixesResourceWithRawResponse: + return AsyncPrefixesResourceWithRawResponse(self._bgp.prefixes) @cached_property - def statuses(self) -> AsyncStatusesWithRawResponse: - return AsyncStatusesWithRawResponse(self._bgp.statuses) + def statuses(self) -> AsyncStatusesResourceWithRawResponse: + return AsyncStatusesResourceWithRawResponse(self._bgp.statuses) -class BGPWithStreamingResponse: - def __init__(self, bgp: BGP) -> None: +class BGPResourceWithStreamingResponse: + def __init__(self, bgp: BGPResource) -> None: self._bgp = bgp @cached_property - def bindings(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self._bgp.bindings) + def bindings(self) -> BindingsResourceWithStreamingResponse: + return BindingsResourceWithStreamingResponse(self._bgp.bindings) @cached_property - def prefixes(self) -> PrefixesWithStreamingResponse: - return PrefixesWithStreamingResponse(self._bgp.prefixes) + def prefixes(self) -> PrefixesResourceWithStreamingResponse: + return PrefixesResourceWithStreamingResponse(self._bgp.prefixes) @cached_property - def statuses(self) -> StatusesWithStreamingResponse: - return StatusesWithStreamingResponse(self._bgp.statuses) + def statuses(self) -> StatusesResourceWithStreamingResponse: + return StatusesResourceWithStreamingResponse(self._bgp.statuses) -class AsyncBGPWithStreamingResponse: - def __init__(self, bgp: AsyncBGP) -> None: +class AsyncBGPResourceWithStreamingResponse: + def __init__(self, bgp: AsyncBGPResource) -> None: self._bgp = bgp @cached_property - def bindings(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self._bgp.bindings) + def bindings(self) -> AsyncBindingsResourceWithStreamingResponse: + return AsyncBindingsResourceWithStreamingResponse(self._bgp.bindings) @cached_property - def prefixes(self) -> AsyncPrefixesWithStreamingResponse: - return AsyncPrefixesWithStreamingResponse(self._bgp.prefixes) + def prefixes(self) -> AsyncPrefixesResourceWithStreamingResponse: + return AsyncPrefixesResourceWithStreamingResponse(self._bgp.prefixes) @cached_property - def statuses(self) -> AsyncStatusesWithStreamingResponse: - return AsyncStatusesWithStreamingResponse(self._bgp.statuses) + def statuses(self) -> AsyncStatusesResourceWithStreamingResponse: + return AsyncStatusesResourceWithStreamingResponse(self._bgp.statuses) diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py b/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py index 46ce8e5e38d..ffa7d4bda3d 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,21 @@ AsyncPaginator, make_request_options, ) -from .....types.addressing.prefixes.bgp import BindingDeleteResponse, AddressingServiceBinding, binding_create_params +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 -__all__ = ["Bindings", "AsyncBindings"] +__all__ = ["BindingsResource", "AsyncBindingsResource"] -class Bindings(SyncAPIResource): +class BindingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self) + def with_raw_response(self) -> BindingsResourceWithRawResponse: + return BindingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self) + def with_streaming_response(self) -> BindingsResourceWithStreamingResponse: + return BindingsResourceWithStreamingResponse(self) def create( self, @@ -52,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingServiceBinding: + ) -> Optional[ServiceBinding]: """ Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. **Note:** This API may only be used on @@ -94,9 +96,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceBinding]]._unwrapper, ), - cast_to=cast(Type[AddressingServiceBinding], ResultWrapper[AddressingServiceBinding]), + cast_to=cast(Type[Optional[ServiceBinding]], ResultWrapper[ServiceBinding]), ) def list( @@ -110,7 +112,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AddressingServiceBinding]: + ) -> SyncSinglePage[ServiceBinding]: """List the Cloudflare services this prefix is currently bound to. Traffic sent to @@ -139,11 +141,11 @@ def list( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings", - page=SyncSinglePage[AddressingServiceBinding], + page=SyncSinglePage[ServiceBinding], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingServiceBinding, + model=ServiceBinding, ) def delete( @@ -183,21 +185,12 @@ def delete( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") if not binding_id: raise ValueError(f"Expected a non-empty value for `binding_id` but received {binding_id!r}") - return cast( - BindingDeleteResponse, - self._delete( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BindingDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=BindingDeleteResponse, ) def get( @@ -212,7 +205,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingServiceBinding: + ) -> Optional[ServiceBinding]: """ Fetch a single Service Binding @@ -244,20 +237,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceBinding]]._unwrapper, ), - cast_to=cast(Type[AddressingServiceBinding], ResultWrapper[AddressingServiceBinding]), + cast_to=cast(Type[Optional[ServiceBinding]], ResultWrapper[ServiceBinding]), ) -class AsyncBindings(AsyncAPIResource): +class AsyncBindingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self) + def with_raw_response(self) -> AsyncBindingsResourceWithRawResponse: + return AsyncBindingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBindingsResourceWithStreamingResponse: + return AsyncBindingsResourceWithStreamingResponse(self) async def create( self, @@ -272,7 +265,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingServiceBinding: + ) -> Optional[ServiceBinding]: """ Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. **Note:** This API may only be used on @@ -314,9 +307,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceBinding]]._unwrapper, ), - cast_to=cast(Type[AddressingServiceBinding], ResultWrapper[AddressingServiceBinding]), + cast_to=cast(Type[Optional[ServiceBinding]], ResultWrapper[ServiceBinding]), ) def list( @@ -330,7 +323,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AddressingServiceBinding, AsyncSinglePage[AddressingServiceBinding]]: + ) -> AsyncPaginator[ServiceBinding, AsyncSinglePage[ServiceBinding]]: """List the Cloudflare services this prefix is currently bound to. Traffic sent to @@ -359,11 +352,11 @@ def list( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings", - page=AsyncSinglePage[AddressingServiceBinding], + page=AsyncSinglePage[ServiceBinding], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingServiceBinding, + model=ServiceBinding, ) async def delete( @@ -403,21 +396,12 @@ async def delete( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") if not binding_id: raise ValueError(f"Expected a non-empty value for `binding_id` but received {binding_id!r}") - return cast( - BindingDeleteResponse, - await self._delete( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BindingDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=BindingDeleteResponse, ) async def get( @@ -432,7 +416,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingServiceBinding: + ) -> Optional[ServiceBinding]: """ Fetch a single Service Binding @@ -464,14 +448,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceBinding]]._unwrapper, ), - cast_to=cast(Type[AddressingServiceBinding], ResultWrapper[AddressingServiceBinding]), + cast_to=cast(Type[Optional[ServiceBinding]], ResultWrapper[ServiceBinding]), ) -class BindingsWithRawResponse: - def __init__(self, bindings: Bindings) -> None: +class BindingsResourceWithRawResponse: + def __init__(self, bindings: BindingsResource) -> None: self._bindings = bindings self.create = to_raw_response_wrapper( @@ -488,8 +472,8 @@ def __init__(self, bindings: Bindings) -> None: ) -class AsyncBindingsWithRawResponse: - def __init__(self, bindings: AsyncBindings) -> None: +class AsyncBindingsResourceWithRawResponse: + def __init__(self, bindings: AsyncBindingsResource) -> None: self._bindings = bindings self.create = async_to_raw_response_wrapper( @@ -506,8 +490,8 @@ def __init__(self, bindings: AsyncBindings) -> None: ) -class BindingsWithStreamingResponse: - def __init__(self, bindings: Bindings) -> None: +class BindingsResourceWithStreamingResponse: + def __init__(self, bindings: BindingsResource) -> None: self._bindings = bindings self.create = to_streamed_response_wrapper( @@ -524,8 +508,8 @@ def __init__(self, bindings: Bindings) -> None: ) -class AsyncBindingsWithStreamingResponse: - def __init__(self, bindings: AsyncBindings) -> None: +class AsyncBindingsResourceWithStreamingResponse: + def __init__(self, bindings: AsyncBindingsResource) -> None: self._bindings = bindings self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py b/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py index 113ea0f6d3d..fc337311031 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,20 @@ AsyncPaginator, make_request_options, ) -from .....types.addressing.prefixes.bgp import AddressingIpamBGPPrefixes, prefix_edit_params +from .....types.addressing.prefixes.bgp import prefix_edit_params +from .....types.addressing.prefixes.bgp.bgp_prefix import BGPPrefix -__all__ = ["Prefixes", "AsyncPrefixes"] +__all__ = ["PrefixesResource", "AsyncPrefixesResource"] -class Prefixes(SyncAPIResource): +class PrefixesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PrefixesWithRawResponse: - return PrefixesWithRawResponse(self) + def with_raw_response(self) -> PrefixesResourceWithRawResponse: + return PrefixesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PrefixesWithStreamingResponse: - return PrefixesWithStreamingResponse(self) + def with_streaming_response(self) -> PrefixesResourceWithStreamingResponse: + return PrefixesResourceWithStreamingResponse(self) def list( self, @@ -50,7 +51,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AddressingIpamBGPPrefixes]: + ) -> SyncSinglePage[BGPPrefix]: """List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to @@ -77,11 +78,11 @@ def list( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes", - page=SyncSinglePage[AddressingIpamBGPPrefixes], + page=SyncSinglePage[BGPPrefix], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingIpamBGPPrefixes, + model=BGPPrefix, ) def edit( @@ -97,7 +98,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamBGPPrefixes: + ) -> Optional[BGPPrefix]: """ Update the properties of a BGP Prefix, such as the on demand advertisement status (advertised or withdrawn). @@ -131,9 +132,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamBGPPrefixes], ResultWrapper[AddressingIpamBGPPrefixes]), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), ) def get( @@ -148,7 +149,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamBGPPrefixes: + ) -> Optional[BGPPrefix]: """ Retrieve a single BGP Prefix according to its identifier @@ -180,20 +181,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamBGPPrefixes], ResultWrapper[AddressingIpamBGPPrefixes]), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), ) -class AsyncPrefixes(AsyncAPIResource): +class AsyncPrefixesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPrefixesWithRawResponse: - return AsyncPrefixesWithRawResponse(self) + def with_raw_response(self) -> AsyncPrefixesResourceWithRawResponse: + return AsyncPrefixesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPrefixesWithStreamingResponse: - return AsyncPrefixesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPrefixesResourceWithStreamingResponse: + return AsyncPrefixesResourceWithStreamingResponse(self) def list( self, @@ -206,7 +207,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AddressingIpamBGPPrefixes, AsyncSinglePage[AddressingIpamBGPPrefixes]]: + ) -> AsyncPaginator[BGPPrefix, AsyncSinglePage[BGPPrefix]]: """List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to @@ -233,11 +234,11 @@ def list( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes", - page=AsyncSinglePage[AddressingIpamBGPPrefixes], + page=AsyncSinglePage[BGPPrefix], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingIpamBGPPrefixes, + model=BGPPrefix, ) async def edit( @@ -253,7 +254,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamBGPPrefixes: + ) -> Optional[BGPPrefix]: """ Update the properties of a BGP Prefix, such as the on demand advertisement status (advertised or withdrawn). @@ -287,9 +288,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamBGPPrefixes], ResultWrapper[AddressingIpamBGPPrefixes]), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), ) async def get( @@ -304,7 +305,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamBGPPrefixes: + ) -> Optional[BGPPrefix]: """ Retrieve a single BGP Prefix according to its identifier @@ -336,14 +337,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamBGPPrefixes], ResultWrapper[AddressingIpamBGPPrefixes]), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), ) -class PrefixesWithRawResponse: - def __init__(self, prefixes: Prefixes) -> None: +class PrefixesResourceWithRawResponse: + def __init__(self, prefixes: PrefixesResource) -> None: self._prefixes = prefixes self.list = to_raw_response_wrapper( @@ -357,8 +358,8 @@ def __init__(self, prefixes: Prefixes) -> None: ) -class AsyncPrefixesWithRawResponse: - def __init__(self, prefixes: AsyncPrefixes) -> None: +class AsyncPrefixesResourceWithRawResponse: + def __init__(self, prefixes: AsyncPrefixesResource) -> None: self._prefixes = prefixes self.list = async_to_raw_response_wrapper( @@ -372,8 +373,8 @@ def __init__(self, prefixes: AsyncPrefixes) -> None: ) -class PrefixesWithStreamingResponse: - def __init__(self, prefixes: Prefixes) -> None: +class PrefixesResourceWithStreamingResponse: + def __init__(self, prefixes: PrefixesResource) -> None: self._prefixes = prefixes self.list = to_streamed_response_wrapper( @@ -387,8 +388,8 @@ def __init__(self, prefixes: Prefixes) -> None: ) -class AsyncPrefixesWithStreamingResponse: - def __init__(self, prefixes: AsyncPrefixes) -> None: +class AsyncPrefixesResourceWithStreamingResponse: + def __init__(self, prefixes: AsyncPrefixesResource) -> None: self._prefixes = prefixes self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py b/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py index c332fa7e27e..aca3d146bc4 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,21 @@ from ....._base_client import ( make_request_options, ) -from .....types.addressing.prefixes.bgp import StatusGetResponse, StatusEditResponse, status_edit_params +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 -__all__ = ["Statuses", "AsyncStatuses"] +__all__ = ["StatusesResource", "AsyncStatusesResource"] -class Statuses(SyncAPIResource): +class StatusesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> StatusesWithRawResponse: - return StatusesWithRawResponse(self) + def with_raw_response(self) -> StatusesResourceWithRawResponse: + return StatusesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> StatusesWithStreamingResponse: - return StatusesWithStreamingResponse(self) + def with_streaming_response(self) -> StatusesResourceWithStreamingResponse: + return StatusesResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +51,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatusEditResponse: + ) -> Optional[StatusEditResponse]: """ Advertise or withdraw BGP route for a prefix. @@ -80,9 +82,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[StatusEditResponse]]._unwrapper, ), - cast_to=cast(Type[StatusEditResponse], ResultWrapper[StatusEditResponse]), + cast_to=cast(Type[Optional[StatusEditResponse]], ResultWrapper[StatusEditResponse]), ) def get( @@ -96,7 +98,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatusGetResponse: + ) -> Optional[StatusGetResponse]: """ List the current advertisement state for a prefix. @@ -124,20 +126,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[StatusGetResponse]]._unwrapper, ), - cast_to=cast(Type[StatusGetResponse], ResultWrapper[StatusGetResponse]), + cast_to=cast(Type[Optional[StatusGetResponse]], ResultWrapper[StatusGetResponse]), ) -class AsyncStatuses(AsyncAPIResource): +class AsyncStatusesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncStatusesWithRawResponse: - return AsyncStatusesWithRawResponse(self) + def with_raw_response(self) -> AsyncStatusesResourceWithRawResponse: + return AsyncStatusesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncStatusesWithStreamingResponse: - return AsyncStatusesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncStatusesResourceWithStreamingResponse: + return AsyncStatusesResourceWithStreamingResponse(self) async def edit( self, @@ -151,7 +153,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatusEditResponse: + ) -> Optional[StatusEditResponse]: """ Advertise or withdraw BGP route for a prefix. @@ -182,9 +184,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[StatusEditResponse]]._unwrapper, ), - cast_to=cast(Type[StatusEditResponse], ResultWrapper[StatusEditResponse]), + cast_to=cast(Type[Optional[StatusEditResponse]], ResultWrapper[StatusEditResponse]), ) async def get( @@ -198,7 +200,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatusGetResponse: + ) -> Optional[StatusGetResponse]: """ List the current advertisement state for a prefix. @@ -226,14 +228,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[StatusGetResponse]]._unwrapper, ), - cast_to=cast(Type[StatusGetResponse], ResultWrapper[StatusGetResponse]), + cast_to=cast(Type[Optional[StatusGetResponse]], ResultWrapper[StatusGetResponse]), ) -class StatusesWithRawResponse: - def __init__(self, statuses: Statuses) -> None: +class StatusesResourceWithRawResponse: + def __init__(self, statuses: StatusesResource) -> None: self._statuses = statuses self.edit = to_raw_response_wrapper( @@ -244,8 +246,8 @@ def __init__(self, statuses: Statuses) -> None: ) -class AsyncStatusesWithRawResponse: - def __init__(self, statuses: AsyncStatuses) -> None: +class AsyncStatusesResourceWithRawResponse: + def __init__(self, statuses: AsyncStatusesResource) -> None: self._statuses = statuses self.edit = async_to_raw_response_wrapper( @@ -256,8 +258,8 @@ def __init__(self, statuses: AsyncStatuses) -> None: ) -class StatusesWithStreamingResponse: - def __init__(self, statuses: Statuses) -> None: +class StatusesResourceWithStreamingResponse: + def __init__(self, statuses: StatusesResource) -> None: self._statuses = statuses self.edit = to_streamed_response_wrapper( @@ -268,8 +270,8 @@ def __init__(self, statuses: Statuses) -> None: ) -class AsyncStatusesWithStreamingResponse: - def __init__(self, statuses: AsyncStatuses) -> None: +class AsyncStatusesResourceWithStreamingResponse: + def __init__(self, statuses: AsyncStatusesResource) -> None: self._statuses = statuses self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/prefixes/delegations.py b/src/cloudflare/resources/addressing/prefixes/delegations.py index 128e96049de..f82a45a6b17 100644 --- a/src/cloudflare/resources/addressing/prefixes/delegations.py +++ b/src/cloudflare/resources/addressing/prefixes/delegations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,21 @@ AsyncPaginator, make_request_options, ) -from ....types.addressing.prefixes import DelegationDeleteResponse, AddressingIpamDelegations, delegation_create_params +from ....types.addressing.prefixes import delegation_create_params, delegation_delete_params +from ....types.addressing.prefixes.delegations import Delegations +from ....types.addressing.prefixes.delegation_delete_response import DelegationDeleteResponse -__all__ = ["Delegations", "AsyncDelegations"] +__all__ = ["DelegationsResource", "AsyncDelegationsResource"] -class Delegations(SyncAPIResource): +class DelegationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DelegationsWithRawResponse: - return DelegationsWithRawResponse(self) + def with_raw_response(self) -> DelegationsResourceWithRawResponse: + return DelegationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DelegationsWithStreamingResponse: - return DelegationsWithStreamingResponse(self) + def with_streaming_response(self) -> DelegationsResourceWithStreamingResponse: + return DelegationsResourceWithStreamingResponse(self) def create( self, @@ -52,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamDelegations: + ) -> Optional[Delegations]: """ Create a new account delegation for a given IP prefix. @@ -91,9 +93,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Delegations]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamDelegations], ResultWrapper[AddressingIpamDelegations]), + cast_to=cast(Type[Optional[Delegations]], ResultWrapper[Delegations]), ) def list( @@ -107,7 +109,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AddressingIpamDelegations]: + ) -> SyncSinglePage[Delegations]: """ List all delegations for a given account IP prefix. @@ -130,11 +132,11 @@ def list( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/delegations", - page=SyncSinglePage[AddressingIpamDelegations], + page=SyncSinglePage[Delegations], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingIpamDelegations, + model=Delegations, ) def delete( @@ -143,13 +145,14 @@ def delete( *, account_id: str, prefix_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> DelegationDeleteResponse: + ) -> Optional[DelegationDeleteResponse]: """ Delete an account delegation for a given IP prefix. @@ -176,25 +179,26 @@ def delete( raise ValueError(f"Expected a non-empty value for `delegation_id` but received {delegation_id!r}") return self._delete( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/delegations/{delegation_id}", + body=maybe_transform(body, delegation_delete_params.DelegationDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DelegationDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[DelegationDeleteResponse], ResultWrapper[DelegationDeleteResponse]), + cast_to=cast(Type[Optional[DelegationDeleteResponse]], ResultWrapper[DelegationDeleteResponse]), ) -class AsyncDelegations(AsyncAPIResource): +class AsyncDelegationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDelegationsWithRawResponse: - return AsyncDelegationsWithRawResponse(self) + def with_raw_response(self) -> AsyncDelegationsResourceWithRawResponse: + return AsyncDelegationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDelegationsWithStreamingResponse: - return AsyncDelegationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDelegationsResourceWithStreamingResponse: + return AsyncDelegationsResourceWithStreamingResponse(self) async def create( self, @@ -209,7 +213,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamDelegations: + ) -> Optional[Delegations]: """ Create a new account delegation for a given IP prefix. @@ -248,9 +252,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Delegations]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamDelegations], ResultWrapper[AddressingIpamDelegations]), + cast_to=cast(Type[Optional[Delegations]], ResultWrapper[Delegations]), ) def list( @@ -264,7 +268,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AddressingIpamDelegations, AsyncSinglePage[AddressingIpamDelegations]]: + ) -> AsyncPaginator[Delegations, AsyncSinglePage[Delegations]]: """ List all delegations for a given account IP prefix. @@ -287,11 +291,11 @@ def list( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/delegations", - page=AsyncSinglePage[AddressingIpamDelegations], + page=AsyncSinglePage[Delegations], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingIpamDelegations, + model=Delegations, ) async def delete( @@ -300,13 +304,14 @@ async def delete( *, account_id: str, prefix_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> DelegationDeleteResponse: + ) -> Optional[DelegationDeleteResponse]: """ Delete an account delegation for a given IP prefix. @@ -333,19 +338,20 @@ async def delete( raise ValueError(f"Expected a non-empty value for `delegation_id` but received {delegation_id!r}") return await self._delete( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/delegations/{delegation_id}", + body=await async_maybe_transform(body, delegation_delete_params.DelegationDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DelegationDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[DelegationDeleteResponse], ResultWrapper[DelegationDeleteResponse]), + cast_to=cast(Type[Optional[DelegationDeleteResponse]], ResultWrapper[DelegationDeleteResponse]), ) -class DelegationsWithRawResponse: - def __init__(self, delegations: Delegations) -> None: +class DelegationsResourceWithRawResponse: + def __init__(self, delegations: DelegationsResource) -> None: self._delegations = delegations self.create = to_raw_response_wrapper( @@ -359,8 +365,8 @@ def __init__(self, delegations: Delegations) -> None: ) -class AsyncDelegationsWithRawResponse: - def __init__(self, delegations: AsyncDelegations) -> None: +class AsyncDelegationsResourceWithRawResponse: + def __init__(self, delegations: AsyncDelegationsResource) -> None: self._delegations = delegations self.create = async_to_raw_response_wrapper( @@ -374,8 +380,8 @@ def __init__(self, delegations: AsyncDelegations) -> None: ) -class DelegationsWithStreamingResponse: - def __init__(self, delegations: Delegations) -> None: +class DelegationsResourceWithStreamingResponse: + def __init__(self, delegations: DelegationsResource) -> None: self._delegations = delegations self.create = to_streamed_response_wrapper( @@ -389,8 +395,8 @@ def __init__(self, delegations: Delegations) -> None: ) -class AsyncDelegationsWithStreamingResponse: - def __init__(self, delegations: AsyncDelegations) -> None: +class AsyncDelegationsResourceWithStreamingResponse: + def __init__(self, delegations: AsyncDelegationsResource) -> None: self._delegations = delegations self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/addressing/prefixes/prefixes.py b/src/cloudflare/resources/addressing/prefixes/prefixes.py index c93fbcd9ef6..e73b6e4edeb 100644 --- a/src/cloudflare/resources/addressing/prefixes/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/prefixes.py @@ -2,19 +2,19 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast import httpx from .bgp import ( - BGP, - AsyncBGP, - BGPWithRawResponse, - AsyncBGPWithRawResponse, - BGPWithStreamingResponse, - AsyncBGPWithStreamingResponse, + BGPResource, + AsyncBGPResource, + BGPResourceWithRawResponse, + AsyncBGPResourceWithRawResponse, + BGPResourceWithStreamingResponse, + AsyncBGPResourceWithStreamingResponse, ) -from .bgp.bgp import BGP, AsyncBGP +from .bgp.bgp import BGPResource, AsyncBGPResource from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( maybe_transform, @@ -22,12 +22,12 @@ ) from ...._compat import cached_property from .delegations import ( - Delegations, - AsyncDelegations, - DelegationsWithRawResponse, - AsyncDelegationsWithRawResponse, - DelegationsWithStreamingResponse, - AsyncDelegationsWithStreamingResponse, + DelegationsResource, + AsyncDelegationsResource, + DelegationsResourceWithRawResponse, + AsyncDelegationsResourceWithRawResponse, + DelegationsResourceWithStreamingResponse, + AsyncDelegationsResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -42,27 +42,29 @@ AsyncPaginator, make_request_options, ) -from ....types.addressing import PrefixDeleteResponse, AddressingIpamPrefixes, prefix_edit_params, prefix_create_params +from ....types.addressing import prefix_edit_params, prefix_create_params, prefix_delete_params +from ....types.addressing.prefix import Prefix +from ....types.addressing.prefix_delete_response import PrefixDeleteResponse -__all__ = ["Prefixes", "AsyncPrefixes"] +__all__ = ["PrefixesResource", "AsyncPrefixesResource"] -class Prefixes(SyncAPIResource): +class PrefixesResource(SyncAPIResource): @cached_property - def bgp(self) -> BGP: - return BGP(self._client) + def bgp(self) -> BGPResource: + return BGPResource(self._client) @cached_property - def delegations(self) -> Delegations: - return Delegations(self._client) + def delegations(self) -> DelegationsResource: + return DelegationsResource(self._client) @cached_property - def with_raw_response(self) -> PrefixesWithRawResponse: - return PrefixesWithRawResponse(self) + def with_raw_response(self) -> PrefixesResourceWithRawResponse: + return PrefixesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PrefixesWithStreamingResponse: - return PrefixesWithStreamingResponse(self) + def with_streaming_response(self) -> PrefixesResourceWithStreamingResponse: + return PrefixesResourceWithStreamingResponse(self) def create( self, @@ -77,7 +79,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamPrefixes: + ) -> Optional[Prefix]: """ Add a new prefix under the account. @@ -115,9 +117,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamPrefixes], ResultWrapper[AddressingIpamPrefixes]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) def list( @@ -130,7 +132,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AddressingIpamPrefixes]: + ) -> SyncSinglePage[Prefix]: """ List all prefixes owned by the account. @@ -149,11 +151,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes", - page=SyncSinglePage[AddressingIpamPrefixes], + page=SyncSinglePage[Prefix], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingIpamPrefixes, + model=Prefix, ) def delete( @@ -161,6 +163,7 @@ def delete( prefix_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -188,21 +191,17 @@ def delete( 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 cast( - Optional[PrefixDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PrefixDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}", + body=maybe_transform(body, prefix_delete_params.PrefixDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PrefixDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PrefixDeleteResponse]], ResultWrapper[PrefixDeleteResponse]), ) def edit( @@ -217,7 +216,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamPrefixes: + ) -> Optional[Prefix]: """ Modify the description for a prefix owned by the account. @@ -248,9 +247,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamPrefixes], ResultWrapper[AddressingIpamPrefixes]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) def get( @@ -264,7 +263,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamPrefixes: + ) -> Optional[Prefix]: """ List a particular prefix owned by the account. @@ -292,28 +291,28 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamPrefixes], ResultWrapper[AddressingIpamPrefixes]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) -class AsyncPrefixes(AsyncAPIResource): +class AsyncPrefixesResource(AsyncAPIResource): @cached_property - def bgp(self) -> AsyncBGP: - return AsyncBGP(self._client) + def bgp(self) -> AsyncBGPResource: + return AsyncBGPResource(self._client) @cached_property - def delegations(self) -> AsyncDelegations: - return AsyncDelegations(self._client) + def delegations(self) -> AsyncDelegationsResource: + return AsyncDelegationsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPrefixesWithRawResponse: - return AsyncPrefixesWithRawResponse(self) + def with_raw_response(self) -> AsyncPrefixesResourceWithRawResponse: + return AsyncPrefixesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPrefixesWithStreamingResponse: - return AsyncPrefixesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPrefixesResourceWithStreamingResponse: + return AsyncPrefixesResourceWithStreamingResponse(self) async def create( self, @@ -328,7 +327,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamPrefixes: + ) -> Optional[Prefix]: """ Add a new prefix under the account. @@ -366,9 +365,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamPrefixes], ResultWrapper[AddressingIpamPrefixes]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) def list( @@ -381,7 +380,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AddressingIpamPrefixes, AsyncSinglePage[AddressingIpamPrefixes]]: + ) -> AsyncPaginator[Prefix, AsyncSinglePage[Prefix]]: """ List all prefixes owned by the account. @@ -400,11 +399,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes", - page=AsyncSinglePage[AddressingIpamPrefixes], + page=AsyncSinglePage[Prefix], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AddressingIpamPrefixes, + model=Prefix, ) async def delete( @@ -412,6 +411,7 @@ async def delete( prefix_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -439,21 +439,17 @@ async def delete( 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 cast( - Optional[PrefixDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PrefixDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}", + body=await async_maybe_transform(body, prefix_delete_params.PrefixDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PrefixDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PrefixDeleteResponse]], ResultWrapper[PrefixDeleteResponse]), ) async def edit( @@ -468,7 +464,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamPrefixes: + ) -> Optional[Prefix]: """ Modify the description for a prefix owned by the account. @@ -499,9 +495,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamPrefixes], ResultWrapper[AddressingIpamPrefixes]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) async def get( @@ -515,7 +511,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressingIpamPrefixes: + ) -> Optional[Prefix]: """ List a particular prefix owned by the account. @@ -543,14 +539,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[AddressingIpamPrefixes], ResultWrapper[AddressingIpamPrefixes]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) -class PrefixesWithRawResponse: - def __init__(self, prefixes: Prefixes) -> None: +class PrefixesResourceWithRawResponse: + def __init__(self, prefixes: PrefixesResource) -> None: self._prefixes = prefixes self.create = to_raw_response_wrapper( @@ -570,16 +566,16 @@ def __init__(self, prefixes: Prefixes) -> None: ) @cached_property - def bgp(self) -> BGPWithRawResponse: - return BGPWithRawResponse(self._prefixes.bgp) + def bgp(self) -> BGPResourceWithRawResponse: + return BGPResourceWithRawResponse(self._prefixes.bgp) @cached_property - def delegations(self) -> DelegationsWithRawResponse: - return DelegationsWithRawResponse(self._prefixes.delegations) + def delegations(self) -> DelegationsResourceWithRawResponse: + return DelegationsResourceWithRawResponse(self._prefixes.delegations) -class AsyncPrefixesWithRawResponse: - def __init__(self, prefixes: AsyncPrefixes) -> None: +class AsyncPrefixesResourceWithRawResponse: + def __init__(self, prefixes: AsyncPrefixesResource) -> None: self._prefixes = prefixes self.create = async_to_raw_response_wrapper( @@ -599,16 +595,16 @@ def __init__(self, prefixes: AsyncPrefixes) -> None: ) @cached_property - def bgp(self) -> AsyncBGPWithRawResponse: - return AsyncBGPWithRawResponse(self._prefixes.bgp) + def bgp(self) -> AsyncBGPResourceWithRawResponse: + return AsyncBGPResourceWithRawResponse(self._prefixes.bgp) @cached_property - def delegations(self) -> AsyncDelegationsWithRawResponse: - return AsyncDelegationsWithRawResponse(self._prefixes.delegations) + def delegations(self) -> AsyncDelegationsResourceWithRawResponse: + return AsyncDelegationsResourceWithRawResponse(self._prefixes.delegations) -class PrefixesWithStreamingResponse: - def __init__(self, prefixes: Prefixes) -> None: +class PrefixesResourceWithStreamingResponse: + def __init__(self, prefixes: PrefixesResource) -> None: self._prefixes = prefixes self.create = to_streamed_response_wrapper( @@ -628,16 +624,16 @@ def __init__(self, prefixes: Prefixes) -> None: ) @cached_property - def bgp(self) -> BGPWithStreamingResponse: - return BGPWithStreamingResponse(self._prefixes.bgp) + def bgp(self) -> BGPResourceWithStreamingResponse: + return BGPResourceWithStreamingResponse(self._prefixes.bgp) @cached_property - def delegations(self) -> DelegationsWithStreamingResponse: - return DelegationsWithStreamingResponse(self._prefixes.delegations) + def delegations(self) -> DelegationsResourceWithStreamingResponse: + return DelegationsResourceWithStreamingResponse(self._prefixes.delegations) -class AsyncPrefixesWithStreamingResponse: - def __init__(self, prefixes: AsyncPrefixes) -> None: +class AsyncPrefixesResourceWithStreamingResponse: + def __init__(self, prefixes: AsyncPrefixesResource) -> None: self._prefixes = prefixes self.create = async_to_streamed_response_wrapper( @@ -657,9 +653,9 @@ def __init__(self, prefixes: AsyncPrefixes) -> None: ) @cached_property - def bgp(self) -> AsyncBGPWithStreamingResponse: - return AsyncBGPWithStreamingResponse(self._prefixes.bgp) + def bgp(self) -> AsyncBGPResourceWithStreamingResponse: + return AsyncBGPResourceWithStreamingResponse(self._prefixes.bgp) @cached_property - def delegations(self) -> AsyncDelegationsWithStreamingResponse: - return AsyncDelegationsWithStreamingResponse(self._prefixes.delegations) + def delegations(self) -> AsyncDelegationsResourceWithStreamingResponse: + return AsyncDelegationsResourceWithStreamingResponse(self._prefixes.delegations) diff --git a/src/cloudflare/resources/addressing/services.py b/src/cloudflare/resources/addressing/services.py index 13a93ebb865..4b97ccde1a2 100644 --- a/src/cloudflare/resources/addressing/services.py +++ b/src/cloudflare/resources/addressing/services.py @@ -18,19 +18,19 @@ AsyncPaginator, make_request_options, ) -from ...types.addressing import ServiceListResponse +from ...types.addressing.service_list_response import ServiceListResponse -__all__ = ["Services", "AsyncServices"] +__all__ = ["ServicesResource", "AsyncServicesResource"] -class Services(SyncAPIResource): +class ServicesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ServicesWithRawResponse: - return ServicesWithRawResponse(self) + def with_raw_response(self) -> ServicesResourceWithRawResponse: + return ServicesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ServicesWithStreamingResponse: - return ServicesWithStreamingResponse(self) + def with_streaming_response(self) -> ServicesResourceWithStreamingResponse: + return ServicesResourceWithStreamingResponse(self) def list( self, @@ -72,14 +72,14 @@ def list( ) -class AsyncServices(AsyncAPIResource): +class AsyncServicesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncServicesWithRawResponse: - return AsyncServicesWithRawResponse(self) + def with_raw_response(self) -> AsyncServicesResourceWithRawResponse: + return AsyncServicesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncServicesWithStreamingResponse: - return AsyncServicesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncServicesResourceWithStreamingResponse: + return AsyncServicesResourceWithStreamingResponse(self) def list( self, @@ -121,8 +121,8 @@ def list( ) -class ServicesWithRawResponse: - def __init__(self, services: Services) -> None: +class ServicesResourceWithRawResponse: + def __init__(self, services: ServicesResource) -> None: self._services = services self.list = to_raw_response_wrapper( @@ -130,8 +130,8 @@ def __init__(self, services: Services) -> None: ) -class AsyncServicesWithRawResponse: - def __init__(self, services: AsyncServices) -> None: +class AsyncServicesResourceWithRawResponse: + def __init__(self, services: AsyncServicesResource) -> None: self._services = services self.list = async_to_raw_response_wrapper( @@ -139,8 +139,8 @@ def __init__(self, services: AsyncServices) -> None: ) -class ServicesWithStreamingResponse: - def __init__(self, services: Services) -> None: +class ServicesResourceWithStreamingResponse: + def __init__(self, services: ServicesResource) -> None: self._services = services self.list = to_streamed_response_wrapper( @@ -148,8 +148,8 @@ def __init__(self, services: Services) -> None: ) -class AsyncServicesWithStreamingResponse: - def __init__(self, services: AsyncServices) -> None: +class AsyncServicesResourceWithStreamingResponse: + def __init__(self, services: AsyncServicesResource) -> None: self._services = services self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/alerting/__init__.py b/src/cloudflare/resources/alerting/__init__.py index 055626c3866..2bf1c17a8f3 100644 --- a/src/cloudflare/resources/alerting/__init__.py +++ b/src/cloudflare/resources/alerting/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .history import ( - History, - AsyncHistory, - HistoryWithRawResponse, - AsyncHistoryWithRawResponse, - HistoryWithStreamingResponse, - AsyncHistoryWithStreamingResponse, + HistoryResource, + AsyncHistoryResource, + HistoryResourceWithRawResponse, + AsyncHistoryResourceWithRawResponse, + HistoryResourceWithStreamingResponse, + AsyncHistoryResourceWithStreamingResponse, ) from .alerting import ( - Alerting, - AsyncAlerting, - AlertingWithRawResponse, - AsyncAlertingWithRawResponse, - AlertingWithStreamingResponse, - AsyncAlertingWithStreamingResponse, + AlertingResource, + AsyncAlertingResource, + AlertingResourceWithRawResponse, + AsyncAlertingResourceWithRawResponse, + AlertingResourceWithStreamingResponse, + AsyncAlertingResourceWithStreamingResponse, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from .destinations import ( - Destinations, - AsyncDestinations, - DestinationsWithRawResponse, - AsyncDestinationsWithRawResponse, - DestinationsWithStreamingResponse, - AsyncDestinationsWithStreamingResponse, + DestinationsResource, + AsyncDestinationsResource, + DestinationsResourceWithRawResponse, + AsyncDestinationsResourceWithRawResponse, + DestinationsResourceWithStreamingResponse, + AsyncDestinationsResourceWithStreamingResponse, ) from .available_alerts import ( - AvailableAlerts, - AsyncAvailableAlerts, - AvailableAlertsWithRawResponse, - AsyncAvailableAlertsWithRawResponse, - AvailableAlertsWithStreamingResponse, - AsyncAvailableAlertsWithStreamingResponse, + AvailableAlertsResource, + AsyncAvailableAlertsResource, + AvailableAlertsResourceWithRawResponse, + AsyncAvailableAlertsResourceWithRawResponse, + AvailableAlertsResourceWithStreamingResponse, + AsyncAvailableAlertsResourceWithStreamingResponse, ) __all__ = [ - "AvailableAlerts", - "AsyncAvailableAlerts", - "AvailableAlertsWithRawResponse", - "AsyncAvailableAlertsWithRawResponse", - "AvailableAlertsWithStreamingResponse", - "AsyncAvailableAlertsWithStreamingResponse", - "Destinations", - "AsyncDestinations", - "DestinationsWithRawResponse", - "AsyncDestinationsWithRawResponse", - "DestinationsWithStreamingResponse", - "AsyncDestinationsWithStreamingResponse", - "History", - "AsyncHistory", - "HistoryWithRawResponse", - "AsyncHistoryWithRawResponse", - "HistoryWithStreamingResponse", - "AsyncHistoryWithStreamingResponse", - "Policies", - "AsyncPolicies", - "PoliciesWithRawResponse", - "AsyncPoliciesWithRawResponse", - "PoliciesWithStreamingResponse", - "AsyncPoliciesWithStreamingResponse", - "Alerting", - "AsyncAlerting", - "AlertingWithRawResponse", - "AsyncAlertingWithRawResponse", - "AlertingWithStreamingResponse", - "AsyncAlertingWithStreamingResponse", + "AvailableAlertsResource", + "AsyncAvailableAlertsResource", + "AvailableAlertsResourceWithRawResponse", + "AsyncAvailableAlertsResourceWithRawResponse", + "AvailableAlertsResourceWithStreamingResponse", + "AsyncAvailableAlertsResourceWithStreamingResponse", + "DestinationsResource", + "AsyncDestinationsResource", + "DestinationsResourceWithRawResponse", + "AsyncDestinationsResourceWithRawResponse", + "DestinationsResourceWithStreamingResponse", + "AsyncDestinationsResourceWithStreamingResponse", + "HistoryResource", + "AsyncHistoryResource", + "HistoryResourceWithRawResponse", + "AsyncHistoryResourceWithRawResponse", + "HistoryResourceWithStreamingResponse", + "AsyncHistoryResourceWithStreamingResponse", + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", + "AlertingResource", + "AsyncAlertingResource", + "AlertingResourceWithRawResponse", + "AsyncAlertingResourceWithRawResponse", + "AlertingResourceWithStreamingResponse", + "AsyncAlertingResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/alerting/alerting.py b/src/cloudflare/resources/alerting/alerting.py index 24e7cc35418..05d80699a14 100644 --- a/src/cloudflare/resources/alerting/alerting.py +++ b/src/cloudflare/resources/alerting/alerting.py @@ -3,175 +3,175 @@ from __future__ import annotations from .history import ( - History, - AsyncHistory, - HistoryWithRawResponse, - AsyncHistoryWithRawResponse, - HistoryWithStreamingResponse, - AsyncHistoryWithStreamingResponse, + HistoryResource, + AsyncHistoryResource, + HistoryResourceWithRawResponse, + AsyncHistoryResourceWithRawResponse, + HistoryResourceWithStreamingResponse, + AsyncHistoryResourceWithStreamingResponse, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from .destinations import ( - Destinations, - AsyncDestinations, - DestinationsWithRawResponse, - AsyncDestinationsWithRawResponse, - DestinationsWithStreamingResponse, - AsyncDestinationsWithStreamingResponse, + DestinationsResource, + AsyncDestinationsResource, + DestinationsResourceWithRawResponse, + AsyncDestinationsResourceWithRawResponse, + DestinationsResourceWithStreamingResponse, + AsyncDestinationsResourceWithStreamingResponse, ) from .available_alerts import ( - AvailableAlerts, - AsyncAvailableAlerts, - AvailableAlertsWithRawResponse, - AsyncAvailableAlertsWithRawResponse, - AvailableAlertsWithStreamingResponse, - AsyncAvailableAlertsWithStreamingResponse, + AvailableAlertsResource, + AsyncAvailableAlertsResource, + AvailableAlertsResourceWithRawResponse, + AsyncAvailableAlertsResourceWithRawResponse, + AvailableAlertsResourceWithStreamingResponse, + AsyncAvailableAlertsResourceWithStreamingResponse, ) -from .destinations.destinations import Destinations, AsyncDestinations +from .destinations.destinations import DestinationsResource, AsyncDestinationsResource -__all__ = ["Alerting", "AsyncAlerting"] +__all__ = ["AlertingResource", "AsyncAlertingResource"] -class Alerting(SyncAPIResource): +class AlertingResource(SyncAPIResource): @cached_property - def available_alerts(self) -> AvailableAlerts: - return AvailableAlerts(self._client) + def available_alerts(self) -> AvailableAlertsResource: + return AvailableAlertsResource(self._client) @cached_property - def destinations(self) -> Destinations: - return Destinations(self._client) + def destinations(self) -> DestinationsResource: + return DestinationsResource(self._client) @cached_property - def history(self) -> History: - return History(self._client) + def history(self) -> HistoryResource: + return HistoryResource(self._client) @cached_property - def policies(self) -> Policies: - return Policies(self._client) + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) @cached_property - def with_raw_response(self) -> AlertingWithRawResponse: - return AlertingWithRawResponse(self) + def with_raw_response(self) -> AlertingResourceWithRawResponse: + return AlertingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AlertingWithStreamingResponse: - return AlertingWithStreamingResponse(self) + def with_streaming_response(self) -> AlertingResourceWithStreamingResponse: + return AlertingResourceWithStreamingResponse(self) -class AsyncAlerting(AsyncAPIResource): +class AsyncAlertingResource(AsyncAPIResource): @cached_property - def available_alerts(self) -> AsyncAvailableAlerts: - return AsyncAvailableAlerts(self._client) + def available_alerts(self) -> AsyncAvailableAlertsResource: + return AsyncAvailableAlertsResource(self._client) @cached_property - def destinations(self) -> AsyncDestinations: - return AsyncDestinations(self._client) + def destinations(self) -> AsyncDestinationsResource: + return AsyncDestinationsResource(self._client) @cached_property - def history(self) -> AsyncHistory: - return AsyncHistory(self._client) + def history(self) -> AsyncHistoryResource: + return AsyncHistoryResource(self._client) @cached_property - def policies(self) -> AsyncPolicies: - return AsyncPolicies(self._client) + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAlertingWithRawResponse: - return AsyncAlertingWithRawResponse(self) + def with_raw_response(self) -> AsyncAlertingResourceWithRawResponse: + return AsyncAlertingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAlertingWithStreamingResponse: - return AsyncAlertingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAlertingResourceWithStreamingResponse: + return AsyncAlertingResourceWithStreamingResponse(self) -class AlertingWithRawResponse: - def __init__(self, alerting: Alerting) -> None: +class AlertingResourceWithRawResponse: + def __init__(self, alerting: AlertingResource) -> None: self._alerting = alerting @cached_property - def available_alerts(self) -> AvailableAlertsWithRawResponse: - return AvailableAlertsWithRawResponse(self._alerting.available_alerts) + def available_alerts(self) -> AvailableAlertsResourceWithRawResponse: + return AvailableAlertsResourceWithRawResponse(self._alerting.available_alerts) @cached_property - def destinations(self) -> DestinationsWithRawResponse: - return DestinationsWithRawResponse(self._alerting.destinations) + def destinations(self) -> DestinationsResourceWithRawResponse: + return DestinationsResourceWithRawResponse(self._alerting.destinations) @cached_property - def history(self) -> HistoryWithRawResponse: - return HistoryWithRawResponse(self._alerting.history) + def history(self) -> HistoryResourceWithRawResponse: + return HistoryResourceWithRawResponse(self._alerting.history) @cached_property - def policies(self) -> PoliciesWithRawResponse: - return PoliciesWithRawResponse(self._alerting.policies) + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._alerting.policies) -class AsyncAlertingWithRawResponse: - def __init__(self, alerting: AsyncAlerting) -> None: +class AsyncAlertingResourceWithRawResponse: + def __init__(self, alerting: AsyncAlertingResource) -> None: self._alerting = alerting @cached_property - def available_alerts(self) -> AsyncAvailableAlertsWithRawResponse: - return AsyncAvailableAlertsWithRawResponse(self._alerting.available_alerts) + def available_alerts(self) -> AsyncAvailableAlertsResourceWithRawResponse: + return AsyncAvailableAlertsResourceWithRawResponse(self._alerting.available_alerts) @cached_property - def destinations(self) -> AsyncDestinationsWithRawResponse: - return AsyncDestinationsWithRawResponse(self._alerting.destinations) + def destinations(self) -> AsyncDestinationsResourceWithRawResponse: + return AsyncDestinationsResourceWithRawResponse(self._alerting.destinations) @cached_property - def history(self) -> AsyncHistoryWithRawResponse: - return AsyncHistoryWithRawResponse(self._alerting.history) + def history(self) -> AsyncHistoryResourceWithRawResponse: + return AsyncHistoryResourceWithRawResponse(self._alerting.history) @cached_property - def policies(self) -> AsyncPoliciesWithRawResponse: - return AsyncPoliciesWithRawResponse(self._alerting.policies) + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._alerting.policies) -class AlertingWithStreamingResponse: - def __init__(self, alerting: Alerting) -> None: +class AlertingResourceWithStreamingResponse: + def __init__(self, alerting: AlertingResource) -> None: self._alerting = alerting @cached_property - def available_alerts(self) -> AvailableAlertsWithStreamingResponse: - return AvailableAlertsWithStreamingResponse(self._alerting.available_alerts) + def available_alerts(self) -> AvailableAlertsResourceWithStreamingResponse: + return AvailableAlertsResourceWithStreamingResponse(self._alerting.available_alerts) @cached_property - def destinations(self) -> DestinationsWithStreamingResponse: - return DestinationsWithStreamingResponse(self._alerting.destinations) + def destinations(self) -> DestinationsResourceWithStreamingResponse: + return DestinationsResourceWithStreamingResponse(self._alerting.destinations) @cached_property - def history(self) -> HistoryWithStreamingResponse: - return HistoryWithStreamingResponse(self._alerting.history) + def history(self) -> HistoryResourceWithStreamingResponse: + return HistoryResourceWithStreamingResponse(self._alerting.history) @cached_property - def policies(self) -> PoliciesWithStreamingResponse: - return PoliciesWithStreamingResponse(self._alerting.policies) + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._alerting.policies) -class AsyncAlertingWithStreamingResponse: - def __init__(self, alerting: AsyncAlerting) -> None: +class AsyncAlertingResourceWithStreamingResponse: + def __init__(self, alerting: AsyncAlertingResource) -> None: self._alerting = alerting @cached_property - def available_alerts(self) -> AsyncAvailableAlertsWithStreamingResponse: - return AsyncAvailableAlertsWithStreamingResponse(self._alerting.available_alerts) + def available_alerts(self) -> AsyncAvailableAlertsResourceWithStreamingResponse: + return AsyncAvailableAlertsResourceWithStreamingResponse(self._alerting.available_alerts) @cached_property - def destinations(self) -> AsyncDestinationsWithStreamingResponse: - return AsyncDestinationsWithStreamingResponse(self._alerting.destinations) + def destinations(self) -> AsyncDestinationsResourceWithStreamingResponse: + return AsyncDestinationsResourceWithStreamingResponse(self._alerting.destinations) @cached_property - def history(self) -> AsyncHistoryWithStreamingResponse: - return AsyncHistoryWithStreamingResponse(self._alerting.history) + def history(self) -> AsyncHistoryResourceWithStreamingResponse: + return AsyncHistoryResourceWithStreamingResponse(self._alerting.history) @cached_property - def policies(self) -> AsyncPoliciesWithStreamingResponse: - return AsyncPoliciesWithStreamingResponse(self._alerting.policies) + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._alerting.policies) diff --git a/src/cloudflare/resources/alerting/available_alerts.py b/src/cloudflare/resources/alerting/available_alerts.py index 660b0e2fb6f..abcc97045c4 100644 --- a/src/cloudflare/resources/alerting/available_alerts.py +++ b/src/cloudflare/resources/alerting/available_alerts.py @@ -19,19 +19,19 @@ from ..._base_client import ( make_request_options, ) -from ...types.alerting import AvailableAlertListResponse +from ...types.alerting.available_alert_list_response import AvailableAlertListResponse -__all__ = ["AvailableAlerts", "AsyncAvailableAlerts"] +__all__ = ["AvailableAlertsResource", "AsyncAvailableAlertsResource"] -class AvailableAlerts(SyncAPIResource): +class AvailableAlertsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AvailableAlertsWithRawResponse: - return AvailableAlertsWithRawResponse(self) + def with_raw_response(self) -> AvailableAlertsResourceWithRawResponse: + return AvailableAlertsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AvailableAlertsWithStreamingResponse: - return AvailableAlertsWithStreamingResponse(self) + def with_streaming_response(self) -> AvailableAlertsResourceWithStreamingResponse: + return AvailableAlertsResourceWithStreamingResponse(self) def list( self, @@ -69,7 +69,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AvailableAlertListResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AvailableAlertListResponse] @@ -78,14 +78,14 @@ def list( ) -class AsyncAvailableAlerts(AsyncAPIResource): +class AsyncAvailableAlertsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAvailableAlertsWithRawResponse: - return AsyncAvailableAlertsWithRawResponse(self) + def with_raw_response(self) -> AsyncAvailableAlertsResourceWithRawResponse: + return AsyncAvailableAlertsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAvailableAlertsWithStreamingResponse: - return AsyncAvailableAlertsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAvailableAlertsResourceWithStreamingResponse: + return AsyncAvailableAlertsResourceWithStreamingResponse(self) async def list( self, @@ -123,7 +123,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AvailableAlertListResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AvailableAlertListResponse] @@ -132,8 +132,8 @@ async def list( ) -class AvailableAlertsWithRawResponse: - def __init__(self, available_alerts: AvailableAlerts) -> None: +class AvailableAlertsResourceWithRawResponse: + def __init__(self, available_alerts: AvailableAlertsResource) -> None: self._available_alerts = available_alerts self.list = to_raw_response_wrapper( @@ -141,8 +141,8 @@ def __init__(self, available_alerts: AvailableAlerts) -> None: ) -class AsyncAvailableAlertsWithRawResponse: - def __init__(self, available_alerts: AsyncAvailableAlerts) -> None: +class AsyncAvailableAlertsResourceWithRawResponse: + def __init__(self, available_alerts: AsyncAvailableAlertsResource) -> None: self._available_alerts = available_alerts self.list = async_to_raw_response_wrapper( @@ -150,8 +150,8 @@ def __init__(self, available_alerts: AsyncAvailableAlerts) -> None: ) -class AvailableAlertsWithStreamingResponse: - def __init__(self, available_alerts: AvailableAlerts) -> None: +class AvailableAlertsResourceWithStreamingResponse: + def __init__(self, available_alerts: AvailableAlertsResource) -> None: self._available_alerts = available_alerts self.list = to_streamed_response_wrapper( @@ -159,8 +159,8 @@ def __init__(self, available_alerts: AvailableAlerts) -> None: ) -class AsyncAvailableAlertsWithStreamingResponse: - def __init__(self, available_alerts: AsyncAvailableAlerts) -> None: +class AsyncAvailableAlertsResourceWithStreamingResponse: + def __init__(self, available_alerts: AsyncAvailableAlertsResource) -> None: self._available_alerts = available_alerts self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/alerting/destinations/__init__.py b/src/cloudflare/resources/alerting/destinations/__init__.py index bf0c2e4e0b8..611f1d5a231 100644 --- a/src/cloudflare/resources/alerting/destinations/__init__.py +++ b/src/cloudflare/resources/alerting/destinations/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .eligible import ( - Eligible, - AsyncEligible, - EligibleWithRawResponse, - AsyncEligibleWithRawResponse, - EligibleWithStreamingResponse, - AsyncEligibleWithStreamingResponse, + EligibleResource, + AsyncEligibleResource, + EligibleResourceWithRawResponse, + AsyncEligibleResourceWithRawResponse, + EligibleResourceWithStreamingResponse, + AsyncEligibleResourceWithStreamingResponse, ) from .webhooks import ( - Webhooks, - AsyncWebhooks, - WebhooksWithRawResponse, - AsyncWebhooksWithRawResponse, - WebhooksWithStreamingResponse, - AsyncWebhooksWithStreamingResponse, + WebhooksResource, + AsyncWebhooksResource, + WebhooksResourceWithRawResponse, + AsyncWebhooksResourceWithRawResponse, + WebhooksResourceWithStreamingResponse, + AsyncWebhooksResourceWithStreamingResponse, ) from .pagerduty import ( - Pagerduty, - AsyncPagerduty, - PagerdutyWithRawResponse, - AsyncPagerdutyWithRawResponse, - PagerdutyWithStreamingResponse, - AsyncPagerdutyWithStreamingResponse, + PagerdutyResource, + AsyncPagerdutyResource, + PagerdutyResourceWithRawResponse, + AsyncPagerdutyResourceWithRawResponse, + PagerdutyResourceWithStreamingResponse, + AsyncPagerdutyResourceWithStreamingResponse, ) from .destinations import ( - Destinations, - AsyncDestinations, - DestinationsWithRawResponse, - AsyncDestinationsWithRawResponse, - DestinationsWithStreamingResponse, - AsyncDestinationsWithStreamingResponse, + DestinationsResource, + AsyncDestinationsResource, + DestinationsResourceWithRawResponse, + AsyncDestinationsResourceWithRawResponse, + DestinationsResourceWithStreamingResponse, + AsyncDestinationsResourceWithStreamingResponse, ) __all__ = [ - "Eligible", - "AsyncEligible", - "EligibleWithRawResponse", - "AsyncEligibleWithRawResponse", - "EligibleWithStreamingResponse", - "AsyncEligibleWithStreamingResponse", - "Pagerduty", - "AsyncPagerduty", - "PagerdutyWithRawResponse", - "AsyncPagerdutyWithRawResponse", - "PagerdutyWithStreamingResponse", - "AsyncPagerdutyWithStreamingResponse", - "Webhooks", - "AsyncWebhooks", - "WebhooksWithRawResponse", - "AsyncWebhooksWithRawResponse", - "WebhooksWithStreamingResponse", - "AsyncWebhooksWithStreamingResponse", - "Destinations", - "AsyncDestinations", - "DestinationsWithRawResponse", - "AsyncDestinationsWithRawResponse", - "DestinationsWithStreamingResponse", - "AsyncDestinationsWithStreamingResponse", + "EligibleResource", + "AsyncEligibleResource", + "EligibleResourceWithRawResponse", + "AsyncEligibleResourceWithRawResponse", + "EligibleResourceWithStreamingResponse", + "AsyncEligibleResourceWithStreamingResponse", + "PagerdutyResource", + "AsyncPagerdutyResource", + "PagerdutyResourceWithRawResponse", + "AsyncPagerdutyResourceWithRawResponse", + "PagerdutyResourceWithStreamingResponse", + "AsyncPagerdutyResourceWithStreamingResponse", + "WebhooksResource", + "AsyncWebhooksResource", + "WebhooksResourceWithRawResponse", + "AsyncWebhooksResourceWithRawResponse", + "WebhooksResourceWithStreamingResponse", + "AsyncWebhooksResourceWithStreamingResponse", + "DestinationsResource", + "AsyncDestinationsResource", + "DestinationsResourceWithRawResponse", + "AsyncDestinationsResourceWithRawResponse", + "DestinationsResourceWithStreamingResponse", + "AsyncDestinationsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/alerting/destinations/destinations.py b/src/cloudflare/resources/alerting/destinations/destinations.py index 35d6a951687..d5e0b713d3d 100644 --- a/src/cloudflare/resources/alerting/destinations/destinations.py +++ b/src/cloudflare/resources/alerting/destinations/destinations.py @@ -3,142 +3,142 @@ from __future__ import annotations from .eligible import ( - Eligible, - AsyncEligible, - EligibleWithRawResponse, - AsyncEligibleWithRawResponse, - EligibleWithStreamingResponse, - AsyncEligibleWithStreamingResponse, + EligibleResource, + AsyncEligibleResource, + EligibleResourceWithRawResponse, + AsyncEligibleResourceWithRawResponse, + EligibleResourceWithStreamingResponse, + AsyncEligibleResourceWithStreamingResponse, ) from .webhooks import ( - Webhooks, - AsyncWebhooks, - WebhooksWithRawResponse, - AsyncWebhooksWithRawResponse, - WebhooksWithStreamingResponse, - AsyncWebhooksWithStreamingResponse, + WebhooksResource, + AsyncWebhooksResource, + WebhooksResourceWithRawResponse, + AsyncWebhooksResourceWithRawResponse, + WebhooksResourceWithStreamingResponse, + AsyncWebhooksResourceWithStreamingResponse, ) from .pagerduty import ( - Pagerduty, - AsyncPagerduty, - PagerdutyWithRawResponse, - AsyncPagerdutyWithRawResponse, - PagerdutyWithStreamingResponse, - AsyncPagerdutyWithStreamingResponse, + PagerdutyResource, + AsyncPagerdutyResource, + PagerdutyResourceWithRawResponse, + AsyncPagerdutyResourceWithRawResponse, + PagerdutyResourceWithStreamingResponse, + AsyncPagerdutyResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Destinations", "AsyncDestinations"] +__all__ = ["DestinationsResource", "AsyncDestinationsResource"] -class Destinations(SyncAPIResource): +class DestinationsResource(SyncAPIResource): @cached_property - def eligible(self) -> Eligible: - return Eligible(self._client) + def eligible(self) -> EligibleResource: + return EligibleResource(self._client) @cached_property - def pagerduty(self) -> Pagerduty: - return Pagerduty(self._client) + def pagerduty(self) -> PagerdutyResource: + return PagerdutyResource(self._client) @cached_property - def webhooks(self) -> Webhooks: - return Webhooks(self._client) + def webhooks(self) -> WebhooksResource: + return WebhooksResource(self._client) @cached_property - def with_raw_response(self) -> DestinationsWithRawResponse: - return DestinationsWithRawResponse(self) + def with_raw_response(self) -> DestinationsResourceWithRawResponse: + return DestinationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DestinationsWithStreamingResponse: - return DestinationsWithStreamingResponse(self) + def with_streaming_response(self) -> DestinationsResourceWithStreamingResponse: + return DestinationsResourceWithStreamingResponse(self) -class AsyncDestinations(AsyncAPIResource): +class AsyncDestinationsResource(AsyncAPIResource): @cached_property - def eligible(self) -> AsyncEligible: - return AsyncEligible(self._client) + def eligible(self) -> AsyncEligibleResource: + return AsyncEligibleResource(self._client) @cached_property - def pagerduty(self) -> AsyncPagerduty: - return AsyncPagerduty(self._client) + def pagerduty(self) -> AsyncPagerdutyResource: + return AsyncPagerdutyResource(self._client) @cached_property - def webhooks(self) -> AsyncWebhooks: - return AsyncWebhooks(self._client) + def webhooks(self) -> AsyncWebhooksResource: + return AsyncWebhooksResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDestinationsWithRawResponse: - return AsyncDestinationsWithRawResponse(self) + def with_raw_response(self) -> AsyncDestinationsResourceWithRawResponse: + return AsyncDestinationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDestinationsWithStreamingResponse: - return AsyncDestinationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDestinationsResourceWithStreamingResponse: + return AsyncDestinationsResourceWithStreamingResponse(self) -class DestinationsWithRawResponse: - def __init__(self, destinations: Destinations) -> None: +class DestinationsResourceWithRawResponse: + def __init__(self, destinations: DestinationsResource) -> None: self._destinations = destinations @cached_property - def eligible(self) -> EligibleWithRawResponse: - return EligibleWithRawResponse(self._destinations.eligible) + def eligible(self) -> EligibleResourceWithRawResponse: + return EligibleResourceWithRawResponse(self._destinations.eligible) @cached_property - def pagerduty(self) -> PagerdutyWithRawResponse: - return PagerdutyWithRawResponse(self._destinations.pagerduty) + def pagerduty(self) -> PagerdutyResourceWithRawResponse: + return PagerdutyResourceWithRawResponse(self._destinations.pagerduty) @cached_property - def webhooks(self) -> WebhooksWithRawResponse: - return WebhooksWithRawResponse(self._destinations.webhooks) + def webhooks(self) -> WebhooksResourceWithRawResponse: + return WebhooksResourceWithRawResponse(self._destinations.webhooks) -class AsyncDestinationsWithRawResponse: - def __init__(self, destinations: AsyncDestinations) -> None: +class AsyncDestinationsResourceWithRawResponse: + def __init__(self, destinations: AsyncDestinationsResource) -> None: self._destinations = destinations @cached_property - def eligible(self) -> AsyncEligibleWithRawResponse: - return AsyncEligibleWithRawResponse(self._destinations.eligible) + def eligible(self) -> AsyncEligibleResourceWithRawResponse: + return AsyncEligibleResourceWithRawResponse(self._destinations.eligible) @cached_property - def pagerduty(self) -> AsyncPagerdutyWithRawResponse: - return AsyncPagerdutyWithRawResponse(self._destinations.pagerduty) + def pagerduty(self) -> AsyncPagerdutyResourceWithRawResponse: + return AsyncPagerdutyResourceWithRawResponse(self._destinations.pagerduty) @cached_property - def webhooks(self) -> AsyncWebhooksWithRawResponse: - return AsyncWebhooksWithRawResponse(self._destinations.webhooks) + def webhooks(self) -> AsyncWebhooksResourceWithRawResponse: + return AsyncWebhooksResourceWithRawResponse(self._destinations.webhooks) -class DestinationsWithStreamingResponse: - def __init__(self, destinations: Destinations) -> None: +class DestinationsResourceWithStreamingResponse: + def __init__(self, destinations: DestinationsResource) -> None: self._destinations = destinations @cached_property - def eligible(self) -> EligibleWithStreamingResponse: - return EligibleWithStreamingResponse(self._destinations.eligible) + def eligible(self) -> EligibleResourceWithStreamingResponse: + return EligibleResourceWithStreamingResponse(self._destinations.eligible) @cached_property - def pagerduty(self) -> PagerdutyWithStreamingResponse: - return PagerdutyWithStreamingResponse(self._destinations.pagerduty) + def pagerduty(self) -> PagerdutyResourceWithStreamingResponse: + return PagerdutyResourceWithStreamingResponse(self._destinations.pagerduty) @cached_property - def webhooks(self) -> WebhooksWithStreamingResponse: - return WebhooksWithStreamingResponse(self._destinations.webhooks) + def webhooks(self) -> WebhooksResourceWithStreamingResponse: + return WebhooksResourceWithStreamingResponse(self._destinations.webhooks) -class AsyncDestinationsWithStreamingResponse: - def __init__(self, destinations: AsyncDestinations) -> None: +class AsyncDestinationsResourceWithStreamingResponse: + def __init__(self, destinations: AsyncDestinationsResource) -> None: self._destinations = destinations @cached_property - def eligible(self) -> AsyncEligibleWithStreamingResponse: - return AsyncEligibleWithStreamingResponse(self._destinations.eligible) + def eligible(self) -> AsyncEligibleResourceWithStreamingResponse: + return AsyncEligibleResourceWithStreamingResponse(self._destinations.eligible) @cached_property - def pagerduty(self) -> AsyncPagerdutyWithStreamingResponse: - return AsyncPagerdutyWithStreamingResponse(self._destinations.pagerduty) + def pagerduty(self) -> AsyncPagerdutyResourceWithStreamingResponse: + return AsyncPagerdutyResourceWithStreamingResponse(self._destinations.pagerduty) @cached_property - def webhooks(self) -> AsyncWebhooksWithStreamingResponse: - return AsyncWebhooksWithStreamingResponse(self._destinations.webhooks) + def webhooks(self) -> AsyncWebhooksResourceWithStreamingResponse: + return AsyncWebhooksResourceWithStreamingResponse(self._destinations.webhooks) diff --git a/src/cloudflare/resources/alerting/destinations/eligible.py b/src/cloudflare/resources/alerting/destinations/eligible.py index 6beb3e9bbe1..850586d484a 100644 --- a/src/cloudflare/resources/alerting/destinations/eligible.py +++ b/src/cloudflare/resources/alerting/destinations/eligible.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.alerting.destinations import EligibleGetResponse +from ....types.alerting.destinations.eligible_get_response import EligibleGetResponse -__all__ = ["Eligible", "AsyncEligible"] +__all__ = ["EligibleResource", "AsyncEligibleResource"] -class Eligible(SyncAPIResource): +class EligibleResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> EligibleWithRawResponse: - return EligibleWithRawResponse(self) + def with_raw_response(self) -> EligibleResourceWithRawResponse: + return EligibleResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EligibleWithStreamingResponse: - return EligibleWithStreamingResponse(self) + def with_streaming_response(self) -> EligibleResourceWithStreamingResponse: + return EligibleResourceWithStreamingResponse(self) def get( self, @@ -69,7 +69,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EligibleGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[EligibleGetResponse] @@ -78,14 +78,14 @@ def get( ) -class AsyncEligible(AsyncAPIResource): +class AsyncEligibleResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncEligibleWithRawResponse: - return AsyncEligibleWithRawResponse(self) + def with_raw_response(self) -> AsyncEligibleResourceWithRawResponse: + return AsyncEligibleResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEligibleWithStreamingResponse: - return AsyncEligibleWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEligibleResourceWithStreamingResponse: + return AsyncEligibleResourceWithStreamingResponse(self) async def get( self, @@ -123,7 +123,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EligibleGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[EligibleGetResponse] @@ -132,8 +132,8 @@ async def get( ) -class EligibleWithRawResponse: - def __init__(self, eligible: Eligible) -> None: +class EligibleResourceWithRawResponse: + def __init__(self, eligible: EligibleResource) -> None: self._eligible = eligible self.get = to_raw_response_wrapper( @@ -141,8 +141,8 @@ def __init__(self, eligible: Eligible) -> None: ) -class AsyncEligibleWithRawResponse: - def __init__(self, eligible: AsyncEligible) -> None: +class AsyncEligibleResourceWithRawResponse: + def __init__(self, eligible: AsyncEligibleResource) -> None: self._eligible = eligible self.get = async_to_raw_response_wrapper( @@ -150,8 +150,8 @@ def __init__(self, eligible: AsyncEligible) -> None: ) -class EligibleWithStreamingResponse: - def __init__(self, eligible: Eligible) -> None: +class EligibleResourceWithStreamingResponse: + def __init__(self, eligible: EligibleResource) -> None: self._eligible = eligible self.get = to_streamed_response_wrapper( @@ -159,8 +159,8 @@ def __init__(self, eligible: Eligible) -> None: ) -class AsyncEligibleWithStreamingResponse: - def __init__(self, eligible: AsyncEligible) -> None: +class AsyncEligibleResourceWithStreamingResponse: + def __init__(self, eligible: AsyncEligibleResource) -> None: self._eligible = eligible self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/alerting/destinations/pagerduty.py b/src/cloudflare/resources/alerting/destinations/pagerduty.py index d92b8bf9a8d..bf465aff2f2 100644 --- a/src/cloudflare/resources/alerting/destinations/pagerduty.py +++ b/src/cloudflare/resources/alerting/destinations/pagerduty.py @@ -19,24 +19,22 @@ from ...._base_client import ( make_request_options, ) -from ....types.alerting.destinations import ( - PagerdutyGetResponse, - PagerdutyLinkResponse, - PagerdutyCreateResponse, - PagerdutyDeleteResponse, -) +from ....types.alerting.destinations.pagerduty_get_response import PagerdutyGetResponse +from ....types.alerting.destinations.pagerduty_link_response import PagerdutyLinkResponse +from ....types.alerting.destinations.pagerduty_create_response import PagerdutyCreateResponse +from ....types.alerting.destinations.pagerduty_delete_response import PagerdutyDeleteResponse -__all__ = ["Pagerduty", "AsyncPagerduty"] +__all__ = ["PagerdutyResource", "AsyncPagerdutyResource"] -class Pagerduty(SyncAPIResource): +class PagerdutyResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PagerdutyWithRawResponse: - return PagerdutyWithRawResponse(self) + def with_raw_response(self) -> PagerdutyResourceWithRawResponse: + return PagerdutyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PagerdutyWithStreamingResponse: - return PagerdutyWithStreamingResponse(self) + def with_streaming_response(self) -> PagerdutyResourceWithStreamingResponse: + return PagerdutyResourceWithStreamingResponse(self) def create( self, @@ -72,7 +70,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PagerdutyCreateResponse]._unwrapper, ), cast_to=cast(Type[PagerdutyCreateResponse], ResultWrapper[PagerdutyCreateResponse]), ) @@ -113,7 +111,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PagerdutyDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PagerdutyDeleteResponse] @@ -155,7 +153,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PagerdutyGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PagerdutyGetResponse]], ResultWrapper[PagerdutyGetResponse]), ) @@ -199,20 +197,20 @@ def link( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PagerdutyLinkResponse]._unwrapper, ), cast_to=cast(Type[PagerdutyLinkResponse], ResultWrapper[PagerdutyLinkResponse]), ) -class AsyncPagerduty(AsyncAPIResource): +class AsyncPagerdutyResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPagerdutyWithRawResponse: - return AsyncPagerdutyWithRawResponse(self) + def with_raw_response(self) -> AsyncPagerdutyResourceWithRawResponse: + return AsyncPagerdutyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPagerdutyWithStreamingResponse: - return AsyncPagerdutyWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPagerdutyResourceWithStreamingResponse: + return AsyncPagerdutyResourceWithStreamingResponse(self) async def create( self, @@ -248,7 +246,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PagerdutyCreateResponse]._unwrapper, ), cast_to=cast(Type[PagerdutyCreateResponse], ResultWrapper[PagerdutyCreateResponse]), ) @@ -289,7 +287,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PagerdutyDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PagerdutyDeleteResponse] @@ -331,7 +329,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PagerdutyGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PagerdutyGetResponse]], ResultWrapper[PagerdutyGetResponse]), ) @@ -375,14 +373,14 @@ async def link( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PagerdutyLinkResponse]._unwrapper, ), cast_to=cast(Type[PagerdutyLinkResponse], ResultWrapper[PagerdutyLinkResponse]), ) -class PagerdutyWithRawResponse: - def __init__(self, pagerduty: Pagerduty) -> None: +class PagerdutyResourceWithRawResponse: + def __init__(self, pagerduty: PagerdutyResource) -> None: self._pagerduty = pagerduty self.create = to_raw_response_wrapper( @@ -399,8 +397,8 @@ def __init__(self, pagerduty: Pagerduty) -> None: ) -class AsyncPagerdutyWithRawResponse: - def __init__(self, pagerduty: AsyncPagerduty) -> None: +class AsyncPagerdutyResourceWithRawResponse: + def __init__(self, pagerduty: AsyncPagerdutyResource) -> None: self._pagerduty = pagerduty self.create = async_to_raw_response_wrapper( @@ -417,8 +415,8 @@ def __init__(self, pagerduty: AsyncPagerduty) -> None: ) -class PagerdutyWithStreamingResponse: - def __init__(self, pagerduty: Pagerduty) -> None: +class PagerdutyResourceWithStreamingResponse: + def __init__(self, pagerduty: PagerdutyResource) -> None: self._pagerduty = pagerduty self.create = to_streamed_response_wrapper( @@ -435,8 +433,8 @@ def __init__(self, pagerduty: Pagerduty) -> None: ) -class AsyncPagerdutyWithStreamingResponse: - def __init__(self, pagerduty: AsyncPagerduty) -> None: +class AsyncPagerdutyResourceWithStreamingResponse: + def __init__(self, pagerduty: AsyncPagerdutyResource) -> None: self._pagerduty = pagerduty self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/alerting/destinations/webhooks.py b/src/cloudflare/resources/alerting/destinations/webhooks.py index 62528f9e741..f988d06b025 100644 --- a/src/cloudflare/resources/alerting/destinations/webhooks.py +++ b/src/cloudflare/resources/alerting/destinations/webhooks.py @@ -25,26 +25,23 @@ AsyncPaginator, make_request_options, ) -from ....types.alerting.destinations import ( - AlertingWebhooks, - WebhookCreateResponse, - WebhookDeleteResponse, - WebhookUpdateResponse, - webhook_create_params, - webhook_update_params, -) +from ....types.alerting.destinations import webhook_create_params, webhook_update_params +from ....types.alerting.destinations.webhooks import Webhooks +from ....types.alerting.destinations.webhook_create_response import WebhookCreateResponse +from ....types.alerting.destinations.webhook_delete_response import WebhookDeleteResponse +from ....types.alerting.destinations.webhook_update_response import WebhookUpdateResponse -__all__ = ["Webhooks", "AsyncWebhooks"] +__all__ = ["WebhooksResource", "AsyncWebhooksResource"] -class Webhooks(SyncAPIResource): +class WebhooksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WebhooksWithRawResponse: - return WebhooksWithRawResponse(self) + def with_raw_response(self) -> WebhooksResourceWithRawResponse: + return WebhooksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WebhooksWithStreamingResponse: - return WebhooksWithStreamingResponse(self) + def with_streaming_response(self) -> WebhooksResourceWithStreamingResponse: + return WebhooksResourceWithStreamingResponse(self) def create( self, @@ -100,7 +97,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WebhookCreateResponse]._unwrapper, ), cast_to=cast(Type[WebhookCreateResponse], ResultWrapper[WebhookCreateResponse]), ) @@ -164,7 +161,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WebhookUpdateResponse]._unwrapper, ), cast_to=cast(Type[WebhookUpdateResponse], ResultWrapper[WebhookUpdateResponse]), ) @@ -179,7 +176,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AlertingWebhooks]: + ) -> SyncSinglePage[Webhooks]: """ Gets a list of all configured webhook destinations. @@ -198,11 +195,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/alerting/v3/destinations/webhooks", - page=SyncSinglePage[AlertingWebhooks], + page=SyncSinglePage[Webhooks], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AlertingWebhooks, + model=Webhooks, ) def delete( @@ -246,7 +243,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebhookDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WebhookDeleteResponse] @@ -265,7 +262,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AlertingWebhooks: + ) -> Webhooks: """ Get details for a single webhooks destination. @@ -293,20 +290,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Webhooks]._unwrapper, ), - cast_to=cast(Type[AlertingWebhooks], ResultWrapper[AlertingWebhooks]), + cast_to=cast(Type[Webhooks], ResultWrapper[Webhooks]), ) -class AsyncWebhooks(AsyncAPIResource): +class AsyncWebhooksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWebhooksWithRawResponse: - return AsyncWebhooksWithRawResponse(self) + def with_raw_response(self) -> AsyncWebhooksResourceWithRawResponse: + return AsyncWebhooksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWebhooksWithStreamingResponse: - return AsyncWebhooksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWebhooksResourceWithStreamingResponse: + return AsyncWebhooksResourceWithStreamingResponse(self) async def create( self, @@ -362,7 +359,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WebhookCreateResponse]._unwrapper, ), cast_to=cast(Type[WebhookCreateResponse], ResultWrapper[WebhookCreateResponse]), ) @@ -426,7 +423,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WebhookUpdateResponse]._unwrapper, ), cast_to=cast(Type[WebhookUpdateResponse], ResultWrapper[WebhookUpdateResponse]), ) @@ -441,7 +438,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AlertingWebhooks, AsyncSinglePage[AlertingWebhooks]]: + ) -> AsyncPaginator[Webhooks, AsyncSinglePage[Webhooks]]: """ Gets a list of all configured webhook destinations. @@ -460,11 +457,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/alerting/v3/destinations/webhooks", - page=AsyncSinglePage[AlertingWebhooks], + page=AsyncSinglePage[Webhooks], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AlertingWebhooks, + model=Webhooks, ) async def delete( @@ -508,7 +505,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebhookDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WebhookDeleteResponse] @@ -527,7 +524,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AlertingWebhooks: + ) -> Webhooks: """ Get details for a single webhooks destination. @@ -555,14 +552,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Webhooks]._unwrapper, ), - cast_to=cast(Type[AlertingWebhooks], ResultWrapper[AlertingWebhooks]), + cast_to=cast(Type[Webhooks], ResultWrapper[Webhooks]), ) -class WebhooksWithRawResponse: - def __init__(self, webhooks: Webhooks) -> None: +class WebhooksResourceWithRawResponse: + def __init__(self, webhooks: WebhooksResource) -> None: self._webhooks = webhooks self.create = to_raw_response_wrapper( @@ -582,8 +579,8 @@ def __init__(self, webhooks: Webhooks) -> None: ) -class AsyncWebhooksWithRawResponse: - def __init__(self, webhooks: AsyncWebhooks) -> None: +class AsyncWebhooksResourceWithRawResponse: + def __init__(self, webhooks: AsyncWebhooksResource) -> None: self._webhooks = webhooks self.create = async_to_raw_response_wrapper( @@ -603,8 +600,8 @@ def __init__(self, webhooks: AsyncWebhooks) -> None: ) -class WebhooksWithStreamingResponse: - def __init__(self, webhooks: Webhooks) -> None: +class WebhooksResourceWithStreamingResponse: + def __init__(self, webhooks: WebhooksResource) -> None: self._webhooks = webhooks self.create = to_streamed_response_wrapper( @@ -624,8 +621,8 @@ def __init__(self, webhooks: Webhooks) -> None: ) -class AsyncWebhooksWithStreamingResponse: - def __init__(self, webhooks: AsyncWebhooks) -> None: +class AsyncWebhooksResourceWithStreamingResponse: + def __init__(self, webhooks: AsyncWebhooksResource) -> None: self._webhooks = webhooks self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/alerting/history.py b/src/cloudflare/resources/alerting/history.py index 9d7bfbb9b2b..9ddd67eb387 100644 --- a/src/cloudflare/resources/alerting/history.py +++ b/src/cloudflare/resources/alerting/history.py @@ -22,19 +22,20 @@ AsyncPaginator, make_request_options, ) -from ...types.alerting import AlertingHistory, history_list_params +from ...types.alerting import history_list_params +from ...types.alerting.history import History -__all__ = ["History", "AsyncHistory"] +__all__ = ["HistoryResource", "AsyncHistoryResource"] -class History(SyncAPIResource): +class HistoryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HistoryWithRawResponse: - return HistoryWithRawResponse(self) + def with_raw_response(self) -> HistoryResourceWithRawResponse: + return HistoryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HistoryWithStreamingResponse: - return HistoryWithStreamingResponse(self) + def with_streaming_response(self) -> HistoryResourceWithStreamingResponse: + return HistoryResourceWithStreamingResponse(self) def list( self, @@ -50,7 +51,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AlertingHistory]: + ) -> SyncV4PagePaginationArray[History]: """Gets a list of history records for notifications sent to an account. The records @@ -82,7 +83,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/alerting/v3/history", - page=SyncV4PagePaginationArray[AlertingHistory], + page=SyncV4PagePaginationArray[History], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -98,18 +99,18 @@ def list( history_list_params.HistoryListParams, ), ), - model=AlertingHistory, + model=History, ) -class AsyncHistory(AsyncAPIResource): +class AsyncHistoryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHistoryWithRawResponse: - return AsyncHistoryWithRawResponse(self) + def with_raw_response(self) -> AsyncHistoryResourceWithRawResponse: + return AsyncHistoryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHistoryWithStreamingResponse: - return AsyncHistoryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHistoryResourceWithStreamingResponse: + return AsyncHistoryResourceWithStreamingResponse(self) def list( self, @@ -125,7 +126,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AlertingHistory, AsyncV4PagePaginationArray[AlertingHistory]]: + ) -> AsyncPaginator[History, AsyncV4PagePaginationArray[History]]: """Gets a list of history records for notifications sent to an account. The records @@ -157,7 +158,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/alerting/v3/history", - page=AsyncV4PagePaginationArray[AlertingHistory], + page=AsyncV4PagePaginationArray[History], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -173,12 +174,12 @@ def list( history_list_params.HistoryListParams, ), ), - model=AlertingHistory, + model=History, ) -class HistoryWithRawResponse: - def __init__(self, history: History) -> None: +class HistoryResourceWithRawResponse: + def __init__(self, history: HistoryResource) -> None: self._history = history self.list = to_raw_response_wrapper( @@ -186,8 +187,8 @@ def __init__(self, history: History) -> None: ) -class AsyncHistoryWithRawResponse: - def __init__(self, history: AsyncHistory) -> None: +class AsyncHistoryResourceWithRawResponse: + def __init__(self, history: AsyncHistoryResource) -> None: self._history = history self.list = async_to_raw_response_wrapper( @@ -195,8 +196,8 @@ def __init__(self, history: AsyncHistory) -> None: ) -class HistoryWithStreamingResponse: - def __init__(self, history: History) -> None: +class HistoryResourceWithStreamingResponse: + def __init__(self, history: HistoryResource) -> None: self._history = history self.list = to_streamed_response_wrapper( @@ -204,8 +205,8 @@ def __init__(self, history: History) -> None: ) -class AsyncHistoryWithStreamingResponse: - def __init__(self, history: AsyncHistory) -> None: +class AsyncHistoryResourceWithStreamingResponse: + def __init__(self, history: AsyncHistoryResource) -> None: self._history = history self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/alerting/policies.py b/src/cloudflare/resources/alerting/policies.py index a3372cb90f5..b7c35076824 100644 --- a/src/cloudflare/resources/alerting/policies.py +++ b/src/cloudflare/resources/alerting/policies.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Dict, Type, Iterable, Optional, cast +from typing import Any, Type, Optional, cast from typing_extensions import Literal import httpx @@ -26,26 +26,25 @@ AsyncPaginator, make_request_options, ) -from ...types.alerting import ( - AlertingPolicies, - PolicyCreateResponse, - PolicyDeleteResponse, - PolicyUpdateResponse, - policy_create_params, - policy_update_params, -) +from ...types.alerting import policy_create_params, policy_update_params +from ...types.alerting.policy import Policy +from ...types.alerting.mechanism_param import MechanismParam +from ...types.alerting.policy_filter_param import PolicyFilterParam +from ...types.alerting.policy_create_response import PolicyCreateResponse +from ...types.alerting.policy_delete_response import PolicyDeleteResponse +from ...types.alerting.policy_update_response import PolicyUpdateResponse -__all__ = ["Policies", "AsyncPolicies"] +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] -class Policies(SyncAPIResource): +class PoliciesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PoliciesWithRawResponse: - return PoliciesWithRawResponse(self) + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PoliciesWithStreamingResponse: - return PoliciesWithStreamingResponse(self) + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self) def create( self, @@ -109,10 +108,10 @@ def create( "zone_aop_custom_certificate_expiration_type", ], enabled: bool, - mechanisms: Dict[str, Iterable[policy_create_params.Mechanisms]], + mechanisms: MechanismParam, name: str, description: str | NotGiven = NOT_GIVEN, - filters: policy_create_params.Filters | NotGiven = NOT_GIVEN, + filters: PolicyFilterParam | 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, @@ -171,7 +170,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PolicyCreateResponse]._unwrapper, ), cast_to=cast(Type[PolicyCreateResponse], ResultWrapper[PolicyCreateResponse]), ) @@ -241,8 +240,8 @@ def update( | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - filters: policy_update_params.Filters | NotGiven = NOT_GIVEN, - mechanisms: Dict[str, Iterable[policy_update_params.Mechanisms]] | NotGiven = NOT_GIVEN, + filters: PolicyFilterParam | NotGiven = NOT_GIVEN, + mechanisms: MechanismParam | NotGiven = NOT_GIVEN, 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. @@ -306,7 +305,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PolicyUpdateResponse]._unwrapper, ), cast_to=cast(Type[PolicyUpdateResponse], ResultWrapper[PolicyUpdateResponse]), ) @@ -321,7 +320,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[AlertingPolicies]: + ) -> SyncSinglePage[Policy]: """ Get a list of all Notification policies. @@ -340,11 +339,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/alerting/v3/policies", - page=SyncSinglePage[AlertingPolicies], + page=SyncSinglePage[Policy], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AlertingPolicies, + model=Policy, ) def delete( @@ -388,7 +387,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PolicyDeleteResponse] @@ -407,7 +406,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AlertingPolicies: + ) -> Policy: """ Get details for a single policy. @@ -435,20 +434,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Policy]._unwrapper, ), - cast_to=cast(Type[AlertingPolicies], ResultWrapper[AlertingPolicies]), + cast_to=cast(Type[Policy], ResultWrapper[Policy]), ) -class AsyncPolicies(AsyncAPIResource): +class AsyncPoliciesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPoliciesWithRawResponse: - return AsyncPoliciesWithRawResponse(self) + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPoliciesWithStreamingResponse: - return AsyncPoliciesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self) async def create( self, @@ -512,10 +511,10 @@ async def create( "zone_aop_custom_certificate_expiration_type", ], enabled: bool, - mechanisms: Dict[str, Iterable[policy_create_params.Mechanisms]], + mechanisms: MechanismParam, name: str, description: str | NotGiven = NOT_GIVEN, - filters: policy_create_params.Filters | NotGiven = NOT_GIVEN, + filters: PolicyFilterParam | 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, @@ -574,7 +573,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PolicyCreateResponse]._unwrapper, ), cast_to=cast(Type[PolicyCreateResponse], ResultWrapper[PolicyCreateResponse]), ) @@ -644,8 +643,8 @@ async def update( | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - filters: policy_update_params.Filters | NotGiven = NOT_GIVEN, - mechanisms: Dict[str, Iterable[policy_update_params.Mechanisms]] | NotGiven = NOT_GIVEN, + filters: PolicyFilterParam | NotGiven = NOT_GIVEN, + mechanisms: MechanismParam | NotGiven = NOT_GIVEN, 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. @@ -709,7 +708,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PolicyUpdateResponse]._unwrapper, ), cast_to=cast(Type[PolicyUpdateResponse], ResultWrapper[PolicyUpdateResponse]), ) @@ -724,7 +723,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AlertingPolicies, AsyncSinglePage[AlertingPolicies]]: + ) -> AsyncPaginator[Policy, AsyncSinglePage[Policy]]: """ Get a list of all Notification policies. @@ -743,11 +742,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/alerting/v3/policies", - page=AsyncSinglePage[AlertingPolicies], + page=AsyncSinglePage[Policy], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=AlertingPolicies, + model=Policy, ) async def delete( @@ -791,7 +790,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PolicyDeleteResponse] @@ -810,7 +809,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AlertingPolicies: + ) -> Policy: """ Get details for a single policy. @@ -838,14 +837,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Policy]._unwrapper, ), - cast_to=cast(Type[AlertingPolicies], ResultWrapper[AlertingPolicies]), + cast_to=cast(Type[Policy], ResultWrapper[Policy]), ) -class PoliciesWithRawResponse: - def __init__(self, policies: Policies) -> None: +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: self._policies = policies self.create = to_raw_response_wrapper( @@ -865,8 +864,8 @@ def __init__(self, policies: Policies) -> None: ) -class AsyncPoliciesWithRawResponse: - def __init__(self, policies: AsyncPolicies) -> None: +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: self._policies = policies self.create = async_to_raw_response_wrapper( @@ -886,8 +885,8 @@ def __init__(self, policies: AsyncPolicies) -> None: ) -class PoliciesWithStreamingResponse: - def __init__(self, policies: Policies) -> None: +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: self._policies = policies self.create = to_streamed_response_wrapper( @@ -907,8 +906,8 @@ def __init__(self, policies: Policies) -> None: ) -class AsyncPoliciesWithStreamingResponse: - def __init__(self, policies: AsyncPolicies) -> None: +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: self._policies = policies self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/argo/__init__.py b/src/cloudflare/resources/argo/__init__.py index 20b443333e4..060e54eaec3 100644 --- a/src/cloudflare/resources/argo/__init__.py +++ b/src/cloudflare/resources/argo/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .argo import ( - Argo, - AsyncArgo, - ArgoWithRawResponse, - AsyncArgoWithRawResponse, - ArgoWithStreamingResponse, - AsyncArgoWithStreamingResponse, + ArgoResource, + AsyncArgoResource, + ArgoResourceWithRawResponse, + AsyncArgoResourceWithRawResponse, + ArgoResourceWithStreamingResponse, + AsyncArgoResourceWithStreamingResponse, ) from .smart_routing import ( - SmartRouting, - AsyncSmartRouting, - SmartRoutingWithRawResponse, - AsyncSmartRoutingWithRawResponse, - SmartRoutingWithStreamingResponse, - AsyncSmartRoutingWithStreamingResponse, + SmartRoutingResource, + AsyncSmartRoutingResource, + SmartRoutingResourceWithRawResponse, + AsyncSmartRoutingResourceWithRawResponse, + SmartRoutingResourceWithStreamingResponse, + AsyncSmartRoutingResourceWithStreamingResponse, ) from .tiered_caching import ( - TieredCaching, - AsyncTieredCaching, - TieredCachingWithRawResponse, - AsyncTieredCachingWithRawResponse, - TieredCachingWithStreamingResponse, - AsyncTieredCachingWithStreamingResponse, + TieredCachingResource, + AsyncTieredCachingResource, + TieredCachingResourceWithRawResponse, + AsyncTieredCachingResourceWithRawResponse, + TieredCachingResourceWithStreamingResponse, + AsyncTieredCachingResourceWithStreamingResponse, ) __all__ = [ - "SmartRouting", - "AsyncSmartRouting", - "SmartRoutingWithRawResponse", - "AsyncSmartRoutingWithRawResponse", - "SmartRoutingWithStreamingResponse", - "AsyncSmartRoutingWithStreamingResponse", - "TieredCaching", - "AsyncTieredCaching", - "TieredCachingWithRawResponse", - "AsyncTieredCachingWithRawResponse", - "TieredCachingWithStreamingResponse", - "AsyncTieredCachingWithStreamingResponse", - "Argo", - "AsyncArgo", - "ArgoWithRawResponse", - "AsyncArgoWithRawResponse", - "ArgoWithStreamingResponse", - "AsyncArgoWithStreamingResponse", + "SmartRoutingResource", + "AsyncSmartRoutingResource", + "SmartRoutingResourceWithRawResponse", + "AsyncSmartRoutingResourceWithRawResponse", + "SmartRoutingResourceWithStreamingResponse", + "AsyncSmartRoutingResourceWithStreamingResponse", + "TieredCachingResource", + "AsyncTieredCachingResource", + "TieredCachingResourceWithRawResponse", + "AsyncTieredCachingResourceWithRawResponse", + "TieredCachingResourceWithStreamingResponse", + "AsyncTieredCachingResourceWithStreamingResponse", + "ArgoResource", + "AsyncArgoResource", + "ArgoResourceWithRawResponse", + "AsyncArgoResourceWithRawResponse", + "ArgoResourceWithStreamingResponse", + "AsyncArgoResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/argo/argo.py b/src/cloudflare/resources/argo/argo.py index 8a335d48b62..f9ce9f32f66 100644 --- a/src/cloudflare/resources/argo/argo.py +++ b/src/cloudflare/resources/argo/argo.py @@ -5,108 +5,108 @@ from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from .smart_routing import ( - SmartRouting, - AsyncSmartRouting, - SmartRoutingWithRawResponse, - AsyncSmartRoutingWithRawResponse, - SmartRoutingWithStreamingResponse, - AsyncSmartRoutingWithStreamingResponse, + SmartRoutingResource, + AsyncSmartRoutingResource, + SmartRoutingResourceWithRawResponse, + AsyncSmartRoutingResourceWithRawResponse, + SmartRoutingResourceWithStreamingResponse, + AsyncSmartRoutingResourceWithStreamingResponse, ) from .tiered_caching import ( - TieredCaching, - AsyncTieredCaching, - TieredCachingWithRawResponse, - AsyncTieredCachingWithRawResponse, - TieredCachingWithStreamingResponse, - AsyncTieredCachingWithStreamingResponse, + TieredCachingResource, + AsyncTieredCachingResource, + TieredCachingResourceWithRawResponse, + AsyncTieredCachingResourceWithRawResponse, + TieredCachingResourceWithStreamingResponse, + AsyncTieredCachingResourceWithStreamingResponse, ) -__all__ = ["Argo", "AsyncArgo"] +__all__ = ["ArgoResource", "AsyncArgoResource"] -class Argo(SyncAPIResource): +class ArgoResource(SyncAPIResource): @cached_property - def smart_routing(self) -> SmartRouting: - return SmartRouting(self._client) + def smart_routing(self) -> SmartRoutingResource: + return SmartRoutingResource(self._client) @cached_property - def tiered_caching(self) -> TieredCaching: - return TieredCaching(self._client) + def tiered_caching(self) -> TieredCachingResource: + return TieredCachingResource(self._client) @cached_property - def with_raw_response(self) -> ArgoWithRawResponse: - return ArgoWithRawResponse(self) + def with_raw_response(self) -> ArgoResourceWithRawResponse: + return ArgoResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ArgoWithStreamingResponse: - return ArgoWithStreamingResponse(self) + def with_streaming_response(self) -> ArgoResourceWithStreamingResponse: + return ArgoResourceWithStreamingResponse(self) -class AsyncArgo(AsyncAPIResource): +class AsyncArgoResource(AsyncAPIResource): @cached_property - def smart_routing(self) -> AsyncSmartRouting: - return AsyncSmartRouting(self._client) + def smart_routing(self) -> AsyncSmartRoutingResource: + return AsyncSmartRoutingResource(self._client) @cached_property - def tiered_caching(self) -> AsyncTieredCaching: - return AsyncTieredCaching(self._client) + def tiered_caching(self) -> AsyncTieredCachingResource: + return AsyncTieredCachingResource(self._client) @cached_property - def with_raw_response(self) -> AsyncArgoWithRawResponse: - return AsyncArgoWithRawResponse(self) + def with_raw_response(self) -> AsyncArgoResourceWithRawResponse: + return AsyncArgoResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncArgoWithStreamingResponse: - return AsyncArgoWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncArgoResourceWithStreamingResponse: + return AsyncArgoResourceWithStreamingResponse(self) -class ArgoWithRawResponse: - def __init__(self, argo: Argo) -> None: +class ArgoResourceWithRawResponse: + def __init__(self, argo: ArgoResource) -> None: self._argo = argo @cached_property - def smart_routing(self) -> SmartRoutingWithRawResponse: - return SmartRoutingWithRawResponse(self._argo.smart_routing) + def smart_routing(self) -> SmartRoutingResourceWithRawResponse: + return SmartRoutingResourceWithRawResponse(self._argo.smart_routing) @cached_property - def tiered_caching(self) -> TieredCachingWithRawResponse: - return TieredCachingWithRawResponse(self._argo.tiered_caching) + def tiered_caching(self) -> TieredCachingResourceWithRawResponse: + return TieredCachingResourceWithRawResponse(self._argo.tiered_caching) -class AsyncArgoWithRawResponse: - def __init__(self, argo: AsyncArgo) -> None: +class AsyncArgoResourceWithRawResponse: + def __init__(self, argo: AsyncArgoResource) -> None: self._argo = argo @cached_property - def smart_routing(self) -> AsyncSmartRoutingWithRawResponse: - return AsyncSmartRoutingWithRawResponse(self._argo.smart_routing) + def smart_routing(self) -> AsyncSmartRoutingResourceWithRawResponse: + return AsyncSmartRoutingResourceWithRawResponse(self._argo.smart_routing) @cached_property - def tiered_caching(self) -> AsyncTieredCachingWithRawResponse: - return AsyncTieredCachingWithRawResponse(self._argo.tiered_caching) + def tiered_caching(self) -> AsyncTieredCachingResourceWithRawResponse: + return AsyncTieredCachingResourceWithRawResponse(self._argo.tiered_caching) -class ArgoWithStreamingResponse: - def __init__(self, argo: Argo) -> None: +class ArgoResourceWithStreamingResponse: + def __init__(self, argo: ArgoResource) -> None: self._argo = argo @cached_property - def smart_routing(self) -> SmartRoutingWithStreamingResponse: - return SmartRoutingWithStreamingResponse(self._argo.smart_routing) + def smart_routing(self) -> SmartRoutingResourceWithStreamingResponse: + return SmartRoutingResourceWithStreamingResponse(self._argo.smart_routing) @cached_property - def tiered_caching(self) -> TieredCachingWithStreamingResponse: - return TieredCachingWithStreamingResponse(self._argo.tiered_caching) + def tiered_caching(self) -> TieredCachingResourceWithStreamingResponse: + return TieredCachingResourceWithStreamingResponse(self._argo.tiered_caching) -class AsyncArgoWithStreamingResponse: - def __init__(self, argo: AsyncArgo) -> None: +class AsyncArgoResourceWithStreamingResponse: + def __init__(self, argo: AsyncArgoResource) -> None: self._argo = argo @cached_property - def smart_routing(self) -> AsyncSmartRoutingWithStreamingResponse: - return AsyncSmartRoutingWithStreamingResponse(self._argo.smart_routing) + def smart_routing(self) -> AsyncSmartRoutingResourceWithStreamingResponse: + return AsyncSmartRoutingResourceWithStreamingResponse(self._argo.smart_routing) @cached_property - def tiered_caching(self) -> AsyncTieredCachingWithStreamingResponse: - return AsyncTieredCachingWithStreamingResponse(self._argo.tiered_caching) + def tiered_caching(self) -> AsyncTieredCachingResourceWithStreamingResponse: + return AsyncTieredCachingResourceWithStreamingResponse(self._argo.tiered_caching) diff --git a/src/cloudflare/resources/argo/smart_routing.py b/src/cloudflare/resources/argo/smart_routing.py index b80da8e83d3..76b1e889a14 100644 --- a/src/cloudflare/resources/argo/smart_routing.py +++ b/src/cloudflare/resources/argo/smart_routing.py @@ -21,22 +21,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.argo import SmartRoutingGetResponse, SmartRoutingEditResponse, smart_routing_edit_params +from ...types.argo import smart_routing_edit_params from ..._base_client import ( make_request_options, ) +from ...types.argo.smart_routing_get_response import SmartRoutingGetResponse +from ...types.argo.smart_routing_edit_response import SmartRoutingEditResponse -__all__ = ["SmartRouting", "AsyncSmartRouting"] +__all__ = ["SmartRoutingResource", "AsyncSmartRoutingResource"] -class SmartRouting(SyncAPIResource): +class SmartRoutingResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SmartRoutingWithRawResponse: - return SmartRoutingWithRawResponse(self) + def with_raw_response(self) -> SmartRoutingResourceWithRawResponse: + return SmartRoutingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SmartRoutingWithStreamingResponse: - return SmartRoutingWithStreamingResponse(self) + def with_streaming_response(self) -> SmartRoutingResourceWithStreamingResponse: + return SmartRoutingResourceWithStreamingResponse(self) def edit( self, @@ -78,7 +80,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartRoutingEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartRoutingEditResponse] @@ -122,7 +124,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartRoutingGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartRoutingGetResponse] @@ -131,14 +133,14 @@ def get( ) -class AsyncSmartRouting(AsyncAPIResource): +class AsyncSmartRoutingResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSmartRoutingWithRawResponse: - return AsyncSmartRoutingWithRawResponse(self) + def with_raw_response(self) -> AsyncSmartRoutingResourceWithRawResponse: + return AsyncSmartRoutingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSmartRoutingWithStreamingResponse: - return AsyncSmartRoutingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSmartRoutingResourceWithStreamingResponse: + return AsyncSmartRoutingResourceWithStreamingResponse(self) async def edit( self, @@ -180,7 +182,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartRoutingEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartRoutingEditResponse] @@ -224,7 +226,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartRoutingGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartRoutingGetResponse] @@ -233,8 +235,8 @@ async def get( ) -class SmartRoutingWithRawResponse: - def __init__(self, smart_routing: SmartRouting) -> None: +class SmartRoutingResourceWithRawResponse: + def __init__(self, smart_routing: SmartRoutingResource) -> None: self._smart_routing = smart_routing self.edit = to_raw_response_wrapper( @@ -245,8 +247,8 @@ def __init__(self, smart_routing: SmartRouting) -> None: ) -class AsyncSmartRoutingWithRawResponse: - def __init__(self, smart_routing: AsyncSmartRouting) -> None: +class AsyncSmartRoutingResourceWithRawResponse: + def __init__(self, smart_routing: AsyncSmartRoutingResource) -> None: self._smart_routing = smart_routing self.edit = async_to_raw_response_wrapper( @@ -257,8 +259,8 @@ def __init__(self, smart_routing: AsyncSmartRouting) -> None: ) -class SmartRoutingWithStreamingResponse: - def __init__(self, smart_routing: SmartRouting) -> None: +class SmartRoutingResourceWithStreamingResponse: + def __init__(self, smart_routing: SmartRoutingResource) -> None: self._smart_routing = smart_routing self.edit = to_streamed_response_wrapper( @@ -269,8 +271,8 @@ def __init__(self, smart_routing: SmartRouting) -> None: ) -class AsyncSmartRoutingWithStreamingResponse: - def __init__(self, smart_routing: AsyncSmartRouting) -> None: +class AsyncSmartRoutingResourceWithStreamingResponse: + def __init__(self, smart_routing: AsyncSmartRoutingResource) -> None: self._smart_routing = smart_routing self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/argo/tiered_caching.py b/src/cloudflare/resources/argo/tiered_caching.py index 354ba514e3a..89faa76ba4a 100644 --- a/src/cloudflare/resources/argo/tiered_caching.py +++ b/src/cloudflare/resources/argo/tiered_caching.py @@ -21,22 +21,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.argo import TieredCachingGetResponse, TieredCachingEditResponse, tiered_caching_edit_params +from ...types.argo import tiered_caching_edit_params from ..._base_client import ( make_request_options, ) +from ...types.argo.tiered_caching_get_response import TieredCachingGetResponse +from ...types.argo.tiered_caching_edit_response import TieredCachingEditResponse -__all__ = ["TieredCaching", "AsyncTieredCaching"] +__all__ = ["TieredCachingResource", "AsyncTieredCachingResource"] -class TieredCaching(SyncAPIResource): +class TieredCachingResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TieredCachingWithRawResponse: - return TieredCachingWithRawResponse(self) + def with_raw_response(self) -> TieredCachingResourceWithRawResponse: + return TieredCachingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TieredCachingWithStreamingResponse: - return TieredCachingWithStreamingResponse(self) + def with_streaming_response(self) -> TieredCachingResourceWithStreamingResponse: + return TieredCachingResourceWithStreamingResponse(self) def edit( self, @@ -78,7 +80,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TieredCachingEditResponse] @@ -122,7 +124,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TieredCachingGetResponse] @@ -131,14 +133,14 @@ def get( ) -class AsyncTieredCaching(AsyncAPIResource): +class AsyncTieredCachingResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTieredCachingWithRawResponse: - return AsyncTieredCachingWithRawResponse(self) + def with_raw_response(self) -> AsyncTieredCachingResourceWithRawResponse: + return AsyncTieredCachingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTieredCachingWithStreamingResponse: - return AsyncTieredCachingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTieredCachingResourceWithStreamingResponse: + return AsyncTieredCachingResourceWithStreamingResponse(self) async def edit( self, @@ -180,7 +182,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TieredCachingEditResponse] @@ -224,7 +226,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TieredCachingGetResponse] @@ -233,8 +235,8 @@ async def get( ) -class TieredCachingWithRawResponse: - def __init__(self, tiered_caching: TieredCaching) -> None: +class TieredCachingResourceWithRawResponse: + def __init__(self, tiered_caching: TieredCachingResource) -> None: self._tiered_caching = tiered_caching self.edit = to_raw_response_wrapper( @@ -245,8 +247,8 @@ def __init__(self, tiered_caching: TieredCaching) -> None: ) -class AsyncTieredCachingWithRawResponse: - def __init__(self, tiered_caching: AsyncTieredCaching) -> None: +class AsyncTieredCachingResourceWithRawResponse: + def __init__(self, tiered_caching: AsyncTieredCachingResource) -> None: self._tiered_caching = tiered_caching self.edit = async_to_raw_response_wrapper( @@ -257,8 +259,8 @@ def __init__(self, tiered_caching: AsyncTieredCaching) -> None: ) -class TieredCachingWithStreamingResponse: - def __init__(self, tiered_caching: TieredCaching) -> None: +class TieredCachingResourceWithStreamingResponse: + def __init__(self, tiered_caching: TieredCachingResource) -> None: self._tiered_caching = tiered_caching self.edit = to_streamed_response_wrapper( @@ -269,8 +271,8 @@ def __init__(self, tiered_caching: TieredCaching) -> None: ) -class AsyncTieredCachingWithStreamingResponse: - def __init__(self, tiered_caching: AsyncTieredCaching) -> None: +class AsyncTieredCachingResourceWithStreamingResponse: + def __init__(self, tiered_caching: AsyncTieredCachingResource) -> None: self._tiered_caching = tiered_caching self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/audit_logs.py b/src/cloudflare/resources/audit_logs.py index fcedf6f2630..2d8cd11c4ba 100644 --- a/src/cloudflare/resources/audit_logs.py +++ b/src/cloudflare/resources/audit_logs.py @@ -8,7 +8,6 @@ import httpx -from ..types import AuditLogListResponse, audit_log_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import maybe_transform from .._compat import cached_property @@ -24,18 +23,20 @@ AsyncPaginator, make_request_options, ) +from ..types.audit_logs import audit_log_list_params +from ..types.shared.audit_log import AuditLog -__all__ = ["AuditLogs", "AsyncAuditLogs"] +__all__ = ["AuditLogsResource", "AsyncAuditLogsResource"] -class AuditLogs(SyncAPIResource): +class AuditLogsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AuditLogsWithRawResponse: - return AuditLogsWithRawResponse(self) + def with_raw_response(self) -> AuditLogsResourceWithRawResponse: + return AuditLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AuditLogsWithStreamingResponse: - return AuditLogsWithStreamingResponse(self) + def with_streaming_response(self) -> AuditLogsResourceWithStreamingResponse: + return AuditLogsResourceWithStreamingResponse(self) def list( self, @@ -58,7 +59,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AuditLogListResponse]: + ) -> SyncV4PagePaginationArray[AuditLog]: """Gets a list of audit logs for an account. Can be filtered by who made the @@ -97,7 +98,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/audit_logs", - page=SyncV4PagePaginationArray[AuditLogListResponse], + page=SyncV4PagePaginationArray[AuditLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -120,18 +121,18 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=AuditLogListResponse, + model=AuditLog, ) -class AsyncAuditLogs(AsyncAPIResource): +class AsyncAuditLogsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAuditLogsWithRawResponse: - return AsyncAuditLogsWithRawResponse(self) + def with_raw_response(self) -> AsyncAuditLogsResourceWithRawResponse: + return AsyncAuditLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAuditLogsWithStreamingResponse: - return AsyncAuditLogsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAuditLogsResourceWithStreamingResponse: + return AsyncAuditLogsResourceWithStreamingResponse(self) def list( self, @@ -154,7 +155,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AuditLogListResponse, AsyncV4PagePaginationArray[AuditLogListResponse]]: + ) -> AsyncPaginator[AuditLog, AsyncV4PagePaginationArray[AuditLog]]: """Gets a list of audit logs for an account. Can be filtered by who made the @@ -193,7 +194,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/audit_logs", - page=AsyncV4PagePaginationArray[AuditLogListResponse], + page=AsyncV4PagePaginationArray[AuditLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -216,12 +217,12 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=AuditLogListResponse, + model=AuditLog, ) -class AuditLogsWithRawResponse: - def __init__(self, audit_logs: AuditLogs) -> None: +class AuditLogsResourceWithRawResponse: + def __init__(self, audit_logs: AuditLogsResource) -> None: self._audit_logs = audit_logs self.list = to_raw_response_wrapper( @@ -229,8 +230,8 @@ def __init__(self, audit_logs: AuditLogs) -> None: ) -class AsyncAuditLogsWithRawResponse: - def __init__(self, audit_logs: AsyncAuditLogs) -> None: +class AsyncAuditLogsResourceWithRawResponse: + def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: self._audit_logs = audit_logs self.list = async_to_raw_response_wrapper( @@ -238,8 +239,8 @@ def __init__(self, audit_logs: AsyncAuditLogs) -> None: ) -class AuditLogsWithStreamingResponse: - def __init__(self, audit_logs: AuditLogs) -> None: +class AuditLogsResourceWithStreamingResponse: + def __init__(self, audit_logs: AuditLogsResource) -> None: self._audit_logs = audit_logs self.list = to_streamed_response_wrapper( @@ -247,8 +248,8 @@ def __init__(self, audit_logs: AuditLogs) -> None: ) -class AsyncAuditLogsWithStreamingResponse: - def __init__(self, audit_logs: AsyncAuditLogs) -> None: +class AsyncAuditLogsResourceWithStreamingResponse: + def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: self._audit_logs = audit_logs self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/billing/__init__.py b/src/cloudflare/resources/billing/__init__.py index 70448dd175c..c16ec03c4dc 100644 --- a/src/cloudflare/resources/billing/__init__.py +++ b/src/cloudflare/resources/billing/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .billing import ( - Billing, - AsyncBilling, - BillingWithRawResponse, - AsyncBillingWithRawResponse, - BillingWithStreamingResponse, - AsyncBillingWithStreamingResponse, + BillingResource, + AsyncBillingResource, + BillingResourceWithRawResponse, + AsyncBillingResourceWithRawResponse, + BillingResourceWithStreamingResponse, + AsyncBillingResourceWithStreamingResponse, ) from .profiles import ( - Profiles, - AsyncProfiles, - ProfilesWithRawResponse, - AsyncProfilesWithRawResponse, - ProfilesWithStreamingResponse, - AsyncProfilesWithStreamingResponse, + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, ) __all__ = [ - "Profiles", - "AsyncProfiles", - "ProfilesWithRawResponse", - "AsyncProfilesWithRawResponse", - "ProfilesWithStreamingResponse", - "AsyncProfilesWithStreamingResponse", - "Billing", - "AsyncBilling", - "BillingWithRawResponse", - "AsyncBillingWithRawResponse", - "BillingWithStreamingResponse", - "AsyncBillingWithStreamingResponse", + "ProfilesResource", + "AsyncProfilesResource", + "ProfilesResourceWithRawResponse", + "AsyncProfilesResourceWithRawResponse", + "ProfilesResourceWithStreamingResponse", + "AsyncProfilesResourceWithStreamingResponse", + "BillingResource", + "AsyncBillingResource", + "BillingResourceWithRawResponse", + "AsyncBillingResourceWithRawResponse", + "BillingResourceWithStreamingResponse", + "AsyncBillingResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/billing/billing.py b/src/cloudflare/resources/billing/billing.py index 84417aaca2f..4eb4692ac3a 100644 --- a/src/cloudflare/resources/billing/billing.py +++ b/src/cloudflare/resources/billing/billing.py @@ -3,78 +3,78 @@ from __future__ import annotations from .profiles import ( - Profiles, - AsyncProfiles, - ProfilesWithRawResponse, - AsyncProfilesWithRawResponse, - ProfilesWithStreamingResponse, - AsyncProfilesWithStreamingResponse, + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Billing", "AsyncBilling"] +__all__ = ["BillingResource", "AsyncBillingResource"] -class Billing(SyncAPIResource): +class BillingResource(SyncAPIResource): @cached_property - def profiles(self) -> Profiles: - return Profiles(self._client) + def profiles(self) -> ProfilesResource: + return ProfilesResource(self._client) @cached_property - def with_raw_response(self) -> BillingWithRawResponse: - return BillingWithRawResponse(self) + def with_raw_response(self) -> BillingResourceWithRawResponse: + return BillingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BillingWithStreamingResponse: - return BillingWithStreamingResponse(self) + def with_streaming_response(self) -> BillingResourceWithStreamingResponse: + return BillingResourceWithStreamingResponse(self) -class AsyncBilling(AsyncAPIResource): +class AsyncBillingResource(AsyncAPIResource): @cached_property - def profiles(self) -> AsyncProfiles: - return AsyncProfiles(self._client) + def profiles(self) -> AsyncProfilesResource: + return AsyncProfilesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncBillingWithRawResponse: - return AsyncBillingWithRawResponse(self) + def with_raw_response(self) -> AsyncBillingResourceWithRawResponse: + return AsyncBillingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBillingWithStreamingResponse: - return AsyncBillingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBillingResourceWithStreamingResponse: + return AsyncBillingResourceWithStreamingResponse(self) -class BillingWithRawResponse: - def __init__(self, billing: Billing) -> None: +class BillingResourceWithRawResponse: + def __init__(self, billing: BillingResource) -> None: self._billing = billing @cached_property - def profiles(self) -> ProfilesWithRawResponse: - return ProfilesWithRawResponse(self._billing.profiles) + def profiles(self) -> ProfilesResourceWithRawResponse: + return ProfilesResourceWithRawResponse(self._billing.profiles) -class AsyncBillingWithRawResponse: - def __init__(self, billing: AsyncBilling) -> None: +class AsyncBillingResourceWithRawResponse: + def __init__(self, billing: AsyncBillingResource) -> None: self._billing = billing @cached_property - def profiles(self) -> AsyncProfilesWithRawResponse: - return AsyncProfilesWithRawResponse(self._billing.profiles) + def profiles(self) -> AsyncProfilesResourceWithRawResponse: + return AsyncProfilesResourceWithRawResponse(self._billing.profiles) -class BillingWithStreamingResponse: - def __init__(self, billing: Billing) -> None: +class BillingResourceWithStreamingResponse: + def __init__(self, billing: BillingResource) -> None: self._billing = billing @cached_property - def profiles(self) -> ProfilesWithStreamingResponse: - return ProfilesWithStreamingResponse(self._billing.profiles) + def profiles(self) -> ProfilesResourceWithStreamingResponse: + return ProfilesResourceWithStreamingResponse(self._billing.profiles) -class AsyncBillingWithStreamingResponse: - def __init__(self, billing: AsyncBilling) -> None: +class AsyncBillingResourceWithStreamingResponse: + def __init__(self, billing: AsyncBillingResource) -> None: self._billing = billing @cached_property - def profiles(self) -> AsyncProfilesWithStreamingResponse: - return AsyncProfilesWithStreamingResponse(self._billing.profiles) + def profiles(self) -> AsyncProfilesResourceWithStreamingResponse: + return AsyncProfilesResourceWithStreamingResponse(self._billing.profiles) diff --git a/src/cloudflare/resources/billing/profiles.py b/src/cloudflare/resources/billing/profiles.py index b7e24e1868a..011916b05ba 100644 --- a/src/cloudflare/resources/billing/profiles.py +++ b/src/cloudflare/resources/billing/profiles.py @@ -19,19 +19,19 @@ from ..._base_client import ( make_request_options, ) -from ...types.billing import ProfileGetResponse +from ...types.billing.profile_get_response import ProfileGetResponse -__all__ = ["Profiles", "AsyncProfiles"] +__all__ = ["ProfilesResource", "AsyncProfilesResource"] -class Profiles(SyncAPIResource): +class ProfilesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ProfilesWithRawResponse: - return ProfilesWithRawResponse(self) + def with_raw_response(self) -> ProfilesResourceWithRawResponse: + return ProfilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ProfilesWithStreamingResponse: - return ProfilesWithStreamingResponse(self) + def with_streaming_response(self) -> ProfilesResourceWithStreamingResponse: + return ProfilesResourceWithStreamingResponse(self) def get( self, @@ -65,7 +65,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProfileGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProfileGetResponse] @@ -74,14 +74,14 @@ def get( ) -class AsyncProfiles(AsyncAPIResource): +class AsyncProfilesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncProfilesWithRawResponse: - return AsyncProfilesWithRawResponse(self) + def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: + return AsyncProfilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncProfilesWithStreamingResponse: - return AsyncProfilesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncProfilesResourceWithStreamingResponse: + return AsyncProfilesResourceWithStreamingResponse(self) async def get( self, @@ -115,7 +115,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProfileGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProfileGetResponse] @@ -124,8 +124,8 @@ async def get( ) -class ProfilesWithRawResponse: - def __init__(self, profiles: Profiles) -> None: +class ProfilesResourceWithRawResponse: + def __init__(self, profiles: ProfilesResource) -> None: self._profiles = profiles self.get = to_raw_response_wrapper( @@ -133,8 +133,8 @@ def __init__(self, profiles: Profiles) -> None: ) -class AsyncProfilesWithRawResponse: - def __init__(self, profiles: AsyncProfiles) -> None: +class AsyncProfilesResourceWithRawResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: self._profiles = profiles self.get = async_to_raw_response_wrapper( @@ -142,8 +142,8 @@ def __init__(self, profiles: AsyncProfiles) -> None: ) -class ProfilesWithStreamingResponse: - def __init__(self, profiles: Profiles) -> None: +class ProfilesResourceWithStreamingResponse: + def __init__(self, profiles: ProfilesResource) -> None: self._profiles = profiles self.get = to_streamed_response_wrapper( @@ -151,8 +151,8 @@ def __init__(self, profiles: Profiles) -> None: ) -class AsyncProfilesWithStreamingResponse: - def __init__(self, profiles: AsyncProfiles) -> None: +class AsyncProfilesResourceWithStreamingResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: self._profiles = profiles self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/bot_management.py b/src/cloudflare/resources/bot_management.py index 4956e7c85c4..a0e2d7d637e 100644 --- a/src/cloudflare/resources/bot_management.py +++ b/src/cloudflare/resources/bot_management.py @@ -7,7 +7,6 @@ import httpx -from ..types import BotManagementGetResponse, BotManagementUpdateResponse, bot_management_update_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( required_args, @@ -26,18 +25,21 @@ from .._base_client import ( make_request_options, ) +from ..types.bot_management import bot_management_update_params +from ..types.bot_management.bot_management_get_response import BotManagementGetResponse +from ..types.bot_management.bot_management_update_response import BotManagementUpdateResponse -__all__ = ["BotManagement", "AsyncBotManagement"] +__all__ = ["BotManagementResource", "AsyncBotManagementResource"] -class BotManagement(SyncAPIResource): +class BotManagementResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BotManagementWithRawResponse: - return BotManagementWithRawResponse(self) + def with_raw_response(self) -> BotManagementResourceWithRawResponse: + return BotManagementResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BotManagementWithStreamingResponse: - return BotManagementWithStreamingResponse(self) + def with_streaming_response(self) -> BotManagementResourceWithStreamingResponse: + return BotManagementResourceWithStreamingResponse(self) @overload def update( @@ -292,7 +294,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BotManagementUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BotManagementUpdateResponse] @@ -336,7 +338,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BotManagementGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BotManagementGetResponse] @@ -345,14 +347,14 @@ def get( ) -class AsyncBotManagement(AsyncAPIResource): +class AsyncBotManagementResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBotManagementWithRawResponse: - return AsyncBotManagementWithRawResponse(self) + def with_raw_response(self) -> AsyncBotManagementResourceWithRawResponse: + return AsyncBotManagementResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBotManagementWithStreamingResponse: - return AsyncBotManagementWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBotManagementResourceWithStreamingResponse: + return AsyncBotManagementResourceWithStreamingResponse(self) @overload async def update( @@ -607,7 +609,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BotManagementUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BotManagementUpdateResponse] @@ -651,7 +653,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BotManagementGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BotManagementGetResponse] @@ -660,8 +662,8 @@ async def get( ) -class BotManagementWithRawResponse: - def __init__(self, bot_management: BotManagement) -> None: +class BotManagementResourceWithRawResponse: + def __init__(self, bot_management: BotManagementResource) -> None: self._bot_management = bot_management self.update = to_raw_response_wrapper( @@ -672,8 +674,8 @@ def __init__(self, bot_management: BotManagement) -> None: ) -class AsyncBotManagementWithRawResponse: - def __init__(self, bot_management: AsyncBotManagement) -> None: +class AsyncBotManagementResourceWithRawResponse: + def __init__(self, bot_management: AsyncBotManagementResource) -> None: self._bot_management = bot_management self.update = async_to_raw_response_wrapper( @@ -684,8 +686,8 @@ def __init__(self, bot_management: AsyncBotManagement) -> None: ) -class BotManagementWithStreamingResponse: - def __init__(self, bot_management: BotManagement) -> None: +class BotManagementResourceWithStreamingResponse: + def __init__(self, bot_management: BotManagementResource) -> None: self._bot_management = bot_management self.update = to_streamed_response_wrapper( @@ -696,8 +698,8 @@ def __init__(self, bot_management: BotManagement) -> None: ) -class AsyncBotManagementWithStreamingResponse: - def __init__(self, bot_management: AsyncBotManagement) -> None: +class AsyncBotManagementResourceWithStreamingResponse: + def __init__(self, bot_management: AsyncBotManagementResource) -> None: self._bot_management = bot_management self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/brand_protection.py b/src/cloudflare/resources/brand_protection.py index 6bfc0100398..093a59d6c7e 100644 --- a/src/cloudflare/resources/brand_protection.py +++ b/src/cloudflare/resources/brand_protection.py @@ -6,12 +6,6 @@ import httpx -from ..types import ( - IntelPhishingURLInfo, - IntelPhishingURLSubmit, - brand_protection_submit_params, - brand_protection_url_info_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -29,18 +23,21 @@ from .._base_client import ( make_request_options, ) +from ..types.brand_protection import brand_protection_submit_params, brand_protection_url_info_params +from ..types.brand_protection.info import Info +from ..types.brand_protection.submit import Submit -__all__ = ["BrandProtection", "AsyncBrandProtection"] +__all__ = ["BrandProtectionResource", "AsyncBrandProtectionResource"] -class BrandProtection(SyncAPIResource): +class BrandProtectionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BrandProtectionWithRawResponse: - return BrandProtectionWithRawResponse(self) + def with_raw_response(self) -> BrandProtectionResourceWithRawResponse: + return BrandProtectionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BrandProtectionWithStreamingResponse: - return BrandProtectionWithStreamingResponse(self) + def with_streaming_response(self) -> BrandProtectionResourceWithStreamingResponse: + return BrandProtectionResourceWithStreamingResponse(self) def submit( self, @@ -53,7 +50,7 @@ def submit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelPhishingURLSubmit: + ) -> Submit: """ Submit suspicious URL for scanning @@ -80,9 +77,9 @@ def submit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Submit]._unwrapper, ), - cast_to=cast(Type[IntelPhishingURLSubmit], ResultWrapper[IntelPhishingURLSubmit]), + cast_to=cast(Type[Submit], ResultWrapper[Submit]), ) def url_info( @@ -97,7 +94,7 @@ def url_info( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelPhishingURLInfo: + ) -> Info: """ Get results for a URL scan @@ -128,20 +125,20 @@ def url_info( }, brand_protection_url_info_params.BrandProtectionURLInfoParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Info]._unwrapper, ), - cast_to=cast(Type[IntelPhishingURLInfo], ResultWrapper[IntelPhishingURLInfo]), + cast_to=cast(Type[Info], ResultWrapper[Info]), ) -class AsyncBrandProtection(AsyncAPIResource): +class AsyncBrandProtectionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBrandProtectionWithRawResponse: - return AsyncBrandProtectionWithRawResponse(self) + def with_raw_response(self) -> AsyncBrandProtectionResourceWithRawResponse: + return AsyncBrandProtectionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBrandProtectionWithStreamingResponse: - return AsyncBrandProtectionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBrandProtectionResourceWithStreamingResponse: + return AsyncBrandProtectionResourceWithStreamingResponse(self) async def submit( self, @@ -154,7 +151,7 @@ async def submit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelPhishingURLSubmit: + ) -> Submit: """ Submit suspicious URL for scanning @@ -181,9 +178,9 @@ async def submit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Submit]._unwrapper, ), - cast_to=cast(Type[IntelPhishingURLSubmit], ResultWrapper[IntelPhishingURLSubmit]), + cast_to=cast(Type[Submit], ResultWrapper[Submit]), ) async def url_info( @@ -198,7 +195,7 @@ async def url_info( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelPhishingURLInfo: + ) -> Info: """ Get results for a URL scan @@ -229,14 +226,14 @@ async def url_info( }, brand_protection_url_info_params.BrandProtectionURLInfoParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Info]._unwrapper, ), - cast_to=cast(Type[IntelPhishingURLInfo], ResultWrapper[IntelPhishingURLInfo]), + cast_to=cast(Type[Info], ResultWrapper[Info]), ) -class BrandProtectionWithRawResponse: - def __init__(self, brand_protection: BrandProtection) -> None: +class BrandProtectionResourceWithRawResponse: + def __init__(self, brand_protection: BrandProtectionResource) -> None: self._brand_protection = brand_protection self.submit = to_raw_response_wrapper( @@ -247,8 +244,8 @@ def __init__(self, brand_protection: BrandProtection) -> None: ) -class AsyncBrandProtectionWithRawResponse: - def __init__(self, brand_protection: AsyncBrandProtection) -> None: +class AsyncBrandProtectionResourceWithRawResponse: + def __init__(self, brand_protection: AsyncBrandProtectionResource) -> None: self._brand_protection = brand_protection self.submit = async_to_raw_response_wrapper( @@ -259,8 +256,8 @@ def __init__(self, brand_protection: AsyncBrandProtection) -> None: ) -class BrandProtectionWithStreamingResponse: - def __init__(self, brand_protection: BrandProtection) -> None: +class BrandProtectionResourceWithStreamingResponse: + def __init__(self, brand_protection: BrandProtectionResource) -> None: self._brand_protection = brand_protection self.submit = to_streamed_response_wrapper( @@ -271,8 +268,8 @@ def __init__(self, brand_protection: BrandProtection) -> None: ) -class AsyncBrandProtectionWithStreamingResponse: - def __init__(self, brand_protection: AsyncBrandProtection) -> None: +class AsyncBrandProtectionResourceWithStreamingResponse: + def __init__(self, brand_protection: AsyncBrandProtectionResource) -> None: self._brand_protection = brand_protection self.submit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/cache/__init__.py b/src/cloudflare/resources/cache/__init__.py index 3ee20b0af7f..faa73ad7735 100644 --- a/src/cloudflare/resources/cache/__init__.py +++ b/src/cloudflare/resources/cache/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .cache import ( - Cache, - AsyncCache, - CacheWithRawResponse, - AsyncCacheWithRawResponse, - CacheWithStreamingResponse, - AsyncCacheWithStreamingResponse, + CacheResource, + AsyncCacheResource, + CacheResourceWithRawResponse, + AsyncCacheResourceWithRawResponse, + CacheResourceWithStreamingResponse, + AsyncCacheResourceWithStreamingResponse, ) from .variants import ( - Variants, - AsyncVariants, - VariantsWithRawResponse, - AsyncVariantsWithRawResponse, - VariantsWithStreamingResponse, - AsyncVariantsWithStreamingResponse, + VariantsResource, + AsyncVariantsResource, + VariantsResourceWithRawResponse, + AsyncVariantsResourceWithRawResponse, + VariantsResourceWithStreamingResponse, + AsyncVariantsResourceWithStreamingResponse, ) from .cache_reserve import ( - CacheReserve, - AsyncCacheReserve, - CacheReserveWithRawResponse, - AsyncCacheReserveWithRawResponse, - CacheReserveWithStreamingResponse, - AsyncCacheReserveWithStreamingResponse, + CacheReserveResource, + AsyncCacheReserveResource, + CacheReserveResourceWithRawResponse, + AsyncCacheReserveResourceWithRawResponse, + CacheReserveResourceWithStreamingResponse, + AsyncCacheReserveResourceWithStreamingResponse, ) from .smart_tiered_cache import ( - SmartTieredCache, - AsyncSmartTieredCache, - SmartTieredCacheWithRawResponse, - AsyncSmartTieredCacheWithRawResponse, - SmartTieredCacheWithStreamingResponse, - AsyncSmartTieredCacheWithStreamingResponse, + SmartTieredCacheResource, + AsyncSmartTieredCacheResource, + SmartTieredCacheResourceWithRawResponse, + AsyncSmartTieredCacheResourceWithRawResponse, + SmartTieredCacheResourceWithStreamingResponse, + AsyncSmartTieredCacheResourceWithStreamingResponse, ) from .regional_tiered_cache import ( - RegionalTieredCache, - AsyncRegionalTieredCache, - RegionalTieredCacheWithRawResponse, - AsyncRegionalTieredCacheWithRawResponse, - RegionalTieredCacheWithStreamingResponse, - AsyncRegionalTieredCacheWithStreamingResponse, + RegionalTieredCacheResource, + AsyncRegionalTieredCacheResource, + RegionalTieredCacheResourceWithRawResponse, + AsyncRegionalTieredCacheResourceWithRawResponse, + RegionalTieredCacheResourceWithStreamingResponse, + AsyncRegionalTieredCacheResourceWithStreamingResponse, ) __all__ = [ - "CacheReserve", - "AsyncCacheReserve", - "CacheReserveWithRawResponse", - "AsyncCacheReserveWithRawResponse", - "CacheReserveWithStreamingResponse", - "AsyncCacheReserveWithStreamingResponse", - "SmartTieredCache", - "AsyncSmartTieredCache", - "SmartTieredCacheWithRawResponse", - "AsyncSmartTieredCacheWithRawResponse", - "SmartTieredCacheWithStreamingResponse", - "AsyncSmartTieredCacheWithStreamingResponse", - "Variants", - "AsyncVariants", - "VariantsWithRawResponse", - "AsyncVariantsWithRawResponse", - "VariantsWithStreamingResponse", - "AsyncVariantsWithStreamingResponse", - "RegionalTieredCache", - "AsyncRegionalTieredCache", - "RegionalTieredCacheWithRawResponse", - "AsyncRegionalTieredCacheWithRawResponse", - "RegionalTieredCacheWithStreamingResponse", - "AsyncRegionalTieredCacheWithStreamingResponse", - "Cache", - "AsyncCache", - "CacheWithRawResponse", - "AsyncCacheWithRawResponse", - "CacheWithStreamingResponse", - "AsyncCacheWithStreamingResponse", + "CacheReserveResource", + "AsyncCacheReserveResource", + "CacheReserveResourceWithRawResponse", + "AsyncCacheReserveResourceWithRawResponse", + "CacheReserveResourceWithStreamingResponse", + "AsyncCacheReserveResourceWithStreamingResponse", + "SmartTieredCacheResource", + "AsyncSmartTieredCacheResource", + "SmartTieredCacheResourceWithRawResponse", + "AsyncSmartTieredCacheResourceWithRawResponse", + "SmartTieredCacheResourceWithStreamingResponse", + "AsyncSmartTieredCacheResourceWithStreamingResponse", + "VariantsResource", + "AsyncVariantsResource", + "VariantsResourceWithRawResponse", + "AsyncVariantsResourceWithRawResponse", + "VariantsResourceWithStreamingResponse", + "AsyncVariantsResourceWithStreamingResponse", + "RegionalTieredCacheResource", + "AsyncRegionalTieredCacheResource", + "RegionalTieredCacheResourceWithRawResponse", + "AsyncRegionalTieredCacheResourceWithRawResponse", + "RegionalTieredCacheResourceWithStreamingResponse", + "AsyncRegionalTieredCacheResourceWithStreamingResponse", + "CacheResource", + "AsyncCacheResource", + "CacheResourceWithRawResponse", + "AsyncCacheResourceWithRawResponse", + "CacheResourceWithStreamingResponse", + "AsyncCacheResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/cache/cache.py b/src/cloudflare/resources/cache/cache.py index 47c6d235c49..c46d707bd24 100644 --- a/src/cloudflare/resources/cache/cache.py +++ b/src/cloudflare/resources/cache/cache.py @@ -6,7 +6,6 @@ import httpx -from ...types import CachePurgeResponse, cache_purge_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( required_args, @@ -14,12 +13,12 @@ async_maybe_transform, ) from .variants import ( - Variants, - AsyncVariants, - VariantsWithRawResponse, - AsyncVariantsWithRawResponse, - VariantsWithStreamingResponse, - AsyncVariantsWithStreamingResponse, + VariantsResource, + AsyncVariantsResource, + VariantsResourceWithRawResponse, + AsyncVariantsResourceWithRawResponse, + VariantsResourceWithStreamingResponse, + AsyncVariantsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -30,61 +29,63 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...types.cache import cache_purge_params from .cache_reserve import ( - CacheReserve, - AsyncCacheReserve, - CacheReserveWithRawResponse, - AsyncCacheReserveWithRawResponse, - CacheReserveWithStreamingResponse, - AsyncCacheReserveWithStreamingResponse, + CacheReserveResource, + AsyncCacheReserveResource, + CacheReserveResourceWithRawResponse, + AsyncCacheReserveResourceWithRawResponse, + CacheReserveResourceWithStreamingResponse, + AsyncCacheReserveResourceWithStreamingResponse, ) from ..._base_client import ( make_request_options, ) from .smart_tiered_cache import ( - SmartTieredCache, - AsyncSmartTieredCache, - SmartTieredCacheWithRawResponse, - AsyncSmartTieredCacheWithRawResponse, - SmartTieredCacheWithStreamingResponse, - AsyncSmartTieredCacheWithStreamingResponse, + SmartTieredCacheResource, + AsyncSmartTieredCacheResource, + SmartTieredCacheResourceWithRawResponse, + AsyncSmartTieredCacheResourceWithRawResponse, + SmartTieredCacheResourceWithStreamingResponse, + AsyncSmartTieredCacheResourceWithStreamingResponse, ) from .regional_tiered_cache import ( - RegionalTieredCache, - AsyncRegionalTieredCache, - RegionalTieredCacheWithRawResponse, - AsyncRegionalTieredCacheWithRawResponse, - RegionalTieredCacheWithStreamingResponse, - AsyncRegionalTieredCacheWithStreamingResponse, + RegionalTieredCacheResource, + AsyncRegionalTieredCacheResource, + RegionalTieredCacheResourceWithRawResponse, + AsyncRegionalTieredCacheResourceWithRawResponse, + RegionalTieredCacheResourceWithStreamingResponse, + AsyncRegionalTieredCacheResourceWithStreamingResponse, ) +from ...types.cache.cache_purge_response import CachePurgeResponse -__all__ = ["Cache", "AsyncCache"] +__all__ = ["CacheResource", "AsyncCacheResource"] -class Cache(SyncAPIResource): +class CacheResource(SyncAPIResource): @cached_property - def cache_reserve(self) -> CacheReserve: - return CacheReserve(self._client) + def cache_reserve(self) -> CacheReserveResource: + return CacheReserveResource(self._client) @cached_property - def smart_tiered_cache(self) -> SmartTieredCache: - return SmartTieredCache(self._client) + def smart_tiered_cache(self) -> SmartTieredCacheResource: + return SmartTieredCacheResource(self._client) @cached_property - def variants(self) -> Variants: - return Variants(self._client) + def variants(self) -> VariantsResource: + return VariantsResource(self._client) @cached_property - def regional_tiered_cache(self) -> RegionalTieredCache: - return RegionalTieredCache(self._client) + def regional_tiered_cache(self) -> RegionalTieredCacheResource: + return RegionalTieredCacheResource(self._client) @cached_property - def with_raw_response(self) -> CacheWithRawResponse: - return CacheWithRawResponse(self) + def with_raw_response(self) -> CacheResourceWithRawResponse: + return CacheResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CacheWithStreamingResponse: - return CacheWithStreamingResponse(self) + def with_streaming_response(self) -> CacheResourceWithStreamingResponse: + return CacheResourceWithStreamingResponse(self) @overload def purge( @@ -117,7 +118,9 @@ def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -172,7 +175,9 @@ def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -227,7 +232,9 @@ def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -282,7 +289,9 @@ def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -337,7 +346,9 @@ def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -397,36 +408,36 @@ def purge( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CachePurgeResponse]]._unwrapper, ), cast_to=cast(Type[Optional[CachePurgeResponse]], ResultWrapper[CachePurgeResponse]), ) -class AsyncCache(AsyncAPIResource): +class AsyncCacheResource(AsyncAPIResource): @cached_property - def cache_reserve(self) -> AsyncCacheReserve: - return AsyncCacheReserve(self._client) + def cache_reserve(self) -> AsyncCacheReserveResource: + return AsyncCacheReserveResource(self._client) @cached_property - def smart_tiered_cache(self) -> AsyncSmartTieredCache: - return AsyncSmartTieredCache(self._client) + def smart_tiered_cache(self) -> AsyncSmartTieredCacheResource: + return AsyncSmartTieredCacheResource(self._client) @cached_property - def variants(self) -> AsyncVariants: - return AsyncVariants(self._client) + def variants(self) -> AsyncVariantsResource: + return AsyncVariantsResource(self._client) @cached_property - def regional_tiered_cache(self) -> AsyncRegionalTieredCache: - return AsyncRegionalTieredCache(self._client) + def regional_tiered_cache(self) -> AsyncRegionalTieredCacheResource: + return AsyncRegionalTieredCacheResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCacheWithRawResponse: - return AsyncCacheWithRawResponse(self) + def with_raw_response(self) -> AsyncCacheResourceWithRawResponse: + return AsyncCacheResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCacheWithStreamingResponse: - return AsyncCacheWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCacheResourceWithStreamingResponse: + return AsyncCacheResourceWithStreamingResponse(self) @overload async def purge( @@ -459,7 +470,9 @@ async def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -514,7 +527,9 @@ async def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -569,7 +584,9 @@ async def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -624,7 +641,9 @@ async def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -679,7 +698,9 @@ async def purge( **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for - http, 443 for https), but must be included otherwise. + http, 443 for https), but must be included otherwise. **NB:** For Zones on + Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones + on Enterprise plan, you may purge up to 500 URLs in one API call. ### Purge Cached Content by Tag, Host or Prefix @@ -739,14 +760,14 @@ async def purge( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CachePurgeResponse]]._unwrapper, ), cast_to=cast(Type[Optional[CachePurgeResponse]], ResultWrapper[CachePurgeResponse]), ) -class CacheWithRawResponse: - def __init__(self, cache: Cache) -> None: +class CacheResourceWithRawResponse: + def __init__(self, cache: CacheResource) -> None: self._cache = cache self.purge = to_raw_response_wrapper( @@ -754,24 +775,24 @@ def __init__(self, cache: Cache) -> None: ) @cached_property - def cache_reserve(self) -> CacheReserveWithRawResponse: - return CacheReserveWithRawResponse(self._cache.cache_reserve) + def cache_reserve(self) -> CacheReserveResourceWithRawResponse: + return CacheReserveResourceWithRawResponse(self._cache.cache_reserve) @cached_property - def smart_tiered_cache(self) -> SmartTieredCacheWithRawResponse: - return SmartTieredCacheWithRawResponse(self._cache.smart_tiered_cache) + def smart_tiered_cache(self) -> SmartTieredCacheResourceWithRawResponse: + return SmartTieredCacheResourceWithRawResponse(self._cache.smart_tiered_cache) @cached_property - def variants(self) -> VariantsWithRawResponse: - return VariantsWithRawResponse(self._cache.variants) + def variants(self) -> VariantsResourceWithRawResponse: + return VariantsResourceWithRawResponse(self._cache.variants) @cached_property - def regional_tiered_cache(self) -> RegionalTieredCacheWithRawResponse: - return RegionalTieredCacheWithRawResponse(self._cache.regional_tiered_cache) + def regional_tiered_cache(self) -> RegionalTieredCacheResourceWithRawResponse: + return RegionalTieredCacheResourceWithRawResponse(self._cache.regional_tiered_cache) -class AsyncCacheWithRawResponse: - def __init__(self, cache: AsyncCache) -> None: +class AsyncCacheResourceWithRawResponse: + def __init__(self, cache: AsyncCacheResource) -> None: self._cache = cache self.purge = async_to_raw_response_wrapper( @@ -779,24 +800,24 @@ def __init__(self, cache: AsyncCache) -> None: ) @cached_property - def cache_reserve(self) -> AsyncCacheReserveWithRawResponse: - return AsyncCacheReserveWithRawResponse(self._cache.cache_reserve) + def cache_reserve(self) -> AsyncCacheReserveResourceWithRawResponse: + return AsyncCacheReserveResourceWithRawResponse(self._cache.cache_reserve) @cached_property - def smart_tiered_cache(self) -> AsyncSmartTieredCacheWithRawResponse: - return AsyncSmartTieredCacheWithRawResponse(self._cache.smart_tiered_cache) + def smart_tiered_cache(self) -> AsyncSmartTieredCacheResourceWithRawResponse: + return AsyncSmartTieredCacheResourceWithRawResponse(self._cache.smart_tiered_cache) @cached_property - def variants(self) -> AsyncVariantsWithRawResponse: - return AsyncVariantsWithRawResponse(self._cache.variants) + def variants(self) -> AsyncVariantsResourceWithRawResponse: + return AsyncVariantsResourceWithRawResponse(self._cache.variants) @cached_property - def regional_tiered_cache(self) -> AsyncRegionalTieredCacheWithRawResponse: - return AsyncRegionalTieredCacheWithRawResponse(self._cache.regional_tiered_cache) + def regional_tiered_cache(self) -> AsyncRegionalTieredCacheResourceWithRawResponse: + return AsyncRegionalTieredCacheResourceWithRawResponse(self._cache.regional_tiered_cache) -class CacheWithStreamingResponse: - def __init__(self, cache: Cache) -> None: +class CacheResourceWithStreamingResponse: + def __init__(self, cache: CacheResource) -> None: self._cache = cache self.purge = to_streamed_response_wrapper( @@ -804,24 +825,24 @@ def __init__(self, cache: Cache) -> None: ) @cached_property - def cache_reserve(self) -> CacheReserveWithStreamingResponse: - return CacheReserveWithStreamingResponse(self._cache.cache_reserve) + def cache_reserve(self) -> CacheReserveResourceWithStreamingResponse: + return CacheReserveResourceWithStreamingResponse(self._cache.cache_reserve) @cached_property - def smart_tiered_cache(self) -> SmartTieredCacheWithStreamingResponse: - return SmartTieredCacheWithStreamingResponse(self._cache.smart_tiered_cache) + def smart_tiered_cache(self) -> SmartTieredCacheResourceWithStreamingResponse: + return SmartTieredCacheResourceWithStreamingResponse(self._cache.smart_tiered_cache) @cached_property - def variants(self) -> VariantsWithStreamingResponse: - return VariantsWithStreamingResponse(self._cache.variants) + def variants(self) -> VariantsResourceWithStreamingResponse: + return VariantsResourceWithStreamingResponse(self._cache.variants) @cached_property - def regional_tiered_cache(self) -> RegionalTieredCacheWithStreamingResponse: - return RegionalTieredCacheWithStreamingResponse(self._cache.regional_tiered_cache) + def regional_tiered_cache(self) -> RegionalTieredCacheResourceWithStreamingResponse: + return RegionalTieredCacheResourceWithStreamingResponse(self._cache.regional_tiered_cache) -class AsyncCacheWithStreamingResponse: - def __init__(self, cache: AsyncCache) -> None: +class AsyncCacheResourceWithStreamingResponse: + def __init__(self, cache: AsyncCacheResource) -> None: self._cache = cache self.purge = async_to_streamed_response_wrapper( @@ -829,17 +850,17 @@ def __init__(self, cache: AsyncCache) -> None: ) @cached_property - def cache_reserve(self) -> AsyncCacheReserveWithStreamingResponse: - return AsyncCacheReserveWithStreamingResponse(self._cache.cache_reserve) + def cache_reserve(self) -> AsyncCacheReserveResourceWithStreamingResponse: + return AsyncCacheReserveResourceWithStreamingResponse(self._cache.cache_reserve) @cached_property - def smart_tiered_cache(self) -> AsyncSmartTieredCacheWithStreamingResponse: - return AsyncSmartTieredCacheWithStreamingResponse(self._cache.smart_tiered_cache) + def smart_tiered_cache(self) -> AsyncSmartTieredCacheResourceWithStreamingResponse: + return AsyncSmartTieredCacheResourceWithStreamingResponse(self._cache.smart_tiered_cache) @cached_property - def variants(self) -> AsyncVariantsWithStreamingResponse: - return AsyncVariantsWithStreamingResponse(self._cache.variants) + def variants(self) -> AsyncVariantsResourceWithStreamingResponse: + return AsyncVariantsResourceWithStreamingResponse(self._cache.variants) @cached_property - def regional_tiered_cache(self) -> AsyncRegionalTieredCacheWithStreamingResponse: - return AsyncRegionalTieredCacheWithStreamingResponse(self._cache.regional_tiered_cache) + def regional_tiered_cache(self) -> AsyncRegionalTieredCacheResourceWithStreamingResponse: + return AsyncRegionalTieredCacheResourceWithStreamingResponse(self._cache.regional_tiered_cache) diff --git a/src/cloudflare/resources/cache/cache_reserve.py b/src/cloudflare/resources/cache/cache_reserve.py index b41c1435e30..8a249b50a0a 100644 --- a/src/cloudflare/resources/cache/cache_reserve.py +++ b/src/cloudflare/resources/cache/cache_reserve.py @@ -21,33 +21,32 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.cache import ( - CacheReserveGetResponse, - CacheReserveEditResponse, - CacheReserveClearResponse, - CacheReserveStatusResponse, - cache_reserve_edit_params, -) +from ...types.cache import cache_reserve_edit_params, cache_reserve_clear_params from ..._base_client import ( make_request_options, ) +from ...types.cache.cache_reserve_get_response import CacheReserveGetResponse +from ...types.cache.cache_reserve_edit_response import CacheReserveEditResponse +from ...types.cache.cache_reserve_clear_response import CacheReserveClearResponse +from ...types.cache.cache_reserve_status_response import CacheReserveStatusResponse -__all__ = ["CacheReserve", "AsyncCacheReserve"] +__all__ = ["CacheReserveResource", "AsyncCacheReserveResource"] -class CacheReserve(SyncAPIResource): +class CacheReserveResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CacheReserveWithRawResponse: - return CacheReserveWithRawResponse(self) + def with_raw_response(self) -> CacheReserveResourceWithRawResponse: + return CacheReserveResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CacheReserveWithStreamingResponse: - return CacheReserveWithStreamingResponse(self) + def with_streaming_response(self) -> CacheReserveResourceWithStreamingResponse: + return CacheReserveResourceWithStreamingResponse(self) def clear( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +75,13 @@ def clear( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._post( f"/zones/{zone_id}/cache/cache_reserve_clear", + body=maybe_transform(body, cache_reserve_clear_params.CacheReserveClearParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheReserveClearResponse]._unwrapper, ), cast_to=cast(Type[CacheReserveClearResponse], ResultWrapper[CacheReserveClearResponse]), ) @@ -129,7 +129,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheReserveEditResponse]._unwrapper, ), cast_to=cast(Type[CacheReserveEditResponse], ResultWrapper[CacheReserveEditResponse]), ) @@ -173,7 +173,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheReserveGetResponse]._unwrapper, ), cast_to=cast(Type[CacheReserveGetResponse], ResultWrapper[CacheReserveGetResponse]), ) @@ -215,25 +215,26 @@ def status( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheReserveStatusResponse]._unwrapper, ), cast_to=cast(Type[CacheReserveStatusResponse], ResultWrapper[CacheReserveStatusResponse]), ) -class AsyncCacheReserve(AsyncAPIResource): +class AsyncCacheReserveResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCacheReserveWithRawResponse: - return AsyncCacheReserveWithRawResponse(self) + def with_raw_response(self) -> AsyncCacheReserveResourceWithRawResponse: + return AsyncCacheReserveResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCacheReserveWithStreamingResponse: - return AsyncCacheReserveWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCacheReserveResourceWithStreamingResponse: + return AsyncCacheReserveResourceWithStreamingResponse(self) async def clear( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -262,12 +263,13 @@ async def clear( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._post( f"/zones/{zone_id}/cache/cache_reserve_clear", + body=await async_maybe_transform(body, cache_reserve_clear_params.CacheReserveClearParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheReserveClearResponse]._unwrapper, ), cast_to=cast(Type[CacheReserveClearResponse], ResultWrapper[CacheReserveClearResponse]), ) @@ -315,7 +317,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheReserveEditResponse]._unwrapper, ), cast_to=cast(Type[CacheReserveEditResponse], ResultWrapper[CacheReserveEditResponse]), ) @@ -359,7 +361,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheReserveGetResponse]._unwrapper, ), cast_to=cast(Type[CacheReserveGetResponse], ResultWrapper[CacheReserveGetResponse]), ) @@ -401,14 +403,14 @@ async def status( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheReserveStatusResponse]._unwrapper, ), cast_to=cast(Type[CacheReserveStatusResponse], ResultWrapper[CacheReserveStatusResponse]), ) -class CacheReserveWithRawResponse: - def __init__(self, cache_reserve: CacheReserve) -> None: +class CacheReserveResourceWithRawResponse: + def __init__(self, cache_reserve: CacheReserveResource) -> None: self._cache_reserve = cache_reserve self.clear = to_raw_response_wrapper( @@ -425,8 +427,8 @@ def __init__(self, cache_reserve: CacheReserve) -> None: ) -class AsyncCacheReserveWithRawResponse: - def __init__(self, cache_reserve: AsyncCacheReserve) -> None: +class AsyncCacheReserveResourceWithRawResponse: + def __init__(self, cache_reserve: AsyncCacheReserveResource) -> None: self._cache_reserve = cache_reserve self.clear = async_to_raw_response_wrapper( @@ -443,8 +445,8 @@ def __init__(self, cache_reserve: AsyncCacheReserve) -> None: ) -class CacheReserveWithStreamingResponse: - def __init__(self, cache_reserve: CacheReserve) -> None: +class CacheReserveResourceWithStreamingResponse: + def __init__(self, cache_reserve: CacheReserveResource) -> None: self._cache_reserve = cache_reserve self.clear = to_streamed_response_wrapper( @@ -461,8 +463,8 @@ def __init__(self, cache_reserve: CacheReserve) -> None: ) -class AsyncCacheReserveWithStreamingResponse: - def __init__(self, cache_reserve: AsyncCacheReserve) -> None: +class AsyncCacheReserveResourceWithStreamingResponse: + def __init__(self, cache_reserve: AsyncCacheReserveResource) -> None: self._cache_reserve = cache_reserve self.clear = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/cache/regional_tiered_cache.py b/src/cloudflare/resources/cache/regional_tiered_cache.py index ef500dc4371..4ccfd7c49cc 100644 --- a/src/cloudflare/resources/cache/regional_tiered_cache.py +++ b/src/cloudflare/resources/cache/regional_tiered_cache.py @@ -21,26 +21,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.cache import ( - RegionalTieredCacheGetResponse, - RegionalTieredCacheEditResponse, - regional_tiered_cache_edit_params, -) +from ...types.cache import regional_tiered_cache_edit_params from ..._base_client import ( make_request_options, ) +from ...types.cache.regional_tiered_cache_get_response import RegionalTieredCacheGetResponse +from ...types.cache.regional_tiered_cache_edit_response import RegionalTieredCacheEditResponse -__all__ = ["RegionalTieredCache", "AsyncRegionalTieredCache"] +__all__ = ["RegionalTieredCacheResource", "AsyncRegionalTieredCacheResource"] -class RegionalTieredCache(SyncAPIResource): +class RegionalTieredCacheResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RegionalTieredCacheWithRawResponse: - return RegionalTieredCacheWithRawResponse(self) + def with_raw_response(self) -> RegionalTieredCacheResourceWithRawResponse: + return RegionalTieredCacheResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RegionalTieredCacheWithStreamingResponse: - return RegionalTieredCacheWithStreamingResponse(self) + def with_streaming_response(self) -> RegionalTieredCacheResourceWithStreamingResponse: + return RegionalTieredCacheResourceWithStreamingResponse(self) def edit( self, @@ -82,7 +80,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RegionalTieredCacheEditResponse]._unwrapper, ), cast_to=cast(Type[RegionalTieredCacheEditResponse], ResultWrapper[RegionalTieredCacheEditResponse]), ) @@ -123,20 +121,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RegionalTieredCacheGetResponse]._unwrapper, ), cast_to=cast(Type[RegionalTieredCacheGetResponse], ResultWrapper[RegionalTieredCacheGetResponse]), ) -class AsyncRegionalTieredCache(AsyncAPIResource): +class AsyncRegionalTieredCacheResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRegionalTieredCacheWithRawResponse: - return AsyncRegionalTieredCacheWithRawResponse(self) + def with_raw_response(self) -> AsyncRegionalTieredCacheResourceWithRawResponse: + return AsyncRegionalTieredCacheResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRegionalTieredCacheWithStreamingResponse: - return AsyncRegionalTieredCacheWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRegionalTieredCacheResourceWithStreamingResponse: + return AsyncRegionalTieredCacheResourceWithStreamingResponse(self) async def edit( self, @@ -180,7 +178,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RegionalTieredCacheEditResponse]._unwrapper, ), cast_to=cast(Type[RegionalTieredCacheEditResponse], ResultWrapper[RegionalTieredCacheEditResponse]), ) @@ -221,14 +219,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RegionalTieredCacheGetResponse]._unwrapper, ), cast_to=cast(Type[RegionalTieredCacheGetResponse], ResultWrapper[RegionalTieredCacheGetResponse]), ) -class RegionalTieredCacheWithRawResponse: - def __init__(self, regional_tiered_cache: RegionalTieredCache) -> None: +class RegionalTieredCacheResourceWithRawResponse: + def __init__(self, regional_tiered_cache: RegionalTieredCacheResource) -> None: self._regional_tiered_cache = regional_tiered_cache self.edit = to_raw_response_wrapper( @@ -239,8 +237,8 @@ def __init__(self, regional_tiered_cache: RegionalTieredCache) -> None: ) -class AsyncRegionalTieredCacheWithRawResponse: - def __init__(self, regional_tiered_cache: AsyncRegionalTieredCache) -> None: +class AsyncRegionalTieredCacheResourceWithRawResponse: + def __init__(self, regional_tiered_cache: AsyncRegionalTieredCacheResource) -> None: self._regional_tiered_cache = regional_tiered_cache self.edit = async_to_raw_response_wrapper( @@ -251,8 +249,8 @@ def __init__(self, regional_tiered_cache: AsyncRegionalTieredCache) -> None: ) -class RegionalTieredCacheWithStreamingResponse: - def __init__(self, regional_tiered_cache: RegionalTieredCache) -> None: +class RegionalTieredCacheResourceWithStreamingResponse: + def __init__(self, regional_tiered_cache: RegionalTieredCacheResource) -> None: self._regional_tiered_cache = regional_tiered_cache self.edit = to_streamed_response_wrapper( @@ -263,8 +261,8 @@ def __init__(self, regional_tiered_cache: RegionalTieredCache) -> None: ) -class AsyncRegionalTieredCacheWithStreamingResponse: - def __init__(self, regional_tiered_cache: AsyncRegionalTieredCache) -> None: +class AsyncRegionalTieredCacheResourceWithStreamingResponse: + def __init__(self, regional_tiered_cache: AsyncRegionalTieredCacheResource) -> None: self._regional_tiered_cache = regional_tiered_cache self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/cache/smart_tiered_cache.py b/src/cloudflare/resources/cache/smart_tiered_cache.py index 237e7751731..39c7e79e4b0 100644 --- a/src/cloudflare/resources/cache/smart_tiered_cache.py +++ b/src/cloudflare/resources/cache/smart_tiered_cache.py @@ -21,32 +21,31 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.cache import ( - SmartTieredCacheGetResponse, - SmartTieredCacheEditResponse, - SmartTieredCacheDeleteResponse, - smart_tiered_cache_edit_params, -) +from ...types.cache import smart_tiered_cache_edit_params, smart_tiered_cache_delete_params from ..._base_client import ( make_request_options, ) +from ...types.cache.smart_tiered_cache_get_response import SmartTieredCacheGetResponse +from ...types.cache.smart_tiered_cache_edit_response import SmartTieredCacheEditResponse +from ...types.cache.smart_tiered_cache_delete_response import SmartTieredCacheDeleteResponse -__all__ = ["SmartTieredCache", "AsyncSmartTieredCache"] +__all__ = ["SmartTieredCacheResource", "AsyncSmartTieredCacheResource"] -class SmartTieredCache(SyncAPIResource): +class SmartTieredCacheResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SmartTieredCacheWithRawResponse: - return SmartTieredCacheWithRawResponse(self) + def with_raw_response(self) -> SmartTieredCacheResourceWithRawResponse: + return SmartTieredCacheResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SmartTieredCacheWithStreamingResponse: - return SmartTieredCacheWithStreamingResponse(self) + def with_streaming_response(self) -> SmartTieredCacheResourceWithStreamingResponse: + return SmartTieredCacheResourceWithStreamingResponse(self) def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -74,12 +73,13 @@ def delete( SmartTieredCacheDeleteResponse, self._delete( f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", + body=maybe_transform(body, smart_tiered_cache_delete_params.SmartTieredCacheDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartTieredCacheDeleteResponse] @@ -127,7 +127,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartTieredCacheEditResponse] @@ -171,7 +171,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartTieredCacheGetResponse] @@ -180,19 +180,20 @@ def get( ) -class AsyncSmartTieredCache(AsyncAPIResource): +class AsyncSmartTieredCacheResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSmartTieredCacheWithRawResponse: - return AsyncSmartTieredCacheWithRawResponse(self) + def with_raw_response(self) -> AsyncSmartTieredCacheResourceWithRawResponse: + return AsyncSmartTieredCacheResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSmartTieredCacheWithStreamingResponse: - return AsyncSmartTieredCacheWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSmartTieredCacheResourceWithStreamingResponse: + return AsyncSmartTieredCacheResourceWithStreamingResponse(self) async def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -220,12 +221,13 @@ async def delete( SmartTieredCacheDeleteResponse, await self._delete( f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", + body=await async_maybe_transform(body, smart_tiered_cache_delete_params.SmartTieredCacheDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartTieredCacheDeleteResponse] @@ -275,7 +277,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartTieredCacheEditResponse] @@ -319,7 +321,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SmartTieredCacheGetResponse] @@ -328,8 +330,8 @@ async def get( ) -class SmartTieredCacheWithRawResponse: - def __init__(self, smart_tiered_cache: SmartTieredCache) -> None: +class SmartTieredCacheResourceWithRawResponse: + def __init__(self, smart_tiered_cache: SmartTieredCacheResource) -> None: self._smart_tiered_cache = smart_tiered_cache self.delete = to_raw_response_wrapper( @@ -343,8 +345,8 @@ def __init__(self, smart_tiered_cache: SmartTieredCache) -> None: ) -class AsyncSmartTieredCacheWithRawResponse: - def __init__(self, smart_tiered_cache: AsyncSmartTieredCache) -> None: +class AsyncSmartTieredCacheResourceWithRawResponse: + def __init__(self, smart_tiered_cache: AsyncSmartTieredCacheResource) -> None: self._smart_tiered_cache = smart_tiered_cache self.delete = async_to_raw_response_wrapper( @@ -358,8 +360,8 @@ def __init__(self, smart_tiered_cache: AsyncSmartTieredCache) -> None: ) -class SmartTieredCacheWithStreamingResponse: - def __init__(self, smart_tiered_cache: SmartTieredCache) -> None: +class SmartTieredCacheResourceWithStreamingResponse: + def __init__(self, smart_tiered_cache: SmartTieredCacheResource) -> None: self._smart_tiered_cache = smart_tiered_cache self.delete = to_streamed_response_wrapper( @@ -373,8 +375,8 @@ def __init__(self, smart_tiered_cache: SmartTieredCache) -> None: ) -class AsyncSmartTieredCacheWithStreamingResponse: - def __init__(self, smart_tiered_cache: AsyncSmartTieredCache) -> None: +class AsyncSmartTieredCacheResourceWithStreamingResponse: + def __init__(self, smart_tiered_cache: AsyncSmartTieredCacheResource) -> None: self._smart_tiered_cache = smart_tiered_cache self.delete = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/cache/variants.py b/src/cloudflare/resources/cache/variants.py index 5d8be413a62..c7043671ef7 100644 --- a/src/cloudflare/resources/cache/variants.py +++ b/src/cloudflare/resources/cache/variants.py @@ -20,34 +20,38 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.cache import CacheVariants, VariantGetResponse, VariantEditResponse, variant_edit_params +from ...types.cache import variant_edit_params, variant_delete_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 -__all__ = ["Variants", "AsyncVariants"] +__all__ = ["VariantsResource", "AsyncVariantsResource"] -class Variants(SyncAPIResource): +class VariantsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> VariantsWithRawResponse: - return VariantsWithRawResponse(self) + def with_raw_response(self) -> VariantsResourceWithRawResponse: + return VariantsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VariantsWithStreamingResponse: - return VariantsWithStreamingResponse(self) + def with_streaming_response(self) -> VariantsResourceWithStreamingResponse: + return VariantsResourceWithStreamingResponse(self) def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> CacheVariants: + ) -> CacheVariant: """ 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 @@ -70,14 +74,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._delete( f"/zones/{zone_id}/cache/variants", + body=maybe_transform(body, variant_delete_params.VariantDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheVariant]._unwrapper, ), - cast_to=cast(Type[CacheVariants], ResultWrapper[CacheVariants]), + cast_to=cast(Type[CacheVariant], ResultWrapper[CacheVariant]), ) def edit( @@ -122,7 +127,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantEditResponse]._unwrapper, ), cast_to=cast(Type[VariantEditResponse], ResultWrapper[VariantEditResponse]), ) @@ -165,32 +170,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantGetResponse]._unwrapper, ), cast_to=cast(Type[VariantGetResponse], ResultWrapper[VariantGetResponse]), ) -class AsyncVariants(AsyncAPIResource): +class AsyncVariantsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncVariantsWithRawResponse: - return AsyncVariantsWithRawResponse(self) + def with_raw_response(self) -> AsyncVariantsResourceWithRawResponse: + return AsyncVariantsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVariantsWithStreamingResponse: - return AsyncVariantsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVariantsResourceWithStreamingResponse: + return AsyncVariantsResourceWithStreamingResponse(self) async def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> CacheVariants: + ) -> CacheVariant: """ 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 @@ -213,14 +219,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._delete( f"/zones/{zone_id}/cache/variants", + body=await async_maybe_transform(body, variant_delete_params.VariantDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CacheVariant]._unwrapper, ), - cast_to=cast(Type[CacheVariants], ResultWrapper[CacheVariants]), + cast_to=cast(Type[CacheVariant], ResultWrapper[CacheVariant]), ) async def edit( @@ -265,7 +272,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantEditResponse]._unwrapper, ), cast_to=cast(Type[VariantEditResponse], ResultWrapper[VariantEditResponse]), ) @@ -308,14 +315,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantGetResponse]._unwrapper, ), cast_to=cast(Type[VariantGetResponse], ResultWrapper[VariantGetResponse]), ) -class VariantsWithRawResponse: - def __init__(self, variants: Variants) -> None: +class VariantsResourceWithRawResponse: + def __init__(self, variants: VariantsResource) -> None: self._variants = variants self.delete = to_raw_response_wrapper( @@ -329,8 +336,8 @@ def __init__(self, variants: Variants) -> None: ) -class AsyncVariantsWithRawResponse: - def __init__(self, variants: AsyncVariants) -> None: +class AsyncVariantsResourceWithRawResponse: + def __init__(self, variants: AsyncVariantsResource) -> None: self._variants = variants self.delete = async_to_raw_response_wrapper( @@ -344,8 +351,8 @@ def __init__(self, variants: AsyncVariants) -> None: ) -class VariantsWithStreamingResponse: - def __init__(self, variants: Variants) -> None: +class VariantsResourceWithStreamingResponse: + def __init__(self, variants: VariantsResource) -> None: self._variants = variants self.delete = to_streamed_response_wrapper( @@ -359,8 +366,8 @@ def __init__(self, variants: Variants) -> None: ) -class AsyncVariantsWithStreamingResponse: - def __init__(self, variants: AsyncVariants) -> None: +class AsyncVariantsResourceWithStreamingResponse: + def __init__(self, variants: AsyncVariantsResource) -> None: self._variants = variants self.delete = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/calls.py b/src/cloudflare/resources/calls.py index 595b997a7e5..71d97f590e8 100644 --- a/src/cloudflare/resources/calls.py +++ b/src/cloudflare/resources/calls.py @@ -2,11 +2,10 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx -from ..types import CallsApp, CallsAppWithSecret, call_create_params, call_update_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -22,22 +21,25 @@ ) from .._wrappers import ResultWrapper from ..pagination import SyncSinglePage, AsyncSinglePage +from ..types.calls import call_create_params, call_update_params from .._base_client import ( AsyncPaginator, make_request_options, ) +from ..types.calls.calls_app import CallsApp +from ..types.calls.calls_app_with_secret import CallsAppWithSecret -__all__ = ["Calls", "AsyncCalls"] +__all__ = ["CallsResource", "AsyncCallsResource"] -class Calls(SyncAPIResource): +class CallsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CallsWithRawResponse: - return CallsWithRawResponse(self) + def with_raw_response(self) -> CallsResourceWithRawResponse: + return CallsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CallsWithStreamingResponse: - return CallsWithStreamingResponse(self) + def with_streaming_response(self) -> CallsResourceWithStreamingResponse: + return CallsResourceWithStreamingResponse(self) def create( self, @@ -50,7 +52,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsAppWithSecret: + ) -> Optional[CallsAppWithSecret]: """Creates a new Cloudflare calls app. An app is an unique enviroment where each @@ -79,9 +81,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CallsAppWithSecret]]._unwrapper, ), - cast_to=cast(Type[CallsAppWithSecret], ResultWrapper[CallsAppWithSecret]), + cast_to=cast(Type[Optional[CallsAppWithSecret]], ResultWrapper[CallsAppWithSecret]), ) def update( @@ -96,7 +98,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Edit details for a single app. @@ -127,9 +129,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CallsApp]]._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) def list( @@ -179,7 +181,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Deletes an app from Cloudflare Calls @@ -207,9 +209,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CallsApp]]._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) def get( @@ -223,7 +225,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Fetches details for a single Calls app. @@ -251,20 +253,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CallsApp]]._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) -class AsyncCalls(AsyncAPIResource): +class AsyncCallsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCallsWithRawResponse: - return AsyncCallsWithRawResponse(self) + def with_raw_response(self) -> AsyncCallsResourceWithRawResponse: + return AsyncCallsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCallsWithStreamingResponse: - return AsyncCallsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCallsResourceWithStreamingResponse: + return AsyncCallsResourceWithStreamingResponse(self) async def create( self, @@ -277,7 +279,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsAppWithSecret: + ) -> Optional[CallsAppWithSecret]: """Creates a new Cloudflare calls app. An app is an unique enviroment where each @@ -306,9 +308,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CallsAppWithSecret]]._unwrapper, ), - cast_to=cast(Type[CallsAppWithSecret], ResultWrapper[CallsAppWithSecret]), + cast_to=cast(Type[Optional[CallsAppWithSecret]], ResultWrapper[CallsAppWithSecret]), ) async def update( @@ -323,7 +325,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Edit details for a single app. @@ -354,9 +356,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CallsApp]]._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) def list( @@ -406,7 +408,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Deletes an app from Cloudflare Calls @@ -434,9 +436,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CallsApp]]._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) async def get( @@ -450,7 +452,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Fetches details for a single Calls app. @@ -478,14 +480,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CallsApp]]._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) -class CallsWithRawResponse: - def __init__(self, calls: Calls) -> None: +class CallsResourceWithRawResponse: + def __init__(self, calls: CallsResource) -> None: self._calls = calls self.create = to_raw_response_wrapper( @@ -505,8 +507,8 @@ def __init__(self, calls: Calls) -> None: ) -class AsyncCallsWithRawResponse: - def __init__(self, calls: AsyncCalls) -> None: +class AsyncCallsResourceWithRawResponse: + def __init__(self, calls: AsyncCallsResource) -> None: self._calls = calls self.create = async_to_raw_response_wrapper( @@ -526,8 +528,8 @@ def __init__(self, calls: AsyncCalls) -> None: ) -class CallsWithStreamingResponse: - def __init__(self, calls: Calls) -> None: +class CallsResourceWithStreamingResponse: + def __init__(self, calls: CallsResource) -> None: self._calls = calls self.create = to_streamed_response_wrapper( @@ -547,8 +549,8 @@ def __init__(self, calls: Calls) -> None: ) -class AsyncCallsWithStreamingResponse: - def __init__(self, calls: AsyncCalls) -> None: +class AsyncCallsResourceWithStreamingResponse: + def __init__(self, calls: AsyncCallsResource) -> None: self._calls = calls self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/certificate_authorities/__init__.py b/src/cloudflare/resources/certificate_authorities/__init__.py index b257d55b35f..8a27c3297ef 100644 --- a/src/cloudflare/resources/certificate_authorities/__init__.py +++ b/src/cloudflare/resources/certificate_authorities/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .hostname_associations import ( - HostnameAssociations, - AsyncHostnameAssociations, - HostnameAssociationsWithRawResponse, - AsyncHostnameAssociationsWithRawResponse, - HostnameAssociationsWithStreamingResponse, - AsyncHostnameAssociationsWithStreamingResponse, + HostnameAssociationsResource, + AsyncHostnameAssociationsResource, + HostnameAssociationsResourceWithRawResponse, + AsyncHostnameAssociationsResourceWithRawResponse, + HostnameAssociationsResourceWithStreamingResponse, + AsyncHostnameAssociationsResourceWithStreamingResponse, ) from .certificate_authorities import ( - CertificateAuthorities, - AsyncCertificateAuthorities, - CertificateAuthoritiesWithRawResponse, - AsyncCertificateAuthoritiesWithRawResponse, - CertificateAuthoritiesWithStreamingResponse, - AsyncCertificateAuthoritiesWithStreamingResponse, + CertificateAuthoritiesResource, + AsyncCertificateAuthoritiesResource, + CertificateAuthoritiesResourceWithRawResponse, + AsyncCertificateAuthoritiesResourceWithRawResponse, + CertificateAuthoritiesResourceWithStreamingResponse, + AsyncCertificateAuthoritiesResourceWithStreamingResponse, ) __all__ = [ - "HostnameAssociations", - "AsyncHostnameAssociations", - "HostnameAssociationsWithRawResponse", - "AsyncHostnameAssociationsWithRawResponse", - "HostnameAssociationsWithStreamingResponse", - "AsyncHostnameAssociationsWithStreamingResponse", - "CertificateAuthorities", - "AsyncCertificateAuthorities", - "CertificateAuthoritiesWithRawResponse", - "AsyncCertificateAuthoritiesWithRawResponse", - "CertificateAuthoritiesWithStreamingResponse", - "AsyncCertificateAuthoritiesWithStreamingResponse", + "HostnameAssociationsResource", + "AsyncHostnameAssociationsResource", + "HostnameAssociationsResourceWithRawResponse", + "AsyncHostnameAssociationsResourceWithRawResponse", + "HostnameAssociationsResourceWithStreamingResponse", + "AsyncHostnameAssociationsResourceWithStreamingResponse", + "CertificateAuthoritiesResource", + "AsyncCertificateAuthoritiesResource", + "CertificateAuthoritiesResourceWithRawResponse", + "AsyncCertificateAuthoritiesResourceWithRawResponse", + "CertificateAuthoritiesResourceWithStreamingResponse", + "AsyncCertificateAuthoritiesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/certificate_authorities/certificate_authorities.py b/src/cloudflare/resources/certificate_authorities/certificate_authorities.py index 0334240a5c4..f5ff3cbf4eb 100644 --- a/src/cloudflare/resources/certificate_authorities/certificate_authorities.py +++ b/src/cloudflare/resources/certificate_authorities/certificate_authorities.py @@ -5,76 +5,78 @@ from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from .hostname_associations import ( - HostnameAssociations, - AsyncHostnameAssociations, - HostnameAssociationsWithRawResponse, - AsyncHostnameAssociationsWithRawResponse, - HostnameAssociationsWithStreamingResponse, - AsyncHostnameAssociationsWithStreamingResponse, + HostnameAssociationsResource, + AsyncHostnameAssociationsResource, + HostnameAssociationsResourceWithRawResponse, + AsyncHostnameAssociationsResourceWithRawResponse, + HostnameAssociationsResourceWithStreamingResponse, + AsyncHostnameAssociationsResourceWithStreamingResponse, ) -__all__ = ["CertificateAuthorities", "AsyncCertificateAuthorities"] +__all__ = ["CertificateAuthoritiesResource", "AsyncCertificateAuthoritiesResource"] -class CertificateAuthorities(SyncAPIResource): +class CertificateAuthoritiesResource(SyncAPIResource): @cached_property - def hostname_associations(self) -> HostnameAssociations: - return HostnameAssociations(self._client) + def hostname_associations(self) -> HostnameAssociationsResource: + return HostnameAssociationsResource(self._client) @cached_property - def with_raw_response(self) -> CertificateAuthoritiesWithRawResponse: - return CertificateAuthoritiesWithRawResponse(self) + def with_raw_response(self) -> CertificateAuthoritiesResourceWithRawResponse: + return CertificateAuthoritiesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CertificateAuthoritiesWithStreamingResponse: - return CertificateAuthoritiesWithStreamingResponse(self) + def with_streaming_response(self) -> CertificateAuthoritiesResourceWithStreamingResponse: + return CertificateAuthoritiesResourceWithStreamingResponse(self) -class AsyncCertificateAuthorities(AsyncAPIResource): +class AsyncCertificateAuthoritiesResource(AsyncAPIResource): @cached_property - def hostname_associations(self) -> AsyncHostnameAssociations: - return AsyncHostnameAssociations(self._client) + def hostname_associations(self) -> AsyncHostnameAssociationsResource: + return AsyncHostnameAssociationsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCertificateAuthoritiesWithRawResponse: - return AsyncCertificateAuthoritiesWithRawResponse(self) + def with_raw_response(self) -> AsyncCertificateAuthoritiesResourceWithRawResponse: + return AsyncCertificateAuthoritiesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCertificateAuthoritiesWithStreamingResponse: - return AsyncCertificateAuthoritiesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCertificateAuthoritiesResourceWithStreamingResponse: + return AsyncCertificateAuthoritiesResourceWithStreamingResponse(self) -class CertificateAuthoritiesWithRawResponse: - def __init__(self, certificate_authorities: CertificateAuthorities) -> None: +class CertificateAuthoritiesResourceWithRawResponse: + def __init__(self, certificate_authorities: CertificateAuthoritiesResource) -> None: self._certificate_authorities = certificate_authorities @cached_property - def hostname_associations(self) -> HostnameAssociationsWithRawResponse: - return HostnameAssociationsWithRawResponse(self._certificate_authorities.hostname_associations) + def hostname_associations(self) -> HostnameAssociationsResourceWithRawResponse: + return HostnameAssociationsResourceWithRawResponse(self._certificate_authorities.hostname_associations) -class AsyncCertificateAuthoritiesWithRawResponse: - def __init__(self, certificate_authorities: AsyncCertificateAuthorities) -> None: +class AsyncCertificateAuthoritiesResourceWithRawResponse: + def __init__(self, certificate_authorities: AsyncCertificateAuthoritiesResource) -> None: self._certificate_authorities = certificate_authorities @cached_property - def hostname_associations(self) -> AsyncHostnameAssociationsWithRawResponse: - return AsyncHostnameAssociationsWithRawResponse(self._certificate_authorities.hostname_associations) + def hostname_associations(self) -> AsyncHostnameAssociationsResourceWithRawResponse: + return AsyncHostnameAssociationsResourceWithRawResponse(self._certificate_authorities.hostname_associations) -class CertificateAuthoritiesWithStreamingResponse: - def __init__(self, certificate_authorities: CertificateAuthorities) -> None: +class CertificateAuthoritiesResourceWithStreamingResponse: + def __init__(self, certificate_authorities: CertificateAuthoritiesResource) -> None: self._certificate_authorities = certificate_authorities @cached_property - def hostname_associations(self) -> HostnameAssociationsWithStreamingResponse: - return HostnameAssociationsWithStreamingResponse(self._certificate_authorities.hostname_associations) + def hostname_associations(self) -> HostnameAssociationsResourceWithStreamingResponse: + return HostnameAssociationsResourceWithStreamingResponse(self._certificate_authorities.hostname_associations) -class AsyncCertificateAuthoritiesWithStreamingResponse: - def __init__(self, certificate_authorities: AsyncCertificateAuthorities) -> None: +class AsyncCertificateAuthoritiesResourceWithStreamingResponse: + def __init__(self, certificate_authorities: AsyncCertificateAuthoritiesResource) -> None: self._certificate_authorities = certificate_authorities @cached_property - def hostname_associations(self) -> AsyncHostnameAssociationsWithStreamingResponse: - return AsyncHostnameAssociationsWithStreamingResponse(self._certificate_authorities.hostname_associations) + def hostname_associations(self) -> AsyncHostnameAssociationsResourceWithStreamingResponse: + return AsyncHostnameAssociationsResourceWithStreamingResponse( + self._certificate_authorities.hostname_associations + ) diff --git a/src/cloudflare/resources/certificate_authorities/hostname_associations.py b/src/cloudflare/resources/certificate_authorities/hostname_associations.py index 87331116d12..688bbaf4aaf 100644 --- a/src/cloudflare/resources/certificate_authorities/hostname_associations.py +++ b/src/cloudflare/resources/certificate_authorities/hostname_associations.py @@ -23,29 +23,28 @@ from ..._base_client import ( make_request_options, ) -from ...types.certificate_authorities import ( - TLSHostnameAssociation, - hostname_association_get_params, - hostname_association_update_params, -) +from ...types.certificate_authorities import hostname_association_get_params, hostname_association_update_params +from ...types.certificate_authorities.hostname_association import HostnameAssociation +from ...types.certificate_authorities.hostname_association_get_response import HostnameAssociationGetResponse +from ...types.certificate_authorities.hostname_association_update_response import HostnameAssociationUpdateResponse -__all__ = ["HostnameAssociations", "AsyncHostnameAssociations"] +__all__ = ["HostnameAssociationsResource", "AsyncHostnameAssociationsResource"] -class HostnameAssociations(SyncAPIResource): +class HostnameAssociationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HostnameAssociationsWithRawResponse: - return HostnameAssociationsWithRawResponse(self) + def with_raw_response(self) -> HostnameAssociationsResourceWithRawResponse: + return HostnameAssociationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HostnameAssociationsWithStreamingResponse: - return HostnameAssociationsWithStreamingResponse(self) + def with_streaming_response(self) -> HostnameAssociationsResourceWithStreamingResponse: + return HostnameAssociationsResourceWithStreamingResponse(self) def update( self, *, zone_id: str, - hostnames: List[str] | NotGiven = NOT_GIVEN, + hostnames: List[HostnameAssociation] | NotGiven = NOT_GIVEN, mtls_certificate_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. @@ -53,7 +52,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TLSHostnameAssociation: + ) -> HostnameAssociationUpdateResponse: """ Replace Hostname Associations @@ -88,9 +87,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HostnameAssociationUpdateResponse]._unwrapper, ), - cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]), + cast_to=cast(Type[HostnameAssociationUpdateResponse], ResultWrapper[HostnameAssociationUpdateResponse]), ) def get( @@ -104,7 +103,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TLSHostnameAssociation: + ) -> HostnameAssociationGetResponse: """ List Hostname Associations @@ -136,26 +135,26 @@ def get( {"mtls_certificate_id": mtls_certificate_id}, hostname_association_get_params.HostnameAssociationGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HostnameAssociationGetResponse]._unwrapper, ), - cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]), + cast_to=cast(Type[HostnameAssociationGetResponse], ResultWrapper[HostnameAssociationGetResponse]), ) -class AsyncHostnameAssociations(AsyncAPIResource): +class AsyncHostnameAssociationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHostnameAssociationsWithRawResponse: - return AsyncHostnameAssociationsWithRawResponse(self) + def with_raw_response(self) -> AsyncHostnameAssociationsResourceWithRawResponse: + return AsyncHostnameAssociationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHostnameAssociationsWithStreamingResponse: - return AsyncHostnameAssociationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHostnameAssociationsResourceWithStreamingResponse: + return AsyncHostnameAssociationsResourceWithStreamingResponse(self) async def update( self, *, zone_id: str, - hostnames: List[str] | NotGiven = NOT_GIVEN, + hostnames: List[HostnameAssociation] | NotGiven = NOT_GIVEN, mtls_certificate_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. @@ -163,7 +162,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TLSHostnameAssociation: + ) -> HostnameAssociationUpdateResponse: """ Replace Hostname Associations @@ -198,9 +197,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HostnameAssociationUpdateResponse]._unwrapper, ), - cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]), + cast_to=cast(Type[HostnameAssociationUpdateResponse], ResultWrapper[HostnameAssociationUpdateResponse]), ) async def get( @@ -214,7 +213,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TLSHostnameAssociation: + ) -> HostnameAssociationGetResponse: """ List Hostname Associations @@ -246,14 +245,14 @@ async def get( {"mtls_certificate_id": mtls_certificate_id}, hostname_association_get_params.HostnameAssociationGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HostnameAssociationGetResponse]._unwrapper, ), - cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]), + cast_to=cast(Type[HostnameAssociationGetResponse], ResultWrapper[HostnameAssociationGetResponse]), ) -class HostnameAssociationsWithRawResponse: - def __init__(self, hostname_associations: HostnameAssociations) -> None: +class HostnameAssociationsResourceWithRawResponse: + def __init__(self, hostname_associations: HostnameAssociationsResource) -> None: self._hostname_associations = hostname_associations self.update = to_raw_response_wrapper( @@ -264,8 +263,8 @@ def __init__(self, hostname_associations: HostnameAssociations) -> None: ) -class AsyncHostnameAssociationsWithRawResponse: - def __init__(self, hostname_associations: AsyncHostnameAssociations) -> None: +class AsyncHostnameAssociationsResourceWithRawResponse: + def __init__(self, hostname_associations: AsyncHostnameAssociationsResource) -> None: self._hostname_associations = hostname_associations self.update = async_to_raw_response_wrapper( @@ -276,8 +275,8 @@ def __init__(self, hostname_associations: AsyncHostnameAssociations) -> None: ) -class HostnameAssociationsWithStreamingResponse: - def __init__(self, hostname_associations: HostnameAssociations) -> None: +class HostnameAssociationsResourceWithStreamingResponse: + def __init__(self, hostname_associations: HostnameAssociationsResource) -> None: self._hostname_associations = hostname_associations self.update = to_streamed_response_wrapper( @@ -288,8 +287,8 @@ def __init__(self, hostname_associations: HostnameAssociations) -> None: ) -class AsyncHostnameAssociationsWithStreamingResponse: - def __init__(self, hostname_associations: AsyncHostnameAssociations) -> None: +class AsyncHostnameAssociationsResourceWithStreamingResponse: + def __init__(self, hostname_associations: AsyncHostnameAssociationsResource) -> None: self._hostname_associations = hostname_associations self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/challenges/__init__.py b/src/cloudflare/resources/challenges/__init__.py index 039ed0a13ec..92f2f7a074a 100644 --- a/src/cloudflare/resources/challenges/__init__.py +++ b/src/cloudflare/resources/challenges/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .widgets import ( - Widgets, - AsyncWidgets, - WidgetsWithRawResponse, - AsyncWidgetsWithRawResponse, - WidgetsWithStreamingResponse, - AsyncWidgetsWithStreamingResponse, + WidgetsResource, + AsyncWidgetsResource, + WidgetsResourceWithRawResponse, + AsyncWidgetsResourceWithRawResponse, + WidgetsResourceWithStreamingResponse, + AsyncWidgetsResourceWithStreamingResponse, ) from .challenges import ( - Challenges, - AsyncChallenges, - ChallengesWithRawResponse, - AsyncChallengesWithRawResponse, - ChallengesWithStreamingResponse, - AsyncChallengesWithStreamingResponse, + ChallengesResource, + AsyncChallengesResource, + ChallengesResourceWithRawResponse, + AsyncChallengesResourceWithRawResponse, + ChallengesResourceWithStreamingResponse, + AsyncChallengesResourceWithStreamingResponse, ) __all__ = [ - "Widgets", - "AsyncWidgets", - "WidgetsWithRawResponse", - "AsyncWidgetsWithRawResponse", - "WidgetsWithStreamingResponse", - "AsyncWidgetsWithStreamingResponse", - "Challenges", - "AsyncChallenges", - "ChallengesWithRawResponse", - "AsyncChallengesWithRawResponse", - "ChallengesWithStreamingResponse", - "AsyncChallengesWithStreamingResponse", + "WidgetsResource", + "AsyncWidgetsResource", + "WidgetsResourceWithRawResponse", + "AsyncWidgetsResourceWithRawResponse", + "WidgetsResourceWithStreamingResponse", + "AsyncWidgetsResourceWithStreamingResponse", + "ChallengesResource", + "AsyncChallengesResource", + "ChallengesResourceWithRawResponse", + "AsyncChallengesResourceWithRawResponse", + "ChallengesResourceWithStreamingResponse", + "AsyncChallengesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/challenges/challenges.py b/src/cloudflare/resources/challenges/challenges.py index 8087ee09edb..b64b5c4dfbd 100644 --- a/src/cloudflare/resources/challenges/challenges.py +++ b/src/cloudflare/resources/challenges/challenges.py @@ -3,78 +3,78 @@ from __future__ import annotations from .widgets import ( - Widgets, - AsyncWidgets, - WidgetsWithRawResponse, - AsyncWidgetsWithRawResponse, - WidgetsWithStreamingResponse, - AsyncWidgetsWithStreamingResponse, + WidgetsResource, + AsyncWidgetsResource, + WidgetsResourceWithRawResponse, + AsyncWidgetsResourceWithRawResponse, + WidgetsResourceWithStreamingResponse, + AsyncWidgetsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Challenges", "AsyncChallenges"] +__all__ = ["ChallengesResource", "AsyncChallengesResource"] -class Challenges(SyncAPIResource): +class ChallengesResource(SyncAPIResource): @cached_property - def widgets(self) -> Widgets: - return Widgets(self._client) + def widgets(self) -> WidgetsResource: + return WidgetsResource(self._client) @cached_property - def with_raw_response(self) -> ChallengesWithRawResponse: - return ChallengesWithRawResponse(self) + def with_raw_response(self) -> ChallengesResourceWithRawResponse: + return ChallengesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ChallengesWithStreamingResponse: - return ChallengesWithStreamingResponse(self) + def with_streaming_response(self) -> ChallengesResourceWithStreamingResponse: + return ChallengesResourceWithStreamingResponse(self) -class AsyncChallenges(AsyncAPIResource): +class AsyncChallengesResource(AsyncAPIResource): @cached_property - def widgets(self) -> AsyncWidgets: - return AsyncWidgets(self._client) + def widgets(self) -> AsyncWidgetsResource: + return AsyncWidgetsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncChallengesWithRawResponse: - return AsyncChallengesWithRawResponse(self) + def with_raw_response(self) -> AsyncChallengesResourceWithRawResponse: + return AsyncChallengesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncChallengesWithStreamingResponse: - return AsyncChallengesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncChallengesResourceWithStreamingResponse: + return AsyncChallengesResourceWithStreamingResponse(self) -class ChallengesWithRawResponse: - def __init__(self, challenges: Challenges) -> None: +class ChallengesResourceWithRawResponse: + def __init__(self, challenges: ChallengesResource) -> None: self._challenges = challenges @cached_property - def widgets(self) -> WidgetsWithRawResponse: - return WidgetsWithRawResponse(self._challenges.widgets) + def widgets(self) -> WidgetsResourceWithRawResponse: + return WidgetsResourceWithRawResponse(self._challenges.widgets) -class AsyncChallengesWithRawResponse: - def __init__(self, challenges: AsyncChallenges) -> None: +class AsyncChallengesResourceWithRawResponse: + def __init__(self, challenges: AsyncChallengesResource) -> None: self._challenges = challenges @cached_property - def widgets(self) -> AsyncWidgetsWithRawResponse: - return AsyncWidgetsWithRawResponse(self._challenges.widgets) + def widgets(self) -> AsyncWidgetsResourceWithRawResponse: + return AsyncWidgetsResourceWithRawResponse(self._challenges.widgets) -class ChallengesWithStreamingResponse: - def __init__(self, challenges: Challenges) -> None: +class ChallengesResourceWithStreamingResponse: + def __init__(self, challenges: ChallengesResource) -> None: self._challenges = challenges @cached_property - def widgets(self) -> WidgetsWithStreamingResponse: - return WidgetsWithStreamingResponse(self._challenges.widgets) + def widgets(self) -> WidgetsResourceWithStreamingResponse: + return WidgetsResourceWithStreamingResponse(self._challenges.widgets) -class AsyncChallengesWithStreamingResponse: - def __init__(self, challenges: AsyncChallenges) -> None: +class AsyncChallengesResourceWithStreamingResponse: + def __init__(self, challenges: AsyncChallengesResource) -> None: self._challenges = challenges @cached_property - def widgets(self) -> AsyncWidgetsWithStreamingResponse: - return AsyncWidgetsWithStreamingResponse(self._challenges.widgets) + def widgets(self) -> AsyncWidgetsResourceWithStreamingResponse: + return AsyncWidgetsResourceWithStreamingResponse(self._challenges.widgets) diff --git a/src/cloudflare/resources/challenges/widgets.py b/src/cloudflare/resources/challenges/widgets.py index 5c9d1521e5b..89830325d3c 100644 --- a/src/cloudflare/resources/challenges/widgets.py +++ b/src/cloudflare/resources/challenges/widgets.py @@ -27,31 +27,32 @@ make_request_options, ) from ...types.challenges import ( - ChallengesWidget, - ChallengesWidgetList, widget_list_params, widget_create_params, widget_update_params, widget_rotate_secret_params, ) +from ...types.challenges.widget import Widget +from ...types.challenges.widget_domain import WidgetDomain +from ...types.challenges.widget_list_response import WidgetListResponse -__all__ = ["Widgets", "AsyncWidgets"] +__all__ = ["WidgetsResource", "AsyncWidgetsResource"] -class Widgets(SyncAPIResource): +class WidgetsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WidgetsWithRawResponse: - return WidgetsWithRawResponse(self) + def with_raw_response(self) -> WidgetsResourceWithRawResponse: + return WidgetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WidgetsWithStreamingResponse: - return WidgetsWithStreamingResponse(self) + def with_streaming_response(self) -> WidgetsResourceWithStreamingResponse: + return WidgetsResourceWithStreamingResponse(self) def create( self, *, account_id: str, - domains: List[str], + domains: List[WidgetDomain], mode: Literal["non-interactive", "invisible", "managed"], name: str, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, @@ -68,7 +69,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """ Lists challenge widgets. @@ -137,9 +138,9 @@ def create( }, widget_create_params.WidgetCreateParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) def update( @@ -147,7 +148,7 @@ def update( sitekey: str, *, account_id: str, - domains: List[str], + domains: List[WidgetDomain], mode: Literal["non-interactive", "invisible", "managed"], name: str, bot_fight_mode: bool | NotGiven = NOT_GIVEN, @@ -159,7 +160,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """ Update the configuration of a widget. @@ -212,9 +213,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) def list( @@ -231,7 +232,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[ChallengesWidgetList]: + ) -> SyncV4PagePaginationArray[WidgetListResponse]: """ Lists all turnstile widgets of an account. @@ -258,7 +259,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/challenges/widgets", - page=SyncV4PagePaginationArray[ChallengesWidgetList], + page=SyncV4PagePaginationArray[WidgetListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -274,7 +275,7 @@ def list( widget_list_params.WidgetListParams, ), ), - model=ChallengesWidgetList, + model=WidgetListResponse, ) def delete( @@ -288,7 +289,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """ Destroy a Turnstile Widget. @@ -316,9 +317,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) def get( @@ -332,7 +333,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """ Show a single challenge widget configuration. @@ -360,9 +361,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) def rotate_secret( @@ -377,7 +378,7 @@ def rotate_secret( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """Generate a new secret key for this widget. If `invalidate_immediately` is set to @@ -416,26 +417,26 @@ def rotate_secret( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) -class AsyncWidgets(AsyncAPIResource): +class AsyncWidgetsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWidgetsWithRawResponse: - return AsyncWidgetsWithRawResponse(self) + def with_raw_response(self) -> AsyncWidgetsResourceWithRawResponse: + return AsyncWidgetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWidgetsWithStreamingResponse: - return AsyncWidgetsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWidgetsResourceWithStreamingResponse: + return AsyncWidgetsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, - domains: List[str], + domains: List[WidgetDomain], mode: Literal["non-interactive", "invisible", "managed"], name: str, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, @@ -452,7 +453,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """ Lists challenge widgets. @@ -521,9 +522,9 @@ async def create( }, widget_create_params.WidgetCreateParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) async def update( @@ -531,7 +532,7 @@ async def update( sitekey: str, *, account_id: str, - domains: List[str], + domains: List[WidgetDomain], mode: Literal["non-interactive", "invisible", "managed"], name: str, bot_fight_mode: bool | NotGiven = NOT_GIVEN, @@ -543,7 +544,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """ Update the configuration of a widget. @@ -596,9 +597,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) def list( @@ -615,7 +616,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ChallengesWidgetList, AsyncV4PagePaginationArray[ChallengesWidgetList]]: + ) -> AsyncPaginator[WidgetListResponse, AsyncV4PagePaginationArray[WidgetListResponse]]: """ Lists all turnstile widgets of an account. @@ -642,7 +643,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/challenges/widgets", - page=AsyncV4PagePaginationArray[ChallengesWidgetList], + page=AsyncV4PagePaginationArray[WidgetListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -658,7 +659,7 @@ def list( widget_list_params.WidgetListParams, ), ), - model=ChallengesWidgetList, + model=WidgetListResponse, ) async def delete( @@ -672,7 +673,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """ Destroy a Turnstile Widget. @@ -700,9 +701,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) async def get( @@ -716,7 +717,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """ Show a single challenge widget configuration. @@ -744,9 +745,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) async def rotate_secret( @@ -761,7 +762,7 @@ async def rotate_secret( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengesWidget]: + ) -> Optional[Widget]: """Generate a new secret key for this widget. If `invalidate_immediately` is set to @@ -800,14 +801,14 @@ async def rotate_secret( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Widget]]._unwrapper, ), - cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]), + cast_to=cast(Type[Optional[Widget]], ResultWrapper[Widget]), ) -class WidgetsWithRawResponse: - def __init__(self, widgets: Widgets) -> None: +class WidgetsResourceWithRawResponse: + def __init__(self, widgets: WidgetsResource) -> None: self._widgets = widgets self.create = to_raw_response_wrapper( @@ -830,8 +831,8 @@ def __init__(self, widgets: Widgets) -> None: ) -class AsyncWidgetsWithRawResponse: - def __init__(self, widgets: AsyncWidgets) -> None: +class AsyncWidgetsResourceWithRawResponse: + def __init__(self, widgets: AsyncWidgetsResource) -> None: self._widgets = widgets self.create = async_to_raw_response_wrapper( @@ -854,8 +855,8 @@ def __init__(self, widgets: AsyncWidgets) -> None: ) -class WidgetsWithStreamingResponse: - def __init__(self, widgets: Widgets) -> None: +class WidgetsResourceWithStreamingResponse: + def __init__(self, widgets: WidgetsResource) -> None: self._widgets = widgets self.create = to_streamed_response_wrapper( @@ -878,8 +879,8 @@ def __init__(self, widgets: Widgets) -> None: ) -class AsyncWidgetsWithStreamingResponse: - def __init__(self, widgets: AsyncWidgets) -> None: +class AsyncWidgetsResourceWithStreamingResponse: + def __init__(self, widgets: AsyncWidgetsResource) -> None: self._widgets = widgets self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/client_certificates.py b/src/cloudflare/resources/client_certificates.py index bf6f2cbdef4..c9f70aa1ace 100644 --- a/src/cloudflare/resources/client_certificates.py +++ b/src/cloudflare/resources/client_certificates.py @@ -7,7 +7,6 @@ import httpx -from ..types import ClientCertificate, client_certificate_list_params, client_certificate_create_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -27,18 +26,20 @@ AsyncPaginator, make_request_options, ) +from ..types.client_certificates import client_certificate_list_params, client_certificate_create_params +from ..types.client_certificates.client_certificate import ClientCertificate -__all__ = ["ClientCertificates", "AsyncClientCertificates"] +__all__ = ["ClientCertificatesResource", "AsyncClientCertificatesResource"] -class ClientCertificates(SyncAPIResource): +class ClientCertificatesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ClientCertificatesWithRawResponse: - return ClientCertificatesWithRawResponse(self) + def with_raw_response(self) -> ClientCertificatesResourceWithRawResponse: + return ClientCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ClientCertificatesWithStreamingResponse: - return ClientCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> ClientCertificatesResourceWithStreamingResponse: + return ClientCertificatesResourceWithStreamingResponse(self) def create( self, @@ -87,7 +88,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ClientCertificate]._unwrapper, ), cast_to=cast(Type[ClientCertificate], ResultWrapper[ClientCertificate]), ) @@ -200,7 +201,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ClientCertificate]._unwrapper, ), cast_to=cast(Type[ClientCertificate], ResultWrapper[ClientCertificate]), ) @@ -247,7 +248,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ClientCertificate]._unwrapper, ), cast_to=cast(Type[ClientCertificate], ResultWrapper[ClientCertificate]), ) @@ -293,20 +294,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ClientCertificate]._unwrapper, ), cast_to=cast(Type[ClientCertificate], ResultWrapper[ClientCertificate]), ) -class AsyncClientCertificates(AsyncAPIResource): +class AsyncClientCertificatesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncClientCertificatesWithRawResponse: - return AsyncClientCertificatesWithRawResponse(self) + def with_raw_response(self) -> AsyncClientCertificatesResourceWithRawResponse: + return AsyncClientCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncClientCertificatesWithStreamingResponse: - return AsyncClientCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncClientCertificatesResourceWithStreamingResponse: + return AsyncClientCertificatesResourceWithStreamingResponse(self) async def create( self, @@ -355,7 +356,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ClientCertificate]._unwrapper, ), cast_to=cast(Type[ClientCertificate], ResultWrapper[ClientCertificate]), ) @@ -468,7 +469,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ClientCertificate]._unwrapper, ), cast_to=cast(Type[ClientCertificate], ResultWrapper[ClientCertificate]), ) @@ -515,7 +516,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ClientCertificate]._unwrapper, ), cast_to=cast(Type[ClientCertificate], ResultWrapper[ClientCertificate]), ) @@ -561,14 +562,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ClientCertificate]._unwrapper, ), cast_to=cast(Type[ClientCertificate], ResultWrapper[ClientCertificate]), ) -class ClientCertificatesWithRawResponse: - def __init__(self, client_certificates: ClientCertificates) -> None: +class ClientCertificatesResourceWithRawResponse: + def __init__(self, client_certificates: ClientCertificatesResource) -> None: self._client_certificates = client_certificates self.create = to_raw_response_wrapper( @@ -588,8 +589,8 @@ def __init__(self, client_certificates: ClientCertificates) -> None: ) -class AsyncClientCertificatesWithRawResponse: - def __init__(self, client_certificates: AsyncClientCertificates) -> None: +class AsyncClientCertificatesResourceWithRawResponse: + def __init__(self, client_certificates: AsyncClientCertificatesResource) -> None: self._client_certificates = client_certificates self.create = async_to_raw_response_wrapper( @@ -609,8 +610,8 @@ def __init__(self, client_certificates: AsyncClientCertificates) -> None: ) -class ClientCertificatesWithStreamingResponse: - def __init__(self, client_certificates: ClientCertificates) -> None: +class ClientCertificatesResourceWithStreamingResponse: + def __init__(self, client_certificates: ClientCertificatesResource) -> None: self._client_certificates = client_certificates self.create = to_streamed_response_wrapper( @@ -630,8 +631,8 @@ def __init__(self, client_certificates: ClientCertificates) -> None: ) -class AsyncClientCertificatesWithStreamingResponse: - def __init__(self, client_certificates: AsyncClientCertificates) -> None: +class AsyncClientCertificatesResourceWithStreamingResponse: + def __init__(self, client_certificates: AsyncClientCertificatesResource) -> None: self._client_certificates = client_certificates self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/cloudforce_one/__init__.py b/src/cloudflare/resources/cloudforce_one/__init__.py index 9847c389eab..328074fc4b5 100644 --- a/src/cloudflare/resources/cloudforce_one/__init__.py +++ b/src/cloudflare/resources/cloudforce_one/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .requests import ( - Requests, - AsyncRequests, - RequestsWithRawResponse, - AsyncRequestsWithRawResponse, - RequestsWithStreamingResponse, - AsyncRequestsWithStreamingResponse, + RequestsResource, + AsyncRequestsResource, + RequestsResourceWithRawResponse, + AsyncRequestsResourceWithRawResponse, + RequestsResourceWithStreamingResponse, + AsyncRequestsResourceWithStreamingResponse, ) from .cloudforce_one import ( - CloudforceOne, - AsyncCloudforceOne, - CloudforceOneWithRawResponse, - AsyncCloudforceOneWithRawResponse, - CloudforceOneWithStreamingResponse, - AsyncCloudforceOneWithStreamingResponse, + CloudforceOneResource, + AsyncCloudforceOneResource, + CloudforceOneResourceWithRawResponse, + AsyncCloudforceOneResourceWithRawResponse, + CloudforceOneResourceWithStreamingResponse, + AsyncCloudforceOneResourceWithStreamingResponse, ) __all__ = [ - "Requests", - "AsyncRequests", - "RequestsWithRawResponse", - "AsyncRequestsWithRawResponse", - "RequestsWithStreamingResponse", - "AsyncRequestsWithStreamingResponse", - "CloudforceOne", - "AsyncCloudforceOne", - "CloudforceOneWithRawResponse", - "AsyncCloudforceOneWithRawResponse", - "CloudforceOneWithStreamingResponse", - "AsyncCloudforceOneWithStreamingResponse", + "RequestsResource", + "AsyncRequestsResource", + "RequestsResourceWithRawResponse", + "AsyncRequestsResourceWithRawResponse", + "RequestsResourceWithStreamingResponse", + "AsyncRequestsResourceWithStreamingResponse", + "CloudforceOneResource", + "AsyncCloudforceOneResource", + "CloudforceOneResourceWithRawResponse", + "AsyncCloudforceOneResourceWithRawResponse", + "CloudforceOneResourceWithStreamingResponse", + "AsyncCloudforceOneResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/cloudforce_one/cloudforce_one.py b/src/cloudflare/resources/cloudforce_one/cloudforce_one.py index b88b29e0364..9c8929e4f64 100644 --- a/src/cloudflare/resources/cloudforce_one/cloudforce_one.py +++ b/src/cloudflare/resources/cloudforce_one/cloudforce_one.py @@ -3,79 +3,79 @@ from __future__ import annotations from .requests import ( - Requests, - AsyncRequests, - RequestsWithRawResponse, - AsyncRequestsWithRawResponse, - RequestsWithStreamingResponse, - AsyncRequestsWithStreamingResponse, + RequestsResource, + AsyncRequestsResource, + RequestsResourceWithRawResponse, + AsyncRequestsResourceWithRawResponse, + RequestsResourceWithStreamingResponse, + AsyncRequestsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .requests.requests import Requests, AsyncRequests +from .requests.requests import RequestsResource, AsyncRequestsResource -__all__ = ["CloudforceOne", "AsyncCloudforceOne"] +__all__ = ["CloudforceOneResource", "AsyncCloudforceOneResource"] -class CloudforceOne(SyncAPIResource): +class CloudforceOneResource(SyncAPIResource): @cached_property - def requests(self) -> Requests: - return Requests(self._client) + def requests(self) -> RequestsResource: + return RequestsResource(self._client) @cached_property - def with_raw_response(self) -> CloudforceOneWithRawResponse: - return CloudforceOneWithRawResponse(self) + def with_raw_response(self) -> CloudforceOneResourceWithRawResponse: + return CloudforceOneResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CloudforceOneWithStreamingResponse: - return CloudforceOneWithStreamingResponse(self) + def with_streaming_response(self) -> CloudforceOneResourceWithStreamingResponse: + return CloudforceOneResourceWithStreamingResponse(self) -class AsyncCloudforceOne(AsyncAPIResource): +class AsyncCloudforceOneResource(AsyncAPIResource): @cached_property - def requests(self) -> AsyncRequests: - return AsyncRequests(self._client) + def requests(self) -> AsyncRequestsResource: + return AsyncRequestsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCloudforceOneWithRawResponse: - return AsyncCloudforceOneWithRawResponse(self) + def with_raw_response(self) -> AsyncCloudforceOneResourceWithRawResponse: + return AsyncCloudforceOneResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCloudforceOneWithStreamingResponse: - return AsyncCloudforceOneWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCloudforceOneResourceWithStreamingResponse: + return AsyncCloudforceOneResourceWithStreamingResponse(self) -class CloudforceOneWithRawResponse: - def __init__(self, cloudforce_one: CloudforceOne) -> None: +class CloudforceOneResourceWithRawResponse: + def __init__(self, cloudforce_one: CloudforceOneResource) -> None: self._cloudforce_one = cloudforce_one @cached_property - def requests(self) -> RequestsWithRawResponse: - return RequestsWithRawResponse(self._cloudforce_one.requests) + def requests(self) -> RequestsResourceWithRawResponse: + return RequestsResourceWithRawResponse(self._cloudforce_one.requests) -class AsyncCloudforceOneWithRawResponse: - def __init__(self, cloudforce_one: AsyncCloudforceOne) -> None: +class AsyncCloudforceOneResourceWithRawResponse: + def __init__(self, cloudforce_one: AsyncCloudforceOneResource) -> None: self._cloudforce_one = cloudforce_one @cached_property - def requests(self) -> AsyncRequestsWithRawResponse: - return AsyncRequestsWithRawResponse(self._cloudforce_one.requests) + def requests(self) -> AsyncRequestsResourceWithRawResponse: + return AsyncRequestsResourceWithRawResponse(self._cloudforce_one.requests) -class CloudforceOneWithStreamingResponse: - def __init__(self, cloudforce_one: CloudforceOne) -> None: +class CloudforceOneResourceWithStreamingResponse: + def __init__(self, cloudforce_one: CloudforceOneResource) -> None: self._cloudforce_one = cloudforce_one @cached_property - def requests(self) -> RequestsWithStreamingResponse: - return RequestsWithStreamingResponse(self._cloudforce_one.requests) + def requests(self) -> RequestsResourceWithStreamingResponse: + return RequestsResourceWithStreamingResponse(self._cloudforce_one.requests) -class AsyncCloudforceOneWithStreamingResponse: - def __init__(self, cloudforce_one: AsyncCloudforceOne) -> None: +class AsyncCloudforceOneResourceWithStreamingResponse: + def __init__(self, cloudforce_one: AsyncCloudforceOneResource) -> None: self._cloudforce_one = cloudforce_one @cached_property - def requests(self) -> AsyncRequestsWithStreamingResponse: - return AsyncRequestsWithStreamingResponse(self._cloudforce_one.requests) + def requests(self) -> AsyncRequestsResourceWithStreamingResponse: + return AsyncRequestsResourceWithStreamingResponse(self._cloudforce_one.requests) diff --git a/src/cloudflare/resources/cloudforce_one/requests/__init__.py b/src/cloudflare/resources/cloudforce_one/requests/__init__.py index d1d7dd5273e..16dfad6eb56 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/__init__.py +++ b/src/cloudflare/resources/cloudforce_one/requests/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .message import ( - Message, - AsyncMessage, - MessageWithRawResponse, - AsyncMessageWithRawResponse, - MessageWithStreamingResponse, - AsyncMessageWithStreamingResponse, + MessageResource, + AsyncMessageResource, + MessageResourceWithRawResponse, + AsyncMessageResourceWithRawResponse, + MessageResourceWithStreamingResponse, + AsyncMessageResourceWithStreamingResponse, ) from .priority import ( - Priority, - AsyncPriority, - PriorityWithRawResponse, - AsyncPriorityWithRawResponse, - PriorityWithStreamingResponse, - AsyncPriorityWithStreamingResponse, + PriorityResource, + AsyncPriorityResource, + PriorityResourceWithRawResponse, + AsyncPriorityResourceWithRawResponse, + PriorityResourceWithStreamingResponse, + AsyncPriorityResourceWithStreamingResponse, ) from .requests import ( - Requests, - AsyncRequests, - RequestsWithRawResponse, - AsyncRequestsWithRawResponse, - RequestsWithStreamingResponse, - AsyncRequestsWithStreamingResponse, + RequestsResource, + AsyncRequestsResource, + RequestsResourceWithRawResponse, + AsyncRequestsResourceWithRawResponse, + RequestsResourceWithStreamingResponse, + AsyncRequestsResourceWithStreamingResponse, ) __all__ = [ - "Message", - "AsyncMessage", - "MessageWithRawResponse", - "AsyncMessageWithRawResponse", - "MessageWithStreamingResponse", - "AsyncMessageWithStreamingResponse", - "Priority", - "AsyncPriority", - "PriorityWithRawResponse", - "AsyncPriorityWithRawResponse", - "PriorityWithStreamingResponse", - "AsyncPriorityWithStreamingResponse", - "Requests", - "AsyncRequests", - "RequestsWithRawResponse", - "AsyncRequestsWithRawResponse", - "RequestsWithStreamingResponse", - "AsyncRequestsWithStreamingResponse", + "MessageResource", + "AsyncMessageResource", + "MessageResourceWithRawResponse", + "AsyncMessageResourceWithRawResponse", + "MessageResourceWithStreamingResponse", + "AsyncMessageResourceWithStreamingResponse", + "PriorityResource", + "AsyncPriorityResource", + "PriorityResourceWithRawResponse", + "AsyncPriorityResourceWithRawResponse", + "PriorityResourceWithStreamingResponse", + "AsyncPriorityResourceWithStreamingResponse", + "RequestsResource", + "AsyncRequestsResource", + "RequestsResourceWithRawResponse", + "AsyncRequestsResourceWithRawResponse", + "RequestsResourceWithStreamingResponse", + "AsyncRequestsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/cloudforce_one/requests/message.py b/src/cloudflare/resources/cloudforce_one/requests/message.py index 40948ce2089..eaea1a987b6 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/message.py +++ b/src/cloudflare/resources/cloudforce_one/requests/message.py @@ -25,26 +25,22 @@ from ...._base_client import ( make_request_options, ) -from ....types.cloudforce_one.requests import ( - MessageGetResponse, - MessageDeleteResponse, - CloudforceOneRequestMessageItem, - message_get_params, - message_create_params, - message_update_params, -) +from ....types.cloudforce_one.requests import message_get_params, message_create_params, message_update_params +from ....types.cloudforce_one.requests.message import Message +from ....types.cloudforce_one.requests.message_get_response import MessageGetResponse +from ....types.cloudforce_one.requests.message_delete_response import MessageDeleteResponse -__all__ = ["Message", "AsyncMessage"] +__all__ = ["MessageResource", "AsyncMessageResource"] -class Message(SyncAPIResource): +class MessageResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MessageWithRawResponse: - return MessageWithRawResponse(self) + def with_raw_response(self) -> MessageResourceWithRawResponse: + return MessageResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MessageWithStreamingResponse: - return MessageWithStreamingResponse(self) + def with_streaming_response(self) -> MessageResourceWithStreamingResponse: + return MessageResourceWithStreamingResponse(self) def create( self, @@ -58,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestMessageItem: + ) -> Message: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -91,9 +87,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Message]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestMessageItem], ResultWrapper[CloudforceOneRequestMessageItem]), + cast_to=cast(Type[Message], ResultWrapper[Message]), ) def update( @@ -113,7 +109,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestMessageItem: + ) -> Message: """ Update a Request Message @@ -161,9 +157,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Message]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestMessageItem], ResultWrapper[CloudforceOneRequestMessageItem]), + cast_to=cast(Type[Message], ResultWrapper[Message]), ) def delete( @@ -208,7 +204,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MessageDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MessageDeleteResponse] @@ -284,20 +280,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MessageGetResponse]._unwrapper, ), cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]), ) -class AsyncMessage(AsyncAPIResource): +class AsyncMessageResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMessageWithRawResponse: - return AsyncMessageWithRawResponse(self) + def with_raw_response(self) -> AsyncMessageResourceWithRawResponse: + return AsyncMessageResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMessageWithStreamingResponse: - return AsyncMessageWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMessageResourceWithStreamingResponse: + return AsyncMessageResourceWithStreamingResponse(self) async def create( self, @@ -311,7 +307,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestMessageItem: + ) -> Message: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -344,9 +340,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Message]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestMessageItem], ResultWrapper[CloudforceOneRequestMessageItem]), + cast_to=cast(Type[Message], ResultWrapper[Message]), ) async def update( @@ -366,7 +362,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestMessageItem: + ) -> Message: """ Update a Request Message @@ -414,9 +410,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Message]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestMessageItem], ResultWrapper[CloudforceOneRequestMessageItem]), + cast_to=cast(Type[Message], ResultWrapper[Message]), ) async def delete( @@ -461,7 +457,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MessageDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MessageDeleteResponse] @@ -537,14 +533,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MessageGetResponse]._unwrapper, ), cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]), ) -class MessageWithRawResponse: - def __init__(self, message: Message) -> None: +class MessageResourceWithRawResponse: + def __init__(self, message: MessageResource) -> None: self._message = message self.create = to_raw_response_wrapper( @@ -561,8 +557,8 @@ def __init__(self, message: Message) -> None: ) -class AsyncMessageWithRawResponse: - def __init__(self, message: AsyncMessage) -> None: +class AsyncMessageResourceWithRawResponse: + def __init__(self, message: AsyncMessageResource) -> None: self._message = message self.create = async_to_raw_response_wrapper( @@ -579,8 +575,8 @@ def __init__(self, message: AsyncMessage) -> None: ) -class MessageWithStreamingResponse: - def __init__(self, message: Message) -> None: +class MessageResourceWithStreamingResponse: + def __init__(self, message: MessageResource) -> None: self._message = message self.create = to_streamed_response_wrapper( @@ -597,8 +593,8 @@ def __init__(self, message: Message) -> None: ) -class AsyncMessageWithStreamingResponse: - def __init__(self, message: AsyncMessage) -> None: +class AsyncMessageResourceWithStreamingResponse: + def __init__(self, message: AsyncMessageResource) -> None: self._message = message self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/cloudforce_one/requests/priority.py b/src/cloudflare/resources/cloudforce_one/requests/priority.py index e3bc6dc3115..0f1d6795a40 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/priority.py +++ b/src/cloudflare/resources/cloudforce_one/requests/priority.py @@ -24,31 +24,30 @@ from ...._base_client import ( make_request_options, ) -from ....types.cloudforce_one import CloudforceOneQuota, CloudforceOneRequestItem -from ....types.cloudforce_one.requests import ( - PriorityDeleteResponse, - CloudforceOnePriorityItem, - priority_create_params, - priority_update_params, -) +from ....types.cloudforce_one.item import Item +from ....types.cloudforce_one.quota import Quota +from ....types.cloudforce_one.requests import priority_create_params, priority_update_params +from ....types.cloudforce_one.requests.label import Label +from ....types.cloudforce_one.requests.priority import Priority +from ....types.cloudforce_one.requests.priority_delete_response import PriorityDeleteResponse -__all__ = ["Priority", "AsyncPriority"] +__all__ = ["PriorityResource", "AsyncPriorityResource"] -class Priority(SyncAPIResource): +class PriorityResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PriorityWithRawResponse: - return PriorityWithRawResponse(self) + def with_raw_response(self) -> PriorityResourceWithRawResponse: + return PriorityResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PriorityWithStreamingResponse: - return PriorityWithStreamingResponse(self) + def with_streaming_response(self) -> PriorityResourceWithStreamingResponse: + return PriorityResourceWithStreamingResponse(self) def create( self, account_identifier: str, *, - labels: List[str], + labels: List[Label], priority: int, requirement: str, tlp: Literal["clear", "amber", "amber-strict", "green", "red"], @@ -58,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOnePriorityItem: + ) -> Priority: """ Create a New Priority Requirement @@ -99,9 +98,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Priority]._unwrapper, ), - cast_to=cast(Type[CloudforceOnePriorityItem], ResultWrapper[CloudforceOnePriorityItem]), + cast_to=cast(Type[Priority], ResultWrapper[Priority]), ) def update( @@ -109,7 +108,7 @@ def update( priority_identifer: str, *, account_identifier: str, - labels: List[str], + labels: List[Label], priority: int, requirement: str, tlp: Literal["clear", "amber", "amber-strict", "green", "red"], @@ -119,7 +118,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """ Update a Priority Intelligence Requirement @@ -164,9 +163,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def delete( @@ -210,7 +209,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PriorityDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PriorityDeleteResponse] @@ -229,7 +228,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """ Get a Priority Intelligence Requirement @@ -257,9 +256,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def quota( @@ -272,7 +271,7 @@ def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneQuota: + ) -> Quota: """ Get Priority Intelligence Requirement Quota @@ -296,26 +295,26 @@ def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Quota]._unwrapper, ), - cast_to=cast(Type[CloudforceOneQuota], ResultWrapper[CloudforceOneQuota]), + cast_to=cast(Type[Quota], ResultWrapper[Quota]), ) -class AsyncPriority(AsyncAPIResource): +class AsyncPriorityResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPriorityWithRawResponse: - return AsyncPriorityWithRawResponse(self) + def with_raw_response(self) -> AsyncPriorityResourceWithRawResponse: + return AsyncPriorityResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPriorityWithStreamingResponse: - return AsyncPriorityWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPriorityResourceWithStreamingResponse: + return AsyncPriorityResourceWithStreamingResponse(self) async def create( self, account_identifier: str, *, - labels: List[str], + labels: List[Label], priority: int, requirement: str, tlp: Literal["clear", "amber", "amber-strict", "green", "red"], @@ -325,7 +324,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOnePriorityItem: + ) -> Priority: """ Create a New Priority Requirement @@ -366,9 +365,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Priority]._unwrapper, ), - cast_to=cast(Type[CloudforceOnePriorityItem], ResultWrapper[CloudforceOnePriorityItem]), + cast_to=cast(Type[Priority], ResultWrapper[Priority]), ) async def update( @@ -376,7 +375,7 @@ async def update( priority_identifer: str, *, account_identifier: str, - labels: List[str], + labels: List[Label], priority: int, requirement: str, tlp: Literal["clear", "amber", "amber-strict", "green", "red"], @@ -386,7 +385,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """ Update a Priority Intelligence Requirement @@ -431,9 +430,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) async def delete( @@ -477,7 +476,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PriorityDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PriorityDeleteResponse] @@ -496,7 +495,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """ Get a Priority Intelligence Requirement @@ -524,9 +523,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) async def quota( @@ -539,7 +538,7 @@ async def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneQuota: + ) -> Quota: """ Get Priority Intelligence Requirement Quota @@ -563,14 +562,14 @@ async def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Quota]._unwrapper, ), - cast_to=cast(Type[CloudforceOneQuota], ResultWrapper[CloudforceOneQuota]), + cast_to=cast(Type[Quota], ResultWrapper[Quota]), ) -class PriorityWithRawResponse: - def __init__(self, priority: Priority) -> None: +class PriorityResourceWithRawResponse: + def __init__(self, priority: PriorityResource) -> None: self._priority = priority self.create = to_raw_response_wrapper( @@ -590,8 +589,8 @@ def __init__(self, priority: Priority) -> None: ) -class AsyncPriorityWithRawResponse: - def __init__(self, priority: AsyncPriority) -> None: +class AsyncPriorityResourceWithRawResponse: + def __init__(self, priority: AsyncPriorityResource) -> None: self._priority = priority self.create = async_to_raw_response_wrapper( @@ -611,8 +610,8 @@ def __init__(self, priority: AsyncPriority) -> None: ) -class PriorityWithStreamingResponse: - def __init__(self, priority: Priority) -> None: +class PriorityResourceWithStreamingResponse: + def __init__(self, priority: PriorityResource) -> None: self._priority = priority self.create = to_streamed_response_wrapper( @@ -632,8 +631,8 @@ def __init__(self, priority: Priority) -> None: ) -class AsyncPriorityWithStreamingResponse: - def __init__(self, priority: AsyncPriority) -> None: +class AsyncPriorityResourceWithStreamingResponse: + def __init__(self, priority: AsyncPriorityResource) -> None: self._priority = priority self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/cloudforce_one/requests/requests.py b/src/cloudflare/resources/cloudforce_one/requests/requests.py index 59a9bd8c04f..61a739aaa7c 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/requests.py +++ b/src/cloudflare/resources/cloudforce_one/requests/requests.py @@ -9,20 +9,20 @@ import httpx from .message import ( - Message, - AsyncMessage, - MessageWithRawResponse, - AsyncMessageWithRawResponse, - MessageWithStreamingResponse, - AsyncMessageWithStreamingResponse, + MessageResource, + AsyncMessageResource, + MessageResourceWithRawResponse, + AsyncMessageResourceWithRawResponse, + MessageResourceWithStreamingResponse, + AsyncMessageResourceWithStreamingResponse, ) from .priority import ( - Priority, - AsyncPriority, - PriorityWithRawResponse, - AsyncPriorityWithRawResponse, - PriorityWithStreamingResponse, - AsyncPriorityWithStreamingResponse, + PriorityResource, + AsyncPriorityResource, + PriorityResourceWithRawResponse, + AsyncPriorityResourceWithRawResponse, + PriorityResourceWithStreamingResponse, + AsyncPriorityResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -43,37 +43,33 @@ AsyncPaginator, make_request_options, ) -from ....types.cloudforce_one import ( - CloudforceOneQuota, - RequestDeleteResponse, - CloudforceOneRequestItem, - CloudforceOneRequestTypes, - CloudforceOneRequestListItem, - CloudforceOneRequestConstants, - request_list_params, - request_create_params, - request_update_params, -) +from ....types.cloudforce_one import request_list_params, request_create_params, request_update_params +from ....types.cloudforce_one.item import Item +from ....types.cloudforce_one.quota import Quota +from ....types.cloudforce_one.list_item import ListItem +from ....types.cloudforce_one.request_types import RequestTypes +from ....types.cloudforce_one.request_constants import RequestConstants +from ....types.cloudforce_one.request_delete_response import RequestDeleteResponse -__all__ = ["Requests", "AsyncRequests"] +__all__ = ["RequestsResource", "AsyncRequestsResource"] -class Requests(SyncAPIResource): +class RequestsResource(SyncAPIResource): @cached_property - def message(self) -> Message: - return Message(self._client) + def message(self) -> MessageResource: + return MessageResource(self._client) @cached_property - def priority(self) -> Priority: - return Priority(self._client) + def priority(self) -> PriorityResource: + return PriorityResource(self._client) @cached_property - def with_raw_response(self) -> RequestsWithRawResponse: - return RequestsWithRawResponse(self) + def with_raw_response(self) -> RequestsResourceWithRawResponse: + return RequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RequestsWithStreamingResponse: - return RequestsWithStreamingResponse(self) + def with_streaming_response(self) -> RequestsResourceWithStreamingResponse: + return RequestsResourceWithStreamingResponse(self) def create( self, @@ -90,7 +86,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -136,9 +132,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def update( @@ -157,7 +153,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """Updating a request alters the request in the Cloudforce One queue. This API may @@ -208,9 +204,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def list( @@ -233,7 +229,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[CloudforceOneRequestListItem]: + ) -> SyncV4PagePaginationArray[ListItem]: """ List Requests @@ -272,7 +268,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/cloudforce-one/requests", - page=SyncV4PagePaginationArray[CloudforceOneRequestListItem], + page=SyncV4PagePaginationArray[ListItem], body=maybe_transform( { "page": page, @@ -291,7 +287,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=CloudforceOneRequestListItem, + model=ListItem, method="post", ) @@ -336,7 +332,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RequestDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RequestDeleteResponse] @@ -354,7 +350,7 @@ def constants( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestConstants: + ) -> RequestConstants: """ Get Request Priority, Status, and TLP constants @@ -378,9 +374,9 @@ def constants( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RequestConstants]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestConstants], ResultWrapper[CloudforceOneRequestConstants]), + cast_to=cast(Type[RequestConstants], ResultWrapper[RequestConstants]), ) def get( @@ -394,7 +390,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """ Get a Request @@ -422,9 +418,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def quota( @@ -437,7 +433,7 @@ def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneQuota: + ) -> Quota: """ Get Request Quota @@ -461,9 +457,9 @@ def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Quota]._unwrapper, ), - cast_to=cast(Type[CloudforceOneQuota], ResultWrapper[CloudforceOneQuota]), + cast_to=cast(Type[Quota], ResultWrapper[Quota]), ) def types( @@ -476,7 +472,7 @@ def types( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestTypes: + ) -> RequestTypes: """ Get Request Types @@ -500,28 +496,28 @@ def types( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RequestTypes]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestTypes], ResultWrapper[CloudforceOneRequestTypes]), + cast_to=cast(Type[RequestTypes], ResultWrapper[RequestTypes]), ) -class AsyncRequests(AsyncAPIResource): +class AsyncRequestsResource(AsyncAPIResource): @cached_property - def message(self) -> AsyncMessage: - return AsyncMessage(self._client) + def message(self) -> AsyncMessageResource: + return AsyncMessageResource(self._client) @cached_property - def priority(self) -> AsyncPriority: - return AsyncPriority(self._client) + def priority(self) -> AsyncPriorityResource: + return AsyncPriorityResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRequestsWithRawResponse: - return AsyncRequestsWithRawResponse(self) + def with_raw_response(self) -> AsyncRequestsResourceWithRawResponse: + return AsyncRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRequestsWithStreamingResponse: - return AsyncRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRequestsResourceWithStreamingResponse: + return AsyncRequestsResourceWithStreamingResponse(self) async def create( self, @@ -538,7 +534,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -584,9 +580,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) async def update( @@ -605,7 +601,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """Updating a request alters the request in the Cloudforce One queue. This API may @@ -656,9 +652,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def list( @@ -681,7 +677,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[CloudforceOneRequestListItem, AsyncV4PagePaginationArray[CloudforceOneRequestListItem]]: + ) -> AsyncPaginator[ListItem, AsyncV4PagePaginationArray[ListItem]]: """ List Requests @@ -720,7 +716,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/cloudforce-one/requests", - page=AsyncV4PagePaginationArray[CloudforceOneRequestListItem], + page=AsyncV4PagePaginationArray[ListItem], body=maybe_transform( { "page": page, @@ -739,7 +735,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=CloudforceOneRequestListItem, + model=ListItem, method="post", ) @@ -784,7 +780,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RequestDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RequestDeleteResponse] @@ -802,7 +798,7 @@ async def constants( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestConstants: + ) -> RequestConstants: """ Get Request Priority, Status, and TLP constants @@ -826,9 +822,9 @@ async def constants( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RequestConstants]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestConstants], ResultWrapper[CloudforceOneRequestConstants]), + cast_to=cast(Type[RequestConstants], ResultWrapper[RequestConstants]), ) async def get( @@ -842,7 +838,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestItem: + ) -> Item: """ Get a Request @@ -870,9 +866,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestItem], ResultWrapper[CloudforceOneRequestItem]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) async def quota( @@ -885,7 +881,7 @@ async def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneQuota: + ) -> Quota: """ Get Request Quota @@ -909,9 +905,9 @@ async def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Quota]._unwrapper, ), - cast_to=cast(Type[CloudforceOneQuota], ResultWrapper[CloudforceOneQuota]), + cast_to=cast(Type[Quota], ResultWrapper[Quota]), ) async def types( @@ -924,7 +920,7 @@ async def types( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CloudforceOneRequestTypes: + ) -> RequestTypes: """ Get Request Types @@ -948,14 +944,14 @@ async def types( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RequestTypes]._unwrapper, ), - cast_to=cast(Type[CloudforceOneRequestTypes], ResultWrapper[CloudforceOneRequestTypes]), + cast_to=cast(Type[RequestTypes], ResultWrapper[RequestTypes]), ) -class RequestsWithRawResponse: - def __init__(self, requests: Requests) -> None: +class RequestsResourceWithRawResponse: + def __init__(self, requests: RequestsResource) -> None: self._requests = requests self.create = to_raw_response_wrapper( @@ -984,16 +980,16 @@ def __init__(self, requests: Requests) -> None: ) @cached_property - def message(self) -> MessageWithRawResponse: - return MessageWithRawResponse(self._requests.message) + def message(self) -> MessageResourceWithRawResponse: + return MessageResourceWithRawResponse(self._requests.message) @cached_property - def priority(self) -> PriorityWithRawResponse: - return PriorityWithRawResponse(self._requests.priority) + def priority(self) -> PriorityResourceWithRawResponse: + return PriorityResourceWithRawResponse(self._requests.priority) -class AsyncRequestsWithRawResponse: - def __init__(self, requests: AsyncRequests) -> None: +class AsyncRequestsResourceWithRawResponse: + def __init__(self, requests: AsyncRequestsResource) -> None: self._requests = requests self.create = async_to_raw_response_wrapper( @@ -1022,16 +1018,16 @@ def __init__(self, requests: AsyncRequests) -> None: ) @cached_property - def message(self) -> AsyncMessageWithRawResponse: - return AsyncMessageWithRawResponse(self._requests.message) + def message(self) -> AsyncMessageResourceWithRawResponse: + return AsyncMessageResourceWithRawResponse(self._requests.message) @cached_property - def priority(self) -> AsyncPriorityWithRawResponse: - return AsyncPriorityWithRawResponse(self._requests.priority) + def priority(self) -> AsyncPriorityResourceWithRawResponse: + return AsyncPriorityResourceWithRawResponse(self._requests.priority) -class RequestsWithStreamingResponse: - def __init__(self, requests: Requests) -> None: +class RequestsResourceWithStreamingResponse: + def __init__(self, requests: RequestsResource) -> None: self._requests = requests self.create = to_streamed_response_wrapper( @@ -1060,16 +1056,16 @@ def __init__(self, requests: Requests) -> None: ) @cached_property - def message(self) -> MessageWithStreamingResponse: - return MessageWithStreamingResponse(self._requests.message) + def message(self) -> MessageResourceWithStreamingResponse: + return MessageResourceWithStreamingResponse(self._requests.message) @cached_property - def priority(self) -> PriorityWithStreamingResponse: - return PriorityWithStreamingResponse(self._requests.priority) + def priority(self) -> PriorityResourceWithStreamingResponse: + return PriorityResourceWithStreamingResponse(self._requests.priority) -class AsyncRequestsWithStreamingResponse: - def __init__(self, requests: AsyncRequests) -> None: +class AsyncRequestsResourceWithStreamingResponse: + def __init__(self, requests: AsyncRequestsResource) -> None: self._requests = requests self.create = async_to_streamed_response_wrapper( @@ -1098,9 +1094,9 @@ def __init__(self, requests: AsyncRequests) -> None: ) @cached_property - def message(self) -> AsyncMessageWithStreamingResponse: - return AsyncMessageWithStreamingResponse(self._requests.message) + def message(self) -> AsyncMessageResourceWithStreamingResponse: + return AsyncMessageResourceWithStreamingResponse(self._requests.message) @cached_property - def priority(self) -> AsyncPriorityWithStreamingResponse: - return AsyncPriorityWithStreamingResponse(self._requests.priority) + def priority(self) -> AsyncPriorityResourceWithStreamingResponse: + return AsyncPriorityResourceWithStreamingResponse(self._requests.priority) diff --git a/src/cloudflare/resources/custom_certificates/__init__.py b/src/cloudflare/resources/custom_certificates/__init__.py index fadf1447fcc..42a32ed70ca 100644 --- a/src/cloudflare/resources/custom_certificates/__init__.py +++ b/src/cloudflare/resources/custom_certificates/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .prioritize import ( - Prioritize, - AsyncPrioritize, - PrioritizeWithRawResponse, - AsyncPrioritizeWithRawResponse, - PrioritizeWithStreamingResponse, - AsyncPrioritizeWithStreamingResponse, + PrioritizeResource, + AsyncPrioritizeResource, + PrioritizeResourceWithRawResponse, + AsyncPrioritizeResourceWithRawResponse, + PrioritizeResourceWithStreamingResponse, + AsyncPrioritizeResourceWithStreamingResponse, ) from .custom_certificates import ( - CustomCertificates, - AsyncCustomCertificates, - CustomCertificatesWithRawResponse, - AsyncCustomCertificatesWithRawResponse, - CustomCertificatesWithStreamingResponse, - AsyncCustomCertificatesWithStreamingResponse, + CustomCertificatesResource, + AsyncCustomCertificatesResource, + CustomCertificatesResourceWithRawResponse, + AsyncCustomCertificatesResourceWithRawResponse, + CustomCertificatesResourceWithStreamingResponse, + AsyncCustomCertificatesResourceWithStreamingResponse, ) __all__ = [ - "Prioritize", - "AsyncPrioritize", - "PrioritizeWithRawResponse", - "AsyncPrioritizeWithRawResponse", - "PrioritizeWithStreamingResponse", - "AsyncPrioritizeWithStreamingResponse", - "CustomCertificates", - "AsyncCustomCertificates", - "CustomCertificatesWithRawResponse", - "AsyncCustomCertificatesWithRawResponse", - "CustomCertificatesWithStreamingResponse", - "AsyncCustomCertificatesWithStreamingResponse", + "PrioritizeResource", + "AsyncPrioritizeResource", + "PrioritizeResourceWithRawResponse", + "AsyncPrioritizeResourceWithRawResponse", + "PrioritizeResourceWithStreamingResponse", + "AsyncPrioritizeResourceWithStreamingResponse", + "CustomCertificatesResource", + "AsyncCustomCertificatesResource", + "CustomCertificatesResourceWithRawResponse", + "AsyncCustomCertificatesResourceWithRawResponse", + "CustomCertificatesResourceWithStreamingResponse", + "AsyncCustomCertificatesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/custom_certificates/custom_certificates.py b/src/cloudflare/resources/custom_certificates/custom_certificates.py index b6a7d4ab90c..8842c9fe482 100644 --- a/src/cloudflare/resources/custom_certificates/custom_certificates.py +++ b/src/cloudflare/resources/custom_certificates/custom_certificates.py @@ -7,16 +7,6 @@ import httpx -from ...types import ( - CustomCertificate, - CustomCertificateGetResponse, - CustomCertificateEditResponse, - CustomCertificateCreateResponse, - CustomCertificateDeleteResponse, - custom_certificate_edit_params, - custom_certificate_list_params, - custom_certificate_create_params, -) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -24,12 +14,12 @@ ) from ..._compat import cached_property from .prioritize import ( - Prioritize, - AsyncPrioritize, - PrioritizeWithRawResponse, - AsyncPrioritizeWithRawResponse, - PrioritizeWithStreamingResponse, - AsyncPrioritizeWithStreamingResponse, + PrioritizeResource, + AsyncPrioritizeResource, + PrioritizeResourceWithRawResponse, + AsyncPrioritizeResourceWithRawResponse, + PrioritizeResourceWithStreamingResponse, + AsyncPrioritizeResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -44,22 +34,36 @@ AsyncPaginator, make_request_options, ) +from ...types.custom_hostnames import BundleMethod +from ...types.custom_certificates import ( + custom_certificate_edit_params, + custom_certificate_list_params, + custom_certificate_create_params, + custom_certificate_delete_params, +) +from ...types.custom_hostnames.bundle_method import BundleMethod +from ...types.custom_certificates.custom_certificate import CustomCertificate +from ...types.custom_certificates.geo_restrictions_param import GeoRestrictionsParam +from ...types.custom_certificates.custom_certificate_get_response import CustomCertificateGetResponse +from ...types.custom_certificates.custom_certificate_edit_response import CustomCertificateEditResponse +from ...types.custom_certificates.custom_certificate_create_response import CustomCertificateCreateResponse +from ...types.custom_certificates.custom_certificate_delete_response import CustomCertificateDeleteResponse -__all__ = ["CustomCertificates", "AsyncCustomCertificates"] +__all__ = ["CustomCertificatesResource", "AsyncCustomCertificatesResource"] -class CustomCertificates(SyncAPIResource): +class CustomCertificatesResource(SyncAPIResource): @cached_property - def prioritize(self) -> Prioritize: - return Prioritize(self._client) + def prioritize(self) -> PrioritizeResource: + return PrioritizeResource(self._client) @cached_property - def with_raw_response(self) -> CustomCertificatesWithRawResponse: - return CustomCertificatesWithRawResponse(self) + def with_raw_response(self) -> CustomCertificatesResourceWithRawResponse: + return CustomCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CustomCertificatesWithStreamingResponse: - return CustomCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> CustomCertificatesResourceWithStreamingResponse: + return CustomCertificatesResourceWithStreamingResponse(self) def create( self, @@ -67,8 +71,8 @@ def create( zone_id: str, certificate: str, private_key: str, - bundle_method: Literal["ubiquitous", "optimal", "force"] | NotGiven = NOT_GIVEN, - geo_restrictions: custom_certificate_create_params.GeoRestrictions | NotGiven = NOT_GIVEN, + bundle_method: BundleMethod | NotGiven = NOT_GIVEN, + geo_restrictions: GeoRestrictionsParam | NotGiven = NOT_GIVEN, policy: str | NotGiven = NOT_GIVEN, type: Literal["legacy_custom", "sni_custom"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -144,7 +148,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomCertificateCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomCertificateCreateResponse] @@ -159,6 +163,7 @@ def list( match: Literal["any", "all"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + status: Literal["active", "expired", "deleted", "pending", "initializing"] | 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, @@ -181,6 +186,8 @@ def list( per_page: Number of zones per page. + status: Status of the zone's custom SSL. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -204,6 +211,7 @@ def list( "match": match, "page": page, "per_page": per_page, + "status": status, }, custom_certificate_list_params.CustomCertificateListParams, ), @@ -216,6 +224,7 @@ def delete( custom_certificate_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -247,12 +256,13 @@ def delete( ) return self._delete( f"/zones/{zone_id}/custom_certificates/{custom_certificate_id}", + body=maybe_transform(body, custom_certificate_delete_params.CustomCertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomCertificateDeleteResponse]._unwrapper, ), cast_to=cast(Type[CustomCertificateDeleteResponse], ResultWrapper[CustomCertificateDeleteResponse]), ) @@ -262,9 +272,9 @@ def edit( custom_certificate_id: str, *, zone_id: str, - bundle_method: Literal["ubiquitous", "optimal", "force"] | NotGiven = NOT_GIVEN, + bundle_method: BundleMethod | NotGiven = NOT_GIVEN, certificate: str | NotGiven = NOT_GIVEN, - geo_restrictions: custom_certificate_edit_params.GeoRestrictions | NotGiven = NOT_GIVEN, + geo_restrictions: GeoRestrictionsParam | NotGiven = NOT_GIVEN, policy: str | NotGiven = NOT_GIVEN, private_key: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -345,7 +355,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomCertificateEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomCertificateEditResponse] @@ -396,7 +406,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomCertificateGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomCertificateGetResponse] @@ -405,18 +415,18 @@ def get( ) -class AsyncCustomCertificates(AsyncAPIResource): +class AsyncCustomCertificatesResource(AsyncAPIResource): @cached_property - def prioritize(self) -> AsyncPrioritize: - return AsyncPrioritize(self._client) + def prioritize(self) -> AsyncPrioritizeResource: + return AsyncPrioritizeResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCustomCertificatesWithRawResponse: - return AsyncCustomCertificatesWithRawResponse(self) + def with_raw_response(self) -> AsyncCustomCertificatesResourceWithRawResponse: + return AsyncCustomCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCustomCertificatesWithStreamingResponse: - return AsyncCustomCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCustomCertificatesResourceWithStreamingResponse: + return AsyncCustomCertificatesResourceWithStreamingResponse(self) async def create( self, @@ -424,8 +434,8 @@ async def create( zone_id: str, certificate: str, private_key: str, - bundle_method: Literal["ubiquitous", "optimal", "force"] | NotGiven = NOT_GIVEN, - geo_restrictions: custom_certificate_create_params.GeoRestrictions | NotGiven = NOT_GIVEN, + bundle_method: BundleMethod | NotGiven = NOT_GIVEN, + geo_restrictions: GeoRestrictionsParam | NotGiven = NOT_GIVEN, policy: str | NotGiven = NOT_GIVEN, type: Literal["legacy_custom", "sni_custom"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -501,7 +511,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomCertificateCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomCertificateCreateResponse] @@ -516,6 +526,7 @@ def list( match: Literal["any", "all"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + status: Literal["active", "expired", "deleted", "pending", "initializing"] | 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 +549,8 @@ def list( per_page: Number of zones per page. + status: Status of the zone's custom SSL. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -561,6 +574,7 @@ def list( "match": match, "page": page, "per_page": per_page, + "status": status, }, custom_certificate_list_params.CustomCertificateListParams, ), @@ -573,6 +587,7 @@ async def delete( custom_certificate_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -604,12 +619,13 @@ async def delete( ) return await self._delete( f"/zones/{zone_id}/custom_certificates/{custom_certificate_id}", + body=await async_maybe_transform(body, custom_certificate_delete_params.CustomCertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomCertificateDeleteResponse]._unwrapper, ), cast_to=cast(Type[CustomCertificateDeleteResponse], ResultWrapper[CustomCertificateDeleteResponse]), ) @@ -619,9 +635,9 @@ async def edit( custom_certificate_id: str, *, zone_id: str, - bundle_method: Literal["ubiquitous", "optimal", "force"] | NotGiven = NOT_GIVEN, + bundle_method: BundleMethod | NotGiven = NOT_GIVEN, certificate: str | NotGiven = NOT_GIVEN, - geo_restrictions: custom_certificate_edit_params.GeoRestrictions | NotGiven = NOT_GIVEN, + geo_restrictions: GeoRestrictionsParam | NotGiven = NOT_GIVEN, policy: str | NotGiven = NOT_GIVEN, private_key: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -702,7 +718,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomCertificateEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomCertificateEditResponse] @@ -753,7 +769,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomCertificateGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomCertificateGetResponse] @@ -762,8 +778,8 @@ async def get( ) -class CustomCertificatesWithRawResponse: - def __init__(self, custom_certificates: CustomCertificates) -> None: +class CustomCertificatesResourceWithRawResponse: + def __init__(self, custom_certificates: CustomCertificatesResource) -> None: self._custom_certificates = custom_certificates self.create = to_raw_response_wrapper( @@ -783,12 +799,12 @@ def __init__(self, custom_certificates: CustomCertificates) -> None: ) @cached_property - def prioritize(self) -> PrioritizeWithRawResponse: - return PrioritizeWithRawResponse(self._custom_certificates.prioritize) + def prioritize(self) -> PrioritizeResourceWithRawResponse: + return PrioritizeResourceWithRawResponse(self._custom_certificates.prioritize) -class AsyncCustomCertificatesWithRawResponse: - def __init__(self, custom_certificates: AsyncCustomCertificates) -> None: +class AsyncCustomCertificatesResourceWithRawResponse: + def __init__(self, custom_certificates: AsyncCustomCertificatesResource) -> None: self._custom_certificates = custom_certificates self.create = async_to_raw_response_wrapper( @@ -808,12 +824,12 @@ def __init__(self, custom_certificates: AsyncCustomCertificates) -> None: ) @cached_property - def prioritize(self) -> AsyncPrioritizeWithRawResponse: - return AsyncPrioritizeWithRawResponse(self._custom_certificates.prioritize) + def prioritize(self) -> AsyncPrioritizeResourceWithRawResponse: + return AsyncPrioritizeResourceWithRawResponse(self._custom_certificates.prioritize) -class CustomCertificatesWithStreamingResponse: - def __init__(self, custom_certificates: CustomCertificates) -> None: +class CustomCertificatesResourceWithStreamingResponse: + def __init__(self, custom_certificates: CustomCertificatesResource) -> None: self._custom_certificates = custom_certificates self.create = to_streamed_response_wrapper( @@ -833,12 +849,12 @@ def __init__(self, custom_certificates: CustomCertificates) -> None: ) @cached_property - def prioritize(self) -> PrioritizeWithStreamingResponse: - return PrioritizeWithStreamingResponse(self._custom_certificates.prioritize) + def prioritize(self) -> PrioritizeResourceWithStreamingResponse: + return PrioritizeResourceWithStreamingResponse(self._custom_certificates.prioritize) -class AsyncCustomCertificatesWithStreamingResponse: - def __init__(self, custom_certificates: AsyncCustomCertificates) -> None: +class AsyncCustomCertificatesResourceWithStreamingResponse: + def __init__(self, custom_certificates: AsyncCustomCertificatesResource) -> None: self._custom_certificates = custom_certificates self.create = async_to_streamed_response_wrapper( @@ -858,5 +874,5 @@ def __init__(self, custom_certificates: AsyncCustomCertificates) -> None: ) @cached_property - def prioritize(self) -> AsyncPrioritizeWithStreamingResponse: - return AsyncPrioritizeWithStreamingResponse(self._custom_certificates.prioritize) + def prioritize(self) -> AsyncPrioritizeResourceWithStreamingResponse: + return AsyncPrioritizeResourceWithStreamingResponse(self._custom_certificates.prioritize) diff --git a/src/cloudflare/resources/custom_certificates/prioritize.py b/src/cloudflare/resources/custom_certificates/prioritize.py index 50cd22f2e0c..1b4813ec49d 100644 --- a/src/cloudflare/resources/custom_certificates/prioritize.py +++ b/src/cloudflare/resources/custom_certificates/prioritize.py @@ -23,19 +23,20 @@ from ..._base_client import ( make_request_options, ) -from ...types.custom_certificates import PrioritizeUpdateResponse, prioritize_update_params +from ...types.custom_certificates import prioritize_update_params +from ...types.custom_certificates.prioritize_update_response import PrioritizeUpdateResponse -__all__ = ["Prioritize", "AsyncPrioritize"] +__all__ = ["PrioritizeResource", "AsyncPrioritizeResource"] -class Prioritize(SyncAPIResource): +class PrioritizeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PrioritizeWithRawResponse: - return PrioritizeWithRawResponse(self) + def with_raw_response(self) -> PrioritizeResourceWithRawResponse: + return PrioritizeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PrioritizeWithStreamingResponse: - return PrioritizeWithStreamingResponse(self) + def with_streaming_response(self) -> PrioritizeResourceWithStreamingResponse: + return PrioritizeResourceWithStreamingResponse(self) def update( self, @@ -77,20 +78,20 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PrioritizeUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PrioritizeUpdateResponse]], ResultWrapper[PrioritizeUpdateResponse]), ) -class AsyncPrioritize(AsyncAPIResource): +class AsyncPrioritizeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPrioritizeWithRawResponse: - return AsyncPrioritizeWithRawResponse(self) + def with_raw_response(self) -> AsyncPrioritizeResourceWithRawResponse: + return AsyncPrioritizeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPrioritizeWithStreamingResponse: - return AsyncPrioritizeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPrioritizeResourceWithStreamingResponse: + return AsyncPrioritizeResourceWithStreamingResponse(self) async def update( self, @@ -134,14 +135,14 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PrioritizeUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PrioritizeUpdateResponse]], ResultWrapper[PrioritizeUpdateResponse]), ) -class PrioritizeWithRawResponse: - def __init__(self, prioritize: Prioritize) -> None: +class PrioritizeResourceWithRawResponse: + def __init__(self, prioritize: PrioritizeResource) -> None: self._prioritize = prioritize self.update = to_raw_response_wrapper( @@ -149,8 +150,8 @@ def __init__(self, prioritize: Prioritize) -> None: ) -class AsyncPrioritizeWithRawResponse: - def __init__(self, prioritize: AsyncPrioritize) -> None: +class AsyncPrioritizeResourceWithRawResponse: + def __init__(self, prioritize: AsyncPrioritizeResource) -> None: self._prioritize = prioritize self.update = async_to_raw_response_wrapper( @@ -158,8 +159,8 @@ def __init__(self, prioritize: AsyncPrioritize) -> None: ) -class PrioritizeWithStreamingResponse: - def __init__(self, prioritize: Prioritize) -> None: +class PrioritizeResourceWithStreamingResponse: + def __init__(self, prioritize: PrioritizeResource) -> None: self._prioritize = prioritize self.update = to_streamed_response_wrapper( @@ -167,8 +168,8 @@ def __init__(self, prioritize: Prioritize) -> None: ) -class AsyncPrioritizeWithStreamingResponse: - def __init__(self, prioritize: AsyncPrioritize) -> None: +class AsyncPrioritizeResourceWithStreamingResponse: + def __init__(self, prioritize: AsyncPrioritizeResource) -> None: self._prioritize = prioritize self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/custom_hostnames/__init__.py b/src/cloudflare/resources/custom_hostnames/__init__.py index e073a364913..333e8854818 100644 --- a/src/cloudflare/resources/custom_hostnames/__init__.py +++ b/src/cloudflare/resources/custom_hostnames/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .fallback_origin import ( - FallbackOrigin, - AsyncFallbackOrigin, - FallbackOriginWithRawResponse, - AsyncFallbackOriginWithRawResponse, - FallbackOriginWithStreamingResponse, - AsyncFallbackOriginWithStreamingResponse, + FallbackOriginResource, + AsyncFallbackOriginResource, + FallbackOriginResourceWithRawResponse, + AsyncFallbackOriginResourceWithRawResponse, + FallbackOriginResourceWithStreamingResponse, + AsyncFallbackOriginResourceWithStreamingResponse, ) from .custom_hostnames import ( - CustomHostnames, - AsyncCustomHostnames, - CustomHostnamesWithRawResponse, - AsyncCustomHostnamesWithRawResponse, - CustomHostnamesWithStreamingResponse, - AsyncCustomHostnamesWithStreamingResponse, + CustomHostnamesResource, + AsyncCustomHostnamesResource, + CustomHostnamesResourceWithRawResponse, + AsyncCustomHostnamesResourceWithRawResponse, + CustomHostnamesResourceWithStreamingResponse, + AsyncCustomHostnamesResourceWithStreamingResponse, ) __all__ = [ - "FallbackOrigin", - "AsyncFallbackOrigin", - "FallbackOriginWithRawResponse", - "AsyncFallbackOriginWithRawResponse", - "FallbackOriginWithStreamingResponse", - "AsyncFallbackOriginWithStreamingResponse", - "CustomHostnames", - "AsyncCustomHostnames", - "CustomHostnamesWithRawResponse", - "AsyncCustomHostnamesWithRawResponse", - "CustomHostnamesWithStreamingResponse", - "AsyncCustomHostnamesWithStreamingResponse", + "FallbackOriginResource", + "AsyncFallbackOriginResource", + "FallbackOriginResourceWithRawResponse", + "AsyncFallbackOriginResourceWithRawResponse", + "FallbackOriginResourceWithStreamingResponse", + "AsyncFallbackOriginResourceWithStreamingResponse", + "CustomHostnamesResource", + "AsyncCustomHostnamesResource", + "CustomHostnamesResourceWithRawResponse", + "AsyncCustomHostnamesResourceWithRawResponse", + "CustomHostnamesResourceWithStreamingResponse", + "AsyncCustomHostnamesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/custom_hostnames/custom_hostnames.py b/src/cloudflare/resources/custom_hostnames/custom_hostnames.py index 42a3ef0a4da..5473e27d513 100644 --- a/src/cloudflare/resources/custom_hostnames/custom_hostnames.py +++ b/src/cloudflare/resources/custom_hostnames/custom_hostnames.py @@ -7,16 +7,6 @@ import httpx -from ...types import ( - CustomHostnameGetResponse, - CustomHostnameEditResponse, - CustomHostnameListResponse, - CustomHostnameCreateResponse, - CustomHostnameDeleteResponse, - custom_hostname_edit_params, - custom_hostname_list_params, - custom_hostname_create_params, -) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -37,29 +27,40 @@ make_request_options, ) from .fallback_origin import ( - FallbackOrigin, - AsyncFallbackOrigin, - FallbackOriginWithRawResponse, - AsyncFallbackOriginWithRawResponse, - FallbackOriginWithStreamingResponse, - AsyncFallbackOriginWithStreamingResponse, + FallbackOriginResource, + AsyncFallbackOriginResource, + FallbackOriginResourceWithRawResponse, + AsyncFallbackOriginResourceWithRawResponse, + FallbackOriginResourceWithStreamingResponse, + AsyncFallbackOriginResourceWithStreamingResponse, +) +from ...types.custom_hostnames import ( + custom_hostname_edit_params, + custom_hostname_list_params, + custom_hostname_create_params, + custom_hostname_delete_params, ) +from ...types.custom_hostnames.custom_hostname_get_response import CustomHostnameGetResponse +from ...types.custom_hostnames.custom_hostname_edit_response import CustomHostnameEditResponse +from ...types.custom_hostnames.custom_hostname_list_response import CustomHostnameListResponse +from ...types.custom_hostnames.custom_hostname_create_response import CustomHostnameCreateResponse +from ...types.custom_hostnames.custom_hostname_delete_response import CustomHostnameDeleteResponse -__all__ = ["CustomHostnames", "AsyncCustomHostnames"] +__all__ = ["CustomHostnamesResource", "AsyncCustomHostnamesResource"] -class CustomHostnames(SyncAPIResource): +class CustomHostnamesResource(SyncAPIResource): @cached_property - def fallback_origin(self) -> FallbackOrigin: - return FallbackOrigin(self._client) + def fallback_origin(self) -> FallbackOriginResource: + return FallbackOriginResource(self._client) @cached_property - def with_raw_response(self) -> CustomHostnamesWithRawResponse: - return CustomHostnamesWithRawResponse(self) + def with_raw_response(self) -> CustomHostnamesResourceWithRawResponse: + return CustomHostnamesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CustomHostnamesWithStreamingResponse: - return CustomHostnamesWithStreamingResponse(self) + def with_streaming_response(self) -> CustomHostnamesResourceWithStreamingResponse: + return CustomHostnamesResourceWithStreamingResponse(self) def create( self, @@ -118,7 +119,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomHostnameCreateResponse]._unwrapper, ), cast_to=cast(Type[CustomHostnameCreateResponse], ResultWrapper[CustomHostnameCreateResponse]), ) @@ -203,6 +204,7 @@ def delete( custom_hostname_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -232,6 +234,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `custom_hostname_id` but received {custom_hostname_id!r}") return self._delete( f"/zones/{zone_id}/custom_hostnames/{custom_hostname_id}", + body=maybe_transform(body, custom_hostname_delete_params.CustomHostnameDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -307,7 +310,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomHostnameEditResponse]._unwrapper, ), cast_to=cast(Type[CustomHostnameEditResponse], ResultWrapper[CustomHostnameEditResponse]), ) @@ -351,24 +354,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomHostnameGetResponse]._unwrapper, ), cast_to=cast(Type[CustomHostnameGetResponse], ResultWrapper[CustomHostnameGetResponse]), ) -class AsyncCustomHostnames(AsyncAPIResource): +class AsyncCustomHostnamesResource(AsyncAPIResource): @cached_property - def fallback_origin(self) -> AsyncFallbackOrigin: - return AsyncFallbackOrigin(self._client) + def fallback_origin(self) -> AsyncFallbackOriginResource: + return AsyncFallbackOriginResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCustomHostnamesWithRawResponse: - return AsyncCustomHostnamesWithRawResponse(self) + def with_raw_response(self) -> AsyncCustomHostnamesResourceWithRawResponse: + return AsyncCustomHostnamesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCustomHostnamesWithStreamingResponse: - return AsyncCustomHostnamesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCustomHostnamesResourceWithStreamingResponse: + return AsyncCustomHostnamesResourceWithStreamingResponse(self) async def create( self, @@ -427,7 +430,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomHostnameCreateResponse]._unwrapper, ), cast_to=cast(Type[CustomHostnameCreateResponse], ResultWrapper[CustomHostnameCreateResponse]), ) @@ -512,6 +515,7 @@ async def delete( custom_hostname_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -541,6 +545,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `custom_hostname_id` but received {custom_hostname_id!r}") return await self._delete( f"/zones/{zone_id}/custom_hostnames/{custom_hostname_id}", + body=await async_maybe_transform(body, custom_hostname_delete_params.CustomHostnameDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -616,7 +621,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomHostnameEditResponse]._unwrapper, ), cast_to=cast(Type[CustomHostnameEditResponse], ResultWrapper[CustomHostnameEditResponse]), ) @@ -660,14 +665,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomHostnameGetResponse]._unwrapper, ), cast_to=cast(Type[CustomHostnameGetResponse], ResultWrapper[CustomHostnameGetResponse]), ) -class CustomHostnamesWithRawResponse: - def __init__(self, custom_hostnames: CustomHostnames) -> None: +class CustomHostnamesResourceWithRawResponse: + def __init__(self, custom_hostnames: CustomHostnamesResource) -> None: self._custom_hostnames = custom_hostnames self.create = to_raw_response_wrapper( @@ -687,12 +692,12 @@ def __init__(self, custom_hostnames: CustomHostnames) -> None: ) @cached_property - def fallback_origin(self) -> FallbackOriginWithRawResponse: - return FallbackOriginWithRawResponse(self._custom_hostnames.fallback_origin) + def fallback_origin(self) -> FallbackOriginResourceWithRawResponse: + return FallbackOriginResourceWithRawResponse(self._custom_hostnames.fallback_origin) -class AsyncCustomHostnamesWithRawResponse: - def __init__(self, custom_hostnames: AsyncCustomHostnames) -> None: +class AsyncCustomHostnamesResourceWithRawResponse: + def __init__(self, custom_hostnames: AsyncCustomHostnamesResource) -> None: self._custom_hostnames = custom_hostnames self.create = async_to_raw_response_wrapper( @@ -712,12 +717,12 @@ def __init__(self, custom_hostnames: AsyncCustomHostnames) -> None: ) @cached_property - def fallback_origin(self) -> AsyncFallbackOriginWithRawResponse: - return AsyncFallbackOriginWithRawResponse(self._custom_hostnames.fallback_origin) + def fallback_origin(self) -> AsyncFallbackOriginResourceWithRawResponse: + return AsyncFallbackOriginResourceWithRawResponse(self._custom_hostnames.fallback_origin) -class CustomHostnamesWithStreamingResponse: - def __init__(self, custom_hostnames: CustomHostnames) -> None: +class CustomHostnamesResourceWithStreamingResponse: + def __init__(self, custom_hostnames: CustomHostnamesResource) -> None: self._custom_hostnames = custom_hostnames self.create = to_streamed_response_wrapper( @@ -737,12 +742,12 @@ def __init__(self, custom_hostnames: CustomHostnames) -> None: ) @cached_property - def fallback_origin(self) -> FallbackOriginWithStreamingResponse: - return FallbackOriginWithStreamingResponse(self._custom_hostnames.fallback_origin) + def fallback_origin(self) -> FallbackOriginResourceWithStreamingResponse: + return FallbackOriginResourceWithStreamingResponse(self._custom_hostnames.fallback_origin) -class AsyncCustomHostnamesWithStreamingResponse: - def __init__(self, custom_hostnames: AsyncCustomHostnames) -> None: +class AsyncCustomHostnamesResourceWithStreamingResponse: + def __init__(self, custom_hostnames: AsyncCustomHostnamesResource) -> None: self._custom_hostnames = custom_hostnames self.create = async_to_streamed_response_wrapper( @@ -762,5 +767,5 @@ def __init__(self, custom_hostnames: AsyncCustomHostnames) -> None: ) @cached_property - def fallback_origin(self) -> AsyncFallbackOriginWithStreamingResponse: - return AsyncFallbackOriginWithStreamingResponse(self._custom_hostnames.fallback_origin) + def fallback_origin(self) -> AsyncFallbackOriginResourceWithStreamingResponse: + return AsyncFallbackOriginResourceWithStreamingResponse(self._custom_hostnames.fallback_origin) diff --git a/src/cloudflare/resources/custom_hostnames/fallback_origin.py b/src/cloudflare/resources/custom_hostnames/fallback_origin.py index bc2855edef4..4372be317f4 100644 --- a/src/cloudflare/resources/custom_hostnames/fallback_origin.py +++ b/src/cloudflare/resources/custom_hostnames/fallback_origin.py @@ -23,24 +23,22 @@ from ..._base_client import ( make_request_options, ) -from ...types.custom_hostnames import ( - FallbackOriginGetResponse, - FallbackOriginDeleteResponse, - FallbackOriginUpdateResponse, - fallback_origin_update_params, -) +from ...types.custom_hostnames import fallback_origin_delete_params, fallback_origin_update_params +from ...types.custom_hostnames.fallback_origin_get_response import FallbackOriginGetResponse +from ...types.custom_hostnames.fallback_origin_delete_response import FallbackOriginDeleteResponse +from ...types.custom_hostnames.fallback_origin_update_response import FallbackOriginUpdateResponse -__all__ = ["FallbackOrigin", "AsyncFallbackOrigin"] +__all__ = ["FallbackOriginResource", "AsyncFallbackOriginResource"] -class FallbackOrigin(SyncAPIResource): +class FallbackOriginResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FallbackOriginWithRawResponse: - return FallbackOriginWithRawResponse(self) + def with_raw_response(self) -> FallbackOriginResourceWithRawResponse: + return FallbackOriginResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FallbackOriginWithStreamingResponse: - return FallbackOriginWithStreamingResponse(self) + def with_streaming_response(self) -> FallbackOriginResourceWithStreamingResponse: + return FallbackOriginResourceWithStreamingResponse(self) def update( self, @@ -82,7 +80,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FallbackOriginUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[FallbackOriginUpdateResponse] @@ -94,6 +92,7 @@ def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -121,12 +120,13 @@ def delete( FallbackOriginDeleteResponse, self._delete( f"/zones/{zone_id}/custom_hostnames/fallback_origin", + body=maybe_transform(body, fallback_origin_delete_params.FallbackOriginDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FallbackOriginDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[FallbackOriginDeleteResponse] @@ -170,7 +170,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FallbackOriginGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[FallbackOriginGetResponse] @@ -179,14 +179,14 @@ def get( ) -class AsyncFallbackOrigin(AsyncAPIResource): +class AsyncFallbackOriginResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFallbackOriginWithRawResponse: - return AsyncFallbackOriginWithRawResponse(self) + def with_raw_response(self) -> AsyncFallbackOriginResourceWithRawResponse: + return AsyncFallbackOriginResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFallbackOriginWithStreamingResponse: - return AsyncFallbackOriginWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFallbackOriginResourceWithStreamingResponse: + return AsyncFallbackOriginResourceWithStreamingResponse(self) async def update( self, @@ -230,7 +230,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FallbackOriginUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[FallbackOriginUpdateResponse] @@ -242,6 +242,7 @@ async def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -269,12 +270,13 @@ async def delete( FallbackOriginDeleteResponse, await self._delete( f"/zones/{zone_id}/custom_hostnames/fallback_origin", + body=await async_maybe_transform(body, fallback_origin_delete_params.FallbackOriginDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FallbackOriginDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[FallbackOriginDeleteResponse] @@ -318,7 +320,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FallbackOriginGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[FallbackOriginGetResponse] @@ -327,8 +329,8 @@ async def get( ) -class FallbackOriginWithRawResponse: - def __init__(self, fallback_origin: FallbackOrigin) -> None: +class FallbackOriginResourceWithRawResponse: + def __init__(self, fallback_origin: FallbackOriginResource) -> None: self._fallback_origin = fallback_origin self.update = to_raw_response_wrapper( @@ -342,8 +344,8 @@ def __init__(self, fallback_origin: FallbackOrigin) -> None: ) -class AsyncFallbackOriginWithRawResponse: - def __init__(self, fallback_origin: AsyncFallbackOrigin) -> None: +class AsyncFallbackOriginResourceWithRawResponse: + def __init__(self, fallback_origin: AsyncFallbackOriginResource) -> None: self._fallback_origin = fallback_origin self.update = async_to_raw_response_wrapper( @@ -357,8 +359,8 @@ def __init__(self, fallback_origin: AsyncFallbackOrigin) -> None: ) -class FallbackOriginWithStreamingResponse: - def __init__(self, fallback_origin: FallbackOrigin) -> None: +class FallbackOriginResourceWithStreamingResponse: + def __init__(self, fallback_origin: FallbackOriginResource) -> None: self._fallback_origin = fallback_origin self.update = to_streamed_response_wrapper( @@ -372,8 +374,8 @@ def __init__(self, fallback_origin: FallbackOrigin) -> None: ) -class AsyncFallbackOriginWithStreamingResponse: - def __init__(self, fallback_origin: AsyncFallbackOrigin) -> None: +class AsyncFallbackOriginResourceWithStreamingResponse: + def __init__(self, fallback_origin: AsyncFallbackOriginResource) -> None: self._fallback_origin = fallback_origin self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/custom_nameservers.py b/src/cloudflare/resources/custom_nameservers.py index bf8e7e65e67..86daaf57bd3 100644 --- a/src/cloudflare/resources/custom_nameservers.py +++ b/src/cloudflare/resources/custom_nameservers.py @@ -6,14 +6,6 @@ import httpx -from ..types import ( - CustomNameserver, - CustomNameserverGetResponse, - CustomNameserverDeleteResponse, - CustomNameserverVerifyResponse, - CustomNameserverAvailabiltyResponse, - custom_nameserver_create_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -31,18 +23,28 @@ from .._base_client import ( make_request_options, ) +from ..types.custom_nameservers import ( + custom_nameserver_create_params, + custom_nameserver_delete_params, + custom_nameserver_verify_params, +) +from ..types.custom_nameservers.custom_nameserver import CustomNameserver +from ..types.custom_nameservers.custom_nameserver_get_response import CustomNameserverGetResponse +from ..types.custom_nameservers.custom_nameserver_delete_response import CustomNameserverDeleteResponse +from ..types.custom_nameservers.custom_nameserver_verify_response import CustomNameserverVerifyResponse +from ..types.custom_nameservers.custom_nameserver_availabilty_response import CustomNameserverAvailabiltyResponse -__all__ = ["CustomNameservers", "AsyncCustomNameservers"] +__all__ = ["CustomNameserversResource", "AsyncCustomNameserversResource"] -class CustomNameservers(SyncAPIResource): +class CustomNameserversResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CustomNameserversWithRawResponse: - return CustomNameserversWithRawResponse(self) + def with_raw_response(self) -> CustomNameserversResourceWithRawResponse: + return CustomNameserversResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CustomNameserversWithStreamingResponse: - return CustomNameserversWithStreamingResponse(self) + def with_streaming_response(self) -> CustomNameserversResourceWithStreamingResponse: + return CustomNameserversResourceWithStreamingResponse(self) def create( self, @@ -91,7 +93,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomNameserver]._unwrapper, ), cast_to=cast(Type[CustomNameserver], ResultWrapper[CustomNameserver]), ) @@ -101,6 +103,7 @@ def delete( custom_ns_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -132,12 +135,13 @@ def delete( Optional[CustomNameserverDeleteResponse], self._delete( f"/accounts/{account_id}/custom_ns/{custom_ns_id}", + body=maybe_transform(body, custom_nameserver_delete_params.CustomNameserverDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomNameserverDeleteResponse] @@ -179,7 +183,7 @@ def availabilty( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverAvailabiltyResponse]]._unwrapper, ), cast_to=cast( Type[Optional[CustomNameserverAvailabiltyResponse]], ResultWrapper[CustomNameserverAvailabiltyResponse] @@ -220,7 +224,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[CustomNameserverGetResponse]], ResultWrapper[CustomNameserverGetResponse]), ) @@ -229,6 +233,7 @@ def verify( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,25 +259,26 @@ def verify( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( f"/accounts/{account_id}/custom_ns/verify", + body=maybe_transform(body, custom_nameserver_verify_params.CustomNameserverVerifyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverVerifyResponse]]._unwrapper, ), cast_to=cast(Type[Optional[CustomNameserverVerifyResponse]], ResultWrapper[CustomNameserverVerifyResponse]), ) -class AsyncCustomNameservers(AsyncAPIResource): +class AsyncCustomNameserversResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCustomNameserversWithRawResponse: - return AsyncCustomNameserversWithRawResponse(self) + def with_raw_response(self) -> AsyncCustomNameserversResourceWithRawResponse: + return AsyncCustomNameserversResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCustomNameserversWithStreamingResponse: - return AsyncCustomNameserversWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCustomNameserversResourceWithStreamingResponse: + return AsyncCustomNameserversResourceWithStreamingResponse(self) async def create( self, @@ -321,7 +327,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomNameserver]._unwrapper, ), cast_to=cast(Type[CustomNameserver], ResultWrapper[CustomNameserver]), ) @@ -331,6 +337,7 @@ async def delete( custom_ns_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -362,12 +369,13 @@ async def delete( Optional[CustomNameserverDeleteResponse], await self._delete( f"/accounts/{account_id}/custom_ns/{custom_ns_id}", + body=await async_maybe_transform(body, custom_nameserver_delete_params.CustomNameserverDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomNameserverDeleteResponse] @@ -409,7 +417,7 @@ async def availabilty( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverAvailabiltyResponse]]._unwrapper, ), cast_to=cast( Type[Optional[CustomNameserverAvailabiltyResponse]], ResultWrapper[CustomNameserverAvailabiltyResponse] @@ -450,7 +458,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[CustomNameserverGetResponse]], ResultWrapper[CustomNameserverGetResponse]), ) @@ -459,6 +467,7 @@ async def verify( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -484,19 +493,20 @@ async def verify( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( f"/accounts/{account_id}/custom_ns/verify", + body=await async_maybe_transform(body, custom_nameserver_verify_params.CustomNameserverVerifyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverVerifyResponse]]._unwrapper, ), cast_to=cast(Type[Optional[CustomNameserverVerifyResponse]], ResultWrapper[CustomNameserverVerifyResponse]), ) -class CustomNameserversWithRawResponse: - def __init__(self, custom_nameservers: CustomNameservers) -> None: +class CustomNameserversResourceWithRawResponse: + def __init__(self, custom_nameservers: CustomNameserversResource) -> None: self._custom_nameservers = custom_nameservers self.create = to_raw_response_wrapper( @@ -516,8 +526,8 @@ def __init__(self, custom_nameservers: CustomNameservers) -> None: ) -class AsyncCustomNameserversWithRawResponse: - def __init__(self, custom_nameservers: AsyncCustomNameservers) -> None: +class AsyncCustomNameserversResourceWithRawResponse: + def __init__(self, custom_nameservers: AsyncCustomNameserversResource) -> None: self._custom_nameservers = custom_nameservers self.create = async_to_raw_response_wrapper( @@ -537,8 +547,8 @@ def __init__(self, custom_nameservers: AsyncCustomNameservers) -> None: ) -class CustomNameserversWithStreamingResponse: - def __init__(self, custom_nameservers: CustomNameservers) -> None: +class CustomNameserversResourceWithStreamingResponse: + def __init__(self, custom_nameservers: CustomNameserversResource) -> None: self._custom_nameservers = custom_nameservers self.create = to_streamed_response_wrapper( @@ -558,8 +568,8 @@ def __init__(self, custom_nameservers: CustomNameservers) -> None: ) -class AsyncCustomNameserversWithStreamingResponse: - def __init__(self, custom_nameservers: AsyncCustomNameservers) -> None: +class AsyncCustomNameserversResourceWithStreamingResponse: + def __init__(self, custom_nameservers: AsyncCustomNameserversResource) -> None: self._custom_nameservers = custom_nameservers self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/d1/__init__.py b/src/cloudflare/resources/d1/__init__.py index e2fbaa90f75..f23835240d5 100644 --- a/src/cloudflare/resources/d1/__init__.py +++ b/src/cloudflare/resources/d1/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .d1 import ( - D1, - AsyncD1, - D1WithRawResponse, - AsyncD1WithRawResponse, - D1WithStreamingResponse, - AsyncD1WithStreamingResponse, + D1Resource, + AsyncD1Resource, + D1ResourceWithRawResponse, + AsyncD1ResourceWithRawResponse, + D1ResourceWithStreamingResponse, + AsyncD1ResourceWithStreamingResponse, ) from .database import ( - Database, - AsyncDatabase, - DatabaseWithRawResponse, - AsyncDatabaseWithRawResponse, - DatabaseWithStreamingResponse, - AsyncDatabaseWithStreamingResponse, + DatabaseResource, + AsyncDatabaseResource, + DatabaseResourceWithRawResponse, + AsyncDatabaseResourceWithRawResponse, + DatabaseResourceWithStreamingResponse, + AsyncDatabaseResourceWithStreamingResponse, ) __all__ = [ - "Database", - "AsyncDatabase", - "DatabaseWithRawResponse", - "AsyncDatabaseWithRawResponse", - "DatabaseWithStreamingResponse", - "AsyncDatabaseWithStreamingResponse", - "D1", - "AsyncD1", - "D1WithRawResponse", - "AsyncD1WithRawResponse", - "D1WithStreamingResponse", - "AsyncD1WithStreamingResponse", + "DatabaseResource", + "AsyncDatabaseResource", + "DatabaseResourceWithRawResponse", + "AsyncDatabaseResourceWithRawResponse", + "DatabaseResourceWithStreamingResponse", + "AsyncDatabaseResourceWithStreamingResponse", + "D1Resource", + "AsyncD1Resource", + "D1ResourceWithRawResponse", + "AsyncD1ResourceWithRawResponse", + "D1ResourceWithStreamingResponse", + "AsyncD1ResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/d1/d1.py b/src/cloudflare/resources/d1/d1.py index 7c5263013fd..713183e81ab 100644 --- a/src/cloudflare/resources/d1/d1.py +++ b/src/cloudflare/resources/d1/d1.py @@ -3,78 +3,78 @@ from __future__ import annotations from .database import ( - Database, - AsyncDatabase, - DatabaseWithRawResponse, - AsyncDatabaseWithRawResponse, - DatabaseWithStreamingResponse, - AsyncDatabaseWithStreamingResponse, + DatabaseResource, + AsyncDatabaseResource, + DatabaseResourceWithRawResponse, + AsyncDatabaseResourceWithRawResponse, + DatabaseResourceWithStreamingResponse, + AsyncDatabaseResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["D1", "AsyncD1"] +__all__ = ["D1Resource", "AsyncD1Resource"] -class D1(SyncAPIResource): +class D1Resource(SyncAPIResource): @cached_property - def database(self) -> Database: - return Database(self._client) + def database(self) -> DatabaseResource: + return DatabaseResource(self._client) @cached_property - def with_raw_response(self) -> D1WithRawResponse: - return D1WithRawResponse(self) + def with_raw_response(self) -> D1ResourceWithRawResponse: + return D1ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> D1WithStreamingResponse: - return D1WithStreamingResponse(self) + def with_streaming_response(self) -> D1ResourceWithStreamingResponse: + return D1ResourceWithStreamingResponse(self) -class AsyncD1(AsyncAPIResource): +class AsyncD1Resource(AsyncAPIResource): @cached_property - def database(self) -> AsyncDatabase: - return AsyncDatabase(self._client) + def database(self) -> AsyncDatabaseResource: + return AsyncDatabaseResource(self._client) @cached_property - def with_raw_response(self) -> AsyncD1WithRawResponse: - return AsyncD1WithRawResponse(self) + def with_raw_response(self) -> AsyncD1ResourceWithRawResponse: + return AsyncD1ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncD1WithStreamingResponse: - return AsyncD1WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncD1ResourceWithStreamingResponse: + return AsyncD1ResourceWithStreamingResponse(self) -class D1WithRawResponse: - def __init__(self, d1: D1) -> None: +class D1ResourceWithRawResponse: + def __init__(self, d1: D1Resource) -> None: self._d1 = d1 @cached_property - def database(self) -> DatabaseWithRawResponse: - return DatabaseWithRawResponse(self._d1.database) + def database(self) -> DatabaseResourceWithRawResponse: + return DatabaseResourceWithRawResponse(self._d1.database) -class AsyncD1WithRawResponse: - def __init__(self, d1: AsyncD1) -> None: +class AsyncD1ResourceWithRawResponse: + def __init__(self, d1: AsyncD1Resource) -> None: self._d1 = d1 @cached_property - def database(self) -> AsyncDatabaseWithRawResponse: - return AsyncDatabaseWithRawResponse(self._d1.database) + def database(self) -> AsyncDatabaseResourceWithRawResponse: + return AsyncDatabaseResourceWithRawResponse(self._d1.database) -class D1WithStreamingResponse: - def __init__(self, d1: D1) -> None: +class D1ResourceWithStreamingResponse: + def __init__(self, d1: D1Resource) -> None: self._d1 = d1 @cached_property - def database(self) -> DatabaseWithStreamingResponse: - return DatabaseWithStreamingResponse(self._d1.database) + def database(self) -> DatabaseResourceWithStreamingResponse: + return DatabaseResourceWithStreamingResponse(self._d1.database) -class AsyncD1WithStreamingResponse: - def __init__(self, d1: AsyncD1) -> None: +class AsyncD1ResourceWithStreamingResponse: + def __init__(self, d1: AsyncD1Resource) -> None: self._d1 = d1 @cached_property - def database(self) -> AsyncDatabaseWithStreamingResponse: - return AsyncDatabaseWithStreamingResponse(self._d1.database) + def database(self) -> AsyncDatabaseResourceWithStreamingResponse: + return AsyncDatabaseResourceWithStreamingResponse(self._d1.database) diff --git a/src/cloudflare/resources/d1/database.py b/src/cloudflare/resources/d1/database.py index 1e8cfa67955..fbdcdffd1f5 100644 --- a/src/cloudflare/resources/d1/database.py +++ b/src/cloudflare/resources/d1/database.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Optional, cast +from typing import Any, List, Type, cast import httpx @@ -12,15 +12,7 @@ async_maybe_transform, ) from ..._compat import cached_property -from ...types.d1 import ( - D1CreateDatabase, - D1DatabaseDetails, - DatabaseQueryResponse, - DatabaseDeleteResponse, - database_list_params, - database_query_params, - database_create_params, -) +from ...types.d1 import database_list_params, database_query_params, database_create_params from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( to_raw_response_wrapper, @@ -30,22 +22,27 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from ...types.d1.d1 import D1 from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.d1.database_list_response import DatabaseListResponse +from ...types.d1.database_query_response import DatabaseQueryResponse +from ...types.d1.database_create_response import DatabaseCreateResponse +from ...types.d1.database_delete_response import DatabaseDeleteResponse -__all__ = ["Database", "AsyncDatabase"] +__all__ = ["DatabaseResource", "AsyncDatabaseResource"] -class Database(SyncAPIResource): +class DatabaseResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DatabaseWithRawResponse: - return DatabaseWithRawResponse(self) + def with_raw_response(self) -> DatabaseResourceWithRawResponse: + return DatabaseResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DatabaseWithStreamingResponse: - return DatabaseWithStreamingResponse(self) + def with_streaming_response(self) -> DatabaseResourceWithStreamingResponse: + return DatabaseResourceWithStreamingResponse(self) def create( self, @@ -58,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> D1CreateDatabase: + ) -> DatabaseCreateResponse: """ Returns the created D1 database. @@ -83,9 +80,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatabaseCreateResponse]._unwrapper, ), - cast_to=cast(Type[D1CreateDatabase], ResultWrapper[D1CreateDatabase]), + cast_to=cast(Type[DatabaseCreateResponse], ResultWrapper[DatabaseCreateResponse]), ) def list( @@ -101,7 +98,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[D1CreateDatabase]: + ) -> SyncV4PagePaginationArray[DatabaseListResponse]: """ Returns a list of D1 databases. @@ -126,7 +123,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/d1/database", - page=SyncV4PagePaginationArray[D1CreateDatabase], + page=SyncV4PagePaginationArray[DatabaseListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -141,7 +138,7 @@ def list( database_list_params.DatabaseListParams, ), ), - model=D1CreateDatabase, + model=DatabaseListResponse, ) def delete( @@ -155,7 +152,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DatabaseDeleteResponse]: + ) -> DatabaseDeleteResponse: """ Deletes the specified D1 database. @@ -177,7 +174,7 @@ def delete( f"Expected a non-empty value for `database_identifier` but received {database_identifier!r}" ) return cast( - Optional[DatabaseDeleteResponse], + DatabaseDeleteResponse, self._delete( f"/accounts/{account_identifier}/d1/database/{database_identifier}", options=make_request_options( @@ -185,7 +182,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatabaseDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DatabaseDeleteResponse] @@ -204,7 +201,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> D1DatabaseDetails: + ) -> D1: """ Returns the specified D1 database. @@ -232,9 +229,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[D1]._unwrapper, ), - cast_to=cast(Type[D1DatabaseDetails], ResultWrapper[D1DatabaseDetails]), + cast_to=cast(Type[D1], ResultWrapper[D1]), ) def query( @@ -285,20 +282,20 @@ def query( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatabaseQueryResponse]._unwrapper, ), cast_to=cast(Type[DatabaseQueryResponse], ResultWrapper[DatabaseQueryResponse]), ) -class AsyncDatabase(AsyncAPIResource): +class AsyncDatabaseResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDatabaseWithRawResponse: - return AsyncDatabaseWithRawResponse(self) + def with_raw_response(self) -> AsyncDatabaseResourceWithRawResponse: + return AsyncDatabaseResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDatabaseWithStreamingResponse: - return AsyncDatabaseWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDatabaseResourceWithStreamingResponse: + return AsyncDatabaseResourceWithStreamingResponse(self) async def create( self, @@ -311,7 +308,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> D1CreateDatabase: + ) -> DatabaseCreateResponse: """ Returns the created D1 database. @@ -336,9 +333,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatabaseCreateResponse]._unwrapper, ), - cast_to=cast(Type[D1CreateDatabase], ResultWrapper[D1CreateDatabase]), + cast_to=cast(Type[DatabaseCreateResponse], ResultWrapper[DatabaseCreateResponse]), ) def list( @@ -354,7 +351,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[D1CreateDatabase, AsyncV4PagePaginationArray[D1CreateDatabase]]: + ) -> AsyncPaginator[DatabaseListResponse, AsyncV4PagePaginationArray[DatabaseListResponse]]: """ Returns a list of D1 databases. @@ -379,7 +376,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/d1/database", - page=AsyncV4PagePaginationArray[D1CreateDatabase], + page=AsyncV4PagePaginationArray[DatabaseListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -394,7 +391,7 @@ def list( database_list_params.DatabaseListParams, ), ), - model=D1CreateDatabase, + model=DatabaseListResponse, ) async def delete( @@ -408,7 +405,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DatabaseDeleteResponse]: + ) -> DatabaseDeleteResponse: """ Deletes the specified D1 database. @@ -430,7 +427,7 @@ async def delete( f"Expected a non-empty value for `database_identifier` but received {database_identifier!r}" ) return cast( - Optional[DatabaseDeleteResponse], + DatabaseDeleteResponse, await self._delete( f"/accounts/{account_identifier}/d1/database/{database_identifier}", options=make_request_options( @@ -438,7 +435,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatabaseDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DatabaseDeleteResponse] @@ -457,7 +454,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> D1DatabaseDetails: + ) -> D1: """ Returns the specified D1 database. @@ -485,9 +482,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[D1]._unwrapper, ), - cast_to=cast(Type[D1DatabaseDetails], ResultWrapper[D1DatabaseDetails]), + cast_to=cast(Type[D1], ResultWrapper[D1]), ) async def query( @@ -538,14 +535,14 @@ async def query( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatabaseQueryResponse]._unwrapper, ), cast_to=cast(Type[DatabaseQueryResponse], ResultWrapper[DatabaseQueryResponse]), ) -class DatabaseWithRawResponse: - def __init__(self, database: Database) -> None: +class DatabaseResourceWithRawResponse: + def __init__(self, database: DatabaseResource) -> None: self._database = database self.create = to_raw_response_wrapper( @@ -565,8 +562,8 @@ def __init__(self, database: Database) -> None: ) -class AsyncDatabaseWithRawResponse: - def __init__(self, database: AsyncDatabase) -> None: +class AsyncDatabaseResourceWithRawResponse: + def __init__(self, database: AsyncDatabaseResource) -> None: self._database = database self.create = async_to_raw_response_wrapper( @@ -586,8 +583,8 @@ def __init__(self, database: AsyncDatabase) -> None: ) -class DatabaseWithStreamingResponse: - def __init__(self, database: Database) -> None: +class DatabaseResourceWithStreamingResponse: + def __init__(self, database: DatabaseResource) -> None: self._database = database self.create = to_streamed_response_wrapper( @@ -607,8 +604,8 @@ def __init__(self, database: Database) -> None: ) -class AsyncDatabaseWithStreamingResponse: - def __init__(self, database: AsyncDatabase) -> None: +class AsyncDatabaseResourceWithStreamingResponse: + def __init__(self, database: AsyncDatabaseResource) -> None: self._database = database self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/dcv_delegation/__init__.py b/src/cloudflare/resources/dcv_delegation/__init__.py index b9445436f07..774c44e1985 100644 --- a/src/cloudflare/resources/dcv_delegation/__init__.py +++ b/src/cloudflare/resources/dcv_delegation/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .uuid import ( - UUID, - AsyncUUID, - UUIDWithRawResponse, - AsyncUUIDWithRawResponse, - UUIDWithStreamingResponse, - AsyncUUIDWithStreamingResponse, + UUIDResource, + AsyncUUIDResource, + UUIDResourceWithRawResponse, + AsyncUUIDResourceWithRawResponse, + UUIDResourceWithStreamingResponse, + AsyncUUIDResourceWithStreamingResponse, ) from .dcv_delegation import ( - DCVDelegation, - AsyncDCVDelegation, - DCVDelegationWithRawResponse, - AsyncDCVDelegationWithRawResponse, - DCVDelegationWithStreamingResponse, - AsyncDCVDelegationWithStreamingResponse, + DCVDelegationResource, + AsyncDCVDelegationResource, + DCVDelegationResourceWithRawResponse, + AsyncDCVDelegationResourceWithRawResponse, + DCVDelegationResourceWithStreamingResponse, + AsyncDCVDelegationResourceWithStreamingResponse, ) __all__ = [ - "UUID", - "AsyncUUID", - "UUIDWithRawResponse", - "AsyncUUIDWithRawResponse", - "UUIDWithStreamingResponse", - "AsyncUUIDWithStreamingResponse", - "DCVDelegation", - "AsyncDCVDelegation", - "DCVDelegationWithRawResponse", - "AsyncDCVDelegationWithRawResponse", - "DCVDelegationWithStreamingResponse", - "AsyncDCVDelegationWithStreamingResponse", + "UUIDResource", + "AsyncUUIDResource", + "UUIDResourceWithRawResponse", + "AsyncUUIDResourceWithRawResponse", + "UUIDResourceWithStreamingResponse", + "AsyncUUIDResourceWithStreamingResponse", + "DCVDelegationResource", + "AsyncDCVDelegationResource", + "DCVDelegationResourceWithRawResponse", + "AsyncDCVDelegationResourceWithRawResponse", + "DCVDelegationResourceWithStreamingResponse", + "AsyncDCVDelegationResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/dcv_delegation/dcv_delegation.py b/src/cloudflare/resources/dcv_delegation/dcv_delegation.py index c6fcca25e42..d09a30ea18c 100644 --- a/src/cloudflare/resources/dcv_delegation/dcv_delegation.py +++ b/src/cloudflare/resources/dcv_delegation/dcv_delegation.py @@ -3,78 +3,78 @@ from __future__ import annotations from .uuid import ( - UUID, - AsyncUUID, - UUIDWithRawResponse, - AsyncUUIDWithRawResponse, - UUIDWithStreamingResponse, - AsyncUUIDWithStreamingResponse, + UUIDResource, + AsyncUUIDResource, + UUIDResourceWithRawResponse, + AsyncUUIDResourceWithRawResponse, + UUIDResourceWithStreamingResponse, + AsyncUUIDResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["DCVDelegation", "AsyncDCVDelegation"] +__all__ = ["DCVDelegationResource", "AsyncDCVDelegationResource"] -class DCVDelegation(SyncAPIResource): +class DCVDelegationResource(SyncAPIResource): @cached_property - def uuid(self) -> UUID: - return UUID(self._client) + def uuid(self) -> UUIDResource: + return UUIDResource(self._client) @cached_property - def with_raw_response(self) -> DCVDelegationWithRawResponse: - return DCVDelegationWithRawResponse(self) + def with_raw_response(self) -> DCVDelegationResourceWithRawResponse: + return DCVDelegationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DCVDelegationWithStreamingResponse: - return DCVDelegationWithStreamingResponse(self) + def with_streaming_response(self) -> DCVDelegationResourceWithStreamingResponse: + return DCVDelegationResourceWithStreamingResponse(self) -class AsyncDCVDelegation(AsyncAPIResource): +class AsyncDCVDelegationResource(AsyncAPIResource): @cached_property - def uuid(self) -> AsyncUUID: - return AsyncUUID(self._client) + def uuid(self) -> AsyncUUIDResource: + return AsyncUUIDResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDCVDelegationWithRawResponse: - return AsyncDCVDelegationWithRawResponse(self) + def with_raw_response(self) -> AsyncDCVDelegationResourceWithRawResponse: + return AsyncDCVDelegationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDCVDelegationWithStreamingResponse: - return AsyncDCVDelegationWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDCVDelegationResourceWithStreamingResponse: + return AsyncDCVDelegationResourceWithStreamingResponse(self) -class DCVDelegationWithRawResponse: - def __init__(self, dcv_delegation: DCVDelegation) -> None: +class DCVDelegationResourceWithRawResponse: + def __init__(self, dcv_delegation: DCVDelegationResource) -> None: self._dcv_delegation = dcv_delegation @cached_property - def uuid(self) -> UUIDWithRawResponse: - return UUIDWithRawResponse(self._dcv_delegation.uuid) + def uuid(self) -> UUIDResourceWithRawResponse: + return UUIDResourceWithRawResponse(self._dcv_delegation.uuid) -class AsyncDCVDelegationWithRawResponse: - def __init__(self, dcv_delegation: AsyncDCVDelegation) -> None: +class AsyncDCVDelegationResourceWithRawResponse: + def __init__(self, dcv_delegation: AsyncDCVDelegationResource) -> None: self._dcv_delegation = dcv_delegation @cached_property - def uuid(self) -> AsyncUUIDWithRawResponse: - return AsyncUUIDWithRawResponse(self._dcv_delegation.uuid) + def uuid(self) -> AsyncUUIDResourceWithRawResponse: + return AsyncUUIDResourceWithRawResponse(self._dcv_delegation.uuid) -class DCVDelegationWithStreamingResponse: - def __init__(self, dcv_delegation: DCVDelegation) -> None: +class DCVDelegationResourceWithStreamingResponse: + def __init__(self, dcv_delegation: DCVDelegationResource) -> None: self._dcv_delegation = dcv_delegation @cached_property - def uuid(self) -> UUIDWithStreamingResponse: - return UUIDWithStreamingResponse(self._dcv_delegation.uuid) + def uuid(self) -> UUIDResourceWithStreamingResponse: + return UUIDResourceWithStreamingResponse(self._dcv_delegation.uuid) -class AsyncDCVDelegationWithStreamingResponse: - def __init__(self, dcv_delegation: AsyncDCVDelegation) -> None: +class AsyncDCVDelegationResourceWithStreamingResponse: + def __init__(self, dcv_delegation: AsyncDCVDelegationResource) -> None: self._dcv_delegation = dcv_delegation @cached_property - def uuid(self) -> AsyncUUIDWithStreamingResponse: - return AsyncUUIDWithStreamingResponse(self._dcv_delegation.uuid) + def uuid(self) -> AsyncUUIDResourceWithStreamingResponse: + return AsyncUUIDResourceWithStreamingResponse(self._dcv_delegation.uuid) diff --git a/src/cloudflare/resources/dcv_delegation/uuid.py b/src/cloudflare/resources/dcv_delegation/uuid.py index c6460a75e22..eef35e97584 100644 --- a/src/cloudflare/resources/dcv_delegation/uuid.py +++ b/src/cloudflare/resources/dcv_delegation/uuid.py @@ -19,19 +19,19 @@ from ..._base_client import ( make_request_options, ) -from ...types.dcv_delegation import DCVDelegationUUID +from ...types.dcv_delegation.dcv_delegation_uuid import DCVDelegationUUID -__all__ = ["UUID", "AsyncUUID"] +__all__ = ["UUIDResource", "AsyncUUIDResource"] -class UUID(SyncAPIResource): +class UUIDResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> UUIDWithRawResponse: - return UUIDWithRawResponse(self) + def with_raw_response(self) -> UUIDResourceWithRawResponse: + return UUIDResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UUIDWithStreamingResponse: - return UUIDWithStreamingResponse(self) + def with_streaming_response(self) -> UUIDResourceWithStreamingResponse: + return UUIDResourceWithStreamingResponse(self) def get( self, @@ -68,20 +68,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DCVDelegationUUID]._unwrapper, ), cast_to=cast(Type[DCVDelegationUUID], ResultWrapper[DCVDelegationUUID]), ) -class AsyncUUID(AsyncAPIResource): +class AsyncUUIDResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncUUIDWithRawResponse: - return AsyncUUIDWithRawResponse(self) + def with_raw_response(self) -> AsyncUUIDResourceWithRawResponse: + return AsyncUUIDResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUUIDWithStreamingResponse: - return AsyncUUIDWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncUUIDResourceWithStreamingResponse: + return AsyncUUIDResourceWithStreamingResponse(self) async def get( self, @@ -118,14 +118,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DCVDelegationUUID]._unwrapper, ), cast_to=cast(Type[DCVDelegationUUID], ResultWrapper[DCVDelegationUUID]), ) -class UUIDWithRawResponse: - def __init__(self, uuid: UUID) -> None: +class UUIDResourceWithRawResponse: + def __init__(self, uuid: UUIDResource) -> None: self._uuid = uuid self.get = to_raw_response_wrapper( @@ -133,8 +133,8 @@ def __init__(self, uuid: UUID) -> None: ) -class AsyncUUIDWithRawResponse: - def __init__(self, uuid: AsyncUUID) -> None: +class AsyncUUIDResourceWithRawResponse: + def __init__(self, uuid: AsyncUUIDResource) -> None: self._uuid = uuid self.get = async_to_raw_response_wrapper( @@ -142,8 +142,8 @@ def __init__(self, uuid: AsyncUUID) -> None: ) -class UUIDWithStreamingResponse: - def __init__(self, uuid: UUID) -> None: +class UUIDResourceWithStreamingResponse: + def __init__(self, uuid: UUIDResource) -> None: self._uuid = uuid self.get = to_streamed_response_wrapper( @@ -151,8 +151,8 @@ def __init__(self, uuid: UUID) -> None: ) -class AsyncUUIDWithStreamingResponse: - def __init__(self, uuid: AsyncUUID) -> None: +class AsyncUUIDResourceWithStreamingResponse: + def __init__(self, uuid: AsyncUUIDResource) -> None: self._uuid = uuid self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/diagnostics/__init__.py b/src/cloudflare/resources/diagnostics/__init__.py index 1c8043a6a21..4ccc6dce7cb 100644 --- a/src/cloudflare/resources/diagnostics/__init__.py +++ b/src/cloudflare/resources/diagnostics/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .diagnostics import ( - Diagnostics, - AsyncDiagnostics, - DiagnosticsWithRawResponse, - AsyncDiagnosticsWithRawResponse, - DiagnosticsWithStreamingResponse, - AsyncDiagnosticsWithStreamingResponse, + DiagnosticsResource, + AsyncDiagnosticsResource, + DiagnosticsResourceWithRawResponse, + AsyncDiagnosticsResourceWithRawResponse, + DiagnosticsResourceWithStreamingResponse, + AsyncDiagnosticsResourceWithStreamingResponse, ) from .traceroutes import ( - Traceroutes, - AsyncTraceroutes, - TraceroutesWithRawResponse, - AsyncTraceroutesWithRawResponse, - TraceroutesWithStreamingResponse, - AsyncTraceroutesWithStreamingResponse, + TraceroutesResource, + AsyncTraceroutesResource, + TraceroutesResourceWithRawResponse, + AsyncTraceroutesResourceWithRawResponse, + TraceroutesResourceWithStreamingResponse, + AsyncTraceroutesResourceWithStreamingResponse, ) __all__ = [ - "Traceroutes", - "AsyncTraceroutes", - "TraceroutesWithRawResponse", - "AsyncTraceroutesWithRawResponse", - "TraceroutesWithStreamingResponse", - "AsyncTraceroutesWithStreamingResponse", - "Diagnostics", - "AsyncDiagnostics", - "DiagnosticsWithRawResponse", - "AsyncDiagnosticsWithRawResponse", - "DiagnosticsWithStreamingResponse", - "AsyncDiagnosticsWithStreamingResponse", + "TraceroutesResource", + "AsyncTraceroutesResource", + "TraceroutesResourceWithRawResponse", + "AsyncTraceroutesResourceWithRawResponse", + "TraceroutesResourceWithStreamingResponse", + "AsyncTraceroutesResourceWithStreamingResponse", + "DiagnosticsResource", + "AsyncDiagnosticsResource", + "DiagnosticsResourceWithRawResponse", + "AsyncDiagnosticsResourceWithRawResponse", + "DiagnosticsResourceWithStreamingResponse", + "AsyncDiagnosticsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/diagnostics/diagnostics.py b/src/cloudflare/resources/diagnostics/diagnostics.py index de8fa603b0e..629321688d5 100644 --- a/src/cloudflare/resources/diagnostics/diagnostics.py +++ b/src/cloudflare/resources/diagnostics/diagnostics.py @@ -5,76 +5,76 @@ from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from .traceroutes import ( - Traceroutes, - AsyncTraceroutes, - TraceroutesWithRawResponse, - AsyncTraceroutesWithRawResponse, - TraceroutesWithStreamingResponse, - AsyncTraceroutesWithStreamingResponse, + TraceroutesResource, + AsyncTraceroutesResource, + TraceroutesResourceWithRawResponse, + AsyncTraceroutesResourceWithRawResponse, + TraceroutesResourceWithStreamingResponse, + AsyncTraceroutesResourceWithStreamingResponse, ) -__all__ = ["Diagnostics", "AsyncDiagnostics"] +__all__ = ["DiagnosticsResource", "AsyncDiagnosticsResource"] -class Diagnostics(SyncAPIResource): +class DiagnosticsResource(SyncAPIResource): @cached_property - def traceroutes(self) -> Traceroutes: - return Traceroutes(self._client) + def traceroutes(self) -> TraceroutesResource: + return TraceroutesResource(self._client) @cached_property - def with_raw_response(self) -> DiagnosticsWithRawResponse: - return DiagnosticsWithRawResponse(self) + def with_raw_response(self) -> DiagnosticsResourceWithRawResponse: + return DiagnosticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DiagnosticsWithStreamingResponse: - return DiagnosticsWithStreamingResponse(self) + def with_streaming_response(self) -> DiagnosticsResourceWithStreamingResponse: + return DiagnosticsResourceWithStreamingResponse(self) -class AsyncDiagnostics(AsyncAPIResource): +class AsyncDiagnosticsResource(AsyncAPIResource): @cached_property - def traceroutes(self) -> AsyncTraceroutes: - return AsyncTraceroutes(self._client) + def traceroutes(self) -> AsyncTraceroutesResource: + return AsyncTraceroutesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDiagnosticsWithRawResponse: - return AsyncDiagnosticsWithRawResponse(self) + def with_raw_response(self) -> AsyncDiagnosticsResourceWithRawResponse: + return AsyncDiagnosticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDiagnosticsWithStreamingResponse: - return AsyncDiagnosticsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDiagnosticsResourceWithStreamingResponse: + return AsyncDiagnosticsResourceWithStreamingResponse(self) -class DiagnosticsWithRawResponse: - def __init__(self, diagnostics: Diagnostics) -> None: +class DiagnosticsResourceWithRawResponse: + def __init__(self, diagnostics: DiagnosticsResource) -> None: self._diagnostics = diagnostics @cached_property - def traceroutes(self) -> TraceroutesWithRawResponse: - return TraceroutesWithRawResponse(self._diagnostics.traceroutes) + def traceroutes(self) -> TraceroutesResourceWithRawResponse: + return TraceroutesResourceWithRawResponse(self._diagnostics.traceroutes) -class AsyncDiagnosticsWithRawResponse: - def __init__(self, diagnostics: AsyncDiagnostics) -> None: +class AsyncDiagnosticsResourceWithRawResponse: + def __init__(self, diagnostics: AsyncDiagnosticsResource) -> None: self._diagnostics = diagnostics @cached_property - def traceroutes(self) -> AsyncTraceroutesWithRawResponse: - return AsyncTraceroutesWithRawResponse(self._diagnostics.traceroutes) + def traceroutes(self) -> AsyncTraceroutesResourceWithRawResponse: + return AsyncTraceroutesResourceWithRawResponse(self._diagnostics.traceroutes) -class DiagnosticsWithStreamingResponse: - def __init__(self, diagnostics: Diagnostics) -> None: +class DiagnosticsResourceWithStreamingResponse: + def __init__(self, diagnostics: DiagnosticsResource) -> None: self._diagnostics = diagnostics @cached_property - def traceroutes(self) -> TraceroutesWithStreamingResponse: - return TraceroutesWithStreamingResponse(self._diagnostics.traceroutes) + def traceroutes(self) -> TraceroutesResourceWithStreamingResponse: + return TraceroutesResourceWithStreamingResponse(self._diagnostics.traceroutes) -class AsyncDiagnosticsWithStreamingResponse: - def __init__(self, diagnostics: AsyncDiagnostics) -> None: +class AsyncDiagnosticsResourceWithStreamingResponse: + def __init__(self, diagnostics: AsyncDiagnosticsResource) -> None: self._diagnostics = diagnostics @cached_property - def traceroutes(self) -> AsyncTraceroutesWithStreamingResponse: - return AsyncTraceroutesWithStreamingResponse(self._diagnostics.traceroutes) + def traceroutes(self) -> AsyncTraceroutesResourceWithStreamingResponse: + return AsyncTraceroutesResourceWithStreamingResponse(self._diagnostics.traceroutes) diff --git a/src/cloudflare/resources/diagnostics/traceroutes.py b/src/cloudflare/resources/diagnostics/traceroutes.py index 950d1d778c0..78ec1ca7d88 100644 --- a/src/cloudflare/resources/diagnostics/traceroutes.py +++ b/src/cloudflare/resources/diagnostics/traceroutes.py @@ -23,19 +23,20 @@ from ..._base_client import ( make_request_options, ) -from ...types.diagnostics import TracerouteCreateResponse, traceroute_create_params +from ...types.diagnostics import traceroute_create_params +from ...types.diagnostics.traceroute_create_response import TracerouteCreateResponse -__all__ = ["Traceroutes", "AsyncTraceroutes"] +__all__ = ["TraceroutesResource", "AsyncTraceroutesResource"] -class Traceroutes(SyncAPIResource): +class TraceroutesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TraceroutesWithRawResponse: - return TraceroutesWithRawResponse(self) + def with_raw_response(self) -> TraceroutesResourceWithRawResponse: + return TraceroutesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TraceroutesWithStreamingResponse: - return TraceroutesWithStreamingResponse(self) + def with_streaming_response(self) -> TraceroutesResourceWithStreamingResponse: + return TraceroutesResourceWithStreamingResponse(self) def create( self, @@ -85,20 +86,20 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TracerouteCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[TracerouteCreateResponse]], ResultWrapper[TracerouteCreateResponse]), ) -class AsyncTraceroutes(AsyncAPIResource): +class AsyncTraceroutesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTraceroutesWithRawResponse: - return AsyncTraceroutesWithRawResponse(self) + def with_raw_response(self) -> AsyncTraceroutesResourceWithRawResponse: + return AsyncTraceroutesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTraceroutesWithStreamingResponse: - return AsyncTraceroutesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTraceroutesResourceWithStreamingResponse: + return AsyncTraceroutesResourceWithStreamingResponse(self) async def create( self, @@ -148,14 +149,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TracerouteCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[TracerouteCreateResponse]], ResultWrapper[TracerouteCreateResponse]), ) -class TraceroutesWithRawResponse: - def __init__(self, traceroutes: Traceroutes) -> None: +class TraceroutesResourceWithRawResponse: + def __init__(self, traceroutes: TraceroutesResource) -> None: self._traceroutes = traceroutes self.create = to_raw_response_wrapper( @@ -163,8 +164,8 @@ def __init__(self, traceroutes: Traceroutes) -> None: ) -class AsyncTraceroutesWithRawResponse: - def __init__(self, traceroutes: AsyncTraceroutes) -> None: +class AsyncTraceroutesResourceWithRawResponse: + def __init__(self, traceroutes: AsyncTraceroutesResource) -> None: self._traceroutes = traceroutes self.create = async_to_raw_response_wrapper( @@ -172,8 +173,8 @@ def __init__(self, traceroutes: AsyncTraceroutes) -> None: ) -class TraceroutesWithStreamingResponse: - def __init__(self, traceroutes: Traceroutes) -> None: +class TraceroutesResourceWithStreamingResponse: + def __init__(self, traceroutes: TraceroutesResource) -> None: self._traceroutes = traceroutes self.create = to_streamed_response_wrapper( @@ -181,8 +182,8 @@ def __init__(self, traceroutes: Traceroutes) -> None: ) -class AsyncTraceroutesWithStreamingResponse: - def __init__(self, traceroutes: AsyncTraceroutes) -> None: +class AsyncTraceroutesResourceWithStreamingResponse: + def __init__(self, traceroutes: AsyncTraceroutesResource) -> None: self._traceroutes = traceroutes self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/dns/__init__.py b/src/cloudflare/resources/dns/__init__.py index bec5b418f44..6f835256c8d 100644 --- a/src/cloudflare/resources/dns/__init__.py +++ b/src/cloudflare/resources/dns/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .records import ( - Records, - AsyncRecords, - RecordsWithRawResponse, - AsyncRecordsWithRawResponse, - RecordsWithStreamingResponse, - AsyncRecordsWithStreamingResponse, + RecordsResource, + AsyncRecordsResource, + RecordsResourceWithRawResponse, + AsyncRecordsResourceWithRawResponse, + RecordsResourceWithStreamingResponse, + AsyncRecordsResourceWithStreamingResponse, ) from .firewall import ( - Firewall, - AsyncFirewall, - FirewallWithRawResponse, - AsyncFirewallWithRawResponse, - FirewallWithStreamingResponse, - AsyncFirewallWithStreamingResponse, + FirewallResource, + AsyncFirewallResource, + FirewallResourceWithRawResponse, + AsyncFirewallResourceWithRawResponse, + FirewallResourceWithStreamingResponse, + AsyncFirewallResourceWithStreamingResponse, ) from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) __all__ = [ - "Records", - "AsyncRecords", - "RecordsWithRawResponse", - "AsyncRecordsWithRawResponse", - "RecordsWithStreamingResponse", - "AsyncRecordsWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", - "Firewall", - "AsyncFirewall", - "FirewallWithRawResponse", - "AsyncFirewallWithRawResponse", - "FirewallWithStreamingResponse", - "AsyncFirewallWithStreamingResponse", - "DNS", - "AsyncDNS", - "DNSWithRawResponse", - "AsyncDNSWithRawResponse", - "DNSWithStreamingResponse", - "AsyncDNSWithStreamingResponse", + "RecordsResource", + "AsyncRecordsResource", + "RecordsResourceWithRawResponse", + "AsyncRecordsResourceWithRawResponse", + "RecordsResourceWithStreamingResponse", + "AsyncRecordsResourceWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", + "FirewallResource", + "AsyncFirewallResource", + "FirewallResourceWithRawResponse", + "AsyncFirewallResourceWithRawResponse", + "FirewallResourceWithStreamingResponse", + "AsyncFirewallResourceWithStreamingResponse", + "DNSResource", + "AsyncDNSResource", + "DNSResourceWithRawResponse", + "AsyncDNSResourceWithRawResponse", + "DNSResourceWithStreamingResponse", + "AsyncDNSResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/dns/analytics/__init__.py b/src/cloudflare/resources/dns/analytics/__init__.py index 15d7a4bfd5f..05639f9f7bc 100644 --- a/src/cloudflare/resources/dns/analytics/__init__.py +++ b/src/cloudflare/resources/dns/analytics/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, + ReportsResource, + AsyncReportsResource, + ReportsResourceWithRawResponse, + AsyncReportsResourceWithRawResponse, + ReportsResourceWithStreamingResponse, + AsyncReportsResourceWithStreamingResponse, ) from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) __all__ = [ - "Reports", - "AsyncReports", - "ReportsWithRawResponse", - "AsyncReportsWithRawResponse", - "ReportsWithStreamingResponse", - "AsyncReportsWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", + "ReportsResource", + "AsyncReportsResource", + "ReportsResourceWithRawResponse", + "AsyncReportsResourceWithRawResponse", + "ReportsResourceWithStreamingResponse", + "AsyncReportsResourceWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/dns/analytics/analytics.py b/src/cloudflare/resources/dns/analytics/analytics.py index 58181bd95e1..c08523958f5 100644 --- a/src/cloudflare/resources/dns/analytics/analytics.py +++ b/src/cloudflare/resources/dns/analytics/analytics.py @@ -3,79 +3,79 @@ from __future__ import annotations from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, + ReportsResource, + AsyncReportsResource, + ReportsResourceWithRawResponse, + AsyncReportsResourceWithRawResponse, + ReportsResourceWithStreamingResponse, + AsyncReportsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -from .reports.reports import Reports, AsyncReports +from .reports.reports import ReportsResource, AsyncReportsResource -__all__ = ["Analytics", "AsyncAnalytics"] +__all__ = ["AnalyticsResource", "AsyncAnalyticsResource"] -class Analytics(SyncAPIResource): +class AnalyticsResource(SyncAPIResource): @cached_property - def reports(self) -> Reports: - return Reports(self._client) + def reports(self) -> ReportsResource: + return ReportsResource(self._client) @cached_property - def with_raw_response(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self) + def with_raw_response(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self) + def with_streaming_response(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self) -class AsyncAnalytics(AsyncAPIResource): +class AsyncAnalyticsResource(AsyncAPIResource): @cached_property - def reports(self) -> AsyncReports: - return AsyncReports(self._client) + def reports(self) -> AsyncReportsResource: + return AsyncReportsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self) + def with_raw_response(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self) -class AnalyticsWithRawResponse: - def __init__(self, analytics: Analytics) -> None: +class AnalyticsResourceWithRawResponse: + def __init__(self, analytics: AnalyticsResource) -> None: self._analytics = analytics @cached_property - def reports(self) -> ReportsWithRawResponse: - return ReportsWithRawResponse(self._analytics.reports) + def reports(self) -> ReportsResourceWithRawResponse: + return ReportsResourceWithRawResponse(self._analytics.reports) -class AsyncAnalyticsWithRawResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: +class AsyncAnalyticsResourceWithRawResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: self._analytics = analytics @cached_property - def reports(self) -> AsyncReportsWithRawResponse: - return AsyncReportsWithRawResponse(self._analytics.reports) + def reports(self) -> AsyncReportsResourceWithRawResponse: + return AsyncReportsResourceWithRawResponse(self._analytics.reports) -class AnalyticsWithStreamingResponse: - def __init__(self, analytics: Analytics) -> None: +class AnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AnalyticsResource) -> None: self._analytics = analytics @cached_property - def reports(self) -> ReportsWithStreamingResponse: - return ReportsWithStreamingResponse(self._analytics.reports) + def reports(self) -> ReportsResourceWithStreamingResponse: + return ReportsResourceWithStreamingResponse(self._analytics.reports) -class AsyncAnalyticsWithStreamingResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: +class AsyncAnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: self._analytics = analytics @cached_property - def reports(self) -> AsyncReportsWithStreamingResponse: - return AsyncReportsWithStreamingResponse(self._analytics.reports) + def reports(self) -> AsyncReportsResourceWithStreamingResponse: + return AsyncReportsResourceWithStreamingResponse(self._analytics.reports) diff --git a/src/cloudflare/resources/dns/analytics/reports/__init__.py b/src/cloudflare/resources/dns/analytics/reports/__init__.py index 863e89438cf..998dba42f94 100644 --- a/src/cloudflare/resources/dns/analytics/reports/__init__.py +++ b/src/cloudflare/resources/dns/analytics/reports/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, + BytimesResource, + AsyncBytimesResource, + BytimesResourceWithRawResponse, + AsyncBytimesResourceWithRawResponse, + BytimesResourceWithStreamingResponse, + AsyncBytimesResourceWithStreamingResponse, ) from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, + ReportsResource, + AsyncReportsResource, + ReportsResourceWithRawResponse, + AsyncReportsResourceWithRawResponse, + ReportsResourceWithStreamingResponse, + AsyncReportsResourceWithStreamingResponse, ) __all__ = [ - "Bytimes", - "AsyncBytimes", - "BytimesWithRawResponse", - "AsyncBytimesWithRawResponse", - "BytimesWithStreamingResponse", - "AsyncBytimesWithStreamingResponse", - "Reports", - "AsyncReports", - "ReportsWithRawResponse", - "AsyncReportsWithRawResponse", - "ReportsWithStreamingResponse", - "AsyncReportsWithStreamingResponse", + "BytimesResource", + "AsyncBytimesResource", + "BytimesResourceWithRawResponse", + "AsyncBytimesResourceWithRawResponse", + "BytimesResourceWithStreamingResponse", + "AsyncBytimesResourceWithStreamingResponse", + "ReportsResource", + "AsyncReportsResource", + "ReportsResourceWithRawResponse", + "AsyncReportsResourceWithRawResponse", + "ReportsResourceWithStreamingResponse", + "AsyncReportsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/dns/analytics/reports/bytimes.py b/src/cloudflare/resources/dns/analytics/reports/bytimes.py index 7e04d625393..e63915e8090 100644 --- a/src/cloudflare/resources/dns/analytics/reports/bytimes.py +++ b/src/cloudflare/resources/dns/analytics/reports/bytimes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime from typing_extensions import Literal @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.dns.analytics.reports import DNSAnalyticsReportByTime, bytime_get_params +from .....types.dns.analytics.reports import bytime_get_params +from .....types.dns.analytics.reports.by_time import ByTime -__all__ = ["Bytimes", "AsyncBytimes"] +__all__ = ["BytimesResource", "AsyncBytimesResource"] -class Bytimes(SyncAPIResource): +class BytimesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self) + def with_raw_response(self) -> BytimesResourceWithRawResponse: + return BytimesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self) + def with_streaming_response(self) -> BytimesResourceWithStreamingResponse: + return BytimesResourceWithStreamingResponse(self) def get( self, @@ -58,7 +59,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSAnalyticsReportByTime: + ) -> Optional[ByTime]: """ Retrieves a list of aggregate metrics grouped by time interval. @@ -116,20 +117,20 @@ def get( }, bytime_get_params.BytimeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ByTime]]._unwrapper, ), - cast_to=cast(Type[DNSAnalyticsReportByTime], ResultWrapper[DNSAnalyticsReportByTime]), + cast_to=cast(Type[Optional[ByTime]], ResultWrapper[ByTime]), ) -class AsyncBytimes(AsyncAPIResource): +class AsyncBytimesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self) + def with_raw_response(self) -> AsyncBytimesResourceWithRawResponse: + return AsyncBytimesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBytimesResourceWithStreamingResponse: + return AsyncBytimesResourceWithStreamingResponse(self) async def get( self, @@ -150,7 +151,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSAnalyticsReportByTime: + ) -> Optional[ByTime]: """ Retrieves a list of aggregate metrics grouped by time interval. @@ -208,14 +209,14 @@ async def get( }, bytime_get_params.BytimeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ByTime]]._unwrapper, ), - cast_to=cast(Type[DNSAnalyticsReportByTime], ResultWrapper[DNSAnalyticsReportByTime]), + cast_to=cast(Type[Optional[ByTime]], ResultWrapper[ByTime]), ) -class BytimesWithRawResponse: - def __init__(self, bytimes: Bytimes) -> None: +class BytimesResourceWithRawResponse: + def __init__(self, bytimes: BytimesResource) -> None: self._bytimes = bytimes self.get = to_raw_response_wrapper( @@ -223,8 +224,8 @@ def __init__(self, bytimes: Bytimes) -> None: ) -class AsyncBytimesWithRawResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: +class AsyncBytimesResourceWithRawResponse: + def __init__(self, bytimes: AsyncBytimesResource) -> None: self._bytimes = bytimes self.get = async_to_raw_response_wrapper( @@ -232,8 +233,8 @@ def __init__(self, bytimes: AsyncBytimes) -> None: ) -class BytimesWithStreamingResponse: - def __init__(self, bytimes: Bytimes) -> None: +class BytimesResourceWithStreamingResponse: + def __init__(self, bytimes: BytimesResource) -> None: self._bytimes = bytimes self.get = to_streamed_response_wrapper( @@ -241,8 +242,8 @@ def __init__(self, bytimes: Bytimes) -> None: ) -class AsyncBytimesWithStreamingResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: +class AsyncBytimesResourceWithStreamingResponse: + def __init__(self, bytimes: AsyncBytimesResource) -> None: self._bytimes = bytimes self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/dns/analytics/reports/reports.py b/src/cloudflare/resources/dns/analytics/reports/reports.py index 0a1f0f1716c..7649e01724f 100644 --- a/src/cloudflare/resources/dns/analytics/reports/reports.py +++ b/src/cloudflare/resources/dns/analytics/reports/reports.py @@ -2,18 +2,18 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime import httpx from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, + BytimesResource, + AsyncBytimesResource, + BytimesResourceWithRawResponse, + AsyncBytimesResourceWithRawResponse, + BytimesResourceWithStreamingResponse, + AsyncBytimesResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -32,23 +32,24 @@ from ....._base_client import ( make_request_options, ) -from .....types.dns.analytics import DNSAnalyticsReport, report_get_params +from .....types.dns.analytics import report_get_params +from .....types.dns.analytics.report import Report -__all__ = ["Reports", "AsyncReports"] +__all__ = ["ReportsResource", "AsyncReportsResource"] -class Reports(SyncAPIResource): +class ReportsResource(SyncAPIResource): @cached_property - def bytimes(self) -> Bytimes: - return Bytimes(self._client) + def bytimes(self) -> BytimesResource: + return BytimesResource(self._client) @cached_property - def with_raw_response(self) -> ReportsWithRawResponse: - return ReportsWithRawResponse(self) + def with_raw_response(self) -> ReportsResourceWithRawResponse: + return ReportsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ReportsWithStreamingResponse: - return ReportsWithStreamingResponse(self) + def with_streaming_response(self) -> ReportsResourceWithStreamingResponse: + return ReportsResourceWithStreamingResponse(self) def get( self, @@ -67,7 +68,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSAnalyticsReport: + ) -> Optional[Report]: """ Retrieves a list of summarised aggregate metrics over a given time period. @@ -122,24 +123,24 @@ def get( }, report_get_params.ReportGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Report]]._unwrapper, ), - cast_to=cast(Type[DNSAnalyticsReport], ResultWrapper[DNSAnalyticsReport]), + cast_to=cast(Type[Optional[Report]], ResultWrapper[Report]), ) -class AsyncReports(AsyncAPIResource): +class AsyncReportsResource(AsyncAPIResource): @cached_property - def bytimes(self) -> AsyncBytimes: - return AsyncBytimes(self._client) + def bytimes(self) -> AsyncBytimesResource: + return AsyncBytimesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncReportsWithRawResponse: - return AsyncReportsWithRawResponse(self) + def with_raw_response(self) -> AsyncReportsResourceWithRawResponse: + return AsyncReportsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncReportsWithStreamingResponse: - return AsyncReportsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncReportsResourceWithStreamingResponse: + return AsyncReportsResourceWithStreamingResponse(self) async def get( self, @@ -158,7 +159,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSAnalyticsReport: + ) -> Optional[Report]: """ Retrieves a list of summarised aggregate metrics over a given time period. @@ -213,14 +214,14 @@ async def get( }, report_get_params.ReportGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Report]]._unwrapper, ), - cast_to=cast(Type[DNSAnalyticsReport], ResultWrapper[DNSAnalyticsReport]), + cast_to=cast(Type[Optional[Report]], ResultWrapper[Report]), ) -class ReportsWithRawResponse: - def __init__(self, reports: Reports) -> None: +class ReportsResourceWithRawResponse: + def __init__(self, reports: ReportsResource) -> None: self._reports = reports self.get = to_raw_response_wrapper( @@ -228,12 +229,12 @@ def __init__(self, reports: Reports) -> None: ) @cached_property - def bytimes(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self._reports.bytimes) + def bytimes(self) -> BytimesResourceWithRawResponse: + return BytimesResourceWithRawResponse(self._reports.bytimes) -class AsyncReportsWithRawResponse: - def __init__(self, reports: AsyncReports) -> None: +class AsyncReportsResourceWithRawResponse: + def __init__(self, reports: AsyncReportsResource) -> None: self._reports = reports self.get = async_to_raw_response_wrapper( @@ -241,12 +242,12 @@ def __init__(self, reports: AsyncReports) -> None: ) @cached_property - def bytimes(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self._reports.bytimes) + def bytimes(self) -> AsyncBytimesResourceWithRawResponse: + return AsyncBytimesResourceWithRawResponse(self._reports.bytimes) -class ReportsWithStreamingResponse: - def __init__(self, reports: Reports) -> None: +class ReportsResourceWithStreamingResponse: + def __init__(self, reports: ReportsResource) -> None: self._reports = reports self.get = to_streamed_response_wrapper( @@ -254,12 +255,12 @@ def __init__(self, reports: Reports) -> None: ) @cached_property - def bytimes(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self._reports.bytimes) + def bytimes(self) -> BytimesResourceWithStreamingResponse: + return BytimesResourceWithStreamingResponse(self._reports.bytimes) -class AsyncReportsWithStreamingResponse: - def __init__(self, reports: AsyncReports) -> None: +class AsyncReportsResourceWithStreamingResponse: + def __init__(self, reports: AsyncReportsResource) -> None: self._reports = reports self.get = async_to_streamed_response_wrapper( @@ -267,5 +268,5 @@ def __init__(self, reports: AsyncReports) -> None: ) @cached_property - def bytimes(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self._reports.bytimes) + def bytimes(self) -> AsyncBytimesResourceWithStreamingResponse: + return AsyncBytimesResourceWithStreamingResponse(self._reports.bytimes) diff --git a/src/cloudflare/resources/dns/dns.py b/src/cloudflare/resources/dns/dns.py index 9107057d3d0..2f71f123a84 100644 --- a/src/cloudflare/resources/dns/dns.py +++ b/src/cloudflare/resources/dns/dns.py @@ -3,144 +3,144 @@ from __future__ import annotations from .records import ( - Records, - AsyncRecords, - RecordsWithRawResponse, - AsyncRecordsWithRawResponse, - RecordsWithStreamingResponse, - AsyncRecordsWithStreamingResponse, + RecordsResource, + AsyncRecordsResource, + RecordsResourceWithRawResponse, + AsyncRecordsResourceWithRawResponse, + RecordsResourceWithStreamingResponse, + AsyncRecordsResourceWithStreamingResponse, ) from .firewall import ( - Firewall, - AsyncFirewall, - FirewallWithRawResponse, - AsyncFirewallWithRawResponse, - FirewallWithStreamingResponse, - AsyncFirewallWithStreamingResponse, + FirewallResource, + AsyncFirewallResource, + FirewallResourceWithRawResponse, + AsyncFirewallResourceWithRawResponse, + FirewallResourceWithStreamingResponse, + AsyncFirewallResourceWithStreamingResponse, ) from ..._compat import cached_property from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .firewall.firewall import Firewall, AsyncFirewall -from .analytics.analytics import Analytics, AsyncAnalytics +from .firewall.firewall import FirewallResource, AsyncFirewallResource +from .analytics.analytics import AnalyticsResource, AsyncAnalyticsResource -__all__ = ["DNS", "AsyncDNS"] +__all__ = ["DNSResource", "AsyncDNSResource"] -class DNS(SyncAPIResource): +class DNSResource(SyncAPIResource): @cached_property - def records(self) -> Records: - return Records(self._client) + def records(self) -> RecordsResource: + return RecordsResource(self._client) @cached_property - def analytics(self) -> Analytics: - return Analytics(self._client) + def analytics(self) -> AnalyticsResource: + return AnalyticsResource(self._client) @cached_property - def firewall(self) -> Firewall: - return Firewall(self._client) + def firewall(self) -> FirewallResource: + return FirewallResource(self._client) @cached_property - def with_raw_response(self) -> DNSWithRawResponse: - return DNSWithRawResponse(self) + def with_raw_response(self) -> DNSResourceWithRawResponse: + return DNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DNSWithStreamingResponse: - return DNSWithStreamingResponse(self) + def with_streaming_response(self) -> DNSResourceWithStreamingResponse: + return DNSResourceWithStreamingResponse(self) -class AsyncDNS(AsyncAPIResource): +class AsyncDNSResource(AsyncAPIResource): @cached_property - def records(self) -> AsyncRecords: - return AsyncRecords(self._client) + def records(self) -> AsyncRecordsResource: + return AsyncRecordsResource(self._client) @cached_property - def analytics(self) -> AsyncAnalytics: - return AsyncAnalytics(self._client) + def analytics(self) -> AsyncAnalyticsResource: + return AsyncAnalyticsResource(self._client) @cached_property - def firewall(self) -> AsyncFirewall: - return AsyncFirewall(self._client) + def firewall(self) -> AsyncFirewallResource: + return AsyncFirewallResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDNSWithRawResponse: - return AsyncDNSWithRawResponse(self) + def with_raw_response(self) -> AsyncDNSResourceWithRawResponse: + return AsyncDNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDNSWithStreamingResponse: - return AsyncDNSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDNSResourceWithStreamingResponse: + return AsyncDNSResourceWithStreamingResponse(self) -class DNSWithRawResponse: - def __init__(self, dns: DNS) -> None: +class DNSResourceWithRawResponse: + def __init__(self, dns: DNSResource) -> None: self._dns = dns @cached_property - def records(self) -> RecordsWithRawResponse: - return RecordsWithRawResponse(self._dns.records) + def records(self) -> RecordsResourceWithRawResponse: + return RecordsResourceWithRawResponse(self._dns.records) @cached_property - def analytics(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self._dns.analytics) + def analytics(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self._dns.analytics) @cached_property - def firewall(self) -> FirewallWithRawResponse: - return FirewallWithRawResponse(self._dns.firewall) + def firewall(self) -> FirewallResourceWithRawResponse: + return FirewallResourceWithRawResponse(self._dns.firewall) -class AsyncDNSWithRawResponse: - def __init__(self, dns: AsyncDNS) -> None: +class AsyncDNSResourceWithRawResponse: + def __init__(self, dns: AsyncDNSResource) -> None: self._dns = dns @cached_property - def records(self) -> AsyncRecordsWithRawResponse: - return AsyncRecordsWithRawResponse(self._dns.records) + def records(self) -> AsyncRecordsResourceWithRawResponse: + return AsyncRecordsResourceWithRawResponse(self._dns.records) @cached_property - def analytics(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self._dns.analytics) + def analytics(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self._dns.analytics) @cached_property - def firewall(self) -> AsyncFirewallWithRawResponse: - return AsyncFirewallWithRawResponse(self._dns.firewall) + def firewall(self) -> AsyncFirewallResourceWithRawResponse: + return AsyncFirewallResourceWithRawResponse(self._dns.firewall) -class DNSWithStreamingResponse: - def __init__(self, dns: DNS) -> None: +class DNSResourceWithStreamingResponse: + def __init__(self, dns: DNSResource) -> None: self._dns = dns @cached_property - def records(self) -> RecordsWithStreamingResponse: - return RecordsWithStreamingResponse(self._dns.records) + def records(self) -> RecordsResourceWithStreamingResponse: + return RecordsResourceWithStreamingResponse(self._dns.records) @cached_property - def analytics(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self._dns.analytics) + def analytics(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self._dns.analytics) @cached_property - def firewall(self) -> FirewallWithStreamingResponse: - return FirewallWithStreamingResponse(self._dns.firewall) + def firewall(self) -> FirewallResourceWithStreamingResponse: + return FirewallResourceWithStreamingResponse(self._dns.firewall) -class AsyncDNSWithStreamingResponse: - def __init__(self, dns: AsyncDNS) -> None: +class AsyncDNSResourceWithStreamingResponse: + def __init__(self, dns: AsyncDNSResource) -> None: self._dns = dns @cached_property - def records(self) -> AsyncRecordsWithStreamingResponse: - return AsyncRecordsWithStreamingResponse(self._dns.records) + def records(self) -> AsyncRecordsResourceWithStreamingResponse: + return AsyncRecordsResourceWithStreamingResponse(self._dns.records) @cached_property - def analytics(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self._dns.analytics) + def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self._dns.analytics) @cached_property - def firewall(self) -> AsyncFirewallWithStreamingResponse: - return AsyncFirewallWithStreamingResponse(self._dns.firewall) + def firewall(self) -> AsyncFirewallResourceWithStreamingResponse: + return AsyncFirewallResourceWithStreamingResponse(self._dns.firewall) diff --git a/src/cloudflare/resources/dns/firewall/__init__.py b/src/cloudflare/resources/dns/firewall/__init__.py index f2d282ba943..0d9d0b6aae2 100644 --- a/src/cloudflare/resources/dns/firewall/__init__.py +++ b/src/cloudflare/resources/dns/firewall/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .firewall import ( - Firewall, - AsyncFirewall, - FirewallWithRawResponse, - AsyncFirewallWithRawResponse, - FirewallWithStreamingResponse, - AsyncFirewallWithStreamingResponse, + FirewallResource, + AsyncFirewallResource, + FirewallResourceWithRawResponse, + AsyncFirewallResourceWithRawResponse, + FirewallResourceWithStreamingResponse, + AsyncFirewallResourceWithStreamingResponse, ) from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) __all__ = [ - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", - "Firewall", - "AsyncFirewall", - "FirewallWithRawResponse", - "AsyncFirewallWithRawResponse", - "FirewallWithStreamingResponse", - "AsyncFirewallWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", + "FirewallResource", + "AsyncFirewallResource", + "FirewallResourceWithRawResponse", + "AsyncFirewallResourceWithRawResponse", + "FirewallResourceWithStreamingResponse", + "AsyncFirewallResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/dns/firewall/analytics/__init__.py b/src/cloudflare/resources/dns/firewall/analytics/__init__.py index 15d7a4bfd5f..05639f9f7bc 100644 --- a/src/cloudflare/resources/dns/firewall/analytics/__init__.py +++ b/src/cloudflare/resources/dns/firewall/analytics/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, + ReportsResource, + AsyncReportsResource, + ReportsResourceWithRawResponse, + AsyncReportsResourceWithRawResponse, + ReportsResourceWithStreamingResponse, + AsyncReportsResourceWithStreamingResponse, ) from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) __all__ = [ - "Reports", - "AsyncReports", - "ReportsWithRawResponse", - "AsyncReportsWithRawResponse", - "ReportsWithStreamingResponse", - "AsyncReportsWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", + "ReportsResource", + "AsyncReportsResource", + "ReportsResourceWithRawResponse", + "AsyncReportsResourceWithRawResponse", + "ReportsResourceWithStreamingResponse", + "AsyncReportsResourceWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/dns/firewall/analytics/analytics.py b/src/cloudflare/resources/dns/firewall/analytics/analytics.py index 4b98a9d710d..14e9b86b117 100644 --- a/src/cloudflare/resources/dns/firewall/analytics/analytics.py +++ b/src/cloudflare/resources/dns/firewall/analytics/analytics.py @@ -3,79 +3,79 @@ from __future__ import annotations from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, + ReportsResource, + AsyncReportsResource, + ReportsResourceWithRawResponse, + AsyncReportsResourceWithRawResponse, + ReportsResourceWithStreamingResponse, + AsyncReportsResourceWithStreamingResponse, ) from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource -from .reports.reports import Reports, AsyncReports +from .reports.reports import ReportsResource, AsyncReportsResource -__all__ = ["Analytics", "AsyncAnalytics"] +__all__ = ["AnalyticsResource", "AsyncAnalyticsResource"] -class Analytics(SyncAPIResource): +class AnalyticsResource(SyncAPIResource): @cached_property - def reports(self) -> Reports: - return Reports(self._client) + def reports(self) -> ReportsResource: + return ReportsResource(self._client) @cached_property - def with_raw_response(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self) + def with_raw_response(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self) + def with_streaming_response(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self) -class AsyncAnalytics(AsyncAPIResource): +class AsyncAnalyticsResource(AsyncAPIResource): @cached_property - def reports(self) -> AsyncReports: - return AsyncReports(self._client) + def reports(self) -> AsyncReportsResource: + return AsyncReportsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self) + def with_raw_response(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self) -class AnalyticsWithRawResponse: - def __init__(self, analytics: Analytics) -> None: +class AnalyticsResourceWithRawResponse: + def __init__(self, analytics: AnalyticsResource) -> None: self._analytics = analytics @cached_property - def reports(self) -> ReportsWithRawResponse: - return ReportsWithRawResponse(self._analytics.reports) + def reports(self) -> ReportsResourceWithRawResponse: + return ReportsResourceWithRawResponse(self._analytics.reports) -class AsyncAnalyticsWithRawResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: +class AsyncAnalyticsResourceWithRawResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: self._analytics = analytics @cached_property - def reports(self) -> AsyncReportsWithRawResponse: - return AsyncReportsWithRawResponse(self._analytics.reports) + def reports(self) -> AsyncReportsResourceWithRawResponse: + return AsyncReportsResourceWithRawResponse(self._analytics.reports) -class AnalyticsWithStreamingResponse: - def __init__(self, analytics: Analytics) -> None: +class AnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AnalyticsResource) -> None: self._analytics = analytics @cached_property - def reports(self) -> ReportsWithStreamingResponse: - return ReportsWithStreamingResponse(self._analytics.reports) + def reports(self) -> ReportsResourceWithStreamingResponse: + return ReportsResourceWithStreamingResponse(self._analytics.reports) -class AsyncAnalyticsWithStreamingResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: +class AsyncAnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: self._analytics = analytics @cached_property - def reports(self) -> AsyncReportsWithStreamingResponse: - return AsyncReportsWithStreamingResponse(self._analytics.reports) + def reports(self) -> AsyncReportsResourceWithStreamingResponse: + return AsyncReportsResourceWithStreamingResponse(self._analytics.reports) diff --git a/src/cloudflare/resources/dns/firewall/analytics/reports/__init__.py b/src/cloudflare/resources/dns/firewall/analytics/reports/__init__.py index 863e89438cf..998dba42f94 100644 --- a/src/cloudflare/resources/dns/firewall/analytics/reports/__init__.py +++ b/src/cloudflare/resources/dns/firewall/analytics/reports/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, + BytimesResource, + AsyncBytimesResource, + BytimesResourceWithRawResponse, + AsyncBytimesResourceWithRawResponse, + BytimesResourceWithStreamingResponse, + AsyncBytimesResourceWithStreamingResponse, ) from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, + ReportsResource, + AsyncReportsResource, + ReportsResourceWithRawResponse, + AsyncReportsResourceWithRawResponse, + ReportsResourceWithStreamingResponse, + AsyncReportsResourceWithStreamingResponse, ) __all__ = [ - "Bytimes", - "AsyncBytimes", - "BytimesWithRawResponse", - "AsyncBytimesWithRawResponse", - "BytimesWithStreamingResponse", - "AsyncBytimesWithStreamingResponse", - "Reports", - "AsyncReports", - "ReportsWithRawResponse", - "AsyncReportsWithRawResponse", - "ReportsWithStreamingResponse", - "AsyncReportsWithStreamingResponse", + "BytimesResource", + "AsyncBytimesResource", + "BytimesResourceWithRawResponse", + "AsyncBytimesResourceWithRawResponse", + "BytimesResourceWithStreamingResponse", + "AsyncBytimesResourceWithStreamingResponse", + "ReportsResource", + "AsyncReportsResource", + "ReportsResourceWithRawResponse", + "AsyncReportsResourceWithRawResponse", + "ReportsResourceWithStreamingResponse", + "AsyncReportsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py b/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py index a86961c5b7b..05c24c9cce7 100644 --- a/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py +++ b/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime from typing_extensions import Literal @@ -25,20 +25,20 @@ from ......_base_client import ( make_request_options, ) -from ......types.dns.analytics.reports import DNSAnalyticsReportByTime +from ......types.dns.analytics.reports.by_time import ByTime from ......types.dns.firewall.analytics.reports import bytime_get_params -__all__ = ["Bytimes", "AsyncBytimes"] +__all__ = ["BytimesResource", "AsyncBytimesResource"] -class Bytimes(SyncAPIResource): +class BytimesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self) + def with_raw_response(self) -> BytimesResourceWithRawResponse: + return BytimesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self) + def with_streaming_response(self) -> BytimesResourceWithStreamingResponse: + return BytimesResourceWithStreamingResponse(self) def get( self, @@ -60,7 +60,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSAnalyticsReportByTime: + ) -> Optional[ByTime]: """ Retrieves a list of aggregate metrics grouped by time interval. @@ -122,20 +122,20 @@ def get( }, bytime_get_params.BytimeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ByTime]]._unwrapper, ), - cast_to=cast(Type[DNSAnalyticsReportByTime], ResultWrapper[DNSAnalyticsReportByTime]), + cast_to=cast(Type[Optional[ByTime]], ResultWrapper[ByTime]), ) -class AsyncBytimes(AsyncAPIResource): +class AsyncBytimesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self) + def with_raw_response(self) -> AsyncBytimesResourceWithRawResponse: + return AsyncBytimesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBytimesResourceWithStreamingResponse: + return AsyncBytimesResourceWithStreamingResponse(self) async def get( self, @@ -157,7 +157,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSAnalyticsReportByTime: + ) -> Optional[ByTime]: """ Retrieves a list of aggregate metrics grouped by time interval. @@ -219,14 +219,14 @@ async def get( }, bytime_get_params.BytimeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ByTime]]._unwrapper, ), - cast_to=cast(Type[DNSAnalyticsReportByTime], ResultWrapper[DNSAnalyticsReportByTime]), + cast_to=cast(Type[Optional[ByTime]], ResultWrapper[ByTime]), ) -class BytimesWithRawResponse: - def __init__(self, bytimes: Bytimes) -> None: +class BytimesResourceWithRawResponse: + def __init__(self, bytimes: BytimesResource) -> None: self._bytimes = bytimes self.get = to_raw_response_wrapper( @@ -234,8 +234,8 @@ def __init__(self, bytimes: Bytimes) -> None: ) -class AsyncBytimesWithRawResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: +class AsyncBytimesResourceWithRawResponse: + def __init__(self, bytimes: AsyncBytimesResource) -> None: self._bytimes = bytimes self.get = async_to_raw_response_wrapper( @@ -243,8 +243,8 @@ def __init__(self, bytimes: AsyncBytimes) -> None: ) -class BytimesWithStreamingResponse: - def __init__(self, bytimes: Bytimes) -> None: +class BytimesResourceWithStreamingResponse: + def __init__(self, bytimes: BytimesResource) -> None: self._bytimes = bytimes self.get = to_streamed_response_wrapper( @@ -252,8 +252,8 @@ def __init__(self, bytimes: Bytimes) -> None: ) -class AsyncBytimesWithStreamingResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: +class AsyncBytimesResourceWithStreamingResponse: + def __init__(self, bytimes: AsyncBytimesResource) -> None: self._bytimes = bytimes self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py b/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py index e21dbc531ac..09693f73830 100644 --- a/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py +++ b/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py @@ -2,18 +2,18 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime import httpx from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, + BytimesResource, + AsyncBytimesResource, + BytimesResourceWithRawResponse, + AsyncBytimesResourceWithRawResponse, + BytimesResourceWithStreamingResponse, + AsyncBytimesResourceWithStreamingResponse, ) from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven from ......_utils import ( @@ -32,24 +32,24 @@ from ......_base_client import ( make_request_options, ) -from ......types.dns.analytics import DNSAnalyticsReport +from ......types.dns.analytics.report import Report from ......types.dns.firewall.analytics import report_get_params -__all__ = ["Reports", "AsyncReports"] +__all__ = ["ReportsResource", "AsyncReportsResource"] -class Reports(SyncAPIResource): +class ReportsResource(SyncAPIResource): @cached_property - def bytimes(self) -> Bytimes: - return Bytimes(self._client) + def bytimes(self) -> BytimesResource: + return BytimesResource(self._client) @cached_property - def with_raw_response(self) -> ReportsWithRawResponse: - return ReportsWithRawResponse(self) + def with_raw_response(self) -> ReportsResourceWithRawResponse: + return ReportsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ReportsWithStreamingResponse: - return ReportsWithStreamingResponse(self) + def with_streaming_response(self) -> ReportsResourceWithStreamingResponse: + return ReportsResourceWithStreamingResponse(self) def get( self, @@ -69,7 +69,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSAnalyticsReport: + ) -> Optional[Report]: """ Retrieves a list of summarised aggregate metrics over a given time period. @@ -128,24 +128,24 @@ def get( }, report_get_params.ReportGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Report]]._unwrapper, ), - cast_to=cast(Type[DNSAnalyticsReport], ResultWrapper[DNSAnalyticsReport]), + cast_to=cast(Type[Optional[Report]], ResultWrapper[Report]), ) -class AsyncReports(AsyncAPIResource): +class AsyncReportsResource(AsyncAPIResource): @cached_property - def bytimes(self) -> AsyncBytimes: - return AsyncBytimes(self._client) + def bytimes(self) -> AsyncBytimesResource: + return AsyncBytimesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncReportsWithRawResponse: - return AsyncReportsWithRawResponse(self) + def with_raw_response(self) -> AsyncReportsResourceWithRawResponse: + return AsyncReportsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncReportsWithStreamingResponse: - return AsyncReportsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncReportsResourceWithStreamingResponse: + return AsyncReportsResourceWithStreamingResponse(self) async def get( self, @@ -165,7 +165,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSAnalyticsReport: + ) -> Optional[Report]: """ Retrieves a list of summarised aggregate metrics over a given time period. @@ -224,14 +224,14 @@ async def get( }, report_get_params.ReportGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Report]]._unwrapper, ), - cast_to=cast(Type[DNSAnalyticsReport], ResultWrapper[DNSAnalyticsReport]), + cast_to=cast(Type[Optional[Report]], ResultWrapper[Report]), ) -class ReportsWithRawResponse: - def __init__(self, reports: Reports) -> None: +class ReportsResourceWithRawResponse: + def __init__(self, reports: ReportsResource) -> None: self._reports = reports self.get = to_raw_response_wrapper( @@ -239,12 +239,12 @@ def __init__(self, reports: Reports) -> None: ) @cached_property - def bytimes(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self._reports.bytimes) + def bytimes(self) -> BytimesResourceWithRawResponse: + return BytimesResourceWithRawResponse(self._reports.bytimes) -class AsyncReportsWithRawResponse: - def __init__(self, reports: AsyncReports) -> None: +class AsyncReportsResourceWithRawResponse: + def __init__(self, reports: AsyncReportsResource) -> None: self._reports = reports self.get = async_to_raw_response_wrapper( @@ -252,12 +252,12 @@ def __init__(self, reports: AsyncReports) -> None: ) @cached_property - def bytimes(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self._reports.bytimes) + def bytimes(self) -> AsyncBytimesResourceWithRawResponse: + return AsyncBytimesResourceWithRawResponse(self._reports.bytimes) -class ReportsWithStreamingResponse: - def __init__(self, reports: Reports) -> None: +class ReportsResourceWithStreamingResponse: + def __init__(self, reports: ReportsResource) -> None: self._reports = reports self.get = to_streamed_response_wrapper( @@ -265,12 +265,12 @@ def __init__(self, reports: Reports) -> None: ) @cached_property - def bytimes(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self._reports.bytimes) + def bytimes(self) -> BytimesResourceWithStreamingResponse: + return BytimesResourceWithStreamingResponse(self._reports.bytimes) -class AsyncReportsWithStreamingResponse: - def __init__(self, reports: AsyncReports) -> None: +class AsyncReportsResourceWithStreamingResponse: + def __init__(self, reports: AsyncReportsResource) -> None: self._reports = reports self.get = async_to_streamed_response_wrapper( @@ -278,5 +278,5 @@ def __init__(self, reports: AsyncReports) -> None: ) @cached_property - def bytimes(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self._reports.bytimes) + def bytimes(self) -> AsyncBytimesResourceWithStreamingResponse: + return AsyncBytimesResourceWithStreamingResponse(self._reports.bytimes) diff --git a/src/cloudflare/resources/dns/firewall/firewall.py b/src/cloudflare/resources/dns/firewall/firewall.py index c8fe6388eb0..a4bbe227f81 100644 --- a/src/cloudflare/resources/dns/firewall/firewall.py +++ b/src/cloudflare/resources/dns/firewall/firewall.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Union, Optional, cast +from typing import List, Type, Optional, cast import httpx @@ -12,12 +12,12 @@ async_maybe_transform, ) from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -29,42 +29,46 @@ ) from ...._wrappers import ResultWrapper from ....types.dns import ( - DNSFirewall, - FirewallDeleteResponse, firewall_edit_params, firewall_list_params, firewall_create_params, + firewall_delete_params, ) from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import ( AsyncPaginator, make_request_options, ) -from .analytics.analytics import Analytics, AsyncAnalytics +from .analytics.analytics import AnalyticsResource, AsyncAnalyticsResource +from ....types.dns.firewall.firewall import Firewall +from ....types.dns.firewall_ips_param import FirewallIPsParam +from ....types.dns.upstream_ips_param import UpstreamIPsParam +from ....types.dns.attack_mitigation_param import AttackMitigationParam +from ....types.dns.firewall_delete_response import FirewallDeleteResponse -__all__ = ["Firewall", "AsyncFirewall"] +__all__ = ["FirewallResource", "AsyncFirewallResource"] -class Firewall(SyncAPIResource): +class FirewallResource(SyncAPIResource): @cached_property - def analytics(self) -> Analytics: - return Analytics(self._client) + def analytics(self) -> AnalyticsResource: + return AnalyticsResource(self._client) @cached_property - def with_raw_response(self) -> FirewallWithRawResponse: - return FirewallWithRawResponse(self) + def with_raw_response(self) -> FirewallResourceWithRawResponse: + return FirewallResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FirewallWithStreamingResponse: - return FirewallWithStreamingResponse(self) + def with_streaming_response(self) -> FirewallResourceWithStreamingResponse: + return FirewallResourceWithStreamingResponse(self) def create( self, *, account_id: str, name: str, - upstream_ips: List[Union[str, str]], - attack_mitigation: Optional[firewall_create_params.AttackMitigation] | NotGiven = NOT_GIVEN, + upstream_ips: List[UpstreamIPsParam], + attack_mitigation: Optional[AttackMitigationParam] | NotGiven = NOT_GIVEN, deprecate_any_requests: bool | NotGiven = NOT_GIVEN, ecs_fallback: bool | NotGiven = NOT_GIVEN, maximum_cache_ttl: float | NotGiven = NOT_GIVEN, @@ -78,7 +82,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSFirewall: + ) -> Firewall: """ Create a configured DNS Firewall Cluster. @@ -137,9 +141,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Firewall]._unwrapper, ), - cast_to=cast(Type[DNSFirewall], ResultWrapper[DNSFirewall]), + cast_to=cast(Type[Firewall], ResultWrapper[Firewall]), ) def list( @@ -154,7 +158,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[DNSFirewall]: + ) -> SyncV4PagePaginationArray[Firewall]: """ List configured DNS Firewall clusters for an account. @@ -177,7 +181,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/dns_firewall", - page=SyncV4PagePaginationArray[DNSFirewall], + page=SyncV4PagePaginationArray[Firewall], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -191,7 +195,7 @@ def list( firewall_list_params.FirewallListParams, ), ), - model=DNSFirewall, + model=Firewall, ) def delete( @@ -199,6 +203,7 @@ def delete( dns_firewall_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -228,12 +233,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `dns_firewall_id` but received {dns_firewall_id!r}") return self._delete( f"/accounts/{account_id}/dns_firewall/{dns_firewall_id}", + body=maybe_transform(body, firewall_delete_params.FirewallDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallDeleteResponse]._unwrapper, ), cast_to=cast(Type[FirewallDeleteResponse], ResultWrapper[FirewallDeleteResponse]), ) @@ -244,13 +250,13 @@ def edit( *, account_id: str, deprecate_any_requests: bool, - dns_firewall_ips: List[Union[str, str]], + dns_firewall_ips: List[FirewallIPsParam], ecs_fallback: bool, maximum_cache_ttl: float, minimum_cache_ttl: float, name: str, - upstream_ips: List[Union[str, str]], - attack_mitigation: Optional[firewall_edit_params.AttackMitigation] | NotGiven = NOT_GIVEN, + upstream_ips: List[UpstreamIPsParam], + attack_mitigation: Optional[AttackMitigationParam] | NotGiven = NOT_GIVEN, negative_cache_ttl: Optional[float] | NotGiven = NOT_GIVEN, ratelimit: Optional[float] | NotGiven = NOT_GIVEN, retries: float | NotGiven = NOT_GIVEN, @@ -260,7 +266,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSFirewall: + ) -> Firewall: """ Modify a DNS Firewall Cluster configuration. @@ -324,9 +330,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Firewall]._unwrapper, ), - cast_to=cast(Type[DNSFirewall], ResultWrapper[DNSFirewall]), + cast_to=cast(Type[Firewall], ResultWrapper[Firewall]), ) def get( @@ -340,7 +346,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSFirewall: + ) -> Firewall: """ Show a single configured DNS Firewall cluster for an account. @@ -368,32 +374,32 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Firewall]._unwrapper, ), - cast_to=cast(Type[DNSFirewall], ResultWrapper[DNSFirewall]), + cast_to=cast(Type[Firewall], ResultWrapper[Firewall]), ) -class AsyncFirewall(AsyncAPIResource): +class AsyncFirewallResource(AsyncAPIResource): @cached_property - def analytics(self) -> AsyncAnalytics: - return AsyncAnalytics(self._client) + def analytics(self) -> AsyncAnalyticsResource: + return AsyncAnalyticsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncFirewallWithRawResponse: - return AsyncFirewallWithRawResponse(self) + def with_raw_response(self) -> AsyncFirewallResourceWithRawResponse: + return AsyncFirewallResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFirewallWithStreamingResponse: - return AsyncFirewallWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFirewallResourceWithStreamingResponse: + return AsyncFirewallResourceWithStreamingResponse(self) async def create( self, *, account_id: str, name: str, - upstream_ips: List[Union[str, str]], - attack_mitigation: Optional[firewall_create_params.AttackMitigation] | NotGiven = NOT_GIVEN, + upstream_ips: List[UpstreamIPsParam], + attack_mitigation: Optional[AttackMitigationParam] | NotGiven = NOT_GIVEN, deprecate_any_requests: bool | NotGiven = NOT_GIVEN, ecs_fallback: bool | NotGiven = NOT_GIVEN, maximum_cache_ttl: float | NotGiven = NOT_GIVEN, @@ -407,7 +413,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSFirewall: + ) -> Firewall: """ Create a configured DNS Firewall Cluster. @@ -466,9 +472,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Firewall]._unwrapper, ), - cast_to=cast(Type[DNSFirewall], ResultWrapper[DNSFirewall]), + cast_to=cast(Type[Firewall], ResultWrapper[Firewall]), ) def list( @@ -483,7 +489,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DNSFirewall, AsyncV4PagePaginationArray[DNSFirewall]]: + ) -> AsyncPaginator[Firewall, AsyncV4PagePaginationArray[Firewall]]: """ List configured DNS Firewall clusters for an account. @@ -506,7 +512,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/dns_firewall", - page=AsyncV4PagePaginationArray[DNSFirewall], + page=AsyncV4PagePaginationArray[Firewall], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -520,7 +526,7 @@ def list( firewall_list_params.FirewallListParams, ), ), - model=DNSFirewall, + model=Firewall, ) async def delete( @@ -528,6 +534,7 @@ async def delete( dns_firewall_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -557,12 +564,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `dns_firewall_id` but received {dns_firewall_id!r}") return await self._delete( f"/accounts/{account_id}/dns_firewall/{dns_firewall_id}", + body=await async_maybe_transform(body, firewall_delete_params.FirewallDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallDeleteResponse]._unwrapper, ), cast_to=cast(Type[FirewallDeleteResponse], ResultWrapper[FirewallDeleteResponse]), ) @@ -573,13 +581,13 @@ async def edit( *, account_id: str, deprecate_any_requests: bool, - dns_firewall_ips: List[Union[str, str]], + dns_firewall_ips: List[FirewallIPsParam], ecs_fallback: bool, maximum_cache_ttl: float, minimum_cache_ttl: float, name: str, - upstream_ips: List[Union[str, str]], - attack_mitigation: Optional[firewall_edit_params.AttackMitigation] | NotGiven = NOT_GIVEN, + upstream_ips: List[UpstreamIPsParam], + attack_mitigation: Optional[AttackMitigationParam] | NotGiven = NOT_GIVEN, negative_cache_ttl: Optional[float] | NotGiven = NOT_GIVEN, ratelimit: Optional[float] | NotGiven = NOT_GIVEN, retries: float | NotGiven = NOT_GIVEN, @@ -589,7 +597,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSFirewall: + ) -> Firewall: """ Modify a DNS Firewall Cluster configuration. @@ -653,9 +661,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Firewall]._unwrapper, ), - cast_to=cast(Type[DNSFirewall], ResultWrapper[DNSFirewall]), + cast_to=cast(Type[Firewall], ResultWrapper[Firewall]), ) async def get( @@ -669,7 +677,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSFirewall: + ) -> Firewall: """ Show a single configured DNS Firewall cluster for an account. @@ -697,14 +705,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Firewall]._unwrapper, ), - cast_to=cast(Type[DNSFirewall], ResultWrapper[DNSFirewall]), + cast_to=cast(Type[Firewall], ResultWrapper[Firewall]), ) -class FirewallWithRawResponse: - def __init__(self, firewall: Firewall) -> None: +class FirewallResourceWithRawResponse: + def __init__(self, firewall: FirewallResource) -> None: self._firewall = firewall self.create = to_raw_response_wrapper( @@ -724,12 +732,12 @@ def __init__(self, firewall: Firewall) -> None: ) @cached_property - def analytics(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self._firewall.analytics) + def analytics(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self._firewall.analytics) -class AsyncFirewallWithRawResponse: - def __init__(self, firewall: AsyncFirewall) -> None: +class AsyncFirewallResourceWithRawResponse: + def __init__(self, firewall: AsyncFirewallResource) -> None: self._firewall = firewall self.create = async_to_raw_response_wrapper( @@ -749,12 +757,12 @@ def __init__(self, firewall: AsyncFirewall) -> None: ) @cached_property - def analytics(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self._firewall.analytics) + def analytics(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self._firewall.analytics) -class FirewallWithStreamingResponse: - def __init__(self, firewall: Firewall) -> None: +class FirewallResourceWithStreamingResponse: + def __init__(self, firewall: FirewallResource) -> None: self._firewall = firewall self.create = to_streamed_response_wrapper( @@ -774,12 +782,12 @@ def __init__(self, firewall: Firewall) -> None: ) @cached_property - def analytics(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self._firewall.analytics) + def analytics(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self._firewall.analytics) -class AsyncFirewallWithStreamingResponse: - def __init__(self, firewall: AsyncFirewall) -> None: +class AsyncFirewallResourceWithStreamingResponse: + def __init__(self, firewall: AsyncFirewallResource) -> None: self._firewall = firewall self.create = async_to_streamed_response_wrapper( @@ -799,5 +807,5 @@ def __init__(self, firewall: AsyncFirewall) -> None: ) @cached_property - def analytics(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self._firewall.analytics) + def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self._firewall.analytics) diff --git a/src/cloudflare/resources/dns/records.py b/src/cloudflare/resources/dns/records.py index 60a37582da7..fd486f064e5 100644 --- a/src/cloudflare/resources/dns/records.py +++ b/src/cloudflare/resources/dns/records.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Union, Optional, cast, overload +from typing import Any, List, Type, Optional, cast, overload from typing_extensions import Literal import httpx @@ -23,13 +23,11 @@ ) from ..._wrappers import ResultWrapper from ...types.dns import ( - DNSRecord, - RecordScanResponse, - RecordDeleteResponse, - RecordImportResponse, record_edit_params, record_list_params, + record_scan_params, record_create_params, + record_delete_params, record_import_params, record_update_params, ) @@ -38,18 +36,24 @@ AsyncPaginator, make_request_options, ) +from ...types.dns.record import Record +from ...types.dns.ttl_param import TTLParam +from ...types.dns.record_tags import RecordTags +from ...types.dns.record_scan_response import RecordScanResponse +from ...types.dns.record_delete_response import RecordDeleteResponse +from ...types.dns.record_import_response import RecordImportResponse -__all__ = ["Records", "AsyncRecords"] +__all__ = ["RecordsResource", "AsyncRecordsResource"] -class Records(SyncAPIResource): +class RecordsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RecordsWithRawResponse: - return RecordsWithRawResponse(self) + def with_raw_response(self) -> RecordsResourceWithRawResponse: + return RecordsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RecordsWithStreamingResponse: - return RecordsWithStreamingResponse(self) + def with_streaming_response(self) -> RecordsResourceWithStreamingResponse: + return RecordsResourceWithStreamingResponse(self) @overload def create( @@ -61,15 +65,15 @@ def create( type: Literal["A"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -121,15 +125,15 @@ def create( type: Literal["AAAA"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -176,19 +180,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsCAARecordData, + data: record_create_params.CAARecordData, name: str, type: Literal["CAA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -232,19 +236,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsCERTRecordData, + data: record_create_params.CERTRecordData, name: str, type: Literal["CERT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -293,15 +297,15 @@ def create( type: Literal["CNAME"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -348,19 +352,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsDNSKEYRecordData, + data: record_create_params.DNSKEYRecordData, name: str, type: Literal["DNSKEY"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -404,19 +408,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsDSRecordData, + data: record_create_params.DSRecordData, name: str, type: Literal["DS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -460,19 +464,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsHTTPSRecordData, + data: record_create_params.HTTPSRecordData, name: str, type: Literal["HTTPS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -516,19 +520,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsLOCRecordData, + data: record_create_params.LOCRecordData, name: str, type: Literal["LOC"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -577,15 +581,15 @@ def create( priority: float, type: Literal["MX"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -632,19 +636,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsNAPTRRecordData, + data: record_create_params.NAPTRRecordData, name: str, type: Literal["NAPTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -692,15 +696,15 @@ def create( name: str, type: Literal["NS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -748,15 +752,15 @@ def create( name: str, type: Literal["PTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -800,19 +804,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsSMIMEARecordData, + data: record_create_params.SMIMEARecordData, name: str, type: Literal["SMIMEA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -856,19 +860,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsSRVRecordData, + data: record_create_params.SRVRecordData, name: str, type: Literal["SRV"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -914,19 +918,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsSSHFPRecordData, + data: record_create_params.SSHFPRecordData, name: str, type: Literal["SSHFP"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -970,19 +974,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsSVCBRecordData, + data: record_create_params.SVCBRecordData, name: str, type: Literal["SVCB"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -1026,19 +1030,19 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsTLSARecordData, + data: record_create_params.TLSARecordData, name: str, type: Literal["TLSA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -1086,15 +1090,15 @@ def create( name: str, type: Literal["TXT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -1138,20 +1142,20 @@ def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsURIRecordData, + data: record_create_params.URIRecordData, name: str, priority: float, type: Literal["URI"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -1243,19 +1247,19 @@ def create( | Literal["URI"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, - data: record_create_params.DNSRecordsCAARecordData - | record_create_params.DNSRecordsCERTRecordData - | record_create_params.DNSRecordsDNSKEYRecordData - | record_create_params.DNSRecordsDSRecordData - | record_create_params.DNSRecordsHTTPSRecordData - | record_create_params.DNSRecordsLOCRecordData - | record_create_params.DNSRecordsNAPTRRecordData - | record_create_params.DNSRecordsSMIMEARecordData - | record_create_params.DNSRecordsSRVRecordData - | record_create_params.DNSRecordsSSHFPRecordData - | record_create_params.DNSRecordsURIRecordData + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | NotGiven = NOT_GIVEN, + data: record_create_params.CAARecordData + | record_create_params.CERTRecordData + | record_create_params.DNSKEYRecordData + | record_create_params.DSRecordData + | record_create_params.HTTPSRecordData + | record_create_params.LOCRecordData + | record_create_params.NAPTRRecordData + | record_create_params.SMIMEARecordData + | record_create_params.SRVRecordData + | record_create_params.SSHFPRecordData + | record_create_params.URIRecordData | 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. @@ -1264,11 +1268,11 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSRecord: + ) -> Optional[Record]: if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - DNSRecord, + Optional[Record], self._post( f"/zones/{zone_id}/dns_records", body=maybe_transform( @@ -1290,10 +1294,10 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Record]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[DNSRecord] + Any, ResultWrapper[Record] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -1309,15 +1313,15 @@ def update( type: Literal["A"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1371,15 +1375,15 @@ def update( type: Literal["AAAA"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1428,19 +1432,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsCAARecordData, + data: record_update_params.CAARecordData, name: str, type: Literal["CAA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1486,19 +1490,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsCERTRecordData, + data: record_update_params.CERTRecordData, name: str, type: Literal["CERT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1549,15 +1553,15 @@ def update( type: Literal["CNAME"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1606,19 +1610,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsDNSKEYRecordData, + data: record_update_params.DNSKEYRecordData, name: str, type: Literal["DNSKEY"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1664,19 +1668,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsDSRecordData, + data: record_update_params.DSRecordData, name: str, type: Literal["DS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1722,19 +1726,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsHTTPSRecordData, + data: record_update_params.HTTPSRecordData, name: str, type: Literal["HTTPS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1780,19 +1784,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsLOCRecordData, + data: record_update_params.LOCRecordData, name: str, type: Literal["LOC"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1843,15 +1847,15 @@ def update( priority: float, type: Literal["MX"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1900,19 +1904,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsNAPTRRecordData, + data: record_update_params.NAPTRRecordData, name: str, type: Literal["NAPTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -1962,15 +1966,15 @@ def update( name: str, type: Literal["NS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2020,15 +2024,15 @@ def update( name: str, type: Literal["PTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2074,19 +2078,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsSMIMEARecordData, + data: record_update_params.SMIMEARecordData, name: str, type: Literal["SMIMEA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2132,19 +2136,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsSRVRecordData, + data: record_update_params.SRVRecordData, name: str, type: Literal["SRV"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2192,19 +2196,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsSSHFPRecordData, + data: record_update_params.SSHFPRecordData, name: str, type: Literal["SSHFP"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2250,19 +2254,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsSVCBRecordData, + data: record_update_params.SVCBRecordData, name: str, type: Literal["SVCB"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2308,19 +2312,19 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsTLSARecordData, + data: record_update_params.TLSARecordData, name: str, type: Literal["TLSA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2370,15 +2374,15 @@ def update( name: str, type: Literal["TXT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2424,20 +2428,20 @@ def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsURIRecordData, + data: record_update_params.URIRecordData, name: str, priority: float, type: Literal["URI"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -2531,19 +2535,19 @@ def update( | Literal["URI"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, - data: record_update_params.DNSRecordsCAARecordData - | record_update_params.DNSRecordsCERTRecordData - | record_update_params.DNSRecordsDNSKEYRecordData - | record_update_params.DNSRecordsDSRecordData - | record_update_params.DNSRecordsHTTPSRecordData - | record_update_params.DNSRecordsLOCRecordData - | record_update_params.DNSRecordsNAPTRRecordData - | record_update_params.DNSRecordsSMIMEARecordData - | record_update_params.DNSRecordsSRVRecordData - | record_update_params.DNSRecordsSSHFPRecordData - | record_update_params.DNSRecordsURIRecordData + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | NotGiven = NOT_GIVEN, + data: record_update_params.CAARecordData + | record_update_params.CERTRecordData + | record_update_params.DNSKEYRecordData + | record_update_params.DSRecordData + | record_update_params.HTTPSRecordData + | record_update_params.LOCRecordData + | record_update_params.NAPTRRecordData + | record_update_params.SMIMEARecordData + | record_update_params.SRVRecordData + | record_update_params.SSHFPRecordData + | record_update_params.URIRecordData | 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. @@ -2552,13 +2556,13 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSRecord: + ) -> Optional[Record]: 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( - DNSRecord, + Optional[Record], self._put( f"/zones/{zone_id}/dns_records/{dns_record_id}", body=maybe_transform( @@ -2580,10 +2584,10 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Record]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[DNSRecord] + Any, ResultWrapper[Record] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -2633,7 +2637,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[DNSRecord]: + ) -> SyncV4PagePaginationArray[Record]: """ List, search, sort, and filter a zones' DNS records. @@ -2685,7 +2689,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[DNSRecord], + page=SyncV4PagePaginationArray[Record], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2710,7 +2714,7 @@ def list( record_list_params.RecordListParams, ), ), - model=cast(Any, DNSRecord), # Union types cannot be passed in as arguments in the type system + model=cast(Any, Record), # Union types cannot be passed in as arguments in the type system ) def delete( @@ -2718,6 +2722,7 @@ def delete( dns_record_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2747,12 +2752,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `dns_record_id` but received {dns_record_id!r}") return self._delete( f"/zones/{zone_id}/dns_records/{dns_record_id}", + body=maybe_transform(body, record_delete_params.RecordDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RecordDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RecordDeleteResponse]], ResultWrapper[RecordDeleteResponse]), ) @@ -2768,15 +2774,15 @@ def edit( type: Literal["A"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -2830,15 +2836,15 @@ def edit( type: Literal["AAAA"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -2887,19 +2893,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsCAARecordData, + data: record_edit_params.CAARecordData, name: str, type: Literal["CAA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -2945,19 +2951,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsCERTRecordData, + data: record_edit_params.CERTRecordData, name: str, type: Literal["CERT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3008,15 +3014,15 @@ def edit( type: Literal["CNAME"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3065,19 +3071,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsDNSKEYRecordData, + data: record_edit_params.DNSKEYRecordData, name: str, type: Literal["DNSKEY"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3123,19 +3129,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsDSRecordData, + data: record_edit_params.DSRecordData, name: str, type: Literal["DS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3181,19 +3187,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsHTTPSRecordData, + data: record_edit_params.HTTPSRecordData, name: str, type: Literal["HTTPS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3239,19 +3245,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsLOCRecordData, + data: record_edit_params.LOCRecordData, name: str, type: Literal["LOC"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3302,15 +3308,15 @@ def edit( priority: float, type: Literal["MX"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3359,19 +3365,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsNAPTRRecordData, + data: record_edit_params.NAPTRRecordData, name: str, type: Literal["NAPTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3421,15 +3427,15 @@ def edit( name: str, type: Literal["NS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3479,15 +3485,15 @@ def edit( name: str, type: Literal["PTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3533,19 +3539,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsSMIMEARecordData, + data: record_edit_params.SMIMEARecordData, name: str, type: Literal["SMIMEA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3591,19 +3597,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsSRVRecordData, + data: record_edit_params.SRVRecordData, name: str, type: Literal["SRV"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3651,19 +3657,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsSSHFPRecordData, + data: record_edit_params.SSHFPRecordData, name: str, type: Literal["SSHFP"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3709,19 +3715,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsSVCBRecordData, + data: record_edit_params.SVCBRecordData, name: str, type: Literal["SVCB"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3767,19 +3773,19 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsTLSARecordData, + data: record_edit_params.TLSARecordData, name: str, type: Literal["TLSA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3829,15 +3835,15 @@ def edit( name: str, type: Literal["TXT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3883,20 +3889,20 @@ def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsURIRecordData, + data: record_edit_params.URIRecordData, name: str, priority: float, type: Literal["URI"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -3990,19 +3996,19 @@ def edit( | Literal["URI"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, - data: record_edit_params.DNSRecordsCAARecordData - | record_edit_params.DNSRecordsCERTRecordData - | record_edit_params.DNSRecordsDNSKEYRecordData - | record_edit_params.DNSRecordsDSRecordData - | record_edit_params.DNSRecordsHTTPSRecordData - | record_edit_params.DNSRecordsLOCRecordData - | record_edit_params.DNSRecordsNAPTRRecordData - | record_edit_params.DNSRecordsSMIMEARecordData - | record_edit_params.DNSRecordsSRVRecordData - | record_edit_params.DNSRecordsSSHFPRecordData - | record_edit_params.DNSRecordsURIRecordData + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | NotGiven = NOT_GIVEN, + data: record_edit_params.CAARecordData + | record_edit_params.CERTRecordData + | record_edit_params.DNSKEYRecordData + | record_edit_params.DSRecordData + | record_edit_params.HTTPSRecordData + | record_edit_params.LOCRecordData + | record_edit_params.NAPTRRecordData + | record_edit_params.SMIMEARecordData + | record_edit_params.SRVRecordData + | record_edit_params.SSHFPRecordData + | record_edit_params.URIRecordData | 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. @@ -4011,13 +4017,13 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSRecord: + ) -> Optional[Record]: 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( - DNSRecord, + Optional[Record], self._patch( f"/zones/{zone_id}/dns_records/{dns_record_id}", body=maybe_transform( @@ -4039,10 +4045,10 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Record]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[DNSRecord] + Any, ResultWrapper[Record] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -4100,7 +4106,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSRecord: + ) -> Optional[Record]: """ DNS Record Details @@ -4122,7 +4128,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( - DNSRecord, + Optional[Record], self._get( f"/zones/{zone_id}/dns_records/{dns_record_id}", options=make_request_options( @@ -4130,10 +4136,10 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Record]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[DNSRecord] + Any, ResultWrapper[Record] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -4150,7 +4156,7 @@ def import_( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RecordImportResponse: + ) -> Optional[RecordImportResponse]: """ You can upload your [BIND config](https://en.wikipedia.org/wiki/Zone_file "Zone file") through this @@ -4198,22 +4204,23 @@ def import_( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RecordImportResponse]]._unwrapper, ), - cast_to=cast(Type[RecordImportResponse], ResultWrapper[RecordImportResponse]), + cast_to=cast(Type[Optional[RecordImportResponse]], ResultWrapper[RecordImportResponse]), ) def scan( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> RecordScanResponse: + ) -> Optional[RecordScanResponse]: """ Scan for common DNS records on your domain and automatically add them to your zone. Useful if you haven't updated your nameservers yet. @@ -4233,25 +4240,26 @@ def scan( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._post( f"/zones/{zone_id}/dns_records/scan", + body=maybe_transform(body, record_scan_params.RecordScanParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RecordScanResponse]]._unwrapper, ), - cast_to=cast(Type[RecordScanResponse], ResultWrapper[RecordScanResponse]), + cast_to=cast(Type[Optional[RecordScanResponse]], ResultWrapper[RecordScanResponse]), ) -class AsyncRecords(AsyncAPIResource): +class AsyncRecordsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRecordsWithRawResponse: - return AsyncRecordsWithRawResponse(self) + def with_raw_response(self) -> AsyncRecordsResourceWithRawResponse: + return AsyncRecordsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRecordsWithStreamingResponse: - return AsyncRecordsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRecordsResourceWithStreamingResponse: + return AsyncRecordsResourceWithStreamingResponse(self) @overload async def create( @@ -4263,15 +4271,15 @@ async def create( type: Literal["A"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4323,15 +4331,15 @@ async def create( type: Literal["AAAA"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4378,19 +4386,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsCAARecordData, + data: record_create_params.CAARecordData, name: str, type: Literal["CAA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4434,19 +4442,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsCERTRecordData, + data: record_create_params.CERTRecordData, name: str, type: Literal["CERT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4495,15 +4503,15 @@ async def create( type: Literal["CNAME"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4550,19 +4558,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsDNSKEYRecordData, + data: record_create_params.DNSKEYRecordData, name: str, type: Literal["DNSKEY"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4606,19 +4614,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsDSRecordData, + data: record_create_params.DSRecordData, name: str, type: Literal["DS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4662,19 +4670,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsHTTPSRecordData, + data: record_create_params.HTTPSRecordData, name: str, type: Literal["HTTPS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4718,19 +4726,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsLOCRecordData, + data: record_create_params.LOCRecordData, name: str, type: Literal["LOC"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4779,15 +4787,15 @@ async def create( priority: float, type: Literal["MX"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4834,19 +4842,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsNAPTRRecordData, + data: record_create_params.NAPTRRecordData, name: str, type: Literal["NAPTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4894,15 +4902,15 @@ async def create( name: str, type: Literal["NS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -4950,15 +4958,15 @@ async def create( name: str, type: Literal["PTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -5002,19 +5010,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsSMIMEARecordData, + data: record_create_params.SMIMEARecordData, name: str, type: Literal["SMIMEA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -5058,19 +5066,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsSRVRecordData, + data: record_create_params.SRVRecordData, name: str, type: Literal["SRV"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -5116,19 +5124,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsSSHFPRecordData, + data: record_create_params.SSHFPRecordData, name: str, type: Literal["SSHFP"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -5172,19 +5180,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsSVCBRecordData, + data: record_create_params.SVCBRecordData, name: str, type: Literal["SVCB"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -5228,19 +5236,19 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsTLSARecordData, + data: record_create_params.TLSARecordData, name: str, type: Literal["TLSA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -5288,15 +5296,15 @@ async def create( name: str, type: Literal["TXT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -5340,20 +5348,20 @@ async def create( self, *, zone_id: str, - data: record_create_params.DNSRecordsURIRecordData, + data: record_create_params.URIRecordData, name: str, priority: float, type: Literal["URI"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """ Create a new DNS record for a zone. @@ -5445,19 +5453,19 @@ async def create( | Literal["URI"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, - data: record_create_params.DNSRecordsCAARecordData - | record_create_params.DNSRecordsCERTRecordData - | record_create_params.DNSRecordsDNSKEYRecordData - | record_create_params.DNSRecordsDSRecordData - | record_create_params.DNSRecordsHTTPSRecordData - | record_create_params.DNSRecordsLOCRecordData - | record_create_params.DNSRecordsNAPTRRecordData - | record_create_params.DNSRecordsSMIMEARecordData - | record_create_params.DNSRecordsSRVRecordData - | record_create_params.DNSRecordsSSHFPRecordData - | record_create_params.DNSRecordsURIRecordData + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | NotGiven = NOT_GIVEN, + data: record_create_params.CAARecordData + | record_create_params.CERTRecordData + | record_create_params.DNSKEYRecordData + | record_create_params.DSRecordData + | record_create_params.HTTPSRecordData + | record_create_params.LOCRecordData + | record_create_params.NAPTRRecordData + | record_create_params.SMIMEARecordData + | record_create_params.SRVRecordData + | record_create_params.SSHFPRecordData + | record_create_params.URIRecordData | 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. @@ -5466,11 +5474,11 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSRecord: + ) -> Optional[Record]: if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - DNSRecord, + Optional[Record], await self._post( f"/zones/{zone_id}/dns_records", body=await async_maybe_transform( @@ -5492,10 +5500,10 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Record]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[DNSRecord] + Any, ResultWrapper[Record] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -5511,15 +5519,15 @@ async def update( type: Literal["A"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -5573,15 +5581,15 @@ async def update( type: Literal["AAAA"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -5630,19 +5638,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsCAARecordData, + data: record_update_params.CAARecordData, name: str, type: Literal["CAA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -5688,19 +5696,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsCERTRecordData, + data: record_update_params.CERTRecordData, name: str, type: Literal["CERT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -5751,15 +5759,15 @@ async def update( type: Literal["CNAME"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -5808,19 +5816,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsDNSKEYRecordData, + data: record_update_params.DNSKEYRecordData, name: str, type: Literal["DNSKEY"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -5866,19 +5874,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsDSRecordData, + data: record_update_params.DSRecordData, name: str, type: Literal["DS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -5924,19 +5932,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsHTTPSRecordData, + data: record_update_params.HTTPSRecordData, name: str, type: Literal["HTTPS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -5982,19 +5990,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsLOCRecordData, + data: record_update_params.LOCRecordData, name: str, type: Literal["LOC"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6045,15 +6053,15 @@ async def update( priority: float, type: Literal["MX"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6102,19 +6110,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsNAPTRRecordData, + data: record_update_params.NAPTRRecordData, name: str, type: Literal["NAPTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6164,15 +6172,15 @@ async def update( name: str, type: Literal["NS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6222,15 +6230,15 @@ async def update( name: str, type: Literal["PTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6276,19 +6284,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsSMIMEARecordData, + data: record_update_params.SMIMEARecordData, name: str, type: Literal["SMIMEA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6334,19 +6342,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsSRVRecordData, + data: record_update_params.SRVRecordData, name: str, type: Literal["SRV"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6394,19 +6402,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsSSHFPRecordData, + data: record_update_params.SSHFPRecordData, name: str, type: Literal["SSHFP"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6452,19 +6460,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsSVCBRecordData, + data: record_update_params.SVCBRecordData, name: str, type: Literal["SVCB"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6510,19 +6518,19 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsTLSARecordData, + data: record_update_params.TLSARecordData, name: str, type: Literal["TLSA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6572,15 +6580,15 @@ async def update( name: str, type: Literal["TXT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6626,20 +6634,20 @@ async def update( dns_record_id: str, *, zone_id: str, - data: record_update_params.DNSRecordsURIRecordData, + data: record_update_params.URIRecordData, name: str, priority: float, type: Literal["URI"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Overwrite an existing DNS record. Notes: @@ -6733,19 +6741,19 @@ async def update( | Literal["URI"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, - data: record_update_params.DNSRecordsCAARecordData - | record_update_params.DNSRecordsCERTRecordData - | record_update_params.DNSRecordsDNSKEYRecordData - | record_update_params.DNSRecordsDSRecordData - | record_update_params.DNSRecordsHTTPSRecordData - | record_update_params.DNSRecordsLOCRecordData - | record_update_params.DNSRecordsNAPTRRecordData - | record_update_params.DNSRecordsSMIMEARecordData - | record_update_params.DNSRecordsSRVRecordData - | record_update_params.DNSRecordsSSHFPRecordData - | record_update_params.DNSRecordsURIRecordData + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | NotGiven = NOT_GIVEN, + data: record_update_params.CAARecordData + | record_update_params.CERTRecordData + | record_update_params.DNSKEYRecordData + | record_update_params.DSRecordData + | record_update_params.HTTPSRecordData + | record_update_params.LOCRecordData + | record_update_params.NAPTRRecordData + | record_update_params.SMIMEARecordData + | record_update_params.SRVRecordData + | record_update_params.SSHFPRecordData + | record_update_params.URIRecordData | 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. @@ -6754,13 +6762,13 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSRecord: + ) -> Optional[Record]: 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( - DNSRecord, + Optional[Record], await self._put( f"/zones/{zone_id}/dns_records/{dns_record_id}", body=await async_maybe_transform( @@ -6782,10 +6790,10 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Record]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[DNSRecord] + Any, ResultWrapper[Record] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -6835,7 +6843,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DNSRecord, AsyncV4PagePaginationArray[DNSRecord]]: + ) -> AsyncPaginator[Record, AsyncV4PagePaginationArray[Record]]: """ List, search, sort, and filter a zones' DNS records. @@ -6887,7 +6895,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[DNSRecord], + page=AsyncV4PagePaginationArray[Record], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -6912,7 +6920,7 @@ def list( record_list_params.RecordListParams, ), ), - model=cast(Any, DNSRecord), # Union types cannot be passed in as arguments in the type system + model=cast(Any, Record), # Union types cannot be passed in as arguments in the type system ) async def delete( @@ -6920,6 +6928,7 @@ async def delete( dns_record_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -6949,12 +6958,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `dns_record_id` but received {dns_record_id!r}") return await self._delete( f"/zones/{zone_id}/dns_records/{dns_record_id}", + body=await async_maybe_transform(body, record_delete_params.RecordDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RecordDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RecordDeleteResponse]], ResultWrapper[RecordDeleteResponse]), ) @@ -6970,15 +6980,15 @@ async def edit( type: Literal["A"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7032,15 +7042,15 @@ async def edit( type: Literal["AAAA"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7089,19 +7099,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsCAARecordData, + data: record_edit_params.CAARecordData, name: str, type: Literal["CAA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7147,19 +7157,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsCERTRecordData, + data: record_edit_params.CERTRecordData, name: str, type: Literal["CERT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7210,15 +7220,15 @@ async def edit( type: Literal["CNAME"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7267,19 +7277,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsDNSKEYRecordData, + data: record_edit_params.DNSKEYRecordData, name: str, type: Literal["DNSKEY"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7325,19 +7335,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsDSRecordData, + data: record_edit_params.DSRecordData, name: str, type: Literal["DS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7383,19 +7393,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsHTTPSRecordData, + data: record_edit_params.HTTPSRecordData, name: str, type: Literal["HTTPS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7441,19 +7451,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsLOCRecordData, + data: record_edit_params.LOCRecordData, name: str, type: Literal["LOC"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7504,15 +7514,15 @@ async def edit( priority: float, type: Literal["MX"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7561,19 +7571,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsNAPTRRecordData, + data: record_edit_params.NAPTRRecordData, name: str, type: Literal["NAPTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7623,15 +7633,15 @@ async def edit( name: str, type: Literal["NS"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7681,15 +7691,15 @@ async def edit( name: str, type: Literal["PTR"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7735,19 +7745,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsSMIMEARecordData, + data: record_edit_params.SMIMEARecordData, name: str, type: Literal["SMIMEA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7793,19 +7803,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsSRVRecordData, + data: record_edit_params.SRVRecordData, name: str, type: Literal["SRV"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7853,19 +7863,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsSSHFPRecordData, + data: record_edit_params.SSHFPRecordData, name: str, type: Literal["SSHFP"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7911,19 +7921,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsSVCBRecordData, + data: record_edit_params.SVCBRecordData, name: str, type: Literal["SVCB"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -7969,19 +7979,19 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsTLSARecordData, + data: record_edit_params.TLSARecordData, name: str, type: Literal["TLSA"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -8031,15 +8041,15 @@ async def edit( name: str, type: Literal["TXT"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -8085,20 +8095,20 @@ async def edit( dns_record_id: str, *, zone_id: str, - data: record_edit_params.DNSRecordsURIRecordData, + data: record_edit_params.URIRecordData, name: str, priority: float, type: Literal["URI"], comment: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | 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, - ) -> DNSRecord: + ) -> Optional[Record]: """Update an existing DNS record. Notes: @@ -8192,19 +8202,19 @@ async def edit( | Literal["URI"], comment: str | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, - ttl: Union[float, Literal[1]] | NotGiven = NOT_GIVEN, - data: record_edit_params.DNSRecordsCAARecordData - | record_edit_params.DNSRecordsCERTRecordData - | record_edit_params.DNSRecordsDNSKEYRecordData - | record_edit_params.DNSRecordsDSRecordData - | record_edit_params.DNSRecordsHTTPSRecordData - | record_edit_params.DNSRecordsLOCRecordData - | record_edit_params.DNSRecordsNAPTRRecordData - | record_edit_params.DNSRecordsSMIMEARecordData - | record_edit_params.DNSRecordsSRVRecordData - | record_edit_params.DNSRecordsSSHFPRecordData - | record_edit_params.DNSRecordsURIRecordData + tags: List[RecordTags] | NotGiven = NOT_GIVEN, + ttl: TTLParam | NotGiven = NOT_GIVEN, + data: record_edit_params.CAARecordData + | record_edit_params.CERTRecordData + | record_edit_params.DNSKEYRecordData + | record_edit_params.DSRecordData + | record_edit_params.HTTPSRecordData + | record_edit_params.LOCRecordData + | record_edit_params.NAPTRRecordData + | record_edit_params.SMIMEARecordData + | record_edit_params.SRVRecordData + | record_edit_params.SSHFPRecordData + | record_edit_params.URIRecordData | 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. @@ -8213,13 +8223,13 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSRecord: + ) -> Optional[Record]: 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( - DNSRecord, + Optional[Record], await self._patch( f"/zones/{zone_id}/dns_records/{dns_record_id}", body=await async_maybe_transform( @@ -8241,10 +8251,10 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Record]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[DNSRecord] + Any, ResultWrapper[Record] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -8302,7 +8312,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSRecord: + ) -> Optional[Record]: """ DNS Record Details @@ -8324,7 +8334,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( - DNSRecord, + Optional[Record], await self._get( f"/zones/{zone_id}/dns_records/{dns_record_id}", options=make_request_options( @@ -8332,10 +8342,10 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Record]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[DNSRecord] + Any, ResultWrapper[Record] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -8352,7 +8362,7 @@ async def import_( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RecordImportResponse: + ) -> Optional[RecordImportResponse]: """ You can upload your [BIND config](https://en.wikipedia.org/wiki/Zone_file "Zone file") through this @@ -8400,22 +8410,23 @@ async def import_( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RecordImportResponse]]._unwrapper, ), - cast_to=cast(Type[RecordImportResponse], ResultWrapper[RecordImportResponse]), + cast_to=cast(Type[Optional[RecordImportResponse]], ResultWrapper[RecordImportResponse]), ) async def scan( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> RecordScanResponse: + ) -> Optional[RecordScanResponse]: """ Scan for common DNS records on your domain and automatically add them to your zone. Useful if you haven't updated your nameservers yet. @@ -8435,19 +8446,20 @@ async def scan( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._post( f"/zones/{zone_id}/dns_records/scan", + body=await async_maybe_transform(body, record_scan_params.RecordScanParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RecordScanResponse]]._unwrapper, ), - cast_to=cast(Type[RecordScanResponse], ResultWrapper[RecordScanResponse]), + cast_to=cast(Type[Optional[RecordScanResponse]], ResultWrapper[RecordScanResponse]), ) -class RecordsWithRawResponse: - def __init__(self, records: Records) -> None: +class RecordsResourceWithRawResponse: + def __init__(self, records: RecordsResource) -> None: self._records = records self.create = to_raw_response_wrapper( @@ -8479,8 +8491,8 @@ def __init__(self, records: Records) -> None: ) -class AsyncRecordsWithRawResponse: - def __init__(self, records: AsyncRecords) -> None: +class AsyncRecordsResourceWithRawResponse: + def __init__(self, records: AsyncRecordsResource) -> None: self._records = records self.create = async_to_raw_response_wrapper( @@ -8512,8 +8524,8 @@ def __init__(self, records: AsyncRecords) -> None: ) -class RecordsWithStreamingResponse: - def __init__(self, records: Records) -> None: +class RecordsResourceWithStreamingResponse: + def __init__(self, records: RecordsResource) -> None: self._records = records self.create = to_streamed_response_wrapper( @@ -8545,8 +8557,8 @@ def __init__(self, records: Records) -> None: ) -class AsyncRecordsWithStreamingResponse: - def __init__(self, records: AsyncRecords) -> None: +class AsyncRecordsResourceWithStreamingResponse: + def __init__(self, records: AsyncRecordsResource) -> None: self._records = records self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/dnssec.py b/src/cloudflare/resources/dnssec.py index c8799dab26a..e4e171d640a 100644 --- a/src/cloudflare/resources/dnssec.py +++ b/src/cloudflare/resources/dnssec.py @@ -2,12 +2,11 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Any, Type, Optional, cast from typing_extensions import Literal import httpx -from ..types import DNSSEC, DNSSECDeleteResponse, dnssec_edit_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -25,6 +24,9 @@ from .._base_client import ( make_request_options, ) +from ..types.dnssec import dnssec_edit_params, dnssec_delete_params +from ..types.dnssec.dnssec import DNSSEC +from ..types.dnssec.dnssec_delete_response import DNSSECDeleteResponse __all__ = ["DNSSECResource", "AsyncDNSSECResource"] @@ -42,13 +44,14 @@ def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> DNSSECDeleteResponse: + ) -> Optional[DNSSECDeleteResponse]: """ Delete DNSSEC. @@ -66,15 +69,16 @@ def delete( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - DNSSECDeleteResponse, + Optional[DNSSECDeleteResponse], self._delete( f"/zones/{zone_id}/dnssec", + body=maybe_transform(body, dnssec_delete_params.DNSSECDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DNSSECDeleteResponse] @@ -95,7 +99,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSSEC: + ) -> Optional[DNSSEC]: """ Enable or disable DNSSEC. @@ -146,9 +150,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSEC]]._unwrapper, ), - cast_to=cast(Type[DNSSEC], ResultWrapper[DNSSEC]), + cast_to=cast(Type[Optional[DNSSEC]], ResultWrapper[DNSSEC]), ) def get( @@ -161,7 +165,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSSEC: + ) -> Optional[DNSSEC]: """ Details about DNSSEC status and configuration. @@ -185,9 +189,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSEC]]._unwrapper, ), - cast_to=cast(Type[DNSSEC], ResultWrapper[DNSSEC]), + cast_to=cast(Type[Optional[DNSSEC]], ResultWrapper[DNSSEC]), ) @@ -204,13 +208,14 @@ async def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> DNSSECDeleteResponse: + ) -> Optional[DNSSECDeleteResponse]: """ Delete DNSSEC. @@ -228,15 +233,16 @@ async def delete( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - DNSSECDeleteResponse, + Optional[DNSSECDeleteResponse], await self._delete( f"/zones/{zone_id}/dnssec", + body=await async_maybe_transform(body, dnssec_delete_params.DNSSECDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DNSSECDeleteResponse] @@ -257,7 +263,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSSEC: + ) -> Optional[DNSSEC]: """ Enable or disable DNSSEC. @@ -308,9 +314,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSEC]]._unwrapper, ), - cast_to=cast(Type[DNSSEC], ResultWrapper[DNSSEC]), + cast_to=cast(Type[Optional[DNSSEC]], ResultWrapper[DNSSEC]), ) async def get( @@ -323,7 +329,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSSEC: + ) -> Optional[DNSSEC]: """ Details about DNSSEC status and configuration. @@ -347,9 +353,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSEC]]._unwrapper, ), - cast_to=cast(Type[DNSSEC], ResultWrapper[DNSSEC]), + cast_to=cast(Type[Optional[DNSSEC]], ResultWrapper[DNSSEC]), ) diff --git a/src/cloudflare/resources/durable_objects/__init__.py b/src/cloudflare/resources/durable_objects/__init__.py index ec81e2e6c90..749de3c93ef 100644 --- a/src/cloudflare/resources/durable_objects/__init__.py +++ b/src/cloudflare/resources/durable_objects/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) from .durable_objects import ( - DurableObjects, - AsyncDurableObjects, - DurableObjectsWithRawResponse, - AsyncDurableObjectsWithRawResponse, - DurableObjectsWithStreamingResponse, - AsyncDurableObjectsWithStreamingResponse, + DurableObjectsResource, + AsyncDurableObjectsResource, + DurableObjectsResourceWithRawResponse, + AsyncDurableObjectsResourceWithRawResponse, + DurableObjectsResourceWithStreamingResponse, + AsyncDurableObjectsResourceWithStreamingResponse, ) __all__ = [ - "Namespaces", - "AsyncNamespaces", - "NamespacesWithRawResponse", - "AsyncNamespacesWithRawResponse", - "NamespacesWithStreamingResponse", - "AsyncNamespacesWithStreamingResponse", - "DurableObjects", - "AsyncDurableObjects", - "DurableObjectsWithRawResponse", - "AsyncDurableObjectsWithRawResponse", - "DurableObjectsWithStreamingResponse", - "AsyncDurableObjectsWithStreamingResponse", + "NamespacesResource", + "AsyncNamespacesResource", + "NamespacesResourceWithRawResponse", + "AsyncNamespacesResourceWithRawResponse", + "NamespacesResourceWithStreamingResponse", + "AsyncNamespacesResourceWithStreamingResponse", + "DurableObjectsResource", + "AsyncDurableObjectsResource", + "DurableObjectsResourceWithRawResponse", + "AsyncDurableObjectsResourceWithRawResponse", + "DurableObjectsResourceWithStreamingResponse", + "AsyncDurableObjectsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/durable_objects/durable_objects.py b/src/cloudflare/resources/durable_objects/durable_objects.py index aaa65e00ece..97f13cd09ec 100644 --- a/src/cloudflare/resources/durable_objects/durable_objects.py +++ b/src/cloudflare/resources/durable_objects/durable_objects.py @@ -4,78 +4,78 @@ from ..._compat import cached_property from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .namespaces.namespaces import Namespaces, AsyncNamespaces +from .namespaces.namespaces import NamespacesResource, AsyncNamespacesResource -__all__ = ["DurableObjects", "AsyncDurableObjects"] +__all__ = ["DurableObjectsResource", "AsyncDurableObjectsResource"] -class DurableObjects(SyncAPIResource): +class DurableObjectsResource(SyncAPIResource): @cached_property - def namespaces(self) -> Namespaces: - return Namespaces(self._client) + def namespaces(self) -> NamespacesResource: + return NamespacesResource(self._client) @cached_property - def with_raw_response(self) -> DurableObjectsWithRawResponse: - return DurableObjectsWithRawResponse(self) + def with_raw_response(self) -> DurableObjectsResourceWithRawResponse: + return DurableObjectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DurableObjectsWithStreamingResponse: - return DurableObjectsWithStreamingResponse(self) + def with_streaming_response(self) -> DurableObjectsResourceWithStreamingResponse: + return DurableObjectsResourceWithStreamingResponse(self) -class AsyncDurableObjects(AsyncAPIResource): +class AsyncDurableObjectsResource(AsyncAPIResource): @cached_property - def namespaces(self) -> AsyncNamespaces: - return AsyncNamespaces(self._client) + def namespaces(self) -> AsyncNamespacesResource: + return AsyncNamespacesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDurableObjectsWithRawResponse: - return AsyncDurableObjectsWithRawResponse(self) + def with_raw_response(self) -> AsyncDurableObjectsResourceWithRawResponse: + return AsyncDurableObjectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDurableObjectsWithStreamingResponse: - return AsyncDurableObjectsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDurableObjectsResourceWithStreamingResponse: + return AsyncDurableObjectsResourceWithStreamingResponse(self) -class DurableObjectsWithRawResponse: - def __init__(self, durable_objects: DurableObjects) -> None: +class DurableObjectsResourceWithRawResponse: + def __init__(self, durable_objects: DurableObjectsResource) -> None: self._durable_objects = durable_objects @cached_property - def namespaces(self) -> NamespacesWithRawResponse: - return NamespacesWithRawResponse(self._durable_objects.namespaces) + def namespaces(self) -> NamespacesResourceWithRawResponse: + return NamespacesResourceWithRawResponse(self._durable_objects.namespaces) -class AsyncDurableObjectsWithRawResponse: - def __init__(self, durable_objects: AsyncDurableObjects) -> None: +class AsyncDurableObjectsResourceWithRawResponse: + def __init__(self, durable_objects: AsyncDurableObjectsResource) -> None: self._durable_objects = durable_objects @cached_property - def namespaces(self) -> AsyncNamespacesWithRawResponse: - return AsyncNamespacesWithRawResponse(self._durable_objects.namespaces) + def namespaces(self) -> AsyncNamespacesResourceWithRawResponse: + return AsyncNamespacesResourceWithRawResponse(self._durable_objects.namespaces) -class DurableObjectsWithStreamingResponse: - def __init__(self, durable_objects: DurableObjects) -> None: +class DurableObjectsResourceWithStreamingResponse: + def __init__(self, durable_objects: DurableObjectsResource) -> None: self._durable_objects = durable_objects @cached_property - def namespaces(self) -> NamespacesWithStreamingResponse: - return NamespacesWithStreamingResponse(self._durable_objects.namespaces) + def namespaces(self) -> NamespacesResourceWithStreamingResponse: + return NamespacesResourceWithStreamingResponse(self._durable_objects.namespaces) -class AsyncDurableObjectsWithStreamingResponse: - def __init__(self, durable_objects: AsyncDurableObjects) -> None: +class AsyncDurableObjectsResourceWithStreamingResponse: + def __init__(self, durable_objects: AsyncDurableObjectsResource) -> None: self._durable_objects = durable_objects @cached_property - def namespaces(self) -> AsyncNamespacesWithStreamingResponse: - return AsyncNamespacesWithStreamingResponse(self._durable_objects.namespaces) + def namespaces(self) -> AsyncNamespacesResourceWithStreamingResponse: + return AsyncNamespacesResourceWithStreamingResponse(self._durable_objects.namespaces) diff --git a/src/cloudflare/resources/durable_objects/namespaces/__init__.py b/src/cloudflare/resources/durable_objects/namespaces/__init__.py index bdf063f1b89..80b5be8b768 100644 --- a/src/cloudflare/resources/durable_objects/namespaces/__init__.py +++ b/src/cloudflare/resources/durable_objects/namespaces/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .objects import ( - Objects, - AsyncObjects, - ObjectsWithRawResponse, - AsyncObjectsWithRawResponse, - ObjectsWithStreamingResponse, - AsyncObjectsWithStreamingResponse, + ObjectsResource, + AsyncObjectsResource, + ObjectsResourceWithRawResponse, + AsyncObjectsResourceWithRawResponse, + ObjectsResourceWithStreamingResponse, + AsyncObjectsResourceWithStreamingResponse, ) from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) __all__ = [ - "Objects", - "AsyncObjects", - "ObjectsWithRawResponse", - "AsyncObjectsWithRawResponse", - "ObjectsWithStreamingResponse", - "AsyncObjectsWithStreamingResponse", - "Namespaces", - "AsyncNamespaces", - "NamespacesWithRawResponse", - "AsyncNamespacesWithRawResponse", - "NamespacesWithStreamingResponse", - "AsyncNamespacesWithStreamingResponse", + "ObjectsResource", + "AsyncObjectsResource", + "ObjectsResourceWithRawResponse", + "AsyncObjectsResourceWithRawResponse", + "ObjectsResourceWithStreamingResponse", + "AsyncObjectsResourceWithStreamingResponse", + "NamespacesResource", + "AsyncNamespacesResource", + "NamespacesResourceWithRawResponse", + "AsyncNamespacesResourceWithRawResponse", + "NamespacesResourceWithStreamingResponse", + "AsyncNamespacesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/durable_objects/namespaces/namespaces.py b/src/cloudflare/resources/durable_objects/namespaces/namespaces.py index a46939676e7..7c8870332a3 100644 --- a/src/cloudflare/resources/durable_objects/namespaces/namespaces.py +++ b/src/cloudflare/resources/durable_objects/namespaces/namespaces.py @@ -5,12 +5,12 @@ import httpx from .objects import ( - Objects, - AsyncObjects, - ObjectsWithRawResponse, - AsyncObjectsWithRawResponse, - ObjectsWithStreamingResponse, - AsyncObjectsWithStreamingResponse, + ObjectsResource, + AsyncObjectsResource, + ObjectsResourceWithRawResponse, + AsyncObjectsResourceWithRawResponse, + ObjectsResourceWithStreamingResponse, + AsyncObjectsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._compat import cached_property @@ -26,23 +26,23 @@ AsyncPaginator, make_request_options, ) -from ....types.durable_objects import DurableObjectNamespace +from ....types.durable_objects.namespace import Namespace -__all__ = ["Namespaces", "AsyncNamespaces"] +__all__ = ["NamespacesResource", "AsyncNamespacesResource"] -class Namespaces(SyncAPIResource): +class NamespacesResource(SyncAPIResource): @cached_property - def objects(self) -> Objects: - return Objects(self._client) + def objects(self) -> ObjectsResource: + return ObjectsResource(self._client) @cached_property - def with_raw_response(self) -> NamespacesWithRawResponse: - return NamespacesWithRawResponse(self) + def with_raw_response(self) -> NamespacesResourceWithRawResponse: + return NamespacesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NamespacesWithStreamingResponse: - return NamespacesWithStreamingResponse(self) + def with_streaming_response(self) -> NamespacesResourceWithStreamingResponse: + return NamespacesResourceWithStreamingResponse(self) def list( self, @@ -54,7 +54,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DurableObjectNamespace]: + ) -> SyncSinglePage[Namespace]: """ Returns the Durable Object namespaces owned by an account. @@ -73,26 +73,26 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/workers/durable_objects/namespaces", - page=SyncSinglePage[DurableObjectNamespace], + page=SyncSinglePage[Namespace], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DurableObjectNamespace, + model=Namespace, ) -class AsyncNamespaces(AsyncAPIResource): +class AsyncNamespacesResource(AsyncAPIResource): @cached_property - def objects(self) -> AsyncObjects: - return AsyncObjects(self._client) + def objects(self) -> AsyncObjectsResource: + return AsyncObjectsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncNamespacesWithRawResponse: - return AsyncNamespacesWithRawResponse(self) + def with_raw_response(self) -> AsyncNamespacesResourceWithRawResponse: + return AsyncNamespacesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNamespacesWithStreamingResponse: - return AsyncNamespacesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNamespacesResourceWithStreamingResponse: + return AsyncNamespacesResourceWithStreamingResponse(self) def list( self, @@ -104,7 +104,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DurableObjectNamespace, AsyncSinglePage[DurableObjectNamespace]]: + ) -> AsyncPaginator[Namespace, AsyncSinglePage[Namespace]]: """ Returns the Durable Object namespaces owned by an account. @@ -123,16 +123,16 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/workers/durable_objects/namespaces", - page=AsyncSinglePage[DurableObjectNamespace], + page=AsyncSinglePage[Namespace], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DurableObjectNamespace, + model=Namespace, ) -class NamespacesWithRawResponse: - def __init__(self, namespaces: Namespaces) -> None: +class NamespacesResourceWithRawResponse: + def __init__(self, namespaces: NamespacesResource) -> None: self._namespaces = namespaces self.list = to_raw_response_wrapper( @@ -140,12 +140,12 @@ def __init__(self, namespaces: Namespaces) -> None: ) @cached_property - def objects(self) -> ObjectsWithRawResponse: - return ObjectsWithRawResponse(self._namespaces.objects) + def objects(self) -> ObjectsResourceWithRawResponse: + return ObjectsResourceWithRawResponse(self._namespaces.objects) -class AsyncNamespacesWithRawResponse: - def __init__(self, namespaces: AsyncNamespaces) -> None: +class AsyncNamespacesResourceWithRawResponse: + def __init__(self, namespaces: AsyncNamespacesResource) -> None: self._namespaces = namespaces self.list = async_to_raw_response_wrapper( @@ -153,12 +153,12 @@ def __init__(self, namespaces: AsyncNamespaces) -> None: ) @cached_property - def objects(self) -> AsyncObjectsWithRawResponse: - return AsyncObjectsWithRawResponse(self._namespaces.objects) + def objects(self) -> AsyncObjectsResourceWithRawResponse: + return AsyncObjectsResourceWithRawResponse(self._namespaces.objects) -class NamespacesWithStreamingResponse: - def __init__(self, namespaces: Namespaces) -> None: +class NamespacesResourceWithStreamingResponse: + def __init__(self, namespaces: NamespacesResource) -> None: self._namespaces = namespaces self.list = to_streamed_response_wrapper( @@ -166,12 +166,12 @@ def __init__(self, namespaces: Namespaces) -> None: ) @cached_property - def objects(self) -> ObjectsWithStreamingResponse: - return ObjectsWithStreamingResponse(self._namespaces.objects) + def objects(self) -> ObjectsResourceWithStreamingResponse: + return ObjectsResourceWithStreamingResponse(self._namespaces.objects) -class AsyncNamespacesWithStreamingResponse: - def __init__(self, namespaces: AsyncNamespaces) -> None: +class AsyncNamespacesResourceWithStreamingResponse: + def __init__(self, namespaces: AsyncNamespacesResource) -> None: self._namespaces = namespaces self.list = async_to_streamed_response_wrapper( @@ -179,5 +179,5 @@ def __init__(self, namespaces: AsyncNamespaces) -> None: ) @cached_property - def objects(self) -> AsyncObjectsWithStreamingResponse: - return AsyncObjectsWithStreamingResponse(self._namespaces.objects) + def objects(self) -> AsyncObjectsResourceWithStreamingResponse: + return AsyncObjectsResourceWithStreamingResponse(self._namespaces.objects) diff --git a/src/cloudflare/resources/durable_objects/namespaces/objects.py b/src/cloudflare/resources/durable_objects/namespaces/objects.py index 721e40b19d4..0c05a216f24 100644 --- a/src/cloudflare/resources/durable_objects/namespaces/objects.py +++ b/src/cloudflare/resources/durable_objects/namespaces/objects.py @@ -19,19 +19,20 @@ AsyncPaginator, make_request_options, ) -from ....types.durable_objects.namespaces import DurableObject, object_list_params +from ....types.durable_objects.namespaces import object_list_params +from ....types.durable_objects.namespaces.durable_object import DurableObject -__all__ = ["Objects", "AsyncObjects"] +__all__ = ["ObjectsResource", "AsyncObjectsResource"] -class Objects(SyncAPIResource): +class ObjectsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ObjectsWithRawResponse: - return ObjectsWithRawResponse(self) + def with_raw_response(self) -> ObjectsResourceWithRawResponse: + return ObjectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ObjectsWithStreamingResponse: - return ObjectsWithStreamingResponse(self) + def with_streaming_response(self) -> ObjectsResourceWithStreamingResponse: + return ObjectsResourceWithStreamingResponse(self) def list( self, @@ -94,14 +95,14 @@ def list( ) -class AsyncObjects(AsyncAPIResource): +class AsyncObjectsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncObjectsWithRawResponse: - return AsyncObjectsWithRawResponse(self) + def with_raw_response(self) -> AsyncObjectsResourceWithRawResponse: + return AsyncObjectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncObjectsWithStreamingResponse: - return AsyncObjectsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncObjectsResourceWithStreamingResponse: + return AsyncObjectsResourceWithStreamingResponse(self) def list( self, @@ -164,8 +165,8 @@ def list( ) -class ObjectsWithRawResponse: - def __init__(self, objects: Objects) -> None: +class ObjectsResourceWithRawResponse: + def __init__(self, objects: ObjectsResource) -> None: self._objects = objects self.list = to_raw_response_wrapper( @@ -173,8 +174,8 @@ def __init__(self, objects: Objects) -> None: ) -class AsyncObjectsWithRawResponse: - def __init__(self, objects: AsyncObjects) -> None: +class AsyncObjectsResourceWithRawResponse: + def __init__(self, objects: AsyncObjectsResource) -> None: self._objects = objects self.list = async_to_raw_response_wrapper( @@ -182,8 +183,8 @@ def __init__(self, objects: AsyncObjects) -> None: ) -class ObjectsWithStreamingResponse: - def __init__(self, objects: Objects) -> None: +class ObjectsResourceWithStreamingResponse: + def __init__(self, objects: ObjectsResource) -> None: self._objects = objects self.list = to_streamed_response_wrapper( @@ -191,8 +192,8 @@ def __init__(self, objects: Objects) -> None: ) -class AsyncObjectsWithStreamingResponse: - def __init__(self, objects: AsyncObjects) -> None: +class AsyncObjectsResourceWithStreamingResponse: + def __init__(self, objects: AsyncObjectsResource) -> None: self._objects = objects self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/email_routing/__init__.py b/src/cloudflare/resources/email_routing/__init__.py index b7bd0fb42fa..687b7186276 100644 --- a/src/cloudflare/resources/email_routing/__init__.py +++ b/src/cloudflare/resources/email_routing/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .addresses import ( - Addresses, - AsyncAddresses, - AddressesWithRawResponse, - AsyncAddressesWithRawResponse, - AddressesWithStreamingResponse, - AsyncAddressesWithStreamingResponse, + AddressesResource, + AsyncAddressesResource, + AddressesResourceWithRawResponse, + AsyncAddressesResourceWithRawResponse, + AddressesResourceWithStreamingResponse, + AsyncAddressesResourceWithStreamingResponse, ) from .email_routing import ( - EmailRouting, - AsyncEmailRouting, - EmailRoutingWithRawResponse, - AsyncEmailRoutingWithRawResponse, - EmailRoutingWithStreamingResponse, - AsyncEmailRoutingWithStreamingResponse, + EmailRoutingResource, + AsyncEmailRoutingResource, + EmailRoutingResourceWithRawResponse, + AsyncEmailRoutingResourceWithRawResponse, + EmailRoutingResourceWithStreamingResponse, + AsyncEmailRoutingResourceWithStreamingResponse, ) __all__ = [ - "DNS", - "AsyncDNS", - "DNSWithRawResponse", - "AsyncDNSWithRawResponse", - "DNSWithStreamingResponse", - "AsyncDNSWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "Addresses", - "AsyncAddresses", - "AddressesWithRawResponse", - "AsyncAddressesWithRawResponse", - "AddressesWithStreamingResponse", - "AsyncAddressesWithStreamingResponse", - "EmailRouting", - "AsyncEmailRouting", - "EmailRoutingWithRawResponse", - "AsyncEmailRoutingWithRawResponse", - "EmailRoutingWithStreamingResponse", - "AsyncEmailRoutingWithStreamingResponse", + "DNSResource", + "AsyncDNSResource", + "DNSResourceWithRawResponse", + "AsyncDNSResourceWithRawResponse", + "DNSResourceWithStreamingResponse", + "AsyncDNSResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "AddressesResource", + "AsyncAddressesResource", + "AddressesResourceWithRawResponse", + "AsyncAddressesResourceWithRawResponse", + "AddressesResourceWithStreamingResponse", + "AsyncAddressesResourceWithStreamingResponse", + "EmailRoutingResource", + "AsyncEmailRoutingResource", + "EmailRoutingResourceWithRawResponse", + "AsyncEmailRoutingResourceWithRawResponse", + "EmailRoutingResourceWithStreamingResponse", + "AsyncEmailRoutingResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/email_routing/addresses.py b/src/cloudflare/resources/email_routing/addresses.py index b810ed54eaf..8af8920e626 100644 --- a/src/cloudflare/resources/email_routing/addresses.py +++ b/src/cloudflare/resources/email_routing/addresses.py @@ -26,26 +26,20 @@ AsyncPaginator, make_request_options, ) -from ...types.email_routing import ( - AddressGetResponse, - AddressListResponse, - AddressCreateResponse, - AddressDeleteResponse, - address_list_params, - address_create_params, -) +from ...types.email_routing import address_list_params, address_create_params +from ...types.email_routing.address import Address -__all__ = ["Addresses", "AsyncAddresses"] +__all__ = ["AddressesResource", "AsyncAddressesResource"] -class Addresses(SyncAPIResource): +class AddressesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AddressesWithRawResponse: - return AddressesWithRawResponse(self) + def with_raw_response(self) -> AddressesResourceWithRawResponse: + return AddressesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AddressesWithStreamingResponse: - return AddressesWithStreamingResponse(self) + def with_streaming_response(self) -> AddressesResourceWithStreamingResponse: + return AddressesResourceWithStreamingResponse(self) def create( self, @@ -58,7 +52,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressCreateResponse: + ) -> Address: """Create a destination address to forward your emails to. Destination addresses @@ -87,9 +81,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Address]._unwrapper, ), - cast_to=cast(Type[AddressCreateResponse], ResultWrapper[AddressCreateResponse]), + cast_to=cast(Type[Address], ResultWrapper[Address]), ) def list( @@ -106,7 +100,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AddressListResponse]: + ) -> SyncV4PagePaginationArray[Address]: """ Lists existing destination addresses. @@ -133,7 +127,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/email/routing/addresses", - page=SyncV4PagePaginationArray[AddressListResponse], + page=SyncV4PagePaginationArray[Address], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -149,7 +143,7 @@ def list( address_list_params.AddressListParams, ), ), - model=AddressListResponse, + model=Address, ) def delete( @@ -163,7 +157,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressDeleteResponse: + ) -> Address: """ Deletes a specific destination address. @@ -193,9 +187,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Address]._unwrapper, ), - cast_to=cast(Type[AddressDeleteResponse], ResultWrapper[AddressDeleteResponse]), + cast_to=cast(Type[Address], ResultWrapper[Address]), ) def get( @@ -209,7 +203,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressGetResponse: + ) -> Address: """ Gets information for a specific destination email already created. @@ -239,20 +233,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Address]._unwrapper, ), - cast_to=cast(Type[AddressGetResponse], ResultWrapper[AddressGetResponse]), + cast_to=cast(Type[Address], ResultWrapper[Address]), ) -class AsyncAddresses(AsyncAPIResource): +class AsyncAddressesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAddressesWithRawResponse: - return AsyncAddressesWithRawResponse(self) + def with_raw_response(self) -> AsyncAddressesResourceWithRawResponse: + return AsyncAddressesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAddressesWithStreamingResponse: - return AsyncAddressesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAddressesResourceWithStreamingResponse: + return AsyncAddressesResourceWithStreamingResponse(self) async def create( self, @@ -265,7 +259,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressCreateResponse: + ) -> Address: """Create a destination address to forward your emails to. Destination addresses @@ -294,9 +288,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Address]._unwrapper, ), - cast_to=cast(Type[AddressCreateResponse], ResultWrapper[AddressCreateResponse]), + cast_to=cast(Type[Address], ResultWrapper[Address]), ) def list( @@ -313,7 +307,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AddressListResponse, AsyncV4PagePaginationArray[AddressListResponse]]: + ) -> AsyncPaginator[Address, AsyncV4PagePaginationArray[Address]]: """ Lists existing destination addresses. @@ -340,7 +334,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/email/routing/addresses", - page=AsyncV4PagePaginationArray[AddressListResponse], + page=AsyncV4PagePaginationArray[Address], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -356,7 +350,7 @@ def list( address_list_params.AddressListParams, ), ), - model=AddressListResponse, + model=Address, ) async def delete( @@ -370,7 +364,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressDeleteResponse: + ) -> Address: """ Deletes a specific destination address. @@ -400,9 +394,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Address]._unwrapper, ), - cast_to=cast(Type[AddressDeleteResponse], ResultWrapper[AddressDeleteResponse]), + cast_to=cast(Type[Address], ResultWrapper[Address]), ) async def get( @@ -416,7 +410,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressGetResponse: + ) -> Address: """ Gets information for a specific destination email already created. @@ -446,14 +440,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Address]._unwrapper, ), - cast_to=cast(Type[AddressGetResponse], ResultWrapper[AddressGetResponse]), + cast_to=cast(Type[Address], ResultWrapper[Address]), ) -class AddressesWithRawResponse: - def __init__(self, addresses: Addresses) -> None: +class AddressesResourceWithRawResponse: + def __init__(self, addresses: AddressesResource) -> None: self._addresses = addresses self.create = to_raw_response_wrapper( @@ -470,8 +464,8 @@ def __init__(self, addresses: Addresses) -> None: ) -class AsyncAddressesWithRawResponse: - def __init__(self, addresses: AsyncAddresses) -> None: +class AsyncAddressesResourceWithRawResponse: + def __init__(self, addresses: AsyncAddressesResource) -> None: self._addresses = addresses self.create = async_to_raw_response_wrapper( @@ -488,8 +482,8 @@ def __init__(self, addresses: AsyncAddresses) -> None: ) -class AddressesWithStreamingResponse: - def __init__(self, addresses: Addresses) -> None: +class AddressesResourceWithStreamingResponse: + def __init__(self, addresses: AddressesResource) -> None: self._addresses = addresses self.create = to_streamed_response_wrapper( @@ -506,8 +500,8 @@ def __init__(self, addresses: Addresses) -> None: ) -class AsyncAddressesWithStreamingResponse: - def __init__(self, addresses: AsyncAddresses) -> None: +class AsyncAddressesResourceWithStreamingResponse: + def __init__(self, addresses: AsyncAddressesResource) -> None: self._addresses = addresses self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/email_routing/dns.py b/src/cloudflare/resources/email_routing/dns.py index 0ee6ff2fb7b..7e438437227 100644 --- a/src/cloudflare/resources/email_routing/dns.py +++ b/src/cloudflare/resources/email_routing/dns.py @@ -19,19 +19,19 @@ from ..._base_client import ( make_request_options, ) -from ...types.email_routing import DNSGetResponse +from ...types.email_routing.dns_get_response import DNSGetResponse -__all__ = ["DNS", "AsyncDNS"] +__all__ = ["DNSResource", "AsyncDNSResource"] -class DNS(SyncAPIResource): +class DNSResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DNSWithRawResponse: - return DNSWithRawResponse(self) + def with_raw_response(self) -> DNSResourceWithRawResponse: + return DNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DNSWithStreamingResponse: - return DNSWithStreamingResponse(self) + def with_streaming_response(self) -> DNSResourceWithStreamingResponse: + return DNSResourceWithStreamingResponse(self) def get( self, @@ -67,20 +67,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[DNSGetResponse]], ResultWrapper[DNSGetResponse]), ) -class AsyncDNS(AsyncAPIResource): +class AsyncDNSResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDNSWithRawResponse: - return AsyncDNSWithRawResponse(self) + def with_raw_response(self) -> AsyncDNSResourceWithRawResponse: + return AsyncDNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDNSWithStreamingResponse: - return AsyncDNSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDNSResourceWithStreamingResponse: + return AsyncDNSResourceWithStreamingResponse(self) async def get( self, @@ -116,14 +116,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[DNSGetResponse]], ResultWrapper[DNSGetResponse]), ) -class DNSWithRawResponse: - def __init__(self, dns: DNS) -> None: +class DNSResourceWithRawResponse: + def __init__(self, dns: DNSResource) -> None: self._dns = dns self.get = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, dns: DNS) -> None: ) -class AsyncDNSWithRawResponse: - def __init__(self, dns: AsyncDNS) -> None: +class AsyncDNSResourceWithRawResponse: + def __init__(self, dns: AsyncDNSResource) -> None: self._dns = dns self.get = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, dns: AsyncDNS) -> None: ) -class DNSWithStreamingResponse: - def __init__(self, dns: DNS) -> None: +class DNSResourceWithStreamingResponse: + def __init__(self, dns: DNSResource) -> None: self._dns = dns self.get = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, dns: DNS) -> None: ) -class AsyncDNSWithStreamingResponse: - def __init__(self, dns: AsyncDNS) -> None: +class AsyncDNSResourceWithStreamingResponse: + def __init__(self, dns: AsyncDNSResource) -> None: self._dns = dns self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/email_routing/email_routing.py b/src/cloudflare/resources/email_routing/email_routing.py index c4c10871fcb..1a6ba8f71e0 100644 --- a/src/cloudflare/resources/email_routing/email_routing.py +++ b/src/cloudflare/resources/email_routing/email_routing.py @@ -7,31 +7,34 @@ import httpx from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) -from ...types import EmailRoutingGetResponse, EmailRoutingEnableResponse, EmailRoutingDisableResponse from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) from ..._compat import cached_property from .addresses import ( - Addresses, - AsyncAddresses, - AddressesWithRawResponse, - AsyncAddressesWithRawResponse, - AddressesWithStreamingResponse, - AsyncAddressesWithStreamingResponse, + AddressesResource, + AsyncAddressesResource, + AddressesResourceWithRawResponse, + AsyncAddressesResourceWithRawResponse, + AddressesResourceWithStreamingResponse, + AsyncAddressesResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -41,46 +44,49 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from .rules.rules import Rules, AsyncRules +from .rules.rules import RulesResource, AsyncRulesResource from ..._base_client import ( make_request_options, ) +from ...types.email_routing import email_routing_enable_params, email_routing_disable_params +from ...types.email_routing.settings import Settings -__all__ = ["EmailRouting", "AsyncEmailRouting"] +__all__ = ["EmailRoutingResource", "AsyncEmailRoutingResource"] -class EmailRouting(SyncAPIResource): +class EmailRoutingResource(SyncAPIResource): @cached_property - def dns(self) -> DNS: - return DNS(self._client) + def dns(self) -> DNSResource: + return DNSResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def addresses(self) -> Addresses: - return Addresses(self._client) + def addresses(self) -> AddressesResource: + return AddressesResource(self._client) @cached_property - def with_raw_response(self) -> EmailRoutingWithRawResponse: - return EmailRoutingWithRawResponse(self) + def with_raw_response(self) -> EmailRoutingResourceWithRawResponse: + return EmailRoutingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EmailRoutingWithStreamingResponse: - return EmailRoutingWithStreamingResponse(self) + def with_streaming_response(self) -> EmailRoutingResourceWithStreamingResponse: + return EmailRoutingResourceWithStreamingResponse(self) def disable( self, zone_identifier: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> EmailRoutingDisableResponse: + ) -> Settings: """Disable your Email Routing zone. Also removes additional MX records previously @@ -101,27 +107,29 @@ def disable( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._post( f"/zones/{zone_identifier}/email/routing/disable", + body=maybe_transform(body, email_routing_disable_params.EmailRoutingDisableParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Settings]._unwrapper, ), - cast_to=cast(Type[EmailRoutingDisableResponse], ResultWrapper[EmailRoutingDisableResponse]), + cast_to=cast(Type[Settings], ResultWrapper[Settings]), ) def enable( self, zone_identifier: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> EmailRoutingEnableResponse: + ) -> Settings: """Enable you Email Routing zone. Add and lock the necessary MX and SPF records. @@ -141,14 +149,15 @@ def enable( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._post( f"/zones/{zone_identifier}/email/routing/enable", + body=maybe_transform(body, email_routing_enable_params.EmailRoutingEnableParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Settings]._unwrapper, ), - cast_to=cast(Type[EmailRoutingEnableResponse], ResultWrapper[EmailRoutingEnableResponse]), + cast_to=cast(Type[Settings], ResultWrapper[Settings]), ) def get( @@ -161,7 +170,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingGetResponse: + ) -> Settings: """ Get information about the settings for your Email Routing zone. @@ -185,44 +194,45 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Settings]._unwrapper, ), - cast_to=cast(Type[EmailRoutingGetResponse], ResultWrapper[EmailRoutingGetResponse]), + cast_to=cast(Type[Settings], ResultWrapper[Settings]), ) -class AsyncEmailRouting(AsyncAPIResource): +class AsyncEmailRoutingResource(AsyncAPIResource): @cached_property - def dns(self) -> AsyncDNS: - return AsyncDNS(self._client) + def dns(self) -> AsyncDNSResource: + return AsyncDNSResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def addresses(self) -> AsyncAddresses: - return AsyncAddresses(self._client) + def addresses(self) -> AsyncAddressesResource: + return AsyncAddressesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncEmailRoutingWithRawResponse: - return AsyncEmailRoutingWithRawResponse(self) + def with_raw_response(self) -> AsyncEmailRoutingResourceWithRawResponse: + return AsyncEmailRoutingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEmailRoutingWithStreamingResponse: - return AsyncEmailRoutingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEmailRoutingResourceWithStreamingResponse: + return AsyncEmailRoutingResourceWithStreamingResponse(self) async def disable( self, zone_identifier: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> EmailRoutingDisableResponse: + ) -> Settings: """Disable your Email Routing zone. Also removes additional MX records previously @@ -243,27 +253,29 @@ async def disable( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return await self._post( f"/zones/{zone_identifier}/email/routing/disable", + body=await async_maybe_transform(body, email_routing_disable_params.EmailRoutingDisableParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Settings]._unwrapper, ), - cast_to=cast(Type[EmailRoutingDisableResponse], ResultWrapper[EmailRoutingDisableResponse]), + cast_to=cast(Type[Settings], ResultWrapper[Settings]), ) async def enable( self, zone_identifier: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> EmailRoutingEnableResponse: + ) -> Settings: """Enable you Email Routing zone. Add and lock the necessary MX and SPF records. @@ -283,14 +295,15 @@ async def enable( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return await self._post( f"/zones/{zone_identifier}/email/routing/enable", + body=await async_maybe_transform(body, email_routing_enable_params.EmailRoutingEnableParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Settings]._unwrapper, ), - cast_to=cast(Type[EmailRoutingEnableResponse], ResultWrapper[EmailRoutingEnableResponse]), + cast_to=cast(Type[Settings], ResultWrapper[Settings]), ) async def get( @@ -303,7 +316,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingGetResponse: + ) -> Settings: """ Get information about the settings for your Email Routing zone. @@ -327,14 +340,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Settings]._unwrapper, ), - cast_to=cast(Type[EmailRoutingGetResponse], ResultWrapper[EmailRoutingGetResponse]), + cast_to=cast(Type[Settings], ResultWrapper[Settings]), ) -class EmailRoutingWithRawResponse: - def __init__(self, email_routing: EmailRouting) -> None: +class EmailRoutingResourceWithRawResponse: + def __init__(self, email_routing: EmailRoutingResource) -> None: self._email_routing = email_routing self.disable = to_raw_response_wrapper( @@ -348,20 +361,20 @@ def __init__(self, email_routing: EmailRouting) -> None: ) @cached_property - def dns(self) -> DNSWithRawResponse: - return DNSWithRawResponse(self._email_routing.dns) + def dns(self) -> DNSResourceWithRawResponse: + return DNSResourceWithRawResponse(self._email_routing.dns) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._email_routing.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._email_routing.rules) @cached_property - def addresses(self) -> AddressesWithRawResponse: - return AddressesWithRawResponse(self._email_routing.addresses) + def addresses(self) -> AddressesResourceWithRawResponse: + return AddressesResourceWithRawResponse(self._email_routing.addresses) -class AsyncEmailRoutingWithRawResponse: - def __init__(self, email_routing: AsyncEmailRouting) -> None: +class AsyncEmailRoutingResourceWithRawResponse: + def __init__(self, email_routing: AsyncEmailRoutingResource) -> None: self._email_routing = email_routing self.disable = async_to_raw_response_wrapper( @@ -375,20 +388,20 @@ def __init__(self, email_routing: AsyncEmailRouting) -> None: ) @cached_property - def dns(self) -> AsyncDNSWithRawResponse: - return AsyncDNSWithRawResponse(self._email_routing.dns) + def dns(self) -> AsyncDNSResourceWithRawResponse: + return AsyncDNSResourceWithRawResponse(self._email_routing.dns) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._email_routing.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._email_routing.rules) @cached_property - def addresses(self) -> AsyncAddressesWithRawResponse: - return AsyncAddressesWithRawResponse(self._email_routing.addresses) + def addresses(self) -> AsyncAddressesResourceWithRawResponse: + return AsyncAddressesResourceWithRawResponse(self._email_routing.addresses) -class EmailRoutingWithStreamingResponse: - def __init__(self, email_routing: EmailRouting) -> None: +class EmailRoutingResourceWithStreamingResponse: + def __init__(self, email_routing: EmailRoutingResource) -> None: self._email_routing = email_routing self.disable = to_streamed_response_wrapper( @@ -402,20 +415,20 @@ def __init__(self, email_routing: EmailRouting) -> None: ) @cached_property - def dns(self) -> DNSWithStreamingResponse: - return DNSWithStreamingResponse(self._email_routing.dns) + def dns(self) -> DNSResourceWithStreamingResponse: + return DNSResourceWithStreamingResponse(self._email_routing.dns) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._email_routing.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._email_routing.rules) @cached_property - def addresses(self) -> AddressesWithStreamingResponse: - return AddressesWithStreamingResponse(self._email_routing.addresses) + def addresses(self) -> AddressesResourceWithStreamingResponse: + return AddressesResourceWithStreamingResponse(self._email_routing.addresses) -class AsyncEmailRoutingWithStreamingResponse: - def __init__(self, email_routing: AsyncEmailRouting) -> None: +class AsyncEmailRoutingResourceWithStreamingResponse: + def __init__(self, email_routing: AsyncEmailRoutingResource) -> None: self._email_routing = email_routing self.disable = async_to_streamed_response_wrapper( @@ -429,13 +442,13 @@ def __init__(self, email_routing: AsyncEmailRouting) -> None: ) @cached_property - def dns(self) -> AsyncDNSWithStreamingResponse: - return AsyncDNSWithStreamingResponse(self._email_routing.dns) + def dns(self) -> AsyncDNSResourceWithStreamingResponse: + return AsyncDNSResourceWithStreamingResponse(self._email_routing.dns) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._email_routing.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._email_routing.rules) @cached_property - def addresses(self) -> AsyncAddressesWithStreamingResponse: - return AsyncAddressesWithStreamingResponse(self._email_routing.addresses) + def addresses(self) -> AsyncAddressesResourceWithStreamingResponse: + return AsyncAddressesResourceWithStreamingResponse(self._email_routing.addresses) diff --git a/src/cloudflare/resources/email_routing/rules/__init__.py b/src/cloudflare/resources/email_routing/rules/__init__.py index 5775e328883..16e5a3929ed 100644 --- a/src/cloudflare/resources/email_routing/rules/__init__.py +++ b/src/cloudflare/resources/email_routing/rules/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .catch_alls import ( - CatchAlls, - AsyncCatchAlls, - CatchAllsWithRawResponse, - AsyncCatchAllsWithRawResponse, - CatchAllsWithStreamingResponse, - AsyncCatchAllsWithStreamingResponse, + CatchAllsResource, + AsyncCatchAllsResource, + CatchAllsResourceWithRawResponse, + AsyncCatchAllsResourceWithRawResponse, + CatchAllsResourceWithStreamingResponse, + AsyncCatchAllsResourceWithStreamingResponse, ) __all__ = [ - "CatchAlls", - "AsyncCatchAlls", - "CatchAllsWithRawResponse", - "AsyncCatchAllsWithRawResponse", - "CatchAllsWithStreamingResponse", - "AsyncCatchAllsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", + "CatchAllsResource", + "AsyncCatchAllsResource", + "CatchAllsResourceWithRawResponse", + "AsyncCatchAllsResourceWithRawResponse", + "CatchAllsResourceWithStreamingResponse", + "AsyncCatchAllsResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/email_routing/rules/catch_alls.py b/src/cloudflare/resources/email_routing/rules/catch_alls.py index be5a264dab1..bc3761ff093 100644 --- a/src/cloudflare/resources/email_routing/rules/catch_alls.py +++ b/src/cloudflare/resources/email_routing/rules/catch_alls.py @@ -24,26 +24,30 @@ from ...._base_client import ( make_request_options, ) -from ....types.email_routing.rules import EmailCatchAllRule, catch_all_update_params +from ....types.email_routing.rules import catch_all_update_params +from ....types.email_routing.rules.catch_all_action_param import CatchAllActionParam +from ....types.email_routing.rules.catch_all_get_response import CatchAllGetResponse +from ....types.email_routing.rules.catch_all_matcher_param import CatchAllMatcherParam +from ....types.email_routing.rules.catch_all_update_response import CatchAllUpdateResponse -__all__ = ["CatchAlls", "AsyncCatchAlls"] +__all__ = ["CatchAllsResource", "AsyncCatchAllsResource"] -class CatchAlls(SyncAPIResource): +class CatchAllsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CatchAllsWithRawResponse: - return CatchAllsWithRawResponse(self) + def with_raw_response(self) -> CatchAllsResourceWithRawResponse: + return CatchAllsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CatchAllsWithStreamingResponse: - return CatchAllsWithStreamingResponse(self) + def with_streaming_response(self) -> CatchAllsResourceWithStreamingResponse: + return CatchAllsResourceWithStreamingResponse(self) def update( self, zone_identifier: str, *, - actions: Iterable[catch_all_update_params.Action], - matchers: Iterable[catch_all_update_params.Matcher], + actions: Iterable[CatchAllActionParam], + matchers: Iterable[CatchAllMatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, 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. @@ -52,7 +56,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailCatchAllRule: + ) -> CatchAllUpdateResponse: """ Enable or disable catch-all routing rule, or change action to forward to specific destination address. @@ -94,9 +98,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CatchAllUpdateResponse]._unwrapper, ), - cast_to=cast(Type[EmailCatchAllRule], ResultWrapper[EmailCatchAllRule]), + cast_to=cast(Type[CatchAllUpdateResponse], ResultWrapper[CatchAllUpdateResponse]), ) def get( @@ -109,7 +113,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailCatchAllRule: + ) -> CatchAllGetResponse: """ Get information on the default catch-all routing rule. @@ -133,27 +137,27 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CatchAllGetResponse]._unwrapper, ), - cast_to=cast(Type[EmailCatchAllRule], ResultWrapper[EmailCatchAllRule]), + cast_to=cast(Type[CatchAllGetResponse], ResultWrapper[CatchAllGetResponse]), ) -class AsyncCatchAlls(AsyncAPIResource): +class AsyncCatchAllsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCatchAllsWithRawResponse: - return AsyncCatchAllsWithRawResponse(self) + def with_raw_response(self) -> AsyncCatchAllsResourceWithRawResponse: + return AsyncCatchAllsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCatchAllsWithStreamingResponse: - return AsyncCatchAllsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCatchAllsResourceWithStreamingResponse: + return AsyncCatchAllsResourceWithStreamingResponse(self) async def update( self, zone_identifier: str, *, - actions: Iterable[catch_all_update_params.Action], - matchers: Iterable[catch_all_update_params.Matcher], + actions: Iterable[CatchAllActionParam], + matchers: Iterable[CatchAllMatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, 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. @@ -162,7 +166,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailCatchAllRule: + ) -> CatchAllUpdateResponse: """ Enable or disable catch-all routing rule, or change action to forward to specific destination address. @@ -204,9 +208,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CatchAllUpdateResponse]._unwrapper, ), - cast_to=cast(Type[EmailCatchAllRule], ResultWrapper[EmailCatchAllRule]), + cast_to=cast(Type[CatchAllUpdateResponse], ResultWrapper[CatchAllUpdateResponse]), ) async def get( @@ -219,7 +223,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailCatchAllRule: + ) -> CatchAllGetResponse: """ Get information on the default catch-all routing rule. @@ -243,14 +247,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CatchAllGetResponse]._unwrapper, ), - cast_to=cast(Type[EmailCatchAllRule], ResultWrapper[EmailCatchAllRule]), + cast_to=cast(Type[CatchAllGetResponse], ResultWrapper[CatchAllGetResponse]), ) -class CatchAllsWithRawResponse: - def __init__(self, catch_alls: CatchAlls) -> None: +class CatchAllsResourceWithRawResponse: + def __init__(self, catch_alls: CatchAllsResource) -> None: self._catch_alls = catch_alls self.update = to_raw_response_wrapper( @@ -261,8 +265,8 @@ def __init__(self, catch_alls: CatchAlls) -> None: ) -class AsyncCatchAllsWithRawResponse: - def __init__(self, catch_alls: AsyncCatchAlls) -> None: +class AsyncCatchAllsResourceWithRawResponse: + def __init__(self, catch_alls: AsyncCatchAllsResource) -> None: self._catch_alls = catch_alls self.update = async_to_raw_response_wrapper( @@ -273,8 +277,8 @@ def __init__(self, catch_alls: AsyncCatchAlls) -> None: ) -class CatchAllsWithStreamingResponse: - def __init__(self, catch_alls: CatchAlls) -> None: +class CatchAllsResourceWithStreamingResponse: + def __init__(self, catch_alls: CatchAllsResource) -> None: self._catch_alls = catch_alls self.update = to_streamed_response_wrapper( @@ -285,8 +289,8 @@ def __init__(self, catch_alls: CatchAlls) -> None: ) -class AsyncCatchAllsWithStreamingResponse: - def __init__(self, catch_alls: AsyncCatchAlls) -> None: +class AsyncCatchAllsResourceWithStreamingResponse: + def __init__(self, catch_alls: AsyncCatchAllsResource) -> None: self._catch_alls = catch_alls self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/email_routing/rules/rules.py b/src/cloudflare/resources/email_routing/rules/rules.py index 3ebf372ee59..963df9fbe78 100644 --- a/src/cloudflare/resources/email_routing/rules/rules.py +++ b/src/cloudflare/resources/email_routing/rules/rules.py @@ -14,12 +14,12 @@ ) from ...._compat import cached_property from .catch_alls import ( - CatchAlls, - AsyncCatchAlls, - CatchAllsWithRawResponse, - AsyncCatchAllsWithRawResponse, - CatchAllsWithStreamingResponse, - AsyncCatchAllsWithStreamingResponse, + CatchAllsResource, + AsyncCatchAllsResource, + CatchAllsResourceWithRawResponse, + AsyncCatchAllsResourceWithRawResponse, + CatchAllsResourceWithStreamingResponse, + AsyncCatchAllsResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -34,39 +34,33 @@ AsyncPaginator, make_request_options, ) -from ....types.email_routing import ( - RuleGetResponse, - RuleListResponse, - RuleCreateResponse, - RuleDeleteResponse, - RuleUpdateResponse, - rule_list_params, - rule_create_params, - rule_update_params, -) +from ....types.email_routing import rule_list_params, rule_create_params, rule_update_params +from ....types.email_routing.action_param import ActionParam +from ....types.email_routing.matcher_param import MatcherParam +from ....types.email_routing.email_routing_rule import EmailRoutingRule -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def catch_alls(self) -> CatchAlls: - return CatchAlls(self._client) + def catch_alls(self) -> CatchAllsResource: + return CatchAllsResource(self._client) @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) def create( self, zone_identifier: str, *, - actions: Iterable[rule_create_params.Action], - matchers: Iterable[rule_create_params.Matcher], + actions: Iterable[ActionParam], + matchers: Iterable[MatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -76,7 +70,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleCreateResponse: + ) -> EmailRoutingRule: """ Rules consist of a set of criteria for matching emails (such as an email being sent to a specific custom email address) plus a set of actions to take on the @@ -122,9 +116,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, ), - cast_to=cast(Type[RuleCreateResponse], ResultWrapper[RuleCreateResponse]), + cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), ) def update( @@ -132,8 +126,8 @@ def update( rule_identifier: str, *, zone_identifier: str, - actions: Iterable[rule_update_params.Action], - matchers: Iterable[rule_update_params.Matcher], + actions: Iterable[ActionParam], + matchers: Iterable[MatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -143,7 +137,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleUpdateResponse: + ) -> EmailRoutingRule: """ Update actions and matches, or enable/disable specific routing rules. @@ -191,9 +185,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, ), - cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), + cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), ) def list( @@ -209,7 +203,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[RuleListResponse]: + ) -> SyncV4PagePaginationArray[EmailRoutingRule]: """ Lists existing routing rules. @@ -234,7 +228,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/email/routing/rules", - page=SyncV4PagePaginationArray[RuleListResponse], + page=SyncV4PagePaginationArray[EmailRoutingRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -249,7 +243,7 @@ def list( rule_list_params.RuleListParams, ), ), - model=RuleListResponse, + model=EmailRoutingRule, ) def delete( @@ -263,7 +257,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleDeleteResponse: + ) -> EmailRoutingRule: """ Delete a specific routing rule. @@ -291,9 +285,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, ), - cast_to=cast(Type[RuleDeleteResponse], ResultWrapper[RuleDeleteResponse]), + cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), ) def get( @@ -307,7 +301,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleGetResponse: + ) -> EmailRoutingRule: """ Get information for a specific routing rule already created. @@ -335,31 +329,31 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, ), - cast_to=cast(Type[RuleGetResponse], ResultWrapper[RuleGetResponse]), + cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), ) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def catch_alls(self) -> AsyncCatchAlls: - return AsyncCatchAlls(self._client) + def catch_alls(self) -> AsyncCatchAllsResource: + return AsyncCatchAllsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) async def create( self, zone_identifier: str, *, - actions: Iterable[rule_create_params.Action], - matchers: Iterable[rule_create_params.Matcher], + actions: Iterable[ActionParam], + matchers: Iterable[MatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -369,7 +363,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleCreateResponse: + ) -> EmailRoutingRule: """ Rules consist of a set of criteria for matching emails (such as an email being sent to a specific custom email address) plus a set of actions to take on the @@ -415,9 +409,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, ), - cast_to=cast(Type[RuleCreateResponse], ResultWrapper[RuleCreateResponse]), + cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), ) async def update( @@ -425,8 +419,8 @@ async def update( rule_identifier: str, *, zone_identifier: str, - actions: Iterable[rule_update_params.Action], - matchers: Iterable[rule_update_params.Matcher], + actions: Iterable[ActionParam], + matchers: Iterable[MatcherParam], enabled: Literal[True, False] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -436,7 +430,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleUpdateResponse: + ) -> EmailRoutingRule: """ Update actions and matches, or enable/disable specific routing rules. @@ -484,9 +478,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, ), - cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), + cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), ) def list( @@ -502,7 +496,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RuleListResponse, AsyncV4PagePaginationArray[RuleListResponse]]: + ) -> AsyncPaginator[EmailRoutingRule, AsyncV4PagePaginationArray[EmailRoutingRule]]: """ Lists existing routing rules. @@ -527,7 +521,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/email/routing/rules", - page=AsyncV4PagePaginationArray[RuleListResponse], + page=AsyncV4PagePaginationArray[EmailRoutingRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -542,7 +536,7 @@ def list( rule_list_params.RuleListParams, ), ), - model=RuleListResponse, + model=EmailRoutingRule, ) async def delete( @@ -556,7 +550,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleDeleteResponse: + ) -> EmailRoutingRule: """ Delete a specific routing rule. @@ -584,9 +578,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, ), - cast_to=cast(Type[RuleDeleteResponse], ResultWrapper[RuleDeleteResponse]), + cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), ) async def get( @@ -600,7 +594,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleGetResponse: + ) -> EmailRoutingRule: """ Get information for a specific routing rule already created. @@ -628,14 +622,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, ), - cast_to=cast(Type[RuleGetResponse], ResultWrapper[RuleGetResponse]), + cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_raw_response_wrapper( @@ -655,12 +649,12 @@ def __init__(self, rules: Rules) -> None: ) @cached_property - def catch_alls(self) -> CatchAllsWithRawResponse: - return CatchAllsWithRawResponse(self._rules.catch_alls) + def catch_alls(self) -> CatchAllsResourceWithRawResponse: + return CatchAllsResourceWithRawResponse(self._rules.catch_alls) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_raw_response_wrapper( @@ -680,12 +674,12 @@ def __init__(self, rules: AsyncRules) -> None: ) @cached_property - def catch_alls(self) -> AsyncCatchAllsWithRawResponse: - return AsyncCatchAllsWithRawResponse(self._rules.catch_alls) + def catch_alls(self) -> AsyncCatchAllsResourceWithRawResponse: + return AsyncCatchAllsResourceWithRawResponse(self._rules.catch_alls) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_streamed_response_wrapper( @@ -705,12 +699,12 @@ def __init__(self, rules: Rules) -> None: ) @cached_property - def catch_alls(self) -> CatchAllsWithStreamingResponse: - return CatchAllsWithStreamingResponse(self._rules.catch_alls) + def catch_alls(self) -> CatchAllsResourceWithStreamingResponse: + return CatchAllsResourceWithStreamingResponse(self._rules.catch_alls) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_streamed_response_wrapper( @@ -730,5 +724,5 @@ def __init__(self, rules: AsyncRules) -> None: ) @cached_property - def catch_alls(self) -> AsyncCatchAllsWithStreamingResponse: - return AsyncCatchAllsWithStreamingResponse(self._rules.catch_alls) + def catch_alls(self) -> AsyncCatchAllsResourceWithStreamingResponse: + return AsyncCatchAllsResourceWithStreamingResponse(self._rules.catch_alls) diff --git a/src/cloudflare/resources/event_notifications/__init__.py b/src/cloudflare/resources/event_notifications/__init__.py new file mode 100644 index 00000000000..b0d56c216b8 --- /dev/null +++ b/src/cloudflare/resources/event_notifications/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .r2 import ( + R2Resource, + AsyncR2Resource, + R2ResourceWithRawResponse, + AsyncR2ResourceWithRawResponse, + R2ResourceWithStreamingResponse, + AsyncR2ResourceWithStreamingResponse, +) +from .event_notifications import ( + EventNotificationsResource, + AsyncEventNotificationsResource, + EventNotificationsResourceWithRawResponse, + AsyncEventNotificationsResourceWithRawResponse, + EventNotificationsResourceWithStreamingResponse, + AsyncEventNotificationsResourceWithStreamingResponse, +) + +__all__ = [ + "R2Resource", + "AsyncR2Resource", + "R2ResourceWithRawResponse", + "AsyncR2ResourceWithRawResponse", + "R2ResourceWithStreamingResponse", + "AsyncR2ResourceWithStreamingResponse", + "EventNotificationsResource", + "AsyncEventNotificationsResource", + "EventNotificationsResourceWithRawResponse", + "AsyncEventNotificationsResourceWithRawResponse", + "EventNotificationsResourceWithStreamingResponse", + "AsyncEventNotificationsResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/event_notifications/event_notifications.py b/src/cloudflare/resources/event_notifications/event_notifications.py new file mode 100644 index 00000000000..d0ed187d73c --- /dev/null +++ b/src/cloudflare/resources/event_notifications/event_notifications.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .r2 import ( + R2Resource, + AsyncR2Resource, + R2ResourceWithRawResponse, + AsyncR2ResourceWithRawResponse, + R2ResourceWithStreamingResponse, + AsyncR2ResourceWithStreamingResponse, +) +from .r2.r2 import R2Resource, AsyncR2Resource +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["EventNotificationsResource", "AsyncEventNotificationsResource"] + + +class EventNotificationsResource(SyncAPIResource): + @cached_property + def r2(self) -> R2Resource: + return R2Resource(self._client) + + @cached_property + def with_raw_response(self) -> EventNotificationsResourceWithRawResponse: + return EventNotificationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EventNotificationsResourceWithStreamingResponse: + return EventNotificationsResourceWithStreamingResponse(self) + + +class AsyncEventNotificationsResource(AsyncAPIResource): + @cached_property + def r2(self) -> AsyncR2Resource: + return AsyncR2Resource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncEventNotificationsResourceWithRawResponse: + return AsyncEventNotificationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEventNotificationsResourceWithStreamingResponse: + return AsyncEventNotificationsResourceWithStreamingResponse(self) + + +class EventNotificationsResourceWithRawResponse: + def __init__(self, event_notifications: EventNotificationsResource) -> None: + self._event_notifications = event_notifications + + @cached_property + def r2(self) -> R2ResourceWithRawResponse: + return R2ResourceWithRawResponse(self._event_notifications.r2) + + +class AsyncEventNotificationsResourceWithRawResponse: + def __init__(self, event_notifications: AsyncEventNotificationsResource) -> None: + self._event_notifications = event_notifications + + @cached_property + def r2(self) -> AsyncR2ResourceWithRawResponse: + return AsyncR2ResourceWithRawResponse(self._event_notifications.r2) + + +class EventNotificationsResourceWithStreamingResponse: + def __init__(self, event_notifications: EventNotificationsResource) -> None: + self._event_notifications = event_notifications + + @cached_property + def r2(self) -> R2ResourceWithStreamingResponse: + return R2ResourceWithStreamingResponse(self._event_notifications.r2) + + +class AsyncEventNotificationsResourceWithStreamingResponse: + def __init__(self, event_notifications: AsyncEventNotificationsResource) -> None: + self._event_notifications = event_notifications + + @cached_property + def r2(self) -> AsyncR2ResourceWithStreamingResponse: + return AsyncR2ResourceWithStreamingResponse(self._event_notifications.r2) diff --git a/src/cloudflare/resources/event_notifications/r2/__init__.py b/src/cloudflare/resources/event_notifications/r2/__init__.py new file mode 100644 index 00000000000..6d6123f2e43 --- /dev/null +++ b/src/cloudflare/resources/event_notifications/r2/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .r2 import ( + R2Resource, + AsyncR2Resource, + R2ResourceWithRawResponse, + AsyncR2ResourceWithRawResponse, + R2ResourceWithStreamingResponse, + AsyncR2ResourceWithStreamingResponse, +) +from .configuration import ( + ConfigurationResource, + AsyncConfigurationResource, + ConfigurationResourceWithRawResponse, + AsyncConfigurationResourceWithRawResponse, + ConfigurationResourceWithStreamingResponse, + AsyncConfigurationResourceWithStreamingResponse, +) + +__all__ = [ + "ConfigurationResource", + "AsyncConfigurationResource", + "ConfigurationResourceWithRawResponse", + "AsyncConfigurationResourceWithRawResponse", + "ConfigurationResourceWithStreamingResponse", + "AsyncConfigurationResourceWithStreamingResponse", + "R2Resource", + "AsyncR2Resource", + "R2ResourceWithRawResponse", + "AsyncR2ResourceWithRawResponse", + "R2ResourceWithStreamingResponse", + "AsyncR2ResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/event_notifications/r2/configuration/__init__.py b/src/cloudflare/resources/event_notifications/r2/configuration/__init__.py new file mode 100644 index 00000000000..500f08ff784 --- /dev/null +++ b/src/cloudflare/resources/event_notifications/r2/configuration/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .queues import ( + QueuesResource, + AsyncQueuesResource, + QueuesResourceWithRawResponse, + AsyncQueuesResourceWithRawResponse, + QueuesResourceWithStreamingResponse, + AsyncQueuesResourceWithStreamingResponse, +) +from .configuration import ( + ConfigurationResource, + AsyncConfigurationResource, + ConfigurationResourceWithRawResponse, + AsyncConfigurationResourceWithRawResponse, + ConfigurationResourceWithStreamingResponse, + AsyncConfigurationResourceWithStreamingResponse, +) + +__all__ = [ + "QueuesResource", + "AsyncQueuesResource", + "QueuesResourceWithRawResponse", + "AsyncQueuesResourceWithRawResponse", + "QueuesResourceWithStreamingResponse", + "AsyncQueuesResourceWithStreamingResponse", + "ConfigurationResource", + "AsyncConfigurationResource", + "ConfigurationResourceWithRawResponse", + "AsyncConfigurationResourceWithRawResponse", + "ConfigurationResourceWithStreamingResponse", + "AsyncConfigurationResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/event_notifications/r2/configuration/configuration.py b/src/cloudflare/resources/event_notifications/r2/configuration/configuration.py new file mode 100644 index 00000000000..b4c80577222 --- /dev/null +++ b/src/cloudflare/resources/event_notifications/r2/configuration/configuration.py @@ -0,0 +1,202 @@ +# 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 .queues import ( + QueuesResource, + AsyncQueuesResource, + QueuesResourceWithRawResponse, + AsyncQueuesResourceWithRawResponse, + QueuesResourceWithStreamingResponse, + AsyncQueuesResourceWithStreamingResponse, +) +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._wrappers import ResultWrapper +from ....._base_client import ( + make_request_options, +) +from .....types.event_notifications.r2.configuration_get_response import ConfigurationGetResponse + +__all__ = ["ConfigurationResource", "AsyncConfigurationResource"] + + +class ConfigurationResource(SyncAPIResource): + @cached_property + def queues(self) -> QueuesResource: + return QueuesResource(self._client) + + @cached_property + def with_raw_response(self) -> ConfigurationResourceWithRawResponse: + return ConfigurationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ConfigurationResourceWithStreamingResponse: + return ConfigurationResourceWithStreamingResponse(self) + + def get( + self, + bucket_name: 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, + ) -> ConfigurationGetResponse: + """ + Returns all notification rules for each queue for which bucket notifications are + produced. + + Args: + account_id: Identifier + + bucket_name: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + return self._get( + f"/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConfigurationGetResponse]._unwrapper, + ), + cast_to=cast(Type[ConfigurationGetResponse], ResultWrapper[ConfigurationGetResponse]), + ) + + +class AsyncConfigurationResource(AsyncAPIResource): + @cached_property + def queues(self) -> AsyncQueuesResource: + return AsyncQueuesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncConfigurationResourceWithRawResponse: + return AsyncConfigurationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncConfigurationResourceWithStreamingResponse: + return AsyncConfigurationResourceWithStreamingResponse(self) + + async def get( + self, + bucket_name: 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, + ) -> ConfigurationGetResponse: + """ + Returns all notification rules for each queue for which bucket notifications are + produced. + + Args: + account_id: Identifier + + bucket_name: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + return await self._get( + f"/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConfigurationGetResponse]._unwrapper, + ), + cast_to=cast(Type[ConfigurationGetResponse], ResultWrapper[ConfigurationGetResponse]), + ) + + +class ConfigurationResourceWithRawResponse: + def __init__(self, configuration: ConfigurationResource) -> None: + self._configuration = configuration + + self.get = to_raw_response_wrapper( + configuration.get, + ) + + @cached_property + def queues(self) -> QueuesResourceWithRawResponse: + return QueuesResourceWithRawResponse(self._configuration.queues) + + +class AsyncConfigurationResourceWithRawResponse: + def __init__(self, configuration: AsyncConfigurationResource) -> None: + self._configuration = configuration + + self.get = async_to_raw_response_wrapper( + configuration.get, + ) + + @cached_property + def queues(self) -> AsyncQueuesResourceWithRawResponse: + return AsyncQueuesResourceWithRawResponse(self._configuration.queues) + + +class ConfigurationResourceWithStreamingResponse: + def __init__(self, configuration: ConfigurationResource) -> None: + self._configuration = configuration + + self.get = to_streamed_response_wrapper( + configuration.get, + ) + + @cached_property + def queues(self) -> QueuesResourceWithStreamingResponse: + return QueuesResourceWithStreamingResponse(self._configuration.queues) + + +class AsyncConfigurationResourceWithStreamingResponse: + def __init__(self, configuration: AsyncConfigurationResource) -> None: + self._configuration = configuration + + self.get = async_to_streamed_response_wrapper( + configuration.get, + ) + + @cached_property + def queues(self) -> AsyncQueuesResourceWithStreamingResponse: + return AsyncQueuesResourceWithStreamingResponse(self._configuration.queues) diff --git a/src/cloudflare/resources/event_notifications/r2/configuration/queues.py b/src/cloudflare/resources/event_notifications/r2/configuration/queues.py new file mode 100644 index 00000000000..cee65c5ac89 --- /dev/null +++ b/src/cloudflare/resources/event_notifications/r2/configuration/queues.py @@ -0,0 +1,318 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, Type, Iterable, 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.event_notifications.r2.configuration import queue_update_params +from .....types.event_notifications.r2.configuration.queue_delete_response import QueueDeleteResponse +from .....types.event_notifications.r2.configuration.queue_update_response import QueueUpdateResponse + +__all__ = ["QueuesResource", "AsyncQueuesResource"] + + +class QueuesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> QueuesResourceWithRawResponse: + return QueuesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> QueuesResourceWithStreamingResponse: + return QueuesResourceWithStreamingResponse(self) + + def update( + self, + queue_id: str, + *, + account_id: str, + bucket_name: str, + rules: Iterable[queue_update_params.Rule] | 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, + ) -> QueueUpdateResponse: + """ + Define the rules for a given queue which will determine event notification + production. + + Args: + account_id: Identifier + + bucket_name: Identifier + + queue_id: Identifier + + rules: Array of rules to drive notifications + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + if not queue_id: + raise ValueError(f"Expected a non-empty value for `queue_id` but received {queue_id!r}") + return self._put( + f"/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}", + body=maybe_transform({"rules": rules}, queue_update_params.QueueUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[QueueUpdateResponse]._unwrapper, + ), + cast_to=cast(Type[QueueUpdateResponse], ResultWrapper[QueueUpdateResponse]), + ) + + def delete( + self, + queue_id: str, + *, + account_id: str, + bucket_name: 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, + ) -> QueueDeleteResponse: + """Turn off all event notifications configured for delivery to a given queue. + + No + further notifications will be produced for the queue once complete. + + Args: + account_id: Identifier + + bucket_name: Identifier + + queue_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + if not queue_id: + raise ValueError(f"Expected a non-empty value for `queue_id` but received {queue_id!r}") + return cast( + QueueDeleteResponse, + self._delete( + f"/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[QueueDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[QueueDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class AsyncQueuesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncQueuesResourceWithRawResponse: + return AsyncQueuesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncQueuesResourceWithStreamingResponse: + return AsyncQueuesResourceWithStreamingResponse(self) + + async def update( + self, + queue_id: str, + *, + account_id: str, + bucket_name: str, + rules: Iterable[queue_update_params.Rule] | 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, + ) -> QueueUpdateResponse: + """ + Define the rules for a given queue which will determine event notification + production. + + Args: + account_id: Identifier + + bucket_name: Identifier + + queue_id: Identifier + + rules: Array of rules to drive notifications + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + if not queue_id: + raise ValueError(f"Expected a non-empty value for `queue_id` but received {queue_id!r}") + return await self._put( + f"/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}", + body=await async_maybe_transform({"rules": rules}, queue_update_params.QueueUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[QueueUpdateResponse]._unwrapper, + ), + cast_to=cast(Type[QueueUpdateResponse], ResultWrapper[QueueUpdateResponse]), + ) + + async def delete( + self, + queue_id: str, + *, + account_id: str, + bucket_name: 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, + ) -> QueueDeleteResponse: + """Turn off all event notifications configured for delivery to a given queue. + + No + further notifications will be produced for the queue once complete. + + Args: + account_id: Identifier + + bucket_name: Identifier + + queue_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + if not queue_id: + raise ValueError(f"Expected a non-empty value for `queue_id` but received {queue_id!r}") + return cast( + QueueDeleteResponse, + await self._delete( + f"/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[QueueDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[QueueDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class QueuesResourceWithRawResponse: + def __init__(self, queues: QueuesResource) -> None: + self._queues = queues + + self.update = to_raw_response_wrapper( + queues.update, + ) + self.delete = to_raw_response_wrapper( + queues.delete, + ) + + +class AsyncQueuesResourceWithRawResponse: + def __init__(self, queues: AsyncQueuesResource) -> None: + self._queues = queues + + self.update = async_to_raw_response_wrapper( + queues.update, + ) + self.delete = async_to_raw_response_wrapper( + queues.delete, + ) + + +class QueuesResourceWithStreamingResponse: + def __init__(self, queues: QueuesResource) -> None: + self._queues = queues + + self.update = to_streamed_response_wrapper( + queues.update, + ) + self.delete = to_streamed_response_wrapper( + queues.delete, + ) + + +class AsyncQueuesResourceWithStreamingResponse: + def __init__(self, queues: AsyncQueuesResource) -> None: + self._queues = queues + + self.update = async_to_streamed_response_wrapper( + queues.update, + ) + self.delete = async_to_streamed_response_wrapper( + queues.delete, + ) diff --git a/src/cloudflare/resources/event_notifications/r2/r2.py b/src/cloudflare/resources/event_notifications/r2/r2.py new file mode 100644 index 00000000000..4103c51b0f8 --- /dev/null +++ b/src/cloudflare/resources/event_notifications/r2/r2.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .configuration import ( + ConfigurationResource, + AsyncConfigurationResource, + ConfigurationResourceWithRawResponse, + AsyncConfigurationResourceWithRawResponse, + ConfigurationResourceWithStreamingResponse, + AsyncConfigurationResourceWithStreamingResponse, +) +from .configuration.configuration import ConfigurationResource, AsyncConfigurationResource + +__all__ = ["R2Resource", "AsyncR2Resource"] + + +class R2Resource(SyncAPIResource): + @cached_property + def configuration(self) -> ConfigurationResource: + return ConfigurationResource(self._client) + + @cached_property + def with_raw_response(self) -> R2ResourceWithRawResponse: + return R2ResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> R2ResourceWithStreamingResponse: + return R2ResourceWithStreamingResponse(self) + + +class AsyncR2Resource(AsyncAPIResource): + @cached_property + def configuration(self) -> AsyncConfigurationResource: + return AsyncConfigurationResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncR2ResourceWithRawResponse: + return AsyncR2ResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncR2ResourceWithStreamingResponse: + return AsyncR2ResourceWithStreamingResponse(self) + + +class R2ResourceWithRawResponse: + def __init__(self, r2: R2Resource) -> None: + self._r2 = r2 + + @cached_property + def configuration(self) -> ConfigurationResourceWithRawResponse: + return ConfigurationResourceWithRawResponse(self._r2.configuration) + + +class AsyncR2ResourceWithRawResponse: + def __init__(self, r2: AsyncR2Resource) -> None: + self._r2 = r2 + + @cached_property + def configuration(self) -> AsyncConfigurationResourceWithRawResponse: + return AsyncConfigurationResourceWithRawResponse(self._r2.configuration) + + +class R2ResourceWithStreamingResponse: + def __init__(self, r2: R2Resource) -> None: + self._r2 = r2 + + @cached_property + def configuration(self) -> ConfigurationResourceWithStreamingResponse: + return ConfigurationResourceWithStreamingResponse(self._r2.configuration) + + +class AsyncR2ResourceWithStreamingResponse: + def __init__(self, r2: AsyncR2Resource) -> None: + self._r2 = r2 + + @cached_property + def configuration(self) -> AsyncConfigurationResourceWithStreamingResponse: + return AsyncConfigurationResourceWithStreamingResponse(self._r2.configuration) diff --git a/src/cloudflare/resources/filters.py b/src/cloudflare/resources/filters.py index 2f1348e4137..1204f4347c3 100644 --- a/src/cloudflare/resources/filters.py +++ b/src/cloudflare/resources/filters.py @@ -6,13 +6,6 @@ import httpx -from ..types import ( - FirewallFilter, - FilterCreateResponse, - filter_list_params, - filter_create_params, - filter_update_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -32,18 +25,21 @@ AsyncPaginator, make_request_options, ) +from ..types.filters import filter_list_params, filter_create_params, filter_delete_params, filter_update_params +from ..types.filters.firewall_filter import FirewallFilter +from ..types.filters.filter_create_response import FilterCreateResponse -__all__ = ["Filters", "AsyncFilters"] +__all__ = ["FiltersResource", "AsyncFiltersResource"] -class Filters(SyncAPIResource): +class FiltersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FiltersWithRawResponse: - return FiltersWithRawResponse(self) + def with_raw_response(self) -> FiltersResourceWithRawResponse: + return FiltersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FiltersWithStreamingResponse: - return FiltersWithStreamingResponse(self) + def with_streaming_response(self) -> FiltersResourceWithStreamingResponse: + return FiltersResourceWithStreamingResponse(self) def create( self, @@ -81,7 +77,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FilterCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[FilterCreateResponse]], ResultWrapper[FilterCreateResponse]), ) @@ -98,7 +94,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallFilter]: + ) -> FirewallFilter: """ Updates an existing filter. @@ -127,15 +123,16 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallFilter]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilter]], ResultWrapper[FirewallFilter]), + cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) def list( self, zone_identifier: str, *, + id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, @@ -157,6 +154,8 @@ def list( Args: zone_identifier: Identifier + id: The unique identifier of the filter. + description: A case-insensitive string to find in the description. expression: A case-insensitive string to find in the expression. @@ -189,6 +188,7 @@ def list( timeout=timeout, query=maybe_transform( { + "id": id, "description": description, "expression": expression, "page": page, @@ -207,13 +207,14 @@ def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[FirewallFilter]: + ) -> FirewallFilter: """ Deletes an existing filter. @@ -236,14 +237,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._delete( f"/zones/{zone_identifier}/filters/{id}", + body=maybe_transform(body, filter_delete_params.FilterDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallFilter]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilter]], ResultWrapper[FirewallFilter]), + cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) def get( @@ -257,7 +259,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallFilter]: + ) -> FirewallFilter: """ Fetches the details of a filter. @@ -285,20 +287,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallFilter]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilter]], ResultWrapper[FirewallFilter]), + cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) -class AsyncFilters(AsyncAPIResource): +class AsyncFiltersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFiltersWithRawResponse: - return AsyncFiltersWithRawResponse(self) + def with_raw_response(self) -> AsyncFiltersResourceWithRawResponse: + return AsyncFiltersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFiltersWithStreamingResponse: - return AsyncFiltersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFiltersResourceWithStreamingResponse: + return AsyncFiltersResourceWithStreamingResponse(self) async def create( self, @@ -336,7 +338,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FilterCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[FilterCreateResponse]], ResultWrapper[FilterCreateResponse]), ) @@ -353,7 +355,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallFilter]: + ) -> FirewallFilter: """ Updates an existing filter. @@ -382,15 +384,16 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallFilter]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilter]], ResultWrapper[FirewallFilter]), + cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) def list( self, zone_identifier: str, *, + id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, @@ -412,6 +415,8 @@ def list( Args: zone_identifier: Identifier + id: The unique identifier of the filter. + description: A case-insensitive string to find in the description. expression: A case-insensitive string to find in the expression. @@ -444,6 +449,7 @@ def list( timeout=timeout, query=maybe_transform( { + "id": id, "description": description, "expression": expression, "page": page, @@ -462,13 +468,14 @@ async def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[FirewallFilter]: + ) -> FirewallFilter: """ Deletes an existing filter. @@ -491,14 +498,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._delete( f"/zones/{zone_identifier}/filters/{id}", + body=await async_maybe_transform(body, filter_delete_params.FilterDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallFilter]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilter]], ResultWrapper[FirewallFilter]), + cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) async def get( @@ -512,7 +520,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallFilter]: + ) -> FirewallFilter: """ Fetches the details of a filter. @@ -540,14 +548,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallFilter]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilter]], ResultWrapper[FirewallFilter]), + cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) -class FiltersWithRawResponse: - def __init__(self, filters: Filters) -> None: +class FiltersResourceWithRawResponse: + def __init__(self, filters: FiltersResource) -> None: self._filters = filters self.create = to_raw_response_wrapper( @@ -567,8 +575,8 @@ def __init__(self, filters: Filters) -> None: ) -class AsyncFiltersWithRawResponse: - def __init__(self, filters: AsyncFilters) -> None: +class AsyncFiltersResourceWithRawResponse: + def __init__(self, filters: AsyncFiltersResource) -> None: self._filters = filters self.create = async_to_raw_response_wrapper( @@ -588,8 +596,8 @@ def __init__(self, filters: AsyncFilters) -> None: ) -class FiltersWithStreamingResponse: - def __init__(self, filters: Filters) -> None: +class FiltersResourceWithStreamingResponse: + def __init__(self, filters: FiltersResource) -> None: self._filters = filters self.create = to_streamed_response_wrapper( @@ -609,8 +617,8 @@ def __init__(self, filters: Filters) -> None: ) -class AsyncFiltersWithStreamingResponse: - def __init__(self, filters: AsyncFilters) -> None: +class AsyncFiltersResourceWithStreamingResponse: + def __init__(self, filters: AsyncFiltersResource) -> None: self._filters = filters self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/firewall/__init__.py b/src/cloudflare/resources/firewall/__init__.py index cdcf0e03563..cc405a6f65f 100644 --- a/src/cloudflare/resources/firewall/__init__.py +++ b/src/cloudflare/resources/firewall/__init__.py @@ -1,89 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .waf import ( - WAF, - AsyncWAF, - WAFWithRawResponse, - AsyncWAFWithRawResponse, - WAFWithStreamingResponse, - AsyncWAFWithStreamingResponse, + WAFResource, + AsyncWAFResource, + WAFResourceWithRawResponse, + AsyncWAFResourceWithRawResponse, + WAFResourceWithStreamingResponse, + AsyncWAFResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .firewall import ( - Firewall, - AsyncFirewall, - FirewallWithRawResponse, - AsyncFirewallWithRawResponse, - FirewallWithStreamingResponse, - AsyncFirewallWithStreamingResponse, + FirewallResource, + AsyncFirewallResource, + FirewallResourceWithRawResponse, + AsyncFirewallResourceWithRawResponse, + FirewallResourceWithStreamingResponse, + AsyncFirewallResourceWithStreamingResponse, ) from .ua_rules import ( - UARules, - AsyncUARules, - UARulesWithRawResponse, - AsyncUARulesWithRawResponse, - UARulesWithStreamingResponse, - AsyncUARulesWithStreamingResponse, + UARulesResource, + AsyncUARulesResource, + UARulesResourceWithRawResponse, + AsyncUARulesResourceWithRawResponse, + UARulesResourceWithStreamingResponse, + AsyncUARulesResourceWithStreamingResponse, ) from .lockdowns import ( - Lockdowns, - AsyncLockdowns, - LockdownsWithRawResponse, - AsyncLockdownsWithRawResponse, - LockdownsWithStreamingResponse, - AsyncLockdownsWithStreamingResponse, + LockdownsResource, + AsyncLockdownsResource, + LockdownsResourceWithRawResponse, + AsyncLockdownsResourceWithRawResponse, + LockdownsResourceWithStreamingResponse, + AsyncLockdownsResourceWithStreamingResponse, ) from .access_rules import ( - AccessRules, - AsyncAccessRules, - AccessRulesWithRawResponse, - AsyncAccessRulesWithRawResponse, - AccessRulesWithStreamingResponse, - AsyncAccessRulesWithStreamingResponse, + AccessRulesResource, + AsyncAccessRulesResource, + AccessRulesResourceWithRawResponse, + AsyncAccessRulesResourceWithRawResponse, + AccessRulesResourceWithStreamingResponse, + AsyncAccessRulesResourceWithStreamingResponse, ) __all__ = [ - "Lockdowns", - "AsyncLockdowns", - "LockdownsWithRawResponse", - "AsyncLockdownsWithRawResponse", - "LockdownsWithStreamingResponse", - "AsyncLockdownsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "AccessRules", - "AsyncAccessRules", - "AccessRulesWithRawResponse", - "AsyncAccessRulesWithRawResponse", - "AccessRulesWithStreamingResponse", - "AsyncAccessRulesWithStreamingResponse", - "UARules", - "AsyncUARules", - "UARulesWithRawResponse", - "AsyncUARulesWithRawResponse", - "UARulesWithStreamingResponse", - "AsyncUARulesWithStreamingResponse", - "WAF", - "AsyncWAF", - "WAFWithRawResponse", - "AsyncWAFWithRawResponse", - "WAFWithStreamingResponse", - "AsyncWAFWithStreamingResponse", - "Firewall", - "AsyncFirewall", - "FirewallWithRawResponse", - "AsyncFirewallWithRawResponse", - "FirewallWithStreamingResponse", - "AsyncFirewallWithStreamingResponse", + "LockdownsResource", + "AsyncLockdownsResource", + "LockdownsResourceWithRawResponse", + "AsyncLockdownsResourceWithRawResponse", + "LockdownsResourceWithStreamingResponse", + "AsyncLockdownsResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "AccessRulesResource", + "AsyncAccessRulesResource", + "AccessRulesResourceWithRawResponse", + "AsyncAccessRulesResourceWithRawResponse", + "AccessRulesResourceWithStreamingResponse", + "AsyncAccessRulesResourceWithStreamingResponse", + "UARulesResource", + "AsyncUARulesResource", + "UARulesResourceWithRawResponse", + "AsyncUARulesResourceWithRawResponse", + "UARulesResourceWithStreamingResponse", + "AsyncUARulesResourceWithStreamingResponse", + "WAFResource", + "AsyncWAFResource", + "WAFResourceWithRawResponse", + "AsyncWAFResourceWithRawResponse", + "WAFResourceWithStreamingResponse", + "AsyncWAFResourceWithStreamingResponse", + "FirewallResource", + "AsyncFirewallResource", + "FirewallResourceWithRawResponse", + "AsyncFirewallResourceWithRawResponse", + "FirewallResourceWithStreamingResponse", + "AsyncFirewallResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/firewall/access_rules.py b/src/cloudflare/resources/firewall/access_rules.py index 2ac2903cb19..db4e862920e 100644 --- a/src/cloudflare/resources/firewall/access_rules.py +++ b/src/cloudflare/resources/firewall/access_rules.py @@ -27,26 +27,27 @@ make_request_options, ) from ...types.firewall import ( - AccessRuleGetResponse, - AccessRuleEditResponse, - AccessRuleCreateResponse, - AccessRuleDeleteResponse, access_rule_edit_params, access_rule_list_params, access_rule_create_params, + access_rule_delete_params, ) +from ...types.firewall.access_rule_get_response import AccessRuleGetResponse +from ...types.firewall.access_rule_edit_response import AccessRuleEditResponse +from ...types.firewall.access_rule_create_response import AccessRuleCreateResponse +from ...types.firewall.access_rule_delete_response import AccessRuleDeleteResponse -__all__ = ["AccessRules", "AsyncAccessRules"] +__all__ = ["AccessRulesResource", "AsyncAccessRulesResource"] -class AccessRules(SyncAPIResource): +class AccessRulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccessRulesWithRawResponse: - return AccessRulesWithRawResponse(self) + def with_raw_response(self) -> AccessRulesResourceWithRawResponse: + return AccessRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccessRulesWithStreamingResponse: - return AccessRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AccessRulesResourceWithStreamingResponse: + return AccessRulesResourceWithStreamingResponse(self) def create( self, @@ -62,7 +63,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRuleCreateResponse]: + ) -> AccessRuleCreateResponse: """Creates a new IP Access rule for an account or zone. The rule will apply to all @@ -90,12 +91,6 @@ def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -103,10 +98,13 @@ def create( 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 cast( - Optional[AccessRuleCreateResponse], + AccessRuleCreateResponse, self._post( f"/{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules", body=maybe_transform( @@ -122,7 +120,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccessRuleCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccessRuleCreateResponse] @@ -175,12 +173,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -188,6 +180,9 @@ def list( 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._get_api_list( @@ -217,6 +212,7 @@ def delete( self, identifier: object, *, + body: object, 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. @@ -244,12 +240,6 @@ def delete( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -257,16 +247,20 @@ def delete( 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._delete( f"/{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}", + body=maybe_transform(body, access_rule_delete_params.AccessRuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AccessRuleDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AccessRuleDeleteResponse]], ResultWrapper[AccessRuleDeleteResponse]), ) @@ -286,7 +280,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRuleEditResponse]: + ) -> AccessRuleEditResponse: """ Updates an IP Access rule defined. @@ -311,12 +305,6 @@ def edit( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -324,10 +312,13 @@ def edit( 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 cast( - Optional[AccessRuleEditResponse], + AccessRuleEditResponse, self._patch( f"/{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}", body=maybe_transform( @@ -343,7 +334,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccessRuleEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccessRuleEditResponse] @@ -363,7 +354,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRuleGetResponse]: + ) -> AccessRuleGetResponse: """ Fetches the details of an IP Access rule defined. @@ -380,12 +371,6 @@ def get( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -393,10 +378,13 @@ def get( 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 cast( - Optional[AccessRuleGetResponse], + AccessRuleGetResponse, self._get( f"/{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}", options=make_request_options( @@ -404,7 +392,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccessRuleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccessRuleGetResponse] @@ -413,14 +401,14 @@ def get( ) -class AsyncAccessRules(AsyncAPIResource): +class AsyncAccessRulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccessRulesWithRawResponse: - return AsyncAccessRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncAccessRulesResourceWithRawResponse: + return AsyncAccessRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccessRulesWithStreamingResponse: - return AsyncAccessRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccessRulesResourceWithStreamingResponse: + return AsyncAccessRulesResourceWithStreamingResponse(self) async def create( self, @@ -436,7 +424,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRuleCreateResponse]: + ) -> AccessRuleCreateResponse: """Creates a new IP Access rule for an account or zone. The rule will apply to all @@ -464,12 +452,6 @@ async def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -477,10 +459,13 @@ async def create( 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 cast( - Optional[AccessRuleCreateResponse], + AccessRuleCreateResponse, await self._post( f"/{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules", body=await async_maybe_transform( @@ -496,7 +481,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccessRuleCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccessRuleCreateResponse] @@ -549,12 +534,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -562,6 +541,9 @@ def list( 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._get_api_list( @@ -591,6 +573,7 @@ async def delete( self, identifier: object, *, + body: object, 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. @@ -618,12 +601,6 @@ async def delete( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -631,16 +608,20 @@ async def delete( 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._delete( f"/{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}", + body=await async_maybe_transform(body, access_rule_delete_params.AccessRuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AccessRuleDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AccessRuleDeleteResponse]], ResultWrapper[AccessRuleDeleteResponse]), ) @@ -660,7 +641,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRuleEditResponse]: + ) -> AccessRuleEditResponse: """ Updates an IP Access rule defined. @@ -685,12 +666,6 @@ async def edit( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -698,10 +673,13 @@ async def edit( 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 cast( - Optional[AccessRuleEditResponse], + AccessRuleEditResponse, await self._patch( f"/{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}", body=await async_maybe_transform( @@ -717,7 +695,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccessRuleEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccessRuleEditResponse] @@ -737,7 +715,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRuleGetResponse]: + ) -> AccessRuleGetResponse: """ Fetches the details of an IP Access rule defined. @@ -754,12 +732,6 @@ async def get( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -767,10 +739,13 @@ async def get( 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 cast( - Optional[AccessRuleGetResponse], + AccessRuleGetResponse, await self._get( f"/{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}", options=make_request_options( @@ -778,7 +753,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AccessRuleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AccessRuleGetResponse] @@ -787,8 +762,8 @@ async def get( ) -class AccessRulesWithRawResponse: - def __init__(self, access_rules: AccessRules) -> None: +class AccessRulesResourceWithRawResponse: + def __init__(self, access_rules: AccessRulesResource) -> None: self._access_rules = access_rules self.create = to_raw_response_wrapper( @@ -808,8 +783,8 @@ def __init__(self, access_rules: AccessRules) -> None: ) -class AsyncAccessRulesWithRawResponse: - def __init__(self, access_rules: AsyncAccessRules) -> None: +class AsyncAccessRulesResourceWithRawResponse: + def __init__(self, access_rules: AsyncAccessRulesResource) -> None: self._access_rules = access_rules self.create = async_to_raw_response_wrapper( @@ -829,8 +804,8 @@ def __init__(self, access_rules: AsyncAccessRules) -> None: ) -class AccessRulesWithStreamingResponse: - def __init__(self, access_rules: AccessRules) -> None: +class AccessRulesResourceWithStreamingResponse: + def __init__(self, access_rules: AccessRulesResource) -> None: self._access_rules = access_rules self.create = to_streamed_response_wrapper( @@ -850,8 +825,8 @@ def __init__(self, access_rules: AccessRules) -> None: ) -class AsyncAccessRulesWithStreamingResponse: - def __init__(self, access_rules: AsyncAccessRules) -> None: +class AsyncAccessRulesResourceWithStreamingResponse: + def __init__(self, access_rules: AsyncAccessRulesResource) -> None: self._access_rules = access_rules self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/firewall/firewall.py b/src/cloudflare/resources/firewall/firewall.py index 1a15aa959b1..77990b2476c 100644 --- a/src/cloudflare/resources/firewall/firewall.py +++ b/src/cloudflare/resources/firewall/firewall.py @@ -3,207 +3,207 @@ from __future__ import annotations from .waf import ( - WAF, - AsyncWAF, - WAFWithRawResponse, - AsyncWAFWithRawResponse, - WAFWithStreamingResponse, - AsyncWAFWithStreamingResponse, + WAFResource, + AsyncWAFResource, + WAFResourceWithRawResponse, + AsyncWAFResourceWithRawResponse, + WAFResourceWithStreamingResponse, + AsyncWAFResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) -from .waf.waf import WAF, AsyncWAF +from .waf.waf import WAFResource, AsyncWAFResource from .ua_rules import ( - UARules, - AsyncUARules, - UARulesWithRawResponse, - AsyncUARulesWithRawResponse, - UARulesWithStreamingResponse, - AsyncUARulesWithStreamingResponse, + UARulesResource, + AsyncUARulesResource, + UARulesResourceWithRawResponse, + AsyncUARulesResourceWithRawResponse, + UARulesResourceWithStreamingResponse, + AsyncUARulesResourceWithStreamingResponse, ) from ..._compat import cached_property from .lockdowns import ( - Lockdowns, - AsyncLockdowns, - LockdownsWithRawResponse, - AsyncLockdownsWithRawResponse, - LockdownsWithStreamingResponse, - AsyncLockdownsWithStreamingResponse, + LockdownsResource, + AsyncLockdownsResource, + LockdownsResourceWithRawResponse, + AsyncLockdownsResourceWithRawResponse, + LockdownsResourceWithStreamingResponse, + AsyncLockdownsResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from .access_rules import ( - AccessRules, - AsyncAccessRules, - AccessRulesWithRawResponse, - AsyncAccessRulesWithRawResponse, - AccessRulesWithStreamingResponse, - AsyncAccessRulesWithStreamingResponse, + AccessRulesResource, + AsyncAccessRulesResource, + AccessRulesResourceWithRawResponse, + AsyncAccessRulesResourceWithRawResponse, + AccessRulesResourceWithStreamingResponse, + AsyncAccessRulesResourceWithStreamingResponse, ) -__all__ = ["Firewall", "AsyncFirewall"] +__all__ = ["FirewallResource", "AsyncFirewallResource"] -class Firewall(SyncAPIResource): +class FirewallResource(SyncAPIResource): @cached_property - def lockdowns(self) -> Lockdowns: - return Lockdowns(self._client) + def lockdowns(self) -> LockdownsResource: + return LockdownsResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def access_rules(self) -> AccessRules: - return AccessRules(self._client) + def access_rules(self) -> AccessRulesResource: + return AccessRulesResource(self._client) @cached_property - def ua_rules(self) -> UARules: - return UARules(self._client) + def ua_rules(self) -> UARulesResource: + return UARulesResource(self._client) @cached_property - def waf(self) -> WAF: - return WAF(self._client) + def waf(self) -> WAFResource: + return WAFResource(self._client) @cached_property - def with_raw_response(self) -> FirewallWithRawResponse: - return FirewallWithRawResponse(self) + def with_raw_response(self) -> FirewallResourceWithRawResponse: + return FirewallResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FirewallWithStreamingResponse: - return FirewallWithStreamingResponse(self) + def with_streaming_response(self) -> FirewallResourceWithStreamingResponse: + return FirewallResourceWithStreamingResponse(self) -class AsyncFirewall(AsyncAPIResource): +class AsyncFirewallResource(AsyncAPIResource): @cached_property - def lockdowns(self) -> AsyncLockdowns: - return AsyncLockdowns(self._client) + def lockdowns(self) -> AsyncLockdownsResource: + return AsyncLockdownsResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def access_rules(self) -> AsyncAccessRules: - return AsyncAccessRules(self._client) + def access_rules(self) -> AsyncAccessRulesResource: + return AsyncAccessRulesResource(self._client) @cached_property - def ua_rules(self) -> AsyncUARules: - return AsyncUARules(self._client) + def ua_rules(self) -> AsyncUARulesResource: + return AsyncUARulesResource(self._client) @cached_property - def waf(self) -> AsyncWAF: - return AsyncWAF(self._client) + def waf(self) -> AsyncWAFResource: + return AsyncWAFResource(self._client) @cached_property - def with_raw_response(self) -> AsyncFirewallWithRawResponse: - return AsyncFirewallWithRawResponse(self) + def with_raw_response(self) -> AsyncFirewallResourceWithRawResponse: + return AsyncFirewallResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFirewallWithStreamingResponse: - return AsyncFirewallWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFirewallResourceWithStreamingResponse: + return AsyncFirewallResourceWithStreamingResponse(self) -class FirewallWithRawResponse: - def __init__(self, firewall: Firewall) -> None: +class FirewallResourceWithRawResponse: + def __init__(self, firewall: FirewallResource) -> None: self._firewall = firewall @cached_property - def lockdowns(self) -> LockdownsWithRawResponse: - return LockdownsWithRawResponse(self._firewall.lockdowns) + def lockdowns(self) -> LockdownsResourceWithRawResponse: + return LockdownsResourceWithRawResponse(self._firewall.lockdowns) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._firewall.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._firewall.rules) @cached_property - def access_rules(self) -> AccessRulesWithRawResponse: - return AccessRulesWithRawResponse(self._firewall.access_rules) + def access_rules(self) -> AccessRulesResourceWithRawResponse: + return AccessRulesResourceWithRawResponse(self._firewall.access_rules) @cached_property - def ua_rules(self) -> UARulesWithRawResponse: - return UARulesWithRawResponse(self._firewall.ua_rules) + def ua_rules(self) -> UARulesResourceWithRawResponse: + return UARulesResourceWithRawResponse(self._firewall.ua_rules) @cached_property - def waf(self) -> WAFWithRawResponse: - return WAFWithRawResponse(self._firewall.waf) + def waf(self) -> WAFResourceWithRawResponse: + return WAFResourceWithRawResponse(self._firewall.waf) -class AsyncFirewallWithRawResponse: - def __init__(self, firewall: AsyncFirewall) -> None: +class AsyncFirewallResourceWithRawResponse: + def __init__(self, firewall: AsyncFirewallResource) -> None: self._firewall = firewall @cached_property - def lockdowns(self) -> AsyncLockdownsWithRawResponse: - return AsyncLockdownsWithRawResponse(self._firewall.lockdowns) + def lockdowns(self) -> AsyncLockdownsResourceWithRawResponse: + return AsyncLockdownsResourceWithRawResponse(self._firewall.lockdowns) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._firewall.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._firewall.rules) @cached_property - def access_rules(self) -> AsyncAccessRulesWithRawResponse: - return AsyncAccessRulesWithRawResponse(self._firewall.access_rules) + def access_rules(self) -> AsyncAccessRulesResourceWithRawResponse: + return AsyncAccessRulesResourceWithRawResponse(self._firewall.access_rules) @cached_property - def ua_rules(self) -> AsyncUARulesWithRawResponse: - return AsyncUARulesWithRawResponse(self._firewall.ua_rules) + def ua_rules(self) -> AsyncUARulesResourceWithRawResponse: + return AsyncUARulesResourceWithRawResponse(self._firewall.ua_rules) @cached_property - def waf(self) -> AsyncWAFWithRawResponse: - return AsyncWAFWithRawResponse(self._firewall.waf) + def waf(self) -> AsyncWAFResourceWithRawResponse: + return AsyncWAFResourceWithRawResponse(self._firewall.waf) -class FirewallWithStreamingResponse: - def __init__(self, firewall: Firewall) -> None: +class FirewallResourceWithStreamingResponse: + def __init__(self, firewall: FirewallResource) -> None: self._firewall = firewall @cached_property - def lockdowns(self) -> LockdownsWithStreamingResponse: - return LockdownsWithStreamingResponse(self._firewall.lockdowns) + def lockdowns(self) -> LockdownsResourceWithStreamingResponse: + return LockdownsResourceWithStreamingResponse(self._firewall.lockdowns) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._firewall.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._firewall.rules) @cached_property - def access_rules(self) -> AccessRulesWithStreamingResponse: - return AccessRulesWithStreamingResponse(self._firewall.access_rules) + def access_rules(self) -> AccessRulesResourceWithStreamingResponse: + return AccessRulesResourceWithStreamingResponse(self._firewall.access_rules) @cached_property - def ua_rules(self) -> UARulesWithStreamingResponse: - return UARulesWithStreamingResponse(self._firewall.ua_rules) + def ua_rules(self) -> UARulesResourceWithStreamingResponse: + return UARulesResourceWithStreamingResponse(self._firewall.ua_rules) @cached_property - def waf(self) -> WAFWithStreamingResponse: - return WAFWithStreamingResponse(self._firewall.waf) + def waf(self) -> WAFResourceWithStreamingResponse: + return WAFResourceWithStreamingResponse(self._firewall.waf) -class AsyncFirewallWithStreamingResponse: - def __init__(self, firewall: AsyncFirewall) -> None: +class AsyncFirewallResourceWithStreamingResponse: + def __init__(self, firewall: AsyncFirewallResource) -> None: self._firewall = firewall @cached_property - def lockdowns(self) -> AsyncLockdownsWithStreamingResponse: - return AsyncLockdownsWithStreamingResponse(self._firewall.lockdowns) + def lockdowns(self) -> AsyncLockdownsResourceWithStreamingResponse: + return AsyncLockdownsResourceWithStreamingResponse(self._firewall.lockdowns) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._firewall.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._firewall.rules) @cached_property - def access_rules(self) -> AsyncAccessRulesWithStreamingResponse: - return AsyncAccessRulesWithStreamingResponse(self._firewall.access_rules) + def access_rules(self) -> AsyncAccessRulesResourceWithStreamingResponse: + return AsyncAccessRulesResourceWithStreamingResponse(self._firewall.access_rules) @cached_property - def ua_rules(self) -> AsyncUARulesWithStreamingResponse: - return AsyncUARulesWithStreamingResponse(self._firewall.ua_rules) + def ua_rules(self) -> AsyncUARulesResourceWithStreamingResponse: + return AsyncUARulesResourceWithStreamingResponse(self._firewall.ua_rules) @cached_property - def waf(self) -> AsyncWAFWithStreamingResponse: - return AsyncWAFWithStreamingResponse(self._firewall.waf) + def waf(self) -> AsyncWAFResourceWithStreamingResponse: + return AsyncWAFResourceWithStreamingResponse(self._firewall.waf) diff --git a/src/cloudflare/resources/firewall/lockdowns.py b/src/cloudflare/resources/firewall/lockdowns.py index f3600c66241..df602e6eaa2 100644 --- a/src/cloudflare/resources/firewall/lockdowns.py +++ b/src/cloudflare/resources/firewall/lockdowns.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, Union, Optional, cast +from datetime import datetime import httpx @@ -26,24 +27,25 @@ make_request_options, ) from ...types.firewall import ( - FirewallZoneLockdown, - LockdownDeleteResponse, lockdown_list_params, lockdown_create_params, + lockdown_delete_params, lockdown_update_params, ) +from ...types.firewall.lockdown import Lockdown +from ...types.firewall.lockdown_delete_response import LockdownDeleteResponse -__all__ = ["Lockdowns", "AsyncLockdowns"] +__all__ = ["LockdownsResource", "AsyncLockdownsResource"] -class Lockdowns(SyncAPIResource): +class LockdownsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LockdownsWithRawResponse: - return LockdownsWithRawResponse(self) + def with_raw_response(self) -> LockdownsResourceWithRawResponse: + return LockdownsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LockdownsWithStreamingResponse: - return LockdownsWithStreamingResponse(self) + def with_streaming_response(self) -> LockdownsResourceWithStreamingResponse: + return LockdownsResourceWithStreamingResponse(self) def create( self, @@ -56,7 +58,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallZoneLockdown]: + ) -> Lockdown: """ Creates a new Zone Lockdown rule. @@ -81,9 +83,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Lockdown]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallZoneLockdown]], ResultWrapper[FirewallZoneLockdown]), + cast_to=cast(Type[Lockdown], ResultWrapper[Lockdown]), ) def update( @@ -98,7 +100,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallZoneLockdown]: + ) -> Lockdown: """ Updates an existing Zone Lockdown rule. @@ -127,20 +129,22 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Lockdown]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallZoneLockdown]], ResultWrapper[FirewallZoneLockdown]), + cast_to=cast(Type[Lockdown], ResultWrapper[Lockdown]), ) def list( self, zone_identifier: str, *, + created_on: Union[str, datetime] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, description_search: str | NotGiven = NOT_GIVEN, ip: str | NotGiven = NOT_GIVEN, ip_range_search: str | NotGiven = NOT_GIVEN, ip_search: str | NotGiven = NOT_GIVEN, + modified_on: Union[str, datetime] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -151,7 +155,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[FirewallZoneLockdown]: + ) -> SyncV4PagePaginationArray[Lockdown]: """Fetches Zone Lockdown rules. You can filter the results using several optional @@ -160,6 +164,8 @@ def list( Args: zone_identifier: Identifier + created_on: The timestamp of when the rule was created. + description: A string to search for in the description of existing rules. description_search: A string to search for in the description of existing rules. @@ -170,6 +176,8 @@ def list( ip_search: A single IP address to search for in existing rules. + modified_on: The timestamp of when the rule was last modified. + page: Page number of paginated results. per_page: The maximum number of results per page. You can only set the value to `1` or to @@ -193,7 +201,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/firewall/lockdowns", - page=SyncV4PagePaginationArray[FirewallZoneLockdown], + page=SyncV4PagePaginationArray[Lockdown], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -201,11 +209,13 @@ def list( timeout=timeout, query=maybe_transform( { + "created_on": created_on, "description": description, "description_search": description_search, "ip": ip, "ip_range_search": ip_range_search, "ip_search": ip_search, + "modified_on": modified_on, "page": page, "per_page": per_page, "priority": priority, @@ -214,7 +224,7 @@ def list( lockdown_list_params.LockdownListParams, ), ), - model=FirewallZoneLockdown, + model=Lockdown, ) def delete( @@ -222,6 +232,7 @@ def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -251,12 +262,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._delete( f"/zones/{zone_identifier}/firewall/lockdowns/{id}", + body=maybe_transform(body, lockdown_delete_params.LockdownDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LockdownDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[LockdownDeleteResponse]], ResultWrapper[LockdownDeleteResponse]), ) @@ -272,7 +284,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallZoneLockdown]: + ) -> Lockdown: """ Fetches the details of a Zone Lockdown rule. @@ -300,20 +312,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Lockdown]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallZoneLockdown]], ResultWrapper[FirewallZoneLockdown]), + cast_to=cast(Type[Lockdown], ResultWrapper[Lockdown]), ) -class AsyncLockdowns(AsyncAPIResource): +class AsyncLockdownsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLockdownsWithRawResponse: - return AsyncLockdownsWithRawResponse(self) + def with_raw_response(self) -> AsyncLockdownsResourceWithRawResponse: + return AsyncLockdownsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLockdownsWithStreamingResponse: - return AsyncLockdownsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLockdownsResourceWithStreamingResponse: + return AsyncLockdownsResourceWithStreamingResponse(self) async def create( self, @@ -326,7 +338,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallZoneLockdown]: + ) -> Lockdown: """ Creates a new Zone Lockdown rule. @@ -351,9 +363,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Lockdown]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallZoneLockdown]], ResultWrapper[FirewallZoneLockdown]), + cast_to=cast(Type[Lockdown], ResultWrapper[Lockdown]), ) async def update( @@ -368,7 +380,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallZoneLockdown]: + ) -> Lockdown: """ Updates an existing Zone Lockdown rule. @@ -397,20 +409,22 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Lockdown]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallZoneLockdown]], ResultWrapper[FirewallZoneLockdown]), + cast_to=cast(Type[Lockdown], ResultWrapper[Lockdown]), ) def list( self, zone_identifier: str, *, + created_on: Union[str, datetime] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, description_search: str | NotGiven = NOT_GIVEN, ip: str | NotGiven = NOT_GIVEN, ip_range_search: str | NotGiven = NOT_GIVEN, ip_search: str | NotGiven = NOT_GIVEN, + modified_on: Union[str, datetime] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, priority: float | NotGiven = NOT_GIVEN, @@ -421,7 +435,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[FirewallZoneLockdown, AsyncV4PagePaginationArray[FirewallZoneLockdown]]: + ) -> AsyncPaginator[Lockdown, AsyncV4PagePaginationArray[Lockdown]]: """Fetches Zone Lockdown rules. You can filter the results using several optional @@ -430,6 +444,8 @@ def list( Args: zone_identifier: Identifier + created_on: The timestamp of when the rule was created. + description: A string to search for in the description of existing rules. description_search: A string to search for in the description of existing rules. @@ -440,6 +456,8 @@ def list( ip_search: A single IP address to search for in existing rules. + modified_on: The timestamp of when the rule was last modified. + page: Page number of paginated results. per_page: The maximum number of results per page. You can only set the value to `1` or to @@ -463,7 +481,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/firewall/lockdowns", - page=AsyncV4PagePaginationArray[FirewallZoneLockdown], + page=AsyncV4PagePaginationArray[Lockdown], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -471,11 +489,13 @@ def list( timeout=timeout, query=maybe_transform( { + "created_on": created_on, "description": description, "description_search": description_search, "ip": ip, "ip_range_search": ip_range_search, "ip_search": ip_search, + "modified_on": modified_on, "page": page, "per_page": per_page, "priority": priority, @@ -484,7 +504,7 @@ def list( lockdown_list_params.LockdownListParams, ), ), - model=FirewallZoneLockdown, + model=Lockdown, ) async def delete( @@ -492,6 +512,7 @@ async def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -521,12 +542,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._delete( f"/zones/{zone_identifier}/firewall/lockdowns/{id}", + body=await async_maybe_transform(body, lockdown_delete_params.LockdownDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LockdownDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[LockdownDeleteResponse]], ResultWrapper[LockdownDeleteResponse]), ) @@ -542,7 +564,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallZoneLockdown]: + ) -> Lockdown: """ Fetches the details of a Zone Lockdown rule. @@ -570,14 +592,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Lockdown]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallZoneLockdown]], ResultWrapper[FirewallZoneLockdown]), + cast_to=cast(Type[Lockdown], ResultWrapper[Lockdown]), ) -class LockdownsWithRawResponse: - def __init__(self, lockdowns: Lockdowns) -> None: +class LockdownsResourceWithRawResponse: + def __init__(self, lockdowns: LockdownsResource) -> None: self._lockdowns = lockdowns self.create = to_raw_response_wrapper( @@ -597,8 +619,8 @@ def __init__(self, lockdowns: Lockdowns) -> None: ) -class AsyncLockdownsWithRawResponse: - def __init__(self, lockdowns: AsyncLockdowns) -> None: +class AsyncLockdownsResourceWithRawResponse: + def __init__(self, lockdowns: AsyncLockdownsResource) -> None: self._lockdowns = lockdowns self.create = async_to_raw_response_wrapper( @@ -618,8 +640,8 @@ def __init__(self, lockdowns: AsyncLockdowns) -> None: ) -class LockdownsWithStreamingResponse: - def __init__(self, lockdowns: Lockdowns) -> None: +class LockdownsResourceWithStreamingResponse: + def __init__(self, lockdowns: LockdownsResource) -> None: self._lockdowns = lockdowns self.create = to_streamed_response_wrapper( @@ -639,8 +661,8 @@ def __init__(self, lockdowns: Lockdowns) -> None: ) -class AsyncLockdownsWithStreamingResponse: - def __init__(self, lockdowns: AsyncLockdowns) -> None: +class AsyncLockdownsResourceWithStreamingResponse: + def __init__(self, lockdowns: AsyncLockdownsResource) -> None: self._lockdowns = lockdowns self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/firewall/rules.py b/src/cloudflare/resources/firewall/rules.py index 899df1780bd..03d832a407a 100644 --- a/src/cloudflare/resources/firewall/rules.py +++ b/src/cloudflare/resources/firewall/rules.py @@ -26,27 +26,28 @@ make_request_options, ) from ...types.firewall import ( - RuleEditResponse, - FirewallFilterRule, - RuleCreateResponse, + rule_get_params, rule_edit_params, rule_list_params, rule_create_params, rule_delete_params, rule_update_params, ) +from ...types.firewall.firewall_rule import FirewallRule +from ...types.firewall.rule_edit_response import RuleEditResponse +from ...types.firewall.rule_create_response import RuleCreateResponse -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) def create( self, @@ -84,7 +85,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), ) @@ -101,7 +102,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallFilterRule]: + ) -> FirewallRule: """ Updates an existing firewall rule. @@ -130,15 +131,16 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallRule]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilterRule]], ResultWrapper[FirewallFilterRule]), + cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) def list( self, zone_identifier: str, *, + id: str | NotGiven = NOT_GIVEN, action: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, @@ -150,7 +152,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[FirewallFilterRule]: + ) -> SyncV4PagePaginationArray[FirewallRule]: """Fetches firewall rules in a zone. You can filter the results using several @@ -159,6 +161,8 @@ def list( Args: zone_identifier: Identifier + id: The unique identifier of the firewall rule. + action: The action to search for. Must be an exact match. description: A case-insensitive string to find in the description. @@ -181,7 +185,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/firewall/rules", - page=SyncV4PagePaginationArray[FirewallFilterRule], + page=SyncV4PagePaginationArray[FirewallRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,6 +193,7 @@ def list( timeout=timeout, query=maybe_transform( { + "id": id, "action": action, "description": description, "page": page, @@ -198,7 +203,7 @@ def list( rule_list_params.RuleListParams, ), ), - model=FirewallFilterRule, + model=FirewallRule, ) def delete( @@ -213,7 +218,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallFilterRule]: + ) -> FirewallRule: """ Deletes an existing firewall rule. @@ -247,9 +252,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallRule]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilterRule]], ResultWrapper[FirewallFilterRule]), + cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) def edit( @@ -293,30 +298,33 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleEditResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleEditResponse]], ResultWrapper[RuleEditResponse]), ) def get( self, - id: str, - *, zone_identifier: str, + *, + path_id: str, + query_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[FirewallFilterRule]: + ) -> FirewallRule: """ Fetches the details of a firewall rule. Args: + path_id: The unique identifier of the firewall rule. + zone_identifier: Identifier - id: The unique identifier of the firewall rule. + query_id: The unique identifier of the firewall rule. extra_headers: Send extra headers @@ -326,31 +334,32 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ + if not path_id: + raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._get( - f"/zones/{zone_identifier}/firewall/rules/{id}", + f"/zones/{zone_identifier}/firewall/rules/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + query=maybe_transform({"id": query_id}, rule_get_params.RuleGetParams), + post_parser=ResultWrapper[FirewallRule]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilterRule]], ResultWrapper[FirewallFilterRule]), + cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) async def create( self, @@ -388,7 +397,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), ) @@ -405,7 +414,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallFilterRule]: + ) -> FirewallRule: """ Updates an existing firewall rule. @@ -434,15 +443,16 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallRule]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilterRule]], ResultWrapper[FirewallFilterRule]), + cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) def list( self, zone_identifier: str, *, + id: str | NotGiven = NOT_GIVEN, action: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, @@ -454,7 +464,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[FirewallFilterRule, AsyncV4PagePaginationArray[FirewallFilterRule]]: + ) -> AsyncPaginator[FirewallRule, AsyncV4PagePaginationArray[FirewallRule]]: """Fetches firewall rules in a zone. You can filter the results using several @@ -463,6 +473,8 @@ def list( Args: zone_identifier: Identifier + id: The unique identifier of the firewall rule. + action: The action to search for. Must be an exact match. description: A case-insensitive string to find in the description. @@ -485,7 +497,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/firewall/rules", - page=AsyncV4PagePaginationArray[FirewallFilterRule], + page=AsyncV4PagePaginationArray[FirewallRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -493,6 +505,7 @@ def list( timeout=timeout, query=maybe_transform( { + "id": id, "action": action, "description": description, "page": page, @@ -502,7 +515,7 @@ def list( rule_list_params.RuleListParams, ), ), - model=FirewallFilterRule, + model=FirewallRule, ) async def delete( @@ -517,7 +530,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FirewallFilterRule]: + ) -> FirewallRule: """ Deletes an existing firewall rule. @@ -551,9 +564,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FirewallRule]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilterRule]], ResultWrapper[FirewallFilterRule]), + cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) async def edit( @@ -597,30 +610,33 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleEditResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleEditResponse]], ResultWrapper[RuleEditResponse]), ) async def get( self, - id: str, - *, zone_identifier: str, + *, + path_id: str, + query_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[FirewallFilterRule]: + ) -> FirewallRule: """ Fetches the details of a firewall rule. Args: + path_id: The unique identifier of the firewall rule. + zone_identifier: Identifier - id: The unique identifier of the firewall rule. + query_id: The unique identifier of the firewall rule. extra_headers: Send extra headers @@ -630,25 +646,26 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ + if not path_id: + raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._get( - f"/zones/{zone_identifier}/firewall/rules/{id}", + f"/zones/{zone_identifier}/firewall/rules/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + query=await async_maybe_transform({"id": query_id}, rule_get_params.RuleGetParams), + post_parser=ResultWrapper[FirewallRule]._unwrapper, ), - cast_to=cast(Type[Optional[FirewallFilterRule]], ResultWrapper[FirewallFilterRule]), + cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_raw_response_wrapper( @@ -671,8 +688,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_raw_response_wrapper( @@ -695,8 +712,8 @@ def __init__(self, rules: AsyncRules) -> None: ) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_streamed_response_wrapper( @@ -719,8 +736,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/firewall/ua_rules.py b/src/cloudflare/resources/firewall/ua_rules.py index 8b1db683b3b..16158d802a2 100644 --- a/src/cloudflare/resources/firewall/ua_rules.py +++ b/src/cloudflare/resources/firewall/ua_rules.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, Type, cast import httpx @@ -25,28 +25,24 @@ AsyncPaginator, make_request_options, ) -from ...types.firewall import ( - UARuleGetResponse, - UARuleListResponse, - UARuleCreateResponse, - UARuleDeleteResponse, - UARuleUpdateResponse, - ua_rule_list_params, - ua_rule_create_params, - ua_rule_update_params, -) +from ...types.firewall import ua_rule_list_params, ua_rule_create_params, ua_rule_delete_params, ua_rule_update_params +from ...types.firewall.ua_rule_get_response import UARuleGetResponse +from ...types.firewall.ua_rule_list_response import UARuleListResponse +from ...types.firewall.ua_rule_create_response import UARuleCreateResponse +from ...types.firewall.ua_rule_delete_response import UARuleDeleteResponse +from ...types.firewall.ua_rule_update_response import UARuleUpdateResponse -__all__ = ["UARules", "AsyncUARules"] +__all__ = ["UARulesResource", "AsyncUARulesResource"] -class UARules(SyncAPIResource): +class UARulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> UARulesWithRawResponse: - return UARulesWithRawResponse(self) + def with_raw_response(self) -> UARulesResourceWithRawResponse: + return UARulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UARulesWithStreamingResponse: - return UARulesWithStreamingResponse(self) + def with_streaming_response(self) -> UARulesResourceWithStreamingResponse: + return UARulesResourceWithStreamingResponse(self) def create( self, @@ -59,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UARuleCreateResponse]: + ) -> UARuleCreateResponse: """ Creates a new User Agent Blocking rule in a zone. @@ -77,7 +73,7 @@ def create( if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return cast( - Optional[UARuleCreateResponse], + UARuleCreateResponse, self._post( f"/zones/{zone_identifier}/firewall/ua_rules", body=maybe_transform(body, ua_rule_create_params.UARuleCreateParams), @@ -86,7 +82,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UARuleCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UARuleCreateResponse] @@ -106,7 +102,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UARuleUpdateResponse]: + ) -> UARuleUpdateResponse: """ Updates an existing User Agent Blocking rule. @@ -128,7 +124,7 @@ def update( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return cast( - Optional[UARuleUpdateResponse], + UARuleUpdateResponse, self._put( f"/zones/{zone_identifier}/firewall/ua_rules/{id}", body=maybe_transform(body, ua_rule_update_params.UARuleUpdateParams), @@ -137,7 +133,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UARuleUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UARuleUpdateResponse] @@ -217,13 +213,14 @@ def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[UARuleDeleteResponse]: + ) -> UARuleDeleteResponse: """ Deletes an existing User Agent Blocking rule. @@ -246,14 +243,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._delete( f"/zones/{zone_identifier}/firewall/ua_rules/{id}", + body=maybe_transform(body, ua_rule_delete_params.UARuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UARuleDeleteResponse]._unwrapper, ), - cast_to=cast(Type[Optional[UARuleDeleteResponse]], ResultWrapper[UARuleDeleteResponse]), + cast_to=cast(Type[UARuleDeleteResponse], ResultWrapper[UARuleDeleteResponse]), ) def get( @@ -267,7 +265,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UARuleGetResponse]: + ) -> UARuleGetResponse: """ Fetches the details of a User Agent Blocking rule. @@ -289,7 +287,7 @@ def get( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return cast( - Optional[UARuleGetResponse], + UARuleGetResponse, self._get( f"/zones/{zone_identifier}/firewall/ua_rules/{id}", options=make_request_options( @@ -297,7 +295,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UARuleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UARuleGetResponse] @@ -306,14 +304,14 @@ def get( ) -class AsyncUARules(AsyncAPIResource): +class AsyncUARulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncUARulesWithRawResponse: - return AsyncUARulesWithRawResponse(self) + def with_raw_response(self) -> AsyncUARulesResourceWithRawResponse: + return AsyncUARulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUARulesWithStreamingResponse: - return AsyncUARulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncUARulesResourceWithStreamingResponse: + return AsyncUARulesResourceWithStreamingResponse(self) async def create( self, @@ -326,7 +324,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UARuleCreateResponse]: + ) -> UARuleCreateResponse: """ Creates a new User Agent Blocking rule in a zone. @@ -344,7 +342,7 @@ async def create( if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return cast( - Optional[UARuleCreateResponse], + UARuleCreateResponse, await self._post( f"/zones/{zone_identifier}/firewall/ua_rules", body=await async_maybe_transform(body, ua_rule_create_params.UARuleCreateParams), @@ -353,7 +351,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UARuleCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UARuleCreateResponse] @@ -373,7 +371,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UARuleUpdateResponse]: + ) -> UARuleUpdateResponse: """ Updates an existing User Agent Blocking rule. @@ -395,7 +393,7 @@ async def update( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return cast( - Optional[UARuleUpdateResponse], + UARuleUpdateResponse, await self._put( f"/zones/{zone_identifier}/firewall/ua_rules/{id}", body=await async_maybe_transform(body, ua_rule_update_params.UARuleUpdateParams), @@ -404,7 +402,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UARuleUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UARuleUpdateResponse] @@ -484,13 +482,14 @@ async def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[UARuleDeleteResponse]: + ) -> UARuleDeleteResponse: """ Deletes an existing User Agent Blocking rule. @@ -513,14 +512,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._delete( f"/zones/{zone_identifier}/firewall/ua_rules/{id}", + body=await async_maybe_transform(body, ua_rule_delete_params.UARuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UARuleDeleteResponse]._unwrapper, ), - cast_to=cast(Type[Optional[UARuleDeleteResponse]], ResultWrapper[UARuleDeleteResponse]), + cast_to=cast(Type[UARuleDeleteResponse], ResultWrapper[UARuleDeleteResponse]), ) async def get( @@ -534,7 +534,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UARuleGetResponse]: + ) -> UARuleGetResponse: """ Fetches the details of a User Agent Blocking rule. @@ -556,7 +556,7 @@ async def get( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return cast( - Optional[UARuleGetResponse], + UARuleGetResponse, await self._get( f"/zones/{zone_identifier}/firewall/ua_rules/{id}", options=make_request_options( @@ -564,7 +564,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UARuleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UARuleGetResponse] @@ -573,8 +573,8 @@ async def get( ) -class UARulesWithRawResponse: - def __init__(self, ua_rules: UARules) -> None: +class UARulesResourceWithRawResponse: + def __init__(self, ua_rules: UARulesResource) -> None: self._ua_rules = ua_rules self.create = to_raw_response_wrapper( @@ -594,8 +594,8 @@ def __init__(self, ua_rules: UARules) -> None: ) -class AsyncUARulesWithRawResponse: - def __init__(self, ua_rules: AsyncUARules) -> None: +class AsyncUARulesResourceWithRawResponse: + def __init__(self, ua_rules: AsyncUARulesResource) -> None: self._ua_rules = ua_rules self.create = async_to_raw_response_wrapper( @@ -615,8 +615,8 @@ def __init__(self, ua_rules: AsyncUARules) -> None: ) -class UARulesWithStreamingResponse: - def __init__(self, ua_rules: UARules) -> None: +class UARulesResourceWithStreamingResponse: + def __init__(self, ua_rules: UARulesResource) -> None: self._ua_rules = ua_rules self.create = to_streamed_response_wrapper( @@ -636,8 +636,8 @@ def __init__(self, ua_rules: UARules) -> None: ) -class AsyncUARulesWithStreamingResponse: - def __init__(self, ua_rules: AsyncUARules) -> None: +class AsyncUARulesResourceWithStreamingResponse: + def __init__(self, ua_rules: AsyncUARulesResource) -> None: self._ua_rules = ua_rules self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/firewall/waf/__init__.py b/src/cloudflare/resources/firewall/waf/__init__.py index 7b42b58fae5..03886bfc2c7 100644 --- a/src/cloudflare/resources/firewall/waf/__init__.py +++ b/src/cloudflare/resources/firewall/waf/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .waf import ( - WAF, - AsyncWAF, - WAFWithRawResponse, - AsyncWAFWithRawResponse, - WAFWithStreamingResponse, - AsyncWAFWithStreamingResponse, + WAFResource, + AsyncWAFResource, + WAFResourceWithRawResponse, + AsyncWAFResourceWithRawResponse, + WAFResourceWithStreamingResponse, + AsyncWAFResourceWithStreamingResponse, ) from .packages import ( - Packages, - AsyncPackages, - PackagesWithRawResponse, - AsyncPackagesWithRawResponse, - PackagesWithStreamingResponse, - AsyncPackagesWithStreamingResponse, + PackagesResource, + AsyncPackagesResource, + PackagesResourceWithRawResponse, + AsyncPackagesResourceWithRawResponse, + PackagesResourceWithStreamingResponse, + AsyncPackagesResourceWithStreamingResponse, ) from .overrides import ( - Overrides, - AsyncOverrides, - OverridesWithRawResponse, - AsyncOverridesWithRawResponse, - OverridesWithStreamingResponse, - AsyncOverridesWithStreamingResponse, + OverridesResource, + AsyncOverridesResource, + OverridesResourceWithRawResponse, + AsyncOverridesResourceWithRawResponse, + OverridesResourceWithStreamingResponse, + AsyncOverridesResourceWithStreamingResponse, ) __all__ = [ - "Overrides", - "AsyncOverrides", - "OverridesWithRawResponse", - "AsyncOverridesWithRawResponse", - "OverridesWithStreamingResponse", - "AsyncOverridesWithStreamingResponse", - "Packages", - "AsyncPackages", - "PackagesWithRawResponse", - "AsyncPackagesWithRawResponse", - "PackagesWithStreamingResponse", - "AsyncPackagesWithStreamingResponse", - "WAF", - "AsyncWAF", - "WAFWithRawResponse", - "AsyncWAFWithRawResponse", - "WAFWithStreamingResponse", - "AsyncWAFWithStreamingResponse", + "OverridesResource", + "AsyncOverridesResource", + "OverridesResourceWithRawResponse", + "AsyncOverridesResourceWithRawResponse", + "OverridesResourceWithStreamingResponse", + "AsyncOverridesResourceWithStreamingResponse", + "PackagesResource", + "AsyncPackagesResource", + "PackagesResourceWithRawResponse", + "AsyncPackagesResourceWithRawResponse", + "PackagesResourceWithStreamingResponse", + "AsyncPackagesResourceWithStreamingResponse", + "WAFResource", + "AsyncWAFResource", + "WAFResourceWithRawResponse", + "AsyncWAFResourceWithRawResponse", + "WAFResourceWithStreamingResponse", + "AsyncWAFResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/firewall/waf/overrides.py b/src/cloudflare/resources/firewall/waf/overrides.py index d6dceea4f8b..2ead7d5a916 100644 --- a/src/cloudflare/resources/firewall/waf/overrides.py +++ b/src/cloudflare/resources/firewall/waf/overrides.py @@ -26,24 +26,25 @@ make_request_options, ) from ....types.firewall.waf import ( - WAFOverride, - OverrideDeleteResponse, override_list_params, override_create_params, + override_delete_params, override_update_params, ) +from ....types.firewall.waf.override import Override +from ....types.firewall.waf.override_delete_response import OverrideDeleteResponse -__all__ = ["Overrides", "AsyncOverrides"] +__all__ = ["OverridesResource", "AsyncOverridesResource"] -class Overrides(SyncAPIResource): +class OverridesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OverridesWithRawResponse: - return OverridesWithRawResponse(self) + def with_raw_response(self) -> OverridesResourceWithRawResponse: + return OverridesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OverridesWithStreamingResponse: - return OverridesWithStreamingResponse(self) + def with_streaming_response(self) -> OverridesResourceWithStreamingResponse: + return OverridesResourceWithStreamingResponse(self) def create( self, @@ -56,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WAFOverride]: + ) -> Override: """ Creates a URI-based WAF override for a zone. @@ -84,9 +85,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Override]._unwrapper, ), - cast_to=cast(Type[Optional[WAFOverride]], ResultWrapper[WAFOverride]), + cast_to=cast(Type[Override], ResultWrapper[Override]), ) def update( @@ -101,7 +102,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WAFOverride]: + ) -> Override: """ Updates an existing URI-based WAF override. @@ -133,9 +134,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Override]._unwrapper, ), - cast_to=cast(Type[Optional[WAFOverride]], ResultWrapper[WAFOverride]), + cast_to=cast(Type[Override], ResultWrapper[Override]), ) def list( @@ -150,7 +151,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[WAFOverride]: + ) -> SyncV4PagePaginationArray[Override]: """ Fetches the URI-based WAF overrides in a zone. @@ -176,7 +177,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/firewall/waf/overrides", - page=SyncV4PagePaginationArray[WAFOverride], + page=SyncV4PagePaginationArray[Override], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -190,7 +191,7 @@ def list( override_list_params.OverrideListParams, ), ), - model=WAFOverride, + model=Override, ) def delete( @@ -198,6 +199,7 @@ def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -230,12 +232,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._delete( f"/zones/{zone_identifier}/firewall/waf/overrides/{id}", + body=maybe_transform(body, override_delete_params.OverrideDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OverrideDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[OverrideDeleteResponse]], ResultWrapper[OverrideDeleteResponse]), ) @@ -251,7 +254,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WAFOverride]: + ) -> Override: """ Fetches the details of a URI-based WAF override. @@ -282,20 +285,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Override]._unwrapper, ), - cast_to=cast(Type[Optional[WAFOverride]], ResultWrapper[WAFOverride]), + cast_to=cast(Type[Override], ResultWrapper[Override]), ) -class AsyncOverrides(AsyncAPIResource): +class AsyncOverridesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOverridesWithRawResponse: - return AsyncOverridesWithRawResponse(self) + def with_raw_response(self) -> AsyncOverridesResourceWithRawResponse: + return AsyncOverridesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOverridesWithStreamingResponse: - return AsyncOverridesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOverridesResourceWithStreamingResponse: + return AsyncOverridesResourceWithStreamingResponse(self) async def create( self, @@ -308,7 +311,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WAFOverride]: + ) -> Override: """ Creates a URI-based WAF override for a zone. @@ -336,9 +339,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Override]._unwrapper, ), - cast_to=cast(Type[Optional[WAFOverride]], ResultWrapper[WAFOverride]), + cast_to=cast(Type[Override], ResultWrapper[Override]), ) async def update( @@ -353,7 +356,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WAFOverride]: + ) -> Override: """ Updates an existing URI-based WAF override. @@ -385,9 +388,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Override]._unwrapper, ), - cast_to=cast(Type[Optional[WAFOverride]], ResultWrapper[WAFOverride]), + cast_to=cast(Type[Override], ResultWrapper[Override]), ) def list( @@ -402,7 +405,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WAFOverride, AsyncV4PagePaginationArray[WAFOverride]]: + ) -> AsyncPaginator[Override, AsyncV4PagePaginationArray[Override]]: """ Fetches the URI-based WAF overrides in a zone. @@ -428,7 +431,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/firewall/waf/overrides", - page=AsyncV4PagePaginationArray[WAFOverride], + page=AsyncV4PagePaginationArray[Override], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -442,7 +445,7 @@ def list( override_list_params.OverrideListParams, ), ), - model=WAFOverride, + model=Override, ) async def delete( @@ -450,6 +453,7 @@ async def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -482,12 +486,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._delete( f"/zones/{zone_identifier}/firewall/waf/overrides/{id}", + body=await async_maybe_transform(body, override_delete_params.OverrideDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OverrideDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[OverrideDeleteResponse]], ResultWrapper[OverrideDeleteResponse]), ) @@ -503,7 +508,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WAFOverride]: + ) -> Override: """ Fetches the details of a URI-based WAF override. @@ -534,14 +539,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Override]._unwrapper, ), - cast_to=cast(Type[Optional[WAFOverride]], ResultWrapper[WAFOverride]), + cast_to=cast(Type[Override], ResultWrapper[Override]), ) -class OverridesWithRawResponse: - def __init__(self, overrides: Overrides) -> None: +class OverridesResourceWithRawResponse: + def __init__(self, overrides: OverridesResource) -> None: self._overrides = overrides self.create = to_raw_response_wrapper( @@ -561,8 +566,8 @@ def __init__(self, overrides: Overrides) -> None: ) -class AsyncOverridesWithRawResponse: - def __init__(self, overrides: AsyncOverrides) -> None: +class AsyncOverridesResourceWithRawResponse: + def __init__(self, overrides: AsyncOverridesResource) -> None: self._overrides = overrides self.create = async_to_raw_response_wrapper( @@ -582,8 +587,8 @@ def __init__(self, overrides: AsyncOverrides) -> None: ) -class OverridesWithStreamingResponse: - def __init__(self, overrides: Overrides) -> None: +class OverridesResourceWithStreamingResponse: + def __init__(self, overrides: OverridesResource) -> None: self._overrides = overrides self.create = to_streamed_response_wrapper( @@ -603,8 +608,8 @@ def __init__(self, overrides: Overrides) -> None: ) -class AsyncOverridesWithStreamingResponse: - def __init__(self, overrides: AsyncOverrides) -> None: +class AsyncOverridesResourceWithStreamingResponse: + def __init__(self, overrides: AsyncOverridesResource) -> None: self._overrides = overrides self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/firewall/waf/packages/__init__.py b/src/cloudflare/resources/firewall/waf/packages/__init__.py index a49b4e49251..2398adf2647 100644 --- a/src/cloudflare/resources/firewall/waf/packages/__init__.py +++ b/src/cloudflare/resources/firewall/waf/packages/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .groups import ( - Groups, - AsyncGroups, - GroupsWithRawResponse, - AsyncGroupsWithRawResponse, - GroupsWithStreamingResponse, - AsyncGroupsWithStreamingResponse, + GroupsResource, + AsyncGroupsResource, + GroupsResourceWithRawResponse, + AsyncGroupsResourceWithRawResponse, + GroupsResourceWithStreamingResponse, + AsyncGroupsResourceWithStreamingResponse, ) from .packages import ( - Packages, - AsyncPackages, - PackagesWithRawResponse, - AsyncPackagesWithRawResponse, - PackagesWithStreamingResponse, - AsyncPackagesWithStreamingResponse, + PackagesResource, + AsyncPackagesResource, + PackagesResourceWithRawResponse, + AsyncPackagesResourceWithRawResponse, + PackagesResourceWithStreamingResponse, + AsyncPackagesResourceWithStreamingResponse, ) __all__ = [ - "Groups", - "AsyncGroups", - "GroupsWithRawResponse", - "AsyncGroupsWithRawResponse", - "GroupsWithStreamingResponse", - "AsyncGroupsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "Packages", - "AsyncPackages", - "PackagesWithRawResponse", - "AsyncPackagesWithRawResponse", - "PackagesWithStreamingResponse", - "AsyncPackagesWithStreamingResponse", + "GroupsResource", + "AsyncGroupsResource", + "GroupsResourceWithRawResponse", + "AsyncGroupsResourceWithRawResponse", + "GroupsResourceWithStreamingResponse", + "AsyncGroupsResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "PackagesResource", + "AsyncPackagesResource", + "PackagesResourceWithRawResponse", + "AsyncPackagesResourceWithRawResponse", + "PackagesResourceWithStreamingResponse", + "AsyncPackagesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/firewall/waf/packages/groups.py b/src/cloudflare/resources/firewall/waf/packages/groups.py index 2cf9cf75c11..efd106d5cec 100644 --- a/src/cloudflare/resources/firewall/waf/packages/groups.py +++ b/src/cloudflare/resources/firewall/waf/packages/groups.py @@ -26,25 +26,22 @@ AsyncPaginator, make_request_options, ) -from .....types.firewall.waf.packages import ( - GroupGetResponse, - GroupEditResponse, - WAFManagedRulesGroup, - group_edit_params, - group_list_params, -) +from .....types.firewall.waf.packages import group_edit_params, group_list_params +from .....types.firewall.waf.packages.group import Group +from .....types.firewall.waf.packages.group_get_response import GroupGetResponse +from .....types.firewall.waf.packages.group_edit_response import GroupEditResponse -__all__ = ["Groups", "AsyncGroups"] +__all__ = ["GroupsResource", "AsyncGroupsResource"] -class Groups(SyncAPIResource): +class GroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> GroupsWithRawResponse: - return GroupsWithRawResponse(self) + def with_raw_response(self) -> GroupsResourceWithRawResponse: + return GroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> GroupsWithStreamingResponse: - return GroupsWithStreamingResponse(self) + def with_streaming_response(self) -> GroupsResourceWithStreamingResponse: + return GroupsResourceWithStreamingResponse(self) def list( self, @@ -54,16 +51,18 @@ def list( direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, match: Literal["any", "all"] | NotGiven = NOT_GIVEN, mode: Literal["on", "off"] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, order: Literal["mode", "rules_count"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + rules_count: 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. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[WAFManagedRulesGroup]: + ) -> SyncV4PagePaginationArray[Group]: """ Fetches the WAF rule groups in a WAF package. @@ -83,12 +82,16 @@ def list( mode: The state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable. + name: The name of the rule group. + order: The field used to sort returned rule groups. page: The page number of paginated results. per_page: The number of rule groups per page. + rules_count: The number of rules in the current rule group. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -103,7 +106,7 @@ def list( raise ValueError(f"Expected a non-empty value for `package_id` but received {package_id!r}") return self._get_api_list( f"/zones/{zone_id}/firewall/waf/packages/{package_id}/groups", - page=SyncV4PagePaginationArray[WAFManagedRulesGroup], + page=SyncV4PagePaginationArray[Group], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -114,14 +117,16 @@ def list( "direction": direction, "match": match, "mode": mode, + "name": name, "order": order, "page": page, "per_page": per_page, + "rules_count": rules_count, }, group_list_params.GroupListParams, ), ), - model=WAFManagedRulesGroup, + model=Group, ) def edit( @@ -180,7 +185,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GroupEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[GroupEditResponse] @@ -237,7 +242,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GroupGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[GroupGetResponse] @@ -246,14 +251,14 @@ def get( ) -class AsyncGroups(AsyncAPIResource): +class AsyncGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncGroupsWithRawResponse: - return AsyncGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncGroupsResourceWithRawResponse: + return AsyncGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncGroupsWithStreamingResponse: - return AsyncGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncGroupsResourceWithStreamingResponse: + return AsyncGroupsResourceWithStreamingResponse(self) def list( self, @@ -263,16 +268,18 @@ def list( direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, match: Literal["any", "all"] | NotGiven = NOT_GIVEN, mode: Literal["on", "off"] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, order: Literal["mode", "rules_count"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + rules_count: 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. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WAFManagedRulesGroup, AsyncV4PagePaginationArray[WAFManagedRulesGroup]]: + ) -> AsyncPaginator[Group, AsyncV4PagePaginationArray[Group]]: """ Fetches the WAF rule groups in a WAF package. @@ -292,12 +299,16 @@ def list( mode: The state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable. + name: The name of the rule group. + order: The field used to sort returned rule groups. page: The page number of paginated results. per_page: The number of rule groups per page. + rules_count: The number of rules in the current rule group. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -312,7 +323,7 @@ def list( raise ValueError(f"Expected a non-empty value for `package_id` but received {package_id!r}") return self._get_api_list( f"/zones/{zone_id}/firewall/waf/packages/{package_id}/groups", - page=AsyncV4PagePaginationArray[WAFManagedRulesGroup], + page=AsyncV4PagePaginationArray[Group], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,14 +334,16 @@ def list( "direction": direction, "match": match, "mode": mode, + "name": name, "order": order, "page": page, "per_page": per_page, + "rules_count": rules_count, }, group_list_params.GroupListParams, ), ), - model=WAFManagedRulesGroup, + model=Group, ) async def edit( @@ -389,7 +402,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GroupEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[GroupEditResponse] @@ -446,7 +459,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GroupGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[GroupGetResponse] @@ -455,8 +468,8 @@ async def get( ) -class GroupsWithRawResponse: - def __init__(self, groups: Groups) -> None: +class GroupsResourceWithRawResponse: + def __init__(self, groups: GroupsResource) -> None: self._groups = groups self.list = to_raw_response_wrapper( @@ -470,8 +483,8 @@ def __init__(self, groups: Groups) -> None: ) -class AsyncGroupsWithRawResponse: - def __init__(self, groups: AsyncGroups) -> None: +class AsyncGroupsResourceWithRawResponse: + def __init__(self, groups: AsyncGroupsResource) -> None: self._groups = groups self.list = async_to_raw_response_wrapper( @@ -485,8 +498,8 @@ def __init__(self, groups: AsyncGroups) -> None: ) -class GroupsWithStreamingResponse: - def __init__(self, groups: Groups) -> None: +class GroupsResourceWithStreamingResponse: + def __init__(self, groups: GroupsResource) -> None: self._groups = groups self.list = to_streamed_response_wrapper( @@ -500,8 +513,8 @@ def __init__(self, groups: Groups) -> None: ) -class AsyncGroupsWithStreamingResponse: - def __init__(self, groups: AsyncGroups) -> None: +class AsyncGroupsResourceWithStreamingResponse: + def __init__(self, groups: AsyncGroupsResource) -> None: self._groups = groups self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/firewall/waf/packages/packages.py b/src/cloudflare/resources/firewall/waf/packages/packages.py index c80a52601ec..bf8c365887e 100644 --- a/src/cloudflare/resources/firewall/waf/packages/packages.py +++ b/src/cloudflare/resources/firewall/waf/packages/packages.py @@ -8,20 +8,20 @@ import httpx from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .groups import ( - Groups, - AsyncGroups, - GroupsWithRawResponse, - AsyncGroupsWithRawResponse, - GroupsWithStreamingResponse, - AsyncGroupsWithStreamingResponse, + GroupsResource, + AsyncGroupsResource, + GroupsResourceWithRawResponse, + AsyncGroupsResourceWithRawResponse, + GroupsResourceWithStreamingResponse, + AsyncGroupsResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import maybe_transform @@ -38,27 +38,29 @@ AsyncPaginator, make_request_options, ) -from .....types.firewall.waf import PackageGetResponse, PackageListResponse, package_list_params +from .....types.firewall.waf import package_list_params +from .....types.firewall.waf.package_get_response import PackageGetResponse +from .....types.firewall.waf.package_list_response import PackageListResponse -__all__ = ["Packages", "AsyncPackages"] +__all__ = ["PackagesResource", "AsyncPackagesResource"] -class Packages(SyncAPIResource): +class PackagesResource(SyncAPIResource): @cached_property - def groups(self) -> Groups: - return Groups(self._client) + def groups(self) -> GroupsResource: + return GroupsResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def with_raw_response(self) -> PackagesWithRawResponse: - return PackagesWithRawResponse(self) + def with_raw_response(self) -> PackagesResourceWithRawResponse: + return PackagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PackagesWithStreamingResponse: - return PackagesWithStreamingResponse(self) + def with_streaming_response(self) -> PackagesResourceWithStreamingResponse: + return PackagesResourceWithStreamingResponse(self) def list( self, @@ -66,6 +68,7 @@ def list( *, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, match: Literal["any", "all"] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, order: Literal["name"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, @@ -90,6 +93,8 @@ def list( match: When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match. + name: The name of the WAF package. + order: The field used to sort returned packages. page: The page number of paginated results. @@ -118,6 +123,7 @@ def list( { "direction": direction, "match": match, + "name": name, "order": order, "page": page, "per_page": per_page, @@ -149,7 +155,7 @@ def get( Args: zone_identifier: Identifier - identifier: The unique identifier of a WAF package. + identifier: Identifier extra_headers: Send extra headers @@ -177,22 +183,22 @@ def get( ) -class AsyncPackages(AsyncAPIResource): +class AsyncPackagesResource(AsyncAPIResource): @cached_property - def groups(self) -> AsyncGroups: - return AsyncGroups(self._client) + def groups(self) -> AsyncGroupsResource: + return AsyncGroupsResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPackagesWithRawResponse: - return AsyncPackagesWithRawResponse(self) + def with_raw_response(self) -> AsyncPackagesResourceWithRawResponse: + return AsyncPackagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPackagesWithStreamingResponse: - return AsyncPackagesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPackagesResourceWithStreamingResponse: + return AsyncPackagesResourceWithStreamingResponse(self) def list( self, @@ -200,6 +206,7 @@ def list( *, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, match: Literal["any", "all"] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, order: Literal["name"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, @@ -224,6 +231,8 @@ def list( match: When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match. + name: The name of the WAF package. + order: The field used to sort returned packages. page: The page number of paginated results. @@ -252,6 +261,7 @@ def list( { "direction": direction, "match": match, + "name": name, "order": order, "page": page, "per_page": per_page, @@ -283,7 +293,7 @@ async def get( Args: zone_identifier: Identifier - identifier: The unique identifier of a WAF package. + identifier: Identifier extra_headers: Send extra headers @@ -311,8 +321,8 @@ async def get( ) -class PackagesWithRawResponse: - def __init__(self, packages: Packages) -> None: +class PackagesResourceWithRawResponse: + def __init__(self, packages: PackagesResource) -> None: self._packages = packages self.list = to_raw_response_wrapper( @@ -323,16 +333,16 @@ def __init__(self, packages: Packages) -> None: ) @cached_property - def groups(self) -> GroupsWithRawResponse: - return GroupsWithRawResponse(self._packages.groups) + def groups(self) -> GroupsResourceWithRawResponse: + return GroupsResourceWithRawResponse(self._packages.groups) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._packages.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._packages.rules) -class AsyncPackagesWithRawResponse: - def __init__(self, packages: AsyncPackages) -> None: +class AsyncPackagesResourceWithRawResponse: + def __init__(self, packages: AsyncPackagesResource) -> None: self._packages = packages self.list = async_to_raw_response_wrapper( @@ -343,16 +353,16 @@ def __init__(self, packages: AsyncPackages) -> None: ) @cached_property - def groups(self) -> AsyncGroupsWithRawResponse: - return AsyncGroupsWithRawResponse(self._packages.groups) + def groups(self) -> AsyncGroupsResourceWithRawResponse: + return AsyncGroupsResourceWithRawResponse(self._packages.groups) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._packages.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._packages.rules) -class PackagesWithStreamingResponse: - def __init__(self, packages: Packages) -> None: +class PackagesResourceWithStreamingResponse: + def __init__(self, packages: PackagesResource) -> None: self._packages = packages self.list = to_streamed_response_wrapper( @@ -363,16 +373,16 @@ def __init__(self, packages: Packages) -> None: ) @cached_property - def groups(self) -> GroupsWithStreamingResponse: - return GroupsWithStreamingResponse(self._packages.groups) + def groups(self) -> GroupsResourceWithStreamingResponse: + return GroupsResourceWithStreamingResponse(self._packages.groups) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._packages.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._packages.rules) -class AsyncPackagesWithStreamingResponse: - def __init__(self, packages: AsyncPackages) -> None: +class AsyncPackagesResourceWithStreamingResponse: + def __init__(self, packages: AsyncPackagesResource) -> None: self._packages = packages self.list = async_to_streamed_response_wrapper( @@ -383,9 +393,9 @@ def __init__(self, packages: AsyncPackages) -> None: ) @cached_property - def groups(self) -> AsyncGroupsWithStreamingResponse: - return AsyncGroupsWithStreamingResponse(self._packages.groups) + def groups(self) -> AsyncGroupsResourceWithStreamingResponse: + return AsyncGroupsResourceWithStreamingResponse(self._packages.groups) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._packages.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._packages.rules) diff --git a/src/cloudflare/resources/firewall/waf/packages/rules.py b/src/cloudflare/resources/firewall/waf/packages/rules.py index e237cc19e20..7a1f92a3ede 100644 --- a/src/cloudflare/resources/firewall/waf/packages/rules.py +++ b/src/cloudflare/resources/firewall/waf/packages/rules.py @@ -26,44 +26,44 @@ AsyncPaginator, make_request_options, ) -from .....types.firewall.waf.packages import ( - RuleGetResponse, - RuleEditResponse, - WAFManagedRulesRule, - rule_edit_params, - rule_list_params, -) +from .....types.firewall.waf.packages import rule_edit_params, rule_list_params +from .....types.firewall.waf.packages.rule_get_response import RuleGetResponse +from .....types.firewall.waf.packages.rule_edit_response import RuleEditResponse +from .....types.firewall.waf.packages.rule_list_response import RuleListResponse -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) def list( self, package_id: str, *, zone_id: str, + description: str | NotGiven = NOT_GIVEN, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + group_id: str | NotGiven = NOT_GIVEN, match: Literal["any", "all"] | NotGiven = NOT_GIVEN, mode: Literal["DIS", "CHL", "BLK", "SIM"] | NotGiven = NOT_GIVEN, order: Literal["priority", "group_id", "description"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + priority: 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[WAFManagedRulesRule]: + ) -> SyncV4PagePaginationArray[RuleListResponse]: """ Fetches WAF rules in a WAF package. @@ -75,8 +75,12 @@ def list( package_id: The unique identifier of a WAF package. + description: The public description of the WAF rule. + direction: The direction used to sort returned rules. + group_id: The unique identifier of the rule group. + match: When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match. @@ -88,6 +92,8 @@ def list( per_page: The number of rules per page. + priority: The order in which the individual WAF rule is executed within its rule group. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -102,7 +108,7 @@ def list( raise ValueError(f"Expected a non-empty value for `package_id` but received {package_id!r}") return self._get_api_list( f"/zones/{zone_id}/firewall/waf/packages/{package_id}/rules", - page=SyncV4PagePaginationArray[WAFManagedRulesRule], + page=SyncV4PagePaginationArray[RuleListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -110,17 +116,20 @@ def list( timeout=timeout, query=maybe_transform( { + "description": description, "direction": direction, + "group_id": group_id, "match": match, "mode": mode, "order": order, "page": page, "per_page": per_page, + "priority": priority, }, rule_list_params.RuleListParams, ), ), - model=cast(Any, WAFManagedRulesRule), # Union types cannot be passed in as arguments in the type system + model=cast(Any, RuleListResponse), # Union types cannot be passed in as arguments in the type system ) def edit( @@ -178,7 +187,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RuleEditResponse] @@ -235,7 +244,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RuleGetResponse] @@ -244,33 +253,36 @@ def get( ) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) def list( self, package_id: str, *, zone_id: str, + description: str | NotGiven = NOT_GIVEN, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + group_id: str | NotGiven = NOT_GIVEN, match: Literal["any", "all"] | NotGiven = NOT_GIVEN, mode: Literal["DIS", "CHL", "BLK", "SIM"] | NotGiven = NOT_GIVEN, order: Literal["priority", "group_id", "description"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + priority: 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[WAFManagedRulesRule, AsyncV4PagePaginationArray[WAFManagedRulesRule]]: + ) -> AsyncPaginator[RuleListResponse, AsyncV4PagePaginationArray[RuleListResponse]]: """ Fetches WAF rules in a WAF package. @@ -282,8 +294,12 @@ def list( package_id: The unique identifier of a WAF package. + description: The public description of the WAF rule. + direction: The direction used to sort returned rules. + group_id: The unique identifier of the rule group. + match: When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match. @@ -295,6 +311,8 @@ def list( per_page: The number of rules per page. + priority: The order in which the individual WAF rule is executed within its rule group. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -309,7 +327,7 @@ def list( raise ValueError(f"Expected a non-empty value for `package_id` but received {package_id!r}") return self._get_api_list( f"/zones/{zone_id}/firewall/waf/packages/{package_id}/rules", - page=AsyncV4PagePaginationArray[WAFManagedRulesRule], + page=AsyncV4PagePaginationArray[RuleListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -317,17 +335,20 @@ def list( timeout=timeout, query=maybe_transform( { + "description": description, "direction": direction, + "group_id": group_id, "match": match, "mode": mode, "order": order, "page": page, "per_page": per_page, + "priority": priority, }, rule_list_params.RuleListParams, ), ), - model=cast(Any, WAFManagedRulesRule), # Union types cannot be passed in as arguments in the type system + model=cast(Any, RuleListResponse), # Union types cannot be passed in as arguments in the type system ) async def edit( @@ -385,7 +406,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RuleEditResponse] @@ -442,7 +463,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RuleGetResponse] @@ -451,8 +472,8 @@ async def get( ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.list = to_raw_response_wrapper( @@ -466,8 +487,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.list = async_to_raw_response_wrapper( @@ -481,8 +502,8 @@ def __init__(self, rules: AsyncRules) -> None: ) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.list = to_streamed_response_wrapper( @@ -496,8 +517,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/firewall/waf/waf.py b/src/cloudflare/resources/firewall/waf/waf.py index 80d5523dcde..1a4ec228629 100644 --- a/src/cloudflare/resources/firewall/waf/waf.py +++ b/src/cloudflare/resources/firewall/waf/waf.py @@ -3,111 +3,111 @@ from __future__ import annotations from .packages import ( - Packages, - AsyncPackages, - PackagesWithRawResponse, - AsyncPackagesWithRawResponse, - PackagesWithStreamingResponse, - AsyncPackagesWithStreamingResponse, + PackagesResource, + AsyncPackagesResource, + PackagesResourceWithRawResponse, + AsyncPackagesResourceWithRawResponse, + PackagesResourceWithStreamingResponse, + AsyncPackagesResourceWithStreamingResponse, ) from .overrides import ( - Overrides, - AsyncOverrides, - OverridesWithRawResponse, - AsyncOverridesWithRawResponse, - OverridesWithStreamingResponse, - AsyncOverridesWithStreamingResponse, + OverridesResource, + AsyncOverridesResource, + OverridesResourceWithRawResponse, + AsyncOverridesResourceWithRawResponse, + OverridesResourceWithStreamingResponse, + AsyncOverridesResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -from .packages.packages import Packages, AsyncPackages +from .packages.packages import PackagesResource, AsyncPackagesResource -__all__ = ["WAF", "AsyncWAF"] +__all__ = ["WAFResource", "AsyncWAFResource"] -class WAF(SyncAPIResource): +class WAFResource(SyncAPIResource): @cached_property - def overrides(self) -> Overrides: - return Overrides(self._client) + def overrides(self) -> OverridesResource: + return OverridesResource(self._client) @cached_property - def packages(self) -> Packages: - return Packages(self._client) + def packages(self) -> PackagesResource: + return PackagesResource(self._client) @cached_property - def with_raw_response(self) -> WAFWithRawResponse: - return WAFWithRawResponse(self) + def with_raw_response(self) -> WAFResourceWithRawResponse: + return WAFResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WAFWithStreamingResponse: - return WAFWithStreamingResponse(self) + def with_streaming_response(self) -> WAFResourceWithStreamingResponse: + return WAFResourceWithStreamingResponse(self) -class AsyncWAF(AsyncAPIResource): +class AsyncWAFResource(AsyncAPIResource): @cached_property - def overrides(self) -> AsyncOverrides: - return AsyncOverrides(self._client) + def overrides(self) -> AsyncOverridesResource: + return AsyncOverridesResource(self._client) @cached_property - def packages(self) -> AsyncPackages: - return AsyncPackages(self._client) + def packages(self) -> AsyncPackagesResource: + return AsyncPackagesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncWAFWithRawResponse: - return AsyncWAFWithRawResponse(self) + def with_raw_response(self) -> AsyncWAFResourceWithRawResponse: + return AsyncWAFResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWAFWithStreamingResponse: - return AsyncWAFWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWAFResourceWithStreamingResponse: + return AsyncWAFResourceWithStreamingResponse(self) -class WAFWithRawResponse: - def __init__(self, waf: WAF) -> None: +class WAFResourceWithRawResponse: + def __init__(self, waf: WAFResource) -> None: self._waf = waf @cached_property - def overrides(self) -> OverridesWithRawResponse: - return OverridesWithRawResponse(self._waf.overrides) + def overrides(self) -> OverridesResourceWithRawResponse: + return OverridesResourceWithRawResponse(self._waf.overrides) @cached_property - def packages(self) -> PackagesWithRawResponse: - return PackagesWithRawResponse(self._waf.packages) + def packages(self) -> PackagesResourceWithRawResponse: + return PackagesResourceWithRawResponse(self._waf.packages) -class AsyncWAFWithRawResponse: - def __init__(self, waf: AsyncWAF) -> None: +class AsyncWAFResourceWithRawResponse: + def __init__(self, waf: AsyncWAFResource) -> None: self._waf = waf @cached_property - def overrides(self) -> AsyncOverridesWithRawResponse: - return AsyncOverridesWithRawResponse(self._waf.overrides) + def overrides(self) -> AsyncOverridesResourceWithRawResponse: + return AsyncOverridesResourceWithRawResponse(self._waf.overrides) @cached_property - def packages(self) -> AsyncPackagesWithRawResponse: - return AsyncPackagesWithRawResponse(self._waf.packages) + def packages(self) -> AsyncPackagesResourceWithRawResponse: + return AsyncPackagesResourceWithRawResponse(self._waf.packages) -class WAFWithStreamingResponse: - def __init__(self, waf: WAF) -> None: +class WAFResourceWithStreamingResponse: + def __init__(self, waf: WAFResource) -> None: self._waf = waf @cached_property - def overrides(self) -> OverridesWithStreamingResponse: - return OverridesWithStreamingResponse(self._waf.overrides) + def overrides(self) -> OverridesResourceWithStreamingResponse: + return OverridesResourceWithStreamingResponse(self._waf.overrides) @cached_property - def packages(self) -> PackagesWithStreamingResponse: - return PackagesWithStreamingResponse(self._waf.packages) + def packages(self) -> PackagesResourceWithStreamingResponse: + return PackagesResourceWithStreamingResponse(self._waf.packages) -class AsyncWAFWithStreamingResponse: - def __init__(self, waf: AsyncWAF) -> None: +class AsyncWAFResourceWithStreamingResponse: + def __init__(self, waf: AsyncWAFResource) -> None: self._waf = waf @cached_property - def overrides(self) -> AsyncOverridesWithStreamingResponse: - return AsyncOverridesWithStreamingResponse(self._waf.overrides) + def overrides(self) -> AsyncOverridesResourceWithStreamingResponse: + return AsyncOverridesResourceWithStreamingResponse(self._waf.overrides) @cached_property - def packages(self) -> AsyncPackagesWithStreamingResponse: - return AsyncPackagesWithStreamingResponse(self._waf.packages) + def packages(self) -> AsyncPackagesResourceWithStreamingResponse: + return AsyncPackagesResourceWithStreamingResponse(self._waf.packages) diff --git a/src/cloudflare/resources/healthchecks/__init__.py b/src/cloudflare/resources/healthchecks/__init__.py index 3587bef8b68..33ddb832b75 100644 --- a/src/cloudflare/resources/healthchecks/__init__.py +++ b/src/cloudflare/resources/healthchecks/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .previews import ( - Previews, - AsyncPreviews, - PreviewsWithRawResponse, - AsyncPreviewsWithRawResponse, - PreviewsWithStreamingResponse, - AsyncPreviewsWithStreamingResponse, + PreviewsResource, + AsyncPreviewsResource, + PreviewsResourceWithRawResponse, + AsyncPreviewsResourceWithRawResponse, + PreviewsResourceWithStreamingResponse, + AsyncPreviewsResourceWithStreamingResponse, ) from .healthchecks import ( - Healthchecks, - AsyncHealthchecks, - HealthchecksWithRawResponse, - AsyncHealthchecksWithRawResponse, - HealthchecksWithStreamingResponse, - AsyncHealthchecksWithStreamingResponse, + HealthchecksResource, + AsyncHealthchecksResource, + HealthchecksResourceWithRawResponse, + AsyncHealthchecksResourceWithRawResponse, + HealthchecksResourceWithStreamingResponse, + AsyncHealthchecksResourceWithStreamingResponse, ) __all__ = [ - "Previews", - "AsyncPreviews", - "PreviewsWithRawResponse", - "AsyncPreviewsWithRawResponse", - "PreviewsWithStreamingResponse", - "AsyncPreviewsWithStreamingResponse", - "Healthchecks", - "AsyncHealthchecks", - "HealthchecksWithRawResponse", - "AsyncHealthchecksWithRawResponse", - "HealthchecksWithStreamingResponse", - "AsyncHealthchecksWithStreamingResponse", + "PreviewsResource", + "AsyncPreviewsResource", + "PreviewsResourceWithRawResponse", + "AsyncPreviewsResourceWithRawResponse", + "PreviewsResourceWithStreamingResponse", + "AsyncPreviewsResourceWithStreamingResponse", + "HealthchecksResource", + "AsyncHealthchecksResource", + "HealthchecksResourceWithRawResponse", + "AsyncHealthchecksResourceWithRawResponse", + "HealthchecksResourceWithStreamingResponse", + "AsyncHealthchecksResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/healthchecks/healthchecks.py b/src/cloudflare/resources/healthchecks/healthchecks.py index 5ceeb208130..8194286f06a 100644 --- a/src/cloudflare/resources/healthchecks/healthchecks.py +++ b/src/cloudflare/resources/healthchecks/healthchecks.py @@ -3,29 +3,21 @@ from __future__ import annotations from typing import List, Type, Optional, cast -from typing_extensions import Literal import httpx -from ...types import ( - Healthcheck, - HealthcheckDeleteResponse, - healthcheck_edit_params, - healthcheck_create_params, - healthcheck_update_params, -) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, async_maybe_transform, ) from .previews import ( - Previews, - AsyncPreviews, - PreviewsWithRawResponse, - AsyncPreviewsWithRawResponse, - PreviewsWithStreamingResponse, - AsyncPreviewsWithStreamingResponse, + PreviewsResource, + AsyncPreviewsResource, + PreviewsResourceWithRawResponse, + AsyncPreviewsResourceWithRawResponse, + PreviewsResourceWithStreamingResponse, + AsyncPreviewsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -41,22 +33,34 @@ AsyncPaginator, make_request_options, ) +from ...types.healthchecks import ( + healthcheck_edit_params, + healthcheck_list_params, + healthcheck_create_params, + healthcheck_delete_params, + healthcheck_update_params, +) +from ...types.healthchecks.healthcheck import Healthcheck +from ...types.healthchecks.check_region import CheckRegion +from ...types.healthchecks.tcp_configuration_param import TCPConfigurationParam +from ...types.healthchecks.http_configuration_param import HTTPConfigurationParam +from ...types.healthchecks.healthcheck_delete_response import HealthcheckDeleteResponse -__all__ = ["Healthchecks", "AsyncHealthchecks"] +__all__ = ["HealthchecksResource", "AsyncHealthchecksResource"] -class Healthchecks(SyncAPIResource): +class HealthchecksResource(SyncAPIResource): @cached_property - def previews(self) -> Previews: - return Previews(self._client) + def previews(self) -> PreviewsResource: + return PreviewsResource(self._client) @cached_property - def with_raw_response(self) -> HealthchecksWithRawResponse: - return HealthchecksWithRawResponse(self) + def with_raw_response(self) -> HealthchecksResourceWithRawResponse: + return HealthchecksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HealthchecksWithStreamingResponse: - return HealthchecksWithStreamingResponse(self) + def with_streaming_response(self) -> HealthchecksResourceWithStreamingResponse: + return HealthchecksResourceWithStreamingResponse(self) def create( self, @@ -64,35 +68,15 @@ def create( zone_id: str, address: str, name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, consecutive_fails: int | NotGiven = NOT_GIVEN, consecutive_successes: int | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_create_params.HTTPConfig] | NotGiven = NOT_GIVEN, + http_config: Optional[HTTPConfigurationParam] | NotGiven = NOT_GIVEN, interval: int | NotGiven = NOT_GIVEN, retries: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_create_params.TcpConfig] | NotGiven = NOT_GIVEN, + tcp_config: Optional[TCPConfigurationParam] | NotGiven = NOT_GIVEN, healthcheck_timeout: int | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -177,7 +161,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) @@ -189,35 +173,15 @@ def update( zone_id: str, address: str, name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, consecutive_fails: int | NotGiven = NOT_GIVEN, consecutive_successes: int | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_update_params.HTTPConfig] | NotGiven = NOT_GIVEN, + http_config: Optional[HTTPConfigurationParam] | NotGiven = NOT_GIVEN, interval: int | NotGiven = NOT_GIVEN, retries: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_update_params.TcpConfig] | NotGiven = NOT_GIVEN, + tcp_config: Optional[TCPConfigurationParam] | NotGiven = NOT_GIVEN, healthcheck_timeout: int | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -306,7 +270,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) @@ -315,6 +279,8 @@ def list( self, *, zone_id: str, + page: object | NotGiven = NOT_GIVEN, + per_page: object | 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, @@ -328,6 +294,10 @@ def list( Args: zone_id: Identifier + page: Page number of paginated results. + + per_page: Maximum number of results per page. Must be a multiple of 5. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -342,7 +312,17 @@ def list( f"/zones/{zone_id}/healthchecks", page=SyncSinglePage[Healthcheck], 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, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + healthcheck_list_params.HealthcheckListParams, + ), ), model=Healthcheck, ) @@ -352,6 +332,7 @@ def delete( healthcheck_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -381,12 +362,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `healthcheck_id` but received {healthcheck_id!r}") return self._delete( f"/zones/{zone_id}/healthchecks/{healthcheck_id}", + body=maybe_transform(body, healthcheck_delete_params.HealthcheckDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HealthcheckDeleteResponse]._unwrapper, ), cast_to=cast(Type[HealthcheckDeleteResponse], ResultWrapper[HealthcheckDeleteResponse]), ) @@ -398,35 +380,15 @@ def edit( zone_id: str, address: str, name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, consecutive_fails: int | NotGiven = NOT_GIVEN, consecutive_successes: int | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_edit_params.HTTPConfig] | NotGiven = NOT_GIVEN, + http_config: Optional[HTTPConfigurationParam] | NotGiven = NOT_GIVEN, interval: int | NotGiven = NOT_GIVEN, retries: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_edit_params.TcpConfig] | NotGiven = NOT_GIVEN, + tcp_config: Optional[TCPConfigurationParam] | NotGiven = NOT_GIVEN, healthcheck_timeout: int | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -515,7 +477,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) @@ -559,24 +521,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) -class AsyncHealthchecks(AsyncAPIResource): +class AsyncHealthchecksResource(AsyncAPIResource): @cached_property - def previews(self) -> AsyncPreviews: - return AsyncPreviews(self._client) + def previews(self) -> AsyncPreviewsResource: + return AsyncPreviewsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncHealthchecksWithRawResponse: - return AsyncHealthchecksWithRawResponse(self) + def with_raw_response(self) -> AsyncHealthchecksResourceWithRawResponse: + return AsyncHealthchecksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHealthchecksWithStreamingResponse: - return AsyncHealthchecksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHealthchecksResourceWithStreamingResponse: + return AsyncHealthchecksResourceWithStreamingResponse(self) async def create( self, @@ -584,35 +546,15 @@ async def create( zone_id: str, address: str, name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, consecutive_fails: int | NotGiven = NOT_GIVEN, consecutive_successes: int | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_create_params.HTTPConfig] | NotGiven = NOT_GIVEN, + http_config: Optional[HTTPConfigurationParam] | NotGiven = NOT_GIVEN, interval: int | NotGiven = NOT_GIVEN, retries: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_create_params.TcpConfig] | NotGiven = NOT_GIVEN, + tcp_config: Optional[TCPConfigurationParam] | NotGiven = NOT_GIVEN, healthcheck_timeout: int | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -697,7 +639,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) @@ -709,35 +651,15 @@ async def update( zone_id: str, address: str, name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, consecutive_fails: int | NotGiven = NOT_GIVEN, consecutive_successes: int | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_update_params.HTTPConfig] | NotGiven = NOT_GIVEN, + http_config: Optional[HTTPConfigurationParam] | NotGiven = NOT_GIVEN, interval: int | NotGiven = NOT_GIVEN, retries: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_update_params.TcpConfig] | NotGiven = NOT_GIVEN, + tcp_config: Optional[TCPConfigurationParam] | NotGiven = NOT_GIVEN, healthcheck_timeout: int | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -826,7 +748,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) @@ -835,6 +757,8 @@ def list( self, *, zone_id: str, + page: object | NotGiven = NOT_GIVEN, + per_page: object | 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, @@ -848,6 +772,10 @@ def list( Args: zone_id: Identifier + page: Page number of paginated results. + + per_page: Maximum number of results per page. Must be a multiple of 5. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -862,7 +790,17 @@ def list( f"/zones/{zone_id}/healthchecks", page=AsyncSinglePage[Healthcheck], 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, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + healthcheck_list_params.HealthcheckListParams, + ), ), model=Healthcheck, ) @@ -872,6 +810,7 @@ async def delete( healthcheck_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -901,12 +840,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `healthcheck_id` but received {healthcheck_id!r}") return await self._delete( f"/zones/{zone_id}/healthchecks/{healthcheck_id}", + body=await async_maybe_transform(body, healthcheck_delete_params.HealthcheckDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HealthcheckDeleteResponse]._unwrapper, ), cast_to=cast(Type[HealthcheckDeleteResponse], ResultWrapper[HealthcheckDeleteResponse]), ) @@ -918,35 +858,15 @@ async def edit( zone_id: str, address: str, name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, consecutive_fails: int | NotGiven = NOT_GIVEN, consecutive_successes: int | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_edit_params.HTTPConfig] | NotGiven = NOT_GIVEN, + http_config: Optional[HTTPConfigurationParam] | NotGiven = NOT_GIVEN, interval: int | NotGiven = NOT_GIVEN, retries: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_edit_params.TcpConfig] | NotGiven = NOT_GIVEN, + tcp_config: Optional[TCPConfigurationParam] | NotGiven = NOT_GIVEN, healthcheck_timeout: int | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1035,7 +955,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) @@ -1079,14 +999,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) -class HealthchecksWithRawResponse: - def __init__(self, healthchecks: Healthchecks) -> None: +class HealthchecksResourceWithRawResponse: + def __init__(self, healthchecks: HealthchecksResource) -> None: self._healthchecks = healthchecks self.create = to_raw_response_wrapper( @@ -1109,12 +1029,12 @@ def __init__(self, healthchecks: Healthchecks) -> None: ) @cached_property - def previews(self) -> PreviewsWithRawResponse: - return PreviewsWithRawResponse(self._healthchecks.previews) + def previews(self) -> PreviewsResourceWithRawResponse: + return PreviewsResourceWithRawResponse(self._healthchecks.previews) -class AsyncHealthchecksWithRawResponse: - def __init__(self, healthchecks: AsyncHealthchecks) -> None: +class AsyncHealthchecksResourceWithRawResponse: + def __init__(self, healthchecks: AsyncHealthchecksResource) -> None: self._healthchecks = healthchecks self.create = async_to_raw_response_wrapper( @@ -1137,12 +1057,12 @@ def __init__(self, healthchecks: AsyncHealthchecks) -> None: ) @cached_property - def previews(self) -> AsyncPreviewsWithRawResponse: - return AsyncPreviewsWithRawResponse(self._healthchecks.previews) + def previews(self) -> AsyncPreviewsResourceWithRawResponse: + return AsyncPreviewsResourceWithRawResponse(self._healthchecks.previews) -class HealthchecksWithStreamingResponse: - def __init__(self, healthchecks: Healthchecks) -> None: +class HealthchecksResourceWithStreamingResponse: + def __init__(self, healthchecks: HealthchecksResource) -> None: self._healthchecks = healthchecks self.create = to_streamed_response_wrapper( @@ -1165,12 +1085,12 @@ def __init__(self, healthchecks: Healthchecks) -> None: ) @cached_property - def previews(self) -> PreviewsWithStreamingResponse: - return PreviewsWithStreamingResponse(self._healthchecks.previews) + def previews(self) -> PreviewsResourceWithStreamingResponse: + return PreviewsResourceWithStreamingResponse(self._healthchecks.previews) -class AsyncHealthchecksWithStreamingResponse: - def __init__(self, healthchecks: AsyncHealthchecks) -> None: +class AsyncHealthchecksResourceWithStreamingResponse: + def __init__(self, healthchecks: AsyncHealthchecksResource) -> None: self._healthchecks = healthchecks self.create = async_to_streamed_response_wrapper( @@ -1193,5 +1113,5 @@ def __init__(self, healthchecks: AsyncHealthchecks) -> None: ) @cached_property - def previews(self) -> AsyncPreviewsWithStreamingResponse: - return AsyncPreviewsWithStreamingResponse(self._healthchecks.previews) + def previews(self) -> AsyncPreviewsResourceWithStreamingResponse: + return AsyncPreviewsResourceWithStreamingResponse(self._healthchecks.previews) diff --git a/src/cloudflare/resources/healthchecks/previews.py b/src/cloudflare/resources/healthchecks/previews.py index 376b0e5a5ae..8af9a96911d 100644 --- a/src/cloudflare/resources/healthchecks/previews.py +++ b/src/cloudflare/resources/healthchecks/previews.py @@ -3,11 +3,9 @@ from __future__ import annotations from typing import List, Type, Optional, cast -from typing_extensions import Literal import httpx -from ...types import Healthcheck from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -25,19 +23,24 @@ from ..._base_client import ( make_request_options, ) -from ...types.healthchecks import PreviewDeleteResponse, preview_create_params +from ...types.healthchecks import preview_create_params, preview_delete_params +from ...types.healthchecks.healthcheck import Healthcheck +from ...types.healthchecks.check_region import CheckRegion +from ...types.healthchecks.preview_delete_response import PreviewDeleteResponse +from ...types.healthchecks.tcp_configuration_param import TCPConfigurationParam +from ...types.healthchecks.http_configuration_param import HTTPConfigurationParam -__all__ = ["Previews", "AsyncPreviews"] +__all__ = ["PreviewsResource", "AsyncPreviewsResource"] -class Previews(SyncAPIResource): +class PreviewsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PreviewsWithRawResponse: - return PreviewsWithRawResponse(self) + def with_raw_response(self) -> PreviewsResourceWithRawResponse: + return PreviewsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PreviewsWithStreamingResponse: - return PreviewsWithStreamingResponse(self) + def with_streaming_response(self) -> PreviewsResourceWithStreamingResponse: + return PreviewsResourceWithStreamingResponse(self) def create( self, @@ -45,35 +48,15 @@ def create( zone_id: str, address: str, name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, consecutive_fails: int | NotGiven = NOT_GIVEN, consecutive_successes: int | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - http_config: Optional[preview_create_params.HTTPConfig] | NotGiven = NOT_GIVEN, + http_config: Optional[HTTPConfigurationParam] | NotGiven = NOT_GIVEN, interval: int | NotGiven = NOT_GIVEN, retries: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[preview_create_params.TcpConfig] | NotGiven = NOT_GIVEN, + tcp_config: Optional[TCPConfigurationParam] | NotGiven = NOT_GIVEN, healthcheck_timeout: int | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -158,7 +141,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) @@ -168,6 +151,7 @@ def delete( healthcheck_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -197,12 +181,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `healthcheck_id` but received {healthcheck_id!r}") return self._delete( f"/zones/{zone_id}/healthchecks/preview/{healthcheck_id}", + body=maybe_transform(body, preview_delete_params.PreviewDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PreviewDeleteResponse]._unwrapper, ), cast_to=cast(Type[PreviewDeleteResponse], ResultWrapper[PreviewDeleteResponse]), ) @@ -246,20 +231,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) -class AsyncPreviews(AsyncAPIResource): +class AsyncPreviewsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPreviewsWithRawResponse: - return AsyncPreviewsWithRawResponse(self) + def with_raw_response(self) -> AsyncPreviewsResourceWithRawResponse: + return AsyncPreviewsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPreviewsWithStreamingResponse: - return AsyncPreviewsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPreviewsResourceWithStreamingResponse: + return AsyncPreviewsResourceWithStreamingResponse(self) async def create( self, @@ -267,35 +252,15 @@ async def create( zone_id: str, address: str, name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, consecutive_fails: int | NotGiven = NOT_GIVEN, consecutive_successes: int | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - http_config: Optional[preview_create_params.HTTPConfig] | NotGiven = NOT_GIVEN, + http_config: Optional[HTTPConfigurationParam] | NotGiven = NOT_GIVEN, interval: int | NotGiven = NOT_GIVEN, retries: int | NotGiven = NOT_GIVEN, suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[preview_create_params.TcpConfig] | NotGiven = NOT_GIVEN, + tcp_config: Optional[TCPConfigurationParam] | NotGiven = NOT_GIVEN, healthcheck_timeout: int | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -380,7 +345,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) @@ -390,6 +355,7 @@ async def delete( healthcheck_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -419,12 +385,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `healthcheck_id` but received {healthcheck_id!r}") return await self._delete( f"/zones/{zone_id}/healthchecks/preview/{healthcheck_id}", + body=await async_maybe_transform(body, preview_delete_params.PreviewDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PreviewDeleteResponse]._unwrapper, ), cast_to=cast(Type[PreviewDeleteResponse], ResultWrapper[PreviewDeleteResponse]), ) @@ -468,14 +435,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Healthcheck]._unwrapper, ), cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) -class PreviewsWithRawResponse: - def __init__(self, previews: Previews) -> None: +class PreviewsResourceWithRawResponse: + def __init__(self, previews: PreviewsResource) -> None: self._previews = previews self.create = to_raw_response_wrapper( @@ -489,8 +456,8 @@ def __init__(self, previews: Previews) -> None: ) -class AsyncPreviewsWithRawResponse: - def __init__(self, previews: AsyncPreviews) -> None: +class AsyncPreviewsResourceWithRawResponse: + def __init__(self, previews: AsyncPreviewsResource) -> None: self._previews = previews self.create = async_to_raw_response_wrapper( @@ -504,8 +471,8 @@ def __init__(self, previews: AsyncPreviews) -> None: ) -class PreviewsWithStreamingResponse: - def __init__(self, previews: Previews) -> None: +class PreviewsResourceWithStreamingResponse: + def __init__(self, previews: PreviewsResource) -> None: self._previews = previews self.create = to_streamed_response_wrapper( @@ -519,8 +486,8 @@ def __init__(self, previews: Previews) -> None: ) -class AsyncPreviewsWithStreamingResponse: - def __init__(self, previews: AsyncPreviews) -> None: +class AsyncPreviewsResourceWithStreamingResponse: + def __init__(self, previews: AsyncPreviewsResource) -> None: self._previews = previews self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/hostnames/__init__.py b/src/cloudflare/resources/hostnames/__init__.py index 1a85c285d56..52ba53610b1 100644 --- a/src/cloudflare/resources/hostnames/__init__.py +++ b/src/cloudflare/resources/hostnames/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .hostnames import ( - Hostnames, - AsyncHostnames, - HostnamesWithRawResponse, - AsyncHostnamesWithRawResponse, - HostnamesWithStreamingResponse, - AsyncHostnamesWithStreamingResponse, + HostnamesResource, + AsyncHostnamesResource, + HostnamesResourceWithRawResponse, + AsyncHostnamesResourceWithRawResponse, + HostnamesResourceWithStreamingResponse, + AsyncHostnamesResourceWithStreamingResponse, ) __all__ = [ - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Hostnames", - "AsyncHostnames", - "HostnamesWithRawResponse", - "AsyncHostnamesWithRawResponse", - "HostnamesWithStreamingResponse", - "AsyncHostnamesWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "HostnamesResource", + "AsyncHostnamesResource", + "HostnamesResourceWithRawResponse", + "AsyncHostnamesResourceWithRawResponse", + "HostnamesResourceWithStreamingResponse", + "AsyncHostnamesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/hostnames/hostnames.py b/src/cloudflare/resources/hostnames/hostnames.py index 6cc08e80f77..8b2b6c2dab1 100644 --- a/src/cloudflare/resources/hostnames/hostnames.py +++ b/src/cloudflare/resources/hostnames/hostnames.py @@ -3,79 +3,79 @@ from __future__ import annotations from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .settings.settings import Settings, AsyncSettings +from .settings.settings import SettingsResource, AsyncSettingsResource -__all__ = ["Hostnames", "AsyncHostnames"] +__all__ = ["HostnamesResource", "AsyncHostnamesResource"] -class Hostnames(SyncAPIResource): +class HostnamesResource(SyncAPIResource): @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def with_raw_response(self) -> HostnamesWithRawResponse: - return HostnamesWithRawResponse(self) + def with_raw_response(self) -> HostnamesResourceWithRawResponse: + return HostnamesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HostnamesWithStreamingResponse: - return HostnamesWithStreamingResponse(self) + def with_streaming_response(self) -> HostnamesResourceWithStreamingResponse: + return HostnamesResourceWithStreamingResponse(self) -class AsyncHostnames(AsyncAPIResource): +class AsyncHostnamesResource(AsyncAPIResource): @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncHostnamesWithRawResponse: - return AsyncHostnamesWithRawResponse(self) + def with_raw_response(self) -> AsyncHostnamesResourceWithRawResponse: + return AsyncHostnamesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHostnamesWithStreamingResponse: - return AsyncHostnamesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHostnamesResourceWithStreamingResponse: + return AsyncHostnamesResourceWithStreamingResponse(self) -class HostnamesWithRawResponse: - def __init__(self, hostnames: Hostnames) -> None: +class HostnamesResourceWithRawResponse: + def __init__(self, hostnames: HostnamesResource) -> None: self._hostnames = hostnames @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._hostnames.settings) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._hostnames.settings) -class AsyncHostnamesWithRawResponse: - def __init__(self, hostnames: AsyncHostnames) -> None: +class AsyncHostnamesResourceWithRawResponse: + def __init__(self, hostnames: AsyncHostnamesResource) -> None: self._hostnames = hostnames @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._hostnames.settings) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._hostnames.settings) -class HostnamesWithStreamingResponse: - def __init__(self, hostnames: Hostnames) -> None: +class HostnamesResourceWithStreamingResponse: + def __init__(self, hostnames: HostnamesResource) -> None: self._hostnames = hostnames @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._hostnames.settings) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._hostnames.settings) -class AsyncHostnamesWithStreamingResponse: - def __init__(self, hostnames: AsyncHostnames) -> None: +class AsyncHostnamesResourceWithStreamingResponse: + def __init__(self, hostnames: AsyncHostnamesResource) -> None: self._hostnames = hostnames @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._hostnames.settings) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._hostnames.settings) diff --git a/src/cloudflare/resources/hostnames/settings/__init__.py b/src/cloudflare/resources/hostnames/settings/__init__.py index ea048129344..b23f0392adc 100644 --- a/src/cloudflare/resources/hostnames/settings/__init__.py +++ b/src/cloudflare/resources/hostnames/settings/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .tls import ( - TLS, - AsyncTLS, - TLSWithRawResponse, - AsyncTLSWithRawResponse, - TLSWithStreamingResponse, - AsyncTLSWithStreamingResponse, + TLSResource, + AsyncTLSResource, + TLSResourceWithRawResponse, + AsyncTLSResourceWithRawResponse, + TLSResourceWithStreamingResponse, + AsyncTLSResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) __all__ = [ - "TLS", - "AsyncTLS", - "TLSWithRawResponse", - "AsyncTLSWithRawResponse", - "TLSWithStreamingResponse", - "AsyncTLSWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", + "TLSResource", + "AsyncTLSResource", + "TLSResourceWithRawResponse", + "AsyncTLSResourceWithRawResponse", + "TLSResourceWithStreamingResponse", + "AsyncTLSResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/hostnames/settings/settings.py b/src/cloudflare/resources/hostnames/settings/settings.py index f0349274861..9f31fc518e0 100644 --- a/src/cloudflare/resources/hostnames/settings/settings.py +++ b/src/cloudflare/resources/hostnames/settings/settings.py @@ -3,78 +3,78 @@ from __future__ import annotations from .tls import ( - TLS, - AsyncTLS, - TLSWithRawResponse, - AsyncTLSWithRawResponse, - TLSWithStreamingResponse, - AsyncTLSWithStreamingResponse, + TLSResource, + AsyncTLSResource, + TLSResourceWithRawResponse, + AsyncTLSResourceWithRawResponse, + TLSResourceWithStreamingResponse, + AsyncTLSResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def tls(self) -> TLS: - return TLS(self._client) + def tls(self) -> TLSResource: + return TLSResource(self._client) @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def tls(self) -> AsyncTLS: - return AsyncTLS(self._client) + def tls(self) -> AsyncTLSResource: + return AsyncTLSResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings @cached_property - def tls(self) -> TLSWithRawResponse: - return TLSWithRawResponse(self._settings.tls) + def tls(self) -> TLSResourceWithRawResponse: + return TLSResourceWithRawResponse(self._settings.tls) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings @cached_property - def tls(self) -> AsyncTLSWithRawResponse: - return AsyncTLSWithRawResponse(self._settings.tls) + def tls(self) -> AsyncTLSResourceWithRawResponse: + return AsyncTLSResourceWithRawResponse(self._settings.tls) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings @cached_property - def tls(self) -> TLSWithStreamingResponse: - return TLSWithStreamingResponse(self._settings.tls) + def tls(self) -> TLSResourceWithStreamingResponse: + return TLSResourceWithStreamingResponse(self._settings.tls) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings @cached_property - def tls(self) -> AsyncTLSWithStreamingResponse: - return AsyncTLSWithStreamingResponse(self._settings.tls) + def tls(self) -> AsyncTLSResourceWithStreamingResponse: + return AsyncTLSResourceWithStreamingResponse(self._settings.tls) diff --git a/src/cloudflare/resources/hostnames/settings/tls.py b/src/cloudflare/resources/hostnames/settings/tls.py index 9c58de5adde..0aa85650230 100644 --- a/src/cloudflare/resources/hostnames/settings/tls.py +++ b/src/cloudflare/resources/hostnames/settings/tls.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Union, Optional, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -24,19 +24,23 @@ from ...._base_client import ( make_request_options, ) -from ....types.hostnames.settings import HostnameStting, TLSGetResponse, HostnameSettingDelete, tls_update_params +from ....types.hostnames.settings import tls_update_params +from ....types.hostnames.settings.setting import Setting +from ....types.hostnames.settings.tls_get_response import TLSGetResponse +from ....types.hostnames.settings.setting_value_param import SettingValueParam +from ....types.hostnames.settings.tls_delete_response import TLSDeleteResponse -__all__ = ["TLS", "AsyncTLS"] +__all__ = ["TLSResource", "AsyncTLSResource"] -class TLS(SyncAPIResource): +class TLSResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TLSWithRawResponse: - return TLSWithRawResponse(self) + def with_raw_response(self) -> TLSResourceWithRawResponse: + return TLSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TLSWithStreamingResponse: - return TLSWithStreamingResponse(self) + def with_streaming_response(self) -> TLSResourceWithStreamingResponse: + return TLSResourceWithStreamingResponse(self) def update( self, @@ -44,14 +48,14 @@ def update( *, zone_id: str, setting_id: Literal["ciphers", "min_tls_version", "http2"], - value: Union[float, str, List[str]], + value: SettingValueParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> HostnameStting: + ) -> Setting: """ Update the tls setting value for the hostname. @@ -86,9 +90,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Setting]._unwrapper, ), - cast_to=cast(Type[HostnameStting], ResultWrapper[HostnameStting]), + cast_to=cast(Type[Setting], ResultWrapper[Setting]), ) def delete( @@ -103,7 +107,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HostnameSettingDelete: + ) -> TLSDeleteResponse: """ Delete the tls setting value for the hostname. @@ -135,9 +139,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TLSDeleteResponse]._unwrapper, ), - cast_to=cast(Type[HostnameSettingDelete], ResultWrapper[HostnameSettingDelete]), + cast_to=cast(Type[TLSDeleteResponse], ResultWrapper[TLSDeleteResponse]), ) def get( @@ -179,20 +183,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLSGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[TLSGetResponse]], ResultWrapper[TLSGetResponse]), ) -class AsyncTLS(AsyncAPIResource): +class AsyncTLSResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTLSWithRawResponse: - return AsyncTLSWithRawResponse(self) + def with_raw_response(self) -> AsyncTLSResourceWithRawResponse: + return AsyncTLSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTLSWithStreamingResponse: - return AsyncTLSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTLSResourceWithStreamingResponse: + return AsyncTLSResourceWithStreamingResponse(self) async def update( self, @@ -200,14 +204,14 @@ async def update( *, zone_id: str, setting_id: Literal["ciphers", "min_tls_version", "http2"], - value: Union[float, str, List[str]], + value: SettingValueParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> HostnameStting: + ) -> Setting: """ Update the tls setting value for the hostname. @@ -242,9 +246,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Setting]._unwrapper, ), - cast_to=cast(Type[HostnameStting], ResultWrapper[HostnameStting]), + cast_to=cast(Type[Setting], ResultWrapper[Setting]), ) async def delete( @@ -259,7 +263,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HostnameSettingDelete: + ) -> TLSDeleteResponse: """ Delete the tls setting value for the hostname. @@ -291,9 +295,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TLSDeleteResponse]._unwrapper, ), - cast_to=cast(Type[HostnameSettingDelete], ResultWrapper[HostnameSettingDelete]), + cast_to=cast(Type[TLSDeleteResponse], ResultWrapper[TLSDeleteResponse]), ) async def get( @@ -335,14 +339,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLSGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[TLSGetResponse]], ResultWrapper[TLSGetResponse]), ) -class TLSWithRawResponse: - def __init__(self, tls: TLS) -> None: +class TLSResourceWithRawResponse: + def __init__(self, tls: TLSResource) -> None: self._tls = tls self.update = to_raw_response_wrapper( @@ -356,8 +360,8 @@ def __init__(self, tls: TLS) -> None: ) -class AsyncTLSWithRawResponse: - def __init__(self, tls: AsyncTLS) -> None: +class AsyncTLSResourceWithRawResponse: + def __init__(self, tls: AsyncTLSResource) -> None: self._tls = tls self.update = async_to_raw_response_wrapper( @@ -371,8 +375,8 @@ def __init__(self, tls: AsyncTLS) -> None: ) -class TLSWithStreamingResponse: - def __init__(self, tls: TLS) -> None: +class TLSResourceWithStreamingResponse: + def __init__(self, tls: TLSResource) -> None: self._tls = tls self.update = to_streamed_response_wrapper( @@ -386,8 +390,8 @@ def __init__(self, tls: TLS) -> None: ) -class AsyncTLSWithStreamingResponse: - def __init__(self, tls: AsyncTLS) -> None: +class AsyncTLSResourceWithStreamingResponse: + def __init__(self, tls: AsyncTLSResource) -> None: self._tls = tls self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/hyperdrive/__init__.py b/src/cloudflare/resources/hyperdrive/__init__.py index f83f2db969d..525d223706d 100644 --- a/src/cloudflare/resources/hyperdrive/__init__.py +++ b/src/cloudflare/resources/hyperdrive/__init__.py @@ -1,12 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .configs import ( - Configs, - AsyncConfigs, - ConfigsWithRawResponse, - AsyncConfigsWithRawResponse, - ConfigsWithStreamingResponse, - AsyncConfigsWithStreamingResponse, + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, ) from .hyperdrive import ( HyperdriveResource, @@ -18,12 +18,12 @@ ) __all__ = [ - "Configs", - "AsyncConfigs", - "ConfigsWithRawResponse", - "AsyncConfigsWithRawResponse", - "ConfigsWithStreamingResponse", - "AsyncConfigsWithStreamingResponse", + "ConfigsResource", + "AsyncConfigsResource", + "ConfigsResourceWithRawResponse", + "AsyncConfigsResourceWithRawResponse", + "ConfigsResourceWithStreamingResponse", + "AsyncConfigsResourceWithStreamingResponse", "HyperdriveResource", "AsyncHyperdriveResource", "HyperdriveResourceWithRawResponse", diff --git a/src/cloudflare/resources/hyperdrive/configs.py b/src/cloudflare/resources/hyperdrive/configs.py index 451c1c4020c..66f94ebdeec 100644 --- a/src/cloudflare/resources/hyperdrive/configs.py +++ b/src/cloudflare/resources/hyperdrive/configs.py @@ -25,42 +25,37 @@ AsyncPaginator, make_request_options, ) -from ...types.hyperdrive import ( - ConfigGetResponse, - ConfigEditResponse, - ConfigListResponse, - ConfigCreateResponse, - ConfigDeleteResponse, - ConfigUpdateResponse, - config_edit_params, - config_create_params, - config_update_params, -) +from ...types.hyperdrive import config_edit_params, config_create_params, config_update_params +from ...types.hyperdrive.hyperdrive import Hyperdrive +from ...types.hyperdrive.configuration_param import ConfigurationParam +from ...types.hyperdrive.config_delete_response import ConfigDeleteResponse -__all__ = ["Configs", "AsyncConfigs"] +__all__ = ["ConfigsResource", "AsyncConfigsResource"] -class Configs(SyncAPIResource): +class ConfigsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConfigsWithRawResponse: - return ConfigsWithRawResponse(self) + def with_raw_response(self) -> ConfigsResourceWithRawResponse: + return ConfigsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConfigsWithStreamingResponse: - return ConfigsWithStreamingResponse(self) + def with_streaming_response(self) -> ConfigsResourceWithStreamingResponse: + return ConfigsResourceWithStreamingResponse(self) def create( self, *, account_id: str, - origin: config_create_params.Origin, + name: str, + origin: ConfigurationParam, + caching: config_create_params.Caching | 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[ConfigCreateResponse]: + ) -> Optional[Hyperdrive]: """ Creates and returns a new Hyperdrive configuration. @@ -79,15 +74,22 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( f"/accounts/{account_id}/hyperdrive/configs", - body=maybe_transform({"origin": origin}, config_create_params.ConfigCreateParams), + body=maybe_transform( + { + "name": name, + "origin": origin, + "caching": caching, + }, + config_create_params.ConfigCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Hyperdrive]]._unwrapper, ), - cast_to=cast(Type[Optional[ConfigCreateResponse]], ResultWrapper[ConfigCreateResponse]), + cast_to=cast(Type[Optional[Hyperdrive]], ResultWrapper[Hyperdrive]), ) def update( @@ -95,14 +97,16 @@ def update( hyperdrive_id: str, *, account_id: str, - origin: config_update_params.Origin, + name: str, + origin: ConfigurationParam, + caching: config_update_params.Caching | 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[ConfigUpdateResponse]: + ) -> Optional[Hyperdrive]: """ Updates and returns the specified Hyperdrive configuration. @@ -125,15 +129,22 @@ def update( raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}") return self._put( f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", - body=maybe_transform({"origin": origin}, config_update_params.ConfigUpdateParams), + body=maybe_transform( + { + "name": name, + "origin": origin, + "caching": caching, + }, + config_update_params.ConfigUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Hyperdrive]]._unwrapper, ), - cast_to=cast(Type[Optional[ConfigUpdateResponse]], ResultWrapper[ConfigUpdateResponse]), + cast_to=cast(Type[Optional[Hyperdrive]], ResultWrapper[Hyperdrive]), ) def list( @@ -146,7 +157,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ConfigListResponse]: + ) -> SyncSinglePage[Hyperdrive]: """ Returns a list of Hyperdrives @@ -165,11 +176,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/hyperdrive/configs", - page=SyncSinglePage[ConfigListResponse], + page=SyncSinglePage[Hyperdrive], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ConfigListResponse, + model=Hyperdrive, ) def delete( @@ -183,7 +194,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ConfigDeleteResponse]: + ) -> ConfigDeleteResponse: """ Deletes the specified Hyperdrive. @@ -205,7 +216,7 @@ def delete( if not hyperdrive_id: raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}") return cast( - Optional[ConfigDeleteResponse], + ConfigDeleteResponse, self._delete( f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", options=make_request_options( @@ -213,7 +224,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConfigDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConfigDeleteResponse] @@ -226,14 +237,16 @@ def edit( hyperdrive_id: str, *, account_id: str, - origin: config_edit_params.Origin | NotGiven = NOT_GIVEN, + caching: config_edit_params.Caching | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + origin: ConfigurationParam | 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[ConfigEditResponse]: + ) -> Optional[Hyperdrive]: """Patches and returns the specified Hyperdrive configuration. Updates to the @@ -258,15 +271,22 @@ def edit( raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}") return self._patch( f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", - body=maybe_transform({"origin": origin}, config_edit_params.ConfigEditParams), + body=maybe_transform( + { + "caching": caching, + "name": name, + "origin": origin, + }, + config_edit_params.ConfigEditParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Hyperdrive]]._unwrapper, ), - cast_to=cast(Type[Optional[ConfigEditResponse]], ResultWrapper[ConfigEditResponse]), + cast_to=cast(Type[Optional[Hyperdrive]], ResultWrapper[Hyperdrive]), ) def get( @@ -280,7 +300,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ConfigGetResponse]: + ) -> Optional[Hyperdrive]: """ Returns the specified Hyperdrive configuration. @@ -308,33 +328,35 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Hyperdrive]]._unwrapper, ), - cast_to=cast(Type[Optional[ConfigGetResponse]], ResultWrapper[ConfigGetResponse]), + cast_to=cast(Type[Optional[Hyperdrive]], ResultWrapper[Hyperdrive]), ) -class AsyncConfigs(AsyncAPIResource): +class AsyncConfigsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConfigsWithRawResponse: - return AsyncConfigsWithRawResponse(self) + def with_raw_response(self) -> AsyncConfigsResourceWithRawResponse: + return AsyncConfigsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConfigsWithStreamingResponse: - return AsyncConfigsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConfigsResourceWithStreamingResponse: + return AsyncConfigsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, - origin: config_create_params.Origin, + name: str, + origin: ConfigurationParam, + caching: config_create_params.Caching | 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[ConfigCreateResponse]: + ) -> Optional[Hyperdrive]: """ Creates and returns a new Hyperdrive configuration. @@ -353,15 +375,22 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( f"/accounts/{account_id}/hyperdrive/configs", - body=await async_maybe_transform({"origin": origin}, config_create_params.ConfigCreateParams), + body=await async_maybe_transform( + { + "name": name, + "origin": origin, + "caching": caching, + }, + config_create_params.ConfigCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Hyperdrive]]._unwrapper, ), - cast_to=cast(Type[Optional[ConfigCreateResponse]], ResultWrapper[ConfigCreateResponse]), + cast_to=cast(Type[Optional[Hyperdrive]], ResultWrapper[Hyperdrive]), ) async def update( @@ -369,14 +398,16 @@ async def update( hyperdrive_id: str, *, account_id: str, - origin: config_update_params.Origin, + name: str, + origin: ConfigurationParam, + caching: config_update_params.Caching | 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[ConfigUpdateResponse]: + ) -> Optional[Hyperdrive]: """ Updates and returns the specified Hyperdrive configuration. @@ -399,15 +430,22 @@ async def update( raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}") return await self._put( f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", - body=await async_maybe_transform({"origin": origin}, config_update_params.ConfigUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "origin": origin, + "caching": caching, + }, + config_update_params.ConfigUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Hyperdrive]]._unwrapper, ), - cast_to=cast(Type[Optional[ConfigUpdateResponse]], ResultWrapper[ConfigUpdateResponse]), + cast_to=cast(Type[Optional[Hyperdrive]], ResultWrapper[Hyperdrive]), ) def list( @@ -420,7 +458,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ConfigListResponse, AsyncSinglePage[ConfigListResponse]]: + ) -> AsyncPaginator[Hyperdrive, AsyncSinglePage[Hyperdrive]]: """ Returns a list of Hyperdrives @@ -439,11 +477,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/hyperdrive/configs", - page=AsyncSinglePage[ConfigListResponse], + page=AsyncSinglePage[Hyperdrive], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ConfigListResponse, + model=Hyperdrive, ) async def delete( @@ -457,7 +495,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ConfigDeleteResponse]: + ) -> ConfigDeleteResponse: """ Deletes the specified Hyperdrive. @@ -479,7 +517,7 @@ async def delete( if not hyperdrive_id: raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}") return cast( - Optional[ConfigDeleteResponse], + ConfigDeleteResponse, await self._delete( f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", options=make_request_options( @@ -487,7 +525,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConfigDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConfigDeleteResponse] @@ -500,14 +538,16 @@ async def edit( hyperdrive_id: str, *, account_id: str, - origin: config_edit_params.Origin | NotGiven = NOT_GIVEN, + caching: config_edit_params.Caching | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + origin: ConfigurationParam | 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[ConfigEditResponse]: + ) -> Optional[Hyperdrive]: """Patches and returns the specified Hyperdrive configuration. Updates to the @@ -532,15 +572,22 @@ async def edit( raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}") return await self._patch( f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", - body=await async_maybe_transform({"origin": origin}, config_edit_params.ConfigEditParams), + body=await async_maybe_transform( + { + "caching": caching, + "name": name, + "origin": origin, + }, + config_edit_params.ConfigEditParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Hyperdrive]]._unwrapper, ), - cast_to=cast(Type[Optional[ConfigEditResponse]], ResultWrapper[ConfigEditResponse]), + cast_to=cast(Type[Optional[Hyperdrive]], ResultWrapper[Hyperdrive]), ) async def get( @@ -554,7 +601,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ConfigGetResponse]: + ) -> Optional[Hyperdrive]: """ Returns the specified Hyperdrive configuration. @@ -582,14 +629,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Hyperdrive]]._unwrapper, ), - cast_to=cast(Type[Optional[ConfigGetResponse]], ResultWrapper[ConfigGetResponse]), + cast_to=cast(Type[Optional[Hyperdrive]], ResultWrapper[Hyperdrive]), ) -class ConfigsWithRawResponse: - def __init__(self, configs: Configs) -> None: +class ConfigsResourceWithRawResponse: + def __init__(self, configs: ConfigsResource) -> None: self._configs = configs self.create = to_raw_response_wrapper( @@ -612,8 +659,8 @@ def __init__(self, configs: Configs) -> None: ) -class AsyncConfigsWithRawResponse: - def __init__(self, configs: AsyncConfigs) -> None: +class AsyncConfigsResourceWithRawResponse: + def __init__(self, configs: AsyncConfigsResource) -> None: self._configs = configs self.create = async_to_raw_response_wrapper( @@ -636,8 +683,8 @@ def __init__(self, configs: AsyncConfigs) -> None: ) -class ConfigsWithStreamingResponse: - def __init__(self, configs: Configs) -> None: +class ConfigsResourceWithStreamingResponse: + def __init__(self, configs: ConfigsResource) -> None: self._configs = configs self.create = to_streamed_response_wrapper( @@ -660,8 +707,8 @@ def __init__(self, configs: Configs) -> None: ) -class AsyncConfigsWithStreamingResponse: - def __init__(self, configs: AsyncConfigs) -> None: +class AsyncConfigsResourceWithStreamingResponse: + def __init__(self, configs: AsyncConfigsResource) -> None: self._configs = configs self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/hyperdrive/hyperdrive.py b/src/cloudflare/resources/hyperdrive/hyperdrive.py index 0f2abb955fa..fbca61fe44f 100644 --- a/src/cloudflare/resources/hyperdrive/hyperdrive.py +++ b/src/cloudflare/resources/hyperdrive/hyperdrive.py @@ -3,12 +3,12 @@ from __future__ import annotations from .configs import ( - Configs, - AsyncConfigs, - ConfigsWithRawResponse, - AsyncConfigsWithRawResponse, - ConfigsWithStreamingResponse, - AsyncConfigsWithStreamingResponse, + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -18,8 +18,8 @@ class HyperdriveResource(SyncAPIResource): @cached_property - def configs(self) -> Configs: - return Configs(self._client) + def configs(self) -> ConfigsResource: + return ConfigsResource(self._client) @cached_property def with_raw_response(self) -> HyperdriveResourceWithRawResponse: @@ -32,8 +32,8 @@ def with_streaming_response(self) -> HyperdriveResourceWithStreamingResponse: class AsyncHyperdriveResource(AsyncAPIResource): @cached_property - def configs(self) -> AsyncConfigs: - return AsyncConfigs(self._client) + def configs(self) -> AsyncConfigsResource: + return AsyncConfigsResource(self._client) @cached_property def with_raw_response(self) -> AsyncHyperdriveResourceWithRawResponse: @@ -49,8 +49,8 @@ def __init__(self, hyperdrive: HyperdriveResource) -> None: self._hyperdrive = hyperdrive @cached_property - def configs(self) -> ConfigsWithRawResponse: - return ConfigsWithRawResponse(self._hyperdrive.configs) + def configs(self) -> ConfigsResourceWithRawResponse: + return ConfigsResourceWithRawResponse(self._hyperdrive.configs) class AsyncHyperdriveResourceWithRawResponse: @@ -58,8 +58,8 @@ def __init__(self, hyperdrive: AsyncHyperdriveResource) -> None: self._hyperdrive = hyperdrive @cached_property - def configs(self) -> AsyncConfigsWithRawResponse: - return AsyncConfigsWithRawResponse(self._hyperdrive.configs) + def configs(self) -> AsyncConfigsResourceWithRawResponse: + return AsyncConfigsResourceWithRawResponse(self._hyperdrive.configs) class HyperdriveResourceWithStreamingResponse: @@ -67,8 +67,8 @@ def __init__(self, hyperdrive: HyperdriveResource) -> None: self._hyperdrive = hyperdrive @cached_property - def configs(self) -> ConfigsWithStreamingResponse: - return ConfigsWithStreamingResponse(self._hyperdrive.configs) + def configs(self) -> ConfigsResourceWithStreamingResponse: + return ConfigsResourceWithStreamingResponse(self._hyperdrive.configs) class AsyncHyperdriveResourceWithStreamingResponse: @@ -76,5 +76,5 @@ def __init__(self, hyperdrive: AsyncHyperdriveResource) -> None: self._hyperdrive = hyperdrive @cached_property - def configs(self) -> AsyncConfigsWithStreamingResponse: - return AsyncConfigsWithStreamingResponse(self._hyperdrive.configs) + def configs(self) -> AsyncConfigsResourceWithStreamingResponse: + return AsyncConfigsResourceWithStreamingResponse(self._hyperdrive.configs) diff --git a/src/cloudflare/resources/images/__init__.py b/src/cloudflare/resources/images/__init__.py index 4916a905174..5f6c36d97fa 100644 --- a/src/cloudflare/resources/images/__init__.py +++ b/src/cloudflare/resources/images/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .v1 import ( - V1, - AsyncV1, - V1WithRawResponse, - AsyncV1WithRawResponse, - V1WithStreamingResponse, - AsyncV1WithStreamingResponse, + V1Resource, + AsyncV1Resource, + V1ResourceWithRawResponse, + AsyncV1ResourceWithRawResponse, + V1ResourceWithStreamingResponse, + AsyncV1ResourceWithStreamingResponse, ) from .v2 import ( - V2, - AsyncV2, - V2WithRawResponse, - AsyncV2WithRawResponse, - V2WithStreamingResponse, - AsyncV2WithStreamingResponse, + V2Resource, + AsyncV2Resource, + V2ResourceWithRawResponse, + AsyncV2ResourceWithRawResponse, + V2ResourceWithStreamingResponse, + AsyncV2ResourceWithStreamingResponse, ) from .images import ( - Images, - AsyncImages, - ImagesWithRawResponse, - AsyncImagesWithRawResponse, - ImagesWithStreamingResponse, - AsyncImagesWithStreamingResponse, + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, ) __all__ = [ - "V1", - "AsyncV1", - "V1WithRawResponse", - "AsyncV1WithRawResponse", - "V1WithStreamingResponse", - "AsyncV1WithStreamingResponse", - "V2", - "AsyncV2", - "V2WithRawResponse", - "AsyncV2WithRawResponse", - "V2WithStreamingResponse", - "AsyncV2WithStreamingResponse", - "Images", - "AsyncImages", - "ImagesWithRawResponse", - "AsyncImagesWithRawResponse", - "ImagesWithStreamingResponse", - "AsyncImagesWithStreamingResponse", + "V1Resource", + "AsyncV1Resource", + "V1ResourceWithRawResponse", + "AsyncV1ResourceWithRawResponse", + "V1ResourceWithStreamingResponse", + "AsyncV1ResourceWithStreamingResponse", + "V2Resource", + "AsyncV2Resource", + "V2ResourceWithRawResponse", + "AsyncV2ResourceWithRawResponse", + "V2ResourceWithStreamingResponse", + "AsyncV2ResourceWithStreamingResponse", + "ImagesResource", + "AsyncImagesResource", + "ImagesResourceWithRawResponse", + "AsyncImagesResourceWithRawResponse", + "ImagesResourceWithStreamingResponse", + "AsyncImagesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/images/images.py b/src/cloudflare/resources/images/images.py index 6844af2ecb8..211ccd371e1 100644 --- a/src/cloudflare/resources/images/images.py +++ b/src/cloudflare/resources/images/images.py @@ -3,112 +3,112 @@ from __future__ import annotations from .v1 import ( - V1, - AsyncV1, - V1WithRawResponse, - AsyncV1WithRawResponse, - V1WithStreamingResponse, - AsyncV1WithStreamingResponse, + V1Resource, + AsyncV1Resource, + V1ResourceWithRawResponse, + AsyncV1ResourceWithRawResponse, + V1ResourceWithStreamingResponse, + AsyncV1ResourceWithStreamingResponse, ) from .v2 import ( - V2, - AsyncV2, - V2WithRawResponse, - AsyncV2WithRawResponse, - V2WithStreamingResponse, - AsyncV2WithStreamingResponse, + V2Resource, + AsyncV2Resource, + V2ResourceWithRawResponse, + AsyncV2ResourceWithRawResponse, + V2ResourceWithStreamingResponse, + AsyncV2ResourceWithStreamingResponse, ) -from .v1.v1 import V1, AsyncV1 -from .v2.v2 import V2, AsyncV2 +from .v1.v1 import V1Resource, AsyncV1Resource +from .v2.v2 import V2Resource, AsyncV2Resource from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Images", "AsyncImages"] +__all__ = ["ImagesResource", "AsyncImagesResource"] -class Images(SyncAPIResource): +class ImagesResource(SyncAPIResource): @cached_property - def v1(self) -> V1: - return V1(self._client) + def v1(self) -> V1Resource: + return V1Resource(self._client) @cached_property - def v2(self) -> V2: - return V2(self._client) + def v2(self) -> V2Resource: + return V2Resource(self._client) @cached_property - def with_raw_response(self) -> ImagesWithRawResponse: - return ImagesWithRawResponse(self) + def with_raw_response(self) -> ImagesResourceWithRawResponse: + return ImagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ImagesWithStreamingResponse: - return ImagesWithStreamingResponse(self) + def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: + return ImagesResourceWithStreamingResponse(self) -class AsyncImages(AsyncAPIResource): +class AsyncImagesResource(AsyncAPIResource): @cached_property - def v1(self) -> AsyncV1: - return AsyncV1(self._client) + def v1(self) -> AsyncV1Resource: + return AsyncV1Resource(self._client) @cached_property - def v2(self) -> AsyncV2: - return AsyncV2(self._client) + def v2(self) -> AsyncV2Resource: + return AsyncV2Resource(self._client) @cached_property - def with_raw_response(self) -> AsyncImagesWithRawResponse: - return AsyncImagesWithRawResponse(self) + def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: + return AsyncImagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncImagesWithStreamingResponse: - return AsyncImagesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: + return AsyncImagesResourceWithStreamingResponse(self) -class ImagesWithRawResponse: - def __init__(self, images: Images) -> None: +class ImagesResourceWithRawResponse: + def __init__(self, images: ImagesResource) -> None: self._images = images @cached_property - def v1(self) -> V1WithRawResponse: - return V1WithRawResponse(self._images.v1) + def v1(self) -> V1ResourceWithRawResponse: + return V1ResourceWithRawResponse(self._images.v1) @cached_property - def v2(self) -> V2WithRawResponse: - return V2WithRawResponse(self._images.v2) + def v2(self) -> V2ResourceWithRawResponse: + return V2ResourceWithRawResponse(self._images.v2) -class AsyncImagesWithRawResponse: - def __init__(self, images: AsyncImages) -> None: +class AsyncImagesResourceWithRawResponse: + def __init__(self, images: AsyncImagesResource) -> None: self._images = images @cached_property - def v1(self) -> AsyncV1WithRawResponse: - return AsyncV1WithRawResponse(self._images.v1) + def v1(self) -> AsyncV1ResourceWithRawResponse: + return AsyncV1ResourceWithRawResponse(self._images.v1) @cached_property - def v2(self) -> AsyncV2WithRawResponse: - return AsyncV2WithRawResponse(self._images.v2) + def v2(self) -> AsyncV2ResourceWithRawResponse: + return AsyncV2ResourceWithRawResponse(self._images.v2) -class ImagesWithStreamingResponse: - def __init__(self, images: Images) -> None: +class ImagesResourceWithStreamingResponse: + def __init__(self, images: ImagesResource) -> None: self._images = images @cached_property - def v1(self) -> V1WithStreamingResponse: - return V1WithStreamingResponse(self._images.v1) + def v1(self) -> V1ResourceWithStreamingResponse: + return V1ResourceWithStreamingResponse(self._images.v1) @cached_property - def v2(self) -> V2WithStreamingResponse: - return V2WithStreamingResponse(self._images.v2) + def v2(self) -> V2ResourceWithStreamingResponse: + return V2ResourceWithStreamingResponse(self._images.v2) -class AsyncImagesWithStreamingResponse: - def __init__(self, images: AsyncImages) -> None: +class AsyncImagesResourceWithStreamingResponse: + def __init__(self, images: AsyncImagesResource) -> None: self._images = images @cached_property - def v1(self) -> AsyncV1WithStreamingResponse: - return AsyncV1WithStreamingResponse(self._images.v1) + def v1(self) -> AsyncV1ResourceWithStreamingResponse: + return AsyncV1ResourceWithStreamingResponse(self._images.v1) @cached_property - def v2(self) -> AsyncV2WithStreamingResponse: - return AsyncV2WithStreamingResponse(self._images.v2) + def v2(self) -> AsyncV2ResourceWithStreamingResponse: + return AsyncV2ResourceWithStreamingResponse(self._images.v2) diff --git a/src/cloudflare/resources/images/v1/__init__.py b/src/cloudflare/resources/images/v1/__init__.py index a96e820f7f2..8f34624ef08 100644 --- a/src/cloudflare/resources/images/v1/__init__.py +++ b/src/cloudflare/resources/images/v1/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .v1 import ( - V1, - AsyncV1, - V1WithRawResponse, - AsyncV1WithRawResponse, - V1WithStreamingResponse, - AsyncV1WithStreamingResponse, + V1Resource, + AsyncV1Resource, + V1ResourceWithRawResponse, + AsyncV1ResourceWithRawResponse, + V1ResourceWithStreamingResponse, + AsyncV1ResourceWithStreamingResponse, ) from .keys import ( - Keys, - AsyncKeys, - KeysWithRawResponse, - AsyncKeysWithRawResponse, - KeysWithStreamingResponse, - AsyncKeysWithStreamingResponse, + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, ) from .blobs import ( - Blobs, - AsyncBlobs, - BlobsWithRawResponse, - AsyncBlobsWithRawResponse, - BlobsWithStreamingResponse, - AsyncBlobsWithStreamingResponse, + BlobsResource, + AsyncBlobsResource, + BlobsResourceWithRawResponse, + AsyncBlobsResourceWithRawResponse, + BlobsResourceWithStreamingResponse, + AsyncBlobsResourceWithStreamingResponse, ) from .stats import ( - Stats, - AsyncStats, - StatsWithRawResponse, - AsyncStatsWithRawResponse, - StatsWithStreamingResponse, - AsyncStatsWithStreamingResponse, + StatsResource, + AsyncStatsResource, + StatsResourceWithRawResponse, + AsyncStatsResourceWithRawResponse, + StatsResourceWithStreamingResponse, + AsyncStatsResourceWithStreamingResponse, ) from .variants import ( - Variants, - AsyncVariants, - VariantsWithRawResponse, - AsyncVariantsWithRawResponse, - VariantsWithStreamingResponse, - AsyncVariantsWithStreamingResponse, + VariantsResource, + AsyncVariantsResource, + VariantsResourceWithRawResponse, + AsyncVariantsResourceWithRawResponse, + VariantsResourceWithStreamingResponse, + AsyncVariantsResourceWithStreamingResponse, ) __all__ = [ - "Keys", - "AsyncKeys", - "KeysWithRawResponse", - "AsyncKeysWithRawResponse", - "KeysWithStreamingResponse", - "AsyncKeysWithStreamingResponse", - "Stats", - "AsyncStats", - "StatsWithRawResponse", - "AsyncStatsWithRawResponse", - "StatsWithStreamingResponse", - "AsyncStatsWithStreamingResponse", - "Variants", - "AsyncVariants", - "VariantsWithRawResponse", - "AsyncVariantsWithRawResponse", - "VariantsWithStreamingResponse", - "AsyncVariantsWithStreamingResponse", - "Blobs", - "AsyncBlobs", - "BlobsWithRawResponse", - "AsyncBlobsWithRawResponse", - "BlobsWithStreamingResponse", - "AsyncBlobsWithStreamingResponse", - "V1", - "AsyncV1", - "V1WithRawResponse", - "AsyncV1WithRawResponse", - "V1WithStreamingResponse", - "AsyncV1WithStreamingResponse", + "KeysResource", + "AsyncKeysResource", + "KeysResourceWithRawResponse", + "AsyncKeysResourceWithRawResponse", + "KeysResourceWithStreamingResponse", + "AsyncKeysResourceWithStreamingResponse", + "StatsResource", + "AsyncStatsResource", + "StatsResourceWithRawResponse", + "AsyncStatsResourceWithRawResponse", + "StatsResourceWithStreamingResponse", + "AsyncStatsResourceWithStreamingResponse", + "VariantsResource", + "AsyncVariantsResource", + "VariantsResourceWithRawResponse", + "AsyncVariantsResourceWithRawResponse", + "VariantsResourceWithStreamingResponse", + "AsyncVariantsResourceWithStreamingResponse", + "BlobsResource", + "AsyncBlobsResource", + "BlobsResourceWithRawResponse", + "AsyncBlobsResourceWithRawResponse", + "BlobsResourceWithStreamingResponse", + "AsyncBlobsResourceWithStreamingResponse", + "V1Resource", + "AsyncV1Resource", + "V1ResourceWithRawResponse", + "AsyncV1ResourceWithRawResponse", + "V1ResourceWithStreamingResponse", + "AsyncV1ResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/images/v1/blobs.py b/src/cloudflare/resources/images/v1/blobs.py index 4f4d918d78a..4a4dec6571c 100644 --- a/src/cloudflare/resources/images/v1/blobs.py +++ b/src/cloudflare/resources/images/v1/blobs.py @@ -21,17 +21,17 @@ make_request_options, ) -__all__ = ["Blobs", "AsyncBlobs"] +__all__ = ["BlobsResource", "AsyncBlobsResource"] -class Blobs(SyncAPIResource): +class BlobsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BlobsWithRawResponse: - return BlobsWithRawResponse(self) + def with_raw_response(self) -> BlobsResourceWithRawResponse: + return BlobsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BlobsWithStreamingResponse: - return BlobsWithStreamingResponse(self) + def with_streaming_response(self) -> BlobsResourceWithStreamingResponse: + return BlobsResourceWithStreamingResponse(self) def get( self, @@ -77,14 +77,14 @@ def get( ) -class AsyncBlobs(AsyncAPIResource): +class AsyncBlobsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBlobsWithRawResponse: - return AsyncBlobsWithRawResponse(self) + def with_raw_response(self) -> AsyncBlobsResourceWithRawResponse: + return AsyncBlobsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBlobsWithStreamingResponse: - return AsyncBlobsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBlobsResourceWithStreamingResponse: + return AsyncBlobsResourceWithStreamingResponse(self) async def get( self, @@ -130,8 +130,8 @@ async def get( ) -class BlobsWithRawResponse: - def __init__(self, blobs: Blobs) -> None: +class BlobsResourceWithRawResponse: + def __init__(self, blobs: BlobsResource) -> None: self._blobs = blobs self.get = to_custom_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, blobs: Blobs) -> None: ) -class AsyncBlobsWithRawResponse: - def __init__(self, blobs: AsyncBlobs) -> None: +class AsyncBlobsResourceWithRawResponse: + def __init__(self, blobs: AsyncBlobsResource) -> None: self._blobs = blobs self.get = async_to_custom_raw_response_wrapper( @@ -150,8 +150,8 @@ def __init__(self, blobs: AsyncBlobs) -> None: ) -class BlobsWithStreamingResponse: - def __init__(self, blobs: Blobs) -> None: +class BlobsResourceWithStreamingResponse: + def __init__(self, blobs: BlobsResource) -> None: self._blobs = blobs self.get = to_custom_streamed_response_wrapper( @@ -160,8 +160,8 @@ def __init__(self, blobs: Blobs) -> None: ) -class AsyncBlobsWithStreamingResponse: - def __init__(self, blobs: AsyncBlobs) -> None: +class AsyncBlobsResourceWithStreamingResponse: + def __init__(self, blobs: AsyncBlobsResource) -> None: self._blobs = blobs self.get = async_to_custom_streamed_response_wrapper( diff --git a/src/cloudflare/resources/images/v1/keys.py b/src/cloudflare/resources/images/v1/keys.py index b646e0cb140..96ff163104a 100644 --- a/src/cloudflare/resources/images/v1/keys.py +++ b/src/cloudflare/resources/images/v1/keys.py @@ -19,19 +19,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.images.v1 import ImagesImageKeys +from ....types.images.v1.key_list_response import KeyListResponse +from ....types.images.v1.key_delete_response import KeyDeleteResponse +from ....types.images.v1.key_update_response import KeyUpdateResponse -__all__ = ["Keys", "AsyncKeys"] +__all__ = ["KeysResource", "AsyncKeysResource"] -class Keys(SyncAPIResource): +class KeysResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> KeysWithRawResponse: - return KeysWithRawResponse(self) + def with_raw_response(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> KeysWithStreamingResponse: - return KeysWithStreamingResponse(self) + def with_streaming_response(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self) def update( self, @@ -44,7 +46,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImagesImageKeys: + ) -> KeyUpdateResponse: """Create a new signing key with specified name. Returns all keys available. @@ -71,9 +73,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeyUpdateResponse]._unwrapper, ), - cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]), + cast_to=cast(Type[KeyUpdateResponse], ResultWrapper[KeyUpdateResponse]), ) def list( @@ -86,7 +88,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImagesImageKeys: + ) -> KeyListResponse: """Lists your signing keys. These can be found on your Cloudflare Images dashboard. @@ -111,9 +113,9 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeyListResponse]._unwrapper, ), - cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]), + cast_to=cast(Type[KeyListResponse], ResultWrapper[KeyListResponse]), ) def delete( @@ -127,7 +129,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImagesImageKeys: + ) -> KeyDeleteResponse: """Delete signing key with specified name. Returns all keys available. When last @@ -155,20 +157,20 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeyDeleteResponse]._unwrapper, ), - cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]), + cast_to=cast(Type[KeyDeleteResponse], ResultWrapper[KeyDeleteResponse]), ) -class AsyncKeys(AsyncAPIResource): +class AsyncKeysResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncKeysWithRawResponse: - return AsyncKeysWithRawResponse(self) + def with_raw_response(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncKeysWithStreamingResponse: - return AsyncKeysWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self) async def update( self, @@ -181,7 +183,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImagesImageKeys: + ) -> KeyUpdateResponse: """Create a new signing key with specified name. Returns all keys available. @@ -208,9 +210,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeyUpdateResponse]._unwrapper, ), - cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]), + cast_to=cast(Type[KeyUpdateResponse], ResultWrapper[KeyUpdateResponse]), ) async def list( @@ -223,7 +225,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImagesImageKeys: + ) -> KeyListResponse: """Lists your signing keys. These can be found on your Cloudflare Images dashboard. @@ -248,9 +250,9 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeyListResponse]._unwrapper, ), - cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]), + cast_to=cast(Type[KeyListResponse], ResultWrapper[KeyListResponse]), ) async def delete( @@ -264,7 +266,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImagesImageKeys: + ) -> KeyDeleteResponse: """Delete signing key with specified name. Returns all keys available. When last @@ -292,14 +294,14 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeyDeleteResponse]._unwrapper, ), - cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]), + cast_to=cast(Type[KeyDeleteResponse], ResultWrapper[KeyDeleteResponse]), ) -class KeysWithRawResponse: - def __init__(self, keys: Keys) -> None: +class KeysResourceWithRawResponse: + def __init__(self, keys: KeysResource) -> None: self._keys = keys self.update = to_raw_response_wrapper( @@ -313,8 +315,8 @@ def __init__(self, keys: Keys) -> None: ) -class AsyncKeysWithRawResponse: - def __init__(self, keys: AsyncKeys) -> None: +class AsyncKeysResourceWithRawResponse: + def __init__(self, keys: AsyncKeysResource) -> None: self._keys = keys self.update = async_to_raw_response_wrapper( @@ -328,8 +330,8 @@ def __init__(self, keys: AsyncKeys) -> None: ) -class KeysWithStreamingResponse: - def __init__(self, keys: Keys) -> None: +class KeysResourceWithStreamingResponse: + def __init__(self, keys: KeysResource) -> None: self._keys = keys self.update = to_streamed_response_wrapper( @@ -343,8 +345,8 @@ def __init__(self, keys: Keys) -> None: ) -class AsyncKeysWithStreamingResponse: - def __init__(self, keys: AsyncKeys) -> None: +class AsyncKeysResourceWithStreamingResponse: + def __init__(self, keys: AsyncKeysResource) -> None: self._keys = keys self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/images/v1/stats.py b/src/cloudflare/resources/images/v1/stats.py index 40c4307c82b..f67fea164a7 100644 --- a/src/cloudflare/resources/images/v1/stats.py +++ b/src/cloudflare/resources/images/v1/stats.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.images.v1 import ImagesImagesStats +from ....types.images.v1.stat import Stat -__all__ = ["Stats", "AsyncStats"] +__all__ = ["StatsResource", "AsyncStatsResource"] -class Stats(SyncAPIResource): +class StatsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> StatsWithRawResponse: - return StatsWithRawResponse(self) + def with_raw_response(self) -> StatsResourceWithRawResponse: + return StatsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> StatsWithStreamingResponse: - return StatsWithStreamingResponse(self) + def with_streaming_response(self) -> StatsResourceWithStreamingResponse: + return StatsResourceWithStreamingResponse(self) def get( self, @@ -43,7 +43,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImagesImagesStats: + ) -> Stat: """ Fetch usage statistics details for Cloudflare Images. @@ -67,20 +67,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Stat]._unwrapper, ), - cast_to=cast(Type[ImagesImagesStats], ResultWrapper[ImagesImagesStats]), + cast_to=cast(Type[Stat], ResultWrapper[Stat]), ) -class AsyncStats(AsyncAPIResource): +class AsyncStatsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncStatsWithRawResponse: - return AsyncStatsWithRawResponse(self) + def with_raw_response(self) -> AsyncStatsResourceWithRawResponse: + return AsyncStatsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncStatsWithStreamingResponse: - return AsyncStatsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncStatsResourceWithStreamingResponse: + return AsyncStatsResourceWithStreamingResponse(self) async def get( self, @@ -92,7 +92,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImagesImagesStats: + ) -> Stat: """ Fetch usage statistics details for Cloudflare Images. @@ -116,14 +116,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Stat]._unwrapper, ), - cast_to=cast(Type[ImagesImagesStats], ResultWrapper[ImagesImagesStats]), + cast_to=cast(Type[Stat], ResultWrapper[Stat]), ) -class StatsWithRawResponse: - def __init__(self, stats: Stats) -> None: +class StatsResourceWithRawResponse: + def __init__(self, stats: StatsResource) -> None: self._stats = stats self.get = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, stats: Stats) -> None: ) -class AsyncStatsWithRawResponse: - def __init__(self, stats: AsyncStats) -> None: +class AsyncStatsResourceWithRawResponse: + def __init__(self, stats: AsyncStatsResource) -> None: self._stats = stats self.get = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, stats: AsyncStats) -> None: ) -class StatsWithStreamingResponse: - def __init__(self, stats: Stats) -> None: +class StatsResourceWithStreamingResponse: + def __init__(self, stats: StatsResource) -> None: self._stats = stats self.get = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, stats: Stats) -> None: ) -class AsyncStatsWithStreamingResponse: - def __init__(self, stats: AsyncStats) -> None: +class AsyncStatsResourceWithStreamingResponse: + def __init__(self, stats: AsyncStatsResource) -> None: self._stats = stats self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/images/v1/v1.py b/src/cloudflare/resources/images/v1/v1.py index 14e662717ec..1cc52fb05d8 100644 --- a/src/cloudflare/resources/images/v1/v1.py +++ b/src/cloudflare/resources/images/v1/v1.py @@ -2,45 +2,44 @@ from __future__ import annotations -from typing import Any, Type, cast, overload +from typing import Any, Type, cast import httpx from .keys import ( - Keys, - AsyncKeys, - KeysWithRawResponse, - AsyncKeysWithRawResponse, - KeysWithStreamingResponse, - AsyncKeysWithStreamingResponse, + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, ) from .blobs import ( - Blobs, - AsyncBlobs, - BlobsWithRawResponse, - AsyncBlobsWithRawResponse, - BlobsWithStreamingResponse, - AsyncBlobsWithStreamingResponse, + BlobsResource, + AsyncBlobsResource, + BlobsResourceWithRawResponse, + AsyncBlobsResourceWithRawResponse, + BlobsResourceWithStreamingResponse, + AsyncBlobsResourceWithStreamingResponse, ) from .stats import ( - Stats, - AsyncStats, - StatsWithRawResponse, - AsyncStatsWithRawResponse, - StatsWithStreamingResponse, - AsyncStatsWithStreamingResponse, + StatsResource, + AsyncStatsResource, + StatsResourceWithRawResponse, + AsyncStatsResourceWithRawResponse, + StatsResourceWithStreamingResponse, + AsyncStatsResourceWithStreamingResponse, ) from .variants import ( - Variants, - AsyncVariants, - VariantsWithRawResponse, - AsyncVariantsWithRawResponse, - VariantsWithStreamingResponse, - AsyncVariantsWithStreamingResponse, + VariantsResource, + AsyncVariantsResource, + VariantsResourceWithRawResponse, + AsyncVariantsResourceWithRawResponse, + VariantsResourceWithStreamingResponse, + AsyncVariantsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -58,42 +57,47 @@ AsyncPaginator, make_request_options, ) -from ....types.images import Image, V1ListResponse, V1DeleteResponse, v1_edit_params, v1_list_params, v1_create_params +from ....types.images import v1_edit_params, v1_list_params, v1_create_params, v1_delete_params +from ....types.images.image import Image +from ....types.images.v1_list_response import V1ListResponse +from ....types.images.v1_delete_response import V1DeleteResponse -__all__ = ["V1", "AsyncV1"] +__all__ = ["V1Resource", "AsyncV1Resource"] -class V1(SyncAPIResource): +class V1Resource(SyncAPIResource): @cached_property - def keys(self) -> Keys: - return Keys(self._client) + def keys(self) -> KeysResource: + return KeysResource(self._client) @cached_property - def stats(self) -> Stats: - return Stats(self._client) + def stats(self) -> StatsResource: + return StatsResource(self._client) @cached_property - def variants(self) -> Variants: - return Variants(self._client) + def variants(self) -> VariantsResource: + return VariantsResource(self._client) @cached_property - def blobs(self) -> Blobs: - return Blobs(self._client) + def blobs(self) -> BlobsResource: + return BlobsResource(self._client) @cached_property - def with_raw_response(self) -> V1WithRawResponse: - return V1WithRawResponse(self) + def with_raw_response(self) -> V1ResourceWithRawResponse: + return V1ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> V1WithStreamingResponse: - return V1WithStreamingResponse(self) + def with_streaming_response(self) -> V1ResourceWithStreamingResponse: + return V1ResourceWithStreamingResponse(self) - @overload def create( self, *, account_id: str, - file: object, + file: object | NotGiven = NOT_GIVEN, + metadata: object | NotGiven = NOT_GIVEN, + require_signed_urls: bool | NotGiven = NOT_GIVEN, + url: 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, @@ -109,40 +113,15 @@ def create( Args: account_id: Account identifier tag. - file: An image binary data. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request + file: An image binary data. Only needed when type is uploading a file. - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - *, - account_id: str, - url: 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, - ) -> Image: - """ - Upload an image with up to 10 Megabytes using a single HTTP POST - (multipart/form-data) request. An image can be uploaded by sending an image file - or passing an accessible to an API url. + metadata: User modifiable key-value store. Can use used for keeping references to another + system of record for managing images. - Args: - account_id: Account identifier tag. + require_signed_urls: Indicates whether the image requires a signature token for the access. - url: A URL to fetch an image from origin. + url: A URL to fetch an image from origin. Only needed when type is uploading from a + URL. extra_headers: Send extra headers @@ -152,22 +131,6 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["account_id", "file"], ["account_id", "url"]) - def create( - self, - *, - account_id: str, - file: object | NotGiven = NOT_GIVEN, - url: 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, - ) -> Image: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( @@ -175,6 +138,8 @@ def create( body=maybe_transform( { "file": file, + "metadata": metadata, + "require_signed_urls": require_signed_urls, "url": url, }, v1_create_params.V1CreateParams, @@ -184,7 +149,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Image]._unwrapper, ), cast_to=cast(Type[Image], ResultWrapper[Image]), ) @@ -248,6 +213,7 @@ def delete( image_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -281,12 +247,13 @@ def delete( V1DeleteResponse, self._delete( f"/accounts/{account_id}/images/v1/{image_id}", + body=maybe_transform(body, v1_delete_params.V1DeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[V1DeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[V1DeleteResponse] @@ -351,7 +318,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Image]._unwrapper, ), cast_to=cast(Type[Image], ResultWrapper[Image]), ) @@ -395,43 +362,45 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Image]._unwrapper, ), cast_to=cast(Type[Image], ResultWrapper[Image]), ) -class AsyncV1(AsyncAPIResource): +class AsyncV1Resource(AsyncAPIResource): @cached_property - def keys(self) -> AsyncKeys: - return AsyncKeys(self._client) + def keys(self) -> AsyncKeysResource: + return AsyncKeysResource(self._client) @cached_property - def stats(self) -> AsyncStats: - return AsyncStats(self._client) + def stats(self) -> AsyncStatsResource: + return AsyncStatsResource(self._client) @cached_property - def variants(self) -> AsyncVariants: - return AsyncVariants(self._client) + def variants(self) -> AsyncVariantsResource: + return AsyncVariantsResource(self._client) @cached_property - def blobs(self) -> AsyncBlobs: - return AsyncBlobs(self._client) + def blobs(self) -> AsyncBlobsResource: + return AsyncBlobsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncV1WithRawResponse: - return AsyncV1WithRawResponse(self) + def with_raw_response(self) -> AsyncV1ResourceWithRawResponse: + return AsyncV1ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncV1WithStreamingResponse: - return AsyncV1WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncV1ResourceWithStreamingResponse: + return AsyncV1ResourceWithStreamingResponse(self) - @overload async def create( self, *, account_id: str, - file: object, + file: object | NotGiven = NOT_GIVEN, + metadata: object | NotGiven = NOT_GIVEN, + require_signed_urls: bool | NotGiven = NOT_GIVEN, + url: 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, @@ -447,40 +416,15 @@ async def create( Args: account_id: Account identifier tag. - file: An image binary data. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request + file: An image binary data. Only needed when type is uploading a file. - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - account_id: str, - url: 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, - ) -> Image: - """ - Upload an image with up to 10 Megabytes using a single HTTP POST - (multipart/form-data) request. An image can be uploaded by sending an image file - or passing an accessible to an API url. + metadata: User modifiable key-value store. Can use used for keeping references to another + system of record for managing images. - Args: - account_id: Account identifier tag. + require_signed_urls: Indicates whether the image requires a signature token for the access. - url: A URL to fetch an image from origin. + url: A URL to fetch an image from origin. Only needed when type is uploading from a + URL. extra_headers: Send extra headers @@ -490,22 +434,6 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["account_id", "file"], ["account_id", "url"]) - async def create( - self, - *, - account_id: str, - file: object | NotGiven = NOT_GIVEN, - url: 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, - ) -> Image: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( @@ -513,6 +441,8 @@ async def create( body=await async_maybe_transform( { "file": file, + "metadata": metadata, + "require_signed_urls": require_signed_urls, "url": url, }, v1_create_params.V1CreateParams, @@ -522,7 +452,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Image]._unwrapper, ), cast_to=cast(Type[Image], ResultWrapper[Image]), ) @@ -586,6 +516,7 @@ async def delete( image_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -619,12 +550,13 @@ async def delete( V1DeleteResponse, await self._delete( f"/accounts/{account_id}/images/v1/{image_id}", + body=await async_maybe_transform(body, v1_delete_params.V1DeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[V1DeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[V1DeleteResponse] @@ -689,7 +621,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Image]._unwrapper, ), cast_to=cast(Type[Image], ResultWrapper[Image]), ) @@ -733,14 +665,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Image]._unwrapper, ), cast_to=cast(Type[Image], ResultWrapper[Image]), ) -class V1WithRawResponse: - def __init__(self, v1: V1) -> None: +class V1ResourceWithRawResponse: + def __init__(self, v1: V1Resource) -> None: self._v1 = v1 self.create = to_raw_response_wrapper( @@ -760,24 +692,24 @@ def __init__(self, v1: V1) -> None: ) @cached_property - def keys(self) -> KeysWithRawResponse: - return KeysWithRawResponse(self._v1.keys) + def keys(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self._v1.keys) @cached_property - def stats(self) -> StatsWithRawResponse: - return StatsWithRawResponse(self._v1.stats) + def stats(self) -> StatsResourceWithRawResponse: + return StatsResourceWithRawResponse(self._v1.stats) @cached_property - def variants(self) -> VariantsWithRawResponse: - return VariantsWithRawResponse(self._v1.variants) + def variants(self) -> VariantsResourceWithRawResponse: + return VariantsResourceWithRawResponse(self._v1.variants) @cached_property - def blobs(self) -> BlobsWithRawResponse: - return BlobsWithRawResponse(self._v1.blobs) + def blobs(self) -> BlobsResourceWithRawResponse: + return BlobsResourceWithRawResponse(self._v1.blobs) -class AsyncV1WithRawResponse: - def __init__(self, v1: AsyncV1) -> None: +class AsyncV1ResourceWithRawResponse: + def __init__(self, v1: AsyncV1Resource) -> None: self._v1 = v1 self.create = async_to_raw_response_wrapper( @@ -797,24 +729,24 @@ def __init__(self, v1: AsyncV1) -> None: ) @cached_property - def keys(self) -> AsyncKeysWithRawResponse: - return AsyncKeysWithRawResponse(self._v1.keys) + def keys(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self._v1.keys) @cached_property - def stats(self) -> AsyncStatsWithRawResponse: - return AsyncStatsWithRawResponse(self._v1.stats) + def stats(self) -> AsyncStatsResourceWithRawResponse: + return AsyncStatsResourceWithRawResponse(self._v1.stats) @cached_property - def variants(self) -> AsyncVariantsWithRawResponse: - return AsyncVariantsWithRawResponse(self._v1.variants) + def variants(self) -> AsyncVariantsResourceWithRawResponse: + return AsyncVariantsResourceWithRawResponse(self._v1.variants) @cached_property - def blobs(self) -> AsyncBlobsWithRawResponse: - return AsyncBlobsWithRawResponse(self._v1.blobs) + def blobs(self) -> AsyncBlobsResourceWithRawResponse: + return AsyncBlobsResourceWithRawResponse(self._v1.blobs) -class V1WithStreamingResponse: - def __init__(self, v1: V1) -> None: +class V1ResourceWithStreamingResponse: + def __init__(self, v1: V1Resource) -> None: self._v1 = v1 self.create = to_streamed_response_wrapper( @@ -834,24 +766,24 @@ def __init__(self, v1: V1) -> None: ) @cached_property - def keys(self) -> KeysWithStreamingResponse: - return KeysWithStreamingResponse(self._v1.keys) + def keys(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self._v1.keys) @cached_property - def stats(self) -> StatsWithStreamingResponse: - return StatsWithStreamingResponse(self._v1.stats) + def stats(self) -> StatsResourceWithStreamingResponse: + return StatsResourceWithStreamingResponse(self._v1.stats) @cached_property - def variants(self) -> VariantsWithStreamingResponse: - return VariantsWithStreamingResponse(self._v1.variants) + def variants(self) -> VariantsResourceWithStreamingResponse: + return VariantsResourceWithStreamingResponse(self._v1.variants) @cached_property - def blobs(self) -> BlobsWithStreamingResponse: - return BlobsWithStreamingResponse(self._v1.blobs) + def blobs(self) -> BlobsResourceWithStreamingResponse: + return BlobsResourceWithStreamingResponse(self._v1.blobs) -class AsyncV1WithStreamingResponse: - def __init__(self, v1: AsyncV1) -> None: +class AsyncV1ResourceWithStreamingResponse: + def __init__(self, v1: AsyncV1Resource) -> None: self._v1 = v1 self.create = async_to_streamed_response_wrapper( @@ -871,17 +803,17 @@ def __init__(self, v1: AsyncV1) -> None: ) @cached_property - def keys(self) -> AsyncKeysWithStreamingResponse: - return AsyncKeysWithStreamingResponse(self._v1.keys) + def keys(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self._v1.keys) @cached_property - def stats(self) -> AsyncStatsWithStreamingResponse: - return AsyncStatsWithStreamingResponse(self._v1.stats) + def stats(self) -> AsyncStatsResourceWithStreamingResponse: + return AsyncStatsResourceWithStreamingResponse(self._v1.stats) @cached_property - def variants(self) -> AsyncVariantsWithStreamingResponse: - return AsyncVariantsWithStreamingResponse(self._v1.variants) + def variants(self) -> AsyncVariantsResourceWithStreamingResponse: + return AsyncVariantsResourceWithStreamingResponse(self._v1.variants) @cached_property - def blobs(self) -> AsyncBlobsWithStreamingResponse: - return AsyncBlobsWithStreamingResponse(self._v1.blobs) + def blobs(self) -> AsyncBlobsResourceWithStreamingResponse: + return AsyncBlobsResourceWithStreamingResponse(self._v1.blobs) diff --git a/src/cloudflare/resources/images/v1/variants.py b/src/cloudflare/resources/images/v1/variants.py index cca0fd68980..67656b3cf42 100644 --- a/src/cloudflare/resources/images/v1/variants.py +++ b/src/cloudflare/resources/images/v1/variants.py @@ -23,25 +23,24 @@ from ...._base_client import ( make_request_options, ) -from ....types.images.v1 import ( - V1ImageVariant, - V1ImageVariants, - VariantDeleteResponse, - variant_edit_params, - variant_create_params, -) +from ....types.images.v1 import variant_edit_params, variant_create_params, variant_delete_params +from ....types.images.v1.variant import Variant +from ....types.images.v1.variant_get_response import VariantGetResponse +from ....types.images.v1.variant_edit_response import VariantEditResponse +from ....types.images.v1.variant_create_response import VariantCreateResponse +from ....types.images.v1.variant_delete_response import VariantDeleteResponse -__all__ = ["Variants", "AsyncVariants"] +__all__ = ["VariantsResource", "AsyncVariantsResource"] -class Variants(SyncAPIResource): +class VariantsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> VariantsWithRawResponse: - return VariantsWithRawResponse(self) + def with_raw_response(self) -> VariantsResourceWithRawResponse: + return VariantsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VariantsWithStreamingResponse: - return VariantsWithStreamingResponse(self) + def with_streaming_response(self) -> VariantsResourceWithStreamingResponse: + return VariantsResourceWithStreamingResponse(self) def create( self, @@ -56,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ImageVariant: + ) -> VariantCreateResponse: """ Specify variants that allow you to resize images for different use cases. @@ -93,9 +92,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantCreateResponse]._unwrapper, ), - cast_to=cast(Type[V1ImageVariant], ResultWrapper[V1ImageVariant]), + cast_to=cast(Type[VariantCreateResponse], ResultWrapper[VariantCreateResponse]), ) def list( @@ -108,7 +107,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ImageVariants: + ) -> Variant: """ Lists existing variants. @@ -132,9 +131,9 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Variant]._unwrapper, ), - cast_to=cast(Type[V1ImageVariants], ResultWrapper[V1ImageVariants]), + cast_to=cast(Type[Variant], ResultWrapper[Variant]), ) def delete( @@ -142,6 +141,7 @@ def delete( variant_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -171,12 +171,13 @@ def delete( VariantDeleteResponse, self._delete( f"/accounts/{account_id}/images/v1/variants/{variant_id}", + body=maybe_transform(body, variant_delete_params.VariantDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[VariantDeleteResponse] @@ -197,7 +198,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ImageVariant: + ) -> VariantEditResponse: """ Updating a variant purges the cache for all images associated with the variant. @@ -235,9 +236,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantEditResponse]._unwrapper, ), - cast_to=cast(Type[V1ImageVariant], ResultWrapper[V1ImageVariant]), + cast_to=cast(Type[VariantEditResponse], ResultWrapper[VariantEditResponse]), ) def get( @@ -251,7 +252,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ImageVariant: + ) -> VariantGetResponse: """ Fetch details for a single variant. @@ -277,20 +278,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantGetResponse]._unwrapper, ), - cast_to=cast(Type[V1ImageVariant], ResultWrapper[V1ImageVariant]), + cast_to=cast(Type[VariantGetResponse], ResultWrapper[VariantGetResponse]), ) -class AsyncVariants(AsyncAPIResource): +class AsyncVariantsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncVariantsWithRawResponse: - return AsyncVariantsWithRawResponse(self) + def with_raw_response(self) -> AsyncVariantsResourceWithRawResponse: + return AsyncVariantsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVariantsWithStreamingResponse: - return AsyncVariantsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVariantsResourceWithStreamingResponse: + return AsyncVariantsResourceWithStreamingResponse(self) async def create( self, @@ -305,7 +306,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ImageVariant: + ) -> VariantCreateResponse: """ Specify variants that allow you to resize images for different use cases. @@ -342,9 +343,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantCreateResponse]._unwrapper, ), - cast_to=cast(Type[V1ImageVariant], ResultWrapper[V1ImageVariant]), + cast_to=cast(Type[VariantCreateResponse], ResultWrapper[VariantCreateResponse]), ) async def list( @@ -357,7 +358,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ImageVariants: + ) -> Variant: """ Lists existing variants. @@ -381,9 +382,9 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Variant]._unwrapper, ), - cast_to=cast(Type[V1ImageVariants], ResultWrapper[V1ImageVariants]), + cast_to=cast(Type[Variant], ResultWrapper[Variant]), ) async def delete( @@ -391,6 +392,7 @@ async def delete( variant_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -420,12 +422,13 @@ async def delete( VariantDeleteResponse, await self._delete( f"/accounts/{account_id}/images/v1/variants/{variant_id}", + body=await async_maybe_transform(body, variant_delete_params.VariantDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[VariantDeleteResponse] @@ -446,7 +449,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ImageVariant: + ) -> VariantEditResponse: """ Updating a variant purges the cache for all images associated with the variant. @@ -484,9 +487,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantEditResponse]._unwrapper, ), - cast_to=cast(Type[V1ImageVariant], ResultWrapper[V1ImageVariant]), + cast_to=cast(Type[VariantEditResponse], ResultWrapper[VariantEditResponse]), ) async def get( @@ -500,7 +503,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ImageVariant: + ) -> VariantGetResponse: """ Fetch details for a single variant. @@ -526,14 +529,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VariantGetResponse]._unwrapper, ), - cast_to=cast(Type[V1ImageVariant], ResultWrapper[V1ImageVariant]), + cast_to=cast(Type[VariantGetResponse], ResultWrapper[VariantGetResponse]), ) -class VariantsWithRawResponse: - def __init__(self, variants: Variants) -> None: +class VariantsResourceWithRawResponse: + def __init__(self, variants: VariantsResource) -> None: self._variants = variants self.create = to_raw_response_wrapper( @@ -553,8 +556,8 @@ def __init__(self, variants: Variants) -> None: ) -class AsyncVariantsWithRawResponse: - def __init__(self, variants: AsyncVariants) -> None: +class AsyncVariantsResourceWithRawResponse: + def __init__(self, variants: AsyncVariantsResource) -> None: self._variants = variants self.create = async_to_raw_response_wrapper( @@ -574,8 +577,8 @@ def __init__(self, variants: AsyncVariants) -> None: ) -class VariantsWithStreamingResponse: - def __init__(self, variants: Variants) -> None: +class VariantsResourceWithStreamingResponse: + def __init__(self, variants: VariantsResource) -> None: self._variants = variants self.create = to_streamed_response_wrapper( @@ -595,8 +598,8 @@ def __init__(self, variants: Variants) -> None: ) -class AsyncVariantsWithStreamingResponse: - def __init__(self, variants: AsyncVariants) -> None: +class AsyncVariantsResourceWithStreamingResponse: + def __init__(self, variants: AsyncVariantsResource) -> None: self._variants = variants self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/images/v2/__init__.py b/src/cloudflare/resources/images/v2/__init__.py index 67e075c4706..aa1ac470432 100644 --- a/src/cloudflare/resources/images/v2/__init__.py +++ b/src/cloudflare/resources/images/v2/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .v2 import ( - V2, - AsyncV2, - V2WithRawResponse, - AsyncV2WithRawResponse, - V2WithStreamingResponse, - AsyncV2WithStreamingResponse, + V2Resource, + AsyncV2Resource, + V2ResourceWithRawResponse, + AsyncV2ResourceWithRawResponse, + V2ResourceWithStreamingResponse, + AsyncV2ResourceWithStreamingResponse, ) from .direct_uploads import ( - DirectUploads, - AsyncDirectUploads, - DirectUploadsWithRawResponse, - AsyncDirectUploadsWithRawResponse, - DirectUploadsWithStreamingResponse, - AsyncDirectUploadsWithStreamingResponse, + DirectUploadsResource, + AsyncDirectUploadsResource, + DirectUploadsResourceWithRawResponse, + AsyncDirectUploadsResourceWithRawResponse, + DirectUploadsResourceWithStreamingResponse, + AsyncDirectUploadsResourceWithStreamingResponse, ) __all__ = [ - "DirectUploads", - "AsyncDirectUploads", - "DirectUploadsWithRawResponse", - "AsyncDirectUploadsWithRawResponse", - "DirectUploadsWithStreamingResponse", - "AsyncDirectUploadsWithStreamingResponse", - "V2", - "AsyncV2", - "V2WithRawResponse", - "AsyncV2WithRawResponse", - "V2WithStreamingResponse", - "AsyncV2WithStreamingResponse", + "DirectUploadsResource", + "AsyncDirectUploadsResource", + "DirectUploadsResourceWithRawResponse", + "AsyncDirectUploadsResourceWithRawResponse", + "DirectUploadsResourceWithStreamingResponse", + "AsyncDirectUploadsResourceWithStreamingResponse", + "V2Resource", + "AsyncV2Resource", + "V2ResourceWithRawResponse", + "AsyncV2ResourceWithRawResponse", + "V2ResourceWithStreamingResponse", + "AsyncV2ResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/images/v2/direct_uploads.py b/src/cloudflare/resources/images/v2/direct_uploads.py index abefd7e4502..3c66318e9f2 100644 --- a/src/cloudflare/resources/images/v2/direct_uploads.py +++ b/src/cloudflare/resources/images/v2/direct_uploads.py @@ -24,24 +24,26 @@ from ...._base_client import ( make_request_options, ) -from ....types.images.v2 import DirectUploadCreateResponse, direct_upload_create_params +from ....types.images.v2 import direct_upload_create_params +from ....types.images.v2.direct_upload_create_response import DirectUploadCreateResponse -__all__ = ["DirectUploads", "AsyncDirectUploads"] +__all__ = ["DirectUploadsResource", "AsyncDirectUploadsResource"] -class DirectUploads(SyncAPIResource): +class DirectUploadsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DirectUploadsWithRawResponse: - return DirectUploadsWithRawResponse(self) + def with_raw_response(self) -> DirectUploadsResourceWithRawResponse: + return DirectUploadsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DirectUploadsWithStreamingResponse: - return DirectUploadsWithStreamingResponse(self) + def with_streaming_response(self) -> DirectUploadsResourceWithStreamingResponse: + return DirectUploadsResourceWithStreamingResponse(self) def create( self, *, account_id: str, + id: str | NotGiven = NOT_GIVEN, expiry: Union[str, datetime] | NotGiven = NOT_GIVEN, metadata: object | NotGiven = NOT_GIVEN, require_signed_urls: bool | NotGiven = NOT_GIVEN, @@ -65,6 +67,10 @@ def create( Args: account_id: Account identifier tag. + id: Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths, + and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a + UUID. + expiry: The date after which the upload will not be accepted. Minimum: Now + 2 minutes. Maximum: Now + 6 hours. @@ -87,6 +93,7 @@ def create( f"/accounts/{account_id}/images/v2/direct_upload", body=maybe_transform( { + "id": id, "expiry": expiry, "metadata": metadata, "require_signed_urls": require_signed_urls, @@ -98,25 +105,26 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DirectUploadCreateResponse]._unwrapper, ), cast_to=cast(Type[DirectUploadCreateResponse], ResultWrapper[DirectUploadCreateResponse]), ) -class AsyncDirectUploads(AsyncAPIResource): +class AsyncDirectUploadsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDirectUploadsWithRawResponse: - return AsyncDirectUploadsWithRawResponse(self) + def with_raw_response(self) -> AsyncDirectUploadsResourceWithRawResponse: + return AsyncDirectUploadsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDirectUploadsWithStreamingResponse: - return AsyncDirectUploadsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDirectUploadsResourceWithStreamingResponse: + return AsyncDirectUploadsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, + id: str | NotGiven = NOT_GIVEN, expiry: Union[str, datetime] | NotGiven = NOT_GIVEN, metadata: object | NotGiven = NOT_GIVEN, require_signed_urls: bool | NotGiven = NOT_GIVEN, @@ -140,6 +148,10 @@ async def create( Args: account_id: Account identifier tag. + id: Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths, + and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a + UUID. + expiry: The date after which the upload will not be accepted. Minimum: Now + 2 minutes. Maximum: Now + 6 hours. @@ -162,6 +174,7 @@ async def create( f"/accounts/{account_id}/images/v2/direct_upload", body=await async_maybe_transform( { + "id": id, "expiry": expiry, "metadata": metadata, "require_signed_urls": require_signed_urls, @@ -173,14 +186,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DirectUploadCreateResponse]._unwrapper, ), cast_to=cast(Type[DirectUploadCreateResponse], ResultWrapper[DirectUploadCreateResponse]), ) -class DirectUploadsWithRawResponse: - def __init__(self, direct_uploads: DirectUploads) -> None: +class DirectUploadsResourceWithRawResponse: + def __init__(self, direct_uploads: DirectUploadsResource) -> None: self._direct_uploads = direct_uploads self.create = to_raw_response_wrapper( @@ -188,8 +201,8 @@ def __init__(self, direct_uploads: DirectUploads) -> None: ) -class AsyncDirectUploadsWithRawResponse: - def __init__(self, direct_uploads: AsyncDirectUploads) -> None: +class AsyncDirectUploadsResourceWithRawResponse: + def __init__(self, direct_uploads: AsyncDirectUploadsResource) -> None: self._direct_uploads = direct_uploads self.create = async_to_raw_response_wrapper( @@ -197,8 +210,8 @@ def __init__(self, direct_uploads: AsyncDirectUploads) -> None: ) -class DirectUploadsWithStreamingResponse: - def __init__(self, direct_uploads: DirectUploads) -> None: +class DirectUploadsResourceWithStreamingResponse: + def __init__(self, direct_uploads: DirectUploadsResource) -> None: self._direct_uploads = direct_uploads self.create = to_streamed_response_wrapper( @@ -206,8 +219,8 @@ def __init__(self, direct_uploads: DirectUploads) -> None: ) -class AsyncDirectUploadsWithStreamingResponse: - def __init__(self, direct_uploads: AsyncDirectUploads) -> None: +class AsyncDirectUploadsResourceWithStreamingResponse: + def __init__(self, direct_uploads: AsyncDirectUploadsResource) -> None: self._direct_uploads = direct_uploads self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/images/v2/v2.py b/src/cloudflare/resources/images/v2/v2.py index a3d4a6f83a0..b683506e828 100644 --- a/src/cloudflare/resources/images/v2/v2.py +++ b/src/cloudflare/resources/images/v2/v2.py @@ -22,33 +22,34 @@ ) from ...._wrappers import ResultWrapper from .direct_uploads import ( - DirectUploads, - AsyncDirectUploads, - DirectUploadsWithRawResponse, - AsyncDirectUploadsWithRawResponse, - DirectUploadsWithStreamingResponse, - AsyncDirectUploadsWithStreamingResponse, + DirectUploadsResource, + AsyncDirectUploadsResource, + DirectUploadsResourceWithRawResponse, + AsyncDirectUploadsResourceWithRawResponse, + DirectUploadsResourceWithStreamingResponse, + AsyncDirectUploadsResourceWithStreamingResponse, ) from ...._base_client import ( make_request_options, ) -from ....types.images import V2ListResponse, v2_list_params +from ....types.images import v2_list_params +from ....types.images.v2_list_response import V2ListResponse -__all__ = ["V2", "AsyncV2"] +__all__ = ["V2Resource", "AsyncV2Resource"] -class V2(SyncAPIResource): +class V2Resource(SyncAPIResource): @cached_property - def direct_uploads(self) -> DirectUploads: - return DirectUploads(self._client) + def direct_uploads(self) -> DirectUploadsResource: + return DirectUploadsResource(self._client) @cached_property - def with_raw_response(self) -> V2WithRawResponse: - return V2WithRawResponse(self) + def with_raw_response(self) -> V2ResourceWithRawResponse: + return V2ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> V2WithStreamingResponse: - return V2WithStreamingResponse(self) + def with_streaming_response(self) -> V2ResourceWithStreamingResponse: + return V2ResourceWithStreamingResponse(self) def list( self, @@ -104,24 +105,24 @@ def list( }, v2_list_params.V2ListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[V2ListResponse]._unwrapper, ), cast_to=cast(Type[V2ListResponse], ResultWrapper[V2ListResponse]), ) -class AsyncV2(AsyncAPIResource): +class AsyncV2Resource(AsyncAPIResource): @cached_property - def direct_uploads(self) -> AsyncDirectUploads: - return AsyncDirectUploads(self._client) + def direct_uploads(self) -> AsyncDirectUploadsResource: + return AsyncDirectUploadsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncV2WithRawResponse: - return AsyncV2WithRawResponse(self) + def with_raw_response(self) -> AsyncV2ResourceWithRawResponse: + return AsyncV2ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncV2WithStreamingResponse: - return AsyncV2WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncV2ResourceWithStreamingResponse: + return AsyncV2ResourceWithStreamingResponse(self) async def list( self, @@ -177,14 +178,14 @@ async def list( }, v2_list_params.V2ListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[V2ListResponse]._unwrapper, ), cast_to=cast(Type[V2ListResponse], ResultWrapper[V2ListResponse]), ) -class V2WithRawResponse: - def __init__(self, v2: V2) -> None: +class V2ResourceWithRawResponse: + def __init__(self, v2: V2Resource) -> None: self._v2 = v2 self.list = to_raw_response_wrapper( @@ -192,12 +193,12 @@ def __init__(self, v2: V2) -> None: ) @cached_property - def direct_uploads(self) -> DirectUploadsWithRawResponse: - return DirectUploadsWithRawResponse(self._v2.direct_uploads) + def direct_uploads(self) -> DirectUploadsResourceWithRawResponse: + return DirectUploadsResourceWithRawResponse(self._v2.direct_uploads) -class AsyncV2WithRawResponse: - def __init__(self, v2: AsyncV2) -> None: +class AsyncV2ResourceWithRawResponse: + def __init__(self, v2: AsyncV2Resource) -> None: self._v2 = v2 self.list = async_to_raw_response_wrapper( @@ -205,12 +206,12 @@ def __init__(self, v2: AsyncV2) -> None: ) @cached_property - def direct_uploads(self) -> AsyncDirectUploadsWithRawResponse: - return AsyncDirectUploadsWithRawResponse(self._v2.direct_uploads) + def direct_uploads(self) -> AsyncDirectUploadsResourceWithRawResponse: + return AsyncDirectUploadsResourceWithRawResponse(self._v2.direct_uploads) -class V2WithStreamingResponse: - def __init__(self, v2: V2) -> None: +class V2ResourceWithStreamingResponse: + def __init__(self, v2: V2Resource) -> None: self._v2 = v2 self.list = to_streamed_response_wrapper( @@ -218,12 +219,12 @@ def __init__(self, v2: V2) -> None: ) @cached_property - def direct_uploads(self) -> DirectUploadsWithStreamingResponse: - return DirectUploadsWithStreamingResponse(self._v2.direct_uploads) + def direct_uploads(self) -> DirectUploadsResourceWithStreamingResponse: + return DirectUploadsResourceWithStreamingResponse(self._v2.direct_uploads) -class AsyncV2WithStreamingResponse: - def __init__(self, v2: AsyncV2) -> None: +class AsyncV2ResourceWithStreamingResponse: + def __init__(self, v2: AsyncV2Resource) -> None: self._v2 = v2 self.list = async_to_streamed_response_wrapper( @@ -231,5 +232,5 @@ def __init__(self, v2: AsyncV2) -> None: ) @cached_property - def direct_uploads(self) -> AsyncDirectUploadsWithStreamingResponse: - return AsyncDirectUploadsWithStreamingResponse(self._v2.direct_uploads) + def direct_uploads(self) -> AsyncDirectUploadsResourceWithStreamingResponse: + return AsyncDirectUploadsResourceWithStreamingResponse(self._v2.direct_uploads) diff --git a/src/cloudflare/resources/intel/__init__.py b/src/cloudflare/resources/intel/__init__.py index 2d6b3ff1216..126ee686dad 100644 --- a/src/cloudflare/resources/intel/__init__.py +++ b/src/cloudflare/resources/intel/__init__.py @@ -1,173 +1,173 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .asn import ( - ASN, - AsyncASN, - ASNWithRawResponse, - AsyncASNWithRawResponse, - ASNWithStreamingResponse, - AsyncASNWithStreamingResponse, + ASNResource, + AsyncASNResource, + ASNResourceWithRawResponse, + AsyncASNResourceWithRawResponse, + ASNResourceWithStreamingResponse, + AsyncASNResourceWithStreamingResponse, ) from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .ips import ( - IPs, - AsyncIPs, - IPsWithRawResponse, - AsyncIPsWithRawResponse, - IPsWithStreamingResponse, - AsyncIPsWithStreamingResponse, + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, ) from .intel import ( - Intel, - AsyncIntel, - IntelWithRawResponse, - AsyncIntelWithRawResponse, - IntelWithStreamingResponse, - AsyncIntelWithStreamingResponse, + IntelResource, + AsyncIntelResource, + IntelResourceWithRawResponse, + AsyncIntelResourceWithRawResponse, + IntelResourceWithStreamingResponse, + AsyncIntelResourceWithStreamingResponse, ) from .whois import ( - Whois, - AsyncWhois, - WhoisWithRawResponse, - AsyncWhoisWithRawResponse, - WhoisWithStreamingResponse, - AsyncWhoisWithStreamingResponse, + WhoisResource, + AsyncWhoisResource, + WhoisResourceWithRawResponse, + AsyncWhoisResourceWithRawResponse, + WhoisResourceWithStreamingResponse, + AsyncWhoisResourceWithStreamingResponse, ) from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) from .ip_lists import ( - IPLists, - AsyncIPLists, - IPListsWithRawResponse, - AsyncIPListsWithRawResponse, - IPListsWithStreamingResponse, - AsyncIPListsWithStreamingResponse, + IPListsResource, + AsyncIPListsResource, + IPListsResourceWithRawResponse, + AsyncIPListsResourceWithRawResponse, + IPListsResourceWithStreamingResponse, + AsyncIPListsResourceWithStreamingResponse, ) from .sinkholes import ( - Sinkholes, - AsyncSinkholes, - SinkholesWithRawResponse, - AsyncSinkholesWithRawResponse, - SinkholesWithStreamingResponse, - AsyncSinkholesWithStreamingResponse, + SinkholesResource, + AsyncSinkholesResource, + SinkholesResourceWithRawResponse, + AsyncSinkholesResourceWithRawResponse, + SinkholesResourceWithStreamingResponse, + AsyncSinkholesResourceWithStreamingResponse, ) from .domain_history import ( - DomainHistory, - AsyncDomainHistory, - DomainHistoryWithRawResponse, - AsyncDomainHistoryWithRawResponse, - DomainHistoryWithStreamingResponse, - AsyncDomainHistoryWithStreamingResponse, + DomainHistoryResource, + AsyncDomainHistoryResource, + DomainHistoryResourceWithRawResponse, + AsyncDomainHistoryResourceWithRawResponse, + DomainHistoryResourceWithStreamingResponse, + AsyncDomainHistoryResourceWithStreamingResponse, ) from .indicator_feeds import ( - IndicatorFeeds, - AsyncIndicatorFeeds, - IndicatorFeedsWithRawResponse, - AsyncIndicatorFeedsWithRawResponse, - IndicatorFeedsWithStreamingResponse, - AsyncIndicatorFeedsWithStreamingResponse, + IndicatorFeedsResource, + AsyncIndicatorFeedsResource, + IndicatorFeedsResourceWithRawResponse, + AsyncIndicatorFeedsResourceWithRawResponse, + IndicatorFeedsResourceWithStreamingResponse, + AsyncIndicatorFeedsResourceWithStreamingResponse, ) from .miscategorizations import ( - Miscategorizations, - AsyncMiscategorizations, - MiscategorizationsWithRawResponse, - AsyncMiscategorizationsWithRawResponse, - MiscategorizationsWithStreamingResponse, - AsyncMiscategorizationsWithStreamingResponse, + MiscategorizationsResource, + AsyncMiscategorizationsResource, + MiscategorizationsResourceWithRawResponse, + AsyncMiscategorizationsResourceWithRawResponse, + MiscategorizationsResourceWithStreamingResponse, + AsyncMiscategorizationsResourceWithStreamingResponse, ) from .attack_surface_report import ( - AttackSurfaceReport, - AsyncAttackSurfaceReport, - AttackSurfaceReportWithRawResponse, - AsyncAttackSurfaceReportWithRawResponse, - AttackSurfaceReportWithStreamingResponse, - AsyncAttackSurfaceReportWithStreamingResponse, + AttackSurfaceReportResource, + AsyncAttackSurfaceReportResource, + AttackSurfaceReportResourceWithRawResponse, + AsyncAttackSurfaceReportResourceWithRawResponse, + AttackSurfaceReportResourceWithStreamingResponse, + AsyncAttackSurfaceReportResourceWithStreamingResponse, ) __all__ = [ - "ASN", - "AsyncASN", - "ASNWithRawResponse", - "AsyncASNWithRawResponse", - "ASNWithStreamingResponse", - "AsyncASNWithStreamingResponse", - "DNS", - "AsyncDNS", - "DNSWithRawResponse", - "AsyncDNSWithRawResponse", - "DNSWithStreamingResponse", - "AsyncDNSWithStreamingResponse", - "Domains", - "AsyncDomains", - "DomainsWithRawResponse", - "AsyncDomainsWithRawResponse", - "DomainsWithStreamingResponse", - "AsyncDomainsWithStreamingResponse", - "DomainHistory", - "AsyncDomainHistory", - "DomainHistoryWithRawResponse", - "AsyncDomainHistoryWithRawResponse", - "DomainHistoryWithStreamingResponse", - "AsyncDomainHistoryWithStreamingResponse", - "IPs", - "AsyncIPs", - "IPsWithRawResponse", - "AsyncIPsWithRawResponse", - "IPsWithStreamingResponse", - "AsyncIPsWithStreamingResponse", - "IPLists", - "AsyncIPLists", - "IPListsWithRawResponse", - "AsyncIPListsWithRawResponse", - "IPListsWithStreamingResponse", - "AsyncIPListsWithStreamingResponse", - "Miscategorizations", - "AsyncMiscategorizations", - "MiscategorizationsWithRawResponse", - "AsyncMiscategorizationsWithRawResponse", - "MiscategorizationsWithStreamingResponse", - "AsyncMiscategorizationsWithStreamingResponse", - "Whois", - "AsyncWhois", - "WhoisWithRawResponse", - "AsyncWhoisWithRawResponse", - "WhoisWithStreamingResponse", - "AsyncWhoisWithStreamingResponse", - "IndicatorFeeds", - "AsyncIndicatorFeeds", - "IndicatorFeedsWithRawResponse", - "AsyncIndicatorFeedsWithRawResponse", - "IndicatorFeedsWithStreamingResponse", - "AsyncIndicatorFeedsWithStreamingResponse", - "Sinkholes", - "AsyncSinkholes", - "SinkholesWithRawResponse", - "AsyncSinkholesWithRawResponse", - "SinkholesWithStreamingResponse", - "AsyncSinkholesWithStreamingResponse", - "AttackSurfaceReport", - "AsyncAttackSurfaceReport", - "AttackSurfaceReportWithRawResponse", - "AsyncAttackSurfaceReportWithRawResponse", - "AttackSurfaceReportWithStreamingResponse", - "AsyncAttackSurfaceReportWithStreamingResponse", - "Intel", - "AsyncIntel", - "IntelWithRawResponse", - "AsyncIntelWithRawResponse", - "IntelWithStreamingResponse", - "AsyncIntelWithStreamingResponse", + "ASNResource", + "AsyncASNResource", + "ASNResourceWithRawResponse", + "AsyncASNResourceWithRawResponse", + "ASNResourceWithStreamingResponse", + "AsyncASNResourceWithStreamingResponse", + "DNSResource", + "AsyncDNSResource", + "DNSResourceWithRawResponse", + "AsyncDNSResourceWithRawResponse", + "DNSResourceWithStreamingResponse", + "AsyncDNSResourceWithStreamingResponse", + "DomainsResource", + "AsyncDomainsResource", + "DomainsResourceWithRawResponse", + "AsyncDomainsResourceWithRawResponse", + "DomainsResourceWithStreamingResponse", + "AsyncDomainsResourceWithStreamingResponse", + "DomainHistoryResource", + "AsyncDomainHistoryResource", + "DomainHistoryResourceWithRawResponse", + "AsyncDomainHistoryResourceWithRawResponse", + "DomainHistoryResourceWithStreamingResponse", + "AsyncDomainHistoryResourceWithStreamingResponse", + "IPsResource", + "AsyncIPsResource", + "IPsResourceWithRawResponse", + "AsyncIPsResourceWithRawResponse", + "IPsResourceWithStreamingResponse", + "AsyncIPsResourceWithStreamingResponse", + "IPListsResource", + "AsyncIPListsResource", + "IPListsResourceWithRawResponse", + "AsyncIPListsResourceWithRawResponse", + "IPListsResourceWithStreamingResponse", + "AsyncIPListsResourceWithStreamingResponse", + "MiscategorizationsResource", + "AsyncMiscategorizationsResource", + "MiscategorizationsResourceWithRawResponse", + "AsyncMiscategorizationsResourceWithRawResponse", + "MiscategorizationsResourceWithStreamingResponse", + "AsyncMiscategorizationsResourceWithStreamingResponse", + "WhoisResource", + "AsyncWhoisResource", + "WhoisResourceWithRawResponse", + "AsyncWhoisResourceWithRawResponse", + "WhoisResourceWithStreamingResponse", + "AsyncWhoisResourceWithStreamingResponse", + "IndicatorFeedsResource", + "AsyncIndicatorFeedsResource", + "IndicatorFeedsResourceWithRawResponse", + "AsyncIndicatorFeedsResourceWithRawResponse", + "IndicatorFeedsResourceWithStreamingResponse", + "AsyncIndicatorFeedsResourceWithStreamingResponse", + "SinkholesResource", + "AsyncSinkholesResource", + "SinkholesResourceWithRawResponse", + "AsyncSinkholesResourceWithRawResponse", + "SinkholesResourceWithStreamingResponse", + "AsyncSinkholesResourceWithStreamingResponse", + "AttackSurfaceReportResource", + "AsyncAttackSurfaceReportResource", + "AttackSurfaceReportResourceWithRawResponse", + "AsyncAttackSurfaceReportResourceWithRawResponse", + "AttackSurfaceReportResourceWithStreamingResponse", + "AsyncAttackSurfaceReportResourceWithStreamingResponse", + "IntelResource", + "AsyncIntelResource", + "IntelResourceWithRawResponse", + "AsyncIntelResourceWithRawResponse", + "IntelResourceWithStreamingResponse", + "AsyncIntelResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/intel/asn/__init__.py b/src/cloudflare/resources/intel/asn/__init__.py index 3992bce51a8..9136f2a9e64 100644 --- a/src/cloudflare/resources/intel/asn/__init__.py +++ b/src/cloudflare/resources/intel/asn/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .asn import ( - ASN, - AsyncASN, - ASNWithRawResponse, - AsyncASNWithRawResponse, - ASNWithStreamingResponse, - AsyncASNWithStreamingResponse, + ASNResource, + AsyncASNResource, + ASNResourceWithRawResponse, + AsyncASNResourceWithRawResponse, + ASNResourceWithStreamingResponse, + AsyncASNResourceWithStreamingResponse, ) from .subnets import ( - Subnets, - AsyncSubnets, - SubnetsWithRawResponse, - AsyncSubnetsWithRawResponse, - SubnetsWithStreamingResponse, - AsyncSubnetsWithStreamingResponse, + SubnetsResource, + AsyncSubnetsResource, + SubnetsResourceWithRawResponse, + AsyncSubnetsResourceWithRawResponse, + SubnetsResourceWithStreamingResponse, + AsyncSubnetsResourceWithStreamingResponse, ) __all__ = [ - "Subnets", - "AsyncSubnets", - "SubnetsWithRawResponse", - "AsyncSubnetsWithRawResponse", - "SubnetsWithStreamingResponse", - "AsyncSubnetsWithStreamingResponse", - "ASN", - "AsyncASN", - "ASNWithRawResponse", - "AsyncASNWithRawResponse", - "ASNWithStreamingResponse", - "AsyncASNWithStreamingResponse", + "SubnetsResource", + "AsyncSubnetsResource", + "SubnetsResourceWithRawResponse", + "AsyncSubnetsResourceWithRawResponse", + "SubnetsResourceWithStreamingResponse", + "AsyncSubnetsResourceWithStreamingResponse", + "ASNResource", + "AsyncASNResource", + "ASNResourceWithRawResponse", + "AsyncASNResourceWithRawResponse", + "ASNResourceWithStreamingResponse", + "AsyncASNResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/intel/asn/asn.py b/src/cloudflare/resources/intel/asn/asn.py index f3687f935e4..2c721f038ed 100644 --- a/src/cloudflare/resources/intel/asn/asn.py +++ b/src/cloudflare/resources/intel/asn/asn.py @@ -7,12 +7,12 @@ import httpx from .subnets import ( - Subnets, - AsyncSubnets, - SubnetsWithRawResponse, - AsyncSubnetsWithRawResponse, - SubnetsWithStreamingResponse, - AsyncSubnetsWithStreamingResponse, + SubnetsResource, + AsyncSubnetsResource, + SubnetsResourceWithRawResponse, + AsyncSubnetsResourceWithRawResponse, + SubnetsResourceWithStreamingResponse, + AsyncSubnetsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._compat import cached_property @@ -24,30 +24,30 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.intel import IntelASN from ...._base_client import ( make_request_options, ) +from ....types.shared.asn import ASN -__all__ = ["ASN", "AsyncASN"] +__all__ = ["ASNResource", "AsyncASNResource"] -class ASN(SyncAPIResource): +class ASNResource(SyncAPIResource): @cached_property - def subnets(self) -> Subnets: - return Subnets(self._client) + def subnets(self) -> SubnetsResource: + return SubnetsResource(self._client) @cached_property - def with_raw_response(self) -> ASNWithRawResponse: - return ASNWithRawResponse(self) + def with_raw_response(self) -> ASNResourceWithRawResponse: + return ASNResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ASNWithStreamingResponse: - return ASNWithStreamingResponse(self) + def with_streaming_response(self) -> ASNResourceWithStreamingResponse: + return ASNResourceWithStreamingResponse(self) def get( self, - asn: IntelASN, + asn: ASN, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -56,7 +56,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelASN: + ) -> ASN: """ Get ASN Overview @@ -80,28 +80,28 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASN]._unwrapper, ), - cast_to=cast(Type[IntelASN], ResultWrapper[int]), + cast_to=cast(Type[ASN], ResultWrapper[int]), ) -class AsyncASN(AsyncAPIResource): +class AsyncASNResource(AsyncAPIResource): @cached_property - def subnets(self) -> AsyncSubnets: - return AsyncSubnets(self._client) + def subnets(self) -> AsyncSubnetsResource: + return AsyncSubnetsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncASNWithRawResponse: - return AsyncASNWithRawResponse(self) + def with_raw_response(self) -> AsyncASNResourceWithRawResponse: + return AsyncASNResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncASNWithStreamingResponse: - return AsyncASNWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncASNResourceWithStreamingResponse: + return AsyncASNResourceWithStreamingResponse(self) async def get( self, - asn: IntelASN, + asn: ASN, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -110,7 +110,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelASN: + ) -> ASN: """ Get ASN Overview @@ -134,14 +134,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASN]._unwrapper, ), - cast_to=cast(Type[IntelASN], ResultWrapper[int]), + cast_to=cast(Type[ASN], ResultWrapper[int]), ) -class ASNWithRawResponse: - def __init__(self, asn: ASN) -> None: +class ASNResourceWithRawResponse: + def __init__(self, asn: ASNResource) -> None: self._asn = asn self.get = to_raw_response_wrapper( @@ -149,12 +149,12 @@ def __init__(self, asn: ASN) -> None: ) @cached_property - def subnets(self) -> SubnetsWithRawResponse: - return SubnetsWithRawResponse(self._asn.subnets) + def subnets(self) -> SubnetsResourceWithRawResponse: + return SubnetsResourceWithRawResponse(self._asn.subnets) -class AsyncASNWithRawResponse: - def __init__(self, asn: AsyncASN) -> None: +class AsyncASNResourceWithRawResponse: + def __init__(self, asn: AsyncASNResource) -> None: self._asn = asn self.get = async_to_raw_response_wrapper( @@ -162,12 +162,12 @@ def __init__(self, asn: AsyncASN) -> None: ) @cached_property - def subnets(self) -> AsyncSubnetsWithRawResponse: - return AsyncSubnetsWithRawResponse(self._asn.subnets) + def subnets(self) -> AsyncSubnetsResourceWithRawResponse: + return AsyncSubnetsResourceWithRawResponse(self._asn.subnets) -class ASNWithStreamingResponse: - def __init__(self, asn: ASN) -> None: +class ASNResourceWithStreamingResponse: + def __init__(self, asn: ASNResource) -> None: self._asn = asn self.get = to_streamed_response_wrapper( @@ -175,12 +175,12 @@ def __init__(self, asn: ASN) -> None: ) @cached_property - def subnets(self) -> SubnetsWithStreamingResponse: - return SubnetsWithStreamingResponse(self._asn.subnets) + def subnets(self) -> SubnetsResourceWithStreamingResponse: + return SubnetsResourceWithStreamingResponse(self._asn.subnets) -class AsyncASNWithStreamingResponse: - def __init__(self, asn: AsyncASN) -> None: +class AsyncASNResourceWithStreamingResponse: + def __init__(self, asn: AsyncASNResource) -> None: self._asn = asn self.get = async_to_streamed_response_wrapper( @@ -188,5 +188,5 @@ def __init__(self, asn: AsyncASN) -> None: ) @cached_property - def subnets(self) -> AsyncSubnetsWithStreamingResponse: - return AsyncSubnetsWithStreamingResponse(self._asn.subnets) + def subnets(self) -> AsyncSubnetsResourceWithStreamingResponse: + return AsyncSubnetsResourceWithStreamingResponse(self._asn.subnets) diff --git a/src/cloudflare/resources/intel/asn/subnets.py b/src/cloudflare/resources/intel/asn/subnets.py index 6e47fc5da93..20fc57dcf63 100644 --- a/src/cloudflare/resources/intel/asn/subnets.py +++ b/src/cloudflare/resources/intel/asn/subnets.py @@ -13,27 +13,27 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....types.intel import IntelASN from ...._base_client import ( make_request_options, ) -from ....types.intel.asn import SubnetGetResponse +from ....types.shared.asn import ASN +from ....types.intel.asn.subnet_get_response import SubnetGetResponse -__all__ = ["Subnets", "AsyncSubnets"] +__all__ = ["SubnetsResource", "AsyncSubnetsResource"] -class Subnets(SyncAPIResource): +class SubnetsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SubnetsWithRawResponse: - return SubnetsWithRawResponse(self) + def with_raw_response(self) -> SubnetsResourceWithRawResponse: + return SubnetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SubnetsWithStreamingResponse: - return SubnetsWithStreamingResponse(self) + def with_streaming_response(self) -> SubnetsResourceWithStreamingResponse: + return SubnetsResourceWithStreamingResponse(self) def get( self, - asn: IntelASN, + asn: ASN, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -68,18 +68,18 @@ def get( ) -class AsyncSubnets(AsyncAPIResource): +class AsyncSubnetsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSubnetsWithRawResponse: - return AsyncSubnetsWithRawResponse(self) + def with_raw_response(self) -> AsyncSubnetsResourceWithRawResponse: + return AsyncSubnetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSubnetsWithStreamingResponse: - return AsyncSubnetsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSubnetsResourceWithStreamingResponse: + return AsyncSubnetsResourceWithStreamingResponse(self) async def get( self, - asn: IntelASN, + asn: ASN, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -114,8 +114,8 @@ async def get( ) -class SubnetsWithRawResponse: - def __init__(self, subnets: Subnets) -> None: +class SubnetsResourceWithRawResponse: + def __init__(self, subnets: SubnetsResource) -> None: self._subnets = subnets self.get = to_raw_response_wrapper( @@ -123,8 +123,8 @@ def __init__(self, subnets: Subnets) -> None: ) -class AsyncSubnetsWithRawResponse: - def __init__(self, subnets: AsyncSubnets) -> None: +class AsyncSubnetsResourceWithRawResponse: + def __init__(self, subnets: AsyncSubnetsResource) -> None: self._subnets = subnets self.get = async_to_raw_response_wrapper( @@ -132,8 +132,8 @@ def __init__(self, subnets: AsyncSubnets) -> None: ) -class SubnetsWithStreamingResponse: - def __init__(self, subnets: Subnets) -> None: +class SubnetsResourceWithStreamingResponse: + def __init__(self, subnets: SubnetsResource) -> None: self._subnets = subnets self.get = to_streamed_response_wrapper( @@ -141,8 +141,8 @@ def __init__(self, subnets: Subnets) -> None: ) -class AsyncSubnetsWithStreamingResponse: - def __init__(self, subnets: AsyncSubnets) -> None: +class AsyncSubnetsResourceWithStreamingResponse: + def __init__(self, subnets: AsyncSubnetsResource) -> None: self._subnets = subnets self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/attack_surface_report/__init__.py b/src/cloudflare/resources/intel/attack_surface_report/__init__.py index 8591604d6f0..2ea1be53563 100644 --- a/src/cloudflare/resources/intel/attack_surface_report/__init__.py +++ b/src/cloudflare/resources/intel/attack_surface_report/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .issues import ( - Issues, - AsyncIssues, - IssuesWithRawResponse, - AsyncIssuesWithRawResponse, - IssuesWithStreamingResponse, - AsyncIssuesWithStreamingResponse, + IssuesResource, + AsyncIssuesResource, + IssuesResourceWithRawResponse, + AsyncIssuesResourceWithRawResponse, + IssuesResourceWithStreamingResponse, + AsyncIssuesResourceWithStreamingResponse, ) from .issue_types import ( - IssueTypes, - AsyncIssueTypes, - IssueTypesWithRawResponse, - AsyncIssueTypesWithRawResponse, - IssueTypesWithStreamingResponse, - AsyncIssueTypesWithStreamingResponse, + IssueTypesResource, + AsyncIssueTypesResource, + IssueTypesResourceWithRawResponse, + AsyncIssueTypesResourceWithRawResponse, + IssueTypesResourceWithStreamingResponse, + AsyncIssueTypesResourceWithStreamingResponse, ) from .attack_surface_report import ( - AttackSurfaceReport, - AsyncAttackSurfaceReport, - AttackSurfaceReportWithRawResponse, - AsyncAttackSurfaceReportWithRawResponse, - AttackSurfaceReportWithStreamingResponse, - AsyncAttackSurfaceReportWithStreamingResponse, + AttackSurfaceReportResource, + AsyncAttackSurfaceReportResource, + AttackSurfaceReportResourceWithRawResponse, + AsyncAttackSurfaceReportResourceWithRawResponse, + AttackSurfaceReportResourceWithStreamingResponse, + AsyncAttackSurfaceReportResourceWithStreamingResponse, ) __all__ = [ - "IssueTypes", - "AsyncIssueTypes", - "IssueTypesWithRawResponse", - "AsyncIssueTypesWithRawResponse", - "IssueTypesWithStreamingResponse", - "AsyncIssueTypesWithStreamingResponse", - "Issues", - "AsyncIssues", - "IssuesWithRawResponse", - "AsyncIssuesWithRawResponse", - "IssuesWithStreamingResponse", - "AsyncIssuesWithStreamingResponse", - "AttackSurfaceReport", - "AsyncAttackSurfaceReport", - "AttackSurfaceReportWithRawResponse", - "AsyncAttackSurfaceReportWithRawResponse", - "AttackSurfaceReportWithStreamingResponse", - "AsyncAttackSurfaceReportWithStreamingResponse", + "IssueTypesResource", + "AsyncIssueTypesResource", + "IssueTypesResourceWithRawResponse", + "AsyncIssueTypesResourceWithRawResponse", + "IssueTypesResourceWithStreamingResponse", + "AsyncIssueTypesResourceWithStreamingResponse", + "IssuesResource", + "AsyncIssuesResource", + "IssuesResourceWithRawResponse", + "AsyncIssuesResourceWithRawResponse", + "IssuesResourceWithStreamingResponse", + "AsyncIssuesResourceWithStreamingResponse", + "AttackSurfaceReportResource", + "AsyncAttackSurfaceReportResource", + "AttackSurfaceReportResourceWithRawResponse", + "AsyncAttackSurfaceReportResourceWithRawResponse", + "AttackSurfaceReportResourceWithStreamingResponse", + "AsyncAttackSurfaceReportResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/intel/attack_surface_report/attack_surface_report.py b/src/cloudflare/resources/intel/attack_surface_report/attack_surface_report.py index b2eb4d0b843..0cb2fabd7b1 100644 --- a/src/cloudflare/resources/intel/attack_surface_report/attack_surface_report.py +++ b/src/cloudflare/resources/intel/attack_surface_report/attack_surface_report.py @@ -3,110 +3,110 @@ from __future__ import annotations from .issues import ( - Issues, - AsyncIssues, - IssuesWithRawResponse, - AsyncIssuesWithRawResponse, - IssuesWithStreamingResponse, - AsyncIssuesWithStreamingResponse, + IssuesResource, + AsyncIssuesResource, + IssuesResourceWithRawResponse, + AsyncIssuesResourceWithRawResponse, + IssuesResourceWithStreamingResponse, + AsyncIssuesResourceWithStreamingResponse, ) from ...._compat import cached_property from .issue_types import ( - IssueTypes, - AsyncIssueTypes, - IssueTypesWithRawResponse, - AsyncIssueTypesWithRawResponse, - IssueTypesWithStreamingResponse, - AsyncIssueTypesWithStreamingResponse, + IssueTypesResource, + AsyncIssueTypesResource, + IssueTypesResourceWithRawResponse, + AsyncIssueTypesResourceWithRawResponse, + IssueTypesResourceWithStreamingResponse, + AsyncIssueTypesResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["AttackSurfaceReport", "AsyncAttackSurfaceReport"] +__all__ = ["AttackSurfaceReportResource", "AsyncAttackSurfaceReportResource"] -class AttackSurfaceReport(SyncAPIResource): +class AttackSurfaceReportResource(SyncAPIResource): @cached_property - def issue_types(self) -> IssueTypes: - return IssueTypes(self._client) + def issue_types(self) -> IssueTypesResource: + return IssueTypesResource(self._client) @cached_property - def issues(self) -> Issues: - return Issues(self._client) + def issues(self) -> IssuesResource: + return IssuesResource(self._client) @cached_property - def with_raw_response(self) -> AttackSurfaceReportWithRawResponse: - return AttackSurfaceReportWithRawResponse(self) + def with_raw_response(self) -> AttackSurfaceReportResourceWithRawResponse: + return AttackSurfaceReportResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AttackSurfaceReportWithStreamingResponse: - return AttackSurfaceReportWithStreamingResponse(self) + def with_streaming_response(self) -> AttackSurfaceReportResourceWithStreamingResponse: + return AttackSurfaceReportResourceWithStreamingResponse(self) -class AsyncAttackSurfaceReport(AsyncAPIResource): +class AsyncAttackSurfaceReportResource(AsyncAPIResource): @cached_property - def issue_types(self) -> AsyncIssueTypes: - return AsyncIssueTypes(self._client) + def issue_types(self) -> AsyncIssueTypesResource: + return AsyncIssueTypesResource(self._client) @cached_property - def issues(self) -> AsyncIssues: - return AsyncIssues(self._client) + def issues(self) -> AsyncIssuesResource: + return AsyncIssuesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAttackSurfaceReportWithRawResponse: - return AsyncAttackSurfaceReportWithRawResponse(self) + def with_raw_response(self) -> AsyncAttackSurfaceReportResourceWithRawResponse: + return AsyncAttackSurfaceReportResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAttackSurfaceReportWithStreamingResponse: - return AsyncAttackSurfaceReportWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAttackSurfaceReportResourceWithStreamingResponse: + return AsyncAttackSurfaceReportResourceWithStreamingResponse(self) -class AttackSurfaceReportWithRawResponse: - def __init__(self, attack_surface_report: AttackSurfaceReport) -> None: +class AttackSurfaceReportResourceWithRawResponse: + def __init__(self, attack_surface_report: AttackSurfaceReportResource) -> None: self._attack_surface_report = attack_surface_report @cached_property - def issue_types(self) -> IssueTypesWithRawResponse: - return IssueTypesWithRawResponse(self._attack_surface_report.issue_types) + def issue_types(self) -> IssueTypesResourceWithRawResponse: + return IssueTypesResourceWithRawResponse(self._attack_surface_report.issue_types) @cached_property - def issues(self) -> IssuesWithRawResponse: - return IssuesWithRawResponse(self._attack_surface_report.issues) + def issues(self) -> IssuesResourceWithRawResponse: + return IssuesResourceWithRawResponse(self._attack_surface_report.issues) -class AsyncAttackSurfaceReportWithRawResponse: - def __init__(self, attack_surface_report: AsyncAttackSurfaceReport) -> None: +class AsyncAttackSurfaceReportResourceWithRawResponse: + def __init__(self, attack_surface_report: AsyncAttackSurfaceReportResource) -> None: self._attack_surface_report = attack_surface_report @cached_property - def issue_types(self) -> AsyncIssueTypesWithRawResponse: - return AsyncIssueTypesWithRawResponse(self._attack_surface_report.issue_types) + def issue_types(self) -> AsyncIssueTypesResourceWithRawResponse: + return AsyncIssueTypesResourceWithRawResponse(self._attack_surface_report.issue_types) @cached_property - def issues(self) -> AsyncIssuesWithRawResponse: - return AsyncIssuesWithRawResponse(self._attack_surface_report.issues) + def issues(self) -> AsyncIssuesResourceWithRawResponse: + return AsyncIssuesResourceWithRawResponse(self._attack_surface_report.issues) -class AttackSurfaceReportWithStreamingResponse: - def __init__(self, attack_surface_report: AttackSurfaceReport) -> None: +class AttackSurfaceReportResourceWithStreamingResponse: + def __init__(self, attack_surface_report: AttackSurfaceReportResource) -> None: self._attack_surface_report = attack_surface_report @cached_property - def issue_types(self) -> IssueTypesWithStreamingResponse: - return IssueTypesWithStreamingResponse(self._attack_surface_report.issue_types) + def issue_types(self) -> IssueTypesResourceWithStreamingResponse: + return IssueTypesResourceWithStreamingResponse(self._attack_surface_report.issue_types) @cached_property - def issues(self) -> IssuesWithStreamingResponse: - return IssuesWithStreamingResponse(self._attack_surface_report.issues) + def issues(self) -> IssuesResourceWithStreamingResponse: + return IssuesResourceWithStreamingResponse(self._attack_surface_report.issues) -class AsyncAttackSurfaceReportWithStreamingResponse: - def __init__(self, attack_surface_report: AsyncAttackSurfaceReport) -> None: +class AsyncAttackSurfaceReportResourceWithStreamingResponse: + def __init__(self, attack_surface_report: AsyncAttackSurfaceReportResource) -> None: self._attack_surface_report = attack_surface_report @cached_property - def issue_types(self) -> AsyncIssueTypesWithStreamingResponse: - return AsyncIssueTypesWithStreamingResponse(self._attack_surface_report.issue_types) + def issue_types(self) -> AsyncIssueTypesResourceWithStreamingResponse: + return AsyncIssueTypesResourceWithStreamingResponse(self._attack_surface_report.issue_types) @cached_property - def issues(self) -> AsyncIssuesWithStreamingResponse: - return AsyncIssuesWithStreamingResponse(self._attack_surface_report.issues) + def issues(self) -> AsyncIssuesResourceWithStreamingResponse: + return AsyncIssuesResourceWithStreamingResponse(self._attack_surface_report.issues) diff --git a/src/cloudflare/resources/intel/attack_surface_report/issue_types.py b/src/cloudflare/resources/intel/attack_surface_report/issue_types.py index 05ff0d8ff5f..327ad759c0c 100644 --- a/src/cloudflare/resources/intel/attack_surface_report/issue_types.py +++ b/src/cloudflare/resources/intel/attack_surface_report/issue_types.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.intel.attack_surface_report import IssueTypeGetResponse +from ....types.intel.attack_surface_report.issue_type_get_response import IssueTypeGetResponse -__all__ = ["IssueTypes", "AsyncIssueTypes"] +__all__ = ["IssueTypesResource", "AsyncIssueTypesResource"] -class IssueTypes(SyncAPIResource): +class IssueTypesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IssueTypesWithRawResponse: - return IssueTypesWithRawResponse(self) + def with_raw_response(self) -> IssueTypesResourceWithRawResponse: + return IssueTypesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IssueTypesWithStreamingResponse: - return IssueTypesWithStreamingResponse(self) + def with_streaming_response(self) -> IssueTypesResourceWithStreamingResponse: + return IssueTypesResourceWithStreamingResponse(self) def get( self, @@ -67,20 +67,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueTypeGetResponse]._unwrapper, ), cast_to=cast(Type[IssueTypeGetResponse], ResultWrapper[IssueTypeGetResponse]), ) -class AsyncIssueTypes(AsyncAPIResource): +class AsyncIssueTypesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIssueTypesWithRawResponse: - return AsyncIssueTypesWithRawResponse(self) + def with_raw_response(self) -> AsyncIssueTypesResourceWithRawResponse: + return AsyncIssueTypesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIssueTypesWithStreamingResponse: - return AsyncIssueTypesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIssueTypesResourceWithStreamingResponse: + return AsyncIssueTypesResourceWithStreamingResponse(self) async def get( self, @@ -116,14 +116,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueTypeGetResponse]._unwrapper, ), cast_to=cast(Type[IssueTypeGetResponse], ResultWrapper[IssueTypeGetResponse]), ) -class IssueTypesWithRawResponse: - def __init__(self, issue_types: IssueTypes) -> None: +class IssueTypesResourceWithRawResponse: + def __init__(self, issue_types: IssueTypesResource) -> None: self._issue_types = issue_types self.get = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, issue_types: IssueTypes) -> None: ) -class AsyncIssueTypesWithRawResponse: - def __init__(self, issue_types: AsyncIssueTypes) -> None: +class AsyncIssueTypesResourceWithRawResponse: + def __init__(self, issue_types: AsyncIssueTypesResource) -> None: self._issue_types = issue_types self.get = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, issue_types: AsyncIssueTypes) -> None: ) -class IssueTypesWithStreamingResponse: - def __init__(self, issue_types: IssueTypes) -> None: +class IssueTypesResourceWithStreamingResponse: + def __init__(self, issue_types: IssueTypesResource) -> None: self._issue_types = issue_types self.get = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, issue_types: IssueTypes) -> None: ) -class AsyncIssueTypesWithStreamingResponse: - def __init__(self, issue_types: AsyncIssueTypes) -> None: +class AsyncIssueTypesResourceWithStreamingResponse: + def __init__(self, issue_types: AsyncIssueTypesResource) -> None: self._issue_types = issue_types self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/attack_surface_report/issues.py b/src/cloudflare/resources/intel/attack_surface_report/issues.py index 4ce6fc5a93f..357a1f48030 100644 --- a/src/cloudflare/resources/intel/attack_surface_report/issues.py +++ b/src/cloudflare/resources/intel/attack_surface_report/issues.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import Any, List, Type, cast -from typing_extensions import Literal import httpx @@ -27,65 +26,52 @@ make_request_options, ) from ....types.intel.attack_surface_report import ( - IssueListResponse, - IssueTypeResponse, - IssueClassResponse, - IssueDismissResponse, - IssueSeverityResponse, issue_list_params, issue_type_params, issue_class_params, issue_dismiss_params, issue_severity_params, ) +from ....types.intel.attack_surface_report.issue_type import IssueType +from ....types.intel.attack_surface_report.product_param import ProductParam +from ....types.intel.attack_surface_report.subject_param import SubjectParam +from ....types.intel.attack_surface_report.issue_class_param import IssueClassParam +from ....types.intel.attack_surface_report.issue_list_response import IssueListResponse +from ....types.intel.attack_surface_report.issue_type_response import IssueTypeResponse +from ....types.intel.attack_surface_report.issue_class_response import IssueClassResponse +from ....types.intel.attack_surface_report.severity_query_param import SeverityQueryParam +from ....types.intel.attack_surface_report.issue_dismiss_response import IssueDismissResponse +from ....types.intel.attack_surface_report.issue_severity_response import IssueSeverityResponse -__all__ = ["Issues", "AsyncIssues"] +__all__ = ["IssuesResource", "AsyncIssuesResource"] -class Issues(SyncAPIResource): +class IssuesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IssuesWithRawResponse: - return IssuesWithRawResponse(self) + def with_raw_response(self) -> IssuesResourceWithRawResponse: + return IssuesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IssuesWithStreamingResponse: - return IssuesWithStreamingResponse(self) + def with_streaming_response(self) -> IssuesResourceWithStreamingResponse: + return IssuesResourceWithStreamingResponse(self) def list( self, *, account_id: str, dismissed: bool | NotGiven = NOT_GIVEN, - issue_class: List[str] | NotGiven = NOT_GIVEN, - issue_class_neq: List[str] | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_class: IssueClassParam | NotGiven = NOT_GIVEN, + issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, - product: List[str] | NotGiven = NOT_GIVEN, - product_neq: List[str] | NotGiven = NOT_GIVEN, - severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - subject: List[str] | NotGiven = NOT_GIVEN, - subject_neq: List[str] | NotGiven = NOT_GIVEN, + product: ProductParam | NotGiven = NOT_GIVEN, + product_neq: ProductParam | NotGiven = NOT_GIVEN, + severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + severity_neq: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + subject: SubjectParam | NotGiven = NOT_GIVEN, + subject_neq: SubjectParam | 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, @@ -148,34 +134,16 @@ def class_( *, account_id: str, dismissed: bool | NotGiven = NOT_GIVEN, - issue_class: List[str] | NotGiven = NOT_GIVEN, - issue_class_neq: List[str] | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - product: List[str] | NotGiven = NOT_GIVEN, - product_neq: List[str] | NotGiven = NOT_GIVEN, - severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - subject: List[str] | NotGiven = NOT_GIVEN, - subject_neq: List[str] | NotGiven = NOT_GIVEN, + issue_class: IssueClassParam | NotGiven = NOT_GIVEN, + issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, + product: ProductParam | NotGiven = NOT_GIVEN, + product_neq: ProductParam | NotGiven = NOT_GIVEN, + severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + severity_neq: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + subject: SubjectParam | NotGiven = NOT_GIVEN, + subject_neq: SubjectParam | 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, @@ -222,7 +190,7 @@ def class_( }, issue_class_params.IssueClassParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueClassResponse]._unwrapper, ), cast_to=cast(Type[IssueClassResponse], ResultWrapper[IssueClassResponse]), ) @@ -268,7 +236,7 @@ def dismiss( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueDismissResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IssueDismissResponse] @@ -281,34 +249,16 @@ def severity( *, account_id: str, dismissed: bool | NotGiven = NOT_GIVEN, - issue_class: List[str] | NotGiven = NOT_GIVEN, - issue_class_neq: List[str] | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - product: List[str] | NotGiven = NOT_GIVEN, - product_neq: List[str] | NotGiven = NOT_GIVEN, - severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - subject: List[str] | NotGiven = NOT_GIVEN, - subject_neq: List[str] | NotGiven = NOT_GIVEN, + issue_class: IssueClassParam | NotGiven = NOT_GIVEN, + issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, + product: ProductParam | NotGiven = NOT_GIVEN, + product_neq: ProductParam | NotGiven = NOT_GIVEN, + severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + severity_neq: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + subject: SubjectParam | NotGiven = NOT_GIVEN, + subject_neq: SubjectParam | 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, @@ -355,7 +305,7 @@ def severity( }, issue_severity_params.IssueSeverityParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueSeverityResponse]._unwrapper, ), cast_to=cast(Type[IssueSeverityResponse], ResultWrapper[IssueSeverityResponse]), ) @@ -365,34 +315,16 @@ def type( *, account_id: str, dismissed: bool | NotGiven = NOT_GIVEN, - issue_class: List[str] | NotGiven = NOT_GIVEN, - issue_class_neq: List[str] | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - product: List[str] | NotGiven = NOT_GIVEN, - product_neq: List[str] | NotGiven = NOT_GIVEN, - severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - subject: List[str] | NotGiven = NOT_GIVEN, - subject_neq: List[str] | NotGiven = NOT_GIVEN, + issue_class: IssueClassParam | NotGiven = NOT_GIVEN, + issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, + product: ProductParam | NotGiven = NOT_GIVEN, + product_neq: ProductParam | NotGiven = NOT_GIVEN, + severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + severity_neq: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + subject: SubjectParam | NotGiven = NOT_GIVEN, + subject_neq: SubjectParam | 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, @@ -439,56 +371,38 @@ def type( }, issue_type_params.IssueTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueTypeResponse]._unwrapper, ), cast_to=cast(Type[IssueTypeResponse], ResultWrapper[IssueTypeResponse]), ) -class AsyncIssues(AsyncAPIResource): +class AsyncIssuesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIssuesWithRawResponse: - return AsyncIssuesWithRawResponse(self) + def with_raw_response(self) -> AsyncIssuesResourceWithRawResponse: + return AsyncIssuesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIssuesWithStreamingResponse: - return AsyncIssuesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIssuesResourceWithStreamingResponse: + return AsyncIssuesResourceWithStreamingResponse(self) def list( self, *, account_id: str, dismissed: bool | NotGiven = NOT_GIVEN, - issue_class: List[str] | NotGiven = NOT_GIVEN, - issue_class_neq: List[str] | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_class: IssueClassParam | NotGiven = NOT_GIVEN, + issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, - product: List[str] | NotGiven = NOT_GIVEN, - product_neq: List[str] | NotGiven = NOT_GIVEN, - severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - subject: List[str] | NotGiven = NOT_GIVEN, - subject_neq: List[str] | NotGiven = NOT_GIVEN, + product: ProductParam | NotGiven = NOT_GIVEN, + product_neq: ProductParam | NotGiven = NOT_GIVEN, + severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + severity_neq: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + subject: SubjectParam | NotGiven = NOT_GIVEN, + subject_neq: SubjectParam | 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, @@ -551,34 +465,16 @@ async def class_( *, account_id: str, dismissed: bool | NotGiven = NOT_GIVEN, - issue_class: List[str] | NotGiven = NOT_GIVEN, - issue_class_neq: List[str] | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - product: List[str] | NotGiven = NOT_GIVEN, - product_neq: List[str] | NotGiven = NOT_GIVEN, - severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - subject: List[str] | NotGiven = NOT_GIVEN, - subject_neq: List[str] | NotGiven = NOT_GIVEN, + issue_class: IssueClassParam | NotGiven = NOT_GIVEN, + issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, + product: ProductParam | NotGiven = NOT_GIVEN, + product_neq: ProductParam | NotGiven = NOT_GIVEN, + severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + severity_neq: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + subject: SubjectParam | NotGiven = NOT_GIVEN, + subject_neq: SubjectParam | 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, @@ -625,7 +521,7 @@ async def class_( }, issue_class_params.IssueClassParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueClassResponse]._unwrapper, ), cast_to=cast(Type[IssueClassResponse], ResultWrapper[IssueClassResponse]), ) @@ -671,7 +567,7 @@ async def dismiss( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueDismissResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IssueDismissResponse] @@ -684,34 +580,16 @@ async def severity( *, account_id: str, dismissed: bool | NotGiven = NOT_GIVEN, - issue_class: List[str] | NotGiven = NOT_GIVEN, - issue_class_neq: List[str] | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - product: List[str] | NotGiven = NOT_GIVEN, - product_neq: List[str] | NotGiven = NOT_GIVEN, - severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - subject: List[str] | NotGiven = NOT_GIVEN, - subject_neq: List[str] | NotGiven = NOT_GIVEN, + issue_class: IssueClassParam | NotGiven = NOT_GIVEN, + issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, + product: ProductParam | NotGiven = NOT_GIVEN, + product_neq: ProductParam | NotGiven = NOT_GIVEN, + severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + severity_neq: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + subject: SubjectParam | NotGiven = NOT_GIVEN, + subject_neq: SubjectParam | 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, @@ -758,7 +636,7 @@ async def severity( }, issue_severity_params.IssueSeverityParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueSeverityResponse]._unwrapper, ), cast_to=cast(Type[IssueSeverityResponse], ResultWrapper[IssueSeverityResponse]), ) @@ -768,34 +646,16 @@ async def type( *, account_id: str, dismissed: bool | NotGiven = NOT_GIVEN, - issue_class: List[str] | NotGiven = NOT_GIVEN, - issue_class_neq: List[str] | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - product: List[str] | NotGiven = NOT_GIVEN, - product_neq: List[str] | NotGiven = NOT_GIVEN, - severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN, - subject: List[str] | NotGiven = NOT_GIVEN, - subject_neq: List[str] | NotGiven = NOT_GIVEN, + issue_class: IssueClassParam | NotGiven = NOT_GIVEN, + issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, + product: ProductParam | NotGiven = NOT_GIVEN, + product_neq: ProductParam | NotGiven = NOT_GIVEN, + severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + severity_neq: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, + subject: SubjectParam | NotGiven = NOT_GIVEN, + subject_neq: SubjectParam | 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, @@ -842,14 +702,14 @@ async def type( }, issue_type_params.IssueTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IssueTypeResponse]._unwrapper, ), cast_to=cast(Type[IssueTypeResponse], ResultWrapper[IssueTypeResponse]), ) -class IssuesWithRawResponse: - def __init__(self, issues: Issues) -> None: +class IssuesResourceWithRawResponse: + def __init__(self, issues: IssuesResource) -> None: self._issues = issues self.list = to_raw_response_wrapper( @@ -869,8 +729,8 @@ def __init__(self, issues: Issues) -> None: ) -class AsyncIssuesWithRawResponse: - def __init__(self, issues: AsyncIssues) -> None: +class AsyncIssuesResourceWithRawResponse: + def __init__(self, issues: AsyncIssuesResource) -> None: self._issues = issues self.list = async_to_raw_response_wrapper( @@ -890,8 +750,8 @@ def __init__(self, issues: AsyncIssues) -> None: ) -class IssuesWithStreamingResponse: - def __init__(self, issues: Issues) -> None: +class IssuesResourceWithStreamingResponse: + def __init__(self, issues: IssuesResource) -> None: self._issues = issues self.list = to_streamed_response_wrapper( @@ -911,8 +771,8 @@ def __init__(self, issues: Issues) -> None: ) -class AsyncIssuesWithStreamingResponse: - def __init__(self, issues: AsyncIssues) -> None: +class AsyncIssuesResourceWithStreamingResponse: + def __init__(self, issues: AsyncIssuesResource) -> None: self._issues = issues self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/dns.py b/src/cloudflare/resources/intel/dns.py index 4b5effc93f9..7a5835921b8 100644 --- a/src/cloudflare/resources/intel/dns.py +++ b/src/cloudflare/resources/intel/dns.py @@ -2,15 +2,10 @@ from __future__ import annotations -from typing import Type, cast - import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -19,39 +14,41 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper -from ...types.intel import IntelPassiveDNSByIP, dns_get_params +from ...pagination import SyncV4PagePagination, AsyncV4PagePagination +from ...types.intel import dns_list_params from ..._base_client import ( + AsyncPaginator, make_request_options, ) +from ...types.intel.dns_list_response import DNSListResponse -__all__ = ["DNS", "AsyncDNS"] +__all__ = ["DNSResource", "AsyncDNSResource"] -class DNS(SyncAPIResource): +class DNSResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DNSWithRawResponse: - return DNSWithRawResponse(self) + def with_raw_response(self) -> DNSResourceWithRawResponse: + return DNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DNSWithStreamingResponse: - return DNSWithStreamingResponse(self) + def with_streaming_response(self) -> DNSResourceWithStreamingResponse: + return DNSResourceWithStreamingResponse(self) - def get( + def list( self, *, account_id: str, ipv4: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, - start_end_params: dns_get_params.StartEndParams | NotGiven = NOT_GIVEN, + start_end_params: dns_list_params.StartEndParams | 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, - ) -> IntelPassiveDNSByIP: + ) -> SyncV4PagePagination[DNSListResponse]: """ Get Passive DNS by IP @@ -72,8 +69,9 @@ 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( + return self._get_api_list( f"/accounts/{account_id}/intel/dns", + page=SyncV4PagePagination[DNSListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -86,38 +84,37 @@ def get( "per_page": per_page, "start_end_params": start_end_params, }, - dns_get_params.DNSGetParams, + dns_list_params.DNSListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[IntelPassiveDNSByIP], ResultWrapper[IntelPassiveDNSByIP]), + model=DNSListResponse, ) -class AsyncDNS(AsyncAPIResource): +class AsyncDNSResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDNSWithRawResponse: - return AsyncDNSWithRawResponse(self) + def with_raw_response(self) -> AsyncDNSResourceWithRawResponse: + return AsyncDNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDNSWithStreamingResponse: - return AsyncDNSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDNSResourceWithStreamingResponse: + return AsyncDNSResourceWithStreamingResponse(self) - async def get( + def list( self, *, account_id: str, ipv4: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, - start_end_params: dns_get_params.StartEndParams | NotGiven = NOT_GIVEN, + start_end_params: dns_list_params.StartEndParams | 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, - ) -> IntelPassiveDNSByIP: + ) -> AsyncPaginator[DNSListResponse, AsyncV4PagePagination[DNSListResponse]]: """ Get Passive DNS by IP @@ -138,59 +135,59 @@ 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( + return self._get_api_list( f"/accounts/{account_id}/intel/dns", + page=AsyncV4PagePagination[DNSListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "ipv4": ipv4, "page": page, "per_page": per_page, "start_end_params": start_end_params, }, - dns_get_params.DNSGetParams, + dns_list_params.DNSListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[IntelPassiveDNSByIP], ResultWrapper[IntelPassiveDNSByIP]), + model=DNSListResponse, ) -class DNSWithRawResponse: - def __init__(self, dns: DNS) -> None: +class DNSResourceWithRawResponse: + def __init__(self, dns: DNSResource) -> None: self._dns = dns - self.get = to_raw_response_wrapper( - dns.get, + self.list = to_raw_response_wrapper( + dns.list, ) -class AsyncDNSWithRawResponse: - def __init__(self, dns: AsyncDNS) -> None: +class AsyncDNSResourceWithRawResponse: + def __init__(self, dns: AsyncDNSResource) -> None: self._dns = dns - self.get = async_to_raw_response_wrapper( - dns.get, + self.list = async_to_raw_response_wrapper( + dns.list, ) -class DNSWithStreamingResponse: - def __init__(self, dns: DNS) -> None: +class DNSResourceWithStreamingResponse: + def __init__(self, dns: DNSResource) -> None: self._dns = dns - self.get = to_streamed_response_wrapper( - dns.get, + self.list = to_streamed_response_wrapper( + dns.list, ) -class AsyncDNSWithStreamingResponse: - def __init__(self, dns: AsyncDNS) -> None: +class AsyncDNSResourceWithStreamingResponse: + def __init__(self, dns: AsyncDNSResource) -> None: self._dns = dns - self.get = async_to_streamed_response_wrapper( - dns.get, + self.list = async_to_streamed_response_wrapper( + dns.list, ) diff --git a/src/cloudflare/resources/intel/domain_history.py b/src/cloudflare/resources/intel/domain_history.py index 25de53aa218..01f977b3b72 100644 --- a/src/cloudflare/resources/intel/domain_history.py +++ b/src/cloudflare/resources/intel/domain_history.py @@ -20,22 +20,23 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.intel import DomainHistoryGetResponse, domain_history_get_params +from ...types.intel import domain_history_get_params from ..._base_client import ( make_request_options, ) +from ...types.intel.domain_history_get_response import DomainHistoryGetResponse -__all__ = ["DomainHistory", "AsyncDomainHistory"] +__all__ = ["DomainHistoryResource", "AsyncDomainHistoryResource"] -class DomainHistory(SyncAPIResource): +class DomainHistoryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DomainHistoryWithRawResponse: - return DomainHistoryWithRawResponse(self) + def with_raw_response(self) -> DomainHistoryResourceWithRawResponse: + return DomainHistoryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DomainHistoryWithStreamingResponse: - return DomainHistoryWithStreamingResponse(self) + def with_streaming_response(self) -> DomainHistoryResourceWithStreamingResponse: + return DomainHistoryResourceWithStreamingResponse(self) def get( self, @@ -73,20 +74,20 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"domain": domain}, domain_history_get_params.DomainHistoryGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainHistoryGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[DomainHistoryGetResponse]], ResultWrapper[DomainHistoryGetResponse]), ) -class AsyncDomainHistory(AsyncAPIResource): +class AsyncDomainHistoryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDomainHistoryWithRawResponse: - return AsyncDomainHistoryWithRawResponse(self) + def with_raw_response(self) -> AsyncDomainHistoryResourceWithRawResponse: + return AsyncDomainHistoryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDomainHistoryWithStreamingResponse: - return AsyncDomainHistoryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDomainHistoryResourceWithStreamingResponse: + return AsyncDomainHistoryResourceWithStreamingResponse(self) async def get( self, @@ -124,14 +125,14 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"domain": domain}, domain_history_get_params.DomainHistoryGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainHistoryGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[DomainHistoryGetResponse]], ResultWrapper[DomainHistoryGetResponse]), ) -class DomainHistoryWithRawResponse: - def __init__(self, domain_history: DomainHistory) -> None: +class DomainHistoryResourceWithRawResponse: + def __init__(self, domain_history: DomainHistoryResource) -> None: self._domain_history = domain_history self.get = to_raw_response_wrapper( @@ -139,8 +140,8 @@ def __init__(self, domain_history: DomainHistory) -> None: ) -class AsyncDomainHistoryWithRawResponse: - def __init__(self, domain_history: AsyncDomainHistory) -> None: +class AsyncDomainHistoryResourceWithRawResponse: + def __init__(self, domain_history: AsyncDomainHistoryResource) -> None: self._domain_history = domain_history self.get = async_to_raw_response_wrapper( @@ -148,8 +149,8 @@ def __init__(self, domain_history: AsyncDomainHistory) -> None: ) -class DomainHistoryWithStreamingResponse: - def __init__(self, domain_history: DomainHistory) -> None: +class DomainHistoryResourceWithStreamingResponse: + def __init__(self, domain_history: DomainHistoryResource) -> None: self._domain_history = domain_history self.get = to_streamed_response_wrapper( @@ -157,8 +158,8 @@ def __init__(self, domain_history: DomainHistory) -> None: ) -class AsyncDomainHistoryWithStreamingResponse: - def __init__(self, domain_history: AsyncDomainHistory) -> None: +class AsyncDomainHistoryResourceWithStreamingResponse: + def __init__(self, domain_history: AsyncDomainHistoryResource) -> None: self._domain_history = domain_history self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/domains/__init__.py b/src/cloudflare/resources/intel/domains/__init__.py index 25312e146b0..41e1931619f 100644 --- a/src/cloudflare/resources/intel/domains/__init__.py +++ b/src/cloudflare/resources/intel/domains/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .bulks import ( - Bulks, - AsyncBulks, - BulksWithRawResponse, - AsyncBulksWithRawResponse, - BulksWithStreamingResponse, - AsyncBulksWithStreamingResponse, + BulksResource, + AsyncBulksResource, + BulksResourceWithRawResponse, + AsyncBulksResourceWithRawResponse, + BulksResourceWithStreamingResponse, + AsyncBulksResourceWithStreamingResponse, ) from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) __all__ = [ - "Bulks", - "AsyncBulks", - "BulksWithRawResponse", - "AsyncBulksWithRawResponse", - "BulksWithStreamingResponse", - "AsyncBulksWithStreamingResponse", - "Domains", - "AsyncDomains", - "DomainsWithRawResponse", - "AsyncDomainsWithRawResponse", - "DomainsWithStreamingResponse", - "AsyncDomainsWithStreamingResponse", + "BulksResource", + "AsyncBulksResource", + "BulksResourceWithRawResponse", + "AsyncBulksResourceWithRawResponse", + "BulksResourceWithStreamingResponse", + "AsyncBulksResourceWithStreamingResponse", + "DomainsResource", + "AsyncDomainsResource", + "DomainsResourceWithRawResponse", + "AsyncDomainsResourceWithRawResponse", + "DomainsResourceWithStreamingResponse", + "AsyncDomainsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/intel/domains/bulks.py b/src/cloudflare/resources/intel/domains/bulks.py index 3073013e08c..c8eb350e1ae 100644 --- a/src/cloudflare/resources/intel/domains/bulks.py +++ b/src/cloudflare/resources/intel/domains/bulks.py @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.intel.domains import BulkGetResponse, bulk_get_params +from ....types.intel.domains import bulk_get_params +from ....types.intel.domains.bulk_get_response import BulkGetResponse -__all__ = ["Bulks", "AsyncBulks"] +__all__ = ["BulksResource", "AsyncBulksResource"] -class Bulks(SyncAPIResource): +class BulksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BulksWithRawResponse: - return BulksWithRawResponse(self) + def with_raw_response(self) -> BulksResourceWithRawResponse: + return BulksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BulksWithStreamingResponse: - return BulksWithStreamingResponse(self) + def with_streaming_response(self) -> BulksResourceWithStreamingResponse: + return BulksResourceWithStreamingResponse(self) def get( self, @@ -75,20 +76,20 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"domain": domain}, bulk_get_params.BulkGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BulkGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[BulkGetResponse]], ResultWrapper[BulkGetResponse]), ) -class AsyncBulks(AsyncAPIResource): +class AsyncBulksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBulksWithRawResponse: - return AsyncBulksWithRawResponse(self) + def with_raw_response(self) -> AsyncBulksResourceWithRawResponse: + return AsyncBulksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBulksWithStreamingResponse: - return AsyncBulksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBulksResourceWithStreamingResponse: + return AsyncBulksResourceWithStreamingResponse(self) async def get( self, @@ -128,14 +129,14 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"domain": domain}, bulk_get_params.BulkGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BulkGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[BulkGetResponse]], ResultWrapper[BulkGetResponse]), ) -class BulksWithRawResponse: - def __init__(self, bulks: Bulks) -> None: +class BulksResourceWithRawResponse: + def __init__(self, bulks: BulksResource) -> None: self._bulks = bulks self.get = to_raw_response_wrapper( @@ -143,8 +144,8 @@ def __init__(self, bulks: Bulks) -> None: ) -class AsyncBulksWithRawResponse: - def __init__(self, bulks: AsyncBulks) -> None: +class AsyncBulksResourceWithRawResponse: + def __init__(self, bulks: AsyncBulksResource) -> None: self._bulks = bulks self.get = async_to_raw_response_wrapper( @@ -152,8 +153,8 @@ def __init__(self, bulks: AsyncBulks) -> None: ) -class BulksWithStreamingResponse: - def __init__(self, bulks: Bulks) -> None: +class BulksResourceWithStreamingResponse: + def __init__(self, bulks: BulksResource) -> None: self._bulks = bulks self.get = to_streamed_response_wrapper( @@ -161,8 +162,8 @@ def __init__(self, bulks: Bulks) -> None: ) -class AsyncBulksWithStreamingResponse: - def __init__(self, bulks: AsyncBulks) -> None: +class AsyncBulksResourceWithStreamingResponse: + def __init__(self, bulks: AsyncBulksResource) -> None: self._bulks = bulks self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/domains/domains.py b/src/cloudflare/resources/intel/domains/domains.py index a8eee7ac86b..15b1171aca6 100644 --- a/src/cloudflare/resources/intel/domains/domains.py +++ b/src/cloudflare/resources/intel/domains/domains.py @@ -7,12 +7,12 @@ import httpx from .bulks import ( - Bulks, - AsyncBulks, - BulksWithRawResponse, - AsyncBulksWithRawResponse, - BulksWithStreamingResponse, - AsyncBulksWithStreamingResponse, + BulksResource, + AsyncBulksResource, + BulksResourceWithRawResponse, + AsyncBulksResourceWithRawResponse, + BulksResourceWithStreamingResponse, + AsyncBulksResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -28,26 +28,27 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.intel import IntelDomain, domain_get_params +from ....types.intel import domain_get_params from ...._base_client import ( make_request_options, ) +from ....types.intel.domain import Domain -__all__ = ["Domains", "AsyncDomains"] +__all__ = ["DomainsResource", "AsyncDomainsResource"] -class Domains(SyncAPIResource): +class DomainsResource(SyncAPIResource): @cached_property - def bulks(self) -> Bulks: - return Bulks(self._client) + def bulks(self) -> BulksResource: + return BulksResource(self._client) @cached_property - def with_raw_response(self) -> DomainsWithRawResponse: - return DomainsWithRawResponse(self) + def with_raw_response(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DomainsWithStreamingResponse: - return DomainsWithStreamingResponse(self) + def with_streaming_response(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self) def get( self, @@ -60,7 +61,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelDomain: + ) -> Domain: """ Get Domain Details @@ -85,24 +86,24 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"domain": domain}, domain_get_params.DomainGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Domain]._unwrapper, ), - cast_to=cast(Type[IntelDomain], ResultWrapper[IntelDomain]), + cast_to=cast(Type[Domain], ResultWrapper[Domain]), ) -class AsyncDomains(AsyncAPIResource): +class AsyncDomainsResource(AsyncAPIResource): @cached_property - def bulks(self) -> AsyncBulks: - return AsyncBulks(self._client) + def bulks(self) -> AsyncBulksResource: + return AsyncBulksResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDomainsWithRawResponse: - return AsyncDomainsWithRawResponse(self) + def with_raw_response(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDomainsWithStreamingResponse: - return AsyncDomainsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self) async def get( self, @@ -115,7 +116,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelDomain: + ) -> Domain: """ Get Domain Details @@ -140,14 +141,14 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"domain": domain}, domain_get_params.DomainGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Domain]._unwrapper, ), - cast_to=cast(Type[IntelDomain], ResultWrapper[IntelDomain]), + cast_to=cast(Type[Domain], ResultWrapper[Domain]), ) -class DomainsWithRawResponse: - def __init__(self, domains: Domains) -> None: +class DomainsResourceWithRawResponse: + def __init__(self, domains: DomainsResource) -> None: self._domains = domains self.get = to_raw_response_wrapper( @@ -155,12 +156,12 @@ def __init__(self, domains: Domains) -> None: ) @cached_property - def bulks(self) -> BulksWithRawResponse: - return BulksWithRawResponse(self._domains.bulks) + def bulks(self) -> BulksResourceWithRawResponse: + return BulksResourceWithRawResponse(self._domains.bulks) -class AsyncDomainsWithRawResponse: - def __init__(self, domains: AsyncDomains) -> None: +class AsyncDomainsResourceWithRawResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: self._domains = domains self.get = async_to_raw_response_wrapper( @@ -168,12 +169,12 @@ def __init__(self, domains: AsyncDomains) -> None: ) @cached_property - def bulks(self) -> AsyncBulksWithRawResponse: - return AsyncBulksWithRawResponse(self._domains.bulks) + def bulks(self) -> AsyncBulksResourceWithRawResponse: + return AsyncBulksResourceWithRawResponse(self._domains.bulks) -class DomainsWithStreamingResponse: - def __init__(self, domains: Domains) -> None: +class DomainsResourceWithStreamingResponse: + def __init__(self, domains: DomainsResource) -> None: self._domains = domains self.get = to_streamed_response_wrapper( @@ -181,12 +182,12 @@ def __init__(self, domains: Domains) -> None: ) @cached_property - def bulks(self) -> BulksWithStreamingResponse: - return BulksWithStreamingResponse(self._domains.bulks) + def bulks(self) -> BulksResourceWithStreamingResponse: + return BulksResourceWithStreamingResponse(self._domains.bulks) -class AsyncDomainsWithStreamingResponse: - def __init__(self, domains: AsyncDomains) -> None: +class AsyncDomainsResourceWithStreamingResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: self._domains = domains self.get = async_to_streamed_response_wrapper( @@ -194,5 +195,5 @@ def __init__(self, domains: AsyncDomains) -> None: ) @cached_property - def bulks(self) -> AsyncBulksWithStreamingResponse: - return AsyncBulksWithStreamingResponse(self._domains.bulks) + def bulks(self) -> AsyncBulksResourceWithStreamingResponse: + return AsyncBulksResourceWithStreamingResponse(self._domains.bulks) diff --git a/src/cloudflare/resources/intel/indicator_feeds/__init__.py b/src/cloudflare/resources/intel/indicator_feeds/__init__.py index c537db94a52..a562b4be04d 100644 --- a/src/cloudflare/resources/intel/indicator_feeds/__init__.py +++ b/src/cloudflare/resources/intel/indicator_feeds/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .permissions import ( - Permissions, - AsyncPermissions, - PermissionsWithRawResponse, - AsyncPermissionsWithRawResponse, - PermissionsWithStreamingResponse, - AsyncPermissionsWithStreamingResponse, + PermissionsResource, + AsyncPermissionsResource, + PermissionsResourceWithRawResponse, + AsyncPermissionsResourceWithRawResponse, + PermissionsResourceWithStreamingResponse, + AsyncPermissionsResourceWithStreamingResponse, ) from .indicator_feeds import ( - IndicatorFeeds, - AsyncIndicatorFeeds, - IndicatorFeedsWithRawResponse, - AsyncIndicatorFeedsWithRawResponse, - IndicatorFeedsWithStreamingResponse, - AsyncIndicatorFeedsWithStreamingResponse, + IndicatorFeedsResource, + AsyncIndicatorFeedsResource, + IndicatorFeedsResourceWithRawResponse, + AsyncIndicatorFeedsResourceWithRawResponse, + IndicatorFeedsResourceWithStreamingResponse, + AsyncIndicatorFeedsResourceWithStreamingResponse, ) __all__ = [ - "Permissions", - "AsyncPermissions", - "PermissionsWithRawResponse", - "AsyncPermissionsWithRawResponse", - "PermissionsWithStreamingResponse", - "AsyncPermissionsWithStreamingResponse", - "IndicatorFeeds", - "AsyncIndicatorFeeds", - "IndicatorFeedsWithRawResponse", - "AsyncIndicatorFeedsWithRawResponse", - "IndicatorFeedsWithStreamingResponse", - "AsyncIndicatorFeedsWithStreamingResponse", + "PermissionsResource", + "AsyncPermissionsResource", + "PermissionsResourceWithRawResponse", + "AsyncPermissionsResourceWithRawResponse", + "PermissionsResourceWithStreamingResponse", + "AsyncPermissionsResourceWithStreamingResponse", + "IndicatorFeedsResource", + "AsyncIndicatorFeedsResource", + "IndicatorFeedsResourceWithRawResponse", + "AsyncIndicatorFeedsResourceWithRawResponse", + "IndicatorFeedsResourceWithStreamingResponse", + "AsyncIndicatorFeedsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py b/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py index add3191f331..c76f8b588c9 100644 --- a/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py +++ b/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py @@ -13,12 +13,12 @@ ) from ...._compat import cached_property from .permissions import ( - Permissions, - AsyncPermissions, - PermissionsWithRawResponse, - AsyncPermissionsWithRawResponse, - PermissionsWithStreamingResponse, - AsyncPermissionsWithStreamingResponse, + PermissionsResource, + AsyncPermissionsResource, + PermissionsResourceWithRawResponse, + AsyncPermissionsResourceWithRawResponse, + PermissionsResourceWithStreamingResponse, + AsyncPermissionsResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -29,34 +29,31 @@ ) from ...._wrappers import ResultWrapper from ....pagination import SyncSinglePage, AsyncSinglePage -from ....types.intel import ( - IndicatorFeedGetResponse, - IndicatorFeedListResponse, - IndicatorFeedCreateResponse, - IndicatorFeedUpdateResponse, - indicator_feed_create_params, - indicator_feed_update_params, -) +from ....types.intel import indicator_feed_create_params, indicator_feed_update_params from ...._base_client import ( AsyncPaginator, make_request_options, ) +from ....types.intel.indicator_feed_get_response import IndicatorFeedGetResponse +from ....types.intel.indicator_feed_list_response import IndicatorFeedListResponse +from ....types.intel.indicator_feed_create_response import IndicatorFeedCreateResponse +from ....types.intel.indicator_feed_update_response import IndicatorFeedUpdateResponse -__all__ = ["IndicatorFeeds", "AsyncIndicatorFeeds"] +__all__ = ["IndicatorFeedsResource", "AsyncIndicatorFeedsResource"] -class IndicatorFeeds(SyncAPIResource): +class IndicatorFeedsResource(SyncAPIResource): @cached_property - def permissions(self) -> Permissions: - return Permissions(self._client) + def permissions(self) -> PermissionsResource: + return PermissionsResource(self._client) @cached_property - def with_raw_response(self) -> IndicatorFeedsWithRawResponse: - return IndicatorFeedsWithRawResponse(self) + def with_raw_response(self) -> IndicatorFeedsResourceWithRawResponse: + return IndicatorFeedsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IndicatorFeedsWithStreamingResponse: - return IndicatorFeedsWithStreamingResponse(self) + def with_streaming_response(self) -> IndicatorFeedsResourceWithStreamingResponse: + return IndicatorFeedsResourceWithStreamingResponse(self) def create( self, @@ -105,7 +102,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IndicatorFeedCreateResponse]._unwrapper, ), cast_to=cast(Type[IndicatorFeedCreateResponse], ResultWrapper[IndicatorFeedCreateResponse]), ) @@ -151,7 +148,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IndicatorFeedUpdateResponse]._unwrapper, ), cast_to=cast(Type[IndicatorFeedUpdateResponse], ResultWrapper[IndicatorFeedUpdateResponse]), ) @@ -268,24 +265,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IndicatorFeedGetResponse]._unwrapper, ), cast_to=cast(Type[IndicatorFeedGetResponse], ResultWrapper[IndicatorFeedGetResponse]), ) -class AsyncIndicatorFeeds(AsyncAPIResource): +class AsyncIndicatorFeedsResource(AsyncAPIResource): @cached_property - def permissions(self) -> AsyncPermissions: - return AsyncPermissions(self._client) + def permissions(self) -> AsyncPermissionsResource: + return AsyncPermissionsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncIndicatorFeedsWithRawResponse: - return AsyncIndicatorFeedsWithRawResponse(self) + def with_raw_response(self) -> AsyncIndicatorFeedsResourceWithRawResponse: + return AsyncIndicatorFeedsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIndicatorFeedsWithStreamingResponse: - return AsyncIndicatorFeedsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIndicatorFeedsResourceWithStreamingResponse: + return AsyncIndicatorFeedsResourceWithStreamingResponse(self) async def create( self, @@ -334,7 +331,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IndicatorFeedCreateResponse]._unwrapper, ), cast_to=cast(Type[IndicatorFeedCreateResponse], ResultWrapper[IndicatorFeedCreateResponse]), ) @@ -382,7 +379,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IndicatorFeedUpdateResponse]._unwrapper, ), cast_to=cast(Type[IndicatorFeedUpdateResponse], ResultWrapper[IndicatorFeedUpdateResponse]), ) @@ -499,14 +496,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IndicatorFeedGetResponse]._unwrapper, ), cast_to=cast(Type[IndicatorFeedGetResponse], ResultWrapper[IndicatorFeedGetResponse]), ) -class IndicatorFeedsWithRawResponse: - def __init__(self, indicator_feeds: IndicatorFeeds) -> None: +class IndicatorFeedsResourceWithRawResponse: + def __init__(self, indicator_feeds: IndicatorFeedsResource) -> None: self._indicator_feeds = indicator_feeds self.create = to_raw_response_wrapper( @@ -526,12 +523,12 @@ def __init__(self, indicator_feeds: IndicatorFeeds) -> None: ) @cached_property - def permissions(self) -> PermissionsWithRawResponse: - return PermissionsWithRawResponse(self._indicator_feeds.permissions) + def permissions(self) -> PermissionsResourceWithRawResponse: + return PermissionsResourceWithRawResponse(self._indicator_feeds.permissions) -class AsyncIndicatorFeedsWithRawResponse: - def __init__(self, indicator_feeds: AsyncIndicatorFeeds) -> None: +class AsyncIndicatorFeedsResourceWithRawResponse: + def __init__(self, indicator_feeds: AsyncIndicatorFeedsResource) -> None: self._indicator_feeds = indicator_feeds self.create = async_to_raw_response_wrapper( @@ -551,12 +548,12 @@ def __init__(self, indicator_feeds: AsyncIndicatorFeeds) -> None: ) @cached_property - def permissions(self) -> AsyncPermissionsWithRawResponse: - return AsyncPermissionsWithRawResponse(self._indicator_feeds.permissions) + def permissions(self) -> AsyncPermissionsResourceWithRawResponse: + return AsyncPermissionsResourceWithRawResponse(self._indicator_feeds.permissions) -class IndicatorFeedsWithStreamingResponse: - def __init__(self, indicator_feeds: IndicatorFeeds) -> None: +class IndicatorFeedsResourceWithStreamingResponse: + def __init__(self, indicator_feeds: IndicatorFeedsResource) -> None: self._indicator_feeds = indicator_feeds self.create = to_streamed_response_wrapper( @@ -576,12 +573,12 @@ def __init__(self, indicator_feeds: IndicatorFeeds) -> None: ) @cached_property - def permissions(self) -> PermissionsWithStreamingResponse: - return PermissionsWithStreamingResponse(self._indicator_feeds.permissions) + def permissions(self) -> PermissionsResourceWithStreamingResponse: + return PermissionsResourceWithStreamingResponse(self._indicator_feeds.permissions) -class AsyncIndicatorFeedsWithStreamingResponse: - def __init__(self, indicator_feeds: AsyncIndicatorFeeds) -> None: +class AsyncIndicatorFeedsResourceWithStreamingResponse: + def __init__(self, indicator_feeds: AsyncIndicatorFeedsResource) -> None: self._indicator_feeds = indicator_feeds self.create = async_to_streamed_response_wrapper( @@ -601,5 +598,5 @@ def __init__(self, indicator_feeds: AsyncIndicatorFeeds) -> None: ) @cached_property - def permissions(self) -> AsyncPermissionsWithStreamingResponse: - return AsyncPermissionsWithStreamingResponse(self._indicator_feeds.permissions) + def permissions(self) -> AsyncPermissionsResourceWithStreamingResponse: + return AsyncPermissionsResourceWithStreamingResponse(self._indicator_feeds.permissions) diff --git a/src/cloudflare/resources/intel/indicator_feeds/permissions.py b/src/cloudflare/resources/intel/indicator_feeds/permissions.py index 5b6ebb29679..9558b5e48ff 100644 --- a/src/cloudflare/resources/intel/indicator_feeds/permissions.py +++ b/src/cloudflare/resources/intel/indicator_feeds/permissions.py @@ -23,25 +23,22 @@ from ...._base_client import ( make_request_options, ) -from ....types.intel.indicator_feeds import ( - PermissionListResponse, - PermissionCreateResponse, - PermissionDeleteResponse, - permission_create_params, - permission_delete_params, -) +from ....types.intel.indicator_feeds import permission_create_params, permission_delete_params +from ....types.intel.indicator_feeds.permission_list_response import PermissionListResponse +from ....types.intel.indicator_feeds.permission_create_response import PermissionCreateResponse +from ....types.intel.indicator_feeds.permission_delete_response import PermissionDeleteResponse -__all__ = ["Permissions", "AsyncPermissions"] +__all__ = ["PermissionsResource", "AsyncPermissionsResource"] -class Permissions(SyncAPIResource): +class PermissionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PermissionsWithRawResponse: - return PermissionsWithRawResponse(self) + def with_raw_response(self) -> PermissionsResourceWithRawResponse: + return PermissionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PermissionsWithStreamingResponse: - return PermissionsWithStreamingResponse(self) + def with_streaming_response(self) -> PermissionsResourceWithStreamingResponse: + return PermissionsResourceWithStreamingResponse(self) def create( self, @@ -90,7 +87,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PermissionCreateResponse]._unwrapper, ), cast_to=cast(Type[PermissionCreateResponse], ResultWrapper[PermissionCreateResponse]), ) @@ -129,7 +126,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PermissionListResponse]._unwrapper, ), cast_to=cast(Type[PermissionListResponse], ResultWrapper[PermissionListResponse]), ) @@ -181,20 +178,20 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PermissionDeleteResponse]._unwrapper, ), cast_to=cast(Type[PermissionDeleteResponse], ResultWrapper[PermissionDeleteResponse]), ) -class AsyncPermissions(AsyncAPIResource): +class AsyncPermissionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPermissionsWithRawResponse: - return AsyncPermissionsWithRawResponse(self) + def with_raw_response(self) -> AsyncPermissionsResourceWithRawResponse: + return AsyncPermissionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPermissionsWithStreamingResponse: - return AsyncPermissionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPermissionsResourceWithStreamingResponse: + return AsyncPermissionsResourceWithStreamingResponse(self) async def create( self, @@ -243,7 +240,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PermissionCreateResponse]._unwrapper, ), cast_to=cast(Type[PermissionCreateResponse], ResultWrapper[PermissionCreateResponse]), ) @@ -282,7 +279,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PermissionListResponse]._unwrapper, ), cast_to=cast(Type[PermissionListResponse], ResultWrapper[PermissionListResponse]), ) @@ -334,14 +331,14 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PermissionDeleteResponse]._unwrapper, ), cast_to=cast(Type[PermissionDeleteResponse], ResultWrapper[PermissionDeleteResponse]), ) -class PermissionsWithRawResponse: - def __init__(self, permissions: Permissions) -> None: +class PermissionsResourceWithRawResponse: + def __init__(self, permissions: PermissionsResource) -> None: self._permissions = permissions self.create = to_raw_response_wrapper( @@ -355,8 +352,8 @@ def __init__(self, permissions: Permissions) -> None: ) -class AsyncPermissionsWithRawResponse: - def __init__(self, permissions: AsyncPermissions) -> None: +class AsyncPermissionsResourceWithRawResponse: + def __init__(self, permissions: AsyncPermissionsResource) -> None: self._permissions = permissions self.create = async_to_raw_response_wrapper( @@ -370,8 +367,8 @@ def __init__(self, permissions: AsyncPermissions) -> None: ) -class PermissionsWithStreamingResponse: - def __init__(self, permissions: Permissions) -> None: +class PermissionsResourceWithStreamingResponse: + def __init__(self, permissions: PermissionsResource) -> None: self._permissions = permissions self.create = to_streamed_response_wrapper( @@ -385,8 +382,8 @@ def __init__(self, permissions: Permissions) -> None: ) -class AsyncPermissionsWithStreamingResponse: - def __init__(self, permissions: AsyncPermissions) -> None: +class AsyncPermissionsResourceWithStreamingResponse: + def __init__(self, permissions: AsyncPermissionsResource) -> None: self._permissions = permissions self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/intel.py b/src/cloudflare/resources/intel/intel.py index c67ec7e95d4..5dc3092ce45 100644 --- a/src/cloudflare/resources/intel/intel.py +++ b/src/cloudflare/resources/intel/intel.py @@ -3,402 +3,402 @@ from __future__ import annotations from .asn import ( - ASN, - AsyncASN, - ASNWithRawResponse, - AsyncASNWithRawResponse, - ASNWithStreamingResponse, - AsyncASNWithStreamingResponse, + ASNResource, + AsyncASNResource, + ASNResourceWithRawResponse, + AsyncASNResourceWithRawResponse, + ASNResourceWithStreamingResponse, + AsyncASNResourceWithStreamingResponse, ) from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .ips import ( - IPs, - AsyncIPs, - IPsWithRawResponse, - AsyncIPsWithRawResponse, - IPsWithStreamingResponse, - AsyncIPsWithStreamingResponse, + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, ) from .whois import ( - Whois, - AsyncWhois, - WhoisWithRawResponse, - AsyncWhoisWithRawResponse, - WhoisWithStreamingResponse, - AsyncWhoisWithStreamingResponse, + WhoisResource, + AsyncWhoisResource, + WhoisResourceWithRawResponse, + AsyncWhoisResourceWithRawResponse, + WhoisResourceWithStreamingResponse, + AsyncWhoisResourceWithStreamingResponse, ) -from .asn.asn import ASN, AsyncASN +from .asn.asn import ASNResource, AsyncASNResource from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) from .ip_lists import ( - IPLists, - AsyncIPLists, - IPListsWithRawResponse, - AsyncIPListsWithRawResponse, - IPListsWithStreamingResponse, - AsyncIPListsWithStreamingResponse, + IPListsResource, + AsyncIPListsResource, + IPListsResourceWithRawResponse, + AsyncIPListsResourceWithRawResponse, + IPListsResourceWithStreamingResponse, + AsyncIPListsResourceWithStreamingResponse, ) from ..._compat import cached_property from .sinkholes import ( - Sinkholes, - AsyncSinkholes, - SinkholesWithRawResponse, - AsyncSinkholesWithRawResponse, - SinkholesWithStreamingResponse, - AsyncSinkholesWithStreamingResponse, + SinkholesResource, + AsyncSinkholesResource, + SinkholesResourceWithRawResponse, + AsyncSinkholesResourceWithRawResponse, + SinkholesResourceWithStreamingResponse, + AsyncSinkholesResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from .domain_history import ( - DomainHistory, - AsyncDomainHistory, - DomainHistoryWithRawResponse, - AsyncDomainHistoryWithRawResponse, - DomainHistoryWithStreamingResponse, - AsyncDomainHistoryWithStreamingResponse, + DomainHistoryResource, + AsyncDomainHistoryResource, + DomainHistoryResourceWithRawResponse, + AsyncDomainHistoryResourceWithRawResponse, + DomainHistoryResourceWithStreamingResponse, + AsyncDomainHistoryResourceWithStreamingResponse, ) -from .domains.domains import Domains, AsyncDomains +from .domains.domains import DomainsResource, AsyncDomainsResource from .indicator_feeds import ( - IndicatorFeeds, - AsyncIndicatorFeeds, - IndicatorFeedsWithRawResponse, - AsyncIndicatorFeedsWithRawResponse, - IndicatorFeedsWithStreamingResponse, - AsyncIndicatorFeedsWithStreamingResponse, + IndicatorFeedsResource, + AsyncIndicatorFeedsResource, + IndicatorFeedsResourceWithRawResponse, + AsyncIndicatorFeedsResourceWithRawResponse, + IndicatorFeedsResourceWithStreamingResponse, + AsyncIndicatorFeedsResourceWithStreamingResponse, ) from .miscategorizations import ( - Miscategorizations, - AsyncMiscategorizations, - MiscategorizationsWithRawResponse, - AsyncMiscategorizationsWithRawResponse, - MiscategorizationsWithStreamingResponse, - AsyncMiscategorizationsWithStreamingResponse, + MiscategorizationsResource, + AsyncMiscategorizationsResource, + MiscategorizationsResourceWithRawResponse, + AsyncMiscategorizationsResourceWithRawResponse, + MiscategorizationsResourceWithStreamingResponse, + AsyncMiscategorizationsResourceWithStreamingResponse, ) from .attack_surface_report import ( - AttackSurfaceReport, - AsyncAttackSurfaceReport, - AttackSurfaceReportWithRawResponse, - AsyncAttackSurfaceReportWithRawResponse, - AttackSurfaceReportWithStreamingResponse, - AsyncAttackSurfaceReportWithStreamingResponse, + AttackSurfaceReportResource, + AsyncAttackSurfaceReportResource, + AttackSurfaceReportResourceWithRawResponse, + AsyncAttackSurfaceReportResourceWithRawResponse, + AttackSurfaceReportResourceWithStreamingResponse, + AsyncAttackSurfaceReportResourceWithStreamingResponse, ) -from .indicator_feeds.indicator_feeds import IndicatorFeeds, AsyncIndicatorFeeds -from .attack_surface_report.attack_surface_report import AttackSurfaceReport, AsyncAttackSurfaceReport +from .indicator_feeds.indicator_feeds import IndicatorFeedsResource, AsyncIndicatorFeedsResource +from .attack_surface_report.attack_surface_report import AttackSurfaceReportResource, AsyncAttackSurfaceReportResource -__all__ = ["Intel", "AsyncIntel"] +__all__ = ["IntelResource", "AsyncIntelResource"] -class Intel(SyncAPIResource): +class IntelResource(SyncAPIResource): @cached_property - def asn(self) -> ASN: - return ASN(self._client) + def asn(self) -> ASNResource: + return ASNResource(self._client) @cached_property - def dns(self) -> DNS: - return DNS(self._client) + def dns(self) -> DNSResource: + return DNSResource(self._client) @cached_property - def domains(self) -> Domains: - return Domains(self._client) + def domains(self) -> DomainsResource: + return DomainsResource(self._client) @cached_property - def domain_history(self) -> DomainHistory: - return DomainHistory(self._client) + def domain_history(self) -> DomainHistoryResource: + return DomainHistoryResource(self._client) @cached_property - def ips(self) -> IPs: - return IPs(self._client) + def ips(self) -> IPsResource: + return IPsResource(self._client) @cached_property - def ip_lists(self) -> IPLists: - return IPLists(self._client) + def ip_lists(self) -> IPListsResource: + return IPListsResource(self._client) @cached_property - def miscategorizations(self) -> Miscategorizations: - return Miscategorizations(self._client) + def miscategorizations(self) -> MiscategorizationsResource: + return MiscategorizationsResource(self._client) @cached_property - def whois(self) -> Whois: - return Whois(self._client) + def whois(self) -> WhoisResource: + return WhoisResource(self._client) @cached_property - def indicator_feeds(self) -> IndicatorFeeds: - return IndicatorFeeds(self._client) + def indicator_feeds(self) -> IndicatorFeedsResource: + return IndicatorFeedsResource(self._client) @cached_property - def sinkholes(self) -> Sinkholes: - return Sinkholes(self._client) + def sinkholes(self) -> SinkholesResource: + return SinkholesResource(self._client) @cached_property - def attack_surface_report(self) -> AttackSurfaceReport: - return AttackSurfaceReport(self._client) + def attack_surface_report(self) -> AttackSurfaceReportResource: + return AttackSurfaceReportResource(self._client) @cached_property - def with_raw_response(self) -> IntelWithRawResponse: - return IntelWithRawResponse(self) + def with_raw_response(self) -> IntelResourceWithRawResponse: + return IntelResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IntelWithStreamingResponse: - return IntelWithStreamingResponse(self) + def with_streaming_response(self) -> IntelResourceWithStreamingResponse: + return IntelResourceWithStreamingResponse(self) -class AsyncIntel(AsyncAPIResource): +class AsyncIntelResource(AsyncAPIResource): @cached_property - def asn(self) -> AsyncASN: - return AsyncASN(self._client) + def asn(self) -> AsyncASNResource: + return AsyncASNResource(self._client) @cached_property - def dns(self) -> AsyncDNS: - return AsyncDNS(self._client) + def dns(self) -> AsyncDNSResource: + return AsyncDNSResource(self._client) @cached_property - def domains(self) -> AsyncDomains: - return AsyncDomains(self._client) + def domains(self) -> AsyncDomainsResource: + return AsyncDomainsResource(self._client) @cached_property - def domain_history(self) -> AsyncDomainHistory: - return AsyncDomainHistory(self._client) + def domain_history(self) -> AsyncDomainHistoryResource: + return AsyncDomainHistoryResource(self._client) @cached_property - def ips(self) -> AsyncIPs: - return AsyncIPs(self._client) + def ips(self) -> AsyncIPsResource: + return AsyncIPsResource(self._client) @cached_property - def ip_lists(self) -> AsyncIPLists: - return AsyncIPLists(self._client) + def ip_lists(self) -> AsyncIPListsResource: + return AsyncIPListsResource(self._client) @cached_property - def miscategorizations(self) -> AsyncMiscategorizations: - return AsyncMiscategorizations(self._client) + def miscategorizations(self) -> AsyncMiscategorizationsResource: + return AsyncMiscategorizationsResource(self._client) @cached_property - def whois(self) -> AsyncWhois: - return AsyncWhois(self._client) + def whois(self) -> AsyncWhoisResource: + return AsyncWhoisResource(self._client) @cached_property - def indicator_feeds(self) -> AsyncIndicatorFeeds: - return AsyncIndicatorFeeds(self._client) + def indicator_feeds(self) -> AsyncIndicatorFeedsResource: + return AsyncIndicatorFeedsResource(self._client) @cached_property - def sinkholes(self) -> AsyncSinkholes: - return AsyncSinkholes(self._client) + def sinkholes(self) -> AsyncSinkholesResource: + return AsyncSinkholesResource(self._client) @cached_property - def attack_surface_report(self) -> AsyncAttackSurfaceReport: - return AsyncAttackSurfaceReport(self._client) + def attack_surface_report(self) -> AsyncAttackSurfaceReportResource: + return AsyncAttackSurfaceReportResource(self._client) @cached_property - def with_raw_response(self) -> AsyncIntelWithRawResponse: - return AsyncIntelWithRawResponse(self) + def with_raw_response(self) -> AsyncIntelResourceWithRawResponse: + return AsyncIntelResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIntelWithStreamingResponse: - return AsyncIntelWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIntelResourceWithStreamingResponse: + return AsyncIntelResourceWithStreamingResponse(self) -class IntelWithRawResponse: - def __init__(self, intel: Intel) -> None: +class IntelResourceWithRawResponse: + def __init__(self, intel: IntelResource) -> None: self._intel = intel @cached_property - def asn(self) -> ASNWithRawResponse: - return ASNWithRawResponse(self._intel.asn) + def asn(self) -> ASNResourceWithRawResponse: + return ASNResourceWithRawResponse(self._intel.asn) @cached_property - def dns(self) -> DNSWithRawResponse: - return DNSWithRawResponse(self._intel.dns) + def dns(self) -> DNSResourceWithRawResponse: + return DNSResourceWithRawResponse(self._intel.dns) @cached_property - def domains(self) -> DomainsWithRawResponse: - return DomainsWithRawResponse(self._intel.domains) + def domains(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self._intel.domains) @cached_property - def domain_history(self) -> DomainHistoryWithRawResponse: - return DomainHistoryWithRawResponse(self._intel.domain_history) + def domain_history(self) -> DomainHistoryResourceWithRawResponse: + return DomainHistoryResourceWithRawResponse(self._intel.domain_history) @cached_property - def ips(self) -> IPsWithRawResponse: - return IPsWithRawResponse(self._intel.ips) + def ips(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self._intel.ips) @cached_property - def ip_lists(self) -> IPListsWithRawResponse: - return IPListsWithRawResponse(self._intel.ip_lists) + def ip_lists(self) -> IPListsResourceWithRawResponse: + return IPListsResourceWithRawResponse(self._intel.ip_lists) @cached_property - def miscategorizations(self) -> MiscategorizationsWithRawResponse: - return MiscategorizationsWithRawResponse(self._intel.miscategorizations) + def miscategorizations(self) -> MiscategorizationsResourceWithRawResponse: + return MiscategorizationsResourceWithRawResponse(self._intel.miscategorizations) @cached_property - def whois(self) -> WhoisWithRawResponse: - return WhoisWithRawResponse(self._intel.whois) + def whois(self) -> WhoisResourceWithRawResponse: + return WhoisResourceWithRawResponse(self._intel.whois) @cached_property - def indicator_feeds(self) -> IndicatorFeedsWithRawResponse: - return IndicatorFeedsWithRawResponse(self._intel.indicator_feeds) + def indicator_feeds(self) -> IndicatorFeedsResourceWithRawResponse: + return IndicatorFeedsResourceWithRawResponse(self._intel.indicator_feeds) @cached_property - def sinkholes(self) -> SinkholesWithRawResponse: - return SinkholesWithRawResponse(self._intel.sinkholes) + def sinkholes(self) -> SinkholesResourceWithRawResponse: + return SinkholesResourceWithRawResponse(self._intel.sinkholes) @cached_property - def attack_surface_report(self) -> AttackSurfaceReportWithRawResponse: - return AttackSurfaceReportWithRawResponse(self._intel.attack_surface_report) + def attack_surface_report(self) -> AttackSurfaceReportResourceWithRawResponse: + return AttackSurfaceReportResourceWithRawResponse(self._intel.attack_surface_report) -class AsyncIntelWithRawResponse: - def __init__(self, intel: AsyncIntel) -> None: +class AsyncIntelResourceWithRawResponse: + def __init__(self, intel: AsyncIntelResource) -> None: self._intel = intel @cached_property - def asn(self) -> AsyncASNWithRawResponse: - return AsyncASNWithRawResponse(self._intel.asn) + def asn(self) -> AsyncASNResourceWithRawResponse: + return AsyncASNResourceWithRawResponse(self._intel.asn) @cached_property - def dns(self) -> AsyncDNSWithRawResponse: - return AsyncDNSWithRawResponse(self._intel.dns) + def dns(self) -> AsyncDNSResourceWithRawResponse: + return AsyncDNSResourceWithRawResponse(self._intel.dns) @cached_property - def domains(self) -> AsyncDomainsWithRawResponse: - return AsyncDomainsWithRawResponse(self._intel.domains) + def domains(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self._intel.domains) @cached_property - def domain_history(self) -> AsyncDomainHistoryWithRawResponse: - return AsyncDomainHistoryWithRawResponse(self._intel.domain_history) + def domain_history(self) -> AsyncDomainHistoryResourceWithRawResponse: + return AsyncDomainHistoryResourceWithRawResponse(self._intel.domain_history) @cached_property - def ips(self) -> AsyncIPsWithRawResponse: - return AsyncIPsWithRawResponse(self._intel.ips) + def ips(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self._intel.ips) @cached_property - def ip_lists(self) -> AsyncIPListsWithRawResponse: - return AsyncIPListsWithRawResponse(self._intel.ip_lists) + def ip_lists(self) -> AsyncIPListsResourceWithRawResponse: + return AsyncIPListsResourceWithRawResponse(self._intel.ip_lists) @cached_property - def miscategorizations(self) -> AsyncMiscategorizationsWithRawResponse: - return AsyncMiscategorizationsWithRawResponse(self._intel.miscategorizations) + def miscategorizations(self) -> AsyncMiscategorizationsResourceWithRawResponse: + return AsyncMiscategorizationsResourceWithRawResponse(self._intel.miscategorizations) @cached_property - def whois(self) -> AsyncWhoisWithRawResponse: - return AsyncWhoisWithRawResponse(self._intel.whois) + def whois(self) -> AsyncWhoisResourceWithRawResponse: + return AsyncWhoisResourceWithRawResponse(self._intel.whois) @cached_property - def indicator_feeds(self) -> AsyncIndicatorFeedsWithRawResponse: - return AsyncIndicatorFeedsWithRawResponse(self._intel.indicator_feeds) + def indicator_feeds(self) -> AsyncIndicatorFeedsResourceWithRawResponse: + return AsyncIndicatorFeedsResourceWithRawResponse(self._intel.indicator_feeds) @cached_property - def sinkholes(self) -> AsyncSinkholesWithRawResponse: - return AsyncSinkholesWithRawResponse(self._intel.sinkholes) + def sinkholes(self) -> AsyncSinkholesResourceWithRawResponse: + return AsyncSinkholesResourceWithRawResponse(self._intel.sinkholes) @cached_property - def attack_surface_report(self) -> AsyncAttackSurfaceReportWithRawResponse: - return AsyncAttackSurfaceReportWithRawResponse(self._intel.attack_surface_report) + def attack_surface_report(self) -> AsyncAttackSurfaceReportResourceWithRawResponse: + return AsyncAttackSurfaceReportResourceWithRawResponse(self._intel.attack_surface_report) -class IntelWithStreamingResponse: - def __init__(self, intel: Intel) -> None: +class IntelResourceWithStreamingResponse: + def __init__(self, intel: IntelResource) -> None: self._intel = intel @cached_property - def asn(self) -> ASNWithStreamingResponse: - return ASNWithStreamingResponse(self._intel.asn) + def asn(self) -> ASNResourceWithStreamingResponse: + return ASNResourceWithStreamingResponse(self._intel.asn) @cached_property - def dns(self) -> DNSWithStreamingResponse: - return DNSWithStreamingResponse(self._intel.dns) + def dns(self) -> DNSResourceWithStreamingResponse: + return DNSResourceWithStreamingResponse(self._intel.dns) @cached_property - def domains(self) -> DomainsWithStreamingResponse: - return DomainsWithStreamingResponse(self._intel.domains) + def domains(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self._intel.domains) @cached_property - def domain_history(self) -> DomainHistoryWithStreamingResponse: - return DomainHistoryWithStreamingResponse(self._intel.domain_history) + def domain_history(self) -> DomainHistoryResourceWithStreamingResponse: + return DomainHistoryResourceWithStreamingResponse(self._intel.domain_history) @cached_property - def ips(self) -> IPsWithStreamingResponse: - return IPsWithStreamingResponse(self._intel.ips) + def ips(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self._intel.ips) @cached_property - def ip_lists(self) -> IPListsWithStreamingResponse: - return IPListsWithStreamingResponse(self._intel.ip_lists) + def ip_lists(self) -> IPListsResourceWithStreamingResponse: + return IPListsResourceWithStreamingResponse(self._intel.ip_lists) @cached_property - def miscategorizations(self) -> MiscategorizationsWithStreamingResponse: - return MiscategorizationsWithStreamingResponse(self._intel.miscategorizations) + def miscategorizations(self) -> MiscategorizationsResourceWithStreamingResponse: + return MiscategorizationsResourceWithStreamingResponse(self._intel.miscategorizations) @cached_property - def whois(self) -> WhoisWithStreamingResponse: - return WhoisWithStreamingResponse(self._intel.whois) + def whois(self) -> WhoisResourceWithStreamingResponse: + return WhoisResourceWithStreamingResponse(self._intel.whois) @cached_property - def indicator_feeds(self) -> IndicatorFeedsWithStreamingResponse: - return IndicatorFeedsWithStreamingResponse(self._intel.indicator_feeds) + def indicator_feeds(self) -> IndicatorFeedsResourceWithStreamingResponse: + return IndicatorFeedsResourceWithStreamingResponse(self._intel.indicator_feeds) @cached_property - def sinkholes(self) -> SinkholesWithStreamingResponse: - return SinkholesWithStreamingResponse(self._intel.sinkholes) + def sinkholes(self) -> SinkholesResourceWithStreamingResponse: + return SinkholesResourceWithStreamingResponse(self._intel.sinkholes) @cached_property - def attack_surface_report(self) -> AttackSurfaceReportWithStreamingResponse: - return AttackSurfaceReportWithStreamingResponse(self._intel.attack_surface_report) + def attack_surface_report(self) -> AttackSurfaceReportResourceWithStreamingResponse: + return AttackSurfaceReportResourceWithStreamingResponse(self._intel.attack_surface_report) -class AsyncIntelWithStreamingResponse: - def __init__(self, intel: AsyncIntel) -> None: +class AsyncIntelResourceWithStreamingResponse: + def __init__(self, intel: AsyncIntelResource) -> None: self._intel = intel @cached_property - def asn(self) -> AsyncASNWithStreamingResponse: - return AsyncASNWithStreamingResponse(self._intel.asn) + def asn(self) -> AsyncASNResourceWithStreamingResponse: + return AsyncASNResourceWithStreamingResponse(self._intel.asn) @cached_property - def dns(self) -> AsyncDNSWithStreamingResponse: - return AsyncDNSWithStreamingResponse(self._intel.dns) + def dns(self) -> AsyncDNSResourceWithStreamingResponse: + return AsyncDNSResourceWithStreamingResponse(self._intel.dns) @cached_property - def domains(self) -> AsyncDomainsWithStreamingResponse: - return AsyncDomainsWithStreamingResponse(self._intel.domains) + def domains(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self._intel.domains) @cached_property - def domain_history(self) -> AsyncDomainHistoryWithStreamingResponse: - return AsyncDomainHistoryWithStreamingResponse(self._intel.domain_history) + def domain_history(self) -> AsyncDomainHistoryResourceWithStreamingResponse: + return AsyncDomainHistoryResourceWithStreamingResponse(self._intel.domain_history) @cached_property - def ips(self) -> AsyncIPsWithStreamingResponse: - return AsyncIPsWithStreamingResponse(self._intel.ips) + def ips(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self._intel.ips) @cached_property - def ip_lists(self) -> AsyncIPListsWithStreamingResponse: - return AsyncIPListsWithStreamingResponse(self._intel.ip_lists) + def ip_lists(self) -> AsyncIPListsResourceWithStreamingResponse: + return AsyncIPListsResourceWithStreamingResponse(self._intel.ip_lists) @cached_property - def miscategorizations(self) -> AsyncMiscategorizationsWithStreamingResponse: - return AsyncMiscategorizationsWithStreamingResponse(self._intel.miscategorizations) + def miscategorizations(self) -> AsyncMiscategorizationsResourceWithStreamingResponse: + return AsyncMiscategorizationsResourceWithStreamingResponse(self._intel.miscategorizations) @cached_property - def whois(self) -> AsyncWhoisWithStreamingResponse: - return AsyncWhoisWithStreamingResponse(self._intel.whois) + def whois(self) -> AsyncWhoisResourceWithStreamingResponse: + return AsyncWhoisResourceWithStreamingResponse(self._intel.whois) @cached_property - def indicator_feeds(self) -> AsyncIndicatorFeedsWithStreamingResponse: - return AsyncIndicatorFeedsWithStreamingResponse(self._intel.indicator_feeds) + def indicator_feeds(self) -> AsyncIndicatorFeedsResourceWithStreamingResponse: + return AsyncIndicatorFeedsResourceWithStreamingResponse(self._intel.indicator_feeds) @cached_property - def sinkholes(self) -> AsyncSinkholesWithStreamingResponse: - return AsyncSinkholesWithStreamingResponse(self._intel.sinkholes) + def sinkholes(self) -> AsyncSinkholesResourceWithStreamingResponse: + return AsyncSinkholesResourceWithStreamingResponse(self._intel.sinkholes) @cached_property - def attack_surface_report(self) -> AsyncAttackSurfaceReportWithStreamingResponse: - return AsyncAttackSurfaceReportWithStreamingResponse(self._intel.attack_surface_report) + def attack_surface_report(self) -> AsyncAttackSurfaceReportResourceWithStreamingResponse: + return AsyncAttackSurfaceReportResourceWithStreamingResponse(self._intel.attack_surface_report) diff --git a/src/cloudflare/resources/intel/ip_lists.py b/src/cloudflare/resources/intel/ip_lists.py index 4c661662685..78bb216c729 100644 --- a/src/cloudflare/resources/intel/ip_lists.py +++ b/src/cloudflare/resources/intel/ip_lists.py @@ -16,22 +16,22 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.intel import IPListGetResponse from ..._base_client import ( make_request_options, ) +from ...types.intel.ip_list_get_response import IPListGetResponse -__all__ = ["IPLists", "AsyncIPLists"] +__all__ = ["IPListsResource", "AsyncIPListsResource"] -class IPLists(SyncAPIResource): +class IPListsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPListsWithRawResponse: - return IPListsWithRawResponse(self) + def with_raw_response(self) -> IPListsResourceWithRawResponse: + return IPListsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPListsWithStreamingResponse: - return IPListsWithStreamingResponse(self) + def with_streaming_response(self) -> IPListsResourceWithStreamingResponse: + return IPListsResourceWithStreamingResponse(self) def get( self, @@ -67,20 +67,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPListGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[IPListGetResponse]], ResultWrapper[IPListGetResponse]), ) -class AsyncIPLists(AsyncAPIResource): +class AsyncIPListsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPListsWithRawResponse: - return AsyncIPListsWithRawResponse(self) + def with_raw_response(self) -> AsyncIPListsResourceWithRawResponse: + return AsyncIPListsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPListsWithStreamingResponse: - return AsyncIPListsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPListsResourceWithStreamingResponse: + return AsyncIPListsResourceWithStreamingResponse(self) async def get( self, @@ -116,14 +116,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPListGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[IPListGetResponse]], ResultWrapper[IPListGetResponse]), ) -class IPListsWithRawResponse: - def __init__(self, ip_lists: IPLists) -> None: +class IPListsResourceWithRawResponse: + def __init__(self, ip_lists: IPListsResource) -> None: self._ip_lists = ip_lists self.get = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, ip_lists: IPLists) -> None: ) -class AsyncIPListsWithRawResponse: - def __init__(self, ip_lists: AsyncIPLists) -> None: +class AsyncIPListsResourceWithRawResponse: + def __init__(self, ip_lists: AsyncIPListsResource) -> None: self._ip_lists = ip_lists self.get = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, ip_lists: AsyncIPLists) -> None: ) -class IPListsWithStreamingResponse: - def __init__(self, ip_lists: IPLists) -> None: +class IPListsResourceWithStreamingResponse: + def __init__(self, ip_lists: IPListsResource) -> None: self._ip_lists = ip_lists self.get = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, ip_lists: IPLists) -> None: ) -class AsyncIPListsWithStreamingResponse: - def __init__(self, ip_lists: AsyncIPLists) -> None: +class AsyncIPListsResourceWithStreamingResponse: + def __init__(self, ip_lists: AsyncIPListsResource) -> None: self._ip_lists = ip_lists self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/ips.py b/src/cloudflare/resources/intel/ips.py index a1ec0ebad5a..f205d9a9afd 100644 --- a/src/cloudflare/resources/intel/ips.py +++ b/src/cloudflare/resources/intel/ips.py @@ -20,22 +20,23 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.intel import IPGetResponse, ip_get_params +from ...types.intel import ip_get_params from ..._base_client import ( make_request_options, ) +from ...types.intel.ip_get_response import IPGetResponse -__all__ = ["IPs", "AsyncIPs"] +__all__ = ["IPsResource", "AsyncIPsResource"] -class IPs(SyncAPIResource): +class IPsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPsWithRawResponse: - return IPsWithRawResponse(self) + def with_raw_response(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPsWithStreamingResponse: - return IPsWithStreamingResponse(self) + def with_streaming_response(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self) def get( self, @@ -80,20 +81,20 @@ def get( }, ip_get_params.IPGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[IPGetResponse]], ResultWrapper[IPGetResponse]), ) -class AsyncIPs(AsyncAPIResource): +class AsyncIPsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPsWithRawResponse: - return AsyncIPsWithRawResponse(self) + def with_raw_response(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPsWithStreamingResponse: - return AsyncIPsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self) async def get( self, @@ -138,14 +139,14 @@ async def get( }, ip_get_params.IPGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[IPGetResponse]], ResultWrapper[IPGetResponse]), ) -class IPsWithRawResponse: - def __init__(self, ips: IPs) -> None: +class IPsResourceWithRawResponse: + def __init__(self, ips: IPsResource) -> None: self._ips = ips self.get = to_raw_response_wrapper( @@ -153,8 +154,8 @@ def __init__(self, ips: IPs) -> None: ) -class AsyncIPsWithRawResponse: - def __init__(self, ips: AsyncIPs) -> None: +class AsyncIPsResourceWithRawResponse: + def __init__(self, ips: AsyncIPsResource) -> None: self._ips = ips self.get = async_to_raw_response_wrapper( @@ -162,8 +163,8 @@ def __init__(self, ips: AsyncIPs) -> None: ) -class IPsWithStreamingResponse: - def __init__(self, ips: IPs) -> None: +class IPsResourceWithStreamingResponse: + def __init__(self, ips: IPsResource) -> None: self._ips = ips self.get = to_streamed_response_wrapper( @@ -171,8 +172,8 @@ def __init__(self, ips: IPs) -> None: ) -class AsyncIPsWithStreamingResponse: - def __init__(self, ips: AsyncIPs) -> None: +class AsyncIPsResourceWithStreamingResponse: + def __init__(self, ips: AsyncIPsResource) -> None: self._ips = ips self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/miscategorizations.py b/src/cloudflare/resources/intel/miscategorizations.py index 34b12eb83da..266ed05d040 100644 --- a/src/cloudflare/resources/intel/miscategorizations.py +++ b/src/cloudflare/resources/intel/miscategorizations.py @@ -21,22 +21,23 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.intel import MiscategorizationCreateResponse, miscategorization_create_params +from ...types.intel import miscategorization_create_params from ..._base_client import ( make_request_options, ) +from ...types.intel.miscategorization_create_response import MiscategorizationCreateResponse -__all__ = ["Miscategorizations", "AsyncMiscategorizations"] +__all__ = ["MiscategorizationsResource", "AsyncMiscategorizationsResource"] -class Miscategorizations(SyncAPIResource): +class MiscategorizationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MiscategorizationsWithRawResponse: - return MiscategorizationsWithRawResponse(self) + def with_raw_response(self) -> MiscategorizationsResourceWithRawResponse: + return MiscategorizationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MiscategorizationsWithStreamingResponse: - return MiscategorizationsWithStreamingResponse(self) + def with_streaming_response(self) -> MiscategorizationsResourceWithStreamingResponse: + return MiscategorizationsResourceWithStreamingResponse(self) def create( self, @@ -107,7 +108,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MiscategorizationCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MiscategorizationCreateResponse] @@ -116,14 +117,14 @@ def create( ) -class AsyncMiscategorizations(AsyncAPIResource): +class AsyncMiscategorizationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMiscategorizationsWithRawResponse: - return AsyncMiscategorizationsWithRawResponse(self) + def with_raw_response(self) -> AsyncMiscategorizationsResourceWithRawResponse: + return AsyncMiscategorizationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMiscategorizationsWithStreamingResponse: - return AsyncMiscategorizationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMiscategorizationsResourceWithStreamingResponse: + return AsyncMiscategorizationsResourceWithStreamingResponse(self) async def create( self, @@ -194,7 +195,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MiscategorizationCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MiscategorizationCreateResponse] @@ -203,8 +204,8 @@ async def create( ) -class MiscategorizationsWithRawResponse: - def __init__(self, miscategorizations: Miscategorizations) -> None: +class MiscategorizationsResourceWithRawResponse: + def __init__(self, miscategorizations: MiscategorizationsResource) -> None: self._miscategorizations = miscategorizations self.create = to_raw_response_wrapper( @@ -212,8 +213,8 @@ def __init__(self, miscategorizations: Miscategorizations) -> None: ) -class AsyncMiscategorizationsWithRawResponse: - def __init__(self, miscategorizations: AsyncMiscategorizations) -> None: +class AsyncMiscategorizationsResourceWithRawResponse: + def __init__(self, miscategorizations: AsyncMiscategorizationsResource) -> None: self._miscategorizations = miscategorizations self.create = async_to_raw_response_wrapper( @@ -221,8 +222,8 @@ def __init__(self, miscategorizations: AsyncMiscategorizations) -> None: ) -class MiscategorizationsWithStreamingResponse: - def __init__(self, miscategorizations: Miscategorizations) -> None: +class MiscategorizationsResourceWithStreamingResponse: + def __init__(self, miscategorizations: MiscategorizationsResource) -> None: self._miscategorizations = miscategorizations self.create = to_streamed_response_wrapper( @@ -230,8 +231,8 @@ def __init__(self, miscategorizations: Miscategorizations) -> None: ) -class AsyncMiscategorizationsWithStreamingResponse: - def __init__(self, miscategorizations: AsyncMiscategorizations) -> None: +class AsyncMiscategorizationsResourceWithStreamingResponse: + def __init__(self, miscategorizations: AsyncMiscategorizationsResource) -> None: self._miscategorizations = miscategorizations self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/sinkholes.py b/src/cloudflare/resources/intel/sinkholes.py index ecd8c6c8e4e..39757a98044 100644 --- a/src/cloudflare/resources/intel/sinkholes.py +++ b/src/cloudflare/resources/intel/sinkholes.py @@ -14,23 +14,23 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncSinglePage, AsyncSinglePage -from ...types.intel import IntelSinkholeItem from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.intel.sinkhole import Sinkhole -__all__ = ["Sinkholes", "AsyncSinkholes"] +__all__ = ["SinkholesResource", "AsyncSinkholesResource"] -class Sinkholes(SyncAPIResource): +class SinkholesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SinkholesWithRawResponse: - return SinkholesWithRawResponse(self) + def with_raw_response(self) -> SinkholesResourceWithRawResponse: + return SinkholesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SinkholesWithStreamingResponse: - return SinkholesWithStreamingResponse(self) + def with_streaming_response(self) -> SinkholesResourceWithStreamingResponse: + return SinkholesResourceWithStreamingResponse(self) def list( self, @@ -42,7 +42,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[IntelSinkholeItem]: + ) -> SyncSinglePage[Sinkhole]: """ List sinkholes owned by this account @@ -61,22 +61,22 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/intel/sinkholes", - page=SyncSinglePage[IntelSinkholeItem], + page=SyncSinglePage[Sinkhole], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=IntelSinkholeItem, + model=Sinkhole, ) -class AsyncSinkholes(AsyncAPIResource): +class AsyncSinkholesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSinkholesWithRawResponse: - return AsyncSinkholesWithRawResponse(self) + def with_raw_response(self) -> AsyncSinkholesResourceWithRawResponse: + return AsyncSinkholesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSinkholesWithStreamingResponse: - return AsyncSinkholesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSinkholesResourceWithStreamingResponse: + return AsyncSinkholesResourceWithStreamingResponse(self) def list( self, @@ -88,7 +88,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[IntelSinkholeItem, AsyncSinglePage[IntelSinkholeItem]]: + ) -> AsyncPaginator[Sinkhole, AsyncSinglePage[Sinkhole]]: """ List sinkholes owned by this account @@ -107,16 +107,16 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/intel/sinkholes", - page=AsyncSinglePage[IntelSinkholeItem], + page=AsyncSinglePage[Sinkhole], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=IntelSinkholeItem, + model=Sinkhole, ) -class SinkholesWithRawResponse: - def __init__(self, sinkholes: Sinkholes) -> None: +class SinkholesResourceWithRawResponse: + def __init__(self, sinkholes: SinkholesResource) -> None: self._sinkholes = sinkholes self.list = to_raw_response_wrapper( @@ -124,8 +124,8 @@ def __init__(self, sinkholes: Sinkholes) -> None: ) -class AsyncSinkholesWithRawResponse: - def __init__(self, sinkholes: AsyncSinkholes) -> None: +class AsyncSinkholesResourceWithRawResponse: + def __init__(self, sinkholes: AsyncSinkholesResource) -> None: self._sinkholes = sinkholes self.list = async_to_raw_response_wrapper( @@ -133,8 +133,8 @@ def __init__(self, sinkholes: AsyncSinkholes) -> None: ) -class SinkholesWithStreamingResponse: - def __init__(self, sinkholes: Sinkholes) -> None: +class SinkholesResourceWithStreamingResponse: + def __init__(self, sinkholes: SinkholesResource) -> None: self._sinkholes = sinkholes self.list = to_streamed_response_wrapper( @@ -142,8 +142,8 @@ def __init__(self, sinkholes: Sinkholes) -> None: ) -class AsyncSinkholesWithStreamingResponse: - def __init__(self, sinkholes: AsyncSinkholes) -> None: +class AsyncSinkholesResourceWithStreamingResponse: + def __init__(self, sinkholes: AsyncSinkholesResource) -> None: self._sinkholes = sinkholes self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/intel/whois.py b/src/cloudflare/resources/intel/whois.py index 01ed43b6f03..570d37b6095 100644 --- a/src/cloudflare/resources/intel/whois.py +++ b/src/cloudflare/resources/intel/whois.py @@ -20,22 +20,23 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.intel import IntelWhois, whois_get_params +from ...types.intel import whois_get_params from ..._base_client import ( make_request_options, ) +from ...types.intel.whois import Whois -__all__ = ["Whois", "AsyncWhois"] +__all__ = ["WhoisResource", "AsyncWhoisResource"] -class Whois(SyncAPIResource): +class WhoisResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WhoisWithRawResponse: - return WhoisWithRawResponse(self) + def with_raw_response(self) -> WhoisResourceWithRawResponse: + return WhoisResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WhoisWithStreamingResponse: - return WhoisWithStreamingResponse(self) + def with_streaming_response(self) -> WhoisResourceWithStreamingResponse: + return WhoisResourceWithStreamingResponse(self) def get( self, @@ -48,7 +49,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelWhois: + ) -> Whois: """ Get WHOIS Record @@ -73,20 +74,20 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Whois]._unwrapper, ), - cast_to=cast(Type[IntelWhois], ResultWrapper[IntelWhois]), + cast_to=cast(Type[Whois], ResultWrapper[Whois]), ) -class AsyncWhois(AsyncAPIResource): +class AsyncWhoisResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWhoisWithRawResponse: - return AsyncWhoisWithRawResponse(self) + def with_raw_response(self) -> AsyncWhoisResourceWithRawResponse: + return AsyncWhoisResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWhoisWithStreamingResponse: - return AsyncWhoisWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWhoisResourceWithStreamingResponse: + return AsyncWhoisResourceWithStreamingResponse(self) async def get( self, @@ -99,7 +100,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelWhois: + ) -> Whois: """ Get WHOIS Record @@ -124,14 +125,14 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Whois]._unwrapper, ), - cast_to=cast(Type[IntelWhois], ResultWrapper[IntelWhois]), + cast_to=cast(Type[Whois], ResultWrapper[Whois]), ) -class WhoisWithRawResponse: - def __init__(self, whois: Whois) -> None: +class WhoisResourceWithRawResponse: + def __init__(self, whois: WhoisResource) -> None: self._whois = whois self.get = to_raw_response_wrapper( @@ -139,8 +140,8 @@ def __init__(self, whois: Whois) -> None: ) -class AsyncWhoisWithRawResponse: - def __init__(self, whois: AsyncWhois) -> None: +class AsyncWhoisResourceWithRawResponse: + def __init__(self, whois: AsyncWhoisResource) -> None: self._whois = whois self.get = async_to_raw_response_wrapper( @@ -148,8 +149,8 @@ def __init__(self, whois: AsyncWhois) -> None: ) -class WhoisWithStreamingResponse: - def __init__(self, whois: Whois) -> None: +class WhoisResourceWithStreamingResponse: + def __init__(self, whois: WhoisResource) -> None: self._whois = whois self.get = to_streamed_response_wrapper( @@ -157,8 +158,8 @@ def __init__(self, whois: Whois) -> None: ) -class AsyncWhoisWithStreamingResponse: - def __init__(self, whois: AsyncWhois) -> None: +class AsyncWhoisResourceWithStreamingResponse: + def __init__(self, whois: AsyncWhoisResource) -> None: self._whois = whois self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/ips.py b/src/cloudflare/resources/ips.py index 136d48aaf80..c5d99f25d6b 100644 --- a/src/cloudflare/resources/ips.py +++ b/src/cloudflare/resources/ips.py @@ -2,11 +2,10 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx -from ..types import IPListResponse, ip_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -21,21 +20,23 @@ async_to_streamed_response_wrapper, ) from .._wrappers import ResultWrapper +from ..types.ips import ip_list_params from .._base_client import ( make_request_options, ) +from ..types.ips.ip_list_response import IPListResponse -__all__ = ["IPs", "AsyncIPs"] +__all__ = ["IPsResource", "AsyncIPsResource"] -class IPs(SyncAPIResource): +class IPsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPsWithRawResponse: - return IPsWithRawResponse(self) + def with_raw_response(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPsWithStreamingResponse: - return IPsWithStreamingResponse(self) + def with_streaming_response(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self) def list( self, @@ -47,7 +48,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPListResponse: + ) -> Optional[IPListResponse]: """ Get IPs used on the Cloudflare/JD Cloud network, see https://www.cloudflare.com/ips for Cloudflare IPs or @@ -66,7 +67,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return cast( - IPListResponse, + Optional[IPListResponse], self._get( "/ips", options=make_request_options( @@ -75,7 +76,7 @@ def list( extra_body=extra_body, timeout=timeout, query=maybe_transform({"networks": networks}, ip_list_params.IPListParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPListResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IPListResponse] @@ -84,14 +85,14 @@ def list( ) -class AsyncIPs(AsyncAPIResource): +class AsyncIPsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPsWithRawResponse: - return AsyncIPsWithRawResponse(self) + def with_raw_response(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPsWithStreamingResponse: - return AsyncIPsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self) async def list( self, @@ -103,7 +104,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPListResponse: + ) -> Optional[IPListResponse]: """ Get IPs used on the Cloudflare/JD Cloud network, see https://www.cloudflare.com/ips for Cloudflare IPs or @@ -122,7 +123,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return cast( - IPListResponse, + Optional[IPListResponse], await self._get( "/ips", options=make_request_options( @@ -131,7 +132,7 @@ async def list( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"networks": networks}, ip_list_params.IPListParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPListResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IPListResponse] @@ -140,8 +141,8 @@ async def list( ) -class IPsWithRawResponse: - def __init__(self, ips: IPs) -> None: +class IPsResourceWithRawResponse: + def __init__(self, ips: IPsResource) -> None: self._ips = ips self.list = to_raw_response_wrapper( @@ -149,8 +150,8 @@ def __init__(self, ips: IPs) -> None: ) -class AsyncIPsWithRawResponse: - def __init__(self, ips: AsyncIPs) -> None: +class AsyncIPsResourceWithRawResponse: + def __init__(self, ips: AsyncIPsResource) -> None: self._ips = ips self.list = async_to_raw_response_wrapper( @@ -158,8 +159,8 @@ def __init__(self, ips: AsyncIPs) -> None: ) -class IPsWithStreamingResponse: - def __init__(self, ips: IPs) -> None: +class IPsResourceWithStreamingResponse: + def __init__(self, ips: IPsResource) -> None: self._ips = ips self.list = to_streamed_response_wrapper( @@ -167,8 +168,8 @@ def __init__(self, ips: IPs) -> None: ) -class AsyncIPsWithStreamingResponse: - def __init__(self, ips: AsyncIPs) -> None: +class AsyncIPsResourceWithStreamingResponse: + def __init__(self, ips: AsyncIPsResource) -> None: self._ips = ips self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/keyless_certificates.py b/src/cloudflare/resources/keyless_certificates.py index 8fc10fd3d1e..9f805b11e3e 100644 --- a/src/cloudflare/resources/keyless_certificates.py +++ b/src/cloudflare/resources/keyless_certificates.py @@ -3,16 +3,9 @@ from __future__ import annotations from typing import Type, cast -from typing_extensions import Literal import httpx -from ..types import ( - KeylessCertificateHostname, - KeylessCertificateDeleteResponse, - keyless_certificate_edit_params, - keyless_certificate_create_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -32,18 +25,28 @@ AsyncPaginator, make_request_options, ) +from ..types.custom_hostnames import BundleMethod +from ..types.keyless_certificates import ( + keyless_certificate_edit_params, + keyless_certificate_create_params, + keyless_certificate_delete_params, +) +from ..types.custom_hostnames.bundle_method import BundleMethod +from ..types.keyless_certificates.tunnel_param import TunnelParam +from ..types.keyless_certificates.keyless_certificate import KeylessCertificate +from ..types.keyless_certificates.keyless_certificate_delete_response import KeylessCertificateDeleteResponse -__all__ = ["KeylessCertificates", "AsyncKeylessCertificates"] +__all__ = ["KeylessCertificatesResource", "AsyncKeylessCertificatesResource"] -class KeylessCertificates(SyncAPIResource): +class KeylessCertificatesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> KeylessCertificatesWithRawResponse: - return KeylessCertificatesWithRawResponse(self) + def with_raw_response(self) -> KeylessCertificatesResourceWithRawResponse: + return KeylessCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> KeylessCertificatesWithStreamingResponse: - return KeylessCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> KeylessCertificatesResourceWithStreamingResponse: + return KeylessCertificatesResourceWithStreamingResponse(self) def create( self, @@ -52,16 +55,16 @@ def create( certificate: str, host: str, port: float, - bundle_method: Literal["ubiquitous", "optimal", "force"] | NotGiven = NOT_GIVEN, + bundle_method: BundleMethod | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - tunnel: keyless_certificate_create_params.Tunnel | NotGiven = NOT_GIVEN, + tunnel: TunnelParam | 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, - ) -> KeylessCertificateHostname: + ) -> KeylessCertificate: """ Create Keyless SSL Configuration @@ -112,9 +115,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeylessCertificate]._unwrapper, ), - cast_to=cast(Type[KeylessCertificateHostname], ResultWrapper[KeylessCertificateHostname]), + cast_to=cast(Type[KeylessCertificate], ResultWrapper[KeylessCertificate]), ) def list( @@ -127,7 +130,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[KeylessCertificateHostname]: + ) -> SyncSinglePage[KeylessCertificate]: """ List all Keyless SSL configurations for a given zone. @@ -146,11 +149,11 @@ 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}/keyless_certificates", - page=SyncSinglePage[KeylessCertificateHostname], + page=SyncSinglePage[KeylessCertificate], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=KeylessCertificateHostname, + model=KeylessCertificate, ) def delete( @@ -158,6 +161,7 @@ def delete( keyless_certificate_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -189,12 +193,13 @@ def delete( ) return self._delete( f"/zones/{zone_id}/keyless_certificates/{keyless_certificate_id}", + body=maybe_transform(body, keyless_certificate_delete_params.KeylessCertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeylessCertificateDeleteResponse]._unwrapper, ), cast_to=cast(Type[KeylessCertificateDeleteResponse], ResultWrapper[KeylessCertificateDeleteResponse]), ) @@ -208,14 +213,14 @@ def edit( host: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, port: float | NotGiven = NOT_GIVEN, - tunnel: keyless_certificate_edit_params.Tunnel | NotGiven = NOT_GIVEN, + tunnel: TunnelParam | 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, - ) -> KeylessCertificateHostname: + ) -> KeylessCertificate: """This will update attributes of a Keyless SSL. Consists of one or more of the @@ -268,9 +273,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeylessCertificate]._unwrapper, ), - cast_to=cast(Type[KeylessCertificateHostname], ResultWrapper[KeylessCertificateHostname]), + cast_to=cast(Type[KeylessCertificate], ResultWrapper[KeylessCertificate]), ) def get( @@ -284,7 +289,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeylessCertificateHostname: + ) -> KeylessCertificate: """ Get details for one Keyless SSL configuration. @@ -314,20 +319,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeylessCertificate]._unwrapper, ), - cast_to=cast(Type[KeylessCertificateHostname], ResultWrapper[KeylessCertificateHostname]), + cast_to=cast(Type[KeylessCertificate], ResultWrapper[KeylessCertificate]), ) -class AsyncKeylessCertificates(AsyncAPIResource): +class AsyncKeylessCertificatesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncKeylessCertificatesWithRawResponse: - return AsyncKeylessCertificatesWithRawResponse(self) + def with_raw_response(self) -> AsyncKeylessCertificatesResourceWithRawResponse: + return AsyncKeylessCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncKeylessCertificatesWithStreamingResponse: - return AsyncKeylessCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncKeylessCertificatesResourceWithStreamingResponse: + return AsyncKeylessCertificatesResourceWithStreamingResponse(self) async def create( self, @@ -336,16 +341,16 @@ async def create( certificate: str, host: str, port: float, - bundle_method: Literal["ubiquitous", "optimal", "force"] | NotGiven = NOT_GIVEN, + bundle_method: BundleMethod | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - tunnel: keyless_certificate_create_params.Tunnel | NotGiven = NOT_GIVEN, + tunnel: TunnelParam | 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, - ) -> KeylessCertificateHostname: + ) -> KeylessCertificate: """ Create Keyless SSL Configuration @@ -396,9 +401,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeylessCertificate]._unwrapper, ), - cast_to=cast(Type[KeylessCertificateHostname], ResultWrapper[KeylessCertificateHostname]), + cast_to=cast(Type[KeylessCertificate], ResultWrapper[KeylessCertificate]), ) def list( @@ -411,7 +416,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[KeylessCertificateHostname, AsyncSinglePage[KeylessCertificateHostname]]: + ) -> AsyncPaginator[KeylessCertificate, AsyncSinglePage[KeylessCertificate]]: """ List all Keyless SSL configurations for a given zone. @@ -430,11 +435,11 @@ 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}/keyless_certificates", - page=AsyncSinglePage[KeylessCertificateHostname], + page=AsyncSinglePage[KeylessCertificate], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=KeylessCertificateHostname, + model=KeylessCertificate, ) async def delete( @@ -442,6 +447,7 @@ async def delete( keyless_certificate_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -473,12 +479,13 @@ async def delete( ) return await self._delete( f"/zones/{zone_id}/keyless_certificates/{keyless_certificate_id}", + body=await async_maybe_transform(body, keyless_certificate_delete_params.KeylessCertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeylessCertificateDeleteResponse]._unwrapper, ), cast_to=cast(Type[KeylessCertificateDeleteResponse], ResultWrapper[KeylessCertificateDeleteResponse]), ) @@ -492,14 +499,14 @@ async def edit( host: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, port: float | NotGiven = NOT_GIVEN, - tunnel: keyless_certificate_edit_params.Tunnel | NotGiven = NOT_GIVEN, + tunnel: TunnelParam | 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, - ) -> KeylessCertificateHostname: + ) -> KeylessCertificate: """This will update attributes of a Keyless SSL. Consists of one or more of the @@ -552,9 +559,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeylessCertificate]._unwrapper, ), - cast_to=cast(Type[KeylessCertificateHostname], ResultWrapper[KeylessCertificateHostname]), + cast_to=cast(Type[KeylessCertificate], ResultWrapper[KeylessCertificate]), ) async def get( @@ -568,7 +575,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeylessCertificateHostname: + ) -> KeylessCertificate: """ Get details for one Keyless SSL configuration. @@ -598,14 +605,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[KeylessCertificate]._unwrapper, ), - cast_to=cast(Type[KeylessCertificateHostname], ResultWrapper[KeylessCertificateHostname]), + cast_to=cast(Type[KeylessCertificate], ResultWrapper[KeylessCertificate]), ) -class KeylessCertificatesWithRawResponse: - def __init__(self, keyless_certificates: KeylessCertificates) -> None: +class KeylessCertificatesResourceWithRawResponse: + def __init__(self, keyless_certificates: KeylessCertificatesResource) -> None: self._keyless_certificates = keyless_certificates self.create = to_raw_response_wrapper( @@ -625,8 +632,8 @@ def __init__(self, keyless_certificates: KeylessCertificates) -> None: ) -class AsyncKeylessCertificatesWithRawResponse: - def __init__(self, keyless_certificates: AsyncKeylessCertificates) -> None: +class AsyncKeylessCertificatesResourceWithRawResponse: + def __init__(self, keyless_certificates: AsyncKeylessCertificatesResource) -> None: self._keyless_certificates = keyless_certificates self.create = async_to_raw_response_wrapper( @@ -646,8 +653,8 @@ def __init__(self, keyless_certificates: AsyncKeylessCertificates) -> None: ) -class KeylessCertificatesWithStreamingResponse: - def __init__(self, keyless_certificates: KeylessCertificates) -> None: +class KeylessCertificatesResourceWithStreamingResponse: + def __init__(self, keyless_certificates: KeylessCertificatesResource) -> None: self._keyless_certificates = keyless_certificates self.create = to_streamed_response_wrapper( @@ -667,8 +674,8 @@ def __init__(self, keyless_certificates: KeylessCertificates) -> None: ) -class AsyncKeylessCertificatesWithStreamingResponse: - def __init__(self, keyless_certificates: AsyncKeylessCertificates) -> None: +class AsyncKeylessCertificatesResourceWithStreamingResponse: + def __init__(self, keyless_certificates: AsyncKeylessCertificatesResource) -> None: self._keyless_certificates = keyless_certificates self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/kv/__init__.py b/src/cloudflare/resources/kv/__init__.py index 142fba07f20..e79d23bddee 100644 --- a/src/cloudflare/resources/kv/__init__.py +++ b/src/cloudflare/resources/kv/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .kv import ( - KV, - AsyncKV, - KVWithRawResponse, - AsyncKVWithRawResponse, - KVWithStreamingResponse, - AsyncKVWithStreamingResponse, + KVResource, + AsyncKVResource, + KVResourceWithRawResponse, + AsyncKVResourceWithRawResponse, + KVResourceWithStreamingResponse, + AsyncKVResourceWithStreamingResponse, ) from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) __all__ = [ - "Namespaces", - "AsyncNamespaces", - "NamespacesWithRawResponse", - "AsyncNamespacesWithRawResponse", - "NamespacesWithStreamingResponse", - "AsyncNamespacesWithStreamingResponse", - "KV", - "AsyncKV", - "KVWithRawResponse", - "AsyncKVWithRawResponse", - "KVWithStreamingResponse", - "AsyncKVWithStreamingResponse", + "NamespacesResource", + "AsyncNamespacesResource", + "NamespacesResourceWithRawResponse", + "AsyncNamespacesResourceWithRawResponse", + "NamespacesResourceWithStreamingResponse", + "AsyncNamespacesResourceWithStreamingResponse", + "KVResource", + "AsyncKVResource", + "KVResourceWithRawResponse", + "AsyncKVResourceWithRawResponse", + "KVResourceWithStreamingResponse", + "AsyncKVResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/kv/kv.py b/src/cloudflare/resources/kv/kv.py index 5ac3bd8ee07..4adb24ff8f6 100644 --- a/src/cloudflare/resources/kv/kv.py +++ b/src/cloudflare/resources/kv/kv.py @@ -4,78 +4,78 @@ from ..._compat import cached_property from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .namespaces.namespaces import Namespaces, AsyncNamespaces +from .namespaces.namespaces import NamespacesResource, AsyncNamespacesResource -__all__ = ["KV", "AsyncKV"] +__all__ = ["KVResource", "AsyncKVResource"] -class KV(SyncAPIResource): +class KVResource(SyncAPIResource): @cached_property - def namespaces(self) -> Namespaces: - return Namespaces(self._client) + def namespaces(self) -> NamespacesResource: + return NamespacesResource(self._client) @cached_property - def with_raw_response(self) -> KVWithRawResponse: - return KVWithRawResponse(self) + def with_raw_response(self) -> KVResourceWithRawResponse: + return KVResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> KVWithStreamingResponse: - return KVWithStreamingResponse(self) + def with_streaming_response(self) -> KVResourceWithStreamingResponse: + return KVResourceWithStreamingResponse(self) -class AsyncKV(AsyncAPIResource): +class AsyncKVResource(AsyncAPIResource): @cached_property - def namespaces(self) -> AsyncNamespaces: - return AsyncNamespaces(self._client) + def namespaces(self) -> AsyncNamespacesResource: + return AsyncNamespacesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncKVWithRawResponse: - return AsyncKVWithRawResponse(self) + def with_raw_response(self) -> AsyncKVResourceWithRawResponse: + return AsyncKVResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncKVWithStreamingResponse: - return AsyncKVWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncKVResourceWithStreamingResponse: + return AsyncKVResourceWithStreamingResponse(self) -class KVWithRawResponse: - def __init__(self, kv: KV) -> None: +class KVResourceWithRawResponse: + def __init__(self, kv: KVResource) -> None: self._kv = kv @cached_property - def namespaces(self) -> NamespacesWithRawResponse: - return NamespacesWithRawResponse(self._kv.namespaces) + def namespaces(self) -> NamespacesResourceWithRawResponse: + return NamespacesResourceWithRawResponse(self._kv.namespaces) -class AsyncKVWithRawResponse: - def __init__(self, kv: AsyncKV) -> None: +class AsyncKVResourceWithRawResponse: + def __init__(self, kv: AsyncKVResource) -> None: self._kv = kv @cached_property - def namespaces(self) -> AsyncNamespacesWithRawResponse: - return AsyncNamespacesWithRawResponse(self._kv.namespaces) + def namespaces(self) -> AsyncNamespacesResourceWithRawResponse: + return AsyncNamespacesResourceWithRawResponse(self._kv.namespaces) -class KVWithStreamingResponse: - def __init__(self, kv: KV) -> None: +class KVResourceWithStreamingResponse: + def __init__(self, kv: KVResource) -> None: self._kv = kv @cached_property - def namespaces(self) -> NamespacesWithStreamingResponse: - return NamespacesWithStreamingResponse(self._kv.namespaces) + def namespaces(self) -> NamespacesResourceWithStreamingResponse: + return NamespacesResourceWithStreamingResponse(self._kv.namespaces) -class AsyncKVWithStreamingResponse: - def __init__(self, kv: AsyncKV) -> None: +class AsyncKVResourceWithStreamingResponse: + def __init__(self, kv: AsyncKVResource) -> None: self._kv = kv @cached_property - def namespaces(self) -> AsyncNamespacesWithStreamingResponse: - return AsyncNamespacesWithStreamingResponse(self._kv.namespaces) + def namespaces(self) -> AsyncNamespacesResourceWithStreamingResponse: + return AsyncNamespacesResourceWithStreamingResponse(self._kv.namespaces) diff --git a/src/cloudflare/resources/kv/namespaces/__init__.py b/src/cloudflare/resources/kv/namespaces/__init__.py index 6bf42263da9..0784dbb3103 100644 --- a/src/cloudflare/resources/kv/namespaces/__init__.py +++ b/src/cloudflare/resources/kv/namespaces/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .bulk import ( - Bulk, - AsyncBulk, - BulkWithRawResponse, - AsyncBulkWithRawResponse, - BulkWithStreamingResponse, - AsyncBulkWithStreamingResponse, + BulkResource, + AsyncBulkResource, + BulkResourceWithRawResponse, + AsyncBulkResourceWithRawResponse, + BulkResourceWithStreamingResponse, + AsyncBulkResourceWithStreamingResponse, ) from .keys import ( - Keys, - AsyncKeys, - KeysWithRawResponse, - AsyncKeysWithRawResponse, - KeysWithStreamingResponse, - AsyncKeysWithStreamingResponse, + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, ) from .values import ( - Values, - AsyncValues, - ValuesWithRawResponse, - AsyncValuesWithRawResponse, - ValuesWithStreamingResponse, - AsyncValuesWithStreamingResponse, + ValuesResource, + AsyncValuesResource, + ValuesResourceWithRawResponse, + AsyncValuesResourceWithRawResponse, + ValuesResourceWithStreamingResponse, + AsyncValuesResourceWithStreamingResponse, ) from .metadata import ( - Metadata, - AsyncMetadata, - MetadataWithRawResponse, - AsyncMetadataWithRawResponse, - MetadataWithStreamingResponse, - AsyncMetadataWithStreamingResponse, + MetadataResource, + AsyncMetadataResource, + MetadataResourceWithRawResponse, + AsyncMetadataResourceWithRawResponse, + MetadataResourceWithStreamingResponse, + AsyncMetadataResourceWithStreamingResponse, ) from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) __all__ = [ - "Bulk", - "AsyncBulk", - "BulkWithRawResponse", - "AsyncBulkWithRawResponse", - "BulkWithStreamingResponse", - "AsyncBulkWithStreamingResponse", - "Keys", - "AsyncKeys", - "KeysWithRawResponse", - "AsyncKeysWithRawResponse", - "KeysWithStreamingResponse", - "AsyncKeysWithStreamingResponse", - "Metadata", - "AsyncMetadata", - "MetadataWithRawResponse", - "AsyncMetadataWithRawResponse", - "MetadataWithStreamingResponse", - "AsyncMetadataWithStreamingResponse", - "Values", - "AsyncValues", - "ValuesWithRawResponse", - "AsyncValuesWithRawResponse", - "ValuesWithStreamingResponse", - "AsyncValuesWithStreamingResponse", - "Namespaces", - "AsyncNamespaces", - "NamespacesWithRawResponse", - "AsyncNamespacesWithRawResponse", - "NamespacesWithStreamingResponse", - "AsyncNamespacesWithStreamingResponse", + "BulkResource", + "AsyncBulkResource", + "BulkResourceWithRawResponse", + "AsyncBulkResourceWithRawResponse", + "BulkResourceWithStreamingResponse", + "AsyncBulkResourceWithStreamingResponse", + "KeysResource", + "AsyncKeysResource", + "KeysResourceWithRawResponse", + "AsyncKeysResourceWithRawResponse", + "KeysResourceWithStreamingResponse", + "AsyncKeysResourceWithStreamingResponse", + "MetadataResource", + "AsyncMetadataResource", + "MetadataResourceWithRawResponse", + "AsyncMetadataResourceWithRawResponse", + "MetadataResourceWithStreamingResponse", + "AsyncMetadataResourceWithStreamingResponse", + "ValuesResource", + "AsyncValuesResource", + "ValuesResourceWithRawResponse", + "AsyncValuesResourceWithRawResponse", + "ValuesResourceWithStreamingResponse", + "AsyncValuesResourceWithStreamingResponse", + "NamespacesResource", + "AsyncNamespacesResource", + "NamespacesResourceWithRawResponse", + "AsyncNamespacesResourceWithRawResponse", + "NamespacesResourceWithStreamingResponse", + "AsyncNamespacesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/kv/namespaces/bulk.py b/src/cloudflare/resources/kv/namespaces/bulk.py index 87a61239976..0df5b19e076 100644 --- a/src/cloudflare/resources/kv/namespaces/bulk.py +++ b/src/cloudflare/resources/kv/namespaces/bulk.py @@ -23,19 +23,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.kv.namespaces import BulkDeleteResponse, BulkUpdateResponse, bulk_delete_params, bulk_update_params +from ....types.kv.namespaces import bulk_delete_params, bulk_update_params +from ....types.kv.namespaces.bulk_delete_response import BulkDeleteResponse +from ....types.kv.namespaces.bulk_update_response import BulkUpdateResponse -__all__ = ["Bulk", "AsyncBulk"] +__all__ = ["BulkResource", "AsyncBulkResource"] -class Bulk(SyncAPIResource): +class BulkResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BulkWithRawResponse: - return BulkWithRawResponse(self) + def with_raw_response(self) -> BulkResourceWithRawResponse: + return BulkResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BulkWithStreamingResponse: - return BulkWithStreamingResponse(self) + def with_streaming_response(self) -> BulkResourceWithStreamingResponse: + return BulkResourceWithStreamingResponse(self) def update( self, @@ -86,7 +88,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BulkUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BulkUpdateResponse] @@ -139,7 +141,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BulkDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BulkDeleteResponse] @@ -148,14 +150,14 @@ def delete( ) -class AsyncBulk(AsyncAPIResource): +class AsyncBulkResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBulkWithRawResponse: - return AsyncBulkWithRawResponse(self) + def with_raw_response(self) -> AsyncBulkResourceWithRawResponse: + return AsyncBulkResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBulkWithStreamingResponse: - return AsyncBulkWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBulkResourceWithStreamingResponse: + return AsyncBulkResourceWithStreamingResponse(self) async def update( self, @@ -206,7 +208,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BulkUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BulkUpdateResponse] @@ -259,7 +261,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BulkDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BulkDeleteResponse] @@ -268,8 +270,8 @@ async def delete( ) -class BulkWithRawResponse: - def __init__(self, bulk: Bulk) -> None: +class BulkResourceWithRawResponse: + def __init__(self, bulk: BulkResource) -> None: self._bulk = bulk self.update = to_raw_response_wrapper( @@ -280,8 +282,8 @@ def __init__(self, bulk: Bulk) -> None: ) -class AsyncBulkWithRawResponse: - def __init__(self, bulk: AsyncBulk) -> None: +class AsyncBulkResourceWithRawResponse: + def __init__(self, bulk: AsyncBulkResource) -> None: self._bulk = bulk self.update = async_to_raw_response_wrapper( @@ -292,8 +294,8 @@ def __init__(self, bulk: AsyncBulk) -> None: ) -class BulkWithStreamingResponse: - def __init__(self, bulk: Bulk) -> None: +class BulkResourceWithStreamingResponse: + def __init__(self, bulk: BulkResource) -> None: self._bulk = bulk self.update = to_streamed_response_wrapper( @@ -304,8 +306,8 @@ def __init__(self, bulk: Bulk) -> None: ) -class AsyncBulkWithStreamingResponse: - def __init__(self, bulk: AsyncBulk) -> None: +class AsyncBulkResourceWithStreamingResponse: + def __init__(self, bulk: AsyncBulkResource) -> None: self._bulk = bulk self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/kv/namespaces/keys.py b/src/cloudflare/resources/kv/namespaces/keys.py index 86bc2d6296c..8d8c4ed3727 100644 --- a/src/cloudflare/resources/kv/namespaces/keys.py +++ b/src/cloudflare/resources/kv/namespaces/keys.py @@ -19,19 +19,20 @@ AsyncPaginator, make_request_options, ) -from ....types.kv.namespaces import WorkersKVKey, key_list_params +from ....types.kv.namespaces import key_list_params +from ....types.kv.namespaces.key import Key -__all__ = ["Keys", "AsyncKeys"] +__all__ = ["KeysResource", "AsyncKeysResource"] -class Keys(SyncAPIResource): +class KeysResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> KeysWithRawResponse: - return KeysWithRawResponse(self) + def with_raw_response(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> KeysWithStreamingResponse: - return KeysWithStreamingResponse(self) + def with_streaming_response(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self) def list( self, @@ -47,7 +48,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncCursorLimitPagination[WorkersKVKey]: + ) -> SyncCursorLimitPagination[Key]: """ Lists a namespace's keys. @@ -81,7 +82,7 @@ def list( raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") return self._get_api_list( f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys", - page=SyncCursorLimitPagination[WorkersKVKey], + page=SyncCursorLimitPagination[Key], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -96,18 +97,18 @@ def list( key_list_params.KeyListParams, ), ), - model=WorkersKVKey, + model=Key, ) -class AsyncKeys(AsyncAPIResource): +class AsyncKeysResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncKeysWithRawResponse: - return AsyncKeysWithRawResponse(self) + def with_raw_response(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncKeysWithStreamingResponse: - return AsyncKeysWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self) def list( self, @@ -123,7 +124,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WorkersKVKey, AsyncCursorLimitPagination[WorkersKVKey]]: + ) -> AsyncPaginator[Key, AsyncCursorLimitPagination[Key]]: """ Lists a namespace's keys. @@ -157,7 +158,7 @@ def list( raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") return self._get_api_list( f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys", - page=AsyncCursorLimitPagination[WorkersKVKey], + page=AsyncCursorLimitPagination[Key], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -172,12 +173,12 @@ def list( key_list_params.KeyListParams, ), ), - model=WorkersKVKey, + model=Key, ) -class KeysWithRawResponse: - def __init__(self, keys: Keys) -> None: +class KeysResourceWithRawResponse: + def __init__(self, keys: KeysResource) -> None: self._keys = keys self.list = to_raw_response_wrapper( @@ -185,8 +186,8 @@ def __init__(self, keys: Keys) -> None: ) -class AsyncKeysWithRawResponse: - def __init__(self, keys: AsyncKeys) -> None: +class AsyncKeysResourceWithRawResponse: + def __init__(self, keys: AsyncKeysResource) -> None: self._keys = keys self.list = async_to_raw_response_wrapper( @@ -194,8 +195,8 @@ def __init__(self, keys: AsyncKeys) -> None: ) -class KeysWithStreamingResponse: - def __init__(self, keys: Keys) -> None: +class KeysResourceWithStreamingResponse: + def __init__(self, keys: KeysResource) -> None: self._keys = keys self.list = to_streamed_response_wrapper( @@ -203,8 +204,8 @@ def __init__(self, keys: Keys) -> None: ) -class AsyncKeysWithStreamingResponse: - def __init__(self, keys: AsyncKeys) -> None: +class AsyncKeysResourceWithStreamingResponse: + def __init__(self, keys: AsyncKeysResource) -> None: self._keys = keys self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/kv/namespaces/metadata.py b/src/cloudflare/resources/kv/namespaces/metadata.py index b60d9c3e92d..b9a442c88b0 100644 --- a/src/cloudflare/resources/kv/namespaces/metadata.py +++ b/src/cloudflare/resources/kv/namespaces/metadata.py @@ -20,17 +20,17 @@ make_request_options, ) -__all__ = ["Metadata", "AsyncMetadata"] +__all__ = ["MetadataResource", "AsyncMetadataResource"] -class Metadata(SyncAPIResource): +class MetadataResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MetadataWithRawResponse: - return MetadataWithRawResponse(self) + def with_raw_response(self) -> MetadataResourceWithRawResponse: + return MetadataResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MetadataWithStreamingResponse: - return MetadataWithStreamingResponse(self) + def with_streaming_response(self) -> MetadataResourceWithStreamingResponse: + return MetadataResourceWithStreamingResponse(self) def get( self, @@ -80,20 +80,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) -class AsyncMetadata(AsyncAPIResource): +class AsyncMetadataResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMetadataWithRawResponse: - return AsyncMetadataWithRawResponse(self) + def with_raw_response(self) -> AsyncMetadataResourceWithRawResponse: + return AsyncMetadataResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMetadataWithStreamingResponse: - return AsyncMetadataWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMetadataResourceWithStreamingResponse: + return AsyncMetadataResourceWithStreamingResponse(self) async def get( self, @@ -143,14 +143,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) -class MetadataWithRawResponse: - def __init__(self, metadata: Metadata) -> None: +class MetadataResourceWithRawResponse: + def __init__(self, metadata: MetadataResource) -> None: self._metadata = metadata self.get = to_raw_response_wrapper( @@ -158,8 +158,8 @@ def __init__(self, metadata: Metadata) -> None: ) -class AsyncMetadataWithRawResponse: - def __init__(self, metadata: AsyncMetadata) -> None: +class AsyncMetadataResourceWithRawResponse: + def __init__(self, metadata: AsyncMetadataResource) -> None: self._metadata = metadata self.get = async_to_raw_response_wrapper( @@ -167,8 +167,8 @@ def __init__(self, metadata: AsyncMetadata) -> None: ) -class MetadataWithStreamingResponse: - def __init__(self, metadata: Metadata) -> None: +class MetadataResourceWithStreamingResponse: + def __init__(self, metadata: MetadataResource) -> None: self._metadata = metadata self.get = to_streamed_response_wrapper( @@ -176,8 +176,8 @@ def __init__(self, metadata: Metadata) -> None: ) -class AsyncMetadataWithStreamingResponse: - def __init__(self, metadata: AsyncMetadata) -> None: +class AsyncMetadataResourceWithStreamingResponse: + def __init__(self, metadata: AsyncMetadataResource) -> None: self._metadata = metadata self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/kv/namespaces/namespaces.py b/src/cloudflare/resources/kv/namespaces/namespaces.py index 9c64e5664ba..0eda74e6c1c 100644 --- a/src/cloudflare/resources/kv/namespaces/namespaces.py +++ b/src/cloudflare/resources/kv/namespaces/namespaces.py @@ -8,36 +8,36 @@ import httpx from .bulk import ( - Bulk, - AsyncBulk, - BulkWithRawResponse, - AsyncBulkWithRawResponse, - BulkWithStreamingResponse, - AsyncBulkWithStreamingResponse, + BulkResource, + AsyncBulkResource, + BulkResourceWithRawResponse, + AsyncBulkResourceWithRawResponse, + BulkResourceWithStreamingResponse, + AsyncBulkResourceWithStreamingResponse, ) from .keys import ( - Keys, - AsyncKeys, - KeysWithRawResponse, - AsyncKeysWithRawResponse, - KeysWithStreamingResponse, - AsyncKeysWithStreamingResponse, + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, ) from .values import ( - Values, - AsyncValues, - ValuesWithRawResponse, - AsyncValuesWithRawResponse, - ValuesWithStreamingResponse, - AsyncValuesWithStreamingResponse, + ValuesResource, + AsyncValuesResource, + ValuesResourceWithRawResponse, + AsyncValuesResourceWithRawResponse, + ValuesResourceWithStreamingResponse, + AsyncValuesResourceWithStreamingResponse, ) from .metadata import ( - Metadata, - AsyncMetadata, - MetadataWithRawResponse, - AsyncMetadataWithRawResponse, - MetadataWithStreamingResponse, - AsyncMetadataWithStreamingResponse, + MetadataResource, + AsyncMetadataResource, + MetadataResourceWithRawResponse, + AsyncMetadataResourceWithRawResponse, + MetadataResourceWithStreamingResponse, + AsyncMetadataResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -46,11 +46,9 @@ ) from ...._compat import cached_property from ....types.kv import ( - WorkersKVNamespace, - NamespaceDeleteResponse, - NamespaceUpdateResponse, namespace_list_params, namespace_create_params, + namespace_delete_params, namespace_update_params, ) from ...._resource import SyncAPIResource, AsyncAPIResource @@ -66,34 +64,37 @@ AsyncPaginator, make_request_options, ) +from ....types.kv.namespace import Namespace +from ....types.kv.namespace_delete_response import NamespaceDeleteResponse +from ....types.kv.namespace_update_response import NamespaceUpdateResponse -__all__ = ["Namespaces", "AsyncNamespaces"] +__all__ = ["NamespacesResource", "AsyncNamespacesResource"] -class Namespaces(SyncAPIResource): +class NamespacesResource(SyncAPIResource): @cached_property - def bulk(self) -> Bulk: - return Bulk(self._client) + def bulk(self) -> BulkResource: + return BulkResource(self._client) @cached_property - def keys(self) -> Keys: - return Keys(self._client) + def keys(self) -> KeysResource: + return KeysResource(self._client) @cached_property - def metadata(self) -> Metadata: - return Metadata(self._client) + def metadata(self) -> MetadataResource: + return MetadataResource(self._client) @cached_property - def values(self) -> Values: - return Values(self._client) + def values(self) -> ValuesResource: + return ValuesResource(self._client) @cached_property - def with_raw_response(self) -> NamespacesWithRawResponse: - return NamespacesWithRawResponse(self) + def with_raw_response(self) -> NamespacesResourceWithRawResponse: + return NamespacesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NamespacesWithStreamingResponse: - return NamespacesWithStreamingResponse(self) + def with_streaming_response(self) -> NamespacesResourceWithStreamingResponse: + return NamespacesResourceWithStreamingResponse(self) def create( self, @@ -106,7 +107,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersKVNamespace: + ) -> Namespace: """Creates a namespace under the given title. A `400` is returned if the account @@ -136,9 +137,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Namespace]._unwrapper, ), - cast_to=cast(Type[WorkersKVNamespace], ResultWrapper[WorkersKVNamespace]), + cast_to=cast(Type[Namespace], ResultWrapper[Namespace]), ) def update( @@ -186,7 +187,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[NamespaceUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[NamespaceUpdateResponse] @@ -208,7 +209,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[WorkersKVNamespace]: + ) -> SyncV4PagePaginationArray[Namespace]: """ Returns the namespaces owned by an account. @@ -235,7 +236,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/storage/kv/namespaces", - page=SyncV4PagePaginationArray[WorkersKVNamespace], + page=SyncV4PagePaginationArray[Namespace], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -251,7 +252,7 @@ def list( namespace_list_params.NamespaceListParams, ), ), - model=WorkersKVNamespace, + model=Namespace, ) def delete( @@ -259,6 +260,7 @@ def delete( namespace_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -290,12 +292,13 @@ def delete( NamespaceDeleteResponse, self._delete( f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", + body=maybe_transform(body, namespace_delete_params.NamespaceDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[NamespaceDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[NamespaceDeleteResponse] @@ -304,30 +307,30 @@ def delete( ) -class AsyncNamespaces(AsyncAPIResource): +class AsyncNamespacesResource(AsyncAPIResource): @cached_property - def bulk(self) -> AsyncBulk: - return AsyncBulk(self._client) + def bulk(self) -> AsyncBulkResource: + return AsyncBulkResource(self._client) @cached_property - def keys(self) -> AsyncKeys: - return AsyncKeys(self._client) + def keys(self) -> AsyncKeysResource: + return AsyncKeysResource(self._client) @cached_property - def metadata(self) -> AsyncMetadata: - return AsyncMetadata(self._client) + def metadata(self) -> AsyncMetadataResource: + return AsyncMetadataResource(self._client) @cached_property - def values(self) -> AsyncValues: - return AsyncValues(self._client) + def values(self) -> AsyncValuesResource: + return AsyncValuesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncNamespacesWithRawResponse: - return AsyncNamespacesWithRawResponse(self) + def with_raw_response(self) -> AsyncNamespacesResourceWithRawResponse: + return AsyncNamespacesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNamespacesWithStreamingResponse: - return AsyncNamespacesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNamespacesResourceWithStreamingResponse: + return AsyncNamespacesResourceWithStreamingResponse(self) async def create( self, @@ -340,7 +343,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersKVNamespace: + ) -> Namespace: """Creates a namespace under the given title. A `400` is returned if the account @@ -370,9 +373,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Namespace]._unwrapper, ), - cast_to=cast(Type[WorkersKVNamespace], ResultWrapper[WorkersKVNamespace]), + cast_to=cast(Type[Namespace], ResultWrapper[Namespace]), ) async def update( @@ -420,7 +423,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[NamespaceUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[NamespaceUpdateResponse] @@ -442,7 +445,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WorkersKVNamespace, AsyncV4PagePaginationArray[WorkersKVNamespace]]: + ) -> AsyncPaginator[Namespace, AsyncV4PagePaginationArray[Namespace]]: """ Returns the namespaces owned by an account. @@ -469,7 +472,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/storage/kv/namespaces", - page=AsyncV4PagePaginationArray[WorkersKVNamespace], + page=AsyncV4PagePaginationArray[Namespace], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -485,7 +488,7 @@ def list( namespace_list_params.NamespaceListParams, ), ), - model=WorkersKVNamespace, + model=Namespace, ) async def delete( @@ -493,6 +496,7 @@ async def delete( namespace_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -524,12 +528,13 @@ async def delete( NamespaceDeleteResponse, await self._delete( f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", + body=await async_maybe_transform(body, namespace_delete_params.NamespaceDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[NamespaceDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[NamespaceDeleteResponse] @@ -538,8 +543,8 @@ async def delete( ) -class NamespacesWithRawResponse: - def __init__(self, namespaces: Namespaces) -> None: +class NamespacesResourceWithRawResponse: + def __init__(self, namespaces: NamespacesResource) -> None: self._namespaces = namespaces self.create = to_raw_response_wrapper( @@ -556,24 +561,24 @@ def __init__(self, namespaces: Namespaces) -> None: ) @cached_property - def bulk(self) -> BulkWithRawResponse: - return BulkWithRawResponse(self._namespaces.bulk) + def bulk(self) -> BulkResourceWithRawResponse: + return BulkResourceWithRawResponse(self._namespaces.bulk) @cached_property - def keys(self) -> KeysWithRawResponse: - return KeysWithRawResponse(self._namespaces.keys) + def keys(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self._namespaces.keys) @cached_property - def metadata(self) -> MetadataWithRawResponse: - return MetadataWithRawResponse(self._namespaces.metadata) + def metadata(self) -> MetadataResourceWithRawResponse: + return MetadataResourceWithRawResponse(self._namespaces.metadata) @cached_property - def values(self) -> ValuesWithRawResponse: - return ValuesWithRawResponse(self._namespaces.values) + def values(self) -> ValuesResourceWithRawResponse: + return ValuesResourceWithRawResponse(self._namespaces.values) -class AsyncNamespacesWithRawResponse: - def __init__(self, namespaces: AsyncNamespaces) -> None: +class AsyncNamespacesResourceWithRawResponse: + def __init__(self, namespaces: AsyncNamespacesResource) -> None: self._namespaces = namespaces self.create = async_to_raw_response_wrapper( @@ -590,24 +595,24 @@ def __init__(self, namespaces: AsyncNamespaces) -> None: ) @cached_property - def bulk(self) -> AsyncBulkWithRawResponse: - return AsyncBulkWithRawResponse(self._namespaces.bulk) + def bulk(self) -> AsyncBulkResourceWithRawResponse: + return AsyncBulkResourceWithRawResponse(self._namespaces.bulk) @cached_property - def keys(self) -> AsyncKeysWithRawResponse: - return AsyncKeysWithRawResponse(self._namespaces.keys) + def keys(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self._namespaces.keys) @cached_property - def metadata(self) -> AsyncMetadataWithRawResponse: - return AsyncMetadataWithRawResponse(self._namespaces.metadata) + def metadata(self) -> AsyncMetadataResourceWithRawResponse: + return AsyncMetadataResourceWithRawResponse(self._namespaces.metadata) @cached_property - def values(self) -> AsyncValuesWithRawResponse: - return AsyncValuesWithRawResponse(self._namespaces.values) + def values(self) -> AsyncValuesResourceWithRawResponse: + return AsyncValuesResourceWithRawResponse(self._namespaces.values) -class NamespacesWithStreamingResponse: - def __init__(self, namespaces: Namespaces) -> None: +class NamespacesResourceWithStreamingResponse: + def __init__(self, namespaces: NamespacesResource) -> None: self._namespaces = namespaces self.create = to_streamed_response_wrapper( @@ -624,24 +629,24 @@ def __init__(self, namespaces: Namespaces) -> None: ) @cached_property - def bulk(self) -> BulkWithStreamingResponse: - return BulkWithStreamingResponse(self._namespaces.bulk) + def bulk(self) -> BulkResourceWithStreamingResponse: + return BulkResourceWithStreamingResponse(self._namespaces.bulk) @cached_property - def keys(self) -> KeysWithStreamingResponse: - return KeysWithStreamingResponse(self._namespaces.keys) + def keys(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self._namespaces.keys) @cached_property - def metadata(self) -> MetadataWithStreamingResponse: - return MetadataWithStreamingResponse(self._namespaces.metadata) + def metadata(self) -> MetadataResourceWithStreamingResponse: + return MetadataResourceWithStreamingResponse(self._namespaces.metadata) @cached_property - def values(self) -> ValuesWithStreamingResponse: - return ValuesWithStreamingResponse(self._namespaces.values) + def values(self) -> ValuesResourceWithStreamingResponse: + return ValuesResourceWithStreamingResponse(self._namespaces.values) -class AsyncNamespacesWithStreamingResponse: - def __init__(self, namespaces: AsyncNamespaces) -> None: +class AsyncNamespacesResourceWithStreamingResponse: + def __init__(self, namespaces: AsyncNamespacesResource) -> None: self._namespaces = namespaces self.create = async_to_streamed_response_wrapper( @@ -658,17 +663,17 @@ def __init__(self, namespaces: AsyncNamespaces) -> None: ) @cached_property - def bulk(self) -> AsyncBulkWithStreamingResponse: - return AsyncBulkWithStreamingResponse(self._namespaces.bulk) + def bulk(self) -> AsyncBulkResourceWithStreamingResponse: + return AsyncBulkResourceWithStreamingResponse(self._namespaces.bulk) @cached_property - def keys(self) -> AsyncKeysWithStreamingResponse: - return AsyncKeysWithStreamingResponse(self._namespaces.keys) + def keys(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self._namespaces.keys) @cached_property - def metadata(self) -> AsyncMetadataWithStreamingResponse: - return AsyncMetadataWithStreamingResponse(self._namespaces.metadata) + def metadata(self) -> AsyncMetadataResourceWithStreamingResponse: + return AsyncMetadataResourceWithStreamingResponse(self._namespaces.metadata) @cached_property - def values(self) -> AsyncValuesWithStreamingResponse: - return AsyncValuesWithStreamingResponse(self._namespaces.values) + def values(self) -> AsyncValuesResourceWithStreamingResponse: + return AsyncValuesResourceWithStreamingResponse(self._namespaces.values) diff --git a/src/cloudflare/resources/kv/namespaces/values.py b/src/cloudflare/resources/kv/namespaces/values.py index eae7f2a1ca5..358a679aaf9 100644 --- a/src/cloudflare/resources/kv/namespaces/values.py +++ b/src/cloudflare/resources/kv/namespaces/values.py @@ -23,19 +23,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.kv.namespaces import ValueDeleteResponse, ValueUpdateResponse, value_update_params +from ....types.kv.namespaces import value_delete_params, value_update_params +from ....types.kv.namespaces.value_delete_response import ValueDeleteResponse +from ....types.kv.namespaces.value_update_response import ValueUpdateResponse -__all__ = ["Values", "AsyncValues"] +__all__ = ["ValuesResource", "AsyncValuesResource"] -class Values(SyncAPIResource): +class ValuesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ValuesWithRawResponse: - return ValuesWithRawResponse(self) + def with_raw_response(self) -> ValuesResourceWithRawResponse: + return ValuesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ValuesWithStreamingResponse: - return ValuesWithStreamingResponse(self) + def with_streaming_response(self) -> ValuesResourceWithStreamingResponse: + return ValuesResourceWithStreamingResponse(self) def update( self, @@ -103,7 +105,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ValueUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ValueUpdateResponse] @@ -117,6 +119,7 @@ def delete( *, account_id: str, namespace_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +158,13 @@ def delete( ValueDeleteResponse, self._delete( f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", + body=maybe_transform(body, value_delete_params.ValueDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ValueDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ValueDeleteResponse] @@ -220,14 +224,14 @@ def get( ) -class AsyncValues(AsyncAPIResource): +class AsyncValuesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncValuesWithRawResponse: - return AsyncValuesWithRawResponse(self) + def with_raw_response(self) -> AsyncValuesResourceWithRawResponse: + return AsyncValuesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncValuesWithStreamingResponse: - return AsyncValuesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncValuesResourceWithStreamingResponse: + return AsyncValuesResourceWithStreamingResponse(self) async def update( self, @@ -295,7 +299,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ValueUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ValueUpdateResponse] @@ -309,6 +313,7 @@ async def delete( *, account_id: str, namespace_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -347,12 +352,13 @@ async def delete( ValueDeleteResponse, await self._delete( f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", + body=await async_maybe_transform(body, value_delete_params.ValueDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ValueDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ValueDeleteResponse] @@ -412,8 +418,8 @@ async def get( ) -class ValuesWithRawResponse: - def __init__(self, values: Values) -> None: +class ValuesResourceWithRawResponse: + def __init__(self, values: ValuesResource) -> None: self._values = values self.update = to_raw_response_wrapper( @@ -427,8 +433,8 @@ def __init__(self, values: Values) -> None: ) -class AsyncValuesWithRawResponse: - def __init__(self, values: AsyncValues) -> None: +class AsyncValuesResourceWithRawResponse: + def __init__(self, values: AsyncValuesResource) -> None: self._values = values self.update = async_to_raw_response_wrapper( @@ -442,8 +448,8 @@ def __init__(self, values: AsyncValues) -> None: ) -class ValuesWithStreamingResponse: - def __init__(self, values: Values) -> None: +class ValuesResourceWithStreamingResponse: + def __init__(self, values: ValuesResource) -> None: self._values = values self.update = to_streamed_response_wrapper( @@ -457,8 +463,8 @@ def __init__(self, values: Values) -> None: ) -class AsyncValuesWithStreamingResponse: - def __init__(self, values: AsyncValues) -> None: +class AsyncValuesResourceWithStreamingResponse: + def __init__(self, values: AsyncValuesResource) -> None: self._values = values self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/load_balancers/__init__.py b/src/cloudflare/resources/load_balancers/__init__.py index 07e2eee26a3..a6ca61a9b10 100644 --- a/src/cloudflare/resources/load_balancers/__init__.py +++ b/src/cloudflare/resources/load_balancers/__init__.py @@ -1,89 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .pools import ( - Pools, - AsyncPools, - PoolsWithRawResponse, - AsyncPoolsWithRawResponse, - PoolsWithStreamingResponse, - AsyncPoolsWithStreamingResponse, + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, ) from .regions import ( - Regions, - AsyncRegions, - RegionsWithRawResponse, - AsyncRegionsWithRawResponse, - RegionsWithStreamingResponse, - AsyncRegionsWithStreamingResponse, + RegionsResource, + AsyncRegionsResource, + RegionsResourceWithRawResponse, + AsyncRegionsResourceWithRawResponse, + RegionsResourceWithStreamingResponse, + AsyncRegionsResourceWithStreamingResponse, ) from .monitors import ( - Monitors, - AsyncMonitors, - MonitorsWithRawResponse, - AsyncMonitorsWithRawResponse, - MonitorsWithStreamingResponse, - AsyncMonitorsWithStreamingResponse, + MonitorsResource, + AsyncMonitorsResource, + MonitorsResourceWithRawResponse, + AsyncMonitorsResourceWithRawResponse, + MonitorsResourceWithStreamingResponse, + AsyncMonitorsResourceWithStreamingResponse, ) from .previews import ( - Previews, - AsyncPreviews, - PreviewsWithRawResponse, - AsyncPreviewsWithRawResponse, - PreviewsWithStreamingResponse, - AsyncPreviewsWithStreamingResponse, + PreviewsResource, + AsyncPreviewsResource, + PreviewsResourceWithRawResponse, + AsyncPreviewsResourceWithRawResponse, + PreviewsResourceWithStreamingResponse, + AsyncPreviewsResourceWithStreamingResponse, ) from .searches import ( - Searches, - AsyncSearches, - SearchesWithRawResponse, - AsyncSearchesWithRawResponse, - SearchesWithStreamingResponse, - AsyncSearchesWithStreamingResponse, + SearchesResource, + AsyncSearchesResource, + SearchesResourceWithRawResponse, + AsyncSearchesResourceWithRawResponse, + SearchesResourceWithStreamingResponse, + AsyncSearchesResourceWithStreamingResponse, ) from .load_balancers import ( - LoadBalancers, - AsyncLoadBalancers, - LoadBalancersWithRawResponse, - AsyncLoadBalancersWithRawResponse, - LoadBalancersWithStreamingResponse, - AsyncLoadBalancersWithStreamingResponse, + LoadBalancersResource, + AsyncLoadBalancersResource, + LoadBalancersResourceWithRawResponse, + AsyncLoadBalancersResourceWithRawResponse, + LoadBalancersResourceWithStreamingResponse, + AsyncLoadBalancersResourceWithStreamingResponse, ) __all__ = [ - "Monitors", - "AsyncMonitors", - "MonitorsWithRawResponse", - "AsyncMonitorsWithRawResponse", - "MonitorsWithStreamingResponse", - "AsyncMonitorsWithStreamingResponse", - "Pools", - "AsyncPools", - "PoolsWithRawResponse", - "AsyncPoolsWithRawResponse", - "PoolsWithStreamingResponse", - "AsyncPoolsWithStreamingResponse", - "Previews", - "AsyncPreviews", - "PreviewsWithRawResponse", - "AsyncPreviewsWithRawResponse", - "PreviewsWithStreamingResponse", - "AsyncPreviewsWithStreamingResponse", - "Regions", - "AsyncRegions", - "RegionsWithRawResponse", - "AsyncRegionsWithRawResponse", - "RegionsWithStreamingResponse", - "AsyncRegionsWithStreamingResponse", - "Searches", - "AsyncSearches", - "SearchesWithRawResponse", - "AsyncSearchesWithRawResponse", - "SearchesWithStreamingResponse", - "AsyncSearchesWithStreamingResponse", - "LoadBalancers", - "AsyncLoadBalancers", - "LoadBalancersWithRawResponse", - "AsyncLoadBalancersWithRawResponse", - "LoadBalancersWithStreamingResponse", - "AsyncLoadBalancersWithStreamingResponse", + "MonitorsResource", + "AsyncMonitorsResource", + "MonitorsResourceWithRawResponse", + "AsyncMonitorsResourceWithRawResponse", + "MonitorsResourceWithStreamingResponse", + "AsyncMonitorsResourceWithStreamingResponse", + "PoolsResource", + "AsyncPoolsResource", + "PoolsResourceWithRawResponse", + "AsyncPoolsResourceWithRawResponse", + "PoolsResourceWithStreamingResponse", + "AsyncPoolsResourceWithStreamingResponse", + "PreviewsResource", + "AsyncPreviewsResource", + "PreviewsResourceWithRawResponse", + "AsyncPreviewsResourceWithRawResponse", + "PreviewsResourceWithStreamingResponse", + "AsyncPreviewsResourceWithStreamingResponse", + "RegionsResource", + "AsyncRegionsResource", + "RegionsResourceWithRawResponse", + "AsyncRegionsResourceWithRawResponse", + "RegionsResourceWithStreamingResponse", + "AsyncRegionsResourceWithStreamingResponse", + "SearchesResource", + "AsyncSearchesResource", + "SearchesResourceWithRawResponse", + "AsyncSearchesResourceWithRawResponse", + "SearchesResourceWithStreamingResponse", + "AsyncSearchesResourceWithStreamingResponse", + "LoadBalancersResource", + "AsyncLoadBalancersResource", + "LoadBalancersResourceWithRawResponse", + "AsyncLoadBalancersResourceWithRawResponse", + "LoadBalancersResourceWithStreamingResponse", + "AsyncLoadBalancersResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/load_balancers/load_balancers.py b/src/cloudflare/resources/load_balancers/load_balancers.py index 4216e4e2fe2..829ffadc328 100644 --- a/src/cloudflare/resources/load_balancers/load_balancers.py +++ b/src/cloudflare/resources/load_balancers/load_balancers.py @@ -8,27 +8,20 @@ import httpx from .pools import ( - Pools, - AsyncPools, - PoolsWithRawResponse, - AsyncPoolsWithRawResponse, - PoolsWithStreamingResponse, - AsyncPoolsWithStreamingResponse, -) -from ...types import ( - LoadBalancer, - LoadBalancerDeleteResponse, - load_balancer_edit_params, - load_balancer_create_params, - load_balancer_update_params, + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, ) from .regions import ( - Regions, - AsyncRegions, - RegionsWithRawResponse, - AsyncRegionsWithRawResponse, - RegionsWithStreamingResponse, - AsyncRegionsWithStreamingResponse, + RegionsResource, + AsyncRegionsResource, + RegionsResourceWithRawResponse, + AsyncRegionsResourceWithRawResponse, + RegionsResourceWithStreamingResponse, + AsyncRegionsResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( @@ -36,28 +29,28 @@ async_maybe_transform, ) from .monitors import ( - Monitors, - AsyncMonitors, - MonitorsWithRawResponse, - AsyncMonitorsWithRawResponse, - MonitorsWithStreamingResponse, - AsyncMonitorsWithStreamingResponse, + MonitorsResource, + AsyncMonitorsResource, + MonitorsResourceWithRawResponse, + AsyncMonitorsResourceWithRawResponse, + MonitorsResourceWithStreamingResponse, + AsyncMonitorsResourceWithStreamingResponse, ) from .previews import ( - Previews, - AsyncPreviews, - PreviewsWithRawResponse, - AsyncPreviewsWithRawResponse, - PreviewsWithStreamingResponse, - AsyncPreviewsWithStreamingResponse, + PreviewsResource, + AsyncPreviewsResource, + PreviewsResourceWithRawResponse, + AsyncPreviewsResourceWithRawResponse, + PreviewsResourceWithStreamingResponse, + AsyncPreviewsResourceWithStreamingResponse, ) from .searches import ( - Searches, - AsyncSearches, - SearchesWithRawResponse, - AsyncSearchesWithRawResponse, - SearchesWithStreamingResponse, - AsyncSearchesWithStreamingResponse, + SearchesResource, + AsyncSearchesResource, + SearchesResourceWithRawResponse, + AsyncSearchesResourceWithRawResponse, + SearchesResourceWithStreamingResponse, + AsyncSearchesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -68,64 +61,78 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from .pools.pools import Pools, AsyncPools +from .pools.pools import PoolsResource, AsyncPoolsResource from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( AsyncPaginator, make_request_options, ) -from .monitors.monitors import Monitors, AsyncMonitors +from .monitors.monitors import MonitorsResource, AsyncMonitorsResource +from ...types.load_balancers import ( + load_balancer_edit_params, + load_balancer_create_params, + load_balancer_delete_params, + load_balancer_update_params, +) +from ...types.load_balancers.rules_param import RulesParam +from ...types.load_balancers.default_pools import DefaultPools +from ...types.load_balancers.load_balancer import LoadBalancer +from ...types.load_balancers.random_steering_param import RandomSteeringParam +from ...types.load_balancers.adaptive_routing_param import AdaptiveRoutingParam +from ...types.load_balancers.location_strategy_param import LocationStrategyParam +from ...types.load_balancers.load_balancer_delete_response import LoadBalancerDeleteResponse +from ...types.load_balancers.session_affinity_attributes_param import SessionAffinityAttributesParam -__all__ = ["LoadBalancers", "AsyncLoadBalancers"] +__all__ = ["LoadBalancersResource", "AsyncLoadBalancersResource"] -class LoadBalancers(SyncAPIResource): +class LoadBalancersResource(SyncAPIResource): @cached_property - def monitors(self) -> Monitors: - return Monitors(self._client) + def monitors(self) -> MonitorsResource: + return MonitorsResource(self._client) @cached_property - def pools(self) -> Pools: - return Pools(self._client) + def pools(self) -> PoolsResource: + return PoolsResource(self._client) @cached_property - def previews(self) -> Previews: - return Previews(self._client) + def previews(self) -> PreviewsResource: + return PreviewsResource(self._client) @cached_property - def regions(self) -> Regions: - return Regions(self._client) + def regions(self) -> RegionsResource: + return RegionsResource(self._client) @cached_property - def searches(self) -> Searches: - return Searches(self._client) + def searches(self) -> SearchesResource: + return SearchesResource(self._client) @cached_property - def with_raw_response(self) -> LoadBalancersWithRawResponse: - return LoadBalancersWithRawResponse(self) + def with_raw_response(self) -> LoadBalancersResourceWithRawResponse: + return LoadBalancersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LoadBalancersWithStreamingResponse: - return LoadBalancersWithStreamingResponse(self) + def with_streaming_response(self) -> LoadBalancersResourceWithStreamingResponse: + return LoadBalancersResourceWithStreamingResponse(self) def create( self, *, zone_id: str, - default_pools: List[str], + default_pools: List[DefaultPools], fallback_pool: object, name: str, - adaptive_routing: load_balancer_create_params.AdaptiveRouting | NotGiven = NOT_GIVEN, + adaptive_routing: AdaptiveRoutingParam | NotGiven = NOT_GIVEN, country_pools: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - location_strategy: load_balancer_create_params.LocationStrategy | NotGiven = NOT_GIVEN, + location_strategy: LocationStrategyParam | NotGiven = NOT_GIVEN, pop_pools: object | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - random_steering: load_balancer_create_params.RandomSteering | NotGiven = NOT_GIVEN, + random_steering: RandomSteeringParam | NotGiven = NOT_GIVEN, region_pools: object | NotGiven = NOT_GIVEN, - rules: Iterable[load_balancer_create_params.Rule] | NotGiven = NOT_GIVEN, + rules: Iterable[RulesParam] | NotGiven = NOT_GIVEN, session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] | NotGiven = NOT_GIVEN, - session_affinity_attributes: load_balancer_create_params.SessionAffinityAttributes | NotGiven = NOT_GIVEN, + session_affinity_attributes: SessionAffinityAttributesParam | NotGiven = NOT_GIVEN, session_affinity_ttl: float | NotGiven = NOT_GIVEN, steering_policy: Literal[ "off", @@ -301,7 +308,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancer]._unwrapper, ), cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) @@ -311,21 +318,21 @@ def update( load_balancer_id: str, *, zone_id: str, - default_pools: List[str], + default_pools: List[DefaultPools], fallback_pool: object, name: str, - adaptive_routing: load_balancer_update_params.AdaptiveRouting | NotGiven = NOT_GIVEN, + adaptive_routing: AdaptiveRoutingParam | NotGiven = NOT_GIVEN, country_pools: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - location_strategy: load_balancer_update_params.LocationStrategy | NotGiven = NOT_GIVEN, + location_strategy: LocationStrategyParam | NotGiven = NOT_GIVEN, pop_pools: object | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - random_steering: load_balancer_update_params.RandomSteering | NotGiven = NOT_GIVEN, + random_steering: RandomSteeringParam | NotGiven = NOT_GIVEN, region_pools: object | NotGiven = NOT_GIVEN, - rules: Iterable[load_balancer_update_params.Rule] | NotGiven = NOT_GIVEN, + rules: Iterable[RulesParam] | NotGiven = NOT_GIVEN, session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] | NotGiven = NOT_GIVEN, - session_affinity_attributes: load_balancer_update_params.SessionAffinityAttributes | NotGiven = NOT_GIVEN, + session_affinity_attributes: SessionAffinityAttributesParam | NotGiven = NOT_GIVEN, session_affinity_ttl: float | NotGiven = NOT_GIVEN, steering_policy: Literal[ "off", @@ -506,7 +513,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancer]._unwrapper, ), cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) @@ -550,6 +557,7 @@ def delete( load_balancer_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -575,12 +583,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") return self._delete( f"/zones/{zone_id}/load_balancers/{load_balancer_id}", + body=maybe_transform(body, load_balancer_delete_params.LoadBalancerDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancerDeleteResponse]._unwrapper, ), cast_to=cast(Type[LoadBalancerDeleteResponse], ResultWrapper[LoadBalancerDeleteResponse]), ) @@ -590,21 +599,21 @@ def edit( load_balancer_id: str, *, zone_id: str, - adaptive_routing: load_balancer_edit_params.AdaptiveRouting | NotGiven = NOT_GIVEN, + adaptive_routing: AdaptiveRoutingParam | NotGiven = NOT_GIVEN, country_pools: object | NotGiven = NOT_GIVEN, - default_pools: List[str] | NotGiven = NOT_GIVEN, + default_pools: List[DefaultPools] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, fallback_pool: object | NotGiven = NOT_GIVEN, - location_strategy: load_balancer_edit_params.LocationStrategy | NotGiven = NOT_GIVEN, + location_strategy: LocationStrategyParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, pop_pools: object | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - random_steering: load_balancer_edit_params.RandomSteering | NotGiven = NOT_GIVEN, + random_steering: RandomSteeringParam | NotGiven = NOT_GIVEN, region_pools: object | NotGiven = NOT_GIVEN, - rules: Iterable[load_balancer_edit_params.Rule] | NotGiven = NOT_GIVEN, + rules: Iterable[RulesParam] | NotGiven = NOT_GIVEN, session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] | NotGiven = NOT_GIVEN, - session_affinity_attributes: load_balancer_edit_params.SessionAffinityAttributes | NotGiven = NOT_GIVEN, + session_affinity_attributes: SessionAffinityAttributesParam | NotGiven = NOT_GIVEN, session_affinity_ttl: float | NotGiven = NOT_GIVEN, steering_policy: Literal[ "off", @@ -785,7 +794,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancer]._unwrapper, ), cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) @@ -825,59 +834,59 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancer]._unwrapper, ), cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) -class AsyncLoadBalancers(AsyncAPIResource): +class AsyncLoadBalancersResource(AsyncAPIResource): @cached_property - def monitors(self) -> AsyncMonitors: - return AsyncMonitors(self._client) + def monitors(self) -> AsyncMonitorsResource: + return AsyncMonitorsResource(self._client) @cached_property - def pools(self) -> AsyncPools: - return AsyncPools(self._client) + def pools(self) -> AsyncPoolsResource: + return AsyncPoolsResource(self._client) @cached_property - def previews(self) -> AsyncPreviews: - return AsyncPreviews(self._client) + def previews(self) -> AsyncPreviewsResource: + return AsyncPreviewsResource(self._client) @cached_property - def regions(self) -> AsyncRegions: - return AsyncRegions(self._client) + def regions(self) -> AsyncRegionsResource: + return AsyncRegionsResource(self._client) @cached_property - def searches(self) -> AsyncSearches: - return AsyncSearches(self._client) + def searches(self) -> AsyncSearchesResource: + return AsyncSearchesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLoadBalancersWithRawResponse: - return AsyncLoadBalancersWithRawResponse(self) + def with_raw_response(self) -> AsyncLoadBalancersResourceWithRawResponse: + return AsyncLoadBalancersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLoadBalancersWithStreamingResponse: - return AsyncLoadBalancersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLoadBalancersResourceWithStreamingResponse: + return AsyncLoadBalancersResourceWithStreamingResponse(self) async def create( self, *, zone_id: str, - default_pools: List[str], + default_pools: List[DefaultPools], fallback_pool: object, name: str, - adaptive_routing: load_balancer_create_params.AdaptiveRouting | NotGiven = NOT_GIVEN, + adaptive_routing: AdaptiveRoutingParam | NotGiven = NOT_GIVEN, country_pools: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - location_strategy: load_balancer_create_params.LocationStrategy | NotGiven = NOT_GIVEN, + location_strategy: LocationStrategyParam | NotGiven = NOT_GIVEN, pop_pools: object | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - random_steering: load_balancer_create_params.RandomSteering | NotGiven = NOT_GIVEN, + random_steering: RandomSteeringParam | NotGiven = NOT_GIVEN, region_pools: object | NotGiven = NOT_GIVEN, - rules: Iterable[load_balancer_create_params.Rule] | NotGiven = NOT_GIVEN, + rules: Iterable[RulesParam] | NotGiven = NOT_GIVEN, session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] | NotGiven = NOT_GIVEN, - session_affinity_attributes: load_balancer_create_params.SessionAffinityAttributes | NotGiven = NOT_GIVEN, + session_affinity_attributes: SessionAffinityAttributesParam | NotGiven = NOT_GIVEN, session_affinity_ttl: float | NotGiven = NOT_GIVEN, steering_policy: Literal[ "off", @@ -1053,7 +1062,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancer]._unwrapper, ), cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) @@ -1063,21 +1072,21 @@ async def update( load_balancer_id: str, *, zone_id: str, - default_pools: List[str], + default_pools: List[DefaultPools], fallback_pool: object, name: str, - adaptive_routing: load_balancer_update_params.AdaptiveRouting | NotGiven = NOT_GIVEN, + adaptive_routing: AdaptiveRoutingParam | NotGiven = NOT_GIVEN, country_pools: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - location_strategy: load_balancer_update_params.LocationStrategy | NotGiven = NOT_GIVEN, + location_strategy: LocationStrategyParam | NotGiven = NOT_GIVEN, pop_pools: object | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - random_steering: load_balancer_update_params.RandomSteering | NotGiven = NOT_GIVEN, + random_steering: RandomSteeringParam | NotGiven = NOT_GIVEN, region_pools: object | NotGiven = NOT_GIVEN, - rules: Iterable[load_balancer_update_params.Rule] | NotGiven = NOT_GIVEN, + rules: Iterable[RulesParam] | NotGiven = NOT_GIVEN, session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] | NotGiven = NOT_GIVEN, - session_affinity_attributes: load_balancer_update_params.SessionAffinityAttributes | NotGiven = NOT_GIVEN, + session_affinity_attributes: SessionAffinityAttributesParam | NotGiven = NOT_GIVEN, session_affinity_ttl: float | NotGiven = NOT_GIVEN, steering_policy: Literal[ "off", @@ -1258,7 +1267,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancer]._unwrapper, ), cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) @@ -1302,6 +1311,7 @@ async def delete( load_balancer_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1327,12 +1337,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") return await self._delete( f"/zones/{zone_id}/load_balancers/{load_balancer_id}", + body=await async_maybe_transform(body, load_balancer_delete_params.LoadBalancerDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancerDeleteResponse]._unwrapper, ), cast_to=cast(Type[LoadBalancerDeleteResponse], ResultWrapper[LoadBalancerDeleteResponse]), ) @@ -1342,21 +1353,21 @@ async def edit( load_balancer_id: str, *, zone_id: str, - adaptive_routing: load_balancer_edit_params.AdaptiveRouting | NotGiven = NOT_GIVEN, + adaptive_routing: AdaptiveRoutingParam | NotGiven = NOT_GIVEN, country_pools: object | NotGiven = NOT_GIVEN, - default_pools: List[str] | NotGiven = NOT_GIVEN, + default_pools: List[DefaultPools] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, fallback_pool: object | NotGiven = NOT_GIVEN, - location_strategy: load_balancer_edit_params.LocationStrategy | NotGiven = NOT_GIVEN, + location_strategy: LocationStrategyParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, pop_pools: object | NotGiven = NOT_GIVEN, proxied: bool | NotGiven = NOT_GIVEN, - random_steering: load_balancer_edit_params.RandomSteering | NotGiven = NOT_GIVEN, + random_steering: RandomSteeringParam | NotGiven = NOT_GIVEN, region_pools: object | NotGiven = NOT_GIVEN, - rules: Iterable[load_balancer_edit_params.Rule] | NotGiven = NOT_GIVEN, + rules: Iterable[RulesParam] | NotGiven = NOT_GIVEN, session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] | NotGiven = NOT_GIVEN, - session_affinity_attributes: load_balancer_edit_params.SessionAffinityAttributes | NotGiven = NOT_GIVEN, + session_affinity_attributes: SessionAffinityAttributesParam | NotGiven = NOT_GIVEN, session_affinity_ttl: float | NotGiven = NOT_GIVEN, steering_policy: Literal[ "off", @@ -1537,7 +1548,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancer]._unwrapper, ), cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) @@ -1577,14 +1588,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LoadBalancer]._unwrapper, ), cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) -class LoadBalancersWithRawResponse: - def __init__(self, load_balancers: LoadBalancers) -> None: +class LoadBalancersResourceWithRawResponse: + def __init__(self, load_balancers: LoadBalancersResource) -> None: self._load_balancers = load_balancers self.create = to_raw_response_wrapper( @@ -1607,28 +1618,28 @@ def __init__(self, load_balancers: LoadBalancers) -> None: ) @cached_property - def monitors(self) -> MonitorsWithRawResponse: - return MonitorsWithRawResponse(self._load_balancers.monitors) + def monitors(self) -> MonitorsResourceWithRawResponse: + return MonitorsResourceWithRawResponse(self._load_balancers.monitors) @cached_property - def pools(self) -> PoolsWithRawResponse: - return PoolsWithRawResponse(self._load_balancers.pools) + def pools(self) -> PoolsResourceWithRawResponse: + return PoolsResourceWithRawResponse(self._load_balancers.pools) @cached_property - def previews(self) -> PreviewsWithRawResponse: - return PreviewsWithRawResponse(self._load_balancers.previews) + def previews(self) -> PreviewsResourceWithRawResponse: + return PreviewsResourceWithRawResponse(self._load_balancers.previews) @cached_property - def regions(self) -> RegionsWithRawResponse: - return RegionsWithRawResponse(self._load_balancers.regions) + def regions(self) -> RegionsResourceWithRawResponse: + return RegionsResourceWithRawResponse(self._load_balancers.regions) @cached_property - def searches(self) -> SearchesWithRawResponse: - return SearchesWithRawResponse(self._load_balancers.searches) + def searches(self) -> SearchesResourceWithRawResponse: + return SearchesResourceWithRawResponse(self._load_balancers.searches) -class AsyncLoadBalancersWithRawResponse: - def __init__(self, load_balancers: AsyncLoadBalancers) -> None: +class AsyncLoadBalancersResourceWithRawResponse: + def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self._load_balancers = load_balancers self.create = async_to_raw_response_wrapper( @@ -1651,28 +1662,28 @@ def __init__(self, load_balancers: AsyncLoadBalancers) -> None: ) @cached_property - def monitors(self) -> AsyncMonitorsWithRawResponse: - return AsyncMonitorsWithRawResponse(self._load_balancers.monitors) + def monitors(self) -> AsyncMonitorsResourceWithRawResponse: + return AsyncMonitorsResourceWithRawResponse(self._load_balancers.monitors) @cached_property - def pools(self) -> AsyncPoolsWithRawResponse: - return AsyncPoolsWithRawResponse(self._load_balancers.pools) + def pools(self) -> AsyncPoolsResourceWithRawResponse: + return AsyncPoolsResourceWithRawResponse(self._load_balancers.pools) @cached_property - def previews(self) -> AsyncPreviewsWithRawResponse: - return AsyncPreviewsWithRawResponse(self._load_balancers.previews) + def previews(self) -> AsyncPreviewsResourceWithRawResponse: + return AsyncPreviewsResourceWithRawResponse(self._load_balancers.previews) @cached_property - def regions(self) -> AsyncRegionsWithRawResponse: - return AsyncRegionsWithRawResponse(self._load_balancers.regions) + def regions(self) -> AsyncRegionsResourceWithRawResponse: + return AsyncRegionsResourceWithRawResponse(self._load_balancers.regions) @cached_property - def searches(self) -> AsyncSearchesWithRawResponse: - return AsyncSearchesWithRawResponse(self._load_balancers.searches) + def searches(self) -> AsyncSearchesResourceWithRawResponse: + return AsyncSearchesResourceWithRawResponse(self._load_balancers.searches) -class LoadBalancersWithStreamingResponse: - def __init__(self, load_balancers: LoadBalancers) -> None: +class LoadBalancersResourceWithStreamingResponse: + def __init__(self, load_balancers: LoadBalancersResource) -> None: self._load_balancers = load_balancers self.create = to_streamed_response_wrapper( @@ -1695,28 +1706,28 @@ def __init__(self, load_balancers: LoadBalancers) -> None: ) @cached_property - def monitors(self) -> MonitorsWithStreamingResponse: - return MonitorsWithStreamingResponse(self._load_balancers.monitors) + def monitors(self) -> MonitorsResourceWithStreamingResponse: + return MonitorsResourceWithStreamingResponse(self._load_balancers.monitors) @cached_property - def pools(self) -> PoolsWithStreamingResponse: - return PoolsWithStreamingResponse(self._load_balancers.pools) + def pools(self) -> PoolsResourceWithStreamingResponse: + return PoolsResourceWithStreamingResponse(self._load_balancers.pools) @cached_property - def previews(self) -> PreviewsWithStreamingResponse: - return PreviewsWithStreamingResponse(self._load_balancers.previews) + def previews(self) -> PreviewsResourceWithStreamingResponse: + return PreviewsResourceWithStreamingResponse(self._load_balancers.previews) @cached_property - def regions(self) -> RegionsWithStreamingResponse: - return RegionsWithStreamingResponse(self._load_balancers.regions) + def regions(self) -> RegionsResourceWithStreamingResponse: + return RegionsResourceWithStreamingResponse(self._load_balancers.regions) @cached_property - def searches(self) -> SearchesWithStreamingResponse: - return SearchesWithStreamingResponse(self._load_balancers.searches) + def searches(self) -> SearchesResourceWithStreamingResponse: + return SearchesResourceWithStreamingResponse(self._load_balancers.searches) -class AsyncLoadBalancersWithStreamingResponse: - def __init__(self, load_balancers: AsyncLoadBalancers) -> None: +class AsyncLoadBalancersResourceWithStreamingResponse: + def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self._load_balancers = load_balancers self.create = async_to_streamed_response_wrapper( @@ -1739,21 +1750,21 @@ def __init__(self, load_balancers: AsyncLoadBalancers) -> None: ) @cached_property - def monitors(self) -> AsyncMonitorsWithStreamingResponse: - return AsyncMonitorsWithStreamingResponse(self._load_balancers.monitors) + def monitors(self) -> AsyncMonitorsResourceWithStreamingResponse: + return AsyncMonitorsResourceWithStreamingResponse(self._load_balancers.monitors) @cached_property - def pools(self) -> AsyncPoolsWithStreamingResponse: - return AsyncPoolsWithStreamingResponse(self._load_balancers.pools) + def pools(self) -> AsyncPoolsResourceWithStreamingResponse: + return AsyncPoolsResourceWithStreamingResponse(self._load_balancers.pools) @cached_property - def previews(self) -> AsyncPreviewsWithStreamingResponse: - return AsyncPreviewsWithStreamingResponse(self._load_balancers.previews) + def previews(self) -> AsyncPreviewsResourceWithStreamingResponse: + return AsyncPreviewsResourceWithStreamingResponse(self._load_balancers.previews) @cached_property - def regions(self) -> AsyncRegionsWithStreamingResponse: - return AsyncRegionsWithStreamingResponse(self._load_balancers.regions) + def regions(self) -> AsyncRegionsResourceWithStreamingResponse: + return AsyncRegionsResourceWithStreamingResponse(self._load_balancers.regions) @cached_property - def searches(self) -> AsyncSearchesWithStreamingResponse: - return AsyncSearchesWithStreamingResponse(self._load_balancers.searches) + def searches(self) -> AsyncSearchesResourceWithStreamingResponse: + return AsyncSearchesResourceWithStreamingResponse(self._load_balancers.searches) diff --git a/src/cloudflare/resources/load_balancers/monitors/__init__.py b/src/cloudflare/resources/load_balancers/monitors/__init__.py index 02d4bf3e818..a0f096d5984 100644 --- a/src/cloudflare/resources/load_balancers/monitors/__init__.py +++ b/src/cloudflare/resources/load_balancers/monitors/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .monitors import ( - Monitors, - AsyncMonitors, - MonitorsWithRawResponse, - AsyncMonitorsWithRawResponse, - MonitorsWithStreamingResponse, - AsyncMonitorsWithStreamingResponse, + MonitorsResource, + AsyncMonitorsResource, + MonitorsResourceWithRawResponse, + AsyncMonitorsResourceWithRawResponse, + MonitorsResourceWithStreamingResponse, + AsyncMonitorsResourceWithStreamingResponse, ) from .previews import ( - Previews, - AsyncPreviews, - PreviewsWithRawResponse, - AsyncPreviewsWithRawResponse, - PreviewsWithStreamingResponse, - AsyncPreviewsWithStreamingResponse, + PreviewsResource, + AsyncPreviewsResource, + PreviewsResourceWithRawResponse, + AsyncPreviewsResourceWithRawResponse, + PreviewsResourceWithStreamingResponse, + AsyncPreviewsResourceWithStreamingResponse, ) from .references import ( - References, - AsyncReferences, - ReferencesWithRawResponse, - AsyncReferencesWithRawResponse, - ReferencesWithStreamingResponse, - AsyncReferencesWithStreamingResponse, + ReferencesResource, + AsyncReferencesResource, + ReferencesResourceWithRawResponse, + AsyncReferencesResourceWithRawResponse, + ReferencesResourceWithStreamingResponse, + AsyncReferencesResourceWithStreamingResponse, ) __all__ = [ - "Previews", - "AsyncPreviews", - "PreviewsWithRawResponse", - "AsyncPreviewsWithRawResponse", - "PreviewsWithStreamingResponse", - "AsyncPreviewsWithStreamingResponse", - "References", - "AsyncReferences", - "ReferencesWithRawResponse", - "AsyncReferencesWithRawResponse", - "ReferencesWithStreamingResponse", - "AsyncReferencesWithStreamingResponse", - "Monitors", - "AsyncMonitors", - "MonitorsWithRawResponse", - "AsyncMonitorsWithRawResponse", - "MonitorsWithStreamingResponse", - "AsyncMonitorsWithStreamingResponse", + "PreviewsResource", + "AsyncPreviewsResource", + "PreviewsResourceWithRawResponse", + "AsyncPreviewsResourceWithRawResponse", + "PreviewsResourceWithStreamingResponse", + "AsyncPreviewsResourceWithStreamingResponse", + "ReferencesResource", + "AsyncReferencesResource", + "ReferencesResourceWithRawResponse", + "AsyncReferencesResourceWithRawResponse", + "ReferencesResourceWithStreamingResponse", + "AsyncReferencesResourceWithStreamingResponse", + "MonitorsResource", + "AsyncMonitorsResource", + "MonitorsResourceWithRawResponse", + "AsyncMonitorsResourceWithRawResponse", + "MonitorsResourceWithStreamingResponse", + "AsyncMonitorsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/load_balancers/monitors/monitors.py b/src/cloudflare/resources/load_balancers/monitors/monitors.py index 53b9f963ff6..1a963337a6d 100644 --- a/src/cloudflare/resources/load_balancers/monitors/monitors.py +++ b/src/cloudflare/resources/load_balancers/monitors/monitors.py @@ -8,12 +8,12 @@ import httpx from .previews import ( - Previews, - AsyncPreviews, - PreviewsWithRawResponse, - AsyncPreviewsWithRawResponse, - PreviewsWithStreamingResponse, - AsyncPreviewsWithStreamingResponse, + PreviewsResource, + AsyncPreviewsResource, + PreviewsResourceWithRawResponse, + AsyncPreviewsResourceWithRawResponse, + PreviewsResourceWithStreamingResponse, + AsyncPreviewsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -22,12 +22,12 @@ ) from ...._compat import cached_property from .references import ( - References, - AsyncReferences, - ReferencesWithRawResponse, - AsyncReferencesWithRawResponse, - ReferencesWithStreamingResponse, - AsyncReferencesWithStreamingResponse, + ReferencesResource, + AsyncReferencesResource, + ReferencesResourceWithRawResponse, + AsyncReferencesResourceWithRawResponse, + ReferencesResourceWithStreamingResponse, + AsyncReferencesResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -43,32 +43,33 @@ make_request_options, ) from ....types.load_balancers import ( - MonitorDeleteResponse, monitor_edit_params, monitor_create_params, + monitor_delete_params, monitor_update_params, ) -from ....types.user.load_balancers import LoadBalancingMonitor +from ....types.load_balancers.monitor import Monitor +from ....types.load_balancers.monitor_delete_response import MonitorDeleteResponse -__all__ = ["Monitors", "AsyncMonitors"] +__all__ = ["MonitorsResource", "AsyncMonitorsResource"] -class Monitors(SyncAPIResource): +class MonitorsResource(SyncAPIResource): @cached_property - def previews(self) -> Previews: - return Previews(self._client) + def previews(self) -> PreviewsResource: + return PreviewsResource(self._client) @cached_property - def references(self) -> References: - return References(self._client) + def references(self) -> ReferencesResource: + return ReferencesResource(self._client) @cached_property - def with_raw_response(self) -> MonitorsWithRawResponse: - return MonitorsWithRawResponse(self) + def with_raw_response(self) -> MonitorsResourceWithRawResponse: + return MonitorsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MonitorsWithStreamingResponse: - return MonitorsWithStreamingResponse(self) + def with_streaming_response(self) -> MonitorsResourceWithStreamingResponse: + return MonitorsResourceWithStreamingResponse(self) def create( self, @@ -96,7 +97,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingMonitor: + ) -> Monitor: """ Create a configured monitor. @@ -190,9 +191,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Monitor]._unwrapper, ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), + cast_to=cast(Type[Monitor], ResultWrapper[Monitor]), ) def update( @@ -222,7 +223,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingMonitor: + ) -> Monitor: """ Modify a configured monitor. @@ -318,9 +319,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Monitor]._unwrapper, ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), + cast_to=cast(Type[Monitor], ResultWrapper[Monitor]), ) def list( @@ -333,7 +334,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[LoadBalancingMonitor]: + ) -> SyncSinglePage[Monitor]: """ List configured monitors for an account. @@ -352,11 +353,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/load_balancers/monitors", - page=SyncSinglePage[LoadBalancingMonitor], + page=SyncSinglePage[Monitor], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=LoadBalancingMonitor, + model=Monitor, ) def delete( @@ -364,6 +365,7 @@ def delete( monitor_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -391,12 +393,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") return self._delete( f"/accounts/{account_id}/load_balancers/monitors/{monitor_id}", + body=maybe_transform(body, monitor_delete_params.MonitorDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MonitorDeleteResponse]._unwrapper, ), cast_to=cast(Type[MonitorDeleteResponse], ResultWrapper[MonitorDeleteResponse]), ) @@ -428,7 +431,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingMonitor: + ) -> Monitor: """ Apply changes to an existing monitor, overwriting the supplied properties. @@ -524,9 +527,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Monitor]._unwrapper, ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), + cast_to=cast(Type[Monitor], ResultWrapper[Monitor]), ) def get( @@ -540,7 +543,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingMonitor: + ) -> Monitor: """ List a single configured monitor for an account. @@ -566,28 +569,28 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Monitor]._unwrapper, ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), + cast_to=cast(Type[Monitor], ResultWrapper[Monitor]), ) -class AsyncMonitors(AsyncAPIResource): +class AsyncMonitorsResource(AsyncAPIResource): @cached_property - def previews(self) -> AsyncPreviews: - return AsyncPreviews(self._client) + def previews(self) -> AsyncPreviewsResource: + return AsyncPreviewsResource(self._client) @cached_property - def references(self) -> AsyncReferences: - return AsyncReferences(self._client) + def references(self) -> AsyncReferencesResource: + return AsyncReferencesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncMonitorsWithRawResponse: - return AsyncMonitorsWithRawResponse(self) + def with_raw_response(self) -> AsyncMonitorsResourceWithRawResponse: + return AsyncMonitorsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMonitorsWithStreamingResponse: - return AsyncMonitorsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMonitorsResourceWithStreamingResponse: + return AsyncMonitorsResourceWithStreamingResponse(self) async def create( self, @@ -615,7 +618,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingMonitor: + ) -> Monitor: """ Create a configured monitor. @@ -709,9 +712,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Monitor]._unwrapper, ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), + cast_to=cast(Type[Monitor], ResultWrapper[Monitor]), ) async def update( @@ -741,7 +744,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingMonitor: + ) -> Monitor: """ Modify a configured monitor. @@ -837,9 +840,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Monitor]._unwrapper, ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), + cast_to=cast(Type[Monitor], ResultWrapper[Monitor]), ) def list( @@ -852,7 +855,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[LoadBalancingMonitor, AsyncSinglePage[LoadBalancingMonitor]]: + ) -> AsyncPaginator[Monitor, AsyncSinglePage[Monitor]]: """ List configured monitors for an account. @@ -871,11 +874,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/load_balancers/monitors", - page=AsyncSinglePage[LoadBalancingMonitor], + page=AsyncSinglePage[Monitor], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=LoadBalancingMonitor, + model=Monitor, ) async def delete( @@ -883,6 +886,7 @@ async def delete( monitor_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -910,12 +914,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") return await self._delete( f"/accounts/{account_id}/load_balancers/monitors/{monitor_id}", + body=await async_maybe_transform(body, monitor_delete_params.MonitorDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MonitorDeleteResponse]._unwrapper, ), cast_to=cast(Type[MonitorDeleteResponse], ResultWrapper[MonitorDeleteResponse]), ) @@ -947,7 +952,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingMonitor: + ) -> Monitor: """ Apply changes to an existing monitor, overwriting the supplied properties. @@ -1043,9 +1048,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Monitor]._unwrapper, ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), + cast_to=cast(Type[Monitor], ResultWrapper[Monitor]), ) async def get( @@ -1059,7 +1064,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingMonitor: + ) -> Monitor: """ List a single configured monitor for an account. @@ -1085,14 +1090,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Monitor]._unwrapper, ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), + cast_to=cast(Type[Monitor], ResultWrapper[Monitor]), ) -class MonitorsWithRawResponse: - def __init__(self, monitors: Monitors) -> None: +class MonitorsResourceWithRawResponse: + def __init__(self, monitors: MonitorsResource) -> None: self._monitors = monitors self.create = to_raw_response_wrapper( @@ -1115,16 +1120,16 @@ def __init__(self, monitors: Monitors) -> None: ) @cached_property - def previews(self) -> PreviewsWithRawResponse: - return PreviewsWithRawResponse(self._monitors.previews) + def previews(self) -> PreviewsResourceWithRawResponse: + return PreviewsResourceWithRawResponse(self._monitors.previews) @cached_property - def references(self) -> ReferencesWithRawResponse: - return ReferencesWithRawResponse(self._monitors.references) + def references(self) -> ReferencesResourceWithRawResponse: + return ReferencesResourceWithRawResponse(self._monitors.references) -class AsyncMonitorsWithRawResponse: - def __init__(self, monitors: AsyncMonitors) -> None: +class AsyncMonitorsResourceWithRawResponse: + def __init__(self, monitors: AsyncMonitorsResource) -> None: self._monitors = monitors self.create = async_to_raw_response_wrapper( @@ -1147,16 +1152,16 @@ def __init__(self, monitors: AsyncMonitors) -> None: ) @cached_property - def previews(self) -> AsyncPreviewsWithRawResponse: - return AsyncPreviewsWithRawResponse(self._monitors.previews) + def previews(self) -> AsyncPreviewsResourceWithRawResponse: + return AsyncPreviewsResourceWithRawResponse(self._monitors.previews) @cached_property - def references(self) -> AsyncReferencesWithRawResponse: - return AsyncReferencesWithRawResponse(self._monitors.references) + def references(self) -> AsyncReferencesResourceWithRawResponse: + return AsyncReferencesResourceWithRawResponse(self._monitors.references) -class MonitorsWithStreamingResponse: - def __init__(self, monitors: Monitors) -> None: +class MonitorsResourceWithStreamingResponse: + def __init__(self, monitors: MonitorsResource) -> None: self._monitors = monitors self.create = to_streamed_response_wrapper( @@ -1179,16 +1184,16 @@ def __init__(self, monitors: Monitors) -> None: ) @cached_property - def previews(self) -> PreviewsWithStreamingResponse: - return PreviewsWithStreamingResponse(self._monitors.previews) + def previews(self) -> PreviewsResourceWithStreamingResponse: + return PreviewsResourceWithStreamingResponse(self._monitors.previews) @cached_property - def references(self) -> ReferencesWithStreamingResponse: - return ReferencesWithStreamingResponse(self._monitors.references) + def references(self) -> ReferencesResourceWithStreamingResponse: + return ReferencesResourceWithStreamingResponse(self._monitors.references) -class AsyncMonitorsWithStreamingResponse: - def __init__(self, monitors: AsyncMonitors) -> None: +class AsyncMonitorsResourceWithStreamingResponse: + def __init__(self, monitors: AsyncMonitorsResource) -> None: self._monitors = monitors self.create = async_to_streamed_response_wrapper( @@ -1211,9 +1216,9 @@ def __init__(self, monitors: AsyncMonitors) -> None: ) @cached_property - def previews(self) -> AsyncPreviewsWithStreamingResponse: - return AsyncPreviewsWithStreamingResponse(self._monitors.previews) + def previews(self) -> AsyncPreviewsResourceWithStreamingResponse: + return AsyncPreviewsResourceWithStreamingResponse(self._monitors.previews) @cached_property - def references(self) -> AsyncReferencesWithStreamingResponse: - return AsyncReferencesWithStreamingResponse(self._monitors.references) + def references(self) -> AsyncReferencesResourceWithStreamingResponse: + return AsyncReferencesResourceWithStreamingResponse(self._monitors.references) diff --git a/src/cloudflare/resources/load_balancers/monitors/previews.py b/src/cloudflare/resources/load_balancers/monitors/previews.py index 1af0c9b063f..df68da9f446 100644 --- a/src/cloudflare/resources/load_balancers/monitors/previews.py +++ b/src/cloudflare/resources/load_balancers/monitors/previews.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.load_balancers.monitors import PreviewCreateResponse, preview_create_params +from ....types.load_balancers.monitors import preview_create_params +from ....types.load_balancers.monitors.preview_create_response import PreviewCreateResponse -__all__ = ["Previews", "AsyncPreviews"] +__all__ = ["PreviewsResource", "AsyncPreviewsResource"] -class Previews(SyncAPIResource): +class PreviewsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PreviewsWithRawResponse: - return PreviewsWithRawResponse(self) + def with_raw_response(self) -> PreviewsResourceWithRawResponse: + return PreviewsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PreviewsWithStreamingResponse: - return PreviewsWithStreamingResponse(self) + def with_streaming_response(self) -> PreviewsResourceWithStreamingResponse: + return PreviewsResourceWithStreamingResponse(self) def create( self, @@ -163,20 +164,20 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PreviewCreateResponse]._unwrapper, ), cast_to=cast(Type[PreviewCreateResponse], ResultWrapper[PreviewCreateResponse]), ) -class AsyncPreviews(AsyncAPIResource): +class AsyncPreviewsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPreviewsWithRawResponse: - return AsyncPreviewsWithRawResponse(self) + def with_raw_response(self) -> AsyncPreviewsResourceWithRawResponse: + return AsyncPreviewsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPreviewsWithStreamingResponse: - return AsyncPreviewsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPreviewsResourceWithStreamingResponse: + return AsyncPreviewsResourceWithStreamingResponse(self) async def create( self, @@ -303,14 +304,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PreviewCreateResponse]._unwrapper, ), cast_to=cast(Type[PreviewCreateResponse], ResultWrapper[PreviewCreateResponse]), ) -class PreviewsWithRawResponse: - def __init__(self, previews: Previews) -> None: +class PreviewsResourceWithRawResponse: + def __init__(self, previews: PreviewsResource) -> None: self._previews = previews self.create = to_raw_response_wrapper( @@ -318,8 +319,8 @@ def __init__(self, previews: Previews) -> None: ) -class AsyncPreviewsWithRawResponse: - def __init__(self, previews: AsyncPreviews) -> None: +class AsyncPreviewsResourceWithRawResponse: + def __init__(self, previews: AsyncPreviewsResource) -> None: self._previews = previews self.create = async_to_raw_response_wrapper( @@ -327,8 +328,8 @@ def __init__(self, previews: AsyncPreviews) -> None: ) -class PreviewsWithStreamingResponse: - def __init__(self, previews: Previews) -> None: +class PreviewsResourceWithStreamingResponse: + def __init__(self, previews: PreviewsResource) -> None: self._previews = previews self.create = to_streamed_response_wrapper( @@ -336,8 +337,8 @@ def __init__(self, previews: Previews) -> None: ) -class AsyncPreviewsWithStreamingResponse: - def __init__(self, previews: AsyncPreviews) -> None: +class AsyncPreviewsResourceWithStreamingResponse: + def __init__(self, previews: AsyncPreviewsResource) -> None: self._previews = previews self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/load_balancers/monitors/references.py b/src/cloudflare/resources/load_balancers/monitors/references.py index 1f91c2f3f1b..d6a57962095 100644 --- a/src/cloudflare/resources/load_balancers/monitors/references.py +++ b/src/cloudflare/resources/load_balancers/monitors/references.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.load_balancers.monitors import ReferenceGetResponse +from ....types.load_balancers.monitors.reference_get_response import ReferenceGetResponse -__all__ = ["References", "AsyncReferences"] +__all__ = ["ReferencesResource", "AsyncReferencesResource"] -class References(SyncAPIResource): +class ReferencesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ReferencesWithRawResponse: - return ReferencesWithRawResponse(self) + def with_raw_response(self) -> ReferencesResourceWithRawResponse: + return ReferencesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ReferencesWithStreamingResponse: - return ReferencesWithStreamingResponse(self) + def with_streaming_response(self) -> ReferencesResourceWithStreamingResponse: + return ReferencesResourceWithStreamingResponse(self) def get( self, @@ -70,20 +70,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ReferenceGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ReferenceGetResponse]], ResultWrapper[ReferenceGetResponse]), ) -class AsyncReferences(AsyncAPIResource): +class AsyncReferencesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncReferencesWithRawResponse: - return AsyncReferencesWithRawResponse(self) + def with_raw_response(self) -> AsyncReferencesResourceWithRawResponse: + return AsyncReferencesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncReferencesWithStreamingResponse: - return AsyncReferencesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncReferencesResourceWithStreamingResponse: + return AsyncReferencesResourceWithStreamingResponse(self) async def get( self, @@ -122,14 +122,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ReferenceGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ReferenceGetResponse]], ResultWrapper[ReferenceGetResponse]), ) -class ReferencesWithRawResponse: - def __init__(self, references: References) -> None: +class ReferencesResourceWithRawResponse: + def __init__(self, references: ReferencesResource) -> None: self._references = references self.get = to_raw_response_wrapper( @@ -137,8 +137,8 @@ def __init__(self, references: References) -> None: ) -class AsyncReferencesWithRawResponse: - def __init__(self, references: AsyncReferences) -> None: +class AsyncReferencesResourceWithRawResponse: + def __init__(self, references: AsyncReferencesResource) -> None: self._references = references self.get = async_to_raw_response_wrapper( @@ -146,8 +146,8 @@ def __init__(self, references: AsyncReferences) -> None: ) -class ReferencesWithStreamingResponse: - def __init__(self, references: References) -> None: +class ReferencesResourceWithStreamingResponse: + def __init__(self, references: ReferencesResource) -> None: self._references = references self.get = to_streamed_response_wrapper( @@ -155,8 +155,8 @@ def __init__(self, references: References) -> None: ) -class AsyncReferencesWithStreamingResponse: - def __init__(self, references: AsyncReferences) -> None: +class AsyncReferencesResourceWithStreamingResponse: + def __init__(self, references: AsyncReferencesResource) -> None: self._references = references self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/load_balancers/pools/__init__.py b/src/cloudflare/resources/load_balancers/pools/__init__.py index 4c7ba4dfc46..1af722d27b7 100644 --- a/src/cloudflare/resources/load_balancers/pools/__init__.py +++ b/src/cloudflare/resources/load_balancers/pools/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .pools import ( - Pools, - AsyncPools, - PoolsWithRawResponse, - AsyncPoolsWithRawResponse, - PoolsWithStreamingResponse, - AsyncPoolsWithStreamingResponse, + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, ) from .health import ( - Health, - AsyncHealth, - HealthWithRawResponse, - AsyncHealthWithRawResponse, - HealthWithStreamingResponse, - AsyncHealthWithStreamingResponse, + HealthResource, + AsyncHealthResource, + HealthResourceWithRawResponse, + AsyncHealthResourceWithRawResponse, + HealthResourceWithStreamingResponse, + AsyncHealthResourceWithStreamingResponse, ) from .references import ( - References, - AsyncReferences, - ReferencesWithRawResponse, - AsyncReferencesWithRawResponse, - ReferencesWithStreamingResponse, - AsyncReferencesWithStreamingResponse, + ReferencesResource, + AsyncReferencesResource, + ReferencesResourceWithRawResponse, + AsyncReferencesResourceWithRawResponse, + ReferencesResourceWithStreamingResponse, + AsyncReferencesResourceWithStreamingResponse, ) __all__ = [ - "Health", - "AsyncHealth", - "HealthWithRawResponse", - "AsyncHealthWithRawResponse", - "HealthWithStreamingResponse", - "AsyncHealthWithStreamingResponse", - "References", - "AsyncReferences", - "ReferencesWithRawResponse", - "AsyncReferencesWithRawResponse", - "ReferencesWithStreamingResponse", - "AsyncReferencesWithStreamingResponse", - "Pools", - "AsyncPools", - "PoolsWithRawResponse", - "AsyncPoolsWithRawResponse", - "PoolsWithStreamingResponse", - "AsyncPoolsWithStreamingResponse", + "HealthResource", + "AsyncHealthResource", + "HealthResourceWithRawResponse", + "AsyncHealthResourceWithRawResponse", + "HealthResourceWithStreamingResponse", + "AsyncHealthResourceWithStreamingResponse", + "ReferencesResource", + "AsyncReferencesResource", + "ReferencesResourceWithRawResponse", + "AsyncReferencesResourceWithRawResponse", + "ReferencesResourceWithStreamingResponse", + "AsyncReferencesResourceWithStreamingResponse", + "PoolsResource", + "AsyncPoolsResource", + "PoolsResourceWithRawResponse", + "AsyncPoolsResourceWithRawResponse", + "PoolsResourceWithStreamingResponse", + "AsyncPoolsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/load_balancers/pools/health.py b/src/cloudflare/resources/load_balancers/pools/health.py index bd5d1b78e9b..9018456132c 100644 --- a/src/cloudflare/resources/load_balancers/pools/health.py +++ b/src/cloudflare/resources/load_balancers/pools/health.py @@ -24,19 +24,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.load_balancers.pools import HealthGetResponse, HealthCreateResponse, health_create_params +from ....types.load_balancers.pools import health_create_params +from ....types.load_balancers.pools.health_get_response import HealthGetResponse +from ....types.load_balancers.pools.health_create_response import HealthCreateResponse -__all__ = ["Health", "AsyncHealth"] +__all__ = ["HealthResource", "AsyncHealthResource"] -class Health(SyncAPIResource): +class HealthResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HealthWithRawResponse: - return HealthWithRawResponse(self) + def with_raw_response(self) -> HealthResourceWithRawResponse: + return HealthResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HealthWithStreamingResponse: - return HealthWithStreamingResponse(self) + def with_streaming_response(self) -> HealthResourceWithStreamingResponse: + return HealthResourceWithStreamingResponse(self) def create( self, @@ -163,7 +165,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HealthCreateResponse]._unwrapper, ), cast_to=cast(Type[HealthCreateResponse], ResultWrapper[HealthCreateResponse]), ) @@ -207,7 +209,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HealthGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[HealthGetResponse] @@ -216,14 +218,14 @@ def get( ) -class AsyncHealth(AsyncAPIResource): +class AsyncHealthResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHealthWithRawResponse: - return AsyncHealthWithRawResponse(self) + def with_raw_response(self) -> AsyncHealthResourceWithRawResponse: + return AsyncHealthResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHealthWithStreamingResponse: - return AsyncHealthWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHealthResourceWithStreamingResponse: + return AsyncHealthResourceWithStreamingResponse(self) async def create( self, @@ -350,7 +352,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HealthCreateResponse]._unwrapper, ), cast_to=cast(Type[HealthCreateResponse], ResultWrapper[HealthCreateResponse]), ) @@ -394,7 +396,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HealthGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[HealthGetResponse] @@ -403,8 +405,8 @@ async def get( ) -class HealthWithRawResponse: - def __init__(self, health: Health) -> None: +class HealthResourceWithRawResponse: + def __init__(self, health: HealthResource) -> None: self._health = health self.create = to_raw_response_wrapper( @@ -415,8 +417,8 @@ def __init__(self, health: Health) -> None: ) -class AsyncHealthWithRawResponse: - def __init__(self, health: AsyncHealth) -> None: +class AsyncHealthResourceWithRawResponse: + def __init__(self, health: AsyncHealthResource) -> None: self._health = health self.create = async_to_raw_response_wrapper( @@ -427,8 +429,8 @@ def __init__(self, health: AsyncHealth) -> None: ) -class HealthWithStreamingResponse: - def __init__(self, health: Health) -> None: +class HealthResourceWithStreamingResponse: + def __init__(self, health: HealthResource) -> None: self._health = health self.create = to_streamed_response_wrapper( @@ -439,8 +441,8 @@ def __init__(self, health: Health) -> None: ) -class AsyncHealthWithStreamingResponse: - def __init__(self, health: AsyncHealth) -> None: +class AsyncHealthResourceWithStreamingResponse: + def __init__(self, health: AsyncHealthResource) -> None: self._health = health self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/load_balancers/pools/pools.py b/src/cloudflare/resources/load_balancers/pools/pools.py index d08af267c65..f72a395e9fb 100644 --- a/src/cloudflare/resources/load_balancers/pools/pools.py +++ b/src/cloudflare/resources/load_balancers/pools/pools.py @@ -3,17 +3,16 @@ from __future__ import annotations from typing import List, Type, Iterable, Optional, cast -from typing_extensions import Literal import httpx from .health import ( - Health, - AsyncHealth, - HealthWithRawResponse, - AsyncHealthWithRawResponse, - HealthWithStreamingResponse, - AsyncHealthWithStreamingResponse, + HealthResource, + AsyncHealthResource, + HealthResourceWithRawResponse, + AsyncHealthResourceWithRawResponse, + HealthResourceWithStreamingResponse, + AsyncHealthResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -22,12 +21,12 @@ ) from ...._compat import cached_property from .references import ( - References, - AsyncReferences, - ReferencesWithRawResponse, - AsyncReferencesWithRawResponse, - ReferencesWithStreamingResponse, - AsyncReferencesWithStreamingResponse, + ReferencesResource, + AsyncReferencesResource, + ReferencesResourceWithRawResponse, + AsyncReferencesResourceWithRawResponse, + ReferencesResourceWithStreamingResponse, + AsyncReferencesResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -43,57 +42,63 @@ make_request_options, ) from ....types.load_balancers import ( - PoolDeleteResponse, pool_edit_params, pool_list_params, pool_create_params, + pool_delete_params, pool_update_params, ) -from ....types.user.load_balancers import LoadBalancingPool +from ....types.load_balancers.pool import Pool +from ....types.load_balancers.check_region import CheckRegion +from ....types.load_balancers.origin_param import OriginParam +from ....types.load_balancers.load_shedding_param import LoadSheddingParam +from ....types.load_balancers.pool_delete_response import PoolDeleteResponse +from ....types.load_balancers.origin_steering_param import OriginSteeringParam +from ....types.load_balancers.notification_filter_param import NotificationFilterParam -__all__ = ["Pools", "AsyncPools"] +__all__ = ["PoolsResource", "AsyncPoolsResource"] -class Pools(SyncAPIResource): +class PoolsResource(SyncAPIResource): @cached_property - def health(self) -> Health: - return Health(self._client) + def health(self) -> HealthResource: + return HealthResource(self._client) @cached_property - def references(self) -> References: - return References(self._client) + def references(self) -> ReferencesResource: + return ReferencesResource(self._client) @cached_property - def with_raw_response(self) -> PoolsWithRawResponse: - return PoolsWithRawResponse(self) + def with_raw_response(self) -> PoolsResourceWithRawResponse: + return PoolsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PoolsWithStreamingResponse: - return PoolsWithStreamingResponse(self) + def with_streaming_response(self) -> PoolsResourceWithStreamingResponse: + return PoolsResourceWithStreamingResponse(self) def create( self, *, account_id: str, name: str, - origins: Iterable[pool_create_params.Origin], + origins: Iterable[OriginParam], description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_create_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_create_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_create_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | 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, - ) -> LoadBalancingPool: + ) -> Pool: """ Create a new pool. @@ -173,9 +178,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Pool]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), + cast_to=cast(Type[Pool], ResultWrapper[Pool]), ) def update( @@ -184,45 +189,25 @@ def update( *, account_id: str, name: str, - origins: Iterable[pool_update_params.Origin], - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + origins: Iterable[OriginParam], + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_update_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_update_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_update_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | 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, - ) -> LoadBalancingPool: + ) -> Pool: """ Modify a configured pool. @@ -308,9 +293,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Pool]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), + cast_to=cast(Type[Pool], ResultWrapper[Pool]), ) def list( @@ -324,7 +309,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[LoadBalancingPool]: + ) -> SyncSinglePage[Pool]: """ List configured pools. @@ -346,7 +331,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/load_balancers/pools", - page=SyncSinglePage[LoadBalancingPool], + page=SyncSinglePage[Pool], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -354,7 +339,7 @@ def list( timeout=timeout, query=maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), ), - model=LoadBalancingPool, + model=Pool, ) def delete( @@ -362,6 +347,7 @@ def delete( pool_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -389,12 +375,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( f"/accounts/{account_id}/load_balancers/pools/{pool_id}", + body=maybe_transform(body, pool_delete_params.PoolDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PoolDeleteResponse]._unwrapper, ), cast_to=cast(Type[PoolDeleteResponse], ResultWrapper[PoolDeleteResponse]), ) @@ -404,46 +391,26 @@ def edit( pool_id: str, *, account_id: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_edit_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_edit_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_edit_params.OriginSteering | NotGiven = NOT_GIVEN, - origins: Iterable[pool_edit_params.Origin] | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, + origins: Iterable[OriginParam] | 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, - ) -> LoadBalancingPool: + ) -> Pool: """ Apply changes to an existing pool, overwriting the supplied properties. @@ -529,9 +496,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Pool]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), + cast_to=cast(Type[Pool], ResultWrapper[Pool]), ) def get( @@ -545,7 +512,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingPool: + ) -> Pool: """ Fetch a single configured pool. @@ -571,52 +538,52 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Pool]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), + cast_to=cast(Type[Pool], ResultWrapper[Pool]), ) -class AsyncPools(AsyncAPIResource): +class AsyncPoolsResource(AsyncAPIResource): @cached_property - def health(self) -> AsyncHealth: - return AsyncHealth(self._client) + def health(self) -> AsyncHealthResource: + return AsyncHealthResource(self._client) @cached_property - def references(self) -> AsyncReferences: - return AsyncReferences(self._client) + def references(self) -> AsyncReferencesResource: + return AsyncReferencesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPoolsWithRawResponse: - return AsyncPoolsWithRawResponse(self) + def with_raw_response(self) -> AsyncPoolsResourceWithRawResponse: + return AsyncPoolsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPoolsWithStreamingResponse: - return AsyncPoolsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPoolsResourceWithStreamingResponse: + return AsyncPoolsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, name: str, - origins: Iterable[pool_create_params.Origin], + origins: Iterable[OriginParam], description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_create_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_create_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_create_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | 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, - ) -> LoadBalancingPool: + ) -> Pool: """ Create a new pool. @@ -696,9 +663,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Pool]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), + cast_to=cast(Type[Pool], ResultWrapper[Pool]), ) async def update( @@ -707,45 +674,25 @@ async def update( *, account_id: str, name: str, - origins: Iterable[pool_update_params.Origin], - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + origins: Iterable[OriginParam], + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_update_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_update_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_update_params.OriginSteering | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | 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, - ) -> LoadBalancingPool: + ) -> Pool: """ Modify a configured pool. @@ -831,9 +778,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Pool]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), + cast_to=cast(Type[Pool], ResultWrapper[Pool]), ) def list( @@ -847,7 +794,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[LoadBalancingPool, AsyncSinglePage[LoadBalancingPool]]: + ) -> AsyncPaginator[Pool, AsyncSinglePage[Pool]]: """ List configured pools. @@ -869,7 +816,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/load_balancers/pools", - page=AsyncSinglePage[LoadBalancingPool], + page=AsyncSinglePage[Pool], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -877,7 +824,7 @@ def list( timeout=timeout, query=maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), ), - model=LoadBalancingPool, + model=Pool, ) async def delete( @@ -885,6 +832,7 @@ async def delete( pool_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -912,12 +860,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( f"/accounts/{account_id}/load_balancers/pools/{pool_id}", + body=await async_maybe_transform(body, pool_delete_params.PoolDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PoolDeleteResponse]._unwrapper, ), cast_to=cast(Type[PoolDeleteResponse], ResultWrapper[PoolDeleteResponse]), ) @@ -927,46 +876,26 @@ async def edit( pool_id: str, *, account_id: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, + check_regions: Optional[List[CheckRegion]] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_edit_params.LoadShedding | NotGiven = NOT_GIVEN, + load_shedding: LoadSheddingParam | NotGiven = NOT_GIVEN, longitude: float | NotGiven = NOT_GIVEN, minimum_origins: int | NotGiven = NOT_GIVEN, monitor: object | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_edit_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_edit_params.OriginSteering | NotGiven = NOT_GIVEN, - origins: Iterable[pool_edit_params.Origin] | NotGiven = NOT_GIVEN, + notification_filter: Optional[NotificationFilterParam] | NotGiven = NOT_GIVEN, + origin_steering: OriginSteeringParam | NotGiven = NOT_GIVEN, + origins: Iterable[OriginParam] | 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, - ) -> LoadBalancingPool: + ) -> Pool: """ Apply changes to an existing pool, overwriting the supplied properties. @@ -1052,9 +981,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Pool]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), + cast_to=cast(Type[Pool], ResultWrapper[Pool]), ) async def get( @@ -1068,7 +997,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingPool: + ) -> Pool: """ Fetch a single configured pool. @@ -1094,14 +1023,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Pool]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), + cast_to=cast(Type[Pool], ResultWrapper[Pool]), ) -class PoolsWithRawResponse: - def __init__(self, pools: Pools) -> None: +class PoolsResourceWithRawResponse: + def __init__(self, pools: PoolsResource) -> None: self._pools = pools self.create = to_raw_response_wrapper( @@ -1124,16 +1053,16 @@ def __init__(self, pools: Pools) -> None: ) @cached_property - def health(self) -> HealthWithRawResponse: - return HealthWithRawResponse(self._pools.health) + def health(self) -> HealthResourceWithRawResponse: + return HealthResourceWithRawResponse(self._pools.health) @cached_property - def references(self) -> ReferencesWithRawResponse: - return ReferencesWithRawResponse(self._pools.references) + def references(self) -> ReferencesResourceWithRawResponse: + return ReferencesResourceWithRawResponse(self._pools.references) -class AsyncPoolsWithRawResponse: - def __init__(self, pools: AsyncPools) -> None: +class AsyncPoolsResourceWithRawResponse: + def __init__(self, pools: AsyncPoolsResource) -> None: self._pools = pools self.create = async_to_raw_response_wrapper( @@ -1156,16 +1085,16 @@ def __init__(self, pools: AsyncPools) -> None: ) @cached_property - def health(self) -> AsyncHealthWithRawResponse: - return AsyncHealthWithRawResponse(self._pools.health) + def health(self) -> AsyncHealthResourceWithRawResponse: + return AsyncHealthResourceWithRawResponse(self._pools.health) @cached_property - def references(self) -> AsyncReferencesWithRawResponse: - return AsyncReferencesWithRawResponse(self._pools.references) + def references(self) -> AsyncReferencesResourceWithRawResponse: + return AsyncReferencesResourceWithRawResponse(self._pools.references) -class PoolsWithStreamingResponse: - def __init__(self, pools: Pools) -> None: +class PoolsResourceWithStreamingResponse: + def __init__(self, pools: PoolsResource) -> None: self._pools = pools self.create = to_streamed_response_wrapper( @@ -1188,16 +1117,16 @@ def __init__(self, pools: Pools) -> None: ) @cached_property - def health(self) -> HealthWithStreamingResponse: - return HealthWithStreamingResponse(self._pools.health) + def health(self) -> HealthResourceWithStreamingResponse: + return HealthResourceWithStreamingResponse(self._pools.health) @cached_property - def references(self) -> ReferencesWithStreamingResponse: - return ReferencesWithStreamingResponse(self._pools.references) + def references(self) -> ReferencesResourceWithStreamingResponse: + return ReferencesResourceWithStreamingResponse(self._pools.references) -class AsyncPoolsWithStreamingResponse: - def __init__(self, pools: AsyncPools) -> None: +class AsyncPoolsResourceWithStreamingResponse: + def __init__(self, pools: AsyncPoolsResource) -> None: self._pools = pools self.create = async_to_streamed_response_wrapper( @@ -1220,9 +1149,9 @@ def __init__(self, pools: AsyncPools) -> None: ) @cached_property - def health(self) -> AsyncHealthWithStreamingResponse: - return AsyncHealthWithStreamingResponse(self._pools.health) + def health(self) -> AsyncHealthResourceWithStreamingResponse: + return AsyncHealthResourceWithStreamingResponse(self._pools.health) @cached_property - def references(self) -> AsyncReferencesWithStreamingResponse: - return AsyncReferencesWithStreamingResponse(self._pools.references) + def references(self) -> AsyncReferencesResourceWithStreamingResponse: + return AsyncReferencesResourceWithStreamingResponse(self._pools.references) diff --git a/src/cloudflare/resources/load_balancers/pools/references.py b/src/cloudflare/resources/load_balancers/pools/references.py index 93d27b2debe..a66b780bb96 100644 --- a/src/cloudflare/resources/load_balancers/pools/references.py +++ b/src/cloudflare/resources/load_balancers/pools/references.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.load_balancers.pools import ReferenceGetResponse +from ....types.load_balancers.pools.reference_get_response import ReferenceGetResponse -__all__ = ["References", "AsyncReferences"] +__all__ = ["ReferencesResource", "AsyncReferencesResource"] -class References(SyncAPIResource): +class ReferencesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ReferencesWithRawResponse: - return ReferencesWithRawResponse(self) + def with_raw_response(self) -> ReferencesResourceWithRawResponse: + return ReferencesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ReferencesWithStreamingResponse: - return ReferencesWithStreamingResponse(self) + def with_streaming_response(self) -> ReferencesResourceWithStreamingResponse: + return ReferencesResourceWithStreamingResponse(self) def get( self, @@ -70,20 +70,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ReferenceGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ReferenceGetResponse]], ResultWrapper[ReferenceGetResponse]), ) -class AsyncReferences(AsyncAPIResource): +class AsyncReferencesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncReferencesWithRawResponse: - return AsyncReferencesWithRawResponse(self) + def with_raw_response(self) -> AsyncReferencesResourceWithRawResponse: + return AsyncReferencesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncReferencesWithStreamingResponse: - return AsyncReferencesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncReferencesResourceWithStreamingResponse: + return AsyncReferencesResourceWithStreamingResponse(self) async def get( self, @@ -122,14 +122,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ReferenceGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ReferenceGetResponse]], ResultWrapper[ReferenceGetResponse]), ) -class ReferencesWithRawResponse: - def __init__(self, references: References) -> None: +class ReferencesResourceWithRawResponse: + def __init__(self, references: ReferencesResource) -> None: self._references = references self.get = to_raw_response_wrapper( @@ -137,8 +137,8 @@ def __init__(self, references: References) -> None: ) -class AsyncReferencesWithRawResponse: - def __init__(self, references: AsyncReferences) -> None: +class AsyncReferencesResourceWithRawResponse: + def __init__(self, references: AsyncReferencesResource) -> None: self._references = references self.get = async_to_raw_response_wrapper( @@ -146,8 +146,8 @@ def __init__(self, references: AsyncReferences) -> None: ) -class ReferencesWithStreamingResponse: - def __init__(self, references: References) -> None: +class ReferencesResourceWithStreamingResponse: + def __init__(self, references: ReferencesResource) -> None: self._references = references self.get = to_streamed_response_wrapper( @@ -155,8 +155,8 @@ def __init__(self, references: References) -> None: ) -class AsyncReferencesWithStreamingResponse: - def __init__(self, references: AsyncReferences) -> None: +class AsyncReferencesResourceWithStreamingResponse: + def __init__(self, references: AsyncReferencesResource) -> None: self._references = references self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/load_balancers/previews.py b/src/cloudflare/resources/load_balancers/previews.py index 06267b7e36a..5014648be35 100644 --- a/src/cloudflare/resources/load_balancers/previews.py +++ b/src/cloudflare/resources/load_balancers/previews.py @@ -19,19 +19,19 @@ from ..._base_client import ( make_request_options, ) -from ...types.user.load_balancers import LoadBalancingPreview +from ...types.load_balancers.preview_get_response import PreviewGetResponse -__all__ = ["Previews", "AsyncPreviews"] +__all__ = ["PreviewsResource", "AsyncPreviewsResource"] -class Previews(SyncAPIResource): +class PreviewsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PreviewsWithRawResponse: - return PreviewsWithRawResponse(self) + def with_raw_response(self) -> PreviewsResourceWithRawResponse: + return PreviewsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PreviewsWithStreamingResponse: - return PreviewsWithStreamingResponse(self) + def with_streaming_response(self) -> PreviewsResourceWithStreamingResponse: + return PreviewsResourceWithStreamingResponse(self) def get( self, @@ -44,7 +44,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingPreview: + ) -> PreviewGetResponse: """ Get the result of a previous preview operation using the provided preview_id. @@ -70,20 +70,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PreviewGetResponse]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPreview], ResultWrapper[LoadBalancingPreview]), + cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]), ) -class AsyncPreviews(AsyncAPIResource): +class AsyncPreviewsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPreviewsWithRawResponse: - return AsyncPreviewsWithRawResponse(self) + def with_raw_response(self) -> AsyncPreviewsResourceWithRawResponse: + return AsyncPreviewsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPreviewsWithStreamingResponse: - return AsyncPreviewsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPreviewsResourceWithStreamingResponse: + return AsyncPreviewsResourceWithStreamingResponse(self) async def get( self, @@ -96,7 +96,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancingPreview: + ) -> PreviewGetResponse: """ Get the result of a previous preview operation using the provided preview_id. @@ -122,14 +122,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PreviewGetResponse]._unwrapper, ), - cast_to=cast(Type[LoadBalancingPreview], ResultWrapper[LoadBalancingPreview]), + cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]), ) -class PreviewsWithRawResponse: - def __init__(self, previews: Previews) -> None: +class PreviewsResourceWithRawResponse: + def __init__(self, previews: PreviewsResource) -> None: self._previews = previews self.get = to_raw_response_wrapper( @@ -137,8 +137,8 @@ def __init__(self, previews: Previews) -> None: ) -class AsyncPreviewsWithRawResponse: - def __init__(self, previews: AsyncPreviews) -> None: +class AsyncPreviewsResourceWithRawResponse: + def __init__(self, previews: AsyncPreviewsResource) -> None: self._previews = previews self.get = async_to_raw_response_wrapper( @@ -146,8 +146,8 @@ def __init__(self, previews: AsyncPreviews) -> None: ) -class PreviewsWithStreamingResponse: - def __init__(self, previews: Previews) -> None: +class PreviewsResourceWithStreamingResponse: + def __init__(self, previews: PreviewsResource) -> None: self._previews = previews self.get = to_streamed_response_wrapper( @@ -155,8 +155,8 @@ def __init__(self, previews: Previews) -> None: ) -class AsyncPreviewsWithStreamingResponse: - def __init__(self, previews: AsyncPreviews) -> None: +class AsyncPreviewsResourceWithStreamingResponse: + def __init__(self, previews: AsyncPreviewsResource) -> None: self._previews = previews self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/load_balancers/regions.py b/src/cloudflare/resources/load_balancers/regions.py index eb787f86d2d..21ce3a8b4eb 100644 --- a/src/cloudflare/resources/load_balancers/regions.py +++ b/src/cloudflare/resources/load_balancers/regions.py @@ -24,19 +24,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.load_balancers import RegionGetResponse, RegionListResponse, region_list_params +from ...types.load_balancers import region_list_params +from ...types.load_balancers.region_get_response import RegionGetResponse +from ...types.load_balancers.region_list_response import RegionListResponse -__all__ = ["Regions", "AsyncRegions"] +__all__ = ["RegionsResource", "AsyncRegionsResource"] -class Regions(SyncAPIResource): +class RegionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RegionsWithRawResponse: - return RegionsWithRawResponse(self) + def with_raw_response(self) -> RegionsResourceWithRawResponse: + return RegionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RegionsWithStreamingResponse: - return RegionsWithStreamingResponse(self) + def with_streaming_response(self) -> RegionsResourceWithStreamingResponse: + return RegionsResourceWithStreamingResponse(self) def list( self, @@ -91,7 +93,7 @@ def list( }, region_list_params.RegionListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RegionListResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RegionListResponse] @@ -146,7 +148,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RegionGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RegionGetResponse] @@ -155,14 +157,14 @@ def get( ) -class AsyncRegions(AsyncAPIResource): +class AsyncRegionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRegionsWithRawResponse: - return AsyncRegionsWithRawResponse(self) + def with_raw_response(self) -> AsyncRegionsResourceWithRawResponse: + return AsyncRegionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRegionsWithStreamingResponse: - return AsyncRegionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRegionsResourceWithStreamingResponse: + return AsyncRegionsResourceWithStreamingResponse(self) async def list( self, @@ -217,7 +219,7 @@ async def list( }, region_list_params.RegionListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RegionListResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RegionListResponse] @@ -272,7 +274,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RegionGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RegionGetResponse] @@ -281,8 +283,8 @@ async def get( ) -class RegionsWithRawResponse: - def __init__(self, regions: Regions) -> None: +class RegionsResourceWithRawResponse: + def __init__(self, regions: RegionsResource) -> None: self._regions = regions self.list = to_raw_response_wrapper( @@ -293,8 +295,8 @@ def __init__(self, regions: Regions) -> None: ) -class AsyncRegionsWithRawResponse: - def __init__(self, regions: AsyncRegions) -> None: +class AsyncRegionsResourceWithRawResponse: + def __init__(self, regions: AsyncRegionsResource) -> None: self._regions = regions self.list = async_to_raw_response_wrapper( @@ -305,8 +307,8 @@ def __init__(self, regions: AsyncRegions) -> None: ) -class RegionsWithStreamingResponse: - def __init__(self, regions: Regions) -> None: +class RegionsResourceWithStreamingResponse: + def __init__(self, regions: RegionsResource) -> None: self._regions = regions self.list = to_streamed_response_wrapper( @@ -317,8 +319,8 @@ def __init__(self, regions: Regions) -> None: ) -class AsyncRegionsWithStreamingResponse: - def __init__(self, regions: AsyncRegions) -> None: +class AsyncRegionsResourceWithStreamingResponse: + def __init__(self, regions: AsyncRegionsResource) -> None: self._regions = regions self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/load_balancers/searches.py b/src/cloudflare/resources/load_balancers/searches.py index 0fe4c63e9e7..5d52ce7aaec 100644 --- a/src/cloudflare/resources/load_balancers/searches.py +++ b/src/cloudflare/resources/load_balancers/searches.py @@ -23,19 +23,20 @@ from ..._base_client import ( make_request_options, ) -from ...types.load_balancers import SearchGetResponse, search_get_params +from ...types.load_balancers import search_get_params +from ...types.load_balancers.search_get_response import SearchGetResponse -__all__ = ["Searches", "AsyncSearches"] +__all__ = ["SearchesResource", "AsyncSearchesResource"] -class Searches(SyncAPIResource): +class SearchesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SearchesWithRawResponse: - return SearchesWithRawResponse(self) + def with_raw_response(self) -> SearchesResourceWithRawResponse: + return SearchesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SearchesWithStreamingResponse: - return SearchesWithStreamingResponse(self) + def with_streaming_response(self) -> SearchesResourceWithStreamingResponse: + return SearchesResourceWithStreamingResponse(self) def get( self, @@ -82,20 +83,20 @@ def get( }, search_get_params.SearchGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SearchGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SearchGetResponse]], ResultWrapper[SearchGetResponse]), ) -class AsyncSearches(AsyncAPIResource): +class AsyncSearchesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSearchesWithRawResponse: - return AsyncSearchesWithRawResponse(self) + def with_raw_response(self) -> AsyncSearchesResourceWithRawResponse: + return AsyncSearchesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSearchesWithStreamingResponse: - return AsyncSearchesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSearchesResourceWithStreamingResponse: + return AsyncSearchesResourceWithStreamingResponse(self) async def get( self, @@ -142,14 +143,14 @@ async def get( }, search_get_params.SearchGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SearchGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SearchGetResponse]], ResultWrapper[SearchGetResponse]), ) -class SearchesWithRawResponse: - def __init__(self, searches: Searches) -> None: +class SearchesResourceWithRawResponse: + def __init__(self, searches: SearchesResource) -> None: self._searches = searches self.get = to_raw_response_wrapper( @@ -157,8 +158,8 @@ def __init__(self, searches: Searches) -> None: ) -class AsyncSearchesWithRawResponse: - def __init__(self, searches: AsyncSearches) -> None: +class AsyncSearchesResourceWithRawResponse: + def __init__(self, searches: AsyncSearchesResource) -> None: self._searches = searches self.get = async_to_raw_response_wrapper( @@ -166,8 +167,8 @@ def __init__(self, searches: AsyncSearches) -> None: ) -class SearchesWithStreamingResponse: - def __init__(self, searches: Searches) -> None: +class SearchesResourceWithStreamingResponse: + def __init__(self, searches: SearchesResource) -> None: self._searches = searches self.get = to_streamed_response_wrapper( @@ -175,8 +176,8 @@ def __init__(self, searches: Searches) -> None: ) -class AsyncSearchesWithStreamingResponse: - def __init__(self, searches: AsyncSearches) -> None: +class AsyncSearchesResourceWithStreamingResponse: + def __init__(self, searches: AsyncSearchesResource) -> None: self._searches = searches self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logpush/__init__.py b/src/cloudflare/resources/logpush/__init__.py index cd54a2efc7d..a1e3be0ccc2 100644 --- a/src/cloudflare/resources/logpush/__init__.py +++ b/src/cloudflare/resources/logpush/__init__.py @@ -1,89 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .edge import ( - Edge, - AsyncEdge, - EdgeWithRawResponse, - AsyncEdgeWithRawResponse, - EdgeWithStreamingResponse, - AsyncEdgeWithStreamingResponse, + EdgeResource, + AsyncEdgeResource, + EdgeResourceWithRawResponse, + AsyncEdgeResourceWithRawResponse, + EdgeResourceWithStreamingResponse, + AsyncEdgeResourceWithStreamingResponse, ) from .jobs import ( - Jobs, - AsyncJobs, - JobsWithRawResponse, - AsyncJobsWithRawResponse, - JobsWithStreamingResponse, - AsyncJobsWithStreamingResponse, + JobsResource, + AsyncJobsResource, + JobsResourceWithRawResponse, + AsyncJobsResourceWithRawResponse, + JobsResourceWithStreamingResponse, + AsyncJobsResourceWithStreamingResponse, ) from .logpush import ( - Logpush, - AsyncLogpush, - LogpushWithRawResponse, - AsyncLogpushWithRawResponse, - LogpushWithStreamingResponse, - AsyncLogpushWithStreamingResponse, + LogpushResource, + AsyncLogpushResource, + LogpushResourceWithRawResponse, + AsyncLogpushResourceWithRawResponse, + LogpushResourceWithStreamingResponse, + AsyncLogpushResourceWithStreamingResponse, ) from .datasets import ( - Datasets, - AsyncDatasets, - DatasetsWithRawResponse, - AsyncDatasetsWithRawResponse, - DatasetsWithStreamingResponse, - AsyncDatasetsWithStreamingResponse, + DatasetsResource, + AsyncDatasetsResource, + DatasetsResourceWithRawResponse, + AsyncDatasetsResourceWithRawResponse, + DatasetsResourceWithStreamingResponse, + AsyncDatasetsResourceWithStreamingResponse, ) from .validate import ( - Validate, - AsyncValidate, - ValidateWithRawResponse, - AsyncValidateWithRawResponse, - ValidateWithStreamingResponse, - AsyncValidateWithStreamingResponse, + ValidateResource, + AsyncValidateResource, + ValidateResourceWithRawResponse, + AsyncValidateResourceWithRawResponse, + ValidateResourceWithStreamingResponse, + AsyncValidateResourceWithStreamingResponse, ) from .ownership import ( - Ownership, - AsyncOwnership, - OwnershipWithRawResponse, - AsyncOwnershipWithRawResponse, - OwnershipWithStreamingResponse, - AsyncOwnershipWithStreamingResponse, + OwnershipResource, + AsyncOwnershipResource, + OwnershipResourceWithRawResponse, + AsyncOwnershipResourceWithRawResponse, + OwnershipResourceWithStreamingResponse, + AsyncOwnershipResourceWithStreamingResponse, ) __all__ = [ - "Datasets", - "AsyncDatasets", - "DatasetsWithRawResponse", - "AsyncDatasetsWithRawResponse", - "DatasetsWithStreamingResponse", - "AsyncDatasetsWithStreamingResponse", - "Edge", - "AsyncEdge", - "EdgeWithRawResponse", - "AsyncEdgeWithRawResponse", - "EdgeWithStreamingResponse", - "AsyncEdgeWithStreamingResponse", - "Jobs", - "AsyncJobs", - "JobsWithRawResponse", - "AsyncJobsWithRawResponse", - "JobsWithStreamingResponse", - "AsyncJobsWithStreamingResponse", - "Ownership", - "AsyncOwnership", - "OwnershipWithRawResponse", - "AsyncOwnershipWithRawResponse", - "OwnershipWithStreamingResponse", - "AsyncOwnershipWithStreamingResponse", - "Validate", - "AsyncValidate", - "ValidateWithRawResponse", - "AsyncValidateWithRawResponse", - "ValidateWithStreamingResponse", - "AsyncValidateWithStreamingResponse", - "Logpush", - "AsyncLogpush", - "LogpushWithRawResponse", - "AsyncLogpushWithRawResponse", - "LogpushWithStreamingResponse", - "AsyncLogpushWithStreamingResponse", + "DatasetsResource", + "AsyncDatasetsResource", + "DatasetsResourceWithRawResponse", + "AsyncDatasetsResourceWithRawResponse", + "DatasetsResourceWithStreamingResponse", + "AsyncDatasetsResourceWithStreamingResponse", + "EdgeResource", + "AsyncEdgeResource", + "EdgeResourceWithRawResponse", + "AsyncEdgeResourceWithRawResponse", + "EdgeResourceWithStreamingResponse", + "AsyncEdgeResourceWithStreamingResponse", + "JobsResource", + "AsyncJobsResource", + "JobsResourceWithRawResponse", + "AsyncJobsResourceWithRawResponse", + "JobsResourceWithStreamingResponse", + "AsyncJobsResourceWithStreamingResponse", + "OwnershipResource", + "AsyncOwnershipResource", + "OwnershipResourceWithRawResponse", + "AsyncOwnershipResourceWithRawResponse", + "OwnershipResourceWithStreamingResponse", + "AsyncOwnershipResourceWithStreamingResponse", + "ValidateResource", + "AsyncValidateResource", + "ValidateResourceWithRawResponse", + "AsyncValidateResourceWithRawResponse", + "ValidateResourceWithStreamingResponse", + "AsyncValidateResourceWithStreamingResponse", + "LogpushResource", + "AsyncLogpushResource", + "LogpushResourceWithRawResponse", + "AsyncLogpushResourceWithRawResponse", + "LogpushResourceWithStreamingResponse", + "AsyncLogpushResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/logpush/datasets/__init__.py b/src/cloudflare/resources/logpush/datasets/__init__.py index 5f7eeabee86..55ef58eac3a 100644 --- a/src/cloudflare/resources/logpush/datasets/__init__.py +++ b/src/cloudflare/resources/logpush/datasets/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .jobs import ( - Jobs, - AsyncJobs, - JobsWithRawResponse, - AsyncJobsWithRawResponse, - JobsWithStreamingResponse, - AsyncJobsWithStreamingResponse, + JobsResource, + AsyncJobsResource, + JobsResourceWithRawResponse, + AsyncJobsResourceWithRawResponse, + JobsResourceWithStreamingResponse, + AsyncJobsResourceWithStreamingResponse, ) from .fields import ( - Fields, - AsyncFields, - FieldsWithRawResponse, - AsyncFieldsWithRawResponse, - FieldsWithStreamingResponse, - AsyncFieldsWithStreamingResponse, + FieldsResource, + AsyncFieldsResource, + FieldsResourceWithRawResponse, + AsyncFieldsResourceWithRawResponse, + FieldsResourceWithStreamingResponse, + AsyncFieldsResourceWithStreamingResponse, ) from .datasets import ( - Datasets, - AsyncDatasets, - DatasetsWithRawResponse, - AsyncDatasetsWithRawResponse, - DatasetsWithStreamingResponse, - AsyncDatasetsWithStreamingResponse, + DatasetsResource, + AsyncDatasetsResource, + DatasetsResourceWithRawResponse, + AsyncDatasetsResourceWithRawResponse, + DatasetsResourceWithStreamingResponse, + AsyncDatasetsResourceWithStreamingResponse, ) __all__ = [ - "Fields", - "AsyncFields", - "FieldsWithRawResponse", - "AsyncFieldsWithRawResponse", - "FieldsWithStreamingResponse", - "AsyncFieldsWithStreamingResponse", - "Jobs", - "AsyncJobs", - "JobsWithRawResponse", - "AsyncJobsWithRawResponse", - "JobsWithStreamingResponse", - "AsyncJobsWithStreamingResponse", - "Datasets", - "AsyncDatasets", - "DatasetsWithRawResponse", - "AsyncDatasetsWithRawResponse", - "DatasetsWithStreamingResponse", - "AsyncDatasetsWithStreamingResponse", + "FieldsResource", + "AsyncFieldsResource", + "FieldsResourceWithRawResponse", + "AsyncFieldsResourceWithRawResponse", + "FieldsResourceWithStreamingResponse", + "AsyncFieldsResourceWithStreamingResponse", + "JobsResource", + "AsyncJobsResource", + "JobsResourceWithRawResponse", + "AsyncJobsResourceWithRawResponse", + "JobsResourceWithStreamingResponse", + "AsyncJobsResourceWithStreamingResponse", + "DatasetsResource", + "AsyncDatasetsResource", + "DatasetsResourceWithRawResponse", + "AsyncDatasetsResourceWithRawResponse", + "DatasetsResourceWithStreamingResponse", + "AsyncDatasetsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/logpush/datasets/datasets.py b/src/cloudflare/resources/logpush/datasets/datasets.py index 65efe906677..e2218d3f1db 100644 --- a/src/cloudflare/resources/logpush/datasets/datasets.py +++ b/src/cloudflare/resources/logpush/datasets/datasets.py @@ -3,110 +3,110 @@ from __future__ import annotations from .jobs import ( - Jobs, - AsyncJobs, - JobsWithRawResponse, - AsyncJobsWithRawResponse, - JobsWithStreamingResponse, - AsyncJobsWithStreamingResponse, + JobsResource, + AsyncJobsResource, + JobsResourceWithRawResponse, + AsyncJobsResourceWithRawResponse, + JobsResourceWithStreamingResponse, + AsyncJobsResourceWithStreamingResponse, ) from .fields import ( - Fields, - AsyncFields, - FieldsWithRawResponse, - AsyncFieldsWithRawResponse, - FieldsWithStreamingResponse, - AsyncFieldsWithStreamingResponse, + FieldsResource, + AsyncFieldsResource, + FieldsResourceWithRawResponse, + AsyncFieldsResourceWithRawResponse, + FieldsResourceWithStreamingResponse, + AsyncFieldsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Datasets", "AsyncDatasets"] +__all__ = ["DatasetsResource", "AsyncDatasetsResource"] -class Datasets(SyncAPIResource): +class DatasetsResource(SyncAPIResource): @cached_property - def fields(self) -> Fields: - return Fields(self._client) + def fields(self) -> FieldsResource: + return FieldsResource(self._client) @cached_property - def jobs(self) -> Jobs: - return Jobs(self._client) + def jobs(self) -> JobsResource: + return JobsResource(self._client) @cached_property - def with_raw_response(self) -> DatasetsWithRawResponse: - return DatasetsWithRawResponse(self) + def with_raw_response(self) -> DatasetsResourceWithRawResponse: + return DatasetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DatasetsWithStreamingResponse: - return DatasetsWithStreamingResponse(self) + def with_streaming_response(self) -> DatasetsResourceWithStreamingResponse: + return DatasetsResourceWithStreamingResponse(self) -class AsyncDatasets(AsyncAPIResource): +class AsyncDatasetsResource(AsyncAPIResource): @cached_property - def fields(self) -> AsyncFields: - return AsyncFields(self._client) + def fields(self) -> AsyncFieldsResource: + return AsyncFieldsResource(self._client) @cached_property - def jobs(self) -> AsyncJobs: - return AsyncJobs(self._client) + def jobs(self) -> AsyncJobsResource: + return AsyncJobsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDatasetsWithRawResponse: - return AsyncDatasetsWithRawResponse(self) + def with_raw_response(self) -> AsyncDatasetsResourceWithRawResponse: + return AsyncDatasetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDatasetsWithStreamingResponse: - return AsyncDatasetsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDatasetsResourceWithStreamingResponse: + return AsyncDatasetsResourceWithStreamingResponse(self) -class DatasetsWithRawResponse: - def __init__(self, datasets: Datasets) -> None: +class DatasetsResourceWithRawResponse: + def __init__(self, datasets: DatasetsResource) -> None: self._datasets = datasets @cached_property - def fields(self) -> FieldsWithRawResponse: - return FieldsWithRawResponse(self._datasets.fields) + def fields(self) -> FieldsResourceWithRawResponse: + return FieldsResourceWithRawResponse(self._datasets.fields) @cached_property - def jobs(self) -> JobsWithRawResponse: - return JobsWithRawResponse(self._datasets.jobs) + def jobs(self) -> JobsResourceWithRawResponse: + return JobsResourceWithRawResponse(self._datasets.jobs) -class AsyncDatasetsWithRawResponse: - def __init__(self, datasets: AsyncDatasets) -> None: +class AsyncDatasetsResourceWithRawResponse: + def __init__(self, datasets: AsyncDatasetsResource) -> None: self._datasets = datasets @cached_property - def fields(self) -> AsyncFieldsWithRawResponse: - return AsyncFieldsWithRawResponse(self._datasets.fields) + def fields(self) -> AsyncFieldsResourceWithRawResponse: + return AsyncFieldsResourceWithRawResponse(self._datasets.fields) @cached_property - def jobs(self) -> AsyncJobsWithRawResponse: - return AsyncJobsWithRawResponse(self._datasets.jobs) + def jobs(self) -> AsyncJobsResourceWithRawResponse: + return AsyncJobsResourceWithRawResponse(self._datasets.jobs) -class DatasetsWithStreamingResponse: - def __init__(self, datasets: Datasets) -> None: +class DatasetsResourceWithStreamingResponse: + def __init__(self, datasets: DatasetsResource) -> None: self._datasets = datasets @cached_property - def fields(self) -> FieldsWithStreamingResponse: - return FieldsWithStreamingResponse(self._datasets.fields) + def fields(self) -> FieldsResourceWithStreamingResponse: + return FieldsResourceWithStreamingResponse(self._datasets.fields) @cached_property - def jobs(self) -> JobsWithStreamingResponse: - return JobsWithStreamingResponse(self._datasets.jobs) + def jobs(self) -> JobsResourceWithStreamingResponse: + return JobsResourceWithStreamingResponse(self._datasets.jobs) -class AsyncDatasetsWithStreamingResponse: - def __init__(self, datasets: AsyncDatasets) -> None: +class AsyncDatasetsResourceWithStreamingResponse: + def __init__(self, datasets: AsyncDatasetsResource) -> None: self._datasets = datasets @cached_property - def fields(self) -> AsyncFieldsWithStreamingResponse: - return AsyncFieldsWithStreamingResponse(self._datasets.fields) + def fields(self) -> AsyncFieldsResourceWithStreamingResponse: + return AsyncFieldsResourceWithStreamingResponse(self._datasets.fields) @cached_property - def jobs(self) -> AsyncJobsWithStreamingResponse: - return AsyncJobsWithStreamingResponse(self._datasets.jobs) + def jobs(self) -> AsyncJobsResourceWithStreamingResponse: + return AsyncJobsResourceWithStreamingResponse(self._datasets.jobs) diff --git a/src/cloudflare/resources/logpush/datasets/fields.py b/src/cloudflare/resources/logpush/datasets/fields.py index a3c36cb11a8..8fd43b17e1c 100644 --- a/src/cloudflare/resources/logpush/datasets/fields.py +++ b/src/cloudflare/resources/logpush/datasets/fields.py @@ -20,17 +20,17 @@ make_request_options, ) -__all__ = ["Fields", "AsyncFields"] +__all__ = ["FieldsResource", "AsyncFieldsResource"] -class Fields(SyncAPIResource): +class FieldsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FieldsWithRawResponse: - return FieldsWithRawResponse(self) + def with_raw_response(self) -> FieldsResourceWithRawResponse: + return FieldsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FieldsWithStreamingResponse: - return FieldsWithStreamingResponse(self) + def with_streaming_response(self) -> FieldsResourceWithStreamingResponse: + return FieldsResourceWithStreamingResponse(self) def get( self, @@ -67,12 +67,6 @@ def get( """ if not dataset_id: raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -80,6 +74,9 @@ def get( 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._get( @@ -89,20 +86,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) -class AsyncFields(AsyncAPIResource): +class AsyncFieldsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFieldsWithRawResponse: - return AsyncFieldsWithRawResponse(self) + def with_raw_response(self) -> AsyncFieldsResourceWithRawResponse: + return AsyncFieldsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFieldsWithStreamingResponse: - return AsyncFieldsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFieldsResourceWithStreamingResponse: + return AsyncFieldsResourceWithStreamingResponse(self) async def get( self, @@ -139,12 +136,6 @@ async def get( """ if not dataset_id: raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -152,6 +143,9 @@ async def get( 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._get( @@ -161,14 +155,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) -class FieldsWithRawResponse: - def __init__(self, fields: Fields) -> None: +class FieldsResourceWithRawResponse: + def __init__(self, fields: FieldsResource) -> None: self._fields = fields self.get = to_raw_response_wrapper( @@ -176,8 +170,8 @@ def __init__(self, fields: Fields) -> None: ) -class AsyncFieldsWithRawResponse: - def __init__(self, fields: AsyncFields) -> None: +class AsyncFieldsResourceWithRawResponse: + def __init__(self, fields: AsyncFieldsResource) -> None: self._fields = fields self.get = async_to_raw_response_wrapper( @@ -185,8 +179,8 @@ def __init__(self, fields: AsyncFields) -> None: ) -class FieldsWithStreamingResponse: - def __init__(self, fields: Fields) -> None: +class FieldsResourceWithStreamingResponse: + def __init__(self, fields: FieldsResource) -> None: self._fields = fields self.get = to_streamed_response_wrapper( @@ -194,8 +188,8 @@ def __init__(self, fields: Fields) -> None: ) -class AsyncFieldsWithStreamingResponse: - def __init__(self, fields: AsyncFields) -> None: +class AsyncFieldsResourceWithStreamingResponse: + def __init__(self, fields: AsyncFieldsResource) -> None: self._fields = fields self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logpush/datasets/jobs.py b/src/cloudflare/resources/logpush/datasets/jobs.py index 1fa7369012c..92dc0138053 100644 --- a/src/cloudflare/resources/logpush/datasets/jobs.py +++ b/src/cloudflare/resources/logpush/datasets/jobs.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.logpush.datasets import JobGetResponse +from ....types.logpush.datasets.job_get_response import JobGetResponse -__all__ = ["Jobs", "AsyncJobs"] +__all__ = ["JobsResource", "AsyncJobsResource"] -class Jobs(SyncAPIResource): +class JobsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> JobsWithRawResponse: - return JobsWithRawResponse(self) + def with_raw_response(self) -> JobsResourceWithRawResponse: + return JobsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> JobsWithStreamingResponse: - return JobsWithStreamingResponse(self) + def with_streaming_response(self) -> JobsResourceWithStreamingResponse: + return JobsResourceWithStreamingResponse(self) def get( self, @@ -45,7 +45,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobGetResponse: + ) -> Optional[JobGetResponse]: """ Lists Logpush jobs for an account or zone for a dataset. @@ -66,12 +66,6 @@ def get( """ if not dataset_id: raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -79,6 +73,9 @@ def get( 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._get( @@ -88,20 +85,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[JobGetResponse]]._unwrapper, ), - cast_to=cast(Type[JobGetResponse], ResultWrapper[JobGetResponse]), + cast_to=cast(Type[Optional[JobGetResponse]], ResultWrapper[JobGetResponse]), ) -class AsyncJobs(AsyncAPIResource): +class AsyncJobsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncJobsWithRawResponse: - return AsyncJobsWithRawResponse(self) + def with_raw_response(self) -> AsyncJobsResourceWithRawResponse: + return AsyncJobsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncJobsWithStreamingResponse: - return AsyncJobsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncJobsResourceWithStreamingResponse: + return AsyncJobsResourceWithStreamingResponse(self) async def get( self, @@ -115,7 +112,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobGetResponse: + ) -> Optional[JobGetResponse]: """ Lists Logpush jobs for an account or zone for a dataset. @@ -136,12 +133,6 @@ async def get( """ if not dataset_id: raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -149,6 +140,9 @@ async def get( 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._get( @@ -158,14 +152,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[JobGetResponse]]._unwrapper, ), - cast_to=cast(Type[JobGetResponse], ResultWrapper[JobGetResponse]), + cast_to=cast(Type[Optional[JobGetResponse]], ResultWrapper[JobGetResponse]), ) -class JobsWithRawResponse: - def __init__(self, jobs: Jobs) -> None: +class JobsResourceWithRawResponse: + def __init__(self, jobs: JobsResource) -> None: self._jobs = jobs self.get = to_raw_response_wrapper( @@ -173,8 +167,8 @@ def __init__(self, jobs: Jobs) -> None: ) -class AsyncJobsWithRawResponse: - def __init__(self, jobs: AsyncJobs) -> None: +class AsyncJobsResourceWithRawResponse: + def __init__(self, jobs: AsyncJobsResource) -> None: self._jobs = jobs self.get = async_to_raw_response_wrapper( @@ -182,8 +176,8 @@ def __init__(self, jobs: AsyncJobs) -> None: ) -class JobsWithStreamingResponse: - def __init__(self, jobs: Jobs) -> None: +class JobsResourceWithStreamingResponse: + def __init__(self, jobs: JobsResource) -> None: self._jobs = jobs self.get = to_streamed_response_wrapper( @@ -191,8 +185,8 @@ def __init__(self, jobs: Jobs) -> None: ) -class AsyncJobsWithStreamingResponse: - def __init__(self, jobs: AsyncJobs) -> None: +class AsyncJobsResourceWithStreamingResponse: + def __init__(self, jobs: AsyncJobsResource) -> None: self._jobs = jobs self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logpush/edge.py b/src/cloudflare/resources/logpush/edge.py index 6d7d106f081..de3d6ff76e2 100644 --- a/src/cloudflare/resources/logpush/edge.py +++ b/src/cloudflare/resources/logpush/edge.py @@ -23,19 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.logpush import EdgeGetResponse, InstantLogpushJob, edge_create_params +from ...types.logpush import edge_create_params +from ...types.logpush.edge_get_response import EdgeGetResponse +from ...types.logpush.instant_logpush_job import InstantLogpushJob -__all__ = ["Edge", "AsyncEdge"] +__all__ = ["EdgeResource", "AsyncEdgeResource"] -class Edge(SyncAPIResource): +class EdgeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> EdgeWithRawResponse: - return EdgeWithRawResponse(self) + def with_raw_response(self) -> EdgeResourceWithRawResponse: + return EdgeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EdgeWithStreamingResponse: - return EdgeWithStreamingResponse(self) + def with_streaming_response(self) -> EdgeResourceWithStreamingResponse: + return EdgeResourceWithStreamingResponse(self) def create( self, @@ -90,7 +92,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[InstantLogpushJob]]._unwrapper, ), cast_to=cast(Type[Optional[InstantLogpushJob]], ResultWrapper[InstantLogpushJob]), ) @@ -105,7 +107,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EdgeGetResponse: + ) -> Optional[EdgeGetResponse]: """ Lists Instant Logs jobs for a zone. @@ -129,20 +131,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EdgeGetResponse]]._unwrapper, ), - cast_to=cast(Type[EdgeGetResponse], ResultWrapper[EdgeGetResponse]), + cast_to=cast(Type[Optional[EdgeGetResponse]], ResultWrapper[EdgeGetResponse]), ) -class AsyncEdge(AsyncAPIResource): +class AsyncEdgeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncEdgeWithRawResponse: - return AsyncEdgeWithRawResponse(self) + def with_raw_response(self) -> AsyncEdgeResourceWithRawResponse: + return AsyncEdgeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEdgeWithStreamingResponse: - return AsyncEdgeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEdgeResourceWithStreamingResponse: + return AsyncEdgeResourceWithStreamingResponse(self) async def create( self, @@ -197,7 +199,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[InstantLogpushJob]]._unwrapper, ), cast_to=cast(Type[Optional[InstantLogpushJob]], ResultWrapper[InstantLogpushJob]), ) @@ -212,7 +214,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EdgeGetResponse: + ) -> Optional[EdgeGetResponse]: """ Lists Instant Logs jobs for a zone. @@ -236,14 +238,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EdgeGetResponse]]._unwrapper, ), - cast_to=cast(Type[EdgeGetResponse], ResultWrapper[EdgeGetResponse]), + cast_to=cast(Type[Optional[EdgeGetResponse]], ResultWrapper[EdgeGetResponse]), ) -class EdgeWithRawResponse: - def __init__(self, edge: Edge) -> None: +class EdgeResourceWithRawResponse: + def __init__(self, edge: EdgeResource) -> None: self._edge = edge self.create = to_raw_response_wrapper( @@ -254,8 +256,8 @@ def __init__(self, edge: Edge) -> None: ) -class AsyncEdgeWithRawResponse: - def __init__(self, edge: AsyncEdge) -> None: +class AsyncEdgeResourceWithRawResponse: + def __init__(self, edge: AsyncEdgeResource) -> None: self._edge = edge self.create = async_to_raw_response_wrapper( @@ -266,8 +268,8 @@ def __init__(self, edge: AsyncEdge) -> None: ) -class EdgeWithStreamingResponse: - def __init__(self, edge: Edge) -> None: +class EdgeResourceWithStreamingResponse: + def __init__(self, edge: EdgeResource) -> None: self._edge = edge self.create = to_streamed_response_wrapper( @@ -278,8 +280,8 @@ def __init__(self, edge: Edge) -> None: ) -class AsyncEdgeWithStreamingResponse: - def __init__(self, edge: AsyncEdge) -> None: +class AsyncEdgeResourceWithStreamingResponse: + def __init__(self, edge: AsyncEdgeResource) -> None: self._edge = edge self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logpush/jobs.py b/src/cloudflare/resources/logpush/jobs.py index 13b4b38af47..1262ffd13fd 100644 --- a/src/cloudflare/resources/logpush/jobs.py +++ b/src/cloudflare/resources/logpush/jobs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -26,20 +26,21 @@ AsyncPaginator, make_request_options, ) -from ...types.logpush import JobDeleteResponse, job_create_params, job_update_params -from ...types.logpush.datasets import LogpushJob +from ...types.logpush import job_create_params, job_delete_params, job_update_params +from ...types.logpush.logpush_job import LogpushJob +from ...types.logpush.output_options_param import OutputOptionsParam -__all__ = ["Jobs", "AsyncJobs"] +__all__ = ["JobsResource", "AsyncJobsResource"] -class Jobs(SyncAPIResource): +class JobsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> JobsWithRawResponse: - return JobsWithRawResponse(self) + def with_raw_response(self) -> JobsResourceWithRawResponse: + return JobsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> JobsWithStreamingResponse: - return JobsWithStreamingResponse(self) + def with_streaming_response(self) -> JobsResourceWithStreamingResponse: + return JobsResourceWithStreamingResponse(self) def create( self, @@ -52,7 +53,7 @@ def create( frequency: Optional[Literal["high", "low"]] | NotGiven = NOT_GIVEN, logpull_options: Optional[str] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - output_options: Optional[job_create_params.OutputOptions] | 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. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -104,12 +105,6 @@ def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -117,6 +112,9 @@ def create( 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( @@ -139,7 +137,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LogpushJob]]._unwrapper, ), cast_to=cast(Type[Optional[LogpushJob]], ResultWrapper[LogpushJob]), ) @@ -154,7 +152,7 @@ def update( enabled: bool | NotGiven = NOT_GIVEN, frequency: Optional[Literal["high", "low"]] | NotGiven = NOT_GIVEN, logpull_options: Optional[str] | NotGiven = NOT_GIVEN, - output_options: Optional[job_update_params.OutputOptions] | 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. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -202,12 +200,6 @@ def update( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -215,6 +207,9 @@ def update( 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._put( @@ -235,7 +230,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LogpushJob]]._unwrapper, ), cast_to=cast(Type[Optional[LogpushJob]], ResultWrapper[LogpushJob]), ) @@ -268,12 +263,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -281,6 +270,9 @@ def list( 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._get_api_list( @@ -296,6 +288,7 @@ def delete( self, job_id: int, *, + body: object, 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. @@ -304,7 +297,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[JobDeleteResponse]: + ) -> object: """ Deletes a Logpush job. @@ -323,12 +316,6 @@ def delete( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -336,23 +323,22 @@ def delete( 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 cast( - Optional[JobDeleteResponse], - self._delete( - f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[JobDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}", + body=maybe_transform(body, job_delete_params.JobDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) def get( @@ -386,12 +372,6 @@ def get( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -399,6 +379,9 @@ def get( 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._get( @@ -408,20 +391,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LogpushJob]]._unwrapper, ), cast_to=cast(Type[Optional[LogpushJob]], ResultWrapper[LogpushJob]), ) -class AsyncJobs(AsyncAPIResource): +class AsyncJobsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncJobsWithRawResponse: - return AsyncJobsWithRawResponse(self) + def with_raw_response(self) -> AsyncJobsResourceWithRawResponse: + return AsyncJobsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncJobsWithStreamingResponse: - return AsyncJobsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncJobsResourceWithStreamingResponse: + return AsyncJobsResourceWithStreamingResponse(self) async def create( self, @@ -434,7 +417,7 @@ async def create( frequency: Optional[Literal["high", "low"]] | NotGiven = NOT_GIVEN, logpull_options: Optional[str] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - output_options: Optional[job_create_params.OutputOptions] | 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. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -486,12 +469,6 @@ async def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -499,6 +476,9 @@ async def create( 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( @@ -521,7 +501,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LogpushJob]]._unwrapper, ), cast_to=cast(Type[Optional[LogpushJob]], ResultWrapper[LogpushJob]), ) @@ -536,7 +516,7 @@ async def update( enabled: bool | NotGiven = NOT_GIVEN, frequency: Optional[Literal["high", "low"]] | NotGiven = NOT_GIVEN, logpull_options: Optional[str] | NotGiven = NOT_GIVEN, - output_options: Optional[job_update_params.OutputOptions] | 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. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -584,12 +564,6 @@ async def update( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -597,6 +571,9 @@ async def update( 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._put( @@ -617,7 +594,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LogpushJob]]._unwrapper, ), cast_to=cast(Type[Optional[LogpushJob]], ResultWrapper[LogpushJob]), ) @@ -650,12 +627,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -663,6 +634,9 @@ def list( 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._get_api_list( @@ -678,6 +652,7 @@ async def delete( self, job_id: int, *, + body: object, 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. @@ -686,7 +661,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[JobDeleteResponse]: + ) -> object: """ Deletes a Logpush job. @@ -705,12 +680,6 @@ async def delete( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -718,23 +687,22 @@ async def delete( 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 cast( - Optional[JobDeleteResponse], - await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[JobDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}", + body=await async_maybe_transform(body, job_delete_params.JobDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) async def get( @@ -768,12 +736,6 @@ async def get( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -781,6 +743,9 @@ async def get( 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._get( @@ -790,14 +755,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LogpushJob]]._unwrapper, ), cast_to=cast(Type[Optional[LogpushJob]], ResultWrapper[LogpushJob]), ) -class JobsWithRawResponse: - def __init__(self, jobs: Jobs) -> None: +class JobsResourceWithRawResponse: + def __init__(self, jobs: JobsResource) -> None: self._jobs = jobs self.create = to_raw_response_wrapper( @@ -817,8 +782,8 @@ def __init__(self, jobs: Jobs) -> None: ) -class AsyncJobsWithRawResponse: - def __init__(self, jobs: AsyncJobs) -> None: +class AsyncJobsResourceWithRawResponse: + def __init__(self, jobs: AsyncJobsResource) -> None: self._jobs = jobs self.create = async_to_raw_response_wrapper( @@ -838,8 +803,8 @@ def __init__(self, jobs: AsyncJobs) -> None: ) -class JobsWithStreamingResponse: - def __init__(self, jobs: Jobs) -> None: +class JobsResourceWithStreamingResponse: + def __init__(self, jobs: JobsResource) -> None: self._jobs = jobs self.create = to_streamed_response_wrapper( @@ -859,8 +824,8 @@ def __init__(self, jobs: Jobs) -> None: ) -class AsyncJobsWithStreamingResponse: - def __init__(self, jobs: AsyncJobs) -> None: +class AsyncJobsResourceWithStreamingResponse: + def __init__(self, jobs: AsyncJobsResource) -> None: self._jobs = jobs self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logpush/logpush.py b/src/cloudflare/resources/logpush/logpush.py index 40d828d2952..4b316a9b912 100644 --- a/src/cloudflare/resources/logpush/logpush.py +++ b/src/cloudflare/resources/logpush/logpush.py @@ -3,207 +3,207 @@ from __future__ import annotations from .edge import ( - Edge, - AsyncEdge, - EdgeWithRawResponse, - AsyncEdgeWithRawResponse, - EdgeWithStreamingResponse, - AsyncEdgeWithStreamingResponse, + EdgeResource, + AsyncEdgeResource, + EdgeResourceWithRawResponse, + AsyncEdgeResourceWithRawResponse, + EdgeResourceWithStreamingResponse, + AsyncEdgeResourceWithStreamingResponse, ) from .jobs import ( - Jobs, - AsyncJobs, - JobsWithRawResponse, - AsyncJobsWithRawResponse, - JobsWithStreamingResponse, - AsyncJobsWithStreamingResponse, + JobsResource, + AsyncJobsResource, + JobsResourceWithRawResponse, + AsyncJobsResourceWithRawResponse, + JobsResourceWithStreamingResponse, + AsyncJobsResourceWithStreamingResponse, ) from .datasets import ( - Datasets, - AsyncDatasets, - DatasetsWithRawResponse, - AsyncDatasetsWithRawResponse, - DatasetsWithStreamingResponse, - AsyncDatasetsWithStreamingResponse, + DatasetsResource, + AsyncDatasetsResource, + DatasetsResourceWithRawResponse, + AsyncDatasetsResourceWithRawResponse, + DatasetsResourceWithStreamingResponse, + AsyncDatasetsResourceWithStreamingResponse, ) from .validate import ( - Validate, - AsyncValidate, - ValidateWithRawResponse, - AsyncValidateWithRawResponse, - ValidateWithStreamingResponse, - AsyncValidateWithStreamingResponse, + ValidateResource, + AsyncValidateResource, + ValidateResourceWithRawResponse, + AsyncValidateResourceWithRawResponse, + ValidateResourceWithStreamingResponse, + AsyncValidateResourceWithStreamingResponse, ) from ..._compat import cached_property from .ownership import ( - Ownership, - AsyncOwnership, - OwnershipWithRawResponse, - AsyncOwnershipWithRawResponse, - OwnershipWithStreamingResponse, - AsyncOwnershipWithStreamingResponse, + OwnershipResource, + AsyncOwnershipResource, + OwnershipResourceWithRawResponse, + AsyncOwnershipResourceWithRawResponse, + OwnershipResourceWithStreamingResponse, + AsyncOwnershipResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .datasets.datasets import Datasets, AsyncDatasets +from .datasets.datasets import DatasetsResource, AsyncDatasetsResource -__all__ = ["Logpush", "AsyncLogpush"] +__all__ = ["LogpushResource", "AsyncLogpushResource"] -class Logpush(SyncAPIResource): +class LogpushResource(SyncAPIResource): @cached_property - def datasets(self) -> Datasets: - return Datasets(self._client) + def datasets(self) -> DatasetsResource: + return DatasetsResource(self._client) @cached_property - def edge(self) -> Edge: - return Edge(self._client) + def edge(self) -> EdgeResource: + return EdgeResource(self._client) @cached_property - def jobs(self) -> Jobs: - return Jobs(self._client) + def jobs(self) -> JobsResource: + return JobsResource(self._client) @cached_property - def ownership(self) -> Ownership: - return Ownership(self._client) + def ownership(self) -> OwnershipResource: + return OwnershipResource(self._client) @cached_property - def validate(self) -> Validate: - return Validate(self._client) + def validate(self) -> ValidateResource: + return ValidateResource(self._client) @cached_property - def with_raw_response(self) -> LogpushWithRawResponse: - return LogpushWithRawResponse(self) + def with_raw_response(self) -> LogpushResourceWithRawResponse: + return LogpushResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LogpushWithStreamingResponse: - return LogpushWithStreamingResponse(self) + def with_streaming_response(self) -> LogpushResourceWithStreamingResponse: + return LogpushResourceWithStreamingResponse(self) -class AsyncLogpush(AsyncAPIResource): +class AsyncLogpushResource(AsyncAPIResource): @cached_property - def datasets(self) -> AsyncDatasets: - return AsyncDatasets(self._client) + def datasets(self) -> AsyncDatasetsResource: + return AsyncDatasetsResource(self._client) @cached_property - def edge(self) -> AsyncEdge: - return AsyncEdge(self._client) + def edge(self) -> AsyncEdgeResource: + return AsyncEdgeResource(self._client) @cached_property - def jobs(self) -> AsyncJobs: - return AsyncJobs(self._client) + def jobs(self) -> AsyncJobsResource: + return AsyncJobsResource(self._client) @cached_property - def ownership(self) -> AsyncOwnership: - return AsyncOwnership(self._client) + def ownership(self) -> AsyncOwnershipResource: + return AsyncOwnershipResource(self._client) @cached_property - def validate(self) -> AsyncValidate: - return AsyncValidate(self._client) + def validate(self) -> AsyncValidateResource: + return AsyncValidateResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLogpushWithRawResponse: - return AsyncLogpushWithRawResponse(self) + def with_raw_response(self) -> AsyncLogpushResourceWithRawResponse: + return AsyncLogpushResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLogpushWithStreamingResponse: - return AsyncLogpushWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLogpushResourceWithStreamingResponse: + return AsyncLogpushResourceWithStreamingResponse(self) -class LogpushWithRawResponse: - def __init__(self, logpush: Logpush) -> None: +class LogpushResourceWithRawResponse: + def __init__(self, logpush: LogpushResource) -> None: self._logpush = logpush @cached_property - def datasets(self) -> DatasetsWithRawResponse: - return DatasetsWithRawResponse(self._logpush.datasets) + def datasets(self) -> DatasetsResourceWithRawResponse: + return DatasetsResourceWithRawResponse(self._logpush.datasets) @cached_property - def edge(self) -> EdgeWithRawResponse: - return EdgeWithRawResponse(self._logpush.edge) + def edge(self) -> EdgeResourceWithRawResponse: + return EdgeResourceWithRawResponse(self._logpush.edge) @cached_property - def jobs(self) -> JobsWithRawResponse: - return JobsWithRawResponse(self._logpush.jobs) + def jobs(self) -> JobsResourceWithRawResponse: + return JobsResourceWithRawResponse(self._logpush.jobs) @cached_property - def ownership(self) -> OwnershipWithRawResponse: - return OwnershipWithRawResponse(self._logpush.ownership) + def ownership(self) -> OwnershipResourceWithRawResponse: + return OwnershipResourceWithRawResponse(self._logpush.ownership) @cached_property - def validate(self) -> ValidateWithRawResponse: - return ValidateWithRawResponse(self._logpush.validate) + def validate(self) -> ValidateResourceWithRawResponse: + return ValidateResourceWithRawResponse(self._logpush.validate) -class AsyncLogpushWithRawResponse: - def __init__(self, logpush: AsyncLogpush) -> None: +class AsyncLogpushResourceWithRawResponse: + def __init__(self, logpush: AsyncLogpushResource) -> None: self._logpush = logpush @cached_property - def datasets(self) -> AsyncDatasetsWithRawResponse: - return AsyncDatasetsWithRawResponse(self._logpush.datasets) + def datasets(self) -> AsyncDatasetsResourceWithRawResponse: + return AsyncDatasetsResourceWithRawResponse(self._logpush.datasets) @cached_property - def edge(self) -> AsyncEdgeWithRawResponse: - return AsyncEdgeWithRawResponse(self._logpush.edge) + def edge(self) -> AsyncEdgeResourceWithRawResponse: + return AsyncEdgeResourceWithRawResponse(self._logpush.edge) @cached_property - def jobs(self) -> AsyncJobsWithRawResponse: - return AsyncJobsWithRawResponse(self._logpush.jobs) + def jobs(self) -> AsyncJobsResourceWithRawResponse: + return AsyncJobsResourceWithRawResponse(self._logpush.jobs) @cached_property - def ownership(self) -> AsyncOwnershipWithRawResponse: - return AsyncOwnershipWithRawResponse(self._logpush.ownership) + def ownership(self) -> AsyncOwnershipResourceWithRawResponse: + return AsyncOwnershipResourceWithRawResponse(self._logpush.ownership) @cached_property - def validate(self) -> AsyncValidateWithRawResponse: - return AsyncValidateWithRawResponse(self._logpush.validate) + def validate(self) -> AsyncValidateResourceWithRawResponse: + return AsyncValidateResourceWithRawResponse(self._logpush.validate) -class LogpushWithStreamingResponse: - def __init__(self, logpush: Logpush) -> None: +class LogpushResourceWithStreamingResponse: + def __init__(self, logpush: LogpushResource) -> None: self._logpush = logpush @cached_property - def datasets(self) -> DatasetsWithStreamingResponse: - return DatasetsWithStreamingResponse(self._logpush.datasets) + def datasets(self) -> DatasetsResourceWithStreamingResponse: + return DatasetsResourceWithStreamingResponse(self._logpush.datasets) @cached_property - def edge(self) -> EdgeWithStreamingResponse: - return EdgeWithStreamingResponse(self._logpush.edge) + def edge(self) -> EdgeResourceWithStreamingResponse: + return EdgeResourceWithStreamingResponse(self._logpush.edge) @cached_property - def jobs(self) -> JobsWithStreamingResponse: - return JobsWithStreamingResponse(self._logpush.jobs) + def jobs(self) -> JobsResourceWithStreamingResponse: + return JobsResourceWithStreamingResponse(self._logpush.jobs) @cached_property - def ownership(self) -> OwnershipWithStreamingResponse: - return OwnershipWithStreamingResponse(self._logpush.ownership) + def ownership(self) -> OwnershipResourceWithStreamingResponse: + return OwnershipResourceWithStreamingResponse(self._logpush.ownership) @cached_property - def validate(self) -> ValidateWithStreamingResponse: - return ValidateWithStreamingResponse(self._logpush.validate) + def validate(self) -> ValidateResourceWithStreamingResponse: + return ValidateResourceWithStreamingResponse(self._logpush.validate) -class AsyncLogpushWithStreamingResponse: - def __init__(self, logpush: AsyncLogpush) -> None: +class AsyncLogpushResourceWithStreamingResponse: + def __init__(self, logpush: AsyncLogpushResource) -> None: self._logpush = logpush @cached_property - def datasets(self) -> AsyncDatasetsWithStreamingResponse: - return AsyncDatasetsWithStreamingResponse(self._logpush.datasets) + def datasets(self) -> AsyncDatasetsResourceWithStreamingResponse: + return AsyncDatasetsResourceWithStreamingResponse(self._logpush.datasets) @cached_property - def edge(self) -> AsyncEdgeWithStreamingResponse: - return AsyncEdgeWithStreamingResponse(self._logpush.edge) + def edge(self) -> AsyncEdgeResourceWithStreamingResponse: + return AsyncEdgeResourceWithStreamingResponse(self._logpush.edge) @cached_property - def jobs(self) -> AsyncJobsWithStreamingResponse: - return AsyncJobsWithStreamingResponse(self._logpush.jobs) + def jobs(self) -> AsyncJobsResourceWithStreamingResponse: + return AsyncJobsResourceWithStreamingResponse(self._logpush.jobs) @cached_property - def ownership(self) -> AsyncOwnershipWithStreamingResponse: - return AsyncOwnershipWithStreamingResponse(self._logpush.ownership) + def ownership(self) -> AsyncOwnershipResourceWithStreamingResponse: + return AsyncOwnershipResourceWithStreamingResponse(self._logpush.ownership) @cached_property - def validate(self) -> AsyncValidateWithStreamingResponse: - return AsyncValidateWithStreamingResponse(self._logpush.validate) + def validate(self) -> AsyncValidateResourceWithStreamingResponse: + return AsyncValidateResourceWithStreamingResponse(self._logpush.validate) diff --git a/src/cloudflare/resources/logpush/ownership.py b/src/cloudflare/resources/logpush/ownership.py index c582203bc80..5498bb1f679 100644 --- a/src/cloudflare/resources/logpush/ownership.py +++ b/src/cloudflare/resources/logpush/ownership.py @@ -23,24 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.logpush import ( - OwnershipCreateResponse, - OwnershipValidateResponse, - ownership_create_params, - ownership_validate_params, -) +from ...types.logpush import ownership_create_params, ownership_validate_params +from ...types.logpush.ownership_validation import OwnershipValidation +from ...types.logpush.ownership_create_response import OwnershipCreateResponse -__all__ = ["Ownership", "AsyncOwnership"] +__all__ = ["OwnershipResource", "AsyncOwnershipResource"] -class Ownership(SyncAPIResource): +class OwnershipResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OwnershipWithRawResponse: - return OwnershipWithRawResponse(self) + def with_raw_response(self) -> OwnershipResourceWithRawResponse: + return OwnershipResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OwnershipWithStreamingResponse: - return OwnershipWithStreamingResponse(self) + def with_streaming_response(self) -> OwnershipResourceWithStreamingResponse: + return OwnershipResourceWithStreamingResponse(self) def create( self, @@ -75,12 +72,6 @@ def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -88,6 +79,9 @@ def create( 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( @@ -98,7 +92,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OwnershipCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[OwnershipCreateResponse]], ResultWrapper[OwnershipCreateResponse]), ) @@ -116,7 +110,7 @@ def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OwnershipValidateResponse]: + ) -> Optional[OwnershipValidation]: """ Validates ownership challenge of the destination. @@ -139,12 +133,6 @@ def validate( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -152,6 +140,9 @@ def validate( 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( @@ -168,20 +159,20 @@ def validate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OwnershipValidation]]._unwrapper, ), - cast_to=cast(Type[Optional[OwnershipValidateResponse]], ResultWrapper[OwnershipValidateResponse]), + cast_to=cast(Type[Optional[OwnershipValidation]], ResultWrapper[OwnershipValidation]), ) -class AsyncOwnership(AsyncAPIResource): +class AsyncOwnershipResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOwnershipWithRawResponse: - return AsyncOwnershipWithRawResponse(self) + def with_raw_response(self) -> AsyncOwnershipResourceWithRawResponse: + return AsyncOwnershipResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOwnershipWithStreamingResponse: - return AsyncOwnershipWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOwnershipResourceWithStreamingResponse: + return AsyncOwnershipResourceWithStreamingResponse(self) async def create( self, @@ -216,12 +207,6 @@ async def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -229,6 +214,9 @@ async def create( 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( @@ -241,7 +229,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OwnershipCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[OwnershipCreateResponse]], ResultWrapper[OwnershipCreateResponse]), ) @@ -259,7 +247,7 @@ async def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OwnershipValidateResponse]: + ) -> Optional[OwnershipValidation]: """ Validates ownership challenge of the destination. @@ -282,12 +270,6 @@ async def validate( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -295,6 +277,9 @@ async def validate( 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( @@ -311,14 +296,14 @@ async def validate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OwnershipValidation]]._unwrapper, ), - cast_to=cast(Type[Optional[OwnershipValidateResponse]], ResultWrapper[OwnershipValidateResponse]), + cast_to=cast(Type[Optional[OwnershipValidation]], ResultWrapper[OwnershipValidation]), ) -class OwnershipWithRawResponse: - def __init__(self, ownership: Ownership) -> None: +class OwnershipResourceWithRawResponse: + def __init__(self, ownership: OwnershipResource) -> None: self._ownership = ownership self.create = to_raw_response_wrapper( @@ -329,8 +314,8 @@ def __init__(self, ownership: Ownership) -> None: ) -class AsyncOwnershipWithRawResponse: - def __init__(self, ownership: AsyncOwnership) -> None: +class AsyncOwnershipResourceWithRawResponse: + def __init__(self, ownership: AsyncOwnershipResource) -> None: self._ownership = ownership self.create = async_to_raw_response_wrapper( @@ -341,8 +326,8 @@ def __init__(self, ownership: AsyncOwnership) -> None: ) -class OwnershipWithStreamingResponse: - def __init__(self, ownership: Ownership) -> None: +class OwnershipResourceWithStreamingResponse: + def __init__(self, ownership: OwnershipResource) -> None: self._ownership = ownership self.create = to_streamed_response_wrapper( @@ -353,8 +338,8 @@ def __init__(self, ownership: Ownership) -> None: ) -class AsyncOwnershipWithStreamingResponse: - def __init__(self, ownership: AsyncOwnership) -> None: +class AsyncOwnershipResourceWithStreamingResponse: + def __init__(self, ownership: AsyncOwnershipResource) -> None: self._ownership = ownership self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logpush/validate.py b/src/cloudflare/resources/logpush/validate.py index 407b47af93b..c334340392b 100644 --- a/src/cloudflare/resources/logpush/validate.py +++ b/src/cloudflare/resources/logpush/validate.py @@ -23,24 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.logpush import ( - ValidateOriginResponse, - ValidateDestinationResponse, - validate_origin_params, - validate_destination_params, -) +from ...types.logpush import validate_origin_params, validate_destination_params +from ...types.logpush.validate_origin_response import ValidateOriginResponse +from ...types.logpush.validate_destination_response import ValidateDestinationResponse -__all__ = ["Validate", "AsyncValidate"] +__all__ = ["ValidateResource", "AsyncValidateResource"] -class Validate(SyncAPIResource): +class ValidateResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ValidateWithRawResponse: - return ValidateWithRawResponse(self) + def with_raw_response(self) -> ValidateResourceWithRawResponse: + return ValidateResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ValidateWithStreamingResponse: - return ValidateWithStreamingResponse(self) + def with_streaming_response(self) -> ValidateResourceWithStreamingResponse: + return ValidateResourceWithStreamingResponse(self) def destination( self, @@ -75,12 +72,6 @@ def destination( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -88,6 +79,9 @@ def destination( 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( @@ -100,7 +94,7 @@ def destination( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ValidateDestinationResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ValidateDestinationResponse]], ResultWrapper[ValidateDestinationResponse]), ) @@ -140,12 +134,6 @@ def origin( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -153,6 +141,9 @@ def origin( 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( @@ -163,20 +154,20 @@ def origin( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ValidateOriginResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ValidateOriginResponse]], ResultWrapper[ValidateOriginResponse]), ) -class AsyncValidate(AsyncAPIResource): +class AsyncValidateResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncValidateWithRawResponse: - return AsyncValidateWithRawResponse(self) + def with_raw_response(self) -> AsyncValidateResourceWithRawResponse: + return AsyncValidateResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncValidateWithStreamingResponse: - return AsyncValidateWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncValidateResourceWithStreamingResponse: + return AsyncValidateResourceWithStreamingResponse(self) async def destination( self, @@ -211,12 +202,6 @@ async def destination( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -224,6 +209,9 @@ async def destination( 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( @@ -236,7 +224,7 @@ async def destination( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ValidateDestinationResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ValidateDestinationResponse]], ResultWrapper[ValidateDestinationResponse]), ) @@ -276,12 +264,6 @@ async def origin( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -289,6 +271,9 @@ async def origin( 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( @@ -301,14 +286,14 @@ async def origin( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ValidateOriginResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ValidateOriginResponse]], ResultWrapper[ValidateOriginResponse]), ) -class ValidateWithRawResponse: - def __init__(self, validate: Validate) -> None: +class ValidateResourceWithRawResponse: + def __init__(self, validate: ValidateResource) -> None: self._validate = validate self.destination = to_raw_response_wrapper( @@ -319,8 +304,8 @@ def __init__(self, validate: Validate) -> None: ) -class AsyncValidateWithRawResponse: - def __init__(self, validate: AsyncValidate) -> None: +class AsyncValidateResourceWithRawResponse: + def __init__(self, validate: AsyncValidateResource) -> None: self._validate = validate self.destination = async_to_raw_response_wrapper( @@ -331,8 +316,8 @@ def __init__(self, validate: AsyncValidate) -> None: ) -class ValidateWithStreamingResponse: - def __init__(self, validate: Validate) -> None: +class ValidateResourceWithStreamingResponse: + def __init__(self, validate: ValidateResource) -> None: self._validate = validate self.destination = to_streamed_response_wrapper( @@ -343,8 +328,8 @@ def __init__(self, validate: Validate) -> None: ) -class AsyncValidateWithStreamingResponse: - def __init__(self, validate: AsyncValidate) -> None: +class AsyncValidateResourceWithStreamingResponse: + def __init__(self, validate: AsyncValidateResource) -> None: self._validate = validate self.destination = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logs/__init__.py b/src/cloudflare/resources/logs/__init__.py index 5a22fc8aeed..758397ab14d 100644 --- a/src/cloudflare/resources/logs/__init__.py +++ b/src/cloudflare/resources/logs/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .logs import ( - Logs, - AsyncLogs, - LogsWithRawResponse, - AsyncLogsWithRawResponse, - LogsWithStreamingResponse, - AsyncLogsWithStreamingResponse, + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, ) from .rayid import ( - RayID, - AsyncRayID, - RayIDWithRawResponse, - AsyncRayIDWithRawResponse, - RayIDWithStreamingResponse, - AsyncRayIDWithStreamingResponse, + RayIDResource, + AsyncRayIDResource, + RayIDResourceWithRawResponse, + AsyncRayIDResourceWithRawResponse, + RayIDResourceWithStreamingResponse, + AsyncRayIDResourceWithStreamingResponse, ) from .control import ( - Control, - AsyncControl, - ControlWithRawResponse, - AsyncControlWithRawResponse, - ControlWithStreamingResponse, - AsyncControlWithStreamingResponse, + ControlResource, + AsyncControlResource, + ControlResourceWithRawResponse, + AsyncControlResourceWithRawResponse, + ControlResourceWithStreamingResponse, + AsyncControlResourceWithStreamingResponse, ) from .received import ( - Received, - AsyncReceived, - ReceivedWithRawResponse, - AsyncReceivedWithRawResponse, - ReceivedWithStreamingResponse, - AsyncReceivedWithStreamingResponse, + ReceivedResource, + AsyncReceivedResource, + ReceivedResourceWithRawResponse, + AsyncReceivedResourceWithRawResponse, + ReceivedResourceWithStreamingResponse, + AsyncReceivedResourceWithStreamingResponse, ) __all__ = [ - "Control", - "AsyncControl", - "ControlWithRawResponse", - "AsyncControlWithRawResponse", - "ControlWithStreamingResponse", - "AsyncControlWithStreamingResponse", - "RayID", - "AsyncRayID", - "RayIDWithRawResponse", - "AsyncRayIDWithRawResponse", - "RayIDWithStreamingResponse", - "AsyncRayIDWithStreamingResponse", - "Received", - "AsyncReceived", - "ReceivedWithRawResponse", - "AsyncReceivedWithRawResponse", - "ReceivedWithStreamingResponse", - "AsyncReceivedWithStreamingResponse", - "Logs", - "AsyncLogs", - "LogsWithRawResponse", - "AsyncLogsWithRawResponse", - "LogsWithStreamingResponse", - "AsyncLogsWithStreamingResponse", + "ControlResource", + "AsyncControlResource", + "ControlResourceWithRawResponse", + "AsyncControlResourceWithRawResponse", + "ControlResourceWithStreamingResponse", + "AsyncControlResourceWithStreamingResponse", + "RayIDResource", + "AsyncRayIDResource", + "RayIDResourceWithRawResponse", + "AsyncRayIDResourceWithRawResponse", + "RayIDResourceWithStreamingResponse", + "AsyncRayIDResourceWithStreamingResponse", + "ReceivedResource", + "AsyncReceivedResource", + "ReceivedResourceWithRawResponse", + "AsyncReceivedResourceWithRawResponse", + "ReceivedResourceWithStreamingResponse", + "AsyncReceivedResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/logs/control/__init__.py b/src/cloudflare/resources/logs/control/__init__.py index f689e7617b0..a762ffc3235 100644 --- a/src/cloudflare/resources/logs/control/__init__.py +++ b/src/cloudflare/resources/logs/control/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .cmb import ( - Cmb, - AsyncCmb, - CmbWithRawResponse, - AsyncCmbWithRawResponse, - CmbWithStreamingResponse, - AsyncCmbWithStreamingResponse, + CmbResource, + AsyncCmbResource, + CmbResourceWithRawResponse, + AsyncCmbResourceWithRawResponse, + CmbResourceWithStreamingResponse, + AsyncCmbResourceWithStreamingResponse, ) from .control import ( - Control, - AsyncControl, - ControlWithRawResponse, - AsyncControlWithRawResponse, - ControlWithStreamingResponse, - AsyncControlWithStreamingResponse, + ControlResource, + AsyncControlResource, + ControlResourceWithRawResponse, + AsyncControlResourceWithRawResponse, + ControlResourceWithStreamingResponse, + AsyncControlResourceWithStreamingResponse, ) from .retention import ( - Retention, - AsyncRetention, - RetentionWithRawResponse, - AsyncRetentionWithRawResponse, - RetentionWithStreamingResponse, - AsyncRetentionWithStreamingResponse, + RetentionResource, + AsyncRetentionResource, + RetentionResourceWithRawResponse, + AsyncRetentionResourceWithRawResponse, + RetentionResourceWithStreamingResponse, + AsyncRetentionResourceWithStreamingResponse, ) __all__ = [ - "Retention", - "AsyncRetention", - "RetentionWithRawResponse", - "AsyncRetentionWithRawResponse", - "RetentionWithStreamingResponse", - "AsyncRetentionWithStreamingResponse", - "Cmb", - "AsyncCmb", - "CmbWithRawResponse", - "AsyncCmbWithRawResponse", - "CmbWithStreamingResponse", - "AsyncCmbWithStreamingResponse", - "Control", - "AsyncControl", - "ControlWithRawResponse", - "AsyncControlWithRawResponse", - "ControlWithStreamingResponse", - "AsyncControlWithStreamingResponse", + "RetentionResource", + "AsyncRetentionResource", + "RetentionResourceWithRawResponse", + "AsyncRetentionResourceWithRawResponse", + "RetentionResourceWithStreamingResponse", + "AsyncRetentionResourceWithStreamingResponse", + "CmbResource", + "AsyncCmbResource", + "CmbResourceWithRawResponse", + "AsyncCmbResourceWithRawResponse", + "CmbResourceWithStreamingResponse", + "AsyncCmbResourceWithStreamingResponse", + "ControlResource", + "AsyncControlResource", + "ControlResourceWithRawResponse", + "AsyncControlResourceWithRawResponse", + "ControlResourceWithStreamingResponse", + "AsyncControlResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/logs/control/cmb/__init__.py b/src/cloudflare/resources/logs/control/cmb/__init__.py index 85b33068e75..870349941fc 100644 --- a/src/cloudflare/resources/logs/control/cmb/__init__.py +++ b/src/cloudflare/resources/logs/control/cmb/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .cmb import ( - Cmb, - AsyncCmb, - CmbWithRawResponse, - AsyncCmbWithRawResponse, - CmbWithStreamingResponse, - AsyncCmbWithStreamingResponse, + CmbResource, + AsyncCmbResource, + CmbResourceWithRawResponse, + AsyncCmbResourceWithRawResponse, + CmbResourceWithStreamingResponse, + AsyncCmbResourceWithStreamingResponse, ) from .config import ( - Config, - AsyncConfig, - ConfigWithRawResponse, - AsyncConfigWithRawResponse, - ConfigWithStreamingResponse, - AsyncConfigWithStreamingResponse, + ConfigResource, + AsyncConfigResource, + ConfigResourceWithRawResponse, + AsyncConfigResourceWithRawResponse, + ConfigResourceWithStreamingResponse, + AsyncConfigResourceWithStreamingResponse, ) __all__ = [ - "Config", - "AsyncConfig", - "ConfigWithRawResponse", - "AsyncConfigWithRawResponse", - "ConfigWithStreamingResponse", - "AsyncConfigWithStreamingResponse", - "Cmb", - "AsyncCmb", - "CmbWithRawResponse", - "AsyncCmbWithRawResponse", - "CmbWithStreamingResponse", - "AsyncCmbWithStreamingResponse", + "ConfigResource", + "AsyncConfigResource", + "ConfigResourceWithRawResponse", + "AsyncConfigResourceWithRawResponse", + "ConfigResourceWithStreamingResponse", + "AsyncConfigResourceWithStreamingResponse", + "CmbResource", + "AsyncCmbResource", + "CmbResourceWithRawResponse", + "AsyncCmbResourceWithRawResponse", + "CmbResourceWithStreamingResponse", + "AsyncCmbResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/logs/control/cmb/cmb.py b/src/cloudflare/resources/logs/control/cmb/cmb.py index d8d68697b91..c24d2105c2c 100644 --- a/src/cloudflare/resources/logs/control/cmb/cmb.py +++ b/src/cloudflare/resources/logs/control/cmb/cmb.py @@ -3,78 +3,78 @@ from __future__ import annotations from .config import ( - Config, - AsyncConfig, - ConfigWithRawResponse, - AsyncConfigWithRawResponse, - ConfigWithStreamingResponse, - AsyncConfigWithStreamingResponse, + ConfigResource, + AsyncConfigResource, + ConfigResourceWithRawResponse, + AsyncConfigResourceWithRawResponse, + ConfigResourceWithStreamingResponse, + AsyncConfigResourceWithStreamingResponse, ) from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Cmb", "AsyncCmb"] +__all__ = ["CmbResource", "AsyncCmbResource"] -class Cmb(SyncAPIResource): +class CmbResource(SyncAPIResource): @cached_property - def config(self) -> Config: - return Config(self._client) + def config(self) -> ConfigResource: + return ConfigResource(self._client) @cached_property - def with_raw_response(self) -> CmbWithRawResponse: - return CmbWithRawResponse(self) + def with_raw_response(self) -> CmbResourceWithRawResponse: + return CmbResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CmbWithStreamingResponse: - return CmbWithStreamingResponse(self) + def with_streaming_response(self) -> CmbResourceWithStreamingResponse: + return CmbResourceWithStreamingResponse(self) -class AsyncCmb(AsyncAPIResource): +class AsyncCmbResource(AsyncAPIResource): @cached_property - def config(self) -> AsyncConfig: - return AsyncConfig(self._client) + def config(self) -> AsyncConfigResource: + return AsyncConfigResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCmbWithRawResponse: - return AsyncCmbWithRawResponse(self) + def with_raw_response(self) -> AsyncCmbResourceWithRawResponse: + return AsyncCmbResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCmbWithStreamingResponse: - return AsyncCmbWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCmbResourceWithStreamingResponse: + return AsyncCmbResourceWithStreamingResponse(self) -class CmbWithRawResponse: - def __init__(self, cmb: Cmb) -> None: +class CmbResourceWithRawResponse: + def __init__(self, cmb: CmbResource) -> None: self._cmb = cmb @cached_property - def config(self) -> ConfigWithRawResponse: - return ConfigWithRawResponse(self._cmb.config) + def config(self) -> ConfigResourceWithRawResponse: + return ConfigResourceWithRawResponse(self._cmb.config) -class AsyncCmbWithRawResponse: - def __init__(self, cmb: AsyncCmb) -> None: +class AsyncCmbResourceWithRawResponse: + def __init__(self, cmb: AsyncCmbResource) -> None: self._cmb = cmb @cached_property - def config(self) -> AsyncConfigWithRawResponse: - return AsyncConfigWithRawResponse(self._cmb.config) + def config(self) -> AsyncConfigResourceWithRawResponse: + return AsyncConfigResourceWithRawResponse(self._cmb.config) -class CmbWithStreamingResponse: - def __init__(self, cmb: Cmb) -> None: +class CmbResourceWithStreamingResponse: + def __init__(self, cmb: CmbResource) -> None: self._cmb = cmb @cached_property - def config(self) -> ConfigWithStreamingResponse: - return ConfigWithStreamingResponse(self._cmb.config) + def config(self) -> ConfigResourceWithStreamingResponse: + return ConfigResourceWithStreamingResponse(self._cmb.config) -class AsyncCmbWithStreamingResponse: - def __init__(self, cmb: AsyncCmb) -> None: +class AsyncCmbResourceWithStreamingResponse: + def __init__(self, cmb: AsyncCmbResource) -> None: self._cmb = cmb @cached_property - def config(self) -> AsyncConfigWithStreamingResponse: - return AsyncConfigWithStreamingResponse(self._cmb.config) + def config(self) -> AsyncConfigResourceWithStreamingResponse: + return AsyncConfigResourceWithStreamingResponse(self._cmb.config) diff --git a/src/cloudflare/resources/logs/control/cmb/config.py b/src/cloudflare/resources/logs/control/cmb/config.py index bc6f02732b6..3c13ce3f56e 100644 --- a/src/cloudflare/resources/logs/control/cmb/config.py +++ b/src/cloudflare/resources/logs/control/cmb/config.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.logs.control.cmb import CmbConfig, ConfigDeleteResponse, config_create_params +from .....types.logs.control.cmb import config_create_params, config_delete_params +from .....types.logs.control.cmb.cmb_config import CmbConfig -__all__ = ["Config", "AsyncConfig"] +__all__ = ["ConfigResource", "AsyncConfigResource"] -class Config(SyncAPIResource): +class ConfigResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConfigWithRawResponse: - return ConfigWithRawResponse(self) + def with_raw_response(self) -> ConfigResourceWithRawResponse: + return ConfigResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConfigWithStreamingResponse: - return ConfigWithStreamingResponse(self) + def with_streaming_response(self) -> ConfigResourceWithStreamingResponse: + return ConfigResourceWithStreamingResponse(self) def create( self, @@ -75,7 +76,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CmbConfig]]._unwrapper, ), cast_to=cast(Type[Optional[CmbConfig]], ResultWrapper[CmbConfig]), ) @@ -84,13 +85,14 @@ def delete( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ConfigDeleteResponse]: + ) -> object: """ Deletes CMB config. @@ -107,21 +109,17 @@ def delete( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - Optional[ConfigDeleteResponse], - self._delete( - f"/accounts/{account_id}/logs/control/cmb/config", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ConfigDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/logs/control/cmb/config", + body=maybe_transform(body, config_delete_params.ConfigDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) def get( @@ -158,20 +156,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CmbConfig]]._unwrapper, ), cast_to=cast(Type[Optional[CmbConfig]], ResultWrapper[CmbConfig]), ) -class AsyncConfig(AsyncAPIResource): +class AsyncConfigResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConfigWithRawResponse: - return AsyncConfigWithRawResponse(self) + def with_raw_response(self) -> AsyncConfigResourceWithRawResponse: + return AsyncConfigResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConfigWithStreamingResponse: - return AsyncConfigWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConfigResourceWithStreamingResponse: + return AsyncConfigResourceWithStreamingResponse(self) async def create( self, @@ -211,7 +209,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CmbConfig]]._unwrapper, ), cast_to=cast(Type[Optional[CmbConfig]], ResultWrapper[CmbConfig]), ) @@ -220,13 +218,14 @@ async def delete( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ConfigDeleteResponse]: + ) -> object: """ Deletes CMB config. @@ -243,21 +242,17 @@ async def delete( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - Optional[ConfigDeleteResponse], - await self._delete( - f"/accounts/{account_id}/logs/control/cmb/config", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ConfigDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/logs/control/cmb/config", + body=await async_maybe_transform(body, config_delete_params.ConfigDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) async def get( @@ -294,14 +289,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CmbConfig]]._unwrapper, ), cast_to=cast(Type[Optional[CmbConfig]], ResultWrapper[CmbConfig]), ) -class ConfigWithRawResponse: - def __init__(self, config: Config) -> None: +class ConfigResourceWithRawResponse: + def __init__(self, config: ConfigResource) -> None: self._config = config self.create = to_raw_response_wrapper( @@ -315,8 +310,8 @@ def __init__(self, config: Config) -> None: ) -class AsyncConfigWithRawResponse: - def __init__(self, config: AsyncConfig) -> None: +class AsyncConfigResourceWithRawResponse: + def __init__(self, config: AsyncConfigResource) -> None: self._config = config self.create = async_to_raw_response_wrapper( @@ -330,8 +325,8 @@ def __init__(self, config: AsyncConfig) -> None: ) -class ConfigWithStreamingResponse: - def __init__(self, config: Config) -> None: +class ConfigResourceWithStreamingResponse: + def __init__(self, config: ConfigResource) -> None: self._config = config self.create = to_streamed_response_wrapper( @@ -345,8 +340,8 @@ def __init__(self, config: Config) -> None: ) -class AsyncConfigWithStreamingResponse: - def __init__(self, config: AsyncConfig) -> None: +class AsyncConfigResourceWithStreamingResponse: + def __init__(self, config: AsyncConfigResource) -> None: self._config = config self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logs/control/control.py b/src/cloudflare/resources/logs/control/control.py index 7bbaf220174..ce92ba94219 100644 --- a/src/cloudflare/resources/logs/control/control.py +++ b/src/cloudflare/resources/logs/control/control.py @@ -3,112 +3,112 @@ from __future__ import annotations from .cmb import ( - Cmb, - AsyncCmb, - CmbWithRawResponse, - AsyncCmbWithRawResponse, - CmbWithStreamingResponse, - AsyncCmbWithStreamingResponse, + CmbResource, + AsyncCmbResource, + CmbResourceWithRawResponse, + AsyncCmbResourceWithRawResponse, + CmbResourceWithStreamingResponse, + AsyncCmbResourceWithStreamingResponse, ) -from .cmb.cmb import Cmb, AsyncCmb +from .cmb.cmb import CmbResource, AsyncCmbResource from .retention import ( - Retention, - AsyncRetention, - RetentionWithRawResponse, - AsyncRetentionWithRawResponse, - RetentionWithStreamingResponse, - AsyncRetentionWithStreamingResponse, + RetentionResource, + AsyncRetentionResource, + RetentionResourceWithRawResponse, + AsyncRetentionResourceWithRawResponse, + RetentionResourceWithStreamingResponse, + AsyncRetentionResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -from .retention.retention import Retention, AsyncRetention +from .retention.retention import RetentionResource, AsyncRetentionResource -__all__ = ["Control", "AsyncControl"] +__all__ = ["ControlResource", "AsyncControlResource"] -class Control(SyncAPIResource): +class ControlResource(SyncAPIResource): @cached_property - def retention(self) -> Retention: - return Retention(self._client) + def retention(self) -> RetentionResource: + return RetentionResource(self._client) @cached_property - def cmb(self) -> Cmb: - return Cmb(self._client) + def cmb(self) -> CmbResource: + return CmbResource(self._client) @cached_property - def with_raw_response(self) -> ControlWithRawResponse: - return ControlWithRawResponse(self) + def with_raw_response(self) -> ControlResourceWithRawResponse: + return ControlResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ControlWithStreamingResponse: - return ControlWithStreamingResponse(self) + def with_streaming_response(self) -> ControlResourceWithStreamingResponse: + return ControlResourceWithStreamingResponse(self) -class AsyncControl(AsyncAPIResource): +class AsyncControlResource(AsyncAPIResource): @cached_property - def retention(self) -> AsyncRetention: - return AsyncRetention(self._client) + def retention(self) -> AsyncRetentionResource: + return AsyncRetentionResource(self._client) @cached_property - def cmb(self) -> AsyncCmb: - return AsyncCmb(self._client) + def cmb(self) -> AsyncCmbResource: + return AsyncCmbResource(self._client) @cached_property - def with_raw_response(self) -> AsyncControlWithRawResponse: - return AsyncControlWithRawResponse(self) + def with_raw_response(self) -> AsyncControlResourceWithRawResponse: + return AsyncControlResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncControlWithStreamingResponse: - return AsyncControlWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncControlResourceWithStreamingResponse: + return AsyncControlResourceWithStreamingResponse(self) -class ControlWithRawResponse: - def __init__(self, control: Control) -> None: +class ControlResourceWithRawResponse: + def __init__(self, control: ControlResource) -> None: self._control = control @cached_property - def retention(self) -> RetentionWithRawResponse: - return RetentionWithRawResponse(self._control.retention) + def retention(self) -> RetentionResourceWithRawResponse: + return RetentionResourceWithRawResponse(self._control.retention) @cached_property - def cmb(self) -> CmbWithRawResponse: - return CmbWithRawResponse(self._control.cmb) + def cmb(self) -> CmbResourceWithRawResponse: + return CmbResourceWithRawResponse(self._control.cmb) -class AsyncControlWithRawResponse: - def __init__(self, control: AsyncControl) -> None: +class AsyncControlResourceWithRawResponse: + def __init__(self, control: AsyncControlResource) -> None: self._control = control @cached_property - def retention(self) -> AsyncRetentionWithRawResponse: - return AsyncRetentionWithRawResponse(self._control.retention) + def retention(self) -> AsyncRetentionResourceWithRawResponse: + return AsyncRetentionResourceWithRawResponse(self._control.retention) @cached_property - def cmb(self) -> AsyncCmbWithRawResponse: - return AsyncCmbWithRawResponse(self._control.cmb) + def cmb(self) -> AsyncCmbResourceWithRawResponse: + return AsyncCmbResourceWithRawResponse(self._control.cmb) -class ControlWithStreamingResponse: - def __init__(self, control: Control) -> None: +class ControlResourceWithStreamingResponse: + def __init__(self, control: ControlResource) -> None: self._control = control @cached_property - def retention(self) -> RetentionWithStreamingResponse: - return RetentionWithStreamingResponse(self._control.retention) + def retention(self) -> RetentionResourceWithStreamingResponse: + return RetentionResourceWithStreamingResponse(self._control.retention) @cached_property - def cmb(self) -> CmbWithStreamingResponse: - return CmbWithStreamingResponse(self._control.cmb) + def cmb(self) -> CmbResourceWithStreamingResponse: + return CmbResourceWithStreamingResponse(self._control.cmb) -class AsyncControlWithStreamingResponse: - def __init__(self, control: AsyncControl) -> None: +class AsyncControlResourceWithStreamingResponse: + def __init__(self, control: AsyncControlResource) -> None: self._control = control @cached_property - def retention(self) -> AsyncRetentionWithStreamingResponse: - return AsyncRetentionWithStreamingResponse(self._control.retention) + def retention(self) -> AsyncRetentionResourceWithStreamingResponse: + return AsyncRetentionResourceWithStreamingResponse(self._control.retention) @cached_property - def cmb(self) -> AsyncCmbWithStreamingResponse: - return AsyncCmbWithStreamingResponse(self._control.cmb) + def cmb(self) -> AsyncCmbResourceWithStreamingResponse: + return AsyncCmbResourceWithStreamingResponse(self._control.cmb) diff --git a/src/cloudflare/resources/logs/control/retention/__init__.py b/src/cloudflare/resources/logs/control/retention/__init__.py index bd12d07366d..f86ef33b8fd 100644 --- a/src/cloudflare/resources/logs/control/retention/__init__.py +++ b/src/cloudflare/resources/logs/control/retention/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .flag import ( - Flag, - AsyncFlag, - FlagWithRawResponse, - AsyncFlagWithRawResponse, - FlagWithStreamingResponse, - AsyncFlagWithStreamingResponse, + FlagResource, + AsyncFlagResource, + FlagResourceWithRawResponse, + AsyncFlagResourceWithRawResponse, + FlagResourceWithStreamingResponse, + AsyncFlagResourceWithStreamingResponse, ) from .retention import ( - Retention, - AsyncRetention, - RetentionWithRawResponse, - AsyncRetentionWithRawResponse, - RetentionWithStreamingResponse, - AsyncRetentionWithStreamingResponse, + RetentionResource, + AsyncRetentionResource, + RetentionResourceWithRawResponse, + AsyncRetentionResourceWithRawResponse, + RetentionResourceWithStreamingResponse, + AsyncRetentionResourceWithStreamingResponse, ) __all__ = [ - "Flag", - "AsyncFlag", - "FlagWithRawResponse", - "AsyncFlagWithRawResponse", - "FlagWithStreamingResponse", - "AsyncFlagWithStreamingResponse", - "Retention", - "AsyncRetention", - "RetentionWithRawResponse", - "AsyncRetentionWithRawResponse", - "RetentionWithStreamingResponse", - "AsyncRetentionWithStreamingResponse", + "FlagResource", + "AsyncFlagResource", + "FlagResourceWithRawResponse", + "AsyncFlagResourceWithRawResponse", + "FlagResourceWithStreamingResponse", + "AsyncFlagResourceWithStreamingResponse", + "RetentionResource", + "AsyncRetentionResource", + "RetentionResourceWithRawResponse", + "AsyncRetentionResourceWithRawResponse", + "RetentionResourceWithStreamingResponse", + "AsyncRetentionResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/logs/control/retention/flag.py b/src/cloudflare/resources/logs/control/retention/flag.py index 185ea40e950..3b430f1e9c6 100644 --- a/src/cloudflare/resources/logs/control/retention/flag.py +++ b/src/cloudflare/resources/logs/control/retention/flag.py @@ -23,19 +23,21 @@ from ....._base_client import ( make_request_options, ) -from .....types.logs.control.retention import FlagGetResponse, FlagCreateResponse, flag_create_params +from .....types.logs.control.retention import flag_create_params +from .....types.logs.control.retention.flag_get_response import FlagGetResponse +from .....types.logs.control.retention.flag_create_response import FlagCreateResponse -__all__ = ["Flag", "AsyncFlag"] +__all__ = ["FlagResource", "AsyncFlagResource"] -class Flag(SyncAPIResource): +class FlagResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FlagWithRawResponse: - return FlagWithRawResponse(self) + def with_raw_response(self) -> FlagResourceWithRawResponse: + return FlagResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FlagWithStreamingResponse: - return FlagWithStreamingResponse(self) + def with_streaming_response(self) -> FlagResourceWithStreamingResponse: + return FlagResourceWithStreamingResponse(self) def create( self, @@ -75,7 +77,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FlagCreateResponse]._unwrapper, ), cast_to=cast(Type[FlagCreateResponse], ResultWrapper[FlagCreateResponse]), ) @@ -114,20 +116,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FlagGetResponse]._unwrapper, ), cast_to=cast(Type[FlagGetResponse], ResultWrapper[FlagGetResponse]), ) -class AsyncFlag(AsyncAPIResource): +class AsyncFlagResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFlagWithRawResponse: - return AsyncFlagWithRawResponse(self) + def with_raw_response(self) -> AsyncFlagResourceWithRawResponse: + return AsyncFlagResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFlagWithStreamingResponse: - return AsyncFlagWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFlagResourceWithStreamingResponse: + return AsyncFlagResourceWithStreamingResponse(self) async def create( self, @@ -167,7 +169,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FlagCreateResponse]._unwrapper, ), cast_to=cast(Type[FlagCreateResponse], ResultWrapper[FlagCreateResponse]), ) @@ -206,14 +208,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[FlagGetResponse]._unwrapper, ), cast_to=cast(Type[FlagGetResponse], ResultWrapper[FlagGetResponse]), ) -class FlagWithRawResponse: - def __init__(self, flag: Flag) -> None: +class FlagResourceWithRawResponse: + def __init__(self, flag: FlagResource) -> None: self._flag = flag self.create = to_raw_response_wrapper( @@ -224,8 +226,8 @@ def __init__(self, flag: Flag) -> None: ) -class AsyncFlagWithRawResponse: - def __init__(self, flag: AsyncFlag) -> None: +class AsyncFlagResourceWithRawResponse: + def __init__(self, flag: AsyncFlagResource) -> None: self._flag = flag self.create = async_to_raw_response_wrapper( @@ -236,8 +238,8 @@ def __init__(self, flag: AsyncFlag) -> None: ) -class FlagWithStreamingResponse: - def __init__(self, flag: Flag) -> None: +class FlagResourceWithStreamingResponse: + def __init__(self, flag: FlagResource) -> None: self._flag = flag self.create = to_streamed_response_wrapper( @@ -248,8 +250,8 @@ def __init__(self, flag: Flag) -> None: ) -class AsyncFlagWithStreamingResponse: - def __init__(self, flag: AsyncFlag) -> None: +class AsyncFlagResourceWithStreamingResponse: + def __init__(self, flag: AsyncFlagResource) -> None: self._flag = flag self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logs/control/retention/retention.py b/src/cloudflare/resources/logs/control/retention/retention.py index 39e309df551..01597a0c091 100644 --- a/src/cloudflare/resources/logs/control/retention/retention.py +++ b/src/cloudflare/resources/logs/control/retention/retention.py @@ -3,78 +3,78 @@ from __future__ import annotations from .flag import ( - Flag, - AsyncFlag, - FlagWithRawResponse, - AsyncFlagWithRawResponse, - FlagWithStreamingResponse, - AsyncFlagWithStreamingResponse, + FlagResource, + AsyncFlagResource, + FlagResourceWithRawResponse, + AsyncFlagResourceWithRawResponse, + FlagResourceWithStreamingResponse, + AsyncFlagResourceWithStreamingResponse, ) from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Retention", "AsyncRetention"] +__all__ = ["RetentionResource", "AsyncRetentionResource"] -class Retention(SyncAPIResource): +class RetentionResource(SyncAPIResource): @cached_property - def flag(self) -> Flag: - return Flag(self._client) + def flag(self) -> FlagResource: + return FlagResource(self._client) @cached_property - def with_raw_response(self) -> RetentionWithRawResponse: - return RetentionWithRawResponse(self) + def with_raw_response(self) -> RetentionResourceWithRawResponse: + return RetentionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RetentionWithStreamingResponse: - return RetentionWithStreamingResponse(self) + def with_streaming_response(self) -> RetentionResourceWithStreamingResponse: + return RetentionResourceWithStreamingResponse(self) -class AsyncRetention(AsyncAPIResource): +class AsyncRetentionResource(AsyncAPIResource): @cached_property - def flag(self) -> AsyncFlag: - return AsyncFlag(self._client) + def flag(self) -> AsyncFlagResource: + return AsyncFlagResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRetentionWithRawResponse: - return AsyncRetentionWithRawResponse(self) + def with_raw_response(self) -> AsyncRetentionResourceWithRawResponse: + return AsyncRetentionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRetentionWithStreamingResponse: - return AsyncRetentionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRetentionResourceWithStreamingResponse: + return AsyncRetentionResourceWithStreamingResponse(self) -class RetentionWithRawResponse: - def __init__(self, retention: Retention) -> None: +class RetentionResourceWithRawResponse: + def __init__(self, retention: RetentionResource) -> None: self._retention = retention @cached_property - def flag(self) -> FlagWithRawResponse: - return FlagWithRawResponse(self._retention.flag) + def flag(self) -> FlagResourceWithRawResponse: + return FlagResourceWithRawResponse(self._retention.flag) -class AsyncRetentionWithRawResponse: - def __init__(self, retention: AsyncRetention) -> None: +class AsyncRetentionResourceWithRawResponse: + def __init__(self, retention: AsyncRetentionResource) -> None: self._retention = retention @cached_property - def flag(self) -> AsyncFlagWithRawResponse: - return AsyncFlagWithRawResponse(self._retention.flag) + def flag(self) -> AsyncFlagResourceWithRawResponse: + return AsyncFlagResourceWithRawResponse(self._retention.flag) -class RetentionWithStreamingResponse: - def __init__(self, retention: Retention) -> None: +class RetentionResourceWithStreamingResponse: + def __init__(self, retention: RetentionResource) -> None: self._retention = retention @cached_property - def flag(self) -> FlagWithStreamingResponse: - return FlagWithStreamingResponse(self._retention.flag) + def flag(self) -> FlagResourceWithStreamingResponse: + return FlagResourceWithStreamingResponse(self._retention.flag) -class AsyncRetentionWithStreamingResponse: - def __init__(self, retention: AsyncRetention) -> None: +class AsyncRetentionResourceWithStreamingResponse: + def __init__(self, retention: AsyncRetentionResource) -> None: self._retention = retention @cached_property - def flag(self) -> AsyncFlagWithStreamingResponse: - return AsyncFlagWithStreamingResponse(self._retention.flag) + def flag(self) -> AsyncFlagResourceWithStreamingResponse: + return AsyncFlagResourceWithStreamingResponse(self._retention.flag) diff --git a/src/cloudflare/resources/logs/logs.py b/src/cloudflare/resources/logs/logs.py index 32db7078099..b868582e35b 100644 --- a/src/cloudflare/resources/logs/logs.py +++ b/src/cloudflare/resources/logs/logs.py @@ -3,144 +3,144 @@ from __future__ import annotations from .rayid import ( - RayID, - AsyncRayID, - RayIDWithRawResponse, - AsyncRayIDWithRawResponse, - RayIDWithStreamingResponse, - AsyncRayIDWithStreamingResponse, + RayIDResource, + AsyncRayIDResource, + RayIDResourceWithRawResponse, + AsyncRayIDResourceWithRawResponse, + RayIDResourceWithStreamingResponse, + AsyncRayIDResourceWithStreamingResponse, ) from .control import ( - Control, - AsyncControl, - ControlWithRawResponse, - AsyncControlWithRawResponse, - ControlWithStreamingResponse, - AsyncControlWithStreamingResponse, + ControlResource, + AsyncControlResource, + ControlResourceWithRawResponse, + AsyncControlResourceWithRawResponse, + ControlResourceWithStreamingResponse, + AsyncControlResourceWithStreamingResponse, ) from .received import ( - Received, - AsyncReceived, - ReceivedWithRawResponse, - AsyncReceivedWithRawResponse, - ReceivedWithStreamingResponse, - AsyncReceivedWithStreamingResponse, + ReceivedResource, + AsyncReceivedResource, + ReceivedResourceWithRawResponse, + AsyncReceivedResourceWithRawResponse, + ReceivedResourceWithStreamingResponse, + AsyncReceivedResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .control.control import Control, AsyncControl -from .received.received import Received, AsyncReceived +from .control.control import ControlResource, AsyncControlResource +from .received.received import ReceivedResource, AsyncReceivedResource -__all__ = ["Logs", "AsyncLogs"] +__all__ = ["LogsResource", "AsyncLogsResource"] -class Logs(SyncAPIResource): +class LogsResource(SyncAPIResource): @cached_property - def control(self) -> Control: - return Control(self._client) + def control(self) -> ControlResource: + return ControlResource(self._client) @cached_property - def rayid(self) -> RayID: - return RayID(self._client) + def rayid(self) -> RayIDResource: + return RayIDResource(self._client) @cached_property - def received(self) -> Received: - return Received(self._client) + def received(self) -> ReceivedResource: + return ReceivedResource(self._client) @cached_property - def with_raw_response(self) -> LogsWithRawResponse: - return LogsWithRawResponse(self) + def with_raw_response(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LogsWithStreamingResponse: - return LogsWithStreamingResponse(self) + def with_streaming_response(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self) -class AsyncLogs(AsyncAPIResource): +class AsyncLogsResource(AsyncAPIResource): @cached_property - def control(self) -> AsyncControl: - return AsyncControl(self._client) + def control(self) -> AsyncControlResource: + return AsyncControlResource(self._client) @cached_property - def rayid(self) -> AsyncRayID: - return AsyncRayID(self._client) + def rayid(self) -> AsyncRayIDResource: + return AsyncRayIDResource(self._client) @cached_property - def received(self) -> AsyncReceived: - return AsyncReceived(self._client) + def received(self) -> AsyncReceivedResource: + return AsyncReceivedResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLogsWithRawResponse: - return AsyncLogsWithRawResponse(self) + def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLogsWithStreamingResponse: - return AsyncLogsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self) -class LogsWithRawResponse: - def __init__(self, logs: Logs) -> None: +class LogsResourceWithRawResponse: + def __init__(self, logs: LogsResource) -> None: self._logs = logs @cached_property - def control(self) -> ControlWithRawResponse: - return ControlWithRawResponse(self._logs.control) + def control(self) -> ControlResourceWithRawResponse: + return ControlResourceWithRawResponse(self._logs.control) @cached_property - def rayid(self) -> RayIDWithRawResponse: - return RayIDWithRawResponse(self._logs.rayid) + def rayid(self) -> RayIDResourceWithRawResponse: + return RayIDResourceWithRawResponse(self._logs.rayid) @cached_property - def received(self) -> ReceivedWithRawResponse: - return ReceivedWithRawResponse(self._logs.received) + def received(self) -> ReceivedResourceWithRawResponse: + return ReceivedResourceWithRawResponse(self._logs.received) -class AsyncLogsWithRawResponse: - def __init__(self, logs: AsyncLogs) -> None: +class AsyncLogsResourceWithRawResponse: + def __init__(self, logs: AsyncLogsResource) -> None: self._logs = logs @cached_property - def control(self) -> AsyncControlWithRawResponse: - return AsyncControlWithRawResponse(self._logs.control) + def control(self) -> AsyncControlResourceWithRawResponse: + return AsyncControlResourceWithRawResponse(self._logs.control) @cached_property - def rayid(self) -> AsyncRayIDWithRawResponse: - return AsyncRayIDWithRawResponse(self._logs.rayid) + def rayid(self) -> AsyncRayIDResourceWithRawResponse: + return AsyncRayIDResourceWithRawResponse(self._logs.rayid) @cached_property - def received(self) -> AsyncReceivedWithRawResponse: - return AsyncReceivedWithRawResponse(self._logs.received) + def received(self) -> AsyncReceivedResourceWithRawResponse: + return AsyncReceivedResourceWithRawResponse(self._logs.received) -class LogsWithStreamingResponse: - def __init__(self, logs: Logs) -> None: +class LogsResourceWithStreamingResponse: + def __init__(self, logs: LogsResource) -> None: self._logs = logs @cached_property - def control(self) -> ControlWithStreamingResponse: - return ControlWithStreamingResponse(self._logs.control) + def control(self) -> ControlResourceWithStreamingResponse: + return ControlResourceWithStreamingResponse(self._logs.control) @cached_property - def rayid(self) -> RayIDWithStreamingResponse: - return RayIDWithStreamingResponse(self._logs.rayid) + def rayid(self) -> RayIDResourceWithStreamingResponse: + return RayIDResourceWithStreamingResponse(self._logs.rayid) @cached_property - def received(self) -> ReceivedWithStreamingResponse: - return ReceivedWithStreamingResponse(self._logs.received) + def received(self) -> ReceivedResourceWithStreamingResponse: + return ReceivedResourceWithStreamingResponse(self._logs.received) -class AsyncLogsWithStreamingResponse: - def __init__(self, logs: AsyncLogs) -> None: +class AsyncLogsResourceWithStreamingResponse: + def __init__(self, logs: AsyncLogsResource) -> None: self._logs = logs @cached_property - def control(self) -> AsyncControlWithStreamingResponse: - return AsyncControlWithStreamingResponse(self._logs.control) + def control(self) -> AsyncControlResourceWithStreamingResponse: + return AsyncControlResourceWithStreamingResponse(self._logs.control) @cached_property - def rayid(self) -> AsyncRayIDWithStreamingResponse: - return AsyncRayIDWithStreamingResponse(self._logs.rayid) + def rayid(self) -> AsyncRayIDResourceWithStreamingResponse: + return AsyncRayIDResourceWithStreamingResponse(self._logs.rayid) @cached_property - def received(self) -> AsyncReceivedWithStreamingResponse: - return AsyncReceivedWithStreamingResponse(self._logs.received) + def received(self) -> AsyncReceivedResourceWithStreamingResponse: + return AsyncReceivedResourceWithStreamingResponse(self._logs.received) diff --git a/src/cloudflare/resources/logs/rayid.py b/src/cloudflare/resources/logs/rayid.py index 7b21e5fb1bc..d6cbefae0ee 100644 --- a/src/cloudflare/resources/logs/rayid.py +++ b/src/cloudflare/resources/logs/rayid.py @@ -20,22 +20,23 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.logs import RayIDGetResponse, rayid_get_params +from ...types.logs import rayid_get_params from ..._base_client import ( make_request_options, ) +from ...types.logs.rayid_get_response import RayIDGetResponse -__all__ = ["RayID", "AsyncRayID"] +__all__ = ["RayIDResource", "AsyncRayIDResource"] -class RayID(SyncAPIResource): +class RayIDResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RayIDWithRawResponse: - return RayIDWithRawResponse(self) + def with_raw_response(self) -> RayIDResourceWithRawResponse: + return RayIDResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RayIDWithStreamingResponse: - return RayIDWithStreamingResponse(self) + def with_streaming_response(self) -> RayIDResourceWithStreamingResponse: + return RayIDResourceWithStreamingResponse(self) def get( self, @@ -113,14 +114,14 @@ def get( ) -class AsyncRayID(AsyncAPIResource): +class AsyncRayIDResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRayIDWithRawResponse: - return AsyncRayIDWithRawResponse(self) + def with_raw_response(self) -> AsyncRayIDResourceWithRawResponse: + return AsyncRayIDResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRayIDWithStreamingResponse: - return AsyncRayIDWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRayIDResourceWithStreamingResponse: + return AsyncRayIDResourceWithStreamingResponse(self) async def get( self, @@ -198,8 +199,8 @@ async def get( ) -class RayIDWithRawResponse: - def __init__(self, rayid: RayID) -> None: +class RayIDResourceWithRawResponse: + def __init__(self, rayid: RayIDResource) -> None: self._rayid = rayid self.get = to_raw_response_wrapper( @@ -207,8 +208,8 @@ def __init__(self, rayid: RayID) -> None: ) -class AsyncRayIDWithRawResponse: - def __init__(self, rayid: AsyncRayID) -> None: +class AsyncRayIDResourceWithRawResponse: + def __init__(self, rayid: AsyncRayIDResource) -> None: self._rayid = rayid self.get = async_to_raw_response_wrapper( @@ -216,8 +217,8 @@ def __init__(self, rayid: AsyncRayID) -> None: ) -class RayIDWithStreamingResponse: - def __init__(self, rayid: RayID) -> None: +class RayIDResourceWithStreamingResponse: + def __init__(self, rayid: RayIDResource) -> None: self._rayid = rayid self.get = to_streamed_response_wrapper( @@ -225,8 +226,8 @@ def __init__(self, rayid: RayID) -> None: ) -class AsyncRayIDWithStreamingResponse: - def __init__(self, rayid: AsyncRayID) -> None: +class AsyncRayIDResourceWithStreamingResponse: + def __init__(self, rayid: AsyncRayIDResource) -> None: self._rayid = rayid self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logs/received/__init__.py b/src/cloudflare/resources/logs/received/__init__.py index 0c7d17be7e7..dc6b4c74f2b 100644 --- a/src/cloudflare/resources/logs/received/__init__.py +++ b/src/cloudflare/resources/logs/received/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .fields import ( - Fields, - AsyncFields, - FieldsWithRawResponse, - AsyncFieldsWithRawResponse, - FieldsWithStreamingResponse, - AsyncFieldsWithStreamingResponse, + FieldsResource, + AsyncFieldsResource, + FieldsResourceWithRawResponse, + AsyncFieldsResourceWithRawResponse, + FieldsResourceWithStreamingResponse, + AsyncFieldsResourceWithStreamingResponse, ) from .received import ( - Received, - AsyncReceived, - ReceivedWithRawResponse, - AsyncReceivedWithRawResponse, - ReceivedWithStreamingResponse, - AsyncReceivedWithStreamingResponse, + ReceivedResource, + AsyncReceivedResource, + ReceivedResourceWithRawResponse, + AsyncReceivedResourceWithRawResponse, + ReceivedResourceWithStreamingResponse, + AsyncReceivedResourceWithStreamingResponse, ) __all__ = [ - "Fields", - "AsyncFields", - "FieldsWithRawResponse", - "AsyncFieldsWithRawResponse", - "FieldsWithStreamingResponse", - "AsyncFieldsWithStreamingResponse", - "Received", - "AsyncReceived", - "ReceivedWithRawResponse", - "AsyncReceivedWithRawResponse", - "ReceivedWithStreamingResponse", - "AsyncReceivedWithStreamingResponse", + "FieldsResource", + "AsyncFieldsResource", + "FieldsResourceWithRawResponse", + "AsyncFieldsResourceWithRawResponse", + "FieldsResourceWithStreamingResponse", + "AsyncFieldsResourceWithStreamingResponse", + "ReceivedResource", + "AsyncReceivedResource", + "ReceivedResourceWithRawResponse", + "AsyncReceivedResourceWithRawResponse", + "ReceivedResourceWithStreamingResponse", + "AsyncReceivedResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/logs/received/fields.py b/src/cloudflare/resources/logs/received/fields.py index ca480194be1..18015412ab8 100644 --- a/src/cloudflare/resources/logs/received/fields.py +++ b/src/cloudflare/resources/logs/received/fields.py @@ -16,19 +16,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.logs.received import FieldGetResponse +from ....types.logs.received.field_get_response import FieldGetResponse -__all__ = ["Fields", "AsyncFields"] +__all__ = ["FieldsResource", "AsyncFieldsResource"] -class Fields(SyncAPIResource): +class FieldsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FieldsWithRawResponse: - return FieldsWithRawResponse(self) + def with_raw_response(self) -> FieldsResourceWithRawResponse: + return FieldsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FieldsWithStreamingResponse: - return FieldsWithStreamingResponse(self) + def with_streaming_response(self) -> FieldsResourceWithStreamingResponse: + return FieldsResourceWithStreamingResponse(self) def get( self, @@ -68,14 +68,14 @@ def get( ) -class AsyncFields(AsyncAPIResource): +class AsyncFieldsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFieldsWithRawResponse: - return AsyncFieldsWithRawResponse(self) + def with_raw_response(self) -> AsyncFieldsResourceWithRawResponse: + return AsyncFieldsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFieldsWithStreamingResponse: - return AsyncFieldsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFieldsResourceWithStreamingResponse: + return AsyncFieldsResourceWithStreamingResponse(self) async def get( self, @@ -115,8 +115,8 @@ async def get( ) -class FieldsWithRawResponse: - def __init__(self, fields: Fields) -> None: +class FieldsResourceWithRawResponse: + def __init__(self, fields: FieldsResource) -> None: self._fields = fields self.get = to_raw_response_wrapper( @@ -124,8 +124,8 @@ def __init__(self, fields: Fields) -> None: ) -class AsyncFieldsWithRawResponse: - def __init__(self, fields: AsyncFields) -> None: +class AsyncFieldsResourceWithRawResponse: + def __init__(self, fields: AsyncFieldsResource) -> None: self._fields = fields self.get = async_to_raw_response_wrapper( @@ -133,8 +133,8 @@ def __init__(self, fields: AsyncFields) -> None: ) -class FieldsWithStreamingResponse: - def __init__(self, fields: Fields) -> None: +class FieldsResourceWithStreamingResponse: + def __init__(self, fields: FieldsResource) -> None: self._fields = fields self.get = to_streamed_response_wrapper( @@ -142,8 +142,8 @@ def __init__(self, fields: Fields) -> None: ) -class AsyncFieldsWithStreamingResponse: - def __init__(self, fields: AsyncFields) -> None: +class AsyncFieldsResourceWithStreamingResponse: + def __init__(self, fields: AsyncFieldsResource) -> None: self._fields = fields self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/logs/received/received.py b/src/cloudflare/resources/logs/received/received.py index ffc41c0d3c6..fe5ea8ffda1 100644 --- a/src/cloudflare/resources/logs/received/received.py +++ b/src/cloudflare/resources/logs/received/received.py @@ -8,12 +8,12 @@ import httpx from .fields import ( - Fields, - AsyncFields, - FieldsWithRawResponse, - AsyncFieldsWithRawResponse, - FieldsWithStreamingResponse, - AsyncFieldsWithStreamingResponse, + FieldsResource, + AsyncFieldsResource, + FieldsResourceWithRawResponse, + AsyncFieldsResourceWithRawResponse, + FieldsResourceWithStreamingResponse, + AsyncFieldsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -28,26 +28,27 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....types.logs import ReceivedGetResponse, received_get_params +from ....types.logs import received_get_params from ...._base_client import ( make_request_options, ) +from ....types.logs.received_get_response import ReceivedGetResponse -__all__ = ["Received", "AsyncReceived"] +__all__ = ["ReceivedResource", "AsyncReceivedResource"] -class Received(SyncAPIResource): +class ReceivedResource(SyncAPIResource): @cached_property - def fields(self) -> Fields: - return Fields(self._client) + def fields(self) -> FieldsResource: + return FieldsResource(self._client) @cached_property - def with_raw_response(self) -> ReceivedWithRawResponse: - return ReceivedWithRawResponse(self) + def with_raw_response(self) -> ReceivedResourceWithRawResponse: + return ReceivedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ReceivedWithStreamingResponse: - return ReceivedWithStreamingResponse(self) + def with_streaming_response(self) -> ReceivedResourceWithStreamingResponse: + return ReceivedResourceWithStreamingResponse(self) def get( self, @@ -160,18 +161,18 @@ def get( ) -class AsyncReceived(AsyncAPIResource): +class AsyncReceivedResource(AsyncAPIResource): @cached_property - def fields(self) -> AsyncFields: - return AsyncFields(self._client) + def fields(self) -> AsyncFieldsResource: + return AsyncFieldsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncReceivedWithRawResponse: - return AsyncReceivedWithRawResponse(self) + def with_raw_response(self) -> AsyncReceivedResourceWithRawResponse: + return AsyncReceivedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncReceivedWithStreamingResponse: - return AsyncReceivedWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncReceivedResourceWithStreamingResponse: + return AsyncReceivedResourceWithStreamingResponse(self) async def get( self, @@ -284,8 +285,8 @@ async def get( ) -class ReceivedWithRawResponse: - def __init__(self, received: Received) -> None: +class ReceivedResourceWithRawResponse: + def __init__(self, received: ReceivedResource) -> None: self._received = received self.get = to_raw_response_wrapper( @@ -293,12 +294,12 @@ def __init__(self, received: Received) -> None: ) @cached_property - def fields(self) -> FieldsWithRawResponse: - return FieldsWithRawResponse(self._received.fields) + def fields(self) -> FieldsResourceWithRawResponse: + return FieldsResourceWithRawResponse(self._received.fields) -class AsyncReceivedWithRawResponse: - def __init__(self, received: AsyncReceived) -> None: +class AsyncReceivedResourceWithRawResponse: + def __init__(self, received: AsyncReceivedResource) -> None: self._received = received self.get = async_to_raw_response_wrapper( @@ -306,12 +307,12 @@ def __init__(self, received: AsyncReceived) -> None: ) @cached_property - def fields(self) -> AsyncFieldsWithRawResponse: - return AsyncFieldsWithRawResponse(self._received.fields) + def fields(self) -> AsyncFieldsResourceWithRawResponse: + return AsyncFieldsResourceWithRawResponse(self._received.fields) -class ReceivedWithStreamingResponse: - def __init__(self, received: Received) -> None: +class ReceivedResourceWithStreamingResponse: + def __init__(self, received: ReceivedResource) -> None: self._received = received self.get = to_streamed_response_wrapper( @@ -319,12 +320,12 @@ def __init__(self, received: Received) -> None: ) @cached_property - def fields(self) -> FieldsWithStreamingResponse: - return FieldsWithStreamingResponse(self._received.fields) + def fields(self) -> FieldsResourceWithStreamingResponse: + return FieldsResourceWithStreamingResponse(self._received.fields) -class AsyncReceivedWithStreamingResponse: - def __init__(self, received: AsyncReceived) -> None: +class AsyncReceivedResourceWithStreamingResponse: + def __init__(self, received: AsyncReceivedResource) -> None: self._received = received self.get = async_to_streamed_response_wrapper( @@ -332,5 +333,5 @@ def __init__(self, received: AsyncReceived) -> None: ) @cached_property - def fields(self) -> AsyncFieldsWithStreamingResponse: - return AsyncFieldsWithStreamingResponse(self._received.fields) + def fields(self) -> AsyncFieldsResourceWithStreamingResponse: + return AsyncFieldsResourceWithStreamingResponse(self._received.fields) diff --git a/src/cloudflare/resources/magic_network_monitoring/__init__.py b/src/cloudflare/resources/magic_network_monitoring/__init__.py index 3149fd83017..ddc8bc54f41 100644 --- a/src/cloudflare/resources/magic_network_monitoring/__init__.py +++ b/src/cloudflare/resources/magic_network_monitoring/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .configs import ( - Configs, - AsyncConfigs, - ConfigsWithRawResponse, - AsyncConfigsWithRawResponse, - ConfigsWithStreamingResponse, - AsyncConfigsWithStreamingResponse, + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, ) from .magic_network_monitoring import ( - MagicNetworkMonitoring, - AsyncMagicNetworkMonitoring, - MagicNetworkMonitoringWithRawResponse, - AsyncMagicNetworkMonitoringWithRawResponse, - MagicNetworkMonitoringWithStreamingResponse, - AsyncMagicNetworkMonitoringWithStreamingResponse, + MagicNetworkMonitoringResource, + AsyncMagicNetworkMonitoringResource, + MagicNetworkMonitoringResourceWithRawResponse, + AsyncMagicNetworkMonitoringResourceWithRawResponse, + MagicNetworkMonitoringResourceWithStreamingResponse, + AsyncMagicNetworkMonitoringResourceWithStreamingResponse, ) __all__ = [ - "Configs", - "AsyncConfigs", - "ConfigsWithRawResponse", - "AsyncConfigsWithRawResponse", - "ConfigsWithStreamingResponse", - "AsyncConfigsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "MagicNetworkMonitoring", - "AsyncMagicNetworkMonitoring", - "MagicNetworkMonitoringWithRawResponse", - "AsyncMagicNetworkMonitoringWithRawResponse", - "MagicNetworkMonitoringWithStreamingResponse", - "AsyncMagicNetworkMonitoringWithStreamingResponse", + "ConfigsResource", + "AsyncConfigsResource", + "ConfigsResourceWithRawResponse", + "AsyncConfigsResourceWithRawResponse", + "ConfigsResourceWithStreamingResponse", + "AsyncConfigsResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "MagicNetworkMonitoringResource", + "AsyncMagicNetworkMonitoringResource", + "MagicNetworkMonitoringResourceWithRawResponse", + "AsyncMagicNetworkMonitoringResourceWithRawResponse", + "MagicNetworkMonitoringResourceWithStreamingResponse", + "AsyncMagicNetworkMonitoringResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/magic_network_monitoring/configs/__init__.py b/src/cloudflare/resources/magic_network_monitoring/configs/__init__.py index 3925a938c90..cd21fef80b1 100644 --- a/src/cloudflare/resources/magic_network_monitoring/configs/__init__.py +++ b/src/cloudflare/resources/magic_network_monitoring/configs/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .full import ( - Full, - AsyncFull, - FullWithRawResponse, - AsyncFullWithRawResponse, - FullWithStreamingResponse, - AsyncFullWithStreamingResponse, + FullResource, + AsyncFullResource, + FullResourceWithRawResponse, + AsyncFullResourceWithRawResponse, + FullResourceWithStreamingResponse, + AsyncFullResourceWithStreamingResponse, ) from .configs import ( - Configs, - AsyncConfigs, - ConfigsWithRawResponse, - AsyncConfigsWithRawResponse, - ConfigsWithStreamingResponse, - AsyncConfigsWithStreamingResponse, + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, ) __all__ = [ - "Full", - "AsyncFull", - "FullWithRawResponse", - "AsyncFullWithRawResponse", - "FullWithStreamingResponse", - "AsyncFullWithStreamingResponse", - "Configs", - "AsyncConfigs", - "ConfigsWithRawResponse", - "AsyncConfigsWithRawResponse", - "ConfigsWithStreamingResponse", - "AsyncConfigsWithStreamingResponse", + "FullResource", + "AsyncFullResource", + "FullResourceWithRawResponse", + "AsyncFullResourceWithRawResponse", + "FullResourceWithStreamingResponse", + "AsyncFullResourceWithStreamingResponse", + "ConfigsResource", + "AsyncConfigsResource", + "ConfigsResourceWithRawResponse", + "AsyncConfigsResourceWithRawResponse", + "ConfigsResourceWithStreamingResponse", + "AsyncConfigsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/magic_network_monitoring/configs/configs.py b/src/cloudflare/resources/magic_network_monitoring/configs/configs.py index 6d2f1e9761d..aa26e9f620f 100644 --- a/src/cloudflare/resources/magic_network_monitoring/configs/configs.py +++ b/src/cloudflare/resources/magic_network_monitoring/configs/configs.py @@ -7,14 +7,18 @@ import httpx from .full import ( - Full, - AsyncFull, - FullWithRawResponse, - AsyncFullWithRawResponse, - FullWithStreamingResponse, - AsyncFullWithStreamingResponse, + FullResource, + AsyncFullResource, + FullResourceWithRawResponse, + AsyncFullResourceWithRawResponse, + FullResourceWithStreamingResponse, + AsyncFullResourceWithStreamingResponse, ) 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 ( @@ -27,35 +31,42 @@ from ...._base_client import ( make_request_options, ) -from ....types.magic_network_monitoring import MagicNetworkMonitoringConfig +from ....types.magic_network_monitoring import ( + config_edit_params, + config_create_params, + config_delete_params, + config_update_params, +) +from ....types.magic_network_monitoring.configuration import Configuration -__all__ = ["Configs", "AsyncConfigs"] +__all__ = ["ConfigsResource", "AsyncConfigsResource"] -class Configs(SyncAPIResource): +class ConfigsResource(SyncAPIResource): @cached_property - def full(self) -> Full: - return Full(self._client) + def full(self) -> FullResource: + return FullResource(self._client) @cached_property - def with_raw_response(self) -> ConfigsWithRawResponse: - return ConfigsWithRawResponse(self) + def with_raw_response(self) -> ConfigsResourceWithRawResponse: + return ConfigsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConfigsWithStreamingResponse: - return ConfigsWithStreamingResponse(self) + def with_streaming_response(self) -> ConfigsResourceWithStreamingResponse: + return ConfigsResourceWithStreamingResponse(self) def create( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Create a new network monitoring configuration. @@ -72,27 +83,29 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( f"/accounts/{account_id}/mnm/config", + body=maybe_transform(body, config_create_params.ConfigCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) def update( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Update an existing network monitoring configuration, requires the entire configuration to be updated at once. @@ -110,27 +123,29 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._put( f"/accounts/{account_id}/mnm/config", + body=maybe_transform(body, config_update_params.ConfigUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) def delete( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Delete an existing network monitoring configuration. @@ -147,27 +162,29 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._delete( f"/accounts/{account_id}/mnm/config", + body=maybe_transform(body, config_delete_params.ConfigDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) def edit( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Update fields in an existing network monitoring configuration. @@ -184,14 +201,15 @@ def edit( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._patch( f"/accounts/{account_id}/mnm/config", + body=maybe_transform(body, config_edit_params.ConfigEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) def get( @@ -204,7 +222,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Lists default sampling and router IPs for account. @@ -226,36 +244,37 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) -class AsyncConfigs(AsyncAPIResource): +class AsyncConfigsResource(AsyncAPIResource): @cached_property - def full(self) -> AsyncFull: - return AsyncFull(self._client) + def full(self) -> AsyncFullResource: + return AsyncFullResource(self._client) @cached_property - def with_raw_response(self) -> AsyncConfigsWithRawResponse: - return AsyncConfigsWithRawResponse(self) + def with_raw_response(self) -> AsyncConfigsResourceWithRawResponse: + return AsyncConfigsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConfigsWithStreamingResponse: - return AsyncConfigsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConfigsResourceWithStreamingResponse: + return AsyncConfigsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Create a new network monitoring configuration. @@ -272,27 +291,29 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( f"/accounts/{account_id}/mnm/config", + body=await async_maybe_transform(body, config_create_params.ConfigCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) async def update( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Update an existing network monitoring configuration, requires the entire configuration to be updated at once. @@ -310,27 +331,29 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._put( f"/accounts/{account_id}/mnm/config", + body=await async_maybe_transform(body, config_update_params.ConfigUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) async def delete( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Delete an existing network monitoring configuration. @@ -347,27 +370,29 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._delete( f"/accounts/{account_id}/mnm/config", + body=await async_maybe_transform(body, config_delete_params.ConfigDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) async def edit( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Update fields in an existing network monitoring configuration. @@ -384,14 +409,15 @@ async def edit( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._patch( f"/accounts/{account_id}/mnm/config", + body=await async_maybe_transform(body, config_edit_params.ConfigEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) async def get( @@ -404,7 +430,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Lists default sampling and router IPs for account. @@ -426,14 +452,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) -class ConfigsWithRawResponse: - def __init__(self, configs: Configs) -> None: +class ConfigsResourceWithRawResponse: + def __init__(self, configs: ConfigsResource) -> None: self._configs = configs self.create = to_raw_response_wrapper( @@ -453,12 +479,12 @@ def __init__(self, configs: Configs) -> None: ) @cached_property - def full(self) -> FullWithRawResponse: - return FullWithRawResponse(self._configs.full) + def full(self) -> FullResourceWithRawResponse: + return FullResourceWithRawResponse(self._configs.full) -class AsyncConfigsWithRawResponse: - def __init__(self, configs: AsyncConfigs) -> None: +class AsyncConfigsResourceWithRawResponse: + def __init__(self, configs: AsyncConfigsResource) -> None: self._configs = configs self.create = async_to_raw_response_wrapper( @@ -478,12 +504,12 @@ def __init__(self, configs: AsyncConfigs) -> None: ) @cached_property - def full(self) -> AsyncFullWithRawResponse: - return AsyncFullWithRawResponse(self._configs.full) + def full(self) -> AsyncFullResourceWithRawResponse: + return AsyncFullResourceWithRawResponse(self._configs.full) -class ConfigsWithStreamingResponse: - def __init__(self, configs: Configs) -> None: +class ConfigsResourceWithStreamingResponse: + def __init__(self, configs: ConfigsResource) -> None: self._configs = configs self.create = to_streamed_response_wrapper( @@ -503,12 +529,12 @@ def __init__(self, configs: Configs) -> None: ) @cached_property - def full(self) -> FullWithStreamingResponse: - return FullWithStreamingResponse(self._configs.full) + def full(self) -> FullResourceWithStreamingResponse: + return FullResourceWithStreamingResponse(self._configs.full) -class AsyncConfigsWithStreamingResponse: - def __init__(self, configs: AsyncConfigs) -> None: +class AsyncConfigsResourceWithStreamingResponse: + def __init__(self, configs: AsyncConfigsResource) -> None: self._configs = configs self.create = async_to_streamed_response_wrapper( @@ -528,5 +554,5 @@ def __init__(self, configs: AsyncConfigs) -> None: ) @cached_property - def full(self) -> AsyncFullWithStreamingResponse: - return AsyncFullWithStreamingResponse(self._configs.full) + def full(self) -> AsyncFullResourceWithStreamingResponse: + return AsyncFullResourceWithStreamingResponse(self._configs.full) diff --git a/src/cloudflare/resources/magic_network_monitoring/configs/full.py b/src/cloudflare/resources/magic_network_monitoring/configs/full.py index 14f0d1a6dde..ef411789377 100644 --- a/src/cloudflare/resources/magic_network_monitoring/configs/full.py +++ b/src/cloudflare/resources/magic_network_monitoring/configs/full.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.magic_network_monitoring import MagicNetworkMonitoringConfig +from ....types.magic_network_monitoring.configuration import Configuration -__all__ = ["Full", "AsyncFull"] +__all__ = ["FullResource", "AsyncFullResource"] -class Full(SyncAPIResource): +class FullResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FullWithRawResponse: - return FullWithRawResponse(self) + def with_raw_response(self) -> FullResourceWithRawResponse: + return FullResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FullWithStreamingResponse: - return FullWithStreamingResponse(self) + def with_streaming_response(self) -> FullResourceWithStreamingResponse: + return FullResourceWithStreamingResponse(self) def get( self, @@ -43,7 +43,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Lists default sampling, router IPs, and rules for account. @@ -65,20 +65,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) -class AsyncFull(AsyncAPIResource): +class AsyncFullResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFullWithRawResponse: - return AsyncFullWithRawResponse(self) + def with_raw_response(self) -> AsyncFullResourceWithRawResponse: + return AsyncFullResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFullWithStreamingResponse: - return AsyncFullWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFullResourceWithStreamingResponse: + return AsyncFullResourceWithStreamingResponse(self) async def get( self, @@ -90,7 +90,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MagicNetworkMonitoringConfig: + ) -> Configuration: """ Lists default sampling, router IPs, and rules for account. @@ -112,14 +112,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Configuration]._unwrapper, ), - cast_to=cast(Type[MagicNetworkMonitoringConfig], ResultWrapper[MagicNetworkMonitoringConfig]), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), ) -class FullWithRawResponse: - def __init__(self, full: Full) -> None: +class FullResourceWithRawResponse: + def __init__(self, full: FullResource) -> None: self._full = full self.get = to_raw_response_wrapper( @@ -127,8 +127,8 @@ def __init__(self, full: Full) -> None: ) -class AsyncFullWithRawResponse: - def __init__(self, full: AsyncFull) -> None: +class AsyncFullResourceWithRawResponse: + def __init__(self, full: AsyncFullResource) -> None: self._full = full self.get = async_to_raw_response_wrapper( @@ -136,8 +136,8 @@ def __init__(self, full: AsyncFull) -> None: ) -class FullWithStreamingResponse: - def __init__(self, full: Full) -> None: +class FullResourceWithStreamingResponse: + def __init__(self, full: FullResource) -> None: self._full = full self.get = to_streamed_response_wrapper( @@ -145,8 +145,8 @@ def __init__(self, full: Full) -> None: ) -class AsyncFullWithStreamingResponse: - def __init__(self, full: AsyncFull) -> None: +class AsyncFullResourceWithStreamingResponse: + def __init__(self, full: AsyncFullResource) -> None: self._full = full self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/magic_network_monitoring/magic_network_monitoring.py b/src/cloudflare/resources/magic_network_monitoring/magic_network_monitoring.py index 024fa234d68..528cbaa79ef 100644 --- a/src/cloudflare/resources/magic_network_monitoring/magic_network_monitoring.py +++ b/src/cloudflare/resources/magic_network_monitoring/magic_network_monitoring.py @@ -3,112 +3,112 @@ from __future__ import annotations from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .configs import ( - Configs, - AsyncConfigs, - ConfigsWithRawResponse, - AsyncConfigsWithRawResponse, - ConfigsWithStreamingResponse, - AsyncConfigsWithStreamingResponse, + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .rules.rules import Rules, AsyncRules -from .configs.configs import Configs, AsyncConfigs +from .rules.rules import RulesResource, AsyncRulesResource +from .configs.configs import ConfigsResource, AsyncConfigsResource -__all__ = ["MagicNetworkMonitoring", "AsyncMagicNetworkMonitoring"] +__all__ = ["MagicNetworkMonitoringResource", "AsyncMagicNetworkMonitoringResource"] -class MagicNetworkMonitoring(SyncAPIResource): +class MagicNetworkMonitoringResource(SyncAPIResource): @cached_property - def configs(self) -> Configs: - return Configs(self._client) + def configs(self) -> ConfigsResource: + return ConfigsResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def with_raw_response(self) -> MagicNetworkMonitoringWithRawResponse: - return MagicNetworkMonitoringWithRawResponse(self) + def with_raw_response(self) -> MagicNetworkMonitoringResourceWithRawResponse: + return MagicNetworkMonitoringResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MagicNetworkMonitoringWithStreamingResponse: - return MagicNetworkMonitoringWithStreamingResponse(self) + def with_streaming_response(self) -> MagicNetworkMonitoringResourceWithStreamingResponse: + return MagicNetworkMonitoringResourceWithStreamingResponse(self) -class AsyncMagicNetworkMonitoring(AsyncAPIResource): +class AsyncMagicNetworkMonitoringResource(AsyncAPIResource): @cached_property - def configs(self) -> AsyncConfigs: - return AsyncConfigs(self._client) + def configs(self) -> AsyncConfigsResource: + return AsyncConfigsResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncMagicNetworkMonitoringWithRawResponse: - return AsyncMagicNetworkMonitoringWithRawResponse(self) + def with_raw_response(self) -> AsyncMagicNetworkMonitoringResourceWithRawResponse: + return AsyncMagicNetworkMonitoringResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMagicNetworkMonitoringWithStreamingResponse: - return AsyncMagicNetworkMonitoringWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMagicNetworkMonitoringResourceWithStreamingResponse: + return AsyncMagicNetworkMonitoringResourceWithStreamingResponse(self) -class MagicNetworkMonitoringWithRawResponse: - def __init__(self, magic_network_monitoring: MagicNetworkMonitoring) -> None: +class MagicNetworkMonitoringResourceWithRawResponse: + def __init__(self, magic_network_monitoring: MagicNetworkMonitoringResource) -> None: self._magic_network_monitoring = magic_network_monitoring @cached_property - def configs(self) -> ConfigsWithRawResponse: - return ConfigsWithRawResponse(self._magic_network_monitoring.configs) + def configs(self) -> ConfigsResourceWithRawResponse: + return ConfigsResourceWithRawResponse(self._magic_network_monitoring.configs) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._magic_network_monitoring.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._magic_network_monitoring.rules) -class AsyncMagicNetworkMonitoringWithRawResponse: - def __init__(self, magic_network_monitoring: AsyncMagicNetworkMonitoring) -> None: +class AsyncMagicNetworkMonitoringResourceWithRawResponse: + def __init__(self, magic_network_monitoring: AsyncMagicNetworkMonitoringResource) -> None: self._magic_network_monitoring = magic_network_monitoring @cached_property - def configs(self) -> AsyncConfigsWithRawResponse: - return AsyncConfigsWithRawResponse(self._magic_network_monitoring.configs) + def configs(self) -> AsyncConfigsResourceWithRawResponse: + return AsyncConfigsResourceWithRawResponse(self._magic_network_monitoring.configs) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._magic_network_monitoring.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._magic_network_monitoring.rules) -class MagicNetworkMonitoringWithStreamingResponse: - def __init__(self, magic_network_monitoring: MagicNetworkMonitoring) -> None: +class MagicNetworkMonitoringResourceWithStreamingResponse: + def __init__(self, magic_network_monitoring: MagicNetworkMonitoringResource) -> None: self._magic_network_monitoring = magic_network_monitoring @cached_property - def configs(self) -> ConfigsWithStreamingResponse: - return ConfigsWithStreamingResponse(self._magic_network_monitoring.configs) + def configs(self) -> ConfigsResourceWithStreamingResponse: + return ConfigsResourceWithStreamingResponse(self._magic_network_monitoring.configs) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._magic_network_monitoring.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._magic_network_monitoring.rules) -class AsyncMagicNetworkMonitoringWithStreamingResponse: - def __init__(self, magic_network_monitoring: AsyncMagicNetworkMonitoring) -> None: +class AsyncMagicNetworkMonitoringResourceWithStreamingResponse: + def __init__(self, magic_network_monitoring: AsyncMagicNetworkMonitoringResource) -> None: self._magic_network_monitoring = magic_network_monitoring @cached_property - def configs(self) -> AsyncConfigsWithStreamingResponse: - return AsyncConfigsWithStreamingResponse(self._magic_network_monitoring.configs) + def configs(self) -> AsyncConfigsResourceWithStreamingResponse: + return AsyncConfigsResourceWithStreamingResponse(self._magic_network_monitoring.configs) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._magic_network_monitoring.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._magic_network_monitoring.rules) diff --git a/src/cloudflare/resources/magic_network_monitoring/rules/__init__.py b/src/cloudflare/resources/magic_network_monitoring/rules/__init__.py index cba78cae500..00d12a6e555 100644 --- a/src/cloudflare/resources/magic_network_monitoring/rules/__init__.py +++ b/src/cloudflare/resources/magic_network_monitoring/rules/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .advertisements import ( - Advertisements, - AsyncAdvertisements, - AdvertisementsWithRawResponse, - AsyncAdvertisementsWithRawResponse, - AdvertisementsWithStreamingResponse, - AsyncAdvertisementsWithStreamingResponse, + AdvertisementsResource, + AsyncAdvertisementsResource, + AdvertisementsResourceWithRawResponse, + AsyncAdvertisementsResourceWithRawResponse, + AdvertisementsResourceWithStreamingResponse, + AsyncAdvertisementsResourceWithStreamingResponse, ) __all__ = [ - "Advertisements", - "AsyncAdvertisements", - "AdvertisementsWithRawResponse", - "AsyncAdvertisementsWithRawResponse", - "AdvertisementsWithStreamingResponse", - "AsyncAdvertisementsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", + "AdvertisementsResource", + "AsyncAdvertisementsResource", + "AdvertisementsResourceWithRawResponse", + "AsyncAdvertisementsResourceWithRawResponse", + "AdvertisementsResourceWithStreamingResponse", + "AsyncAdvertisementsResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/magic_network_monitoring/rules/advertisements.py b/src/cloudflare/resources/magic_network_monitoring/rules/advertisements.py index a3257fb7f14..73550783cd7 100644 --- a/src/cloudflare/resources/magic_network_monitoring/rules/advertisements.py +++ b/src/cloudflare/resources/magic_network_monitoring/rules/advertisements.py @@ -7,6 +7,10 @@ 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 ( @@ -19,36 +23,41 @@ from ...._base_client import ( make_request_options, ) -from ....types.magic_network_monitoring.rules import MagicNetworkMonitoringRuleAdvertisable +from ....types.magic_network_monitoring.rules import advertisement_edit_params +from ....types.magic_network_monitoring.rules.advertisement import Advertisement -__all__ = ["Advertisements", "AsyncAdvertisements"] +__all__ = ["AdvertisementsResource", "AsyncAdvertisementsResource"] -class Advertisements(SyncAPIResource): +class AdvertisementsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AdvertisementsWithRawResponse: - return AdvertisementsWithRawResponse(self) + def with_raw_response(self) -> AdvertisementsResourceWithRawResponse: + return AdvertisementsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AdvertisementsWithStreamingResponse: - return AdvertisementsWithStreamingResponse(self) + def with_streaming_response(self) -> AdvertisementsResourceWithStreamingResponse: + return AdvertisementsResourceWithStreamingResponse(self) def edit( self, rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[MagicNetworkMonitoringRuleAdvertisable]: - """ - Update advertisement for rule. + ) -> Optional[Advertisement]: + """Update advertisement for rule. Args: + rule_id: The id of the rule. + + Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -63,45 +72,47 @@ def edit( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._patch( f"/accounts/{account_id}/mnm/rules/{rule_id}/advertisement", + body=maybe_transform(body, advertisement_edit_params.AdvertisementEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[MagicNetworkMonitoringRuleAdvertisable]], - ResultWrapper[MagicNetworkMonitoringRuleAdvertisable], + post_parser=ResultWrapper[Optional[Advertisement]]._unwrapper, ), + cast_to=cast(Type[Optional[Advertisement]], ResultWrapper[Advertisement]), ) -class AsyncAdvertisements(AsyncAPIResource): +class AsyncAdvertisementsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAdvertisementsWithRawResponse: - return AsyncAdvertisementsWithRawResponse(self) + def with_raw_response(self) -> AsyncAdvertisementsResourceWithRawResponse: + return AsyncAdvertisementsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAdvertisementsWithStreamingResponse: - return AsyncAdvertisementsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAdvertisementsResourceWithStreamingResponse: + return AsyncAdvertisementsResourceWithStreamingResponse(self) async def edit( self, rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[MagicNetworkMonitoringRuleAdvertisable]: - """ - Update advertisement for rule. + ) -> Optional[Advertisement]: + """Update advertisement for rule. Args: + rule_id: The id of the rule. + + Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -116,22 +127,20 @@ async def edit( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._patch( f"/accounts/{account_id}/mnm/rules/{rule_id}/advertisement", + body=await async_maybe_transform(body, advertisement_edit_params.AdvertisementEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[MagicNetworkMonitoringRuleAdvertisable]], - ResultWrapper[MagicNetworkMonitoringRuleAdvertisable], + post_parser=ResultWrapper[Optional[Advertisement]]._unwrapper, ), + cast_to=cast(Type[Optional[Advertisement]], ResultWrapper[Advertisement]), ) -class AdvertisementsWithRawResponse: - def __init__(self, advertisements: Advertisements) -> None: +class AdvertisementsResourceWithRawResponse: + def __init__(self, advertisements: AdvertisementsResource) -> None: self._advertisements = advertisements self.edit = to_raw_response_wrapper( @@ -139,8 +148,8 @@ def __init__(self, advertisements: Advertisements) -> None: ) -class AsyncAdvertisementsWithRawResponse: - def __init__(self, advertisements: AsyncAdvertisements) -> None: +class AsyncAdvertisementsResourceWithRawResponse: + def __init__(self, advertisements: AsyncAdvertisementsResource) -> None: self._advertisements = advertisements self.edit = async_to_raw_response_wrapper( @@ -148,8 +157,8 @@ def __init__(self, advertisements: AsyncAdvertisements) -> None: ) -class AdvertisementsWithStreamingResponse: - def __init__(self, advertisements: Advertisements) -> None: +class AdvertisementsResourceWithStreamingResponse: + def __init__(self, advertisements: AdvertisementsResource) -> None: self._advertisements = advertisements self.edit = to_streamed_response_wrapper( @@ -157,8 +166,8 @@ def __init__(self, advertisements: Advertisements) -> None: ) -class AsyncAdvertisementsWithStreamingResponse: - def __init__(self, advertisements: AsyncAdvertisements) -> None: +class AsyncAdvertisementsResourceWithStreamingResponse: + def __init__(self, advertisements: AsyncAdvertisementsResource) -> None: self._advertisements = advertisements self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/magic_network_monitoring/rules/rules.py b/src/cloudflare/resources/magic_network_monitoring/rules/rules.py index 4560798250e..fb7429d9f99 100644 --- a/src/cloudflare/resources/magic_network_monitoring/rules/rules.py +++ b/src/cloudflare/resources/magic_network_monitoring/rules/rules.py @@ -7,6 +7,10 @@ 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 ( @@ -18,39 +22,46 @@ from ...._wrappers import ResultWrapper from ....pagination import SyncSinglePage, AsyncSinglePage from .advertisements import ( - Advertisements, - AsyncAdvertisements, - AdvertisementsWithRawResponse, - AsyncAdvertisementsWithRawResponse, - AdvertisementsWithStreamingResponse, - AsyncAdvertisementsWithStreamingResponse, + AdvertisementsResource, + AsyncAdvertisementsResource, + AdvertisementsResourceWithRawResponse, + AsyncAdvertisementsResourceWithRawResponse, + AdvertisementsResourceWithStreamingResponse, + AsyncAdvertisementsResourceWithStreamingResponse, ) from ...._base_client import ( AsyncPaginator, make_request_options, ) -from ....types.magic_network_monitoring import MagicNetworkMonitoringRule +from ....types.magic_network_monitoring import ( + rule_edit_params, + rule_create_params, + rule_delete_params, + rule_update_params, +) +from ....types.magic_network_monitoring.magic_network_monitoring_rule import MagicNetworkMonitoringRule -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def advertisements(self) -> Advertisements: - return Advertisements(self._client) + def advertisements(self) -> AdvertisementsResource: + return AdvertisementsResource(self._client) @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) def create( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +87,13 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( f"/accounts/{account_id}/mnm/rules", + body=maybe_transform(body, 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._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) @@ -90,6 +102,7 @@ def update( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -113,12 +126,13 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._put( f"/accounts/{account_id}/mnm/rules", + body=maybe_transform(body, 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._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) @@ -162,6 +176,7 @@ def delete( rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -173,6 +188,8 @@ def delete( Delete a network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -187,12 +204,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._delete( f"/accounts/{account_id}/mnm/rules/{rule_id}", + body=maybe_transform(body, rule_delete_params.RuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) @@ -202,6 +220,7 @@ def edit( rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -213,6 +232,8 @@ def edit( Update a network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -227,12 +248,13 @@ def edit( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._patch( f"/accounts/{account_id}/mnm/rules/{rule_id}", + body=maybe_transform(body, rule_edit_params.RuleEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) @@ -253,6 +275,8 @@ def get( List a single network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -272,29 +296,30 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def advertisements(self) -> AsyncAdvertisements: - return AsyncAdvertisements(self._client) + def advertisements(self) -> AsyncAdvertisementsResource: + return AsyncAdvertisementsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) async def create( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -320,12 +345,13 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( f"/accounts/{account_id}/mnm/rules", + body=await async_maybe_transform(body, 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._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) @@ -334,6 +360,7 @@ async def update( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -357,12 +384,13 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._put( f"/accounts/{account_id}/mnm/rules", + body=await async_maybe_transform(body, 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._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) @@ -406,6 +434,7 @@ async def delete( rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,6 +446,8 @@ async def delete( Delete a network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -431,12 +462,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._delete( f"/accounts/{account_id}/mnm/rules/{rule_id}", + body=await async_maybe_transform(body, rule_delete_params.RuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) @@ -446,6 +478,7 @@ async def edit( rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -457,6 +490,8 @@ async def edit( Update a network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -471,12 +506,13 @@ async def edit( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._patch( f"/accounts/{account_id}/mnm/rules/{rule_id}", + body=await async_maybe_transform(body, rule_edit_params.RuleEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) @@ -497,6 +533,8 @@ async def get( List a single network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -516,14 +554,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MagicNetworkMonitoringRule]]._unwrapper, ), cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_raw_response_wrapper( @@ -546,12 +584,12 @@ def __init__(self, rules: Rules) -> None: ) @cached_property - def advertisements(self) -> AdvertisementsWithRawResponse: - return AdvertisementsWithRawResponse(self._rules.advertisements) + def advertisements(self) -> AdvertisementsResourceWithRawResponse: + return AdvertisementsResourceWithRawResponse(self._rules.advertisements) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_raw_response_wrapper( @@ -574,12 +612,12 @@ def __init__(self, rules: AsyncRules) -> None: ) @cached_property - def advertisements(self) -> AsyncAdvertisementsWithRawResponse: - return AsyncAdvertisementsWithRawResponse(self._rules.advertisements) + def advertisements(self) -> AsyncAdvertisementsResourceWithRawResponse: + return AsyncAdvertisementsResourceWithRawResponse(self._rules.advertisements) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_streamed_response_wrapper( @@ -602,12 +640,12 @@ def __init__(self, rules: Rules) -> None: ) @cached_property - def advertisements(self) -> AdvertisementsWithStreamingResponse: - return AdvertisementsWithStreamingResponse(self._rules.advertisements) + def advertisements(self) -> AdvertisementsResourceWithStreamingResponse: + return AdvertisementsResourceWithStreamingResponse(self._rules.advertisements) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_streamed_response_wrapper( @@ -630,5 +668,5 @@ def __init__(self, rules: AsyncRules) -> None: ) @cached_property - def advertisements(self) -> AsyncAdvertisementsWithStreamingResponse: - return AsyncAdvertisementsWithStreamingResponse(self._rules.advertisements) + def advertisements(self) -> AsyncAdvertisementsResourceWithStreamingResponse: + return AsyncAdvertisementsResourceWithStreamingResponse(self._rules.advertisements) diff --git a/src/cloudflare/resources/magic_transit/__init__.py b/src/cloudflare/resources/magic_transit/__init__.py index e554d5d7620..c954e23e46a 100644 --- a/src/cloudflare/resources/magic_transit/__init__.py +++ b/src/cloudflare/resources/magic_transit/__init__.py @@ -1,89 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .sites import ( - Sites, - AsyncSites, - SitesWithRawResponse, - AsyncSitesWithRawResponse, - SitesWithStreamingResponse, - AsyncSitesWithStreamingResponse, + SitesResource, + AsyncSitesResource, + SitesResourceWithRawResponse, + AsyncSitesResourceWithRawResponse, + SitesResourceWithStreamingResponse, + AsyncSitesResourceWithStreamingResponse, ) from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, ) from .gre_tunnels import ( - GRETunnels, - AsyncGRETunnels, - GRETunnelsWithRawResponse, - AsyncGRETunnelsWithRawResponse, - GRETunnelsWithStreamingResponse, - AsyncGRETunnelsWithStreamingResponse, + GRETunnelsResource, + AsyncGRETunnelsResource, + GRETunnelsResourceWithRawResponse, + AsyncGRETunnelsResourceWithRawResponse, + GRETunnelsResourceWithStreamingResponse, + AsyncGRETunnelsResourceWithStreamingResponse, ) from .ipsec_tunnels import ( - IPSECTunnels, - AsyncIPSECTunnels, - IPSECTunnelsWithRawResponse, - AsyncIPSECTunnelsWithRawResponse, - IPSECTunnelsWithStreamingResponse, - AsyncIPSECTunnelsWithStreamingResponse, + IPSECTunnelsResource, + AsyncIPSECTunnelsResource, + IPSECTunnelsResourceWithRawResponse, + AsyncIPSECTunnelsResourceWithRawResponse, + IPSECTunnelsResourceWithStreamingResponse, + AsyncIPSECTunnelsResourceWithStreamingResponse, ) from .magic_transit import ( - MagicTransit, - AsyncMagicTransit, - MagicTransitWithRawResponse, - AsyncMagicTransitWithRawResponse, - MagicTransitWithStreamingResponse, - AsyncMagicTransitWithStreamingResponse, + MagicTransitResource, + AsyncMagicTransitResource, + MagicTransitResourceWithRawResponse, + AsyncMagicTransitResourceWithRawResponse, + MagicTransitResourceWithStreamingResponse, + AsyncMagicTransitResourceWithStreamingResponse, ) from .cf_interconnects import ( - CfInterconnects, - AsyncCfInterconnects, - CfInterconnectsWithRawResponse, - AsyncCfInterconnectsWithRawResponse, - CfInterconnectsWithStreamingResponse, - AsyncCfInterconnectsWithStreamingResponse, + CfInterconnectsResource, + AsyncCfInterconnectsResource, + CfInterconnectsResourceWithRawResponse, + AsyncCfInterconnectsResourceWithRawResponse, + CfInterconnectsResourceWithStreamingResponse, + AsyncCfInterconnectsResourceWithStreamingResponse, ) __all__ = [ - "CfInterconnects", - "AsyncCfInterconnects", - "CfInterconnectsWithRawResponse", - "AsyncCfInterconnectsWithRawResponse", - "CfInterconnectsWithStreamingResponse", - "AsyncCfInterconnectsWithStreamingResponse", - "GRETunnels", - "AsyncGRETunnels", - "GRETunnelsWithRawResponse", - "AsyncGRETunnelsWithRawResponse", - "GRETunnelsWithStreamingResponse", - "AsyncGRETunnelsWithStreamingResponse", - "IPSECTunnels", - "AsyncIPSECTunnels", - "IPSECTunnelsWithRawResponse", - "AsyncIPSECTunnelsWithRawResponse", - "IPSECTunnelsWithStreamingResponse", - "AsyncIPSECTunnelsWithStreamingResponse", - "Routes", - "AsyncRoutes", - "RoutesWithRawResponse", - "AsyncRoutesWithRawResponse", - "RoutesWithStreamingResponse", - "AsyncRoutesWithStreamingResponse", - "Sites", - "AsyncSites", - "SitesWithRawResponse", - "AsyncSitesWithRawResponse", - "SitesWithStreamingResponse", - "AsyncSitesWithStreamingResponse", - "MagicTransit", - "AsyncMagicTransit", - "MagicTransitWithRawResponse", - "AsyncMagicTransitWithRawResponse", - "MagicTransitWithStreamingResponse", - "AsyncMagicTransitWithStreamingResponse", + "CfInterconnectsResource", + "AsyncCfInterconnectsResource", + "CfInterconnectsResourceWithRawResponse", + "AsyncCfInterconnectsResourceWithRawResponse", + "CfInterconnectsResourceWithStreamingResponse", + "AsyncCfInterconnectsResourceWithStreamingResponse", + "GRETunnelsResource", + "AsyncGRETunnelsResource", + "GRETunnelsResourceWithRawResponse", + "AsyncGRETunnelsResourceWithRawResponse", + "GRETunnelsResourceWithStreamingResponse", + "AsyncGRETunnelsResourceWithStreamingResponse", + "IPSECTunnelsResource", + "AsyncIPSECTunnelsResource", + "IPSECTunnelsResourceWithRawResponse", + "AsyncIPSECTunnelsResourceWithRawResponse", + "IPSECTunnelsResourceWithStreamingResponse", + "AsyncIPSECTunnelsResourceWithStreamingResponse", + "RoutesResource", + "AsyncRoutesResource", + "RoutesResourceWithRawResponse", + "AsyncRoutesResourceWithRawResponse", + "RoutesResourceWithStreamingResponse", + "AsyncRoutesResourceWithStreamingResponse", + "SitesResource", + "AsyncSitesResource", + "SitesResourceWithRawResponse", + "AsyncSitesResourceWithRawResponse", + "SitesResourceWithStreamingResponse", + "AsyncSitesResourceWithStreamingResponse", + "MagicTransitResource", + "AsyncMagicTransitResource", + "MagicTransitResourceWithRawResponse", + "AsyncMagicTransitResourceWithRawResponse", + "MagicTransitResourceWithStreamingResponse", + "AsyncMagicTransitResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/magic_transit/cf_interconnects.py b/src/cloudflare/resources/magic_transit/cf_interconnects.py index baeb9340daf..753c1abf218 100644 --- a/src/cloudflare/resources/magic_transit/cf_interconnects.py +++ b/src/cloudflare/resources/magic_transit/cf_interconnects.py @@ -23,24 +23,22 @@ from ..._base_client import ( make_request_options, ) -from ...types.magic_transit import ( - CfInterconnectGetResponse, - CfInterconnectListResponse, - CfInterconnectUpdateResponse, - cf_interconnect_update_params, -) +from ...types.magic_transit import cf_interconnect_update_params +from ...types.magic_transit.cf_interconnect_get_response import CfInterconnectGetResponse +from ...types.magic_transit.cf_interconnect_list_response import CfInterconnectListResponse +from ...types.magic_transit.cf_interconnect_update_response import CfInterconnectUpdateResponse -__all__ = ["CfInterconnects", "AsyncCfInterconnects"] +__all__ = ["CfInterconnectsResource", "AsyncCfInterconnectsResource"] -class CfInterconnects(SyncAPIResource): +class CfInterconnectsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CfInterconnectsWithRawResponse: - return CfInterconnectsWithRawResponse(self) + def with_raw_response(self) -> CfInterconnectsResourceWithRawResponse: + return CfInterconnectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CfInterconnectsWithStreamingResponse: - return CfInterconnectsWithStreamingResponse(self) + def with_streaming_response(self) -> CfInterconnectsResourceWithStreamingResponse: + return CfInterconnectsResourceWithStreamingResponse(self) def update( self, @@ -110,7 +108,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CfInterconnectUpdateResponse]._unwrapper, ), cast_to=cast(Type[CfInterconnectUpdateResponse], ResultWrapper[CfInterconnectUpdateResponse]), ) @@ -149,7 +147,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CfInterconnectListResponse]._unwrapper, ), cast_to=cast(Type[CfInterconnectListResponse], ResultWrapper[CfInterconnectListResponse]), ) @@ -193,20 +191,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CfInterconnectGetResponse]._unwrapper, ), cast_to=cast(Type[CfInterconnectGetResponse], ResultWrapper[CfInterconnectGetResponse]), ) -class AsyncCfInterconnects(AsyncAPIResource): +class AsyncCfInterconnectsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCfInterconnectsWithRawResponse: - return AsyncCfInterconnectsWithRawResponse(self) + def with_raw_response(self) -> AsyncCfInterconnectsResourceWithRawResponse: + return AsyncCfInterconnectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCfInterconnectsWithStreamingResponse: - return AsyncCfInterconnectsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCfInterconnectsResourceWithStreamingResponse: + return AsyncCfInterconnectsResourceWithStreamingResponse(self) async def update( self, @@ -276,7 +274,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CfInterconnectUpdateResponse]._unwrapper, ), cast_to=cast(Type[CfInterconnectUpdateResponse], ResultWrapper[CfInterconnectUpdateResponse]), ) @@ -315,7 +313,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CfInterconnectListResponse]._unwrapper, ), cast_to=cast(Type[CfInterconnectListResponse], ResultWrapper[CfInterconnectListResponse]), ) @@ -359,14 +357,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CfInterconnectGetResponse]._unwrapper, ), cast_to=cast(Type[CfInterconnectGetResponse], ResultWrapper[CfInterconnectGetResponse]), ) -class CfInterconnectsWithRawResponse: - def __init__(self, cf_interconnects: CfInterconnects) -> None: +class CfInterconnectsResourceWithRawResponse: + def __init__(self, cf_interconnects: CfInterconnectsResource) -> None: self._cf_interconnects = cf_interconnects self.update = to_raw_response_wrapper( @@ -380,8 +378,8 @@ def __init__(self, cf_interconnects: CfInterconnects) -> None: ) -class AsyncCfInterconnectsWithRawResponse: - def __init__(self, cf_interconnects: AsyncCfInterconnects) -> None: +class AsyncCfInterconnectsResourceWithRawResponse: + def __init__(self, cf_interconnects: AsyncCfInterconnectsResource) -> None: self._cf_interconnects = cf_interconnects self.update = async_to_raw_response_wrapper( @@ -395,8 +393,8 @@ def __init__(self, cf_interconnects: AsyncCfInterconnects) -> None: ) -class CfInterconnectsWithStreamingResponse: - def __init__(self, cf_interconnects: CfInterconnects) -> None: +class CfInterconnectsResourceWithStreamingResponse: + def __init__(self, cf_interconnects: CfInterconnectsResource) -> None: self._cf_interconnects = cf_interconnects self.update = to_streamed_response_wrapper( @@ -410,8 +408,8 @@ def __init__(self, cf_interconnects: CfInterconnects) -> None: ) -class AsyncCfInterconnectsWithStreamingResponse: - def __init__(self, cf_interconnects: AsyncCfInterconnects) -> None: +class AsyncCfInterconnectsResourceWithStreamingResponse: + def __init__(self, cf_interconnects: AsyncCfInterconnectsResource) -> None: self._cf_interconnects = cf_interconnects self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/magic_transit/gre_tunnels.py b/src/cloudflare/resources/magic_transit/gre_tunnels.py index 178f4b622ff..02f978ed886 100644 --- a/src/cloudflare/resources/magic_transit/gre_tunnels.py +++ b/src/cloudflare/resources/magic_transit/gre_tunnels.py @@ -24,26 +24,28 @@ make_request_options, ) from ...types.magic_transit import ( - GRETunnelGetResponse, - GRETunnelListResponse, - GRETunnelCreateResponse, - GRETunnelDeleteResponse, - GRETunnelUpdateResponse, gre_tunnel_create_params, + gre_tunnel_delete_params, gre_tunnel_update_params, ) +from ...types.magic_transit.health_check_param import HealthCheckParam +from ...types.magic_transit.gre_tunnel_get_response import GRETunnelGetResponse +from ...types.magic_transit.gre_tunnel_list_response import GRETunnelListResponse +from ...types.magic_transit.gre_tunnel_create_response import GRETunnelCreateResponse +from ...types.magic_transit.gre_tunnel_delete_response import GRETunnelDeleteResponse +from ...types.magic_transit.gre_tunnel_update_response import GRETunnelUpdateResponse -__all__ = ["GRETunnels", "AsyncGRETunnels"] +__all__ = ["GRETunnelsResource", "AsyncGRETunnelsResource"] -class GRETunnels(SyncAPIResource): +class GRETunnelsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> GRETunnelsWithRawResponse: - return GRETunnelsWithRawResponse(self) + def with_raw_response(self) -> GRETunnelsResourceWithRawResponse: + return GRETunnelsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> GRETunnelsWithStreamingResponse: - return GRETunnelsWithStreamingResponse(self) + def with_streaming_response(self) -> GRETunnelsResourceWithStreamingResponse: + return GRETunnelsResourceWithStreamingResponse(self) def create( self, @@ -83,7 +85,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelCreateResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelCreateResponse], ResultWrapper[GRETunnelCreateResponse]), ) @@ -98,7 +100,7 @@ def update( interface_address: str, name: str, description: str | NotGiven = NOT_GIVEN, - health_check: gre_tunnel_update_params.HealthCheck | NotGiven = NOT_GIVEN, + health_check: HealthCheckParam | NotGiven = NOT_GIVEN, mtu: int | NotGiven = NOT_GIVEN, ttl: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -168,7 +170,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelUpdateResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelUpdateResponse], ResultWrapper[GRETunnelUpdateResponse]), ) @@ -207,7 +209,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelListResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelListResponse], ResultWrapper[GRETunnelListResponse]), ) @@ -217,6 +219,7 @@ def delete( tunnel_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -248,12 +251,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}") return self._delete( f"/accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}", + body=maybe_transform(body, gre_tunnel_delete_params.GRETunnelDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelDeleteResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelDeleteResponse], ResultWrapper[GRETunnelDeleteResponse]), ) @@ -297,20 +301,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelGetResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelGetResponse], ResultWrapper[GRETunnelGetResponse]), ) -class AsyncGRETunnels(AsyncAPIResource): +class AsyncGRETunnelsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncGRETunnelsWithRawResponse: - return AsyncGRETunnelsWithRawResponse(self) + def with_raw_response(self) -> AsyncGRETunnelsResourceWithRawResponse: + return AsyncGRETunnelsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncGRETunnelsWithStreamingResponse: - return AsyncGRETunnelsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncGRETunnelsResourceWithStreamingResponse: + return AsyncGRETunnelsResourceWithStreamingResponse(self) async def create( self, @@ -350,7 +354,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelCreateResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelCreateResponse], ResultWrapper[GRETunnelCreateResponse]), ) @@ -365,7 +369,7 @@ async def update( interface_address: str, name: str, description: str | NotGiven = NOT_GIVEN, - health_check: gre_tunnel_update_params.HealthCheck | NotGiven = NOT_GIVEN, + health_check: HealthCheckParam | NotGiven = NOT_GIVEN, mtu: int | NotGiven = NOT_GIVEN, ttl: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -435,7 +439,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelUpdateResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelUpdateResponse], ResultWrapper[GRETunnelUpdateResponse]), ) @@ -474,7 +478,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelListResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelListResponse], ResultWrapper[GRETunnelListResponse]), ) @@ -484,6 +488,7 @@ async def delete( tunnel_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -515,12 +520,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}") return await self._delete( f"/accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}", + body=await async_maybe_transform(body, gre_tunnel_delete_params.GRETunnelDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelDeleteResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelDeleteResponse], ResultWrapper[GRETunnelDeleteResponse]), ) @@ -564,14 +570,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[GRETunnelGetResponse]._unwrapper, ), cast_to=cast(Type[GRETunnelGetResponse], ResultWrapper[GRETunnelGetResponse]), ) -class GRETunnelsWithRawResponse: - def __init__(self, gre_tunnels: GRETunnels) -> None: +class GRETunnelsResourceWithRawResponse: + def __init__(self, gre_tunnels: GRETunnelsResource) -> None: self._gre_tunnels = gre_tunnels self.create = to_raw_response_wrapper( @@ -591,8 +597,8 @@ def __init__(self, gre_tunnels: GRETunnels) -> None: ) -class AsyncGRETunnelsWithRawResponse: - def __init__(self, gre_tunnels: AsyncGRETunnels) -> None: +class AsyncGRETunnelsResourceWithRawResponse: + def __init__(self, gre_tunnels: AsyncGRETunnelsResource) -> None: self._gre_tunnels = gre_tunnels self.create = async_to_raw_response_wrapper( @@ -612,8 +618,8 @@ def __init__(self, gre_tunnels: AsyncGRETunnels) -> None: ) -class GRETunnelsWithStreamingResponse: - def __init__(self, gre_tunnels: GRETunnels) -> None: +class GRETunnelsResourceWithStreamingResponse: + def __init__(self, gre_tunnels: GRETunnelsResource) -> None: self._gre_tunnels = gre_tunnels self.create = to_streamed_response_wrapper( @@ -633,8 +639,8 @@ def __init__(self, gre_tunnels: GRETunnels) -> None: ) -class AsyncGRETunnelsWithStreamingResponse: - def __init__(self, gre_tunnels: AsyncGRETunnels) -> None: +class AsyncGRETunnelsResourceWithStreamingResponse: + def __init__(self, gre_tunnels: AsyncGRETunnelsResource) -> None: self._gre_tunnels = gre_tunnels self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/magic_transit/ipsec_tunnels.py b/src/cloudflare/resources/magic_transit/ipsec_tunnels.py index 55067d5e807..12c21e755d4 100644 --- a/src/cloudflare/resources/magic_transit/ipsec_tunnels.py +++ b/src/cloudflare/resources/magic_transit/ipsec_tunnels.py @@ -24,27 +24,30 @@ make_request_options, ) from ...types.magic_transit import ( - IPSECTunnelGetResponse, - IPSECTunnelListResponse, - IPSECTunnelCreateResponse, - IPSECTunnelDeleteResponse, - IPSECTunnelUpdateResponse, - IPSECTunnelPSKGenerateResponse, ipsec_tunnel_create_params, + ipsec_tunnel_delete_params, ipsec_tunnel_update_params, + ipsec_tunnel_psk_generate_params, ) +from ...types.magic_transit.health_check_param import HealthCheckParam +from ...types.magic_transit.ipsec_tunnel_get_response import IPSECTunnelGetResponse +from ...types.magic_transit.ipsec_tunnel_list_response import IPSECTunnelListResponse +from ...types.magic_transit.ipsec_tunnel_create_response import IPSECTunnelCreateResponse +from ...types.magic_transit.ipsec_tunnel_delete_response import IPSECTunnelDeleteResponse +from ...types.magic_transit.ipsec_tunnel_update_response import IPSECTunnelUpdateResponse +from ...types.magic_transit.ipsec_tunnel_psk_generate_response import IPSECTunnelPSKGenerateResponse -__all__ = ["IPSECTunnels", "AsyncIPSECTunnels"] +__all__ = ["IPSECTunnelsResource", "AsyncIPSECTunnelsResource"] -class IPSECTunnels(SyncAPIResource): +class IPSECTunnelsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPSECTunnelsWithRawResponse: - return IPSECTunnelsWithRawResponse(self) + def with_raw_response(self) -> IPSECTunnelsResourceWithRawResponse: + return IPSECTunnelsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPSECTunnelsWithStreamingResponse: - return IPSECTunnelsWithStreamingResponse(self) + def with_streaming_response(self) -> IPSECTunnelsResourceWithStreamingResponse: + return IPSECTunnelsResourceWithStreamingResponse(self) def create( self, @@ -55,7 +58,7 @@ def create( name: str, customer_endpoint: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - health_check: ipsec_tunnel_create_params.HealthCheck | NotGiven = NOT_GIVEN, + health_check: HealthCheckParam | NotGiven = NOT_GIVEN, psk: str | NotGiven = NOT_GIVEN, replay_protection: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -82,7 +85,8 @@ def create( name: The name of the IPsec tunnel. The name cannot share a name with other tunnels. - customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. + customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. Not required, + but must be set for proactive traceroutes to work. description: An optional description forthe IPsec tunnel. @@ -121,7 +125,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelCreateResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelCreateResponse], ResultWrapper[IPSECTunnelCreateResponse]), ) @@ -136,7 +140,7 @@ def update( name: str, customer_endpoint: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - health_check: ipsec_tunnel_update_params.HealthCheck | NotGiven = NOT_GIVEN, + health_check: HealthCheckParam | NotGiven = NOT_GIVEN, psk: str | NotGiven = NOT_GIVEN, replay_protection: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -165,7 +169,8 @@ def update( name: The name of the IPsec tunnel. The name cannot share a name with other tunnels. - customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. + customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. Not required, + but must be set for proactive traceroutes to work. description: An optional description forthe IPsec tunnel. @@ -206,7 +211,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelUpdateResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelUpdateResponse], ResultWrapper[IPSECTunnelUpdateResponse]), ) @@ -245,7 +250,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelListResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelListResponse], ResultWrapper[IPSECTunnelListResponse]), ) @@ -255,6 +260,7 @@ def delete( tunnel_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -286,12 +292,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}") return self._delete( f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}", + body=maybe_transform(body, ipsec_tunnel_delete_params.IPSECTunnelDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelDeleteResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelDeleteResponse], ResultWrapper[IPSECTunnelDeleteResponse]), ) @@ -335,7 +342,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelGetResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelGetResponse], ResultWrapper[IPSECTunnelGetResponse]), ) @@ -345,6 +352,7 @@ def psk_generate( tunnel_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -378,25 +386,26 @@ def psk_generate( raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}") return self._post( f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}/psk_generate", + body=maybe_transform(body, ipsec_tunnel_psk_generate_params.IPSECTunnelPSKGenerateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelPSKGenerateResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelPSKGenerateResponse], ResultWrapper[IPSECTunnelPSKGenerateResponse]), ) -class AsyncIPSECTunnels(AsyncAPIResource): +class AsyncIPSECTunnelsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPSECTunnelsWithRawResponse: - return AsyncIPSECTunnelsWithRawResponse(self) + def with_raw_response(self) -> AsyncIPSECTunnelsResourceWithRawResponse: + return AsyncIPSECTunnelsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPSECTunnelsWithStreamingResponse: - return AsyncIPSECTunnelsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPSECTunnelsResourceWithStreamingResponse: + return AsyncIPSECTunnelsResourceWithStreamingResponse(self) async def create( self, @@ -407,7 +416,7 @@ async def create( name: str, customer_endpoint: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - health_check: ipsec_tunnel_create_params.HealthCheck | NotGiven = NOT_GIVEN, + health_check: HealthCheckParam | NotGiven = NOT_GIVEN, psk: str | NotGiven = NOT_GIVEN, replay_protection: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -434,7 +443,8 @@ async def create( name: The name of the IPsec tunnel. The name cannot share a name with other tunnels. - customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. + customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. Not required, + but must be set for proactive traceroutes to work. description: An optional description forthe IPsec tunnel. @@ -473,7 +483,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelCreateResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelCreateResponse], ResultWrapper[IPSECTunnelCreateResponse]), ) @@ -488,7 +498,7 @@ async def update( name: str, customer_endpoint: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - health_check: ipsec_tunnel_update_params.HealthCheck | NotGiven = NOT_GIVEN, + health_check: HealthCheckParam | NotGiven = NOT_GIVEN, psk: str | NotGiven = NOT_GIVEN, replay_protection: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -517,7 +527,8 @@ async def update( name: The name of the IPsec tunnel. The name cannot share a name with other tunnels. - customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. + customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. Not required, + but must be set for proactive traceroutes to work. description: An optional description forthe IPsec tunnel. @@ -558,7 +569,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelUpdateResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelUpdateResponse], ResultWrapper[IPSECTunnelUpdateResponse]), ) @@ -597,7 +608,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelListResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelListResponse], ResultWrapper[IPSECTunnelListResponse]), ) @@ -607,6 +618,7 @@ async def delete( tunnel_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -638,12 +650,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}") return await self._delete( f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}", + body=await async_maybe_transform(body, ipsec_tunnel_delete_params.IPSECTunnelDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelDeleteResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelDeleteResponse], ResultWrapper[IPSECTunnelDeleteResponse]), ) @@ -687,7 +700,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelGetResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelGetResponse], ResultWrapper[IPSECTunnelGetResponse]), ) @@ -697,6 +710,7 @@ async def psk_generate( tunnel_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -730,19 +744,20 @@ async def psk_generate( raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}") return await self._post( f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}/psk_generate", + body=await async_maybe_transform(body, ipsec_tunnel_psk_generate_params.IPSECTunnelPSKGenerateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPSECTunnelPSKGenerateResponse]._unwrapper, ), cast_to=cast(Type[IPSECTunnelPSKGenerateResponse], ResultWrapper[IPSECTunnelPSKGenerateResponse]), ) -class IPSECTunnelsWithRawResponse: - def __init__(self, ipsec_tunnels: IPSECTunnels) -> None: +class IPSECTunnelsResourceWithRawResponse: + def __init__(self, ipsec_tunnels: IPSECTunnelsResource) -> None: self._ipsec_tunnels = ipsec_tunnels self.create = to_raw_response_wrapper( @@ -765,8 +780,8 @@ def __init__(self, ipsec_tunnels: IPSECTunnels) -> None: ) -class AsyncIPSECTunnelsWithRawResponse: - def __init__(self, ipsec_tunnels: AsyncIPSECTunnels) -> None: +class AsyncIPSECTunnelsResourceWithRawResponse: + def __init__(self, ipsec_tunnels: AsyncIPSECTunnelsResource) -> None: self._ipsec_tunnels = ipsec_tunnels self.create = async_to_raw_response_wrapper( @@ -789,8 +804,8 @@ def __init__(self, ipsec_tunnels: AsyncIPSECTunnels) -> None: ) -class IPSECTunnelsWithStreamingResponse: - def __init__(self, ipsec_tunnels: IPSECTunnels) -> None: +class IPSECTunnelsResourceWithStreamingResponse: + def __init__(self, ipsec_tunnels: IPSECTunnelsResource) -> None: self._ipsec_tunnels = ipsec_tunnels self.create = to_streamed_response_wrapper( @@ -813,8 +828,8 @@ def __init__(self, ipsec_tunnels: IPSECTunnels) -> None: ) -class AsyncIPSECTunnelsWithStreamingResponse: - def __init__(self, ipsec_tunnels: AsyncIPSECTunnels) -> None: +class AsyncIPSECTunnelsResourceWithStreamingResponse: + def __init__(self, ipsec_tunnels: AsyncIPSECTunnelsResource) -> None: self._ipsec_tunnels = ipsec_tunnels self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/magic_transit/magic_transit.py b/src/cloudflare/resources/magic_transit/magic_transit.py index 5c6ad22503a..1cce72b3cfa 100644 --- a/src/cloudflare/resources/magic_transit/magic_transit.py +++ b/src/cloudflare/resources/magic_transit/magic_transit.py @@ -3,207 +3,207 @@ from __future__ import annotations from .sites import ( - Sites, - AsyncSites, - SitesWithRawResponse, - AsyncSitesWithRawResponse, - SitesWithStreamingResponse, - AsyncSitesWithStreamingResponse, + SitesResource, + AsyncSitesResource, + SitesResourceWithRawResponse, + AsyncSitesResourceWithRawResponse, + SitesResourceWithStreamingResponse, + AsyncSitesResourceWithStreamingResponse, ) from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from .gre_tunnels import ( - GRETunnels, - AsyncGRETunnels, - GRETunnelsWithRawResponse, - AsyncGRETunnelsWithRawResponse, - GRETunnelsWithStreamingResponse, - AsyncGRETunnelsWithStreamingResponse, + GRETunnelsResource, + AsyncGRETunnelsResource, + GRETunnelsResourceWithRawResponse, + AsyncGRETunnelsResourceWithRawResponse, + GRETunnelsResourceWithStreamingResponse, + AsyncGRETunnelsResourceWithStreamingResponse, ) -from .sites.sites import Sites, AsyncSites +from .sites.sites import SitesResource, AsyncSitesResource from .ipsec_tunnels import ( - IPSECTunnels, - AsyncIPSECTunnels, - IPSECTunnelsWithRawResponse, - AsyncIPSECTunnelsWithRawResponse, - IPSECTunnelsWithStreamingResponse, - AsyncIPSECTunnelsWithStreamingResponse, + IPSECTunnelsResource, + AsyncIPSECTunnelsResource, + IPSECTunnelsResourceWithRawResponse, + AsyncIPSECTunnelsResourceWithRawResponse, + IPSECTunnelsResourceWithStreamingResponse, + AsyncIPSECTunnelsResourceWithStreamingResponse, ) from .cf_interconnects import ( - CfInterconnects, - AsyncCfInterconnects, - CfInterconnectsWithRawResponse, - AsyncCfInterconnectsWithRawResponse, - CfInterconnectsWithStreamingResponse, - AsyncCfInterconnectsWithStreamingResponse, + CfInterconnectsResource, + AsyncCfInterconnectsResource, + CfInterconnectsResourceWithRawResponse, + AsyncCfInterconnectsResourceWithRawResponse, + CfInterconnectsResourceWithStreamingResponse, + AsyncCfInterconnectsResourceWithStreamingResponse, ) -__all__ = ["MagicTransit", "AsyncMagicTransit"] +__all__ = ["MagicTransitResource", "AsyncMagicTransitResource"] -class MagicTransit(SyncAPIResource): +class MagicTransitResource(SyncAPIResource): @cached_property - def cf_interconnects(self) -> CfInterconnects: - return CfInterconnects(self._client) + def cf_interconnects(self) -> CfInterconnectsResource: + return CfInterconnectsResource(self._client) @cached_property - def gre_tunnels(self) -> GRETunnels: - return GRETunnels(self._client) + def gre_tunnels(self) -> GRETunnelsResource: + return GRETunnelsResource(self._client) @cached_property - def ipsec_tunnels(self) -> IPSECTunnels: - return IPSECTunnels(self._client) + def ipsec_tunnels(self) -> IPSECTunnelsResource: + return IPSECTunnelsResource(self._client) @cached_property - def routes(self) -> Routes: - return Routes(self._client) + def routes(self) -> RoutesResource: + return RoutesResource(self._client) @cached_property - def sites(self) -> Sites: - return Sites(self._client) + def sites(self) -> SitesResource: + return SitesResource(self._client) @cached_property - def with_raw_response(self) -> MagicTransitWithRawResponse: - return MagicTransitWithRawResponse(self) + def with_raw_response(self) -> MagicTransitResourceWithRawResponse: + return MagicTransitResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MagicTransitWithStreamingResponse: - return MagicTransitWithStreamingResponse(self) + def with_streaming_response(self) -> MagicTransitResourceWithStreamingResponse: + return MagicTransitResourceWithStreamingResponse(self) -class AsyncMagicTransit(AsyncAPIResource): +class AsyncMagicTransitResource(AsyncAPIResource): @cached_property - def cf_interconnects(self) -> AsyncCfInterconnects: - return AsyncCfInterconnects(self._client) + def cf_interconnects(self) -> AsyncCfInterconnectsResource: + return AsyncCfInterconnectsResource(self._client) @cached_property - def gre_tunnels(self) -> AsyncGRETunnels: - return AsyncGRETunnels(self._client) + def gre_tunnels(self) -> AsyncGRETunnelsResource: + return AsyncGRETunnelsResource(self._client) @cached_property - def ipsec_tunnels(self) -> AsyncIPSECTunnels: - return AsyncIPSECTunnels(self._client) + def ipsec_tunnels(self) -> AsyncIPSECTunnelsResource: + return AsyncIPSECTunnelsResource(self._client) @cached_property - def routes(self) -> AsyncRoutes: - return AsyncRoutes(self._client) + def routes(self) -> AsyncRoutesResource: + return AsyncRoutesResource(self._client) @cached_property - def sites(self) -> AsyncSites: - return AsyncSites(self._client) + def sites(self) -> AsyncSitesResource: + return AsyncSitesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncMagicTransitWithRawResponse: - return AsyncMagicTransitWithRawResponse(self) + def with_raw_response(self) -> AsyncMagicTransitResourceWithRawResponse: + return AsyncMagicTransitResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMagicTransitWithStreamingResponse: - return AsyncMagicTransitWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMagicTransitResourceWithStreamingResponse: + return AsyncMagicTransitResourceWithStreamingResponse(self) -class MagicTransitWithRawResponse: - def __init__(self, magic_transit: MagicTransit) -> None: +class MagicTransitResourceWithRawResponse: + def __init__(self, magic_transit: MagicTransitResource) -> None: self._magic_transit = magic_transit @cached_property - def cf_interconnects(self) -> CfInterconnectsWithRawResponse: - return CfInterconnectsWithRawResponse(self._magic_transit.cf_interconnects) + def cf_interconnects(self) -> CfInterconnectsResourceWithRawResponse: + return CfInterconnectsResourceWithRawResponse(self._magic_transit.cf_interconnects) @cached_property - def gre_tunnels(self) -> GRETunnelsWithRawResponse: - return GRETunnelsWithRawResponse(self._magic_transit.gre_tunnels) + def gre_tunnels(self) -> GRETunnelsResourceWithRawResponse: + return GRETunnelsResourceWithRawResponse(self._magic_transit.gre_tunnels) @cached_property - def ipsec_tunnels(self) -> IPSECTunnelsWithRawResponse: - return IPSECTunnelsWithRawResponse(self._magic_transit.ipsec_tunnels) + def ipsec_tunnels(self) -> IPSECTunnelsResourceWithRawResponse: + return IPSECTunnelsResourceWithRawResponse(self._magic_transit.ipsec_tunnels) @cached_property - def routes(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self._magic_transit.routes) + def routes(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self._magic_transit.routes) @cached_property - def sites(self) -> SitesWithRawResponse: - return SitesWithRawResponse(self._magic_transit.sites) + def sites(self) -> SitesResourceWithRawResponse: + return SitesResourceWithRawResponse(self._magic_transit.sites) -class AsyncMagicTransitWithRawResponse: - def __init__(self, magic_transit: AsyncMagicTransit) -> None: +class AsyncMagicTransitResourceWithRawResponse: + def __init__(self, magic_transit: AsyncMagicTransitResource) -> None: self._magic_transit = magic_transit @cached_property - def cf_interconnects(self) -> AsyncCfInterconnectsWithRawResponse: - return AsyncCfInterconnectsWithRawResponse(self._magic_transit.cf_interconnects) + def cf_interconnects(self) -> AsyncCfInterconnectsResourceWithRawResponse: + return AsyncCfInterconnectsResourceWithRawResponse(self._magic_transit.cf_interconnects) @cached_property - def gre_tunnels(self) -> AsyncGRETunnelsWithRawResponse: - return AsyncGRETunnelsWithRawResponse(self._magic_transit.gre_tunnels) + def gre_tunnels(self) -> AsyncGRETunnelsResourceWithRawResponse: + return AsyncGRETunnelsResourceWithRawResponse(self._magic_transit.gre_tunnels) @cached_property - def ipsec_tunnels(self) -> AsyncIPSECTunnelsWithRawResponse: - return AsyncIPSECTunnelsWithRawResponse(self._magic_transit.ipsec_tunnels) + def ipsec_tunnels(self) -> AsyncIPSECTunnelsResourceWithRawResponse: + return AsyncIPSECTunnelsResourceWithRawResponse(self._magic_transit.ipsec_tunnels) @cached_property - def routes(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self._magic_transit.routes) + def routes(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self._magic_transit.routes) @cached_property - def sites(self) -> AsyncSitesWithRawResponse: - return AsyncSitesWithRawResponse(self._magic_transit.sites) + def sites(self) -> AsyncSitesResourceWithRawResponse: + return AsyncSitesResourceWithRawResponse(self._magic_transit.sites) -class MagicTransitWithStreamingResponse: - def __init__(self, magic_transit: MagicTransit) -> None: +class MagicTransitResourceWithStreamingResponse: + def __init__(self, magic_transit: MagicTransitResource) -> None: self._magic_transit = magic_transit @cached_property - def cf_interconnects(self) -> CfInterconnectsWithStreamingResponse: - return CfInterconnectsWithStreamingResponse(self._magic_transit.cf_interconnects) + def cf_interconnects(self) -> CfInterconnectsResourceWithStreamingResponse: + return CfInterconnectsResourceWithStreamingResponse(self._magic_transit.cf_interconnects) @cached_property - def gre_tunnels(self) -> GRETunnelsWithStreamingResponse: - return GRETunnelsWithStreamingResponse(self._magic_transit.gre_tunnels) + def gre_tunnels(self) -> GRETunnelsResourceWithStreamingResponse: + return GRETunnelsResourceWithStreamingResponse(self._magic_transit.gre_tunnels) @cached_property - def ipsec_tunnels(self) -> IPSECTunnelsWithStreamingResponse: - return IPSECTunnelsWithStreamingResponse(self._magic_transit.ipsec_tunnels) + def ipsec_tunnels(self) -> IPSECTunnelsResourceWithStreamingResponse: + return IPSECTunnelsResourceWithStreamingResponse(self._magic_transit.ipsec_tunnels) @cached_property - def routes(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(self._magic_transit.routes) + def routes(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self._magic_transit.routes) @cached_property - def sites(self) -> SitesWithStreamingResponse: - return SitesWithStreamingResponse(self._magic_transit.sites) + def sites(self) -> SitesResourceWithStreamingResponse: + return SitesResourceWithStreamingResponse(self._magic_transit.sites) -class AsyncMagicTransitWithStreamingResponse: - def __init__(self, magic_transit: AsyncMagicTransit) -> None: +class AsyncMagicTransitResourceWithStreamingResponse: + def __init__(self, magic_transit: AsyncMagicTransitResource) -> None: self._magic_transit = magic_transit @cached_property - def cf_interconnects(self) -> AsyncCfInterconnectsWithStreamingResponse: - return AsyncCfInterconnectsWithStreamingResponse(self._magic_transit.cf_interconnects) + def cf_interconnects(self) -> AsyncCfInterconnectsResourceWithStreamingResponse: + return AsyncCfInterconnectsResourceWithStreamingResponse(self._magic_transit.cf_interconnects) @cached_property - def gre_tunnels(self) -> AsyncGRETunnelsWithStreamingResponse: - return AsyncGRETunnelsWithStreamingResponse(self._magic_transit.gre_tunnels) + def gre_tunnels(self) -> AsyncGRETunnelsResourceWithStreamingResponse: + return AsyncGRETunnelsResourceWithStreamingResponse(self._magic_transit.gre_tunnels) @cached_property - def ipsec_tunnels(self) -> AsyncIPSECTunnelsWithStreamingResponse: - return AsyncIPSECTunnelsWithStreamingResponse(self._magic_transit.ipsec_tunnels) + def ipsec_tunnels(self) -> AsyncIPSECTunnelsResourceWithStreamingResponse: + return AsyncIPSECTunnelsResourceWithStreamingResponse(self._magic_transit.ipsec_tunnels) @cached_property - def routes(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(self._magic_transit.routes) + def routes(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self._magic_transit.routes) @cached_property - def sites(self) -> AsyncSitesWithStreamingResponse: - return AsyncSitesWithStreamingResponse(self._magic_transit.sites) + def sites(self) -> AsyncSitesResourceWithStreamingResponse: + return AsyncSitesResourceWithStreamingResponse(self._magic_transit.sites) diff --git a/src/cloudflare/resources/magic_transit/routes.py b/src/cloudflare/resources/magic_transit/routes.py index 1572a6623fa..31cc36c643d 100644 --- a/src/cloudflare/resources/magic_transit/routes.py +++ b/src/cloudflare/resources/magic_transit/routes.py @@ -24,28 +24,30 @@ make_request_options, ) from ...types.magic_transit import ( - RouteGetResponse, - RouteListResponse, - RouteEmptyResponse, - RouteCreateResponse, - RouteDeleteResponse, - RouteUpdateResponse, route_empty_params, route_create_params, + route_delete_params, route_update_params, ) +from ...types.magic_transit.scope_param import ScopeParam +from ...types.magic_transit.route_get_response import RouteGetResponse +from ...types.magic_transit.route_list_response import RouteListResponse +from ...types.magic_transit.route_empty_response import RouteEmptyResponse +from ...types.magic_transit.route_create_response import RouteCreateResponse +from ...types.magic_transit.route_delete_response import RouteDeleteResponse +from ...types.magic_transit.route_update_response import RouteUpdateResponse -__all__ = ["Routes", "AsyncRoutes"] +__all__ = ["RoutesResource", "AsyncRoutesResource"] -class Routes(SyncAPIResource): +class RoutesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self) + def with_raw_response(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(self) + def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self) def create( self, @@ -85,7 +87,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteCreateResponse]._unwrapper, ), cast_to=cast(Type[RouteCreateResponse], ResultWrapper[RouteCreateResponse]), ) @@ -99,7 +101,7 @@ def update( prefix: str, priority: int, description: str | NotGiven = NOT_GIVEN, - scope: route_update_params.Scope | NotGiven = NOT_GIVEN, + scope: ScopeParam | NotGiven = NOT_GIVEN, weight: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -160,7 +162,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteUpdateResponse]._unwrapper, ), cast_to=cast(Type[RouteUpdateResponse], ResultWrapper[RouteUpdateResponse]), ) @@ -199,7 +201,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteListResponse]._unwrapper, ), cast_to=cast(Type[RouteListResponse], ResultWrapper[RouteListResponse]), ) @@ -209,6 +211,7 @@ def delete( route_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -238,12 +241,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `route_identifier` but received {route_identifier!r}") return self._delete( f"/accounts/{account_id}/magic/routes/{route_identifier}", + body=maybe_transform(body, route_delete_params.RouteDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteDeleteResponse]._unwrapper, ), cast_to=cast(Type[RouteDeleteResponse], ResultWrapper[RouteDeleteResponse]), ) @@ -284,7 +288,7 @@ def empty( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteEmptyResponse]._unwrapper, ), cast_to=cast(Type[RouteEmptyResponse], ResultWrapper[RouteEmptyResponse]), ) @@ -328,20 +332,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteGetResponse]._unwrapper, ), cast_to=cast(Type[RouteGetResponse], ResultWrapper[RouteGetResponse]), ) -class AsyncRoutes(AsyncAPIResource): +class AsyncRoutesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self) + def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self) async def create( self, @@ -381,7 +385,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteCreateResponse]._unwrapper, ), cast_to=cast(Type[RouteCreateResponse], ResultWrapper[RouteCreateResponse]), ) @@ -395,7 +399,7 @@ async def update( prefix: str, priority: int, description: str | NotGiven = NOT_GIVEN, - scope: route_update_params.Scope | NotGiven = NOT_GIVEN, + scope: ScopeParam | NotGiven = NOT_GIVEN, weight: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -456,7 +460,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteUpdateResponse]._unwrapper, ), cast_to=cast(Type[RouteUpdateResponse], ResultWrapper[RouteUpdateResponse]), ) @@ -495,7 +499,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteListResponse]._unwrapper, ), cast_to=cast(Type[RouteListResponse], ResultWrapper[RouteListResponse]), ) @@ -505,6 +509,7 @@ async def delete( route_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -534,12 +539,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `route_identifier` but received {route_identifier!r}") return await self._delete( f"/accounts/{account_id}/magic/routes/{route_identifier}", + body=await async_maybe_transform(body, route_delete_params.RouteDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteDeleteResponse]._unwrapper, ), cast_to=cast(Type[RouteDeleteResponse], ResultWrapper[RouteDeleteResponse]), ) @@ -580,7 +586,7 @@ async def empty( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteEmptyResponse]._unwrapper, ), cast_to=cast(Type[RouteEmptyResponse], ResultWrapper[RouteEmptyResponse]), ) @@ -624,14 +630,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteGetResponse]._unwrapper, ), cast_to=cast(Type[RouteGetResponse], ResultWrapper[RouteGetResponse]), ) -class RoutesWithRawResponse: - def __init__(self, routes: Routes) -> None: +class RoutesResourceWithRawResponse: + def __init__(self, routes: RoutesResource) -> None: self._routes = routes self.create = to_raw_response_wrapper( @@ -654,8 +660,8 @@ def __init__(self, routes: Routes) -> None: ) -class AsyncRoutesWithRawResponse: - def __init__(self, routes: AsyncRoutes) -> None: +class AsyncRoutesResourceWithRawResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: self._routes = routes self.create = async_to_raw_response_wrapper( @@ -678,8 +684,8 @@ def __init__(self, routes: AsyncRoutes) -> None: ) -class RoutesWithStreamingResponse: - def __init__(self, routes: Routes) -> None: +class RoutesResourceWithStreamingResponse: + def __init__(self, routes: RoutesResource) -> None: self._routes = routes self.create = to_streamed_response_wrapper( @@ -702,8 +708,8 @@ def __init__(self, routes: Routes) -> None: ) -class AsyncRoutesWithStreamingResponse: - def __init__(self, routes: AsyncRoutes) -> None: +class AsyncRoutesResourceWithStreamingResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: self._routes = routes self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/magic_transit/sites/__init__.py b/src/cloudflare/resources/magic_transit/sites/__init__.py index 87b77022b76..8a2a07f48db 100644 --- a/src/cloudflare/resources/magic_transit/sites/__init__.py +++ b/src/cloudflare/resources/magic_transit/sites/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .acls import ( - ACLs, - AsyncACLs, - ACLsWithRawResponse, - AsyncACLsWithRawResponse, - ACLsWithStreamingResponse, - AsyncACLsWithStreamingResponse, + ACLsResource, + AsyncACLsResource, + ACLsResourceWithRawResponse, + AsyncACLsResourceWithRawResponse, + ACLsResourceWithStreamingResponse, + AsyncACLsResourceWithStreamingResponse, ) from .lans import ( - LANs, - AsyncLANs, - LANsWithRawResponse, - AsyncLANsWithRawResponse, - LANsWithStreamingResponse, - AsyncLANsWithStreamingResponse, + LANsResource, + AsyncLANsResource, + LANsResourceWithRawResponse, + AsyncLANsResourceWithRawResponse, + LANsResourceWithStreamingResponse, + AsyncLANsResourceWithStreamingResponse, ) from .wans import ( - WANs, - AsyncWANs, - WANsWithRawResponse, - AsyncWANsWithRawResponse, - WANsWithStreamingResponse, - AsyncWANsWithStreamingResponse, + WANsResource, + AsyncWANsResource, + WANsResourceWithRawResponse, + AsyncWANsResourceWithRawResponse, + WANsResourceWithStreamingResponse, + AsyncWANsResourceWithStreamingResponse, ) from .sites import ( - Sites, - AsyncSites, - SitesWithRawResponse, - AsyncSitesWithRawResponse, - SitesWithStreamingResponse, - AsyncSitesWithStreamingResponse, + SitesResource, + AsyncSitesResource, + SitesResourceWithRawResponse, + AsyncSitesResourceWithRawResponse, + SitesResourceWithStreamingResponse, + AsyncSitesResourceWithStreamingResponse, ) __all__ = [ - "ACLs", - "AsyncACLs", - "ACLsWithRawResponse", - "AsyncACLsWithRawResponse", - "ACLsWithStreamingResponse", - "AsyncACLsWithStreamingResponse", - "LANs", - "AsyncLANs", - "LANsWithRawResponse", - "AsyncLANsWithRawResponse", - "LANsWithStreamingResponse", - "AsyncLANsWithStreamingResponse", - "WANs", - "AsyncWANs", - "WANsWithRawResponse", - "AsyncWANsWithRawResponse", - "WANsWithStreamingResponse", - "AsyncWANsWithStreamingResponse", - "Sites", - "AsyncSites", - "SitesWithRawResponse", - "AsyncSitesWithRawResponse", - "SitesWithStreamingResponse", - "AsyncSitesWithStreamingResponse", + "ACLsResource", + "AsyncACLsResource", + "ACLsResourceWithRawResponse", + "AsyncACLsResourceWithRawResponse", + "ACLsResourceWithStreamingResponse", + "AsyncACLsResourceWithStreamingResponse", + "LANsResource", + "AsyncLANsResource", + "LANsResourceWithRawResponse", + "AsyncLANsResourceWithRawResponse", + "LANsResourceWithStreamingResponse", + "AsyncLANsResourceWithStreamingResponse", + "WANsResource", + "AsyncWANsResource", + "WANsResourceWithRawResponse", + "AsyncWANsResourceWithRawResponse", + "WANsResourceWithStreamingResponse", + "AsyncWANsResourceWithStreamingResponse", + "SitesResource", + "AsyncSitesResource", + "SitesResourceWithRawResponse", + "AsyncSitesResourceWithRawResponse", + "SitesResourceWithStreamingResponse", + "AsyncSitesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/magic_transit/sites/acls.py b/src/cloudflare/resources/magic_transit/sites/acls.py index 6d9f85883c8..a58dd7a33db 100644 --- a/src/cloudflare/resources/magic_transit/sites/acls.py +++ b/src/cloudflare/resources/magic_transit/sites/acls.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import List, Type, cast import httpx @@ -20,44 +20,46 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.magic_transit.sites import ( - ACLGetResponse, - ACLListResponse, - ACLCreateResponse, - ACLDeleteResponse, - ACLUpdateResponse, - acl_create_params, - acl_update_params, -) +from ....types.magic_transit.sites import acl_create_params, acl_delete_params, acl_update_params +from ....types.magic_transit.sites.acl import ACL +from ....types.magic_transit.sites.allowed_protocol import AllowedProtocol +from ....types.magic_transit.sites.acl_configuration_param import ACLConfigurationParam -__all__ = ["ACLs", "AsyncACLs"] +__all__ = ["ACLsResource", "AsyncACLsResource"] -class ACLs(SyncAPIResource): +class ACLsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ACLsWithRawResponse: - return ACLsWithRawResponse(self) + def with_raw_response(self) -> ACLsResourceWithRawResponse: + return ACLsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ACLsWithStreamingResponse: - return ACLsWithStreamingResponse(self) + def with_streaming_response(self) -> ACLsResourceWithStreamingResponse: + return ACLsResourceWithStreamingResponse(self) def create( self, site_id: str, *, account_id: str, - acl: acl_create_params.ACL | NotGiven = NOT_GIVEN, + lan_1: ACLConfigurationParam, + lan_2: ACLConfigurationParam, + name: str, + description: str | NotGiven = NOT_GIVEN, + forward_locally: bool | NotGiven = NOT_GIVEN, + protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLCreateResponse: + ) -> ACL: """ Creates a new Site ACL. @@ -66,6 +68,15 @@ def create( site_id: Identifier + name: The name of the ACL. + + description: Description for the ACL. + + forward_locally: The desired forwarding action for this ACL policy. If set to "false", the policy + will forward traffic to Cloudflare. If set to "true", the policy will forward + traffic locally on the Magic WAN Connector. If not included in request, will + default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -80,15 +91,25 @@ def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._post( f"/accounts/{account_id}/magic/sites/{site_id}/acls", - body=maybe_transform({"acl": acl}, acl_create_params.ACLCreateParams), + body=maybe_transform( + { + "lan_1": lan_1, + "lan_2": lan_2, + "name": name, + "description": description, + "forward_locally": forward_locally, + "protocols": protocols, + }, + acl_create_params.ACLCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLCreateResponse], ResultWrapper[ACLCreateResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) def update( @@ -97,14 +118,19 @@ def update( *, account_id: str, site_id: str, - acl: acl_update_params.ACL | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + forward_locally: bool | NotGiven = NOT_GIVEN, + lan_1: ACLConfigurationParam | NotGiven = NOT_GIVEN, + lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLUpdateResponse: + ) -> ACL: """ Update a specific Site ACL. @@ -115,6 +141,15 @@ def update( acl_identifier: Identifier + description: Description for the ACL. + + forward_locally: The desired forwarding action for this ACL policy. If set to "false", the policy + will forward traffic to Cloudflare. If set to "true", the policy will forward + traffic locally on the Magic WAN Connector. If not included in request, will + default to false. + + name: The name of the ACL. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -131,15 +166,25 @@ def update( raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}") return self._put( f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}", - body=maybe_transform({"acl": acl}, acl_update_params.ACLUpdateParams), + body=maybe_transform( + { + "description": description, + "forward_locally": forward_locally, + "lan_1": lan_1, + "lan_2": lan_2, + "name": name, + "protocols": protocols, + }, + acl_update_params.ACLUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLUpdateResponse], ResultWrapper[ACLUpdateResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) def list( @@ -153,7 +198,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLListResponse: + ) -> SyncSinglePage[ACL]: """ Lists Site ACLs associated with an account. @@ -174,16 +219,13 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not site_id: raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/acls", + page=SyncSinglePage[ACL], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ACLListResponse], ResultWrapper[ACLListResponse]), + model=ACL, ) def delete( @@ -192,13 +234,14 @@ def delete( *, account_id: str, site_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLDeleteResponse: + ) -> ACL: """ Remove a specific Site ACL. @@ -225,14 +268,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}") return self._delete( f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}", + body=maybe_transform(body, acl_delete_params.ACLDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLDeleteResponse], ResultWrapper[ACLDeleteResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) def get( @@ -247,7 +291,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLGetResponse: + ) -> ACL: """ Get a specific Site ACL. @@ -279,34 +323,39 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLGetResponse], ResultWrapper[ACLGetResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) -class AsyncACLs(AsyncAPIResource): +class AsyncACLsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncACLsWithRawResponse: - return AsyncACLsWithRawResponse(self) + def with_raw_response(self) -> AsyncACLsResourceWithRawResponse: + return AsyncACLsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncACLsWithStreamingResponse: - return AsyncACLsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncACLsResourceWithStreamingResponse: + return AsyncACLsResourceWithStreamingResponse(self) async def create( self, site_id: str, *, account_id: str, - acl: acl_create_params.ACL | NotGiven = NOT_GIVEN, + lan_1: ACLConfigurationParam, + lan_2: ACLConfigurationParam, + name: str, + description: str | NotGiven = NOT_GIVEN, + forward_locally: bool | NotGiven = NOT_GIVEN, + protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLCreateResponse: + ) -> ACL: """ Creates a new Site ACL. @@ -315,6 +364,15 @@ async def create( site_id: Identifier + name: The name of the ACL. + + description: Description for the ACL. + + forward_locally: The desired forwarding action for this ACL policy. If set to "false", the policy + will forward traffic to Cloudflare. If set to "true", the policy will forward + traffic locally on the Magic WAN Connector. If not included in request, will + default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -329,15 +387,25 @@ async def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._post( f"/accounts/{account_id}/magic/sites/{site_id}/acls", - body=await async_maybe_transform({"acl": acl}, acl_create_params.ACLCreateParams), + body=await async_maybe_transform( + { + "lan_1": lan_1, + "lan_2": lan_2, + "name": name, + "description": description, + "forward_locally": forward_locally, + "protocols": protocols, + }, + acl_create_params.ACLCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLCreateResponse], ResultWrapper[ACLCreateResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) async def update( @@ -346,14 +414,19 @@ async def update( *, account_id: str, site_id: str, - acl: acl_update_params.ACL | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + forward_locally: bool | NotGiven = NOT_GIVEN, + lan_1: ACLConfigurationParam | NotGiven = NOT_GIVEN, + lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLUpdateResponse: + ) -> ACL: """ Update a specific Site ACL. @@ -364,6 +437,15 @@ async def update( acl_identifier: Identifier + description: Description for the ACL. + + forward_locally: The desired forwarding action for this ACL policy. If set to "false", the policy + will forward traffic to Cloudflare. If set to "true", the policy will forward + traffic locally on the Magic WAN Connector. If not included in request, will + default to false. + + name: The name of the ACL. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -380,18 +462,28 @@ async def update( raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}") return await self._put( f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}", - body=await async_maybe_transform({"acl": acl}, acl_update_params.ACLUpdateParams), + body=await async_maybe_transform( + { + "description": description, + "forward_locally": forward_locally, + "lan_1": lan_1, + "lan_2": lan_2, + "name": name, + "protocols": protocols, + }, + acl_update_params.ACLUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLUpdateResponse], ResultWrapper[ACLUpdateResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) - async def list( + def list( self, site_id: str, *, @@ -402,7 +494,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLListResponse: + ) -> AsyncPaginator[ACL, AsyncSinglePage[ACL]]: """ Lists Site ACLs associated with an account. @@ -423,16 +515,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not site_id: raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/acls", + page=AsyncSinglePage[ACL], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ACLListResponse], ResultWrapper[ACLListResponse]), + model=ACL, ) async def delete( @@ -441,13 +530,14 @@ async def delete( *, account_id: str, site_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLDeleteResponse: + ) -> ACL: """ Remove a specific Site ACL. @@ -474,14 +564,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}") return await self._delete( f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}", + body=await async_maybe_transform(body, acl_delete_params.ACLDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLDeleteResponse], ResultWrapper[ACLDeleteResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) async def get( @@ -496,7 +587,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLGetResponse: + ) -> ACL: """ Get a specific Site ACL. @@ -528,14 +619,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLGetResponse], ResultWrapper[ACLGetResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) -class ACLsWithRawResponse: - def __init__(self, acls: ACLs) -> None: +class ACLsResourceWithRawResponse: + def __init__(self, acls: ACLsResource) -> None: self._acls = acls self.create = to_raw_response_wrapper( @@ -555,8 +646,8 @@ def __init__(self, acls: ACLs) -> None: ) -class AsyncACLsWithRawResponse: - def __init__(self, acls: AsyncACLs) -> None: +class AsyncACLsResourceWithRawResponse: + def __init__(self, acls: AsyncACLsResource) -> None: self._acls = acls self.create = async_to_raw_response_wrapper( @@ -576,8 +667,8 @@ def __init__(self, acls: AsyncACLs) -> None: ) -class ACLsWithStreamingResponse: - def __init__(self, acls: ACLs) -> None: +class ACLsResourceWithStreamingResponse: + def __init__(self, acls: ACLsResource) -> None: self._acls = acls self.create = to_streamed_response_wrapper( @@ -597,8 +688,8 @@ def __init__(self, acls: ACLs) -> None: ) -class AsyncACLsWithStreamingResponse: - def __init__(self, acls: AsyncACLs) -> None: +class AsyncACLsResourceWithStreamingResponse: + def __init__(self, acls: AsyncACLsResource) -> None: self._acls = acls self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/magic_transit/sites/lans.py b/src/cloudflare/resources/magic_transit/sites/lans.py index a3c299944c7..6eba19aed92 100644 --- a/src/cloudflare/resources/magic_transit/sites/lans.py +++ b/src/cloudflare/resources/magic_transit/sites/lans.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Iterable, cast import httpx @@ -20,37 +20,46 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.magic_transit.sites import ( - LANGetResponse, - LANListResponse, - LANCreateResponse, - LANDeleteResponse, - LANUpdateResponse, lan_create_params, + lan_delete_params, lan_update_params, ) +from ....types.magic_transit.sites.lan import LAN +from ....types.magic_transit.sites.nat_param import NatParam +from ....types.magic_transit.sites.lan_create_response import LANCreateResponse +from ....types.magic_transit.sites.routed_subnet_param import RoutedSubnetParam +from ....types.magic_transit.sites.lan_static_addressing_param import LANStaticAddressingParam -__all__ = ["LANs", "AsyncLANs"] +__all__ = ["LANsResource", "AsyncLANsResource"] -class LANs(SyncAPIResource): +class LANsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LANsWithRawResponse: - return LANsWithRawResponse(self) + def with_raw_response(self) -> LANsResourceWithRawResponse: + return LANsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LANsWithStreamingResponse: - return LANsWithStreamingResponse(self) + def with_streaming_response(self) -> LANsResourceWithStreamingResponse: + return LANsResourceWithStreamingResponse(self) def create( self, site_id: str, *, account_id: str, - lan: lan_create_params.LAN | NotGiven = NOT_GIVEN, + physport: int, + vlan_tag: int, + ha_link: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + nat: NatParam | NotGiven = NOT_GIVEN, + routed_subnets: Iterable[RoutedSubnetParam] | NotGiven = NOT_GIVEN, + static_addressing: LANStaticAddressingParam | 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, @@ -68,6 +77,15 @@ def create( site_id: Identifier + vlan_tag: VLAN port number. + + ha_link: mark true to use this LAN for HA probing. only works for site with HA turned on. + only one LAN can be set as the ha_link. + + static_addressing: If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -82,13 +100,24 @@ def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._post( f"/accounts/{account_id}/magic/sites/{site_id}/lans", - body=maybe_transform({"lan": lan}, lan_create_params.LANCreateParams), + body=maybe_transform( + { + "physport": physport, + "vlan_tag": vlan_tag, + "ha_link": ha_link, + "name": name, + "nat": nat, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + }, + lan_create_params.LANCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LANCreateResponse]._unwrapper, ), cast_to=cast(Type[LANCreateResponse], ResultWrapper[LANCreateResponse]), ) @@ -99,14 +128,19 @@ def update( *, account_id: str, site_id: str, - lan: lan_update_params.LAN | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + nat: NatParam | NotGiven = NOT_GIVEN, + physport: int | NotGiven = NOT_GIVEN, + routed_subnets: Iterable[RoutedSubnetParam] | NotGiven = NOT_GIVEN, + static_addressing: LANStaticAddressingParam | NotGiven = NOT_GIVEN, + vlan_tag: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANUpdateResponse: + ) -> LAN: """ Update a specific LAN. @@ -117,6 +151,12 @@ def update( lan_id: Identifier + static_addressing: If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + + vlan_tag: VLAN port number. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -133,15 +173,25 @@ def update( raise ValueError(f"Expected a non-empty value for `lan_id` but received {lan_id!r}") return self._put( f"/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}", - body=maybe_transform({"lan": lan}, lan_update_params.LANUpdateParams), + body=maybe_transform( + { + "name": name, + "nat": nat, + "physport": physport, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + lan_update_params.LANUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANUpdateResponse], ResultWrapper[LANUpdateResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) def list( @@ -155,7 +205,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANListResponse: + ) -> SyncSinglePage[LAN]: """ Lists LANs associated with an account and site. @@ -176,16 +226,13 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not site_id: raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/lans", + page=SyncSinglePage[LAN], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[LANListResponse], ResultWrapper[LANListResponse]), + model=LAN, ) def delete( @@ -194,13 +241,14 @@ def delete( *, account_id: str, site_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANDeleteResponse: + ) -> LAN: """ Remove a specific LAN. @@ -227,14 +275,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `lan_id` but received {lan_id!r}") return self._delete( f"/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}", + body=maybe_transform(body, lan_delete_params.LANDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANDeleteResponse], ResultWrapper[LANDeleteResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) def get( @@ -249,7 +298,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANGetResponse: + ) -> LAN: """ Get a specific LAN. @@ -281,27 +330,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANGetResponse], ResultWrapper[LANGetResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) -class AsyncLANs(AsyncAPIResource): +class AsyncLANsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLANsWithRawResponse: - return AsyncLANsWithRawResponse(self) + def with_raw_response(self) -> AsyncLANsResourceWithRawResponse: + return AsyncLANsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLANsWithStreamingResponse: - return AsyncLANsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLANsResourceWithStreamingResponse: + return AsyncLANsResourceWithStreamingResponse(self) async def create( self, site_id: str, *, account_id: str, - lan: lan_create_params.LAN | NotGiven = NOT_GIVEN, + physport: int, + vlan_tag: int, + ha_link: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + nat: NatParam | NotGiven = NOT_GIVEN, + routed_subnets: Iterable[RoutedSubnetParam] | NotGiven = NOT_GIVEN, + static_addressing: LANStaticAddressingParam | 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, @@ -319,6 +374,15 @@ async def create( site_id: Identifier + vlan_tag: VLAN port number. + + ha_link: mark true to use this LAN for HA probing. only works for site with HA turned on. + only one LAN can be set as the ha_link. + + static_addressing: If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -333,13 +397,24 @@ async def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._post( f"/accounts/{account_id}/magic/sites/{site_id}/lans", - body=await async_maybe_transform({"lan": lan}, lan_create_params.LANCreateParams), + body=await async_maybe_transform( + { + "physport": physport, + "vlan_tag": vlan_tag, + "ha_link": ha_link, + "name": name, + "nat": nat, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + }, + lan_create_params.LANCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LANCreateResponse]._unwrapper, ), cast_to=cast(Type[LANCreateResponse], ResultWrapper[LANCreateResponse]), ) @@ -350,14 +425,19 @@ async def update( *, account_id: str, site_id: str, - lan: lan_update_params.LAN | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + nat: NatParam | NotGiven = NOT_GIVEN, + physport: int | NotGiven = NOT_GIVEN, + routed_subnets: Iterable[RoutedSubnetParam] | NotGiven = NOT_GIVEN, + static_addressing: LANStaticAddressingParam | NotGiven = NOT_GIVEN, + vlan_tag: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANUpdateResponse: + ) -> LAN: """ Update a specific LAN. @@ -368,6 +448,12 @@ async def update( lan_id: Identifier + static_addressing: If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + + vlan_tag: VLAN port number. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -384,18 +470,28 @@ async def update( raise ValueError(f"Expected a non-empty value for `lan_id` but received {lan_id!r}") return await self._put( f"/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}", - body=await async_maybe_transform({"lan": lan}, lan_update_params.LANUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "nat": nat, + "physport": physport, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + lan_update_params.LANUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANUpdateResponse], ResultWrapper[LANUpdateResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) - async def list( + def list( self, site_id: str, *, @@ -406,7 +502,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANListResponse: + ) -> AsyncPaginator[LAN, AsyncSinglePage[LAN]]: """ Lists LANs associated with an account and site. @@ -427,16 +523,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not site_id: raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/lans", + page=AsyncSinglePage[LAN], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[LANListResponse], ResultWrapper[LANListResponse]), + model=LAN, ) async def delete( @@ -445,13 +538,14 @@ async def delete( *, account_id: str, site_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANDeleteResponse: + ) -> LAN: """ Remove a specific LAN. @@ -478,14 +572,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `lan_id` but received {lan_id!r}") return await self._delete( f"/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}", + body=await async_maybe_transform(body, lan_delete_params.LANDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANDeleteResponse], ResultWrapper[LANDeleteResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) async def get( @@ -500,7 +595,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANGetResponse: + ) -> LAN: """ Get a specific LAN. @@ -532,14 +627,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANGetResponse], ResultWrapper[LANGetResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) -class LANsWithRawResponse: - def __init__(self, lans: LANs) -> None: +class LANsResourceWithRawResponse: + def __init__(self, lans: LANsResource) -> None: self._lans = lans self.create = to_raw_response_wrapper( @@ -559,8 +654,8 @@ def __init__(self, lans: LANs) -> None: ) -class AsyncLANsWithRawResponse: - def __init__(self, lans: AsyncLANs) -> None: +class AsyncLANsResourceWithRawResponse: + def __init__(self, lans: AsyncLANsResource) -> None: self._lans = lans self.create = async_to_raw_response_wrapper( @@ -580,8 +675,8 @@ def __init__(self, lans: AsyncLANs) -> None: ) -class LANsWithStreamingResponse: - def __init__(self, lans: LANs) -> None: +class LANsResourceWithStreamingResponse: + def __init__(self, lans: LANsResource) -> None: self._lans = lans self.create = to_streamed_response_wrapper( @@ -601,8 +696,8 @@ def __init__(self, lans: LANs) -> None: ) -class AsyncLANsWithStreamingResponse: - def __init__(self, lans: AsyncLANs) -> None: +class AsyncLANsResourceWithStreamingResponse: + def __init__(self, lans: AsyncLANsResource) -> None: self._lans = lans self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/magic_transit/sites/sites.py b/src/cloudflare/resources/magic_transit/sites/sites.py index dd936c7b8da..fdb6388000c 100644 --- a/src/cloudflare/resources/magic_transit/sites/sites.py +++ b/src/cloudflare/resources/magic_transit/sites/sites.py @@ -7,28 +7,28 @@ import httpx from .acls import ( - ACLs, - AsyncACLs, - ACLsWithRawResponse, - AsyncACLsWithRawResponse, - ACLsWithStreamingResponse, - AsyncACLsWithStreamingResponse, + ACLsResource, + AsyncACLsResource, + ACLsResourceWithRawResponse, + AsyncACLsResourceWithRawResponse, + ACLsResourceWithStreamingResponse, + AsyncACLsResourceWithStreamingResponse, ) from .lans import ( - LANs, - AsyncLANs, - LANsWithRawResponse, - AsyncLANsWithRawResponse, - LANsWithStreamingResponse, - AsyncLANsWithStreamingResponse, + LANsResource, + AsyncLANsResource, + LANsResourceWithRawResponse, + AsyncLANsResourceWithRawResponse, + LANsResourceWithStreamingResponse, + AsyncLANsResourceWithStreamingResponse, ) from .wans import ( - WANs, - AsyncWANs, - WANsWithRawResponse, - AsyncWANsWithRawResponse, - WANsWithStreamingResponse, - AsyncWANsWithStreamingResponse, + WANsResource, + AsyncWANsResource, + WANsResourceWithRawResponse, + AsyncWANsResourceWithRawResponse, + WANsResourceWithStreamingResponse, + AsyncWANsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -44,61 +44,78 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.magic_transit import ( - SiteGetResponse, - SiteListResponse, - SiteCreateResponse, - SiteDeleteResponse, - SiteUpdateResponse, + site_list_params, site_create_params, + site_delete_params, site_update_params, ) +from ....types.magic_transit.site import Site +from ....types.magic_transit.site_location_param import SiteLocationParam -__all__ = ["Sites", "AsyncSites"] +__all__ = ["SitesResource", "AsyncSitesResource"] -class Sites(SyncAPIResource): +class SitesResource(SyncAPIResource): @cached_property - def acls(self) -> ACLs: - return ACLs(self._client) + def acls(self) -> ACLsResource: + return ACLsResource(self._client) @cached_property - def lans(self) -> LANs: - return LANs(self._client) + def lans(self) -> LANsResource: + return LANsResource(self._client) @cached_property - def wans(self) -> WANs: - return WANs(self._client) + def wans(self) -> WANsResource: + return WANsResource(self._client) @cached_property - def with_raw_response(self) -> SitesWithRawResponse: - return SitesWithRawResponse(self) + def with_raw_response(self) -> SitesResourceWithRawResponse: + return SitesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SitesWithStreamingResponse: - return SitesWithStreamingResponse(self) + def with_streaming_response(self) -> SitesResourceWithStreamingResponse: + return SitesResourceWithStreamingResponse(self) def create( self, *, account_id: str, - site: site_create_params.Site | NotGiven = NOT_GIVEN, + name: str, + connector_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + ha_mode: bool | NotGiven = NOT_GIVEN, + location: SiteLocationParam | NotGiven = NOT_GIVEN, + secondary_connector_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, - ) -> SiteCreateResponse: + ) -> Site: """ Creates a new Site Args: account_id: Identifier + name: The name of the site. + + connector_id: Magic WAN Connector identifier tag. + + ha_mode: Site high availability mode. If set to true, the site can have two connectors + and runs in high availability mode. + + location: Location of site in latitude and longitude. + + secondary_connector_id: Magic WAN Connector identifier tag. Used when high availability mode is on. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -111,15 +128,25 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( f"/accounts/{account_id}/magic/sites", - body=maybe_transform({"site": site}, site_create_params.SiteCreateParams), + body=maybe_transform( + { + "name": name, + "connector_id": connector_id, + "description": description, + "ha_mode": ha_mode, + "location": location, + "secondary_connector_id": secondary_connector_id, + }, + site_create_params.SiteCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteCreateResponse], ResultWrapper[SiteCreateResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) def update( @@ -127,14 +154,18 @@ def update( site_id: str, *, account_id: str, - site: site_update_params.Site | NotGiven = NOT_GIVEN, + connector_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + location: SiteLocationParam | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + secondary_connector_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, - ) -> SiteUpdateResponse: + ) -> Site: """ Update a specific Site. @@ -143,6 +174,14 @@ def update( site_id: Identifier + connector_id: Magic WAN Connector identifier tag. + + location: Location of site in latitude and longitude. + + name: The name of the site. + + secondary_connector_id: Magic WAN Connector identifier tag. Used when high availability mode is on. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -157,28 +196,38 @@ def update( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._put( f"/accounts/{account_id}/magic/sites/{site_id}", - body=maybe_transform({"site": site}, site_update_params.SiteUpdateParams), + body=maybe_transform( + { + "connector_id": connector_id, + "description": description, + "location": location, + "name": name, + "secondary_connector_id": secondary_connector_id, + }, + site_update_params.SiteUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteUpdateResponse], ResultWrapper[SiteUpdateResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) def list( self, *, account_id: str, + connector_identifier: 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, - ) -> SiteListResponse: + ) -> SyncSinglePage[Site]: """Lists Sites associated with an account. Use connector_identifier query param to @@ -188,6 +237,8 @@ def list( Args: account_id: Identifier + connector_identifier: Identifier + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -198,16 +249,17 @@ 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( + return self._get_api_list( f"/accounts/{account_id}/magic/sites", + page=SyncSinglePage[Site], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + query=maybe_transform({"connector_identifier": connector_identifier}, site_list_params.SiteListParams), ), - cast_to=cast(Type[SiteListResponse], ResultWrapper[SiteListResponse]), + model=Site, ) def delete( @@ -215,13 +267,14 @@ def delete( site_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteDeleteResponse: + ) -> Site: """ Remove a specific Site. @@ -244,14 +297,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._delete( f"/accounts/{account_id}/magic/sites/{site_id}", + body=maybe_transform(body, site_delete_params.SiteDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteDeleteResponse], ResultWrapper[SiteDeleteResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) def get( @@ -265,7 +319,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteGetResponse: + ) -> Site: """ Get a specific Site. @@ -293,51 +347,67 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteGetResponse], ResultWrapper[SiteGetResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) -class AsyncSites(AsyncAPIResource): +class AsyncSitesResource(AsyncAPIResource): @cached_property - def acls(self) -> AsyncACLs: - return AsyncACLs(self._client) + def acls(self) -> AsyncACLsResource: + return AsyncACLsResource(self._client) @cached_property - def lans(self) -> AsyncLANs: - return AsyncLANs(self._client) + def lans(self) -> AsyncLANsResource: + return AsyncLANsResource(self._client) @cached_property - def wans(self) -> AsyncWANs: - return AsyncWANs(self._client) + def wans(self) -> AsyncWANsResource: + return AsyncWANsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSitesWithRawResponse: - return AsyncSitesWithRawResponse(self) + def with_raw_response(self) -> AsyncSitesResourceWithRawResponse: + return AsyncSitesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSitesWithStreamingResponse: - return AsyncSitesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSitesResourceWithStreamingResponse: + return AsyncSitesResourceWithStreamingResponse(self) async def create( self, *, account_id: str, - site: site_create_params.Site | NotGiven = NOT_GIVEN, + name: str, + connector_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + ha_mode: bool | NotGiven = NOT_GIVEN, + location: SiteLocationParam | NotGiven = NOT_GIVEN, + secondary_connector_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, - ) -> SiteCreateResponse: + ) -> Site: """ Creates a new Site Args: account_id: Identifier + name: The name of the site. + + connector_id: Magic WAN Connector identifier tag. + + ha_mode: Site high availability mode. If set to true, the site can have two connectors + and runs in high availability mode. + + location: Location of site in latitude and longitude. + + secondary_connector_id: Magic WAN Connector identifier tag. Used when high availability mode is on. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -350,15 +420,25 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( f"/accounts/{account_id}/magic/sites", - body=await async_maybe_transform({"site": site}, site_create_params.SiteCreateParams), + body=await async_maybe_transform( + { + "name": name, + "connector_id": connector_id, + "description": description, + "ha_mode": ha_mode, + "location": location, + "secondary_connector_id": secondary_connector_id, + }, + site_create_params.SiteCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteCreateResponse], ResultWrapper[SiteCreateResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) async def update( @@ -366,14 +446,18 @@ async def update( site_id: str, *, account_id: str, - site: site_update_params.Site | NotGiven = NOT_GIVEN, + connector_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + location: SiteLocationParam | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + secondary_connector_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, - ) -> SiteUpdateResponse: + ) -> Site: """ Update a specific Site. @@ -382,6 +466,14 @@ async def update( site_id: Identifier + connector_id: Magic WAN Connector identifier tag. + + location: Location of site in latitude and longitude. + + name: The name of the site. + + secondary_connector_id: Magic WAN Connector identifier tag. Used when high availability mode is on. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -396,28 +488,38 @@ async def update( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._put( f"/accounts/{account_id}/magic/sites/{site_id}", - body=await async_maybe_transform({"site": site}, site_update_params.SiteUpdateParams), + body=await async_maybe_transform( + { + "connector_id": connector_id, + "description": description, + "location": location, + "name": name, + "secondary_connector_id": secondary_connector_id, + }, + site_update_params.SiteUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteUpdateResponse], ResultWrapper[SiteUpdateResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) - async def list( + def list( self, *, account_id: str, + connector_identifier: 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, - ) -> SiteListResponse: + ) -> AsyncPaginator[Site, AsyncSinglePage[Site]]: """Lists Sites associated with an account. Use connector_identifier query param to @@ -427,6 +529,8 @@ async def list( Args: account_id: Identifier + connector_identifier: Identifier + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -437,16 +541,17 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites", + page=AsyncSinglePage[Site], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + query=maybe_transform({"connector_identifier": connector_identifier}, site_list_params.SiteListParams), ), - cast_to=cast(Type[SiteListResponse], ResultWrapper[SiteListResponse]), + model=Site, ) async def delete( @@ -454,13 +559,14 @@ async def delete( site_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteDeleteResponse: + ) -> Site: """ Remove a specific Site. @@ -483,14 +589,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._delete( f"/accounts/{account_id}/magic/sites/{site_id}", + body=await async_maybe_transform(body, site_delete_params.SiteDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteDeleteResponse], ResultWrapper[SiteDeleteResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) async def get( @@ -504,7 +611,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteGetResponse: + ) -> Site: """ Get a specific Site. @@ -532,14 +639,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteGetResponse], ResultWrapper[SiteGetResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) -class SitesWithRawResponse: - def __init__(self, sites: Sites) -> None: +class SitesResourceWithRawResponse: + def __init__(self, sites: SitesResource) -> None: self._sites = sites self.create = to_raw_response_wrapper( @@ -559,20 +666,20 @@ def __init__(self, sites: Sites) -> None: ) @cached_property - def acls(self) -> ACLsWithRawResponse: - return ACLsWithRawResponse(self._sites.acls) + def acls(self) -> ACLsResourceWithRawResponse: + return ACLsResourceWithRawResponse(self._sites.acls) @cached_property - def lans(self) -> LANsWithRawResponse: - return LANsWithRawResponse(self._sites.lans) + def lans(self) -> LANsResourceWithRawResponse: + return LANsResourceWithRawResponse(self._sites.lans) @cached_property - def wans(self) -> WANsWithRawResponse: - return WANsWithRawResponse(self._sites.wans) + def wans(self) -> WANsResourceWithRawResponse: + return WANsResourceWithRawResponse(self._sites.wans) -class AsyncSitesWithRawResponse: - def __init__(self, sites: AsyncSites) -> None: +class AsyncSitesResourceWithRawResponse: + def __init__(self, sites: AsyncSitesResource) -> None: self._sites = sites self.create = async_to_raw_response_wrapper( @@ -592,20 +699,20 @@ def __init__(self, sites: AsyncSites) -> None: ) @cached_property - def acls(self) -> AsyncACLsWithRawResponse: - return AsyncACLsWithRawResponse(self._sites.acls) + def acls(self) -> AsyncACLsResourceWithRawResponse: + return AsyncACLsResourceWithRawResponse(self._sites.acls) @cached_property - def lans(self) -> AsyncLANsWithRawResponse: - return AsyncLANsWithRawResponse(self._sites.lans) + def lans(self) -> AsyncLANsResourceWithRawResponse: + return AsyncLANsResourceWithRawResponse(self._sites.lans) @cached_property - def wans(self) -> AsyncWANsWithRawResponse: - return AsyncWANsWithRawResponse(self._sites.wans) + def wans(self) -> AsyncWANsResourceWithRawResponse: + return AsyncWANsResourceWithRawResponse(self._sites.wans) -class SitesWithStreamingResponse: - def __init__(self, sites: Sites) -> None: +class SitesResourceWithStreamingResponse: + def __init__(self, sites: SitesResource) -> None: self._sites = sites self.create = to_streamed_response_wrapper( @@ -625,20 +732,20 @@ def __init__(self, sites: Sites) -> None: ) @cached_property - def acls(self) -> ACLsWithStreamingResponse: - return ACLsWithStreamingResponse(self._sites.acls) + def acls(self) -> ACLsResourceWithStreamingResponse: + return ACLsResourceWithStreamingResponse(self._sites.acls) @cached_property - def lans(self) -> LANsWithStreamingResponse: - return LANsWithStreamingResponse(self._sites.lans) + def lans(self) -> LANsResourceWithStreamingResponse: + return LANsResourceWithStreamingResponse(self._sites.lans) @cached_property - def wans(self) -> WANsWithStreamingResponse: - return WANsWithStreamingResponse(self._sites.wans) + def wans(self) -> WANsResourceWithStreamingResponse: + return WANsResourceWithStreamingResponse(self._sites.wans) -class AsyncSitesWithStreamingResponse: - def __init__(self, sites: AsyncSites) -> None: +class AsyncSitesResourceWithStreamingResponse: + def __init__(self, sites: AsyncSitesResource) -> None: self._sites = sites self.create = async_to_streamed_response_wrapper( @@ -658,13 +765,13 @@ def __init__(self, sites: AsyncSites) -> None: ) @cached_property - def acls(self) -> AsyncACLsWithStreamingResponse: - return AsyncACLsWithStreamingResponse(self._sites.acls) + def acls(self) -> AsyncACLsResourceWithStreamingResponse: + return AsyncACLsResourceWithStreamingResponse(self._sites.acls) @cached_property - def lans(self) -> AsyncLANsWithStreamingResponse: - return AsyncLANsWithStreamingResponse(self._sites.lans) + def lans(self) -> AsyncLANsResourceWithStreamingResponse: + return AsyncLANsResourceWithStreamingResponse(self._sites.lans) @cached_property - def wans(self) -> AsyncWANsWithStreamingResponse: - return AsyncWANsWithStreamingResponse(self._sites.wans) + def wans(self) -> AsyncWANsResourceWithStreamingResponse: + return AsyncWANsResourceWithStreamingResponse(self._sites.wans) diff --git a/src/cloudflare/resources/magic_transit/sites/wans.py b/src/cloudflare/resources/magic_transit/sites/wans.py index 9d0906a390e..36a1cecd8b3 100644 --- a/src/cloudflare/resources/magic_transit/sites/wans.py +++ b/src/cloudflare/resources/magic_transit/sites/wans.py @@ -20,37 +20,38 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.magic_transit.sites import ( - WANGetResponse, - WANListResponse, - WANCreateResponse, - WANDeleteResponse, - WANUpdateResponse, - wan_create_params, - wan_update_params, -) +from ....types.magic_transit.sites import wan_create_params, wan_delete_params, wan_update_params +from ....types.magic_transit.sites.wan import WAN +from ....types.magic_transit.sites.wan_create_response import WANCreateResponse +from ....types.magic_transit.sites.wan_static_addressing_param import WANStaticAddressingParam -__all__ = ["WANs", "AsyncWANs"] +__all__ = ["WANsResource", "AsyncWANsResource"] -class WANs(SyncAPIResource): +class WANsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WANsWithRawResponse: - return WANsWithRawResponse(self) + def with_raw_response(self) -> WANsResourceWithRawResponse: + return WANsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WANsWithStreamingResponse: - return WANsWithStreamingResponse(self) + def with_streaming_response(self) -> WANsResourceWithStreamingResponse: + return WANsResourceWithStreamingResponse(self) def create( self, site_id: str, *, account_id: str, - wan: wan_create_params.WAN | NotGiven = NOT_GIVEN, + physport: int, + vlan_tag: int, + name: str | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + static_addressing: WANStaticAddressingParam | 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, @@ -66,6 +67,11 @@ def create( site_id: Identifier + vlan_tag: VLAN port number. + + static_addressing: (optional) if omitted, use DHCP. Submit secondary_address when site is in high + availability mode. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -80,13 +86,22 @@ def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._post( f"/accounts/{account_id}/magic/sites/{site_id}/wans", - body=maybe_transform({"wan": wan}, wan_create_params.WANCreateParams), + body=maybe_transform( + { + "physport": physport, + "vlan_tag": vlan_tag, + "name": name, + "priority": priority, + "static_addressing": static_addressing, + }, + wan_create_params.WANCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WANCreateResponse]._unwrapper, ), cast_to=cast(Type[WANCreateResponse], ResultWrapper[WANCreateResponse]), ) @@ -97,14 +112,18 @@ def update( *, account_id: str, site_id: str, - wan: wan_update_params.WAN | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + physport: int | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + static_addressing: WANStaticAddressingParam | NotGiven = NOT_GIVEN, + vlan_tag: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANUpdateResponse: + ) -> WAN: """ Update a specific WAN. @@ -115,6 +134,11 @@ def update( wan_id: Identifier + static_addressing: (optional) if omitted, use DHCP. Submit secondary_address when site is in high + availability mode. + + vlan_tag: VLAN port number. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -131,15 +155,24 @@ def update( raise ValueError(f"Expected a non-empty value for `wan_id` but received {wan_id!r}") return self._put( f"/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}", - body=maybe_transform({"wan": wan}, wan_update_params.WANUpdateParams), + body=maybe_transform( + { + "name": name, + "physport": physport, + "priority": priority, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + wan_update_params.WANUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANUpdateResponse], ResultWrapper[WANUpdateResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) def list( @@ -153,7 +186,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANListResponse: + ) -> SyncSinglePage[WAN]: """ Lists WANs associated with an account and site. @@ -174,16 +207,13 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not site_id: raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/wans", + page=SyncSinglePage[WAN], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[WANListResponse], ResultWrapper[WANListResponse]), + model=WAN, ) def delete( @@ -192,13 +222,14 @@ def delete( *, account_id: str, site_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANDeleteResponse: + ) -> WAN: """ Remove a specific WAN. @@ -225,14 +256,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `wan_id` but received {wan_id!r}") return self._delete( f"/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}", + body=maybe_transform(body, wan_delete_params.WANDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANDeleteResponse], ResultWrapper[WANDeleteResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) def get( @@ -247,7 +279,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANGetResponse: + ) -> WAN: """ Get a specific WAN. @@ -279,27 +311,31 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANGetResponse], ResultWrapper[WANGetResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) -class AsyncWANs(AsyncAPIResource): +class AsyncWANsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWANsWithRawResponse: - return AsyncWANsWithRawResponse(self) + def with_raw_response(self) -> AsyncWANsResourceWithRawResponse: + return AsyncWANsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWANsWithStreamingResponse: - return AsyncWANsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWANsResourceWithStreamingResponse: + return AsyncWANsResourceWithStreamingResponse(self) async def create( self, site_id: str, *, account_id: str, - wan: wan_create_params.WAN | NotGiven = NOT_GIVEN, + physport: int, + vlan_tag: int, + name: str | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + static_addressing: WANStaticAddressingParam | 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, @@ -315,6 +351,11 @@ async def create( site_id: Identifier + vlan_tag: VLAN port number. + + static_addressing: (optional) if omitted, use DHCP. Submit secondary_address when site is in high + availability mode. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -329,13 +370,22 @@ async def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._post( f"/accounts/{account_id}/magic/sites/{site_id}/wans", - body=await async_maybe_transform({"wan": wan}, wan_create_params.WANCreateParams), + body=await async_maybe_transform( + { + "physport": physport, + "vlan_tag": vlan_tag, + "name": name, + "priority": priority, + "static_addressing": static_addressing, + }, + wan_create_params.WANCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WANCreateResponse]._unwrapper, ), cast_to=cast(Type[WANCreateResponse], ResultWrapper[WANCreateResponse]), ) @@ -346,14 +396,18 @@ async def update( *, account_id: str, site_id: str, - wan: wan_update_params.WAN | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + physport: int | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + static_addressing: WANStaticAddressingParam | NotGiven = NOT_GIVEN, + vlan_tag: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANUpdateResponse: + ) -> WAN: """ Update a specific WAN. @@ -364,6 +418,11 @@ async def update( wan_id: Identifier + static_addressing: (optional) if omitted, use DHCP. Submit secondary_address when site is in high + availability mode. + + vlan_tag: VLAN port number. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -380,18 +439,27 @@ async def update( raise ValueError(f"Expected a non-empty value for `wan_id` but received {wan_id!r}") return await self._put( f"/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}", - body=await async_maybe_transform({"wan": wan}, wan_update_params.WANUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "physport": physport, + "priority": priority, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + wan_update_params.WANUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANUpdateResponse], ResultWrapper[WANUpdateResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) - async def list( + def list( self, site_id: str, *, @@ -402,7 +470,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANListResponse: + ) -> AsyncPaginator[WAN, AsyncSinglePage[WAN]]: """ Lists WANs associated with an account and site. @@ -423,16 +491,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not site_id: raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/wans", + page=AsyncSinglePage[WAN], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[WANListResponse], ResultWrapper[WANListResponse]), + model=WAN, ) async def delete( @@ -441,13 +506,14 @@ async def delete( *, account_id: str, site_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANDeleteResponse: + ) -> WAN: """ Remove a specific WAN. @@ -474,14 +540,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `wan_id` but received {wan_id!r}") return await self._delete( f"/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}", + body=await async_maybe_transform(body, wan_delete_params.WANDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANDeleteResponse], ResultWrapper[WANDeleteResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) async def get( @@ -496,7 +563,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANGetResponse: + ) -> WAN: """ Get a specific WAN. @@ -528,14 +595,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANGetResponse], ResultWrapper[WANGetResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) -class WANsWithRawResponse: - def __init__(self, wans: WANs) -> None: +class WANsResourceWithRawResponse: + def __init__(self, wans: WANsResource) -> None: self._wans = wans self.create = to_raw_response_wrapper( @@ -555,8 +622,8 @@ def __init__(self, wans: WANs) -> None: ) -class AsyncWANsWithRawResponse: - def __init__(self, wans: AsyncWANs) -> None: +class AsyncWANsResourceWithRawResponse: + def __init__(self, wans: AsyncWANsResource) -> None: self._wans = wans self.create = async_to_raw_response_wrapper( @@ -576,8 +643,8 @@ def __init__(self, wans: AsyncWANs) -> None: ) -class WANsWithStreamingResponse: - def __init__(self, wans: WANs) -> None: +class WANsResourceWithStreamingResponse: + def __init__(self, wans: WANsResource) -> None: self._wans = wans self.create = to_streamed_response_wrapper( @@ -597,8 +664,8 @@ def __init__(self, wans: WANs) -> None: ) -class AsyncWANsWithStreamingResponse: - def __init__(self, wans: AsyncWANs) -> None: +class AsyncWANsResourceWithStreamingResponse: + def __init__(self, wans: AsyncWANsResource) -> None: self._wans = wans self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/managed_headers.py b/src/cloudflare/resources/managed_headers.py index 4c5a186cc51..345adb7d6e5 100644 --- a/src/cloudflare/resources/managed_headers.py +++ b/src/cloudflare/resources/managed_headers.py @@ -6,7 +6,6 @@ import httpx -from ..types import ManagedHeaderEditResponse, ManagedHeaderListResponse, managed_header_edit_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -23,18 +22,22 @@ from .._base_client import ( make_request_options, ) +from ..types.managed_headers import managed_header_edit_params +from ..types.managed_headers.request_model_param import RequestModelParam +from ..types.managed_headers.managed_header_edit_response import ManagedHeaderEditResponse +from ..types.managed_headers.managed_header_list_response import ManagedHeaderListResponse -__all__ = ["ManagedHeaders", "AsyncManagedHeaders"] +__all__ = ["ManagedHeadersResource", "AsyncManagedHeadersResource"] -class ManagedHeaders(SyncAPIResource): +class ManagedHeadersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ManagedHeadersWithRawResponse: - return ManagedHeadersWithRawResponse(self) + def with_raw_response(self) -> ManagedHeadersResourceWithRawResponse: + return ManagedHeadersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ManagedHeadersWithStreamingResponse: - return ManagedHeadersWithStreamingResponse(self) + def with_streaming_response(self) -> ManagedHeadersResourceWithStreamingResponse: + return ManagedHeadersResourceWithStreamingResponse(self) def list( self, @@ -75,8 +78,8 @@ def edit( self, *, zone_id: str, - managed_request_headers: Iterable[managed_header_edit_params.ManagedRequestHeader], - managed_response_headers: Iterable[managed_header_edit_params.ManagedResponseHeader], + managed_request_headers: Iterable[RequestModelParam], + managed_response_headers: Iterable[RequestModelParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -116,14 +119,14 @@ def edit( ) -class AsyncManagedHeaders(AsyncAPIResource): +class AsyncManagedHeadersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncManagedHeadersWithRawResponse: - return AsyncManagedHeadersWithRawResponse(self) + def with_raw_response(self) -> AsyncManagedHeadersResourceWithRawResponse: + return AsyncManagedHeadersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncManagedHeadersWithStreamingResponse: - return AsyncManagedHeadersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncManagedHeadersResourceWithStreamingResponse: + return AsyncManagedHeadersResourceWithStreamingResponse(self) async def list( self, @@ -164,8 +167,8 @@ async def edit( self, *, zone_id: str, - managed_request_headers: Iterable[managed_header_edit_params.ManagedRequestHeader], - managed_response_headers: Iterable[managed_header_edit_params.ManagedResponseHeader], + managed_request_headers: Iterable[RequestModelParam], + managed_response_headers: Iterable[RequestModelParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -205,8 +208,8 @@ async def edit( ) -class ManagedHeadersWithRawResponse: - def __init__(self, managed_headers: ManagedHeaders) -> None: +class ManagedHeadersResourceWithRawResponse: + def __init__(self, managed_headers: ManagedHeadersResource) -> None: self._managed_headers = managed_headers self.list = to_raw_response_wrapper( @@ -217,8 +220,8 @@ def __init__(self, managed_headers: ManagedHeaders) -> None: ) -class AsyncManagedHeadersWithRawResponse: - def __init__(self, managed_headers: AsyncManagedHeaders) -> None: +class AsyncManagedHeadersResourceWithRawResponse: + def __init__(self, managed_headers: AsyncManagedHeadersResource) -> None: self._managed_headers = managed_headers self.list = async_to_raw_response_wrapper( @@ -229,8 +232,8 @@ def __init__(self, managed_headers: AsyncManagedHeaders) -> None: ) -class ManagedHeadersWithStreamingResponse: - def __init__(self, managed_headers: ManagedHeaders) -> None: +class ManagedHeadersResourceWithStreamingResponse: + def __init__(self, managed_headers: ManagedHeadersResource) -> None: self._managed_headers = managed_headers self.list = to_streamed_response_wrapper( @@ -241,8 +244,8 @@ def __init__(self, managed_headers: ManagedHeaders) -> None: ) -class AsyncManagedHeadersWithStreamingResponse: - def __init__(self, managed_headers: AsyncManagedHeaders) -> None: +class AsyncManagedHeadersResourceWithStreamingResponse: + def __init__(self, managed_headers: AsyncManagedHeadersResource) -> None: self._managed_headers = managed_headers self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/memberships.py b/src/cloudflare/resources/memberships.py index ba9f0192a13..81efde2394b 100644 --- a/src/cloudflare/resources/memberships.py +++ b/src/cloudflare/resources/memberships.py @@ -7,14 +7,6 @@ import httpx -from ..types import ( - Membership, - MembershipGetResponse, - MembershipDeleteResponse, - MembershipUpdateResponse, - membership_list_params, - membership_update_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -34,18 +26,23 @@ AsyncPaginator, make_request_options, ) +from ..types.memberships import membership_list_params, membership_delete_params, membership_update_params +from ..types.memberships.membership import Membership +from ..types.memberships.membership_get_response import MembershipGetResponse +from ..types.memberships.membership_delete_response import MembershipDeleteResponse +from ..types.memberships.membership_update_response import MembershipUpdateResponse -__all__ = ["Memberships", "AsyncMemberships"] +__all__ = ["MembershipsResource", "AsyncMembershipsResource"] -class Memberships(SyncAPIResource): +class MembershipsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MembershipsWithRawResponse: - return MembershipsWithRawResponse(self) + def with_raw_response(self) -> MembershipsResourceWithRawResponse: + return MembershipsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MembershipsWithStreamingResponse: - return MembershipsWithStreamingResponse(self) + def with_streaming_response(self) -> MembershipsResourceWithStreamingResponse: + return MembershipsResourceWithStreamingResponse(self) def update( self, @@ -87,7 +84,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MembershipUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MembershipUpdateResponse] @@ -164,6 +161,7 @@ def delete( self, membership_id: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -189,12 +187,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `membership_id` but received {membership_id!r}") return self._delete( f"/memberships/{membership_id}", + body=maybe_transform(body, membership_delete_params.MembershipDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MembershipDeleteResponse]._unwrapper, ), cast_to=cast(Type[MembershipDeleteResponse], ResultWrapper[MembershipDeleteResponse]), ) @@ -235,7 +234,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MembershipGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MembershipGetResponse] @@ -244,14 +243,14 @@ def get( ) -class AsyncMemberships(AsyncAPIResource): +class AsyncMembershipsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMembershipsWithRawResponse: - return AsyncMembershipsWithRawResponse(self) + def with_raw_response(self) -> AsyncMembershipsResourceWithRawResponse: + return AsyncMembershipsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMembershipsWithStreamingResponse: - return AsyncMembershipsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMembershipsResourceWithStreamingResponse: + return AsyncMembershipsResourceWithStreamingResponse(self) async def update( self, @@ -293,7 +292,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MembershipUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MembershipUpdateResponse] @@ -370,6 +369,7 @@ async def delete( self, membership_id: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -395,12 +395,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `membership_id` but received {membership_id!r}") return await self._delete( f"/memberships/{membership_id}", + body=await async_maybe_transform(body, membership_delete_params.MembershipDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MembershipDeleteResponse]._unwrapper, ), cast_to=cast(Type[MembershipDeleteResponse], ResultWrapper[MembershipDeleteResponse]), ) @@ -441,7 +442,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MembershipGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MembershipGetResponse] @@ -450,8 +451,8 @@ async def get( ) -class MembershipsWithRawResponse: - def __init__(self, memberships: Memberships) -> None: +class MembershipsResourceWithRawResponse: + def __init__(self, memberships: MembershipsResource) -> None: self._memberships = memberships self.update = to_raw_response_wrapper( @@ -468,8 +469,8 @@ def __init__(self, memberships: Memberships) -> None: ) -class AsyncMembershipsWithRawResponse: - def __init__(self, memberships: AsyncMemberships) -> None: +class AsyncMembershipsResourceWithRawResponse: + def __init__(self, memberships: AsyncMembershipsResource) -> None: self._memberships = memberships self.update = async_to_raw_response_wrapper( @@ -486,8 +487,8 @@ def __init__(self, memberships: AsyncMemberships) -> None: ) -class MembershipsWithStreamingResponse: - def __init__(self, memberships: Memberships) -> None: +class MembershipsResourceWithStreamingResponse: + def __init__(self, memberships: MembershipsResource) -> None: self._memberships = memberships self.update = to_streamed_response_wrapper( @@ -504,8 +505,8 @@ def __init__(self, memberships: Memberships) -> None: ) -class AsyncMembershipsWithStreamingResponse: - def __init__(self, memberships: AsyncMemberships) -> None: +class AsyncMembershipsResourceWithStreamingResponse: + def __init__(self, memberships: AsyncMembershipsResource) -> None: self._memberships = memberships self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/mtls_certificates/__init__.py b/src/cloudflare/resources/mtls_certificates/__init__.py index ea427828828..f149d9bd299 100644 --- a/src/cloudflare/resources/mtls_certificates/__init__.py +++ b/src/cloudflare/resources/mtls_certificates/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .associations import ( - Associations, - AsyncAssociations, - AssociationsWithRawResponse, - AsyncAssociationsWithRawResponse, - AssociationsWithStreamingResponse, - AsyncAssociationsWithStreamingResponse, + AssociationsResource, + AsyncAssociationsResource, + AssociationsResourceWithRawResponse, + AsyncAssociationsResourceWithRawResponse, + AssociationsResourceWithStreamingResponse, + AsyncAssociationsResourceWithStreamingResponse, ) from .mtls_certificates import ( - MTLSCertificates, - AsyncMTLSCertificates, - MTLSCertificatesWithRawResponse, - AsyncMTLSCertificatesWithRawResponse, - MTLSCertificatesWithStreamingResponse, - AsyncMTLSCertificatesWithStreamingResponse, + MTLSCertificatesResource, + AsyncMTLSCertificatesResource, + MTLSCertificatesResourceWithRawResponse, + AsyncMTLSCertificatesResourceWithRawResponse, + MTLSCertificatesResourceWithStreamingResponse, + AsyncMTLSCertificatesResourceWithStreamingResponse, ) __all__ = [ - "Associations", - "AsyncAssociations", - "AssociationsWithRawResponse", - "AsyncAssociationsWithRawResponse", - "AssociationsWithStreamingResponse", - "AsyncAssociationsWithStreamingResponse", - "MTLSCertificates", - "AsyncMTLSCertificates", - "MTLSCertificatesWithRawResponse", - "AsyncMTLSCertificatesWithRawResponse", - "MTLSCertificatesWithStreamingResponse", - "AsyncMTLSCertificatesWithStreamingResponse", + "AssociationsResource", + "AsyncAssociationsResource", + "AssociationsResourceWithRawResponse", + "AsyncAssociationsResourceWithRawResponse", + "AssociationsResourceWithStreamingResponse", + "AsyncAssociationsResourceWithStreamingResponse", + "MTLSCertificatesResource", + "AsyncMTLSCertificatesResource", + "MTLSCertificatesResourceWithRawResponse", + "AsyncMTLSCertificatesResourceWithRawResponse", + "MTLSCertificatesResourceWithStreamingResponse", + "AsyncMTLSCertificatesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/mtls_certificates/associations.py b/src/cloudflare/resources/mtls_certificates/associations.py index 7b6653a1a81..bd3fcd1f7dc 100644 --- a/src/cloudflare/resources/mtls_certificates/associations.py +++ b/src/cloudflare/resources/mtls_certificates/associations.py @@ -19,19 +19,19 @@ from ..._base_client import ( make_request_options, ) -from ...types.mtls_certificates import AssociationGetResponse +from ...types.mtls_certificates.association_get_response import AssociationGetResponse -__all__ = ["Associations", "AsyncAssociations"] +__all__ = ["AssociationsResource", "AsyncAssociationsResource"] -class Associations(SyncAPIResource): +class AssociationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AssociationsWithRawResponse: - return AssociationsWithRawResponse(self) + def with_raw_response(self) -> AssociationsResourceWithRawResponse: + return AssociationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AssociationsWithStreamingResponse: - return AssociationsWithStreamingResponse(self) + def with_streaming_response(self) -> AssociationsResourceWithStreamingResponse: + return AssociationsResourceWithStreamingResponse(self) def get( self, @@ -74,20 +74,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AssociationGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AssociationGetResponse]], ResultWrapper[AssociationGetResponse]), ) -class AsyncAssociations(AsyncAPIResource): +class AsyncAssociationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAssociationsWithRawResponse: - return AsyncAssociationsWithRawResponse(self) + def with_raw_response(self) -> AsyncAssociationsResourceWithRawResponse: + return AsyncAssociationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAssociationsWithStreamingResponse: - return AsyncAssociationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAssociationsResourceWithStreamingResponse: + return AsyncAssociationsResourceWithStreamingResponse(self) async def get( self, @@ -130,14 +130,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AssociationGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AssociationGetResponse]], ResultWrapper[AssociationGetResponse]), ) -class AssociationsWithRawResponse: - def __init__(self, associations: Associations) -> None: +class AssociationsResourceWithRawResponse: + def __init__(self, associations: AssociationsResource) -> None: self._associations = associations self.get = to_raw_response_wrapper( @@ -145,8 +145,8 @@ def __init__(self, associations: Associations) -> None: ) -class AsyncAssociationsWithRawResponse: - def __init__(self, associations: AsyncAssociations) -> None: +class AsyncAssociationsResourceWithRawResponse: + def __init__(self, associations: AsyncAssociationsResource) -> None: self._associations = associations self.get = async_to_raw_response_wrapper( @@ -154,8 +154,8 @@ def __init__(self, associations: AsyncAssociations) -> None: ) -class AssociationsWithStreamingResponse: - def __init__(self, associations: Associations) -> None: +class AssociationsResourceWithStreamingResponse: + def __init__(self, associations: AssociationsResource) -> None: self._associations = associations self.get = to_streamed_response_wrapper( @@ -163,8 +163,8 @@ def __init__(self, associations: Associations) -> None: ) -class AsyncAssociationsWithStreamingResponse: - def __init__(self, associations: AsyncAssociations) -> None: +class AsyncAssociationsResourceWithStreamingResponse: + def __init__(self, associations: AsyncAssociationsResource) -> None: self._associations = associations self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/mtls_certificates/mtls_certificates.py b/src/cloudflare/resources/mtls_certificates/mtls_certificates.py index 505f1a90c7d..c5da4fc9b8e 100644 --- a/src/cloudflare/resources/mtls_certificates/mtls_certificates.py +++ b/src/cloudflare/resources/mtls_certificates/mtls_certificates.py @@ -6,7 +6,6 @@ import httpx -from ...types import MTLSCertificate, MTLSCertificateUpdate, mtls_certificate_create_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -23,33 +22,36 @@ from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage from .associations import ( - Associations, - AsyncAssociations, - AssociationsWithRawResponse, - AsyncAssociationsWithRawResponse, - AssociationsWithStreamingResponse, - AsyncAssociationsWithStreamingResponse, + AssociationsResource, + AsyncAssociationsResource, + AssociationsResourceWithRawResponse, + AsyncAssociationsResourceWithRawResponse, + AssociationsResourceWithStreamingResponse, + AsyncAssociationsResourceWithStreamingResponse, ) from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.mtls_certificates import mtls_certificate_create_params, mtls_certificate_delete_params +from ...types.mtls_certificates.mtls_certificate import MTLSCertificate +from ...types.mtls_certificates.mtls_certificate_create_response import MTLSCertificateCreateResponse -__all__ = ["MTLSCertificates", "AsyncMTLSCertificates"] +__all__ = ["MTLSCertificatesResource", "AsyncMTLSCertificatesResource"] -class MTLSCertificates(SyncAPIResource): +class MTLSCertificatesResource(SyncAPIResource): @cached_property - def associations(self) -> Associations: - return Associations(self._client) + def associations(self) -> AssociationsResource: + return AssociationsResource(self._client) @cached_property - def with_raw_response(self) -> MTLSCertificatesWithRawResponse: - return MTLSCertificatesWithRawResponse(self) + def with_raw_response(self) -> MTLSCertificatesResourceWithRawResponse: + return MTLSCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MTLSCertificatesWithStreamingResponse: - return MTLSCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> MTLSCertificatesResourceWithStreamingResponse: + return MTLSCertificatesResourceWithStreamingResponse(self) def create( self, @@ -65,7 +67,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MTLSCertificateUpdate: + ) -> MTLSCertificateCreateResponse: """ Upload a certificate that you want to use with mTLS-enabled Cloudflare services. @@ -106,9 +108,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MTLSCertificateCreateResponse]._unwrapper, ), - cast_to=cast(Type[MTLSCertificateUpdate], ResultWrapper[MTLSCertificateUpdate]), + cast_to=cast(Type[MTLSCertificateCreateResponse], ResultWrapper[MTLSCertificateCreateResponse]), ) def list( @@ -152,6 +154,7 @@ def delete( mtls_certificate_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -184,12 +187,13 @@ def delete( ) return self._delete( f"/accounts/{account_id}/mtls_certificates/{mtls_certificate_id}", + body=maybe_transform(body, mtls_certificate_delete_params.MTLSCertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MTLSCertificate]._unwrapper, ), cast_to=cast(Type[MTLSCertificate], ResultWrapper[MTLSCertificate]), ) @@ -235,24 +239,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MTLSCertificate]._unwrapper, ), cast_to=cast(Type[MTLSCertificate], ResultWrapper[MTLSCertificate]), ) -class AsyncMTLSCertificates(AsyncAPIResource): +class AsyncMTLSCertificatesResource(AsyncAPIResource): @cached_property - def associations(self) -> AsyncAssociations: - return AsyncAssociations(self._client) + def associations(self) -> AsyncAssociationsResource: + return AsyncAssociationsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncMTLSCertificatesWithRawResponse: - return AsyncMTLSCertificatesWithRawResponse(self) + def with_raw_response(self) -> AsyncMTLSCertificatesResourceWithRawResponse: + return AsyncMTLSCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMTLSCertificatesWithStreamingResponse: - return AsyncMTLSCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMTLSCertificatesResourceWithStreamingResponse: + return AsyncMTLSCertificatesResourceWithStreamingResponse(self) async def create( self, @@ -268,7 +272,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MTLSCertificateUpdate: + ) -> MTLSCertificateCreateResponse: """ Upload a certificate that you want to use with mTLS-enabled Cloudflare services. @@ -309,9 +313,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MTLSCertificateCreateResponse]._unwrapper, ), - cast_to=cast(Type[MTLSCertificateUpdate], ResultWrapper[MTLSCertificateUpdate]), + cast_to=cast(Type[MTLSCertificateCreateResponse], ResultWrapper[MTLSCertificateCreateResponse]), ) def list( @@ -355,6 +359,7 @@ async def delete( mtls_certificate_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -387,12 +392,13 @@ async def delete( ) return await self._delete( f"/accounts/{account_id}/mtls_certificates/{mtls_certificate_id}", + body=await async_maybe_transform(body, mtls_certificate_delete_params.MTLSCertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MTLSCertificate]._unwrapper, ), cast_to=cast(Type[MTLSCertificate], ResultWrapper[MTLSCertificate]), ) @@ -438,14 +444,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MTLSCertificate]._unwrapper, ), cast_to=cast(Type[MTLSCertificate], ResultWrapper[MTLSCertificate]), ) -class MTLSCertificatesWithRawResponse: - def __init__(self, mtls_certificates: MTLSCertificates) -> None: +class MTLSCertificatesResourceWithRawResponse: + def __init__(self, mtls_certificates: MTLSCertificatesResource) -> None: self._mtls_certificates = mtls_certificates self.create = to_raw_response_wrapper( @@ -462,12 +468,12 @@ def __init__(self, mtls_certificates: MTLSCertificates) -> None: ) @cached_property - def associations(self) -> AssociationsWithRawResponse: - return AssociationsWithRawResponse(self._mtls_certificates.associations) + def associations(self) -> AssociationsResourceWithRawResponse: + return AssociationsResourceWithRawResponse(self._mtls_certificates.associations) -class AsyncMTLSCertificatesWithRawResponse: - def __init__(self, mtls_certificates: AsyncMTLSCertificates) -> None: +class AsyncMTLSCertificatesResourceWithRawResponse: + def __init__(self, mtls_certificates: AsyncMTLSCertificatesResource) -> None: self._mtls_certificates = mtls_certificates self.create = async_to_raw_response_wrapper( @@ -484,12 +490,12 @@ def __init__(self, mtls_certificates: AsyncMTLSCertificates) -> None: ) @cached_property - def associations(self) -> AsyncAssociationsWithRawResponse: - return AsyncAssociationsWithRawResponse(self._mtls_certificates.associations) + def associations(self) -> AsyncAssociationsResourceWithRawResponse: + return AsyncAssociationsResourceWithRawResponse(self._mtls_certificates.associations) -class MTLSCertificatesWithStreamingResponse: - def __init__(self, mtls_certificates: MTLSCertificates) -> None: +class MTLSCertificatesResourceWithStreamingResponse: + def __init__(self, mtls_certificates: MTLSCertificatesResource) -> None: self._mtls_certificates = mtls_certificates self.create = to_streamed_response_wrapper( @@ -506,12 +512,12 @@ def __init__(self, mtls_certificates: MTLSCertificates) -> None: ) @cached_property - def associations(self) -> AssociationsWithStreamingResponse: - return AssociationsWithStreamingResponse(self._mtls_certificates.associations) + def associations(self) -> AssociationsResourceWithStreamingResponse: + return AssociationsResourceWithStreamingResponse(self._mtls_certificates.associations) -class AsyncMTLSCertificatesWithStreamingResponse: - def __init__(self, mtls_certificates: AsyncMTLSCertificates) -> None: +class AsyncMTLSCertificatesResourceWithStreamingResponse: + def __init__(self, mtls_certificates: AsyncMTLSCertificatesResource) -> None: self._mtls_certificates = mtls_certificates self.create = async_to_streamed_response_wrapper( @@ -528,5 +534,5 @@ def __init__(self, mtls_certificates: AsyncMTLSCertificates) -> None: ) @cached_property - def associations(self) -> AsyncAssociationsWithStreamingResponse: - return AsyncAssociationsWithStreamingResponse(self._mtls_certificates.associations) + def associations(self) -> AsyncAssociationsResourceWithStreamingResponse: + return AsyncAssociationsResourceWithStreamingResponse(self._mtls_certificates.associations) diff --git a/src/cloudflare/resources/origin_ca_certificates.py b/src/cloudflare/resources/origin_ca_certificates.py index b9104ca3a01..1ffdea60be4 100644 --- a/src/cloudflare/resources/origin_ca_certificates.py +++ b/src/cloudflare/resources/origin_ca_certificates.py @@ -7,13 +7,6 @@ import httpx -from ..types import ( - OriginCACertificate, - OriginCACertificateGetResponse, - OriginCACertificateCreateResponse, - OriginCACertificateDeleteResponse, - origin_ca_certificate_create_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -33,18 +26,27 @@ AsyncPaginator, make_request_options, ) +from ..types.origin_ca_certificates import ( + origin_ca_certificate_list_params, + origin_ca_certificate_create_params, + origin_ca_certificate_delete_params, +) +from ..types.origin_ca_certificates.origin_ca_certificate import OriginCACertificate +from ..types.origin_ca_certificates.origin_ca_certificate_get_response import OriginCACertificateGetResponse +from ..types.origin_ca_certificates.origin_ca_certificate_create_response import OriginCACertificateCreateResponse +from ..types.origin_ca_certificates.origin_ca_certificate_delete_response import OriginCACertificateDeleteResponse -__all__ = ["OriginCACertificates", "AsyncOriginCACertificates"] +__all__ = ["OriginCACertificatesResource", "AsyncOriginCACertificatesResource"] -class OriginCACertificates(SyncAPIResource): +class OriginCACertificatesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OriginCACertificatesWithRawResponse: - return OriginCACertificatesWithRawResponse(self) + def with_raw_response(self) -> OriginCACertificatesResourceWithRawResponse: + return OriginCACertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OriginCACertificatesWithStreamingResponse: - return OriginCACertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> OriginCACertificatesResourceWithStreamingResponse: + return OriginCACertificatesResourceWithStreamingResponse(self) def create( self, @@ -102,7 +104,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginCACertificateCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginCACertificateCreateResponse] @@ -113,6 +115,7 @@ def create( def list( self, *, + identifier: 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, @@ -125,12 +128,29 @@ def list( Use your Origin CA Key as your User Service Key when calling this endpoint ([see above](#requests)). + + Args: + identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( "/certificates", page=SyncSinglePage[OriginCACertificate], 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, + query=maybe_transform( + {"identifier": identifier}, origin_ca_certificate_list_params.OriginCACertificateListParams + ), ), model=OriginCACertificate, ) @@ -139,6 +159,7 @@ def delete( self, certificate_id: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +188,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") return self._delete( f"/certificates/{certificate_id}", + body=maybe_transform(body, origin_ca_certificate_delete_params.OriginCACertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginCACertificateDeleteResponse]._unwrapper, ), cast_to=cast(Type[OriginCACertificateDeleteResponse], ResultWrapper[OriginCACertificateDeleteResponse]), ) @@ -216,7 +238,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginCACertificateGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginCACertificateGetResponse] @@ -225,14 +247,14 @@ def get( ) -class AsyncOriginCACertificates(AsyncAPIResource): +class AsyncOriginCACertificatesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOriginCACertificatesWithRawResponse: - return AsyncOriginCACertificatesWithRawResponse(self) + def with_raw_response(self) -> AsyncOriginCACertificatesResourceWithRawResponse: + return AsyncOriginCACertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOriginCACertificatesWithStreamingResponse: - return AsyncOriginCACertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOriginCACertificatesResourceWithStreamingResponse: + return AsyncOriginCACertificatesResourceWithStreamingResponse(self) async def create( self, @@ -290,7 +312,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginCACertificateCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginCACertificateCreateResponse] @@ -301,6 +323,7 @@ async def create( def list( self, *, + identifier: 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, @@ -313,12 +336,29 @@ def list( Use your Origin CA Key as your User Service Key when calling this endpoint ([see above](#requests)). + + Args: + identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( "/certificates", page=AsyncSinglePage[OriginCACertificate], 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, + query=maybe_transform( + {"identifier": identifier}, origin_ca_certificate_list_params.OriginCACertificateListParams + ), ), model=OriginCACertificate, ) @@ -327,6 +367,7 @@ async def delete( self, certificate_id: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -355,12 +396,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") return await self._delete( f"/certificates/{certificate_id}", + body=await async_maybe_transform(body, origin_ca_certificate_delete_params.OriginCACertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginCACertificateDeleteResponse]._unwrapper, ), cast_to=cast(Type[OriginCACertificateDeleteResponse], ResultWrapper[OriginCACertificateDeleteResponse]), ) @@ -404,7 +446,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginCACertificateGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginCACertificateGetResponse] @@ -413,8 +455,8 @@ async def get( ) -class OriginCACertificatesWithRawResponse: - def __init__(self, origin_ca_certificates: OriginCACertificates) -> None: +class OriginCACertificatesResourceWithRawResponse: + def __init__(self, origin_ca_certificates: OriginCACertificatesResource) -> None: self._origin_ca_certificates = origin_ca_certificates self.create = to_raw_response_wrapper( @@ -431,8 +473,8 @@ def __init__(self, origin_ca_certificates: OriginCACertificates) -> None: ) -class AsyncOriginCACertificatesWithRawResponse: - def __init__(self, origin_ca_certificates: AsyncOriginCACertificates) -> None: +class AsyncOriginCACertificatesResourceWithRawResponse: + def __init__(self, origin_ca_certificates: AsyncOriginCACertificatesResource) -> None: self._origin_ca_certificates = origin_ca_certificates self.create = async_to_raw_response_wrapper( @@ -449,8 +491,8 @@ def __init__(self, origin_ca_certificates: AsyncOriginCACertificates) -> None: ) -class OriginCACertificatesWithStreamingResponse: - def __init__(self, origin_ca_certificates: OriginCACertificates) -> None: +class OriginCACertificatesResourceWithStreamingResponse: + def __init__(self, origin_ca_certificates: OriginCACertificatesResource) -> None: self._origin_ca_certificates = origin_ca_certificates self.create = to_streamed_response_wrapper( @@ -467,8 +509,8 @@ def __init__(self, origin_ca_certificates: OriginCACertificates) -> None: ) -class AsyncOriginCACertificatesWithStreamingResponse: - def __init__(self, origin_ca_certificates: AsyncOriginCACertificates) -> None: +class AsyncOriginCACertificatesResourceWithStreamingResponse: + def __init__(self, origin_ca_certificates: AsyncOriginCACertificatesResource) -> None: self._origin_ca_certificates = origin_ca_certificates self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/origin_post_quantum_encryption.py b/src/cloudflare/resources/origin_post_quantum_encryption.py index 084104ad3fa..58c75a387f7 100644 --- a/src/cloudflare/resources/origin_post_quantum_encryption.py +++ b/src/cloudflare/resources/origin_post_quantum_encryption.py @@ -7,11 +7,6 @@ import httpx -from ..types import ( - OriginPostQuantumEncryptionGetResponse, - OriginPostQuantumEncryptionUpdateResponse, - origin_post_quantum_encryption_update_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -29,18 +24,25 @@ from .._base_client import ( make_request_options, ) +from ..types.origin_post_quantum_encryption import origin_post_quantum_encryption_update_params +from ..types.origin_post_quantum_encryption.origin_post_quantum_encryption_get_response import ( + OriginPostQuantumEncryptionGetResponse, +) +from ..types.origin_post_quantum_encryption.origin_post_quantum_encryption_update_response import ( + OriginPostQuantumEncryptionUpdateResponse, +) -__all__ = ["OriginPostQuantumEncryption", "AsyncOriginPostQuantumEncryption"] +__all__ = ["OriginPostQuantumEncryptionResource", "AsyncOriginPostQuantumEncryptionResource"] -class OriginPostQuantumEncryption(SyncAPIResource): +class OriginPostQuantumEncryptionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OriginPostQuantumEncryptionWithRawResponse: - return OriginPostQuantumEncryptionWithRawResponse(self) + def with_raw_response(self) -> OriginPostQuantumEncryptionResourceWithRawResponse: + return OriginPostQuantumEncryptionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OriginPostQuantumEncryptionWithStreamingResponse: - return OriginPostQuantumEncryptionWithStreamingResponse(self) + def with_streaming_response(self) -> OriginPostQuantumEncryptionResourceWithStreamingResponse: + return OriginPostQuantumEncryptionResourceWithStreamingResponse(self) def update( self, @@ -90,7 +92,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginPostQuantumEncryptionUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginPostQuantumEncryptionUpdateResponse] @@ -139,7 +141,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginPostQuantumEncryptionGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginPostQuantumEncryptionGetResponse] @@ -148,14 +150,14 @@ def get( ) -class AsyncOriginPostQuantumEncryption(AsyncAPIResource): +class AsyncOriginPostQuantumEncryptionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOriginPostQuantumEncryptionWithRawResponse: - return AsyncOriginPostQuantumEncryptionWithRawResponse(self) + def with_raw_response(self) -> AsyncOriginPostQuantumEncryptionResourceWithRawResponse: + return AsyncOriginPostQuantumEncryptionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOriginPostQuantumEncryptionWithStreamingResponse: - return AsyncOriginPostQuantumEncryptionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse: + return AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse(self) async def update( self, @@ -205,7 +207,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginPostQuantumEncryptionUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginPostQuantumEncryptionUpdateResponse] @@ -254,7 +256,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginPostQuantumEncryptionGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginPostQuantumEncryptionGetResponse] @@ -263,8 +265,8 @@ async def get( ) -class OriginPostQuantumEncryptionWithRawResponse: - def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryption) -> None: +class OriginPostQuantumEncryptionResourceWithRawResponse: + def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryptionResource) -> None: self._origin_post_quantum_encryption = origin_post_quantum_encryption self.update = to_raw_response_wrapper( @@ -275,8 +277,8 @@ def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryption) ) -class AsyncOriginPostQuantumEncryptionWithRawResponse: - def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncryption) -> None: +class AsyncOriginPostQuantumEncryptionResourceWithRawResponse: + def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncryptionResource) -> None: self._origin_post_quantum_encryption = origin_post_quantum_encryption self.update = async_to_raw_response_wrapper( @@ -287,8 +289,8 @@ def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncrypt ) -class OriginPostQuantumEncryptionWithStreamingResponse: - def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryption) -> None: +class OriginPostQuantumEncryptionResourceWithStreamingResponse: + def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryptionResource) -> None: self._origin_post_quantum_encryption = origin_post_quantum_encryption self.update = to_streamed_response_wrapper( @@ -299,8 +301,8 @@ def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryption) ) -class AsyncOriginPostQuantumEncryptionWithStreamingResponse: - def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncryption) -> None: +class AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse: + def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncryptionResource) -> None: self._origin_post_quantum_encryption = origin_post_quantum_encryption self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/origin_tls_client_auth/__init__.py b/src/cloudflare/resources/origin_tls_client_auth/__init__.py index 14ad95548ab..6c12314975a 100644 --- a/src/cloudflare/resources/origin_tls_client_auth/__init__.py +++ b/src/cloudflare/resources/origin_tls_client_auth/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .hostnames import ( - Hostnames, - AsyncHostnames, - HostnamesWithRawResponse, - AsyncHostnamesWithRawResponse, - HostnamesWithStreamingResponse, - AsyncHostnamesWithStreamingResponse, + HostnamesResource, + AsyncHostnamesResource, + HostnamesResourceWithRawResponse, + AsyncHostnamesResourceWithRawResponse, + HostnamesResourceWithStreamingResponse, + AsyncHostnamesResourceWithStreamingResponse, ) from .origin_tls_client_auth import ( - OriginTLSClientAuth, - AsyncOriginTLSClientAuth, - OriginTLSClientAuthWithRawResponse, - AsyncOriginTLSClientAuthWithRawResponse, - OriginTLSClientAuthWithStreamingResponse, - AsyncOriginTLSClientAuthWithStreamingResponse, + OriginTLSClientAuthResource, + AsyncOriginTLSClientAuthResource, + OriginTLSClientAuthResourceWithRawResponse, + AsyncOriginTLSClientAuthResourceWithRawResponse, + OriginTLSClientAuthResourceWithStreamingResponse, + AsyncOriginTLSClientAuthResourceWithStreamingResponse, ) __all__ = [ - "Hostnames", - "AsyncHostnames", - "HostnamesWithRawResponse", - "AsyncHostnamesWithRawResponse", - "HostnamesWithStreamingResponse", - "AsyncHostnamesWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "OriginTLSClientAuth", - "AsyncOriginTLSClientAuth", - "OriginTLSClientAuthWithRawResponse", - "AsyncOriginTLSClientAuthWithRawResponse", - "OriginTLSClientAuthWithStreamingResponse", - "AsyncOriginTLSClientAuthWithStreamingResponse", + "HostnamesResource", + "AsyncHostnamesResource", + "HostnamesResourceWithRawResponse", + "AsyncHostnamesResourceWithRawResponse", + "HostnamesResourceWithStreamingResponse", + "AsyncHostnamesResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "OriginTLSClientAuthResource", + "AsyncOriginTLSClientAuthResource", + "OriginTLSClientAuthResourceWithRawResponse", + "AsyncOriginTLSClientAuthResourceWithRawResponse", + "OriginTLSClientAuthResourceWithStreamingResponse", + "AsyncOriginTLSClientAuthResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/origin_tls_client_auth/hostnames/__init__.py b/src/cloudflare/resources/origin_tls_client_auth/hostnames/__init__.py index 92b619612bd..0e6260acee3 100644 --- a/src/cloudflare/resources/origin_tls_client_auth/hostnames/__init__.py +++ b/src/cloudflare/resources/origin_tls_client_auth/hostnames/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .hostnames import ( - Hostnames, - AsyncHostnames, - HostnamesWithRawResponse, - AsyncHostnamesWithRawResponse, - HostnamesWithStreamingResponse, - AsyncHostnamesWithStreamingResponse, + HostnamesResource, + AsyncHostnamesResource, + HostnamesResourceWithRawResponse, + AsyncHostnamesResourceWithRawResponse, + HostnamesResourceWithStreamingResponse, + AsyncHostnamesResourceWithStreamingResponse, ) from .certificates import ( - Certificates, - AsyncCertificates, - CertificatesWithRawResponse, - AsyncCertificatesWithRawResponse, - CertificatesWithStreamingResponse, - AsyncCertificatesWithStreamingResponse, + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, ) __all__ = [ - "Certificates", - "AsyncCertificates", - "CertificatesWithRawResponse", - "AsyncCertificatesWithRawResponse", - "CertificatesWithStreamingResponse", - "AsyncCertificatesWithStreamingResponse", - "Hostnames", - "AsyncHostnames", - "HostnamesWithRawResponse", - "AsyncHostnamesWithRawResponse", - "HostnamesWithStreamingResponse", - "AsyncHostnamesWithStreamingResponse", + "CertificatesResource", + "AsyncCertificatesResource", + "CertificatesResourceWithRawResponse", + "AsyncCertificatesResourceWithRawResponse", + "CertificatesResourceWithStreamingResponse", + "AsyncCertificatesResourceWithStreamingResponse", + "HostnamesResource", + "AsyncHostnamesResource", + "HostnamesResourceWithRawResponse", + "AsyncHostnamesResourceWithRawResponse", + "HostnamesResourceWithStreamingResponse", + "AsyncHostnamesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/origin_tls_client_auth/hostnames/certificates.py b/src/cloudflare/resources/origin_tls_client_auth/hostnames/certificates.py index a20922942f9..a46067f12cc 100644 --- a/src/cloudflare/resources/origin_tls_client_auth/hostnames/certificates.py +++ b/src/cloudflare/resources/origin_tls_client_auth/hostnames/certificates.py @@ -25,20 +25,23 @@ AsyncPaginator, make_request_options, ) -from ....types.origin_tls_client_auth import OriginTLSClientCertificateID -from ....types.origin_tls_client_auth.hostnames import OriginTLSClientCertificate, certificate_create_params +from ....types.origin_tls_client_auth.hostnames import certificate_create_params, certificate_delete_params +from ....types.origin_tls_client_auth.authenticated_origin_pull import AuthenticatedOriginPull +from ....types.origin_tls_client_auth.hostnames.certificate_get_response import CertificateGetResponse +from ....types.origin_tls_client_auth.hostnames.certificate_create_response import CertificateCreateResponse +from ....types.origin_tls_client_auth.hostnames.certificate_delete_response import CertificateDeleteResponse -__all__ = ["Certificates", "AsyncCertificates"] +__all__ = ["CertificatesResource", "AsyncCertificatesResource"] -class Certificates(SyncAPIResource): +class CertificatesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CertificatesWithRawResponse: - return CertificatesWithRawResponse(self) + def with_raw_response(self) -> CertificatesResourceWithRawResponse: + return CertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CertificatesWithStreamingResponse: - return CertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> CertificatesResourceWithStreamingResponse: + return CertificatesResourceWithStreamingResponse(self) def create( self, @@ -52,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginTLSClientCertificate: + ) -> CertificateCreateResponse: """Upload a certificate to be used for client authentication on a hostname. 10 @@ -89,9 +92,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificateCreateResponse]._unwrapper, ), - cast_to=cast(Type[OriginTLSClientCertificate], ResultWrapper[OriginTLSClientCertificate]), + cast_to=cast(Type[CertificateCreateResponse], ResultWrapper[CertificateCreateResponse]), ) def list( @@ -104,7 +107,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[OriginTLSClientCertificateID]: + ) -> SyncSinglePage[AuthenticatedOriginPull]: """ List Certificates @@ -123,11 +126,11 @@ 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}/origin_tls_client_auth/hostnames/certificates", - page=SyncSinglePage[OriginTLSClientCertificateID], + page=SyncSinglePage[AuthenticatedOriginPull], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=OriginTLSClientCertificateID, + model=AuthenticatedOriginPull, ) def delete( @@ -135,13 +138,14 @@ def delete( certificate_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> OriginTLSClientCertificate: + ) -> CertificateDeleteResponse: """ Delete Hostname Client Certificate @@ -164,14 +168,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") return self._delete( f"/zones/{zone_id}/origin_tls_client_auth/hostnames/certificates/{certificate_id}", + body=maybe_transform(body, certificate_delete_params.CertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificateDeleteResponse]._unwrapper, ), - cast_to=cast(Type[OriginTLSClientCertificate], ResultWrapper[OriginTLSClientCertificate]), + cast_to=cast(Type[CertificateDeleteResponse], ResultWrapper[CertificateDeleteResponse]), ) def get( @@ -185,7 +190,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginTLSClientCertificate: + ) -> CertificateGetResponse: """ Get the certificate by ID to be used for client authentication on a hostname. @@ -213,20 +218,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificateGetResponse]._unwrapper, ), - cast_to=cast(Type[OriginTLSClientCertificate], ResultWrapper[OriginTLSClientCertificate]), + cast_to=cast(Type[CertificateGetResponse], ResultWrapper[CertificateGetResponse]), ) -class AsyncCertificates(AsyncAPIResource): +class AsyncCertificatesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCertificatesWithRawResponse: - return AsyncCertificatesWithRawResponse(self) + def with_raw_response(self) -> AsyncCertificatesResourceWithRawResponse: + return AsyncCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCertificatesWithStreamingResponse: - return AsyncCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCertificatesResourceWithStreamingResponse: + return AsyncCertificatesResourceWithStreamingResponse(self) async def create( self, @@ -240,7 +245,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginTLSClientCertificate: + ) -> CertificateCreateResponse: """Upload a certificate to be used for client authentication on a hostname. 10 @@ -277,9 +282,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificateCreateResponse]._unwrapper, ), - cast_to=cast(Type[OriginTLSClientCertificate], ResultWrapper[OriginTLSClientCertificate]), + cast_to=cast(Type[CertificateCreateResponse], ResultWrapper[CertificateCreateResponse]), ) def list( @@ -292,7 +297,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[OriginTLSClientCertificateID, AsyncSinglePage[OriginTLSClientCertificateID]]: + ) -> AsyncPaginator[AuthenticatedOriginPull, AsyncSinglePage[AuthenticatedOriginPull]]: """ List Certificates @@ -311,11 +316,11 @@ 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}/origin_tls_client_auth/hostnames/certificates", - page=AsyncSinglePage[OriginTLSClientCertificateID], + page=AsyncSinglePage[AuthenticatedOriginPull], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=OriginTLSClientCertificateID, + model=AuthenticatedOriginPull, ) async def delete( @@ -323,13 +328,14 @@ async def delete( certificate_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> OriginTLSClientCertificate: + ) -> CertificateDeleteResponse: """ Delete Hostname Client Certificate @@ -352,14 +358,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") return await self._delete( f"/zones/{zone_id}/origin_tls_client_auth/hostnames/certificates/{certificate_id}", + body=await async_maybe_transform(body, certificate_delete_params.CertificateDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificateDeleteResponse]._unwrapper, ), - cast_to=cast(Type[OriginTLSClientCertificate], ResultWrapper[OriginTLSClientCertificate]), + cast_to=cast(Type[CertificateDeleteResponse], ResultWrapper[CertificateDeleteResponse]), ) async def get( @@ -373,7 +380,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginTLSClientCertificate: + ) -> CertificateGetResponse: """ Get the certificate by ID to be used for client authentication on a hostname. @@ -401,14 +408,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificateGetResponse]._unwrapper, ), - cast_to=cast(Type[OriginTLSClientCertificate], ResultWrapper[OriginTLSClientCertificate]), + cast_to=cast(Type[CertificateGetResponse], ResultWrapper[CertificateGetResponse]), ) -class CertificatesWithRawResponse: - def __init__(self, certificates: Certificates) -> None: +class CertificatesResourceWithRawResponse: + def __init__(self, certificates: CertificatesResource) -> None: self._certificates = certificates self.create = to_raw_response_wrapper( @@ -425,8 +432,8 @@ def __init__(self, certificates: Certificates) -> None: ) -class AsyncCertificatesWithRawResponse: - def __init__(self, certificates: AsyncCertificates) -> None: +class AsyncCertificatesResourceWithRawResponse: + def __init__(self, certificates: AsyncCertificatesResource) -> None: self._certificates = certificates self.create = async_to_raw_response_wrapper( @@ -443,8 +450,8 @@ def __init__(self, certificates: AsyncCertificates) -> None: ) -class CertificatesWithStreamingResponse: - def __init__(self, certificates: Certificates) -> None: +class CertificatesResourceWithStreamingResponse: + def __init__(self, certificates: CertificatesResource) -> None: self._certificates = certificates self.create = to_streamed_response_wrapper( @@ -461,8 +468,8 @@ def __init__(self, certificates: Certificates) -> None: ) -class AsyncCertificatesWithStreamingResponse: - def __init__(self, certificates: AsyncCertificates) -> None: +class AsyncCertificatesResourceWithStreamingResponse: + def __init__(self, certificates: AsyncCertificatesResource) -> None: self._certificates = certificates self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/origin_tls_client_auth/hostnames/hostnames.py b/src/cloudflare/resources/origin_tls_client_auth/hostnames/hostnames.py index 2ebc5bf3915..d5654039bca 100644 --- a/src/cloudflare/resources/origin_tls_client_auth/hostnames/hostnames.py +++ b/src/cloudflare/resources/origin_tls_client_auth/hostnames/hostnames.py @@ -21,37 +21,35 @@ ) from ...._wrappers import ResultWrapper from .certificates import ( - Certificates, - AsyncCertificates, - CertificatesWithRawResponse, - AsyncCertificatesWithRawResponse, - CertificatesWithStreamingResponse, - AsyncCertificatesWithStreamingResponse, + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, ) from ...._base_client import ( make_request_options, ) -from ....types.origin_tls_client_auth import ( - HostnameUpdateResponse, - OriginTLSClientCertificateID, - hostname_update_params, -) +from ....types.origin_tls_client_auth import hostname_update_params +from ....types.origin_tls_client_auth.hostname_update_response import HostnameUpdateResponse +from ....types.origin_tls_client_auth.authenticated_origin_pull import AuthenticatedOriginPull -__all__ = ["Hostnames", "AsyncHostnames"] +__all__ = ["HostnamesResource", "AsyncHostnamesResource"] -class Hostnames(SyncAPIResource): +class HostnamesResource(SyncAPIResource): @cached_property - def certificates(self) -> Certificates: - return Certificates(self._client) + def certificates(self) -> CertificatesResource: + return CertificatesResource(self._client) @cached_property - def with_raw_response(self) -> HostnamesWithRawResponse: - return HostnamesWithRawResponse(self) + def with_raw_response(self) -> HostnamesResourceWithRawResponse: + return HostnamesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HostnamesWithStreamingResponse: - return HostnamesWithStreamingResponse(self) + def with_streaming_response(self) -> HostnamesResourceWithStreamingResponse: + return HostnamesResourceWithStreamingResponse(self) def update( self, @@ -93,7 +91,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HostnameUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[HostnameUpdateResponse]], ResultWrapper[HostnameUpdateResponse]), ) @@ -109,7 +107,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginTLSClientCertificateID: + ) -> AuthenticatedOriginPull: """ Get the Hostname Status for Client Authentication @@ -138,24 +136,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AuthenticatedOriginPull]._unwrapper, ), - cast_to=cast(Type[OriginTLSClientCertificateID], ResultWrapper[OriginTLSClientCertificateID]), + cast_to=cast(Type[AuthenticatedOriginPull], ResultWrapper[AuthenticatedOriginPull]), ) -class AsyncHostnames(AsyncAPIResource): +class AsyncHostnamesResource(AsyncAPIResource): @cached_property - def certificates(self) -> AsyncCertificates: - return AsyncCertificates(self._client) + def certificates(self) -> AsyncCertificatesResource: + return AsyncCertificatesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncHostnamesWithRawResponse: - return AsyncHostnamesWithRawResponse(self) + def with_raw_response(self) -> AsyncHostnamesResourceWithRawResponse: + return AsyncHostnamesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHostnamesWithStreamingResponse: - return AsyncHostnamesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHostnamesResourceWithStreamingResponse: + return AsyncHostnamesResourceWithStreamingResponse(self) async def update( self, @@ -197,7 +195,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HostnameUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[HostnameUpdateResponse]], ResultWrapper[HostnameUpdateResponse]), ) @@ -213,7 +211,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginTLSClientCertificateID: + ) -> AuthenticatedOriginPull: """ Get the Hostname Status for Client Authentication @@ -242,14 +240,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AuthenticatedOriginPull]._unwrapper, ), - cast_to=cast(Type[OriginTLSClientCertificateID], ResultWrapper[OriginTLSClientCertificateID]), + cast_to=cast(Type[AuthenticatedOriginPull], ResultWrapper[AuthenticatedOriginPull]), ) -class HostnamesWithRawResponse: - def __init__(self, hostnames: Hostnames) -> None: +class HostnamesResourceWithRawResponse: + def __init__(self, hostnames: HostnamesResource) -> None: self._hostnames = hostnames self.update = to_raw_response_wrapper( @@ -260,12 +258,12 @@ def __init__(self, hostnames: Hostnames) -> None: ) @cached_property - def certificates(self) -> CertificatesWithRawResponse: - return CertificatesWithRawResponse(self._hostnames.certificates) + def certificates(self) -> CertificatesResourceWithRawResponse: + return CertificatesResourceWithRawResponse(self._hostnames.certificates) -class AsyncHostnamesWithRawResponse: - def __init__(self, hostnames: AsyncHostnames) -> None: +class AsyncHostnamesResourceWithRawResponse: + def __init__(self, hostnames: AsyncHostnamesResource) -> None: self._hostnames = hostnames self.update = async_to_raw_response_wrapper( @@ -276,12 +274,12 @@ def __init__(self, hostnames: AsyncHostnames) -> None: ) @cached_property - def certificates(self) -> AsyncCertificatesWithRawResponse: - return AsyncCertificatesWithRawResponse(self._hostnames.certificates) + def certificates(self) -> AsyncCertificatesResourceWithRawResponse: + return AsyncCertificatesResourceWithRawResponse(self._hostnames.certificates) -class HostnamesWithStreamingResponse: - def __init__(self, hostnames: Hostnames) -> None: +class HostnamesResourceWithStreamingResponse: + def __init__(self, hostnames: HostnamesResource) -> None: self._hostnames = hostnames self.update = to_streamed_response_wrapper( @@ -292,12 +290,12 @@ def __init__(self, hostnames: Hostnames) -> None: ) @cached_property - def certificates(self) -> CertificatesWithStreamingResponse: - return CertificatesWithStreamingResponse(self._hostnames.certificates) + def certificates(self) -> CertificatesResourceWithStreamingResponse: + return CertificatesResourceWithStreamingResponse(self._hostnames.certificates) -class AsyncHostnamesWithStreamingResponse: - def __init__(self, hostnames: AsyncHostnames) -> None: +class AsyncHostnamesResourceWithStreamingResponse: + def __init__(self, hostnames: AsyncHostnamesResource) -> None: self._hostnames = hostnames self.update = async_to_streamed_response_wrapper( @@ -308,5 +306,5 @@ def __init__(self, hostnames: AsyncHostnames) -> None: ) @cached_property - def certificates(self) -> AsyncCertificatesWithStreamingResponse: - return AsyncCertificatesWithStreamingResponse(self._hostnames.certificates) + def certificates(self) -> AsyncCertificatesResourceWithStreamingResponse: + return AsyncCertificatesResourceWithStreamingResponse(self._hostnames.certificates) diff --git a/src/cloudflare/resources/origin_tls_client_auth/origin_tls_client_auth.py b/src/cloudflare/resources/origin_tls_client_auth/origin_tls_client_auth.py index bfed59276f2..5d0d50f7e9d 100644 --- a/src/cloudflare/resources/origin_tls_client_auth/origin_tls_client_auth.py +++ b/src/cloudflare/resources/origin_tls_client_auth/origin_tls_client_auth.py @@ -6,34 +6,27 @@ import httpx -from ...types import ( - OriginTLSClientAuthGetResponse, - OriginTLSClientAuthListResponse, - OriginTLSClientAuthCreateResponse, - OriginTLSClientAuthDeleteResponse, - origin_tls_client_auth_create_params, -) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, async_maybe_transform, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from ..._compat import cached_property from .hostnames import ( - Hostnames, - AsyncHostnames, - HostnamesWithRawResponse, - AsyncHostnamesWithRawResponse, - HostnamesWithStreamingResponse, - AsyncHostnamesWithStreamingResponse, + HostnamesResource, + AsyncHostnamesResource, + HostnamesResourceWithRawResponse, + AsyncHostnamesResourceWithRawResponse, + HostnamesResourceWithStreamingResponse, + AsyncHostnamesResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -48,27 +41,32 @@ AsyncPaginator, make_request_options, ) -from .hostnames.hostnames import Hostnames, AsyncHostnames +from .hostnames.hostnames import HostnamesResource, AsyncHostnamesResource +from ...types.origin_tls_client_auth import origin_tls_client_auth_create_params, origin_tls_client_auth_delete_params +from ...types.origin_tls_client_auth.zone_authenticated_origin_pull import ZoneAuthenticatedOriginPull +from ...types.origin_tls_client_auth.origin_tls_client_auth_get_response import OriginTLSClientAuthGetResponse +from ...types.origin_tls_client_auth.origin_tls_client_auth_create_response import OriginTLSClientAuthCreateResponse +from ...types.origin_tls_client_auth.origin_tls_client_auth_delete_response import OriginTLSClientAuthDeleteResponse -__all__ = ["OriginTLSClientAuth", "AsyncOriginTLSClientAuth"] +__all__ = ["OriginTLSClientAuthResource", "AsyncOriginTLSClientAuthResource"] -class OriginTLSClientAuth(SyncAPIResource): +class OriginTLSClientAuthResource(SyncAPIResource): @cached_property - def hostnames(self) -> Hostnames: - return Hostnames(self._client) + def hostnames(self) -> HostnamesResource: + return HostnamesResource(self._client) @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def with_raw_response(self) -> OriginTLSClientAuthWithRawResponse: - return OriginTLSClientAuthWithRawResponse(self) + def with_raw_response(self) -> OriginTLSClientAuthResourceWithRawResponse: + return OriginTLSClientAuthResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OriginTLSClientAuthWithStreamingResponse: - return OriginTLSClientAuthWithStreamingResponse(self) + def with_streaming_response(self) -> OriginTLSClientAuthResourceWithStreamingResponse: + return OriginTLSClientAuthResourceWithStreamingResponse(self) def create( self, @@ -123,7 +121,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginTLSClientAuthCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginTLSClientAuthCreateResponse] @@ -141,7 +139,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[OriginTLSClientAuthListResponse]: + ) -> SyncSinglePage[ZoneAuthenticatedOriginPull]: """ List Certificates @@ -160,11 +158,11 @@ 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}/origin_tls_client_auth", - page=SyncSinglePage[OriginTLSClientAuthListResponse], + page=SyncSinglePage[ZoneAuthenticatedOriginPull], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=OriginTLSClientAuthListResponse, + model=ZoneAuthenticatedOriginPull, ) def delete( @@ -172,6 +170,7 @@ def delete( certificate_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -203,12 +202,13 @@ def delete( OriginTLSClientAuthDeleteResponse, self._delete( f"/zones/{zone_id}/origin_tls_client_auth/{certificate_id}", + body=maybe_transform(body, origin_tls_client_auth_delete_params.OriginTLSClientAuthDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginTLSClientAuthDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginTLSClientAuthDeleteResponse] @@ -257,7 +257,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginTLSClientAuthGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginTLSClientAuthGetResponse] @@ -266,22 +266,22 @@ def get( ) -class AsyncOriginTLSClientAuth(AsyncAPIResource): +class AsyncOriginTLSClientAuthResource(AsyncAPIResource): @cached_property - def hostnames(self) -> AsyncHostnames: - return AsyncHostnames(self._client) + def hostnames(self) -> AsyncHostnamesResource: + return AsyncHostnamesResource(self._client) @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncOriginTLSClientAuthWithRawResponse: - return AsyncOriginTLSClientAuthWithRawResponse(self) + def with_raw_response(self) -> AsyncOriginTLSClientAuthResourceWithRawResponse: + return AsyncOriginTLSClientAuthResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOriginTLSClientAuthWithStreamingResponse: - return AsyncOriginTLSClientAuthWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOriginTLSClientAuthResourceWithStreamingResponse: + return AsyncOriginTLSClientAuthResourceWithStreamingResponse(self) async def create( self, @@ -336,7 +336,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginTLSClientAuthCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginTLSClientAuthCreateResponse] @@ -354,7 +354,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[OriginTLSClientAuthListResponse, AsyncSinglePage[OriginTLSClientAuthListResponse]]: + ) -> AsyncPaginator[ZoneAuthenticatedOriginPull, AsyncSinglePage[ZoneAuthenticatedOriginPull]]: """ List Certificates @@ -373,11 +373,11 @@ 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}/origin_tls_client_auth", - page=AsyncSinglePage[OriginTLSClientAuthListResponse], + page=AsyncSinglePage[ZoneAuthenticatedOriginPull], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=OriginTLSClientAuthListResponse, + model=ZoneAuthenticatedOriginPull, ) async def delete( @@ -385,6 +385,7 @@ async def delete( certificate_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -416,12 +417,15 @@ async def delete( OriginTLSClientAuthDeleteResponse, await self._delete( f"/zones/{zone_id}/origin_tls_client_auth/{certificate_id}", + body=await async_maybe_transform( + body, origin_tls_client_auth_delete_params.OriginTLSClientAuthDeleteParams + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginTLSClientAuthDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginTLSClientAuthDeleteResponse] @@ -470,7 +474,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginTLSClientAuthGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OriginTLSClientAuthGetResponse] @@ -479,8 +483,8 @@ async def get( ) -class OriginTLSClientAuthWithRawResponse: - def __init__(self, origin_tls_client_auth: OriginTLSClientAuth) -> None: +class OriginTLSClientAuthResourceWithRawResponse: + def __init__(self, origin_tls_client_auth: OriginTLSClientAuthResource) -> None: self._origin_tls_client_auth = origin_tls_client_auth self.create = to_raw_response_wrapper( @@ -497,16 +501,16 @@ def __init__(self, origin_tls_client_auth: OriginTLSClientAuth) -> None: ) @cached_property - def hostnames(self) -> HostnamesWithRawResponse: - return HostnamesWithRawResponse(self._origin_tls_client_auth.hostnames) + def hostnames(self) -> HostnamesResourceWithRawResponse: + return HostnamesResourceWithRawResponse(self._origin_tls_client_auth.hostnames) @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._origin_tls_client_auth.settings) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._origin_tls_client_auth.settings) -class AsyncOriginTLSClientAuthWithRawResponse: - def __init__(self, origin_tls_client_auth: AsyncOriginTLSClientAuth) -> None: +class AsyncOriginTLSClientAuthResourceWithRawResponse: + def __init__(self, origin_tls_client_auth: AsyncOriginTLSClientAuthResource) -> None: self._origin_tls_client_auth = origin_tls_client_auth self.create = async_to_raw_response_wrapper( @@ -523,16 +527,16 @@ def __init__(self, origin_tls_client_auth: AsyncOriginTLSClientAuth) -> None: ) @cached_property - def hostnames(self) -> AsyncHostnamesWithRawResponse: - return AsyncHostnamesWithRawResponse(self._origin_tls_client_auth.hostnames) + def hostnames(self) -> AsyncHostnamesResourceWithRawResponse: + return AsyncHostnamesResourceWithRawResponse(self._origin_tls_client_auth.hostnames) @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._origin_tls_client_auth.settings) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._origin_tls_client_auth.settings) -class OriginTLSClientAuthWithStreamingResponse: - def __init__(self, origin_tls_client_auth: OriginTLSClientAuth) -> None: +class OriginTLSClientAuthResourceWithStreamingResponse: + def __init__(self, origin_tls_client_auth: OriginTLSClientAuthResource) -> None: self._origin_tls_client_auth = origin_tls_client_auth self.create = to_streamed_response_wrapper( @@ -549,16 +553,16 @@ def __init__(self, origin_tls_client_auth: OriginTLSClientAuth) -> None: ) @cached_property - def hostnames(self) -> HostnamesWithStreamingResponse: - return HostnamesWithStreamingResponse(self._origin_tls_client_auth.hostnames) + def hostnames(self) -> HostnamesResourceWithStreamingResponse: + return HostnamesResourceWithStreamingResponse(self._origin_tls_client_auth.hostnames) @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._origin_tls_client_auth.settings) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._origin_tls_client_auth.settings) -class AsyncOriginTLSClientAuthWithStreamingResponse: - def __init__(self, origin_tls_client_auth: AsyncOriginTLSClientAuth) -> None: +class AsyncOriginTLSClientAuthResourceWithStreamingResponse: + def __init__(self, origin_tls_client_auth: AsyncOriginTLSClientAuthResource) -> None: self._origin_tls_client_auth = origin_tls_client_auth self.create = async_to_streamed_response_wrapper( @@ -575,9 +579,9 @@ def __init__(self, origin_tls_client_auth: AsyncOriginTLSClientAuth) -> None: ) @cached_property - def hostnames(self) -> AsyncHostnamesWithStreamingResponse: - return AsyncHostnamesWithStreamingResponse(self._origin_tls_client_auth.hostnames) + def hostnames(self) -> AsyncHostnamesResourceWithStreamingResponse: + return AsyncHostnamesResourceWithStreamingResponse(self._origin_tls_client_auth.hostnames) @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._origin_tls_client_auth.settings) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._origin_tls_client_auth.settings) diff --git a/src/cloudflare/resources/origin_tls_client_auth/settings.py b/src/cloudflare/resources/origin_tls_client_auth/settings.py index 217082afc24..ac8304e1edd 100644 --- a/src/cloudflare/resources/origin_tls_client_auth/settings.py +++ b/src/cloudflare/resources/origin_tls_client_auth/settings.py @@ -23,19 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.origin_tls_client_auth import SettingGetResponse, SettingUpdateResponse, setting_update_params +from ...types.origin_tls_client_auth import setting_update_params +from ...types.origin_tls_client_auth.setting_get_response import SettingGetResponse +from ...types.origin_tls_client_auth.setting_update_response import SettingUpdateResponse -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def update( self, @@ -78,7 +80,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingUpdateResponse]._unwrapper, ), cast_to=cast(Type[SettingUpdateResponse], ResultWrapper[SettingUpdateResponse]), ) @@ -119,20 +121,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingGetResponse]._unwrapper, ), cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), ) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def update( self, @@ -175,7 +177,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingUpdateResponse]._unwrapper, ), cast_to=cast(Type[SettingUpdateResponse], ResultWrapper[SettingUpdateResponse]), ) @@ -216,14 +218,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingGetResponse]._unwrapper, ), cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), ) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.update = to_raw_response_wrapper( @@ -234,8 +236,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.update = async_to_raw_response_wrapper( @@ -246,8 +248,8 @@ def __init__(self, settings: AsyncSettings) -> None: ) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.update = to_streamed_response_wrapper( @@ -258,8 +260,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/page_shield/__init__.py b/src/cloudflare/resources/page_shield/__init__.py index 195b675feb5..42a42e10c4d 100644 --- a/src/cloudflare/resources/page_shield/__init__.py +++ b/src/cloudflare/resources/page_shield/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, + ScriptsResource, + AsyncScriptsResource, + ScriptsResourceWithRawResponse, + AsyncScriptsResourceWithRawResponse, + ScriptsResourceWithStreamingResponse, + AsyncScriptsResourceWithStreamingResponse, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from .connections import ( - Connections, - AsyncConnections, - ConnectionsWithRawResponse, - AsyncConnectionsWithRawResponse, - ConnectionsWithStreamingResponse, - AsyncConnectionsWithStreamingResponse, + ConnectionsResource, + AsyncConnectionsResource, + ConnectionsResourceWithRawResponse, + AsyncConnectionsResourceWithRawResponse, + ConnectionsResourceWithStreamingResponse, + AsyncConnectionsResourceWithStreamingResponse, ) from .page_shield import ( - PageShield, - AsyncPageShield, - PageShieldWithRawResponse, - AsyncPageShieldWithRawResponse, - PageShieldWithStreamingResponse, - AsyncPageShieldWithStreamingResponse, + PageShieldResource, + AsyncPageShieldResource, + PageShieldResourceWithRawResponse, + AsyncPageShieldResourceWithRawResponse, + PageShieldResourceWithStreamingResponse, + AsyncPageShieldResourceWithStreamingResponse, ) __all__ = [ - "Policies", - "AsyncPolicies", - "PoliciesWithRawResponse", - "AsyncPoliciesWithRawResponse", - "PoliciesWithStreamingResponse", - "AsyncPoliciesWithStreamingResponse", - "Connections", - "AsyncConnections", - "ConnectionsWithRawResponse", - "AsyncConnectionsWithRawResponse", - "ConnectionsWithStreamingResponse", - "AsyncConnectionsWithStreamingResponse", - "Scripts", - "AsyncScripts", - "ScriptsWithRawResponse", - "AsyncScriptsWithRawResponse", - "ScriptsWithStreamingResponse", - "AsyncScriptsWithStreamingResponse", - "PageShield", - "AsyncPageShield", - "PageShieldWithRawResponse", - "AsyncPageShieldWithRawResponse", - "PageShieldWithStreamingResponse", - "AsyncPageShieldWithStreamingResponse", + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", + "ConnectionsResource", + "AsyncConnectionsResource", + "ConnectionsResourceWithRawResponse", + "AsyncConnectionsResourceWithRawResponse", + "ConnectionsResourceWithStreamingResponse", + "AsyncConnectionsResourceWithStreamingResponse", + "ScriptsResource", + "AsyncScriptsResource", + "ScriptsResourceWithRawResponse", + "AsyncScriptsResourceWithRawResponse", + "ScriptsResourceWithStreamingResponse", + "AsyncScriptsResourceWithStreamingResponse", + "PageShieldResource", + "AsyncPageShieldResource", + "PageShieldResourceWithRawResponse", + "AsyncPageShieldResourceWithRawResponse", + "PageShieldResourceWithStreamingResponse", + "AsyncPageShieldResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/page_shield/connections.py b/src/cloudflare/resources/page_shield/connections.py index 64c146b362e..c9d5a5c7c71 100644 --- a/src/cloudflare/resources/page_shield/connections.py +++ b/src/cloudflare/resources/page_shield/connections.py @@ -21,19 +21,20 @@ AsyncPaginator, make_request_options, ) -from ...types.page_shield import PageShieldConnection, connection_list_params +from ...types.page_shield import connection_list_params +from ...types.page_shield.connection import Connection -__all__ = ["Connections", "AsyncConnections"] +__all__ = ["ConnectionsResource", "AsyncConnectionsResource"] -class Connections(SyncAPIResource): +class ConnectionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConnectionsWithRawResponse: - return ConnectionsWithRawResponse(self) + def with_raw_response(self) -> ConnectionsResourceWithRawResponse: + return ConnectionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConnectionsWithStreamingResponse: - return ConnectionsWithStreamingResponse(self) + def with_streaming_response(self) -> ConnectionsResourceWithStreamingResponse: + return ConnectionsResourceWithStreamingResponse(self) def list( self, @@ -57,7 +58,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[PageShieldConnection]: + ) -> SyncSinglePage[Connection]: """ Lists all connections detected by Page Shield. @@ -122,7 +123,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}/page_shield/connections", - page=SyncSinglePage[PageShieldConnection], + page=SyncSinglePage[Connection], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -146,7 +147,7 @@ def list( connection_list_params.ConnectionListParams, ), ), - model=PageShieldConnection, + model=Connection, ) def get( @@ -160,7 +161,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldConnection: + ) -> Connection: """ Fetches a connection detected by Page Shield by connection ID. @@ -186,18 +187,18 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PageShieldConnection, + cast_to=Connection, ) -class AsyncConnections(AsyncAPIResource): +class AsyncConnectionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConnectionsWithRawResponse: - return AsyncConnectionsWithRawResponse(self) + def with_raw_response(self) -> AsyncConnectionsResourceWithRawResponse: + return AsyncConnectionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConnectionsWithStreamingResponse: - return AsyncConnectionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConnectionsResourceWithStreamingResponse: + return AsyncConnectionsResourceWithStreamingResponse(self) def list( self, @@ -221,7 +222,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PageShieldConnection, AsyncSinglePage[PageShieldConnection]]: + ) -> AsyncPaginator[Connection, AsyncSinglePage[Connection]]: """ Lists all connections detected by Page Shield. @@ -286,7 +287,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}/page_shield/connections", - page=AsyncSinglePage[PageShieldConnection], + page=AsyncSinglePage[Connection], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -310,7 +311,7 @@ def list( connection_list_params.ConnectionListParams, ), ), - model=PageShieldConnection, + model=Connection, ) async def get( @@ -324,7 +325,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldConnection: + ) -> Connection: """ Fetches a connection detected by Page Shield by connection ID. @@ -350,12 +351,12 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PageShieldConnection, + cast_to=Connection, ) -class ConnectionsWithRawResponse: - def __init__(self, connections: Connections) -> None: +class ConnectionsResourceWithRawResponse: + def __init__(self, connections: ConnectionsResource) -> None: self._connections = connections self.list = to_raw_response_wrapper( @@ -366,8 +367,8 @@ def __init__(self, connections: Connections) -> None: ) -class AsyncConnectionsWithRawResponse: - def __init__(self, connections: AsyncConnections) -> None: +class AsyncConnectionsResourceWithRawResponse: + def __init__(self, connections: AsyncConnectionsResource) -> None: self._connections = connections self.list = async_to_raw_response_wrapper( @@ -378,8 +379,8 @@ def __init__(self, connections: AsyncConnections) -> None: ) -class ConnectionsWithStreamingResponse: - def __init__(self, connections: Connections) -> None: +class ConnectionsResourceWithStreamingResponse: + def __init__(self, connections: ConnectionsResource) -> None: self._connections = connections self.list = to_streamed_response_wrapper( @@ -390,8 +391,8 @@ def __init__(self, connections: Connections) -> None: ) -class AsyncConnectionsWithStreamingResponse: - def __init__(self, connections: AsyncConnections) -> None: +class AsyncConnectionsResourceWithStreamingResponse: + def __init__(self, connections: AsyncConnectionsResource) -> None: self._connections = connections self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/page_shield/page_shield.py b/src/cloudflare/resources/page_shield/page_shield.py index 4c0d32b9133..ef88a6b37e0 100644 --- a/src/cloudflare/resources/page_shield/page_shield.py +++ b/src/cloudflare/resources/page_shield/page_shield.py @@ -6,14 +6,13 @@ import httpx -from ...types import PageShieldSetting, PageShieldUpdateResponse, page_shield_update_params from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, + ScriptsResource, + AsyncScriptsResource, + ScriptsResourceWithRawResponse, + AsyncScriptsResourceWithRawResponse, + ScriptsResourceWithStreamingResponse, + AsyncScriptsResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( @@ -21,12 +20,12 @@ async_maybe_transform, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -38,40 +37,43 @@ ) from ..._wrappers import ResultWrapper from .connections import ( - Connections, - AsyncConnections, - ConnectionsWithRawResponse, - AsyncConnectionsWithRawResponse, - ConnectionsWithStreamingResponse, - AsyncConnectionsWithStreamingResponse, + ConnectionsResource, + AsyncConnectionsResource, + ConnectionsResourceWithRawResponse, + AsyncConnectionsResourceWithRawResponse, + ConnectionsResourceWithStreamingResponse, + AsyncConnectionsResourceWithStreamingResponse, ) from ..._base_client import ( make_request_options, ) +from ...types.page_shield import page_shield_update_params +from ...types.page_shield.setting import Setting +from ...types.page_shield.page_shield_update_response import PageShieldUpdateResponse -__all__ = ["PageShield", "AsyncPageShield"] +__all__ = ["PageShieldResource", "AsyncPageShieldResource"] -class PageShield(SyncAPIResource): +class PageShieldResource(SyncAPIResource): @cached_property - def policies(self) -> Policies: - return Policies(self._client) + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) @cached_property - def connections(self) -> Connections: - return Connections(self._client) + def connections(self) -> ConnectionsResource: + return ConnectionsResource(self._client) @cached_property - def scripts(self) -> Scripts: - return Scripts(self._client) + def scripts(self) -> ScriptsResource: + return ScriptsResource(self._client) @cached_property - def with_raw_response(self) -> PageShieldWithRawResponse: - return PageShieldWithRawResponse(self) + def with_raw_response(self) -> PageShieldResourceWithRawResponse: + return PageShieldResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PageShieldWithStreamingResponse: - return PageShieldWithStreamingResponse(self) + def with_streaming_response(self) -> PageShieldResourceWithStreamingResponse: + return PageShieldResourceWithStreamingResponse(self) def update( self, @@ -125,7 +127,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageShieldUpdateResponse]._unwrapper, ), cast_to=cast(Type[PageShieldUpdateResponse], ResultWrapper[PageShieldUpdateResponse]), ) @@ -140,7 +142,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldSetting: + ) -> Setting: """ Fetches the Page Shield settings. @@ -164,32 +166,32 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Setting]._unwrapper, ), - cast_to=cast(Type[PageShieldSetting], ResultWrapper[PageShieldSetting]), + cast_to=cast(Type[Setting], ResultWrapper[Setting]), ) -class AsyncPageShield(AsyncAPIResource): +class AsyncPageShieldResource(AsyncAPIResource): @cached_property - def policies(self) -> AsyncPolicies: - return AsyncPolicies(self._client) + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) @cached_property - def connections(self) -> AsyncConnections: - return AsyncConnections(self._client) + def connections(self) -> AsyncConnectionsResource: + return AsyncConnectionsResource(self._client) @cached_property - def scripts(self) -> AsyncScripts: - return AsyncScripts(self._client) + def scripts(self) -> AsyncScriptsResource: + return AsyncScriptsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPageShieldWithRawResponse: - return AsyncPageShieldWithRawResponse(self) + def with_raw_response(self) -> AsyncPageShieldResourceWithRawResponse: + return AsyncPageShieldResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPageShieldWithStreamingResponse: - return AsyncPageShieldWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPageShieldResourceWithStreamingResponse: + return AsyncPageShieldResourceWithStreamingResponse(self) async def update( self, @@ -243,7 +245,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageShieldUpdateResponse]._unwrapper, ), cast_to=cast(Type[PageShieldUpdateResponse], ResultWrapper[PageShieldUpdateResponse]), ) @@ -258,7 +260,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldSetting: + ) -> Setting: """ Fetches the Page Shield settings. @@ -282,14 +284,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Setting]._unwrapper, ), - cast_to=cast(Type[PageShieldSetting], ResultWrapper[PageShieldSetting]), + cast_to=cast(Type[Setting], ResultWrapper[Setting]), ) -class PageShieldWithRawResponse: - def __init__(self, page_shield: PageShield) -> None: +class PageShieldResourceWithRawResponse: + def __init__(self, page_shield: PageShieldResource) -> None: self._page_shield = page_shield self.update = to_raw_response_wrapper( @@ -300,20 +302,20 @@ def __init__(self, page_shield: PageShield) -> None: ) @cached_property - def policies(self) -> PoliciesWithRawResponse: - return PoliciesWithRawResponse(self._page_shield.policies) + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._page_shield.policies) @cached_property - def connections(self) -> ConnectionsWithRawResponse: - return ConnectionsWithRawResponse(self._page_shield.connections) + def connections(self) -> ConnectionsResourceWithRawResponse: + return ConnectionsResourceWithRawResponse(self._page_shield.connections) @cached_property - def scripts(self) -> ScriptsWithRawResponse: - return ScriptsWithRawResponse(self._page_shield.scripts) + def scripts(self) -> ScriptsResourceWithRawResponse: + return ScriptsResourceWithRawResponse(self._page_shield.scripts) -class AsyncPageShieldWithRawResponse: - def __init__(self, page_shield: AsyncPageShield) -> None: +class AsyncPageShieldResourceWithRawResponse: + def __init__(self, page_shield: AsyncPageShieldResource) -> None: self._page_shield = page_shield self.update = async_to_raw_response_wrapper( @@ -324,20 +326,20 @@ def __init__(self, page_shield: AsyncPageShield) -> None: ) @cached_property - def policies(self) -> AsyncPoliciesWithRawResponse: - return AsyncPoliciesWithRawResponse(self._page_shield.policies) + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._page_shield.policies) @cached_property - def connections(self) -> AsyncConnectionsWithRawResponse: - return AsyncConnectionsWithRawResponse(self._page_shield.connections) + def connections(self) -> AsyncConnectionsResourceWithRawResponse: + return AsyncConnectionsResourceWithRawResponse(self._page_shield.connections) @cached_property - def scripts(self) -> AsyncScriptsWithRawResponse: - return AsyncScriptsWithRawResponse(self._page_shield.scripts) + def scripts(self) -> AsyncScriptsResourceWithRawResponse: + return AsyncScriptsResourceWithRawResponse(self._page_shield.scripts) -class PageShieldWithStreamingResponse: - def __init__(self, page_shield: PageShield) -> None: +class PageShieldResourceWithStreamingResponse: + def __init__(self, page_shield: PageShieldResource) -> None: self._page_shield = page_shield self.update = to_streamed_response_wrapper( @@ -348,20 +350,20 @@ def __init__(self, page_shield: PageShield) -> None: ) @cached_property - def policies(self) -> PoliciesWithStreamingResponse: - return PoliciesWithStreamingResponse(self._page_shield.policies) + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._page_shield.policies) @cached_property - def connections(self) -> ConnectionsWithStreamingResponse: - return ConnectionsWithStreamingResponse(self._page_shield.connections) + def connections(self) -> ConnectionsResourceWithStreamingResponse: + return ConnectionsResourceWithStreamingResponse(self._page_shield.connections) @cached_property - def scripts(self) -> ScriptsWithStreamingResponse: - return ScriptsWithStreamingResponse(self._page_shield.scripts) + def scripts(self) -> ScriptsResourceWithStreamingResponse: + return ScriptsResourceWithStreamingResponse(self._page_shield.scripts) -class AsyncPageShieldWithStreamingResponse: - def __init__(self, page_shield: AsyncPageShield) -> None: +class AsyncPageShieldResourceWithStreamingResponse: + def __init__(self, page_shield: AsyncPageShieldResource) -> None: self._page_shield = page_shield self.update = async_to_streamed_response_wrapper( @@ -372,13 +374,13 @@ def __init__(self, page_shield: AsyncPageShield) -> None: ) @cached_property - def policies(self) -> AsyncPoliciesWithStreamingResponse: - return AsyncPoliciesWithStreamingResponse(self._page_shield.policies) + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._page_shield.policies) @cached_property - def connections(self) -> AsyncConnectionsWithStreamingResponse: - return AsyncConnectionsWithStreamingResponse(self._page_shield.connections) + def connections(self) -> AsyncConnectionsResourceWithStreamingResponse: + return AsyncConnectionsResourceWithStreamingResponse(self._page_shield.connections) @cached_property - def scripts(self) -> AsyncScriptsWithStreamingResponse: - return AsyncScriptsWithStreamingResponse(self._page_shield.scripts) + def scripts(self) -> AsyncScriptsResourceWithStreamingResponse: + return AsyncScriptsResourceWithStreamingResponse(self._page_shield.scripts) diff --git a/src/cloudflare/resources/page_shield/policies.py b/src/cloudflare/resources/page_shield/policies.py index 5f55c1bc288..2a0ecdd591b 100644 --- a/src/cloudflare/resources/page_shield/policies.py +++ b/src/cloudflare/resources/page_shield/policies.py @@ -24,19 +24,20 @@ AsyncPaginator, make_request_options, ) -from ...types.page_shield import PageShieldPolicy, policy_create_params, policy_update_params +from ...types.page_shield import policy_create_params, policy_update_params +from ...types.page_shield.policy import Policy -__all__ = ["Policies", "AsyncPolicies"] +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] -class Policies(SyncAPIResource): +class PoliciesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PoliciesWithRawResponse: - return PoliciesWithRawResponse(self) + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PoliciesWithStreamingResponse: - return PoliciesWithStreamingResponse(self) + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self) def create( self, @@ -53,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldPolicy: + ) -> Policy: """ Create a Page Shield policy. @@ -96,7 +97,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PageShieldPolicy, + cast_to=Policy, ) def update( @@ -115,7 +116,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldPolicy: + ) -> Policy: """ Update a Page Shield policy by ID. @@ -162,7 +163,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PageShieldPolicy, + cast_to=Policy, ) def list( @@ -175,7 +176,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[PageShieldPolicy]: + ) -> SyncSinglePage[Policy]: """ Lists all Page Shield policies. @@ -194,11 +195,11 @@ 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}/page_shield/policies", - page=SyncSinglePage[PageShieldPolicy], + page=SyncSinglePage[Policy], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=PageShieldPolicy, + model=Policy, ) def delete( @@ -253,7 +254,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldPolicy: + ) -> Policy: """ Fetches a Page Shield policy by ID. @@ -279,18 +280,18 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PageShieldPolicy, + cast_to=Policy, ) -class AsyncPolicies(AsyncAPIResource): +class AsyncPoliciesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPoliciesWithRawResponse: - return AsyncPoliciesWithRawResponse(self) + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPoliciesWithStreamingResponse: - return AsyncPoliciesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self) async def create( self, @@ -307,7 +308,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldPolicy: + ) -> Policy: """ Create a Page Shield policy. @@ -350,7 +351,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PageShieldPolicy, + cast_to=Policy, ) async def update( @@ -369,7 +370,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldPolicy: + ) -> Policy: """ Update a Page Shield policy by ID. @@ -416,7 +417,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PageShieldPolicy, + cast_to=Policy, ) def list( @@ -429,7 +430,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PageShieldPolicy, AsyncSinglePage[PageShieldPolicy]]: + ) -> AsyncPaginator[Policy, AsyncSinglePage[Policy]]: """ Lists all Page Shield policies. @@ -448,11 +449,11 @@ 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}/page_shield/policies", - page=AsyncSinglePage[PageShieldPolicy], + page=AsyncSinglePage[Policy], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=PageShieldPolicy, + model=Policy, ) async def delete( @@ -507,7 +508,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldPolicy: + ) -> Policy: """ Fetches a Page Shield policy by ID. @@ -533,12 +534,12 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PageShieldPolicy, + cast_to=Policy, ) -class PoliciesWithRawResponse: - def __init__(self, policies: Policies) -> None: +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: self._policies = policies self.create = to_raw_response_wrapper( @@ -558,8 +559,8 @@ def __init__(self, policies: Policies) -> None: ) -class AsyncPoliciesWithRawResponse: - def __init__(self, policies: AsyncPolicies) -> None: +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: self._policies = policies self.create = async_to_raw_response_wrapper( @@ -579,8 +580,8 @@ def __init__(self, policies: AsyncPolicies) -> None: ) -class PoliciesWithStreamingResponse: - def __init__(self, policies: Policies) -> None: +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: self._policies = policies self.create = to_streamed_response_wrapper( @@ -600,8 +601,8 @@ def __init__(self, policies: Policies) -> None: ) -class AsyncPoliciesWithStreamingResponse: - def __init__(self, policies: AsyncPolicies) -> None: +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: self._policies = policies self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/page_shield/scripts.py b/src/cloudflare/resources/page_shield/scripts.py index 58d201d5e36..147bef3320b 100644 --- a/src/cloudflare/resources/page_shield/scripts.py +++ b/src/cloudflare/resources/page_shield/scripts.py @@ -21,19 +21,21 @@ AsyncPaginator, make_request_options, ) -from ...types.page_shield import PageShieldScript, ScriptGetResponse, script_list_params +from ...types.page_shield import script_list_params +from ...types.page_shield.script import Script +from ...types.page_shield.script_get_response import ScriptGetResponse -__all__ = ["Scripts", "AsyncScripts"] +__all__ = ["ScriptsResource", "AsyncScriptsResource"] -class Scripts(SyncAPIResource): +class ScriptsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ScriptsWithRawResponse: - return ScriptsWithRawResponse(self) + def with_raw_response(self) -> ScriptsResourceWithRawResponse: + return ScriptsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ScriptsWithStreamingResponse: - return ScriptsWithStreamingResponse(self) + def with_streaming_response(self) -> ScriptsResourceWithStreamingResponse: + return ScriptsResourceWithStreamingResponse(self) def list( self, @@ -58,7 +60,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[PageShieldScript]: + ) -> SyncSinglePage[Script]: """ Lists all scripts detected by Page Shield. @@ -128,7 +130,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}/page_shield/scripts", - page=SyncSinglePage[PageShieldScript], + page=SyncSinglePage[Script], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -153,7 +155,7 @@ def list( script_list_params.ScriptListParams, ), ), - model=PageShieldScript, + model=Script, ) def get( @@ -197,14 +199,14 @@ def get( ) -class AsyncScripts(AsyncAPIResource): +class AsyncScriptsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncScriptsWithRawResponse: - return AsyncScriptsWithRawResponse(self) + def with_raw_response(self) -> AsyncScriptsResourceWithRawResponse: + return AsyncScriptsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncScriptsWithStreamingResponse: - return AsyncScriptsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncScriptsResourceWithStreamingResponse: + return AsyncScriptsResourceWithStreamingResponse(self) def list( self, @@ -229,7 +231,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PageShieldScript, AsyncSinglePage[PageShieldScript]]: + ) -> AsyncPaginator[Script, AsyncSinglePage[Script]]: """ Lists all scripts detected by Page Shield. @@ -299,7 +301,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}/page_shield/scripts", - page=AsyncSinglePage[PageShieldScript], + page=AsyncSinglePage[Script], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -324,7 +326,7 @@ def list( script_list_params.ScriptListParams, ), ), - model=PageShieldScript, + model=Script, ) async def get( @@ -368,8 +370,8 @@ async def get( ) -class ScriptsWithRawResponse: - def __init__(self, scripts: Scripts) -> None: +class ScriptsResourceWithRawResponse: + def __init__(self, scripts: ScriptsResource) -> None: self._scripts = scripts self.list = to_raw_response_wrapper( @@ -380,8 +382,8 @@ def __init__(self, scripts: Scripts) -> None: ) -class AsyncScriptsWithRawResponse: - def __init__(self, scripts: AsyncScripts) -> None: +class AsyncScriptsResourceWithRawResponse: + def __init__(self, scripts: AsyncScriptsResource) -> None: self._scripts = scripts self.list = async_to_raw_response_wrapper( @@ -392,8 +394,8 @@ def __init__(self, scripts: AsyncScripts) -> None: ) -class ScriptsWithStreamingResponse: - def __init__(self, scripts: Scripts) -> None: +class ScriptsResourceWithStreamingResponse: + def __init__(self, scripts: ScriptsResource) -> None: self._scripts = scripts self.list = to_streamed_response_wrapper( @@ -404,8 +406,8 @@ def __init__(self, scripts: Scripts) -> None: ) -class AsyncScriptsWithStreamingResponse: - def __init__(self, scripts: AsyncScripts) -> None: +class AsyncScriptsResourceWithStreamingResponse: + def __init__(self, scripts: AsyncScriptsResource) -> None: self._scripts = scripts self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/pagerules/__init__.py b/src/cloudflare/resources/pagerules/__init__.py index 1a849dd3594..d1c6434816b 100644 --- a/src/cloudflare/resources/pagerules/__init__.py +++ b/src/cloudflare/resources/pagerules/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .pagerules import ( - Pagerules, - AsyncPagerules, - PagerulesWithRawResponse, - AsyncPagerulesWithRawResponse, - PagerulesWithStreamingResponse, - AsyncPagerulesWithStreamingResponse, + PagerulesResource, + AsyncPagerulesResource, + PagerulesResourceWithRawResponse, + AsyncPagerulesResourceWithRawResponse, + PagerulesResourceWithStreamingResponse, + AsyncPagerulesResourceWithStreamingResponse, ) __all__ = [ - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Pagerules", - "AsyncPagerules", - "PagerulesWithRawResponse", - "AsyncPagerulesWithRawResponse", - "PagerulesWithStreamingResponse", - "AsyncPagerulesWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "PagerulesResource", + "AsyncPagerulesResource", + "PagerulesResourceWithRawResponse", + "AsyncPagerulesResourceWithRawResponse", + "PagerulesResourceWithStreamingResponse", + "AsyncPagerulesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/pagerules/pagerules.py b/src/cloudflare/resources/pagerules/pagerules.py index 6a59729af96..cc4dc3a4bdf 100644 --- a/src/cloudflare/resources/pagerules/pagerules.py +++ b/src/cloudflare/resources/pagerules/pagerules.py @@ -7,30 +7,18 @@ import httpx -from ...types import ( - PageruleGetResponse, - PageruleEditResponse, - PageruleListResponse, - PageruleCreateResponse, - PageruleDeleteResponse, - PageruleUpdateResponse, - pagerule_edit_params, - pagerule_list_params, - pagerule_create_params, - pagerule_update_params, -) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, async_maybe_transform, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -44,29 +32,44 @@ from ..._base_client import ( make_request_options, ) +from ...types.pagerules import ( + pagerule_edit_params, + pagerule_list_params, + pagerule_create_params, + pagerule_delete_params, + pagerule_update_params, +) +from ...types.pagerules.route_param import RouteParam +from ...types.pagerules.target_param import TargetParam +from ...types.pagerules.pagerule_get_response import PageruleGetResponse +from ...types.pagerules.pagerule_edit_response import PageruleEditResponse +from ...types.pagerules.pagerule_list_response import PageruleListResponse +from ...types.pagerules.pagerule_create_response import PageruleCreateResponse +from ...types.pagerules.pagerule_delete_response import PageruleDeleteResponse +from ...types.pagerules.pagerule_update_response import PageruleUpdateResponse -__all__ = ["Pagerules", "AsyncPagerules"] +__all__ = ["PagerulesResource", "AsyncPagerulesResource"] -class Pagerules(SyncAPIResource): +class PagerulesResource(SyncAPIResource): @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def with_raw_response(self) -> PagerulesWithRawResponse: - return PagerulesWithRawResponse(self) + def with_raw_response(self) -> PagerulesResourceWithRawResponse: + return PagerulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PagerulesWithStreamingResponse: - return PagerulesWithStreamingResponse(self) + def with_streaming_response(self) -> PagerulesResourceWithStreamingResponse: + return PagerulesResourceWithStreamingResponse(self) def create( self, *, zone_id: str, - actions: Iterable[pagerule_create_params.Action], - targets: Iterable[pagerule_create_params.Target], + actions: Iterable[RouteParam], + targets: Iterable[TargetParam], priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -123,7 +126,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PageruleCreateResponse] @@ -136,8 +139,8 @@ def update( pagerule_id: str, *, zone_id: str, - actions: Iterable[pagerule_update_params.Action], - targets: Iterable[pagerule_update_params.Target], + actions: Iterable[RouteParam], + targets: Iterable[TargetParam], priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -200,7 +203,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PageruleUpdateResponse] @@ -264,7 +267,7 @@ def list( }, pagerule_list_params.PageruleListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleListResponse]._unwrapper, ), cast_to=cast(Type[PageruleListResponse], ResultWrapper[PageruleListResponse]), ) @@ -274,6 +277,7 @@ def delete( pagerule_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -303,12 +307,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `pagerule_id` but received {pagerule_id!r}") return self._delete( f"/zones/{zone_id}/pagerules/{pagerule_id}", + body=maybe_transform(body, pagerule_delete_params.PageruleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PageruleDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PageruleDeleteResponse]], ResultWrapper[PageruleDeleteResponse]), ) @@ -318,10 +323,10 @@ def edit( pagerule_id: str, *, zone_id: str, - actions: Iterable[pagerule_edit_params.Action] | NotGiven = NOT_GIVEN, + actions: Iterable[RouteParam] | NotGiven = NOT_GIVEN, priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, - targets: Iterable[pagerule_edit_params.Target] | NotGiven = NOT_GIVEN, + targets: Iterable[TargetParam] | 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, @@ -380,7 +385,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PageruleEditResponse] @@ -429,7 +434,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PageruleGetResponse] @@ -438,25 +443,25 @@ def get( ) -class AsyncPagerules(AsyncAPIResource): +class AsyncPagerulesResource(AsyncAPIResource): @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPagerulesWithRawResponse: - return AsyncPagerulesWithRawResponse(self) + def with_raw_response(self) -> AsyncPagerulesResourceWithRawResponse: + return AsyncPagerulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPagerulesWithStreamingResponse: - return AsyncPagerulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPagerulesResourceWithStreamingResponse: + return AsyncPagerulesResourceWithStreamingResponse(self) async def create( self, *, zone_id: str, - actions: Iterable[pagerule_create_params.Action], - targets: Iterable[pagerule_create_params.Target], + actions: Iterable[RouteParam], + targets: Iterable[TargetParam], priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -513,7 +518,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PageruleCreateResponse] @@ -526,8 +531,8 @@ async def update( pagerule_id: str, *, zone_id: str, - actions: Iterable[pagerule_update_params.Action], - targets: Iterable[pagerule_update_params.Target], + actions: Iterable[RouteParam], + targets: Iterable[TargetParam], priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -590,7 +595,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PageruleUpdateResponse] @@ -654,7 +659,7 @@ async def list( }, pagerule_list_params.PageruleListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleListResponse]._unwrapper, ), cast_to=cast(Type[PageruleListResponse], ResultWrapper[PageruleListResponse]), ) @@ -664,6 +669,7 @@ async def delete( pagerule_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -693,12 +699,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pagerule_id` but received {pagerule_id!r}") return await self._delete( f"/zones/{zone_id}/pagerules/{pagerule_id}", + body=await async_maybe_transform(body, pagerule_delete_params.PageruleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PageruleDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PageruleDeleteResponse]], ResultWrapper[PageruleDeleteResponse]), ) @@ -708,10 +715,10 @@ async def edit( pagerule_id: str, *, zone_id: str, - actions: Iterable[pagerule_edit_params.Action] | NotGiven = NOT_GIVEN, + actions: Iterable[RouteParam] | NotGiven = NOT_GIVEN, priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, - targets: Iterable[pagerule_edit_params.Target] | NotGiven = NOT_GIVEN, + targets: Iterable[TargetParam] | 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, @@ -770,7 +777,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PageruleEditResponse] @@ -819,7 +826,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PageruleGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PageruleGetResponse] @@ -828,8 +835,8 @@ async def get( ) -class PagerulesWithRawResponse: - def __init__(self, pagerules: Pagerules) -> None: +class PagerulesResourceWithRawResponse: + def __init__(self, pagerules: PagerulesResource) -> None: self._pagerules = pagerules self.create = to_raw_response_wrapper( @@ -852,12 +859,12 @@ def __init__(self, pagerules: Pagerules) -> None: ) @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._pagerules.settings) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._pagerules.settings) -class AsyncPagerulesWithRawResponse: - def __init__(self, pagerules: AsyncPagerules) -> None: +class AsyncPagerulesResourceWithRawResponse: + def __init__(self, pagerules: AsyncPagerulesResource) -> None: self._pagerules = pagerules self.create = async_to_raw_response_wrapper( @@ -880,12 +887,12 @@ def __init__(self, pagerules: AsyncPagerules) -> None: ) @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._pagerules.settings) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._pagerules.settings) -class PagerulesWithStreamingResponse: - def __init__(self, pagerules: Pagerules) -> None: +class PagerulesResourceWithStreamingResponse: + def __init__(self, pagerules: PagerulesResource) -> None: self._pagerules = pagerules self.create = to_streamed_response_wrapper( @@ -908,12 +915,12 @@ def __init__(self, pagerules: Pagerules) -> None: ) @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._pagerules.settings) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._pagerules.settings) -class AsyncPagerulesWithStreamingResponse: - def __init__(self, pagerules: AsyncPagerules) -> None: +class AsyncPagerulesResourceWithStreamingResponse: + def __init__(self, pagerules: AsyncPagerulesResource) -> None: self._pagerules = pagerules self.create = async_to_streamed_response_wrapper( @@ -936,5 +943,5 @@ def __init__(self, pagerules: AsyncPagerules) -> None: ) @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._pagerules.settings) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._pagerules.settings) diff --git a/src/cloudflare/resources/pagerules/settings.py b/src/cloudflare/resources/pagerules/settings.py index d78d2708c42..b89f657bbbb 100644 --- a/src/cloudflare/resources/pagerules/settings.py +++ b/src/cloudflare/resources/pagerules/settings.py @@ -19,19 +19,19 @@ from ..._base_client import ( make_request_options, ) -from ...types.pagerules import ZonePageruleSettings +from ...types.pagerules.setting_list_response import SettingListResponse -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def list( self, @@ -43,7 +43,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZonePageruleSettings: + ) -> SettingListResponse: """ Returns a list of settings (and their details) that Page Rules can apply to matching requests. @@ -68,20 +68,20 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingListResponse]._unwrapper, ), - cast_to=cast(Type[ZonePageruleSettings], ResultWrapper[ZonePageruleSettings]), + cast_to=cast(Type[SettingListResponse], ResultWrapper[SettingListResponse]), ) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def list( self, @@ -93,7 +93,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZonePageruleSettings: + ) -> SettingListResponse: """ Returns a list of settings (and their details) that Page Rules can apply to matching requests. @@ -118,14 +118,14 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingListResponse]._unwrapper, ), - cast_to=cast(Type[ZonePageruleSettings], ResultWrapper[ZonePageruleSettings]), + cast_to=cast(Type[SettingListResponse], ResultWrapper[SettingListResponse]), ) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.list = to_raw_response_wrapper( @@ -133,8 +133,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.list = async_to_raw_response_wrapper( @@ -142,8 +142,8 @@ def __init__(self, settings: AsyncSettings) -> None: ) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.list = to_streamed_response_wrapper( @@ -151,8 +151,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/pages/__init__.py b/src/cloudflare/resources/pages/__init__.py index 92decc9eec2..e810153f642 100644 --- a/src/cloudflare/resources/pages/__init__.py +++ b/src/cloudflare/resources/pages/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .pages import ( - Pages, - AsyncPages, - PagesWithRawResponse, - AsyncPagesWithRawResponse, - PagesWithStreamingResponse, - AsyncPagesWithStreamingResponse, + PagesResource, + AsyncPagesResource, + PagesResourceWithRawResponse, + AsyncPagesResourceWithRawResponse, + PagesResourceWithStreamingResponse, + AsyncPagesResourceWithStreamingResponse, ) from .projects import ( - Projects, - AsyncProjects, - ProjectsWithRawResponse, - AsyncProjectsWithRawResponse, - ProjectsWithStreamingResponse, - AsyncProjectsWithStreamingResponse, + ProjectsResource, + AsyncProjectsResource, + ProjectsResourceWithRawResponse, + AsyncProjectsResourceWithRawResponse, + ProjectsResourceWithStreamingResponse, + AsyncProjectsResourceWithStreamingResponse, ) __all__ = [ - "Projects", - "AsyncProjects", - "ProjectsWithRawResponse", - "AsyncProjectsWithRawResponse", - "ProjectsWithStreamingResponse", - "AsyncProjectsWithStreamingResponse", - "Pages", - "AsyncPages", - "PagesWithRawResponse", - "AsyncPagesWithRawResponse", - "PagesWithStreamingResponse", - "AsyncPagesWithStreamingResponse", + "ProjectsResource", + "AsyncProjectsResource", + "ProjectsResourceWithRawResponse", + "AsyncProjectsResourceWithRawResponse", + "ProjectsResourceWithStreamingResponse", + "AsyncProjectsResourceWithStreamingResponse", + "PagesResource", + "AsyncPagesResource", + "PagesResourceWithRawResponse", + "AsyncPagesResourceWithRawResponse", + "PagesResourceWithStreamingResponse", + "AsyncPagesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/pages/pages.py b/src/cloudflare/resources/pages/pages.py index c34b2adadd3..e0367240c49 100644 --- a/src/cloudflare/resources/pages/pages.py +++ b/src/cloudflare/resources/pages/pages.py @@ -3,79 +3,79 @@ from __future__ import annotations from .projects import ( - Projects, - AsyncProjects, - ProjectsWithRawResponse, - AsyncProjectsWithRawResponse, - ProjectsWithStreamingResponse, - AsyncProjectsWithStreamingResponse, + ProjectsResource, + AsyncProjectsResource, + ProjectsResourceWithRawResponse, + AsyncProjectsResourceWithRawResponse, + ProjectsResourceWithStreamingResponse, + AsyncProjectsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .projects.projects import Projects, AsyncProjects +from .projects.projects import ProjectsResource, AsyncProjectsResource -__all__ = ["Pages", "AsyncPages"] +__all__ = ["PagesResource", "AsyncPagesResource"] -class Pages(SyncAPIResource): +class PagesResource(SyncAPIResource): @cached_property - def projects(self) -> Projects: - return Projects(self._client) + def projects(self) -> ProjectsResource: + return ProjectsResource(self._client) @cached_property - def with_raw_response(self) -> PagesWithRawResponse: - return PagesWithRawResponse(self) + def with_raw_response(self) -> PagesResourceWithRawResponse: + return PagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PagesWithStreamingResponse: - return PagesWithStreamingResponse(self) + def with_streaming_response(self) -> PagesResourceWithStreamingResponse: + return PagesResourceWithStreamingResponse(self) -class AsyncPages(AsyncAPIResource): +class AsyncPagesResource(AsyncAPIResource): @cached_property - def projects(self) -> AsyncProjects: - return AsyncProjects(self._client) + def projects(self) -> AsyncProjectsResource: + return AsyncProjectsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPagesWithRawResponse: - return AsyncPagesWithRawResponse(self) + def with_raw_response(self) -> AsyncPagesResourceWithRawResponse: + return AsyncPagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPagesWithStreamingResponse: - return AsyncPagesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPagesResourceWithStreamingResponse: + return AsyncPagesResourceWithStreamingResponse(self) -class PagesWithRawResponse: - def __init__(self, pages: Pages) -> None: +class PagesResourceWithRawResponse: + def __init__(self, pages: PagesResource) -> None: self._pages = pages @cached_property - def projects(self) -> ProjectsWithRawResponse: - return ProjectsWithRawResponse(self._pages.projects) + def projects(self) -> ProjectsResourceWithRawResponse: + return ProjectsResourceWithRawResponse(self._pages.projects) -class AsyncPagesWithRawResponse: - def __init__(self, pages: AsyncPages) -> None: +class AsyncPagesResourceWithRawResponse: + def __init__(self, pages: AsyncPagesResource) -> None: self._pages = pages @cached_property - def projects(self) -> AsyncProjectsWithRawResponse: - return AsyncProjectsWithRawResponse(self._pages.projects) + def projects(self) -> AsyncProjectsResourceWithRawResponse: + return AsyncProjectsResourceWithRawResponse(self._pages.projects) -class PagesWithStreamingResponse: - def __init__(self, pages: Pages) -> None: +class PagesResourceWithStreamingResponse: + def __init__(self, pages: PagesResource) -> None: self._pages = pages @cached_property - def projects(self) -> ProjectsWithStreamingResponse: - return ProjectsWithStreamingResponse(self._pages.projects) + def projects(self) -> ProjectsResourceWithStreamingResponse: + return ProjectsResourceWithStreamingResponse(self._pages.projects) -class AsyncPagesWithStreamingResponse: - def __init__(self, pages: AsyncPages) -> None: +class AsyncPagesResourceWithStreamingResponse: + def __init__(self, pages: AsyncPagesResource) -> None: self._pages = pages @cached_property - def projects(self) -> AsyncProjectsWithStreamingResponse: - return AsyncProjectsWithStreamingResponse(self._pages.projects) + def projects(self) -> AsyncProjectsResourceWithStreamingResponse: + return AsyncProjectsResourceWithStreamingResponse(self._pages.projects) diff --git a/src/cloudflare/resources/pages/projects/__init__.py b/src/cloudflare/resources/pages/projects/__init__.py index f91034d9c54..5d89924de8e 100644 --- a/src/cloudflare/resources/pages/projects/__init__.py +++ b/src/cloudflare/resources/pages/projects/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) from .projects import ( - Projects, - AsyncProjects, - ProjectsWithRawResponse, - AsyncProjectsWithRawResponse, - ProjectsWithStreamingResponse, - AsyncProjectsWithStreamingResponse, + ProjectsResource, + AsyncProjectsResource, + ProjectsResourceWithRawResponse, + AsyncProjectsResourceWithRawResponse, + ProjectsResourceWithStreamingResponse, + AsyncProjectsResourceWithStreamingResponse, ) from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, ) __all__ = [ - "Deployments", - "AsyncDeployments", - "DeploymentsWithRawResponse", - "AsyncDeploymentsWithRawResponse", - "DeploymentsWithStreamingResponse", - "AsyncDeploymentsWithStreamingResponse", - "Domains", - "AsyncDomains", - "DomainsWithRawResponse", - "AsyncDomainsWithRawResponse", - "DomainsWithStreamingResponse", - "AsyncDomainsWithStreamingResponse", - "Projects", - "AsyncProjects", - "ProjectsWithRawResponse", - "AsyncProjectsWithRawResponse", - "ProjectsWithStreamingResponse", - "AsyncProjectsWithStreamingResponse", + "DeploymentsResource", + "AsyncDeploymentsResource", + "DeploymentsResourceWithRawResponse", + "AsyncDeploymentsResourceWithRawResponse", + "DeploymentsResourceWithStreamingResponse", + "AsyncDeploymentsResourceWithStreamingResponse", + "DomainsResource", + "AsyncDomainsResource", + "DomainsResourceWithRawResponse", + "AsyncDomainsResourceWithRawResponse", + "DomainsResourceWithStreamingResponse", + "AsyncDomainsResourceWithStreamingResponse", + "ProjectsResource", + "AsyncProjectsResource", + "ProjectsResourceWithRawResponse", + "AsyncProjectsResourceWithRawResponse", + "ProjectsResourceWithStreamingResponse", + "AsyncProjectsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/pages/projects/deployments/__init__.py b/src/cloudflare/resources/pages/projects/deployments/__init__.py index 3f58dc4cd0e..ef7c42c710f 100644 --- a/src/cloudflare/resources/pages/projects/deployments/__init__.py +++ b/src/cloudflare/resources/pages/projects/deployments/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .history import ( - History, - AsyncHistory, - HistoryWithRawResponse, - AsyncHistoryWithRawResponse, - HistoryWithStreamingResponse, - AsyncHistoryWithStreamingResponse, + HistoryResource, + AsyncHistoryResource, + HistoryResourceWithRawResponse, + AsyncHistoryResourceWithRawResponse, + HistoryResourceWithStreamingResponse, + AsyncHistoryResourceWithStreamingResponse, ) from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, ) __all__ = [ - "History", - "AsyncHistory", - "HistoryWithRawResponse", - "AsyncHistoryWithRawResponse", - "HistoryWithStreamingResponse", - "AsyncHistoryWithStreamingResponse", - "Deployments", - "AsyncDeployments", - "DeploymentsWithRawResponse", - "AsyncDeploymentsWithRawResponse", - "DeploymentsWithStreamingResponse", - "AsyncDeploymentsWithStreamingResponse", + "HistoryResource", + "AsyncHistoryResource", + "HistoryResourceWithRawResponse", + "AsyncHistoryResourceWithRawResponse", + "HistoryResourceWithStreamingResponse", + "AsyncHistoryResourceWithStreamingResponse", + "DeploymentsResource", + "AsyncDeploymentsResource", + "DeploymentsResourceWithRawResponse", + "AsyncDeploymentsResourceWithRawResponse", + "DeploymentsResourceWithStreamingResponse", + "AsyncDeploymentsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/pages/projects/deployments/deployments.py b/src/cloudflare/resources/pages/projects/deployments/deployments.py index 114d015e84d..afc233c1feb 100644 --- a/src/cloudflare/resources/pages/projects/deployments/deployments.py +++ b/src/cloudflare/resources/pages/projects/deployments/deployments.py @@ -8,12 +8,12 @@ import httpx from .history import ( - History, - AsyncHistory, - HistoryWithRawResponse, - AsyncHistoryWithRawResponse, - HistoryWithStreamingResponse, - AsyncHistoryWithStreamingResponse, + HistoryResource, + AsyncHistoryResource, + HistoryResourceWithRawResponse, + AsyncHistoryResourceWithRawResponse, + HistoryResourceWithStreamingResponse, + AsyncHistoryResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -30,29 +30,35 @@ ) from ....._wrappers import ResultWrapper from .....pagination import SyncSinglePage, AsyncSinglePage -from .....types.pages import PagesDeployments -from .history.history import History, AsyncHistory +from .history.history import HistoryResource, AsyncHistoryResource from ....._base_client import ( AsyncPaginator, make_request_options, ) -from .....types.pages.projects import deployment_list_params, deployment_create_params +from .....types.pages.projects import ( + deployment_list_params, + deployment_retry_params, + deployment_create_params, + deployment_delete_params, + deployment_rollback_params, +) +from .....types.pages.deployment import Deployment -__all__ = ["Deployments", "AsyncDeployments"] +__all__ = ["DeploymentsResource", "AsyncDeploymentsResource"] -class Deployments(SyncAPIResource): +class DeploymentsResource(SyncAPIResource): @cached_property - def history(self) -> History: - return History(self._client) + def history(self) -> HistoryResource: + return HistoryResource(self._client) @cached_property - def with_raw_response(self) -> DeploymentsWithRawResponse: - return DeploymentsWithRawResponse(self) + def with_raw_response(self) -> DeploymentsResourceWithRawResponse: + return DeploymentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DeploymentsWithStreamingResponse: - return DeploymentsWithStreamingResponse(self) + def with_streaming_response(self) -> DeploymentsResourceWithStreamingResponse: + return DeploymentsResourceWithStreamingResponse(self) def create( self, @@ -66,7 +72,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagesDeployments: + ) -> Deployment: """Start a new deployment from production. The repository and account must have @@ -100,9 +106,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Deployment]._unwrapper, ), - cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), + cast_to=cast(Type[Deployment], ResultWrapper[Deployment]), ) def list( @@ -117,7 +123,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[PagesDeployments]: + ) -> SyncSinglePage[Deployment]: """ Fetch a list of project deployments. @@ -142,7 +148,7 @@ def list( raise ValueError(f"Expected a non-empty value for `project_name` but received {project_name!r}") return self._get_api_list( f"/accounts/{account_id}/pages/projects/{project_name}/deployments", - page=SyncSinglePage[PagesDeployments], + page=SyncSinglePage[Deployment], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -150,7 +156,7 @@ def list( timeout=timeout, query=maybe_transform({"env": env}, deployment_list_params.DeploymentListParams), ), - model=PagesDeployments, + model=Deployment, ) def delete( @@ -159,6 +165,7 @@ def delete( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -192,6 +199,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") return self._delete( f"/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}", + body=maybe_transform(body, deployment_delete_params.DeploymentDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,7 +218,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagesDeployments: + ) -> Deployment: """ Fetch information about a deployment. @@ -242,9 +250,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Deployment]._unwrapper, ), - cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), + cast_to=cast(Type[Deployment], ResultWrapper[Deployment]), ) def retry( @@ -253,13 +261,14 @@ def retry( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> PagesDeployments: + ) -> Deployment: """ Retry a previous deployment. @@ -286,14 +295,15 @@ def retry( raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") return self._post( f"/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/retry", + body=maybe_transform(body, deployment_retry_params.DeploymentRetryParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Deployment]._unwrapper, ), - cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), + cast_to=cast(Type[Deployment], ResultWrapper[Deployment]), ) def rollback( @@ -302,13 +312,14 @@ def rollback( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> PagesDeployments: + ) -> Deployment: """Rollback the production deployment to a previous deployment. You can only @@ -337,29 +348,30 @@ def rollback( raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") return self._post( f"/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/rollback", + body=maybe_transform(body, deployment_rollback_params.DeploymentRollbackParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Deployment]._unwrapper, ), - cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), + cast_to=cast(Type[Deployment], ResultWrapper[Deployment]), ) -class AsyncDeployments(AsyncAPIResource): +class AsyncDeploymentsResource(AsyncAPIResource): @cached_property - def history(self) -> AsyncHistory: - return AsyncHistory(self._client) + def history(self) -> AsyncHistoryResource: + return AsyncHistoryResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDeploymentsWithRawResponse: - return AsyncDeploymentsWithRawResponse(self) + def with_raw_response(self) -> AsyncDeploymentsResourceWithRawResponse: + return AsyncDeploymentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDeploymentsWithStreamingResponse: - return AsyncDeploymentsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDeploymentsResourceWithStreamingResponse: + return AsyncDeploymentsResourceWithStreamingResponse(self) async def create( self, @@ -373,7 +385,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagesDeployments: + ) -> Deployment: """Start a new deployment from production. The repository and account must have @@ -407,9 +419,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Deployment]._unwrapper, ), - cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), + cast_to=cast(Type[Deployment], ResultWrapper[Deployment]), ) def list( @@ -424,7 +436,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PagesDeployments, AsyncSinglePage[PagesDeployments]]: + ) -> AsyncPaginator[Deployment, AsyncSinglePage[Deployment]]: """ Fetch a list of project deployments. @@ -449,7 +461,7 @@ def list( raise ValueError(f"Expected a non-empty value for `project_name` but received {project_name!r}") return self._get_api_list( f"/accounts/{account_id}/pages/projects/{project_name}/deployments", - page=AsyncSinglePage[PagesDeployments], + page=AsyncSinglePage[Deployment], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -457,7 +469,7 @@ def list( timeout=timeout, query=maybe_transform({"env": env}, deployment_list_params.DeploymentListParams), ), - model=PagesDeployments, + model=Deployment, ) async def delete( @@ -466,6 +478,7 @@ async def delete( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,6 +512,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") return await self._delete( f"/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}", + body=await async_maybe_transform(body, deployment_delete_params.DeploymentDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,7 +531,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagesDeployments: + ) -> Deployment: """ Fetch information about a deployment. @@ -549,9 +563,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Deployment]._unwrapper, ), - cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), + cast_to=cast(Type[Deployment], ResultWrapper[Deployment]), ) async def retry( @@ -560,13 +574,14 @@ async def retry( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> PagesDeployments: + ) -> Deployment: """ Retry a previous deployment. @@ -593,14 +608,15 @@ async def retry( raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") return await self._post( f"/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/retry", + body=await async_maybe_transform(body, deployment_retry_params.DeploymentRetryParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Deployment]._unwrapper, ), - cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), + cast_to=cast(Type[Deployment], ResultWrapper[Deployment]), ) async def rollback( @@ -609,13 +625,14 @@ async def rollback( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> PagesDeployments: + ) -> Deployment: """Rollback the production deployment to a previous deployment. You can only @@ -644,19 +661,20 @@ async def rollback( raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") return await self._post( f"/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/rollback", + body=await async_maybe_transform(body, deployment_rollback_params.DeploymentRollbackParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Deployment]._unwrapper, ), - cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), + cast_to=cast(Type[Deployment], ResultWrapper[Deployment]), ) -class DeploymentsWithRawResponse: - def __init__(self, deployments: Deployments) -> None: +class DeploymentsResourceWithRawResponse: + def __init__(self, deployments: DeploymentsResource) -> None: self._deployments = deployments self.create = to_raw_response_wrapper( @@ -679,12 +697,12 @@ def __init__(self, deployments: Deployments) -> None: ) @cached_property - def history(self) -> HistoryWithRawResponse: - return HistoryWithRawResponse(self._deployments.history) + def history(self) -> HistoryResourceWithRawResponse: + return HistoryResourceWithRawResponse(self._deployments.history) -class AsyncDeploymentsWithRawResponse: - def __init__(self, deployments: AsyncDeployments) -> None: +class AsyncDeploymentsResourceWithRawResponse: + def __init__(self, deployments: AsyncDeploymentsResource) -> None: self._deployments = deployments self.create = async_to_raw_response_wrapper( @@ -707,12 +725,12 @@ def __init__(self, deployments: AsyncDeployments) -> None: ) @cached_property - def history(self) -> AsyncHistoryWithRawResponse: - return AsyncHistoryWithRawResponse(self._deployments.history) + def history(self) -> AsyncHistoryResourceWithRawResponse: + return AsyncHistoryResourceWithRawResponse(self._deployments.history) -class DeploymentsWithStreamingResponse: - def __init__(self, deployments: Deployments) -> None: +class DeploymentsResourceWithStreamingResponse: + def __init__(self, deployments: DeploymentsResource) -> None: self._deployments = deployments self.create = to_streamed_response_wrapper( @@ -735,12 +753,12 @@ def __init__(self, deployments: Deployments) -> None: ) @cached_property - def history(self) -> HistoryWithStreamingResponse: - return HistoryWithStreamingResponse(self._deployments.history) + def history(self) -> HistoryResourceWithStreamingResponse: + return HistoryResourceWithStreamingResponse(self._deployments.history) -class AsyncDeploymentsWithStreamingResponse: - def __init__(self, deployments: AsyncDeployments) -> None: +class AsyncDeploymentsResourceWithStreamingResponse: + def __init__(self, deployments: AsyncDeploymentsResource) -> None: self._deployments = deployments self.create = async_to_streamed_response_wrapper( @@ -763,5 +781,5 @@ def __init__(self, deployments: AsyncDeployments) -> None: ) @cached_property - def history(self) -> AsyncHistoryWithStreamingResponse: - return AsyncHistoryWithStreamingResponse(self._deployments.history) + def history(self) -> AsyncHistoryResourceWithStreamingResponse: + return AsyncHistoryResourceWithStreamingResponse(self._deployments.history) diff --git a/src/cloudflare/resources/pages/projects/deployments/history/__init__.py b/src/cloudflare/resources/pages/projects/deployments/history/__init__.py index 59c515d3016..a5b63015d9f 100644 --- a/src/cloudflare/resources/pages/projects/deployments/history/__init__.py +++ b/src/cloudflare/resources/pages/projects/deployments/history/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .logs import ( - Logs, - AsyncLogs, - LogsWithRawResponse, - AsyncLogsWithRawResponse, - LogsWithStreamingResponse, - AsyncLogsWithStreamingResponse, + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, ) from .history import ( - History, - AsyncHistory, - HistoryWithRawResponse, - AsyncHistoryWithRawResponse, - HistoryWithStreamingResponse, - AsyncHistoryWithStreamingResponse, + HistoryResource, + AsyncHistoryResource, + HistoryResourceWithRawResponse, + AsyncHistoryResourceWithRawResponse, + HistoryResourceWithStreamingResponse, + AsyncHistoryResourceWithStreamingResponse, ) __all__ = [ - "Logs", - "AsyncLogs", - "LogsWithRawResponse", - "AsyncLogsWithRawResponse", - "LogsWithStreamingResponse", - "AsyncLogsWithStreamingResponse", - "History", - "AsyncHistory", - "HistoryWithRawResponse", - "AsyncHistoryWithRawResponse", - "HistoryWithStreamingResponse", - "AsyncHistoryWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", + "HistoryResource", + "AsyncHistoryResource", + "HistoryResourceWithRawResponse", + "AsyncHistoryResourceWithRawResponse", + "HistoryResourceWithStreamingResponse", + "AsyncHistoryResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/pages/projects/deployments/history/history.py b/src/cloudflare/resources/pages/projects/deployments/history/history.py index e4c5a3babc5..7258c71fc9a 100644 --- a/src/cloudflare/resources/pages/projects/deployments/history/history.py +++ b/src/cloudflare/resources/pages/projects/deployments/history/history.py @@ -3,78 +3,78 @@ from __future__ import annotations from .logs import ( - Logs, - AsyncLogs, - LogsWithRawResponse, - AsyncLogsWithRawResponse, - LogsWithStreamingResponse, - AsyncLogsWithStreamingResponse, + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, ) from ......_compat import cached_property from ......_resource import SyncAPIResource, AsyncAPIResource -__all__ = ["History", "AsyncHistory"] +__all__ = ["HistoryResource", "AsyncHistoryResource"] -class History(SyncAPIResource): +class HistoryResource(SyncAPIResource): @cached_property - def logs(self) -> Logs: - return Logs(self._client) + def logs(self) -> LogsResource: + return LogsResource(self._client) @cached_property - def with_raw_response(self) -> HistoryWithRawResponse: - return HistoryWithRawResponse(self) + def with_raw_response(self) -> HistoryResourceWithRawResponse: + return HistoryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HistoryWithStreamingResponse: - return HistoryWithStreamingResponse(self) + def with_streaming_response(self) -> HistoryResourceWithStreamingResponse: + return HistoryResourceWithStreamingResponse(self) -class AsyncHistory(AsyncAPIResource): +class AsyncHistoryResource(AsyncAPIResource): @cached_property - def logs(self) -> AsyncLogs: - return AsyncLogs(self._client) + def logs(self) -> AsyncLogsResource: + return AsyncLogsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncHistoryWithRawResponse: - return AsyncHistoryWithRawResponse(self) + def with_raw_response(self) -> AsyncHistoryResourceWithRawResponse: + return AsyncHistoryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHistoryWithStreamingResponse: - return AsyncHistoryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHistoryResourceWithStreamingResponse: + return AsyncHistoryResourceWithStreamingResponse(self) -class HistoryWithRawResponse: - def __init__(self, history: History) -> None: +class HistoryResourceWithRawResponse: + def __init__(self, history: HistoryResource) -> None: self._history = history @cached_property - def logs(self) -> LogsWithRawResponse: - return LogsWithRawResponse(self._history.logs) + def logs(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self._history.logs) -class AsyncHistoryWithRawResponse: - def __init__(self, history: AsyncHistory) -> None: +class AsyncHistoryResourceWithRawResponse: + def __init__(self, history: AsyncHistoryResource) -> None: self._history = history @cached_property - def logs(self) -> AsyncLogsWithRawResponse: - return AsyncLogsWithRawResponse(self._history.logs) + def logs(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self._history.logs) -class HistoryWithStreamingResponse: - def __init__(self, history: History) -> None: +class HistoryResourceWithStreamingResponse: + def __init__(self, history: HistoryResource) -> None: self._history = history @cached_property - def logs(self) -> LogsWithStreamingResponse: - return LogsWithStreamingResponse(self._history.logs) + def logs(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self._history.logs) -class AsyncHistoryWithStreamingResponse: - def __init__(self, history: AsyncHistory) -> None: +class AsyncHistoryResourceWithStreamingResponse: + def __init__(self, history: AsyncHistoryResource) -> None: self._history = history @cached_property - def logs(self) -> AsyncLogsWithStreamingResponse: - return AsyncLogsWithStreamingResponse(self._history.logs) + def logs(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self._history.logs) diff --git a/src/cloudflare/resources/pages/projects/deployments/history/logs.py b/src/cloudflare/resources/pages/projects/deployments/history/logs.py index 16a9f3a2f75..b3a5e2aaf67 100644 --- a/src/cloudflare/resources/pages/projects/deployments/history/logs.py +++ b/src/cloudflare/resources/pages/projects/deployments/history/logs.py @@ -19,19 +19,19 @@ from ......_base_client import ( make_request_options, ) -from ......types.pages.projects.deployments.history import LogGetResponse +from ......types.pages.projects.deployments.history.log_get_response import LogGetResponse -__all__ = ["Logs", "AsyncLogs"] +__all__ = ["LogsResource", "AsyncLogsResource"] -class Logs(SyncAPIResource): +class LogsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LogsWithRawResponse: - return LogsWithRawResponse(self) + def with_raw_response(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LogsWithStreamingResponse: - return LogsWithStreamingResponse(self) + def with_streaming_response(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self) def get( self, @@ -79,7 +79,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LogGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[LogGetResponse] @@ -88,14 +88,14 @@ def get( ) -class AsyncLogs(AsyncAPIResource): +class AsyncLogsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLogsWithRawResponse: - return AsyncLogsWithRawResponse(self) + def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLogsWithStreamingResponse: - return AsyncLogsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self) async def get( self, @@ -143,7 +143,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LogGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[LogGetResponse] @@ -152,8 +152,8 @@ async def get( ) -class LogsWithRawResponse: - def __init__(self, logs: Logs) -> None: +class LogsResourceWithRawResponse: + def __init__(self, logs: LogsResource) -> None: self._logs = logs self.get = to_raw_response_wrapper( @@ -161,8 +161,8 @@ def __init__(self, logs: Logs) -> None: ) -class AsyncLogsWithRawResponse: - def __init__(self, logs: AsyncLogs) -> None: +class AsyncLogsResourceWithRawResponse: + def __init__(self, logs: AsyncLogsResource) -> None: self._logs = logs self.get = async_to_raw_response_wrapper( @@ -170,8 +170,8 @@ def __init__(self, logs: AsyncLogs) -> None: ) -class LogsWithStreamingResponse: - def __init__(self, logs: Logs) -> None: +class LogsResourceWithStreamingResponse: + def __init__(self, logs: LogsResource) -> None: self._logs = logs self.get = to_streamed_response_wrapper( @@ -179,8 +179,8 @@ def __init__(self, logs: Logs) -> None: ) -class AsyncLogsWithStreamingResponse: - def __init__(self, logs: AsyncLogs) -> None: +class AsyncLogsResourceWithStreamingResponse: + def __init__(self, logs: AsyncLogsResource) -> None: self._logs = logs self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/pages/projects/domains.py b/src/cloudflare/resources/pages/projects/domains.py index 41fdc48d87f..d968c436061 100644 --- a/src/cloudflare/resources/pages/projects/domains.py +++ b/src/cloudflare/resources/pages/projects/domains.py @@ -25,19 +25,22 @@ AsyncPaginator, make_request_options, ) -from ....types.pages.projects import DomainGetResponse, DomainEditResponse, DomainCreateResponse, domain_create_params +from ....types.pages.projects import domain_edit_params, domain_create_params, domain_delete_params +from ....types.pages.projects.domain_get_response import DomainGetResponse +from ....types.pages.projects.domain_edit_response import DomainEditResponse +from ....types.pages.projects.domain_create_response import DomainCreateResponse -__all__ = ["Domains", "AsyncDomains"] +__all__ = ["DomainsResource", "AsyncDomainsResource"] -class Domains(SyncAPIResource): +class DomainsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DomainsWithRawResponse: - return DomainsWithRawResponse(self) + def with_raw_response(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DomainsWithStreamingResponse: - return DomainsWithStreamingResponse(self) + def with_streaming_response(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self) def create( self, @@ -82,7 +85,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainCreateResponse] @@ -137,6 +140,7 @@ def delete( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -170,6 +174,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}") return self._delete( f"/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}", + body=maybe_transform(body, domain_delete_params.DomainDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,6 +187,7 @@ def edit( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -217,12 +223,13 @@ def edit( Optional[DomainEditResponse], self._patch( f"/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}", + body=maybe_transform(body, domain_edit_params.DomainEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainEditResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainEditResponse] @@ -276,7 +283,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainGetResponse] @@ -285,14 +292,14 @@ def get( ) -class AsyncDomains(AsyncAPIResource): +class AsyncDomainsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDomainsWithRawResponse: - return AsyncDomainsWithRawResponse(self) + def with_raw_response(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDomainsWithStreamingResponse: - return AsyncDomainsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self) async def create( self, @@ -337,7 +344,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainCreateResponse] @@ -392,6 +399,7 @@ async def delete( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -425,6 +433,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}") return await self._delete( f"/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}", + body=await async_maybe_transform(body, domain_delete_params.DomainDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,6 +446,7 @@ async def edit( *, account_id: str, project_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -472,12 +482,13 @@ async def edit( Optional[DomainEditResponse], await self._patch( f"/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}", + body=await async_maybe_transform(body, domain_edit_params.DomainEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainEditResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainEditResponse] @@ -531,7 +542,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainGetResponse] @@ -540,8 +551,8 @@ async def get( ) -class DomainsWithRawResponse: - def __init__(self, domains: Domains) -> None: +class DomainsResourceWithRawResponse: + def __init__(self, domains: DomainsResource) -> None: self._domains = domains self.create = to_raw_response_wrapper( @@ -561,8 +572,8 @@ def __init__(self, domains: Domains) -> None: ) -class AsyncDomainsWithRawResponse: - def __init__(self, domains: AsyncDomains) -> None: +class AsyncDomainsResourceWithRawResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: self._domains = domains self.create = async_to_raw_response_wrapper( @@ -582,8 +593,8 @@ def __init__(self, domains: AsyncDomains) -> None: ) -class DomainsWithStreamingResponse: - def __init__(self, domains: Domains) -> None: +class DomainsResourceWithStreamingResponse: + def __init__(self, domains: DomainsResource) -> None: self._domains = domains self.create = to_streamed_response_wrapper( @@ -603,8 +614,8 @@ def __init__(self, domains: Domains) -> None: ) -class AsyncDomainsWithStreamingResponse: - def __init__(self, domains: AsyncDomains) -> None: +class AsyncDomainsResourceWithStreamingResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: self._domains = domains self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/pages/projects/projects.py b/src/cloudflare/resources/pages/projects/projects.py index 9aaba8bcf16..d2090062d4f 100644 --- a/src/cloudflare/resources/pages/projects/projects.py +++ b/src/cloudflare/resources/pages/projects/projects.py @@ -7,12 +7,12 @@ import httpx from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -21,12 +21,12 @@ ) from ...._compat import cached_property from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -37,49 +37,46 @@ ) from ...._wrappers import ResultWrapper from ....pagination import SyncSinglePage, AsyncSinglePage -from ....types.pages import ( - PagesProjects, - PagesDeployments, - ProjectEditResponse, - PagesDeploymentsParam, - ProjectCreateResponse, - project_edit_params, - project_create_params, -) +from ....types.pages import Deployment, project_edit_params, project_create_params, project_delete_params from ...._base_client import ( AsyncPaginator, make_request_options, ) -from .deployments.deployments import Deployments, AsyncDeployments +from ....types.pages.project import Project +from .deployments.deployments import DeploymentsResource, AsyncDeploymentsResource +from ....types.pages.deployment import Deployment +from ....types.pages.deployment_param import DeploymentParam +from ....types.pages.project_edit_response import ProjectEditResponse +from ....types.pages.project_create_response import ProjectCreateResponse -__all__ = ["Projects", "AsyncProjects"] +__all__ = ["ProjectsResource", "AsyncProjectsResource"] -class Projects(SyncAPIResource): +class ProjectsResource(SyncAPIResource): @cached_property - def deployments(self) -> Deployments: - return Deployments(self._client) + def deployments(self) -> DeploymentsResource: + return DeploymentsResource(self._client) @cached_property - def domains(self) -> Domains: - return Domains(self._client) + def domains(self) -> DomainsResource: + return DomainsResource(self._client) @cached_property - def with_raw_response(self) -> ProjectsWithRawResponse: - return ProjectsWithRawResponse(self) + def with_raw_response(self) -> ProjectsResourceWithRawResponse: + return ProjectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ProjectsWithStreamingResponse: - return ProjectsWithStreamingResponse(self) + def with_streaming_response(self) -> ProjectsResourceWithStreamingResponse: + return ProjectsResourceWithStreamingResponse(self) def create( self, *, account_id: str, build_config: project_create_params.BuildConfig | NotGiven = NOT_GIVEN, - canonical_deployment: PagesDeploymentsParam | NotGiven = NOT_GIVEN, + canonical_deployment: DeploymentParam | NotGiven = NOT_GIVEN, deployment_configs: project_create_params.DeploymentConfigs | NotGiven = NOT_GIVEN, - latest_deployment: PagesDeploymentsParam | NotGiven = NOT_GIVEN, + latest_deployment: DeploymentParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, production_branch: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -133,7 +130,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProjectCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProjectCreateResponse] @@ -151,7 +148,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[PagesDeployments]: + ) -> SyncSinglePage[Deployment]: """ Fetch a list of all user projects. @@ -170,11 +167,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/pages/projects", - page=SyncSinglePage[PagesDeployments], + page=SyncSinglePage[Deployment], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=PagesDeployments, + model=Deployment, ) def delete( @@ -182,6 +179,7 @@ def delete( project_name: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -211,6 +209,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `project_name` but received {project_name!r}") return self._delete( f"/accounts/{account_id}/pages/projects/{project_name}", + body=maybe_transform(body, project_delete_params.ProjectDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -262,7 +261,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProjectEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProjectEditResponse] @@ -281,7 +280,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagesProjects: + ) -> Project: """ Fetch a project by name. @@ -309,9 +308,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Project]._unwrapper, ), - cast_to=cast(Type[PagesProjects], ResultWrapper[PagesProjects]), + cast_to=cast(Type[Project], ResultWrapper[Project]), ) def purge_build_cache( @@ -355,31 +354,31 @@ def purge_build_cache( ) -class AsyncProjects(AsyncAPIResource): +class AsyncProjectsResource(AsyncAPIResource): @cached_property - def deployments(self) -> AsyncDeployments: - return AsyncDeployments(self._client) + def deployments(self) -> AsyncDeploymentsResource: + return AsyncDeploymentsResource(self._client) @cached_property - def domains(self) -> AsyncDomains: - return AsyncDomains(self._client) + def domains(self) -> AsyncDomainsResource: + return AsyncDomainsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncProjectsWithRawResponse: - return AsyncProjectsWithRawResponse(self) + def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: + return AsyncProjectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncProjectsWithStreamingResponse: - return AsyncProjectsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncProjectsResourceWithStreamingResponse: + return AsyncProjectsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, build_config: project_create_params.BuildConfig | NotGiven = NOT_GIVEN, - canonical_deployment: PagesDeploymentsParam | NotGiven = NOT_GIVEN, + canonical_deployment: DeploymentParam | NotGiven = NOT_GIVEN, deployment_configs: project_create_params.DeploymentConfigs | NotGiven = NOT_GIVEN, - latest_deployment: PagesDeploymentsParam | NotGiven = NOT_GIVEN, + latest_deployment: DeploymentParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, production_branch: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -433,7 +432,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProjectCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProjectCreateResponse] @@ -451,7 +450,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PagesDeployments, AsyncSinglePage[PagesDeployments]]: + ) -> AsyncPaginator[Deployment, AsyncSinglePage[Deployment]]: """ Fetch a list of all user projects. @@ -470,11 +469,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/pages/projects", - page=AsyncSinglePage[PagesDeployments], + page=AsyncSinglePage[Deployment], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=PagesDeployments, + model=Deployment, ) async def delete( @@ -482,6 +481,7 @@ async def delete( project_name: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -511,6 +511,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `project_name` but received {project_name!r}") return await self._delete( f"/accounts/{account_id}/pages/projects/{project_name}", + body=await async_maybe_transform(body, project_delete_params.ProjectDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,7 +563,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProjectEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProjectEditResponse] @@ -581,7 +582,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagesProjects: + ) -> Project: """ Fetch a project by name. @@ -609,9 +610,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Project]._unwrapper, ), - cast_to=cast(Type[PagesProjects], ResultWrapper[PagesProjects]), + cast_to=cast(Type[Project], ResultWrapper[Project]), ) async def purge_build_cache( @@ -655,8 +656,8 @@ async def purge_build_cache( ) -class ProjectsWithRawResponse: - def __init__(self, projects: Projects) -> None: +class ProjectsResourceWithRawResponse: + def __init__(self, projects: ProjectsResource) -> None: self._projects = projects self.create = to_raw_response_wrapper( @@ -679,16 +680,16 @@ def __init__(self, projects: Projects) -> None: ) @cached_property - def deployments(self) -> DeploymentsWithRawResponse: - return DeploymentsWithRawResponse(self._projects.deployments) + def deployments(self) -> DeploymentsResourceWithRawResponse: + return DeploymentsResourceWithRawResponse(self._projects.deployments) @cached_property - def domains(self) -> DomainsWithRawResponse: - return DomainsWithRawResponse(self._projects.domains) + def domains(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self._projects.domains) -class AsyncProjectsWithRawResponse: - def __init__(self, projects: AsyncProjects) -> None: +class AsyncProjectsResourceWithRawResponse: + def __init__(self, projects: AsyncProjectsResource) -> None: self._projects = projects self.create = async_to_raw_response_wrapper( @@ -711,16 +712,16 @@ def __init__(self, projects: AsyncProjects) -> None: ) @cached_property - def deployments(self) -> AsyncDeploymentsWithRawResponse: - return AsyncDeploymentsWithRawResponse(self._projects.deployments) + def deployments(self) -> AsyncDeploymentsResourceWithRawResponse: + return AsyncDeploymentsResourceWithRawResponse(self._projects.deployments) @cached_property - def domains(self) -> AsyncDomainsWithRawResponse: - return AsyncDomainsWithRawResponse(self._projects.domains) + def domains(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self._projects.domains) -class ProjectsWithStreamingResponse: - def __init__(self, projects: Projects) -> None: +class ProjectsResourceWithStreamingResponse: + def __init__(self, projects: ProjectsResource) -> None: self._projects = projects self.create = to_streamed_response_wrapper( @@ -743,16 +744,16 @@ def __init__(self, projects: Projects) -> None: ) @cached_property - def deployments(self) -> DeploymentsWithStreamingResponse: - return DeploymentsWithStreamingResponse(self._projects.deployments) + def deployments(self) -> DeploymentsResourceWithStreamingResponse: + return DeploymentsResourceWithStreamingResponse(self._projects.deployments) @cached_property - def domains(self) -> DomainsWithStreamingResponse: - return DomainsWithStreamingResponse(self._projects.domains) + def domains(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self._projects.domains) -class AsyncProjectsWithStreamingResponse: - def __init__(self, projects: AsyncProjects) -> None: +class AsyncProjectsResourceWithStreamingResponse: + def __init__(self, projects: AsyncProjectsResource) -> None: self._projects = projects self.create = async_to_streamed_response_wrapper( @@ -775,9 +776,9 @@ def __init__(self, projects: AsyncProjects) -> None: ) @cached_property - def deployments(self) -> AsyncDeploymentsWithStreamingResponse: - return AsyncDeploymentsWithStreamingResponse(self._projects.deployments) + def deployments(self) -> AsyncDeploymentsResourceWithStreamingResponse: + return AsyncDeploymentsResourceWithStreamingResponse(self._projects.deployments) @cached_property - def domains(self) -> AsyncDomainsWithStreamingResponse: - return AsyncDomainsWithStreamingResponse(self._projects.domains) + def domains(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self._projects.domains) diff --git a/src/cloudflare/resources/pcaps/__init__.py b/src/cloudflare/resources/pcaps/__init__.py index a49b718eb5e..3ff03d0256d 100644 --- a/src/cloudflare/resources/pcaps/__init__.py +++ b/src/cloudflare/resources/pcaps/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .pcaps import ( - PCAPs, - AsyncPCAPs, - PCAPsWithRawResponse, - AsyncPCAPsWithRawResponse, - PCAPsWithStreamingResponse, - AsyncPCAPsWithStreamingResponse, + PCAPsResource, + AsyncPCAPsResource, + PCAPsResourceWithRawResponse, + AsyncPCAPsResourceWithRawResponse, + PCAPsResourceWithStreamingResponse, + AsyncPCAPsResourceWithStreamingResponse, ) from .download import ( - Download, - AsyncDownload, - DownloadWithRawResponse, - AsyncDownloadWithRawResponse, - DownloadWithStreamingResponse, - AsyncDownloadWithStreamingResponse, + DownloadResource, + AsyncDownloadResource, + DownloadResourceWithRawResponse, + AsyncDownloadResourceWithRawResponse, + DownloadResourceWithStreamingResponse, + AsyncDownloadResourceWithStreamingResponse, ) from .ownership import ( - Ownership, - AsyncOwnership, - OwnershipWithRawResponse, - AsyncOwnershipWithRawResponse, - OwnershipWithStreamingResponse, - AsyncOwnershipWithStreamingResponse, + OwnershipResource, + AsyncOwnershipResource, + OwnershipResourceWithRawResponse, + AsyncOwnershipResourceWithRawResponse, + OwnershipResourceWithStreamingResponse, + AsyncOwnershipResourceWithStreamingResponse, ) __all__ = [ - "Ownership", - "AsyncOwnership", - "OwnershipWithRawResponse", - "AsyncOwnershipWithRawResponse", - "OwnershipWithStreamingResponse", - "AsyncOwnershipWithStreamingResponse", - "Download", - "AsyncDownload", - "DownloadWithRawResponse", - "AsyncDownloadWithRawResponse", - "DownloadWithStreamingResponse", - "AsyncDownloadWithStreamingResponse", - "PCAPs", - "AsyncPCAPs", - "PCAPsWithRawResponse", - "AsyncPCAPsWithRawResponse", - "PCAPsWithStreamingResponse", - "AsyncPCAPsWithStreamingResponse", + "OwnershipResource", + "AsyncOwnershipResource", + "OwnershipResourceWithRawResponse", + "AsyncOwnershipResourceWithRawResponse", + "OwnershipResourceWithStreamingResponse", + "AsyncOwnershipResourceWithStreamingResponse", + "DownloadResource", + "AsyncDownloadResource", + "DownloadResourceWithRawResponse", + "AsyncDownloadResourceWithRawResponse", + "DownloadResourceWithStreamingResponse", + "AsyncDownloadResourceWithStreamingResponse", + "PCAPsResource", + "AsyncPCAPsResource", + "PCAPsResourceWithRawResponse", + "AsyncPCAPsResourceWithRawResponse", + "PCAPsResourceWithStreamingResponse", + "AsyncPCAPsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/pcaps/download.py b/src/cloudflare/resources/pcaps/download.py index 997eb11fa32..de8e8fa0168 100644 --- a/src/cloudflare/resources/pcaps/download.py +++ b/src/cloudflare/resources/pcaps/download.py @@ -21,17 +21,17 @@ make_request_options, ) -__all__ = ["Download", "AsyncDownload"] +__all__ = ["DownloadResource", "AsyncDownloadResource"] -class Download(SyncAPIResource): +class DownloadResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DownloadWithRawResponse: - return DownloadWithRawResponse(self) + def with_raw_response(self) -> DownloadResourceWithRawResponse: + return DownloadResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DownloadWithStreamingResponse: - return DownloadWithStreamingResponse(self) + def with_streaming_response(self) -> DownloadResourceWithStreamingResponse: + return DownloadResourceWithStreamingResponse(self) def get( self, @@ -76,14 +76,14 @@ def get( ) -class AsyncDownload(AsyncAPIResource): +class AsyncDownloadResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDownloadWithRawResponse: - return AsyncDownloadWithRawResponse(self) + def with_raw_response(self) -> AsyncDownloadResourceWithRawResponse: + return AsyncDownloadResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDownloadWithStreamingResponse: - return AsyncDownloadWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDownloadResourceWithStreamingResponse: + return AsyncDownloadResourceWithStreamingResponse(self) async def get( self, @@ -128,8 +128,8 @@ async def get( ) -class DownloadWithRawResponse: - def __init__(self, download: Download) -> None: +class DownloadResourceWithRawResponse: + def __init__(self, download: DownloadResource) -> None: self._download = download self.get = to_custom_raw_response_wrapper( @@ -138,8 +138,8 @@ def __init__(self, download: Download) -> None: ) -class AsyncDownloadWithRawResponse: - def __init__(self, download: AsyncDownload) -> None: +class AsyncDownloadResourceWithRawResponse: + def __init__(self, download: AsyncDownloadResource) -> None: self._download = download self.get = async_to_custom_raw_response_wrapper( @@ -148,8 +148,8 @@ def __init__(self, download: AsyncDownload) -> None: ) -class DownloadWithStreamingResponse: - def __init__(self, download: Download) -> None: +class DownloadResourceWithStreamingResponse: + def __init__(self, download: DownloadResource) -> None: self._download = download self.get = to_custom_streamed_response_wrapper( @@ -158,8 +158,8 @@ def __init__(self, download: Download) -> None: ) -class AsyncDownloadWithStreamingResponse: - def __init__(self, download: AsyncDownload) -> None: +class AsyncDownloadResourceWithStreamingResponse: + def __init__(self, download: AsyncDownloadResource) -> None: self._download = download self.get = async_to_custom_streamed_response_wrapper( diff --git a/src/cloudflare/resources/pcaps/ownership.py b/src/cloudflare/resources/pcaps/ownership.py index ece8b105f61..618d9796ddd 100644 --- a/src/cloudflare/resources/pcaps/ownership.py +++ b/src/cloudflare/resources/pcaps/ownership.py @@ -20,27 +20,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.pcaps import ( - OwnershipGetResponse, - MagicVisibilityPCAPsOwnership, - ownership_create_params, - ownership_validate_params, -) +from ...types.pcaps import ownership_create_params, ownership_validate_params from ..._base_client import ( make_request_options, ) +from ...types.pcaps.ownership import Ownership +from ...types.pcaps.ownership_get_response import OwnershipGetResponse -__all__ = ["Ownership", "AsyncOwnership"] +__all__ = ["OwnershipResource", "AsyncOwnershipResource"] -class Ownership(SyncAPIResource): +class OwnershipResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OwnershipWithRawResponse: - return OwnershipWithRawResponse(self) + def with_raw_response(self) -> OwnershipResourceWithRawResponse: + return OwnershipResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OwnershipWithStreamingResponse: - return OwnershipWithStreamingResponse(self) + def with_streaming_response(self) -> OwnershipResourceWithStreamingResponse: + return OwnershipResourceWithStreamingResponse(self) def create( self, @@ -53,7 +50,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MagicVisibilityPCAPsOwnership: + ) -> Ownership: """ Adds an AWS or GCP bucket to use with full packet captures. @@ -80,9 +77,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Ownership]._unwrapper, ), - cast_to=cast(Type[MagicVisibilityPCAPsOwnership], ResultWrapper[MagicVisibilityPCAPsOwnership]), + cast_to=cast(Type[Ownership], ResultWrapper[Ownership]), ) def delete( @@ -160,7 +157,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OwnershipGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[OwnershipGetResponse]], ResultWrapper[OwnershipGetResponse]), ) @@ -177,7 +174,7 @@ def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MagicVisibilityPCAPsOwnership: + ) -> Ownership: """ Validates buckets added to the packet captures API. @@ -212,20 +209,20 @@ def validate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Ownership]._unwrapper, ), - cast_to=cast(Type[MagicVisibilityPCAPsOwnership], ResultWrapper[MagicVisibilityPCAPsOwnership]), + cast_to=cast(Type[Ownership], ResultWrapper[Ownership]), ) -class AsyncOwnership(AsyncAPIResource): +class AsyncOwnershipResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOwnershipWithRawResponse: - return AsyncOwnershipWithRawResponse(self) + def with_raw_response(self) -> AsyncOwnershipResourceWithRawResponse: + return AsyncOwnershipResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOwnershipWithStreamingResponse: - return AsyncOwnershipWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOwnershipResourceWithStreamingResponse: + return AsyncOwnershipResourceWithStreamingResponse(self) async def create( self, @@ -238,7 +235,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MagicVisibilityPCAPsOwnership: + ) -> Ownership: """ Adds an AWS or GCP bucket to use with full packet captures. @@ -267,9 +264,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Ownership]._unwrapper, ), - cast_to=cast(Type[MagicVisibilityPCAPsOwnership], ResultWrapper[MagicVisibilityPCAPsOwnership]), + cast_to=cast(Type[Ownership], ResultWrapper[Ownership]), ) async def delete( @@ -347,7 +344,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OwnershipGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[OwnershipGetResponse]], ResultWrapper[OwnershipGetResponse]), ) @@ -364,7 +361,7 @@ async def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MagicVisibilityPCAPsOwnership: + ) -> Ownership: """ Validates buckets added to the packet captures API. @@ -399,14 +396,14 @@ async def validate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Ownership]._unwrapper, ), - cast_to=cast(Type[MagicVisibilityPCAPsOwnership], ResultWrapper[MagicVisibilityPCAPsOwnership]), + cast_to=cast(Type[Ownership], ResultWrapper[Ownership]), ) -class OwnershipWithRawResponse: - def __init__(self, ownership: Ownership) -> None: +class OwnershipResourceWithRawResponse: + def __init__(self, ownership: OwnershipResource) -> None: self._ownership = ownership self.create = to_raw_response_wrapper( @@ -423,8 +420,8 @@ def __init__(self, ownership: Ownership) -> None: ) -class AsyncOwnershipWithRawResponse: - def __init__(self, ownership: AsyncOwnership) -> None: +class AsyncOwnershipResourceWithRawResponse: + def __init__(self, ownership: AsyncOwnershipResource) -> None: self._ownership = ownership self.create = async_to_raw_response_wrapper( @@ -441,8 +438,8 @@ def __init__(self, ownership: AsyncOwnership) -> None: ) -class OwnershipWithStreamingResponse: - def __init__(self, ownership: Ownership) -> None: +class OwnershipResourceWithStreamingResponse: + def __init__(self, ownership: OwnershipResource) -> None: self._ownership = ownership self.create = to_streamed_response_wrapper( @@ -459,8 +456,8 @@ def __init__(self, ownership: Ownership) -> None: ) -class AsyncOwnershipWithStreamingResponse: - def __init__(self, ownership: AsyncOwnership) -> None: +class AsyncOwnershipResourceWithStreamingResponse: + def __init__(self, ownership: AsyncOwnershipResource) -> None: self._ownership = ownership self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/pcaps/pcaps.py b/src/cloudflare/resources/pcaps/pcaps.py index 2afd4a28fae..e6ea121deb1 100644 --- a/src/cloudflare/resources/pcaps/pcaps.py +++ b/src/cloudflare/resources/pcaps/pcaps.py @@ -7,7 +7,6 @@ import httpx -from ...types import PCAPGetResponse, PCAPListResponse, PCAPCreateResponse, pcap_create_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( required_args, @@ -15,21 +14,21 @@ async_maybe_transform, ) from .download import ( - Download, - AsyncDownload, - DownloadWithRawResponse, - AsyncDownloadWithRawResponse, - DownloadWithStreamingResponse, - AsyncDownloadWithStreamingResponse, + DownloadResource, + AsyncDownloadResource, + DownloadResourceWithRawResponse, + AsyncDownloadResourceWithRawResponse, + DownloadResourceWithStreamingResponse, + AsyncDownloadResourceWithStreamingResponse, ) from ..._compat import cached_property from .ownership import ( - Ownership, - AsyncOwnership, - OwnershipWithRawResponse, - AsyncOwnershipWithRawResponse, - OwnershipWithStreamingResponse, - AsyncOwnershipWithStreamingResponse, + OwnershipResource, + AsyncOwnershipResource, + OwnershipResourceWithRawResponse, + AsyncOwnershipResourceWithRawResponse, + OwnershipResourceWithStreamingResponse, + AsyncOwnershipResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -40,30 +39,35 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage +from ...types.pcaps import pcap_create_params from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.pcaps.pcap_filter_param import PCAPFilterParam +from ...types.pcaps.pcap_get_response import PCAPGetResponse +from ...types.pcaps.pcap_list_response import PCAPListResponse +from ...types.pcaps.pcap_create_response import PCAPCreateResponse -__all__ = ["PCAPs", "AsyncPCAPs"] +__all__ = ["PCAPsResource", "AsyncPCAPsResource"] -class PCAPs(SyncAPIResource): +class PCAPsResource(SyncAPIResource): @cached_property - def ownership(self) -> Ownership: - return Ownership(self._client) + def ownership(self) -> OwnershipResource: + return OwnershipResource(self._client) @cached_property - def download(self) -> Download: - return Download(self._client) + def download(self) -> DownloadResource: + return DownloadResource(self._client) @cached_property - def with_raw_response(self) -> PCAPsWithRawResponse: - return PCAPsWithRawResponse(self) + def with_raw_response(self) -> PCAPsResourceWithRawResponse: + return PCAPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PCAPsWithStreamingResponse: - return PCAPsWithStreamingResponse(self) + def with_streaming_response(self) -> PCAPsResourceWithStreamingResponse: + return PCAPsResourceWithStreamingResponse(self) @overload def create( @@ -74,7 +78,7 @@ def create( system: Literal["magic-transit"], time_limit: float, type: Literal["simple", "full"], - filter_v1: pcap_create_params.MagicVisibilityPCAPsRequestSimpleFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | 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 +124,7 @@ def create( time_limit: float, type: Literal["simple", "full"], byte_limit: float | NotGiven = NOT_GIVEN, - filter_v1: pcap_create_params.MagicVisibilityPCAPsRequestFullFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN, packet_limit: 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. @@ -177,7 +181,7 @@ def create( system: Literal["magic-transit"], time_limit: float, type: Literal["simple", "full"], - filter_v1: pcap_create_params.MagicVisibilityPCAPsRequestSimpleFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN, colo_name: str | NotGiven = NOT_GIVEN, destination_conf: str | NotGiven = NOT_GIVEN, byte_limit: float | NotGiven = NOT_GIVEN, @@ -212,7 +216,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PCAPCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PCAPCreateResponse] @@ -297,7 +301,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PCAPGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PCAPGetResponse] @@ -306,22 +310,22 @@ def get( ) -class AsyncPCAPs(AsyncAPIResource): +class AsyncPCAPsResource(AsyncAPIResource): @cached_property - def ownership(self) -> AsyncOwnership: - return AsyncOwnership(self._client) + def ownership(self) -> AsyncOwnershipResource: + return AsyncOwnershipResource(self._client) @cached_property - def download(self) -> AsyncDownload: - return AsyncDownload(self._client) + def download(self) -> AsyncDownloadResource: + return AsyncDownloadResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPCAPsWithRawResponse: - return AsyncPCAPsWithRawResponse(self) + def with_raw_response(self) -> AsyncPCAPsResourceWithRawResponse: + return AsyncPCAPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPCAPsWithStreamingResponse: - return AsyncPCAPsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPCAPsResourceWithStreamingResponse: + return AsyncPCAPsResourceWithStreamingResponse(self) @overload async def create( @@ -332,7 +336,7 @@ async def create( system: Literal["magic-transit"], time_limit: float, type: Literal["simple", "full"], - filter_v1: pcap_create_params.MagicVisibilityPCAPsRequestSimpleFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | 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, @@ -378,7 +382,7 @@ async def create( time_limit: float, type: Literal["simple", "full"], byte_limit: float | NotGiven = NOT_GIVEN, - filter_v1: pcap_create_params.MagicVisibilityPCAPsRequestFullFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN, packet_limit: 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. @@ -435,7 +439,7 @@ async def create( system: Literal["magic-transit"], time_limit: float, type: Literal["simple", "full"], - filter_v1: pcap_create_params.MagicVisibilityPCAPsRequestSimpleFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN, colo_name: str | NotGiven = NOT_GIVEN, destination_conf: str | NotGiven = NOT_GIVEN, byte_limit: float | NotGiven = NOT_GIVEN, @@ -470,7 +474,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PCAPCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PCAPCreateResponse] @@ -555,7 +559,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PCAPGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[PCAPGetResponse] @@ -564,8 +568,8 @@ async def get( ) -class PCAPsWithRawResponse: - def __init__(self, pcaps: PCAPs) -> None: +class PCAPsResourceWithRawResponse: + def __init__(self, pcaps: PCAPsResource) -> None: self._pcaps = pcaps self.create = to_raw_response_wrapper( @@ -579,16 +583,16 @@ def __init__(self, pcaps: PCAPs) -> None: ) @cached_property - def ownership(self) -> OwnershipWithRawResponse: - return OwnershipWithRawResponse(self._pcaps.ownership) + def ownership(self) -> OwnershipResourceWithRawResponse: + return OwnershipResourceWithRawResponse(self._pcaps.ownership) @cached_property - def download(self) -> DownloadWithRawResponse: - return DownloadWithRawResponse(self._pcaps.download) + def download(self) -> DownloadResourceWithRawResponse: + return DownloadResourceWithRawResponse(self._pcaps.download) -class AsyncPCAPsWithRawResponse: - def __init__(self, pcaps: AsyncPCAPs) -> None: +class AsyncPCAPsResourceWithRawResponse: + def __init__(self, pcaps: AsyncPCAPsResource) -> None: self._pcaps = pcaps self.create = async_to_raw_response_wrapper( @@ -602,16 +606,16 @@ def __init__(self, pcaps: AsyncPCAPs) -> None: ) @cached_property - def ownership(self) -> AsyncOwnershipWithRawResponse: - return AsyncOwnershipWithRawResponse(self._pcaps.ownership) + def ownership(self) -> AsyncOwnershipResourceWithRawResponse: + return AsyncOwnershipResourceWithRawResponse(self._pcaps.ownership) @cached_property - def download(self) -> AsyncDownloadWithRawResponse: - return AsyncDownloadWithRawResponse(self._pcaps.download) + def download(self) -> AsyncDownloadResourceWithRawResponse: + return AsyncDownloadResourceWithRawResponse(self._pcaps.download) -class PCAPsWithStreamingResponse: - def __init__(self, pcaps: PCAPs) -> None: +class PCAPsResourceWithStreamingResponse: + def __init__(self, pcaps: PCAPsResource) -> None: self._pcaps = pcaps self.create = to_streamed_response_wrapper( @@ -625,16 +629,16 @@ def __init__(self, pcaps: PCAPs) -> None: ) @cached_property - def ownership(self) -> OwnershipWithStreamingResponse: - return OwnershipWithStreamingResponse(self._pcaps.ownership) + def ownership(self) -> OwnershipResourceWithStreamingResponse: + return OwnershipResourceWithStreamingResponse(self._pcaps.ownership) @cached_property - def download(self) -> DownloadWithStreamingResponse: - return DownloadWithStreamingResponse(self._pcaps.download) + def download(self) -> DownloadResourceWithStreamingResponse: + return DownloadResourceWithStreamingResponse(self._pcaps.download) -class AsyncPCAPsWithStreamingResponse: - def __init__(self, pcaps: AsyncPCAPs) -> None: +class AsyncPCAPsResourceWithStreamingResponse: + def __init__(self, pcaps: AsyncPCAPsResource) -> None: self._pcaps = pcaps self.create = async_to_streamed_response_wrapper( @@ -648,9 +652,9 @@ def __init__(self, pcaps: AsyncPCAPs) -> None: ) @cached_property - def ownership(self) -> AsyncOwnershipWithStreamingResponse: - return AsyncOwnershipWithStreamingResponse(self._pcaps.ownership) + def ownership(self) -> AsyncOwnershipResourceWithStreamingResponse: + return AsyncOwnershipResourceWithStreamingResponse(self._pcaps.ownership) @cached_property - def download(self) -> AsyncDownloadWithStreamingResponse: - return AsyncDownloadWithStreamingResponse(self._pcaps.download) + def download(self) -> AsyncDownloadResourceWithStreamingResponse: + return AsyncDownloadResourceWithStreamingResponse(self._pcaps.download) diff --git a/src/cloudflare/resources/plans.py b/src/cloudflare/resources/plans.py index 8b49136d3df..fc177c15925 100644 --- a/src/cloudflare/resources/plans.py +++ b/src/cloudflare/resources/plans.py @@ -6,7 +6,6 @@ import httpx -from ..types import AvailableRatePlan from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -22,18 +21,19 @@ AsyncPaginator, make_request_options, ) +from ..types.plans.available_rate_plan import AvailableRatePlan -__all__ = ["Plans", "AsyncPlans"] +__all__ = ["PlansResource", "AsyncPlansResource"] -class Plans(SyncAPIResource): +class PlansResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PlansWithRawResponse: - return PlansWithRawResponse(self) + def with_raw_response(self) -> PlansResourceWithRawResponse: + return PlansResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PlansWithStreamingResponse: - return PlansWithStreamingResponse(self) + def with_streaming_response(self) -> PlansResourceWithStreamingResponse: + return PlansResourceWithStreamingResponse(self) def list( self, @@ -110,20 +110,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AvailableRatePlan]._unwrapper, ), cast_to=cast(Type[AvailableRatePlan], ResultWrapper[AvailableRatePlan]), ) -class AsyncPlans(AsyncAPIResource): +class AsyncPlansResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPlansWithRawResponse: - return AsyncPlansWithRawResponse(self) + def with_raw_response(self) -> AsyncPlansResourceWithRawResponse: + return AsyncPlansResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPlansWithStreamingResponse: - return AsyncPlansWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPlansResourceWithStreamingResponse: + return AsyncPlansResourceWithStreamingResponse(self) def list( self, @@ -200,14 +200,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AvailableRatePlan]._unwrapper, ), cast_to=cast(Type[AvailableRatePlan], ResultWrapper[AvailableRatePlan]), ) -class PlansWithRawResponse: - def __init__(self, plans: Plans) -> None: +class PlansResourceWithRawResponse: + def __init__(self, plans: PlansResource) -> None: self._plans = plans self.list = to_raw_response_wrapper( @@ -218,8 +218,8 @@ def __init__(self, plans: Plans) -> None: ) -class AsyncPlansWithRawResponse: - def __init__(self, plans: AsyncPlans) -> None: +class AsyncPlansResourceWithRawResponse: + def __init__(self, plans: AsyncPlansResource) -> None: self._plans = plans self.list = async_to_raw_response_wrapper( @@ -230,8 +230,8 @@ def __init__(self, plans: AsyncPlans) -> None: ) -class PlansWithStreamingResponse: - def __init__(self, plans: Plans) -> None: +class PlansResourceWithStreamingResponse: + def __init__(self, plans: PlansResource) -> None: self._plans = plans self.list = to_streamed_response_wrapper( @@ -242,8 +242,8 @@ def __init__(self, plans: Plans) -> None: ) -class AsyncPlansWithStreamingResponse: - def __init__(self, plans: AsyncPlans) -> None: +class AsyncPlansResourceWithStreamingResponse: + def __init__(self, plans: AsyncPlansResource) -> None: self._plans = plans self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/queues/__init__.py b/src/cloudflare/resources/queues/__init__.py index 6c53c636c3f..27d187759fa 100644 --- a/src/cloudflare/resources/queues/__init__.py +++ b/src/cloudflare/resources/queues/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .queues import ( - Queues, - AsyncQueues, - QueuesWithRawResponse, - AsyncQueuesWithRawResponse, - QueuesWithStreamingResponse, - AsyncQueuesWithStreamingResponse, + QueuesResource, + AsyncQueuesResource, + QueuesResourceWithRawResponse, + AsyncQueuesResourceWithRawResponse, + QueuesResourceWithStreamingResponse, + AsyncQueuesResourceWithStreamingResponse, ) from .messages import ( - Messages, - AsyncMessages, - MessagesWithRawResponse, - AsyncMessagesWithRawResponse, - MessagesWithStreamingResponse, - AsyncMessagesWithStreamingResponse, + MessagesResource, + AsyncMessagesResource, + MessagesResourceWithRawResponse, + AsyncMessagesResourceWithRawResponse, + MessagesResourceWithStreamingResponse, + AsyncMessagesResourceWithStreamingResponse, ) from .consumers import ( - Consumers, - AsyncConsumers, - ConsumersWithRawResponse, - AsyncConsumersWithRawResponse, - ConsumersWithStreamingResponse, - AsyncConsumersWithStreamingResponse, + ConsumersResource, + AsyncConsumersResource, + ConsumersResourceWithRawResponse, + AsyncConsumersResourceWithRawResponse, + ConsumersResourceWithStreamingResponse, + AsyncConsumersResourceWithStreamingResponse, ) __all__ = [ - "Consumers", - "AsyncConsumers", - "ConsumersWithRawResponse", - "AsyncConsumersWithRawResponse", - "ConsumersWithStreamingResponse", - "AsyncConsumersWithStreamingResponse", - "Messages", - "AsyncMessages", - "MessagesWithRawResponse", - "AsyncMessagesWithRawResponse", - "MessagesWithStreamingResponse", - "AsyncMessagesWithStreamingResponse", - "Queues", - "AsyncQueues", - "QueuesWithRawResponse", - "AsyncQueuesWithRawResponse", - "QueuesWithStreamingResponse", - "AsyncQueuesWithStreamingResponse", + "ConsumersResource", + "AsyncConsumersResource", + "ConsumersResourceWithRawResponse", + "AsyncConsumersResourceWithRawResponse", + "ConsumersResourceWithStreamingResponse", + "AsyncConsumersResourceWithStreamingResponse", + "MessagesResource", + "AsyncMessagesResource", + "MessagesResourceWithRawResponse", + "AsyncMessagesResourceWithRawResponse", + "MessagesResourceWithStreamingResponse", + "AsyncMessagesResourceWithStreamingResponse", + "QueuesResource", + "AsyncQueuesResource", + "QueuesResourceWithRawResponse", + "AsyncQueuesResourceWithRawResponse", + "QueuesResourceWithStreamingResponse", + "AsyncQueuesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/queues/consumers.py b/src/cloudflare/resources/queues/consumers.py index a5c9097bba5..b7b0ce5e999 100644 --- a/src/cloudflare/resources/queues/consumers.py +++ b/src/cloudflare/resources/queues/consumers.py @@ -23,26 +23,23 @@ from ..._base_client import ( make_request_options, ) -from ...types.queues import ( - ConsumerGetResponse, - ConsumerCreateResponse, - ConsumerDeleteResponse, - ConsumerUpdateResponse, - consumer_create_params, - consumer_update_params, -) +from ...types.queues import consumer_create_params, consumer_delete_params, consumer_update_params +from ...types.queues.consumer_get_response import ConsumerGetResponse +from ...types.queues.consumer_create_response import ConsumerCreateResponse +from ...types.queues.consumer_delete_response import ConsumerDeleteResponse +from ...types.queues.consumer_update_response import ConsumerUpdateResponse -__all__ = ["Consumers", "AsyncConsumers"] +__all__ = ["ConsumersResource", "AsyncConsumersResource"] -class Consumers(SyncAPIResource): +class ConsumersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConsumersWithRawResponse: - return ConsumersWithRawResponse(self) + def with_raw_response(self) -> ConsumersResourceWithRawResponse: + return ConsumersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConsumersWithStreamingResponse: - return ConsumersWithStreamingResponse(self) + def with_streaming_response(self) -> ConsumersResourceWithStreamingResponse: + return ConsumersResourceWithStreamingResponse(self) def create( self, @@ -85,7 +82,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConsumerCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ConsumerCreateResponse]], ResultWrapper[ConsumerCreateResponse]), ) @@ -136,7 +133,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConsumerUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ConsumerUpdateResponse]], ResultWrapper[ConsumerUpdateResponse]), ) @@ -147,6 +144,7 @@ def delete( *, account_id: str, queue_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +180,13 @@ def delete( Optional[ConsumerDeleteResponse], self._delete( f"/accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}", + body=maybe_transform(body, consumer_delete_params.ConsumerDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConsumerDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConsumerDeleteResponse] @@ -234,20 +233,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConsumerGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ConsumerGetResponse]], ResultWrapper[ConsumerGetResponse]), ) -class AsyncConsumers(AsyncAPIResource): +class AsyncConsumersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConsumersWithRawResponse: - return AsyncConsumersWithRawResponse(self) + def with_raw_response(self) -> AsyncConsumersResourceWithRawResponse: + return AsyncConsumersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConsumersWithStreamingResponse: - return AsyncConsumersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConsumersResourceWithStreamingResponse: + return AsyncConsumersResourceWithStreamingResponse(self) async def create( self, @@ -290,7 +289,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConsumerCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ConsumerCreateResponse]], ResultWrapper[ConsumerCreateResponse]), ) @@ -341,7 +340,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConsumerUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ConsumerUpdateResponse]], ResultWrapper[ConsumerUpdateResponse]), ) @@ -352,6 +351,7 @@ async def delete( *, account_id: str, queue_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -387,12 +387,13 @@ async def delete( Optional[ConsumerDeleteResponse], await self._delete( f"/accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}", + body=await async_maybe_transform(body, consumer_delete_params.ConsumerDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConsumerDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConsumerDeleteResponse] @@ -439,14 +440,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConsumerGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ConsumerGetResponse]], ResultWrapper[ConsumerGetResponse]), ) -class ConsumersWithRawResponse: - def __init__(self, consumers: Consumers) -> None: +class ConsumersResourceWithRawResponse: + def __init__(self, consumers: ConsumersResource) -> None: self._consumers = consumers self.create = to_raw_response_wrapper( @@ -463,8 +464,8 @@ def __init__(self, consumers: Consumers) -> None: ) -class AsyncConsumersWithRawResponse: - def __init__(self, consumers: AsyncConsumers) -> None: +class AsyncConsumersResourceWithRawResponse: + def __init__(self, consumers: AsyncConsumersResource) -> None: self._consumers = consumers self.create = async_to_raw_response_wrapper( @@ -481,8 +482,8 @@ def __init__(self, consumers: AsyncConsumers) -> None: ) -class ConsumersWithStreamingResponse: - def __init__(self, consumers: Consumers) -> None: +class ConsumersResourceWithStreamingResponse: + def __init__(self, consumers: ConsumersResource) -> None: self._consumers = consumers self.create = to_streamed_response_wrapper( @@ -499,8 +500,8 @@ def __init__(self, consumers: Consumers) -> None: ) -class AsyncConsumersWithStreamingResponse: - def __init__(self, consumers: AsyncConsumers) -> None: +class AsyncConsumersResourceWithStreamingResponse: + def __init__(self, consumers: AsyncConsumersResource) -> None: self._consumers = consumers self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/queues/messages.py b/src/cloudflare/resources/queues/messages.py index f1f51247dc1..8b651b0dcf2 100644 --- a/src/cloudflare/resources/queues/messages.py +++ b/src/cloudflare/resources/queues/messages.py @@ -23,19 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.queues import MessageAckResponse, MessagePullResponse, message_ack_params, message_pull_params +from ...types.queues import message_ack_params, message_pull_params +from ...types.queues.message_ack_response import MessageAckResponse +from ...types.queues.message_pull_response import MessagePullResponse -__all__ = ["Messages", "AsyncMessages"] +__all__ = ["MessagesResource", "AsyncMessagesResource"] -class Messages(SyncAPIResource): +class MessagesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MessagesWithRawResponse: - return MessagesWithRawResponse(self) + def with_raw_response(self) -> MessagesResourceWithRawResponse: + return MessagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MessagesWithStreamingResponse: - return MessagesWithStreamingResponse(self) + def with_streaming_response(self) -> MessagesResourceWithStreamingResponse: + return MessagesResourceWithStreamingResponse(self) def ack( self, @@ -85,7 +87,7 @@ def ack( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MessageAckResponse]]._unwrapper, ), cast_to=cast(Type[Optional[MessageAckResponse]], ResultWrapper[MessageAckResponse]), ) @@ -143,20 +145,20 @@ def pull( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MessagePullResponse]]._unwrapper, ), cast_to=cast(Type[Optional[MessagePullResponse]], ResultWrapper[MessagePullResponse]), ) -class AsyncMessages(AsyncAPIResource): +class AsyncMessagesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMessagesWithRawResponse: - return AsyncMessagesWithRawResponse(self) + def with_raw_response(self) -> AsyncMessagesResourceWithRawResponse: + return AsyncMessagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMessagesWithStreamingResponse: - return AsyncMessagesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMessagesResourceWithStreamingResponse: + return AsyncMessagesResourceWithStreamingResponse(self) async def ack( self, @@ -206,7 +208,7 @@ async def ack( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MessageAckResponse]]._unwrapper, ), cast_to=cast(Type[Optional[MessageAckResponse]], ResultWrapper[MessageAckResponse]), ) @@ -264,14 +266,14 @@ async def pull( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MessagePullResponse]]._unwrapper, ), cast_to=cast(Type[Optional[MessagePullResponse]], ResultWrapper[MessagePullResponse]), ) -class MessagesWithRawResponse: - def __init__(self, messages: Messages) -> None: +class MessagesResourceWithRawResponse: + def __init__(self, messages: MessagesResource) -> None: self._messages = messages self.ack = to_raw_response_wrapper( @@ -282,8 +284,8 @@ def __init__(self, messages: Messages) -> None: ) -class AsyncMessagesWithRawResponse: - def __init__(self, messages: AsyncMessages) -> None: +class AsyncMessagesResourceWithRawResponse: + def __init__(self, messages: AsyncMessagesResource) -> None: self._messages = messages self.ack = async_to_raw_response_wrapper( @@ -294,8 +296,8 @@ def __init__(self, messages: AsyncMessages) -> None: ) -class MessagesWithStreamingResponse: - def __init__(self, messages: Messages) -> None: +class MessagesResourceWithStreamingResponse: + def __init__(self, messages: MessagesResource) -> None: self._messages = messages self.ack = to_streamed_response_wrapper( @@ -306,8 +308,8 @@ def __init__(self, messages: Messages) -> None: ) -class AsyncMessagesWithStreamingResponse: - def __init__(self, messages: AsyncMessages) -> None: +class AsyncMessagesResourceWithStreamingResponse: + def __init__(self, messages: AsyncMessagesResource) -> None: self._messages = messages self.ack = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/queues/queues.py b/src/cloudflare/resources/queues/queues.py index 0f3f2a0c7fe..f2fcb6c814c 100644 --- a/src/cloudflare/resources/queues/queues.py +++ b/src/cloudflare/resources/queues/queues.py @@ -6,36 +6,27 @@ import httpx -from ...types import ( - QueueGetResponse, - QueueListResponse, - QueueCreateResponse, - QueueDeleteResponse, - QueueUpdateResponse, - queue_create_params, - queue_update_params, -) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, async_maybe_transform, ) from .messages import ( - Messages, - AsyncMessages, - MessagesWithRawResponse, - AsyncMessagesWithRawResponse, - MessagesWithStreamingResponse, - AsyncMessagesWithStreamingResponse, + MessagesResource, + AsyncMessagesResource, + MessagesResourceWithRawResponse, + AsyncMessagesResourceWithRawResponse, + MessagesResourceWithStreamingResponse, + AsyncMessagesResourceWithStreamingResponse, ) from ..._compat import cached_property from .consumers import ( - Consumers, - AsyncConsumers, - ConsumersWithRawResponse, - AsyncConsumersWithRawResponse, - ConsumersWithStreamingResponse, - AsyncConsumersWithStreamingResponse, + ConsumersResource, + AsyncConsumersResource, + ConsumersResourceWithRawResponse, + AsyncConsumersResourceWithRawResponse, + ConsumersResourceWithStreamingResponse, + AsyncConsumersResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -50,26 +41,31 @@ AsyncPaginator, make_request_options, ) +from ...types.queues import queue_create_params, queue_delete_params, queue_update_params +from ...types.queues.queue import Queue +from ...types.queues.queue_created import QueueCreated +from ...types.queues.queue_updated import QueueUpdated +from ...types.queues.queue_delete_response import QueueDeleteResponse -__all__ = ["Queues", "AsyncQueues"] +__all__ = ["QueuesResource", "AsyncQueuesResource"] -class Queues(SyncAPIResource): +class QueuesResource(SyncAPIResource): @cached_property - def consumers(self) -> Consumers: - return Consumers(self._client) + def consumers(self) -> ConsumersResource: + return ConsumersResource(self._client) @cached_property - def messages(self) -> Messages: - return Messages(self._client) + def messages(self) -> MessagesResource: + return MessagesResource(self._client) @cached_property - def with_raw_response(self) -> QueuesWithRawResponse: - return QueuesWithRawResponse(self) + def with_raw_response(self) -> QueuesResourceWithRawResponse: + return QueuesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> QueuesWithStreamingResponse: - return QueuesWithStreamingResponse(self) + def with_streaming_response(self) -> QueuesResourceWithStreamingResponse: + return QueuesResourceWithStreamingResponse(self) def create( self, @@ -82,7 +78,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[QueueCreateResponse]: + ) -> Optional[QueueCreated]: """ Creates a new queue. @@ -107,9 +103,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[QueueCreated]]._unwrapper, ), - cast_to=cast(Type[Optional[QueueCreateResponse]], ResultWrapper[QueueCreateResponse]), + cast_to=cast(Type[Optional[QueueCreated]], ResultWrapper[QueueCreated]), ) def update( @@ -124,7 +120,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[QueueUpdateResponse]: + ) -> Optional[QueueUpdated]: """ Updates a queue. @@ -153,9 +149,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[QueueUpdated]]._unwrapper, ), - cast_to=cast(Type[Optional[QueueUpdateResponse]], ResultWrapper[QueueUpdateResponse]), + cast_to=cast(Type[Optional[QueueUpdated]], ResultWrapper[QueueUpdated]), ) def list( @@ -168,7 +164,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[QueueListResponse]: + ) -> SyncSinglePage[Queue]: """ Returns the queues owned by an account. @@ -187,11 +183,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/queues", - page=SyncSinglePage[QueueListResponse], + page=SyncSinglePage[Queue], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=QueueListResponse, + model=Queue, ) def delete( @@ -199,6 +195,7 @@ def delete( queue_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -230,12 +227,13 @@ def delete( Optional[QueueDeleteResponse], self._delete( f"/accounts/{account_id}/queues/{queue_id}", + body=maybe_transform(body, queue_delete_params.QueueDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[QueueDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[QueueDeleteResponse] @@ -254,7 +252,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[QueueGetResponse]: + ) -> Optional[Queue]: """ Get information about a specific queue. @@ -282,28 +280,28 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Queue]]._unwrapper, ), - cast_to=cast(Type[Optional[QueueGetResponse]], ResultWrapper[QueueGetResponse]), + cast_to=cast(Type[Optional[Queue]], ResultWrapper[Queue]), ) -class AsyncQueues(AsyncAPIResource): +class AsyncQueuesResource(AsyncAPIResource): @cached_property - def consumers(self) -> AsyncConsumers: - return AsyncConsumers(self._client) + def consumers(self) -> AsyncConsumersResource: + return AsyncConsumersResource(self._client) @cached_property - def messages(self) -> AsyncMessages: - return AsyncMessages(self._client) + def messages(self) -> AsyncMessagesResource: + return AsyncMessagesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncQueuesWithRawResponse: - return AsyncQueuesWithRawResponse(self) + def with_raw_response(self) -> AsyncQueuesResourceWithRawResponse: + return AsyncQueuesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncQueuesWithStreamingResponse: - return AsyncQueuesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncQueuesResourceWithStreamingResponse: + return AsyncQueuesResourceWithStreamingResponse(self) async def create( self, @@ -316,7 +314,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[QueueCreateResponse]: + ) -> Optional[QueueCreated]: """ Creates a new queue. @@ -341,9 +339,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[QueueCreated]]._unwrapper, ), - cast_to=cast(Type[Optional[QueueCreateResponse]], ResultWrapper[QueueCreateResponse]), + cast_to=cast(Type[Optional[QueueCreated]], ResultWrapper[QueueCreated]), ) async def update( @@ -358,7 +356,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[QueueUpdateResponse]: + ) -> Optional[QueueUpdated]: """ Updates a queue. @@ -387,9 +385,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[QueueUpdated]]._unwrapper, ), - cast_to=cast(Type[Optional[QueueUpdateResponse]], ResultWrapper[QueueUpdateResponse]), + cast_to=cast(Type[Optional[QueueUpdated]], ResultWrapper[QueueUpdated]), ) def list( @@ -402,7 +400,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[QueueListResponse, AsyncSinglePage[QueueListResponse]]: + ) -> AsyncPaginator[Queue, AsyncSinglePage[Queue]]: """ Returns the queues owned by an account. @@ -421,11 +419,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/queues", - page=AsyncSinglePage[QueueListResponse], + page=AsyncSinglePage[Queue], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=QueueListResponse, + model=Queue, ) async def delete( @@ -433,6 +431,7 @@ async def delete( queue_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -464,12 +463,13 @@ async def delete( Optional[QueueDeleteResponse], await self._delete( f"/accounts/{account_id}/queues/{queue_id}", + body=await async_maybe_transform(body, queue_delete_params.QueueDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[QueueDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[QueueDeleteResponse] @@ -488,7 +488,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[QueueGetResponse]: + ) -> Optional[Queue]: """ Get information about a specific queue. @@ -516,14 +516,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Queue]]._unwrapper, ), - cast_to=cast(Type[Optional[QueueGetResponse]], ResultWrapper[QueueGetResponse]), + cast_to=cast(Type[Optional[Queue]], ResultWrapper[Queue]), ) -class QueuesWithRawResponse: - def __init__(self, queues: Queues) -> None: +class QueuesResourceWithRawResponse: + def __init__(self, queues: QueuesResource) -> None: self._queues = queues self.create = to_raw_response_wrapper( @@ -543,16 +543,16 @@ def __init__(self, queues: Queues) -> None: ) @cached_property - def consumers(self) -> ConsumersWithRawResponse: - return ConsumersWithRawResponse(self._queues.consumers) + def consumers(self) -> ConsumersResourceWithRawResponse: + return ConsumersResourceWithRawResponse(self._queues.consumers) @cached_property - def messages(self) -> MessagesWithRawResponse: - return MessagesWithRawResponse(self._queues.messages) + def messages(self) -> MessagesResourceWithRawResponse: + return MessagesResourceWithRawResponse(self._queues.messages) -class AsyncQueuesWithRawResponse: - def __init__(self, queues: AsyncQueues) -> None: +class AsyncQueuesResourceWithRawResponse: + def __init__(self, queues: AsyncQueuesResource) -> None: self._queues = queues self.create = async_to_raw_response_wrapper( @@ -572,16 +572,16 @@ def __init__(self, queues: AsyncQueues) -> None: ) @cached_property - def consumers(self) -> AsyncConsumersWithRawResponse: - return AsyncConsumersWithRawResponse(self._queues.consumers) + def consumers(self) -> AsyncConsumersResourceWithRawResponse: + return AsyncConsumersResourceWithRawResponse(self._queues.consumers) @cached_property - def messages(self) -> AsyncMessagesWithRawResponse: - return AsyncMessagesWithRawResponse(self._queues.messages) + def messages(self) -> AsyncMessagesResourceWithRawResponse: + return AsyncMessagesResourceWithRawResponse(self._queues.messages) -class QueuesWithStreamingResponse: - def __init__(self, queues: Queues) -> None: +class QueuesResourceWithStreamingResponse: + def __init__(self, queues: QueuesResource) -> None: self._queues = queues self.create = to_streamed_response_wrapper( @@ -601,16 +601,16 @@ def __init__(self, queues: Queues) -> None: ) @cached_property - def consumers(self) -> ConsumersWithStreamingResponse: - return ConsumersWithStreamingResponse(self._queues.consumers) + def consumers(self) -> ConsumersResourceWithStreamingResponse: + return ConsumersResourceWithStreamingResponse(self._queues.consumers) @cached_property - def messages(self) -> MessagesWithStreamingResponse: - return MessagesWithStreamingResponse(self._queues.messages) + def messages(self) -> MessagesResourceWithStreamingResponse: + return MessagesResourceWithStreamingResponse(self._queues.messages) -class AsyncQueuesWithStreamingResponse: - def __init__(self, queues: AsyncQueues) -> None: +class AsyncQueuesResourceWithStreamingResponse: + def __init__(self, queues: AsyncQueuesResource) -> None: self._queues = queues self.create = async_to_streamed_response_wrapper( @@ -630,9 +630,9 @@ def __init__(self, queues: AsyncQueues) -> None: ) @cached_property - def consumers(self) -> AsyncConsumersWithStreamingResponse: - return AsyncConsumersWithStreamingResponse(self._queues.consumers) + def consumers(self) -> AsyncConsumersResourceWithStreamingResponse: + return AsyncConsumersResourceWithStreamingResponse(self._queues.consumers) @cached_property - def messages(self) -> AsyncMessagesWithStreamingResponse: - return AsyncMessagesWithStreamingResponse(self._queues.messages) + def messages(self) -> AsyncMessagesResourceWithStreamingResponse: + return AsyncMessagesResourceWithStreamingResponse(self._queues.messages) diff --git a/src/cloudflare/resources/r2/__init__.py b/src/cloudflare/resources/r2/__init__.py index 03424b10094..96e202b807b 100644 --- a/src/cloudflare/resources/r2/__init__.py +++ b/src/cloudflare/resources/r2/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .r2 import ( - R2, - AsyncR2, - R2WithRawResponse, - AsyncR2WithRawResponse, - R2WithStreamingResponse, - AsyncR2WithStreamingResponse, + R2Resource, + AsyncR2Resource, + R2ResourceWithRawResponse, + AsyncR2ResourceWithRawResponse, + R2ResourceWithStreamingResponse, + AsyncR2ResourceWithStreamingResponse, ) from .sippy import ( - Sippy, - AsyncSippy, - SippyWithRawResponse, - AsyncSippyWithRawResponse, - SippyWithStreamingResponse, - AsyncSippyWithStreamingResponse, + SippyResource, + AsyncSippyResource, + SippyResourceWithRawResponse, + AsyncSippyResourceWithRawResponse, + SippyResourceWithStreamingResponse, + AsyncSippyResourceWithStreamingResponse, ) from .buckets import ( - Buckets, - AsyncBuckets, - BucketsWithRawResponse, - AsyncBucketsWithRawResponse, - BucketsWithStreamingResponse, - AsyncBucketsWithStreamingResponse, + BucketsResource, + AsyncBucketsResource, + BucketsResourceWithRawResponse, + AsyncBucketsResourceWithRawResponse, + BucketsResourceWithStreamingResponse, + AsyncBucketsResourceWithStreamingResponse, ) __all__ = [ - "Buckets", - "AsyncBuckets", - "BucketsWithRawResponse", - "AsyncBucketsWithRawResponse", - "BucketsWithStreamingResponse", - "AsyncBucketsWithStreamingResponse", - "Sippy", - "AsyncSippy", - "SippyWithRawResponse", - "AsyncSippyWithRawResponse", - "SippyWithStreamingResponse", - "AsyncSippyWithStreamingResponse", - "R2", - "AsyncR2", - "R2WithRawResponse", - "AsyncR2WithRawResponse", - "R2WithStreamingResponse", - "AsyncR2WithStreamingResponse", + "BucketsResource", + "AsyncBucketsResource", + "BucketsResourceWithRawResponse", + "AsyncBucketsResourceWithRawResponse", + "BucketsResourceWithStreamingResponse", + "AsyncBucketsResourceWithStreamingResponse", + "SippyResource", + "AsyncSippyResource", + "SippyResourceWithRawResponse", + "AsyncSippyResourceWithRawResponse", + "SippyResourceWithStreamingResponse", + "AsyncSippyResourceWithStreamingResponse", + "R2Resource", + "AsyncR2Resource", + "R2ResourceWithRawResponse", + "AsyncR2ResourceWithRawResponse", + "R2ResourceWithStreamingResponse", + "AsyncR2ResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/r2/buckets.py b/src/cloudflare/resources/r2/buckets.py index 5d4c1e255cb..c7c04313e66 100644 --- a/src/cloudflare/resources/r2/buckets.py +++ b/src/cloudflare/resources/r2/buckets.py @@ -13,7 +13,7 @@ async_maybe_transform, ) from ..._compat import cached_property -from ...types.r2 import R2Bucket, bucket_list_params, bucket_create_params +from ...types.r2 import bucket_list_params, bucket_create_params from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( to_raw_response_wrapper, @@ -27,18 +27,19 @@ AsyncPaginator, make_request_options, ) +from ...types.r2.bucket import Bucket -__all__ = ["Buckets", "AsyncBuckets"] +__all__ = ["BucketsResource", "AsyncBucketsResource"] -class Buckets(SyncAPIResource): +class BucketsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BucketsWithRawResponse: - return BucketsWithRawResponse(self) + def with_raw_response(self) -> BucketsResourceWithRawResponse: + return BucketsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BucketsWithStreamingResponse: - return BucketsWithStreamingResponse(self) + def with_streaming_response(self) -> BucketsResourceWithStreamingResponse: + return BucketsResourceWithStreamingResponse(self) def create( self, @@ -52,7 +53,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Bucket: + ) -> Bucket: """ Creates a new R2 bucket. @@ -87,9 +88,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Bucket]._unwrapper, ), - cast_to=cast(Type[R2Bucket], ResultWrapper[R2Bucket]), + cast_to=cast(Type[Bucket], ResultWrapper[Bucket]), ) def list( @@ -108,7 +109,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncCursorPagination[R2Bucket]: + ) -> SyncCursorPagination[Bucket]: """ Lists all R2 buckets on your account @@ -141,7 +142,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/r2/buckets", - page=SyncCursorPagination[R2Bucket], + page=SyncCursorPagination[Bucket], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -159,7 +160,7 @@ def list( bucket_list_params.BucketListParams, ), ), - model=R2Bucket, + model=Bucket, ) def delete( @@ -201,7 +202,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -217,7 +218,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Bucket: + ) -> Bucket: """ Gets metadata for an existing R2 bucket. @@ -245,20 +246,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Bucket]._unwrapper, ), - cast_to=cast(Type[R2Bucket], ResultWrapper[R2Bucket]), + cast_to=cast(Type[Bucket], ResultWrapper[Bucket]), ) -class AsyncBuckets(AsyncAPIResource): +class AsyncBucketsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBucketsWithRawResponse: - return AsyncBucketsWithRawResponse(self) + def with_raw_response(self) -> AsyncBucketsResourceWithRawResponse: + return AsyncBucketsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBucketsWithStreamingResponse: - return AsyncBucketsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBucketsResourceWithStreamingResponse: + return AsyncBucketsResourceWithStreamingResponse(self) async def create( self, @@ -272,7 +273,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Bucket: + ) -> Bucket: """ Creates a new R2 bucket. @@ -307,9 +308,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Bucket]._unwrapper, ), - cast_to=cast(Type[R2Bucket], ResultWrapper[R2Bucket]), + cast_to=cast(Type[Bucket], ResultWrapper[Bucket]), ) def list( @@ -328,7 +329,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[R2Bucket, AsyncCursorPagination[R2Bucket]]: + ) -> AsyncPaginator[Bucket, AsyncCursorPagination[Bucket]]: """ Lists all R2 buckets on your account @@ -361,7 +362,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/r2/buckets", - page=AsyncCursorPagination[R2Bucket], + page=AsyncCursorPagination[Bucket], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -379,7 +380,7 @@ def list( bucket_list_params.BucketListParams, ), ), - model=R2Bucket, + model=Bucket, ) async def delete( @@ -421,7 +422,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -437,7 +438,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Bucket: + ) -> Bucket: """ Gets metadata for an existing R2 bucket. @@ -465,14 +466,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Bucket]._unwrapper, ), - cast_to=cast(Type[R2Bucket], ResultWrapper[R2Bucket]), + cast_to=cast(Type[Bucket], ResultWrapper[Bucket]), ) -class BucketsWithRawResponse: - def __init__(self, buckets: Buckets) -> None: +class BucketsResourceWithRawResponse: + def __init__(self, buckets: BucketsResource) -> None: self._buckets = buckets self.create = to_raw_response_wrapper( @@ -489,8 +490,8 @@ def __init__(self, buckets: Buckets) -> None: ) -class AsyncBucketsWithRawResponse: - def __init__(self, buckets: AsyncBuckets) -> None: +class AsyncBucketsResourceWithRawResponse: + def __init__(self, buckets: AsyncBucketsResource) -> None: self._buckets = buckets self.create = async_to_raw_response_wrapper( @@ -507,8 +508,8 @@ def __init__(self, buckets: AsyncBuckets) -> None: ) -class BucketsWithStreamingResponse: - def __init__(self, buckets: Buckets) -> None: +class BucketsResourceWithStreamingResponse: + def __init__(self, buckets: BucketsResource) -> None: self._buckets = buckets self.create = to_streamed_response_wrapper( @@ -525,8 +526,8 @@ def __init__(self, buckets: Buckets) -> None: ) -class AsyncBucketsWithStreamingResponse: - def __init__(self, buckets: AsyncBuckets) -> None: +class AsyncBucketsResourceWithStreamingResponse: + def __init__(self, buckets: AsyncBucketsResource) -> None: self._buckets = buckets self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/r2/r2.py b/src/cloudflare/resources/r2/r2.py index 04278e97a85..5bf7bfb501e 100644 --- a/src/cloudflare/resources/r2/r2.py +++ b/src/cloudflare/resources/r2/r2.py @@ -3,110 +3,110 @@ from __future__ import annotations from .sippy import ( - Sippy, - AsyncSippy, - SippyWithRawResponse, - AsyncSippyWithRawResponse, - SippyWithStreamingResponse, - AsyncSippyWithStreamingResponse, + SippyResource, + AsyncSippyResource, + SippyResourceWithRawResponse, + AsyncSippyResourceWithRawResponse, + SippyResourceWithStreamingResponse, + AsyncSippyResourceWithStreamingResponse, ) from .buckets import ( - Buckets, - AsyncBuckets, - BucketsWithRawResponse, - AsyncBucketsWithRawResponse, - BucketsWithStreamingResponse, - AsyncBucketsWithStreamingResponse, + BucketsResource, + AsyncBucketsResource, + BucketsResourceWithRawResponse, + AsyncBucketsResourceWithRawResponse, + BucketsResourceWithStreamingResponse, + AsyncBucketsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["R2", "AsyncR2"] +__all__ = ["R2Resource", "AsyncR2Resource"] -class R2(SyncAPIResource): +class R2Resource(SyncAPIResource): @cached_property - def buckets(self) -> Buckets: - return Buckets(self._client) + def buckets(self) -> BucketsResource: + return BucketsResource(self._client) @cached_property - def sippy(self) -> Sippy: - return Sippy(self._client) + def sippy(self) -> SippyResource: + return SippyResource(self._client) @cached_property - def with_raw_response(self) -> R2WithRawResponse: - return R2WithRawResponse(self) + def with_raw_response(self) -> R2ResourceWithRawResponse: + return R2ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> R2WithStreamingResponse: - return R2WithStreamingResponse(self) + def with_streaming_response(self) -> R2ResourceWithStreamingResponse: + return R2ResourceWithStreamingResponse(self) -class AsyncR2(AsyncAPIResource): +class AsyncR2Resource(AsyncAPIResource): @cached_property - def buckets(self) -> AsyncBuckets: - return AsyncBuckets(self._client) + def buckets(self) -> AsyncBucketsResource: + return AsyncBucketsResource(self._client) @cached_property - def sippy(self) -> AsyncSippy: - return AsyncSippy(self._client) + def sippy(self) -> AsyncSippyResource: + return AsyncSippyResource(self._client) @cached_property - def with_raw_response(self) -> AsyncR2WithRawResponse: - return AsyncR2WithRawResponse(self) + def with_raw_response(self) -> AsyncR2ResourceWithRawResponse: + return AsyncR2ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncR2WithStreamingResponse: - return AsyncR2WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncR2ResourceWithStreamingResponse: + return AsyncR2ResourceWithStreamingResponse(self) -class R2WithRawResponse: - def __init__(self, r2: R2) -> None: +class R2ResourceWithRawResponse: + def __init__(self, r2: R2Resource) -> None: self._r2 = r2 @cached_property - def buckets(self) -> BucketsWithRawResponse: - return BucketsWithRawResponse(self._r2.buckets) + def buckets(self) -> BucketsResourceWithRawResponse: + return BucketsResourceWithRawResponse(self._r2.buckets) @cached_property - def sippy(self) -> SippyWithRawResponse: - return SippyWithRawResponse(self._r2.sippy) + def sippy(self) -> SippyResourceWithRawResponse: + return SippyResourceWithRawResponse(self._r2.sippy) -class AsyncR2WithRawResponse: - def __init__(self, r2: AsyncR2) -> None: +class AsyncR2ResourceWithRawResponse: + def __init__(self, r2: AsyncR2Resource) -> None: self._r2 = r2 @cached_property - def buckets(self) -> AsyncBucketsWithRawResponse: - return AsyncBucketsWithRawResponse(self._r2.buckets) + def buckets(self) -> AsyncBucketsResourceWithRawResponse: + return AsyncBucketsResourceWithRawResponse(self._r2.buckets) @cached_property - def sippy(self) -> AsyncSippyWithRawResponse: - return AsyncSippyWithRawResponse(self._r2.sippy) + def sippy(self) -> AsyncSippyResourceWithRawResponse: + return AsyncSippyResourceWithRawResponse(self._r2.sippy) -class R2WithStreamingResponse: - def __init__(self, r2: R2) -> None: +class R2ResourceWithStreamingResponse: + def __init__(self, r2: R2Resource) -> None: self._r2 = r2 @cached_property - def buckets(self) -> BucketsWithStreamingResponse: - return BucketsWithStreamingResponse(self._r2.buckets) + def buckets(self) -> BucketsResourceWithStreamingResponse: + return BucketsResourceWithStreamingResponse(self._r2.buckets) @cached_property - def sippy(self) -> SippyWithStreamingResponse: - return SippyWithStreamingResponse(self._r2.sippy) + def sippy(self) -> SippyResourceWithStreamingResponse: + return SippyResourceWithStreamingResponse(self._r2.sippy) -class AsyncR2WithStreamingResponse: - def __init__(self, r2: AsyncR2) -> None: +class AsyncR2ResourceWithStreamingResponse: + def __init__(self, r2: AsyncR2Resource) -> None: self._r2 = r2 @cached_property - def buckets(self) -> AsyncBucketsWithStreamingResponse: - return AsyncBucketsWithStreamingResponse(self._r2.buckets) + def buckets(self) -> AsyncBucketsResourceWithStreamingResponse: + return AsyncBucketsResourceWithStreamingResponse(self._r2.buckets) @cached_property - def sippy(self) -> AsyncSippyWithStreamingResponse: - return AsyncSippyWithStreamingResponse(self._r2.sippy) + def sippy(self) -> AsyncSippyResourceWithStreamingResponse: + return AsyncSippyResourceWithStreamingResponse(self._r2.sippy) diff --git a/src/cloudflare/resources/r2/sippy.py b/src/cloudflare/resources/r2/sippy.py index e408938f4cd..e245dda32a2 100644 --- a/src/cloudflare/resources/r2/sippy.py +++ b/src/cloudflare/resources/r2/sippy.py @@ -13,7 +13,7 @@ async_maybe_transform, ) from ..._compat import cached_property -from ...types.r2 import R2Sippy, SippyDeleteResponse, sippy_update_params +from ...types.r2 import sippy_update_params from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( to_raw_response_wrapper, @@ -25,18 +25,20 @@ from ..._base_client import ( make_request_options, ) +from ...types.r2.sippy import Sippy +from ...types.r2.sippy_delete_response import SippyDeleteResponse -__all__ = ["Sippy", "AsyncSippy"] +__all__ = ["SippyResource", "AsyncSippyResource"] -class Sippy(SyncAPIResource): +class SippyResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SippyWithRawResponse: - return SippyWithRawResponse(self) + def with_raw_response(self) -> SippyResourceWithRawResponse: + return SippyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SippyWithStreamingResponse: - return SippyWithStreamingResponse(self) + def with_streaming_response(self) -> SippyResourceWithStreamingResponse: + return SippyResourceWithStreamingResponse(self) @overload def update( @@ -52,7 +54,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Sippy: + ) -> Sippy: """ Sets configuration for Sippy for an existing R2 bucket. @@ -89,7 +91,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Sippy: + ) -> Sippy: """ Sets configuration for Sippy for an existing R2 bucket. @@ -128,7 +130,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Sippy: + ) -> Sippy: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not bucket_name: @@ -147,9 +149,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Sippy]._unwrapper, ), - cast_to=cast(Type[R2Sippy], ResultWrapper[R2Sippy]), + cast_to=cast(Type[Sippy], ResultWrapper[Sippy]), ) def delete( @@ -191,7 +193,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SippyDeleteResponse]._unwrapper, ), cast_to=cast(Type[SippyDeleteResponse], ResultWrapper[SippyDeleteResponse]), ) @@ -207,7 +209,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Sippy: + ) -> Sippy: """ Gets configuration for Sippy for an existing R2 bucket. @@ -235,20 +237,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Sippy]._unwrapper, ), - cast_to=cast(Type[R2Sippy], ResultWrapper[R2Sippy]), + cast_to=cast(Type[Sippy], ResultWrapper[Sippy]), ) -class AsyncSippy(AsyncAPIResource): +class AsyncSippyResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSippyWithRawResponse: - return AsyncSippyWithRawResponse(self) + def with_raw_response(self) -> AsyncSippyResourceWithRawResponse: + return AsyncSippyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSippyWithStreamingResponse: - return AsyncSippyWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSippyResourceWithStreamingResponse: + return AsyncSippyResourceWithStreamingResponse(self) @overload async def update( @@ -264,7 +266,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Sippy: + ) -> Sippy: """ Sets configuration for Sippy for an existing R2 bucket. @@ -301,7 +303,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Sippy: + ) -> Sippy: """ Sets configuration for Sippy for an existing R2 bucket. @@ -340,7 +342,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Sippy: + ) -> Sippy: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not bucket_name: @@ -359,9 +361,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Sippy]._unwrapper, ), - cast_to=cast(Type[R2Sippy], ResultWrapper[R2Sippy]), + cast_to=cast(Type[Sippy], ResultWrapper[Sippy]), ) async def delete( @@ -403,7 +405,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SippyDeleteResponse]._unwrapper, ), cast_to=cast(Type[SippyDeleteResponse], ResultWrapper[SippyDeleteResponse]), ) @@ -419,7 +421,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> R2Sippy: + ) -> Sippy: """ Gets configuration for Sippy for an existing R2 bucket. @@ -447,14 +449,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Sippy]._unwrapper, ), - cast_to=cast(Type[R2Sippy], ResultWrapper[R2Sippy]), + cast_to=cast(Type[Sippy], ResultWrapper[Sippy]), ) -class SippyWithRawResponse: - def __init__(self, sippy: Sippy) -> None: +class SippyResourceWithRawResponse: + def __init__(self, sippy: SippyResource) -> None: self._sippy = sippy self.update = to_raw_response_wrapper( @@ -468,8 +470,8 @@ def __init__(self, sippy: Sippy) -> None: ) -class AsyncSippyWithRawResponse: - def __init__(self, sippy: AsyncSippy) -> None: +class AsyncSippyResourceWithRawResponse: + def __init__(self, sippy: AsyncSippyResource) -> None: self._sippy = sippy self.update = async_to_raw_response_wrapper( @@ -483,8 +485,8 @@ def __init__(self, sippy: AsyncSippy) -> None: ) -class SippyWithStreamingResponse: - def __init__(self, sippy: Sippy) -> None: +class SippyResourceWithStreamingResponse: + def __init__(self, sippy: SippyResource) -> None: self._sippy = sippy self.update = to_streamed_response_wrapper( @@ -498,8 +500,8 @@ def __init__(self, sippy: Sippy) -> None: ) -class AsyncSippyWithStreamingResponse: - def __init__(self, sippy: AsyncSippy) -> None: +class AsyncSippyResourceWithStreamingResponse: + def __init__(self, sippy: AsyncSippyResource) -> None: self._sippy = sippy self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/__init__.py b/src/cloudflare/resources/radar/__init__.py index 527f51d57dc..00dd0bb0fcf 100644 --- a/src/cloudflare/resources/radar/__init__.py +++ b/src/cloudflare/resources/radar/__init__.py @@ -1,243 +1,243 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .bgp import ( - BGP, - AsyncBGP, - BGPWithRawResponse, - AsyncBGPWithRawResponse, - BGPWithStreamingResponse, - AsyncBGPWithStreamingResponse, + BGPResource, + AsyncBGPResource, + BGPResourceWithRawResponse, + AsyncBGPResourceWithRawResponse, + BGPResourceWithStreamingResponse, + AsyncBGPResourceWithStreamingResponse, ) from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .http import ( - HTTP, - AsyncHTTP, - HTTPWithRawResponse, - AsyncHTTPWithRawResponse, - HTTPWithStreamingResponse, - AsyncHTTPWithStreamingResponse, + HTTPResource, + AsyncHTTPResource, + HTTPResourceWithRawResponse, + AsyncHTTPResourceWithRawResponse, + HTTPResourceWithStreamingResponse, + AsyncHTTPResourceWithStreamingResponse, ) from .as112 import ( - AS112, - AsyncAS112, - AS112WithRawResponse, - AsyncAS112WithRawResponse, - AS112WithStreamingResponse, - AsyncAS112WithStreamingResponse, + AS112Resource, + AsyncAS112Resource, + AS112ResourceWithRawResponse, + AsyncAS112ResourceWithRawResponse, + AS112ResourceWithStreamingResponse, + AsyncAS112ResourceWithStreamingResponse, ) from .email import ( - Email, - AsyncEmail, - EmailWithRawResponse, - AsyncEmailWithRawResponse, - EmailWithStreamingResponse, - AsyncEmailWithStreamingResponse, + EmailResource, + AsyncEmailResource, + EmailResourceWithRawResponse, + AsyncEmailResourceWithRawResponse, + EmailResourceWithStreamingResponse, + AsyncEmailResourceWithStreamingResponse, ) from .radar import ( - Radar, - AsyncRadar, - RadarWithRawResponse, - AsyncRadarWithRawResponse, - RadarWithStreamingResponse, - AsyncRadarWithStreamingResponse, + RadarResource, + AsyncRadarResource, + RadarResourceWithRawResponse, + AsyncRadarResourceWithRawResponse, + RadarResourceWithStreamingResponse, + AsyncRadarResourceWithStreamingResponse, ) from .search import ( - Search, - AsyncSearch, - SearchWithRawResponse, - AsyncSearchWithRawResponse, - SearchWithStreamingResponse, - AsyncSearchWithStreamingResponse, + SearchResource, + AsyncSearchResource, + SearchResourceWithRawResponse, + AsyncSearchResourceWithRawResponse, + SearchResourceWithStreamingResponse, + AsyncSearchResourceWithStreamingResponse, ) from .attacks import ( - Attacks, - AsyncAttacks, - AttacksWithRawResponse, - AsyncAttacksWithRawResponse, - AttacksWithStreamingResponse, - AsyncAttacksWithStreamingResponse, + AttacksResource, + AsyncAttacksResource, + AttacksResourceWithRawResponse, + AsyncAttacksResourceWithRawResponse, + AttacksResourceWithStreamingResponse, + AsyncAttacksResourceWithStreamingResponse, ) from .quality import ( - Quality, - AsyncQuality, - QualityWithRawResponse, - AsyncQualityWithRawResponse, - QualityWithStreamingResponse, - AsyncQualityWithStreamingResponse, + QualityResource, + AsyncQualityResource, + QualityResourceWithRawResponse, + AsyncQualityResourceWithRawResponse, + QualityResourceWithStreamingResponse, + AsyncQualityResourceWithStreamingResponse, ) from .ranking import ( - Ranking, - AsyncRanking, - RankingWithRawResponse, - AsyncRankingWithRawResponse, - RankingWithStreamingResponse, - AsyncRankingWithStreamingResponse, + RankingResource, + AsyncRankingResource, + RankingResourceWithRawResponse, + AsyncRankingResourceWithRawResponse, + RankingResourceWithStreamingResponse, + AsyncRankingResourceWithStreamingResponse, ) from .datasets import ( - Datasets, - AsyncDatasets, - DatasetsWithRawResponse, - AsyncDatasetsWithRawResponse, - DatasetsWithStreamingResponse, - AsyncDatasetsWithStreamingResponse, + DatasetsResource, + AsyncDatasetsResource, + DatasetsResourceWithRawResponse, + AsyncDatasetsResourceWithRawResponse, + DatasetsResourceWithStreamingResponse, + AsyncDatasetsResourceWithStreamingResponse, ) from .entities import ( - Entities, - AsyncEntities, - EntitiesWithRawResponse, - AsyncEntitiesWithRawResponse, - EntitiesWithStreamingResponse, - AsyncEntitiesWithStreamingResponse, + EntitiesResource, + AsyncEntitiesResource, + EntitiesResourceWithRawResponse, + AsyncEntitiesResourceWithRawResponse, + EntitiesResourceWithStreamingResponse, + AsyncEntitiesResourceWithStreamingResponse, ) from .netflows import ( - Netflows, - AsyncNetflows, - NetflowsWithRawResponse, - AsyncNetflowsWithRawResponse, - NetflowsWithStreamingResponse, - AsyncNetflowsWithStreamingResponse, + NetflowsResource, + AsyncNetflowsResource, + NetflowsResourceWithRawResponse, + AsyncNetflowsResourceWithRawResponse, + NetflowsResourceWithStreamingResponse, + AsyncNetflowsResourceWithStreamingResponse, ) from .annotations import ( - Annotations, - AsyncAnnotations, - AnnotationsWithRawResponse, - AsyncAnnotationsWithRawResponse, - AnnotationsWithStreamingResponse, - AsyncAnnotationsWithStreamingResponse, + AnnotationsResource, + AsyncAnnotationsResource, + AnnotationsResourceWithRawResponse, + AsyncAnnotationsResourceWithRawResponse, + AnnotationsResourceWithStreamingResponse, + AsyncAnnotationsResourceWithStreamingResponse, ) from .verified_bots import ( - VerifiedBots, - AsyncVerifiedBots, - VerifiedBotsWithRawResponse, - AsyncVerifiedBotsWithRawResponse, - VerifiedBotsWithStreamingResponse, - AsyncVerifiedBotsWithStreamingResponse, + VerifiedBotsResource, + AsyncVerifiedBotsResource, + VerifiedBotsResourceWithRawResponse, + AsyncVerifiedBotsResourceWithRawResponse, + VerifiedBotsResourceWithStreamingResponse, + AsyncVerifiedBotsResourceWithStreamingResponse, ) from .traffic_anomalies import ( - TrafficAnomalies, - AsyncTrafficAnomalies, - TrafficAnomaliesWithRawResponse, - AsyncTrafficAnomaliesWithRawResponse, - TrafficAnomaliesWithStreamingResponse, - AsyncTrafficAnomaliesWithStreamingResponse, + TrafficAnomaliesResource, + AsyncTrafficAnomaliesResource, + TrafficAnomaliesResourceWithRawResponse, + AsyncTrafficAnomaliesResourceWithRawResponse, + TrafficAnomaliesResourceWithStreamingResponse, + AsyncTrafficAnomaliesResourceWithStreamingResponse, ) from .connection_tampering import ( - ConnectionTampering, - AsyncConnectionTampering, - ConnectionTamperingWithRawResponse, - AsyncConnectionTamperingWithRawResponse, - ConnectionTamperingWithStreamingResponse, - AsyncConnectionTamperingWithStreamingResponse, + ConnectionTamperingResource, + AsyncConnectionTamperingResource, + ConnectionTamperingResourceWithRawResponse, + AsyncConnectionTamperingResourceWithRawResponse, + ConnectionTamperingResourceWithStreamingResponse, + AsyncConnectionTamperingResourceWithStreamingResponse, ) __all__ = [ - "Annotations", - "AsyncAnnotations", - "AnnotationsWithRawResponse", - "AsyncAnnotationsWithRawResponse", - "AnnotationsWithStreamingResponse", - "AsyncAnnotationsWithStreamingResponse", - "BGP", - "AsyncBGP", - "BGPWithRawResponse", - "AsyncBGPWithRawResponse", - "BGPWithStreamingResponse", - "AsyncBGPWithStreamingResponse", - "Datasets", - "AsyncDatasets", - "DatasetsWithRawResponse", - "AsyncDatasetsWithRawResponse", - "DatasetsWithStreamingResponse", - "AsyncDatasetsWithStreamingResponse", - "DNS", - "AsyncDNS", - "DNSWithRawResponse", - "AsyncDNSWithRawResponse", - "DNSWithStreamingResponse", - "AsyncDNSWithStreamingResponse", - "Netflows", - "AsyncNetflows", - "NetflowsWithRawResponse", - "AsyncNetflowsWithRawResponse", - "NetflowsWithStreamingResponse", - "AsyncNetflowsWithStreamingResponse", - "Search", - "AsyncSearch", - "SearchWithRawResponse", - "AsyncSearchWithRawResponse", - "SearchWithStreamingResponse", - "AsyncSearchWithStreamingResponse", - "VerifiedBots", - "AsyncVerifiedBots", - "VerifiedBotsWithRawResponse", - "AsyncVerifiedBotsWithRawResponse", - "VerifiedBotsWithStreamingResponse", - "AsyncVerifiedBotsWithStreamingResponse", - "AS112", - "AsyncAS112", - "AS112WithRawResponse", - "AsyncAS112WithRawResponse", - "AS112WithStreamingResponse", - "AsyncAS112WithStreamingResponse", - "ConnectionTampering", - "AsyncConnectionTampering", - "ConnectionTamperingWithRawResponse", - "AsyncConnectionTamperingWithRawResponse", - "ConnectionTamperingWithStreamingResponse", - "AsyncConnectionTamperingWithStreamingResponse", - "Email", - "AsyncEmail", - "EmailWithRawResponse", - "AsyncEmailWithRawResponse", - "EmailWithStreamingResponse", - "AsyncEmailWithStreamingResponse", - "Attacks", - "AsyncAttacks", - "AttacksWithRawResponse", - "AsyncAttacksWithRawResponse", - "AttacksWithStreamingResponse", - "AsyncAttacksWithStreamingResponse", - "Entities", - "AsyncEntities", - "EntitiesWithRawResponse", - "AsyncEntitiesWithRawResponse", - "EntitiesWithStreamingResponse", - "AsyncEntitiesWithStreamingResponse", - "HTTP", - "AsyncHTTP", - "HTTPWithRawResponse", - "AsyncHTTPWithRawResponse", - "HTTPWithStreamingResponse", - "AsyncHTTPWithStreamingResponse", - "Quality", - "AsyncQuality", - "QualityWithRawResponse", - "AsyncQualityWithRawResponse", - "QualityWithStreamingResponse", - "AsyncQualityWithStreamingResponse", - "Ranking", - "AsyncRanking", - "RankingWithRawResponse", - "AsyncRankingWithRawResponse", - "RankingWithStreamingResponse", - "AsyncRankingWithStreamingResponse", - "TrafficAnomalies", - "AsyncTrafficAnomalies", - "TrafficAnomaliesWithRawResponse", - "AsyncTrafficAnomaliesWithRawResponse", - "TrafficAnomaliesWithStreamingResponse", - "AsyncTrafficAnomaliesWithStreamingResponse", - "Radar", - "AsyncRadar", - "RadarWithRawResponse", - "AsyncRadarWithRawResponse", - "RadarWithStreamingResponse", - "AsyncRadarWithStreamingResponse", + "AnnotationsResource", + "AsyncAnnotationsResource", + "AnnotationsResourceWithRawResponse", + "AsyncAnnotationsResourceWithRawResponse", + "AnnotationsResourceWithStreamingResponse", + "AsyncAnnotationsResourceWithStreamingResponse", + "BGPResource", + "AsyncBGPResource", + "BGPResourceWithRawResponse", + "AsyncBGPResourceWithRawResponse", + "BGPResourceWithStreamingResponse", + "AsyncBGPResourceWithStreamingResponse", + "DatasetsResource", + "AsyncDatasetsResource", + "DatasetsResourceWithRawResponse", + "AsyncDatasetsResourceWithRawResponse", + "DatasetsResourceWithStreamingResponse", + "AsyncDatasetsResourceWithStreamingResponse", + "DNSResource", + "AsyncDNSResource", + "DNSResourceWithRawResponse", + "AsyncDNSResourceWithRawResponse", + "DNSResourceWithStreamingResponse", + "AsyncDNSResourceWithStreamingResponse", + "NetflowsResource", + "AsyncNetflowsResource", + "NetflowsResourceWithRawResponse", + "AsyncNetflowsResourceWithRawResponse", + "NetflowsResourceWithStreamingResponse", + "AsyncNetflowsResourceWithStreamingResponse", + "SearchResource", + "AsyncSearchResource", + "SearchResourceWithRawResponse", + "AsyncSearchResourceWithRawResponse", + "SearchResourceWithStreamingResponse", + "AsyncSearchResourceWithStreamingResponse", + "VerifiedBotsResource", + "AsyncVerifiedBotsResource", + "VerifiedBotsResourceWithRawResponse", + "AsyncVerifiedBotsResourceWithRawResponse", + "VerifiedBotsResourceWithStreamingResponse", + "AsyncVerifiedBotsResourceWithStreamingResponse", + "AS112Resource", + "AsyncAS112Resource", + "AS112ResourceWithRawResponse", + "AsyncAS112ResourceWithRawResponse", + "AS112ResourceWithStreamingResponse", + "AsyncAS112ResourceWithStreamingResponse", + "ConnectionTamperingResource", + "AsyncConnectionTamperingResource", + "ConnectionTamperingResourceWithRawResponse", + "AsyncConnectionTamperingResourceWithRawResponse", + "ConnectionTamperingResourceWithStreamingResponse", + "AsyncConnectionTamperingResourceWithStreamingResponse", + "EmailResource", + "AsyncEmailResource", + "EmailResourceWithRawResponse", + "AsyncEmailResourceWithRawResponse", + "EmailResourceWithStreamingResponse", + "AsyncEmailResourceWithStreamingResponse", + "AttacksResource", + "AsyncAttacksResource", + "AttacksResourceWithRawResponse", + "AsyncAttacksResourceWithRawResponse", + "AttacksResourceWithStreamingResponse", + "AsyncAttacksResourceWithStreamingResponse", + "EntitiesResource", + "AsyncEntitiesResource", + "EntitiesResourceWithRawResponse", + "AsyncEntitiesResourceWithRawResponse", + "EntitiesResourceWithStreamingResponse", + "AsyncEntitiesResourceWithStreamingResponse", + "HTTPResource", + "AsyncHTTPResource", + "HTTPResourceWithRawResponse", + "AsyncHTTPResourceWithRawResponse", + "HTTPResourceWithStreamingResponse", + "AsyncHTTPResourceWithStreamingResponse", + "QualityResource", + "AsyncQualityResource", + "QualityResourceWithRawResponse", + "AsyncQualityResourceWithRawResponse", + "QualityResourceWithStreamingResponse", + "AsyncQualityResourceWithStreamingResponse", + "RankingResource", + "AsyncRankingResource", + "RankingResourceWithRawResponse", + "AsyncRankingResourceWithRawResponse", + "RankingResourceWithStreamingResponse", + "AsyncRankingResourceWithStreamingResponse", + "TrafficAnomaliesResource", + "AsyncTrafficAnomaliesResource", + "TrafficAnomaliesResourceWithRawResponse", + "AsyncTrafficAnomaliesResourceWithRawResponse", + "TrafficAnomaliesResourceWithStreamingResponse", + "AsyncTrafficAnomaliesResourceWithStreamingResponse", + "RadarResource", + "AsyncRadarResource", + "RadarResourceWithRawResponse", + "AsyncRadarResourceWithRawResponse", + "RadarResourceWithStreamingResponse", + "AsyncRadarResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/annotations/__init__.py b/src/cloudflare/resources/radar/annotations/__init__.py index 21de76f2c93..0a951a89c72 100644 --- a/src/cloudflare/resources/radar/annotations/__init__.py +++ b/src/cloudflare/resources/radar/annotations/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .outages import ( - Outages, - AsyncOutages, - OutagesWithRawResponse, - AsyncOutagesWithRawResponse, - OutagesWithStreamingResponse, - AsyncOutagesWithStreamingResponse, + OutagesResource, + AsyncOutagesResource, + OutagesResourceWithRawResponse, + AsyncOutagesResourceWithRawResponse, + OutagesResourceWithStreamingResponse, + AsyncOutagesResourceWithStreamingResponse, ) from .annotations import ( - Annotations, - AsyncAnnotations, - AnnotationsWithRawResponse, - AsyncAnnotationsWithRawResponse, - AnnotationsWithStreamingResponse, - AsyncAnnotationsWithStreamingResponse, + AnnotationsResource, + AsyncAnnotationsResource, + AnnotationsResourceWithRawResponse, + AsyncAnnotationsResourceWithRawResponse, + AnnotationsResourceWithStreamingResponse, + AsyncAnnotationsResourceWithStreamingResponse, ) __all__ = [ - "Outages", - "AsyncOutages", - "OutagesWithRawResponse", - "AsyncOutagesWithRawResponse", - "OutagesWithStreamingResponse", - "AsyncOutagesWithStreamingResponse", - "Annotations", - "AsyncAnnotations", - "AnnotationsWithRawResponse", - "AsyncAnnotationsWithRawResponse", - "AnnotationsWithStreamingResponse", - "AsyncAnnotationsWithStreamingResponse", + "OutagesResource", + "AsyncOutagesResource", + "OutagesResourceWithRawResponse", + "AsyncOutagesResourceWithRawResponse", + "OutagesResourceWithStreamingResponse", + "AsyncOutagesResourceWithStreamingResponse", + "AnnotationsResource", + "AsyncAnnotationsResource", + "AnnotationsResourceWithRawResponse", + "AsyncAnnotationsResourceWithRawResponse", + "AnnotationsResourceWithStreamingResponse", + "AsyncAnnotationsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/annotations/annotations.py b/src/cloudflare/resources/radar/annotations/annotations.py index dc39736e55e..b30195f71b2 100644 --- a/src/cloudflare/resources/radar/annotations/annotations.py +++ b/src/cloudflare/resources/radar/annotations/annotations.py @@ -3,78 +3,78 @@ from __future__ import annotations from .outages import ( - Outages, - AsyncOutages, - OutagesWithRawResponse, - AsyncOutagesWithRawResponse, - OutagesWithStreamingResponse, - AsyncOutagesWithStreamingResponse, + OutagesResource, + AsyncOutagesResource, + OutagesResourceWithRawResponse, + AsyncOutagesResourceWithRawResponse, + OutagesResourceWithStreamingResponse, + AsyncOutagesResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Annotations", "AsyncAnnotations"] +__all__ = ["AnnotationsResource", "AsyncAnnotationsResource"] -class Annotations(SyncAPIResource): +class AnnotationsResource(SyncAPIResource): @cached_property - def outages(self) -> Outages: - return Outages(self._client) + def outages(self) -> OutagesResource: + return OutagesResource(self._client) @cached_property - def with_raw_response(self) -> AnnotationsWithRawResponse: - return AnnotationsWithRawResponse(self) + def with_raw_response(self) -> AnnotationsResourceWithRawResponse: + return AnnotationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AnnotationsWithStreamingResponse: - return AnnotationsWithStreamingResponse(self) + def with_streaming_response(self) -> AnnotationsResourceWithStreamingResponse: + return AnnotationsResourceWithStreamingResponse(self) -class AsyncAnnotations(AsyncAPIResource): +class AsyncAnnotationsResource(AsyncAPIResource): @cached_property - def outages(self) -> AsyncOutages: - return AsyncOutages(self._client) + def outages(self) -> AsyncOutagesResource: + return AsyncOutagesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAnnotationsWithRawResponse: - return AsyncAnnotationsWithRawResponse(self) + def with_raw_response(self) -> AsyncAnnotationsResourceWithRawResponse: + return AsyncAnnotationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAnnotationsWithStreamingResponse: - return AsyncAnnotationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAnnotationsResourceWithStreamingResponse: + return AsyncAnnotationsResourceWithStreamingResponse(self) -class AnnotationsWithRawResponse: - def __init__(self, annotations: Annotations) -> None: +class AnnotationsResourceWithRawResponse: + def __init__(self, annotations: AnnotationsResource) -> None: self._annotations = annotations @cached_property - def outages(self) -> OutagesWithRawResponse: - return OutagesWithRawResponse(self._annotations.outages) + def outages(self) -> OutagesResourceWithRawResponse: + return OutagesResourceWithRawResponse(self._annotations.outages) -class AsyncAnnotationsWithRawResponse: - def __init__(self, annotations: AsyncAnnotations) -> None: +class AsyncAnnotationsResourceWithRawResponse: + def __init__(self, annotations: AsyncAnnotationsResource) -> None: self._annotations = annotations @cached_property - def outages(self) -> AsyncOutagesWithRawResponse: - return AsyncOutagesWithRawResponse(self._annotations.outages) + def outages(self) -> AsyncOutagesResourceWithRawResponse: + return AsyncOutagesResourceWithRawResponse(self._annotations.outages) -class AnnotationsWithStreamingResponse: - def __init__(self, annotations: Annotations) -> None: +class AnnotationsResourceWithStreamingResponse: + def __init__(self, annotations: AnnotationsResource) -> None: self._annotations = annotations @cached_property - def outages(self) -> OutagesWithStreamingResponse: - return OutagesWithStreamingResponse(self._annotations.outages) + def outages(self) -> OutagesResourceWithStreamingResponse: + return OutagesResourceWithStreamingResponse(self._annotations.outages) -class AsyncAnnotationsWithStreamingResponse: - def __init__(self, annotations: AsyncAnnotations) -> None: +class AsyncAnnotationsResourceWithStreamingResponse: + def __init__(self, annotations: AsyncAnnotationsResource) -> None: self._annotations = annotations @cached_property - def outages(self) -> AsyncOutagesWithStreamingResponse: - return AsyncOutagesWithStreamingResponse(self._annotations.outages) + def outages(self) -> AsyncOutagesResourceWithStreamingResponse: + return AsyncOutagesResourceWithStreamingResponse(self._annotations.outages) diff --git a/src/cloudflare/resources/radar/annotations/outages.py b/src/cloudflare/resources/radar/annotations/outages.py index adab0d9997f..f53fee61e9d 100644 --- a/src/cloudflare/resources/radar/annotations/outages.py +++ b/src/cloudflare/resources/radar/annotations/outages.py @@ -25,24 +25,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.annotations import ( - OutageGetResponse, - OutageLocationsResponse, - outage_get_params, - outage_locations_params, -) +from ....types.radar.annotations import outage_get_params, outage_locations_params +from ....types.radar.annotations.outage_get_response import OutageGetResponse +from ....types.radar.annotations.outage_locations_response import OutageLocationsResponse -__all__ = ["Outages", "AsyncOutages"] +__all__ = ["OutagesResource", "AsyncOutagesResource"] -class Outages(SyncAPIResource): +class OutagesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OutagesWithRawResponse: - return OutagesWithRawResponse(self) + def with_raw_response(self) -> OutagesResourceWithRawResponse: + return OutagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OutagesWithStreamingResponse: - return OutagesWithStreamingResponse(self) + def with_streaming_response(self) -> OutagesResourceWithStreamingResponse: + return OutagesResourceWithStreamingResponse(self) def get( self, @@ -128,7 +125,7 @@ def get( }, outage_get_params.OutageGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OutageGetResponse]._unwrapper, ), cast_to=cast(Type[OutageGetResponse], ResultWrapper[OutageGetResponse]), ) @@ -205,20 +202,20 @@ def locations( }, outage_locations_params.OutageLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OutageLocationsResponse]._unwrapper, ), cast_to=cast(Type[OutageLocationsResponse], ResultWrapper[OutageLocationsResponse]), ) -class AsyncOutages(AsyncAPIResource): +class AsyncOutagesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOutagesWithRawResponse: - return AsyncOutagesWithRawResponse(self) + def with_raw_response(self) -> AsyncOutagesResourceWithRawResponse: + return AsyncOutagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOutagesWithStreamingResponse: - return AsyncOutagesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOutagesResourceWithStreamingResponse: + return AsyncOutagesResourceWithStreamingResponse(self) async def get( self, @@ -304,7 +301,7 @@ async def get( }, outage_get_params.OutageGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OutageGetResponse]._unwrapper, ), cast_to=cast(Type[OutageGetResponse], ResultWrapper[OutageGetResponse]), ) @@ -381,14 +378,14 @@ async def locations( }, outage_locations_params.OutageLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OutageLocationsResponse]._unwrapper, ), cast_to=cast(Type[OutageLocationsResponse], ResultWrapper[OutageLocationsResponse]), ) -class OutagesWithRawResponse: - def __init__(self, outages: Outages) -> None: +class OutagesResourceWithRawResponse: + def __init__(self, outages: OutagesResource) -> None: self._outages = outages self.get = to_raw_response_wrapper( @@ -399,8 +396,8 @@ def __init__(self, outages: Outages) -> None: ) -class AsyncOutagesWithRawResponse: - def __init__(self, outages: AsyncOutages) -> None: +class AsyncOutagesResourceWithRawResponse: + def __init__(self, outages: AsyncOutagesResource) -> None: self._outages = outages self.get = async_to_raw_response_wrapper( @@ -411,8 +408,8 @@ def __init__(self, outages: AsyncOutages) -> None: ) -class OutagesWithStreamingResponse: - def __init__(self, outages: Outages) -> None: +class OutagesResourceWithStreamingResponse: + def __init__(self, outages: OutagesResource) -> None: self._outages = outages self.get = to_streamed_response_wrapper( @@ -423,8 +420,8 @@ def __init__(self, outages: Outages) -> None: ) -class AsyncOutagesWithStreamingResponse: - def __init__(self, outages: AsyncOutages) -> None: +class AsyncOutagesResourceWithStreamingResponse: + def __init__(self, outages: AsyncOutagesResource) -> None: self._outages = outages self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/as112/__init__.py b/src/cloudflare/resources/radar/as112/__init__.py index a08ff61d832..66f43b9e673 100644 --- a/src/cloudflare/resources/radar/as112/__init__.py +++ b/src/cloudflare/resources/radar/as112/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .as112 import ( - AS112, - AsyncAS112, - AS112WithRawResponse, - AsyncAS112WithRawResponse, - AS112WithStreamingResponse, - AsyncAS112WithStreamingResponse, + AS112Resource, + AsyncAS112Resource, + AS112ResourceWithRawResponse, + AsyncAS112ResourceWithRawResponse, + AS112ResourceWithStreamingResponse, + AsyncAS112ResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) __all__ = [ - "Summary", - "AsyncSummary", - "SummaryWithRawResponse", - "AsyncSummaryWithRawResponse", - "SummaryWithStreamingResponse", - "AsyncSummaryWithStreamingResponse", - "TimeseriesGroups", - "AsyncTimeseriesGroups", - "TimeseriesGroupsWithRawResponse", - "AsyncTimeseriesGroupsWithRawResponse", - "TimeseriesGroupsWithStreamingResponse", - "AsyncTimeseriesGroupsWithStreamingResponse", - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "AS112", - "AsyncAS112", - "AS112WithRawResponse", - "AsyncAS112WithRawResponse", - "AS112WithStreamingResponse", - "AsyncAS112WithStreamingResponse", + "SummaryResource", + "AsyncSummaryResource", + "SummaryResourceWithRawResponse", + "AsyncSummaryResourceWithRawResponse", + "SummaryResourceWithStreamingResponse", + "AsyncSummaryResourceWithStreamingResponse", + "TimeseriesGroupsResource", + "AsyncTimeseriesGroupsResource", + "TimeseriesGroupsResourceWithRawResponse", + "AsyncTimeseriesGroupsResourceWithRawResponse", + "TimeseriesGroupsResourceWithStreamingResponse", + "AsyncTimeseriesGroupsResourceWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "AS112Resource", + "AsyncAS112Resource", + "AS112ResourceWithRawResponse", + "AsyncAS112ResourceWithRawResponse", + "AS112ResourceWithStreamingResponse", + "AsyncAS112ResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/as112/as112.py b/src/cloudflare/resources/radar/as112/as112.py index 1ede7b9eaa3..d9245a12e0e 100644 --- a/src/cloudflare/resources/radar/as112/as112.py +++ b/src/cloudflare/resources/radar/as112/as112.py @@ -9,20 +9,20 @@ import httpx from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -38,42 +38,43 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.radar import AS112TimeseriesResponse, as112_timeseries_params +from ....types.radar import as112_timeseries_params from ...._base_client import ( make_request_options, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) +from ....types.radar.as112_timeseries_response import AS112TimeseriesResponse -__all__ = ["AS112", "AsyncAS112"] +__all__ = ["AS112Resource", "AsyncAS112Resource"] -class AS112(SyncAPIResource): +class AS112Resource(SyncAPIResource): @cached_property - def summary(self) -> Summary: - return Summary(self._client) + def summary(self) -> SummaryResource: + return SummaryResource(self._client) @cached_property - def timeseries_groups(self) -> TimeseriesGroups: - return TimeseriesGroups(self._client) + def timeseries_groups(self) -> TimeseriesGroupsResource: + return TimeseriesGroupsResource(self._client) @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def with_raw_response(self) -> AS112WithRawResponse: - return AS112WithRawResponse(self) + def with_raw_response(self) -> AS112ResourceWithRawResponse: + return AS112ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AS112WithStreamingResponse: - return AS112WithStreamingResponse(self) + def with_streaming_response(self) -> AS112ResourceWithStreamingResponse: + return AS112ResourceWithStreamingResponse(self) def timeseries( self, @@ -174,32 +175,32 @@ def timeseries( }, as112_timeseries_params.AS112TimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AS112TimeseriesResponse]._unwrapper, ), cast_to=cast(Type[AS112TimeseriesResponse], ResultWrapper[AS112TimeseriesResponse]), ) -class AsyncAS112(AsyncAPIResource): +class AsyncAS112Resource(AsyncAPIResource): @cached_property - def summary(self) -> AsyncSummary: - return AsyncSummary(self._client) + def summary(self) -> AsyncSummaryResource: + return AsyncSummaryResource(self._client) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroups: - return AsyncTimeseriesGroups(self._client) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResource: + return AsyncTimeseriesGroupsResource(self._client) @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAS112WithRawResponse: - return AsyncAS112WithRawResponse(self) + def with_raw_response(self) -> AsyncAS112ResourceWithRawResponse: + return AsyncAS112ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAS112WithStreamingResponse: - return AsyncAS112WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAS112ResourceWithStreamingResponse: + return AsyncAS112ResourceWithStreamingResponse(self) async def timeseries( self, @@ -300,14 +301,14 @@ async def timeseries( }, as112_timeseries_params.AS112TimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AS112TimeseriesResponse]._unwrapper, ), cast_to=cast(Type[AS112TimeseriesResponse], ResultWrapper[AS112TimeseriesResponse]), ) -class AS112WithRawResponse: - def __init__(self, as112: AS112) -> None: +class AS112ResourceWithRawResponse: + def __init__(self, as112: AS112Resource) -> None: self._as112 = as112 self.timeseries = to_raw_response_wrapper( @@ -315,20 +316,20 @@ def __init__(self, as112: AS112) -> None: ) @cached_property - def summary(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self._as112.summary) + def summary(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self._as112.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self._as112.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self._as112.timeseries_groups) @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._as112.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._as112.top) -class AsyncAS112WithRawResponse: - def __init__(self, as112: AsyncAS112) -> None: +class AsyncAS112ResourceWithRawResponse: + def __init__(self, as112: AsyncAS112Resource) -> None: self._as112 = as112 self.timeseries = async_to_raw_response_wrapper( @@ -336,20 +337,20 @@ def __init__(self, as112: AsyncAS112) -> None: ) @cached_property - def summary(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self._as112.summary) + def summary(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self._as112.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self._as112.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self._as112.timeseries_groups) @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._as112.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._as112.top) -class AS112WithStreamingResponse: - def __init__(self, as112: AS112) -> None: +class AS112ResourceWithStreamingResponse: + def __init__(self, as112: AS112Resource) -> None: self._as112 = as112 self.timeseries = to_streamed_response_wrapper( @@ -357,20 +358,20 @@ def __init__(self, as112: AS112) -> None: ) @cached_property - def summary(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self._as112.summary) + def summary(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self._as112.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self._as112.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self._as112.timeseries_groups) @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._as112.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._as112.top) -class AsyncAS112WithStreamingResponse: - def __init__(self, as112: AsyncAS112) -> None: +class AsyncAS112ResourceWithStreamingResponse: + def __init__(self, as112: AsyncAS112Resource) -> None: self._as112 = as112 self.timeseries = async_to_streamed_response_wrapper( @@ -378,13 +379,13 @@ def __init__(self, as112: AsyncAS112) -> None: ) @cached_property - def summary(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self._as112.summary) + def summary(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self._as112.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self._as112.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self._as112.timeseries_groups) @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._as112.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._as112.top) diff --git a/src/cloudflare/resources/radar/as112/summary.py b/src/cloudflare/resources/radar/as112/summary.py index 88bc7d1fc6d..a67b1833204 100644 --- a/src/cloudflare/resources/radar/as112/summary.py +++ b/src/cloudflare/resources/radar/as112/summary.py @@ -26,12 +26,6 @@ make_request_options, ) from ....types.radar.as112 import ( - SummaryEdnsResponse, - SummaryDNSSECResponse, - SummaryProtocolResponse, - SummaryIPVersionResponse, - SummaryQueryTypeResponse, - SummaryResponseCodesResponse, summary_edns_params, summary_dnssec_params, summary_protocol_params, @@ -39,18 +33,24 @@ summary_query_type_params, summary_response_codes_params, ) +from ....types.radar.as112.summary_edns_response import SummaryEdnsResponse +from ....types.radar.as112.summary_dnssec_response import SummaryDNSSECResponse +from ....types.radar.as112.summary_protocol_response import SummaryProtocolResponse +from ....types.radar.as112.summary_ip_version_response import SummaryIPVersionResponse +from ....types.radar.as112.summary_query_type_response import SummaryQueryTypeResponse +from ....types.radar.as112.summary_response_codes_response import SummaryResponseCodesResponse -__all__ = ["Summary", "AsyncSummary"] +__all__ = ["SummaryResource", "AsyncSummaryResource"] -class Summary(SyncAPIResource): +class SummaryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self) + def with_raw_response(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self) + def with_streaming_response(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self) def dnssec( self, @@ -145,7 +145,7 @@ def dnssec( }, summary_dnssec_params.SummaryDNSSECParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDNSSECResponse]._unwrapper, ), cast_to=cast(Type[SummaryDNSSECResponse], ResultWrapper[SummaryDNSSECResponse]), ) @@ -243,7 +243,7 @@ def edns( }, summary_edns_params.SummaryEdnsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryEdnsResponse]._unwrapper, ), cast_to=cast(Type[SummaryEdnsResponse], ResultWrapper[SummaryEdnsResponse]), ) @@ -341,7 +341,7 @@ def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -439,7 +439,7 @@ def protocol( }, summary_protocol_params.SummaryProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryProtocolResponse]._unwrapper, ), cast_to=cast(Type[SummaryProtocolResponse], ResultWrapper[SummaryProtocolResponse]), ) @@ -537,7 +537,7 @@ def query_type( }, summary_query_type_params.SummaryQueryTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryQueryTypeResponse]._unwrapper, ), cast_to=cast(Type[SummaryQueryTypeResponse], ResultWrapper[SummaryQueryTypeResponse]), ) @@ -635,20 +635,20 @@ def response_codes( }, summary_response_codes_params.SummaryResponseCodesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryResponseCodesResponse]._unwrapper, ), cast_to=cast(Type[SummaryResponseCodesResponse], ResultWrapper[SummaryResponseCodesResponse]), ) -class AsyncSummary(AsyncAPIResource): +class AsyncSummaryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self) + def with_raw_response(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self) async def dnssec( self, @@ -743,7 +743,7 @@ async def dnssec( }, summary_dnssec_params.SummaryDNSSECParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDNSSECResponse]._unwrapper, ), cast_to=cast(Type[SummaryDNSSECResponse], ResultWrapper[SummaryDNSSECResponse]), ) @@ -841,7 +841,7 @@ async def edns( }, summary_edns_params.SummaryEdnsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryEdnsResponse]._unwrapper, ), cast_to=cast(Type[SummaryEdnsResponse], ResultWrapper[SummaryEdnsResponse]), ) @@ -939,7 +939,7 @@ async def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -1037,7 +1037,7 @@ async def protocol( }, summary_protocol_params.SummaryProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryProtocolResponse]._unwrapper, ), cast_to=cast(Type[SummaryProtocolResponse], ResultWrapper[SummaryProtocolResponse]), ) @@ -1135,7 +1135,7 @@ async def query_type( }, summary_query_type_params.SummaryQueryTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryQueryTypeResponse]._unwrapper, ), cast_to=cast(Type[SummaryQueryTypeResponse], ResultWrapper[SummaryQueryTypeResponse]), ) @@ -1233,14 +1233,14 @@ async def response_codes( }, summary_response_codes_params.SummaryResponseCodesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryResponseCodesResponse]._unwrapper, ), cast_to=cast(Type[SummaryResponseCodesResponse], ResultWrapper[SummaryResponseCodesResponse]), ) -class SummaryWithRawResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithRawResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.dnssec = to_raw_response_wrapper( @@ -1263,8 +1263,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithRawResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithRawResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.dnssec = async_to_raw_response_wrapper( @@ -1287,8 +1287,8 @@ def __init__(self, summary: AsyncSummary) -> None: ) -class SummaryWithStreamingResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithStreamingResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.dnssec = to_streamed_response_wrapper( @@ -1311,8 +1311,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithStreamingResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithStreamingResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.dnssec = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/as112/timeseries_groups.py b/src/cloudflare/resources/radar/as112/timeseries_groups.py index 8945b000050..22765f808f8 100644 --- a/src/cloudflare/resources/radar/as112/timeseries_groups.py +++ b/src/cloudflare/resources/radar/as112/timeseries_groups.py @@ -26,12 +26,6 @@ make_request_options, ) from ....types.radar.as112 import ( - TimeseriesGroupEdnsResponse, - TimeseriesGroupDNSSECResponse, - TimeseriesGroupProtocolResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupQueryTypeResponse, - TimeseriesGroupResponseCodesResponse, timeseries_group_edns_params, timeseries_group_dnssec_params, timeseries_group_protocol_params, @@ -39,18 +33,24 @@ timeseries_group_query_type_params, timeseries_group_response_codes_params, ) +from ....types.radar.as112.timeseries_group_edns_response import TimeseriesGroupEdnsResponse +from ....types.radar.as112.timeseries_group_dnssec_response import TimeseriesGroupDNSSECResponse +from ....types.radar.as112.timeseries_group_protocol_response import TimeseriesGroupProtocolResponse +from ....types.radar.as112.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse +from ....types.radar.as112.timeseries_group_query_type_response import TimeseriesGroupQueryTypeResponse +from ....types.radar.as112.timeseries_group_response_codes_response import TimeseriesGroupResponseCodesResponse -__all__ = ["TimeseriesGroups", "AsyncTimeseriesGroups"] +__all__ = ["TimeseriesGroupsResource", "AsyncTimeseriesGroupsResource"] -class TimeseriesGroups(SyncAPIResource): +class TimeseriesGroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self) def dnssec( self, @@ -151,7 +151,7 @@ def dnssec( }, timeseries_group_dnssec_params.TimeseriesGroupDNSSECParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDNSSECResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDNSSECResponse], ResultWrapper[TimeseriesGroupDNSSECResponse]), ) @@ -255,7 +255,7 @@ def edns( }, timeseries_group_edns_params.TimeseriesGroupEdnsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupEdnsResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupEdnsResponse], ResultWrapper[TimeseriesGroupEdnsResponse]), ) @@ -359,7 +359,7 @@ def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -463,7 +463,7 @@ def protocol( }, timeseries_group_protocol_params.TimeseriesGroupProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupProtocolResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupProtocolResponse], ResultWrapper[TimeseriesGroupProtocolResponse]), ) @@ -567,7 +567,7 @@ def query_type( }, timeseries_group_query_type_params.TimeseriesGroupQueryTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupQueryTypeResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupQueryTypeResponse], ResultWrapper[TimeseriesGroupQueryTypeResponse]), ) @@ -672,7 +672,7 @@ def response_codes( }, timeseries_group_response_codes_params.TimeseriesGroupResponseCodesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupResponseCodesResponse]._unwrapper, ), cast_to=cast( Type[TimeseriesGroupResponseCodesResponse], ResultWrapper[TimeseriesGroupResponseCodesResponse] @@ -680,14 +680,14 @@ def response_codes( ) -class AsyncTimeseriesGroups(AsyncAPIResource): +class AsyncTimeseriesGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self) async def dnssec( self, @@ -788,7 +788,7 @@ async def dnssec( }, timeseries_group_dnssec_params.TimeseriesGroupDNSSECParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDNSSECResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDNSSECResponse], ResultWrapper[TimeseriesGroupDNSSECResponse]), ) @@ -892,7 +892,7 @@ async def edns( }, timeseries_group_edns_params.TimeseriesGroupEdnsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupEdnsResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupEdnsResponse], ResultWrapper[TimeseriesGroupEdnsResponse]), ) @@ -996,7 +996,7 @@ async def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -1100,7 +1100,7 @@ async def protocol( }, timeseries_group_protocol_params.TimeseriesGroupProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupProtocolResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupProtocolResponse], ResultWrapper[TimeseriesGroupProtocolResponse]), ) @@ -1204,7 +1204,7 @@ async def query_type( }, timeseries_group_query_type_params.TimeseriesGroupQueryTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupQueryTypeResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupQueryTypeResponse], ResultWrapper[TimeseriesGroupQueryTypeResponse]), ) @@ -1309,7 +1309,7 @@ async def response_codes( }, timeseries_group_response_codes_params.TimeseriesGroupResponseCodesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupResponseCodesResponse]._unwrapper, ), cast_to=cast( Type[TimeseriesGroupResponseCodesResponse], ResultWrapper[TimeseriesGroupResponseCodesResponse] @@ -1317,8 +1317,8 @@ async def response_codes( ) -class TimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.dnssec = to_raw_response_wrapper( @@ -1341,8 +1341,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.dnssec = async_to_raw_response_wrapper( @@ -1365,8 +1365,8 @@ def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: ) -class TimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.dnssec = to_streamed_response_wrapper( @@ -1389,8 +1389,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.dnssec = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/as112/top.py b/src/cloudflare/resources/radar/as112/top.py index 219cef12a85..bf2166e991f 100644 --- a/src/cloudflare/resources/radar/as112/top.py +++ b/src/cloudflare/resources/radar/as112/top.py @@ -25,28 +25,23 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.as112 import ( - TopEdnsResponse, - TopDNSSECResponse, - TopIPVersionResponse, - TopLocationsResponse, - top_edns_params, - top_dnssec_params, - top_locations_params, - top_ip_version_params, -) +from ....types.radar.as112 import top_edns_params, top_dnssec_params, top_locations_params, top_ip_version_params +from ....types.radar.as112.top_edns_response import TopEdnsResponse +from ....types.radar.as112.top_dnssec_response import TopDNSSECResponse +from ....types.radar.as112.top_locations_response import TopLocationsResponse +from ....types.radar.as112.top_ip_version_response import TopIPVersionResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def dnssec( self, @@ -150,7 +145,7 @@ def dnssec( }, top_dnssec_params.TopDNSSECParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopDNSSECResponse]._unwrapper, ), cast_to=cast(Type[TopDNSSECResponse], ResultWrapper[TopDNSSECResponse]), ) @@ -257,7 +252,7 @@ def edns( }, top_edns_params.TopEdnsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopEdnsResponse]._unwrapper, ), cast_to=cast(Type[TopEdnsResponse], ResultWrapper[TopEdnsResponse]), ) @@ -364,7 +359,7 @@ def ip_version( }, top_ip_version_params.TopIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TopIPVersionResponse], ResultWrapper[TopIPVersionResponse]), ) @@ -468,20 +463,20 @@ def locations( }, top_locations_params.TopLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopLocationsResponse]._unwrapper, ), cast_to=cast(Type[TopLocationsResponse], ResultWrapper[TopLocationsResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def dnssec( self, @@ -585,7 +580,7 @@ async def dnssec( }, top_dnssec_params.TopDNSSECParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopDNSSECResponse]._unwrapper, ), cast_to=cast(Type[TopDNSSECResponse], ResultWrapper[TopDNSSECResponse]), ) @@ -692,7 +687,7 @@ async def edns( }, top_edns_params.TopEdnsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopEdnsResponse]._unwrapper, ), cast_to=cast(Type[TopEdnsResponse], ResultWrapper[TopEdnsResponse]), ) @@ -799,7 +794,7 @@ async def ip_version( }, top_ip_version_params.TopIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TopIPVersionResponse], ResultWrapper[TopIPVersionResponse]), ) @@ -903,14 +898,14 @@ async def locations( }, top_locations_params.TopLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopLocationsResponse]._unwrapper, ), cast_to=cast(Type[TopLocationsResponse], ResultWrapper[TopLocationsResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.dnssec = to_raw_response_wrapper( @@ -927,8 +922,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.dnssec = async_to_raw_response_wrapper( @@ -945,8 +940,8 @@ def __init__(self, top: AsyncTop) -> None: ) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.dnssec = to_streamed_response_wrapper( @@ -963,8 +958,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.dnssec = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/attacks/__init__.py b/src/cloudflare/resources/radar/attacks/__init__.py index 41feca20382..4137d7f1511 100644 --- a/src/cloudflare/resources/radar/attacks/__init__.py +++ b/src/cloudflare/resources/radar/attacks/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .layer3 import ( - Layer3, - AsyncLayer3, - Layer3WithRawResponse, - AsyncLayer3WithRawResponse, - Layer3WithStreamingResponse, - AsyncLayer3WithStreamingResponse, + Layer3Resource, + AsyncLayer3Resource, + Layer3ResourceWithRawResponse, + AsyncLayer3ResourceWithRawResponse, + Layer3ResourceWithStreamingResponse, + AsyncLayer3ResourceWithStreamingResponse, ) from .layer7 import ( - Layer7, - AsyncLayer7, - Layer7WithRawResponse, - AsyncLayer7WithRawResponse, - Layer7WithStreamingResponse, - AsyncLayer7WithStreamingResponse, + Layer7Resource, + AsyncLayer7Resource, + Layer7ResourceWithRawResponse, + AsyncLayer7ResourceWithRawResponse, + Layer7ResourceWithStreamingResponse, + AsyncLayer7ResourceWithStreamingResponse, ) from .attacks import ( - Attacks, - AsyncAttacks, - AttacksWithRawResponse, - AsyncAttacksWithRawResponse, - AttacksWithStreamingResponse, - AsyncAttacksWithStreamingResponse, + AttacksResource, + AsyncAttacksResource, + AttacksResourceWithRawResponse, + AsyncAttacksResourceWithRawResponse, + AttacksResourceWithStreamingResponse, + AsyncAttacksResourceWithStreamingResponse, ) __all__ = [ - "Layer3", - "AsyncLayer3", - "Layer3WithRawResponse", - "AsyncLayer3WithRawResponse", - "Layer3WithStreamingResponse", - "AsyncLayer3WithStreamingResponse", - "Layer7", - "AsyncLayer7", - "Layer7WithRawResponse", - "AsyncLayer7WithRawResponse", - "Layer7WithStreamingResponse", - "AsyncLayer7WithStreamingResponse", - "Attacks", - "AsyncAttacks", - "AttacksWithRawResponse", - "AsyncAttacksWithRawResponse", - "AttacksWithStreamingResponse", - "AsyncAttacksWithStreamingResponse", + "Layer3Resource", + "AsyncLayer3Resource", + "Layer3ResourceWithRawResponse", + "AsyncLayer3ResourceWithRawResponse", + "Layer3ResourceWithStreamingResponse", + "AsyncLayer3ResourceWithStreamingResponse", + "Layer7Resource", + "AsyncLayer7Resource", + "Layer7ResourceWithRawResponse", + "AsyncLayer7ResourceWithRawResponse", + "Layer7ResourceWithStreamingResponse", + "AsyncLayer7ResourceWithStreamingResponse", + "AttacksResource", + "AsyncAttacksResource", + "AttacksResourceWithRawResponse", + "AsyncAttacksResourceWithRawResponse", + "AttacksResourceWithStreamingResponse", + "AsyncAttacksResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/attacks/attacks.py b/src/cloudflare/resources/radar/attacks/attacks.py index a3ce837053a..7e3c8daa7cf 100644 --- a/src/cloudflare/resources/radar/attacks/attacks.py +++ b/src/cloudflare/resources/radar/attacks/attacks.py @@ -3,112 +3,112 @@ from __future__ import annotations from .layer3 import ( - Layer3, - AsyncLayer3, - Layer3WithRawResponse, - AsyncLayer3WithRawResponse, - Layer3WithStreamingResponse, - AsyncLayer3WithStreamingResponse, + Layer3Resource, + AsyncLayer3Resource, + Layer3ResourceWithRawResponse, + AsyncLayer3ResourceWithRawResponse, + Layer3ResourceWithStreamingResponse, + AsyncLayer3ResourceWithStreamingResponse, ) from .layer7 import ( - Layer7, - AsyncLayer7, - Layer7WithRawResponse, - AsyncLayer7WithRawResponse, - Layer7WithStreamingResponse, - AsyncLayer7WithStreamingResponse, + Layer7Resource, + AsyncLayer7Resource, + Layer7ResourceWithRawResponse, + AsyncLayer7ResourceWithRawResponse, + Layer7ResourceWithStreamingResponse, + AsyncLayer7ResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -from .layer3.layer3 import Layer3, AsyncLayer3 -from .layer7.layer7 import Layer7, AsyncLayer7 +from .layer3.layer3 import Layer3Resource, AsyncLayer3Resource +from .layer7.layer7 import Layer7Resource, AsyncLayer7Resource -__all__ = ["Attacks", "AsyncAttacks"] +__all__ = ["AttacksResource", "AsyncAttacksResource"] -class Attacks(SyncAPIResource): +class AttacksResource(SyncAPIResource): @cached_property - def layer3(self) -> Layer3: - return Layer3(self._client) + def layer3(self) -> Layer3Resource: + return Layer3Resource(self._client) @cached_property - def layer7(self) -> Layer7: - return Layer7(self._client) + def layer7(self) -> Layer7Resource: + return Layer7Resource(self._client) @cached_property - def with_raw_response(self) -> AttacksWithRawResponse: - return AttacksWithRawResponse(self) + def with_raw_response(self) -> AttacksResourceWithRawResponse: + return AttacksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AttacksWithStreamingResponse: - return AttacksWithStreamingResponse(self) + def with_streaming_response(self) -> AttacksResourceWithStreamingResponse: + return AttacksResourceWithStreamingResponse(self) -class AsyncAttacks(AsyncAPIResource): +class AsyncAttacksResource(AsyncAPIResource): @cached_property - def layer3(self) -> AsyncLayer3: - return AsyncLayer3(self._client) + def layer3(self) -> AsyncLayer3Resource: + return AsyncLayer3Resource(self._client) @cached_property - def layer7(self) -> AsyncLayer7: - return AsyncLayer7(self._client) + def layer7(self) -> AsyncLayer7Resource: + return AsyncLayer7Resource(self._client) @cached_property - def with_raw_response(self) -> AsyncAttacksWithRawResponse: - return AsyncAttacksWithRawResponse(self) + def with_raw_response(self) -> AsyncAttacksResourceWithRawResponse: + return AsyncAttacksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAttacksWithStreamingResponse: - return AsyncAttacksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAttacksResourceWithStreamingResponse: + return AsyncAttacksResourceWithStreamingResponse(self) -class AttacksWithRawResponse: - def __init__(self, attacks: Attacks) -> None: +class AttacksResourceWithRawResponse: + def __init__(self, attacks: AttacksResource) -> None: self._attacks = attacks @cached_property - def layer3(self) -> Layer3WithRawResponse: - return Layer3WithRawResponse(self._attacks.layer3) + def layer3(self) -> Layer3ResourceWithRawResponse: + return Layer3ResourceWithRawResponse(self._attacks.layer3) @cached_property - def layer7(self) -> Layer7WithRawResponse: - return Layer7WithRawResponse(self._attacks.layer7) + def layer7(self) -> Layer7ResourceWithRawResponse: + return Layer7ResourceWithRawResponse(self._attacks.layer7) -class AsyncAttacksWithRawResponse: - def __init__(self, attacks: AsyncAttacks) -> None: +class AsyncAttacksResourceWithRawResponse: + def __init__(self, attacks: AsyncAttacksResource) -> None: self._attacks = attacks @cached_property - def layer3(self) -> AsyncLayer3WithRawResponse: - return AsyncLayer3WithRawResponse(self._attacks.layer3) + def layer3(self) -> AsyncLayer3ResourceWithRawResponse: + return AsyncLayer3ResourceWithRawResponse(self._attacks.layer3) @cached_property - def layer7(self) -> AsyncLayer7WithRawResponse: - return AsyncLayer7WithRawResponse(self._attacks.layer7) + def layer7(self) -> AsyncLayer7ResourceWithRawResponse: + return AsyncLayer7ResourceWithRawResponse(self._attacks.layer7) -class AttacksWithStreamingResponse: - def __init__(self, attacks: Attacks) -> None: +class AttacksResourceWithStreamingResponse: + def __init__(self, attacks: AttacksResource) -> None: self._attacks = attacks @cached_property - def layer3(self) -> Layer3WithStreamingResponse: - return Layer3WithStreamingResponse(self._attacks.layer3) + def layer3(self) -> Layer3ResourceWithStreamingResponse: + return Layer3ResourceWithStreamingResponse(self._attacks.layer3) @cached_property - def layer7(self) -> Layer7WithStreamingResponse: - return Layer7WithStreamingResponse(self._attacks.layer7) + def layer7(self) -> Layer7ResourceWithStreamingResponse: + return Layer7ResourceWithStreamingResponse(self._attacks.layer7) -class AsyncAttacksWithStreamingResponse: - def __init__(self, attacks: AsyncAttacks) -> None: +class AsyncAttacksResourceWithStreamingResponse: + def __init__(self, attacks: AsyncAttacksResource) -> None: self._attacks = attacks @cached_property - def layer3(self) -> AsyncLayer3WithStreamingResponse: - return AsyncLayer3WithStreamingResponse(self._attacks.layer3) + def layer3(self) -> AsyncLayer3ResourceWithStreamingResponse: + return AsyncLayer3ResourceWithStreamingResponse(self._attacks.layer3) @cached_property - def layer7(self) -> AsyncLayer7WithStreamingResponse: - return AsyncLayer7WithStreamingResponse(self._attacks.layer7) + def layer7(self) -> AsyncLayer7ResourceWithStreamingResponse: + return AsyncLayer7ResourceWithStreamingResponse(self._attacks.layer7) diff --git a/src/cloudflare/resources/radar/attacks/layer3/__init__.py b/src/cloudflare/resources/radar/attacks/layer3/__init__.py index c1b035369df..833984a8122 100644 --- a/src/cloudflare/resources/radar/attacks/layer3/__init__.py +++ b/src/cloudflare/resources/radar/attacks/layer3/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .layer3 import ( - Layer3, - AsyncLayer3, - Layer3WithRawResponse, - AsyncLayer3WithRawResponse, - Layer3WithStreamingResponse, - AsyncLayer3WithStreamingResponse, + Layer3Resource, + AsyncLayer3Resource, + Layer3ResourceWithRawResponse, + AsyncLayer3ResourceWithRawResponse, + Layer3ResourceWithStreamingResponse, + AsyncLayer3ResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) __all__ = [ - "Summary", - "AsyncSummary", - "SummaryWithRawResponse", - "AsyncSummaryWithRawResponse", - "SummaryWithStreamingResponse", - "AsyncSummaryWithStreamingResponse", - "TimeseriesGroups", - "AsyncTimeseriesGroups", - "TimeseriesGroupsWithRawResponse", - "AsyncTimeseriesGroupsWithRawResponse", - "TimeseriesGroupsWithStreamingResponse", - "AsyncTimeseriesGroupsWithStreamingResponse", - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "Layer3", - "AsyncLayer3", - "Layer3WithRawResponse", - "AsyncLayer3WithRawResponse", - "Layer3WithStreamingResponse", - "AsyncLayer3WithStreamingResponse", + "SummaryResource", + "AsyncSummaryResource", + "SummaryResourceWithRawResponse", + "AsyncSummaryResourceWithRawResponse", + "SummaryResourceWithStreamingResponse", + "AsyncSummaryResourceWithStreamingResponse", + "TimeseriesGroupsResource", + "AsyncTimeseriesGroupsResource", + "TimeseriesGroupsResourceWithRawResponse", + "AsyncTimeseriesGroupsResourceWithRawResponse", + "TimeseriesGroupsResourceWithStreamingResponse", + "AsyncTimeseriesGroupsResourceWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "Layer3Resource", + "AsyncLayer3Resource", + "Layer3ResourceWithRawResponse", + "AsyncLayer3ResourceWithRawResponse", + "Layer3ResourceWithStreamingResponse", + "AsyncLayer3ResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/attacks/layer3/layer3.py b/src/cloudflare/resources/radar/attacks/layer3/layer3.py index 9d1f27f7697..22a1a7a706b 100644 --- a/src/cloudflare/resources/radar/attacks/layer3/layer3.py +++ b/src/cloudflare/resources/radar/attacks/layer3/layer3.py @@ -9,22 +9,22 @@ import httpx from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) -from .top.top import Top, AsyncTop +from .top.top import TopResource, AsyncTopResource from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( maybe_transform, @@ -43,38 +43,39 @@ make_request_options, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) -from .....types.radar.attacks import Layer3TimeseriesResponse, layer3_timeseries_params +from .....types.radar.attacks import layer3_timeseries_params +from .....types.radar.attacks.layer3_timeseries_response import Layer3TimeseriesResponse -__all__ = ["Layer3", "AsyncLayer3"] +__all__ = ["Layer3Resource", "AsyncLayer3Resource"] -class Layer3(SyncAPIResource): +class Layer3Resource(SyncAPIResource): @cached_property - def summary(self) -> Summary: - return Summary(self._client) + def summary(self) -> SummaryResource: + return SummaryResource(self._client) @cached_property - def timeseries_groups(self) -> TimeseriesGroups: - return TimeseriesGroups(self._client) + def timeseries_groups(self) -> TimeseriesGroupsResource: + return TimeseriesGroupsResource(self._client) @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def with_raw_response(self) -> Layer3WithRawResponse: - return Layer3WithRawResponse(self) + def with_raw_response(self) -> Layer3ResourceWithRawResponse: + return Layer3ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> Layer3WithStreamingResponse: - return Layer3WithStreamingResponse(self) + def with_streaming_response(self) -> Layer3ResourceWithStreamingResponse: + return Layer3ResourceWithStreamingResponse(self) def timeseries( self, @@ -197,32 +198,32 @@ def timeseries( }, layer3_timeseries_params.Layer3TimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Layer3TimeseriesResponse]._unwrapper, ), cast_to=cast(Type[Layer3TimeseriesResponse], ResultWrapper[Layer3TimeseriesResponse]), ) -class AsyncLayer3(AsyncAPIResource): +class AsyncLayer3Resource(AsyncAPIResource): @cached_property - def summary(self) -> AsyncSummary: - return AsyncSummary(self._client) + def summary(self) -> AsyncSummaryResource: + return AsyncSummaryResource(self._client) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroups: - return AsyncTimeseriesGroups(self._client) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResource: + return AsyncTimeseriesGroupsResource(self._client) @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLayer3WithRawResponse: - return AsyncLayer3WithRawResponse(self) + def with_raw_response(self) -> AsyncLayer3ResourceWithRawResponse: + return AsyncLayer3ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLayer3WithStreamingResponse: - return AsyncLayer3WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLayer3ResourceWithStreamingResponse: + return AsyncLayer3ResourceWithStreamingResponse(self) async def timeseries( self, @@ -345,14 +346,14 @@ async def timeseries( }, layer3_timeseries_params.Layer3TimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Layer3TimeseriesResponse]._unwrapper, ), cast_to=cast(Type[Layer3TimeseriesResponse], ResultWrapper[Layer3TimeseriesResponse]), ) -class Layer3WithRawResponse: - def __init__(self, layer3: Layer3) -> None: +class Layer3ResourceWithRawResponse: + def __init__(self, layer3: Layer3Resource) -> None: self._layer3 = layer3 self.timeseries = to_raw_response_wrapper( @@ -360,20 +361,20 @@ def __init__(self, layer3: Layer3) -> None: ) @cached_property - def summary(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self._layer3.summary) + def summary(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self._layer3.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self._layer3.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self._layer3.timeseries_groups) @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._layer3.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._layer3.top) -class AsyncLayer3WithRawResponse: - def __init__(self, layer3: AsyncLayer3) -> None: +class AsyncLayer3ResourceWithRawResponse: + def __init__(self, layer3: AsyncLayer3Resource) -> None: self._layer3 = layer3 self.timeseries = async_to_raw_response_wrapper( @@ -381,20 +382,20 @@ def __init__(self, layer3: AsyncLayer3) -> None: ) @cached_property - def summary(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self._layer3.summary) + def summary(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self._layer3.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self._layer3.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self._layer3.timeseries_groups) @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._layer3.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._layer3.top) -class Layer3WithStreamingResponse: - def __init__(self, layer3: Layer3) -> None: +class Layer3ResourceWithStreamingResponse: + def __init__(self, layer3: Layer3Resource) -> None: self._layer3 = layer3 self.timeseries = to_streamed_response_wrapper( @@ -402,20 +403,20 @@ def __init__(self, layer3: Layer3) -> None: ) @cached_property - def summary(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self._layer3.summary) + def summary(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self._layer3.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self._layer3.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self._layer3.timeseries_groups) @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._layer3.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._layer3.top) -class AsyncLayer3WithStreamingResponse: - def __init__(self, layer3: AsyncLayer3) -> None: +class AsyncLayer3ResourceWithStreamingResponse: + def __init__(self, layer3: AsyncLayer3Resource) -> None: self._layer3 = layer3 self.timeseries = async_to_streamed_response_wrapper( @@ -423,13 +424,13 @@ def __init__(self, layer3: AsyncLayer3) -> None: ) @cached_property - def summary(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self._layer3.summary) + def summary(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self._layer3.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self._layer3.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self._layer3.timeseries_groups) @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._layer3.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._layer3.top) diff --git a/src/cloudflare/resources/radar/attacks/layer3/summary.py b/src/cloudflare/resources/radar/attacks/layer3/summary.py index 1211d2a30b7..d894d181af2 100644 --- a/src/cloudflare/resources/radar/attacks/layer3/summary.py +++ b/src/cloudflare/resources/radar/attacks/layer3/summary.py @@ -26,12 +26,6 @@ make_request_options, ) from .....types.radar.attacks.layer3 import ( - SummaryGetResponse, - SummaryVectorResponse, - SummaryBitrateResponse, - SummaryDurationResponse, - SummaryProtocolResponse, - SummaryIPVersionResponse, summary_get_params, summary_vector_params, summary_bitrate_params, @@ -39,18 +33,24 @@ summary_protocol_params, summary_ip_version_params, ) +from .....types.radar.attacks.layer3.summary_get_response import SummaryGetResponse +from .....types.radar.attacks.layer3.summary_vector_response import SummaryVectorResponse +from .....types.radar.attacks.layer3.summary_bitrate_response import SummaryBitrateResponse +from .....types.radar.attacks.layer3.summary_duration_response import SummaryDurationResponse +from .....types.radar.attacks.layer3.summary_protocol_response import SummaryProtocolResponse +from .....types.radar.attacks.layer3.summary_ip_version_response import SummaryIPVersionResponse -__all__ = ["Summary", "AsyncSummary"] +__all__ = ["SummaryResource", "AsyncSummaryResource"] -class Summary(SyncAPIResource): +class SummaryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self) + def with_raw_response(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self) + def with_streaming_response(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self) def bitrate( self, @@ -152,7 +152,7 @@ def bitrate( }, summary_bitrate_params.SummaryBitrateParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryBitrateResponse]._unwrapper, ), cast_to=cast(Type[SummaryBitrateResponse], ResultWrapper[SummaryBitrateResponse]), ) @@ -257,7 +257,7 @@ def duration( }, summary_duration_params.SummaryDurationParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDurationResponse]._unwrapper, ), cast_to=cast(Type[SummaryDurationResponse], ResultWrapper[SummaryDurationResponse]), ) @@ -356,7 +356,7 @@ def get( }, summary_get_params.SummaryGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryGetResponse]._unwrapper, ), cast_to=cast(Type[SummaryGetResponse], ResultWrapper[SummaryGetResponse]), ) @@ -457,7 +457,7 @@ def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -558,7 +558,7 @@ def protocol( }, summary_protocol_params.SummaryProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryProtocolResponse]._unwrapper, ), cast_to=cast(Type[SummaryProtocolResponse], ResultWrapper[SummaryProtocolResponse]), ) @@ -663,20 +663,20 @@ def vector( }, summary_vector_params.SummaryVectorParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryVectorResponse]._unwrapper, ), cast_to=cast(Type[SummaryVectorResponse], ResultWrapper[SummaryVectorResponse]), ) -class AsyncSummary(AsyncAPIResource): +class AsyncSummaryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self) + def with_raw_response(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self) async def bitrate( self, @@ -778,7 +778,7 @@ async def bitrate( }, summary_bitrate_params.SummaryBitrateParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryBitrateResponse]._unwrapper, ), cast_to=cast(Type[SummaryBitrateResponse], ResultWrapper[SummaryBitrateResponse]), ) @@ -883,7 +883,7 @@ async def duration( }, summary_duration_params.SummaryDurationParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDurationResponse]._unwrapper, ), cast_to=cast(Type[SummaryDurationResponse], ResultWrapper[SummaryDurationResponse]), ) @@ -982,7 +982,7 @@ async def get( }, summary_get_params.SummaryGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryGetResponse]._unwrapper, ), cast_to=cast(Type[SummaryGetResponse], ResultWrapper[SummaryGetResponse]), ) @@ -1083,7 +1083,7 @@ async def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -1184,7 +1184,7 @@ async def protocol( }, summary_protocol_params.SummaryProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryProtocolResponse]._unwrapper, ), cast_to=cast(Type[SummaryProtocolResponse], ResultWrapper[SummaryProtocolResponse]), ) @@ -1289,14 +1289,14 @@ async def vector( }, summary_vector_params.SummaryVectorParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryVectorResponse]._unwrapper, ), cast_to=cast(Type[SummaryVectorResponse], ResultWrapper[SummaryVectorResponse]), ) -class SummaryWithRawResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithRawResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.bitrate = to_raw_response_wrapper( @@ -1319,8 +1319,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithRawResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithRawResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.bitrate = async_to_raw_response_wrapper( @@ -1343,8 +1343,8 @@ def __init__(self, summary: AsyncSummary) -> None: ) -class SummaryWithStreamingResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithStreamingResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.bitrate = to_streamed_response_wrapper( @@ -1367,8 +1367,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithStreamingResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithStreamingResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.bitrate = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/attacks/layer3/timeseries_groups.py b/src/cloudflare/resources/radar/attacks/layer3/timeseries_groups.py index b74025fc3c2..17011e35747 100644 --- a/src/cloudflare/resources/radar/attacks/layer3/timeseries_groups.py +++ b/src/cloudflare/resources/radar/attacks/layer3/timeseries_groups.py @@ -26,14 +26,6 @@ make_request_options, ) from .....types.radar.attacks.layer3 import ( - TimeseriesGroupGetResponse, - TimeseriesGroupVectorResponse, - TimeseriesGroupBitrateResponse, - TimeseriesGroupDurationResponse, - TimeseriesGroupIndustryResponse, - TimeseriesGroupProtocolResponse, - TimeseriesGroupVerticalResponse, - TimeseriesGroupIPVersionResponse, timeseries_group_get_params, timeseries_group_vector_params, timeseries_group_bitrate_params, @@ -43,18 +35,26 @@ timeseries_group_vertical_params, timeseries_group_ip_version_params, ) +from .....types.radar.attacks.layer3.timeseries_group_get_response import TimeseriesGroupGetResponse +from .....types.radar.attacks.layer3.timeseries_group_vector_response import TimeseriesGroupVectorResponse +from .....types.radar.attacks.layer3.timeseries_group_bitrate_response import TimeseriesGroupBitrateResponse +from .....types.radar.attacks.layer3.timeseries_group_duration_response import TimeseriesGroupDurationResponse +from .....types.radar.attacks.layer3.timeseries_group_industry_response import TimeseriesGroupIndustryResponse +from .....types.radar.attacks.layer3.timeseries_group_protocol_response import TimeseriesGroupProtocolResponse +from .....types.radar.attacks.layer3.timeseries_group_vertical_response import TimeseriesGroupVerticalResponse +from .....types.radar.attacks.layer3.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse -__all__ = ["TimeseriesGroups", "AsyncTimeseriesGroups"] +__all__ = ["TimeseriesGroupsResource", "AsyncTimeseriesGroupsResource"] -class TimeseriesGroups(SyncAPIResource): +class TimeseriesGroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self) def bitrate( self, @@ -167,7 +167,7 @@ def bitrate( }, timeseries_group_bitrate_params.TimeseriesGroupBitrateParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupBitrateResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupBitrateResponse], ResultWrapper[TimeseriesGroupBitrateResponse]), ) @@ -283,7 +283,7 @@ def duration( }, timeseries_group_duration_params.TimeseriesGroupDurationParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDurationResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDurationResponse], ResultWrapper[TimeseriesGroupDurationResponse]), ) @@ -388,7 +388,7 @@ def get( }, timeseries_group_get_params.TimeseriesGroupGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupGetResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupGetResponse], ResultWrapper[TimeseriesGroupGetResponse]), ) @@ -505,7 +505,7 @@ def industry( }, timeseries_group_industry_params.TimeseriesGroupIndustryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIndustryResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIndustryResponse], ResultWrapper[TimeseriesGroupIndustryResponse]), ) @@ -617,7 +617,7 @@ def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -729,7 +729,7 @@ def protocol( }, timeseries_group_protocol_params.TimeseriesGroupProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupProtocolResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupProtocolResponse], ResultWrapper[TimeseriesGroupProtocolResponse]), ) @@ -850,7 +850,7 @@ def vector( }, timeseries_group_vector_params.TimeseriesGroupVectorParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupVectorResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupVectorResponse], ResultWrapper[TimeseriesGroupVectorResponse]), ) @@ -967,20 +967,20 @@ def vertical( }, timeseries_group_vertical_params.TimeseriesGroupVerticalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupVerticalResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupVerticalResponse], ResultWrapper[TimeseriesGroupVerticalResponse]), ) -class AsyncTimeseriesGroups(AsyncAPIResource): +class AsyncTimeseriesGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self) async def bitrate( self, @@ -1093,7 +1093,7 @@ async def bitrate( }, timeseries_group_bitrate_params.TimeseriesGroupBitrateParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupBitrateResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupBitrateResponse], ResultWrapper[TimeseriesGroupBitrateResponse]), ) @@ -1209,7 +1209,7 @@ async def duration( }, timeseries_group_duration_params.TimeseriesGroupDurationParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDurationResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDurationResponse], ResultWrapper[TimeseriesGroupDurationResponse]), ) @@ -1314,7 +1314,7 @@ async def get( }, timeseries_group_get_params.TimeseriesGroupGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupGetResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupGetResponse], ResultWrapper[TimeseriesGroupGetResponse]), ) @@ -1431,7 +1431,7 @@ async def industry( }, timeseries_group_industry_params.TimeseriesGroupIndustryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIndustryResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIndustryResponse], ResultWrapper[TimeseriesGroupIndustryResponse]), ) @@ -1543,7 +1543,7 @@ async def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -1655,7 +1655,7 @@ async def protocol( }, timeseries_group_protocol_params.TimeseriesGroupProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupProtocolResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupProtocolResponse], ResultWrapper[TimeseriesGroupProtocolResponse]), ) @@ -1776,7 +1776,7 @@ async def vector( }, timeseries_group_vector_params.TimeseriesGroupVectorParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupVectorResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupVectorResponse], ResultWrapper[TimeseriesGroupVectorResponse]), ) @@ -1893,14 +1893,14 @@ async def vertical( }, timeseries_group_vertical_params.TimeseriesGroupVerticalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupVerticalResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupVerticalResponse], ResultWrapper[TimeseriesGroupVerticalResponse]), ) -class TimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.bitrate = to_raw_response_wrapper( @@ -1929,8 +1929,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.bitrate = async_to_raw_response_wrapper( @@ -1959,8 +1959,8 @@ def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: ) -class TimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.bitrate = to_streamed_response_wrapper( @@ -1989,8 +1989,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.bitrate = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/attacks/layer3/top/__init__.py b/src/cloudflare/resources/radar/attacks/layer3/top/__init__.py index 3dba539269a..f95820bdd99 100644 --- a/src/cloudflare/resources/radar/attacks/layer3/top/__init__.py +++ b/src/cloudflare/resources/radar/attacks/layer3/top/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) __all__ = [ - "Locations", - "AsyncLocations", - "LocationsWithRawResponse", - "AsyncLocationsWithRawResponse", - "LocationsWithStreamingResponse", - "AsyncLocationsWithStreamingResponse", - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/attacks/layer3/top/locations.py b/src/cloudflare/resources/radar/attacks/layer3/top/locations.py index c43f60fdbf2..998521834a5 100644 --- a/src/cloudflare/resources/radar/attacks/layer3/top/locations.py +++ b/src/cloudflare/resources/radar/attacks/layer3/top/locations.py @@ -25,24 +25,21 @@ from ......_base_client import ( make_request_options, ) -from ......types.radar.attacks.layer3.top import ( - LocationOriginResponse, - LocationTargetResponse, - location_origin_params, - location_target_params, -) +from ......types.radar.attacks.layer3.top import location_origin_params, location_target_params +from ......types.radar.attacks.layer3.top.location_origin_response import LocationOriginResponse +from ......types.radar.attacks.layer3.top.location_target_response import LocationTargetResponse -__all__ = ["Locations", "AsyncLocations"] +__all__ = ["LocationsResource", "AsyncLocationsResource"] -class Locations(SyncAPIResource): +class LocationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self) + def with_raw_response(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self) + def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self) def origin( self, @@ -143,7 +140,7 @@ def origin( }, location_origin_params.LocationOriginParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationOriginResponse]._unwrapper, ), cast_to=cast(Type[LocationOriginResponse], ResultWrapper[LocationOriginResponse]), ) @@ -247,20 +244,20 @@ def target( }, location_target_params.LocationTargetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationTargetResponse]._unwrapper, ), cast_to=cast(Type[LocationTargetResponse], ResultWrapper[LocationTargetResponse]), ) -class AsyncLocations(AsyncAPIResource): +class AsyncLocationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self) + def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self) async def origin( self, @@ -361,7 +358,7 @@ async def origin( }, location_origin_params.LocationOriginParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationOriginResponse]._unwrapper, ), cast_to=cast(Type[LocationOriginResponse], ResultWrapper[LocationOriginResponse]), ) @@ -465,14 +462,14 @@ async def target( }, location_target_params.LocationTargetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationTargetResponse]._unwrapper, ), cast_to=cast(Type[LocationTargetResponse], ResultWrapper[LocationTargetResponse]), ) -class LocationsWithRawResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithRawResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.origin = to_raw_response_wrapper( @@ -483,8 +480,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithRawResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithRawResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.origin = async_to_raw_response_wrapper( @@ -495,8 +492,8 @@ def __init__(self, locations: AsyncLocations) -> None: ) -class LocationsWithStreamingResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithStreamingResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.origin = to_streamed_response_wrapper( @@ -507,8 +504,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithStreamingResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithStreamingResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.origin = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/attacks/layer3/top/top.py b/src/cloudflare/resources/radar/attacks/layer3/top/top.py index 0e00ba162db..984669786f7 100644 --- a/src/cloudflare/resources/radar/attacks/layer3/top/top.py +++ b/src/cloudflare/resources/radar/attacks/layer3/top/top.py @@ -9,12 +9,12 @@ import httpx from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven from ......_utils import ( @@ -33,30 +33,26 @@ from ......_base_client import ( make_request_options, ) -from ......types.radar.attacks.layer3 import ( - TopAttacksResponse, - TopIndustryResponse, - TopVerticalResponse, - top_attacks_params, - top_industry_params, - top_vertical_params, -) +from ......types.radar.attacks.layer3 import top_attacks_params, top_industry_params, top_vertical_params +from ......types.radar.attacks.layer3.top_attacks_response import TopAttacksResponse +from ......types.radar.attacks.layer3.top_industry_response import TopIndustryResponse +from ......types.radar.attacks.layer3.top_vertical_response import TopVerticalResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def locations(self) -> Locations: - return Locations(self._client) + def locations(self) -> LocationsResource: + return LocationsResource(self._client) @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def attacks( self, @@ -172,7 +168,7 @@ def attacks( }, top_attacks_params.TopAttacksParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAttacksResponse]._unwrapper, ), cast_to=cast(Type[TopAttacksResponse], ResultWrapper[TopAttacksResponse]), ) @@ -276,7 +272,7 @@ def industry( }, top_industry_params.TopIndustryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopIndustryResponse]._unwrapper, ), cast_to=cast(Type[TopIndustryResponse], ResultWrapper[TopIndustryResponse]), ) @@ -380,24 +376,24 @@ def vertical( }, top_vertical_params.TopVerticalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopVerticalResponse]._unwrapper, ), cast_to=cast(Type[TopVerticalResponse], ResultWrapper[TopVerticalResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def locations(self) -> AsyncLocations: - return AsyncLocations(self._client) + def locations(self) -> AsyncLocationsResource: + return AsyncLocationsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def attacks( self, @@ -513,7 +509,7 @@ async def attacks( }, top_attacks_params.TopAttacksParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAttacksResponse]._unwrapper, ), cast_to=cast(Type[TopAttacksResponse], ResultWrapper[TopAttacksResponse]), ) @@ -617,7 +613,7 @@ async def industry( }, top_industry_params.TopIndustryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopIndustryResponse]._unwrapper, ), cast_to=cast(Type[TopIndustryResponse], ResultWrapper[TopIndustryResponse]), ) @@ -721,14 +717,14 @@ async def vertical( }, top_vertical_params.TopVerticalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopVerticalResponse]._unwrapper, ), cast_to=cast(Type[TopVerticalResponse], ResultWrapper[TopVerticalResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.attacks = to_raw_response_wrapper( @@ -742,12 +738,12 @@ def __init__(self, top: Top) -> None: ) @cached_property - def locations(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self._top.locations) + def locations(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self._top.locations) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.attacks = async_to_raw_response_wrapper( @@ -761,12 +757,12 @@ def __init__(self, top: AsyncTop) -> None: ) @cached_property - def locations(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self._top.locations) + def locations(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self._top.locations) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.attacks = to_streamed_response_wrapper( @@ -780,12 +776,12 @@ def __init__(self, top: Top) -> None: ) @cached_property - def locations(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self._top.locations) + def locations(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self._top.locations) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.attacks = async_to_streamed_response_wrapper( @@ -799,5 +795,5 @@ def __init__(self, top: AsyncTop) -> None: ) @cached_property - def locations(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self._top.locations) + def locations(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self._top.locations) diff --git a/src/cloudflare/resources/radar/attacks/layer7/__init__.py b/src/cloudflare/resources/radar/attacks/layer7/__init__.py index 2a5e0aa0887..fad86e433d2 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/__init__.py +++ b/src/cloudflare/resources/radar/attacks/layer7/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .layer7 import ( - Layer7, - AsyncLayer7, - Layer7WithRawResponse, - AsyncLayer7WithRawResponse, - Layer7WithStreamingResponse, - AsyncLayer7WithStreamingResponse, + Layer7Resource, + AsyncLayer7Resource, + Layer7ResourceWithRawResponse, + AsyncLayer7ResourceWithRawResponse, + Layer7ResourceWithStreamingResponse, + AsyncLayer7ResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) __all__ = [ - "Summary", - "AsyncSummary", - "SummaryWithRawResponse", - "AsyncSummaryWithRawResponse", - "SummaryWithStreamingResponse", - "AsyncSummaryWithStreamingResponse", - "TimeseriesGroups", - "AsyncTimeseriesGroups", - "TimeseriesGroupsWithRawResponse", - "AsyncTimeseriesGroupsWithRawResponse", - "TimeseriesGroupsWithStreamingResponse", - "AsyncTimeseriesGroupsWithStreamingResponse", - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "Layer7", - "AsyncLayer7", - "Layer7WithRawResponse", - "AsyncLayer7WithRawResponse", - "Layer7WithStreamingResponse", - "AsyncLayer7WithStreamingResponse", + "SummaryResource", + "AsyncSummaryResource", + "SummaryResourceWithRawResponse", + "AsyncSummaryResourceWithRawResponse", + "SummaryResourceWithStreamingResponse", + "AsyncSummaryResourceWithStreamingResponse", + "TimeseriesGroupsResource", + "AsyncTimeseriesGroupsResource", + "TimeseriesGroupsResourceWithRawResponse", + "AsyncTimeseriesGroupsResourceWithRawResponse", + "TimeseriesGroupsResourceWithStreamingResponse", + "AsyncTimeseriesGroupsResourceWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "Layer7Resource", + "AsyncLayer7Resource", + "Layer7ResourceWithRawResponse", + "AsyncLayer7ResourceWithRawResponse", + "Layer7ResourceWithStreamingResponse", + "AsyncLayer7ResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/attacks/layer7/layer7.py b/src/cloudflare/resources/radar/attacks/layer7/layer7.py index 4dd93635ef0..713c3e11de2 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/layer7.py +++ b/src/cloudflare/resources/radar/attacks/layer7/layer7.py @@ -9,22 +9,22 @@ import httpx from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) -from .top.top import Top, AsyncTop +from .top.top import TopResource, AsyncTopResource from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( maybe_transform, @@ -43,38 +43,39 @@ make_request_options, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) -from .....types.radar.attacks import Layer7TimeseriesResponse, layer7_timeseries_params +from .....types.radar.attacks import layer7_timeseries_params +from .....types.radar.attacks.layer7_timeseries_response import Layer7TimeseriesResponse -__all__ = ["Layer7", "AsyncLayer7"] +__all__ = ["Layer7Resource", "AsyncLayer7Resource"] -class Layer7(SyncAPIResource): +class Layer7Resource(SyncAPIResource): @cached_property - def summary(self) -> Summary: - return Summary(self._client) + def summary(self) -> SummaryResource: + return SummaryResource(self._client) @cached_property - def timeseries_groups(self) -> TimeseriesGroups: - return TimeseriesGroups(self._client) + def timeseries_groups(self) -> TimeseriesGroupsResource: + return TimeseriesGroupsResource(self._client) @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def with_raw_response(self) -> Layer7WithRawResponse: - return Layer7WithRawResponse(self) + def with_raw_response(self) -> Layer7ResourceWithRawResponse: + return Layer7ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> Layer7WithStreamingResponse: - return Layer7WithStreamingResponse(self) + def with_streaming_response(self) -> Layer7ResourceWithStreamingResponse: + return Layer7ResourceWithStreamingResponse(self) def timeseries( self, @@ -191,32 +192,32 @@ def timeseries( }, layer7_timeseries_params.Layer7TimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Layer7TimeseriesResponse]._unwrapper, ), cast_to=cast(Type[Layer7TimeseriesResponse], ResultWrapper[Layer7TimeseriesResponse]), ) -class AsyncLayer7(AsyncAPIResource): +class AsyncLayer7Resource(AsyncAPIResource): @cached_property - def summary(self) -> AsyncSummary: - return AsyncSummary(self._client) + def summary(self) -> AsyncSummaryResource: + return AsyncSummaryResource(self._client) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroups: - return AsyncTimeseriesGroups(self._client) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResource: + return AsyncTimeseriesGroupsResource(self._client) @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLayer7WithRawResponse: - return AsyncLayer7WithRawResponse(self) + def with_raw_response(self) -> AsyncLayer7ResourceWithRawResponse: + return AsyncLayer7ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLayer7WithStreamingResponse: - return AsyncLayer7WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLayer7ResourceWithStreamingResponse: + return AsyncLayer7ResourceWithStreamingResponse(self) async def timeseries( self, @@ -333,14 +334,14 @@ async def timeseries( }, layer7_timeseries_params.Layer7TimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Layer7TimeseriesResponse]._unwrapper, ), cast_to=cast(Type[Layer7TimeseriesResponse], ResultWrapper[Layer7TimeseriesResponse]), ) -class Layer7WithRawResponse: - def __init__(self, layer7: Layer7) -> None: +class Layer7ResourceWithRawResponse: + def __init__(self, layer7: Layer7Resource) -> None: self._layer7 = layer7 self.timeseries = to_raw_response_wrapper( @@ -348,20 +349,20 @@ def __init__(self, layer7: Layer7) -> None: ) @cached_property - def summary(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self._layer7.summary) + def summary(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self._layer7.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self._layer7.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self._layer7.timeseries_groups) @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._layer7.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._layer7.top) -class AsyncLayer7WithRawResponse: - def __init__(self, layer7: AsyncLayer7) -> None: +class AsyncLayer7ResourceWithRawResponse: + def __init__(self, layer7: AsyncLayer7Resource) -> None: self._layer7 = layer7 self.timeseries = async_to_raw_response_wrapper( @@ -369,20 +370,20 @@ def __init__(self, layer7: AsyncLayer7) -> None: ) @cached_property - def summary(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self._layer7.summary) + def summary(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self._layer7.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self._layer7.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self._layer7.timeseries_groups) @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._layer7.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._layer7.top) -class Layer7WithStreamingResponse: - def __init__(self, layer7: Layer7) -> None: +class Layer7ResourceWithStreamingResponse: + def __init__(self, layer7: Layer7Resource) -> None: self._layer7 = layer7 self.timeseries = to_streamed_response_wrapper( @@ -390,20 +391,20 @@ def __init__(self, layer7: Layer7) -> None: ) @cached_property - def summary(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self._layer7.summary) + def summary(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self._layer7.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self._layer7.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self._layer7.timeseries_groups) @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._layer7.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._layer7.top) -class AsyncLayer7WithStreamingResponse: - def __init__(self, layer7: AsyncLayer7) -> None: +class AsyncLayer7ResourceWithStreamingResponse: + def __init__(self, layer7: AsyncLayer7Resource) -> None: self._layer7 = layer7 self.timeseries = async_to_streamed_response_wrapper( @@ -411,13 +412,13 @@ def __init__(self, layer7: AsyncLayer7) -> None: ) @cached_property - def summary(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self._layer7.summary) + def summary(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self._layer7.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self._layer7.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self._layer7.timeseries_groups) @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._layer7.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._layer7.top) diff --git a/src/cloudflare/resources/radar/attacks/layer7/summary.py b/src/cloudflare/resources/radar/attacks/layer7/summary.py index c5beec05461..9af8c3dd0d9 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/summary.py +++ b/src/cloudflare/resources/radar/attacks/layer7/summary.py @@ -26,12 +26,6 @@ make_request_options, ) from .....types.radar.attacks.layer7 import ( - SummaryGetResponse, - SummaryIPVersionResponse, - SummaryHTTPMethodResponse, - SummaryHTTPVersionResponse, - SummaryManagedRulesResponse, - SummaryMitigationProductResponse, summary_get_params, summary_ip_version_params, summary_http_method_params, @@ -39,18 +33,24 @@ summary_managed_rules_params, summary_mitigation_product_params, ) +from .....types.radar.attacks.layer7.summary_get_response import SummaryGetResponse +from .....types.radar.attacks.layer7.summary_ip_version_response import SummaryIPVersionResponse +from .....types.radar.attacks.layer7.summary_http_method_response import SummaryHTTPMethodResponse +from .....types.radar.attacks.layer7.summary_http_version_response import SummaryHTTPVersionResponse +from .....types.radar.attacks.layer7.summary_managed_rules_response import SummaryManagedRulesResponse +from .....types.radar.attacks.layer7.summary_mitigation_product_response import SummaryMitigationProductResponse -__all__ = ["Summary", "AsyncSummary"] +__all__ = ["SummaryResource", "AsyncSummaryResource"] -class Summary(SyncAPIResource): +class SummaryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self) + def with_raw_response(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self) + def with_streaming_response(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self) def get( self, @@ -145,7 +145,7 @@ def get( }, summary_get_params.SummaryGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryGetResponse]._unwrapper, ), cast_to=cast(Type[SummaryGetResponse], ResultWrapper[SummaryGetResponse]), ) @@ -260,7 +260,7 @@ def http_method( }, summary_http_method_params.SummaryHTTPMethodParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryHTTPMethodResponse]._unwrapper, ), cast_to=cast(Type[SummaryHTTPMethodResponse], ResultWrapper[SummaryHTTPMethodResponse]), ) @@ -425,7 +425,7 @@ def http_version( }, summary_http_version_params.SummaryHTTPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryHTTPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryHTTPVersionResponse], ResultWrapper[SummaryHTTPVersionResponse]), ) @@ -590,7 +590,7 @@ def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -759,7 +759,7 @@ def managed_rules( }, summary_managed_rules_params.SummaryManagedRulesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryManagedRulesResponse]._unwrapper, ), cast_to=cast(Type[SummaryManagedRulesResponse], ResultWrapper[SummaryManagedRulesResponse]), ) @@ -919,20 +919,20 @@ def mitigation_product( }, summary_mitigation_product_params.SummaryMitigationProductParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryMitigationProductResponse]._unwrapper, ), cast_to=cast(Type[SummaryMitigationProductResponse], ResultWrapper[SummaryMitigationProductResponse]), ) -class AsyncSummary(AsyncAPIResource): +class AsyncSummaryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self) + def with_raw_response(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self) async def get( self, @@ -1027,7 +1027,7 @@ async def get( }, summary_get_params.SummaryGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryGetResponse]._unwrapper, ), cast_to=cast(Type[SummaryGetResponse], ResultWrapper[SummaryGetResponse]), ) @@ -1142,7 +1142,7 @@ async def http_method( }, summary_http_method_params.SummaryHTTPMethodParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryHTTPMethodResponse]._unwrapper, ), cast_to=cast(Type[SummaryHTTPMethodResponse], ResultWrapper[SummaryHTTPMethodResponse]), ) @@ -1307,7 +1307,7 @@ async def http_version( }, summary_http_version_params.SummaryHTTPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryHTTPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryHTTPVersionResponse], ResultWrapper[SummaryHTTPVersionResponse]), ) @@ -1472,7 +1472,7 @@ async def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -1641,7 +1641,7 @@ async def managed_rules( }, summary_managed_rules_params.SummaryManagedRulesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryManagedRulesResponse]._unwrapper, ), cast_to=cast(Type[SummaryManagedRulesResponse], ResultWrapper[SummaryManagedRulesResponse]), ) @@ -1801,14 +1801,14 @@ async def mitigation_product( }, summary_mitigation_product_params.SummaryMitigationProductParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryMitigationProductResponse]._unwrapper, ), cast_to=cast(Type[SummaryMitigationProductResponse], ResultWrapper[SummaryMitigationProductResponse]), ) -class SummaryWithRawResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithRawResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.get = to_raw_response_wrapper( @@ -1831,8 +1831,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithRawResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithRawResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.get = async_to_raw_response_wrapper( @@ -1855,8 +1855,8 @@ def __init__(self, summary: AsyncSummary) -> None: ) -class SummaryWithStreamingResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithStreamingResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.get = to_streamed_response_wrapper( @@ -1879,8 +1879,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithStreamingResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithStreamingResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/attacks/layer7/timeseries_groups.py b/src/cloudflare/resources/radar/attacks/layer7/timeseries_groups.py index fca1bb8411a..35c2b923a1b 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/timeseries_groups.py +++ b/src/cloudflare/resources/radar/attacks/layer7/timeseries_groups.py @@ -26,14 +26,6 @@ make_request_options, ) from .....types.radar.attacks.layer7 import ( - TimeseriesGroupGetResponse, - TimeseriesGroupIndustryResponse, - TimeseriesGroupVerticalResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupHTTPMethodResponse, - TimeseriesGroupHTTPVersionResponse, - TimeseriesGroupManagedRulesResponse, - TimeseriesGroupMitigationProductResponse, timeseries_group_get_params, timeseries_group_industry_params, timeseries_group_vertical_params, @@ -43,18 +35,28 @@ timeseries_group_managed_rules_params, timeseries_group_mitigation_product_params, ) +from .....types.radar.attacks.layer7.timeseries_group_get_response import TimeseriesGroupGetResponse +from .....types.radar.attacks.layer7.timeseries_group_industry_response import TimeseriesGroupIndustryResponse +from .....types.radar.attacks.layer7.timeseries_group_vertical_response import TimeseriesGroupVerticalResponse +from .....types.radar.attacks.layer7.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse +from .....types.radar.attacks.layer7.timeseries_group_http_method_response import TimeseriesGroupHTTPMethodResponse +from .....types.radar.attacks.layer7.timeseries_group_http_version_response import TimeseriesGroupHTTPVersionResponse +from .....types.radar.attacks.layer7.timeseries_group_managed_rules_response import TimeseriesGroupManagedRulesResponse +from .....types.radar.attacks.layer7.timeseries_group_mitigation_product_response import ( + TimeseriesGroupMitigationProductResponse, +) -__all__ = ["TimeseriesGroups", "AsyncTimeseriesGroups"] +__all__ = ["TimeseriesGroupsResource", "AsyncTimeseriesGroupsResource"] -class TimeseriesGroups(SyncAPIResource): +class TimeseriesGroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self) def get( self, @@ -156,7 +158,7 @@ def get( }, timeseries_group_get_params.TimeseriesGroupGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupGetResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupGetResponse], ResultWrapper[TimeseriesGroupGetResponse]), ) @@ -282,7 +284,7 @@ def http_method( }, timeseries_group_http_method_params.TimeseriesGroupHTTPMethodParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupHTTPMethodResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupHTTPMethodResponse], ResultWrapper[TimeseriesGroupHTTPMethodResponse]), ) @@ -458,7 +460,7 @@ def http_version( }, timeseries_group_http_version_params.TimeseriesGroupHTTPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupHTTPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupHTTPVersionResponse], ResultWrapper[TimeseriesGroupHTTPVersionResponse]), ) @@ -643,7 +645,7 @@ def industry( }, timeseries_group_industry_params.TimeseriesGroupIndustryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIndustryResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIndustryResponse], ResultWrapper[TimeseriesGroupIndustryResponse]), ) @@ -819,7 +821,7 @@ def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -999,7 +1001,7 @@ def managed_rules( }, timeseries_group_managed_rules_params.TimeseriesGroupManagedRulesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupManagedRulesResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupManagedRulesResponse], ResultWrapper[TimeseriesGroupManagedRulesResponse]), ) @@ -1170,7 +1172,7 @@ def mitigation_product( }, timeseries_group_mitigation_product_params.TimeseriesGroupMitigationProductParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupMitigationProductResponse]._unwrapper, ), cast_to=cast( Type[TimeseriesGroupMitigationProductResponse], ResultWrapper[TimeseriesGroupMitigationProductResponse] @@ -1357,20 +1359,20 @@ def vertical( }, timeseries_group_vertical_params.TimeseriesGroupVerticalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupVerticalResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupVerticalResponse], ResultWrapper[TimeseriesGroupVerticalResponse]), ) -class AsyncTimeseriesGroups(AsyncAPIResource): +class AsyncTimeseriesGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self) async def get( self, @@ -1472,7 +1474,7 @@ async def get( }, timeseries_group_get_params.TimeseriesGroupGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupGetResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupGetResponse], ResultWrapper[TimeseriesGroupGetResponse]), ) @@ -1598,7 +1600,7 @@ async def http_method( }, timeseries_group_http_method_params.TimeseriesGroupHTTPMethodParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupHTTPMethodResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupHTTPMethodResponse], ResultWrapper[TimeseriesGroupHTTPMethodResponse]), ) @@ -1774,7 +1776,7 @@ async def http_version( }, timeseries_group_http_version_params.TimeseriesGroupHTTPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupHTTPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupHTTPVersionResponse], ResultWrapper[TimeseriesGroupHTTPVersionResponse]), ) @@ -1959,7 +1961,7 @@ async def industry( }, timeseries_group_industry_params.TimeseriesGroupIndustryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIndustryResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIndustryResponse], ResultWrapper[TimeseriesGroupIndustryResponse]), ) @@ -2135,7 +2137,7 @@ async def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -2315,7 +2317,7 @@ async def managed_rules( }, timeseries_group_managed_rules_params.TimeseriesGroupManagedRulesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupManagedRulesResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupManagedRulesResponse], ResultWrapper[TimeseriesGroupManagedRulesResponse]), ) @@ -2486,7 +2488,7 @@ async def mitigation_product( }, timeseries_group_mitigation_product_params.TimeseriesGroupMitigationProductParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupMitigationProductResponse]._unwrapper, ), cast_to=cast( Type[TimeseriesGroupMitigationProductResponse], ResultWrapper[TimeseriesGroupMitigationProductResponse] @@ -2673,14 +2675,14 @@ async def vertical( }, timeseries_group_vertical_params.TimeseriesGroupVerticalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupVerticalResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupVerticalResponse], ResultWrapper[TimeseriesGroupVerticalResponse]), ) -class TimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.get = to_raw_response_wrapper( @@ -2709,8 +2711,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.get = async_to_raw_response_wrapper( @@ -2739,8 +2741,8 @@ def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: ) -class TimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.get = to_streamed_response_wrapper( @@ -2769,8 +2771,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/attacks/layer7/top/__init__.py b/src/cloudflare/resources/radar/attacks/layer7/top/__init__.py index 9ae2c034c88..d890a7946fb 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/top/__init__.py +++ b/src/cloudflare/resources/radar/attacks/layer7/top/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .ases import ( - Ases, - AsyncAses, - AsesWithRawResponse, - AsyncAsesWithRawResponse, - AsesWithStreamingResponse, - AsyncAsesWithStreamingResponse, + AsesResource, + AsyncAsesResource, + AsesResourceWithRawResponse, + AsyncAsesResourceWithRawResponse, + AsesResourceWithStreamingResponse, + AsyncAsesResourceWithStreamingResponse, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) __all__ = [ - "Locations", - "AsyncLocations", - "LocationsWithRawResponse", - "AsyncLocationsWithRawResponse", - "LocationsWithStreamingResponse", - "AsyncLocationsWithStreamingResponse", - "Ases", - "AsyncAses", - "AsesWithRawResponse", - "AsyncAsesWithRawResponse", - "AsesWithStreamingResponse", - "AsyncAsesWithStreamingResponse", - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", + "AsesResource", + "AsyncAsesResource", + "AsesResourceWithRawResponse", + "AsyncAsesResourceWithRawResponse", + "AsesResourceWithStreamingResponse", + "AsyncAsesResourceWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/attacks/layer7/top/ases.py b/src/cloudflare/resources/radar/attacks/layer7/top/ases.py index 997ba52f44b..f6d4c1a7476 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/top/ases.py +++ b/src/cloudflare/resources/radar/attacks/layer7/top/ases.py @@ -25,19 +25,20 @@ from ......_base_client import ( make_request_options, ) -from ......types.radar.attacks.layer7.top import AseOriginResponse, ase_origin_params +from ......types.radar.attacks.layer7.top import ase_origin_params +from ......types.radar.attacks.layer7.top.ase_origin_response import AseOriginResponse -__all__ = ["Ases", "AsyncAses"] +__all__ = ["AsesResource", "AsyncAsesResource"] -class Ases(SyncAPIResource): +class AsesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AsesWithRawResponse: - return AsesWithRawResponse(self) + def with_raw_response(self) -> AsesResourceWithRawResponse: + return AsesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsesWithStreamingResponse: - return AsesWithStreamingResponse(self) + def with_streaming_response(self) -> AsesResourceWithStreamingResponse: + return AsesResourceWithStreamingResponse(self) def origin( self, @@ -133,20 +134,20 @@ def origin( }, ase_origin_params.AseOriginParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AseOriginResponse]._unwrapper, ), cast_to=cast(Type[AseOriginResponse], ResultWrapper[AseOriginResponse]), ) -class AsyncAses(AsyncAPIResource): +class AsyncAsesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAsesWithRawResponse: - return AsyncAsesWithRawResponse(self) + def with_raw_response(self) -> AsyncAsesResourceWithRawResponse: + return AsyncAsesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAsesWithStreamingResponse: - return AsyncAsesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAsesResourceWithStreamingResponse: + return AsyncAsesResourceWithStreamingResponse(self) async def origin( self, @@ -242,14 +243,14 @@ async def origin( }, ase_origin_params.AseOriginParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AseOriginResponse]._unwrapper, ), cast_to=cast(Type[AseOriginResponse], ResultWrapper[AseOriginResponse]), ) -class AsesWithRawResponse: - def __init__(self, ases: Ases) -> None: +class AsesResourceWithRawResponse: + def __init__(self, ases: AsesResource) -> None: self._ases = ases self.origin = to_raw_response_wrapper( @@ -257,8 +258,8 @@ def __init__(self, ases: Ases) -> None: ) -class AsyncAsesWithRawResponse: - def __init__(self, ases: AsyncAses) -> None: +class AsyncAsesResourceWithRawResponse: + def __init__(self, ases: AsyncAsesResource) -> None: self._ases = ases self.origin = async_to_raw_response_wrapper( @@ -266,8 +267,8 @@ def __init__(self, ases: AsyncAses) -> None: ) -class AsesWithStreamingResponse: - def __init__(self, ases: Ases) -> None: +class AsesResourceWithStreamingResponse: + def __init__(self, ases: AsesResource) -> None: self._ases = ases self.origin = to_streamed_response_wrapper( @@ -275,8 +276,8 @@ def __init__(self, ases: Ases) -> None: ) -class AsyncAsesWithStreamingResponse: - def __init__(self, ases: AsyncAses) -> None: +class AsyncAsesResourceWithStreamingResponse: + def __init__(self, ases: AsyncAsesResource) -> None: self._ases = ases self.origin = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/attacks/layer7/top/locations.py b/src/cloudflare/resources/radar/attacks/layer7/top/locations.py index 06f1803d1a1..033bda36fdf 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/top/locations.py +++ b/src/cloudflare/resources/radar/attacks/layer7/top/locations.py @@ -25,24 +25,21 @@ from ......_base_client import ( make_request_options, ) -from ......types.radar.attacks.layer7.top import ( - LocationOriginResponse, - LocationTargetResponse, - location_origin_params, - location_target_params, -) +from ......types.radar.attacks.layer7.top import location_origin_params, location_target_params +from ......types.radar.attacks.layer7.top.location_origin_response import LocationOriginResponse +from ......types.radar.attacks.layer7.top.location_target_response import LocationTargetResponse -__all__ = ["Locations", "AsyncLocations"] +__all__ = ["LocationsResource", "AsyncLocationsResource"] -class Locations(SyncAPIResource): +class LocationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self) + def with_raw_response(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self) + def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self) def origin( self, @@ -138,7 +135,7 @@ def origin( }, location_origin_params.LocationOriginParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationOriginResponse]._unwrapper, ), cast_to=cast(Type[LocationOriginResponse], ResultWrapper[LocationOriginResponse]), ) @@ -231,20 +228,20 @@ def target( }, location_target_params.LocationTargetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationTargetResponse]._unwrapper, ), cast_to=cast(Type[LocationTargetResponse], ResultWrapper[LocationTargetResponse]), ) -class AsyncLocations(AsyncAPIResource): +class AsyncLocationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self) + def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self) async def origin( self, @@ -340,7 +337,7 @@ async def origin( }, location_origin_params.LocationOriginParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationOriginResponse]._unwrapper, ), cast_to=cast(Type[LocationOriginResponse], ResultWrapper[LocationOriginResponse]), ) @@ -433,14 +430,14 @@ async def target( }, location_target_params.LocationTargetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationTargetResponse]._unwrapper, ), cast_to=cast(Type[LocationTargetResponse], ResultWrapper[LocationTargetResponse]), ) -class LocationsWithRawResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithRawResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.origin = to_raw_response_wrapper( @@ -451,8 +448,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithRawResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithRawResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.origin = async_to_raw_response_wrapper( @@ -463,8 +460,8 @@ def __init__(self, locations: AsyncLocations) -> None: ) -class LocationsWithStreamingResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithStreamingResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.origin = to_streamed_response_wrapper( @@ -475,8 +472,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithStreamingResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithStreamingResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.origin = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/attacks/layer7/top/top.py b/src/cloudflare/resources/radar/attacks/layer7/top/top.py index 12ecbdf5c0b..38429445f3e 100644 --- a/src/cloudflare/resources/radar/attacks/layer7/top/top.py +++ b/src/cloudflare/resources/radar/attacks/layer7/top/top.py @@ -9,20 +9,20 @@ import httpx from .ases import ( - Ases, - AsyncAses, - AsesWithRawResponse, - AsyncAsesWithRawResponse, - AsesWithStreamingResponse, - AsyncAsesWithStreamingResponse, + AsesResource, + AsyncAsesResource, + AsesResourceWithRawResponse, + AsyncAsesResourceWithRawResponse, + AsesResourceWithStreamingResponse, + AsyncAsesResourceWithStreamingResponse, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven from ......_utils import ( @@ -41,34 +41,30 @@ from ......_base_client import ( make_request_options, ) -from ......types.radar.attacks.layer7 import ( - TopAttacksResponse, - TopIndustryResponse, - TopVerticalResponse, - top_attacks_params, - top_industry_params, - top_vertical_params, -) +from ......types.radar.attacks.layer7 import top_attacks_params, top_industry_params, top_vertical_params +from ......types.radar.attacks.layer7.top_attacks_response import TopAttacksResponse +from ......types.radar.attacks.layer7.top_industry_response import TopIndustryResponse +from ......types.radar.attacks.layer7.top_vertical_response import TopVerticalResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def locations(self) -> Locations: - return Locations(self._client) + def locations(self) -> LocationsResource: + return LocationsResource(self._client) @cached_property - def ases(self) -> Ases: - return Ases(self._client) + def ases(self) -> AsesResource: + return AsesResource(self._client) @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def attacks( self, @@ -188,7 +184,7 @@ def attacks( }, top_attacks_params.TopAttacksParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAttacksResponse]._unwrapper, ), cast_to=cast(Type[TopAttacksResponse], ResultWrapper[TopAttacksResponse]), ) @@ -290,7 +286,7 @@ def industry( }, top_industry_params.TopIndustryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopIndustryResponse]._unwrapper, ), cast_to=cast(Type[TopIndustryResponse], ResultWrapper[TopIndustryResponse]), ) @@ -392,28 +388,28 @@ def vertical( }, top_vertical_params.TopVerticalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopVerticalResponse]._unwrapper, ), cast_to=cast(Type[TopVerticalResponse], ResultWrapper[TopVerticalResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def locations(self) -> AsyncLocations: - return AsyncLocations(self._client) + def locations(self) -> AsyncLocationsResource: + return AsyncLocationsResource(self._client) @cached_property - def ases(self) -> AsyncAses: - return AsyncAses(self._client) + def ases(self) -> AsyncAsesResource: + return AsyncAsesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def attacks( self, @@ -533,7 +529,7 @@ async def attacks( }, top_attacks_params.TopAttacksParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAttacksResponse]._unwrapper, ), cast_to=cast(Type[TopAttacksResponse], ResultWrapper[TopAttacksResponse]), ) @@ -635,7 +631,7 @@ async def industry( }, top_industry_params.TopIndustryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopIndustryResponse]._unwrapper, ), cast_to=cast(Type[TopIndustryResponse], ResultWrapper[TopIndustryResponse]), ) @@ -737,14 +733,14 @@ async def vertical( }, top_vertical_params.TopVerticalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopVerticalResponse]._unwrapper, ), cast_to=cast(Type[TopVerticalResponse], ResultWrapper[TopVerticalResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.attacks = to_raw_response_wrapper( @@ -758,16 +754,16 @@ def __init__(self, top: Top) -> None: ) @cached_property - def locations(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self._top.locations) + def locations(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self._top.locations) @cached_property - def ases(self) -> AsesWithRawResponse: - return AsesWithRawResponse(self._top.ases) + def ases(self) -> AsesResourceWithRawResponse: + return AsesResourceWithRawResponse(self._top.ases) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.attacks = async_to_raw_response_wrapper( @@ -781,16 +777,16 @@ def __init__(self, top: AsyncTop) -> None: ) @cached_property - def locations(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self._top.locations) + def locations(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self._top.locations) @cached_property - def ases(self) -> AsyncAsesWithRawResponse: - return AsyncAsesWithRawResponse(self._top.ases) + def ases(self) -> AsyncAsesResourceWithRawResponse: + return AsyncAsesResourceWithRawResponse(self._top.ases) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.attacks = to_streamed_response_wrapper( @@ -804,16 +800,16 @@ def __init__(self, top: Top) -> None: ) @cached_property - def locations(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self._top.locations) + def locations(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self._top.locations) @cached_property - def ases(self) -> AsesWithStreamingResponse: - return AsesWithStreamingResponse(self._top.ases) + def ases(self) -> AsesResourceWithStreamingResponse: + return AsesResourceWithStreamingResponse(self._top.ases) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.attacks = async_to_streamed_response_wrapper( @@ -827,9 +823,9 @@ def __init__(self, top: AsyncTop) -> None: ) @cached_property - def locations(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self._top.locations) + def locations(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self._top.locations) @cached_property - def ases(self) -> AsyncAsesWithStreamingResponse: - return AsyncAsesWithStreamingResponse(self._top.ases) + def ases(self) -> AsyncAsesResourceWithStreamingResponse: + return AsyncAsesResourceWithStreamingResponse(self._top.ases) diff --git a/src/cloudflare/resources/radar/bgp/__init__.py b/src/cloudflare/resources/radar/bgp/__init__.py index 889d13b9f17..b143abf6005 100644 --- a/src/cloudflare/resources/radar/bgp/__init__.py +++ b/src/cloudflare/resources/radar/bgp/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .bgp import ( - BGP, - AsyncBGP, - BGPWithRawResponse, - AsyncBGPWithRawResponse, - BGPWithStreamingResponse, - AsyncBGPWithStreamingResponse, + BGPResource, + AsyncBGPResource, + BGPResourceWithRawResponse, + AsyncBGPResourceWithRawResponse, + BGPResourceWithStreamingResponse, + AsyncBGPResourceWithStreamingResponse, ) from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .leaks import ( - Leaks, - AsyncLeaks, - LeaksWithRawResponse, - AsyncLeaksWithRawResponse, - LeaksWithStreamingResponse, - AsyncLeaksWithStreamingResponse, + LeaksResource, + AsyncLeaksResource, + LeaksResourceWithRawResponse, + AsyncLeaksResourceWithRawResponse, + LeaksResourceWithStreamingResponse, + AsyncLeaksResourceWithStreamingResponse, ) from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, ) from .hijacks import ( - Hijacks, - AsyncHijacks, - HijacksWithRawResponse, - AsyncHijacksWithRawResponse, - HijacksWithStreamingResponse, - AsyncHijacksWithStreamingResponse, + HijacksResource, + AsyncHijacksResource, + HijacksResourceWithRawResponse, + AsyncHijacksResourceWithRawResponse, + HijacksResourceWithStreamingResponse, + AsyncHijacksResourceWithStreamingResponse, ) __all__ = [ - "Leaks", - "AsyncLeaks", - "LeaksWithRawResponse", - "AsyncLeaksWithRawResponse", - "LeaksWithStreamingResponse", - "AsyncLeaksWithStreamingResponse", - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "Hijacks", - "AsyncHijacks", - "HijacksWithRawResponse", - "AsyncHijacksWithRawResponse", - "HijacksWithStreamingResponse", - "AsyncHijacksWithStreamingResponse", - "Routes", - "AsyncRoutes", - "RoutesWithRawResponse", - "AsyncRoutesWithRawResponse", - "RoutesWithStreamingResponse", - "AsyncRoutesWithStreamingResponse", - "BGP", - "AsyncBGP", - "BGPWithRawResponse", - "AsyncBGPWithRawResponse", - "BGPWithStreamingResponse", - "AsyncBGPWithStreamingResponse", + "LeaksResource", + "AsyncLeaksResource", + "LeaksResourceWithRawResponse", + "AsyncLeaksResourceWithRawResponse", + "LeaksResourceWithStreamingResponse", + "AsyncLeaksResourceWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "HijacksResource", + "AsyncHijacksResource", + "HijacksResourceWithRawResponse", + "AsyncHijacksResourceWithRawResponse", + "HijacksResourceWithStreamingResponse", + "AsyncHijacksResourceWithStreamingResponse", + "RoutesResource", + "AsyncRoutesResource", + "RoutesResourceWithRawResponse", + "AsyncRoutesResourceWithRawResponse", + "RoutesResourceWithStreamingResponse", + "AsyncRoutesResourceWithStreamingResponse", + "BGPResource", + "AsyncBGPResource", + "BGPResourceWithRawResponse", + "AsyncBGPResourceWithRawResponse", + "BGPResourceWithStreamingResponse", + "AsyncBGPResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/bgp/bgp.py b/src/cloudflare/resources/radar/bgp/bgp.py index d2636d2e58a..2eb211139be 100644 --- a/src/cloudflare/resources/radar/bgp/bgp.py +++ b/src/cloudflare/resources/radar/bgp/bgp.py @@ -9,44 +9,45 @@ import httpx from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .leaks import ( - Leaks, - AsyncLeaks, - LeaksWithRawResponse, - AsyncLeaksWithRawResponse, - LeaksWithStreamingResponse, - AsyncLeaksWithStreamingResponse, + LeaksResource, + AsyncLeaksResource, + LeaksResourceWithRawResponse, + AsyncLeaksResourceWithRawResponse, + LeaksResourceWithStreamingResponse, + AsyncLeaksResourceWithStreamingResponse, ) from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, ) from .hijacks import ( - Hijacks, - AsyncHijacks, - HijacksWithRawResponse, - AsyncHijacksWithRawResponse, - HijacksWithStreamingResponse, - AsyncHijacksWithStreamingResponse, + HijacksResource, + AsyncHijacksResource, + HijacksResourceWithRawResponse, + AsyncHijacksResourceWithRawResponse, + HijacksResourceWithStreamingResponse, + AsyncHijacksResourceWithStreamingResponse, ) -from .top.top import Top, AsyncTop +from .top.top import TopResource, AsyncTopResource from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( maybe_transform, async_maybe_transform, ) from ...._compat import cached_property +from .leaks.leaks import LeaksResource, AsyncLeaksResource from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( to_raw_response_wrapper, @@ -55,38 +56,40 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.radar import BGPTimeseriesResponse, bgp_timeseries_params +from ....types.radar import bgp_timeseries_params from ...._base_client import ( make_request_options, ) +from .hijacks.hijacks import HijacksResource, AsyncHijacksResource +from ....types.radar.bgp_timeseries_response import BGPTimeseriesResponse -__all__ = ["BGP", "AsyncBGP"] +__all__ = ["BGPResource", "AsyncBGPResource"] -class BGP(SyncAPIResource): +class BGPResource(SyncAPIResource): @cached_property - def leaks(self) -> Leaks: - return Leaks(self._client) + def leaks(self) -> LeaksResource: + return LeaksResource(self._client) @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def hijacks(self) -> Hijacks: - return Hijacks(self._client) + def hijacks(self) -> HijacksResource: + return HijacksResource(self._client) @cached_property - def routes(self) -> Routes: - return Routes(self._client) + def routes(self) -> RoutesResource: + return RoutesResource(self._client) @cached_property - def with_raw_response(self) -> BGPWithRawResponse: - return BGPWithRawResponse(self) + def with_raw_response(self) -> BGPResourceWithRawResponse: + return BGPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BGPWithStreamingResponse: - return BGPWithStreamingResponse(self) + def with_streaming_response(self) -> BGPResourceWithStreamingResponse: + return BGPResourceWithStreamingResponse(self) def timeseries( self, @@ -186,36 +189,36 @@ def timeseries( }, bgp_timeseries_params.BGPTimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BGPTimeseriesResponse]._unwrapper, ), cast_to=cast(Type[BGPTimeseriesResponse], ResultWrapper[BGPTimeseriesResponse]), ) -class AsyncBGP(AsyncAPIResource): +class AsyncBGPResource(AsyncAPIResource): @cached_property - def leaks(self) -> AsyncLeaks: - return AsyncLeaks(self._client) + def leaks(self) -> AsyncLeaksResource: + return AsyncLeaksResource(self._client) @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def hijacks(self) -> AsyncHijacks: - return AsyncHijacks(self._client) + def hijacks(self) -> AsyncHijacksResource: + return AsyncHijacksResource(self._client) @cached_property - def routes(self) -> AsyncRoutes: - return AsyncRoutes(self._client) + def routes(self) -> AsyncRoutesResource: + return AsyncRoutesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncBGPWithRawResponse: - return AsyncBGPWithRawResponse(self) + def with_raw_response(self) -> AsyncBGPResourceWithRawResponse: + return AsyncBGPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBGPWithStreamingResponse: - return AsyncBGPWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBGPResourceWithStreamingResponse: + return AsyncBGPResourceWithStreamingResponse(self) async def timeseries( self, @@ -315,14 +318,14 @@ async def timeseries( }, bgp_timeseries_params.BGPTimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BGPTimeseriesResponse]._unwrapper, ), cast_to=cast(Type[BGPTimeseriesResponse], ResultWrapper[BGPTimeseriesResponse]), ) -class BGPWithRawResponse: - def __init__(self, bgp: BGP) -> None: +class BGPResourceWithRawResponse: + def __init__(self, bgp: BGPResource) -> None: self._bgp = bgp self.timeseries = to_raw_response_wrapper( @@ -330,24 +333,24 @@ def __init__(self, bgp: BGP) -> None: ) @cached_property - def leaks(self) -> LeaksWithRawResponse: - return LeaksWithRawResponse(self._bgp.leaks) + def leaks(self) -> LeaksResourceWithRawResponse: + return LeaksResourceWithRawResponse(self._bgp.leaks) @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._bgp.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._bgp.top) @cached_property - def hijacks(self) -> HijacksWithRawResponse: - return HijacksWithRawResponse(self._bgp.hijacks) + def hijacks(self) -> HijacksResourceWithRawResponse: + return HijacksResourceWithRawResponse(self._bgp.hijacks) @cached_property - def routes(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self._bgp.routes) + def routes(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self._bgp.routes) -class AsyncBGPWithRawResponse: - def __init__(self, bgp: AsyncBGP) -> None: +class AsyncBGPResourceWithRawResponse: + def __init__(self, bgp: AsyncBGPResource) -> None: self._bgp = bgp self.timeseries = async_to_raw_response_wrapper( @@ -355,24 +358,24 @@ def __init__(self, bgp: AsyncBGP) -> None: ) @cached_property - def leaks(self) -> AsyncLeaksWithRawResponse: - return AsyncLeaksWithRawResponse(self._bgp.leaks) + def leaks(self) -> AsyncLeaksResourceWithRawResponse: + return AsyncLeaksResourceWithRawResponse(self._bgp.leaks) @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._bgp.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._bgp.top) @cached_property - def hijacks(self) -> AsyncHijacksWithRawResponse: - return AsyncHijacksWithRawResponse(self._bgp.hijacks) + def hijacks(self) -> AsyncHijacksResourceWithRawResponse: + return AsyncHijacksResourceWithRawResponse(self._bgp.hijacks) @cached_property - def routes(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self._bgp.routes) + def routes(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self._bgp.routes) -class BGPWithStreamingResponse: - def __init__(self, bgp: BGP) -> None: +class BGPResourceWithStreamingResponse: + def __init__(self, bgp: BGPResource) -> None: self._bgp = bgp self.timeseries = to_streamed_response_wrapper( @@ -380,24 +383,24 @@ def __init__(self, bgp: BGP) -> None: ) @cached_property - def leaks(self) -> LeaksWithStreamingResponse: - return LeaksWithStreamingResponse(self._bgp.leaks) + def leaks(self) -> LeaksResourceWithStreamingResponse: + return LeaksResourceWithStreamingResponse(self._bgp.leaks) @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._bgp.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._bgp.top) @cached_property - def hijacks(self) -> HijacksWithStreamingResponse: - return HijacksWithStreamingResponse(self._bgp.hijacks) + def hijacks(self) -> HijacksResourceWithStreamingResponse: + return HijacksResourceWithStreamingResponse(self._bgp.hijacks) @cached_property - def routes(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(self._bgp.routes) + def routes(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self._bgp.routes) -class AsyncBGPWithStreamingResponse: - def __init__(self, bgp: AsyncBGP) -> None: +class AsyncBGPResourceWithStreamingResponse: + def __init__(self, bgp: AsyncBGPResource) -> None: self._bgp = bgp self.timeseries = async_to_streamed_response_wrapper( @@ -405,17 +408,17 @@ def __init__(self, bgp: AsyncBGP) -> None: ) @cached_property - def leaks(self) -> AsyncLeaksWithStreamingResponse: - return AsyncLeaksWithStreamingResponse(self._bgp.leaks) + def leaks(self) -> AsyncLeaksResourceWithStreamingResponse: + return AsyncLeaksResourceWithStreamingResponse(self._bgp.leaks) @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._bgp.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._bgp.top) @cached_property - def hijacks(self) -> AsyncHijacksWithStreamingResponse: - return AsyncHijacksWithStreamingResponse(self._bgp.hijacks) + def hijacks(self) -> AsyncHijacksResourceWithStreamingResponse: + return AsyncHijacksResourceWithStreamingResponse(self._bgp.hijacks) @cached_property - def routes(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(self._bgp.routes) + def routes(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self._bgp.routes) diff --git a/src/cloudflare/resources/radar/bgp/hijacks.py b/src/cloudflare/resources/radar/bgp/hijacks.py deleted file mode 100644 index ffe551e6def..00000000000 --- a/src/cloudflare/resources/radar/bgp/hijacks.py +++ /dev/null @@ -1,330 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Union, cast -from datetime import datetime -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.radar.bgp import HijackEventsResponse, hijack_events_params - -__all__ = ["Hijacks", "AsyncHijacks"] - - -class Hijacks(SyncAPIResource): - @cached_property - def with_raw_response(self) -> HijacksWithRawResponse: - return HijacksWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> HijacksWithStreamingResponse: - return HijacksWithStreamingResponse(self) - - def events( - self, - *, - date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - date_range: Literal[ - "1d", - "2d", - "7d", - "14d", - "28d", - "12w", - "24w", - "52w", - "1dControl", - "2dControl", - "7dControl", - "14dControl", - "28dControl", - "12wControl", - "24wControl", - ] - | NotGiven = NOT_GIVEN, - date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, - event_id: int | NotGiven = NOT_GIVEN, - format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, - hijacker_asn: int | NotGiven = NOT_GIVEN, - involved_asn: int | NotGiven = NOT_GIVEN, - involved_country: str | NotGiven = NOT_GIVEN, - max_confidence: int | NotGiven = NOT_GIVEN, - min_confidence: int | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - per_page: int | NotGiven = NOT_GIVEN, - prefix: str | NotGiven = NOT_GIVEN, - sort_by: Literal["ID", "TIME", "CONFIDENCE"] | NotGiven = NOT_GIVEN, - sort_order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN, - victim_asn: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HijackEventsResponse: - """Get the BGP hijack events. - - (Beta) - - Args: - date_end: End of the date range (inclusive). - - date_range: Shorthand date ranges for the last X days - use when you don't need specific - start and end dates. - - date_start: Start of the date range (inclusive). - - event_id: The unique identifier of a event - - format: Format results are returned in. - - hijacker_asn: The potential hijacker AS of a BGP hijack event - - involved_asn: The potential hijacker or victim AS of a BGP hijack event - - involved_country: The country code of the potential hijacker or victim AS of a BGP hijack event - - max_confidence: The maximum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) - - min_confidence: The minimum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) - - page: Current page number, starting from 1 - - per_page: Number of entries per page - - prefix: The prefix hijacked during a BGP hijack event - - sort_by: Sort events by field - - sort_order: Sort order - - victim_asn: The potential victim AS of a BGP hijack event - - 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 - """ - return self._get( - "/radar/bgp/hijacks/events", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "date_end": date_end, - "date_range": date_range, - "date_start": date_start, - "event_id": event_id, - "format": format, - "hijacker_asn": hijacker_asn, - "involved_asn": involved_asn, - "involved_country": involved_country, - "max_confidence": max_confidence, - "min_confidence": min_confidence, - "page": page, - "per_page": per_page, - "prefix": prefix, - "sort_by": sort_by, - "sort_order": sort_order, - "victim_asn": victim_asn, - }, - hijack_events_params.HijackEventsParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HijackEventsResponse], ResultWrapper[HijackEventsResponse]), - ) - - -class AsyncHijacks(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncHijacksWithRawResponse: - return AsyncHijacksWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncHijacksWithStreamingResponse: - return AsyncHijacksWithStreamingResponse(self) - - async def events( - self, - *, - date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - date_range: Literal[ - "1d", - "2d", - "7d", - "14d", - "28d", - "12w", - "24w", - "52w", - "1dControl", - "2dControl", - "7dControl", - "14dControl", - "28dControl", - "12wControl", - "24wControl", - ] - | NotGiven = NOT_GIVEN, - date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, - event_id: int | NotGiven = NOT_GIVEN, - format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, - hijacker_asn: int | NotGiven = NOT_GIVEN, - involved_asn: int | NotGiven = NOT_GIVEN, - involved_country: str | NotGiven = NOT_GIVEN, - max_confidence: int | NotGiven = NOT_GIVEN, - min_confidence: int | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - per_page: int | NotGiven = NOT_GIVEN, - prefix: str | NotGiven = NOT_GIVEN, - sort_by: Literal["ID", "TIME", "CONFIDENCE"] | NotGiven = NOT_GIVEN, - sort_order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN, - victim_asn: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HijackEventsResponse: - """Get the BGP hijack events. - - (Beta) - - Args: - date_end: End of the date range (inclusive). - - date_range: Shorthand date ranges for the last X days - use when you don't need specific - start and end dates. - - date_start: Start of the date range (inclusive). - - event_id: The unique identifier of a event - - format: Format results are returned in. - - hijacker_asn: The potential hijacker AS of a BGP hijack event - - involved_asn: The potential hijacker or victim AS of a BGP hijack event - - involved_country: The country code of the potential hijacker or victim AS of a BGP hijack event - - max_confidence: The maximum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) - - min_confidence: The minimum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) - - page: Current page number, starting from 1 - - per_page: Number of entries per page - - prefix: The prefix hijacked during a BGP hijack event - - sort_by: Sort events by field - - sort_order: Sort order - - victim_asn: The potential victim AS of a BGP hijack event - - 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 - """ - return await self._get( - "/radar/bgp/hijacks/events", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "date_end": date_end, - "date_range": date_range, - "date_start": date_start, - "event_id": event_id, - "format": format, - "hijacker_asn": hijacker_asn, - "involved_asn": involved_asn, - "involved_country": involved_country, - "max_confidence": max_confidence, - "min_confidence": min_confidence, - "page": page, - "per_page": per_page, - "prefix": prefix, - "sort_by": sort_by, - "sort_order": sort_order, - "victim_asn": victim_asn, - }, - hijack_events_params.HijackEventsParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HijackEventsResponse], ResultWrapper[HijackEventsResponse]), - ) - - -class HijacksWithRawResponse: - def __init__(self, hijacks: Hijacks) -> None: - self._hijacks = hijacks - - self.events = to_raw_response_wrapper( - hijacks.events, - ) - - -class AsyncHijacksWithRawResponse: - def __init__(self, hijacks: AsyncHijacks) -> None: - self._hijacks = hijacks - - self.events = async_to_raw_response_wrapper( - hijacks.events, - ) - - -class HijacksWithStreamingResponse: - def __init__(self, hijacks: Hijacks) -> None: - self._hijacks = hijacks - - self.events = to_streamed_response_wrapper( - hijacks.events, - ) - - -class AsyncHijacksWithStreamingResponse: - def __init__(self, hijacks: AsyncHijacks) -> None: - self._hijacks = hijacks - - self.events = async_to_streamed_response_wrapper( - hijacks.events, - ) diff --git a/src/cloudflare/resources/radar/bgp/hijacks/__init__.py b/src/cloudflare/resources/radar/bgp/hijacks/__init__.py new file mode 100644 index 00000000000..f32bf80db23 --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/hijacks/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from .hijacks import ( + HijacksResource, + AsyncHijacksResource, + HijacksResourceWithRawResponse, + AsyncHijacksResourceWithRawResponse, + HijacksResourceWithStreamingResponse, + AsyncHijacksResourceWithStreamingResponse, +) + +__all__ = [ + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "HijacksResource", + "AsyncHijacksResource", + "HijacksResourceWithRawResponse", + "AsyncHijacksResourceWithRawResponse", + "HijacksResourceWithStreamingResponse", + "AsyncHijacksResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/radar/bgp/hijacks/events.py b/src/cloudflare/resources/radar/bgp/hijacks/events.py new file mode 100644 index 00000000000..6844c5c06d6 --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/hijacks/events.py @@ -0,0 +1,329 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal + +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.radar.bgp.hijacks import event_list_params +from .....types.radar.bgp.hijacks.event_list_response import EventListResponse + +__all__ = ["EventsResource", "AsyncEventsResource"] + + +class EventsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self) + + def list( + self, + *, + date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, + date_range: Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + | NotGiven = NOT_GIVEN, + date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, + event_id: int | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + hijacker_asn: int | NotGiven = NOT_GIVEN, + involved_asn: int | NotGiven = NOT_GIVEN, + involved_country: str | NotGiven = NOT_GIVEN, + max_confidence: int | NotGiven = NOT_GIVEN, + min_confidence: int | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + prefix: str | NotGiven = NOT_GIVEN, + sort_by: Literal["ID", "TIME", "CONFIDENCE"] | NotGiven = NOT_GIVEN, + sort_order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN, + victim_asn: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncV4PagePagination[EventListResponse]: + """Get the BGP hijack events. + + (Beta) + + Args: + date_end: End of the date range (inclusive). + + date_range: Shorthand date ranges for the last X days - use when you don't need specific + start and end dates. + + date_start: Start of the date range (inclusive). + + event_id: The unique identifier of a event + + format: Format results are returned in. + + hijacker_asn: The potential hijacker AS of a BGP hijack event + + involved_asn: The potential hijacker or victim AS of a BGP hijack event + + involved_country: The country code of the potential hijacker or victim AS of a BGP hijack event + + max_confidence: The maximum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) + + min_confidence: The minimum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) + + page: Current page number, starting from 1 + + per_page: Number of entries per page + + prefix: The prefix hijacked during a BGP hijack event + + sort_by: Sort events by field + + sort_order: Sort order + + victim_asn: The potential victim AS of a BGP hijack event + + 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 + """ + return self._get_api_list( + "/radar/bgp/hijacks/events", + page=SyncV4PagePagination[EventListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "event_id": event_id, + "format": format, + "hijacker_asn": hijacker_asn, + "involved_asn": involved_asn, + "involved_country": involved_country, + "max_confidence": max_confidence, + "min_confidence": min_confidence, + "page": page, + "per_page": per_page, + "prefix": prefix, + "sort_by": sort_by, + "sort_order": sort_order, + "victim_asn": victim_asn, + }, + event_list_params.EventListParams, + ), + ), + model=EventListResponse, + ) + + +class AsyncEventsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self) + + def list( + self, + *, + date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, + date_range: Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + | NotGiven = NOT_GIVEN, + date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, + event_id: int | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + hijacker_asn: int | NotGiven = NOT_GIVEN, + involved_asn: int | NotGiven = NOT_GIVEN, + involved_country: str | NotGiven = NOT_GIVEN, + max_confidence: int | NotGiven = NOT_GIVEN, + min_confidence: int | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + prefix: str | NotGiven = NOT_GIVEN, + sort_by: Literal["ID", "TIME", "CONFIDENCE"] | NotGiven = NOT_GIVEN, + sort_order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN, + victim_asn: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[EventListResponse, AsyncV4PagePagination[EventListResponse]]: + """Get the BGP hijack events. + + (Beta) + + Args: + date_end: End of the date range (inclusive). + + date_range: Shorthand date ranges for the last X days - use when you don't need specific + start and end dates. + + date_start: Start of the date range (inclusive). + + event_id: The unique identifier of a event + + format: Format results are returned in. + + hijacker_asn: The potential hijacker AS of a BGP hijack event + + involved_asn: The potential hijacker or victim AS of a BGP hijack event + + involved_country: The country code of the potential hijacker or victim AS of a BGP hijack event + + max_confidence: The maximum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) + + min_confidence: The minimum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) + + page: Current page number, starting from 1 + + per_page: Number of entries per page + + prefix: The prefix hijacked during a BGP hijack event + + sort_by: Sort events by field + + sort_order: Sort order + + victim_asn: The potential victim AS of a BGP hijack event + + 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 + """ + return self._get_api_list( + "/radar/bgp/hijacks/events", + page=AsyncV4PagePagination[EventListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "event_id": event_id, + "format": format, + "hijacker_asn": hijacker_asn, + "involved_asn": involved_asn, + "involved_country": involved_country, + "max_confidence": max_confidence, + "min_confidence": min_confidence, + "page": page, + "per_page": per_page, + "prefix": prefix, + "sort_by": sort_by, + "sort_order": sort_order, + "victim_asn": victim_asn, + }, + event_list_params.EventListParams, + ), + ), + model=EventListResponse, + ) + + +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.list = to_raw_response_wrapper( + events.list, + ) + + +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.list = async_to_raw_response_wrapper( + events.list, + ) + + +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.list = to_streamed_response_wrapper( + events.list, + ) + + +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.list = async_to_streamed_response_wrapper( + events.list, + ) diff --git a/src/cloudflare/resources/radar/bgp/hijacks/hijacks.py b/src/cloudflare/resources/radar/bgp/hijacks/hijacks.py new file mode 100644 index 00000000000..70e14049da9 --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/hijacks/hijacks.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["HijacksResource", "AsyncHijacksResource"] + + +class HijacksResource(SyncAPIResource): + @cached_property + def events(self) -> EventsResource: + return EventsResource(self._client) + + @cached_property + def with_raw_response(self) -> HijacksResourceWithRawResponse: + return HijacksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> HijacksResourceWithStreamingResponse: + return HijacksResourceWithStreamingResponse(self) + + +class AsyncHijacksResource(AsyncAPIResource): + @cached_property + def events(self) -> AsyncEventsResource: + return AsyncEventsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncHijacksResourceWithRawResponse: + return AsyncHijacksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncHijacksResourceWithStreamingResponse: + return AsyncHijacksResourceWithStreamingResponse(self) + + +class HijacksResourceWithRawResponse: + def __init__(self, hijacks: HijacksResource) -> None: + self._hijacks = hijacks + + @cached_property + def events(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self._hijacks.events) + + +class AsyncHijacksResourceWithRawResponse: + def __init__(self, hijacks: AsyncHijacksResource) -> None: + self._hijacks = hijacks + + @cached_property + def events(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self._hijacks.events) + + +class HijacksResourceWithStreamingResponse: + def __init__(self, hijacks: HijacksResource) -> None: + self._hijacks = hijacks + + @cached_property + def events(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self._hijacks.events) + + +class AsyncHijacksResourceWithStreamingResponse: + def __init__(self, hijacks: AsyncHijacksResource) -> None: + self._hijacks = hijacks + + @cached_property + def events(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self._hijacks.events) diff --git a/src/cloudflare/resources/radar/bgp/leaks.py b/src/cloudflare/resources/radar/bgp/leaks.py deleted file mode 100644 index 5de9dda0c71..00000000000 --- a/src/cloudflare/resources/radar/bgp/leaks.py +++ /dev/null @@ -1,296 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Union, cast -from datetime import datetime -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.radar.bgp import LeakEventsResponse, leak_events_params - -__all__ = ["Leaks", "AsyncLeaks"] - - -class Leaks(SyncAPIResource): - @cached_property - def with_raw_response(self) -> LeaksWithRawResponse: - return LeaksWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> LeaksWithStreamingResponse: - return LeaksWithStreamingResponse(self) - - def events( - self, - *, - date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - date_range: Literal[ - "1d", - "2d", - "7d", - "14d", - "28d", - "12w", - "24w", - "52w", - "1dControl", - "2dControl", - "7dControl", - "14dControl", - "28dControl", - "12wControl", - "24wControl", - ] - | NotGiven = NOT_GIVEN, - date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, - event_id: int | NotGiven = NOT_GIVEN, - format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, - involved_asn: int | NotGiven = NOT_GIVEN, - involved_country: str | NotGiven = NOT_GIVEN, - leak_asn: int | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - per_page: int | NotGiven = NOT_GIVEN, - sort_by: Literal["ID", "LEAKS", "PEERS", "PREFIXES", "ORIGINS", "TIME"] | NotGiven = NOT_GIVEN, - sort_order: Literal["ASC", "DESC"] | 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, - ) -> LeakEventsResponse: - """ - Get the BGP route leak events (Beta). - - Args: - date_end: End of the date range (inclusive). - - date_range: Shorthand date ranges for the last X days - use when you don't need specific - start and end dates. - - date_start: Start of the date range (inclusive). - - event_id: The unique identifier of a event - - format: Format results are returned in. - - involved_asn: ASN that is causing or affected by a route leak event - - involved_country: Country code of a involved ASN in a route leak event - - leak_asn: The leaking AS of a route leak event - - page: Current page number, starting from 1 - - per_page: Number of entries per page - - sort_by: Sort events by field - - sort_order: Sort order - - 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 - """ - return self._get( - "/radar/bgp/leaks/events", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "date_end": date_end, - "date_range": date_range, - "date_start": date_start, - "event_id": event_id, - "format": format, - "involved_asn": involved_asn, - "involved_country": involved_country, - "leak_asn": leak_asn, - "page": page, - "per_page": per_page, - "sort_by": sort_by, - "sort_order": sort_order, - }, - leak_events_params.LeakEventsParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LeakEventsResponse], ResultWrapper[LeakEventsResponse]), - ) - - -class AsyncLeaks(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncLeaksWithRawResponse: - return AsyncLeaksWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncLeaksWithStreamingResponse: - return AsyncLeaksWithStreamingResponse(self) - - async def events( - self, - *, - date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - date_range: Literal[ - "1d", - "2d", - "7d", - "14d", - "28d", - "12w", - "24w", - "52w", - "1dControl", - "2dControl", - "7dControl", - "14dControl", - "28dControl", - "12wControl", - "24wControl", - ] - | NotGiven = NOT_GIVEN, - date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, - event_id: int | NotGiven = NOT_GIVEN, - format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, - involved_asn: int | NotGiven = NOT_GIVEN, - involved_country: str | NotGiven = NOT_GIVEN, - leak_asn: int | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - per_page: int | NotGiven = NOT_GIVEN, - sort_by: Literal["ID", "LEAKS", "PEERS", "PREFIXES", "ORIGINS", "TIME"] | NotGiven = NOT_GIVEN, - sort_order: Literal["ASC", "DESC"] | 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, - ) -> LeakEventsResponse: - """ - Get the BGP route leak events (Beta). - - Args: - date_end: End of the date range (inclusive). - - date_range: Shorthand date ranges for the last X days - use when you don't need specific - start and end dates. - - date_start: Start of the date range (inclusive). - - event_id: The unique identifier of a event - - format: Format results are returned in. - - involved_asn: ASN that is causing or affected by a route leak event - - involved_country: Country code of a involved ASN in a route leak event - - leak_asn: The leaking AS of a route leak event - - page: Current page number, starting from 1 - - per_page: Number of entries per page - - sort_by: Sort events by field - - sort_order: Sort order - - 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 - """ - return await self._get( - "/radar/bgp/leaks/events", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "date_end": date_end, - "date_range": date_range, - "date_start": date_start, - "event_id": event_id, - "format": format, - "involved_asn": involved_asn, - "involved_country": involved_country, - "leak_asn": leak_asn, - "page": page, - "per_page": per_page, - "sort_by": sort_by, - "sort_order": sort_order, - }, - leak_events_params.LeakEventsParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LeakEventsResponse], ResultWrapper[LeakEventsResponse]), - ) - - -class LeaksWithRawResponse: - def __init__(self, leaks: Leaks) -> None: - self._leaks = leaks - - self.events = to_raw_response_wrapper( - leaks.events, - ) - - -class AsyncLeaksWithRawResponse: - def __init__(self, leaks: AsyncLeaks) -> None: - self._leaks = leaks - - self.events = async_to_raw_response_wrapper( - leaks.events, - ) - - -class LeaksWithStreamingResponse: - def __init__(self, leaks: Leaks) -> None: - self._leaks = leaks - - self.events = to_streamed_response_wrapper( - leaks.events, - ) - - -class AsyncLeaksWithStreamingResponse: - def __init__(self, leaks: AsyncLeaks) -> None: - self._leaks = leaks - - self.events = async_to_streamed_response_wrapper( - leaks.events, - ) diff --git a/src/cloudflare/resources/radar/bgp/leaks/__init__.py b/src/cloudflare/resources/radar/bgp/leaks/__init__.py new file mode 100644 index 00000000000..7f63768a484 --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/leaks/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .leaks import ( + LeaksResource, + AsyncLeaksResource, + LeaksResourceWithRawResponse, + AsyncLeaksResourceWithRawResponse, + LeaksResourceWithStreamingResponse, + AsyncLeaksResourceWithStreamingResponse, +) +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) + +__all__ = [ + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "LeaksResource", + "AsyncLeaksResource", + "LeaksResourceWithRawResponse", + "AsyncLeaksResourceWithRawResponse", + "LeaksResourceWithStreamingResponse", + "AsyncLeaksResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/radar/bgp/leaks/events.py b/src/cloudflare/resources/radar/bgp/leaks/events.py new file mode 100644 index 00000000000..92227d0287b --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/leaks/events.py @@ -0,0 +1,295 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal + +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.radar.bgp.leaks import event_list_params +from .....types.radar.bgp.leaks.event_list_response import EventListResponse + +__all__ = ["EventsResource", "AsyncEventsResource"] + + +class EventsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self) + + def list( + self, + *, + date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, + date_range: Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + | NotGiven = NOT_GIVEN, + date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, + event_id: int | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + involved_asn: int | NotGiven = NOT_GIVEN, + involved_country: str | NotGiven = NOT_GIVEN, + leak_asn: int | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + sort_by: Literal["ID", "LEAKS", "PEERS", "PREFIXES", "ORIGINS", "TIME"] | NotGiven = NOT_GIVEN, + sort_order: Literal["ASC", "DESC"] | 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[EventListResponse]: + """ + Get the BGP route leak events (Beta). + + Args: + date_end: End of the date range (inclusive). + + date_range: Shorthand date ranges for the last X days - use when you don't need specific + start and end dates. + + date_start: Start of the date range (inclusive). + + event_id: The unique identifier of a event + + format: Format results are returned in. + + involved_asn: ASN that is causing or affected by a route leak event + + involved_country: Country code of a involved ASN in a route leak event + + leak_asn: The leaking AS of a route leak event + + page: Current page number, starting from 1 + + per_page: Number of entries per page + + sort_by: Sort events by field + + sort_order: Sort order + + 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 + """ + return self._get_api_list( + "/radar/bgp/leaks/events", + page=SyncV4PagePagination[EventListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "event_id": event_id, + "format": format, + "involved_asn": involved_asn, + "involved_country": involved_country, + "leak_asn": leak_asn, + "page": page, + "per_page": per_page, + "sort_by": sort_by, + "sort_order": sort_order, + }, + event_list_params.EventListParams, + ), + ), + model=EventListResponse, + ) + + +class AsyncEventsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self) + + def list( + self, + *, + date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, + date_range: Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + | NotGiven = NOT_GIVEN, + date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, + event_id: int | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + involved_asn: int | NotGiven = NOT_GIVEN, + involved_country: str | NotGiven = NOT_GIVEN, + leak_asn: int | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + sort_by: Literal["ID", "LEAKS", "PEERS", "PREFIXES", "ORIGINS", "TIME"] | NotGiven = NOT_GIVEN, + sort_order: Literal["ASC", "DESC"] | 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[EventListResponse, AsyncV4PagePagination[EventListResponse]]: + """ + Get the BGP route leak events (Beta). + + Args: + date_end: End of the date range (inclusive). + + date_range: Shorthand date ranges for the last X days - use when you don't need specific + start and end dates. + + date_start: Start of the date range (inclusive). + + event_id: The unique identifier of a event + + format: Format results are returned in. + + involved_asn: ASN that is causing or affected by a route leak event + + involved_country: Country code of a involved ASN in a route leak event + + leak_asn: The leaking AS of a route leak event + + page: Current page number, starting from 1 + + per_page: Number of entries per page + + sort_by: Sort events by field + + sort_order: Sort order + + 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 + """ + return self._get_api_list( + "/radar/bgp/leaks/events", + page=AsyncV4PagePagination[EventListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "event_id": event_id, + "format": format, + "involved_asn": involved_asn, + "involved_country": involved_country, + "leak_asn": leak_asn, + "page": page, + "per_page": per_page, + "sort_by": sort_by, + "sort_order": sort_order, + }, + event_list_params.EventListParams, + ), + ), + model=EventListResponse, + ) + + +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.list = to_raw_response_wrapper( + events.list, + ) + + +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.list = async_to_raw_response_wrapper( + events.list, + ) + + +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.list = to_streamed_response_wrapper( + events.list, + ) + + +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.list = async_to_streamed_response_wrapper( + events.list, + ) diff --git a/src/cloudflare/resources/radar/bgp/leaks/leaks.py b/src/cloudflare/resources/radar/bgp/leaks/leaks.py new file mode 100644 index 00000000000..6a0f9382b18 --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/leaks/leaks.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["LeaksResource", "AsyncLeaksResource"] + + +class LeaksResource(SyncAPIResource): + @cached_property + def events(self) -> EventsResource: + return EventsResource(self._client) + + @cached_property + def with_raw_response(self) -> LeaksResourceWithRawResponse: + return LeaksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LeaksResourceWithStreamingResponse: + return LeaksResourceWithStreamingResponse(self) + + +class AsyncLeaksResource(AsyncAPIResource): + @cached_property + def events(self) -> AsyncEventsResource: + return AsyncEventsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLeaksResourceWithRawResponse: + return AsyncLeaksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLeaksResourceWithStreamingResponse: + return AsyncLeaksResourceWithStreamingResponse(self) + + +class LeaksResourceWithRawResponse: + def __init__(self, leaks: LeaksResource) -> None: + self._leaks = leaks + + @cached_property + def events(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self._leaks.events) + + +class AsyncLeaksResourceWithRawResponse: + def __init__(self, leaks: AsyncLeaksResource) -> None: + self._leaks = leaks + + @cached_property + def events(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self._leaks.events) + + +class LeaksResourceWithStreamingResponse: + def __init__(self, leaks: LeaksResource) -> None: + self._leaks = leaks + + @cached_property + def events(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self._leaks.events) + + +class AsyncLeaksResourceWithStreamingResponse: + def __init__(self, leaks: AsyncLeaksResource) -> None: + self._leaks = leaks + + @cached_property + def events(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self._leaks.events) diff --git a/src/cloudflare/resources/radar/bgp/routes.py b/src/cloudflare/resources/radar/bgp/routes.py index c98a3fb7886..cdb54f244f5 100644 --- a/src/cloudflare/resources/radar/bgp/routes.py +++ b/src/cloudflare/resources/radar/bgp/routes.py @@ -25,28 +25,23 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.bgp import ( - RouteMoasResponse, - RouteStatsResponse, - RoutePfx2asResponse, - RouteTimeseriesResponse, - route_moas_params, - route_stats_params, - route_pfx2as_params, - route_timeseries_params, -) +from ....types.radar.bgp import route_moas_params, route_stats_params, route_pfx2as_params, route_timeseries_params +from ....types.radar.bgp.route_moas_response import RouteMoasResponse +from ....types.radar.bgp.route_stats_response import RouteStatsResponse +from ....types.radar.bgp.route_pfx2as_response import RoutePfx2asResponse +from ....types.radar.bgp.route_timeseries_response import RouteTimeseriesResponse -__all__ = ["Routes", "AsyncRoutes"] +__all__ = ["RoutesResource", "AsyncRoutesResource"] -class Routes(SyncAPIResource): +class RoutesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self) + def with_raw_response(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(self) + def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self) def moas( self, @@ -98,7 +93,7 @@ def moas( }, route_moas_params.RouteMoasParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteMoasResponse]._unwrapper, ), cast_to=cast(Type[RouteMoasResponse], ResultWrapper[RouteMoasResponse]), ) @@ -158,7 +153,7 @@ def pfx2as( }, route_pfx2as_params.RoutePfx2asParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RoutePfx2asResponse]._unwrapper, ), cast_to=cast(Type[RoutePfx2asResponse], ResultWrapper[RoutePfx2asResponse]), ) @@ -209,7 +204,7 @@ def stats( }, route_stats_params.RouteStatsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteStatsResponse]._unwrapper, ), cast_to=cast(Type[RouteStatsResponse], ResultWrapper[RouteStatsResponse]), ) @@ -239,6 +234,7 @@ def timeseries( | NotGiven = NOT_GIVEN, date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + include_delay: bool | NotGiven = NOT_GIVEN, location: 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. @@ -263,6 +259,8 @@ def timeseries( format: Format results are returned in. + include_delay: Include data delay meta information + location: Location Alpha2 code. extra_headers: Send extra headers @@ -287,24 +285,25 @@ def timeseries( "date_range": date_range, "date_start": date_start, "format": format, + "include_delay": include_delay, "location": location, }, route_timeseries_params.RouteTimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteTimeseriesResponse]._unwrapper, ), cast_to=cast(Type[RouteTimeseriesResponse], ResultWrapper[RouteTimeseriesResponse]), ) -class AsyncRoutes(AsyncAPIResource): +class AsyncRoutesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self) + def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self) async def moas( self, @@ -356,7 +355,7 @@ async def moas( }, route_moas_params.RouteMoasParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteMoasResponse]._unwrapper, ), cast_to=cast(Type[RouteMoasResponse], ResultWrapper[RouteMoasResponse]), ) @@ -416,7 +415,7 @@ async def pfx2as( }, route_pfx2as_params.RoutePfx2asParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RoutePfx2asResponse]._unwrapper, ), cast_to=cast(Type[RoutePfx2asResponse], ResultWrapper[RoutePfx2asResponse]), ) @@ -467,7 +466,7 @@ async def stats( }, route_stats_params.RouteStatsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteStatsResponse]._unwrapper, ), cast_to=cast(Type[RouteStatsResponse], ResultWrapper[RouteStatsResponse]), ) @@ -497,6 +496,7 @@ async def timeseries( | NotGiven = NOT_GIVEN, date_start: Union[str, datetime] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + include_delay: bool | NotGiven = NOT_GIVEN, location: 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. @@ -521,6 +521,8 @@ async def timeseries( format: Format results are returned in. + include_delay: Include data delay meta information + location: Location Alpha2 code. extra_headers: Send extra headers @@ -545,18 +547,19 @@ async def timeseries( "date_range": date_range, "date_start": date_start, "format": format, + "include_delay": include_delay, "location": location, }, route_timeseries_params.RouteTimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RouteTimeseriesResponse]._unwrapper, ), cast_to=cast(Type[RouteTimeseriesResponse], ResultWrapper[RouteTimeseriesResponse]), ) -class RoutesWithRawResponse: - def __init__(self, routes: Routes) -> None: +class RoutesResourceWithRawResponse: + def __init__(self, routes: RoutesResource) -> None: self._routes = routes self.moas = to_raw_response_wrapper( @@ -573,8 +576,8 @@ def __init__(self, routes: Routes) -> None: ) -class AsyncRoutesWithRawResponse: - def __init__(self, routes: AsyncRoutes) -> None: +class AsyncRoutesResourceWithRawResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: self._routes = routes self.moas = async_to_raw_response_wrapper( @@ -591,8 +594,8 @@ def __init__(self, routes: AsyncRoutes) -> None: ) -class RoutesWithStreamingResponse: - def __init__(self, routes: Routes) -> None: +class RoutesResourceWithStreamingResponse: + def __init__(self, routes: RoutesResource) -> None: self._routes = routes self.moas = to_streamed_response_wrapper( @@ -609,8 +612,8 @@ def __init__(self, routes: Routes) -> None: ) -class AsyncRoutesWithStreamingResponse: - def __init__(self, routes: AsyncRoutes) -> None: +class AsyncRoutesResourceWithStreamingResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: self._routes = routes self.moas = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/bgp/top/__init__.py b/src/cloudflare/resources/radar/bgp/top/__init__.py index a80240a3a26..4466a472d72 100644 --- a/src/cloudflare/resources/radar/bgp/top/__init__.py +++ b/src/cloudflare/resources/radar/bgp/top/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .ases import ( - Ases, - AsyncAses, - AsesWithRawResponse, - AsyncAsesWithRawResponse, - AsesWithStreamingResponse, - AsyncAsesWithStreamingResponse, + AsesResource, + AsyncAsesResource, + AsesResourceWithRawResponse, + AsyncAsesResourceWithRawResponse, + AsesResourceWithStreamingResponse, + AsyncAsesResourceWithStreamingResponse, ) __all__ = [ - "Ases", - "AsyncAses", - "AsesWithRawResponse", - "AsyncAsesWithRawResponse", - "AsesWithStreamingResponse", - "AsyncAsesWithStreamingResponse", - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", + "AsesResource", + "AsyncAsesResource", + "AsesResourceWithRawResponse", + "AsyncAsesResourceWithRawResponse", + "AsesResourceWithStreamingResponse", + "AsyncAsesResourceWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/bgp/top/ases.py b/src/cloudflare/resources/radar/bgp/top/ases.py index 3cda4759ba5..6a9a0994b59 100644 --- a/src/cloudflare/resources/radar/bgp/top/ases.py +++ b/src/cloudflare/resources/radar/bgp/top/ases.py @@ -25,19 +25,21 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.bgp.top import AseGetResponse, AsePrefixesResponse, ase_get_params, ase_prefixes_params +from .....types.radar.bgp.top import ase_get_params, ase_prefixes_params +from .....types.radar.bgp.top.ase_get_response import AseGetResponse +from .....types.radar.bgp.top.ase_prefixes_response import AsePrefixesResponse -__all__ = ["Ases", "AsyncAses"] +__all__ = ["AsesResource", "AsyncAsesResource"] -class Ases(SyncAPIResource): +class AsesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AsesWithRawResponse: - return AsesWithRawResponse(self) + def with_raw_response(self) -> AsesResourceWithRawResponse: + return AsesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsesWithStreamingResponse: - return AsesWithStreamingResponse(self) + def with_streaming_response(self) -> AsesResourceWithStreamingResponse: + return AsesResourceWithStreamingResponse(self) def get( self, @@ -134,7 +136,7 @@ def get( }, ase_get_params.AseGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AseGetResponse]._unwrapper, ), cast_to=cast(Type[AseGetResponse], ResultWrapper[AseGetResponse]), ) @@ -187,20 +189,20 @@ def prefixes( }, ase_prefixes_params.AsePrefixesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AsePrefixesResponse]._unwrapper, ), cast_to=cast(Type[AsePrefixesResponse], ResultWrapper[AsePrefixesResponse]), ) -class AsyncAses(AsyncAPIResource): +class AsyncAsesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAsesWithRawResponse: - return AsyncAsesWithRawResponse(self) + def with_raw_response(self) -> AsyncAsesResourceWithRawResponse: + return AsyncAsesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAsesWithStreamingResponse: - return AsyncAsesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAsesResourceWithStreamingResponse: + return AsyncAsesResourceWithStreamingResponse(self) async def get( self, @@ -297,7 +299,7 @@ async def get( }, ase_get_params.AseGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AseGetResponse]._unwrapper, ), cast_to=cast(Type[AseGetResponse], ResultWrapper[AseGetResponse]), ) @@ -350,14 +352,14 @@ async def prefixes( }, ase_prefixes_params.AsePrefixesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AsePrefixesResponse]._unwrapper, ), cast_to=cast(Type[AsePrefixesResponse], ResultWrapper[AsePrefixesResponse]), ) -class AsesWithRawResponse: - def __init__(self, ases: Ases) -> None: +class AsesResourceWithRawResponse: + def __init__(self, ases: AsesResource) -> None: self._ases = ases self.get = to_raw_response_wrapper( @@ -368,8 +370,8 @@ def __init__(self, ases: Ases) -> None: ) -class AsyncAsesWithRawResponse: - def __init__(self, ases: AsyncAses) -> None: +class AsyncAsesResourceWithRawResponse: + def __init__(self, ases: AsyncAsesResource) -> None: self._ases = ases self.get = async_to_raw_response_wrapper( @@ -380,8 +382,8 @@ def __init__(self, ases: AsyncAses) -> None: ) -class AsesWithStreamingResponse: - def __init__(self, ases: Ases) -> None: +class AsesResourceWithStreamingResponse: + def __init__(self, ases: AsesResource) -> None: self._ases = ases self.get = to_streamed_response_wrapper( @@ -392,8 +394,8 @@ def __init__(self, ases: Ases) -> None: ) -class AsyncAsesWithStreamingResponse: - def __init__(self, ases: AsyncAses) -> None: +class AsyncAsesResourceWithStreamingResponse: + def __init__(self, ases: AsyncAsesResource) -> None: self._ases = ases self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/bgp/top/top.py b/src/cloudflare/resources/radar/bgp/top/top.py index 515c9c8efa0..17826f992e9 100644 --- a/src/cloudflare/resources/radar/bgp/top/top.py +++ b/src/cloudflare/resources/radar/bgp/top/top.py @@ -9,12 +9,12 @@ import httpx from .ases import ( - Ases, - AsyncAses, - AsesWithRawResponse, - AsyncAsesWithRawResponse, - AsesWithStreamingResponse, - AsyncAsesWithStreamingResponse, + AsesResource, + AsyncAsesResource, + AsesResourceWithRawResponse, + AsyncAsesResourceWithRawResponse, + AsesResourceWithStreamingResponse, + AsyncAsesResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -33,23 +33,24 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.bgp import TopPrefixesResponse, top_prefixes_params +from .....types.radar.bgp import top_prefixes_params +from .....types.radar.bgp.top_prefixes_response import TopPrefixesResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def ases(self) -> Ases: - return Ases(self._client) + def ases(self) -> AsesResource: + return AsesResource(self._client) @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def prefixes( self, @@ -142,24 +143,24 @@ def prefixes( }, top_prefixes_params.TopPrefixesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopPrefixesResponse]._unwrapper, ), cast_to=cast(Type[TopPrefixesResponse], ResultWrapper[TopPrefixesResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def ases(self) -> AsyncAses: - return AsyncAses(self._client) + def ases(self) -> AsyncAsesResource: + return AsyncAsesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def prefixes( self, @@ -252,14 +253,14 @@ async def prefixes( }, top_prefixes_params.TopPrefixesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopPrefixesResponse]._unwrapper, ), cast_to=cast(Type[TopPrefixesResponse], ResultWrapper[TopPrefixesResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.prefixes = to_raw_response_wrapper( @@ -267,12 +268,12 @@ def __init__(self, top: Top) -> None: ) @cached_property - def ases(self) -> AsesWithRawResponse: - return AsesWithRawResponse(self._top.ases) + def ases(self) -> AsesResourceWithRawResponse: + return AsesResourceWithRawResponse(self._top.ases) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.prefixes = async_to_raw_response_wrapper( @@ -280,12 +281,12 @@ def __init__(self, top: AsyncTop) -> None: ) @cached_property - def ases(self) -> AsyncAsesWithRawResponse: - return AsyncAsesWithRawResponse(self._top.ases) + def ases(self) -> AsyncAsesResourceWithRawResponse: + return AsyncAsesResourceWithRawResponse(self._top.ases) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.prefixes = to_streamed_response_wrapper( @@ -293,12 +294,12 @@ def __init__(self, top: Top) -> None: ) @cached_property - def ases(self) -> AsesWithStreamingResponse: - return AsesWithStreamingResponse(self._top.ases) + def ases(self) -> AsesResourceWithStreamingResponse: + return AsesResourceWithStreamingResponse(self._top.ases) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.prefixes = async_to_streamed_response_wrapper( @@ -306,5 +307,5 @@ def __init__(self, top: AsyncTop) -> None: ) @cached_property - def ases(self) -> AsyncAsesWithStreamingResponse: - return AsyncAsesWithStreamingResponse(self._top.ases) + def ases(self) -> AsyncAsesResourceWithStreamingResponse: + return AsyncAsesResourceWithStreamingResponse(self._top.ases) diff --git a/src/cloudflare/resources/radar/connection_tampering.py b/src/cloudflare/resources/radar/connection_tampering.py index fed6c4b21e8..76c5a4c8512 100644 --- a/src/cloudflare/resources/radar/connection_tampering.py +++ b/src/cloudflare/resources/radar/connection_tampering.py @@ -22,27 +22,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.radar import ( - ConnectionTamperingSummaryResponse, - ConnectionTamperingTimeseriesGroupsResponse, - connection_tampering_summary_params, - connection_tampering_timeseries_groups_params, -) +from ...types.radar import connection_tampering_summary_params, connection_tampering_timeseries_groups_params from ..._base_client import ( make_request_options, ) +from ...types.radar.connection_tampering_summary_response import ConnectionTamperingSummaryResponse +from ...types.radar.connection_tampering_timeseries_groups_response import ConnectionTamperingTimeseriesGroupsResponse -__all__ = ["ConnectionTampering", "AsyncConnectionTampering"] +__all__ = ["ConnectionTamperingResource", "AsyncConnectionTamperingResource"] -class ConnectionTampering(SyncAPIResource): +class ConnectionTamperingResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConnectionTamperingWithRawResponse: - return ConnectionTamperingWithRawResponse(self) + def with_raw_response(self) -> ConnectionTamperingResourceWithRawResponse: + return ConnectionTamperingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConnectionTamperingWithStreamingResponse: - return ConnectionTamperingWithStreamingResponse(self) + def with_streaming_response(self) -> ConnectionTamperingResourceWithStreamingResponse: + return ConnectionTamperingResourceWithStreamingResponse(self) def summary( self, @@ -137,7 +134,7 @@ def summary( }, connection_tampering_summary_params.ConnectionTamperingSummaryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectionTamperingSummaryResponse]._unwrapper, ), cast_to=cast(Type[ConnectionTamperingSummaryResponse], ResultWrapper[ConnectionTamperingSummaryResponse]), ) @@ -241,7 +238,7 @@ def timeseries_groups( }, connection_tampering_timeseries_groups_params.ConnectionTamperingTimeseriesGroupsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectionTamperingTimeseriesGroupsResponse]._unwrapper, ), cast_to=cast( Type[ConnectionTamperingTimeseriesGroupsResponse], @@ -250,14 +247,14 @@ def timeseries_groups( ) -class AsyncConnectionTampering(AsyncAPIResource): +class AsyncConnectionTamperingResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConnectionTamperingWithRawResponse: - return AsyncConnectionTamperingWithRawResponse(self) + def with_raw_response(self) -> AsyncConnectionTamperingResourceWithRawResponse: + return AsyncConnectionTamperingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConnectionTamperingWithStreamingResponse: - return AsyncConnectionTamperingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConnectionTamperingResourceWithStreamingResponse: + return AsyncConnectionTamperingResourceWithStreamingResponse(self) async def summary( self, @@ -352,7 +349,7 @@ async def summary( }, connection_tampering_summary_params.ConnectionTamperingSummaryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectionTamperingSummaryResponse]._unwrapper, ), cast_to=cast(Type[ConnectionTamperingSummaryResponse], ResultWrapper[ConnectionTamperingSummaryResponse]), ) @@ -456,7 +453,7 @@ async def timeseries_groups( }, connection_tampering_timeseries_groups_params.ConnectionTamperingTimeseriesGroupsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectionTamperingTimeseriesGroupsResponse]._unwrapper, ), cast_to=cast( Type[ConnectionTamperingTimeseriesGroupsResponse], @@ -465,8 +462,8 @@ async def timeseries_groups( ) -class ConnectionTamperingWithRawResponse: - def __init__(self, connection_tampering: ConnectionTampering) -> None: +class ConnectionTamperingResourceWithRawResponse: + def __init__(self, connection_tampering: ConnectionTamperingResource) -> None: self._connection_tampering = connection_tampering self.summary = to_raw_response_wrapper( @@ -477,8 +474,8 @@ def __init__(self, connection_tampering: ConnectionTampering) -> None: ) -class AsyncConnectionTamperingWithRawResponse: - def __init__(self, connection_tampering: AsyncConnectionTampering) -> None: +class AsyncConnectionTamperingResourceWithRawResponse: + def __init__(self, connection_tampering: AsyncConnectionTamperingResource) -> None: self._connection_tampering = connection_tampering self.summary = async_to_raw_response_wrapper( @@ -489,8 +486,8 @@ def __init__(self, connection_tampering: AsyncConnectionTampering) -> None: ) -class ConnectionTamperingWithStreamingResponse: - def __init__(self, connection_tampering: ConnectionTampering) -> None: +class ConnectionTamperingResourceWithStreamingResponse: + def __init__(self, connection_tampering: ConnectionTamperingResource) -> None: self._connection_tampering = connection_tampering self.summary = to_streamed_response_wrapper( @@ -501,8 +498,8 @@ def __init__(self, connection_tampering: ConnectionTampering) -> None: ) -class AsyncConnectionTamperingWithStreamingResponse: - def __init__(self, connection_tampering: AsyncConnectionTampering) -> None: +class AsyncConnectionTamperingResourceWithStreamingResponse: + def __init__(self, connection_tampering: AsyncConnectionTamperingResource) -> None: self._connection_tampering = connection_tampering self.summary = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/datasets.py b/src/cloudflare/resources/radar/datasets.py index 94541240d44..021724e8c30 100644 --- a/src/cloudflare/resources/radar/datasets.py +++ b/src/cloudflare/resources/radar/datasets.py @@ -21,28 +21,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.radar import ( - DatasetListResponse, - DatasetDownloadResponse, - dataset_get_params, - dataset_list_params, - dataset_download_params, -) +from ...types.radar import dataset_get_params, dataset_list_params, dataset_download_params from ..._base_client import ( make_request_options, ) +from ...types.radar.dataset_list_response import DatasetListResponse +from ...types.radar.dataset_download_response import DatasetDownloadResponse -__all__ = ["Datasets", "AsyncDatasets"] +__all__ = ["DatasetsResource", "AsyncDatasetsResource"] -class Datasets(SyncAPIResource): +class DatasetsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DatasetsWithRawResponse: - return DatasetsWithRawResponse(self) + def with_raw_response(self) -> DatasetsResourceWithRawResponse: + return DatasetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DatasetsWithStreamingResponse: - return DatasetsWithStreamingResponse(self) + def with_streaming_response(self) -> DatasetsResourceWithStreamingResponse: + return DatasetsResourceWithStreamingResponse(self) def list( self, @@ -94,7 +90,7 @@ def list( }, dataset_list_params.DatasetListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatasetListResponse]._unwrapper, ), cast_to=cast(Type[DatasetListResponse], ResultWrapper[DatasetListResponse]), ) @@ -134,7 +130,7 @@ def download( extra_body=extra_body, timeout=timeout, query=maybe_transform({"format": format}, dataset_download_params.DatasetDownloadParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatasetDownloadResponse]._unwrapper, ), cast_to=cast(Type[DatasetDownloadResponse], ResultWrapper[DatasetDownloadResponse]), ) @@ -186,14 +182,14 @@ def get( ) -class AsyncDatasets(AsyncAPIResource): +class AsyncDatasetsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDatasetsWithRawResponse: - return AsyncDatasetsWithRawResponse(self) + def with_raw_response(self) -> AsyncDatasetsResourceWithRawResponse: + return AsyncDatasetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDatasetsWithStreamingResponse: - return AsyncDatasetsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDatasetsResourceWithStreamingResponse: + return AsyncDatasetsResourceWithStreamingResponse(self) async def list( self, @@ -245,7 +241,7 @@ async def list( }, dataset_list_params.DatasetListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatasetListResponse]._unwrapper, ), cast_to=cast(Type[DatasetListResponse], ResultWrapper[DatasetListResponse]), ) @@ -285,7 +281,7 @@ async def download( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"format": format}, dataset_download_params.DatasetDownloadParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DatasetDownloadResponse]._unwrapper, ), cast_to=cast(Type[DatasetDownloadResponse], ResultWrapper[DatasetDownloadResponse]), ) @@ -337,8 +333,8 @@ async def get( ) -class DatasetsWithRawResponse: - def __init__(self, datasets: Datasets) -> None: +class DatasetsResourceWithRawResponse: + def __init__(self, datasets: DatasetsResource) -> None: self._datasets = datasets self.list = to_raw_response_wrapper( @@ -352,8 +348,8 @@ def __init__(self, datasets: Datasets) -> None: ) -class AsyncDatasetsWithRawResponse: - def __init__(self, datasets: AsyncDatasets) -> None: +class AsyncDatasetsResourceWithRawResponse: + def __init__(self, datasets: AsyncDatasetsResource) -> None: self._datasets = datasets self.list = async_to_raw_response_wrapper( @@ -367,8 +363,8 @@ def __init__(self, datasets: AsyncDatasets) -> None: ) -class DatasetsWithStreamingResponse: - def __init__(self, datasets: Datasets) -> None: +class DatasetsResourceWithStreamingResponse: + def __init__(self, datasets: DatasetsResource) -> None: self._datasets = datasets self.list = to_streamed_response_wrapper( @@ -382,8 +378,8 @@ def __init__(self, datasets: Datasets) -> None: ) -class AsyncDatasetsWithStreamingResponse: - def __init__(self, datasets: AsyncDatasets) -> None: +class AsyncDatasetsResourceWithStreamingResponse: + def __init__(self, datasets: AsyncDatasetsResource) -> None: self._datasets = datasets self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/dns/__init__.py b/src/cloudflare/resources/radar/dns/__init__.py index c199e8256b1..c6dbec78760 100644 --- a/src/cloudflare/resources/radar/dns/__init__.py +++ b/src/cloudflare/resources/radar/dns/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) __all__ = [ - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "DNS", - "AsyncDNS", - "DNSWithRawResponse", - "AsyncDNSWithRawResponse", - "DNSWithStreamingResponse", - "AsyncDNSWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "DNSResource", + "AsyncDNSResource", + "DNSResourceWithRawResponse", + "AsyncDNSResourceWithRawResponse", + "DNSResourceWithStreamingResponse", + "AsyncDNSResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/dns/dns.py b/src/cloudflare/resources/radar/dns/dns.py index 61befc211e6..539843254a8 100644 --- a/src/cloudflare/resources/radar/dns/dns.py +++ b/src/cloudflare/resources/radar/dns/dns.py @@ -3,78 +3,78 @@ from __future__ import annotations from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["DNS", "AsyncDNS"] +__all__ = ["DNSResource", "AsyncDNSResource"] -class DNS(SyncAPIResource): +class DNSResource(SyncAPIResource): @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def with_raw_response(self) -> DNSWithRawResponse: - return DNSWithRawResponse(self) + def with_raw_response(self) -> DNSResourceWithRawResponse: + return DNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DNSWithStreamingResponse: - return DNSWithStreamingResponse(self) + def with_streaming_response(self) -> DNSResourceWithStreamingResponse: + return DNSResourceWithStreamingResponse(self) -class AsyncDNS(AsyncAPIResource): +class AsyncDNSResource(AsyncAPIResource): @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDNSWithRawResponse: - return AsyncDNSWithRawResponse(self) + def with_raw_response(self) -> AsyncDNSResourceWithRawResponse: + return AsyncDNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDNSWithStreamingResponse: - return AsyncDNSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDNSResourceWithStreamingResponse: + return AsyncDNSResourceWithStreamingResponse(self) -class DNSWithRawResponse: - def __init__(self, dns: DNS) -> None: +class DNSResourceWithRawResponse: + def __init__(self, dns: DNSResource) -> None: self._dns = dns @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._dns.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._dns.top) -class AsyncDNSWithRawResponse: - def __init__(self, dns: AsyncDNS) -> None: +class AsyncDNSResourceWithRawResponse: + def __init__(self, dns: AsyncDNSResource) -> None: self._dns = dns @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._dns.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._dns.top) -class DNSWithStreamingResponse: - def __init__(self, dns: DNS) -> None: +class DNSResourceWithStreamingResponse: + def __init__(self, dns: DNSResource) -> None: self._dns = dns @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._dns.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._dns.top) -class AsyncDNSWithStreamingResponse: - def __init__(self, dns: AsyncDNS) -> None: +class AsyncDNSResourceWithStreamingResponse: + def __init__(self, dns: AsyncDNSResource) -> None: self._dns = dns @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._dns.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._dns.top) diff --git a/src/cloudflare/resources/radar/dns/top.py b/src/cloudflare/resources/radar/dns/top.py index 746b15ef96d..ea775bb8d98 100644 --- a/src/cloudflare/resources/radar/dns/top.py +++ b/src/cloudflare/resources/radar/dns/top.py @@ -25,19 +25,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.dns import TopAsesResponse, TopLocationsResponse, top_ases_params, top_locations_params +from ....types.radar.dns import top_ases_params, top_locations_params +from ....types.radar.dns.top_ases_response import TopAsesResponse +from ....types.radar.dns.top_locations_response import TopLocationsResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def ases( self, @@ -141,7 +143,7 @@ def ases( }, top_ases_params.TopAsesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAsesResponse]._unwrapper, ), cast_to=cast(Type[TopAsesResponse], ResultWrapper[TopAsesResponse]), ) @@ -247,20 +249,20 @@ def locations( }, top_locations_params.TopLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopLocationsResponse]._unwrapper, ), cast_to=cast(Type[TopLocationsResponse], ResultWrapper[TopLocationsResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def ases( self, @@ -364,7 +366,7 @@ async def ases( }, top_ases_params.TopAsesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAsesResponse]._unwrapper, ), cast_to=cast(Type[TopAsesResponse], ResultWrapper[TopAsesResponse]), ) @@ -470,14 +472,14 @@ async def locations( }, top_locations_params.TopLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopLocationsResponse]._unwrapper, ), cast_to=cast(Type[TopLocationsResponse], ResultWrapper[TopLocationsResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.ases = to_raw_response_wrapper( @@ -488,8 +490,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.ases = async_to_raw_response_wrapper( @@ -500,8 +502,8 @@ def __init__(self, top: AsyncTop) -> None: ) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.ases = to_streamed_response_wrapper( @@ -512,8 +514,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.ases = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/email/__init__.py b/src/cloudflare/resources/radar/email/__init__.py index 13f4c04dd4a..0e2f2297512 100644 --- a/src/cloudflare/resources/radar/email/__init__.py +++ b/src/cloudflare/resources/radar/email/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .email import ( - Email, - AsyncEmail, - EmailWithRawResponse, - AsyncEmailWithRawResponse, - EmailWithStreamingResponse, - AsyncEmailWithStreamingResponse, + EmailResource, + AsyncEmailResource, + EmailResourceWithRawResponse, + AsyncEmailResourceWithRawResponse, + EmailResourceWithStreamingResponse, + AsyncEmailResourceWithStreamingResponse, ) from .routing import ( - Routing, - AsyncRouting, - RoutingWithRawResponse, - AsyncRoutingWithRawResponse, - RoutingWithStreamingResponse, - AsyncRoutingWithStreamingResponse, + RoutingResource, + AsyncRoutingResource, + RoutingResourceWithRawResponse, + AsyncRoutingResourceWithRawResponse, + RoutingResourceWithStreamingResponse, + AsyncRoutingResourceWithStreamingResponse, ) from .security import ( - Security, - AsyncSecurity, - SecurityWithRawResponse, - AsyncSecurityWithRawResponse, - SecurityWithStreamingResponse, - AsyncSecurityWithStreamingResponse, + SecurityResource, + AsyncSecurityResource, + SecurityResourceWithRawResponse, + AsyncSecurityResourceWithRawResponse, + SecurityResourceWithStreamingResponse, + AsyncSecurityResourceWithStreamingResponse, ) __all__ = [ - "Routing", - "AsyncRouting", - "RoutingWithRawResponse", - "AsyncRoutingWithRawResponse", - "RoutingWithStreamingResponse", - "AsyncRoutingWithStreamingResponse", - "Security", - "AsyncSecurity", - "SecurityWithRawResponse", - "AsyncSecurityWithRawResponse", - "SecurityWithStreamingResponse", - "AsyncSecurityWithStreamingResponse", - "Email", - "AsyncEmail", - "EmailWithRawResponse", - "AsyncEmailWithRawResponse", - "EmailWithStreamingResponse", - "AsyncEmailWithStreamingResponse", + "RoutingResource", + "AsyncRoutingResource", + "RoutingResourceWithRawResponse", + "AsyncRoutingResourceWithRawResponse", + "RoutingResourceWithStreamingResponse", + "AsyncRoutingResourceWithStreamingResponse", + "SecurityResource", + "AsyncSecurityResource", + "SecurityResourceWithRawResponse", + "AsyncSecurityResourceWithRawResponse", + "SecurityResourceWithStreamingResponse", + "AsyncSecurityResourceWithStreamingResponse", + "EmailResource", + "AsyncEmailResource", + "EmailResourceWithRawResponse", + "AsyncEmailResourceWithRawResponse", + "EmailResourceWithStreamingResponse", + "AsyncEmailResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/email/email.py b/src/cloudflare/resources/radar/email/email.py index 75e4007b2ca..a609b61d3a4 100644 --- a/src/cloudflare/resources/radar/email/email.py +++ b/src/cloudflare/resources/radar/email/email.py @@ -3,112 +3,112 @@ from __future__ import annotations from .routing import ( - Routing, - AsyncRouting, - RoutingWithRawResponse, - AsyncRoutingWithRawResponse, - RoutingWithStreamingResponse, - AsyncRoutingWithStreamingResponse, + RoutingResource, + AsyncRoutingResource, + RoutingResourceWithRawResponse, + AsyncRoutingResourceWithRawResponse, + RoutingResourceWithStreamingResponse, + AsyncRoutingResourceWithStreamingResponse, ) from .security import ( - Security, - AsyncSecurity, - SecurityWithRawResponse, - AsyncSecurityWithRawResponse, - SecurityWithStreamingResponse, - AsyncSecurityWithStreamingResponse, + SecurityResource, + AsyncSecurityResource, + SecurityResourceWithRawResponse, + AsyncSecurityResourceWithRawResponse, + SecurityResourceWithStreamingResponse, + AsyncSecurityResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -from .routing.routing import Routing, AsyncRouting -from .security.security import Security, AsyncSecurity +from .routing.routing import RoutingResource, AsyncRoutingResource +from .security.security import SecurityResource, AsyncSecurityResource -__all__ = ["Email", "AsyncEmail"] +__all__ = ["EmailResource", "AsyncEmailResource"] -class Email(SyncAPIResource): +class EmailResource(SyncAPIResource): @cached_property - def routing(self) -> Routing: - return Routing(self._client) + def routing(self) -> RoutingResource: + return RoutingResource(self._client) @cached_property - def security(self) -> Security: - return Security(self._client) + def security(self) -> SecurityResource: + return SecurityResource(self._client) @cached_property - def with_raw_response(self) -> EmailWithRawResponse: - return EmailWithRawResponse(self) + def with_raw_response(self) -> EmailResourceWithRawResponse: + return EmailResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EmailWithStreamingResponse: - return EmailWithStreamingResponse(self) + def with_streaming_response(self) -> EmailResourceWithStreamingResponse: + return EmailResourceWithStreamingResponse(self) -class AsyncEmail(AsyncAPIResource): +class AsyncEmailResource(AsyncAPIResource): @cached_property - def routing(self) -> AsyncRouting: - return AsyncRouting(self._client) + def routing(self) -> AsyncRoutingResource: + return AsyncRoutingResource(self._client) @cached_property - def security(self) -> AsyncSecurity: - return AsyncSecurity(self._client) + def security(self) -> AsyncSecurityResource: + return AsyncSecurityResource(self._client) @cached_property - def with_raw_response(self) -> AsyncEmailWithRawResponse: - return AsyncEmailWithRawResponse(self) + def with_raw_response(self) -> AsyncEmailResourceWithRawResponse: + return AsyncEmailResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEmailWithStreamingResponse: - return AsyncEmailWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEmailResourceWithStreamingResponse: + return AsyncEmailResourceWithStreamingResponse(self) -class EmailWithRawResponse: - def __init__(self, email: Email) -> None: +class EmailResourceWithRawResponse: + def __init__(self, email: EmailResource) -> None: self._email = email @cached_property - def routing(self) -> RoutingWithRawResponse: - return RoutingWithRawResponse(self._email.routing) + def routing(self) -> RoutingResourceWithRawResponse: + return RoutingResourceWithRawResponse(self._email.routing) @cached_property - def security(self) -> SecurityWithRawResponse: - return SecurityWithRawResponse(self._email.security) + def security(self) -> SecurityResourceWithRawResponse: + return SecurityResourceWithRawResponse(self._email.security) -class AsyncEmailWithRawResponse: - def __init__(self, email: AsyncEmail) -> None: +class AsyncEmailResourceWithRawResponse: + def __init__(self, email: AsyncEmailResource) -> None: self._email = email @cached_property - def routing(self) -> AsyncRoutingWithRawResponse: - return AsyncRoutingWithRawResponse(self._email.routing) + def routing(self) -> AsyncRoutingResourceWithRawResponse: + return AsyncRoutingResourceWithRawResponse(self._email.routing) @cached_property - def security(self) -> AsyncSecurityWithRawResponse: - return AsyncSecurityWithRawResponse(self._email.security) + def security(self) -> AsyncSecurityResourceWithRawResponse: + return AsyncSecurityResourceWithRawResponse(self._email.security) -class EmailWithStreamingResponse: - def __init__(self, email: Email) -> None: +class EmailResourceWithStreamingResponse: + def __init__(self, email: EmailResource) -> None: self._email = email @cached_property - def routing(self) -> RoutingWithStreamingResponse: - return RoutingWithStreamingResponse(self._email.routing) + def routing(self) -> RoutingResourceWithStreamingResponse: + return RoutingResourceWithStreamingResponse(self._email.routing) @cached_property - def security(self) -> SecurityWithStreamingResponse: - return SecurityWithStreamingResponse(self._email.security) + def security(self) -> SecurityResourceWithStreamingResponse: + return SecurityResourceWithStreamingResponse(self._email.security) -class AsyncEmailWithStreamingResponse: - def __init__(self, email: AsyncEmail) -> None: +class AsyncEmailResourceWithStreamingResponse: + def __init__(self, email: AsyncEmailResource) -> None: self._email = email @cached_property - def routing(self) -> AsyncRoutingWithStreamingResponse: - return AsyncRoutingWithStreamingResponse(self._email.routing) + def routing(self) -> AsyncRoutingResourceWithStreamingResponse: + return AsyncRoutingResourceWithStreamingResponse(self._email.routing) @cached_property - def security(self) -> AsyncSecurityWithStreamingResponse: - return AsyncSecurityWithStreamingResponse(self._email.security) + def security(self) -> AsyncSecurityResourceWithStreamingResponse: + return AsyncSecurityResourceWithStreamingResponse(self._email.security) diff --git a/src/cloudflare/resources/radar/email/routing/__init__.py b/src/cloudflare/resources/radar/email/routing/__init__.py index 6cdce4c3c3a..ab180ee6030 100644 --- a/src/cloudflare/resources/radar/email/routing/__init__.py +++ b/src/cloudflare/resources/radar/email/routing/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .routing import ( - Routing, - AsyncRouting, - RoutingWithRawResponse, - AsyncRoutingWithRawResponse, - RoutingWithStreamingResponse, - AsyncRoutingWithStreamingResponse, + RoutingResource, + AsyncRoutingResource, + RoutingResourceWithRawResponse, + AsyncRoutingResourceWithRawResponse, + RoutingResourceWithStreamingResponse, + AsyncRoutingResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) __all__ = [ - "Summary", - "AsyncSummary", - "SummaryWithRawResponse", - "AsyncSummaryWithRawResponse", - "SummaryWithStreamingResponse", - "AsyncSummaryWithStreamingResponse", - "TimeseriesGroups", - "AsyncTimeseriesGroups", - "TimeseriesGroupsWithRawResponse", - "AsyncTimeseriesGroupsWithRawResponse", - "TimeseriesGroupsWithStreamingResponse", - "AsyncTimeseriesGroupsWithStreamingResponse", - "Routing", - "AsyncRouting", - "RoutingWithRawResponse", - "AsyncRoutingWithRawResponse", - "RoutingWithStreamingResponse", - "AsyncRoutingWithStreamingResponse", + "SummaryResource", + "AsyncSummaryResource", + "SummaryResourceWithRawResponse", + "AsyncSummaryResourceWithRawResponse", + "SummaryResourceWithStreamingResponse", + "AsyncSummaryResourceWithStreamingResponse", + "TimeseriesGroupsResource", + "AsyncTimeseriesGroupsResource", + "TimeseriesGroupsResourceWithRawResponse", + "AsyncTimeseriesGroupsResourceWithRawResponse", + "TimeseriesGroupsResourceWithStreamingResponse", + "AsyncTimeseriesGroupsResourceWithStreamingResponse", + "RoutingResource", + "AsyncRoutingResource", + "RoutingResourceWithRawResponse", + "AsyncRoutingResourceWithRawResponse", + "RoutingResourceWithStreamingResponse", + "AsyncRoutingResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/email/routing/routing.py b/src/cloudflare/resources/radar/email/routing/routing.py index a922a7cb34a..8904ac5ab58 100644 --- a/src/cloudflare/resources/radar/email/routing/routing.py +++ b/src/cloudflare/resources/radar/email/routing/routing.py @@ -3,110 +3,110 @@ from __future__ import annotations from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) -__all__ = ["Routing", "AsyncRouting"] +__all__ = ["RoutingResource", "AsyncRoutingResource"] -class Routing(SyncAPIResource): +class RoutingResource(SyncAPIResource): @cached_property - def summary(self) -> Summary: - return Summary(self._client) + def summary(self) -> SummaryResource: + return SummaryResource(self._client) @cached_property - def timeseries_groups(self) -> TimeseriesGroups: - return TimeseriesGroups(self._client) + def timeseries_groups(self) -> TimeseriesGroupsResource: + return TimeseriesGroupsResource(self._client) @cached_property - def with_raw_response(self) -> RoutingWithRawResponse: - return RoutingWithRawResponse(self) + def with_raw_response(self) -> RoutingResourceWithRawResponse: + return RoutingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RoutingWithStreamingResponse: - return RoutingWithStreamingResponse(self) + def with_streaming_response(self) -> RoutingResourceWithStreamingResponse: + return RoutingResourceWithStreamingResponse(self) -class AsyncRouting(AsyncAPIResource): +class AsyncRoutingResource(AsyncAPIResource): @cached_property - def summary(self) -> AsyncSummary: - return AsyncSummary(self._client) + def summary(self) -> AsyncSummaryResource: + return AsyncSummaryResource(self._client) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroups: - return AsyncTimeseriesGroups(self._client) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResource: + return AsyncTimeseriesGroupsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRoutingWithRawResponse: - return AsyncRoutingWithRawResponse(self) + def with_raw_response(self) -> AsyncRoutingResourceWithRawResponse: + return AsyncRoutingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRoutingWithStreamingResponse: - return AsyncRoutingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRoutingResourceWithStreamingResponse: + return AsyncRoutingResourceWithStreamingResponse(self) -class RoutingWithRawResponse: - def __init__(self, routing: Routing) -> None: +class RoutingResourceWithRawResponse: + def __init__(self, routing: RoutingResource) -> None: self._routing = routing @cached_property - def summary(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self._routing.summary) + def summary(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self._routing.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self._routing.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self._routing.timeseries_groups) -class AsyncRoutingWithRawResponse: - def __init__(self, routing: AsyncRouting) -> None: +class AsyncRoutingResourceWithRawResponse: + def __init__(self, routing: AsyncRoutingResource) -> None: self._routing = routing @cached_property - def summary(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self._routing.summary) + def summary(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self._routing.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self._routing.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self._routing.timeseries_groups) -class RoutingWithStreamingResponse: - def __init__(self, routing: Routing) -> None: +class RoutingResourceWithStreamingResponse: + def __init__(self, routing: RoutingResource) -> None: self._routing = routing @cached_property - def summary(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self._routing.summary) + def summary(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self._routing.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self._routing.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self._routing.timeseries_groups) -class AsyncRoutingWithStreamingResponse: - def __init__(self, routing: AsyncRouting) -> None: +class AsyncRoutingResourceWithStreamingResponse: + def __init__(self, routing: AsyncRoutingResource) -> None: self._routing = routing @cached_property - def summary(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self._routing.summary) + def summary(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self._routing.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self._routing.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self._routing.timeseries_groups) diff --git a/src/cloudflare/resources/radar/email/routing/summary.py b/src/cloudflare/resources/radar/email/routing/summary.py index 3c69e285c9a..574def195a1 100644 --- a/src/cloudflare/resources/radar/email/routing/summary.py +++ b/src/cloudflare/resources/radar/email/routing/summary.py @@ -26,12 +26,6 @@ make_request_options, ) from .....types.radar.email.routing import ( - SummaryARCResponse, - SummarySPFResponse, - SummaryDKIMResponse, - SummaryDMARCResponse, - SummaryEncryptedResponse, - SummaryIPVersionResponse, summary_arc_params, summary_spf_params, summary_dkim_params, @@ -39,18 +33,24 @@ summary_encrypted_params, summary_ip_version_params, ) +from .....types.radar.email.routing.summary_arc_response import SummaryARCResponse +from .....types.radar.email.routing.summary_spf_response import SummarySPFResponse +from .....types.radar.email.routing.summary_dkim_response import SummaryDKIMResponse +from .....types.radar.email.routing.summary_dmarc_response import SummaryDMARCResponse +from .....types.radar.email.routing.summary_encrypted_response import SummaryEncryptedResponse +from .....types.radar.email.routing.summary_ip_version_response import SummaryIPVersionResponse -__all__ = ["Summary", "AsyncSummary"] +__all__ = ["SummaryResource", "AsyncSummaryResource"] -class Summary(SyncAPIResource): +class SummaryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self) + def with_raw_response(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self) + def with_streaming_response(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self) def arc( self, @@ -147,7 +147,7 @@ def arc( }, summary_arc_params.SummaryARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryARCResponse]._unwrapper, ), cast_to=cast(Type[SummaryARCResponse], ResultWrapper[SummaryARCResponse]), ) @@ -247,7 +247,7 @@ def dkim( }, summary_dkim_params.SummaryDKIMParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDKIMResponse]._unwrapper, ), cast_to=cast(Type[SummaryDKIMResponse], ResultWrapper[SummaryDKIMResponse]), ) @@ -347,7 +347,7 @@ def dmarc( }, summary_dmarc_params.SummaryDMARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDMARCResponse]._unwrapper, ), cast_to=cast(Type[SummaryDMARCResponse], ResultWrapper[SummaryDMARCResponse]), ) @@ -447,7 +447,7 @@ def encrypted( }, summary_encrypted_params.SummaryEncryptedParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryEncryptedResponse]._unwrapper, ), cast_to=cast(Type[SummaryEncryptedResponse], ResultWrapper[SummaryEncryptedResponse]), ) @@ -547,7 +547,7 @@ def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -647,20 +647,20 @@ def spf( }, summary_spf_params.SummarySPFParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummarySPFResponse]._unwrapper, ), cast_to=cast(Type[SummarySPFResponse], ResultWrapper[SummarySPFResponse]), ) -class AsyncSummary(AsyncAPIResource): +class AsyncSummaryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self) + def with_raw_response(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self) async def arc( self, @@ -757,7 +757,7 @@ async def arc( }, summary_arc_params.SummaryARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryARCResponse]._unwrapper, ), cast_to=cast(Type[SummaryARCResponse], ResultWrapper[SummaryARCResponse]), ) @@ -857,7 +857,7 @@ async def dkim( }, summary_dkim_params.SummaryDKIMParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDKIMResponse]._unwrapper, ), cast_to=cast(Type[SummaryDKIMResponse], ResultWrapper[SummaryDKIMResponse]), ) @@ -957,7 +957,7 @@ async def dmarc( }, summary_dmarc_params.SummaryDMARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDMARCResponse]._unwrapper, ), cast_to=cast(Type[SummaryDMARCResponse], ResultWrapper[SummaryDMARCResponse]), ) @@ -1057,7 +1057,7 @@ async def encrypted( }, summary_encrypted_params.SummaryEncryptedParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryEncryptedResponse]._unwrapper, ), cast_to=cast(Type[SummaryEncryptedResponse], ResultWrapper[SummaryEncryptedResponse]), ) @@ -1157,7 +1157,7 @@ async def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -1257,14 +1257,14 @@ async def spf( }, summary_spf_params.SummarySPFParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummarySPFResponse]._unwrapper, ), cast_to=cast(Type[SummarySPFResponse], ResultWrapper[SummarySPFResponse]), ) -class SummaryWithRawResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithRawResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.arc = to_raw_response_wrapper( @@ -1287,8 +1287,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithRawResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithRawResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.arc = async_to_raw_response_wrapper( @@ -1311,8 +1311,8 @@ def __init__(self, summary: AsyncSummary) -> None: ) -class SummaryWithStreamingResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithStreamingResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.arc = to_streamed_response_wrapper( @@ -1335,8 +1335,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithStreamingResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithStreamingResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.arc = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/email/routing/timeseries_groups.py b/src/cloudflare/resources/radar/email/routing/timeseries_groups.py index 292779eac89..bffe7e21af1 100644 --- a/src/cloudflare/resources/radar/email/routing/timeseries_groups.py +++ b/src/cloudflare/resources/radar/email/routing/timeseries_groups.py @@ -26,12 +26,6 @@ make_request_options, ) from .....types.radar.email.routing import ( - TimeseriesGroupARCResponse, - TimeseriesGroupSPFResponse, - TimeseriesGroupDKIMResponse, - TimeseriesGroupDMARCResponse, - TimeseriesGroupEncryptedResponse, - TimeseriesGroupIPVersionResponse, timeseries_group_arc_params, timeseries_group_spf_params, timeseries_group_dkim_params, @@ -39,18 +33,24 @@ timeseries_group_encrypted_params, timeseries_group_ip_version_params, ) +from .....types.radar.email.routing.timeseries_group_arc_response import TimeseriesGroupARCResponse +from .....types.radar.email.routing.timeseries_group_spf_response import TimeseriesGroupSPFResponse +from .....types.radar.email.routing.timeseries_group_dkim_response import TimeseriesGroupDKIMResponse +from .....types.radar.email.routing.timeseries_group_dmarc_response import TimeseriesGroupDMARCResponse +from .....types.radar.email.routing.timeseries_group_encrypted_response import TimeseriesGroupEncryptedResponse +from .....types.radar.email.routing.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse -__all__ = ["TimeseriesGroups", "AsyncTimeseriesGroups"] +__all__ = ["TimeseriesGroupsResource", "AsyncTimeseriesGroupsResource"] -class TimeseriesGroups(SyncAPIResource): +class TimeseriesGroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self) def arc( self, @@ -153,7 +153,7 @@ def arc( }, timeseries_group_arc_params.TimeseriesGroupARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupARCResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupARCResponse], ResultWrapper[TimeseriesGroupARCResponse]), ) @@ -259,7 +259,7 @@ def dkim( }, timeseries_group_dkim_params.TimeseriesGroupDKIMParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDKIMResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDKIMResponse], ResultWrapper[TimeseriesGroupDKIMResponse]), ) @@ -365,7 +365,7 @@ def dmarc( }, timeseries_group_dmarc_params.TimeseriesGroupDMARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDMARCResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDMARCResponse], ResultWrapper[TimeseriesGroupDMARCResponse]), ) @@ -471,7 +471,7 @@ def encrypted( }, timeseries_group_encrypted_params.TimeseriesGroupEncryptedParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupEncryptedResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupEncryptedResponse], ResultWrapper[TimeseriesGroupEncryptedResponse]), ) @@ -577,7 +577,7 @@ def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -683,20 +683,20 @@ def spf( }, timeseries_group_spf_params.TimeseriesGroupSPFParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupSPFResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupSPFResponse], ResultWrapper[TimeseriesGroupSPFResponse]), ) -class AsyncTimeseriesGroups(AsyncAPIResource): +class AsyncTimeseriesGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self) async def arc( self, @@ -799,7 +799,7 @@ async def arc( }, timeseries_group_arc_params.TimeseriesGroupARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupARCResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupARCResponse], ResultWrapper[TimeseriesGroupARCResponse]), ) @@ -905,7 +905,7 @@ async def dkim( }, timeseries_group_dkim_params.TimeseriesGroupDKIMParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDKIMResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDKIMResponse], ResultWrapper[TimeseriesGroupDKIMResponse]), ) @@ -1011,7 +1011,7 @@ async def dmarc( }, timeseries_group_dmarc_params.TimeseriesGroupDMARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDMARCResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDMARCResponse], ResultWrapper[TimeseriesGroupDMARCResponse]), ) @@ -1117,7 +1117,7 @@ async def encrypted( }, timeseries_group_encrypted_params.TimeseriesGroupEncryptedParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupEncryptedResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupEncryptedResponse], ResultWrapper[TimeseriesGroupEncryptedResponse]), ) @@ -1223,7 +1223,7 @@ async def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -1329,14 +1329,14 @@ async def spf( }, timeseries_group_spf_params.TimeseriesGroupSPFParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupSPFResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupSPFResponse], ResultWrapper[TimeseriesGroupSPFResponse]), ) -class TimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.arc = to_raw_response_wrapper( @@ -1359,8 +1359,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.arc = async_to_raw_response_wrapper( @@ -1383,8 +1383,8 @@ def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: ) -class TimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.arc = to_streamed_response_wrapper( @@ -1407,8 +1407,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.arc = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/email/security/__init__.py b/src/cloudflare/resources/radar/email/security/__init__.py index 43af88f3f92..df039c900c7 100644 --- a/src/cloudflare/resources/radar/email/security/__init__.py +++ b/src/cloudflare/resources/radar/email/security/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) from .security import ( - Security, - AsyncSecurity, - SecurityWithRawResponse, - AsyncSecurityWithRawResponse, - SecurityWithStreamingResponse, - AsyncSecurityWithStreamingResponse, + SecurityResource, + AsyncSecurityResource, + SecurityResourceWithRawResponse, + AsyncSecurityResourceWithRawResponse, + SecurityResourceWithStreamingResponse, + AsyncSecurityResourceWithStreamingResponse, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) __all__ = [ - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "Summary", - "AsyncSummary", - "SummaryWithRawResponse", - "AsyncSummaryWithRawResponse", - "SummaryWithStreamingResponse", - "AsyncSummaryWithStreamingResponse", - "TimeseriesGroups", - "AsyncTimeseriesGroups", - "TimeseriesGroupsWithRawResponse", - "AsyncTimeseriesGroupsWithRawResponse", - "TimeseriesGroupsWithStreamingResponse", - "AsyncTimeseriesGroupsWithStreamingResponse", - "Security", - "AsyncSecurity", - "SecurityWithRawResponse", - "AsyncSecurityWithRawResponse", - "SecurityWithStreamingResponse", - "AsyncSecurityWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "SummaryResource", + "AsyncSummaryResource", + "SummaryResourceWithRawResponse", + "AsyncSummaryResourceWithRawResponse", + "SummaryResourceWithStreamingResponse", + "AsyncSummaryResourceWithStreamingResponse", + "TimeseriesGroupsResource", + "AsyncTimeseriesGroupsResource", + "TimeseriesGroupsResourceWithRawResponse", + "AsyncTimeseriesGroupsResourceWithRawResponse", + "TimeseriesGroupsResourceWithStreamingResponse", + "AsyncTimeseriesGroupsResourceWithStreamingResponse", + "SecurityResource", + "AsyncSecurityResource", + "SecurityResourceWithRawResponse", + "AsyncSecurityResourceWithRawResponse", + "SecurityResourceWithStreamingResponse", + "AsyncSecurityResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/email/security/security.py b/src/cloudflare/resources/radar/email/security/security.py index 7a399b1c841..a738a646df4 100644 --- a/src/cloudflare/resources/radar/email/security/security.py +++ b/src/cloudflare/resources/radar/email/security/security.py @@ -3,143 +3,143 @@ from __future__ import annotations from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) -from .top.top import Top, AsyncTop +from .top.top import TopResource, AsyncTopResource from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) -__all__ = ["Security", "AsyncSecurity"] +__all__ = ["SecurityResource", "AsyncSecurityResource"] -class Security(SyncAPIResource): +class SecurityResource(SyncAPIResource): @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def summary(self) -> Summary: - return Summary(self._client) + def summary(self) -> SummaryResource: + return SummaryResource(self._client) @cached_property - def timeseries_groups(self) -> TimeseriesGroups: - return TimeseriesGroups(self._client) + def timeseries_groups(self) -> TimeseriesGroupsResource: + return TimeseriesGroupsResource(self._client) @cached_property - def with_raw_response(self) -> SecurityWithRawResponse: - return SecurityWithRawResponse(self) + def with_raw_response(self) -> SecurityResourceWithRawResponse: + return SecurityResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SecurityWithStreamingResponse: - return SecurityWithStreamingResponse(self) + def with_streaming_response(self) -> SecurityResourceWithStreamingResponse: + return SecurityResourceWithStreamingResponse(self) -class AsyncSecurity(AsyncAPIResource): +class AsyncSecurityResource(AsyncAPIResource): @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def summary(self) -> AsyncSummary: - return AsyncSummary(self._client) + def summary(self) -> AsyncSummaryResource: + return AsyncSummaryResource(self._client) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroups: - return AsyncTimeseriesGroups(self._client) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResource: + return AsyncTimeseriesGroupsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSecurityWithRawResponse: - return AsyncSecurityWithRawResponse(self) + def with_raw_response(self) -> AsyncSecurityResourceWithRawResponse: + return AsyncSecurityResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSecurityWithStreamingResponse: - return AsyncSecurityWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSecurityResourceWithStreamingResponse: + return AsyncSecurityResourceWithStreamingResponse(self) -class SecurityWithRawResponse: - def __init__(self, security: Security) -> None: +class SecurityResourceWithRawResponse: + def __init__(self, security: SecurityResource) -> None: self._security = security @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._security.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._security.top) @cached_property - def summary(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self._security.summary) + def summary(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self._security.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self._security.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self._security.timeseries_groups) -class AsyncSecurityWithRawResponse: - def __init__(self, security: AsyncSecurity) -> None: +class AsyncSecurityResourceWithRawResponse: + def __init__(self, security: AsyncSecurityResource) -> None: self._security = security @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._security.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._security.top) @cached_property - def summary(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self._security.summary) + def summary(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self._security.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self._security.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self._security.timeseries_groups) -class SecurityWithStreamingResponse: - def __init__(self, security: Security) -> None: +class SecurityResourceWithStreamingResponse: + def __init__(self, security: SecurityResource) -> None: self._security = security @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._security.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._security.top) @cached_property - def summary(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self._security.summary) + def summary(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self._security.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self._security.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self._security.timeseries_groups) -class AsyncSecurityWithStreamingResponse: - def __init__(self, security: AsyncSecurity) -> None: +class AsyncSecurityResourceWithStreamingResponse: + def __init__(self, security: AsyncSecurityResource) -> None: self._security = security @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._security.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._security.top) @cached_property - def summary(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self._security.summary) + def summary(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self._security.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self._security.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self._security.timeseries_groups) diff --git a/src/cloudflare/resources/radar/email/security/summary.py b/src/cloudflare/resources/radar/email/security/summary.py index 0f7962b40d6..65f3b3d8dd1 100644 --- a/src/cloudflare/resources/radar/email/security/summary.py +++ b/src/cloudflare/resources/radar/email/security/summary.py @@ -26,15 +26,6 @@ make_request_options, ) from .....types.radar.email.security import ( - SummaryARCResponse, - SummarySPFResponse, - SummaryDKIMResponse, - SummarySpamResponse, - SummaryDMARCResponse, - SummarySpoofResponse, - SummaryMaliciousResponse, - SummaryTLSVersionResponse, - SummaryThreatCategoryResponse, summary_arc_params, summary_spf_params, summary_dkim_params, @@ -45,18 +36,27 @@ summary_tls_version_params, summary_threat_category_params, ) +from .....types.radar.email.security.summary_arc_response import SummaryARCResponse +from .....types.radar.email.security.summary_spf_response import SummarySPFResponse +from .....types.radar.email.security.summary_dkim_response import SummaryDKIMResponse +from .....types.radar.email.security.summary_spam_response import SummarySpamResponse +from .....types.radar.email.security.summary_dmarc_response import SummaryDMARCResponse +from .....types.radar.email.security.summary_spoof_response import SummarySpoofResponse +from .....types.radar.email.security.summary_malicious_response import SummaryMaliciousResponse +from .....types.radar.email.security.summary_tls_version_response import SummaryTLSVersionResponse +from .....types.radar.email.security.summary_threat_category_response import SummaryThreatCategoryResponse -__all__ = ["Summary", "AsyncSummary"] +__all__ = ["SummaryResource", "AsyncSummaryResource"] -class Summary(SyncAPIResource): +class SummaryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self) + def with_raw_response(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self) + def with_streaming_response(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self) def arc( self, @@ -149,7 +149,7 @@ def arc( }, summary_arc_params.SummaryARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryARCResponse]._unwrapper, ), cast_to=cast(Type[SummaryARCResponse], ResultWrapper[SummaryARCResponse]), ) @@ -245,7 +245,7 @@ def dkim( }, summary_dkim_params.SummaryDKIMParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDKIMResponse]._unwrapper, ), cast_to=cast(Type[SummaryDKIMResponse], ResultWrapper[SummaryDKIMResponse]), ) @@ -341,7 +341,7 @@ def dmarc( }, summary_dmarc_params.SummaryDMARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDMARCResponse]._unwrapper, ), cast_to=cast(Type[SummaryDMARCResponse], ResultWrapper[SummaryDMARCResponse]), ) @@ -441,7 +441,7 @@ def malicious( }, summary_malicious_params.SummaryMaliciousParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryMaliciousResponse]._unwrapper, ), cast_to=cast(Type[SummaryMaliciousResponse], ResultWrapper[SummaryMaliciousResponse]), ) @@ -541,7 +541,7 @@ def spam( }, summary_spam_params.SummarySpamParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummarySpamResponse]._unwrapper, ), cast_to=cast(Type[SummarySpamResponse], ResultWrapper[SummarySpamResponse]), ) @@ -637,7 +637,7 @@ def spf( }, summary_spf_params.SummarySPFParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummarySPFResponse]._unwrapper, ), cast_to=cast(Type[SummarySPFResponse], ResultWrapper[SummarySPFResponse]), ) @@ -737,7 +737,7 @@ def spoof( }, summary_spoof_params.SummarySpoofParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummarySpoofResponse]._unwrapper, ), cast_to=cast(Type[SummarySpoofResponse], ResultWrapper[SummarySpoofResponse]), ) @@ -837,7 +837,7 @@ def threat_category( }, summary_threat_category_params.SummaryThreatCategoryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryThreatCategoryResponse]._unwrapper, ), cast_to=cast(Type[SummaryThreatCategoryResponse], ResultWrapper[SummaryThreatCategoryResponse]), ) @@ -933,20 +933,20 @@ def tls_version( }, summary_tls_version_params.SummaryTLSVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryTLSVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryTLSVersionResponse], ResultWrapper[SummaryTLSVersionResponse]), ) -class AsyncSummary(AsyncAPIResource): +class AsyncSummaryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self) + def with_raw_response(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self) async def arc( self, @@ -1039,7 +1039,7 @@ async def arc( }, summary_arc_params.SummaryARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryARCResponse]._unwrapper, ), cast_to=cast(Type[SummaryARCResponse], ResultWrapper[SummaryARCResponse]), ) @@ -1135,7 +1135,7 @@ async def dkim( }, summary_dkim_params.SummaryDKIMParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDKIMResponse]._unwrapper, ), cast_to=cast(Type[SummaryDKIMResponse], ResultWrapper[SummaryDKIMResponse]), ) @@ -1231,7 +1231,7 @@ async def dmarc( }, summary_dmarc_params.SummaryDMARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDMARCResponse]._unwrapper, ), cast_to=cast(Type[SummaryDMARCResponse], ResultWrapper[SummaryDMARCResponse]), ) @@ -1331,7 +1331,7 @@ async def malicious( }, summary_malicious_params.SummaryMaliciousParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryMaliciousResponse]._unwrapper, ), cast_to=cast(Type[SummaryMaliciousResponse], ResultWrapper[SummaryMaliciousResponse]), ) @@ -1431,7 +1431,7 @@ async def spam( }, summary_spam_params.SummarySpamParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummarySpamResponse]._unwrapper, ), cast_to=cast(Type[SummarySpamResponse], ResultWrapper[SummarySpamResponse]), ) @@ -1527,7 +1527,7 @@ async def spf( }, summary_spf_params.SummarySPFParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummarySPFResponse]._unwrapper, ), cast_to=cast(Type[SummarySPFResponse], ResultWrapper[SummarySPFResponse]), ) @@ -1627,7 +1627,7 @@ async def spoof( }, summary_spoof_params.SummarySpoofParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummarySpoofResponse]._unwrapper, ), cast_to=cast(Type[SummarySpoofResponse], ResultWrapper[SummarySpoofResponse]), ) @@ -1727,7 +1727,7 @@ async def threat_category( }, summary_threat_category_params.SummaryThreatCategoryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryThreatCategoryResponse]._unwrapper, ), cast_to=cast(Type[SummaryThreatCategoryResponse], ResultWrapper[SummaryThreatCategoryResponse]), ) @@ -1823,14 +1823,14 @@ async def tls_version( }, summary_tls_version_params.SummaryTLSVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryTLSVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryTLSVersionResponse], ResultWrapper[SummaryTLSVersionResponse]), ) -class SummaryWithRawResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithRawResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.arc = to_raw_response_wrapper( @@ -1862,8 +1862,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithRawResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithRawResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.arc = async_to_raw_response_wrapper( @@ -1895,8 +1895,8 @@ def __init__(self, summary: AsyncSummary) -> None: ) -class SummaryWithStreamingResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithStreamingResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.arc = to_streamed_response_wrapper( @@ -1928,8 +1928,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithStreamingResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithStreamingResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.arc = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/email/security/timeseries_groups.py b/src/cloudflare/resources/radar/email/security/timeseries_groups.py index 4c06b252e1d..12486f075c1 100644 --- a/src/cloudflare/resources/radar/email/security/timeseries_groups.py +++ b/src/cloudflare/resources/radar/email/security/timeseries_groups.py @@ -26,15 +26,6 @@ make_request_options, ) from .....types.radar.email.security import ( - TimeseriesGroupARCResponse, - TimeseriesGroupSPFResponse, - TimeseriesGroupDKIMResponse, - TimeseriesGroupSpamResponse, - TimeseriesGroupDMARCResponse, - TimeseriesGroupSpoofResponse, - TimeseriesGroupMaliciousResponse, - TimeseriesGroupTLSVersionResponse, - TimeseriesGroupThreatCategoryResponse, timeseries_group_arc_params, timeseries_group_spf_params, timeseries_group_dkim_params, @@ -45,18 +36,29 @@ timeseries_group_tls_version_params, timeseries_group_threat_category_params, ) +from .....types.radar.email.security.timeseries_group_arc_response import TimeseriesGroupARCResponse +from .....types.radar.email.security.timeseries_group_spf_response import TimeseriesGroupSPFResponse +from .....types.radar.email.security.timeseries_group_dkim_response import TimeseriesGroupDKIMResponse +from .....types.radar.email.security.timeseries_group_spam_response import TimeseriesGroupSpamResponse +from .....types.radar.email.security.timeseries_group_dmarc_response import TimeseriesGroupDMARCResponse +from .....types.radar.email.security.timeseries_group_spoof_response import TimeseriesGroupSpoofResponse +from .....types.radar.email.security.timeseries_group_malicious_response import TimeseriesGroupMaliciousResponse +from .....types.radar.email.security.timeseries_group_tls_version_response import TimeseriesGroupTLSVersionResponse +from .....types.radar.email.security.timeseries_group_threat_category_response import ( + TimeseriesGroupThreatCategoryResponse, +) -__all__ = ["TimeseriesGroups", "AsyncTimeseriesGroups"] +__all__ = ["TimeseriesGroupsResource", "AsyncTimeseriesGroupsResource"] -class TimeseriesGroups(SyncAPIResource): +class TimeseriesGroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self) def arc( self, @@ -155,7 +157,7 @@ def arc( }, timeseries_group_arc_params.TimeseriesGroupARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupARCResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupARCResponse], ResultWrapper[TimeseriesGroupARCResponse]), ) @@ -257,7 +259,7 @@ def dkim( }, timeseries_group_dkim_params.TimeseriesGroupDKIMParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDKIMResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDKIMResponse], ResultWrapper[TimeseriesGroupDKIMResponse]), ) @@ -359,7 +361,7 @@ def dmarc( }, timeseries_group_dmarc_params.TimeseriesGroupDMARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDMARCResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDMARCResponse], ResultWrapper[TimeseriesGroupDMARCResponse]), ) @@ -465,7 +467,7 @@ def malicious( }, timeseries_group_malicious_params.TimeseriesGroupMaliciousParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupMaliciousResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupMaliciousResponse], ResultWrapper[TimeseriesGroupMaliciousResponse]), ) @@ -571,7 +573,7 @@ def spam( }, timeseries_group_spam_params.TimeseriesGroupSpamParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupSpamResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupSpamResponse], ResultWrapper[TimeseriesGroupSpamResponse]), ) @@ -673,7 +675,7 @@ def spf( }, timeseries_group_spf_params.TimeseriesGroupSPFParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupSPFResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupSPFResponse], ResultWrapper[TimeseriesGroupSPFResponse]), ) @@ -779,7 +781,7 @@ def spoof( }, timeseries_group_spoof_params.TimeseriesGroupSpoofParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupSpoofResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupSpoofResponse], ResultWrapper[TimeseriesGroupSpoofResponse]), ) @@ -885,7 +887,7 @@ def threat_category( }, timeseries_group_threat_category_params.TimeseriesGroupThreatCategoryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupThreatCategoryResponse]._unwrapper, ), cast_to=cast( Type[TimeseriesGroupThreatCategoryResponse], ResultWrapper[TimeseriesGroupThreatCategoryResponse] @@ -989,20 +991,20 @@ def tls_version( }, timeseries_group_tls_version_params.TimeseriesGroupTLSVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupTLSVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupTLSVersionResponse], ResultWrapper[TimeseriesGroupTLSVersionResponse]), ) -class AsyncTimeseriesGroups(AsyncAPIResource): +class AsyncTimeseriesGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self) async def arc( self, @@ -1101,7 +1103,7 @@ async def arc( }, timeseries_group_arc_params.TimeseriesGroupARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupARCResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupARCResponse], ResultWrapper[TimeseriesGroupARCResponse]), ) @@ -1203,7 +1205,7 @@ async def dkim( }, timeseries_group_dkim_params.TimeseriesGroupDKIMParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDKIMResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDKIMResponse], ResultWrapper[TimeseriesGroupDKIMResponse]), ) @@ -1305,7 +1307,7 @@ async def dmarc( }, timeseries_group_dmarc_params.TimeseriesGroupDMARCParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDMARCResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDMARCResponse], ResultWrapper[TimeseriesGroupDMARCResponse]), ) @@ -1411,7 +1413,7 @@ async def malicious( }, timeseries_group_malicious_params.TimeseriesGroupMaliciousParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupMaliciousResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupMaliciousResponse], ResultWrapper[TimeseriesGroupMaliciousResponse]), ) @@ -1517,7 +1519,7 @@ async def spam( }, timeseries_group_spam_params.TimeseriesGroupSpamParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupSpamResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupSpamResponse], ResultWrapper[TimeseriesGroupSpamResponse]), ) @@ -1619,7 +1621,7 @@ async def spf( }, timeseries_group_spf_params.TimeseriesGroupSPFParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupSPFResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupSPFResponse], ResultWrapper[TimeseriesGroupSPFResponse]), ) @@ -1725,7 +1727,7 @@ async def spoof( }, timeseries_group_spoof_params.TimeseriesGroupSpoofParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupSpoofResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupSpoofResponse], ResultWrapper[TimeseriesGroupSpoofResponse]), ) @@ -1831,7 +1833,7 @@ async def threat_category( }, timeseries_group_threat_category_params.TimeseriesGroupThreatCategoryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupThreatCategoryResponse]._unwrapper, ), cast_to=cast( Type[TimeseriesGroupThreatCategoryResponse], ResultWrapper[TimeseriesGroupThreatCategoryResponse] @@ -1935,14 +1937,14 @@ async def tls_version( }, timeseries_group_tls_version_params.TimeseriesGroupTLSVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupTLSVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupTLSVersionResponse], ResultWrapper[TimeseriesGroupTLSVersionResponse]), ) -class TimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.arc = to_raw_response_wrapper( @@ -1974,8 +1976,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.arc = async_to_raw_response_wrapper( @@ -2007,8 +2009,8 @@ def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: ) -class TimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.arc = to_streamed_response_wrapper( @@ -2040,8 +2042,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.arc = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/email/security/top/__init__.py b/src/cloudflare/resources/radar/email/security/top/__init__.py index 04accc07551..f9133afce2a 100644 --- a/src/cloudflare/resources/radar/email/security/top/__init__.py +++ b/src/cloudflare/resources/radar/email/security/top/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .tlds import ( - Tlds, - AsyncTlds, - TldsWithRawResponse, - AsyncTldsWithRawResponse, - TldsWithStreamingResponse, - AsyncTldsWithStreamingResponse, + TldsResource, + AsyncTldsResource, + TldsResourceWithRawResponse, + AsyncTldsResourceWithRawResponse, + TldsResourceWithStreamingResponse, + AsyncTldsResourceWithStreamingResponse, ) __all__ = [ - "Tlds", - "AsyncTlds", - "TldsWithRawResponse", - "AsyncTldsWithRawResponse", - "TldsWithStreamingResponse", - "AsyncTldsWithStreamingResponse", - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", + "TldsResource", + "AsyncTldsResource", + "TldsResourceWithRawResponse", + "AsyncTldsResourceWithRawResponse", + "TldsResourceWithStreamingResponse", + "AsyncTldsResourceWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/email/security/top/tlds/__init__.py b/src/cloudflare/resources/radar/email/security/top/tlds/__init__.py index 59fc91f72ce..84574e9ae33 100644 --- a/src/cloudflare/resources/radar/email/security/top/tlds/__init__.py +++ b/src/cloudflare/resources/radar/email/security/top/tlds/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .spam import ( - Spam, - AsyncSpam, - SpamWithRawResponse, - AsyncSpamWithRawResponse, - SpamWithStreamingResponse, - AsyncSpamWithStreamingResponse, + SpamResource, + AsyncSpamResource, + SpamResourceWithRawResponse, + AsyncSpamResourceWithRawResponse, + SpamResourceWithStreamingResponse, + AsyncSpamResourceWithStreamingResponse, ) from .tlds import ( - Tlds, - AsyncTlds, - TldsWithRawResponse, - AsyncTldsWithRawResponse, - TldsWithStreamingResponse, - AsyncTldsWithStreamingResponse, + TldsResource, + AsyncTldsResource, + TldsResourceWithRawResponse, + AsyncTldsResourceWithRawResponse, + TldsResourceWithStreamingResponse, + AsyncTldsResourceWithStreamingResponse, ) from .spoof import ( - Spoof, - AsyncSpoof, - SpoofWithRawResponse, - AsyncSpoofWithRawResponse, - SpoofWithStreamingResponse, - AsyncSpoofWithStreamingResponse, + SpoofResource, + AsyncSpoofResource, + SpoofResourceWithRawResponse, + AsyncSpoofResourceWithRawResponse, + SpoofResourceWithStreamingResponse, + AsyncSpoofResourceWithStreamingResponse, ) from .malicious import ( - Malicious, - AsyncMalicious, - MaliciousWithRawResponse, - AsyncMaliciousWithRawResponse, - MaliciousWithStreamingResponse, - AsyncMaliciousWithStreamingResponse, + MaliciousResource, + AsyncMaliciousResource, + MaliciousResourceWithRawResponse, + AsyncMaliciousResourceWithRawResponse, + MaliciousResourceWithStreamingResponse, + AsyncMaliciousResourceWithStreamingResponse, ) __all__ = [ - "Malicious", - "AsyncMalicious", - "MaliciousWithRawResponse", - "AsyncMaliciousWithRawResponse", - "MaliciousWithStreamingResponse", - "AsyncMaliciousWithStreamingResponse", - "Spam", - "AsyncSpam", - "SpamWithRawResponse", - "AsyncSpamWithRawResponse", - "SpamWithStreamingResponse", - "AsyncSpamWithStreamingResponse", - "Spoof", - "AsyncSpoof", - "SpoofWithRawResponse", - "AsyncSpoofWithRawResponse", - "SpoofWithStreamingResponse", - "AsyncSpoofWithStreamingResponse", - "Tlds", - "AsyncTlds", - "TldsWithRawResponse", - "AsyncTldsWithRawResponse", - "TldsWithStreamingResponse", - "AsyncTldsWithStreamingResponse", + "MaliciousResource", + "AsyncMaliciousResource", + "MaliciousResourceWithRawResponse", + "AsyncMaliciousResourceWithRawResponse", + "MaliciousResourceWithStreamingResponse", + "AsyncMaliciousResourceWithStreamingResponse", + "SpamResource", + "AsyncSpamResource", + "SpamResourceWithRawResponse", + "AsyncSpamResourceWithRawResponse", + "SpamResourceWithStreamingResponse", + "AsyncSpamResourceWithStreamingResponse", + "SpoofResource", + "AsyncSpoofResource", + "SpoofResourceWithRawResponse", + "AsyncSpoofResourceWithRawResponse", + "SpoofResourceWithStreamingResponse", + "AsyncSpoofResourceWithStreamingResponse", + "TldsResource", + "AsyncTldsResource", + "TldsResourceWithRawResponse", + "AsyncTldsResourceWithRawResponse", + "TldsResourceWithStreamingResponse", + "AsyncTldsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/email/security/top/tlds/malicious.py b/src/cloudflare/resources/radar/email/security/top/tlds/malicious.py index 932ed73019a..c9166b9619b 100644 --- a/src/cloudflare/resources/radar/email/security/top/tlds/malicious.py +++ b/src/cloudflare/resources/radar/email/security/top/tlds/malicious.py @@ -25,19 +25,20 @@ from ......._base_client import ( make_request_options, ) -from .......types.radar.email.security.top.tlds import MaliciousGetResponse, malicious_get_params +from .......types.radar.email.security.top.tlds import malicious_get_params +from .......types.radar.email.security.top.tlds.malicious_get_response import MaliciousGetResponse -__all__ = ["Malicious", "AsyncMalicious"] +__all__ = ["MaliciousResource", "AsyncMaliciousResource"] -class Malicious(SyncAPIResource): +class MaliciousResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MaliciousWithRawResponse: - return MaliciousWithRawResponse(self) + def with_raw_response(self) -> MaliciousResourceWithRawResponse: + return MaliciousResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MaliciousWithStreamingResponse: - return MaliciousWithStreamingResponse(self) + def with_streaming_response(self) -> MaliciousResourceWithStreamingResponse: + return MaliciousResourceWithStreamingResponse(self) def get( self, @@ -147,20 +148,20 @@ def get( }, malicious_get_params.MaliciousGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MaliciousGetResponse]._unwrapper, ), cast_to=cast(Type[MaliciousGetResponse], ResultWrapper[MaliciousGetResponse]), ) -class AsyncMalicious(AsyncAPIResource): +class AsyncMaliciousResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMaliciousWithRawResponse: - return AsyncMaliciousWithRawResponse(self) + def with_raw_response(self) -> AsyncMaliciousResourceWithRawResponse: + return AsyncMaliciousResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMaliciousWithStreamingResponse: - return AsyncMaliciousWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMaliciousResourceWithStreamingResponse: + return AsyncMaliciousResourceWithStreamingResponse(self) async def get( self, @@ -270,14 +271,14 @@ async def get( }, malicious_get_params.MaliciousGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[MaliciousGetResponse]._unwrapper, ), cast_to=cast(Type[MaliciousGetResponse], ResultWrapper[MaliciousGetResponse]), ) -class MaliciousWithRawResponse: - def __init__(self, malicious: Malicious) -> None: +class MaliciousResourceWithRawResponse: + def __init__(self, malicious: MaliciousResource) -> None: self._malicious = malicious self.get = to_raw_response_wrapper( @@ -285,8 +286,8 @@ def __init__(self, malicious: Malicious) -> None: ) -class AsyncMaliciousWithRawResponse: - def __init__(self, malicious: AsyncMalicious) -> None: +class AsyncMaliciousResourceWithRawResponse: + def __init__(self, malicious: AsyncMaliciousResource) -> None: self._malicious = malicious self.get = async_to_raw_response_wrapper( @@ -294,8 +295,8 @@ def __init__(self, malicious: AsyncMalicious) -> None: ) -class MaliciousWithStreamingResponse: - def __init__(self, malicious: Malicious) -> None: +class MaliciousResourceWithStreamingResponse: + def __init__(self, malicious: MaliciousResource) -> None: self._malicious = malicious self.get = to_streamed_response_wrapper( @@ -303,8 +304,8 @@ def __init__(self, malicious: Malicious) -> None: ) -class AsyncMaliciousWithStreamingResponse: - def __init__(self, malicious: AsyncMalicious) -> None: +class AsyncMaliciousResourceWithStreamingResponse: + def __init__(self, malicious: AsyncMaliciousResource) -> None: self._malicious = malicious self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/email/security/top/tlds/spam.py b/src/cloudflare/resources/radar/email/security/top/tlds/spam.py index 7cb8f7b240a..40886bdcb09 100644 --- a/src/cloudflare/resources/radar/email/security/top/tlds/spam.py +++ b/src/cloudflare/resources/radar/email/security/top/tlds/spam.py @@ -25,19 +25,20 @@ from ......._base_client import ( make_request_options, ) -from .......types.radar.email.security.top.tlds import SpamGetResponse, spam_get_params +from .......types.radar.email.security.top.tlds import spam_get_params +from .......types.radar.email.security.top.tlds.spam_get_response import SpamGetResponse -__all__ = ["Spam", "AsyncSpam"] +__all__ = ["SpamResource", "AsyncSpamResource"] -class Spam(SyncAPIResource): +class SpamResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SpamWithRawResponse: - return SpamWithRawResponse(self) + def with_raw_response(self) -> SpamResourceWithRawResponse: + return SpamResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SpamWithStreamingResponse: - return SpamWithStreamingResponse(self) + def with_streaming_response(self) -> SpamResourceWithStreamingResponse: + return SpamResourceWithStreamingResponse(self) def get( self, @@ -147,20 +148,20 @@ def get( }, spam_get_params.SpamGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SpamGetResponse]._unwrapper, ), cast_to=cast(Type[SpamGetResponse], ResultWrapper[SpamGetResponse]), ) -class AsyncSpam(AsyncAPIResource): +class AsyncSpamResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSpamWithRawResponse: - return AsyncSpamWithRawResponse(self) + def with_raw_response(self) -> AsyncSpamResourceWithRawResponse: + return AsyncSpamResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSpamWithStreamingResponse: - return AsyncSpamWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSpamResourceWithStreamingResponse: + return AsyncSpamResourceWithStreamingResponse(self) async def get( self, @@ -270,14 +271,14 @@ async def get( }, spam_get_params.SpamGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SpamGetResponse]._unwrapper, ), cast_to=cast(Type[SpamGetResponse], ResultWrapper[SpamGetResponse]), ) -class SpamWithRawResponse: - def __init__(self, spam: Spam) -> None: +class SpamResourceWithRawResponse: + def __init__(self, spam: SpamResource) -> None: self._spam = spam self.get = to_raw_response_wrapper( @@ -285,8 +286,8 @@ def __init__(self, spam: Spam) -> None: ) -class AsyncSpamWithRawResponse: - def __init__(self, spam: AsyncSpam) -> None: +class AsyncSpamResourceWithRawResponse: + def __init__(self, spam: AsyncSpamResource) -> None: self._spam = spam self.get = async_to_raw_response_wrapper( @@ -294,8 +295,8 @@ def __init__(self, spam: AsyncSpam) -> None: ) -class SpamWithStreamingResponse: - def __init__(self, spam: Spam) -> None: +class SpamResourceWithStreamingResponse: + def __init__(self, spam: SpamResource) -> None: self._spam = spam self.get = to_streamed_response_wrapper( @@ -303,8 +304,8 @@ def __init__(self, spam: Spam) -> None: ) -class AsyncSpamWithStreamingResponse: - def __init__(self, spam: AsyncSpam) -> None: +class AsyncSpamResourceWithStreamingResponse: + def __init__(self, spam: AsyncSpamResource) -> None: self._spam = spam self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/email/security/top/tlds/spoof.py b/src/cloudflare/resources/radar/email/security/top/tlds/spoof.py index 3c18dd49b4e..49e04d09ce5 100644 --- a/src/cloudflare/resources/radar/email/security/top/tlds/spoof.py +++ b/src/cloudflare/resources/radar/email/security/top/tlds/spoof.py @@ -25,19 +25,20 @@ from ......._base_client import ( make_request_options, ) -from .......types.radar.email.security.top.tlds import SpoofGetResponse, spoof_get_params +from .......types.radar.email.security.top.tlds import spoof_get_params +from .......types.radar.email.security.top.tlds.spoof_get_response import SpoofGetResponse -__all__ = ["Spoof", "AsyncSpoof"] +__all__ = ["SpoofResource", "AsyncSpoofResource"] -class Spoof(SyncAPIResource): +class SpoofResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SpoofWithRawResponse: - return SpoofWithRawResponse(self) + def with_raw_response(self) -> SpoofResourceWithRawResponse: + return SpoofResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SpoofWithStreamingResponse: - return SpoofWithStreamingResponse(self) + def with_streaming_response(self) -> SpoofResourceWithStreamingResponse: + return SpoofResourceWithStreamingResponse(self) def get( self, @@ -147,20 +148,20 @@ def get( }, spoof_get_params.SpoofGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SpoofGetResponse]._unwrapper, ), cast_to=cast(Type[SpoofGetResponse], ResultWrapper[SpoofGetResponse]), ) -class AsyncSpoof(AsyncAPIResource): +class AsyncSpoofResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSpoofWithRawResponse: - return AsyncSpoofWithRawResponse(self) + def with_raw_response(self) -> AsyncSpoofResourceWithRawResponse: + return AsyncSpoofResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSpoofWithStreamingResponse: - return AsyncSpoofWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSpoofResourceWithStreamingResponse: + return AsyncSpoofResourceWithStreamingResponse(self) async def get( self, @@ -270,14 +271,14 @@ async def get( }, spoof_get_params.SpoofGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SpoofGetResponse]._unwrapper, ), cast_to=cast(Type[SpoofGetResponse], ResultWrapper[SpoofGetResponse]), ) -class SpoofWithRawResponse: - def __init__(self, spoof: Spoof) -> None: +class SpoofResourceWithRawResponse: + def __init__(self, spoof: SpoofResource) -> None: self._spoof = spoof self.get = to_raw_response_wrapper( @@ -285,8 +286,8 @@ def __init__(self, spoof: Spoof) -> None: ) -class AsyncSpoofWithRawResponse: - def __init__(self, spoof: AsyncSpoof) -> None: +class AsyncSpoofResourceWithRawResponse: + def __init__(self, spoof: AsyncSpoofResource) -> None: self._spoof = spoof self.get = async_to_raw_response_wrapper( @@ -294,8 +295,8 @@ def __init__(self, spoof: AsyncSpoof) -> None: ) -class SpoofWithStreamingResponse: - def __init__(self, spoof: Spoof) -> None: +class SpoofResourceWithStreamingResponse: + def __init__(self, spoof: SpoofResource) -> None: self._spoof = spoof self.get = to_streamed_response_wrapper( @@ -303,8 +304,8 @@ def __init__(self, spoof: Spoof) -> None: ) -class AsyncSpoofWithStreamingResponse: - def __init__(self, spoof: AsyncSpoof) -> None: +class AsyncSpoofResourceWithStreamingResponse: + def __init__(self, spoof: AsyncSpoofResource) -> None: self._spoof = spoof self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/email/security/top/tlds/tlds.py b/src/cloudflare/resources/radar/email/security/top/tlds/tlds.py index e5ebe0ac158..8cc5c7e2b3b 100644 --- a/src/cloudflare/resources/radar/email/security/top/tlds/tlds.py +++ b/src/cloudflare/resources/radar/email/security/top/tlds/tlds.py @@ -9,28 +9,28 @@ import httpx from .spam import ( - Spam, - AsyncSpam, - SpamWithRawResponse, - AsyncSpamWithRawResponse, - SpamWithStreamingResponse, - AsyncSpamWithStreamingResponse, + SpamResource, + AsyncSpamResource, + SpamResourceWithRawResponse, + AsyncSpamResourceWithRawResponse, + SpamResourceWithStreamingResponse, + AsyncSpamResourceWithStreamingResponse, ) from .spoof import ( - Spoof, - AsyncSpoof, - SpoofWithRawResponse, - AsyncSpoofWithRawResponse, - SpoofWithStreamingResponse, - AsyncSpoofWithStreamingResponse, + SpoofResource, + AsyncSpoofResource, + SpoofResourceWithRawResponse, + AsyncSpoofResourceWithRawResponse, + SpoofResourceWithStreamingResponse, + AsyncSpoofResourceWithStreamingResponse, ) from .malicious import ( - Malicious, - AsyncMalicious, - MaliciousWithRawResponse, - AsyncMaliciousWithRawResponse, - MaliciousWithStreamingResponse, - AsyncMaliciousWithStreamingResponse, + MaliciousResource, + AsyncMaliciousResource, + MaliciousResourceWithRawResponse, + AsyncMaliciousResourceWithRawResponse, + MaliciousResourceWithStreamingResponse, + AsyncMaliciousResourceWithStreamingResponse, ) from ......._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ......._utils import ( @@ -49,31 +49,32 @@ from ......._base_client import ( make_request_options, ) -from .......types.radar.email.security.top import TldGetResponse, tld_get_params +from .......types.radar.email.security.top import tld_get_params +from .......types.radar.email.security.top.tld_get_response import TldGetResponse -__all__ = ["Tlds", "AsyncTlds"] +__all__ = ["TldsResource", "AsyncTldsResource"] -class Tlds(SyncAPIResource): +class TldsResource(SyncAPIResource): @cached_property - def malicious(self) -> Malicious: - return Malicious(self._client) + def malicious(self) -> MaliciousResource: + return MaliciousResource(self._client) @cached_property - def spam(self) -> Spam: - return Spam(self._client) + def spam(self) -> SpamResource: + return SpamResource(self._client) @cached_property - def spoof(self) -> Spoof: - return Spoof(self._client) + def spoof(self) -> SpoofResource: + return SpoofResource(self._client) @cached_property - def with_raw_response(self) -> TldsWithRawResponse: - return TldsWithRawResponse(self) + def with_raw_response(self) -> TldsResourceWithRawResponse: + return TldsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TldsWithStreamingResponse: - return TldsWithStreamingResponse(self) + def with_streaming_response(self) -> TldsResourceWithStreamingResponse: + return TldsResourceWithStreamingResponse(self) def get( self, @@ -180,32 +181,32 @@ def get( }, tld_get_params.TldGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TldGetResponse]._unwrapper, ), cast_to=cast(Type[TldGetResponse], ResultWrapper[TldGetResponse]), ) -class AsyncTlds(AsyncAPIResource): +class AsyncTldsResource(AsyncAPIResource): @cached_property - def malicious(self) -> AsyncMalicious: - return AsyncMalicious(self._client) + def malicious(self) -> AsyncMaliciousResource: + return AsyncMaliciousResource(self._client) @cached_property - def spam(self) -> AsyncSpam: - return AsyncSpam(self._client) + def spam(self) -> AsyncSpamResource: + return AsyncSpamResource(self._client) @cached_property - def spoof(self) -> AsyncSpoof: - return AsyncSpoof(self._client) + def spoof(self) -> AsyncSpoofResource: + return AsyncSpoofResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTldsWithRawResponse: - return AsyncTldsWithRawResponse(self) + def with_raw_response(self) -> AsyncTldsResourceWithRawResponse: + return AsyncTldsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTldsWithStreamingResponse: - return AsyncTldsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTldsResourceWithStreamingResponse: + return AsyncTldsResourceWithStreamingResponse(self) async def get( self, @@ -312,14 +313,14 @@ async def get( }, tld_get_params.TldGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TldGetResponse]._unwrapper, ), cast_to=cast(Type[TldGetResponse], ResultWrapper[TldGetResponse]), ) -class TldsWithRawResponse: - def __init__(self, tlds: Tlds) -> None: +class TldsResourceWithRawResponse: + def __init__(self, tlds: TldsResource) -> None: self._tlds = tlds self.get = to_raw_response_wrapper( @@ -327,20 +328,20 @@ def __init__(self, tlds: Tlds) -> None: ) @cached_property - def malicious(self) -> MaliciousWithRawResponse: - return MaliciousWithRawResponse(self._tlds.malicious) + def malicious(self) -> MaliciousResourceWithRawResponse: + return MaliciousResourceWithRawResponse(self._tlds.malicious) @cached_property - def spam(self) -> SpamWithRawResponse: - return SpamWithRawResponse(self._tlds.spam) + def spam(self) -> SpamResourceWithRawResponse: + return SpamResourceWithRawResponse(self._tlds.spam) @cached_property - def spoof(self) -> SpoofWithRawResponse: - return SpoofWithRawResponse(self._tlds.spoof) + def spoof(self) -> SpoofResourceWithRawResponse: + return SpoofResourceWithRawResponse(self._tlds.spoof) -class AsyncTldsWithRawResponse: - def __init__(self, tlds: AsyncTlds) -> None: +class AsyncTldsResourceWithRawResponse: + def __init__(self, tlds: AsyncTldsResource) -> None: self._tlds = tlds self.get = async_to_raw_response_wrapper( @@ -348,20 +349,20 @@ def __init__(self, tlds: AsyncTlds) -> None: ) @cached_property - def malicious(self) -> AsyncMaliciousWithRawResponse: - return AsyncMaliciousWithRawResponse(self._tlds.malicious) + def malicious(self) -> AsyncMaliciousResourceWithRawResponse: + return AsyncMaliciousResourceWithRawResponse(self._tlds.malicious) @cached_property - def spam(self) -> AsyncSpamWithRawResponse: - return AsyncSpamWithRawResponse(self._tlds.spam) + def spam(self) -> AsyncSpamResourceWithRawResponse: + return AsyncSpamResourceWithRawResponse(self._tlds.spam) @cached_property - def spoof(self) -> AsyncSpoofWithRawResponse: - return AsyncSpoofWithRawResponse(self._tlds.spoof) + def spoof(self) -> AsyncSpoofResourceWithRawResponse: + return AsyncSpoofResourceWithRawResponse(self._tlds.spoof) -class TldsWithStreamingResponse: - def __init__(self, tlds: Tlds) -> None: +class TldsResourceWithStreamingResponse: + def __init__(self, tlds: TldsResource) -> None: self._tlds = tlds self.get = to_streamed_response_wrapper( @@ -369,20 +370,20 @@ def __init__(self, tlds: Tlds) -> None: ) @cached_property - def malicious(self) -> MaliciousWithStreamingResponse: - return MaliciousWithStreamingResponse(self._tlds.malicious) + def malicious(self) -> MaliciousResourceWithStreamingResponse: + return MaliciousResourceWithStreamingResponse(self._tlds.malicious) @cached_property - def spam(self) -> SpamWithStreamingResponse: - return SpamWithStreamingResponse(self._tlds.spam) + def spam(self) -> SpamResourceWithStreamingResponse: + return SpamResourceWithStreamingResponse(self._tlds.spam) @cached_property - def spoof(self) -> SpoofWithStreamingResponse: - return SpoofWithStreamingResponse(self._tlds.spoof) + def spoof(self) -> SpoofResourceWithStreamingResponse: + return SpoofResourceWithStreamingResponse(self._tlds.spoof) -class AsyncTldsWithStreamingResponse: - def __init__(self, tlds: AsyncTlds) -> None: +class AsyncTldsResourceWithStreamingResponse: + def __init__(self, tlds: AsyncTldsResource) -> None: self._tlds = tlds self.get = async_to_streamed_response_wrapper( @@ -390,13 +391,13 @@ def __init__(self, tlds: AsyncTlds) -> None: ) @cached_property - def malicious(self) -> AsyncMaliciousWithStreamingResponse: - return AsyncMaliciousWithStreamingResponse(self._tlds.malicious) + def malicious(self) -> AsyncMaliciousResourceWithStreamingResponse: + return AsyncMaliciousResourceWithStreamingResponse(self._tlds.malicious) @cached_property - def spam(self) -> AsyncSpamWithStreamingResponse: - return AsyncSpamWithStreamingResponse(self._tlds.spam) + def spam(self) -> AsyncSpamResourceWithStreamingResponse: + return AsyncSpamResourceWithStreamingResponse(self._tlds.spam) @cached_property - def spoof(self) -> AsyncSpoofWithStreamingResponse: - return AsyncSpoofWithStreamingResponse(self._tlds.spoof) + def spoof(self) -> AsyncSpoofResourceWithStreamingResponse: + return AsyncSpoofResourceWithStreamingResponse(self._tlds.spoof) diff --git a/src/cloudflare/resources/radar/email/security/top/top.py b/src/cloudflare/resources/radar/email/security/top/top.py index 0413c036a42..d4f233cf497 100644 --- a/src/cloudflare/resources/radar/email/security/top/top.py +++ b/src/cloudflare/resources/radar/email/security/top/top.py @@ -3,79 +3,79 @@ from __future__ import annotations from .tlds import ( - Tlds, - AsyncTlds, - TldsWithRawResponse, - AsyncTldsWithRawResponse, - TldsWithStreamingResponse, - AsyncTldsWithStreamingResponse, + TldsResource, + AsyncTldsResource, + TldsResourceWithRawResponse, + AsyncTldsResourceWithRawResponse, + TldsResourceWithStreamingResponse, + AsyncTldsResourceWithStreamingResponse, ) -from .tlds.tlds import Tlds, AsyncTlds +from .tlds.tlds import TldsResource, AsyncTldsResource from ......_compat import cached_property from ......_resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def tlds(self) -> Tlds: - return Tlds(self._client) + def tlds(self) -> TldsResource: + return TldsResource(self._client) @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def tlds(self) -> AsyncTlds: - return AsyncTlds(self._client) + def tlds(self) -> AsyncTldsResource: + return AsyncTldsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top @cached_property - def tlds(self) -> TldsWithRawResponse: - return TldsWithRawResponse(self._top.tlds) + def tlds(self) -> TldsResourceWithRawResponse: + return TldsResourceWithRawResponse(self._top.tlds) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top @cached_property - def tlds(self) -> AsyncTldsWithRawResponse: - return AsyncTldsWithRawResponse(self._top.tlds) + def tlds(self) -> AsyncTldsResourceWithRawResponse: + return AsyncTldsResourceWithRawResponse(self._top.tlds) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top @cached_property - def tlds(self) -> TldsWithStreamingResponse: - return TldsWithStreamingResponse(self._top.tlds) + def tlds(self) -> TldsResourceWithStreamingResponse: + return TldsResourceWithStreamingResponse(self._top.tlds) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top @cached_property - def tlds(self) -> AsyncTldsWithStreamingResponse: - return AsyncTldsWithStreamingResponse(self._top.tlds) + def tlds(self) -> AsyncTldsResourceWithStreamingResponse: + return AsyncTldsResourceWithStreamingResponse(self._top.tlds) diff --git a/src/cloudflare/resources/radar/entities/__init__.py b/src/cloudflare/resources/radar/entities/__init__.py index 8cc160d3576..c00c65c517b 100644 --- a/src/cloudflare/resources/radar/entities/__init__.py +++ b/src/cloudflare/resources/radar/entities/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .asns import ( - ASNs, - AsyncASNs, - ASNsWithRawResponse, - AsyncASNsWithRawResponse, - ASNsWithStreamingResponse, - AsyncASNsWithStreamingResponse, + ASNsResource, + AsyncASNsResource, + ASNsResourceWithRawResponse, + AsyncASNsResourceWithRawResponse, + ASNsResourceWithStreamingResponse, + AsyncASNsResourceWithStreamingResponse, ) from .entities import ( - Entities, - AsyncEntities, - EntitiesWithRawResponse, - AsyncEntitiesWithRawResponse, - EntitiesWithStreamingResponse, - AsyncEntitiesWithStreamingResponse, + EntitiesResource, + AsyncEntitiesResource, + EntitiesResourceWithRawResponse, + AsyncEntitiesResourceWithRawResponse, + EntitiesResourceWithStreamingResponse, + AsyncEntitiesResourceWithStreamingResponse, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) __all__ = [ - "ASNs", - "AsyncASNs", - "ASNsWithRawResponse", - "AsyncASNsWithRawResponse", - "ASNsWithStreamingResponse", - "AsyncASNsWithStreamingResponse", - "Locations", - "AsyncLocations", - "LocationsWithRawResponse", - "AsyncLocationsWithRawResponse", - "LocationsWithStreamingResponse", - "AsyncLocationsWithStreamingResponse", - "Entities", - "AsyncEntities", - "EntitiesWithRawResponse", - "AsyncEntitiesWithRawResponse", - "EntitiesWithStreamingResponse", - "AsyncEntitiesWithStreamingResponse", + "ASNsResource", + "AsyncASNsResource", + "ASNsResourceWithRawResponse", + "AsyncASNsResourceWithRawResponse", + "ASNsResourceWithStreamingResponse", + "AsyncASNsResourceWithStreamingResponse", + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", + "EntitiesResource", + "AsyncEntitiesResource", + "EntitiesResourceWithRawResponse", + "AsyncEntitiesResourceWithRawResponse", + "EntitiesResourceWithStreamingResponse", + "AsyncEntitiesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/entities/asns.py b/src/cloudflare/resources/radar/entities/asns.py index 9c43eab1f65..f0479103d73 100644 --- a/src/cloudflare/resources/radar/entities/asns.py +++ b/src/cloudflare/resources/radar/entities/asns.py @@ -24,28 +24,23 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.entities import ( - ASNIPResponse, - ASNGetResponse, - ASNRelResponse, - ASNListResponse, - asn_ip_params, - asn_get_params, - asn_rel_params, - asn_list_params, -) +from ....types.radar.entities import asn_ip_params, asn_get_params, asn_rel_params, asn_list_params +from ....types.radar.entities.asn_ip_response import ASNIPResponse +from ....types.radar.entities.asn_get_response import ASNGetResponse +from ....types.radar.entities.asn_rel_response import ASNRelResponse +from ....types.radar.entities.asn_list_response import ASNListResponse -__all__ = ["ASNs", "AsyncASNs"] +__all__ = ["ASNsResource", "AsyncASNsResource"] -class ASNs(SyncAPIResource): +class ASNsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ASNsWithRawResponse: - return ASNsWithRawResponse(self) + def with_raw_response(self) -> ASNsResourceWithRawResponse: + return ASNsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ASNsWithStreamingResponse: - return ASNsWithStreamingResponse(self) + def with_streaming_response(self) -> ASNsResourceWithStreamingResponse: + return ASNsResourceWithStreamingResponse(self) def list( self, @@ -105,7 +100,7 @@ def list( }, asn_list_params.ASNListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASNListResponse]._unwrapper, ), cast_to=cast(Type[ASNListResponse], ResultWrapper[ASNListResponse]), ) @@ -150,7 +145,7 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"format": format}, asn_get_params.ASNGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASNGetResponse]._unwrapper, ), cast_to=cast(Type[ASNGetResponse], ResultWrapper[ASNGetResponse]), ) @@ -199,7 +194,7 @@ def ip( }, asn_ip_params.ASNIPParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASNIPResponse]._unwrapper, ), cast_to=cast(Type[ASNIPResponse], ResultWrapper[ASNIPResponse]), ) @@ -249,20 +244,20 @@ def rel( }, asn_rel_params.ASNRelParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASNRelResponse]._unwrapper, ), cast_to=cast(Type[ASNRelResponse], ResultWrapper[ASNRelResponse]), ) -class AsyncASNs(AsyncAPIResource): +class AsyncASNsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncASNsWithRawResponse: - return AsyncASNsWithRawResponse(self) + def with_raw_response(self) -> AsyncASNsResourceWithRawResponse: + return AsyncASNsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncASNsWithStreamingResponse: - return AsyncASNsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncASNsResourceWithStreamingResponse: + return AsyncASNsResourceWithStreamingResponse(self) async def list( self, @@ -322,7 +317,7 @@ async def list( }, asn_list_params.ASNListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASNListResponse]._unwrapper, ), cast_to=cast(Type[ASNListResponse], ResultWrapper[ASNListResponse]), ) @@ -367,7 +362,7 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"format": format}, asn_get_params.ASNGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASNGetResponse]._unwrapper, ), cast_to=cast(Type[ASNGetResponse], ResultWrapper[ASNGetResponse]), ) @@ -416,7 +411,7 @@ async def ip( }, asn_ip_params.ASNIPParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASNIPResponse]._unwrapper, ), cast_to=cast(Type[ASNIPResponse], ResultWrapper[ASNIPResponse]), ) @@ -466,14 +461,14 @@ async def rel( }, asn_rel_params.ASNRelParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ASNRelResponse]._unwrapper, ), cast_to=cast(Type[ASNRelResponse], ResultWrapper[ASNRelResponse]), ) -class ASNsWithRawResponse: - def __init__(self, asns: ASNs) -> None: +class ASNsResourceWithRawResponse: + def __init__(self, asns: ASNsResource) -> None: self._asns = asns self.list = to_raw_response_wrapper( @@ -490,8 +485,8 @@ def __init__(self, asns: ASNs) -> None: ) -class AsyncASNsWithRawResponse: - def __init__(self, asns: AsyncASNs) -> None: +class AsyncASNsResourceWithRawResponse: + def __init__(self, asns: AsyncASNsResource) -> None: self._asns = asns self.list = async_to_raw_response_wrapper( @@ -508,8 +503,8 @@ def __init__(self, asns: AsyncASNs) -> None: ) -class ASNsWithStreamingResponse: - def __init__(self, asns: ASNs) -> None: +class ASNsResourceWithStreamingResponse: + def __init__(self, asns: ASNsResource) -> None: self._asns = asns self.list = to_streamed_response_wrapper( @@ -526,8 +521,8 @@ def __init__(self, asns: ASNs) -> None: ) -class AsyncASNsWithStreamingResponse: - def __init__(self, asns: AsyncASNs) -> None: +class AsyncASNsResourceWithStreamingResponse: + def __init__(self, asns: AsyncASNsResource) -> None: self._asns = asns self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/entities/entities.py b/src/cloudflare/resources/radar/entities/entities.py index 4ee4b9b5801..7308469e676 100644 --- a/src/cloudflare/resources/radar/entities/entities.py +++ b/src/cloudflare/resources/radar/entities/entities.py @@ -8,12 +8,12 @@ import httpx from .asns import ( - ASNs, - AsyncASNs, - ASNsWithRawResponse, - AsyncASNsWithRawResponse, - ASNsWithStreamingResponse, - AsyncASNsWithStreamingResponse, + ASNsResource, + AsyncASNsResource, + ASNsResourceWithRawResponse, + AsyncASNsResourceWithRawResponse, + ASNsResourceWithStreamingResponse, + AsyncASNsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -21,12 +21,12 @@ async_maybe_transform, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -37,30 +37,31 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.radar import EntityGetResponse, entity_get_params +from ....types.radar import entity_get_params from ...._base_client import ( make_request_options, ) +from ....types.radar.entity_get_response import EntityGetResponse -__all__ = ["Entities", "AsyncEntities"] +__all__ = ["EntitiesResource", "AsyncEntitiesResource"] -class Entities(SyncAPIResource): +class EntitiesResource(SyncAPIResource): @cached_property - def asns(self) -> ASNs: - return ASNs(self._client) + def asns(self) -> ASNsResource: + return ASNsResource(self._client) @cached_property - def locations(self) -> Locations: - return Locations(self._client) + def locations(self) -> LocationsResource: + return LocationsResource(self._client) @cached_property - def with_raw_response(self) -> EntitiesWithRawResponse: - return EntitiesWithRawResponse(self) + def with_raw_response(self) -> EntitiesResourceWithRawResponse: + return EntitiesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EntitiesWithStreamingResponse: - return EntitiesWithStreamingResponse(self) + def with_streaming_response(self) -> EntitiesResourceWithStreamingResponse: + return EntitiesResourceWithStreamingResponse(self) def get( self, @@ -104,28 +105,28 @@ def get( }, entity_get_params.EntityGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EntityGetResponse]._unwrapper, ), cast_to=cast(Type[EntityGetResponse], ResultWrapper[EntityGetResponse]), ) -class AsyncEntities(AsyncAPIResource): +class AsyncEntitiesResource(AsyncAPIResource): @cached_property - def asns(self) -> AsyncASNs: - return AsyncASNs(self._client) + def asns(self) -> AsyncASNsResource: + return AsyncASNsResource(self._client) @cached_property - def locations(self) -> AsyncLocations: - return AsyncLocations(self._client) + def locations(self) -> AsyncLocationsResource: + return AsyncLocationsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncEntitiesWithRawResponse: - return AsyncEntitiesWithRawResponse(self) + def with_raw_response(self) -> AsyncEntitiesResourceWithRawResponse: + return AsyncEntitiesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEntitiesWithStreamingResponse: - return AsyncEntitiesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEntitiesResourceWithStreamingResponse: + return AsyncEntitiesResourceWithStreamingResponse(self) async def get( self, @@ -169,14 +170,14 @@ async def get( }, entity_get_params.EntityGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EntityGetResponse]._unwrapper, ), cast_to=cast(Type[EntityGetResponse], ResultWrapper[EntityGetResponse]), ) -class EntitiesWithRawResponse: - def __init__(self, entities: Entities) -> None: +class EntitiesResourceWithRawResponse: + def __init__(self, entities: EntitiesResource) -> None: self._entities = entities self.get = to_raw_response_wrapper( @@ -184,16 +185,16 @@ def __init__(self, entities: Entities) -> None: ) @cached_property - def asns(self) -> ASNsWithRawResponse: - return ASNsWithRawResponse(self._entities.asns) + def asns(self) -> ASNsResourceWithRawResponse: + return ASNsResourceWithRawResponse(self._entities.asns) @cached_property - def locations(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self._entities.locations) + def locations(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self._entities.locations) -class AsyncEntitiesWithRawResponse: - def __init__(self, entities: AsyncEntities) -> None: +class AsyncEntitiesResourceWithRawResponse: + def __init__(self, entities: AsyncEntitiesResource) -> None: self._entities = entities self.get = async_to_raw_response_wrapper( @@ -201,16 +202,16 @@ def __init__(self, entities: AsyncEntities) -> None: ) @cached_property - def asns(self) -> AsyncASNsWithRawResponse: - return AsyncASNsWithRawResponse(self._entities.asns) + def asns(self) -> AsyncASNsResourceWithRawResponse: + return AsyncASNsResourceWithRawResponse(self._entities.asns) @cached_property - def locations(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self._entities.locations) + def locations(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self._entities.locations) -class EntitiesWithStreamingResponse: - def __init__(self, entities: Entities) -> None: +class EntitiesResourceWithStreamingResponse: + def __init__(self, entities: EntitiesResource) -> None: self._entities = entities self.get = to_streamed_response_wrapper( @@ -218,16 +219,16 @@ def __init__(self, entities: Entities) -> None: ) @cached_property - def asns(self) -> ASNsWithStreamingResponse: - return ASNsWithStreamingResponse(self._entities.asns) + def asns(self) -> ASNsResourceWithStreamingResponse: + return ASNsResourceWithStreamingResponse(self._entities.asns) @cached_property - def locations(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self._entities.locations) + def locations(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self._entities.locations) -class AsyncEntitiesWithStreamingResponse: - def __init__(self, entities: AsyncEntities) -> None: +class AsyncEntitiesResourceWithStreamingResponse: + def __init__(self, entities: AsyncEntitiesResource) -> None: self._entities = entities self.get = async_to_streamed_response_wrapper( @@ -235,9 +236,9 @@ def __init__(self, entities: AsyncEntities) -> None: ) @cached_property - def asns(self) -> AsyncASNsWithStreamingResponse: - return AsyncASNsWithStreamingResponse(self._entities.asns) + def asns(self) -> AsyncASNsResourceWithStreamingResponse: + return AsyncASNsResourceWithStreamingResponse(self._entities.asns) @cached_property - def locations(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self._entities.locations) + def locations(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self._entities.locations) diff --git a/src/cloudflare/resources/radar/entities/locations.py b/src/cloudflare/resources/radar/entities/locations.py index c21e077100d..a05fa19ad17 100644 --- a/src/cloudflare/resources/radar/entities/locations.py +++ b/src/cloudflare/resources/radar/entities/locations.py @@ -24,24 +24,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.entities import ( - LocationGetResponse, - LocationListResponse, - location_get_params, - location_list_params, -) +from ....types.radar.entities import location_get_params, location_list_params +from ....types.radar.entities.location_get_response import LocationGetResponse +from ....types.radar.entities.location_list_response import LocationListResponse -__all__ = ["Locations", "AsyncLocations"] +__all__ = ["LocationsResource", "AsyncLocationsResource"] -class Locations(SyncAPIResource): +class LocationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self) + def with_raw_response(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self) + def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self) def list( self, @@ -93,7 +90,7 @@ def list( }, location_list_params.LocationListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationListResponse]._unwrapper, ), cast_to=cast(Type[LocationListResponse], ResultWrapper[LocationListResponse]), ) @@ -139,20 +136,20 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"format": format}, location_get_params.LocationGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationGetResponse]._unwrapper, ), cast_to=cast(Type[LocationGetResponse], ResultWrapper[LocationGetResponse]), ) -class AsyncLocations(AsyncAPIResource): +class AsyncLocationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self) + def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self) async def list( self, @@ -204,7 +201,7 @@ async def list( }, location_list_params.LocationListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationListResponse]._unwrapper, ), cast_to=cast(Type[LocationListResponse], ResultWrapper[LocationListResponse]), ) @@ -250,14 +247,14 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"format": format}, location_get_params.LocationGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationGetResponse]._unwrapper, ), cast_to=cast(Type[LocationGetResponse], ResultWrapper[LocationGetResponse]), ) -class LocationsWithRawResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithRawResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.list = to_raw_response_wrapper( @@ -268,8 +265,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithRawResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithRawResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.list = async_to_raw_response_wrapper( @@ -280,8 +277,8 @@ def __init__(self, locations: AsyncLocations) -> None: ) -class LocationsWithStreamingResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithStreamingResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.list = to_streamed_response_wrapper( @@ -292,8 +289,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithStreamingResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithStreamingResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/__init__.py b/src/cloudflare/resources/radar/http/__init__.py index 6e311da0df9..13ec57b6b10 100644 --- a/src/cloudflare/resources/radar/http/__init__.py +++ b/src/cloudflare/resources/radar/http/__init__.py @@ -1,89 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .ases import ( - Ases, - AsyncAses, - AsesWithRawResponse, - AsyncAsesWithRawResponse, - AsesWithStreamingResponse, - AsyncAsesWithStreamingResponse, + AsesResource, + AsyncAsesResource, + AsesResourceWithRawResponse, + AsyncAsesResourceWithRawResponse, + AsesResourceWithStreamingResponse, + AsyncAsesResourceWithStreamingResponse, ) from .http import ( - HTTP, - AsyncHTTP, - HTTPWithRawResponse, - AsyncHTTPWithRawResponse, - HTTPWithStreamingResponse, - AsyncHTTPWithStreamingResponse, + HTTPResource, + AsyncHTTPResource, + HTTPResourceWithRawResponse, + AsyncHTTPResourceWithRawResponse, + HTTPResourceWithStreamingResponse, + AsyncHTTPResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) __all__ = [ - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "Locations", - "AsyncLocations", - "LocationsWithRawResponse", - "AsyncLocationsWithRawResponse", - "LocationsWithStreamingResponse", - "AsyncLocationsWithStreamingResponse", - "Ases", - "AsyncAses", - "AsesWithRawResponse", - "AsyncAsesWithRawResponse", - "AsesWithStreamingResponse", - "AsyncAsesWithStreamingResponse", - "Summary", - "AsyncSummary", - "SummaryWithRawResponse", - "AsyncSummaryWithRawResponse", - "SummaryWithStreamingResponse", - "AsyncSummaryWithStreamingResponse", - "TimeseriesGroups", - "AsyncTimeseriesGroups", - "TimeseriesGroupsWithRawResponse", - "AsyncTimeseriesGroupsWithRawResponse", - "TimeseriesGroupsWithStreamingResponse", - "AsyncTimeseriesGroupsWithStreamingResponse", - "HTTP", - "AsyncHTTP", - "HTTPWithRawResponse", - "AsyncHTTPWithRawResponse", - "HTTPWithStreamingResponse", - "AsyncHTTPWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", + "AsesResource", + "AsyncAsesResource", + "AsesResourceWithRawResponse", + "AsyncAsesResourceWithRawResponse", + "AsesResourceWithStreamingResponse", + "AsyncAsesResourceWithStreamingResponse", + "SummaryResource", + "AsyncSummaryResource", + "SummaryResourceWithRawResponse", + "AsyncSummaryResourceWithRawResponse", + "SummaryResourceWithStreamingResponse", + "AsyncSummaryResourceWithStreamingResponse", + "TimeseriesGroupsResource", + "AsyncTimeseriesGroupsResource", + "TimeseriesGroupsResourceWithRawResponse", + "AsyncTimeseriesGroupsResourceWithRawResponse", + "TimeseriesGroupsResourceWithStreamingResponse", + "AsyncTimeseriesGroupsResourceWithStreamingResponse", + "HTTPResource", + "AsyncHTTPResource", + "HTTPResourceWithRawResponse", + "AsyncHTTPResourceWithRawResponse", + "HTTPResourceWithStreamingResponse", + "AsyncHTTPResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/http/ases/__init__.py b/src/cloudflare/resources/radar/http/ases/__init__.py index 83db7807006..725f29e303a 100644 --- a/src/cloudflare/resources/radar/http/ases/__init__.py +++ b/src/cloudflare/resources/radar/http/ases/__init__.py @@ -1,117 +1,117 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .os import ( - OS, - AsyncOS, - OSWithRawResponse, - AsyncOSWithRawResponse, - OSWithStreamingResponse, - AsyncOSWithStreamingResponse, + OSResource, + AsyncOSResource, + OSResourceWithRawResponse, + AsyncOSResourceWithRawResponse, + OSResourceWithStreamingResponse, + AsyncOSResourceWithStreamingResponse, ) from .ases import ( - Ases, - AsyncAses, - AsesWithRawResponse, - AsyncAsesWithRawResponse, - AsesWithStreamingResponse, - AsyncAsesWithStreamingResponse, + AsesResource, + AsyncAsesResource, + AsesResourceWithRawResponse, + AsyncAsesResourceWithRawResponse, + AsesResourceWithStreamingResponse, + AsyncAsesResourceWithStreamingResponse, ) from .bot_class import ( - BotClass, - AsyncBotClass, - BotClassWithRawResponse, - AsyncBotClassWithRawResponse, - BotClassWithStreamingResponse, - AsyncBotClassWithStreamingResponse, + BotClassResource, + AsyncBotClassResource, + BotClassResourceWithRawResponse, + AsyncBotClassResourceWithRawResponse, + BotClassResourceWithStreamingResponse, + AsyncBotClassResourceWithStreamingResponse, ) from .ip_version import ( - IPVersion, - AsyncIPVersion, - IPVersionWithRawResponse, - AsyncIPVersionWithRawResponse, - IPVersionWithStreamingResponse, - AsyncIPVersionWithStreamingResponse, + IPVersionResource, + AsyncIPVersionResource, + IPVersionResourceWithRawResponse, + AsyncIPVersionResourceWithRawResponse, + IPVersionResourceWithStreamingResponse, + AsyncIPVersionResourceWithStreamingResponse, ) from .device_type import ( - DeviceType, - AsyncDeviceType, - DeviceTypeWithRawResponse, - AsyncDeviceTypeWithRawResponse, - DeviceTypeWithStreamingResponse, - AsyncDeviceTypeWithStreamingResponse, + DeviceTypeResource, + AsyncDeviceTypeResource, + DeviceTypeResourceWithRawResponse, + AsyncDeviceTypeResourceWithRawResponse, + DeviceTypeResourceWithStreamingResponse, + AsyncDeviceTypeResourceWithStreamingResponse, ) from .http_method import ( - HTTPMethod, - AsyncHTTPMethod, - HTTPMethodWithRawResponse, - AsyncHTTPMethodWithRawResponse, - HTTPMethodWithStreamingResponse, - AsyncHTTPMethodWithStreamingResponse, + HTTPMethodResource, + AsyncHTTPMethodResource, + HTTPMethodResourceWithRawResponse, + AsyncHTTPMethodResourceWithRawResponse, + HTTPMethodResourceWithStreamingResponse, + AsyncHTTPMethodResourceWithStreamingResponse, ) from .tls_version import ( - TLSVersion, - AsyncTLSVersion, - TLSVersionWithRawResponse, - AsyncTLSVersionWithRawResponse, - TLSVersionWithStreamingResponse, - AsyncTLSVersionWithStreamingResponse, + TLSVersionResource, + AsyncTLSVersionResource, + TLSVersionResourceWithRawResponse, + AsyncTLSVersionResourceWithRawResponse, + TLSVersionResourceWithStreamingResponse, + AsyncTLSVersionResourceWithStreamingResponse, ) from .http_protocol import ( - HTTPProtocol, - AsyncHTTPProtocol, - HTTPProtocolWithRawResponse, - AsyncHTTPProtocolWithRawResponse, - HTTPProtocolWithStreamingResponse, - AsyncHTTPProtocolWithStreamingResponse, + HTTPProtocolResource, + AsyncHTTPProtocolResource, + HTTPProtocolResourceWithRawResponse, + AsyncHTTPProtocolResourceWithRawResponse, + HTTPProtocolResourceWithStreamingResponse, + AsyncHTTPProtocolResourceWithStreamingResponse, ) __all__ = [ - "BotClass", - "AsyncBotClass", - "BotClassWithRawResponse", - "AsyncBotClassWithRawResponse", - "BotClassWithStreamingResponse", - "AsyncBotClassWithStreamingResponse", - "DeviceType", - "AsyncDeviceType", - "DeviceTypeWithRawResponse", - "AsyncDeviceTypeWithRawResponse", - "DeviceTypeWithStreamingResponse", - "AsyncDeviceTypeWithStreamingResponse", - "HTTPProtocol", - "AsyncHTTPProtocol", - "HTTPProtocolWithRawResponse", - "AsyncHTTPProtocolWithRawResponse", - "HTTPProtocolWithStreamingResponse", - "AsyncHTTPProtocolWithStreamingResponse", - "HTTPMethod", - "AsyncHTTPMethod", - "HTTPMethodWithRawResponse", - "AsyncHTTPMethodWithRawResponse", - "HTTPMethodWithStreamingResponse", - "AsyncHTTPMethodWithStreamingResponse", - "IPVersion", - "AsyncIPVersion", - "IPVersionWithRawResponse", - "AsyncIPVersionWithRawResponse", - "IPVersionWithStreamingResponse", - "AsyncIPVersionWithStreamingResponse", - "OS", - "AsyncOS", - "OSWithRawResponse", - "AsyncOSWithRawResponse", - "OSWithStreamingResponse", - "AsyncOSWithStreamingResponse", - "TLSVersion", - "AsyncTLSVersion", - "TLSVersionWithRawResponse", - "AsyncTLSVersionWithRawResponse", - "TLSVersionWithStreamingResponse", - "AsyncTLSVersionWithStreamingResponse", - "Ases", - "AsyncAses", - "AsesWithRawResponse", - "AsyncAsesWithRawResponse", - "AsesWithStreamingResponse", - "AsyncAsesWithStreamingResponse", + "BotClassResource", + "AsyncBotClassResource", + "BotClassResourceWithRawResponse", + "AsyncBotClassResourceWithRawResponse", + "BotClassResourceWithStreamingResponse", + "AsyncBotClassResourceWithStreamingResponse", + "DeviceTypeResource", + "AsyncDeviceTypeResource", + "DeviceTypeResourceWithRawResponse", + "AsyncDeviceTypeResourceWithRawResponse", + "DeviceTypeResourceWithStreamingResponse", + "AsyncDeviceTypeResourceWithStreamingResponse", + "HTTPProtocolResource", + "AsyncHTTPProtocolResource", + "HTTPProtocolResourceWithRawResponse", + "AsyncHTTPProtocolResourceWithRawResponse", + "HTTPProtocolResourceWithStreamingResponse", + "AsyncHTTPProtocolResourceWithStreamingResponse", + "HTTPMethodResource", + "AsyncHTTPMethodResource", + "HTTPMethodResourceWithRawResponse", + "AsyncHTTPMethodResourceWithRawResponse", + "HTTPMethodResourceWithStreamingResponse", + "AsyncHTTPMethodResourceWithStreamingResponse", + "IPVersionResource", + "AsyncIPVersionResource", + "IPVersionResourceWithRawResponse", + "AsyncIPVersionResourceWithRawResponse", + "IPVersionResourceWithStreamingResponse", + "AsyncIPVersionResourceWithStreamingResponse", + "OSResource", + "AsyncOSResource", + "OSResourceWithRawResponse", + "AsyncOSResourceWithRawResponse", + "OSResourceWithStreamingResponse", + "AsyncOSResourceWithStreamingResponse", + "TLSVersionResource", + "AsyncTLSVersionResource", + "TLSVersionResourceWithRawResponse", + "AsyncTLSVersionResourceWithRawResponse", + "TLSVersionResourceWithStreamingResponse", + "AsyncTLSVersionResourceWithStreamingResponse", + "AsesResource", + "AsyncAsesResource", + "AsesResourceWithRawResponse", + "AsyncAsesResourceWithRawResponse", + "AsesResourceWithStreamingResponse", + "AsyncAsesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/http/ases/ases.py b/src/cloudflare/resources/radar/http/ases/ases.py index 6c70c372ae7..5802bbf3b71 100644 --- a/src/cloudflare/resources/radar/http/ases/ases.py +++ b/src/cloudflare/resources/radar/http/ases/ases.py @@ -9,20 +9,20 @@ import httpx from .os import ( - OS, - AsyncOS, - OSWithRawResponse, - AsyncOSWithRawResponse, - OSWithStreamingResponse, - AsyncOSWithStreamingResponse, + OSResource, + AsyncOSResource, + OSResourceWithRawResponse, + AsyncOSResourceWithRawResponse, + OSResourceWithStreamingResponse, + AsyncOSResourceWithStreamingResponse, ) from .bot_class import ( - BotClass, - AsyncBotClass, - BotClassWithRawResponse, - AsyncBotClassWithRawResponse, - BotClassWithStreamingResponse, - AsyncBotClassWithStreamingResponse, + BotClassResource, + AsyncBotClassResource, + BotClassResourceWithRawResponse, + AsyncBotClassResourceWithRawResponse, + BotClassResourceWithStreamingResponse, + AsyncBotClassResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -30,37 +30,37 @@ async_maybe_transform, ) from .ip_version import ( - IPVersion, - AsyncIPVersion, - IPVersionWithRawResponse, - AsyncIPVersionWithRawResponse, - IPVersionWithStreamingResponse, - AsyncIPVersionWithStreamingResponse, + IPVersionResource, + AsyncIPVersionResource, + IPVersionResourceWithRawResponse, + AsyncIPVersionResourceWithRawResponse, + IPVersionResourceWithStreamingResponse, + AsyncIPVersionResourceWithStreamingResponse, ) from ....._compat import cached_property from .device_type import ( - DeviceType, - AsyncDeviceType, - DeviceTypeWithRawResponse, - AsyncDeviceTypeWithRawResponse, - DeviceTypeWithStreamingResponse, - AsyncDeviceTypeWithStreamingResponse, + DeviceTypeResource, + AsyncDeviceTypeResource, + DeviceTypeResourceWithRawResponse, + AsyncDeviceTypeResourceWithRawResponse, + DeviceTypeResourceWithStreamingResponse, + AsyncDeviceTypeResourceWithStreamingResponse, ) from .http_method import ( - HTTPMethod, - AsyncHTTPMethod, - HTTPMethodWithRawResponse, - AsyncHTTPMethodWithRawResponse, - HTTPMethodWithStreamingResponse, - AsyncHTTPMethodWithStreamingResponse, + HTTPMethodResource, + AsyncHTTPMethodResource, + HTTPMethodResourceWithRawResponse, + AsyncHTTPMethodResourceWithRawResponse, + HTTPMethodResourceWithStreamingResponse, + AsyncHTTPMethodResourceWithStreamingResponse, ) from .tls_version import ( - TLSVersion, - AsyncTLSVersion, - TLSVersionWithRawResponse, - AsyncTLSVersionWithRawResponse, - TLSVersionWithStreamingResponse, - AsyncTLSVersionWithStreamingResponse, + TLSVersionResource, + AsyncTLSVersionResource, + TLSVersionResourceWithRawResponse, + AsyncTLSVersionResourceWithRawResponse, + TLSVersionResourceWithStreamingResponse, + AsyncTLSVersionResourceWithStreamingResponse, ) from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( @@ -71,57 +71,58 @@ ) from ....._wrappers import ResultWrapper from .http_protocol import ( - HTTPProtocol, - AsyncHTTPProtocol, - HTTPProtocolWithRawResponse, - AsyncHTTPProtocolWithRawResponse, - HTTPProtocolWithStreamingResponse, - AsyncHTTPProtocolWithStreamingResponse, + HTTPProtocolResource, + AsyncHTTPProtocolResource, + HTTPProtocolResourceWithRawResponse, + AsyncHTTPProtocolResourceWithRawResponse, + HTTPProtocolResourceWithStreamingResponse, + AsyncHTTPProtocolResourceWithStreamingResponse, ) from ....._base_client import ( make_request_options, ) -from .....types.radar.http import AseGetResponse, ase_get_params +from .....types.radar.http import ase_get_params +from .....types.radar.http.ase_get_response import AseGetResponse -__all__ = ["Ases", "AsyncAses"] +__all__ = ["AsesResource", "AsyncAsesResource"] -class Ases(SyncAPIResource): +class AsesResource(SyncAPIResource): @cached_property - def bot_class(self) -> BotClass: - return BotClass(self._client) + def bot_class(self) -> BotClassResource: + return BotClassResource(self._client) @cached_property - def device_type(self) -> DeviceType: - return DeviceType(self._client) + def device_type(self) -> DeviceTypeResource: + return DeviceTypeResource(self._client) @cached_property - def http_protocol(self) -> HTTPProtocol: - return HTTPProtocol(self._client) + def http_protocol(self) -> HTTPProtocolResource: + return HTTPProtocolResource(self._client) @cached_property - def http_method(self) -> HTTPMethod: - return HTTPMethod(self._client) + def http_method(self) -> HTTPMethodResource: + return HTTPMethodResource(self._client) @cached_property - def ip_version(self) -> IPVersion: - return IPVersion(self._client) + def ip_version(self) -> IPVersionResource: + return IPVersionResource(self._client) @cached_property - def os(self) -> OS: - return OS(self._client) + def os(self) -> OSResource: + return OSResource(self._client) @cached_property - def tls_version(self) -> TLSVersion: - return TLSVersion(self._client) + def tls_version(self) -> TLSVersionResource: + return TLSVersionResource(self._client) @cached_property - def with_raw_response(self) -> AsesWithRawResponse: - return AsesWithRawResponse(self) + def with_raw_response(self) -> AsesResourceWithRawResponse: + return AsesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsesWithStreamingResponse: - return AsesWithStreamingResponse(self) + def with_streaming_response(self) -> AsesResourceWithStreamingResponse: + return AsesResourceWithStreamingResponse(self) def get( self, @@ -252,48 +253,48 @@ def get( }, ase_get_params.AseGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AseGetResponse]._unwrapper, ), cast_to=cast(Type[AseGetResponse], ResultWrapper[AseGetResponse]), ) -class AsyncAses(AsyncAPIResource): +class AsyncAsesResource(AsyncAPIResource): @cached_property - def bot_class(self) -> AsyncBotClass: - return AsyncBotClass(self._client) + def bot_class(self) -> AsyncBotClassResource: + return AsyncBotClassResource(self._client) @cached_property - def device_type(self) -> AsyncDeviceType: - return AsyncDeviceType(self._client) + def device_type(self) -> AsyncDeviceTypeResource: + return AsyncDeviceTypeResource(self._client) @cached_property - def http_protocol(self) -> AsyncHTTPProtocol: - return AsyncHTTPProtocol(self._client) + def http_protocol(self) -> AsyncHTTPProtocolResource: + return AsyncHTTPProtocolResource(self._client) @cached_property - def http_method(self) -> AsyncHTTPMethod: - return AsyncHTTPMethod(self._client) + def http_method(self) -> AsyncHTTPMethodResource: + return AsyncHTTPMethodResource(self._client) @cached_property - def ip_version(self) -> AsyncIPVersion: - return AsyncIPVersion(self._client) + def ip_version(self) -> AsyncIPVersionResource: + return AsyncIPVersionResource(self._client) @cached_property - def os(self) -> AsyncOS: - return AsyncOS(self._client) + def os(self) -> AsyncOSResource: + return AsyncOSResource(self._client) @cached_property - def tls_version(self) -> AsyncTLSVersion: - return AsyncTLSVersion(self._client) + def tls_version(self) -> AsyncTLSVersionResource: + return AsyncTLSVersionResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAsesWithRawResponse: - return AsyncAsesWithRawResponse(self) + def with_raw_response(self) -> AsyncAsesResourceWithRawResponse: + return AsyncAsesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAsesWithStreamingResponse: - return AsyncAsesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAsesResourceWithStreamingResponse: + return AsyncAsesResourceWithStreamingResponse(self) async def get( self, @@ -424,14 +425,14 @@ async def get( }, ase_get_params.AseGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AseGetResponse]._unwrapper, ), cast_to=cast(Type[AseGetResponse], ResultWrapper[AseGetResponse]), ) -class AsesWithRawResponse: - def __init__(self, ases: Ases) -> None: +class AsesResourceWithRawResponse: + def __init__(self, ases: AsesResource) -> None: self._ases = ases self.get = to_raw_response_wrapper( @@ -439,36 +440,36 @@ def __init__(self, ases: Ases) -> None: ) @cached_property - def bot_class(self) -> BotClassWithRawResponse: - return BotClassWithRawResponse(self._ases.bot_class) + def bot_class(self) -> BotClassResourceWithRawResponse: + return BotClassResourceWithRawResponse(self._ases.bot_class) @cached_property - def device_type(self) -> DeviceTypeWithRawResponse: - return DeviceTypeWithRawResponse(self._ases.device_type) + def device_type(self) -> DeviceTypeResourceWithRawResponse: + return DeviceTypeResourceWithRawResponse(self._ases.device_type) @cached_property - def http_protocol(self) -> HTTPProtocolWithRawResponse: - return HTTPProtocolWithRawResponse(self._ases.http_protocol) + def http_protocol(self) -> HTTPProtocolResourceWithRawResponse: + return HTTPProtocolResourceWithRawResponse(self._ases.http_protocol) @cached_property - def http_method(self) -> HTTPMethodWithRawResponse: - return HTTPMethodWithRawResponse(self._ases.http_method) + def http_method(self) -> HTTPMethodResourceWithRawResponse: + return HTTPMethodResourceWithRawResponse(self._ases.http_method) @cached_property - def ip_version(self) -> IPVersionWithRawResponse: - return IPVersionWithRawResponse(self._ases.ip_version) + def ip_version(self) -> IPVersionResourceWithRawResponse: + return IPVersionResourceWithRawResponse(self._ases.ip_version) @cached_property - def os(self) -> OSWithRawResponse: - return OSWithRawResponse(self._ases.os) + def os(self) -> OSResourceWithRawResponse: + return OSResourceWithRawResponse(self._ases.os) @cached_property - def tls_version(self) -> TLSVersionWithRawResponse: - return TLSVersionWithRawResponse(self._ases.tls_version) + def tls_version(self) -> TLSVersionResourceWithRawResponse: + return TLSVersionResourceWithRawResponse(self._ases.tls_version) -class AsyncAsesWithRawResponse: - def __init__(self, ases: AsyncAses) -> None: +class AsyncAsesResourceWithRawResponse: + def __init__(self, ases: AsyncAsesResource) -> None: self._ases = ases self.get = async_to_raw_response_wrapper( @@ -476,36 +477,36 @@ def __init__(self, ases: AsyncAses) -> None: ) @cached_property - def bot_class(self) -> AsyncBotClassWithRawResponse: - return AsyncBotClassWithRawResponse(self._ases.bot_class) + def bot_class(self) -> AsyncBotClassResourceWithRawResponse: + return AsyncBotClassResourceWithRawResponse(self._ases.bot_class) @cached_property - def device_type(self) -> AsyncDeviceTypeWithRawResponse: - return AsyncDeviceTypeWithRawResponse(self._ases.device_type) + def device_type(self) -> AsyncDeviceTypeResourceWithRawResponse: + return AsyncDeviceTypeResourceWithRawResponse(self._ases.device_type) @cached_property - def http_protocol(self) -> AsyncHTTPProtocolWithRawResponse: - return AsyncHTTPProtocolWithRawResponse(self._ases.http_protocol) + def http_protocol(self) -> AsyncHTTPProtocolResourceWithRawResponse: + return AsyncHTTPProtocolResourceWithRawResponse(self._ases.http_protocol) @cached_property - def http_method(self) -> AsyncHTTPMethodWithRawResponse: - return AsyncHTTPMethodWithRawResponse(self._ases.http_method) + def http_method(self) -> AsyncHTTPMethodResourceWithRawResponse: + return AsyncHTTPMethodResourceWithRawResponse(self._ases.http_method) @cached_property - def ip_version(self) -> AsyncIPVersionWithRawResponse: - return AsyncIPVersionWithRawResponse(self._ases.ip_version) + def ip_version(self) -> AsyncIPVersionResourceWithRawResponse: + return AsyncIPVersionResourceWithRawResponse(self._ases.ip_version) @cached_property - def os(self) -> AsyncOSWithRawResponse: - return AsyncOSWithRawResponse(self._ases.os) + def os(self) -> AsyncOSResourceWithRawResponse: + return AsyncOSResourceWithRawResponse(self._ases.os) @cached_property - def tls_version(self) -> AsyncTLSVersionWithRawResponse: - return AsyncTLSVersionWithRawResponse(self._ases.tls_version) + def tls_version(self) -> AsyncTLSVersionResourceWithRawResponse: + return AsyncTLSVersionResourceWithRawResponse(self._ases.tls_version) -class AsesWithStreamingResponse: - def __init__(self, ases: Ases) -> None: +class AsesResourceWithStreamingResponse: + def __init__(self, ases: AsesResource) -> None: self._ases = ases self.get = to_streamed_response_wrapper( @@ -513,36 +514,36 @@ def __init__(self, ases: Ases) -> None: ) @cached_property - def bot_class(self) -> BotClassWithStreamingResponse: - return BotClassWithStreamingResponse(self._ases.bot_class) + def bot_class(self) -> BotClassResourceWithStreamingResponse: + return BotClassResourceWithStreamingResponse(self._ases.bot_class) @cached_property - def device_type(self) -> DeviceTypeWithStreamingResponse: - return DeviceTypeWithStreamingResponse(self._ases.device_type) + def device_type(self) -> DeviceTypeResourceWithStreamingResponse: + return DeviceTypeResourceWithStreamingResponse(self._ases.device_type) @cached_property - def http_protocol(self) -> HTTPProtocolWithStreamingResponse: - return HTTPProtocolWithStreamingResponse(self._ases.http_protocol) + def http_protocol(self) -> HTTPProtocolResourceWithStreamingResponse: + return HTTPProtocolResourceWithStreamingResponse(self._ases.http_protocol) @cached_property - def http_method(self) -> HTTPMethodWithStreamingResponse: - return HTTPMethodWithStreamingResponse(self._ases.http_method) + def http_method(self) -> HTTPMethodResourceWithStreamingResponse: + return HTTPMethodResourceWithStreamingResponse(self._ases.http_method) @cached_property - def ip_version(self) -> IPVersionWithStreamingResponse: - return IPVersionWithStreamingResponse(self._ases.ip_version) + def ip_version(self) -> IPVersionResourceWithStreamingResponse: + return IPVersionResourceWithStreamingResponse(self._ases.ip_version) @cached_property - def os(self) -> OSWithStreamingResponse: - return OSWithStreamingResponse(self._ases.os) + def os(self) -> OSResourceWithStreamingResponse: + return OSResourceWithStreamingResponse(self._ases.os) @cached_property - def tls_version(self) -> TLSVersionWithStreamingResponse: - return TLSVersionWithStreamingResponse(self._ases.tls_version) + def tls_version(self) -> TLSVersionResourceWithStreamingResponse: + return TLSVersionResourceWithStreamingResponse(self._ases.tls_version) -class AsyncAsesWithStreamingResponse: - def __init__(self, ases: AsyncAses) -> None: +class AsyncAsesResourceWithStreamingResponse: + def __init__(self, ases: AsyncAsesResource) -> None: self._ases = ases self.get = async_to_streamed_response_wrapper( @@ -550,29 +551,29 @@ def __init__(self, ases: AsyncAses) -> None: ) @cached_property - def bot_class(self) -> AsyncBotClassWithStreamingResponse: - return AsyncBotClassWithStreamingResponse(self._ases.bot_class) + def bot_class(self) -> AsyncBotClassResourceWithStreamingResponse: + return AsyncBotClassResourceWithStreamingResponse(self._ases.bot_class) @cached_property - def device_type(self) -> AsyncDeviceTypeWithStreamingResponse: - return AsyncDeviceTypeWithStreamingResponse(self._ases.device_type) + def device_type(self) -> AsyncDeviceTypeResourceWithStreamingResponse: + return AsyncDeviceTypeResourceWithStreamingResponse(self._ases.device_type) @cached_property - def http_protocol(self) -> AsyncHTTPProtocolWithStreamingResponse: - return AsyncHTTPProtocolWithStreamingResponse(self._ases.http_protocol) + def http_protocol(self) -> AsyncHTTPProtocolResourceWithStreamingResponse: + return AsyncHTTPProtocolResourceWithStreamingResponse(self._ases.http_protocol) @cached_property - def http_method(self) -> AsyncHTTPMethodWithStreamingResponse: - return AsyncHTTPMethodWithStreamingResponse(self._ases.http_method) + def http_method(self) -> AsyncHTTPMethodResourceWithStreamingResponse: + return AsyncHTTPMethodResourceWithStreamingResponse(self._ases.http_method) @cached_property - def ip_version(self) -> AsyncIPVersionWithStreamingResponse: - return AsyncIPVersionWithStreamingResponse(self._ases.ip_version) + def ip_version(self) -> AsyncIPVersionResourceWithStreamingResponse: + return AsyncIPVersionResourceWithStreamingResponse(self._ases.ip_version) @cached_property - def os(self) -> AsyncOSWithStreamingResponse: - return AsyncOSWithStreamingResponse(self._ases.os) + def os(self) -> AsyncOSResourceWithStreamingResponse: + return AsyncOSResourceWithStreamingResponse(self._ases.os) @cached_property - def tls_version(self) -> AsyncTLSVersionWithStreamingResponse: - return AsyncTLSVersionWithStreamingResponse(self._ases.tls_version) + def tls_version(self) -> AsyncTLSVersionResourceWithStreamingResponse: + return AsyncTLSVersionResourceWithStreamingResponse(self._ases.tls_version) diff --git a/src/cloudflare/resources/radar/http/ases/bot_class.py b/src/cloudflare/resources/radar/http/ases/bot_class.py index e156e1612b5..809ae7ff1de 100644 --- a/src/cloudflare/resources/radar/http/ases/bot_class.py +++ b/src/cloudflare/resources/radar/http/ases/bot_class.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.ases import BotClassGetResponse, bot_class_get_params +from .....types.radar.http.ases import bot_class_get_params +from .....types.radar.http.ases.bot_class_get_response import BotClassGetResponse -__all__ = ["BotClass", "AsyncBotClass"] +__all__ = ["BotClassResource", "AsyncBotClassResource"] -class BotClass(SyncAPIResource): +class BotClassResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BotClassWithRawResponse: - return BotClassWithRawResponse(self) + def with_raw_response(self) -> BotClassResourceWithRawResponse: + return BotClassResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BotClassWithStreamingResponse: - return BotClassWithStreamingResponse(self) + def with_streaming_response(self) -> BotClassResourceWithStreamingResponse: + return BotClassResourceWithStreamingResponse(self) def get( self, @@ -170,20 +171,20 @@ def get( }, bot_class_get_params.BotClassGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BotClassGetResponse]._unwrapper, ), cast_to=cast(Type[BotClassGetResponse], ResultWrapper[BotClassGetResponse]), ) -class AsyncBotClass(AsyncAPIResource): +class AsyncBotClassResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBotClassWithRawResponse: - return AsyncBotClassWithRawResponse(self) + def with_raw_response(self) -> AsyncBotClassResourceWithRawResponse: + return AsyncBotClassResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBotClassWithStreamingResponse: - return AsyncBotClassWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBotClassResourceWithStreamingResponse: + return AsyncBotClassResourceWithStreamingResponse(self) async def get( self, @@ -316,14 +317,14 @@ async def get( }, bot_class_get_params.BotClassGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BotClassGetResponse]._unwrapper, ), cast_to=cast(Type[BotClassGetResponse], ResultWrapper[BotClassGetResponse]), ) -class BotClassWithRawResponse: - def __init__(self, bot_class: BotClass) -> None: +class BotClassResourceWithRawResponse: + def __init__(self, bot_class: BotClassResource) -> None: self._bot_class = bot_class self.get = to_raw_response_wrapper( @@ -331,8 +332,8 @@ def __init__(self, bot_class: BotClass) -> None: ) -class AsyncBotClassWithRawResponse: - def __init__(self, bot_class: AsyncBotClass) -> None: +class AsyncBotClassResourceWithRawResponse: + def __init__(self, bot_class: AsyncBotClassResource) -> None: self._bot_class = bot_class self.get = async_to_raw_response_wrapper( @@ -340,8 +341,8 @@ def __init__(self, bot_class: AsyncBotClass) -> None: ) -class BotClassWithStreamingResponse: - def __init__(self, bot_class: BotClass) -> None: +class BotClassResourceWithStreamingResponse: + def __init__(self, bot_class: BotClassResource) -> None: self._bot_class = bot_class self.get = to_streamed_response_wrapper( @@ -349,8 +350,8 @@ def __init__(self, bot_class: BotClass) -> None: ) -class AsyncBotClassWithStreamingResponse: - def __init__(self, bot_class: AsyncBotClass) -> None: +class AsyncBotClassResourceWithStreamingResponse: + def __init__(self, bot_class: AsyncBotClassResource) -> None: self._bot_class = bot_class self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/ases/device_type.py b/src/cloudflare/resources/radar/http/ases/device_type.py index 1875b15e03e..6bad8da2bc3 100644 --- a/src/cloudflare/resources/radar/http/ases/device_type.py +++ b/src/cloudflare/resources/radar/http/ases/device_type.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.ases import DeviceTypeGetResponse, device_type_get_params +from .....types.radar.http.ases import device_type_get_params +from .....types.radar.http.ases.device_type_get_response import DeviceTypeGetResponse -__all__ = ["DeviceType", "AsyncDeviceType"] +__all__ = ["DeviceTypeResource", "AsyncDeviceTypeResource"] -class DeviceType(SyncAPIResource): +class DeviceTypeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DeviceTypeWithRawResponse: - return DeviceTypeWithRawResponse(self) + def with_raw_response(self) -> DeviceTypeResourceWithRawResponse: + return DeviceTypeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DeviceTypeWithStreamingResponse: - return DeviceTypeWithStreamingResponse(self) + def with_streaming_response(self) -> DeviceTypeResourceWithStreamingResponse: + return DeviceTypeResourceWithStreamingResponse(self) def get( self, @@ -168,20 +169,20 @@ def get( }, device_type_get_params.DeviceTypeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DeviceTypeGetResponse]._unwrapper, ), cast_to=cast(Type[DeviceTypeGetResponse], ResultWrapper[DeviceTypeGetResponse]), ) -class AsyncDeviceType(AsyncAPIResource): +class AsyncDeviceTypeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDeviceTypeWithRawResponse: - return AsyncDeviceTypeWithRawResponse(self) + def with_raw_response(self) -> AsyncDeviceTypeResourceWithRawResponse: + return AsyncDeviceTypeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDeviceTypeWithStreamingResponse: - return AsyncDeviceTypeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDeviceTypeResourceWithStreamingResponse: + return AsyncDeviceTypeResourceWithStreamingResponse(self) async def get( self, @@ -312,14 +313,14 @@ async def get( }, device_type_get_params.DeviceTypeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DeviceTypeGetResponse]._unwrapper, ), cast_to=cast(Type[DeviceTypeGetResponse], ResultWrapper[DeviceTypeGetResponse]), ) -class DeviceTypeWithRawResponse: - def __init__(self, device_type: DeviceType) -> None: +class DeviceTypeResourceWithRawResponse: + def __init__(self, device_type: DeviceTypeResource) -> None: self._device_type = device_type self.get = to_raw_response_wrapper( @@ -327,8 +328,8 @@ def __init__(self, device_type: DeviceType) -> None: ) -class AsyncDeviceTypeWithRawResponse: - def __init__(self, device_type: AsyncDeviceType) -> None: +class AsyncDeviceTypeResourceWithRawResponse: + def __init__(self, device_type: AsyncDeviceTypeResource) -> None: self._device_type = device_type self.get = async_to_raw_response_wrapper( @@ -336,8 +337,8 @@ def __init__(self, device_type: AsyncDeviceType) -> None: ) -class DeviceTypeWithStreamingResponse: - def __init__(self, device_type: DeviceType) -> None: +class DeviceTypeResourceWithStreamingResponse: + def __init__(self, device_type: DeviceTypeResource) -> None: self._device_type = device_type self.get = to_streamed_response_wrapper( @@ -345,8 +346,8 @@ def __init__(self, device_type: DeviceType) -> None: ) -class AsyncDeviceTypeWithStreamingResponse: - def __init__(self, device_type: AsyncDeviceType) -> None: +class AsyncDeviceTypeResourceWithStreamingResponse: + def __init__(self, device_type: AsyncDeviceTypeResource) -> None: self._device_type = device_type self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/ases/http_method.py b/src/cloudflare/resources/radar/http/ases/http_method.py index e9a14a3c7cc..9d6f41fb2b9 100644 --- a/src/cloudflare/resources/radar/http/ases/http_method.py +++ b/src/cloudflare/resources/radar/http/ases/http_method.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.ases import HTTPMethodGetResponse, http_method_get_params +from .....types.radar.http.ases import http_method_get_params +from .....types.radar.http.ases.http_method_get_response import HTTPMethodGetResponse -__all__ = ["HTTPMethod", "AsyncHTTPMethod"] +__all__ = ["HTTPMethodResource", "AsyncHTTPMethodResource"] -class HTTPMethod(SyncAPIResource): +class HTTPMethodResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HTTPMethodWithRawResponse: - return HTTPMethodWithRawResponse(self) + def with_raw_response(self) -> HTTPMethodResourceWithRawResponse: + return HTTPMethodResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HTTPMethodWithStreamingResponse: - return HTTPMethodWithStreamingResponse(self) + def with_streaming_response(self) -> HTTPMethodResourceWithStreamingResponse: + return HTTPMethodResourceWithStreamingResponse(self) def get( self, @@ -168,20 +169,20 @@ def get( }, http_method_get_params.HTTPMethodGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HTTPMethodGetResponse]._unwrapper, ), cast_to=cast(Type[HTTPMethodGetResponse], ResultWrapper[HTTPMethodGetResponse]), ) -class AsyncHTTPMethod(AsyncAPIResource): +class AsyncHTTPMethodResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHTTPMethodWithRawResponse: - return AsyncHTTPMethodWithRawResponse(self) + def with_raw_response(self) -> AsyncHTTPMethodResourceWithRawResponse: + return AsyncHTTPMethodResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHTTPMethodWithStreamingResponse: - return AsyncHTTPMethodWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHTTPMethodResourceWithStreamingResponse: + return AsyncHTTPMethodResourceWithStreamingResponse(self) async def get( self, @@ -312,14 +313,14 @@ async def get( }, http_method_get_params.HTTPMethodGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HTTPMethodGetResponse]._unwrapper, ), cast_to=cast(Type[HTTPMethodGetResponse], ResultWrapper[HTTPMethodGetResponse]), ) -class HTTPMethodWithRawResponse: - def __init__(self, http_method: HTTPMethod) -> None: +class HTTPMethodResourceWithRawResponse: + def __init__(self, http_method: HTTPMethodResource) -> None: self._http_method = http_method self.get = to_raw_response_wrapper( @@ -327,8 +328,8 @@ def __init__(self, http_method: HTTPMethod) -> None: ) -class AsyncHTTPMethodWithRawResponse: - def __init__(self, http_method: AsyncHTTPMethod) -> None: +class AsyncHTTPMethodResourceWithRawResponse: + def __init__(self, http_method: AsyncHTTPMethodResource) -> None: self._http_method = http_method self.get = async_to_raw_response_wrapper( @@ -336,8 +337,8 @@ def __init__(self, http_method: AsyncHTTPMethod) -> None: ) -class HTTPMethodWithStreamingResponse: - def __init__(self, http_method: HTTPMethod) -> None: +class HTTPMethodResourceWithStreamingResponse: + def __init__(self, http_method: HTTPMethodResource) -> None: self._http_method = http_method self.get = to_streamed_response_wrapper( @@ -345,8 +346,8 @@ def __init__(self, http_method: HTTPMethod) -> None: ) -class AsyncHTTPMethodWithStreamingResponse: - def __init__(self, http_method: AsyncHTTPMethod) -> None: +class AsyncHTTPMethodResourceWithStreamingResponse: + def __init__(self, http_method: AsyncHTTPMethodResource) -> None: self._http_method = http_method self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/ases/http_protocol.py b/src/cloudflare/resources/radar/http/ases/http_protocol.py index 9bcb5c719f2..b3ef2da221b 100644 --- a/src/cloudflare/resources/radar/http/ases/http_protocol.py +++ b/src/cloudflare/resources/radar/http/ases/http_protocol.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.ases import HTTPProtocolGetResponse, http_protocol_get_params +from .....types.radar.http.ases import http_protocol_get_params +from .....types.radar.http.ases.http_protocol_get_response import HTTPProtocolGetResponse -__all__ = ["HTTPProtocol", "AsyncHTTPProtocol"] +__all__ = ["HTTPProtocolResource", "AsyncHTTPProtocolResource"] -class HTTPProtocol(SyncAPIResource): +class HTTPProtocolResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HTTPProtocolWithRawResponse: - return HTTPProtocolWithRawResponse(self) + def with_raw_response(self) -> HTTPProtocolResourceWithRawResponse: + return HTTPProtocolResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HTTPProtocolWithStreamingResponse: - return HTTPProtocolWithStreamingResponse(self) + def with_streaming_response(self) -> HTTPProtocolResourceWithStreamingResponse: + return HTTPProtocolResourceWithStreamingResponse(self) def get( self, @@ -164,20 +165,20 @@ def get( }, http_protocol_get_params.HTTPProtocolGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HTTPProtocolGetResponse]._unwrapper, ), cast_to=cast(Type[HTTPProtocolGetResponse], ResultWrapper[HTTPProtocolGetResponse]), ) -class AsyncHTTPProtocol(AsyncAPIResource): +class AsyncHTTPProtocolResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHTTPProtocolWithRawResponse: - return AsyncHTTPProtocolWithRawResponse(self) + def with_raw_response(self) -> AsyncHTTPProtocolResourceWithRawResponse: + return AsyncHTTPProtocolResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHTTPProtocolWithStreamingResponse: - return AsyncHTTPProtocolWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHTTPProtocolResourceWithStreamingResponse: + return AsyncHTTPProtocolResourceWithStreamingResponse(self) async def get( self, @@ -304,14 +305,14 @@ async def get( }, http_protocol_get_params.HTTPProtocolGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HTTPProtocolGetResponse]._unwrapper, ), cast_to=cast(Type[HTTPProtocolGetResponse], ResultWrapper[HTTPProtocolGetResponse]), ) -class HTTPProtocolWithRawResponse: - def __init__(self, http_protocol: HTTPProtocol) -> None: +class HTTPProtocolResourceWithRawResponse: + def __init__(self, http_protocol: HTTPProtocolResource) -> None: self._http_protocol = http_protocol self.get = to_raw_response_wrapper( @@ -319,8 +320,8 @@ def __init__(self, http_protocol: HTTPProtocol) -> None: ) -class AsyncHTTPProtocolWithRawResponse: - def __init__(self, http_protocol: AsyncHTTPProtocol) -> None: +class AsyncHTTPProtocolResourceWithRawResponse: + def __init__(self, http_protocol: AsyncHTTPProtocolResource) -> None: self._http_protocol = http_protocol self.get = async_to_raw_response_wrapper( @@ -328,8 +329,8 @@ def __init__(self, http_protocol: AsyncHTTPProtocol) -> None: ) -class HTTPProtocolWithStreamingResponse: - def __init__(self, http_protocol: HTTPProtocol) -> None: +class HTTPProtocolResourceWithStreamingResponse: + def __init__(self, http_protocol: HTTPProtocolResource) -> None: self._http_protocol = http_protocol self.get = to_streamed_response_wrapper( @@ -337,8 +338,8 @@ def __init__(self, http_protocol: HTTPProtocol) -> None: ) -class AsyncHTTPProtocolWithStreamingResponse: - def __init__(self, http_protocol: AsyncHTTPProtocol) -> None: +class AsyncHTTPProtocolResourceWithStreamingResponse: + def __init__(self, http_protocol: AsyncHTTPProtocolResource) -> None: self._http_protocol = http_protocol self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/ases/ip_version.py b/src/cloudflare/resources/radar/http/ases/ip_version.py index 8a93e11c8be..b62867a8aa9 100644 --- a/src/cloudflare/resources/radar/http/ases/ip_version.py +++ b/src/cloudflare/resources/radar/http/ases/ip_version.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.ases import IPVersionGetResponse, ip_version_get_params +from .....types.radar.http.ases import ip_version_get_params +from .....types.radar.http.ases.ip_version_get_response import IPVersionGetResponse -__all__ = ["IPVersion", "AsyncIPVersion"] +__all__ = ["IPVersionResource", "AsyncIPVersionResource"] -class IPVersion(SyncAPIResource): +class IPVersionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPVersionWithRawResponse: - return IPVersionWithRawResponse(self) + def with_raw_response(self) -> IPVersionResourceWithRawResponse: + return IPVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPVersionWithStreamingResponse: - return IPVersionWithStreamingResponse(self) + def with_streaming_response(self) -> IPVersionResourceWithStreamingResponse: + return IPVersionResourceWithStreamingResponse(self) def get( self, @@ -168,20 +169,20 @@ def get( }, ip_version_get_params.IPVersionGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPVersionGetResponse]._unwrapper, ), cast_to=cast(Type[IPVersionGetResponse], ResultWrapper[IPVersionGetResponse]), ) -class AsyncIPVersion(AsyncAPIResource): +class AsyncIPVersionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPVersionWithRawResponse: - return AsyncIPVersionWithRawResponse(self) + def with_raw_response(self) -> AsyncIPVersionResourceWithRawResponse: + return AsyncIPVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPVersionWithStreamingResponse: - return AsyncIPVersionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPVersionResourceWithStreamingResponse: + return AsyncIPVersionResourceWithStreamingResponse(self) async def get( self, @@ -312,14 +313,14 @@ async def get( }, ip_version_get_params.IPVersionGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPVersionGetResponse]._unwrapper, ), cast_to=cast(Type[IPVersionGetResponse], ResultWrapper[IPVersionGetResponse]), ) -class IPVersionWithRawResponse: - def __init__(self, ip_version: IPVersion) -> None: +class IPVersionResourceWithRawResponse: + def __init__(self, ip_version: IPVersionResource) -> None: self._ip_version = ip_version self.get = to_raw_response_wrapper( @@ -327,8 +328,8 @@ def __init__(self, ip_version: IPVersion) -> None: ) -class AsyncIPVersionWithRawResponse: - def __init__(self, ip_version: AsyncIPVersion) -> None: +class AsyncIPVersionResourceWithRawResponse: + def __init__(self, ip_version: AsyncIPVersionResource) -> None: self._ip_version = ip_version self.get = async_to_raw_response_wrapper( @@ -336,8 +337,8 @@ def __init__(self, ip_version: AsyncIPVersion) -> None: ) -class IPVersionWithStreamingResponse: - def __init__(self, ip_version: IPVersion) -> None: +class IPVersionResourceWithStreamingResponse: + def __init__(self, ip_version: IPVersionResource) -> None: self._ip_version = ip_version self.get = to_streamed_response_wrapper( @@ -345,8 +346,8 @@ def __init__(self, ip_version: IPVersion) -> None: ) -class AsyncIPVersionWithStreamingResponse: - def __init__(self, ip_version: AsyncIPVersion) -> None: +class AsyncIPVersionResourceWithStreamingResponse: + def __init__(self, ip_version: AsyncIPVersionResource) -> None: self._ip_version = ip_version self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/ases/os.py b/src/cloudflare/resources/radar/http/ases/os.py index 4f62dad53f1..4b9be3919f3 100644 --- a/src/cloudflare/resources/radar/http/ases/os.py +++ b/src/cloudflare/resources/radar/http/ases/os.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.ases import OSGetResponse, os_get_params +from .....types.radar.http.ases import os_get_params +from .....types.radar.http.ases.os_get_response import OSGetResponse -__all__ = ["OS", "AsyncOS"] +__all__ = ["OSResource", "AsyncOSResource"] -class OS(SyncAPIResource): +class OSResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OSWithRawResponse: - return OSWithRawResponse(self) + def with_raw_response(self) -> OSResourceWithRawResponse: + return OSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OSWithStreamingResponse: - return OSWithStreamingResponse(self) + def with_streaming_response(self) -> OSResourceWithStreamingResponse: + return OSResourceWithStreamingResponse(self) def get( self, @@ -167,20 +168,20 @@ def get( }, os_get_params.OSGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OSGetResponse]._unwrapper, ), cast_to=cast(Type[OSGetResponse], ResultWrapper[OSGetResponse]), ) -class AsyncOS(AsyncAPIResource): +class AsyncOSResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOSWithRawResponse: - return AsyncOSWithRawResponse(self) + def with_raw_response(self) -> AsyncOSResourceWithRawResponse: + return AsyncOSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOSWithStreamingResponse: - return AsyncOSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOSResourceWithStreamingResponse: + return AsyncOSResourceWithStreamingResponse(self) async def get( self, @@ -310,14 +311,14 @@ async def get( }, os_get_params.OSGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OSGetResponse]._unwrapper, ), cast_to=cast(Type[OSGetResponse], ResultWrapper[OSGetResponse]), ) -class OSWithRawResponse: - def __init__(self, os: OS) -> None: +class OSResourceWithRawResponse: + def __init__(self, os: OSResource) -> None: self._os = os self.get = to_raw_response_wrapper( @@ -325,8 +326,8 @@ def __init__(self, os: OS) -> None: ) -class AsyncOSWithRawResponse: - def __init__(self, os: AsyncOS) -> None: +class AsyncOSResourceWithRawResponse: + def __init__(self, os: AsyncOSResource) -> None: self._os = os self.get = async_to_raw_response_wrapper( @@ -334,8 +335,8 @@ def __init__(self, os: AsyncOS) -> None: ) -class OSWithStreamingResponse: - def __init__(self, os: OS) -> None: +class OSResourceWithStreamingResponse: + def __init__(self, os: OSResource) -> None: self._os = os self.get = to_streamed_response_wrapper( @@ -343,8 +344,8 @@ def __init__(self, os: OS) -> None: ) -class AsyncOSWithStreamingResponse: - def __init__(self, os: AsyncOS) -> None: +class AsyncOSResourceWithStreamingResponse: + def __init__(self, os: AsyncOSResource) -> None: self._os = os self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/ases/tls_version.py b/src/cloudflare/resources/radar/http/ases/tls_version.py index e580cd43ab2..10cd0b988e2 100644 --- a/src/cloudflare/resources/radar/http/ases/tls_version.py +++ b/src/cloudflare/resources/radar/http/ases/tls_version.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.ases import TLSVersionGetResponse, tls_version_get_params +from .....types.radar.http.ases import tls_version_get_params +from .....types.radar.http.ases.tls_version_get_response import TLSVersionGetResponse -__all__ = ["TLSVersion", "AsyncTLSVersion"] +__all__ = ["TLSVersionResource", "AsyncTLSVersionResource"] -class TLSVersion(SyncAPIResource): +class TLSVersionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TLSVersionWithRawResponse: - return TLSVersionWithRawResponse(self) + def with_raw_response(self) -> TLSVersionResourceWithRawResponse: + return TLSVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TLSVersionWithStreamingResponse: - return TLSVersionWithStreamingResponse(self) + def with_streaming_response(self) -> TLSVersionResourceWithStreamingResponse: + return TLSVersionResourceWithStreamingResponse(self) def get( self, @@ -168,20 +169,20 @@ def get( }, tls_version_get_params.TLSVersionGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TLSVersionGetResponse]._unwrapper, ), cast_to=cast(Type[TLSVersionGetResponse], ResultWrapper[TLSVersionGetResponse]), ) -class AsyncTLSVersion(AsyncAPIResource): +class AsyncTLSVersionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTLSVersionWithRawResponse: - return AsyncTLSVersionWithRawResponse(self) + def with_raw_response(self) -> AsyncTLSVersionResourceWithRawResponse: + return AsyncTLSVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTLSVersionWithStreamingResponse: - return AsyncTLSVersionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTLSVersionResourceWithStreamingResponse: + return AsyncTLSVersionResourceWithStreamingResponse(self) async def get( self, @@ -312,14 +313,14 @@ async def get( }, tls_version_get_params.TLSVersionGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TLSVersionGetResponse]._unwrapper, ), cast_to=cast(Type[TLSVersionGetResponse], ResultWrapper[TLSVersionGetResponse]), ) -class TLSVersionWithRawResponse: - def __init__(self, tls_version: TLSVersion) -> None: +class TLSVersionResourceWithRawResponse: + def __init__(self, tls_version: TLSVersionResource) -> None: self._tls_version = tls_version self.get = to_raw_response_wrapper( @@ -327,8 +328,8 @@ def __init__(self, tls_version: TLSVersion) -> None: ) -class AsyncTLSVersionWithRawResponse: - def __init__(self, tls_version: AsyncTLSVersion) -> None: +class AsyncTLSVersionResourceWithRawResponse: + def __init__(self, tls_version: AsyncTLSVersionResource) -> None: self._tls_version = tls_version self.get = async_to_raw_response_wrapper( @@ -336,8 +337,8 @@ def __init__(self, tls_version: AsyncTLSVersion) -> None: ) -class TLSVersionWithStreamingResponse: - def __init__(self, tls_version: TLSVersion) -> None: +class TLSVersionResourceWithStreamingResponse: + def __init__(self, tls_version: TLSVersionResource) -> None: self._tls_version = tls_version self.get = to_streamed_response_wrapper( @@ -345,8 +346,8 @@ def __init__(self, tls_version: TLSVersion) -> None: ) -class AsyncTLSVersionWithStreamingResponse: - def __init__(self, tls_version: AsyncTLSVersion) -> None: +class AsyncTLSVersionResourceWithStreamingResponse: + def __init__(self, tls_version: AsyncTLSVersionResource) -> None: self._tls_version = tls_version self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/http.py b/src/cloudflare/resources/radar/http/http.py index b858685323c..b8a704fd14d 100644 --- a/src/cloudflare/resources/radar/http/http.py +++ b/src/cloudflare/resources/radar/http/http.py @@ -3,208 +3,208 @@ from __future__ import annotations from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .ases import ( - Ases, - AsyncAses, - AsesWithRawResponse, - AsyncAsesWithRawResponse, - AsesWithStreamingResponse, - AsyncAsesWithStreamingResponse, + AsesResource, + AsyncAsesResource, + AsesResourceWithRawResponse, + AsyncAsesResourceWithRawResponse, + AsesResourceWithStreamingResponse, + AsyncAsesResourceWithStreamingResponse, ) from .summary import ( - Summary, - AsyncSummary, - SummaryWithRawResponse, - AsyncSummaryWithRawResponse, - SummaryWithStreamingResponse, - AsyncSummaryWithStreamingResponse, + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, ) -from .ases.ases import Ases, AsyncAses +from .ases.ases import AsesResource, AsyncAsesResource from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from .timeseries_groups import ( - TimeseriesGroups, - AsyncTimeseriesGroups, - TimeseriesGroupsWithRawResponse, - AsyncTimeseriesGroupsWithRawResponse, - TimeseriesGroupsWithStreamingResponse, - AsyncTimeseriesGroupsWithStreamingResponse, + TimeseriesGroupsResource, + AsyncTimeseriesGroupsResource, + TimeseriesGroupsResourceWithRawResponse, + AsyncTimeseriesGroupsResourceWithRawResponse, + TimeseriesGroupsResourceWithStreamingResponse, + AsyncTimeseriesGroupsResourceWithStreamingResponse, ) -from .locations.locations import Locations, AsyncLocations +from .locations.locations import LocationsResource, AsyncLocationsResource -__all__ = ["HTTP", "AsyncHTTP"] +__all__ = ["HTTPResource", "AsyncHTTPResource"] -class HTTP(SyncAPIResource): +class HTTPResource(SyncAPIResource): @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def locations(self) -> Locations: - return Locations(self._client) + def locations(self) -> LocationsResource: + return LocationsResource(self._client) @cached_property - def ases(self) -> Ases: - return Ases(self._client) + def ases(self) -> AsesResource: + return AsesResource(self._client) @cached_property - def summary(self) -> Summary: - return Summary(self._client) + def summary(self) -> SummaryResource: + return SummaryResource(self._client) @cached_property - def timeseries_groups(self) -> TimeseriesGroups: - return TimeseriesGroups(self._client) + def timeseries_groups(self) -> TimeseriesGroupsResource: + return TimeseriesGroupsResource(self._client) @cached_property - def with_raw_response(self) -> HTTPWithRawResponse: - return HTTPWithRawResponse(self) + def with_raw_response(self) -> HTTPResourceWithRawResponse: + return HTTPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HTTPWithStreamingResponse: - return HTTPWithStreamingResponse(self) + def with_streaming_response(self) -> HTTPResourceWithStreamingResponse: + return HTTPResourceWithStreamingResponse(self) -class AsyncHTTP(AsyncAPIResource): +class AsyncHTTPResource(AsyncAPIResource): @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def locations(self) -> AsyncLocations: - return AsyncLocations(self._client) + def locations(self) -> AsyncLocationsResource: + return AsyncLocationsResource(self._client) @cached_property - def ases(self) -> AsyncAses: - return AsyncAses(self._client) + def ases(self) -> AsyncAsesResource: + return AsyncAsesResource(self._client) @cached_property - def summary(self) -> AsyncSummary: - return AsyncSummary(self._client) + def summary(self) -> AsyncSummaryResource: + return AsyncSummaryResource(self._client) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroups: - return AsyncTimeseriesGroups(self._client) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResource: + return AsyncTimeseriesGroupsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncHTTPWithRawResponse: - return AsyncHTTPWithRawResponse(self) + def with_raw_response(self) -> AsyncHTTPResourceWithRawResponse: + return AsyncHTTPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHTTPWithStreamingResponse: - return AsyncHTTPWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHTTPResourceWithStreamingResponse: + return AsyncHTTPResourceWithStreamingResponse(self) -class HTTPWithRawResponse: - def __init__(self, http: HTTP) -> None: +class HTTPResourceWithRawResponse: + def __init__(self, http: HTTPResource) -> None: self._http = http @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._http.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._http.top) @cached_property - def locations(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self._http.locations) + def locations(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self._http.locations) @cached_property - def ases(self) -> AsesWithRawResponse: - return AsesWithRawResponse(self._http.ases) + def ases(self) -> AsesResourceWithRawResponse: + return AsesResourceWithRawResponse(self._http.ases) @cached_property - def summary(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self._http.summary) + def summary(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self._http.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self._http.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self._http.timeseries_groups) -class AsyncHTTPWithRawResponse: - def __init__(self, http: AsyncHTTP) -> None: +class AsyncHTTPResourceWithRawResponse: + def __init__(self, http: AsyncHTTPResource) -> None: self._http = http @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._http.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._http.top) @cached_property - def locations(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self._http.locations) + def locations(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self._http.locations) @cached_property - def ases(self) -> AsyncAsesWithRawResponse: - return AsyncAsesWithRawResponse(self._http.ases) + def ases(self) -> AsyncAsesResourceWithRawResponse: + return AsyncAsesResourceWithRawResponse(self._http.ases) @cached_property - def summary(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self._http.summary) + def summary(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self._http.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self._http.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self._http.timeseries_groups) -class HTTPWithStreamingResponse: - def __init__(self, http: HTTP) -> None: +class HTTPResourceWithStreamingResponse: + def __init__(self, http: HTTPResource) -> None: self._http = http @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._http.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._http.top) @cached_property - def locations(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self._http.locations) + def locations(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self._http.locations) @cached_property - def ases(self) -> AsesWithStreamingResponse: - return AsesWithStreamingResponse(self._http.ases) + def ases(self) -> AsesResourceWithStreamingResponse: + return AsesResourceWithStreamingResponse(self._http.ases) @cached_property - def summary(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self._http.summary) + def summary(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self._http.summary) @cached_property - def timeseries_groups(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self._http.timeseries_groups) + def timeseries_groups(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self._http.timeseries_groups) -class AsyncHTTPWithStreamingResponse: - def __init__(self, http: AsyncHTTP) -> None: +class AsyncHTTPResourceWithStreamingResponse: + def __init__(self, http: AsyncHTTPResource) -> None: self._http = http @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._http.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._http.top) @cached_property - def locations(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self._http.locations) + def locations(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self._http.locations) @cached_property - def ases(self) -> AsyncAsesWithStreamingResponse: - return AsyncAsesWithStreamingResponse(self._http.ases) + def ases(self) -> AsyncAsesResourceWithStreamingResponse: + return AsyncAsesResourceWithStreamingResponse(self._http.ases) @cached_property - def summary(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self._http.summary) + def summary(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self._http.summary) @cached_property - def timeseries_groups(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self._http.timeseries_groups) + def timeseries_groups(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self._http.timeseries_groups) diff --git a/src/cloudflare/resources/radar/http/locations/__init__.py b/src/cloudflare/resources/radar/http/locations/__init__.py index 9dbcd9c4ebe..6ea85e36a11 100644 --- a/src/cloudflare/resources/radar/http/locations/__init__.py +++ b/src/cloudflare/resources/radar/http/locations/__init__.py @@ -1,117 +1,117 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .os import ( - OS, - AsyncOS, - OSWithRawResponse, - AsyncOSWithRawResponse, - OSWithStreamingResponse, - AsyncOSWithStreamingResponse, + OSResource, + AsyncOSResource, + OSResourceWithRawResponse, + AsyncOSResourceWithRawResponse, + OSResourceWithStreamingResponse, + AsyncOSResourceWithStreamingResponse, ) from .bot_class import ( - BotClass, - AsyncBotClass, - BotClassWithRawResponse, - AsyncBotClassWithRawResponse, - BotClassWithStreamingResponse, - AsyncBotClassWithStreamingResponse, + BotClassResource, + AsyncBotClassResource, + BotClassResourceWithRawResponse, + AsyncBotClassResourceWithRawResponse, + BotClassResourceWithStreamingResponse, + AsyncBotClassResourceWithStreamingResponse, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from .ip_version import ( - IPVersion, - AsyncIPVersion, - IPVersionWithRawResponse, - AsyncIPVersionWithRawResponse, - IPVersionWithStreamingResponse, - AsyncIPVersionWithStreamingResponse, + IPVersionResource, + AsyncIPVersionResource, + IPVersionResourceWithRawResponse, + AsyncIPVersionResourceWithRawResponse, + IPVersionResourceWithStreamingResponse, + AsyncIPVersionResourceWithStreamingResponse, ) from .device_type import ( - DeviceType, - AsyncDeviceType, - DeviceTypeWithRawResponse, - AsyncDeviceTypeWithRawResponse, - DeviceTypeWithStreamingResponse, - AsyncDeviceTypeWithStreamingResponse, + DeviceTypeResource, + AsyncDeviceTypeResource, + DeviceTypeResourceWithRawResponse, + AsyncDeviceTypeResourceWithRawResponse, + DeviceTypeResourceWithStreamingResponse, + AsyncDeviceTypeResourceWithStreamingResponse, ) from .http_method import ( - HTTPMethod, - AsyncHTTPMethod, - HTTPMethodWithRawResponse, - AsyncHTTPMethodWithRawResponse, - HTTPMethodWithStreamingResponse, - AsyncHTTPMethodWithStreamingResponse, + HTTPMethodResource, + AsyncHTTPMethodResource, + HTTPMethodResourceWithRawResponse, + AsyncHTTPMethodResourceWithRawResponse, + HTTPMethodResourceWithStreamingResponse, + AsyncHTTPMethodResourceWithStreamingResponse, ) from .tls_version import ( - TLSVersion, - AsyncTLSVersion, - TLSVersionWithRawResponse, - AsyncTLSVersionWithRawResponse, - TLSVersionWithStreamingResponse, - AsyncTLSVersionWithStreamingResponse, + TLSVersionResource, + AsyncTLSVersionResource, + TLSVersionResourceWithRawResponse, + AsyncTLSVersionResourceWithRawResponse, + TLSVersionResourceWithStreamingResponse, + AsyncTLSVersionResourceWithStreamingResponse, ) from .http_protocol import ( - HTTPProtocol, - AsyncHTTPProtocol, - HTTPProtocolWithRawResponse, - AsyncHTTPProtocolWithRawResponse, - HTTPProtocolWithStreamingResponse, - AsyncHTTPProtocolWithStreamingResponse, + HTTPProtocolResource, + AsyncHTTPProtocolResource, + HTTPProtocolResourceWithRawResponse, + AsyncHTTPProtocolResourceWithRawResponse, + HTTPProtocolResourceWithStreamingResponse, + AsyncHTTPProtocolResourceWithStreamingResponse, ) __all__ = [ - "BotClass", - "AsyncBotClass", - "BotClassWithRawResponse", - "AsyncBotClassWithRawResponse", - "BotClassWithStreamingResponse", - "AsyncBotClassWithStreamingResponse", - "DeviceType", - "AsyncDeviceType", - "DeviceTypeWithRawResponse", - "AsyncDeviceTypeWithRawResponse", - "DeviceTypeWithStreamingResponse", - "AsyncDeviceTypeWithStreamingResponse", - "HTTPProtocol", - "AsyncHTTPProtocol", - "HTTPProtocolWithRawResponse", - "AsyncHTTPProtocolWithRawResponse", - "HTTPProtocolWithStreamingResponse", - "AsyncHTTPProtocolWithStreamingResponse", - "HTTPMethod", - "AsyncHTTPMethod", - "HTTPMethodWithRawResponse", - "AsyncHTTPMethodWithRawResponse", - "HTTPMethodWithStreamingResponse", - "AsyncHTTPMethodWithStreamingResponse", - "IPVersion", - "AsyncIPVersion", - "IPVersionWithRawResponse", - "AsyncIPVersionWithRawResponse", - "IPVersionWithStreamingResponse", - "AsyncIPVersionWithStreamingResponse", - "OS", - "AsyncOS", - "OSWithRawResponse", - "AsyncOSWithRawResponse", - "OSWithStreamingResponse", - "AsyncOSWithStreamingResponse", - "TLSVersion", - "AsyncTLSVersion", - "TLSVersionWithRawResponse", - "AsyncTLSVersionWithRawResponse", - "TLSVersionWithStreamingResponse", - "AsyncTLSVersionWithStreamingResponse", - "Locations", - "AsyncLocations", - "LocationsWithRawResponse", - "AsyncLocationsWithRawResponse", - "LocationsWithStreamingResponse", - "AsyncLocationsWithStreamingResponse", + "BotClassResource", + "AsyncBotClassResource", + "BotClassResourceWithRawResponse", + "AsyncBotClassResourceWithRawResponse", + "BotClassResourceWithStreamingResponse", + "AsyncBotClassResourceWithStreamingResponse", + "DeviceTypeResource", + "AsyncDeviceTypeResource", + "DeviceTypeResourceWithRawResponse", + "AsyncDeviceTypeResourceWithRawResponse", + "DeviceTypeResourceWithStreamingResponse", + "AsyncDeviceTypeResourceWithStreamingResponse", + "HTTPProtocolResource", + "AsyncHTTPProtocolResource", + "HTTPProtocolResourceWithRawResponse", + "AsyncHTTPProtocolResourceWithRawResponse", + "HTTPProtocolResourceWithStreamingResponse", + "AsyncHTTPProtocolResourceWithStreamingResponse", + "HTTPMethodResource", + "AsyncHTTPMethodResource", + "HTTPMethodResourceWithRawResponse", + "AsyncHTTPMethodResourceWithRawResponse", + "HTTPMethodResourceWithStreamingResponse", + "AsyncHTTPMethodResourceWithStreamingResponse", + "IPVersionResource", + "AsyncIPVersionResource", + "IPVersionResourceWithRawResponse", + "AsyncIPVersionResourceWithRawResponse", + "IPVersionResourceWithStreamingResponse", + "AsyncIPVersionResourceWithStreamingResponse", + "OSResource", + "AsyncOSResource", + "OSResourceWithRawResponse", + "AsyncOSResourceWithRawResponse", + "OSResourceWithStreamingResponse", + "AsyncOSResourceWithStreamingResponse", + "TLSVersionResource", + "AsyncTLSVersionResource", + "TLSVersionResourceWithRawResponse", + "AsyncTLSVersionResourceWithRawResponse", + "TLSVersionResourceWithStreamingResponse", + "AsyncTLSVersionResourceWithStreamingResponse", + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/http/locations/bot_class.py b/src/cloudflare/resources/radar/http/locations/bot_class.py index dedda8c0f38..6507e30fff9 100644 --- a/src/cloudflare/resources/radar/http/locations/bot_class.py +++ b/src/cloudflare/resources/radar/http/locations/bot_class.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.locations import BotClassGetResponse, bot_class_get_params +from .....types.radar.http.locations import bot_class_get_params +from .....types.radar.http.locations.bot_class_get_response import BotClassGetResponse -__all__ = ["BotClass", "AsyncBotClass"] +__all__ = ["BotClassResource", "AsyncBotClassResource"] -class BotClass(SyncAPIResource): +class BotClassResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BotClassWithRawResponse: - return BotClassWithRawResponse(self) + def with_raw_response(self) -> BotClassResourceWithRawResponse: + return BotClassResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BotClassWithStreamingResponse: - return BotClassWithStreamingResponse(self) + def with_streaming_response(self) -> BotClassResourceWithStreamingResponse: + return BotClassResourceWithStreamingResponse(self) def get( self, @@ -170,20 +171,20 @@ def get( }, bot_class_get_params.BotClassGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BotClassGetResponse]._unwrapper, ), cast_to=cast(Type[BotClassGetResponse], ResultWrapper[BotClassGetResponse]), ) -class AsyncBotClass(AsyncAPIResource): +class AsyncBotClassResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBotClassWithRawResponse: - return AsyncBotClassWithRawResponse(self) + def with_raw_response(self) -> AsyncBotClassResourceWithRawResponse: + return AsyncBotClassResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBotClassWithStreamingResponse: - return AsyncBotClassWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBotClassResourceWithStreamingResponse: + return AsyncBotClassResourceWithStreamingResponse(self) async def get( self, @@ -316,14 +317,14 @@ async def get( }, bot_class_get_params.BotClassGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[BotClassGetResponse]._unwrapper, ), cast_to=cast(Type[BotClassGetResponse], ResultWrapper[BotClassGetResponse]), ) -class BotClassWithRawResponse: - def __init__(self, bot_class: BotClass) -> None: +class BotClassResourceWithRawResponse: + def __init__(self, bot_class: BotClassResource) -> None: self._bot_class = bot_class self.get = to_raw_response_wrapper( @@ -331,8 +332,8 @@ def __init__(self, bot_class: BotClass) -> None: ) -class AsyncBotClassWithRawResponse: - def __init__(self, bot_class: AsyncBotClass) -> None: +class AsyncBotClassResourceWithRawResponse: + def __init__(self, bot_class: AsyncBotClassResource) -> None: self._bot_class = bot_class self.get = async_to_raw_response_wrapper( @@ -340,8 +341,8 @@ def __init__(self, bot_class: AsyncBotClass) -> None: ) -class BotClassWithStreamingResponse: - def __init__(self, bot_class: BotClass) -> None: +class BotClassResourceWithStreamingResponse: + def __init__(self, bot_class: BotClassResource) -> None: self._bot_class = bot_class self.get = to_streamed_response_wrapper( @@ -349,8 +350,8 @@ def __init__(self, bot_class: BotClass) -> None: ) -class AsyncBotClassWithStreamingResponse: - def __init__(self, bot_class: AsyncBotClass) -> None: +class AsyncBotClassResourceWithStreamingResponse: + def __init__(self, bot_class: AsyncBotClassResource) -> None: self._bot_class = bot_class self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/locations/device_type.py b/src/cloudflare/resources/radar/http/locations/device_type.py index cbf3a9c6ff5..cb9ae569c73 100644 --- a/src/cloudflare/resources/radar/http/locations/device_type.py +++ b/src/cloudflare/resources/radar/http/locations/device_type.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.locations import DeviceTypeGetResponse, device_type_get_params +from .....types.radar.http.locations import device_type_get_params +from .....types.radar.http.locations.device_type_get_response import DeviceTypeGetResponse -__all__ = ["DeviceType", "AsyncDeviceType"] +__all__ = ["DeviceTypeResource", "AsyncDeviceTypeResource"] -class DeviceType(SyncAPIResource): +class DeviceTypeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DeviceTypeWithRawResponse: - return DeviceTypeWithRawResponse(self) + def with_raw_response(self) -> DeviceTypeResourceWithRawResponse: + return DeviceTypeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DeviceTypeWithStreamingResponse: - return DeviceTypeWithStreamingResponse(self) + def with_streaming_response(self) -> DeviceTypeResourceWithStreamingResponse: + return DeviceTypeResourceWithStreamingResponse(self) def get( self, @@ -169,20 +170,20 @@ def get( }, device_type_get_params.DeviceTypeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DeviceTypeGetResponse]._unwrapper, ), cast_to=cast(Type[DeviceTypeGetResponse], ResultWrapper[DeviceTypeGetResponse]), ) -class AsyncDeviceType(AsyncAPIResource): +class AsyncDeviceTypeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDeviceTypeWithRawResponse: - return AsyncDeviceTypeWithRawResponse(self) + def with_raw_response(self) -> AsyncDeviceTypeResourceWithRawResponse: + return AsyncDeviceTypeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDeviceTypeWithStreamingResponse: - return AsyncDeviceTypeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDeviceTypeResourceWithStreamingResponse: + return AsyncDeviceTypeResourceWithStreamingResponse(self) async def get( self, @@ -314,14 +315,14 @@ async def get( }, device_type_get_params.DeviceTypeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DeviceTypeGetResponse]._unwrapper, ), cast_to=cast(Type[DeviceTypeGetResponse], ResultWrapper[DeviceTypeGetResponse]), ) -class DeviceTypeWithRawResponse: - def __init__(self, device_type: DeviceType) -> None: +class DeviceTypeResourceWithRawResponse: + def __init__(self, device_type: DeviceTypeResource) -> None: self._device_type = device_type self.get = to_raw_response_wrapper( @@ -329,8 +330,8 @@ def __init__(self, device_type: DeviceType) -> None: ) -class AsyncDeviceTypeWithRawResponse: - def __init__(self, device_type: AsyncDeviceType) -> None: +class AsyncDeviceTypeResourceWithRawResponse: + def __init__(self, device_type: AsyncDeviceTypeResource) -> None: self._device_type = device_type self.get = async_to_raw_response_wrapper( @@ -338,8 +339,8 @@ def __init__(self, device_type: AsyncDeviceType) -> None: ) -class DeviceTypeWithStreamingResponse: - def __init__(self, device_type: DeviceType) -> None: +class DeviceTypeResourceWithStreamingResponse: + def __init__(self, device_type: DeviceTypeResource) -> None: self._device_type = device_type self.get = to_streamed_response_wrapper( @@ -347,8 +348,8 @@ def __init__(self, device_type: DeviceType) -> None: ) -class AsyncDeviceTypeWithStreamingResponse: - def __init__(self, device_type: AsyncDeviceType) -> None: +class AsyncDeviceTypeResourceWithStreamingResponse: + def __init__(self, device_type: AsyncDeviceTypeResource) -> None: self._device_type = device_type self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/locations/http_method.py b/src/cloudflare/resources/radar/http/locations/http_method.py index 5a7d252acd2..fd17679a21b 100644 --- a/src/cloudflare/resources/radar/http/locations/http_method.py +++ b/src/cloudflare/resources/radar/http/locations/http_method.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.locations import HTTPMethodGetResponse, http_method_get_params +from .....types.radar.http.locations import http_method_get_params +from .....types.radar.http.locations.http_method_get_response import HTTPMethodGetResponse -__all__ = ["HTTPMethod", "AsyncHTTPMethod"] +__all__ = ["HTTPMethodResource", "AsyncHTTPMethodResource"] -class HTTPMethod(SyncAPIResource): +class HTTPMethodResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HTTPMethodWithRawResponse: - return HTTPMethodWithRawResponse(self) + def with_raw_response(self) -> HTTPMethodResourceWithRawResponse: + return HTTPMethodResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HTTPMethodWithStreamingResponse: - return HTTPMethodWithStreamingResponse(self) + def with_streaming_response(self) -> HTTPMethodResourceWithStreamingResponse: + return HTTPMethodResourceWithStreamingResponse(self) def get( self, @@ -169,20 +170,20 @@ def get( }, http_method_get_params.HTTPMethodGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HTTPMethodGetResponse]._unwrapper, ), cast_to=cast(Type[HTTPMethodGetResponse], ResultWrapper[HTTPMethodGetResponse]), ) -class AsyncHTTPMethod(AsyncAPIResource): +class AsyncHTTPMethodResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHTTPMethodWithRawResponse: - return AsyncHTTPMethodWithRawResponse(self) + def with_raw_response(self) -> AsyncHTTPMethodResourceWithRawResponse: + return AsyncHTTPMethodResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHTTPMethodWithStreamingResponse: - return AsyncHTTPMethodWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHTTPMethodResourceWithStreamingResponse: + return AsyncHTTPMethodResourceWithStreamingResponse(self) async def get( self, @@ -314,14 +315,14 @@ async def get( }, http_method_get_params.HTTPMethodGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HTTPMethodGetResponse]._unwrapper, ), cast_to=cast(Type[HTTPMethodGetResponse], ResultWrapper[HTTPMethodGetResponse]), ) -class HTTPMethodWithRawResponse: - def __init__(self, http_method: HTTPMethod) -> None: +class HTTPMethodResourceWithRawResponse: + def __init__(self, http_method: HTTPMethodResource) -> None: self._http_method = http_method self.get = to_raw_response_wrapper( @@ -329,8 +330,8 @@ def __init__(self, http_method: HTTPMethod) -> None: ) -class AsyncHTTPMethodWithRawResponse: - def __init__(self, http_method: AsyncHTTPMethod) -> None: +class AsyncHTTPMethodResourceWithRawResponse: + def __init__(self, http_method: AsyncHTTPMethodResource) -> None: self._http_method = http_method self.get = async_to_raw_response_wrapper( @@ -338,8 +339,8 @@ def __init__(self, http_method: AsyncHTTPMethod) -> None: ) -class HTTPMethodWithStreamingResponse: - def __init__(self, http_method: HTTPMethod) -> None: +class HTTPMethodResourceWithStreamingResponse: + def __init__(self, http_method: HTTPMethodResource) -> None: self._http_method = http_method self.get = to_streamed_response_wrapper( @@ -347,8 +348,8 @@ def __init__(self, http_method: HTTPMethod) -> None: ) -class AsyncHTTPMethodWithStreamingResponse: - def __init__(self, http_method: AsyncHTTPMethod) -> None: +class AsyncHTTPMethodResourceWithStreamingResponse: + def __init__(self, http_method: AsyncHTTPMethodResource) -> None: self._http_method = http_method self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/locations/http_protocol.py b/src/cloudflare/resources/radar/http/locations/http_protocol.py index f5ff7102abf..68bc53b8b5f 100644 --- a/src/cloudflare/resources/radar/http/locations/http_protocol.py +++ b/src/cloudflare/resources/radar/http/locations/http_protocol.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.locations import HTTPProtocolGetResponse, http_protocol_get_params +from .....types.radar.http.locations import http_protocol_get_params +from .....types.radar.http.locations.http_protocol_get_response import HTTPProtocolGetResponse -__all__ = ["HTTPProtocol", "AsyncHTTPProtocol"] +__all__ = ["HTTPProtocolResource", "AsyncHTTPProtocolResource"] -class HTTPProtocol(SyncAPIResource): +class HTTPProtocolResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HTTPProtocolWithRawResponse: - return HTTPProtocolWithRawResponse(self) + def with_raw_response(self) -> HTTPProtocolResourceWithRawResponse: + return HTTPProtocolResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HTTPProtocolWithStreamingResponse: - return HTTPProtocolWithStreamingResponse(self) + def with_streaming_response(self) -> HTTPProtocolResourceWithStreamingResponse: + return HTTPProtocolResourceWithStreamingResponse(self) def get( self, @@ -165,20 +166,20 @@ def get( }, http_protocol_get_params.HTTPProtocolGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HTTPProtocolGetResponse]._unwrapper, ), cast_to=cast(Type[HTTPProtocolGetResponse], ResultWrapper[HTTPProtocolGetResponse]), ) -class AsyncHTTPProtocol(AsyncAPIResource): +class AsyncHTTPProtocolResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHTTPProtocolWithRawResponse: - return AsyncHTTPProtocolWithRawResponse(self) + def with_raw_response(self) -> AsyncHTTPProtocolResourceWithRawResponse: + return AsyncHTTPProtocolResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHTTPProtocolWithStreamingResponse: - return AsyncHTTPProtocolWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHTTPProtocolResourceWithStreamingResponse: + return AsyncHTTPProtocolResourceWithStreamingResponse(self) async def get( self, @@ -306,14 +307,14 @@ async def get( }, http_protocol_get_params.HTTPProtocolGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[HTTPProtocolGetResponse]._unwrapper, ), cast_to=cast(Type[HTTPProtocolGetResponse], ResultWrapper[HTTPProtocolGetResponse]), ) -class HTTPProtocolWithRawResponse: - def __init__(self, http_protocol: HTTPProtocol) -> None: +class HTTPProtocolResourceWithRawResponse: + def __init__(self, http_protocol: HTTPProtocolResource) -> None: self._http_protocol = http_protocol self.get = to_raw_response_wrapper( @@ -321,8 +322,8 @@ def __init__(self, http_protocol: HTTPProtocol) -> None: ) -class AsyncHTTPProtocolWithRawResponse: - def __init__(self, http_protocol: AsyncHTTPProtocol) -> None: +class AsyncHTTPProtocolResourceWithRawResponse: + def __init__(self, http_protocol: AsyncHTTPProtocolResource) -> None: self._http_protocol = http_protocol self.get = async_to_raw_response_wrapper( @@ -330,8 +331,8 @@ def __init__(self, http_protocol: AsyncHTTPProtocol) -> None: ) -class HTTPProtocolWithStreamingResponse: - def __init__(self, http_protocol: HTTPProtocol) -> None: +class HTTPProtocolResourceWithStreamingResponse: + def __init__(self, http_protocol: HTTPProtocolResource) -> None: self._http_protocol = http_protocol self.get = to_streamed_response_wrapper( @@ -339,8 +340,8 @@ def __init__(self, http_protocol: HTTPProtocol) -> None: ) -class AsyncHTTPProtocolWithStreamingResponse: - def __init__(self, http_protocol: AsyncHTTPProtocol) -> None: +class AsyncHTTPProtocolResourceWithStreamingResponse: + def __init__(self, http_protocol: AsyncHTTPProtocolResource) -> None: self._http_protocol = http_protocol self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/locations/ip_version.py b/src/cloudflare/resources/radar/http/locations/ip_version.py index 1e2bb160b04..26d202727d4 100644 --- a/src/cloudflare/resources/radar/http/locations/ip_version.py +++ b/src/cloudflare/resources/radar/http/locations/ip_version.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.locations import IPVersionGetResponse, ip_version_get_params +from .....types.radar.http.locations import ip_version_get_params +from .....types.radar.http.locations.ip_version_get_response import IPVersionGetResponse -__all__ = ["IPVersion", "AsyncIPVersion"] +__all__ = ["IPVersionResource", "AsyncIPVersionResource"] -class IPVersion(SyncAPIResource): +class IPVersionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPVersionWithRawResponse: - return IPVersionWithRawResponse(self) + def with_raw_response(self) -> IPVersionResourceWithRawResponse: + return IPVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPVersionWithStreamingResponse: - return IPVersionWithStreamingResponse(self) + def with_streaming_response(self) -> IPVersionResourceWithStreamingResponse: + return IPVersionResourceWithStreamingResponse(self) def get( self, @@ -168,20 +169,20 @@ def get( }, ip_version_get_params.IPVersionGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPVersionGetResponse]._unwrapper, ), cast_to=cast(Type[IPVersionGetResponse], ResultWrapper[IPVersionGetResponse]), ) -class AsyncIPVersion(AsyncAPIResource): +class AsyncIPVersionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPVersionWithRawResponse: - return AsyncIPVersionWithRawResponse(self) + def with_raw_response(self) -> AsyncIPVersionResourceWithRawResponse: + return AsyncIPVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPVersionWithStreamingResponse: - return AsyncIPVersionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPVersionResourceWithStreamingResponse: + return AsyncIPVersionResourceWithStreamingResponse(self) async def get( self, @@ -312,14 +313,14 @@ async def get( }, ip_version_get_params.IPVersionGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IPVersionGetResponse]._unwrapper, ), cast_to=cast(Type[IPVersionGetResponse], ResultWrapper[IPVersionGetResponse]), ) -class IPVersionWithRawResponse: - def __init__(self, ip_version: IPVersion) -> None: +class IPVersionResourceWithRawResponse: + def __init__(self, ip_version: IPVersionResource) -> None: self._ip_version = ip_version self.get = to_raw_response_wrapper( @@ -327,8 +328,8 @@ def __init__(self, ip_version: IPVersion) -> None: ) -class AsyncIPVersionWithRawResponse: - def __init__(self, ip_version: AsyncIPVersion) -> None: +class AsyncIPVersionResourceWithRawResponse: + def __init__(self, ip_version: AsyncIPVersionResource) -> None: self._ip_version = ip_version self.get = async_to_raw_response_wrapper( @@ -336,8 +337,8 @@ def __init__(self, ip_version: AsyncIPVersion) -> None: ) -class IPVersionWithStreamingResponse: - def __init__(self, ip_version: IPVersion) -> None: +class IPVersionResourceWithStreamingResponse: + def __init__(self, ip_version: IPVersionResource) -> None: self._ip_version = ip_version self.get = to_streamed_response_wrapper( @@ -345,8 +346,8 @@ def __init__(self, ip_version: IPVersion) -> None: ) -class AsyncIPVersionWithStreamingResponse: - def __init__(self, ip_version: AsyncIPVersion) -> None: +class AsyncIPVersionResourceWithStreamingResponse: + def __init__(self, ip_version: AsyncIPVersionResource) -> None: self._ip_version = ip_version self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/locations/locations.py b/src/cloudflare/resources/radar/http/locations/locations.py index ae10e926580..63301a082cc 100644 --- a/src/cloudflare/resources/radar/http/locations/locations.py +++ b/src/cloudflare/resources/radar/http/locations/locations.py @@ -9,20 +9,20 @@ import httpx from .os import ( - OS, - AsyncOS, - OSWithRawResponse, - AsyncOSWithRawResponse, - OSWithStreamingResponse, - AsyncOSWithStreamingResponse, + OSResource, + AsyncOSResource, + OSResourceWithRawResponse, + AsyncOSResourceWithRawResponse, + OSResourceWithStreamingResponse, + AsyncOSResourceWithStreamingResponse, ) from .bot_class import ( - BotClass, - AsyncBotClass, - BotClassWithRawResponse, - AsyncBotClassWithRawResponse, - BotClassWithStreamingResponse, - AsyncBotClassWithStreamingResponse, + BotClassResource, + AsyncBotClassResource, + BotClassResourceWithRawResponse, + AsyncBotClassResourceWithRawResponse, + BotClassResourceWithStreamingResponse, + AsyncBotClassResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -30,37 +30,37 @@ async_maybe_transform, ) from .ip_version import ( - IPVersion, - AsyncIPVersion, - IPVersionWithRawResponse, - AsyncIPVersionWithRawResponse, - IPVersionWithStreamingResponse, - AsyncIPVersionWithStreamingResponse, + IPVersionResource, + AsyncIPVersionResource, + IPVersionResourceWithRawResponse, + AsyncIPVersionResourceWithRawResponse, + IPVersionResourceWithStreamingResponse, + AsyncIPVersionResourceWithStreamingResponse, ) from ....._compat import cached_property from .device_type import ( - DeviceType, - AsyncDeviceType, - DeviceTypeWithRawResponse, - AsyncDeviceTypeWithRawResponse, - DeviceTypeWithStreamingResponse, - AsyncDeviceTypeWithStreamingResponse, + DeviceTypeResource, + AsyncDeviceTypeResource, + DeviceTypeResourceWithRawResponse, + AsyncDeviceTypeResourceWithRawResponse, + DeviceTypeResourceWithStreamingResponse, + AsyncDeviceTypeResourceWithStreamingResponse, ) from .http_method import ( - HTTPMethod, - AsyncHTTPMethod, - HTTPMethodWithRawResponse, - AsyncHTTPMethodWithRawResponse, - HTTPMethodWithStreamingResponse, - AsyncHTTPMethodWithStreamingResponse, + HTTPMethodResource, + AsyncHTTPMethodResource, + HTTPMethodResourceWithRawResponse, + AsyncHTTPMethodResourceWithRawResponse, + HTTPMethodResourceWithStreamingResponse, + AsyncHTTPMethodResourceWithStreamingResponse, ) from .tls_version import ( - TLSVersion, - AsyncTLSVersion, - TLSVersionWithRawResponse, - AsyncTLSVersionWithRawResponse, - TLSVersionWithStreamingResponse, - AsyncTLSVersionWithStreamingResponse, + TLSVersionResource, + AsyncTLSVersionResource, + TLSVersionResourceWithRawResponse, + AsyncTLSVersionResourceWithRawResponse, + TLSVersionResourceWithStreamingResponse, + AsyncTLSVersionResourceWithStreamingResponse, ) from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( @@ -71,57 +71,58 @@ ) from ....._wrappers import ResultWrapper from .http_protocol import ( - HTTPProtocol, - AsyncHTTPProtocol, - HTTPProtocolWithRawResponse, - AsyncHTTPProtocolWithRawResponse, - HTTPProtocolWithStreamingResponse, - AsyncHTTPProtocolWithStreamingResponse, + HTTPProtocolResource, + AsyncHTTPProtocolResource, + HTTPProtocolResourceWithRawResponse, + AsyncHTTPProtocolResourceWithRawResponse, + HTTPProtocolResourceWithStreamingResponse, + AsyncHTTPProtocolResourceWithStreamingResponse, ) from ....._base_client import ( make_request_options, ) -from .....types.radar.http import LocationGetResponse, location_get_params +from .....types.radar.http import location_get_params +from .....types.radar.http.location_get_response import LocationGetResponse -__all__ = ["Locations", "AsyncLocations"] +__all__ = ["LocationsResource", "AsyncLocationsResource"] -class Locations(SyncAPIResource): +class LocationsResource(SyncAPIResource): @cached_property - def bot_class(self) -> BotClass: - return BotClass(self._client) + def bot_class(self) -> BotClassResource: + return BotClassResource(self._client) @cached_property - def device_type(self) -> DeviceType: - return DeviceType(self._client) + def device_type(self) -> DeviceTypeResource: + return DeviceTypeResource(self._client) @cached_property - def http_protocol(self) -> HTTPProtocol: - return HTTPProtocol(self._client) + def http_protocol(self) -> HTTPProtocolResource: + return HTTPProtocolResource(self._client) @cached_property - def http_method(self) -> HTTPMethod: - return HTTPMethod(self._client) + def http_method(self) -> HTTPMethodResource: + return HTTPMethodResource(self._client) @cached_property - def ip_version(self) -> IPVersion: - return IPVersion(self._client) + def ip_version(self) -> IPVersionResource: + return IPVersionResource(self._client) @cached_property - def os(self) -> OS: - return OS(self._client) + def os(self) -> OSResource: + return OSResource(self._client) @cached_property - def tls_version(self) -> TLSVersion: - return TLSVersion(self._client) + def tls_version(self) -> TLSVersionResource: + return TLSVersionResource(self._client) @cached_property - def with_raw_response(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self) + def with_raw_response(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self) + def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self) def get( self, @@ -252,48 +253,48 @@ def get( }, location_get_params.LocationGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationGetResponse]._unwrapper, ), cast_to=cast(Type[LocationGetResponse], ResultWrapper[LocationGetResponse]), ) -class AsyncLocations(AsyncAPIResource): +class AsyncLocationsResource(AsyncAPIResource): @cached_property - def bot_class(self) -> AsyncBotClass: - return AsyncBotClass(self._client) + def bot_class(self) -> AsyncBotClassResource: + return AsyncBotClassResource(self._client) @cached_property - def device_type(self) -> AsyncDeviceType: - return AsyncDeviceType(self._client) + def device_type(self) -> AsyncDeviceTypeResource: + return AsyncDeviceTypeResource(self._client) @cached_property - def http_protocol(self) -> AsyncHTTPProtocol: - return AsyncHTTPProtocol(self._client) + def http_protocol(self) -> AsyncHTTPProtocolResource: + return AsyncHTTPProtocolResource(self._client) @cached_property - def http_method(self) -> AsyncHTTPMethod: - return AsyncHTTPMethod(self._client) + def http_method(self) -> AsyncHTTPMethodResource: + return AsyncHTTPMethodResource(self._client) @cached_property - def ip_version(self) -> AsyncIPVersion: - return AsyncIPVersion(self._client) + def ip_version(self) -> AsyncIPVersionResource: + return AsyncIPVersionResource(self._client) @cached_property - def os(self) -> AsyncOS: - return AsyncOS(self._client) + def os(self) -> AsyncOSResource: + return AsyncOSResource(self._client) @cached_property - def tls_version(self) -> AsyncTLSVersion: - return AsyncTLSVersion(self._client) + def tls_version(self) -> AsyncTLSVersionResource: + return AsyncTLSVersionResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self) + def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self) async def get( self, @@ -424,14 +425,14 @@ async def get( }, location_get_params.LocationGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationGetResponse]._unwrapper, ), cast_to=cast(Type[LocationGetResponse], ResultWrapper[LocationGetResponse]), ) -class LocationsWithRawResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithRawResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.get = to_raw_response_wrapper( @@ -439,36 +440,36 @@ def __init__(self, locations: Locations) -> None: ) @cached_property - def bot_class(self) -> BotClassWithRawResponse: - return BotClassWithRawResponse(self._locations.bot_class) + def bot_class(self) -> BotClassResourceWithRawResponse: + return BotClassResourceWithRawResponse(self._locations.bot_class) @cached_property - def device_type(self) -> DeviceTypeWithRawResponse: - return DeviceTypeWithRawResponse(self._locations.device_type) + def device_type(self) -> DeviceTypeResourceWithRawResponse: + return DeviceTypeResourceWithRawResponse(self._locations.device_type) @cached_property - def http_protocol(self) -> HTTPProtocolWithRawResponse: - return HTTPProtocolWithRawResponse(self._locations.http_protocol) + def http_protocol(self) -> HTTPProtocolResourceWithRawResponse: + return HTTPProtocolResourceWithRawResponse(self._locations.http_protocol) @cached_property - def http_method(self) -> HTTPMethodWithRawResponse: - return HTTPMethodWithRawResponse(self._locations.http_method) + def http_method(self) -> HTTPMethodResourceWithRawResponse: + return HTTPMethodResourceWithRawResponse(self._locations.http_method) @cached_property - def ip_version(self) -> IPVersionWithRawResponse: - return IPVersionWithRawResponse(self._locations.ip_version) + def ip_version(self) -> IPVersionResourceWithRawResponse: + return IPVersionResourceWithRawResponse(self._locations.ip_version) @cached_property - def os(self) -> OSWithRawResponse: - return OSWithRawResponse(self._locations.os) + def os(self) -> OSResourceWithRawResponse: + return OSResourceWithRawResponse(self._locations.os) @cached_property - def tls_version(self) -> TLSVersionWithRawResponse: - return TLSVersionWithRawResponse(self._locations.tls_version) + def tls_version(self) -> TLSVersionResourceWithRawResponse: + return TLSVersionResourceWithRawResponse(self._locations.tls_version) -class AsyncLocationsWithRawResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithRawResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.get = async_to_raw_response_wrapper( @@ -476,36 +477,36 @@ def __init__(self, locations: AsyncLocations) -> None: ) @cached_property - def bot_class(self) -> AsyncBotClassWithRawResponse: - return AsyncBotClassWithRawResponse(self._locations.bot_class) + def bot_class(self) -> AsyncBotClassResourceWithRawResponse: + return AsyncBotClassResourceWithRawResponse(self._locations.bot_class) @cached_property - def device_type(self) -> AsyncDeviceTypeWithRawResponse: - return AsyncDeviceTypeWithRawResponse(self._locations.device_type) + def device_type(self) -> AsyncDeviceTypeResourceWithRawResponse: + return AsyncDeviceTypeResourceWithRawResponse(self._locations.device_type) @cached_property - def http_protocol(self) -> AsyncHTTPProtocolWithRawResponse: - return AsyncHTTPProtocolWithRawResponse(self._locations.http_protocol) + def http_protocol(self) -> AsyncHTTPProtocolResourceWithRawResponse: + return AsyncHTTPProtocolResourceWithRawResponse(self._locations.http_protocol) @cached_property - def http_method(self) -> AsyncHTTPMethodWithRawResponse: - return AsyncHTTPMethodWithRawResponse(self._locations.http_method) + def http_method(self) -> AsyncHTTPMethodResourceWithRawResponse: + return AsyncHTTPMethodResourceWithRawResponse(self._locations.http_method) @cached_property - def ip_version(self) -> AsyncIPVersionWithRawResponse: - return AsyncIPVersionWithRawResponse(self._locations.ip_version) + def ip_version(self) -> AsyncIPVersionResourceWithRawResponse: + return AsyncIPVersionResourceWithRawResponse(self._locations.ip_version) @cached_property - def os(self) -> AsyncOSWithRawResponse: - return AsyncOSWithRawResponse(self._locations.os) + def os(self) -> AsyncOSResourceWithRawResponse: + return AsyncOSResourceWithRawResponse(self._locations.os) @cached_property - def tls_version(self) -> AsyncTLSVersionWithRawResponse: - return AsyncTLSVersionWithRawResponse(self._locations.tls_version) + def tls_version(self) -> AsyncTLSVersionResourceWithRawResponse: + return AsyncTLSVersionResourceWithRawResponse(self._locations.tls_version) -class LocationsWithStreamingResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithStreamingResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.get = to_streamed_response_wrapper( @@ -513,36 +514,36 @@ def __init__(self, locations: Locations) -> None: ) @cached_property - def bot_class(self) -> BotClassWithStreamingResponse: - return BotClassWithStreamingResponse(self._locations.bot_class) + def bot_class(self) -> BotClassResourceWithStreamingResponse: + return BotClassResourceWithStreamingResponse(self._locations.bot_class) @cached_property - def device_type(self) -> DeviceTypeWithStreamingResponse: - return DeviceTypeWithStreamingResponse(self._locations.device_type) + def device_type(self) -> DeviceTypeResourceWithStreamingResponse: + return DeviceTypeResourceWithStreamingResponse(self._locations.device_type) @cached_property - def http_protocol(self) -> HTTPProtocolWithStreamingResponse: - return HTTPProtocolWithStreamingResponse(self._locations.http_protocol) + def http_protocol(self) -> HTTPProtocolResourceWithStreamingResponse: + return HTTPProtocolResourceWithStreamingResponse(self._locations.http_protocol) @cached_property - def http_method(self) -> HTTPMethodWithStreamingResponse: - return HTTPMethodWithStreamingResponse(self._locations.http_method) + def http_method(self) -> HTTPMethodResourceWithStreamingResponse: + return HTTPMethodResourceWithStreamingResponse(self._locations.http_method) @cached_property - def ip_version(self) -> IPVersionWithStreamingResponse: - return IPVersionWithStreamingResponse(self._locations.ip_version) + def ip_version(self) -> IPVersionResourceWithStreamingResponse: + return IPVersionResourceWithStreamingResponse(self._locations.ip_version) @cached_property - def os(self) -> OSWithStreamingResponse: - return OSWithStreamingResponse(self._locations.os) + def os(self) -> OSResourceWithStreamingResponse: + return OSResourceWithStreamingResponse(self._locations.os) @cached_property - def tls_version(self) -> TLSVersionWithStreamingResponse: - return TLSVersionWithStreamingResponse(self._locations.tls_version) + def tls_version(self) -> TLSVersionResourceWithStreamingResponse: + return TLSVersionResourceWithStreamingResponse(self._locations.tls_version) -class AsyncLocationsWithStreamingResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithStreamingResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.get = async_to_streamed_response_wrapper( @@ -550,29 +551,29 @@ def __init__(self, locations: AsyncLocations) -> None: ) @cached_property - def bot_class(self) -> AsyncBotClassWithStreamingResponse: - return AsyncBotClassWithStreamingResponse(self._locations.bot_class) + def bot_class(self) -> AsyncBotClassResourceWithStreamingResponse: + return AsyncBotClassResourceWithStreamingResponse(self._locations.bot_class) @cached_property - def device_type(self) -> AsyncDeviceTypeWithStreamingResponse: - return AsyncDeviceTypeWithStreamingResponse(self._locations.device_type) + def device_type(self) -> AsyncDeviceTypeResourceWithStreamingResponse: + return AsyncDeviceTypeResourceWithStreamingResponse(self._locations.device_type) @cached_property - def http_protocol(self) -> AsyncHTTPProtocolWithStreamingResponse: - return AsyncHTTPProtocolWithStreamingResponse(self._locations.http_protocol) + def http_protocol(self) -> AsyncHTTPProtocolResourceWithStreamingResponse: + return AsyncHTTPProtocolResourceWithStreamingResponse(self._locations.http_protocol) @cached_property - def http_method(self) -> AsyncHTTPMethodWithStreamingResponse: - return AsyncHTTPMethodWithStreamingResponse(self._locations.http_method) + def http_method(self) -> AsyncHTTPMethodResourceWithStreamingResponse: + return AsyncHTTPMethodResourceWithStreamingResponse(self._locations.http_method) @cached_property - def ip_version(self) -> AsyncIPVersionWithStreamingResponse: - return AsyncIPVersionWithStreamingResponse(self._locations.ip_version) + def ip_version(self) -> AsyncIPVersionResourceWithStreamingResponse: + return AsyncIPVersionResourceWithStreamingResponse(self._locations.ip_version) @cached_property - def os(self) -> AsyncOSWithStreamingResponse: - return AsyncOSWithStreamingResponse(self._locations.os) + def os(self) -> AsyncOSResourceWithStreamingResponse: + return AsyncOSResourceWithStreamingResponse(self._locations.os) @cached_property - def tls_version(self) -> AsyncTLSVersionWithStreamingResponse: - return AsyncTLSVersionWithStreamingResponse(self._locations.tls_version) + def tls_version(self) -> AsyncTLSVersionResourceWithStreamingResponse: + return AsyncTLSVersionResourceWithStreamingResponse(self._locations.tls_version) diff --git a/src/cloudflare/resources/radar/http/locations/os.py b/src/cloudflare/resources/radar/http/locations/os.py index 2059f0375d8..6564789c347 100644 --- a/src/cloudflare/resources/radar/http/locations/os.py +++ b/src/cloudflare/resources/radar/http/locations/os.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.locations import OSGetResponse, os_get_params +from .....types.radar.http.locations import os_get_params +from .....types.radar.http.locations.os_get_response import OSGetResponse -__all__ = ["OS", "AsyncOS"] +__all__ = ["OSResource", "AsyncOSResource"] -class OS(SyncAPIResource): +class OSResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OSWithRawResponse: - return OSWithRawResponse(self) + def with_raw_response(self) -> OSResourceWithRawResponse: + return OSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OSWithStreamingResponse: - return OSWithStreamingResponse(self) + def with_streaming_response(self) -> OSResourceWithStreamingResponse: + return OSResourceWithStreamingResponse(self) def get( self, @@ -167,20 +168,20 @@ def get( }, os_get_params.OSGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OSGetResponse]._unwrapper, ), cast_to=cast(Type[OSGetResponse], ResultWrapper[OSGetResponse]), ) -class AsyncOS(AsyncAPIResource): +class AsyncOSResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOSWithRawResponse: - return AsyncOSWithRawResponse(self) + def with_raw_response(self) -> AsyncOSResourceWithRawResponse: + return AsyncOSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOSWithStreamingResponse: - return AsyncOSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOSResourceWithStreamingResponse: + return AsyncOSResourceWithStreamingResponse(self) async def get( self, @@ -310,14 +311,14 @@ async def get( }, os_get_params.OSGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OSGetResponse]._unwrapper, ), cast_to=cast(Type[OSGetResponse], ResultWrapper[OSGetResponse]), ) -class OSWithRawResponse: - def __init__(self, os: OS) -> None: +class OSResourceWithRawResponse: + def __init__(self, os: OSResource) -> None: self._os = os self.get = to_raw_response_wrapper( @@ -325,8 +326,8 @@ def __init__(self, os: OS) -> None: ) -class AsyncOSWithRawResponse: - def __init__(self, os: AsyncOS) -> None: +class AsyncOSResourceWithRawResponse: + def __init__(self, os: AsyncOSResource) -> None: self._os = os self.get = async_to_raw_response_wrapper( @@ -334,8 +335,8 @@ def __init__(self, os: AsyncOS) -> None: ) -class OSWithStreamingResponse: - def __init__(self, os: OS) -> None: +class OSResourceWithStreamingResponse: + def __init__(self, os: OSResource) -> None: self._os = os self.get = to_streamed_response_wrapper( @@ -343,8 +344,8 @@ def __init__(self, os: OS) -> None: ) -class AsyncOSWithStreamingResponse: - def __init__(self, os: AsyncOS) -> None: +class AsyncOSResourceWithStreamingResponse: + def __init__(self, os: AsyncOSResource) -> None: self._os = os self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/locations/tls_version.py b/src/cloudflare/resources/radar/http/locations/tls_version.py index 835905f6b94..9a43d75f252 100644 --- a/src/cloudflare/resources/radar/http/locations/tls_version.py +++ b/src/cloudflare/resources/radar/http/locations/tls_version.py @@ -25,19 +25,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.http.locations import TLSVersionGetResponse, tls_version_get_params +from .....types.radar.http.locations import tls_version_get_params +from .....types.radar.http.locations.tls_version_get_response import TLSVersionGetResponse -__all__ = ["TLSVersion", "AsyncTLSVersion"] +__all__ = ["TLSVersionResource", "AsyncTLSVersionResource"] -class TLSVersion(SyncAPIResource): +class TLSVersionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TLSVersionWithRawResponse: - return TLSVersionWithRawResponse(self) + def with_raw_response(self) -> TLSVersionResourceWithRawResponse: + return TLSVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TLSVersionWithStreamingResponse: - return TLSVersionWithStreamingResponse(self) + def with_streaming_response(self) -> TLSVersionResourceWithStreamingResponse: + return TLSVersionResourceWithStreamingResponse(self) def get( self, @@ -168,20 +169,20 @@ def get( }, tls_version_get_params.TLSVersionGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TLSVersionGetResponse]._unwrapper, ), cast_to=cast(Type[TLSVersionGetResponse], ResultWrapper[TLSVersionGetResponse]), ) -class AsyncTLSVersion(AsyncAPIResource): +class AsyncTLSVersionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTLSVersionWithRawResponse: - return AsyncTLSVersionWithRawResponse(self) + def with_raw_response(self) -> AsyncTLSVersionResourceWithRawResponse: + return AsyncTLSVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTLSVersionWithStreamingResponse: - return AsyncTLSVersionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTLSVersionResourceWithStreamingResponse: + return AsyncTLSVersionResourceWithStreamingResponse(self) async def get( self, @@ -312,14 +313,14 @@ async def get( }, tls_version_get_params.TLSVersionGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TLSVersionGetResponse]._unwrapper, ), cast_to=cast(Type[TLSVersionGetResponse], ResultWrapper[TLSVersionGetResponse]), ) -class TLSVersionWithRawResponse: - def __init__(self, tls_version: TLSVersion) -> None: +class TLSVersionResourceWithRawResponse: + def __init__(self, tls_version: TLSVersionResource) -> None: self._tls_version = tls_version self.get = to_raw_response_wrapper( @@ -327,8 +328,8 @@ def __init__(self, tls_version: TLSVersion) -> None: ) -class AsyncTLSVersionWithRawResponse: - def __init__(self, tls_version: AsyncTLSVersion) -> None: +class AsyncTLSVersionResourceWithRawResponse: + def __init__(self, tls_version: AsyncTLSVersionResource) -> None: self._tls_version = tls_version self.get = async_to_raw_response_wrapper( @@ -336,8 +337,8 @@ def __init__(self, tls_version: AsyncTLSVersion) -> None: ) -class TLSVersionWithStreamingResponse: - def __init__(self, tls_version: TLSVersion) -> None: +class TLSVersionResourceWithStreamingResponse: + def __init__(self, tls_version: TLSVersionResource) -> None: self._tls_version = tls_version self.get = to_streamed_response_wrapper( @@ -345,8 +346,8 @@ def __init__(self, tls_version: TLSVersion) -> None: ) -class AsyncTLSVersionWithStreamingResponse: - def __init__(self, tls_version: AsyncTLSVersion) -> None: +class AsyncTLSVersionResourceWithStreamingResponse: + def __init__(self, tls_version: AsyncTLSVersionResource) -> None: self._tls_version = tls_version self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/summary.py b/src/cloudflare/resources/radar/http/summary.py index c823e9908cc..7e71b2aa987 100644 --- a/src/cloudflare/resources/radar/http/summary.py +++ b/src/cloudflare/resources/radar/http/summary.py @@ -26,13 +26,6 @@ make_request_options, ) from ....types.radar.http import ( - SummaryOSResponse, - SummaryBotClassResponse, - SummaryIPVersionResponse, - SummaryDeviceTypeResponse, - SummaryTLSVersionResponse, - SummaryHTTPVersionResponse, - SummaryHTTPProtocolResponse, summary_os_params, summary_bot_class_params, summary_ip_version_params, @@ -41,18 +34,25 @@ summary_http_version_params, summary_http_protocol_params, ) +from ....types.radar.http.summary_os_response import SummaryOSResponse +from ....types.radar.http.summary_bot_class_response import SummaryBotClassResponse +from ....types.radar.http.summary_ip_version_response import SummaryIPVersionResponse +from ....types.radar.http.summary_device_type_response import SummaryDeviceTypeResponse +from ....types.radar.http.summary_tls_version_response import SummaryTLSVersionResponse +from ....types.radar.http.summary_http_version_response import SummaryHTTPVersionResponse +from ....types.radar.http.summary_http_protocol_response import SummaryHTTPProtocolResponse -__all__ = ["Summary", "AsyncSummary"] +__all__ = ["SummaryResource", "AsyncSummaryResource"] -class Summary(SyncAPIResource): +class SummaryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SummaryWithRawResponse: - return SummaryWithRawResponse(self) + def with_raw_response(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SummaryWithStreamingResponse: - return SummaryWithStreamingResponse(self) + def with_streaming_response(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self) def bot_class( self, @@ -175,7 +175,7 @@ def bot_class( }, summary_bot_class_params.SummaryBotClassParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryBotClassResponse]._unwrapper, ), cast_to=cast(Type[SummaryBotClassResponse], ResultWrapper[SummaryBotClassResponse]), ) @@ -300,7 +300,7 @@ def device_type( }, summary_device_type_params.SummaryDeviceTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDeviceTypeResponse]._unwrapper, ), cast_to=cast(Type[SummaryDeviceTypeResponse], ResultWrapper[SummaryDeviceTypeResponse]), ) @@ -424,7 +424,7 @@ def http_protocol( }, summary_http_protocol_params.SummaryHTTPProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryHTTPProtocolResponse]._unwrapper, ), cast_to=cast(Type[SummaryHTTPProtocolResponse], ResultWrapper[SummaryHTTPProtocolResponse]), ) @@ -549,7 +549,7 @@ def http_version( }, summary_http_version_params.SummaryHTTPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryHTTPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryHTTPVersionResponse], ResultWrapper[SummaryHTTPVersionResponse]), ) @@ -674,7 +674,7 @@ def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -798,7 +798,7 @@ def os( }, summary_os_params.SummaryOSParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryOSResponse]._unwrapper, ), cast_to=cast(Type[SummaryOSResponse], ResultWrapper[SummaryOSResponse]), ) @@ -923,20 +923,20 @@ def tls_version( }, summary_tls_version_params.SummaryTLSVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryTLSVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryTLSVersionResponse], ResultWrapper[SummaryTLSVersionResponse]), ) -class AsyncSummary(AsyncAPIResource): +class AsyncSummaryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSummaryWithRawResponse: - return AsyncSummaryWithRawResponse(self) + def with_raw_response(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSummaryWithStreamingResponse: - return AsyncSummaryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self) async def bot_class( self, @@ -1059,7 +1059,7 @@ async def bot_class( }, summary_bot_class_params.SummaryBotClassParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryBotClassResponse]._unwrapper, ), cast_to=cast(Type[SummaryBotClassResponse], ResultWrapper[SummaryBotClassResponse]), ) @@ -1184,7 +1184,7 @@ async def device_type( }, summary_device_type_params.SummaryDeviceTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryDeviceTypeResponse]._unwrapper, ), cast_to=cast(Type[SummaryDeviceTypeResponse], ResultWrapper[SummaryDeviceTypeResponse]), ) @@ -1308,7 +1308,7 @@ async def http_protocol( }, summary_http_protocol_params.SummaryHTTPProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryHTTPProtocolResponse]._unwrapper, ), cast_to=cast(Type[SummaryHTTPProtocolResponse], ResultWrapper[SummaryHTTPProtocolResponse]), ) @@ -1433,7 +1433,7 @@ async def http_version( }, summary_http_version_params.SummaryHTTPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryHTTPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryHTTPVersionResponse], ResultWrapper[SummaryHTTPVersionResponse]), ) @@ -1558,7 +1558,7 @@ async def ip_version( }, summary_ip_version_params.SummaryIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryIPVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryIPVersionResponse], ResultWrapper[SummaryIPVersionResponse]), ) @@ -1682,7 +1682,7 @@ async def os( }, summary_os_params.SummaryOSParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryOSResponse]._unwrapper, ), cast_to=cast(Type[SummaryOSResponse], ResultWrapper[SummaryOSResponse]), ) @@ -1807,14 +1807,14 @@ async def tls_version( }, summary_tls_version_params.SummaryTLSVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SummaryTLSVersionResponse]._unwrapper, ), cast_to=cast(Type[SummaryTLSVersionResponse], ResultWrapper[SummaryTLSVersionResponse]), ) -class SummaryWithRawResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithRawResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.bot_class = to_raw_response_wrapper( @@ -1840,8 +1840,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithRawResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithRawResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.bot_class = async_to_raw_response_wrapper( @@ -1867,8 +1867,8 @@ def __init__(self, summary: AsyncSummary) -> None: ) -class SummaryWithStreamingResponse: - def __init__(self, summary: Summary) -> None: +class SummaryResourceWithStreamingResponse: + def __init__(self, summary: SummaryResource) -> None: self._summary = summary self.bot_class = to_streamed_response_wrapper( @@ -1894,8 +1894,8 @@ def __init__(self, summary: Summary) -> None: ) -class AsyncSummaryWithStreamingResponse: - def __init__(self, summary: AsyncSummary) -> None: +class AsyncSummaryResourceWithStreamingResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: self._summary = summary self.bot_class = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/timeseries_groups.py b/src/cloudflare/resources/radar/http/timeseries_groups.py index 589c540ae0a..4ba8bea28f9 100644 --- a/src/cloudflare/resources/radar/http/timeseries_groups.py +++ b/src/cloudflare/resources/radar/http/timeseries_groups.py @@ -26,15 +26,6 @@ make_request_options, ) from ....types.radar.http import ( - TimeseriesGroupOSResponse, - TimeseriesGroupBrowserResponse, - TimeseriesGroupBotClassResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupDeviceTypeResponse, - TimeseriesGroupTLSVersionResponse, - TimeseriesGroupHTTPVersionResponse, - TimeseriesGroupHTTPProtocolResponse, - TimeseriesGroupBrowserFamilyResponse, timeseries_group_os_params, timeseries_group_browser_params, timeseries_group_bot_class_params, @@ -45,18 +36,27 @@ timeseries_group_http_protocol_params, timeseries_group_browser_family_params, ) +from ....types.radar.http.timeseries_group_os_response import TimeseriesGroupOSResponse +from ....types.radar.http.timeseries_group_browser_response import TimeseriesGroupBrowserResponse +from ....types.radar.http.timeseries_group_bot_class_response import TimeseriesGroupBotClassResponse +from ....types.radar.http.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse +from ....types.radar.http.timeseries_group_device_type_response import TimeseriesGroupDeviceTypeResponse +from ....types.radar.http.timeseries_group_tls_version_response import TimeseriesGroupTLSVersionResponse +from ....types.radar.http.timeseries_group_http_version_response import TimeseriesGroupHTTPVersionResponse +from ....types.radar.http.timeseries_group_http_protocol_response import TimeseriesGroupHTTPProtocolResponse +from ....types.radar.http.timeseries_group_browser_family_response import TimeseriesGroupBrowserFamilyResponse -__all__ = ["TimeseriesGroups", "AsyncTimeseriesGroups"] +__all__ = ["TimeseriesGroupsResource", "AsyncTimeseriesGroupsResource"] -class TimeseriesGroups(SyncAPIResource): +class TimeseriesGroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TimeseriesGroupsWithRawResponse: - return TimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> TimeseriesGroupsResourceWithRawResponse: + return TimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TimeseriesGroupsWithStreamingResponse: - return TimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> TimeseriesGroupsResourceWithStreamingResponse: + return TimeseriesGroupsResourceWithStreamingResponse(self) def bot_class( self, @@ -185,7 +185,7 @@ def bot_class( }, timeseries_group_bot_class_params.TimeseriesGroupBotClassParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupBotClassResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupBotClassResponse], ResultWrapper[TimeseriesGroupBotClassResponse]), ) @@ -325,7 +325,7 @@ def browser( }, timeseries_group_browser_params.TimeseriesGroupBrowserParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupBrowserResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupBrowserResponse], ResultWrapper[TimeseriesGroupBrowserResponse]), ) @@ -460,7 +460,7 @@ def browser_family( }, timeseries_group_browser_family_params.TimeseriesGroupBrowserFamilyParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupBrowserFamilyResponse]._unwrapper, ), cast_to=cast( Type[TimeseriesGroupBrowserFamilyResponse], ResultWrapper[TimeseriesGroupBrowserFamilyResponse] @@ -592,7 +592,7 @@ def device_type( }, timeseries_group_device_type_params.TimeseriesGroupDeviceTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDeviceTypeResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDeviceTypeResponse], ResultWrapper[TimeseriesGroupDeviceTypeResponse]), ) @@ -722,7 +722,7 @@ def http_protocol( }, timeseries_group_http_protocol_params.TimeseriesGroupHTTPProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupHTTPProtocolResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupHTTPProtocolResponse], ResultWrapper[TimeseriesGroupHTTPProtocolResponse]), ) @@ -853,7 +853,7 @@ def http_version( }, timeseries_group_http_version_params.TimeseriesGroupHTTPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupHTTPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupHTTPVersionResponse], ResultWrapper[TimeseriesGroupHTTPVersionResponse]), ) @@ -984,7 +984,7 @@ def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -1114,7 +1114,7 @@ def os( }, timeseries_group_os_params.TimeseriesGroupOSParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupOSResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupOSResponse], ResultWrapper[TimeseriesGroupOSResponse]), ) @@ -1245,20 +1245,20 @@ def tls_version( }, timeseries_group_tls_version_params.TimeseriesGroupTLSVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupTLSVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupTLSVersionResponse], ResultWrapper[TimeseriesGroupTLSVersionResponse]), ) -class AsyncTimeseriesGroups(AsyncAPIResource): +class AsyncTimeseriesGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTimeseriesGroupsWithRawResponse: - return AsyncTimeseriesGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncTimeseriesGroupsResourceWithRawResponse: + return AsyncTimeseriesGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTimeseriesGroupsWithStreamingResponse: - return AsyncTimeseriesGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTimeseriesGroupsResourceWithStreamingResponse: + return AsyncTimeseriesGroupsResourceWithStreamingResponse(self) async def bot_class( self, @@ -1387,7 +1387,7 @@ async def bot_class( }, timeseries_group_bot_class_params.TimeseriesGroupBotClassParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupBotClassResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupBotClassResponse], ResultWrapper[TimeseriesGroupBotClassResponse]), ) @@ -1527,7 +1527,7 @@ async def browser( }, timeseries_group_browser_params.TimeseriesGroupBrowserParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupBrowserResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupBrowserResponse], ResultWrapper[TimeseriesGroupBrowserResponse]), ) @@ -1662,7 +1662,7 @@ async def browser_family( }, timeseries_group_browser_family_params.TimeseriesGroupBrowserFamilyParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupBrowserFamilyResponse]._unwrapper, ), cast_to=cast( Type[TimeseriesGroupBrowserFamilyResponse], ResultWrapper[TimeseriesGroupBrowserFamilyResponse] @@ -1794,7 +1794,7 @@ async def device_type( }, timeseries_group_device_type_params.TimeseriesGroupDeviceTypeParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupDeviceTypeResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupDeviceTypeResponse], ResultWrapper[TimeseriesGroupDeviceTypeResponse]), ) @@ -1924,7 +1924,7 @@ async def http_protocol( }, timeseries_group_http_protocol_params.TimeseriesGroupHTTPProtocolParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupHTTPProtocolResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupHTTPProtocolResponse], ResultWrapper[TimeseriesGroupHTTPProtocolResponse]), ) @@ -2055,7 +2055,7 @@ async def http_version( }, timeseries_group_http_version_params.TimeseriesGroupHTTPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupHTTPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupHTTPVersionResponse], ResultWrapper[TimeseriesGroupHTTPVersionResponse]), ) @@ -2186,7 +2186,7 @@ async def ip_version( }, timeseries_group_ip_version_params.TimeseriesGroupIPVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupIPVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupIPVersionResponse], ResultWrapper[TimeseriesGroupIPVersionResponse]), ) @@ -2316,7 +2316,7 @@ async def os( }, timeseries_group_os_params.TimeseriesGroupOSParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupOSResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupOSResponse], ResultWrapper[TimeseriesGroupOSResponse]), ) @@ -2447,14 +2447,14 @@ async def tls_version( }, timeseries_group_tls_version_params.TimeseriesGroupTLSVersionParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TimeseriesGroupTLSVersionResponse]._unwrapper, ), cast_to=cast(Type[TimeseriesGroupTLSVersionResponse], ResultWrapper[TimeseriesGroupTLSVersionResponse]), ) -class TimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.bot_class = to_raw_response_wrapper( @@ -2486,8 +2486,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithRawResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithRawResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.bot_class = async_to_raw_response_wrapper( @@ -2519,8 +2519,8 @@ def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: ) -class TimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: TimeseriesGroups) -> None: +class TimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: TimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.bot_class = to_streamed_response_wrapper( @@ -2552,8 +2552,8 @@ def __init__(self, timeseries_groups: TimeseriesGroups) -> None: ) -class AsyncTimeseriesGroupsWithStreamingResponse: - def __init__(self, timeseries_groups: AsyncTimeseriesGroups) -> None: +class AsyncTimeseriesGroupsResourceWithStreamingResponse: + def __init__(self, timeseries_groups: AsyncTimeseriesGroupsResource) -> None: self._timeseries_groups = timeseries_groups self.bot_class = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/http/top.py b/src/cloudflare/resources/radar/http/top.py index f2a08f8343b..b96c3aa3671 100644 --- a/src/cloudflare/resources/radar/http/top.py +++ b/src/cloudflare/resources/radar/http/top.py @@ -25,24 +25,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.http import ( - TopBrowsersResponse, - TopBrowserFamiliesResponse, - top_browsers_params, - top_browser_families_params, -) +from ....types.radar.http import top_browsers_params, top_browser_families_params +from ....types.radar.http.top_browsers_response import TopBrowsersResponse +from ....types.radar.http.top_browser_families_response import TopBrowserFamiliesResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def browser_families( self, @@ -173,7 +170,7 @@ def browser_families( }, top_browser_families_params.TopBrowserFamiliesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopBrowserFamiliesResponse]._unwrapper, ), cast_to=cast(Type[TopBrowserFamiliesResponse], ResultWrapper[TopBrowserFamiliesResponse]), ) @@ -307,20 +304,20 @@ def browsers( }, top_browsers_params.TopBrowsersParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopBrowsersResponse]._unwrapper, ), cast_to=cast(Type[TopBrowsersResponse], ResultWrapper[TopBrowsersResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def browser_families( self, @@ -451,7 +448,7 @@ async def browser_families( }, top_browser_families_params.TopBrowserFamiliesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopBrowserFamiliesResponse]._unwrapper, ), cast_to=cast(Type[TopBrowserFamiliesResponse], ResultWrapper[TopBrowserFamiliesResponse]), ) @@ -585,14 +582,14 @@ async def browsers( }, top_browsers_params.TopBrowsersParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopBrowsersResponse]._unwrapper, ), cast_to=cast(Type[TopBrowsersResponse], ResultWrapper[TopBrowsersResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.browser_families = to_raw_response_wrapper( @@ -603,8 +600,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.browser_families = async_to_raw_response_wrapper( @@ -615,8 +612,8 @@ def __init__(self, top: AsyncTop) -> None: ) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.browser_families = to_streamed_response_wrapper( @@ -627,8 +624,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.browser_families = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/netflows/__init__.py b/src/cloudflare/resources/radar/netflows/__init__.py index 51c07505600..a98978678b8 100644 --- a/src/cloudflare/resources/radar/netflows/__init__.py +++ b/src/cloudflare/resources/radar/netflows/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .netflows import ( - Netflows, - AsyncNetflows, - NetflowsWithRawResponse, - AsyncNetflowsWithRawResponse, - NetflowsWithStreamingResponse, - AsyncNetflowsWithStreamingResponse, + NetflowsResource, + AsyncNetflowsResource, + NetflowsResourceWithRawResponse, + AsyncNetflowsResourceWithRawResponse, + NetflowsResourceWithStreamingResponse, + AsyncNetflowsResourceWithStreamingResponse, ) __all__ = [ - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "Netflows", - "AsyncNetflows", - "NetflowsWithRawResponse", - "AsyncNetflowsWithRawResponse", - "NetflowsWithStreamingResponse", - "AsyncNetflowsWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "NetflowsResource", + "AsyncNetflowsResource", + "NetflowsResourceWithRawResponse", + "AsyncNetflowsResourceWithRawResponse", + "NetflowsResourceWithStreamingResponse", + "AsyncNetflowsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/netflows/netflows.py b/src/cloudflare/resources/radar/netflows/netflows.py index 70cd86562c0..b82345a5b43 100644 --- a/src/cloudflare/resources/radar/netflows/netflows.py +++ b/src/cloudflare/resources/radar/netflows/netflows.py @@ -9,12 +9,12 @@ import httpx from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -30,26 +30,27 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.radar import NetflowTimeseriesResponse, netflow_timeseries_params +from ....types.radar import netflow_timeseries_params from ...._base_client import ( make_request_options, ) +from ....types.radar.netflow_timeseries_response import NetflowTimeseriesResponse -__all__ = ["Netflows", "AsyncNetflows"] +__all__ = ["NetflowsResource", "AsyncNetflowsResource"] -class Netflows(SyncAPIResource): +class NetflowsResource(SyncAPIResource): @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def with_raw_response(self) -> NetflowsWithRawResponse: - return NetflowsWithRawResponse(self) + def with_raw_response(self) -> NetflowsResourceWithRawResponse: + return NetflowsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NetflowsWithStreamingResponse: - return NetflowsWithStreamingResponse(self) + def with_streaming_response(self) -> NetflowsResourceWithStreamingResponse: + return NetflowsResourceWithStreamingResponse(self) def timeseries( self, @@ -161,24 +162,24 @@ def timeseries( }, netflow_timeseries_params.NetflowTimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[NetflowTimeseriesResponse]._unwrapper, ), cast_to=cast(Type[NetflowTimeseriesResponse], ResultWrapper[NetflowTimeseriesResponse]), ) -class AsyncNetflows(AsyncAPIResource): +class AsyncNetflowsResource(AsyncAPIResource): @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def with_raw_response(self) -> AsyncNetflowsWithRawResponse: - return AsyncNetflowsWithRawResponse(self) + def with_raw_response(self) -> AsyncNetflowsResourceWithRawResponse: + return AsyncNetflowsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNetflowsWithStreamingResponse: - return AsyncNetflowsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNetflowsResourceWithStreamingResponse: + return AsyncNetflowsResourceWithStreamingResponse(self) async def timeseries( self, @@ -290,14 +291,14 @@ async def timeseries( }, netflow_timeseries_params.NetflowTimeseriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[NetflowTimeseriesResponse]._unwrapper, ), cast_to=cast(Type[NetflowTimeseriesResponse], ResultWrapper[NetflowTimeseriesResponse]), ) -class NetflowsWithRawResponse: - def __init__(self, netflows: Netflows) -> None: +class NetflowsResourceWithRawResponse: + def __init__(self, netflows: NetflowsResource) -> None: self._netflows = netflows self.timeseries = to_raw_response_wrapper( @@ -305,12 +306,12 @@ def __init__(self, netflows: Netflows) -> None: ) @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._netflows.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._netflows.top) -class AsyncNetflowsWithRawResponse: - def __init__(self, netflows: AsyncNetflows) -> None: +class AsyncNetflowsResourceWithRawResponse: + def __init__(self, netflows: AsyncNetflowsResource) -> None: self._netflows = netflows self.timeseries = async_to_raw_response_wrapper( @@ -318,12 +319,12 @@ def __init__(self, netflows: AsyncNetflows) -> None: ) @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._netflows.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._netflows.top) -class NetflowsWithStreamingResponse: - def __init__(self, netflows: Netflows) -> None: +class NetflowsResourceWithStreamingResponse: + def __init__(self, netflows: NetflowsResource) -> None: self._netflows = netflows self.timeseries = to_streamed_response_wrapper( @@ -331,12 +332,12 @@ def __init__(self, netflows: Netflows) -> None: ) @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._netflows.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._netflows.top) -class AsyncNetflowsWithStreamingResponse: - def __init__(self, netflows: AsyncNetflows) -> None: +class AsyncNetflowsResourceWithStreamingResponse: + def __init__(self, netflows: AsyncNetflowsResource) -> None: self._netflows = netflows self.timeseries = async_to_streamed_response_wrapper( @@ -344,5 +345,5 @@ def __init__(self, netflows: AsyncNetflows) -> None: ) @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._netflows.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._netflows.top) diff --git a/src/cloudflare/resources/radar/netflows/top.py b/src/cloudflare/resources/radar/netflows/top.py index e4b41758ab0..310e0a90323 100644 --- a/src/cloudflare/resources/radar/netflows/top.py +++ b/src/cloudflare/resources/radar/netflows/top.py @@ -25,19 +25,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.netflows import TopAsesResponse, TopLocationsResponse, top_ases_params, top_locations_params +from ....types.radar.netflows import top_ases_params, top_locations_params +from ....types.radar.netflows.top_ases_response import TopAsesResponse +from ....types.radar.netflows.top_locations_response import TopLocationsResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def ases( self, @@ -137,7 +139,7 @@ def ases( }, top_ases_params.TopAsesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAsesResponse]._unwrapper, ), cast_to=cast(Type[TopAsesResponse], ResultWrapper[TopAsesResponse]), ) @@ -240,20 +242,20 @@ def locations( }, top_locations_params.TopLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopLocationsResponse]._unwrapper, ), cast_to=cast(Type[TopLocationsResponse], ResultWrapper[TopLocationsResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def ases( self, @@ -353,7 +355,7 @@ async def ases( }, top_ases_params.TopAsesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAsesResponse]._unwrapper, ), cast_to=cast(Type[TopAsesResponse], ResultWrapper[TopAsesResponse]), ) @@ -456,14 +458,14 @@ async def locations( }, top_locations_params.TopLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopLocationsResponse]._unwrapper, ), cast_to=cast(Type[TopLocationsResponse], ResultWrapper[TopLocationsResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.ases = to_raw_response_wrapper( @@ -474,8 +476,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.ases = async_to_raw_response_wrapper( @@ -486,8 +488,8 @@ def __init__(self, top: AsyncTop) -> None: ) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.ases = to_streamed_response_wrapper( @@ -498,8 +500,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.ases = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/quality/__init__.py b/src/cloudflare/resources/radar/quality/__init__.py index 8d7703914a4..ed91d35be8c 100644 --- a/src/cloudflare/resources/radar/quality/__init__.py +++ b/src/cloudflare/resources/radar/quality/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .iqi import ( - IQI, - AsyncIQI, - IQIWithRawResponse, - AsyncIQIWithRawResponse, - IQIWithStreamingResponse, - AsyncIQIWithStreamingResponse, + IQIResource, + AsyncIQIResource, + IQIResourceWithRawResponse, + AsyncIQIResourceWithRawResponse, + IQIResourceWithStreamingResponse, + AsyncIQIResourceWithStreamingResponse, ) from .speed import ( - Speed, - AsyncSpeed, - SpeedWithRawResponse, - AsyncSpeedWithRawResponse, - SpeedWithStreamingResponse, - AsyncSpeedWithStreamingResponse, + SpeedResource, + AsyncSpeedResource, + SpeedResourceWithRawResponse, + AsyncSpeedResourceWithRawResponse, + SpeedResourceWithStreamingResponse, + AsyncSpeedResourceWithStreamingResponse, ) from .quality import ( - Quality, - AsyncQuality, - QualityWithRawResponse, - AsyncQualityWithRawResponse, - QualityWithStreamingResponse, - AsyncQualityWithStreamingResponse, + QualityResource, + AsyncQualityResource, + QualityResourceWithRawResponse, + AsyncQualityResourceWithRawResponse, + QualityResourceWithStreamingResponse, + AsyncQualityResourceWithStreamingResponse, ) __all__ = [ - "IQI", - "AsyncIQI", - "IQIWithRawResponse", - "AsyncIQIWithRawResponse", - "IQIWithStreamingResponse", - "AsyncIQIWithStreamingResponse", - "Speed", - "AsyncSpeed", - "SpeedWithRawResponse", - "AsyncSpeedWithRawResponse", - "SpeedWithStreamingResponse", - "AsyncSpeedWithStreamingResponse", - "Quality", - "AsyncQuality", - "QualityWithRawResponse", - "AsyncQualityWithRawResponse", - "QualityWithStreamingResponse", - "AsyncQualityWithStreamingResponse", + "IQIResource", + "AsyncIQIResource", + "IQIResourceWithRawResponse", + "AsyncIQIResourceWithRawResponse", + "IQIResourceWithStreamingResponse", + "AsyncIQIResourceWithStreamingResponse", + "SpeedResource", + "AsyncSpeedResource", + "SpeedResourceWithRawResponse", + "AsyncSpeedResourceWithRawResponse", + "SpeedResourceWithStreamingResponse", + "AsyncSpeedResourceWithStreamingResponse", + "QualityResource", + "AsyncQualityResource", + "QualityResourceWithRawResponse", + "AsyncQualityResourceWithRawResponse", + "QualityResourceWithStreamingResponse", + "AsyncQualityResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/quality/iqi.py b/src/cloudflare/resources/radar/quality/iqi.py index 6b647293a4f..3a3c8ba4da3 100644 --- a/src/cloudflare/resources/radar/quality/iqi.py +++ b/src/cloudflare/resources/radar/quality/iqi.py @@ -25,24 +25,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.quality import ( - IQISummaryResponse, - IQITimeseriesGroupsResponse, - iqi_summary_params, - iqi_timeseries_groups_params, -) +from ....types.radar.quality import iqi_summary_params, iqi_timeseries_groups_params +from ....types.radar.quality.iqi_summary_response import IQISummaryResponse +from ....types.radar.quality.iqi_timeseries_groups_response import IQITimeseriesGroupsResponse -__all__ = ["IQI", "AsyncIQI"] +__all__ = ["IQIResource", "AsyncIQIResource"] -class IQI(SyncAPIResource): +class IQIResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IQIWithRawResponse: - return IQIWithRawResponse(self) + def with_raw_response(self) -> IQIResourceWithRawResponse: + return IQIResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IQIWithStreamingResponse: - return IQIWithStreamingResponse(self) + def with_streaming_response(self) -> IQIResourceWithStreamingResponse: + return IQIResourceWithStreamingResponse(self) def summary( self, @@ -142,7 +139,7 @@ def summary( }, iqi_summary_params.IQISummaryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IQISummaryResponse]._unwrapper, ), cast_to=cast(Type[IQISummaryResponse], ResultWrapper[IQISummaryResponse]), ) @@ -255,20 +252,20 @@ def timeseries_groups( }, iqi_timeseries_groups_params.IQITimeseriesGroupsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IQITimeseriesGroupsResponse]._unwrapper, ), cast_to=cast(Type[IQITimeseriesGroupsResponse], ResultWrapper[IQITimeseriesGroupsResponse]), ) -class AsyncIQI(AsyncAPIResource): +class AsyncIQIResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIQIWithRawResponse: - return AsyncIQIWithRawResponse(self) + def with_raw_response(self) -> AsyncIQIResourceWithRawResponse: + return AsyncIQIResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIQIWithStreamingResponse: - return AsyncIQIWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIQIResourceWithStreamingResponse: + return AsyncIQIResourceWithStreamingResponse(self) async def summary( self, @@ -368,7 +365,7 @@ async def summary( }, iqi_summary_params.IQISummaryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IQISummaryResponse]._unwrapper, ), cast_to=cast(Type[IQISummaryResponse], ResultWrapper[IQISummaryResponse]), ) @@ -481,14 +478,14 @@ async def timeseries_groups( }, iqi_timeseries_groups_params.IQITimeseriesGroupsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IQITimeseriesGroupsResponse]._unwrapper, ), cast_to=cast(Type[IQITimeseriesGroupsResponse], ResultWrapper[IQITimeseriesGroupsResponse]), ) -class IQIWithRawResponse: - def __init__(self, iqi: IQI) -> None: +class IQIResourceWithRawResponse: + def __init__(self, iqi: IQIResource) -> None: self._iqi = iqi self.summary = to_raw_response_wrapper( @@ -499,8 +496,8 @@ def __init__(self, iqi: IQI) -> None: ) -class AsyncIQIWithRawResponse: - def __init__(self, iqi: AsyncIQI) -> None: +class AsyncIQIResourceWithRawResponse: + def __init__(self, iqi: AsyncIQIResource) -> None: self._iqi = iqi self.summary = async_to_raw_response_wrapper( @@ -511,8 +508,8 @@ def __init__(self, iqi: AsyncIQI) -> None: ) -class IQIWithStreamingResponse: - def __init__(self, iqi: IQI) -> None: +class IQIResourceWithStreamingResponse: + def __init__(self, iqi: IQIResource) -> None: self._iqi = iqi self.summary = to_streamed_response_wrapper( @@ -523,8 +520,8 @@ def __init__(self, iqi: IQI) -> None: ) -class AsyncIQIWithStreamingResponse: - def __init__(self, iqi: AsyncIQI) -> None: +class AsyncIQIResourceWithStreamingResponse: + def __init__(self, iqi: AsyncIQIResource) -> None: self._iqi = iqi self.summary = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/quality/quality.py b/src/cloudflare/resources/radar/quality/quality.py index 1e4f98c7ed6..a5fb5b19f3c 100644 --- a/src/cloudflare/resources/radar/quality/quality.py +++ b/src/cloudflare/resources/radar/quality/quality.py @@ -3,111 +3,111 @@ from __future__ import annotations from .iqi import ( - IQI, - AsyncIQI, - IQIWithRawResponse, - AsyncIQIWithRawResponse, - IQIWithStreamingResponse, - AsyncIQIWithStreamingResponse, + IQIResource, + AsyncIQIResource, + IQIResourceWithRawResponse, + AsyncIQIResourceWithRawResponse, + IQIResourceWithStreamingResponse, + AsyncIQIResourceWithStreamingResponse, ) from .speed import ( - Speed, - AsyncSpeed, - SpeedWithRawResponse, - AsyncSpeedWithRawResponse, - SpeedWithStreamingResponse, - AsyncSpeedWithStreamingResponse, + SpeedResource, + AsyncSpeedResource, + SpeedResourceWithRawResponse, + AsyncSpeedResourceWithRawResponse, + SpeedResourceWithStreamingResponse, + AsyncSpeedResourceWithStreamingResponse, ) from ...._compat import cached_property -from .speed.speed import Speed, AsyncSpeed +from .speed.speed import SpeedResource, AsyncSpeedResource from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Quality", "AsyncQuality"] +__all__ = ["QualityResource", "AsyncQualityResource"] -class Quality(SyncAPIResource): +class QualityResource(SyncAPIResource): @cached_property - def iqi(self) -> IQI: - return IQI(self._client) + def iqi(self) -> IQIResource: + return IQIResource(self._client) @cached_property - def speed(self) -> Speed: - return Speed(self._client) + def speed(self) -> SpeedResource: + return SpeedResource(self._client) @cached_property - def with_raw_response(self) -> QualityWithRawResponse: - return QualityWithRawResponse(self) + def with_raw_response(self) -> QualityResourceWithRawResponse: + return QualityResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> QualityWithStreamingResponse: - return QualityWithStreamingResponse(self) + def with_streaming_response(self) -> QualityResourceWithStreamingResponse: + return QualityResourceWithStreamingResponse(self) -class AsyncQuality(AsyncAPIResource): +class AsyncQualityResource(AsyncAPIResource): @cached_property - def iqi(self) -> AsyncIQI: - return AsyncIQI(self._client) + def iqi(self) -> AsyncIQIResource: + return AsyncIQIResource(self._client) @cached_property - def speed(self) -> AsyncSpeed: - return AsyncSpeed(self._client) + def speed(self) -> AsyncSpeedResource: + return AsyncSpeedResource(self._client) @cached_property - def with_raw_response(self) -> AsyncQualityWithRawResponse: - return AsyncQualityWithRawResponse(self) + def with_raw_response(self) -> AsyncQualityResourceWithRawResponse: + return AsyncQualityResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncQualityWithStreamingResponse: - return AsyncQualityWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncQualityResourceWithStreamingResponse: + return AsyncQualityResourceWithStreamingResponse(self) -class QualityWithRawResponse: - def __init__(self, quality: Quality) -> None: +class QualityResourceWithRawResponse: + def __init__(self, quality: QualityResource) -> None: self._quality = quality @cached_property - def iqi(self) -> IQIWithRawResponse: - return IQIWithRawResponse(self._quality.iqi) + def iqi(self) -> IQIResourceWithRawResponse: + return IQIResourceWithRawResponse(self._quality.iqi) @cached_property - def speed(self) -> SpeedWithRawResponse: - return SpeedWithRawResponse(self._quality.speed) + def speed(self) -> SpeedResourceWithRawResponse: + return SpeedResourceWithRawResponse(self._quality.speed) -class AsyncQualityWithRawResponse: - def __init__(self, quality: AsyncQuality) -> None: +class AsyncQualityResourceWithRawResponse: + def __init__(self, quality: AsyncQualityResource) -> None: self._quality = quality @cached_property - def iqi(self) -> AsyncIQIWithRawResponse: - return AsyncIQIWithRawResponse(self._quality.iqi) + def iqi(self) -> AsyncIQIResourceWithRawResponse: + return AsyncIQIResourceWithRawResponse(self._quality.iqi) @cached_property - def speed(self) -> AsyncSpeedWithRawResponse: - return AsyncSpeedWithRawResponse(self._quality.speed) + def speed(self) -> AsyncSpeedResourceWithRawResponse: + return AsyncSpeedResourceWithRawResponse(self._quality.speed) -class QualityWithStreamingResponse: - def __init__(self, quality: Quality) -> None: +class QualityResourceWithStreamingResponse: + def __init__(self, quality: QualityResource) -> None: self._quality = quality @cached_property - def iqi(self) -> IQIWithStreamingResponse: - return IQIWithStreamingResponse(self._quality.iqi) + def iqi(self) -> IQIResourceWithStreamingResponse: + return IQIResourceWithStreamingResponse(self._quality.iqi) @cached_property - def speed(self) -> SpeedWithStreamingResponse: - return SpeedWithStreamingResponse(self._quality.speed) + def speed(self) -> SpeedResourceWithStreamingResponse: + return SpeedResourceWithStreamingResponse(self._quality.speed) -class AsyncQualityWithStreamingResponse: - def __init__(self, quality: AsyncQuality) -> None: +class AsyncQualityResourceWithStreamingResponse: + def __init__(self, quality: AsyncQualityResource) -> None: self._quality = quality @cached_property - def iqi(self) -> AsyncIQIWithStreamingResponse: - return AsyncIQIWithStreamingResponse(self._quality.iqi) + def iqi(self) -> AsyncIQIResourceWithStreamingResponse: + return AsyncIQIResourceWithStreamingResponse(self._quality.iqi) @cached_property - def speed(self) -> AsyncSpeedWithStreamingResponse: - return AsyncSpeedWithStreamingResponse(self._quality.speed) + def speed(self) -> AsyncSpeedResourceWithStreamingResponse: + return AsyncSpeedResourceWithStreamingResponse(self._quality.speed) diff --git a/src/cloudflare/resources/radar/quality/speed/__init__.py b/src/cloudflare/resources/radar/quality/speed/__init__.py index d0d50b5b02a..1069242d3b2 100644 --- a/src/cloudflare/resources/radar/quality/speed/__init__.py +++ b/src/cloudflare/resources/radar/quality/speed/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .speed import ( - Speed, - AsyncSpeed, - SpeedWithRawResponse, - AsyncSpeedWithRawResponse, - SpeedWithStreamingResponse, - AsyncSpeedWithStreamingResponse, + SpeedResource, + AsyncSpeedResource, + SpeedResourceWithRawResponse, + AsyncSpeedResourceWithRawResponse, + SpeedResourceWithStreamingResponse, + AsyncSpeedResourceWithStreamingResponse, ) __all__ = [ - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "Speed", - "AsyncSpeed", - "SpeedWithRawResponse", - "AsyncSpeedWithRawResponse", - "SpeedWithStreamingResponse", - "AsyncSpeedWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "SpeedResource", + "AsyncSpeedResource", + "SpeedResourceWithRawResponse", + "AsyncSpeedResourceWithRawResponse", + "SpeedResourceWithStreamingResponse", + "AsyncSpeedResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/quality/speed/speed.py b/src/cloudflare/resources/radar/quality/speed/speed.py index 140f9ff9932..83d157cd559 100644 --- a/src/cloudflare/resources/radar/quality/speed/speed.py +++ b/src/cloudflare/resources/radar/quality/speed/speed.py @@ -9,12 +9,12 @@ import httpx from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -33,28 +33,25 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.quality import ( - SpeedSummaryResponse, - SpeedHistogramResponse, - speed_summary_params, - speed_histogram_params, -) +from .....types.radar.quality import speed_summary_params, speed_histogram_params +from .....types.radar.quality.speed_summary_response import SpeedSummaryResponse +from .....types.radar.quality.speed_histogram_response import SpeedHistogramResponse -__all__ = ["Speed", "AsyncSpeed"] +__all__ = ["SpeedResource", "AsyncSpeedResource"] -class Speed(SyncAPIResource): +class SpeedResource(SyncAPIResource): @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def with_raw_response(self) -> SpeedWithRawResponse: - return SpeedWithRawResponse(self) + def with_raw_response(self) -> SpeedResourceWithRawResponse: + return SpeedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SpeedWithStreamingResponse: - return SpeedWithStreamingResponse(self) + def with_streaming_response(self) -> SpeedResourceWithStreamingResponse: + return SpeedResourceWithStreamingResponse(self) def histogram( self, @@ -129,7 +126,7 @@ def histogram( }, speed_histogram_params.SpeedHistogramParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SpeedHistogramResponse]._unwrapper, ), cast_to=cast(Type[SpeedHistogramResponse], ResultWrapper[SpeedHistogramResponse]), ) @@ -199,24 +196,24 @@ def summary( }, speed_summary_params.SpeedSummaryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SpeedSummaryResponse]._unwrapper, ), cast_to=cast(Type[SpeedSummaryResponse], ResultWrapper[SpeedSummaryResponse]), ) -class AsyncSpeed(AsyncAPIResource): +class AsyncSpeedResource(AsyncAPIResource): @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSpeedWithRawResponse: - return AsyncSpeedWithRawResponse(self) + def with_raw_response(self) -> AsyncSpeedResourceWithRawResponse: + return AsyncSpeedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSpeedWithStreamingResponse: - return AsyncSpeedWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSpeedResourceWithStreamingResponse: + return AsyncSpeedResourceWithStreamingResponse(self) async def histogram( self, @@ -291,7 +288,7 @@ async def histogram( }, speed_histogram_params.SpeedHistogramParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SpeedHistogramResponse]._unwrapper, ), cast_to=cast(Type[SpeedHistogramResponse], ResultWrapper[SpeedHistogramResponse]), ) @@ -361,14 +358,14 @@ async def summary( }, speed_summary_params.SpeedSummaryParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SpeedSummaryResponse]._unwrapper, ), cast_to=cast(Type[SpeedSummaryResponse], ResultWrapper[SpeedSummaryResponse]), ) -class SpeedWithRawResponse: - def __init__(self, speed: Speed) -> None: +class SpeedResourceWithRawResponse: + def __init__(self, speed: SpeedResource) -> None: self._speed = speed self.histogram = to_raw_response_wrapper( @@ -379,12 +376,12 @@ def __init__(self, speed: Speed) -> None: ) @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._speed.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._speed.top) -class AsyncSpeedWithRawResponse: - def __init__(self, speed: AsyncSpeed) -> None: +class AsyncSpeedResourceWithRawResponse: + def __init__(self, speed: AsyncSpeedResource) -> None: self._speed = speed self.histogram = async_to_raw_response_wrapper( @@ -395,12 +392,12 @@ def __init__(self, speed: AsyncSpeed) -> None: ) @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._speed.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._speed.top) -class SpeedWithStreamingResponse: - def __init__(self, speed: Speed) -> None: +class SpeedResourceWithStreamingResponse: + def __init__(self, speed: SpeedResource) -> None: self._speed = speed self.histogram = to_streamed_response_wrapper( @@ -411,12 +408,12 @@ def __init__(self, speed: Speed) -> None: ) @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._speed.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._speed.top) -class AsyncSpeedWithStreamingResponse: - def __init__(self, speed: AsyncSpeed) -> None: +class AsyncSpeedResourceWithStreamingResponse: + def __init__(self, speed: AsyncSpeedResource) -> None: self._speed = speed self.histogram = async_to_streamed_response_wrapper( @@ -427,5 +424,5 @@ def __init__(self, speed: AsyncSpeed) -> None: ) @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._speed.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._speed.top) diff --git a/src/cloudflare/resources/radar/quality/speed/top.py b/src/cloudflare/resources/radar/quality/speed/top.py index ce459bc1e33..847810362a3 100644 --- a/src/cloudflare/resources/radar/quality/speed/top.py +++ b/src/cloudflare/resources/radar/quality/speed/top.py @@ -25,19 +25,21 @@ from ....._base_client import ( make_request_options, ) -from .....types.radar.quality.speed import TopAsesResponse, TopLocationsResponse, top_ases_params, top_locations_params +from .....types.radar.quality.speed import top_ases_params, top_locations_params +from .....types.radar.quality.speed.top_ases_response import TopAsesResponse +from .....types.radar.quality.speed.top_locations_response import TopLocationsResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def ases( self, @@ -119,7 +121,7 @@ def ases( }, top_ases_params.TopAsesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAsesResponse]._unwrapper, ), cast_to=cast(Type[TopAsesResponse], ResultWrapper[TopAsesResponse]), ) @@ -204,20 +206,20 @@ def locations( }, top_locations_params.TopLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopLocationsResponse]._unwrapper, ), cast_to=cast(Type[TopLocationsResponse], ResultWrapper[TopLocationsResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def ases( self, @@ -299,7 +301,7 @@ async def ases( }, top_ases_params.TopAsesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopAsesResponse]._unwrapper, ), cast_to=cast(Type[TopAsesResponse], ResultWrapper[TopAsesResponse]), ) @@ -384,14 +386,14 @@ async def locations( }, top_locations_params.TopLocationsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopLocationsResponse]._unwrapper, ), cast_to=cast(Type[TopLocationsResponse], ResultWrapper[TopLocationsResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.ases = to_raw_response_wrapper( @@ -402,8 +404,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.ases = async_to_raw_response_wrapper( @@ -414,8 +416,8 @@ def __init__(self, top: AsyncTop) -> None: ) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.ases = to_streamed_response_wrapper( @@ -426,8 +428,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.ases = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/radar.py b/src/cloudflare/resources/radar/radar.py index e9f0263d907..c6859e8b70c 100644 --- a/src/cloudflare/resources/radar/radar.py +++ b/src/cloudflare/resources/radar/radar.py @@ -3,571 +3,571 @@ from __future__ import annotations from .bgp import ( - BGP, - AsyncBGP, - BGPWithRawResponse, - AsyncBGPWithRawResponse, - BGPWithStreamingResponse, - AsyncBGPWithStreamingResponse, + BGPResource, + AsyncBGPResource, + BGPResourceWithRawResponse, + AsyncBGPResourceWithRawResponse, + BGPResourceWithStreamingResponse, + AsyncBGPResourceWithStreamingResponse, ) from .dns import ( - DNS, - AsyncDNS, - DNSWithRawResponse, - AsyncDNSWithRawResponse, - DNSWithStreamingResponse, - AsyncDNSWithStreamingResponse, + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, ) from .http import ( - HTTP, - AsyncHTTP, - HTTPWithRawResponse, - AsyncHTTPWithRawResponse, - HTTPWithStreamingResponse, - AsyncHTTPWithStreamingResponse, + HTTPResource, + AsyncHTTPResource, + HTTPResourceWithRawResponse, + AsyncHTTPResourceWithRawResponse, + HTTPResourceWithStreamingResponse, + AsyncHTTPResourceWithStreamingResponse, ) from .as112 import ( - AS112, - AsyncAS112, - AS112WithRawResponse, - AsyncAS112WithRawResponse, - AS112WithStreamingResponse, - AsyncAS112WithStreamingResponse, + AS112Resource, + AsyncAS112Resource, + AS112ResourceWithRawResponse, + AsyncAS112ResourceWithRawResponse, + AS112ResourceWithStreamingResponse, + AsyncAS112ResourceWithStreamingResponse, ) from .email import ( - Email, - AsyncEmail, - EmailWithRawResponse, - AsyncEmailWithRawResponse, - EmailWithStreamingResponse, - AsyncEmailWithStreamingResponse, + EmailResource, + AsyncEmailResource, + EmailResourceWithRawResponse, + AsyncEmailResourceWithRawResponse, + EmailResourceWithStreamingResponse, + AsyncEmailResourceWithStreamingResponse, ) from .search import ( - Search, - AsyncSearch, - SearchWithRawResponse, - AsyncSearchWithRawResponse, - SearchWithStreamingResponse, - AsyncSearchWithStreamingResponse, + SearchResource, + AsyncSearchResource, + SearchResourceWithRawResponse, + AsyncSearchResourceWithRawResponse, + SearchResourceWithStreamingResponse, + AsyncSearchResourceWithStreamingResponse, ) from .attacks import ( - Attacks, - AsyncAttacks, - AttacksWithRawResponse, - AsyncAttacksWithRawResponse, - AttacksWithStreamingResponse, - AsyncAttacksWithStreamingResponse, + AttacksResource, + AsyncAttacksResource, + AttacksResourceWithRawResponse, + AsyncAttacksResourceWithRawResponse, + AttacksResourceWithStreamingResponse, + AsyncAttacksResourceWithStreamingResponse, ) -from .bgp.bgp import BGP, AsyncBGP -from .dns.dns import DNS, AsyncDNS +from .bgp.bgp import BGPResource, AsyncBGPResource +from .dns.dns import DNSResource, AsyncDNSResource from .quality import ( - Quality, - AsyncQuality, - QualityWithRawResponse, - AsyncQualityWithRawResponse, - QualityWithStreamingResponse, - AsyncQualityWithStreamingResponse, + QualityResource, + AsyncQualityResource, + QualityResourceWithRawResponse, + AsyncQualityResourceWithRawResponse, + QualityResourceWithStreamingResponse, + AsyncQualityResourceWithStreamingResponse, ) from .ranking import ( - Ranking, - AsyncRanking, - RankingWithRawResponse, - AsyncRankingWithRawResponse, - RankingWithStreamingResponse, - AsyncRankingWithStreamingResponse, + RankingResource, + AsyncRankingResource, + RankingResourceWithRawResponse, + AsyncRankingResourceWithRawResponse, + RankingResourceWithStreamingResponse, + AsyncRankingResourceWithStreamingResponse, ) from .datasets import ( - Datasets, - AsyncDatasets, - DatasetsWithRawResponse, - AsyncDatasetsWithRawResponse, - DatasetsWithStreamingResponse, - AsyncDatasetsWithStreamingResponse, + DatasetsResource, + AsyncDatasetsResource, + DatasetsResourceWithRawResponse, + AsyncDatasetsResourceWithRawResponse, + DatasetsResourceWithStreamingResponse, + AsyncDatasetsResourceWithStreamingResponse, ) from .entities import ( - Entities, - AsyncEntities, - EntitiesWithRawResponse, - AsyncEntitiesWithRawResponse, - EntitiesWithStreamingResponse, - AsyncEntitiesWithStreamingResponse, + EntitiesResource, + AsyncEntitiesResource, + EntitiesResourceWithRawResponse, + AsyncEntitiesResourceWithRawResponse, + EntitiesResourceWithStreamingResponse, + AsyncEntitiesResourceWithStreamingResponse, ) from .netflows import ( - Netflows, - AsyncNetflows, - NetflowsWithRawResponse, - AsyncNetflowsWithRawResponse, - NetflowsWithStreamingResponse, - AsyncNetflowsWithStreamingResponse, + NetflowsResource, + AsyncNetflowsResource, + NetflowsResourceWithRawResponse, + AsyncNetflowsResourceWithRawResponse, + NetflowsResourceWithStreamingResponse, + AsyncNetflowsResourceWithStreamingResponse, ) from ..._compat import cached_property -from .http.http import HTTP, AsyncHTTP +from .http.http import HTTPResource, AsyncHTTPResource from ..._resource import SyncAPIResource, AsyncAPIResource from .annotations import ( - Annotations, - AsyncAnnotations, - AnnotationsWithRawResponse, - AsyncAnnotationsWithRawResponse, - AnnotationsWithStreamingResponse, - AsyncAnnotationsWithStreamingResponse, + AnnotationsResource, + AsyncAnnotationsResource, + AnnotationsResourceWithRawResponse, + AsyncAnnotationsResourceWithRawResponse, + AnnotationsResourceWithStreamingResponse, + AsyncAnnotationsResourceWithStreamingResponse, ) -from .as112.as112 import AS112, AsyncAS112 -from .email.email import Email, AsyncEmail +from .as112.as112 import AS112Resource, AsyncAS112Resource +from .email.email import EmailResource, AsyncEmailResource from .verified_bots import ( - VerifiedBots, - AsyncVerifiedBots, - VerifiedBotsWithRawResponse, - AsyncVerifiedBotsWithRawResponse, - VerifiedBotsWithStreamingResponse, - AsyncVerifiedBotsWithStreamingResponse, + VerifiedBotsResource, + AsyncVerifiedBotsResource, + VerifiedBotsResourceWithRawResponse, + AsyncVerifiedBotsResourceWithRawResponse, + VerifiedBotsResourceWithStreamingResponse, + AsyncVerifiedBotsResourceWithStreamingResponse, ) -from .attacks.attacks import Attacks, AsyncAttacks -from .quality.quality import Quality, AsyncQuality -from .ranking.ranking import Ranking, AsyncRanking -from .entities.entities import Entities, AsyncEntities -from .netflows.netflows import Netflows, AsyncNetflows +from .attacks.attacks import AttacksResource, AsyncAttacksResource +from .quality.quality import QualityResource, AsyncQualityResource +from .ranking.ranking import RankingResource, AsyncRankingResource +from .entities.entities import EntitiesResource, AsyncEntitiesResource +from .netflows.netflows import NetflowsResource, AsyncNetflowsResource from .traffic_anomalies import ( - TrafficAnomalies, - AsyncTrafficAnomalies, - TrafficAnomaliesWithRawResponse, - AsyncTrafficAnomaliesWithRawResponse, - TrafficAnomaliesWithStreamingResponse, - AsyncTrafficAnomaliesWithStreamingResponse, + TrafficAnomaliesResource, + AsyncTrafficAnomaliesResource, + TrafficAnomaliesResourceWithRawResponse, + AsyncTrafficAnomaliesResourceWithRawResponse, + TrafficAnomaliesResourceWithStreamingResponse, + AsyncTrafficAnomaliesResourceWithStreamingResponse, ) from .connection_tampering import ( - ConnectionTampering, - AsyncConnectionTampering, - ConnectionTamperingWithRawResponse, - AsyncConnectionTamperingWithRawResponse, - ConnectionTamperingWithStreamingResponse, - AsyncConnectionTamperingWithStreamingResponse, + ConnectionTamperingResource, + AsyncConnectionTamperingResource, + ConnectionTamperingResourceWithRawResponse, + AsyncConnectionTamperingResourceWithRawResponse, + ConnectionTamperingResourceWithStreamingResponse, + AsyncConnectionTamperingResourceWithStreamingResponse, ) -from .annotations.annotations import Annotations, AsyncAnnotations -from .verified_bots.verified_bots import VerifiedBots, AsyncVerifiedBots -from .traffic_anomalies.traffic_anomalies import TrafficAnomalies, AsyncTrafficAnomalies +from .annotations.annotations import AnnotationsResource, AsyncAnnotationsResource +from .verified_bots.verified_bots import VerifiedBotsResource, AsyncVerifiedBotsResource +from .traffic_anomalies.traffic_anomalies import TrafficAnomaliesResource, AsyncTrafficAnomaliesResource -__all__ = ["Radar", "AsyncRadar"] +__all__ = ["RadarResource", "AsyncRadarResource"] -class Radar(SyncAPIResource): +class RadarResource(SyncAPIResource): @cached_property - def annotations(self) -> Annotations: - return Annotations(self._client) + def annotations(self) -> AnnotationsResource: + return AnnotationsResource(self._client) @cached_property - def bgp(self) -> BGP: - return BGP(self._client) + def bgp(self) -> BGPResource: + return BGPResource(self._client) @cached_property - def datasets(self) -> Datasets: - return Datasets(self._client) + def datasets(self) -> DatasetsResource: + return DatasetsResource(self._client) @cached_property - def dns(self) -> DNS: - return DNS(self._client) + def dns(self) -> DNSResource: + return DNSResource(self._client) @cached_property - def netflows(self) -> Netflows: - return Netflows(self._client) + def netflows(self) -> NetflowsResource: + return NetflowsResource(self._client) @cached_property - def search(self) -> Search: - return Search(self._client) + def search(self) -> SearchResource: + return SearchResource(self._client) @cached_property - def verified_bots(self) -> VerifiedBots: - return VerifiedBots(self._client) + def verified_bots(self) -> VerifiedBotsResource: + return VerifiedBotsResource(self._client) @cached_property - def as112(self) -> AS112: - return AS112(self._client) + def as112(self) -> AS112Resource: + return AS112Resource(self._client) @cached_property - def connection_tampering(self) -> ConnectionTampering: - return ConnectionTampering(self._client) + def connection_tampering(self) -> ConnectionTamperingResource: + return ConnectionTamperingResource(self._client) @cached_property - def email(self) -> Email: - return Email(self._client) + def email(self) -> EmailResource: + return EmailResource(self._client) @cached_property - def attacks(self) -> Attacks: - return Attacks(self._client) + def attacks(self) -> AttacksResource: + return AttacksResource(self._client) @cached_property - def entities(self) -> Entities: - return Entities(self._client) + def entities(self) -> EntitiesResource: + return EntitiesResource(self._client) @cached_property - def http(self) -> HTTP: - return HTTP(self._client) + def http(self) -> HTTPResource: + return HTTPResource(self._client) @cached_property - def quality(self) -> Quality: - return Quality(self._client) + def quality(self) -> QualityResource: + return QualityResource(self._client) @cached_property - def ranking(self) -> Ranking: - return Ranking(self._client) + def ranking(self) -> RankingResource: + return RankingResource(self._client) @cached_property - def traffic_anomalies(self) -> TrafficAnomalies: - return TrafficAnomalies(self._client) + def traffic_anomalies(self) -> TrafficAnomaliesResource: + return TrafficAnomaliesResource(self._client) @cached_property - def with_raw_response(self) -> RadarWithRawResponse: - return RadarWithRawResponse(self) + def with_raw_response(self) -> RadarResourceWithRawResponse: + return RadarResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RadarWithStreamingResponse: - return RadarWithStreamingResponse(self) + def with_streaming_response(self) -> RadarResourceWithStreamingResponse: + return RadarResourceWithStreamingResponse(self) -class AsyncRadar(AsyncAPIResource): +class AsyncRadarResource(AsyncAPIResource): @cached_property - def annotations(self) -> AsyncAnnotations: - return AsyncAnnotations(self._client) + def annotations(self) -> AsyncAnnotationsResource: + return AsyncAnnotationsResource(self._client) @cached_property - def bgp(self) -> AsyncBGP: - return AsyncBGP(self._client) + def bgp(self) -> AsyncBGPResource: + return AsyncBGPResource(self._client) @cached_property - def datasets(self) -> AsyncDatasets: - return AsyncDatasets(self._client) + def datasets(self) -> AsyncDatasetsResource: + return AsyncDatasetsResource(self._client) @cached_property - def dns(self) -> AsyncDNS: - return AsyncDNS(self._client) + def dns(self) -> AsyncDNSResource: + return AsyncDNSResource(self._client) @cached_property - def netflows(self) -> AsyncNetflows: - return AsyncNetflows(self._client) + def netflows(self) -> AsyncNetflowsResource: + return AsyncNetflowsResource(self._client) @cached_property - def search(self) -> AsyncSearch: - return AsyncSearch(self._client) + def search(self) -> AsyncSearchResource: + return AsyncSearchResource(self._client) @cached_property - def verified_bots(self) -> AsyncVerifiedBots: - return AsyncVerifiedBots(self._client) + def verified_bots(self) -> AsyncVerifiedBotsResource: + return AsyncVerifiedBotsResource(self._client) @cached_property - def as112(self) -> AsyncAS112: - return AsyncAS112(self._client) + def as112(self) -> AsyncAS112Resource: + return AsyncAS112Resource(self._client) @cached_property - def connection_tampering(self) -> AsyncConnectionTampering: - return AsyncConnectionTampering(self._client) + def connection_tampering(self) -> AsyncConnectionTamperingResource: + return AsyncConnectionTamperingResource(self._client) @cached_property - def email(self) -> AsyncEmail: - return AsyncEmail(self._client) + def email(self) -> AsyncEmailResource: + return AsyncEmailResource(self._client) @cached_property - def attacks(self) -> AsyncAttacks: - return AsyncAttacks(self._client) + def attacks(self) -> AsyncAttacksResource: + return AsyncAttacksResource(self._client) @cached_property - def entities(self) -> AsyncEntities: - return AsyncEntities(self._client) + def entities(self) -> AsyncEntitiesResource: + return AsyncEntitiesResource(self._client) @cached_property - def http(self) -> AsyncHTTP: - return AsyncHTTP(self._client) + def http(self) -> AsyncHTTPResource: + return AsyncHTTPResource(self._client) @cached_property - def quality(self) -> AsyncQuality: - return AsyncQuality(self._client) + def quality(self) -> AsyncQualityResource: + return AsyncQualityResource(self._client) @cached_property - def ranking(self) -> AsyncRanking: - return AsyncRanking(self._client) + def ranking(self) -> AsyncRankingResource: + return AsyncRankingResource(self._client) @cached_property - def traffic_anomalies(self) -> AsyncTrafficAnomalies: - return AsyncTrafficAnomalies(self._client) + def traffic_anomalies(self) -> AsyncTrafficAnomaliesResource: + return AsyncTrafficAnomaliesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRadarWithRawResponse: - return AsyncRadarWithRawResponse(self) + def with_raw_response(self) -> AsyncRadarResourceWithRawResponse: + return AsyncRadarResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRadarWithStreamingResponse: - return AsyncRadarWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRadarResourceWithStreamingResponse: + return AsyncRadarResourceWithStreamingResponse(self) -class RadarWithRawResponse: - def __init__(self, radar: Radar) -> None: +class RadarResourceWithRawResponse: + def __init__(self, radar: RadarResource) -> None: self._radar = radar @cached_property - def annotations(self) -> AnnotationsWithRawResponse: - return AnnotationsWithRawResponse(self._radar.annotations) + def annotations(self) -> AnnotationsResourceWithRawResponse: + return AnnotationsResourceWithRawResponse(self._radar.annotations) @cached_property - def bgp(self) -> BGPWithRawResponse: - return BGPWithRawResponse(self._radar.bgp) + def bgp(self) -> BGPResourceWithRawResponse: + return BGPResourceWithRawResponse(self._radar.bgp) @cached_property - def datasets(self) -> DatasetsWithRawResponse: - return DatasetsWithRawResponse(self._radar.datasets) + def datasets(self) -> DatasetsResourceWithRawResponse: + return DatasetsResourceWithRawResponse(self._radar.datasets) @cached_property - def dns(self) -> DNSWithRawResponse: - return DNSWithRawResponse(self._radar.dns) + def dns(self) -> DNSResourceWithRawResponse: + return DNSResourceWithRawResponse(self._radar.dns) @cached_property - def netflows(self) -> NetflowsWithRawResponse: - return NetflowsWithRawResponse(self._radar.netflows) + def netflows(self) -> NetflowsResourceWithRawResponse: + return NetflowsResourceWithRawResponse(self._radar.netflows) @cached_property - def search(self) -> SearchWithRawResponse: - return SearchWithRawResponse(self._radar.search) + def search(self) -> SearchResourceWithRawResponse: + return SearchResourceWithRawResponse(self._radar.search) @cached_property - def verified_bots(self) -> VerifiedBotsWithRawResponse: - return VerifiedBotsWithRawResponse(self._radar.verified_bots) + def verified_bots(self) -> VerifiedBotsResourceWithRawResponse: + return VerifiedBotsResourceWithRawResponse(self._radar.verified_bots) @cached_property - def as112(self) -> AS112WithRawResponse: - return AS112WithRawResponse(self._radar.as112) + def as112(self) -> AS112ResourceWithRawResponse: + return AS112ResourceWithRawResponse(self._radar.as112) @cached_property - def connection_tampering(self) -> ConnectionTamperingWithRawResponse: - return ConnectionTamperingWithRawResponse(self._radar.connection_tampering) + def connection_tampering(self) -> ConnectionTamperingResourceWithRawResponse: + return ConnectionTamperingResourceWithRawResponse(self._radar.connection_tampering) @cached_property - def email(self) -> EmailWithRawResponse: - return EmailWithRawResponse(self._radar.email) + def email(self) -> EmailResourceWithRawResponse: + return EmailResourceWithRawResponse(self._radar.email) @cached_property - def attacks(self) -> AttacksWithRawResponse: - return AttacksWithRawResponse(self._radar.attacks) + def attacks(self) -> AttacksResourceWithRawResponse: + return AttacksResourceWithRawResponse(self._radar.attacks) @cached_property - def entities(self) -> EntitiesWithRawResponse: - return EntitiesWithRawResponse(self._radar.entities) + def entities(self) -> EntitiesResourceWithRawResponse: + return EntitiesResourceWithRawResponse(self._radar.entities) @cached_property - def http(self) -> HTTPWithRawResponse: - return HTTPWithRawResponse(self._radar.http) + def http(self) -> HTTPResourceWithRawResponse: + return HTTPResourceWithRawResponse(self._radar.http) @cached_property - def quality(self) -> QualityWithRawResponse: - return QualityWithRawResponse(self._radar.quality) + def quality(self) -> QualityResourceWithRawResponse: + return QualityResourceWithRawResponse(self._radar.quality) @cached_property - def ranking(self) -> RankingWithRawResponse: - return RankingWithRawResponse(self._radar.ranking) + def ranking(self) -> RankingResourceWithRawResponse: + return RankingResourceWithRawResponse(self._radar.ranking) @cached_property - def traffic_anomalies(self) -> TrafficAnomaliesWithRawResponse: - return TrafficAnomaliesWithRawResponse(self._radar.traffic_anomalies) + def traffic_anomalies(self) -> TrafficAnomaliesResourceWithRawResponse: + return TrafficAnomaliesResourceWithRawResponse(self._radar.traffic_anomalies) -class AsyncRadarWithRawResponse: - def __init__(self, radar: AsyncRadar) -> None: +class AsyncRadarResourceWithRawResponse: + def __init__(self, radar: AsyncRadarResource) -> None: self._radar = radar @cached_property - def annotations(self) -> AsyncAnnotationsWithRawResponse: - return AsyncAnnotationsWithRawResponse(self._radar.annotations) + def annotations(self) -> AsyncAnnotationsResourceWithRawResponse: + return AsyncAnnotationsResourceWithRawResponse(self._radar.annotations) @cached_property - def bgp(self) -> AsyncBGPWithRawResponse: - return AsyncBGPWithRawResponse(self._radar.bgp) + def bgp(self) -> AsyncBGPResourceWithRawResponse: + return AsyncBGPResourceWithRawResponse(self._radar.bgp) @cached_property - def datasets(self) -> AsyncDatasetsWithRawResponse: - return AsyncDatasetsWithRawResponse(self._radar.datasets) + def datasets(self) -> AsyncDatasetsResourceWithRawResponse: + return AsyncDatasetsResourceWithRawResponse(self._radar.datasets) @cached_property - def dns(self) -> AsyncDNSWithRawResponse: - return AsyncDNSWithRawResponse(self._radar.dns) + def dns(self) -> AsyncDNSResourceWithRawResponse: + return AsyncDNSResourceWithRawResponse(self._radar.dns) @cached_property - def netflows(self) -> AsyncNetflowsWithRawResponse: - return AsyncNetflowsWithRawResponse(self._radar.netflows) + def netflows(self) -> AsyncNetflowsResourceWithRawResponse: + return AsyncNetflowsResourceWithRawResponse(self._radar.netflows) @cached_property - def search(self) -> AsyncSearchWithRawResponse: - return AsyncSearchWithRawResponse(self._radar.search) + def search(self) -> AsyncSearchResourceWithRawResponse: + return AsyncSearchResourceWithRawResponse(self._radar.search) @cached_property - def verified_bots(self) -> AsyncVerifiedBotsWithRawResponse: - return AsyncVerifiedBotsWithRawResponse(self._radar.verified_bots) + def verified_bots(self) -> AsyncVerifiedBotsResourceWithRawResponse: + return AsyncVerifiedBotsResourceWithRawResponse(self._radar.verified_bots) @cached_property - def as112(self) -> AsyncAS112WithRawResponse: - return AsyncAS112WithRawResponse(self._radar.as112) + def as112(self) -> AsyncAS112ResourceWithRawResponse: + return AsyncAS112ResourceWithRawResponse(self._radar.as112) @cached_property - def connection_tampering(self) -> AsyncConnectionTamperingWithRawResponse: - return AsyncConnectionTamperingWithRawResponse(self._radar.connection_tampering) + def connection_tampering(self) -> AsyncConnectionTamperingResourceWithRawResponse: + return AsyncConnectionTamperingResourceWithRawResponse(self._radar.connection_tampering) @cached_property - def email(self) -> AsyncEmailWithRawResponse: - return AsyncEmailWithRawResponse(self._radar.email) + def email(self) -> AsyncEmailResourceWithRawResponse: + return AsyncEmailResourceWithRawResponse(self._radar.email) @cached_property - def attacks(self) -> AsyncAttacksWithRawResponse: - return AsyncAttacksWithRawResponse(self._radar.attacks) + def attacks(self) -> AsyncAttacksResourceWithRawResponse: + return AsyncAttacksResourceWithRawResponse(self._radar.attacks) @cached_property - def entities(self) -> AsyncEntitiesWithRawResponse: - return AsyncEntitiesWithRawResponse(self._radar.entities) + def entities(self) -> AsyncEntitiesResourceWithRawResponse: + return AsyncEntitiesResourceWithRawResponse(self._radar.entities) @cached_property - def http(self) -> AsyncHTTPWithRawResponse: - return AsyncHTTPWithRawResponse(self._radar.http) + def http(self) -> AsyncHTTPResourceWithRawResponse: + return AsyncHTTPResourceWithRawResponse(self._radar.http) @cached_property - def quality(self) -> AsyncQualityWithRawResponse: - return AsyncQualityWithRawResponse(self._radar.quality) + def quality(self) -> AsyncQualityResourceWithRawResponse: + return AsyncQualityResourceWithRawResponse(self._radar.quality) @cached_property - def ranking(self) -> AsyncRankingWithRawResponse: - return AsyncRankingWithRawResponse(self._radar.ranking) + def ranking(self) -> AsyncRankingResourceWithRawResponse: + return AsyncRankingResourceWithRawResponse(self._radar.ranking) @cached_property - def traffic_anomalies(self) -> AsyncTrafficAnomaliesWithRawResponse: - return AsyncTrafficAnomaliesWithRawResponse(self._radar.traffic_anomalies) + def traffic_anomalies(self) -> AsyncTrafficAnomaliesResourceWithRawResponse: + return AsyncTrafficAnomaliesResourceWithRawResponse(self._radar.traffic_anomalies) -class RadarWithStreamingResponse: - def __init__(self, radar: Radar) -> None: +class RadarResourceWithStreamingResponse: + def __init__(self, radar: RadarResource) -> None: self._radar = radar @cached_property - def annotations(self) -> AnnotationsWithStreamingResponse: - return AnnotationsWithStreamingResponse(self._radar.annotations) + def annotations(self) -> AnnotationsResourceWithStreamingResponse: + return AnnotationsResourceWithStreamingResponse(self._radar.annotations) @cached_property - def bgp(self) -> BGPWithStreamingResponse: - return BGPWithStreamingResponse(self._radar.bgp) + def bgp(self) -> BGPResourceWithStreamingResponse: + return BGPResourceWithStreamingResponse(self._radar.bgp) @cached_property - def datasets(self) -> DatasetsWithStreamingResponse: - return DatasetsWithStreamingResponse(self._radar.datasets) + def datasets(self) -> DatasetsResourceWithStreamingResponse: + return DatasetsResourceWithStreamingResponse(self._radar.datasets) @cached_property - def dns(self) -> DNSWithStreamingResponse: - return DNSWithStreamingResponse(self._radar.dns) + def dns(self) -> DNSResourceWithStreamingResponse: + return DNSResourceWithStreamingResponse(self._radar.dns) @cached_property - def netflows(self) -> NetflowsWithStreamingResponse: - return NetflowsWithStreamingResponse(self._radar.netflows) + def netflows(self) -> NetflowsResourceWithStreamingResponse: + return NetflowsResourceWithStreamingResponse(self._radar.netflows) @cached_property - def search(self) -> SearchWithStreamingResponse: - return SearchWithStreamingResponse(self._radar.search) + def search(self) -> SearchResourceWithStreamingResponse: + return SearchResourceWithStreamingResponse(self._radar.search) @cached_property - def verified_bots(self) -> VerifiedBotsWithStreamingResponse: - return VerifiedBotsWithStreamingResponse(self._radar.verified_bots) + def verified_bots(self) -> VerifiedBotsResourceWithStreamingResponse: + return VerifiedBotsResourceWithStreamingResponse(self._radar.verified_bots) @cached_property - def as112(self) -> AS112WithStreamingResponse: - return AS112WithStreamingResponse(self._radar.as112) + def as112(self) -> AS112ResourceWithStreamingResponse: + return AS112ResourceWithStreamingResponse(self._radar.as112) @cached_property - def connection_tampering(self) -> ConnectionTamperingWithStreamingResponse: - return ConnectionTamperingWithStreamingResponse(self._radar.connection_tampering) + def connection_tampering(self) -> ConnectionTamperingResourceWithStreamingResponse: + return ConnectionTamperingResourceWithStreamingResponse(self._radar.connection_tampering) @cached_property - def email(self) -> EmailWithStreamingResponse: - return EmailWithStreamingResponse(self._radar.email) + def email(self) -> EmailResourceWithStreamingResponse: + return EmailResourceWithStreamingResponse(self._radar.email) @cached_property - def attacks(self) -> AttacksWithStreamingResponse: - return AttacksWithStreamingResponse(self._radar.attacks) + def attacks(self) -> AttacksResourceWithStreamingResponse: + return AttacksResourceWithStreamingResponse(self._radar.attacks) @cached_property - def entities(self) -> EntitiesWithStreamingResponse: - return EntitiesWithStreamingResponse(self._radar.entities) + def entities(self) -> EntitiesResourceWithStreamingResponse: + return EntitiesResourceWithStreamingResponse(self._radar.entities) @cached_property - def http(self) -> HTTPWithStreamingResponse: - return HTTPWithStreamingResponse(self._radar.http) + def http(self) -> HTTPResourceWithStreamingResponse: + return HTTPResourceWithStreamingResponse(self._radar.http) @cached_property - def quality(self) -> QualityWithStreamingResponse: - return QualityWithStreamingResponse(self._radar.quality) + def quality(self) -> QualityResourceWithStreamingResponse: + return QualityResourceWithStreamingResponse(self._radar.quality) @cached_property - def ranking(self) -> RankingWithStreamingResponse: - return RankingWithStreamingResponse(self._radar.ranking) + def ranking(self) -> RankingResourceWithStreamingResponse: + return RankingResourceWithStreamingResponse(self._radar.ranking) @cached_property - def traffic_anomalies(self) -> TrafficAnomaliesWithStreamingResponse: - return TrafficAnomaliesWithStreamingResponse(self._radar.traffic_anomalies) + def traffic_anomalies(self) -> TrafficAnomaliesResourceWithStreamingResponse: + return TrafficAnomaliesResourceWithStreamingResponse(self._radar.traffic_anomalies) -class AsyncRadarWithStreamingResponse: - def __init__(self, radar: AsyncRadar) -> None: +class AsyncRadarResourceWithStreamingResponse: + def __init__(self, radar: AsyncRadarResource) -> None: self._radar = radar @cached_property - def annotations(self) -> AsyncAnnotationsWithStreamingResponse: - return AsyncAnnotationsWithStreamingResponse(self._radar.annotations) + def annotations(self) -> AsyncAnnotationsResourceWithStreamingResponse: + return AsyncAnnotationsResourceWithStreamingResponse(self._radar.annotations) @cached_property - def bgp(self) -> AsyncBGPWithStreamingResponse: - return AsyncBGPWithStreamingResponse(self._radar.bgp) + def bgp(self) -> AsyncBGPResourceWithStreamingResponse: + return AsyncBGPResourceWithStreamingResponse(self._radar.bgp) @cached_property - def datasets(self) -> AsyncDatasetsWithStreamingResponse: - return AsyncDatasetsWithStreamingResponse(self._radar.datasets) + def datasets(self) -> AsyncDatasetsResourceWithStreamingResponse: + return AsyncDatasetsResourceWithStreamingResponse(self._radar.datasets) @cached_property - def dns(self) -> AsyncDNSWithStreamingResponse: - return AsyncDNSWithStreamingResponse(self._radar.dns) + def dns(self) -> AsyncDNSResourceWithStreamingResponse: + return AsyncDNSResourceWithStreamingResponse(self._radar.dns) @cached_property - def netflows(self) -> AsyncNetflowsWithStreamingResponse: - return AsyncNetflowsWithStreamingResponse(self._radar.netflows) + def netflows(self) -> AsyncNetflowsResourceWithStreamingResponse: + return AsyncNetflowsResourceWithStreamingResponse(self._radar.netflows) @cached_property - def search(self) -> AsyncSearchWithStreamingResponse: - return AsyncSearchWithStreamingResponse(self._radar.search) + def search(self) -> AsyncSearchResourceWithStreamingResponse: + return AsyncSearchResourceWithStreamingResponse(self._radar.search) @cached_property - def verified_bots(self) -> AsyncVerifiedBotsWithStreamingResponse: - return AsyncVerifiedBotsWithStreamingResponse(self._radar.verified_bots) + def verified_bots(self) -> AsyncVerifiedBotsResourceWithStreamingResponse: + return AsyncVerifiedBotsResourceWithStreamingResponse(self._radar.verified_bots) @cached_property - def as112(self) -> AsyncAS112WithStreamingResponse: - return AsyncAS112WithStreamingResponse(self._radar.as112) + def as112(self) -> AsyncAS112ResourceWithStreamingResponse: + return AsyncAS112ResourceWithStreamingResponse(self._radar.as112) @cached_property - def connection_tampering(self) -> AsyncConnectionTamperingWithStreamingResponse: - return AsyncConnectionTamperingWithStreamingResponse(self._radar.connection_tampering) + def connection_tampering(self) -> AsyncConnectionTamperingResourceWithStreamingResponse: + return AsyncConnectionTamperingResourceWithStreamingResponse(self._radar.connection_tampering) @cached_property - def email(self) -> AsyncEmailWithStreamingResponse: - return AsyncEmailWithStreamingResponse(self._radar.email) + def email(self) -> AsyncEmailResourceWithStreamingResponse: + return AsyncEmailResourceWithStreamingResponse(self._radar.email) @cached_property - def attacks(self) -> AsyncAttacksWithStreamingResponse: - return AsyncAttacksWithStreamingResponse(self._radar.attacks) + def attacks(self) -> AsyncAttacksResourceWithStreamingResponse: + return AsyncAttacksResourceWithStreamingResponse(self._radar.attacks) @cached_property - def entities(self) -> AsyncEntitiesWithStreamingResponse: - return AsyncEntitiesWithStreamingResponse(self._radar.entities) + def entities(self) -> AsyncEntitiesResourceWithStreamingResponse: + return AsyncEntitiesResourceWithStreamingResponse(self._radar.entities) @cached_property - def http(self) -> AsyncHTTPWithStreamingResponse: - return AsyncHTTPWithStreamingResponse(self._radar.http) + def http(self) -> AsyncHTTPResourceWithStreamingResponse: + return AsyncHTTPResourceWithStreamingResponse(self._radar.http) @cached_property - def quality(self) -> AsyncQualityWithStreamingResponse: - return AsyncQualityWithStreamingResponse(self._radar.quality) + def quality(self) -> AsyncQualityResourceWithStreamingResponse: + return AsyncQualityResourceWithStreamingResponse(self._radar.quality) @cached_property - def ranking(self) -> AsyncRankingWithStreamingResponse: - return AsyncRankingWithStreamingResponse(self._radar.ranking) + def ranking(self) -> AsyncRankingResourceWithStreamingResponse: + return AsyncRankingResourceWithStreamingResponse(self._radar.ranking) @cached_property - def traffic_anomalies(self) -> AsyncTrafficAnomaliesWithStreamingResponse: - return AsyncTrafficAnomaliesWithStreamingResponse(self._radar.traffic_anomalies) + def traffic_anomalies(self) -> AsyncTrafficAnomaliesResourceWithStreamingResponse: + return AsyncTrafficAnomaliesResourceWithStreamingResponse(self._radar.traffic_anomalies) diff --git a/src/cloudflare/resources/radar/ranking/__init__.py b/src/cloudflare/resources/radar/ranking/__init__.py index 0079d940501..cbb9e681fe6 100644 --- a/src/cloudflare/resources/radar/ranking/__init__.py +++ b/src/cloudflare/resources/radar/ranking/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .domain import ( - Domain, - AsyncDomain, - DomainWithRawResponse, - AsyncDomainWithRawResponse, - DomainWithStreamingResponse, - AsyncDomainWithStreamingResponse, + DomainResource, + AsyncDomainResource, + DomainResourceWithRawResponse, + AsyncDomainResourceWithRawResponse, + DomainResourceWithStreamingResponse, + AsyncDomainResourceWithStreamingResponse, ) from .ranking import ( - Ranking, - AsyncRanking, - RankingWithRawResponse, - AsyncRankingWithRawResponse, - RankingWithStreamingResponse, - AsyncRankingWithStreamingResponse, + RankingResource, + AsyncRankingResource, + RankingResourceWithRawResponse, + AsyncRankingResourceWithRawResponse, + RankingResourceWithStreamingResponse, + AsyncRankingResourceWithStreamingResponse, ) __all__ = [ - "Domain", - "AsyncDomain", - "DomainWithRawResponse", - "AsyncDomainWithRawResponse", - "DomainWithStreamingResponse", - "AsyncDomainWithStreamingResponse", - "Ranking", - "AsyncRanking", - "RankingWithRawResponse", - "AsyncRankingWithRawResponse", - "RankingWithStreamingResponse", - "AsyncRankingWithStreamingResponse", + "DomainResource", + "AsyncDomainResource", + "DomainResourceWithRawResponse", + "AsyncDomainResourceWithRawResponse", + "DomainResourceWithStreamingResponse", + "AsyncDomainResourceWithStreamingResponse", + "RankingResource", + "AsyncRankingResource", + "RankingResourceWithRawResponse", + "AsyncRankingResourceWithRawResponse", + "RankingResourceWithStreamingResponse", + "AsyncRankingResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/ranking/domain.py b/src/cloudflare/resources/radar/ranking/domain.py index 8c09364a8cf..19aaa5d8e25 100644 --- a/src/cloudflare/resources/radar/ranking/domain.py +++ b/src/cloudflare/resources/radar/ranking/domain.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.ranking import DomainGetResponse, domain_get_params +from ....types.radar.ranking import domain_get_params +from ....types.radar.ranking.domain_get_response import DomainGetResponse -__all__ = ["Domain", "AsyncDomain"] +__all__ = ["DomainResource", "AsyncDomainResource"] -class Domain(SyncAPIResource): +class DomainResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DomainWithRawResponse: - return DomainWithRawResponse(self) + def with_raw_response(self) -> DomainResourceWithRawResponse: + return DomainResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DomainWithStreamingResponse: - return DomainWithStreamingResponse(self) + def with_streaming_response(self) -> DomainResourceWithStreamingResponse: + return DomainResourceWithStreamingResponse(self) def get( self, @@ -99,20 +100,20 @@ def get( }, domain_get_params.DomainGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DomainGetResponse]._unwrapper, ), cast_to=cast(Type[DomainGetResponse], ResultWrapper[DomainGetResponse]), ) -class AsyncDomain(AsyncAPIResource): +class AsyncDomainResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDomainWithRawResponse: - return AsyncDomainWithRawResponse(self) + def with_raw_response(self) -> AsyncDomainResourceWithRawResponse: + return AsyncDomainResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDomainWithStreamingResponse: - return AsyncDomainWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDomainResourceWithStreamingResponse: + return AsyncDomainResourceWithStreamingResponse(self) async def get( self, @@ -175,14 +176,14 @@ async def get( }, domain_get_params.DomainGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DomainGetResponse]._unwrapper, ), cast_to=cast(Type[DomainGetResponse], ResultWrapper[DomainGetResponse]), ) -class DomainWithRawResponse: - def __init__(self, domain: Domain) -> None: +class DomainResourceWithRawResponse: + def __init__(self, domain: DomainResource) -> None: self._domain = domain self.get = to_raw_response_wrapper( @@ -190,8 +191,8 @@ def __init__(self, domain: Domain) -> None: ) -class AsyncDomainWithRawResponse: - def __init__(self, domain: AsyncDomain) -> None: +class AsyncDomainResourceWithRawResponse: + def __init__(self, domain: AsyncDomainResource) -> None: self._domain = domain self.get = async_to_raw_response_wrapper( @@ -199,8 +200,8 @@ def __init__(self, domain: AsyncDomain) -> None: ) -class DomainWithStreamingResponse: - def __init__(self, domain: Domain) -> None: +class DomainResourceWithStreamingResponse: + def __init__(self, domain: DomainResource) -> None: self._domain = domain self.get = to_streamed_response_wrapper( @@ -208,8 +209,8 @@ def __init__(self, domain: Domain) -> None: ) -class AsyncDomainWithStreamingResponse: - def __init__(self, domain: AsyncDomain) -> None: +class AsyncDomainResourceWithStreamingResponse: + def __init__(self, domain: AsyncDomainResource) -> None: self._domain = domain self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/ranking/ranking.py b/src/cloudflare/resources/radar/ranking/ranking.py index 61dc92dd4b5..ecabe6a0154 100644 --- a/src/cloudflare/resources/radar/ranking/ranking.py +++ b/src/cloudflare/resources/radar/ranking/ranking.py @@ -9,12 +9,12 @@ import httpx from .domain import ( - Domain, - AsyncDomain, - DomainWithRawResponse, - AsyncDomainWithRawResponse, - DomainWithStreamingResponse, - AsyncDomainWithStreamingResponse, + DomainResource, + AsyncDomainResource, + DomainResourceWithRawResponse, + AsyncDomainResourceWithRawResponse, + DomainResourceWithStreamingResponse, + AsyncDomainResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -30,31 +30,28 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.radar import ( - RankingTopResponse, - RankingTimeseriesGroupsResponse, - ranking_top_params, - ranking_timeseries_groups_params, -) +from ....types.radar import ranking_top_params, ranking_timeseries_groups_params from ...._base_client import ( make_request_options, ) +from ....types.radar.ranking_top_response import RankingTopResponse +from ....types.radar.ranking_timeseries_groups_response import RankingTimeseriesGroupsResponse -__all__ = ["Ranking", "AsyncRanking"] +__all__ = ["RankingResource", "AsyncRankingResource"] -class Ranking(SyncAPIResource): +class RankingResource(SyncAPIResource): @cached_property - def domain(self) -> Domain: - return Domain(self._client) + def domain(self) -> DomainResource: + return DomainResource(self._client) @cached_property - def with_raw_response(self) -> RankingWithRawResponse: - return RankingWithRawResponse(self) + def with_raw_response(self) -> RankingResourceWithRawResponse: + return RankingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RankingWithStreamingResponse: - return RankingWithStreamingResponse(self) + def with_streaming_response(self) -> RankingResourceWithStreamingResponse: + return RankingResourceWithStreamingResponse(self) def timeseries_groups( self, @@ -148,7 +145,7 @@ def timeseries_groups( }, ranking_timeseries_groups_params.RankingTimeseriesGroupsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RankingTimeseriesGroupsResponse]._unwrapper, ), cast_to=cast(Type[RankingTimeseriesGroupsResponse], ResultWrapper[RankingTimeseriesGroupsResponse]), ) @@ -215,24 +212,24 @@ def top( }, ranking_top_params.RankingTopParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RankingTopResponse]._unwrapper, ), cast_to=cast(Type[RankingTopResponse], ResultWrapper[RankingTopResponse]), ) -class AsyncRanking(AsyncAPIResource): +class AsyncRankingResource(AsyncAPIResource): @cached_property - def domain(self) -> AsyncDomain: - return AsyncDomain(self._client) + def domain(self) -> AsyncDomainResource: + return AsyncDomainResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRankingWithRawResponse: - return AsyncRankingWithRawResponse(self) + def with_raw_response(self) -> AsyncRankingResourceWithRawResponse: + return AsyncRankingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRankingWithStreamingResponse: - return AsyncRankingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRankingResourceWithStreamingResponse: + return AsyncRankingResourceWithStreamingResponse(self) async def timeseries_groups( self, @@ -326,7 +323,7 @@ async def timeseries_groups( }, ranking_timeseries_groups_params.RankingTimeseriesGroupsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RankingTimeseriesGroupsResponse]._unwrapper, ), cast_to=cast(Type[RankingTimeseriesGroupsResponse], ResultWrapper[RankingTimeseriesGroupsResponse]), ) @@ -393,14 +390,14 @@ async def top( }, ranking_top_params.RankingTopParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RankingTopResponse]._unwrapper, ), cast_to=cast(Type[RankingTopResponse], ResultWrapper[RankingTopResponse]), ) -class RankingWithRawResponse: - def __init__(self, ranking: Ranking) -> None: +class RankingResourceWithRawResponse: + def __init__(self, ranking: RankingResource) -> None: self._ranking = ranking self.timeseries_groups = to_raw_response_wrapper( @@ -411,12 +408,12 @@ def __init__(self, ranking: Ranking) -> None: ) @cached_property - def domain(self) -> DomainWithRawResponse: - return DomainWithRawResponse(self._ranking.domain) + def domain(self) -> DomainResourceWithRawResponse: + return DomainResourceWithRawResponse(self._ranking.domain) -class AsyncRankingWithRawResponse: - def __init__(self, ranking: AsyncRanking) -> None: +class AsyncRankingResourceWithRawResponse: + def __init__(self, ranking: AsyncRankingResource) -> None: self._ranking = ranking self.timeseries_groups = async_to_raw_response_wrapper( @@ -427,12 +424,12 @@ def __init__(self, ranking: AsyncRanking) -> None: ) @cached_property - def domain(self) -> AsyncDomainWithRawResponse: - return AsyncDomainWithRawResponse(self._ranking.domain) + def domain(self) -> AsyncDomainResourceWithRawResponse: + return AsyncDomainResourceWithRawResponse(self._ranking.domain) -class RankingWithStreamingResponse: - def __init__(self, ranking: Ranking) -> None: +class RankingResourceWithStreamingResponse: + def __init__(self, ranking: RankingResource) -> None: self._ranking = ranking self.timeseries_groups = to_streamed_response_wrapper( @@ -443,12 +440,12 @@ def __init__(self, ranking: Ranking) -> None: ) @cached_property - def domain(self) -> DomainWithStreamingResponse: - return DomainWithStreamingResponse(self._ranking.domain) + def domain(self) -> DomainResourceWithStreamingResponse: + return DomainResourceWithStreamingResponse(self._ranking.domain) -class AsyncRankingWithStreamingResponse: - def __init__(self, ranking: AsyncRanking) -> None: +class AsyncRankingResourceWithStreamingResponse: + def __init__(self, ranking: AsyncRankingResource) -> None: self._ranking = ranking self.timeseries_groups = async_to_streamed_response_wrapper( @@ -459,5 +456,5 @@ def __init__(self, ranking: AsyncRanking) -> None: ) @cached_property - def domain(self) -> AsyncDomainWithStreamingResponse: - return AsyncDomainWithStreamingResponse(self._ranking.domain) + def domain(self) -> AsyncDomainResourceWithStreamingResponse: + return AsyncDomainResourceWithStreamingResponse(self._ranking.domain) diff --git a/src/cloudflare/resources/radar/search.py b/src/cloudflare/resources/radar/search.py index 0a0682695a3..d355e6deb96 100644 --- a/src/cloudflare/resources/radar/search.py +++ b/src/cloudflare/resources/radar/search.py @@ -21,22 +21,23 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.radar import SearchGlobalResponse, search_global_params +from ...types.radar import search_global_params from ..._base_client import ( make_request_options, ) +from ...types.radar.search_global_response import SearchGlobalResponse -__all__ = ["Search", "AsyncSearch"] +__all__ = ["SearchResource", "AsyncSearchResource"] -class Search(SyncAPIResource): +class SearchResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SearchWithRawResponse: - return SearchWithRawResponse(self) + def with_raw_response(self) -> SearchResourceWithRawResponse: + return SearchResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SearchWithStreamingResponse: - return SearchWithStreamingResponse(self) + def with_streaming_response(self) -> SearchResourceWithStreamingResponse: + return SearchResourceWithStreamingResponse(self) def global_( self, @@ -96,20 +97,20 @@ def global_( }, search_global_params.SearchGlobalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SearchGlobalResponse]._unwrapper, ), cast_to=cast(Type[SearchGlobalResponse], ResultWrapper[SearchGlobalResponse]), ) -class AsyncSearch(AsyncAPIResource): +class AsyncSearchResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSearchWithRawResponse: - return AsyncSearchWithRawResponse(self) + def with_raw_response(self) -> AsyncSearchResourceWithRawResponse: + return AsyncSearchResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSearchWithStreamingResponse: - return AsyncSearchWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSearchResourceWithStreamingResponse: + return AsyncSearchResourceWithStreamingResponse(self) async def global_( self, @@ -169,14 +170,14 @@ async def global_( }, search_global_params.SearchGlobalParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SearchGlobalResponse]._unwrapper, ), cast_to=cast(Type[SearchGlobalResponse], ResultWrapper[SearchGlobalResponse]), ) -class SearchWithRawResponse: - def __init__(self, search: Search) -> None: +class SearchResourceWithRawResponse: + def __init__(self, search: SearchResource) -> None: self._search = search self.global_ = to_raw_response_wrapper( @@ -184,8 +185,8 @@ def __init__(self, search: Search) -> None: ) -class AsyncSearchWithRawResponse: - def __init__(self, search: AsyncSearch) -> None: +class AsyncSearchResourceWithRawResponse: + def __init__(self, search: AsyncSearchResource) -> None: self._search = search self.global_ = async_to_raw_response_wrapper( @@ -193,8 +194,8 @@ def __init__(self, search: AsyncSearch) -> None: ) -class SearchWithStreamingResponse: - def __init__(self, search: Search) -> None: +class SearchResourceWithStreamingResponse: + def __init__(self, search: SearchResource) -> None: self._search = search self.global_ = to_streamed_response_wrapper( @@ -202,8 +203,8 @@ def __init__(self, search: Search) -> None: ) -class AsyncSearchWithStreamingResponse: - def __init__(self, search: AsyncSearch) -> None: +class AsyncSearchResourceWithStreamingResponse: + def __init__(self, search: AsyncSearchResource) -> None: self._search = search self.global_ = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/traffic_anomalies/__init__.py b/src/cloudflare/resources/radar/traffic_anomalies/__init__.py index f537f98cbe2..122941b73c2 100644 --- a/src/cloudflare/resources/radar/traffic_anomalies/__init__.py +++ b/src/cloudflare/resources/radar/traffic_anomalies/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from .traffic_anomalies import ( - TrafficAnomalies, - AsyncTrafficAnomalies, - TrafficAnomaliesWithRawResponse, - AsyncTrafficAnomaliesWithRawResponse, - TrafficAnomaliesWithStreamingResponse, - AsyncTrafficAnomaliesWithStreamingResponse, + TrafficAnomaliesResource, + AsyncTrafficAnomaliesResource, + TrafficAnomaliesResourceWithRawResponse, + AsyncTrafficAnomaliesResourceWithRawResponse, + TrafficAnomaliesResourceWithStreamingResponse, + AsyncTrafficAnomaliesResourceWithStreamingResponse, ) __all__ = [ - "Locations", - "AsyncLocations", - "LocationsWithRawResponse", - "AsyncLocationsWithRawResponse", - "LocationsWithStreamingResponse", - "AsyncLocationsWithStreamingResponse", - "TrafficAnomalies", - "AsyncTrafficAnomalies", - "TrafficAnomaliesWithRawResponse", - "AsyncTrafficAnomaliesWithRawResponse", - "TrafficAnomaliesWithStreamingResponse", - "AsyncTrafficAnomaliesWithStreamingResponse", + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", + "TrafficAnomaliesResource", + "AsyncTrafficAnomaliesResource", + "TrafficAnomaliesResourceWithRawResponse", + "AsyncTrafficAnomaliesResourceWithRawResponse", + "TrafficAnomaliesResourceWithStreamingResponse", + "AsyncTrafficAnomaliesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/traffic_anomalies/locations.py b/src/cloudflare/resources/radar/traffic_anomalies/locations.py index 981cf07f55b..851686c3964 100644 --- a/src/cloudflare/resources/radar/traffic_anomalies/locations.py +++ b/src/cloudflare/resources/radar/traffic_anomalies/locations.py @@ -25,19 +25,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.traffic_anomalies import LocationGetResponse, location_get_params +from ....types.radar.traffic_anomalies import location_get_params +from ....types.radar.traffic_anomalies.location_get_response import LocationGetResponse -__all__ = ["Locations", "AsyncLocations"] +__all__ = ["LocationsResource", "AsyncLocationsResource"] -class Locations(SyncAPIResource): +class LocationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self) + def with_raw_response(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self) + def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self) def get( self, @@ -115,20 +116,20 @@ def get( }, location_get_params.LocationGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationGetResponse]._unwrapper, ), cast_to=cast(Type[LocationGetResponse], ResultWrapper[LocationGetResponse]), ) -class AsyncLocations(AsyncAPIResource): +class AsyncLocationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self) + def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self) async def get( self, @@ -206,14 +207,14 @@ async def get( }, location_get_params.LocationGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[LocationGetResponse]._unwrapper, ), cast_to=cast(Type[LocationGetResponse], ResultWrapper[LocationGetResponse]), ) -class LocationsWithRawResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithRawResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.get = to_raw_response_wrapper( @@ -221,8 +222,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithRawResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithRawResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.get = async_to_raw_response_wrapper( @@ -230,8 +231,8 @@ def __init__(self, locations: AsyncLocations) -> None: ) -class LocationsWithStreamingResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithStreamingResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.get = to_streamed_response_wrapper( @@ -239,8 +240,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithStreamingResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithStreamingResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/traffic_anomalies/traffic_anomalies.py b/src/cloudflare/resources/radar/traffic_anomalies/traffic_anomalies.py index cf4d8e2394d..6a24039a9aa 100644 --- a/src/cloudflare/resources/radar/traffic_anomalies/traffic_anomalies.py +++ b/src/cloudflare/resources/radar/traffic_anomalies/traffic_anomalies.py @@ -14,12 +14,12 @@ async_maybe_transform, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -30,26 +30,27 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.radar import TrafficAnomalyGetResponse, traffic_anomaly_get_params +from ....types.radar import traffic_anomaly_get_params from ...._base_client import ( make_request_options, ) +from ....types.radar.traffic_anomaly_get_response import TrafficAnomalyGetResponse -__all__ = ["TrafficAnomalies", "AsyncTrafficAnomalies"] +__all__ = ["TrafficAnomaliesResource", "AsyncTrafficAnomaliesResource"] -class TrafficAnomalies(SyncAPIResource): +class TrafficAnomaliesResource(SyncAPIResource): @cached_property - def locations(self) -> Locations: - return Locations(self._client) + def locations(self) -> LocationsResource: + return LocationsResource(self._client) @cached_property - def with_raw_response(self) -> TrafficAnomaliesWithRawResponse: - return TrafficAnomaliesWithRawResponse(self) + def with_raw_response(self) -> TrafficAnomaliesResourceWithRawResponse: + return TrafficAnomaliesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TrafficAnomaliesWithStreamingResponse: - return TrafficAnomaliesWithStreamingResponse(self) + def with_streaming_response(self) -> TrafficAnomaliesResourceWithStreamingResponse: + return TrafficAnomaliesResourceWithStreamingResponse(self) def get( self, @@ -139,24 +140,24 @@ def get( }, traffic_anomaly_get_params.TrafficAnomalyGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TrafficAnomalyGetResponse]._unwrapper, ), cast_to=cast(Type[TrafficAnomalyGetResponse], ResultWrapper[TrafficAnomalyGetResponse]), ) -class AsyncTrafficAnomalies(AsyncAPIResource): +class AsyncTrafficAnomaliesResource(AsyncAPIResource): @cached_property - def locations(self) -> AsyncLocations: - return AsyncLocations(self._client) + def locations(self) -> AsyncLocationsResource: + return AsyncLocationsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTrafficAnomaliesWithRawResponse: - return AsyncTrafficAnomaliesWithRawResponse(self) + def with_raw_response(self) -> AsyncTrafficAnomaliesResourceWithRawResponse: + return AsyncTrafficAnomaliesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTrafficAnomaliesWithStreamingResponse: - return AsyncTrafficAnomaliesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTrafficAnomaliesResourceWithStreamingResponse: + return AsyncTrafficAnomaliesResourceWithStreamingResponse(self) async def get( self, @@ -246,14 +247,14 @@ async def get( }, traffic_anomaly_get_params.TrafficAnomalyGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TrafficAnomalyGetResponse]._unwrapper, ), cast_to=cast(Type[TrafficAnomalyGetResponse], ResultWrapper[TrafficAnomalyGetResponse]), ) -class TrafficAnomaliesWithRawResponse: - def __init__(self, traffic_anomalies: TrafficAnomalies) -> None: +class TrafficAnomaliesResourceWithRawResponse: + def __init__(self, traffic_anomalies: TrafficAnomaliesResource) -> None: self._traffic_anomalies = traffic_anomalies self.get = to_raw_response_wrapper( @@ -261,12 +262,12 @@ def __init__(self, traffic_anomalies: TrafficAnomalies) -> None: ) @cached_property - def locations(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self._traffic_anomalies.locations) + def locations(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self._traffic_anomalies.locations) -class AsyncTrafficAnomaliesWithRawResponse: - def __init__(self, traffic_anomalies: AsyncTrafficAnomalies) -> None: +class AsyncTrafficAnomaliesResourceWithRawResponse: + def __init__(self, traffic_anomalies: AsyncTrafficAnomaliesResource) -> None: self._traffic_anomalies = traffic_anomalies self.get = async_to_raw_response_wrapper( @@ -274,12 +275,12 @@ def __init__(self, traffic_anomalies: AsyncTrafficAnomalies) -> None: ) @cached_property - def locations(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self._traffic_anomalies.locations) + def locations(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self._traffic_anomalies.locations) -class TrafficAnomaliesWithStreamingResponse: - def __init__(self, traffic_anomalies: TrafficAnomalies) -> None: +class TrafficAnomaliesResourceWithStreamingResponse: + def __init__(self, traffic_anomalies: TrafficAnomaliesResource) -> None: self._traffic_anomalies = traffic_anomalies self.get = to_streamed_response_wrapper( @@ -287,12 +288,12 @@ def __init__(self, traffic_anomalies: TrafficAnomalies) -> None: ) @cached_property - def locations(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self._traffic_anomalies.locations) + def locations(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self._traffic_anomalies.locations) -class AsyncTrafficAnomaliesWithStreamingResponse: - def __init__(self, traffic_anomalies: AsyncTrafficAnomalies) -> None: +class AsyncTrafficAnomaliesResourceWithStreamingResponse: + def __init__(self, traffic_anomalies: AsyncTrafficAnomaliesResource) -> None: self._traffic_anomalies = traffic_anomalies self.get = async_to_streamed_response_wrapper( @@ -300,5 +301,5 @@ def __init__(self, traffic_anomalies: AsyncTrafficAnomalies) -> None: ) @cached_property - def locations(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self._traffic_anomalies.locations) + def locations(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self._traffic_anomalies.locations) diff --git a/src/cloudflare/resources/radar/verified_bots/__init__.py b/src/cloudflare/resources/radar/verified_bots/__init__.py index f06f5ebe381..e4a6ff0a0c2 100644 --- a/src/cloudflare/resources/radar/verified_bots/__init__.py +++ b/src/cloudflare/resources/radar/verified_bots/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from .verified_bots import ( - VerifiedBots, - AsyncVerifiedBots, - VerifiedBotsWithRawResponse, - AsyncVerifiedBotsWithRawResponse, - VerifiedBotsWithStreamingResponse, - AsyncVerifiedBotsWithStreamingResponse, + VerifiedBotsResource, + AsyncVerifiedBotsResource, + VerifiedBotsResourceWithRawResponse, + AsyncVerifiedBotsResourceWithRawResponse, + VerifiedBotsResourceWithStreamingResponse, + AsyncVerifiedBotsResourceWithStreamingResponse, ) __all__ = [ - "Top", - "AsyncTop", - "TopWithRawResponse", - "AsyncTopWithRawResponse", - "TopWithStreamingResponse", - "AsyncTopWithStreamingResponse", - "VerifiedBots", - "AsyncVerifiedBots", - "VerifiedBotsWithRawResponse", - "AsyncVerifiedBotsWithRawResponse", - "VerifiedBotsWithStreamingResponse", - "AsyncVerifiedBotsWithStreamingResponse", + "TopResource", + "AsyncTopResource", + "TopResourceWithRawResponse", + "AsyncTopResourceWithRawResponse", + "TopResourceWithStreamingResponse", + "AsyncTopResourceWithStreamingResponse", + "VerifiedBotsResource", + "AsyncVerifiedBotsResource", + "VerifiedBotsResourceWithRawResponse", + "AsyncVerifiedBotsResourceWithRawResponse", + "VerifiedBotsResourceWithStreamingResponse", + "AsyncVerifiedBotsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/verified_bots/top.py b/src/cloudflare/resources/radar/verified_bots/top.py index 3d512538c45..5b7b011891a 100644 --- a/src/cloudflare/resources/radar/verified_bots/top.py +++ b/src/cloudflare/resources/radar/verified_bots/top.py @@ -25,19 +25,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.verified_bots import TopBotsResponse, TopCategoriesResponse, top_bots_params, top_categories_params +from ....types.radar.verified_bots import top_bots_params, top_categories_params +from ....types.radar.verified_bots.top_bots_response import TopBotsResponse +from ....types.radar.verified_bots.top_categories_response import TopCategoriesResponse -__all__ = ["Top", "AsyncTop"] +__all__ = ["TopResource", "AsyncTopResource"] -class Top(SyncAPIResource): +class TopResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TopWithRawResponse: - return TopWithRawResponse(self) + def with_raw_response(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self) + def with_streaming_response(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self) def bots( self, @@ -136,7 +138,7 @@ def bots( }, top_bots_params.TopBotsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopBotsResponse]._unwrapper, ), cast_to=cast(Type[TopBotsResponse], ResultWrapper[TopBotsResponse]), ) @@ -239,20 +241,20 @@ def categories( }, top_categories_params.TopCategoriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopCategoriesResponse]._unwrapper, ), cast_to=cast(Type[TopCategoriesResponse], ResultWrapper[TopCategoriesResponse]), ) -class AsyncTop(AsyncAPIResource): +class AsyncTopResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self) + def with_raw_response(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self) async def bots( self, @@ -351,7 +353,7 @@ async def bots( }, top_bots_params.TopBotsParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopBotsResponse]._unwrapper, ), cast_to=cast(Type[TopBotsResponse], ResultWrapper[TopBotsResponse]), ) @@ -454,14 +456,14 @@ async def categories( }, top_categories_params.TopCategoriesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TopCategoriesResponse]._unwrapper, ), cast_to=cast(Type[TopCategoriesResponse], ResultWrapper[TopCategoriesResponse]), ) -class TopWithRawResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithRawResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.bots = to_raw_response_wrapper( @@ -472,8 +474,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithRawResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithRawResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.bots = async_to_raw_response_wrapper( @@ -484,8 +486,8 @@ def __init__(self, top: AsyncTop) -> None: ) -class TopWithStreamingResponse: - def __init__(self, top: Top) -> None: +class TopResourceWithStreamingResponse: + def __init__(self, top: TopResource) -> None: self._top = top self.bots = to_streamed_response_wrapper( @@ -496,8 +498,8 @@ def __init__(self, top: Top) -> None: ) -class AsyncTopWithStreamingResponse: - def __init__(self, top: AsyncTop) -> None: +class AsyncTopResourceWithStreamingResponse: + def __init__(self, top: AsyncTopResource) -> None: self._top = top self.bots = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/verified_bots/verified_bots.py b/src/cloudflare/resources/radar/verified_bots/verified_bots.py index d51a4ed59a0..d2563c2d472 100644 --- a/src/cloudflare/resources/radar/verified_bots/verified_bots.py +++ b/src/cloudflare/resources/radar/verified_bots/verified_bots.py @@ -3,78 +3,78 @@ from __future__ import annotations from .top import ( - Top, - AsyncTop, - TopWithRawResponse, - AsyncTopWithRawResponse, - TopWithStreamingResponse, - AsyncTopWithStreamingResponse, + TopResource, + AsyncTopResource, + TopResourceWithRawResponse, + AsyncTopResourceWithRawResponse, + TopResourceWithStreamingResponse, + AsyncTopResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["VerifiedBots", "AsyncVerifiedBots"] +__all__ = ["VerifiedBotsResource", "AsyncVerifiedBotsResource"] -class VerifiedBots(SyncAPIResource): +class VerifiedBotsResource(SyncAPIResource): @cached_property - def top(self) -> Top: - return Top(self._client) + def top(self) -> TopResource: + return TopResource(self._client) @cached_property - def with_raw_response(self) -> VerifiedBotsWithRawResponse: - return VerifiedBotsWithRawResponse(self) + def with_raw_response(self) -> VerifiedBotsResourceWithRawResponse: + return VerifiedBotsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VerifiedBotsWithStreamingResponse: - return VerifiedBotsWithStreamingResponse(self) + def with_streaming_response(self) -> VerifiedBotsResourceWithStreamingResponse: + return VerifiedBotsResourceWithStreamingResponse(self) -class AsyncVerifiedBots(AsyncAPIResource): +class AsyncVerifiedBotsResource(AsyncAPIResource): @cached_property - def top(self) -> AsyncTop: - return AsyncTop(self._client) + def top(self) -> AsyncTopResource: + return AsyncTopResource(self._client) @cached_property - def with_raw_response(self) -> AsyncVerifiedBotsWithRawResponse: - return AsyncVerifiedBotsWithRawResponse(self) + def with_raw_response(self) -> AsyncVerifiedBotsResourceWithRawResponse: + return AsyncVerifiedBotsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVerifiedBotsWithStreamingResponse: - return AsyncVerifiedBotsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVerifiedBotsResourceWithStreamingResponse: + return AsyncVerifiedBotsResourceWithStreamingResponse(self) -class VerifiedBotsWithRawResponse: - def __init__(self, verified_bots: VerifiedBots) -> None: +class VerifiedBotsResourceWithRawResponse: + def __init__(self, verified_bots: VerifiedBotsResource) -> None: self._verified_bots = verified_bots @cached_property - def top(self) -> TopWithRawResponse: - return TopWithRawResponse(self._verified_bots.top) + def top(self) -> TopResourceWithRawResponse: + return TopResourceWithRawResponse(self._verified_bots.top) -class AsyncVerifiedBotsWithRawResponse: - def __init__(self, verified_bots: AsyncVerifiedBots) -> None: +class AsyncVerifiedBotsResourceWithRawResponse: + def __init__(self, verified_bots: AsyncVerifiedBotsResource) -> None: self._verified_bots = verified_bots @cached_property - def top(self) -> AsyncTopWithRawResponse: - return AsyncTopWithRawResponse(self._verified_bots.top) + def top(self) -> AsyncTopResourceWithRawResponse: + return AsyncTopResourceWithRawResponse(self._verified_bots.top) -class VerifiedBotsWithStreamingResponse: - def __init__(self, verified_bots: VerifiedBots) -> None: +class VerifiedBotsResourceWithStreamingResponse: + def __init__(self, verified_bots: VerifiedBotsResource) -> None: self._verified_bots = verified_bots @cached_property - def top(self) -> TopWithStreamingResponse: - return TopWithStreamingResponse(self._verified_bots.top) + def top(self) -> TopResourceWithStreamingResponse: + return TopResourceWithStreamingResponse(self._verified_bots.top) -class AsyncVerifiedBotsWithStreamingResponse: - def __init__(self, verified_bots: AsyncVerifiedBots) -> None: +class AsyncVerifiedBotsResourceWithStreamingResponse: + def __init__(self, verified_bots: AsyncVerifiedBotsResource) -> None: self._verified_bots = verified_bots @cached_property - def top(self) -> AsyncTopWithStreamingResponse: - return AsyncTopWithStreamingResponse(self._verified_bots.top) + def top(self) -> AsyncTopResourceWithStreamingResponse: + return AsyncTopResourceWithStreamingResponse(self._verified_bots.top) diff --git a/src/cloudflare/resources/rate_limits.py b/src/cloudflare/resources/rate_limits.py index a6e2d76ed52..0cd9e9f3118 100644 --- a/src/cloudflare/resources/rate_limits.py +++ b/src/cloudflare/resources/rate_limits.py @@ -2,20 +2,10 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, Type, cast import httpx -from ..types import ( - RateLimitGetResponse, - RateLimitEditResponse, - RateLimitListResponse, - RateLimitCreateResponse, - RateLimitDeleteResponse, - rate_limit_edit_params, - rate_limit_list_params, - rate_limit_create_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -35,18 +25,29 @@ AsyncPaginator, make_request_options, ) +from ..types.rate_limits import ( + rate_limit_edit_params, + rate_limit_list_params, + rate_limit_create_params, + rate_limit_delete_params, +) +from ..types.rate_limits.rate_limit import RateLimit +from ..types.rate_limits.rate_limit_get_response import RateLimitGetResponse +from ..types.rate_limits.rate_limit_edit_response import RateLimitEditResponse +from ..types.rate_limits.rate_limit_create_response import RateLimitCreateResponse +from ..types.rate_limits.rate_limit_delete_response import RateLimitDeleteResponse -__all__ = ["RateLimits", "AsyncRateLimits"] +__all__ = ["RateLimitsResource", "AsyncRateLimitsResource"] -class RateLimits(SyncAPIResource): +class RateLimitsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RateLimitsWithRawResponse: - return RateLimitsWithRawResponse(self) + def with_raw_response(self) -> RateLimitsResourceWithRawResponse: + return RateLimitsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RateLimitsWithStreamingResponse: - return RateLimitsWithStreamingResponse(self) + def with_streaming_response(self) -> RateLimitsResourceWithStreamingResponse: + return RateLimitsResourceWithStreamingResponse(self) def create( self, @@ -59,7 +60,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RateLimitCreateResponse]: + ) -> RateLimitCreateResponse: """Creates a new rate limit for a zone. Refer to the object definition for a list @@ -79,7 +80,7 @@ def create( if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return cast( - Optional[RateLimitCreateResponse], + RateLimitCreateResponse, self._post( f"/zones/{zone_identifier}/rate_limits", body=maybe_transform(body, rate_limit_create_params.RateLimitCreateParams), @@ -88,7 +89,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RateLimitCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RateLimitCreateResponse] @@ -108,7 +109,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[RateLimitListResponse]: + ) -> SyncV4PagePaginationArray[RateLimit]: """ Fetches the rate limits for a zone. @@ -132,7 +133,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/rate_limits", - page=SyncV4PagePaginationArray[RateLimitListResponse], + page=SyncV4PagePaginationArray[RateLimit], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -146,7 +147,7 @@ def list( rate_limit_list_params.RateLimitListParams, ), ), - model=RateLimitListResponse, + model=RateLimit, ) def delete( @@ -154,13 +155,14 @@ def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[RateLimitDeleteResponse]: + ) -> RateLimitDeleteResponse: """ Deletes an existing rate limit. @@ -183,14 +185,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._delete( f"/zones/{zone_identifier}/rate_limits/{id}", + body=maybe_transform(body, rate_limit_delete_params.RateLimitDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RateLimitDeleteResponse]._unwrapper, ), - cast_to=cast(Type[Optional[RateLimitDeleteResponse]], ResultWrapper[RateLimitDeleteResponse]), + cast_to=cast(Type[RateLimitDeleteResponse], ResultWrapper[RateLimitDeleteResponse]), ) def edit( @@ -205,7 +208,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RateLimitEditResponse]: + ) -> RateLimitEditResponse: """ Updates an existing rate limit. @@ -227,7 +230,7 @@ def edit( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return cast( - Optional[RateLimitEditResponse], + RateLimitEditResponse, self._put( f"/zones/{zone_identifier}/rate_limits/{id}", body=maybe_transform(body, rate_limit_edit_params.RateLimitEditParams), @@ -236,7 +239,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RateLimitEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RateLimitEditResponse] @@ -255,7 +258,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RateLimitGetResponse]: + ) -> RateLimitGetResponse: """ Fetches the details of a rate limit. @@ -277,7 +280,7 @@ def get( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return cast( - Optional[RateLimitGetResponse], + RateLimitGetResponse, self._get( f"/zones/{zone_identifier}/rate_limits/{id}", options=make_request_options( @@ -285,7 +288,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RateLimitGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RateLimitGetResponse] @@ -294,14 +297,14 @@ def get( ) -class AsyncRateLimits(AsyncAPIResource): +class AsyncRateLimitsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRateLimitsWithRawResponse: - return AsyncRateLimitsWithRawResponse(self) + def with_raw_response(self) -> AsyncRateLimitsResourceWithRawResponse: + return AsyncRateLimitsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRateLimitsWithStreamingResponse: - return AsyncRateLimitsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRateLimitsResourceWithStreamingResponse: + return AsyncRateLimitsResourceWithStreamingResponse(self) async def create( self, @@ -314,7 +317,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RateLimitCreateResponse]: + ) -> RateLimitCreateResponse: """Creates a new rate limit for a zone. Refer to the object definition for a list @@ -334,7 +337,7 @@ async def create( if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return cast( - Optional[RateLimitCreateResponse], + RateLimitCreateResponse, await self._post( f"/zones/{zone_identifier}/rate_limits", body=await async_maybe_transform(body, rate_limit_create_params.RateLimitCreateParams), @@ -343,7 +346,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RateLimitCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RateLimitCreateResponse] @@ -363,7 +366,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RateLimitListResponse, AsyncV4PagePaginationArray[RateLimitListResponse]]: + ) -> AsyncPaginator[RateLimit, AsyncV4PagePaginationArray[RateLimit]]: """ Fetches the rate limits for a zone. @@ -387,7 +390,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/rate_limits", - page=AsyncV4PagePaginationArray[RateLimitListResponse], + page=AsyncV4PagePaginationArray[RateLimit], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -401,7 +404,7 @@ def list( rate_limit_list_params.RateLimitListParams, ), ), - model=RateLimitListResponse, + model=RateLimit, ) async def delete( @@ -409,13 +412,14 @@ async def delete( id: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[RateLimitDeleteResponse]: + ) -> RateLimitDeleteResponse: """ Deletes an existing rate limit. @@ -438,14 +442,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._delete( f"/zones/{zone_identifier}/rate_limits/{id}", + body=await async_maybe_transform(body, rate_limit_delete_params.RateLimitDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RateLimitDeleteResponse]._unwrapper, ), - cast_to=cast(Type[Optional[RateLimitDeleteResponse]], ResultWrapper[RateLimitDeleteResponse]), + cast_to=cast(Type[RateLimitDeleteResponse], ResultWrapper[RateLimitDeleteResponse]), ) async def edit( @@ -460,7 +465,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RateLimitEditResponse]: + ) -> RateLimitEditResponse: """ Updates an existing rate limit. @@ -482,7 +487,7 @@ async def edit( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return cast( - Optional[RateLimitEditResponse], + RateLimitEditResponse, await self._put( f"/zones/{zone_identifier}/rate_limits/{id}", body=await async_maybe_transform(body, rate_limit_edit_params.RateLimitEditParams), @@ -491,7 +496,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RateLimitEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RateLimitEditResponse] @@ -510,7 +515,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RateLimitGetResponse]: + ) -> RateLimitGetResponse: """ Fetches the details of a rate limit. @@ -532,7 +537,7 @@ async def get( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return cast( - Optional[RateLimitGetResponse], + RateLimitGetResponse, await self._get( f"/zones/{zone_identifier}/rate_limits/{id}", options=make_request_options( @@ -540,7 +545,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RateLimitGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RateLimitGetResponse] @@ -549,8 +554,8 @@ async def get( ) -class RateLimitsWithRawResponse: - def __init__(self, rate_limits: RateLimits) -> None: +class RateLimitsResourceWithRawResponse: + def __init__(self, rate_limits: RateLimitsResource) -> None: self._rate_limits = rate_limits self.create = to_raw_response_wrapper( @@ -570,8 +575,8 @@ def __init__(self, rate_limits: RateLimits) -> None: ) -class AsyncRateLimitsWithRawResponse: - def __init__(self, rate_limits: AsyncRateLimits) -> None: +class AsyncRateLimitsResourceWithRawResponse: + def __init__(self, rate_limits: AsyncRateLimitsResource) -> None: self._rate_limits = rate_limits self.create = async_to_raw_response_wrapper( @@ -591,8 +596,8 @@ def __init__(self, rate_limits: AsyncRateLimits) -> None: ) -class RateLimitsWithStreamingResponse: - def __init__(self, rate_limits: RateLimits) -> None: +class RateLimitsResourceWithStreamingResponse: + def __init__(self, rate_limits: RateLimitsResource) -> None: self._rate_limits = rate_limits self.create = to_streamed_response_wrapper( @@ -612,8 +617,8 @@ def __init__(self, rate_limits: RateLimits) -> None: ) -class AsyncRateLimitsWithStreamingResponse: - def __init__(self, rate_limits: AsyncRateLimits) -> None: +class AsyncRateLimitsResourceWithStreamingResponse: + def __init__(self, rate_limits: AsyncRateLimitsResource) -> None: self._rate_limits = rate_limits self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/rate_plans.py b/src/cloudflare/resources/rate_plans.py index c6e967ff8f5..3c90903292e 100644 --- a/src/cloudflare/resources/rate_plans.py +++ b/src/cloudflare/resources/rate_plans.py @@ -6,7 +6,6 @@ import httpx -from ..types import RatePlanGetResponse from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -20,18 +19,19 @@ from .._base_client import ( make_request_options, ) +from ..types.rate_plans.rate_plan_get_response import RatePlanGetResponse -__all__ = ["RatePlans", "AsyncRatePlans"] +__all__ = ["RatePlansResource", "AsyncRatePlansResource"] -class RatePlans(SyncAPIResource): +class RatePlansResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RatePlansWithRawResponse: - return RatePlansWithRawResponse(self) + def with_raw_response(self) -> RatePlansResourceWithRawResponse: + return RatePlansResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RatePlansWithStreamingResponse: - return RatePlansWithStreamingResponse(self) + def with_streaming_response(self) -> RatePlansResourceWithStreamingResponse: + return RatePlansResourceWithStreamingResponse(self) def get( self, @@ -67,20 +67,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RatePlanGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RatePlanGetResponse]], ResultWrapper[RatePlanGetResponse]), ) -class AsyncRatePlans(AsyncAPIResource): +class AsyncRatePlansResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRatePlansWithRawResponse: - return AsyncRatePlansWithRawResponse(self) + def with_raw_response(self) -> AsyncRatePlansResourceWithRawResponse: + return AsyncRatePlansResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRatePlansWithStreamingResponse: - return AsyncRatePlansWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRatePlansResourceWithStreamingResponse: + return AsyncRatePlansResourceWithStreamingResponse(self) async def get( self, @@ -116,14 +116,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RatePlanGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RatePlanGetResponse]], ResultWrapper[RatePlanGetResponse]), ) -class RatePlansWithRawResponse: - def __init__(self, rate_plans: RatePlans) -> None: +class RatePlansResourceWithRawResponse: + def __init__(self, rate_plans: RatePlansResource) -> None: self._rate_plans = rate_plans self.get = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, rate_plans: RatePlans) -> None: ) -class AsyncRatePlansWithRawResponse: - def __init__(self, rate_plans: AsyncRatePlans) -> None: +class AsyncRatePlansResourceWithRawResponse: + def __init__(self, rate_plans: AsyncRatePlansResource) -> None: self._rate_plans = rate_plans self.get = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, rate_plans: AsyncRatePlans) -> None: ) -class RatePlansWithStreamingResponse: - def __init__(self, rate_plans: RatePlans) -> None: +class RatePlansResourceWithStreamingResponse: + def __init__(self, rate_plans: RatePlansResource) -> None: self._rate_plans = rate_plans self.get = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, rate_plans: RatePlans) -> None: ) -class AsyncRatePlansWithStreamingResponse: - def __init__(self, rate_plans: AsyncRatePlans) -> None: +class AsyncRatePlansResourceWithStreamingResponse: + def __init__(self, rate_plans: AsyncRatePlansResource) -> None: self._rate_plans = rate_plans self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/registrar/__init__.py b/src/cloudflare/resources/registrar/__init__.py index 410492bf2e7..e7c8e75402f 100644 --- a/src/cloudflare/resources/registrar/__init__.py +++ b/src/cloudflare/resources/registrar/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) from .registrar import ( - Registrar, - AsyncRegistrar, - RegistrarWithRawResponse, - AsyncRegistrarWithRawResponse, - RegistrarWithStreamingResponse, - AsyncRegistrarWithStreamingResponse, + RegistrarResource, + AsyncRegistrarResource, + RegistrarResourceWithRawResponse, + AsyncRegistrarResourceWithRawResponse, + RegistrarResourceWithStreamingResponse, + AsyncRegistrarResourceWithStreamingResponse, ) __all__ = [ - "Domains", - "AsyncDomains", - "DomainsWithRawResponse", - "AsyncDomainsWithRawResponse", - "DomainsWithStreamingResponse", - "AsyncDomainsWithStreamingResponse", - "Registrar", - "AsyncRegistrar", - "RegistrarWithRawResponse", - "AsyncRegistrarWithRawResponse", - "RegistrarWithStreamingResponse", - "AsyncRegistrarWithStreamingResponse", + "DomainsResource", + "AsyncDomainsResource", + "DomainsResourceWithRawResponse", + "AsyncDomainsResourceWithRawResponse", + "DomainsResourceWithStreamingResponse", + "AsyncDomainsResourceWithStreamingResponse", + "RegistrarResource", + "AsyncRegistrarResource", + "RegistrarResourceWithRawResponse", + "AsyncRegistrarResourceWithRawResponse", + "RegistrarResourceWithStreamingResponse", + "AsyncRegistrarResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/registrar/domains.py b/src/cloudflare/resources/registrar/domains.py index 46e5881cae9..2dc5c9955fc 100644 --- a/src/cloudflare/resources/registrar/domains.py +++ b/src/cloudflare/resources/registrar/domains.py @@ -25,19 +25,22 @@ AsyncPaginator, make_request_options, ) -from ...types.registrar import DomainGetResponse, DomainListResponse, DomainUpdateResponse, domain_update_params +from ...types.registrar import domain_update_params +from ...types.registrar.domain import Domain +from ...types.registrar.domain_get_response import DomainGetResponse +from ...types.registrar.domain_update_response import DomainUpdateResponse -__all__ = ["Domains", "AsyncDomains"] +__all__ = ["DomainsResource", "AsyncDomainsResource"] -class Domains(SyncAPIResource): +class DomainsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DomainsWithRawResponse: - return DomainsWithRawResponse(self) + def with_raw_response(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DomainsWithStreamingResponse: - return DomainsWithStreamingResponse(self) + def with_streaming_response(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self) def update( self, @@ -98,7 +101,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainUpdateResponse] @@ -116,7 +119,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DomainListResponse]: + ) -> SyncSinglePage[Domain]: """ List domains handled by Registrar. @@ -135,11 +138,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/registrar/domains", - page=SyncSinglePage[DomainListResponse], + page=SyncSinglePage[Domain], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DomainListResponse, + model=Domain, ) def get( @@ -183,7 +186,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainGetResponse] @@ -192,14 +195,14 @@ def get( ) -class AsyncDomains(AsyncAPIResource): +class AsyncDomainsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDomainsWithRawResponse: - return AsyncDomainsWithRawResponse(self) + def with_raw_response(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDomainsWithStreamingResponse: - return AsyncDomainsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self) async def update( self, @@ -260,7 +263,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainUpdateResponse] @@ -278,7 +281,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DomainListResponse, AsyncSinglePage[DomainListResponse]]: + ) -> AsyncPaginator[Domain, AsyncSinglePage[Domain]]: """ List domains handled by Registrar. @@ -297,11 +300,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/registrar/domains", - page=AsyncSinglePage[DomainListResponse], + page=AsyncSinglePage[Domain], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DomainListResponse, + model=Domain, ) async def get( @@ -345,7 +348,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DomainGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DomainGetResponse] @@ -354,8 +357,8 @@ async def get( ) -class DomainsWithRawResponse: - def __init__(self, domains: Domains) -> None: +class DomainsResourceWithRawResponse: + def __init__(self, domains: DomainsResource) -> None: self._domains = domains self.update = to_raw_response_wrapper( @@ -369,8 +372,8 @@ def __init__(self, domains: Domains) -> None: ) -class AsyncDomainsWithRawResponse: - def __init__(self, domains: AsyncDomains) -> None: +class AsyncDomainsResourceWithRawResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: self._domains = domains self.update = async_to_raw_response_wrapper( @@ -384,8 +387,8 @@ def __init__(self, domains: AsyncDomains) -> None: ) -class DomainsWithStreamingResponse: - def __init__(self, domains: Domains) -> None: +class DomainsResourceWithStreamingResponse: + def __init__(self, domains: DomainsResource) -> None: self._domains = domains self.update = to_streamed_response_wrapper( @@ -399,8 +402,8 @@ def __init__(self, domains: Domains) -> None: ) -class AsyncDomainsWithStreamingResponse: - def __init__(self, domains: AsyncDomains) -> None: +class AsyncDomainsResourceWithStreamingResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: self._domains = domains self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/registrar/registrar.py b/src/cloudflare/resources/registrar/registrar.py index 4227d2e84a8..aef3e690b16 100644 --- a/src/cloudflare/resources/registrar/registrar.py +++ b/src/cloudflare/resources/registrar/registrar.py @@ -3,78 +3,78 @@ from __future__ import annotations from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Registrar", "AsyncRegistrar"] +__all__ = ["RegistrarResource", "AsyncRegistrarResource"] -class Registrar(SyncAPIResource): +class RegistrarResource(SyncAPIResource): @cached_property - def domains(self) -> Domains: - return Domains(self._client) + def domains(self) -> DomainsResource: + return DomainsResource(self._client) @cached_property - def with_raw_response(self) -> RegistrarWithRawResponse: - return RegistrarWithRawResponse(self) + def with_raw_response(self) -> RegistrarResourceWithRawResponse: + return RegistrarResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RegistrarWithStreamingResponse: - return RegistrarWithStreamingResponse(self) + def with_streaming_response(self) -> RegistrarResourceWithStreamingResponse: + return RegistrarResourceWithStreamingResponse(self) -class AsyncRegistrar(AsyncAPIResource): +class AsyncRegistrarResource(AsyncAPIResource): @cached_property - def domains(self) -> AsyncDomains: - return AsyncDomains(self._client) + def domains(self) -> AsyncDomainsResource: + return AsyncDomainsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRegistrarWithRawResponse: - return AsyncRegistrarWithRawResponse(self) + def with_raw_response(self) -> AsyncRegistrarResourceWithRawResponse: + return AsyncRegistrarResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRegistrarWithStreamingResponse: - return AsyncRegistrarWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRegistrarResourceWithStreamingResponse: + return AsyncRegistrarResourceWithStreamingResponse(self) -class RegistrarWithRawResponse: - def __init__(self, registrar: Registrar) -> None: +class RegistrarResourceWithRawResponse: + def __init__(self, registrar: RegistrarResource) -> None: self._registrar = registrar @cached_property - def domains(self) -> DomainsWithRawResponse: - return DomainsWithRawResponse(self._registrar.domains) + def domains(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self._registrar.domains) -class AsyncRegistrarWithRawResponse: - def __init__(self, registrar: AsyncRegistrar) -> None: +class AsyncRegistrarResourceWithRawResponse: + def __init__(self, registrar: AsyncRegistrarResource) -> None: self._registrar = registrar @cached_property - def domains(self) -> AsyncDomainsWithRawResponse: - return AsyncDomainsWithRawResponse(self._registrar.domains) + def domains(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self._registrar.domains) -class RegistrarWithStreamingResponse: - def __init__(self, registrar: Registrar) -> None: +class RegistrarResourceWithStreamingResponse: + def __init__(self, registrar: RegistrarResource) -> None: self._registrar = registrar @cached_property - def domains(self) -> DomainsWithStreamingResponse: - return DomainsWithStreamingResponse(self._registrar.domains) + def domains(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self._registrar.domains) -class AsyncRegistrarWithStreamingResponse: - def __init__(self, registrar: AsyncRegistrar) -> None: +class AsyncRegistrarResourceWithStreamingResponse: + def __init__(self, registrar: AsyncRegistrarResource) -> None: self._registrar = registrar @cached_property - def domains(self) -> AsyncDomainsWithStreamingResponse: - return AsyncDomainsWithStreamingResponse(self._registrar.domains) + def domains(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self._registrar.domains) diff --git a/src/cloudflare/resources/request_tracers/__init__.py b/src/cloudflare/resources/request_tracers/__init__.py index f19a11ba800..c116ff92b35 100644 --- a/src/cloudflare/resources/request_tracers/__init__.py +++ b/src/cloudflare/resources/request_tracers/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .traces import ( - Traces, - AsyncTraces, - TracesWithRawResponse, - AsyncTracesWithRawResponse, - TracesWithStreamingResponse, - AsyncTracesWithStreamingResponse, + TracesResource, + AsyncTracesResource, + TracesResourceWithRawResponse, + AsyncTracesResourceWithRawResponse, + TracesResourceWithStreamingResponse, + AsyncTracesResourceWithStreamingResponse, ) from .request_tracers import ( - RequestTracers, - AsyncRequestTracers, - RequestTracersWithRawResponse, - AsyncRequestTracersWithRawResponse, - RequestTracersWithStreamingResponse, - AsyncRequestTracersWithStreamingResponse, + RequestTracersResource, + AsyncRequestTracersResource, + RequestTracersResourceWithRawResponse, + AsyncRequestTracersResourceWithRawResponse, + RequestTracersResourceWithStreamingResponse, + AsyncRequestTracersResourceWithStreamingResponse, ) __all__ = [ - "Traces", - "AsyncTraces", - "TracesWithRawResponse", - "AsyncTracesWithRawResponse", - "TracesWithStreamingResponse", - "AsyncTracesWithStreamingResponse", - "RequestTracers", - "AsyncRequestTracers", - "RequestTracersWithRawResponse", - "AsyncRequestTracersWithRawResponse", - "RequestTracersWithStreamingResponse", - "AsyncRequestTracersWithStreamingResponse", + "TracesResource", + "AsyncTracesResource", + "TracesResourceWithRawResponse", + "AsyncTracesResourceWithRawResponse", + "TracesResourceWithStreamingResponse", + "AsyncTracesResourceWithStreamingResponse", + "RequestTracersResource", + "AsyncRequestTracersResource", + "RequestTracersResourceWithRawResponse", + "AsyncRequestTracersResourceWithRawResponse", + "RequestTracersResourceWithStreamingResponse", + "AsyncRequestTracersResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/request_tracers/request_tracers.py b/src/cloudflare/resources/request_tracers/request_tracers.py index bf03ddeaa5e..df986b01321 100644 --- a/src/cloudflare/resources/request_tracers/request_tracers.py +++ b/src/cloudflare/resources/request_tracers/request_tracers.py @@ -3,78 +3,78 @@ from __future__ import annotations from .traces import ( - Traces, - AsyncTraces, - TracesWithRawResponse, - AsyncTracesWithRawResponse, - TracesWithStreamingResponse, - AsyncTracesWithStreamingResponse, + TracesResource, + AsyncTracesResource, + TracesResourceWithRawResponse, + AsyncTracesResourceWithRawResponse, + TracesResourceWithStreamingResponse, + AsyncTracesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["RequestTracers", "AsyncRequestTracers"] +__all__ = ["RequestTracersResource", "AsyncRequestTracersResource"] -class RequestTracers(SyncAPIResource): +class RequestTracersResource(SyncAPIResource): @cached_property - def traces(self) -> Traces: - return Traces(self._client) + def traces(self) -> TracesResource: + return TracesResource(self._client) @cached_property - def with_raw_response(self) -> RequestTracersWithRawResponse: - return RequestTracersWithRawResponse(self) + def with_raw_response(self) -> RequestTracersResourceWithRawResponse: + return RequestTracersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RequestTracersWithStreamingResponse: - return RequestTracersWithStreamingResponse(self) + def with_streaming_response(self) -> RequestTracersResourceWithStreamingResponse: + return RequestTracersResourceWithStreamingResponse(self) -class AsyncRequestTracers(AsyncAPIResource): +class AsyncRequestTracersResource(AsyncAPIResource): @cached_property - def traces(self) -> AsyncTraces: - return AsyncTraces(self._client) + def traces(self) -> AsyncTracesResource: + return AsyncTracesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRequestTracersWithRawResponse: - return AsyncRequestTracersWithRawResponse(self) + def with_raw_response(self) -> AsyncRequestTracersResourceWithRawResponse: + return AsyncRequestTracersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRequestTracersWithStreamingResponse: - return AsyncRequestTracersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRequestTracersResourceWithStreamingResponse: + return AsyncRequestTracersResourceWithStreamingResponse(self) -class RequestTracersWithRawResponse: - def __init__(self, request_tracers: RequestTracers) -> None: +class RequestTracersResourceWithRawResponse: + def __init__(self, request_tracers: RequestTracersResource) -> None: self._request_tracers = request_tracers @cached_property - def traces(self) -> TracesWithRawResponse: - return TracesWithRawResponse(self._request_tracers.traces) + def traces(self) -> TracesResourceWithRawResponse: + return TracesResourceWithRawResponse(self._request_tracers.traces) -class AsyncRequestTracersWithRawResponse: - def __init__(self, request_tracers: AsyncRequestTracers) -> None: +class AsyncRequestTracersResourceWithRawResponse: + def __init__(self, request_tracers: AsyncRequestTracersResource) -> None: self._request_tracers = request_tracers @cached_property - def traces(self) -> AsyncTracesWithRawResponse: - return AsyncTracesWithRawResponse(self._request_tracers.traces) + def traces(self) -> AsyncTracesResourceWithRawResponse: + return AsyncTracesResourceWithRawResponse(self._request_tracers.traces) -class RequestTracersWithStreamingResponse: - def __init__(self, request_tracers: RequestTracers) -> None: +class RequestTracersResourceWithStreamingResponse: + def __init__(self, request_tracers: RequestTracersResource) -> None: self._request_tracers = request_tracers @cached_property - def traces(self) -> TracesWithStreamingResponse: - return TracesWithStreamingResponse(self._request_tracers.traces) + def traces(self) -> TracesResourceWithStreamingResponse: + return TracesResourceWithStreamingResponse(self._request_tracers.traces) -class AsyncRequestTracersWithStreamingResponse: - def __init__(self, request_tracers: AsyncRequestTracers) -> None: +class AsyncRequestTracersResourceWithStreamingResponse: + def __init__(self, request_tracers: AsyncRequestTracersResource) -> None: self._request_tracers = request_tracers @cached_property - def traces(self) -> AsyncTracesWithStreamingResponse: - return AsyncTracesWithStreamingResponse(self._request_tracers.traces) + def traces(self) -> AsyncTracesResourceWithStreamingResponse: + return AsyncTracesResourceWithStreamingResponse(self._request_tracers.traces) diff --git a/src/cloudflare/resources/request_tracers/traces.py b/src/cloudflare/resources/request_tracers/traces.py index faac2d45376..55f4b1ea22a 100644 --- a/src/cloudflare/resources/request_tracers/traces.py +++ b/src/cloudflare/resources/request_tracers/traces.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Type, cast +from typing import Dict, Type, Optional, cast import httpx @@ -23,24 +23,25 @@ from ..._base_client import ( make_request_options, ) -from ...types.request_tracers import TraceCreateResponse, trace_create_params +from ...types.request_tracers import trace_create_params +from ...types.request_tracers.trace_create_response import TraceCreateResponse -__all__ = ["Traces", "AsyncTraces"] +__all__ = ["TracesResource", "AsyncTracesResource"] -class Traces(SyncAPIResource): +class TracesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TracesWithRawResponse: - return TracesWithRawResponse(self) + def with_raw_response(self) -> TracesResourceWithRawResponse: + return TracesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TracesWithStreamingResponse: - return TracesWithStreamingResponse(self) + def with_streaming_response(self) -> TracesResourceWithStreamingResponse: + return TracesResourceWithStreamingResponse(self) def create( self, - account_identifier: str, *, + account_id: str, method: str, url: str, body: trace_create_params.Body | NotGiven = NOT_GIVEN, @@ -55,12 +56,12 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TraceCreateResponse: + ) -> Optional[TraceCreateResponse]: """ Request Trace Args: - account_identifier: Identifier + account_id: Identifier method: HTTP Method of tracing request @@ -84,10 +85,10 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( - f"/accounts/{account_identifier}/request-tracer/trace", + f"/accounts/{account_id}/request-tracer/trace", body=maybe_transform( { "method": method, @@ -106,25 +107,25 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TraceCreateResponse]]._unwrapper, ), - cast_to=cast(Type[TraceCreateResponse], ResultWrapper[TraceCreateResponse]), + cast_to=cast(Type[Optional[TraceCreateResponse]], ResultWrapper[TraceCreateResponse]), ) -class AsyncTraces(AsyncAPIResource): +class AsyncTracesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTracesWithRawResponse: - return AsyncTracesWithRawResponse(self) + def with_raw_response(self) -> AsyncTracesResourceWithRawResponse: + return AsyncTracesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTracesWithStreamingResponse: - return AsyncTracesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTracesResourceWithStreamingResponse: + return AsyncTracesResourceWithStreamingResponse(self) async def create( self, - account_identifier: str, *, + account_id: str, method: str, url: str, body: trace_create_params.Body | NotGiven = NOT_GIVEN, @@ -139,12 +140,12 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TraceCreateResponse: + ) -> Optional[TraceCreateResponse]: """ Request Trace Args: - account_identifier: Identifier + account_id: Identifier method: HTTP Method of tracing request @@ -168,10 +169,10 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not 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_identifier}/request-tracer/trace", + f"/accounts/{account_id}/request-tracer/trace", body=await async_maybe_transform( { "method": method, @@ -190,14 +191,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TraceCreateResponse]]._unwrapper, ), - cast_to=cast(Type[TraceCreateResponse], ResultWrapper[TraceCreateResponse]), + cast_to=cast(Type[Optional[TraceCreateResponse]], ResultWrapper[TraceCreateResponse]), ) -class TracesWithRawResponse: - def __init__(self, traces: Traces) -> None: +class TracesResourceWithRawResponse: + def __init__(self, traces: TracesResource) -> None: self._traces = traces self.create = to_raw_response_wrapper( @@ -205,8 +206,8 @@ def __init__(self, traces: Traces) -> None: ) -class AsyncTracesWithRawResponse: - def __init__(self, traces: AsyncTraces) -> None: +class AsyncTracesResourceWithRawResponse: + def __init__(self, traces: AsyncTracesResource) -> None: self._traces = traces self.create = async_to_raw_response_wrapper( @@ -214,8 +215,8 @@ def __init__(self, traces: AsyncTraces) -> None: ) -class TracesWithStreamingResponse: - def __init__(self, traces: Traces) -> None: +class TracesResourceWithStreamingResponse: + def __init__(self, traces: TracesResource) -> None: self._traces = traces self.create = to_streamed_response_wrapper( @@ -223,8 +224,8 @@ def __init__(self, traces: Traces) -> None: ) -class AsyncTracesWithStreamingResponse: - def __init__(self, traces: AsyncTraces) -> None: +class AsyncTracesResourceWithStreamingResponse: + def __init__(self, traces: AsyncTracesResource) -> None: self._traces = traces self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/rules/__init__.py b/src/cloudflare/resources/rules/__init__.py index c69717b8e6a..93d2881aef4 100644 --- a/src/cloudflare/resources/rules/__init__.py +++ b/src/cloudflare/resources/rules/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .lists import ( - Lists, - AsyncLists, - ListsWithRawResponse, - AsyncListsWithRawResponse, - ListsWithStreamingResponse, - AsyncListsWithStreamingResponse, + ListsResource, + AsyncListsResource, + ListsResourceWithRawResponse, + AsyncListsResourceWithRawResponse, + ListsResourceWithStreamingResponse, + AsyncListsResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) __all__ = [ - "Lists", - "AsyncLists", - "ListsWithRawResponse", - "AsyncListsWithRawResponse", - "ListsWithStreamingResponse", - "AsyncListsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", + "ListsResource", + "AsyncListsResource", + "ListsResourceWithRawResponse", + "AsyncListsResourceWithRawResponse", + "ListsResourceWithStreamingResponse", + "AsyncListsResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/rules/lists/__init__.py b/src/cloudflare/resources/rules/lists/__init__.py index cbe5085f32b..b26e8a39caf 100644 --- a/src/cloudflare/resources/rules/lists/__init__.py +++ b/src/cloudflare/resources/rules/lists/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .items import ( - Items, - AsyncItems, - ItemsWithRawResponse, - AsyncItemsWithRawResponse, - ItemsWithStreamingResponse, - AsyncItemsWithStreamingResponse, + ItemsResource, + AsyncItemsResource, + ItemsResourceWithRawResponse, + AsyncItemsResourceWithRawResponse, + ItemsResourceWithStreamingResponse, + AsyncItemsResourceWithStreamingResponse, ) from .lists import ( - Lists, - AsyncLists, - ListsWithRawResponse, - AsyncListsWithRawResponse, - ListsWithStreamingResponse, - AsyncListsWithStreamingResponse, + ListsResource, + AsyncListsResource, + ListsResourceWithRawResponse, + AsyncListsResourceWithRawResponse, + ListsResourceWithStreamingResponse, + AsyncListsResourceWithStreamingResponse, ) from .bulk_operations import ( - BulkOperations, - AsyncBulkOperations, - BulkOperationsWithRawResponse, - AsyncBulkOperationsWithRawResponse, - BulkOperationsWithStreamingResponse, - AsyncBulkOperationsWithStreamingResponse, + BulkOperationsResource, + AsyncBulkOperationsResource, + BulkOperationsResourceWithRawResponse, + AsyncBulkOperationsResourceWithRawResponse, + BulkOperationsResourceWithStreamingResponse, + AsyncBulkOperationsResourceWithStreamingResponse, ) __all__ = [ - "BulkOperations", - "AsyncBulkOperations", - "BulkOperationsWithRawResponse", - "AsyncBulkOperationsWithRawResponse", - "BulkOperationsWithStreamingResponse", - "AsyncBulkOperationsWithStreamingResponse", - "Items", - "AsyncItems", - "ItemsWithRawResponse", - "AsyncItemsWithRawResponse", - "ItemsWithStreamingResponse", - "AsyncItemsWithStreamingResponse", - "Lists", - "AsyncLists", - "ListsWithRawResponse", - "AsyncListsWithRawResponse", - "ListsWithStreamingResponse", - "AsyncListsWithStreamingResponse", + "BulkOperationsResource", + "AsyncBulkOperationsResource", + "BulkOperationsResourceWithRawResponse", + "AsyncBulkOperationsResourceWithRawResponse", + "BulkOperationsResourceWithStreamingResponse", + "AsyncBulkOperationsResourceWithStreamingResponse", + "ItemsResource", + "AsyncItemsResource", + "ItemsResourceWithRawResponse", + "AsyncItemsResourceWithRawResponse", + "ItemsResourceWithStreamingResponse", + "AsyncItemsResourceWithStreamingResponse", + "ListsResource", + "AsyncListsResource", + "ListsResourceWithRawResponse", + "AsyncListsResourceWithRawResponse", + "ListsResourceWithStreamingResponse", + "AsyncListsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/rules/lists/bulk_operations.py b/src/cloudflare/resources/rules/lists/bulk_operations.py index 991fffce5ed..b1c7f0b3399 100644 --- a/src/cloudflare/resources/rules/lists/bulk_operations.py +++ b/src/cloudflare/resources/rules/lists/bulk_operations.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.rules.lists import BulkOperationGetResponse +from ....types.rules.lists.bulk_operation_get_response import BulkOperationGetResponse -__all__ = ["BulkOperations", "AsyncBulkOperations"] +__all__ = ["BulkOperationsResource", "AsyncBulkOperationsResource"] -class BulkOperations(SyncAPIResource): +class BulkOperationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BulkOperationsWithRawResponse: - return BulkOperationsWithRawResponse(self) + def with_raw_response(self) -> BulkOperationsResourceWithRawResponse: + return BulkOperationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BulkOperationsWithStreamingResponse: - return BulkOperationsWithStreamingResponse(self) + def with_streaming_response(self) -> BulkOperationsResourceWithStreamingResponse: + return BulkOperationsResourceWithStreamingResponse(self) def get( self, @@ -76,20 +76,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BulkOperationGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[BulkOperationGetResponse]], ResultWrapper[BulkOperationGetResponse]), ) -class AsyncBulkOperations(AsyncAPIResource): +class AsyncBulkOperationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBulkOperationsWithRawResponse: - return AsyncBulkOperationsWithRawResponse(self) + def with_raw_response(self) -> AsyncBulkOperationsResourceWithRawResponse: + return AsyncBulkOperationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBulkOperationsWithStreamingResponse: - return AsyncBulkOperationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBulkOperationsResourceWithStreamingResponse: + return AsyncBulkOperationsResourceWithStreamingResponse(self) async def get( self, @@ -134,14 +134,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BulkOperationGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[BulkOperationGetResponse]], ResultWrapper[BulkOperationGetResponse]), ) -class BulkOperationsWithRawResponse: - def __init__(self, bulk_operations: BulkOperations) -> None: +class BulkOperationsResourceWithRawResponse: + def __init__(self, bulk_operations: BulkOperationsResource) -> None: self._bulk_operations = bulk_operations self.get = to_raw_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, bulk_operations: BulkOperations) -> None: ) -class AsyncBulkOperationsWithRawResponse: - def __init__(self, bulk_operations: AsyncBulkOperations) -> None: +class AsyncBulkOperationsResourceWithRawResponse: + def __init__(self, bulk_operations: AsyncBulkOperationsResource) -> None: self._bulk_operations = bulk_operations self.get = async_to_raw_response_wrapper( @@ -158,8 +158,8 @@ def __init__(self, bulk_operations: AsyncBulkOperations) -> None: ) -class BulkOperationsWithStreamingResponse: - def __init__(self, bulk_operations: BulkOperations) -> None: +class BulkOperationsResourceWithStreamingResponse: + def __init__(self, bulk_operations: BulkOperationsResource) -> None: self._bulk_operations = bulk_operations self.get = to_streamed_response_wrapper( @@ -167,8 +167,8 @@ def __init__(self, bulk_operations: BulkOperations) -> None: ) -class AsyncBulkOperationsWithStreamingResponse: - def __init__(self, bulk_operations: AsyncBulkOperations) -> None: +class AsyncBulkOperationsResourceWithStreamingResponse: + def __init__(self, bulk_operations: AsyncBulkOperationsResource) -> None: self._bulk_operations = bulk_operations self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/rules/lists/items.py b/src/cloudflare/resources/rules/lists/items.py index 48c9ef2c264..40d4f5062cc 100644 --- a/src/cloudflare/resources/rules/lists/items.py +++ b/src/cloudflare/resources/rules/lists/items.py @@ -25,28 +25,23 @@ AsyncPaginator, make_request_options, ) -from ....types.rules.lists import ( - ItemGetResponse, - ItemCreateResponse, - ItemDeleteResponse, - ItemUpdateResponse, - item_list_params, - item_create_params, - item_delete_params, - item_update_params, -) +from ....types.rules.lists import item_list_params, item_create_params, item_delete_params, item_update_params +from ....types.rules.lists.item_get_response import ItemGetResponse +from ....types.rules.lists.item_create_response import ItemCreateResponse +from ....types.rules.lists.item_delete_response import ItemDeleteResponse +from ....types.rules.lists.item_update_response import ItemUpdateResponse -__all__ = ["Items", "AsyncItems"] +__all__ = ["ItemsResource", "AsyncItemsResource"] -class Items(SyncAPIResource): +class ItemsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ItemsWithRawResponse: - return ItemsWithRawResponse(self) + def with_raw_response(self) -> ItemsResourceWithRawResponse: + return ItemsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ItemsWithStreamingResponse: - return ItemsWithStreamingResponse(self) + def with_streaming_response(self) -> ItemsResourceWithStreamingResponse: + return ItemsResourceWithStreamingResponse(self) def create( self, @@ -94,7 +89,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ItemCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ItemCreateResponse]], ResultWrapper[ItemCreateResponse]), ) @@ -145,7 +140,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ItemUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ItemUpdateResponse]], ResultWrapper[ItemUpdateResponse]), ) @@ -264,7 +259,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ItemDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ItemDeleteResponse]], ResultWrapper[ItemDeleteResponse]), ) @@ -315,7 +310,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ItemGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ItemGetResponse] @@ -324,14 +319,14 @@ def get( ) -class AsyncItems(AsyncAPIResource): +class AsyncItemsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncItemsWithRawResponse: - return AsyncItemsWithRawResponse(self) + def with_raw_response(self) -> AsyncItemsResourceWithRawResponse: + return AsyncItemsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncItemsWithStreamingResponse: - return AsyncItemsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncItemsResourceWithStreamingResponse: + return AsyncItemsResourceWithStreamingResponse(self) async def create( self, @@ -379,7 +374,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ItemCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ItemCreateResponse]], ResultWrapper[ItemCreateResponse]), ) @@ -430,7 +425,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ItemUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ItemUpdateResponse]], ResultWrapper[ItemUpdateResponse]), ) @@ -549,7 +544,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ItemDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ItemDeleteResponse]], ResultWrapper[ItemDeleteResponse]), ) @@ -600,7 +595,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ItemGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ItemGetResponse] @@ -609,8 +604,8 @@ async def get( ) -class ItemsWithRawResponse: - def __init__(self, items: Items) -> None: +class ItemsResourceWithRawResponse: + def __init__(self, items: ItemsResource) -> None: self._items = items self.create = to_raw_response_wrapper( @@ -630,8 +625,8 @@ def __init__(self, items: Items) -> None: ) -class AsyncItemsWithRawResponse: - def __init__(self, items: AsyncItems) -> None: +class AsyncItemsResourceWithRawResponse: + def __init__(self, items: AsyncItemsResource) -> None: self._items = items self.create = async_to_raw_response_wrapper( @@ -651,8 +646,8 @@ def __init__(self, items: AsyncItems) -> None: ) -class ItemsWithStreamingResponse: - def __init__(self, items: Items) -> None: +class ItemsResourceWithStreamingResponse: + def __init__(self, items: ItemsResource) -> None: self._items = items self.create = to_streamed_response_wrapper( @@ -672,8 +667,8 @@ def __init__(self, items: Items) -> None: ) -class AsyncItemsWithStreamingResponse: - def __init__(self, items: AsyncItems) -> None: +class AsyncItemsResourceWithStreamingResponse: + def __init__(self, items: AsyncItemsResource) -> None: self._items = items self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/rules/lists/lists.py b/src/cloudflare/resources/rules/lists/lists.py index 5cf9ef96496..e871dfed56a 100644 --- a/src/cloudflare/resources/rules/lists/lists.py +++ b/src/cloudflare/resources/rules/lists/lists.py @@ -8,12 +8,12 @@ import httpx from .items import ( - Items, - AsyncItems, - ItemsWithRawResponse, - AsyncItemsWithRawResponse, - ItemsWithStreamingResponse, - AsyncItemsWithStreamingResponse, + ItemsResource, + AsyncItemsResource, + ItemsResourceWithRawResponse, + AsyncItemsResourceWithRawResponse, + ItemsResourceWithStreamingResponse, + AsyncItemsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -30,39 +30,41 @@ ) from ...._wrappers import ResultWrapper from ....pagination import SyncSinglePage, AsyncSinglePage -from ....types.rules import ListsList, ListDeleteResponse, list_create_params, list_update_params +from ....types.rules import list_create_params, list_delete_params, list_update_params from ...._base_client import ( AsyncPaginator, make_request_options, ) from .bulk_operations import ( - BulkOperations, - AsyncBulkOperations, - BulkOperationsWithRawResponse, - AsyncBulkOperationsWithRawResponse, - BulkOperationsWithStreamingResponse, - AsyncBulkOperationsWithStreamingResponse, + BulkOperationsResource, + AsyncBulkOperationsResource, + BulkOperationsResourceWithRawResponse, + AsyncBulkOperationsResourceWithRawResponse, + BulkOperationsResourceWithStreamingResponse, + AsyncBulkOperationsResourceWithStreamingResponse, ) +from ....types.rules.lists_list import ListsList +from ....types.rules.list_delete_response import ListDeleteResponse -__all__ = ["Lists", "AsyncLists"] +__all__ = ["ListsResource", "AsyncListsResource"] -class Lists(SyncAPIResource): +class ListsResource(SyncAPIResource): @cached_property - def bulk_operations(self) -> BulkOperations: - return BulkOperations(self._client) + def bulk_operations(self) -> BulkOperationsResource: + return BulkOperationsResource(self._client) @cached_property - def items(self) -> Items: - return Items(self._client) + def items(self) -> ItemsResource: + return ItemsResource(self._client) @cached_property - def with_raw_response(self) -> ListsWithRawResponse: - return ListsWithRawResponse(self) + def with_raw_response(self) -> ListsResourceWithRawResponse: + return ListsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ListsWithStreamingResponse: - return ListsWithStreamingResponse(self) + def with_streaming_response(self) -> ListsResourceWithStreamingResponse: + return ListsResourceWithStreamingResponse(self) def create( self, @@ -116,7 +118,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListsList]]._unwrapper, ), cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) @@ -164,7 +166,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListsList]]._unwrapper, ), cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) @@ -210,6 +212,7 @@ def delete( list_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -239,12 +242,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") return self._delete( f"/accounts/{account_id}/rules/lists/{list_id}", + body=maybe_transform(body, list_delete_params.ListDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ListDeleteResponse]], ResultWrapper[ListDeleteResponse]), ) @@ -288,28 +292,28 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListsList]]._unwrapper, ), cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) -class AsyncLists(AsyncAPIResource): +class AsyncListsResource(AsyncAPIResource): @cached_property - def bulk_operations(self) -> AsyncBulkOperations: - return AsyncBulkOperations(self._client) + def bulk_operations(self) -> AsyncBulkOperationsResource: + return AsyncBulkOperationsResource(self._client) @cached_property - def items(self) -> AsyncItems: - return AsyncItems(self._client) + def items(self) -> AsyncItemsResource: + return AsyncItemsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncListsWithRawResponse: - return AsyncListsWithRawResponse(self) + def with_raw_response(self) -> AsyncListsResourceWithRawResponse: + return AsyncListsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncListsWithStreamingResponse: - return AsyncListsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncListsResourceWithStreamingResponse: + return AsyncListsResourceWithStreamingResponse(self) async def create( self, @@ -363,7 +367,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListsList]]._unwrapper, ), cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) @@ -411,7 +415,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListsList]]._unwrapper, ), cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) @@ -457,6 +461,7 @@ async def delete( list_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -486,12 +491,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") return await self._delete( f"/accounts/{account_id}/rules/lists/{list_id}", + body=await async_maybe_transform(body, list_delete_params.ListDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ListDeleteResponse]], ResultWrapper[ListDeleteResponse]), ) @@ -535,14 +541,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListsList]]._unwrapper, ), cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) -class ListsWithRawResponse: - def __init__(self, lists: Lists) -> None: +class ListsResourceWithRawResponse: + def __init__(self, lists: ListsResource) -> None: self._lists = lists self.create = to_raw_response_wrapper( @@ -562,16 +568,16 @@ def __init__(self, lists: Lists) -> None: ) @cached_property - def bulk_operations(self) -> BulkOperationsWithRawResponse: - return BulkOperationsWithRawResponse(self._lists.bulk_operations) + def bulk_operations(self) -> BulkOperationsResourceWithRawResponse: + return BulkOperationsResourceWithRawResponse(self._lists.bulk_operations) @cached_property - def items(self) -> ItemsWithRawResponse: - return ItemsWithRawResponse(self._lists.items) + def items(self) -> ItemsResourceWithRawResponse: + return ItemsResourceWithRawResponse(self._lists.items) -class AsyncListsWithRawResponse: - def __init__(self, lists: AsyncLists) -> None: +class AsyncListsResourceWithRawResponse: + def __init__(self, lists: AsyncListsResource) -> None: self._lists = lists self.create = async_to_raw_response_wrapper( @@ -591,16 +597,16 @@ def __init__(self, lists: AsyncLists) -> None: ) @cached_property - def bulk_operations(self) -> AsyncBulkOperationsWithRawResponse: - return AsyncBulkOperationsWithRawResponse(self._lists.bulk_operations) + def bulk_operations(self) -> AsyncBulkOperationsResourceWithRawResponse: + return AsyncBulkOperationsResourceWithRawResponse(self._lists.bulk_operations) @cached_property - def items(self) -> AsyncItemsWithRawResponse: - return AsyncItemsWithRawResponse(self._lists.items) + def items(self) -> AsyncItemsResourceWithRawResponse: + return AsyncItemsResourceWithRawResponse(self._lists.items) -class ListsWithStreamingResponse: - def __init__(self, lists: Lists) -> None: +class ListsResourceWithStreamingResponse: + def __init__(self, lists: ListsResource) -> None: self._lists = lists self.create = to_streamed_response_wrapper( @@ -620,16 +626,16 @@ def __init__(self, lists: Lists) -> None: ) @cached_property - def bulk_operations(self) -> BulkOperationsWithStreamingResponse: - return BulkOperationsWithStreamingResponse(self._lists.bulk_operations) + def bulk_operations(self) -> BulkOperationsResourceWithStreamingResponse: + return BulkOperationsResourceWithStreamingResponse(self._lists.bulk_operations) @cached_property - def items(self) -> ItemsWithStreamingResponse: - return ItemsWithStreamingResponse(self._lists.items) + def items(self) -> ItemsResourceWithStreamingResponse: + return ItemsResourceWithStreamingResponse(self._lists.items) -class AsyncListsWithStreamingResponse: - def __init__(self, lists: AsyncLists) -> None: +class AsyncListsResourceWithStreamingResponse: + def __init__(self, lists: AsyncListsResource) -> None: self._lists = lists self.create = async_to_streamed_response_wrapper( @@ -649,9 +655,9 @@ def __init__(self, lists: AsyncLists) -> None: ) @cached_property - def bulk_operations(self) -> AsyncBulkOperationsWithStreamingResponse: - return AsyncBulkOperationsWithStreamingResponse(self._lists.bulk_operations) + def bulk_operations(self) -> AsyncBulkOperationsResourceWithStreamingResponse: + return AsyncBulkOperationsResourceWithStreamingResponse(self._lists.bulk_operations) @cached_property - def items(self) -> AsyncItemsWithStreamingResponse: - return AsyncItemsWithStreamingResponse(self._lists.items) + def items(self) -> AsyncItemsResourceWithStreamingResponse: + return AsyncItemsResourceWithStreamingResponse(self._lists.items) diff --git a/src/cloudflare/resources/rules/rules.py b/src/cloudflare/resources/rules/rules.py index dd2cfc16909..e4ebeb782bf 100644 --- a/src/cloudflare/resources/rules/rules.py +++ b/src/cloudflare/resources/rules/rules.py @@ -3,79 +3,79 @@ from __future__ import annotations from .lists import ( - Lists, - AsyncLists, - ListsWithRawResponse, - AsyncListsWithRawResponse, - ListsWithStreamingResponse, - AsyncListsWithStreamingResponse, + ListsResource, + AsyncListsResource, + ListsResourceWithRawResponse, + AsyncListsResourceWithRawResponse, + ListsResourceWithStreamingResponse, + AsyncListsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .lists.lists import Lists, AsyncLists +from .lists.lists import ListsResource, AsyncListsResource -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def lists(self) -> Lists: - return Lists(self._client) + def lists(self) -> ListsResource: + return ListsResource(self._client) @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def lists(self) -> AsyncLists: - return AsyncLists(self._client) + def lists(self) -> AsyncListsResource: + return AsyncListsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules @cached_property - def lists(self) -> ListsWithRawResponse: - return ListsWithRawResponse(self._rules.lists) + def lists(self) -> ListsResourceWithRawResponse: + return ListsResourceWithRawResponse(self._rules.lists) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules @cached_property - def lists(self) -> AsyncListsWithRawResponse: - return AsyncListsWithRawResponse(self._rules.lists) + def lists(self) -> AsyncListsResourceWithRawResponse: + return AsyncListsResourceWithRawResponse(self._rules.lists) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules @cached_property - def lists(self) -> ListsWithStreamingResponse: - return ListsWithStreamingResponse(self._rules.lists) + def lists(self) -> ListsResourceWithStreamingResponse: + return ListsResourceWithStreamingResponse(self._rules.lists) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules @cached_property - def lists(self) -> AsyncListsWithStreamingResponse: - return AsyncListsWithStreamingResponse(self._rules.lists) + def lists(self) -> AsyncListsResourceWithStreamingResponse: + return AsyncListsResourceWithStreamingResponse(self._rules.lists) diff --git a/src/cloudflare/resources/rulesets/__init__.py b/src/cloudflare/resources/rulesets/__init__.py index a1339ca700e..3770eeded7d 100644 --- a/src/cloudflare/resources/rulesets/__init__.py +++ b/src/cloudflare/resources/rulesets/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .phases import ( - Phases, - AsyncPhases, - PhasesWithRawResponse, - AsyncPhasesWithRawResponse, - PhasesWithStreamingResponse, - AsyncPhasesWithStreamingResponse, + PhasesResource, + AsyncPhasesResource, + PhasesResourceWithRawResponse, + AsyncPhasesResourceWithRawResponse, + PhasesResourceWithStreamingResponse, + AsyncPhasesResourceWithStreamingResponse, ) from .rulesets import ( - Rulesets, - AsyncRulesets, - RulesetsWithRawResponse, - AsyncRulesetsWithRawResponse, - RulesetsWithStreamingResponse, - AsyncRulesetsWithStreamingResponse, + RulesetsResource, + AsyncRulesetsResource, + RulesetsResourceWithRawResponse, + AsyncRulesetsResourceWithRawResponse, + RulesetsResourceWithStreamingResponse, + AsyncRulesetsResourceWithStreamingResponse, ) from .versions import ( - Versions, - AsyncVersions, - VersionsWithRawResponse, - AsyncVersionsWithRawResponse, - VersionsWithStreamingResponse, - AsyncVersionsWithStreamingResponse, + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, ) __all__ = [ - "Phases", - "AsyncPhases", - "PhasesWithRawResponse", - "AsyncPhasesWithRawResponse", - "PhasesWithStreamingResponse", - "AsyncPhasesWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "Versions", - "AsyncVersions", - "VersionsWithRawResponse", - "AsyncVersionsWithRawResponse", - "VersionsWithStreamingResponse", - "AsyncVersionsWithStreamingResponse", - "Rulesets", - "AsyncRulesets", - "RulesetsWithRawResponse", - "AsyncRulesetsWithRawResponse", - "RulesetsWithStreamingResponse", - "AsyncRulesetsWithStreamingResponse", + "PhasesResource", + "AsyncPhasesResource", + "PhasesResourceWithRawResponse", + "AsyncPhasesResourceWithRawResponse", + "PhasesResourceWithStreamingResponse", + "AsyncPhasesResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "VersionsResource", + "AsyncVersionsResource", + "VersionsResourceWithRawResponse", + "AsyncVersionsResourceWithRawResponse", + "VersionsResourceWithStreamingResponse", + "AsyncVersionsResourceWithStreamingResponse", + "RulesetsResource", + "AsyncRulesetsResource", + "RulesetsResourceWithRawResponse", + "AsyncRulesetsResourceWithRawResponse", + "RulesetsResourceWithStreamingResponse", + "AsyncRulesetsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/rulesets/phases/__init__.py b/src/cloudflare/resources/rulesets/phases/__init__.py index 3bcc9f1eab9..c8ad5c9ffd6 100644 --- a/src/cloudflare/resources/rulesets/phases/__init__.py +++ b/src/cloudflare/resources/rulesets/phases/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .phases import ( - Phases, - AsyncPhases, - PhasesWithRawResponse, - AsyncPhasesWithRawResponse, - PhasesWithStreamingResponse, - AsyncPhasesWithStreamingResponse, + PhasesResource, + AsyncPhasesResource, + PhasesResourceWithRawResponse, + AsyncPhasesResourceWithRawResponse, + PhasesResourceWithStreamingResponse, + AsyncPhasesResourceWithStreamingResponse, ) from .versions import ( - Versions, - AsyncVersions, - VersionsWithRawResponse, - AsyncVersionsWithRawResponse, - VersionsWithStreamingResponse, - AsyncVersionsWithStreamingResponse, + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, ) __all__ = [ - "Versions", - "AsyncVersions", - "VersionsWithRawResponse", - "AsyncVersionsWithRawResponse", - "VersionsWithStreamingResponse", - "AsyncVersionsWithStreamingResponse", - "Phases", - "AsyncPhases", - "PhasesWithRawResponse", - "AsyncPhasesWithRawResponse", - "PhasesWithStreamingResponse", - "AsyncPhasesWithStreamingResponse", + "VersionsResource", + "AsyncVersionsResource", + "VersionsResourceWithRawResponse", + "AsyncVersionsResourceWithRawResponse", + "VersionsResourceWithStreamingResponse", + "AsyncVersionsResourceWithStreamingResponse", + "PhasesResource", + "AsyncPhasesResource", + "PhasesResourceWithRawResponse", + "AsyncPhasesResourceWithRawResponse", + "PhasesResourceWithStreamingResponse", + "AsyncPhasesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/rulesets/phases/phases.py b/src/cloudflare/resources/rulesets/phases/phases.py index f1098a71bff..05b1b1c7e49 100644 --- a/src/cloudflare/resources/rulesets/phases/phases.py +++ b/src/cloudflare/resources/rulesets/phases/phases.py @@ -7,14 +7,13 @@ import httpx -from ....types import Ruleset from .versions import ( - Versions, - AsyncVersions, - VersionsWithRawResponse, - AsyncVersionsWithRawResponse, - VersionsWithStreamingResponse, - AsyncVersionsWithStreamingResponse, + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -34,22 +33,24 @@ make_request_options, ) from ....types.rulesets import phase_update_params +from ....types.rulesets.phase_get_response import PhaseGetResponse +from ....types.rulesets.phase_update_response import PhaseUpdateResponse -__all__ = ["Phases", "AsyncPhases"] +__all__ = ["PhasesResource", "AsyncPhasesResource"] -class Phases(SyncAPIResource): +class PhasesResource(SyncAPIResource): @cached_property - def versions(self) -> Versions: - return Versions(self._client) + def versions(self) -> VersionsResource: + return VersionsResource(self._client) @cached_property - def with_raw_response(self) -> PhasesWithRawResponse: - return PhasesWithRawResponse(self) + def with_raw_response(self) -> PhasesResourceWithRawResponse: + return PhasesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PhasesWithStreamingResponse: - return PhasesWithStreamingResponse(self) + def with_streaming_response(self) -> PhasesResourceWithStreamingResponse: + return PhasesResourceWithStreamingResponse(self) def update( self, @@ -79,7 +80,6 @@ def update( "magic_transit_managed", ], *, - id: str, rules: Iterable[phase_update_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -118,15 +118,13 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> PhaseUpdateResponse: """ Updates an account or zone entry point ruleset, creating a new version. Args: ruleset_phase: The phase of the ruleset. - id: The unique ID of the ruleset. - rules: The list of rules in the ruleset. account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -151,12 +149,6 @@ def update( """ if not ruleset_phase: raise ValueError(f"Expected a non-empty value for `ruleset_phase` but received {ruleset_phase!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -164,13 +156,15 @@ def update( 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._put( f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint", body=maybe_transform( { - "id": id, "rules": rules, "description": description, "kind": kind, @@ -184,9 +178,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PhaseUpdateResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[PhaseUpdateResponse], ResultWrapper[PhaseUpdateResponse]), ) def get( @@ -225,7 +219,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> PhaseGetResponse: """ Fetches the latest version of the account or zone entry point ruleset for a given phase. @@ -247,12 +241,6 @@ def get( """ if not ruleset_phase: raise ValueError(f"Expected a non-empty value for `ruleset_phase` but received {ruleset_phase!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -260,6 +248,9 @@ def get( 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._get( @@ -269,24 +260,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PhaseGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[PhaseGetResponse], ResultWrapper[PhaseGetResponse]), ) -class AsyncPhases(AsyncAPIResource): +class AsyncPhasesResource(AsyncAPIResource): @cached_property - def versions(self) -> AsyncVersions: - return AsyncVersions(self._client) + def versions(self) -> AsyncVersionsResource: + return AsyncVersionsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPhasesWithRawResponse: - return AsyncPhasesWithRawResponse(self) + def with_raw_response(self) -> AsyncPhasesResourceWithRawResponse: + return AsyncPhasesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPhasesWithStreamingResponse: - return AsyncPhasesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPhasesResourceWithStreamingResponse: + return AsyncPhasesResourceWithStreamingResponse(self) async def update( self, @@ -316,7 +307,6 @@ async def update( "magic_transit_managed", ], *, - id: str, rules: Iterable[phase_update_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -355,15 +345,13 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> PhaseUpdateResponse: """ Updates an account or zone entry point ruleset, creating a new version. Args: ruleset_phase: The phase of the ruleset. - id: The unique ID of the ruleset. - rules: The list of rules in the ruleset. account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -388,12 +376,6 @@ async def update( """ if not ruleset_phase: raise ValueError(f"Expected a non-empty value for `ruleset_phase` but received {ruleset_phase!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -401,13 +383,15 @@ async def update( 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._put( f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint", body=await async_maybe_transform( { - "id": id, "rules": rules, "description": description, "kind": kind, @@ -421,9 +405,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PhaseUpdateResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[PhaseUpdateResponse], ResultWrapper[PhaseUpdateResponse]), ) async def get( @@ -462,7 +446,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> PhaseGetResponse: """ Fetches the latest version of the account or zone entry point ruleset for a given phase. @@ -484,12 +468,6 @@ async def get( """ if not ruleset_phase: raise ValueError(f"Expected a non-empty value for `ruleset_phase` but received {ruleset_phase!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -497,6 +475,9 @@ async def get( 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._get( @@ -506,14 +487,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PhaseGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[PhaseGetResponse], ResultWrapper[PhaseGetResponse]), ) -class PhasesWithRawResponse: - def __init__(self, phases: Phases) -> None: +class PhasesResourceWithRawResponse: + def __init__(self, phases: PhasesResource) -> None: self._phases = phases self.update = to_raw_response_wrapper( @@ -524,12 +505,12 @@ def __init__(self, phases: Phases) -> None: ) @cached_property - def versions(self) -> VersionsWithRawResponse: - return VersionsWithRawResponse(self._phases.versions) + def versions(self) -> VersionsResourceWithRawResponse: + return VersionsResourceWithRawResponse(self._phases.versions) -class AsyncPhasesWithRawResponse: - def __init__(self, phases: AsyncPhases) -> None: +class AsyncPhasesResourceWithRawResponse: + def __init__(self, phases: AsyncPhasesResource) -> None: self._phases = phases self.update = async_to_raw_response_wrapper( @@ -540,12 +521,12 @@ def __init__(self, phases: AsyncPhases) -> None: ) @cached_property - def versions(self) -> AsyncVersionsWithRawResponse: - return AsyncVersionsWithRawResponse(self._phases.versions) + def versions(self) -> AsyncVersionsResourceWithRawResponse: + return AsyncVersionsResourceWithRawResponse(self._phases.versions) -class PhasesWithStreamingResponse: - def __init__(self, phases: Phases) -> None: +class PhasesResourceWithStreamingResponse: + def __init__(self, phases: PhasesResource) -> None: self._phases = phases self.update = to_streamed_response_wrapper( @@ -556,12 +537,12 @@ def __init__(self, phases: Phases) -> None: ) @cached_property - def versions(self) -> VersionsWithStreamingResponse: - return VersionsWithStreamingResponse(self._phases.versions) + def versions(self) -> VersionsResourceWithStreamingResponse: + return VersionsResourceWithStreamingResponse(self._phases.versions) -class AsyncPhasesWithStreamingResponse: - def __init__(self, phases: AsyncPhases) -> None: +class AsyncPhasesResourceWithStreamingResponse: + def __init__(self, phases: AsyncPhasesResource) -> None: self._phases = phases self.update = async_to_streamed_response_wrapper( @@ -572,5 +553,5 @@ def __init__(self, phases: AsyncPhases) -> None: ) @cached_property - def versions(self) -> AsyncVersionsWithStreamingResponse: - return AsyncVersionsWithStreamingResponse(self._phases.versions) + def versions(self) -> AsyncVersionsResourceWithStreamingResponse: + return AsyncVersionsResourceWithStreamingResponse(self._phases.versions) diff --git a/src/cloudflare/resources/rulesets/phases/versions.py b/src/cloudflare/resources/rulesets/phases/versions.py index 6dbbb398f8c..96e68eee754 100644 --- a/src/cloudflare/resources/rulesets/phases/versions.py +++ b/src/cloudflare/resources/rulesets/phases/versions.py @@ -7,7 +7,6 @@ import httpx -from ....types import Ruleset from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -23,19 +22,20 @@ AsyncPaginator, make_request_options, ) -from ....types.rulesets.phases import VersionListResponse +from ....types.rulesets.ruleset import Ruleset +from ....types.rulesets.phases.version_get_response import VersionGetResponse -__all__ = ["Versions", "AsyncVersions"] +__all__ = ["VersionsResource", "AsyncVersionsResource"] -class Versions(SyncAPIResource): +class VersionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> VersionsWithRawResponse: - return VersionsWithRawResponse(self) + def with_raw_response(self) -> VersionsResourceWithRawResponse: + return VersionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VersionsWithStreamingResponse: - return VersionsWithStreamingResponse(self) + def with_streaming_response(self) -> VersionsResourceWithStreamingResponse: + return VersionsResourceWithStreamingResponse(self) def list( self, @@ -73,7 +73,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[VersionListResponse]: + ) -> SyncSinglePage[Ruleset]: """ Fetches the versions of an account or zone entry point ruleset. @@ -94,12 +94,6 @@ def list( """ if not ruleset_phase: raise ValueError(f"Expected a non-empty value for `ruleset_phase` but received {ruleset_phase!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -107,15 +101,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions", - page=SyncSinglePage[VersionListResponse], + page=SyncSinglePage[Ruleset], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=VersionListResponse, + model=Ruleset, ) def get( @@ -155,7 +152,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> VersionGetResponse: """ Fetches a specific version of an account or zone entry point ruleset. @@ -180,12 +177,6 @@ def get( raise ValueError(f"Expected a non-empty value for `ruleset_phase` but received {ruleset_phase!r}") if not ruleset_version: raise ValueError(f"Expected a non-empty value for `ruleset_version` but received {ruleset_version!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -193,6 +184,9 @@ def get( 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._get( @@ -202,20 +196,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VersionGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]), ) -class AsyncVersions(AsyncAPIResource): +class AsyncVersionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncVersionsWithRawResponse: - return AsyncVersionsWithRawResponse(self) + def with_raw_response(self) -> AsyncVersionsResourceWithRawResponse: + return AsyncVersionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVersionsWithStreamingResponse: - return AsyncVersionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVersionsResourceWithStreamingResponse: + return AsyncVersionsResourceWithStreamingResponse(self) def list( self, @@ -253,7 +247,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]: + ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: """ Fetches the versions of an account or zone entry point ruleset. @@ -274,12 +268,6 @@ def list( """ if not ruleset_phase: raise ValueError(f"Expected a non-empty value for `ruleset_phase` but received {ruleset_phase!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -287,15 +275,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions", - page=AsyncSinglePage[VersionListResponse], + page=AsyncSinglePage[Ruleset], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=VersionListResponse, + model=Ruleset, ) async def get( @@ -335,7 +326,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> VersionGetResponse: """ Fetches a specific version of an account or zone entry point ruleset. @@ -360,12 +351,6 @@ async def get( raise ValueError(f"Expected a non-empty value for `ruleset_phase` but received {ruleset_phase!r}") if not ruleset_version: raise ValueError(f"Expected a non-empty value for `ruleset_version` but received {ruleset_version!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -373,6 +358,9 @@ async def get( 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._get( @@ -382,14 +370,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VersionGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]), ) -class VersionsWithRawResponse: - def __init__(self, versions: Versions) -> None: +class VersionsResourceWithRawResponse: + def __init__(self, versions: VersionsResource) -> None: self._versions = versions self.list = to_raw_response_wrapper( @@ -400,8 +388,8 @@ def __init__(self, versions: Versions) -> None: ) -class AsyncVersionsWithRawResponse: - def __init__(self, versions: AsyncVersions) -> None: +class AsyncVersionsResourceWithRawResponse: + def __init__(self, versions: AsyncVersionsResource) -> None: self._versions = versions self.list = async_to_raw_response_wrapper( @@ -412,8 +400,8 @@ def __init__(self, versions: AsyncVersions) -> None: ) -class VersionsWithStreamingResponse: - def __init__(self, versions: Versions) -> None: +class VersionsResourceWithStreamingResponse: + def __init__(self, versions: VersionsResource) -> None: self._versions = versions self.list = to_streamed_response_wrapper( @@ -424,8 +412,8 @@ def __init__(self, versions: Versions) -> None: ) -class AsyncVersionsWithStreamingResponse: - def __init__(self, versions: AsyncVersions) -> None: +class AsyncVersionsResourceWithStreamingResponse: + def __init__(self, versions: AsyncVersionsResource) -> None: self._versions = versions self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/rulesets/rules.py b/src/cloudflare/resources/rulesets/rules.py index d9135563a66..48621b0a6bf 100644 --- a/src/cloudflare/resources/rulesets/rules.py +++ b/src/cloudflare/resources/rulesets/rules.py @@ -7,7 +7,6 @@ import httpx -from ...types import Ruleset from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( required_args, @@ -27,18 +26,22 @@ make_request_options, ) from ...types.rulesets import rule_edit_params, rule_create_params +from ...types.rulesets.logging_param import LoggingParam +from ...types.rulesets.rule_edit_response import RuleEditResponse +from ...types.rulesets.rule_create_response import RuleCreateResponse +from ...types.rulesets.rule_delete_response import RuleDeleteResponse -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) @overload def create( @@ -49,11 +52,11 @@ def create( zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, action: Literal["block"] | NotGiven = NOT_GIVEN, - action_parameters: rule_create_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsBlockRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -61,7 +64,127 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["compress_response"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.CompressResponseRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: """Adds a new rule to an account or zone ruleset. The rule will be added to the end @@ -109,11 +232,2452 @@ def create( zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, action: Literal["execute"] | NotGiven = NOT_GIVEN, - action_parameters: rule_create_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["js_challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["log"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["managed_challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["redirect"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.RedirectRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["rewrite"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["route"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.RouteRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["score"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.ScoreRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["serve_error"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.ServeErrorRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["set_config"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.SetConfigRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["skip"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["set_cache_settings"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["block"] + | Literal["challenge"] + | Literal["compress_response"] + | Literal["execute"] + | Literal["js_challenge"] + | Literal["log"] + | Literal["managed_challenge"] + | Literal["redirect"] + | Literal["rewrite"] + | Literal["route"] + | Literal["score"] + | Literal["serve_error"] + | Literal["set_config"] + | Literal["skip"] + | Literal["set_cache_settings"] + | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.BlockRuleActionParameters + | object + | rule_create_params.CompressResponseRuleActionParameters + | rule_create_params.ExecuteRuleActionParameters + | rule_create_params.RedirectRuleActionParameters + | rule_create_params.RewriteRuleActionParameters + | rule_create_params.RouteRuleActionParameters + | rule_create_params.ScoreRuleActionParameters + | rule_create_params.ServeErrorRuleActionParameters + | rule_create_params.SetConfigRuleActionParameters + | rule_create_params.SkipRuleActionParameters + | rule_create_params.SetCacheSettingsRuleActionParameters + | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + if not ruleset_id: + raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") + 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}/rulesets/{ruleset_id}/rules", + body=maybe_transform( + { + "id": id, + "action": action, + "action_parameters": action_parameters, + "description": description, + "enabled": enabled, + "expression": expression, + "logging": logging, + "ref": ref, + }, + 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[RuleCreateResponse]._unwrapper, + ), + cast_to=cast(Type[RuleCreateResponse], ResultWrapper[RuleCreateResponse]), + ) + + def delete( + self, + rule_id: str, + *, + ruleset_id: 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, + ) -> RuleDeleteResponse: + """ + Deletes an existing rule from an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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 not ruleset_id: + raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + 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._delete( + f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[RuleDeleteResponse]._unwrapper, + ), + cast_to=cast(Type[RuleDeleteResponse], ResultWrapper[RuleDeleteResponse]), + ) + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["block"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["compress_response"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.CompressResponseRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["execute"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["js_challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["log"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["managed_challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["redirect"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.RedirectRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["rewrite"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["route"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.RouteRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["score"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.ScoreRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["serve_error"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.ServeErrorRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["set_config"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.SetConfigRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["skip"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["set_cache_settings"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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( + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ) + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["block"] + | Literal["challenge"] + | Literal["compress_response"] + | Literal["execute"] + | Literal["js_challenge"] + | Literal["log"] + | Literal["managed_challenge"] + | Literal["redirect"] + | Literal["rewrite"] + | Literal["route"] + | Literal["score"] + | Literal["serve_error"] + | Literal["set_config"] + | Literal["skip"] + | Literal["set_cache_settings"] + | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.BlockRuleActionParameters + | object + | rule_edit_params.CompressResponseRuleActionParameters + | rule_edit_params.ExecuteRuleActionParameters + | rule_edit_params.RedirectRuleActionParameters + | rule_edit_params.RewriteRuleActionParameters + | rule_edit_params.RouteRuleActionParameters + | rule_edit_params.ScoreRuleActionParameters + | rule_edit_params.ServeErrorRuleActionParameters + | rule_edit_params.SetConfigRuleActionParameters + | rule_edit_params.SkipRuleActionParameters + | rule_edit_params.SetCacheSettingsRuleActionParameters + | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + if not ruleset_id: + raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + 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._patch( + f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}", + body=maybe_transform( + { + "id": id, + "action": action, + "action_parameters": action_parameters, + "description": description, + "enabled": enabled, + "expression": expression, + "logging": logging, + "ref": ref, + }, + rule_edit_params.RuleEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[RuleEditResponse]._unwrapper, + ), + cast_to=cast(Type[RuleEditResponse], ResultWrapper[RuleEditResponse]), + ) + + +class AsyncRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["block"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["compress_response"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.CompressResponseRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["execute"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["js_challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["log"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["managed_challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["redirect"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.RedirectRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["rewrite"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["route"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.RouteRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsExecuteRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -121,7 +2685,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleCreateResponse: """Adds a new rule to an account or zone ruleset. The rule will be added to the end @@ -161,19 +2725,19 @@ def create( ... @overload - def create( + async def create( self, ruleset_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["log"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, + action: Literal["score"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.ScoreRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsLogRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -181,7 +2745,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleCreateResponse: """Adds a new rule to an account or zone ruleset. The rule will be added to the end @@ -221,7 +2785,127 @@ def create( ... @overload - def create( + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["serve_error"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.ServeErrorRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["set_config"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.SetConfigRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def create( self, ruleset_id: str, *, @@ -229,11 +2913,11 @@ def create( zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, action: Literal["skip"] | NotGiven = NOT_GIVEN, - action_parameters: rule_create_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsSkipRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -241,7 +2925,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleCreateResponse: """Adds a new rule to an account or zone ruleset. The rule will be added to the end @@ -280,23 +2964,106 @@ def create( """ ... - def create( + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["set_cache_settings"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + async def create( self, ruleset_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN, - action_parameters: rule_create_params.RulesetsBlockRuleActionParameters - | rule_create_params.RulesetsExecuteRuleActionParameters + action: Literal["block"] + | Literal["challenge"] + | Literal["compress_response"] + | Literal["execute"] + | Literal["js_challenge"] + | Literal["log"] + | Literal["managed_challenge"] + | Literal["redirect"] + | Literal["rewrite"] + | Literal["route"] + | Literal["score"] + | Literal["serve_error"] + | Literal["set_config"] + | Literal["skip"] + | Literal["set_cache_settings"] + | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.BlockRuleActionParameters | object - | rule_create_params.RulesetsSkipRuleActionParameters + | rule_create_params.CompressResponseRuleActionParameters + | rule_create_params.ExecuteRuleActionParameters + | rule_create_params.RedirectRuleActionParameters + | rule_create_params.RewriteRuleActionParameters + | rule_create_params.RouteRuleActionParameters + | rule_create_params.ScoreRuleActionParameters + | rule_create_params.ServeErrorRuleActionParameters + | rule_create_params.SetConfigRuleActionParameters + | rule_create_params.SkipRuleActionParameters + | rule_create_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsBlockRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -304,15 +3071,9 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleCreateResponse: if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -320,11 +3081,14 @@ def create( 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( + return await self._post( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules", - body=maybe_transform( + body=await async_maybe_transform( { "id": id, "action": action, @@ -342,12 +3106,12 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleCreateResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RuleCreateResponse], ResultWrapper[RuleCreateResponse]), ) - def delete( + async def delete( self, rule_id: str, *, @@ -360,7 +3124,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleDeleteResponse: """ Deletes an existing rule from an account or zone ruleset. @@ -385,12 +3149,6 @@ def delete( raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -398,22 +3156,86 @@ def delete( 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._delete( + return await self._delete( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleDeleteResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RuleDeleteResponse], ResultWrapper[RuleDeleteResponse]), ) @overload - def edit( + async def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["block"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: 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, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + 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. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... + + @overload + async def edit( self, rule_id: str, *, @@ -421,12 +3243,12 @@ def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["block"] | NotGiven = NOT_GIVEN, - action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsBlockRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -434,7 +3256,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: """ Updates an existing rule in an account or zone ruleset. @@ -474,7 +3296,7 @@ def edit( ... @overload - def edit( + async def edit( self, rule_id: str, *, @@ -482,12 +3304,12 @@ def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["execute"] | NotGiven = NOT_GIVEN, - action_parameters: rule_edit_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["compress_response"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.CompressResponseRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsExecuteRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -495,7 +3317,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: """ Updates an existing rule in an account or zone ruleset. @@ -535,7 +3357,7 @@ def edit( ... @overload - def edit( + async def edit( self, rule_id: str, *, @@ -543,12 +3365,12 @@ def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["log"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, + action: Literal["execute"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsLogRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -556,7 +3378,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: """ Updates an existing rule in an account or zone ruleset. @@ -596,7 +3418,7 @@ def edit( ... @overload - def edit( + async def edit( self, rule_id: str, *, @@ -604,12 +3426,12 @@ def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["skip"] | NotGiven = NOT_GIVEN, - action_parameters: rule_edit_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["js_challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsSkipRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -617,7 +3439,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: """ Updates an existing rule in an account or zone ruleset. @@ -656,8 +3478,8 @@ def edit( """ ... - @required_args(["ruleset_id"], ["ruleset_id"], ["ruleset_id"], ["ruleset_id"]) - def edit( + @overload + async def edit( self, rule_id: str, *, @@ -665,16 +3487,12 @@ def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN, - action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters - | rule_edit_params.RulesetsExecuteRuleActionParameters - | object - | rule_edit_params.RulesetsSkipRuleActionParameters - | NotGiven = NOT_GIVEN, + action: Literal["log"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsBlockRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -682,75 +3500,60 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: - if not ruleset_id: - raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not rule_id: - raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") - if account_id and zone_id: - raise ValueError("You cannot provide both account_id and zone_id") + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. - if account_id: - account_or_zone = "accounts" - account_or_zone_id = account_id - else: - account_or_zone = "zones" - account_or_zone_id = zone_id - return self._patch( - f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}", - body=maybe_transform( - { - "id": id, - "action": action, - "action_parameters": action_parameters, - "description": description, - "enabled": enabled, - "expression": expression, - "logging": logging, - "ref": ref, - }, - rule_edit_params.RuleEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), - ) + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. -class AsyncRules(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + 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 + """ + ... @overload - async def create( + async def edit( self, - ruleset_id: str, + rule_id: str, *, + ruleset_id: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["block"] | NotGiven = NOT_GIVEN, - action_parameters: rule_create_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["managed_challenge"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsBlockRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -758,15 +3561,15 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: - """Adds a new rule to an account or zone ruleset. - - The rule will be added to the end - of the existing list of rules in the ruleset by default. + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. Args: ruleset_id: The unique ID of the ruleset. + rule_id: The unique ID of the rule. + 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. @@ -798,19 +3601,20 @@ async def create( ... @overload - async def create( + async def edit( self, - ruleset_id: str, + rule_id: str, *, + ruleset_id: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["execute"] | NotGiven = NOT_GIVEN, - action_parameters: rule_create_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["redirect"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.RedirectRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsExecuteRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -818,15 +3622,15 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: - """Adds a new rule to an account or zone ruleset. - - The rule will be added to the end - of the existing list of rules in the ruleset by default. + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. Args: ruleset_id: The unique ID of the ruleset. + rule_id: The unique ID of the rule. + 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. @@ -858,19 +3662,20 @@ async def create( ... @overload - async def create( + async def edit( self, - ruleset_id: str, + rule_id: str, *, + ruleset_id: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["log"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, + action: Literal["rewrite"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsLogRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -878,15 +3683,15 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: - """Adds a new rule to an account or zone ruleset. - - The rule will be added to the end - of the existing list of rules in the ruleset by default. + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. Args: ruleset_id: The unique ID of the ruleset. + rule_id: The unique ID of the rule. + 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. @@ -918,19 +3723,20 @@ async def create( ... @overload - async def create( + async def edit( self, - ruleset_id: str, + rule_id: str, *, + ruleset_id: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["skip"] | NotGiven = NOT_GIVEN, - action_parameters: rule_create_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["route"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.RouteRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsSkipRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -938,15 +3744,15 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: - """Adds a new rule to an account or zone ruleset. - - The rule will be added to the end - of the existing list of rules in the ruleset by default. + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. Args: ruleset_id: The unique ID of the ruleset. + rule_id: The unique ID of the rule. + 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. @@ -977,23 +3783,21 @@ async def create( """ ... - async def create( + @overload + async def edit( self, - ruleset_id: str, + rule_id: str, *, + ruleset_id: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN, - action_parameters: rule_create_params.RulesetsBlockRuleActionParameters - | rule_create_params.RulesetsExecuteRuleActionParameters - | object - | rule_create_params.RulesetsSkipRuleActionParameters - | NotGiven = NOT_GIVEN, + action: Literal["score"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.ScoreRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_create_params.RulesetsBlockRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -1001,65 +3805,9 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: - if not ruleset_id: - raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") - 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: - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._post( - f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules", - body=await async_maybe_transform( - { - "id": id, - "action": action, - "action_parameters": action_parameters, - "description": description, - "enabled": enabled, - "expression": expression, - "logging": logging, - "ref": ref, - }, - 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._unwrapper, - ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), - ) - - async def delete( - self, - rule_id: str, - *, - ruleset_id: 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, - ) -> Ruleset: + ) -> RuleEditResponse: """ - Deletes an existing rule from an account or zone ruleset. + Updates an existing rule in an account or zone ruleset. Args: ruleset_id: The unique ID of the ruleset. @@ -1070,6 +3818,22 @@ async def delete( zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1078,36 +3842,7 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not ruleset_id: - raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not rule_id: - raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") - 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: - account_or_zone = "zones" - account_or_zone_id = zone_id - return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), - ) + ... @overload async def edit( @@ -1118,12 +3853,12 @@ async def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["block"] | NotGiven = NOT_GIVEN, - action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["serve_error"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.ServeErrorRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsBlockRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -1131,7 +3866,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: """ Updates an existing rule in an account or zone ruleset. @@ -1179,12 +3914,12 @@ async def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["execute"] | NotGiven = NOT_GIVEN, - action_parameters: rule_edit_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["set_config"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.SetConfigRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsExecuteRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -1192,7 +3927,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: """ Updates an existing rule in an account or zone ruleset. @@ -1240,12 +3975,12 @@ async def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["log"] | NotGiven = NOT_GIVEN, - action_parameters: object | NotGiven = NOT_GIVEN, + action: Literal["skip"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsLogRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -1253,7 +3988,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: """ Updates an existing rule in an account or zone ruleset. @@ -1301,12 +4036,12 @@ async def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["skip"] | NotGiven = NOT_GIVEN, - action_parameters: rule_edit_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN, + action: Literal["set_cache_settings"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsSkipRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -1314,7 +4049,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: """ Updates an existing rule in an account or zone ruleset. @@ -1353,7 +4088,23 @@ async def edit( """ ... - @required_args(["ruleset_id"], ["ruleset_id"], ["ruleset_id"], ["ruleset_id"]) + @required_args( + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ["ruleset_id"], + ) async def edit( self, rule_id: str, @@ -1362,16 +4113,39 @@ async def edit( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN, - action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters - | rule_edit_params.RulesetsExecuteRuleActionParameters + action: Literal["block"] + | Literal["challenge"] + | Literal["compress_response"] + | Literal["execute"] + | Literal["js_challenge"] + | Literal["log"] + | Literal["managed_challenge"] + | Literal["redirect"] + | Literal["rewrite"] + | Literal["route"] + | Literal["score"] + | Literal["serve_error"] + | Literal["set_config"] + | Literal["skip"] + | Literal["set_cache_settings"] + | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.BlockRuleActionParameters | object - | rule_edit_params.RulesetsSkipRuleActionParameters + | rule_edit_params.CompressResponseRuleActionParameters + | rule_edit_params.ExecuteRuleActionParameters + | rule_edit_params.RedirectRuleActionParameters + | rule_edit_params.RewriteRuleActionParameters + | rule_edit_params.RouteRuleActionParameters + | rule_edit_params.ScoreRuleActionParameters + | rule_edit_params.ServeErrorRuleActionParameters + | rule_edit_params.SetConfigRuleActionParameters + | rule_edit_params.SkipRuleActionParameters + | rule_edit_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, - logging: rule_edit_params.RulesetsBlockRuleLogging | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, ref: 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. @@ -1379,17 +4153,11 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RuleEditResponse: if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1397,6 +4165,9 @@ async def edit( 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._patch( @@ -1419,14 +4190,14 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleEditResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RuleEditResponse], ResultWrapper[RuleEditResponse]), ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_raw_response_wrapper( @@ -1440,8 +4211,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_raw_response_wrapper( @@ -1455,8 +4226,8 @@ def __init__(self, rules: AsyncRules) -> None: ) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_streamed_response_wrapper( @@ -1470,8 +4241,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/rulesets/rulesets.py b/src/cloudflare/resources/rulesets/rulesets.py index f57071173b4..5c040db3ff0 100644 --- a/src/cloudflare/resources/rulesets/rulesets.py +++ b/src/cloudflare/resources/rulesets/rulesets.py @@ -8,34 +8,33 @@ import httpx from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .phases import ( - Phases, - AsyncPhases, - PhasesWithRawResponse, - AsyncPhasesWithRawResponse, - PhasesWithStreamingResponse, - AsyncPhasesWithStreamingResponse, + PhasesResource, + AsyncPhasesResource, + PhasesResourceWithRawResponse, + AsyncPhasesResourceWithRawResponse, + PhasesResourceWithStreamingResponse, + AsyncPhasesResourceWithStreamingResponse, ) -from ...types import Ruleset, RulesetListResponse, ruleset_create_params, ruleset_update_params from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ..._utils import ( maybe_transform, async_maybe_transform, ) from .versions import ( - Versions, - AsyncVersions, - VersionsWithRawResponse, - AsyncVersionsWithRawResponse, - VersionsWithStreamingResponse, - AsyncVersionsWithStreamingResponse, + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -47,36 +46,41 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage -from .phases.phases import Phases, AsyncPhases +from .phases.phases import PhasesResource, AsyncPhasesResource from ..._base_client import ( AsyncPaginator, make_request_options, ) -from .versions.versions import Versions, AsyncVersions +from ...types.rulesets import ruleset_create_params, ruleset_update_params +from .versions.versions import VersionsResource, AsyncVersionsResource +from ...types.rulesets.ruleset import Ruleset +from ...types.rulesets.ruleset_get_response import RulesetGetResponse +from ...types.rulesets.ruleset_create_response import RulesetCreateResponse +from ...types.rulesets.ruleset_update_response import RulesetUpdateResponse -__all__ = ["Rulesets", "AsyncRulesets"] +__all__ = ["RulesetsResource", "AsyncRulesetsResource"] -class Rulesets(SyncAPIResource): +class RulesetsResource(SyncAPIResource): @cached_property - def phases(self) -> Phases: - return Phases(self._client) + def phases(self) -> PhasesResource: + return PhasesResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def versions(self) -> Versions: - return Versions(self._client) + def versions(self) -> VersionsResource: + return VersionsResource(self._client) @cached_property - def with_raw_response(self) -> RulesetsWithRawResponse: - return RulesetsWithRawResponse(self) + def with_raw_response(self) -> RulesetsResourceWithRawResponse: + return RulesetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesetsWithStreamingResponse: - return RulesetsWithStreamingResponse(self) + def with_streaming_response(self) -> RulesetsResourceWithStreamingResponse: + return RulesetsResourceWithStreamingResponse(self) def create( self, @@ -118,7 +122,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RulesetCreateResponse: """ Creates a ruleset. @@ -145,12 +149,6 @@ def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -158,6 +156,9 @@ def create( 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( @@ -177,16 +178,15 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RulesetCreateResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RulesetCreateResponse], ResultWrapper[RulesetCreateResponse]), ) def update( self, ruleset_id: str, *, - id: str, rules: Iterable[ruleset_update_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -225,15 +225,13 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RulesetUpdateResponse: """ Updates an account or zone ruleset, creating a new version. Args: ruleset_id: The unique ID of the ruleset. - id: The unique ID of the ruleset. - rules: The list of rules in the ruleset. account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -258,12 +256,6 @@ def update( """ if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -271,13 +263,15 @@ def update( 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._put( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}", body=maybe_transform( { - "id": id, "rules": rules, "description": description, "kind": kind, @@ -291,9 +285,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RulesetUpdateResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RulesetUpdateResponse], ResultWrapper[RulesetUpdateResponse]), ) def list( @@ -307,7 +301,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[RulesetListResponse]: + ) -> SyncSinglePage[Ruleset]: """ Fetches all rulesets. @@ -324,12 +318,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -337,15 +325,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets", - page=SyncSinglePage[RulesetListResponse], + page=SyncSinglePage[Ruleset], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=RulesetListResponse, + model=Ruleset, ) def delete( @@ -381,12 +372,6 @@ def delete( """ if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -394,6 +379,9 @@ def delete( 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 extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -417,7 +405,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RulesetGetResponse: """ Fetches the latest version of an account or zone ruleset. @@ -438,12 +426,6 @@ def get( """ if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -451,6 +433,9 @@ def get( 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._get( @@ -460,32 +445,32 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RulesetGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RulesetGetResponse], ResultWrapper[RulesetGetResponse]), ) -class AsyncRulesets(AsyncAPIResource): +class AsyncRulesetsResource(AsyncAPIResource): @cached_property - def phases(self) -> AsyncPhases: - return AsyncPhases(self._client) + def phases(self) -> AsyncPhasesResource: + return AsyncPhasesResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def versions(self) -> AsyncVersions: - return AsyncVersions(self._client) + def versions(self) -> AsyncVersionsResource: + return AsyncVersionsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRulesetsWithRawResponse: - return AsyncRulesetsWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesetsResourceWithRawResponse: + return AsyncRulesetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesetsWithStreamingResponse: - return AsyncRulesetsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesetsResourceWithStreamingResponse: + return AsyncRulesetsResourceWithStreamingResponse(self) async def create( self, @@ -527,7 +512,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RulesetCreateResponse: """ Creates a ruleset. @@ -554,12 +539,6 @@ async def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -567,6 +546,9 @@ async def create( 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( @@ -586,16 +568,15 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RulesetCreateResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RulesetCreateResponse], ResultWrapper[RulesetCreateResponse]), ) async def update( self, ruleset_id: str, *, - id: str, rules: Iterable[ruleset_update_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -634,15 +615,13 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RulesetUpdateResponse: """ Updates an account or zone ruleset, creating a new version. Args: ruleset_id: The unique ID of the ruleset. - id: The unique ID of the ruleset. - rules: The list of rules in the ruleset. account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -667,12 +646,6 @@ async def update( """ if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -680,13 +653,15 @@ async def update( 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._put( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}", body=await async_maybe_transform( { - "id": id, "rules": rules, "description": description, "kind": kind, @@ -700,9 +675,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RulesetUpdateResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RulesetUpdateResponse], ResultWrapper[RulesetUpdateResponse]), ) def list( @@ -716,7 +691,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RulesetListResponse, AsyncSinglePage[RulesetListResponse]]: + ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: """ Fetches all rulesets. @@ -733,12 +708,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -746,15 +715,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets", - page=AsyncSinglePage[RulesetListResponse], + page=AsyncSinglePage[Ruleset], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=RulesetListResponse, + model=Ruleset, ) async def delete( @@ -790,12 +762,6 @@ async def delete( """ if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -803,6 +769,9 @@ async def delete( 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 extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -826,7 +795,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> RulesetGetResponse: """ Fetches the latest version of an account or zone ruleset. @@ -847,12 +816,6 @@ async def get( """ if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -860,6 +823,9 @@ async def get( 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._get( @@ -869,14 +835,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RulesetGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[RulesetGetResponse], ResultWrapper[RulesetGetResponse]), ) -class RulesetsWithRawResponse: - def __init__(self, rulesets: Rulesets) -> None: +class RulesetsResourceWithRawResponse: + def __init__(self, rulesets: RulesetsResource) -> None: self._rulesets = rulesets self.create = to_raw_response_wrapper( @@ -896,20 +862,20 @@ def __init__(self, rulesets: Rulesets) -> None: ) @cached_property - def phases(self) -> PhasesWithRawResponse: - return PhasesWithRawResponse(self._rulesets.phases) + def phases(self) -> PhasesResourceWithRawResponse: + return PhasesResourceWithRawResponse(self._rulesets.phases) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._rulesets.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._rulesets.rules) @cached_property - def versions(self) -> VersionsWithRawResponse: - return VersionsWithRawResponse(self._rulesets.versions) + def versions(self) -> VersionsResourceWithRawResponse: + return VersionsResourceWithRawResponse(self._rulesets.versions) -class AsyncRulesetsWithRawResponse: - def __init__(self, rulesets: AsyncRulesets) -> None: +class AsyncRulesetsResourceWithRawResponse: + def __init__(self, rulesets: AsyncRulesetsResource) -> None: self._rulesets = rulesets self.create = async_to_raw_response_wrapper( @@ -929,20 +895,20 @@ def __init__(self, rulesets: AsyncRulesets) -> None: ) @cached_property - def phases(self) -> AsyncPhasesWithRawResponse: - return AsyncPhasesWithRawResponse(self._rulesets.phases) + def phases(self) -> AsyncPhasesResourceWithRawResponse: + return AsyncPhasesResourceWithRawResponse(self._rulesets.phases) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._rulesets.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._rulesets.rules) @cached_property - def versions(self) -> AsyncVersionsWithRawResponse: - return AsyncVersionsWithRawResponse(self._rulesets.versions) + def versions(self) -> AsyncVersionsResourceWithRawResponse: + return AsyncVersionsResourceWithRawResponse(self._rulesets.versions) -class RulesetsWithStreamingResponse: - def __init__(self, rulesets: Rulesets) -> None: +class RulesetsResourceWithStreamingResponse: + def __init__(self, rulesets: RulesetsResource) -> None: self._rulesets = rulesets self.create = to_streamed_response_wrapper( @@ -962,20 +928,20 @@ def __init__(self, rulesets: Rulesets) -> None: ) @cached_property - def phases(self) -> PhasesWithStreamingResponse: - return PhasesWithStreamingResponse(self._rulesets.phases) + def phases(self) -> PhasesResourceWithStreamingResponse: + return PhasesResourceWithStreamingResponse(self._rulesets.phases) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._rulesets.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._rulesets.rules) @cached_property - def versions(self) -> VersionsWithStreamingResponse: - return VersionsWithStreamingResponse(self._rulesets.versions) + def versions(self) -> VersionsResourceWithStreamingResponse: + return VersionsResourceWithStreamingResponse(self._rulesets.versions) -class AsyncRulesetsWithStreamingResponse: - def __init__(self, rulesets: AsyncRulesets) -> None: +class AsyncRulesetsResourceWithStreamingResponse: + def __init__(self, rulesets: AsyncRulesetsResource) -> None: self._rulesets = rulesets self.create = async_to_streamed_response_wrapper( @@ -995,13 +961,13 @@ def __init__(self, rulesets: AsyncRulesets) -> None: ) @cached_property - def phases(self) -> AsyncPhasesWithStreamingResponse: - return AsyncPhasesWithStreamingResponse(self._rulesets.phases) + def phases(self) -> AsyncPhasesResourceWithStreamingResponse: + return AsyncPhasesResourceWithStreamingResponse(self._rulesets.phases) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._rulesets.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._rulesets.rules) @cached_property - def versions(self) -> AsyncVersionsWithStreamingResponse: - return AsyncVersionsWithStreamingResponse(self._rulesets.versions) + def versions(self) -> AsyncVersionsResourceWithStreamingResponse: + return AsyncVersionsResourceWithStreamingResponse(self._rulesets.versions) diff --git a/src/cloudflare/resources/rulesets/versions/__init__.py b/src/cloudflare/resources/rulesets/versions/__init__.py index 41727f2773b..8064a2e609c 100644 --- a/src/cloudflare/resources/rulesets/versions/__init__.py +++ b/src/cloudflare/resources/rulesets/versions/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .by_tag import ( - ByTag, - AsyncByTag, - ByTagWithRawResponse, - AsyncByTagWithRawResponse, - ByTagWithStreamingResponse, - AsyncByTagWithStreamingResponse, + ByTagResource, + AsyncByTagResource, + ByTagResourceWithRawResponse, + AsyncByTagResourceWithRawResponse, + ByTagResourceWithStreamingResponse, + AsyncByTagResourceWithStreamingResponse, ) from .versions import ( - Versions, - AsyncVersions, - VersionsWithRawResponse, - AsyncVersionsWithRawResponse, - VersionsWithStreamingResponse, - AsyncVersionsWithStreamingResponse, + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, ) __all__ = [ - "ByTag", - "AsyncByTag", - "ByTagWithRawResponse", - "AsyncByTagWithRawResponse", - "ByTagWithStreamingResponse", - "AsyncByTagWithStreamingResponse", - "Versions", - "AsyncVersions", - "VersionsWithRawResponse", - "AsyncVersionsWithRawResponse", - "VersionsWithStreamingResponse", - "AsyncVersionsWithStreamingResponse", + "ByTagResource", + "AsyncByTagResource", + "ByTagResourceWithRawResponse", + "AsyncByTagResourceWithRawResponse", + "ByTagResourceWithStreamingResponse", + "AsyncByTagResourceWithStreamingResponse", + "VersionsResource", + "AsyncVersionsResource", + "VersionsResourceWithRawResponse", + "AsyncVersionsResourceWithRawResponse", + "VersionsResourceWithStreamingResponse", + "AsyncVersionsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/rulesets/versions/by_tag.py b/src/cloudflare/resources/rulesets/versions/by_tag.py index 227d92f4b37..7bc2877a38d 100644 --- a/src/cloudflare/resources/rulesets/versions/by_tag.py +++ b/src/cloudflare/resources/rulesets/versions/by_tag.py @@ -6,7 +6,6 @@ import httpx -from ....types import Ruleset from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -20,18 +19,19 @@ from ...._base_client import ( make_request_options, ) +from ....types.rulesets.versions.by_tag_get_response import ByTagGetResponse -__all__ = ["ByTag", "AsyncByTag"] +__all__ = ["ByTagResource", "AsyncByTagResource"] -class ByTag(SyncAPIResource): +class ByTagResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ByTagWithRawResponse: - return ByTagWithRawResponse(self) + def with_raw_response(self) -> ByTagResourceWithRawResponse: + return ByTagResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ByTagWithStreamingResponse: - return ByTagWithStreamingResponse(self) + def with_streaming_response(self) -> ByTagResourceWithStreamingResponse: + return ByTagResourceWithStreamingResponse(self) def get( self, @@ -46,7 +46,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> ByTagGetResponse: """ Fetches the rules of a managed account ruleset version for a given tag. @@ -82,20 +82,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ByTagGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[ByTagGetResponse], ResultWrapper[ByTagGetResponse]), ) -class AsyncByTag(AsyncAPIResource): +class AsyncByTagResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncByTagWithRawResponse: - return AsyncByTagWithRawResponse(self) + def with_raw_response(self) -> AsyncByTagResourceWithRawResponse: + return AsyncByTagResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncByTagWithStreamingResponse: - return AsyncByTagWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncByTagResourceWithStreamingResponse: + return AsyncByTagResourceWithStreamingResponse(self) async def get( self, @@ -110,7 +110,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> ByTagGetResponse: """ Fetches the rules of a managed account ruleset version for a given tag. @@ -146,14 +146,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ByTagGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[ByTagGetResponse], ResultWrapper[ByTagGetResponse]), ) -class ByTagWithRawResponse: - def __init__(self, by_tag: ByTag) -> None: +class ByTagResourceWithRawResponse: + def __init__(self, by_tag: ByTagResource) -> None: self._by_tag = by_tag self.get = to_raw_response_wrapper( @@ -161,8 +161,8 @@ def __init__(self, by_tag: ByTag) -> None: ) -class AsyncByTagWithRawResponse: - def __init__(self, by_tag: AsyncByTag) -> None: +class AsyncByTagResourceWithRawResponse: + def __init__(self, by_tag: AsyncByTagResource) -> None: self._by_tag = by_tag self.get = async_to_raw_response_wrapper( @@ -170,8 +170,8 @@ def __init__(self, by_tag: AsyncByTag) -> None: ) -class ByTagWithStreamingResponse: - def __init__(self, by_tag: ByTag) -> None: +class ByTagResourceWithStreamingResponse: + def __init__(self, by_tag: ByTagResource) -> None: self._by_tag = by_tag self.get = to_streamed_response_wrapper( @@ -179,8 +179,8 @@ def __init__(self, by_tag: ByTag) -> None: ) -class AsyncByTagWithStreamingResponse: - def __init__(self, by_tag: AsyncByTag) -> None: +class AsyncByTagResourceWithStreamingResponse: + def __init__(self, by_tag: AsyncByTagResource) -> None: self._by_tag = by_tag self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/rulesets/versions/versions.py b/src/cloudflare/resources/rulesets/versions/versions.py index 70590d82022..134fb1882b9 100644 --- a/src/cloudflare/resources/rulesets/versions/versions.py +++ b/src/cloudflare/resources/rulesets/versions/versions.py @@ -7,14 +7,13 @@ import httpx from .by_tag import ( - ByTag, - AsyncByTag, - ByTagWithRawResponse, - AsyncByTagWithRawResponse, - ByTagWithStreamingResponse, - AsyncByTagWithStreamingResponse, + ByTagResource, + AsyncByTagResource, + ByTagResourceWithRawResponse, + AsyncByTagResourceWithRawResponse, + ByTagResourceWithStreamingResponse, + AsyncByTagResourceWithStreamingResponse, ) -from ....types import Ruleset from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -30,23 +29,24 @@ AsyncPaginator, make_request_options, ) -from ....types.rulesets import VersionListResponse +from ....types.rulesets.ruleset import Ruleset +from ....types.rulesets.version_get_response import VersionGetResponse -__all__ = ["Versions", "AsyncVersions"] +__all__ = ["VersionsResource", "AsyncVersionsResource"] -class Versions(SyncAPIResource): +class VersionsResource(SyncAPIResource): @cached_property - def by_tag(self) -> ByTag: - return ByTag(self._client) + def by_tag(self) -> ByTagResource: + return ByTagResource(self._client) @cached_property - def with_raw_response(self) -> VersionsWithRawResponse: - return VersionsWithRawResponse(self) + def with_raw_response(self) -> VersionsResourceWithRawResponse: + return VersionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VersionsWithStreamingResponse: - return VersionsWithStreamingResponse(self) + def with_streaming_response(self) -> VersionsResourceWithStreamingResponse: + return VersionsResourceWithStreamingResponse(self) def list( self, @@ -60,7 +60,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[VersionListResponse]: + ) -> SyncSinglePage[Ruleset]: """ Fetches the versions of an account or zone ruleset. @@ -81,12 +81,6 @@ def list( """ if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -94,15 +88,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions", - page=SyncSinglePage[VersionListResponse], + page=SyncSinglePage[Ruleset], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=VersionListResponse, + model=Ruleset, ) def delete( @@ -143,12 +140,6 @@ def delete( raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") if not ruleset_version: raise ValueError(f"Expected a non-empty value for `ruleset_version` but received {ruleset_version!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -156,6 +147,9 @@ def delete( 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 extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -180,7 +174,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> VersionGetResponse: """ Fetches a specific version of an account or zone ruleset. @@ -205,12 +199,6 @@ def get( raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") if not ruleset_version: raise ValueError(f"Expected a non-empty value for `ruleset_version` but received {ruleset_version!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -218,6 +206,9 @@ def get( 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._get( @@ -227,24 +218,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VersionGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]), ) -class AsyncVersions(AsyncAPIResource): +class AsyncVersionsResource(AsyncAPIResource): @cached_property - def by_tag(self) -> AsyncByTag: - return AsyncByTag(self._client) + def by_tag(self) -> AsyncByTagResource: + return AsyncByTagResource(self._client) @cached_property - def with_raw_response(self) -> AsyncVersionsWithRawResponse: - return AsyncVersionsWithRawResponse(self) + def with_raw_response(self) -> AsyncVersionsResourceWithRawResponse: + return AsyncVersionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVersionsWithStreamingResponse: - return AsyncVersionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVersionsResourceWithStreamingResponse: + return AsyncVersionsResourceWithStreamingResponse(self) def list( self, @@ -258,7 +249,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]: + ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: """ Fetches the versions of an account or zone ruleset. @@ -279,12 +270,6 @@ def list( """ if not ruleset_id: raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -292,15 +277,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions", - page=AsyncSinglePage[VersionListResponse], + page=AsyncSinglePage[Ruleset], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=VersionListResponse, + model=Ruleset, ) async def delete( @@ -341,12 +329,6 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") if not ruleset_version: raise ValueError(f"Expected a non-empty value for `ruleset_version` but received {ruleset_version!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -354,6 +336,9 @@ async def delete( 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 extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -378,7 +363,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Ruleset: + ) -> VersionGetResponse: """ Fetches a specific version of an account or zone ruleset. @@ -403,12 +388,6 @@ async def get( raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}") if not ruleset_version: raise ValueError(f"Expected a non-empty value for `ruleset_version` but received {ruleset_version!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -416,6 +395,9 @@ async def get( 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._get( @@ -425,14 +407,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VersionGetResponse]._unwrapper, ), - cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]), + cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]), ) -class VersionsWithRawResponse: - def __init__(self, versions: Versions) -> None: +class VersionsResourceWithRawResponse: + def __init__(self, versions: VersionsResource) -> None: self._versions = versions self.list = to_raw_response_wrapper( @@ -446,12 +428,12 @@ def __init__(self, versions: Versions) -> None: ) @cached_property - def by_tag(self) -> ByTagWithRawResponse: - return ByTagWithRawResponse(self._versions.by_tag) + def by_tag(self) -> ByTagResourceWithRawResponse: + return ByTagResourceWithRawResponse(self._versions.by_tag) -class AsyncVersionsWithRawResponse: - def __init__(self, versions: AsyncVersions) -> None: +class AsyncVersionsResourceWithRawResponse: + def __init__(self, versions: AsyncVersionsResource) -> None: self._versions = versions self.list = async_to_raw_response_wrapper( @@ -465,12 +447,12 @@ def __init__(self, versions: AsyncVersions) -> None: ) @cached_property - def by_tag(self) -> AsyncByTagWithRawResponse: - return AsyncByTagWithRawResponse(self._versions.by_tag) + def by_tag(self) -> AsyncByTagResourceWithRawResponse: + return AsyncByTagResourceWithRawResponse(self._versions.by_tag) -class VersionsWithStreamingResponse: - def __init__(self, versions: Versions) -> None: +class VersionsResourceWithStreamingResponse: + def __init__(self, versions: VersionsResource) -> None: self._versions = versions self.list = to_streamed_response_wrapper( @@ -484,12 +466,12 @@ def __init__(self, versions: Versions) -> None: ) @cached_property - def by_tag(self) -> ByTagWithStreamingResponse: - return ByTagWithStreamingResponse(self._versions.by_tag) + def by_tag(self) -> ByTagResourceWithStreamingResponse: + return ByTagResourceWithStreamingResponse(self._versions.by_tag) -class AsyncVersionsWithStreamingResponse: - def __init__(self, versions: AsyncVersions) -> None: +class AsyncVersionsResourceWithStreamingResponse: + def __init__(self, versions: AsyncVersionsResource) -> None: self._versions = versions self.list = async_to_streamed_response_wrapper( @@ -503,5 +485,5 @@ def __init__(self, versions: AsyncVersions) -> None: ) @cached_property - def by_tag(self) -> AsyncByTagWithStreamingResponse: - return AsyncByTagWithStreamingResponse(self._versions.by_tag) + def by_tag(self) -> AsyncByTagResourceWithStreamingResponse: + return AsyncByTagResourceWithStreamingResponse(self._versions.by_tag) diff --git a/src/cloudflare/resources/rum/__init__.py b/src/cloudflare/resources/rum/__init__.py index 1d5f28e9846..4d891ef6bbb 100644 --- a/src/cloudflare/resources/rum/__init__.py +++ b/src/cloudflare/resources/rum/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .rum import ( - RUM, - AsyncRUM, - RUMWithRawResponse, - AsyncRUMWithRawResponse, - RUMWithStreamingResponse, - AsyncRUMWithStreamingResponse, + RUMResource, + AsyncRUMResource, + RUMResourceWithRawResponse, + AsyncRUMResourceWithRawResponse, + RUMResourceWithStreamingResponse, + AsyncRUMResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .site_info import ( - SiteInfo, - AsyncSiteInfo, - SiteInfoWithRawResponse, - AsyncSiteInfoWithRawResponse, - SiteInfoWithStreamingResponse, - AsyncSiteInfoWithStreamingResponse, + SiteInfoResource, + AsyncSiteInfoResource, + SiteInfoResourceWithRawResponse, + AsyncSiteInfoResourceWithRawResponse, + SiteInfoResourceWithStreamingResponse, + AsyncSiteInfoResourceWithStreamingResponse, ) __all__ = [ - "SiteInfo", - "AsyncSiteInfo", - "SiteInfoWithRawResponse", - "AsyncSiteInfoWithRawResponse", - "SiteInfoWithStreamingResponse", - "AsyncSiteInfoWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "RUM", - "AsyncRUM", - "RUMWithRawResponse", - "AsyncRUMWithRawResponse", - "RUMWithStreamingResponse", - "AsyncRUMWithStreamingResponse", + "SiteInfoResource", + "AsyncSiteInfoResource", + "SiteInfoResourceWithRawResponse", + "AsyncSiteInfoResourceWithRawResponse", + "SiteInfoResourceWithStreamingResponse", + "AsyncSiteInfoResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "RUMResource", + "AsyncRUMResource", + "RUMResourceWithRawResponse", + "AsyncRUMResourceWithRawResponse", + "RUMResourceWithStreamingResponse", + "AsyncRUMResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/rum/rules.py b/src/cloudflare/resources/rum/rules.py index 721e9ca2e49..f78f37f35bf 100644 --- a/src/cloudflare/resources/rum/rules.py +++ b/src/cloudflare/resources/rum/rules.py @@ -20,22 +20,25 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.rum import RUMRule, RuleListResponse, RuleDeleteResponse, rule_create_params, rule_update_params +from ...types.rum import rule_create_params, rule_update_params from ..._base_client import ( make_request_options, ) +from ...types.rum.rum_rule import RUMRule +from ...types.rum.rule_list_response import RuleListResponse +from ...types.rum.rule_delete_response import RuleDeleteResponse -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) def create( self, @@ -93,7 +96,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RUMRule]]._unwrapper, ), cast_to=cast(Type[Optional[RUMRule]], ResultWrapper[RUMRule]), ) @@ -159,7 +162,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RUMRule]]._unwrapper, ), cast_to=cast(Type[Optional[RUMRule]], ResultWrapper[RUMRule]), ) @@ -203,7 +206,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleListResponse]], ResultWrapper[RuleListResponse]), ) @@ -252,20 +255,20 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleDeleteResponse]], ResultWrapper[RuleDeleteResponse]), ) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) async def create( self, @@ -323,7 +326,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RUMRule]]._unwrapper, ), cast_to=cast(Type[Optional[RUMRule]], ResultWrapper[RUMRule]), ) @@ -389,7 +392,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RUMRule]]._unwrapper, ), cast_to=cast(Type[Optional[RUMRule]], ResultWrapper[RUMRule]), ) @@ -433,7 +436,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleListResponse]], ResultWrapper[RuleListResponse]), ) @@ -482,14 +485,14 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleDeleteResponse]], ResultWrapper[RuleDeleteResponse]), ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_raw_response_wrapper( @@ -506,8 +509,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_raw_response_wrapper( @@ -524,8 +527,8 @@ def __init__(self, rules: AsyncRules) -> None: ) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_streamed_response_wrapper( @@ -542,8 +545,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/rum/rum.py b/src/cloudflare/resources/rum/rum.py index 50eb544b0c9..038a15f3ac0 100644 --- a/src/cloudflare/resources/rum/rum.py +++ b/src/cloudflare/resources/rum/rum.py @@ -3,110 +3,110 @@ from __future__ import annotations from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from ..._compat import cached_property from .site_info import ( - SiteInfo, - AsyncSiteInfo, - SiteInfoWithRawResponse, - AsyncSiteInfoWithRawResponse, - SiteInfoWithStreamingResponse, - AsyncSiteInfoWithStreamingResponse, + SiteInfoResource, + AsyncSiteInfoResource, + SiteInfoResourceWithRawResponse, + AsyncSiteInfoResourceWithRawResponse, + SiteInfoResourceWithStreamingResponse, + AsyncSiteInfoResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["RUM", "AsyncRUM"] +__all__ = ["RUMResource", "AsyncRUMResource"] -class RUM(SyncAPIResource): +class RUMResource(SyncAPIResource): @cached_property - def site_info(self) -> SiteInfo: - return SiteInfo(self._client) + def site_info(self) -> SiteInfoResource: + return SiteInfoResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def with_raw_response(self) -> RUMWithRawResponse: - return RUMWithRawResponse(self) + def with_raw_response(self) -> RUMResourceWithRawResponse: + return RUMResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RUMWithStreamingResponse: - return RUMWithStreamingResponse(self) + def with_streaming_response(self) -> RUMResourceWithStreamingResponse: + return RUMResourceWithStreamingResponse(self) -class AsyncRUM(AsyncAPIResource): +class AsyncRUMResource(AsyncAPIResource): @cached_property - def site_info(self) -> AsyncSiteInfo: - return AsyncSiteInfo(self._client) + def site_info(self) -> AsyncSiteInfoResource: + return AsyncSiteInfoResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRUMWithRawResponse: - return AsyncRUMWithRawResponse(self) + def with_raw_response(self) -> AsyncRUMResourceWithRawResponse: + return AsyncRUMResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRUMWithStreamingResponse: - return AsyncRUMWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRUMResourceWithStreamingResponse: + return AsyncRUMResourceWithStreamingResponse(self) -class RUMWithRawResponse: - def __init__(self, rum: RUM) -> None: +class RUMResourceWithRawResponse: + def __init__(self, rum: RUMResource) -> None: self._rum = rum @cached_property - def site_info(self) -> SiteInfoWithRawResponse: - return SiteInfoWithRawResponse(self._rum.site_info) + def site_info(self) -> SiteInfoResourceWithRawResponse: + return SiteInfoResourceWithRawResponse(self._rum.site_info) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._rum.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._rum.rules) -class AsyncRUMWithRawResponse: - def __init__(self, rum: AsyncRUM) -> None: +class AsyncRUMResourceWithRawResponse: + def __init__(self, rum: AsyncRUMResource) -> None: self._rum = rum @cached_property - def site_info(self) -> AsyncSiteInfoWithRawResponse: - return AsyncSiteInfoWithRawResponse(self._rum.site_info) + def site_info(self) -> AsyncSiteInfoResourceWithRawResponse: + return AsyncSiteInfoResourceWithRawResponse(self._rum.site_info) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._rum.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._rum.rules) -class RUMWithStreamingResponse: - def __init__(self, rum: RUM) -> None: +class RUMResourceWithStreamingResponse: + def __init__(self, rum: RUMResource) -> None: self._rum = rum @cached_property - def site_info(self) -> SiteInfoWithStreamingResponse: - return SiteInfoWithStreamingResponse(self._rum.site_info) + def site_info(self) -> SiteInfoResourceWithStreamingResponse: + return SiteInfoResourceWithStreamingResponse(self._rum.site_info) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._rum.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._rum.rules) -class AsyncRUMWithStreamingResponse: - def __init__(self, rum: AsyncRUM) -> None: +class AsyncRUMResourceWithStreamingResponse: + def __init__(self, rum: AsyncRUMResource) -> None: self._rum = rum @cached_property - def site_info(self) -> AsyncSiteInfoWithStreamingResponse: - return AsyncSiteInfoWithStreamingResponse(self._rum.site_info) + def site_info(self) -> AsyncSiteInfoResourceWithStreamingResponse: + return AsyncSiteInfoResourceWithStreamingResponse(self._rum.site_info) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._rum.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._rum.rules) diff --git a/src/cloudflare/resources/rum/site_info.py b/src/cloudflare/resources/rum/site_info.py index 9ecca8d2f44..c70c62d4385 100644 --- a/src/cloudflare/resources/rum/site_info.py +++ b/src/cloudflare/resources/rum/site_info.py @@ -21,30 +21,26 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.rum import ( - RUMSite, - SiteInfoDeleteResponse, - site_info_list_params, - site_info_create_params, - site_info_update_params, -) +from ...types.rum import site_info_list_params, site_info_create_params, site_info_update_params from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.rum.site import Site +from ...types.rum.site_info_delete_response import SiteInfoDeleteResponse -__all__ = ["SiteInfo", "AsyncSiteInfo"] +__all__ = ["SiteInfoResource", "AsyncSiteInfoResource"] -class SiteInfo(SyncAPIResource): +class SiteInfoResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SiteInfoWithRawResponse: - return SiteInfoWithRawResponse(self) + def with_raw_response(self) -> SiteInfoResourceWithRawResponse: + return SiteInfoResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SiteInfoWithStreamingResponse: - return SiteInfoWithStreamingResponse(self) + def with_streaming_response(self) -> SiteInfoResourceWithStreamingResponse: + return SiteInfoResourceWithStreamingResponse(self) def create( self, @@ -59,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RUMSite]: + ) -> Optional[Site]: """ Creates a new Web Analytics site. @@ -98,9 +94,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Site]]._unwrapper, ), - cast_to=cast(Type[Optional[RUMSite]], ResultWrapper[RUMSite]), + cast_to=cast(Type[Optional[Site]], ResultWrapper[Site]), ) def update( @@ -117,7 +113,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RUMSite]: + ) -> Optional[Site]: """ Updates an existing Web Analytics site. @@ -160,9 +156,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Site]]._unwrapper, ), - cast_to=cast(Type[Optional[RUMSite]], ResultWrapper[RUMSite]), + cast_to=cast(Type[Optional[Site]], ResultWrapper[Site]), ) def list( @@ -178,7 +174,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[RUMSite]: + ) -> SyncV4PagePaginationArray[Site]: """ Lists all Web Analytics sites of an account. @@ -203,7 +199,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/rum/site_info/list", - page=SyncV4PagePaginationArray[RUMSite], + page=SyncV4PagePaginationArray[Site], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -218,7 +214,7 @@ def list( site_info_list_params.SiteInfoListParams, ), ), - model=RUMSite, + model=Site, ) def delete( @@ -260,7 +256,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SiteInfoDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SiteInfoDeleteResponse]], ResultWrapper[SiteInfoDeleteResponse]), ) @@ -276,7 +272,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RUMSite]: + ) -> Optional[Site]: """ Retrieves a Web Analytics site. @@ -304,20 +300,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Site]]._unwrapper, ), - cast_to=cast(Type[Optional[RUMSite]], ResultWrapper[RUMSite]), + cast_to=cast(Type[Optional[Site]], ResultWrapper[Site]), ) -class AsyncSiteInfo(AsyncAPIResource): +class AsyncSiteInfoResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSiteInfoWithRawResponse: - return AsyncSiteInfoWithRawResponse(self) + def with_raw_response(self) -> AsyncSiteInfoResourceWithRawResponse: + return AsyncSiteInfoResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSiteInfoWithStreamingResponse: - return AsyncSiteInfoWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSiteInfoResourceWithStreamingResponse: + return AsyncSiteInfoResourceWithStreamingResponse(self) async def create( self, @@ -332,7 +328,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RUMSite]: + ) -> Optional[Site]: """ Creates a new Web Analytics site. @@ -371,9 +367,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Site]]._unwrapper, ), - cast_to=cast(Type[Optional[RUMSite]], ResultWrapper[RUMSite]), + cast_to=cast(Type[Optional[Site]], ResultWrapper[Site]), ) async def update( @@ -390,7 +386,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RUMSite]: + ) -> Optional[Site]: """ Updates an existing Web Analytics site. @@ -433,9 +429,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Site]]._unwrapper, ), - cast_to=cast(Type[Optional[RUMSite]], ResultWrapper[RUMSite]), + cast_to=cast(Type[Optional[Site]], ResultWrapper[Site]), ) def list( @@ -451,7 +447,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RUMSite, AsyncV4PagePaginationArray[RUMSite]]: + ) -> AsyncPaginator[Site, AsyncV4PagePaginationArray[Site]]: """ Lists all Web Analytics sites of an account. @@ -476,7 +472,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/rum/site_info/list", - page=AsyncV4PagePaginationArray[RUMSite], + page=AsyncV4PagePaginationArray[Site], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -491,7 +487,7 @@ def list( site_info_list_params.SiteInfoListParams, ), ), - model=RUMSite, + model=Site, ) async def delete( @@ -533,7 +529,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SiteInfoDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SiteInfoDeleteResponse]], ResultWrapper[SiteInfoDeleteResponse]), ) @@ -549,7 +545,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RUMSite]: + ) -> Optional[Site]: """ Retrieves a Web Analytics site. @@ -577,14 +573,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Site]]._unwrapper, ), - cast_to=cast(Type[Optional[RUMSite]], ResultWrapper[RUMSite]), + cast_to=cast(Type[Optional[Site]], ResultWrapper[Site]), ) -class SiteInfoWithRawResponse: - def __init__(self, site_info: SiteInfo) -> None: +class SiteInfoResourceWithRawResponse: + def __init__(self, site_info: SiteInfoResource) -> None: self._site_info = site_info self.create = to_raw_response_wrapper( @@ -604,8 +600,8 @@ def __init__(self, site_info: SiteInfo) -> None: ) -class AsyncSiteInfoWithRawResponse: - def __init__(self, site_info: AsyncSiteInfo) -> None: +class AsyncSiteInfoResourceWithRawResponse: + def __init__(self, site_info: AsyncSiteInfoResource) -> None: self._site_info = site_info self.create = async_to_raw_response_wrapper( @@ -625,8 +621,8 @@ def __init__(self, site_info: AsyncSiteInfo) -> None: ) -class SiteInfoWithStreamingResponse: - def __init__(self, site_info: SiteInfo) -> None: +class SiteInfoResourceWithStreamingResponse: + def __init__(self, site_info: SiteInfoResource) -> None: self._site_info = site_info self.create = to_streamed_response_wrapper( @@ -646,8 +642,8 @@ def __init__(self, site_info: SiteInfo) -> None: ) -class AsyncSiteInfoWithStreamingResponse: - def __init__(self, site_info: AsyncSiteInfo) -> None: +class AsyncSiteInfoResourceWithStreamingResponse: + def __init__(self, site_info: AsyncSiteInfoResource) -> None: self._site_info = site_info self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/secondary_dns/__init__.py b/src/cloudflare/resources/secondary_dns/__init__.py index e1637cbb07d..3f502a9da2f 100644 --- a/src/cloudflare/resources/secondary_dns/__init__.py +++ b/src/cloudflare/resources/secondary_dns/__init__.py @@ -1,103 +1,103 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .acls import ( - ACLs, - AsyncACLs, - ACLsWithRawResponse, - AsyncACLsWithRawResponse, - ACLsWithStreamingResponse, - AsyncACLsWithStreamingResponse, + ACLsResource, + AsyncACLsResource, + ACLsResourceWithRawResponse, + AsyncACLsResourceWithRawResponse, + ACLsResourceWithStreamingResponse, + AsyncACLsResourceWithStreamingResponse, ) from .peers import ( - Peers, - AsyncPeers, - PeersWithRawResponse, - AsyncPeersWithRawResponse, - PeersWithStreamingResponse, - AsyncPeersWithStreamingResponse, + PeersResource, + AsyncPeersResource, + PeersResourceWithRawResponse, + AsyncPeersResourceWithRawResponse, + PeersResourceWithStreamingResponse, + AsyncPeersResourceWithStreamingResponse, ) from .tsigs import ( - TSIGs, - AsyncTSIGs, - TSIGsWithRawResponse, - AsyncTSIGsWithRawResponse, - TSIGsWithStreamingResponse, - AsyncTSIGsWithStreamingResponse, + TSIGsResource, + AsyncTSIGsResource, + TSIGsResourceWithRawResponse, + AsyncTSIGsResourceWithRawResponse, + TSIGsResourceWithStreamingResponse, + AsyncTSIGsResourceWithStreamingResponse, ) from .incoming import ( - Incoming, - AsyncIncoming, - IncomingWithRawResponse, - AsyncIncomingWithRawResponse, - IncomingWithStreamingResponse, - AsyncIncomingWithStreamingResponse, + IncomingResource, + AsyncIncomingResource, + IncomingResourceWithRawResponse, + AsyncIncomingResourceWithRawResponse, + IncomingResourceWithStreamingResponse, + AsyncIncomingResourceWithStreamingResponse, ) from .outgoing import ( - Outgoing, - AsyncOutgoing, - OutgoingWithRawResponse, - AsyncOutgoingWithRawResponse, - OutgoingWithStreamingResponse, - AsyncOutgoingWithStreamingResponse, + OutgoingResource, + AsyncOutgoingResource, + OutgoingResourceWithRawResponse, + AsyncOutgoingResourceWithRawResponse, + OutgoingResourceWithStreamingResponse, + AsyncOutgoingResourceWithStreamingResponse, ) from .force_axfr import ( - ForceAXFR, - AsyncForceAXFR, - ForceAXFRWithRawResponse, - AsyncForceAXFRWithRawResponse, - ForceAXFRWithStreamingResponse, - AsyncForceAXFRWithStreamingResponse, + ForceAXFRResource, + AsyncForceAXFRResource, + ForceAXFRResourceWithRawResponse, + AsyncForceAXFRResourceWithRawResponse, + ForceAXFRResourceWithStreamingResponse, + AsyncForceAXFRResourceWithStreamingResponse, ) from .secondary_dns import ( - SecondaryDNS, - AsyncSecondaryDNS, - SecondaryDNSWithRawResponse, - AsyncSecondaryDNSWithRawResponse, - SecondaryDNSWithStreamingResponse, - AsyncSecondaryDNSWithStreamingResponse, + SecondaryDNSResource, + AsyncSecondaryDNSResource, + SecondaryDNSResourceWithRawResponse, + AsyncSecondaryDNSResourceWithRawResponse, + SecondaryDNSResourceWithStreamingResponse, + AsyncSecondaryDNSResourceWithStreamingResponse, ) __all__ = [ - "ForceAXFR", - "AsyncForceAXFR", - "ForceAXFRWithRawResponse", - "AsyncForceAXFRWithRawResponse", - "ForceAXFRWithStreamingResponse", - "AsyncForceAXFRWithStreamingResponse", - "Incoming", - "AsyncIncoming", - "IncomingWithRawResponse", - "AsyncIncomingWithRawResponse", - "IncomingWithStreamingResponse", - "AsyncIncomingWithStreamingResponse", - "Outgoing", - "AsyncOutgoing", - "OutgoingWithRawResponse", - "AsyncOutgoingWithRawResponse", - "OutgoingWithStreamingResponse", - "AsyncOutgoingWithStreamingResponse", - "ACLs", - "AsyncACLs", - "ACLsWithRawResponse", - "AsyncACLsWithRawResponse", - "ACLsWithStreamingResponse", - "AsyncACLsWithStreamingResponse", - "Peers", - "AsyncPeers", - "PeersWithRawResponse", - "AsyncPeersWithRawResponse", - "PeersWithStreamingResponse", - "AsyncPeersWithStreamingResponse", - "TSIGs", - "AsyncTSIGs", - "TSIGsWithRawResponse", - "AsyncTSIGsWithRawResponse", - "TSIGsWithStreamingResponse", - "AsyncTSIGsWithStreamingResponse", - "SecondaryDNS", - "AsyncSecondaryDNS", - "SecondaryDNSWithRawResponse", - "AsyncSecondaryDNSWithRawResponse", - "SecondaryDNSWithStreamingResponse", - "AsyncSecondaryDNSWithStreamingResponse", + "ForceAXFRResource", + "AsyncForceAXFRResource", + "ForceAXFRResourceWithRawResponse", + "AsyncForceAXFRResourceWithRawResponse", + "ForceAXFRResourceWithStreamingResponse", + "AsyncForceAXFRResourceWithStreamingResponse", + "IncomingResource", + "AsyncIncomingResource", + "IncomingResourceWithRawResponse", + "AsyncIncomingResourceWithRawResponse", + "IncomingResourceWithStreamingResponse", + "AsyncIncomingResourceWithStreamingResponse", + "OutgoingResource", + "AsyncOutgoingResource", + "OutgoingResourceWithRawResponse", + "AsyncOutgoingResourceWithRawResponse", + "OutgoingResourceWithStreamingResponse", + "AsyncOutgoingResourceWithStreamingResponse", + "ACLsResource", + "AsyncACLsResource", + "ACLsResourceWithRawResponse", + "AsyncACLsResourceWithRawResponse", + "ACLsResourceWithStreamingResponse", + "AsyncACLsResourceWithStreamingResponse", + "PeersResource", + "AsyncPeersResource", + "PeersResourceWithRawResponse", + "AsyncPeersResourceWithRawResponse", + "PeersResourceWithStreamingResponse", + "AsyncPeersResourceWithStreamingResponse", + "TSIGsResource", + "AsyncTSIGsResource", + "TSIGsResourceWithRawResponse", + "AsyncTSIGsResourceWithRawResponse", + "TSIGsResourceWithStreamingResponse", + "AsyncTSIGsResourceWithStreamingResponse", + "SecondaryDNSResource", + "AsyncSecondaryDNSResource", + "SecondaryDNSResourceWithRawResponse", + "AsyncSecondaryDNSResourceWithRawResponse", + "SecondaryDNSResourceWithStreamingResponse", + "AsyncSecondaryDNSResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/secondary_dns/acls.py b/src/cloudflare/resources/secondary_dns/acls.py index 66ece684370..8041320f105 100644 --- a/src/cloudflare/resources/secondary_dns/acls.py +++ b/src/cloudflare/resources/secondary_dns/acls.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,21 @@ AsyncPaginator, make_request_options, ) -from ...types.secondary_dns import SecondaryDNSACL, ACLDeleteResponse, acl_create_params, acl_update_params +from ...types.secondary_dns import acl_create_params, acl_delete_params, acl_update_params +from ...types.secondary_dns.acl import ACL +from ...types.secondary_dns.acl_delete_response import ACLDeleteResponse -__all__ = ["ACLs", "AsyncACLs"] +__all__ = ["ACLsResource", "AsyncACLsResource"] -class ACLs(SyncAPIResource): +class ACLsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ACLsWithRawResponse: - return ACLsWithRawResponse(self) + def with_raw_response(self) -> ACLsResourceWithRawResponse: + return ACLsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ACLsWithStreamingResponse: - return ACLsWithStreamingResponse(self) + def with_streaming_response(self) -> ACLsResourceWithStreamingResponse: + return ACLsResourceWithStreamingResponse(self) def create( self, @@ -50,7 +52,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSACL: + ) -> Optional[ACL]: """ Create ACL. @@ -73,9 +75,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ACL]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSACL], ResultWrapper[SecondaryDNSACL]), + cast_to=cast(Type[Optional[ACL]], ResultWrapper[ACL]), ) def update( @@ -91,7 +93,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSACL: + ) -> Optional[ACL]: """ Modify ACL. @@ -130,9 +132,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ACL]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSACL], ResultWrapper[SecondaryDNSACL]), + cast_to=cast(Type[Optional[ACL]], ResultWrapper[ACL]), ) def list( @@ -145,7 +147,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[SecondaryDNSACL]: + ) -> SyncSinglePage[ACL]: """ List ACLs. @@ -162,11 +164,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/secondary_dns/acls", - page=SyncSinglePage[SecondaryDNSACL], + page=SyncSinglePage[ACL], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SecondaryDNSACL, + model=ACL, ) def delete( @@ -174,13 +176,14 @@ def delete( acl_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLDeleteResponse: + ) -> Optional[ACLDeleteResponse]: """ Delete ACL. @@ -199,14 +202,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `acl_id` but received {acl_id!r}") return self._delete( f"/accounts/{account_id}/secondary_dns/acls/{acl_id}", + body=maybe_transform(body, acl_delete_params.ACLDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ACLDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[ACLDeleteResponse], ResultWrapper[ACLDeleteResponse]), + cast_to=cast(Type[Optional[ACLDeleteResponse]], ResultWrapper[ACLDeleteResponse]), ) def get( @@ -220,7 +224,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSACL: + ) -> Optional[ACL]: """ Get ACL. @@ -244,20 +248,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ACL]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSACL], ResultWrapper[SecondaryDNSACL]), + cast_to=cast(Type[Optional[ACL]], ResultWrapper[ACL]), ) -class AsyncACLs(AsyncAPIResource): +class AsyncACLsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncACLsWithRawResponse: - return AsyncACLsWithRawResponse(self) + def with_raw_response(self) -> AsyncACLsResourceWithRawResponse: + return AsyncACLsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncACLsWithStreamingResponse: - return AsyncACLsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncACLsResourceWithStreamingResponse: + return AsyncACLsResourceWithStreamingResponse(self) async def create( self, @@ -270,7 +274,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSACL: + ) -> Optional[ACL]: """ Create ACL. @@ -293,9 +297,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ACL]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSACL], ResultWrapper[SecondaryDNSACL]), + cast_to=cast(Type[Optional[ACL]], ResultWrapper[ACL]), ) async def update( @@ -311,7 +315,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSACL: + ) -> Optional[ACL]: """ Modify ACL. @@ -350,9 +354,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ACL]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSACL], ResultWrapper[SecondaryDNSACL]), + cast_to=cast(Type[Optional[ACL]], ResultWrapper[ACL]), ) def list( @@ -365,7 +369,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[SecondaryDNSACL, AsyncSinglePage[SecondaryDNSACL]]: + ) -> AsyncPaginator[ACL, AsyncSinglePage[ACL]]: """ List ACLs. @@ -382,11 +386,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/secondary_dns/acls", - page=AsyncSinglePage[SecondaryDNSACL], + page=AsyncSinglePage[ACL], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SecondaryDNSACL, + model=ACL, ) async def delete( @@ -394,13 +398,14 @@ async def delete( acl_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLDeleteResponse: + ) -> Optional[ACLDeleteResponse]: """ Delete ACL. @@ -419,14 +424,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `acl_id` but received {acl_id!r}") return await self._delete( f"/accounts/{account_id}/secondary_dns/acls/{acl_id}", + body=await async_maybe_transform(body, acl_delete_params.ACLDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ACLDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[ACLDeleteResponse], ResultWrapper[ACLDeleteResponse]), + cast_to=cast(Type[Optional[ACLDeleteResponse]], ResultWrapper[ACLDeleteResponse]), ) async def get( @@ -440,7 +446,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSACL: + ) -> Optional[ACL]: """ Get ACL. @@ -464,14 +470,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ACL]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSACL], ResultWrapper[SecondaryDNSACL]), + cast_to=cast(Type[Optional[ACL]], ResultWrapper[ACL]), ) -class ACLsWithRawResponse: - def __init__(self, acls: ACLs) -> None: +class ACLsResourceWithRawResponse: + def __init__(self, acls: ACLsResource) -> None: self._acls = acls self.create = to_raw_response_wrapper( @@ -491,8 +497,8 @@ def __init__(self, acls: ACLs) -> None: ) -class AsyncACLsWithRawResponse: - def __init__(self, acls: AsyncACLs) -> None: +class AsyncACLsResourceWithRawResponse: + def __init__(self, acls: AsyncACLsResource) -> None: self._acls = acls self.create = async_to_raw_response_wrapper( @@ -512,8 +518,8 @@ def __init__(self, acls: AsyncACLs) -> None: ) -class ACLsWithStreamingResponse: - def __init__(self, acls: ACLs) -> None: +class ACLsResourceWithStreamingResponse: + def __init__(self, acls: ACLsResource) -> None: self._acls = acls self.create = to_streamed_response_wrapper( @@ -533,8 +539,8 @@ def __init__(self, acls: ACLs) -> None: ) -class AsyncACLsWithStreamingResponse: - def __init__(self, acls: AsyncACLs) -> None: +class AsyncACLsResourceWithStreamingResponse: + def __init__(self, acls: AsyncACLsResource) -> None: self._acls = acls self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/secondary_dns/force_axfr.py b/src/cloudflare/resources/secondary_dns/force_axfr.py index 82bfd9d194c..406f15e5108 100644 --- a/src/cloudflare/resources/secondary_dns/force_axfr.py +++ b/src/cloudflare/resources/secondary_dns/force_axfr.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing import Type, cast +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 ( @@ -19,23 +23,26 @@ from ..._base_client import ( make_request_options, ) +from ...types.secondary_dns import force_axfr_create_params +from ...types.secondary_dns.force_axfr import ForceAXFR -__all__ = ["ForceAXFR", "AsyncForceAXFR"] +__all__ = ["ForceAXFRResource", "AsyncForceAXFRResource"] -class ForceAXFR(SyncAPIResource): +class ForceAXFRResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ForceAXFRWithRawResponse: - return ForceAXFRWithRawResponse(self) + def with_raw_response(self) -> ForceAXFRResourceWithRawResponse: + return ForceAXFRResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ForceAXFRWithStreamingResponse: - return ForceAXFRWithStreamingResponse(self) + def with_streaming_response(self) -> ForceAXFRResourceWithStreamingResponse: + return ForceAXFRResourceWithStreamingResponse(self) def create( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,30 +66,32 @@ def create( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._post( f"/zones/{zone_id}/secondary_dns/force_axfr", + body=maybe_transform(body, force_axfr_create_params.ForceAXFRCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ForceAXFR]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) -class AsyncForceAXFR(AsyncAPIResource): +class AsyncForceAXFRResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncForceAXFRWithRawResponse: - return AsyncForceAXFRWithRawResponse(self) + def with_raw_response(self) -> AsyncForceAXFRResourceWithRawResponse: + return AsyncForceAXFRResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncForceAXFRWithStreamingResponse: - return AsyncForceAXFRWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncForceAXFRResourceWithStreamingResponse: + return AsyncForceAXFRResourceWithStreamingResponse(self) async def create( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -106,19 +115,20 @@ async def create( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._post( f"/zones/{zone_id}/secondary_dns/force_axfr", + body=await async_maybe_transform(body, force_axfr_create_params.ForceAXFRCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ForceAXFR]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) -class ForceAXFRWithRawResponse: - def __init__(self, force_axfr: ForceAXFR) -> None: +class ForceAXFRResourceWithRawResponse: + def __init__(self, force_axfr: ForceAXFRResource) -> None: self._force_axfr = force_axfr self.create = to_raw_response_wrapper( @@ -126,8 +136,8 @@ def __init__(self, force_axfr: ForceAXFR) -> None: ) -class AsyncForceAXFRWithRawResponse: - def __init__(self, force_axfr: AsyncForceAXFR) -> None: +class AsyncForceAXFRResourceWithRawResponse: + def __init__(self, force_axfr: AsyncForceAXFRResource) -> None: self._force_axfr = force_axfr self.create = async_to_raw_response_wrapper( @@ -135,8 +145,8 @@ def __init__(self, force_axfr: AsyncForceAXFR) -> None: ) -class ForceAXFRWithStreamingResponse: - def __init__(self, force_axfr: ForceAXFR) -> None: +class ForceAXFRResourceWithStreamingResponse: + def __init__(self, force_axfr: ForceAXFRResource) -> None: self._force_axfr = force_axfr self.create = to_streamed_response_wrapper( @@ -144,8 +154,8 @@ def __init__(self, force_axfr: ForceAXFR) -> None: ) -class AsyncForceAXFRWithStreamingResponse: - def __init__(self, force_axfr: AsyncForceAXFR) -> None: +class AsyncForceAXFRResourceWithStreamingResponse: + def __init__(self, force_axfr: AsyncForceAXFRResource) -> None: self._force_axfr = force_axfr self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/secondary_dns/incoming.py b/src/cloudflare/resources/secondary_dns/incoming.py index e3a18e2adaf..6d5bc100692 100644 --- a/src/cloudflare/resources/secondary_dns/incoming.py +++ b/src/cloudflare/resources/secondary_dns/incoming.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast import httpx @@ -23,26 +23,23 @@ from ..._base_client import ( make_request_options, ) -from ...types.secondary_dns import ( - IncomingGetResponse, - IncomingCreateResponse, - IncomingDeleteResponse, - IncomingUpdateResponse, - incoming_create_params, - incoming_update_params, -) +from ...types.secondary_dns import incoming_create_params, incoming_delete_params, incoming_update_params +from ...types.secondary_dns.incoming_get_response import IncomingGetResponse +from ...types.secondary_dns.incoming_create_response import IncomingCreateResponse +from ...types.secondary_dns.incoming_delete_response import IncomingDeleteResponse +from ...types.secondary_dns.incoming_update_response import IncomingUpdateResponse -__all__ = ["Incoming", "AsyncIncoming"] +__all__ = ["IncomingResource", "AsyncIncomingResource"] -class Incoming(SyncAPIResource): +class IncomingResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IncomingWithRawResponse: - return IncomingWithRawResponse(self) + def with_raw_response(self) -> IncomingResourceWithRawResponse: + return IncomingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IncomingWithStreamingResponse: - return IncomingWithStreamingResponse(self) + def with_streaming_response(self) -> IncomingResourceWithStreamingResponse: + return IncomingResourceWithStreamingResponse(self) def create( self, @@ -57,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IncomingCreateResponse: + ) -> Optional[IncomingCreateResponse]: """ Create secondary zone configuration for incoming zone transfers. @@ -94,9 +91,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncomingCreateResponse]]._unwrapper, ), - cast_to=cast(Type[IncomingCreateResponse], ResultWrapper[IncomingCreateResponse]), + cast_to=cast(Type[Optional[IncomingCreateResponse]], ResultWrapper[IncomingCreateResponse]), ) def update( @@ -112,7 +109,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IncomingUpdateResponse: + ) -> Optional[IncomingUpdateResponse]: """ Update secondary zone configuration for incoming zone transfers. @@ -149,22 +146,23 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncomingUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[IncomingUpdateResponse], ResultWrapper[IncomingUpdateResponse]), + cast_to=cast(Type[Optional[IncomingUpdateResponse]], ResultWrapper[IncomingUpdateResponse]), ) def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> IncomingDeleteResponse: + ) -> Optional[IncomingDeleteResponse]: """ Delete secondary zone configuration for incoming zone transfers. @@ -181,14 +179,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._delete( f"/zones/{zone_id}/secondary_dns/incoming", + body=maybe_transform(body, incoming_delete_params.IncomingDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncomingDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[IncomingDeleteResponse], ResultWrapper[IncomingDeleteResponse]), + cast_to=cast(Type[Optional[IncomingDeleteResponse]], ResultWrapper[IncomingDeleteResponse]), ) def get( @@ -201,7 +200,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IncomingGetResponse: + ) -> Optional[IncomingGetResponse]: """ Get secondary zone configuration for incoming zone transfers. @@ -223,20 +222,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncomingGetResponse]]._unwrapper, ), - cast_to=cast(Type[IncomingGetResponse], ResultWrapper[IncomingGetResponse]), + cast_to=cast(Type[Optional[IncomingGetResponse]], ResultWrapper[IncomingGetResponse]), ) -class AsyncIncoming(AsyncAPIResource): +class AsyncIncomingResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIncomingWithRawResponse: - return AsyncIncomingWithRawResponse(self) + def with_raw_response(self) -> AsyncIncomingResourceWithRawResponse: + return AsyncIncomingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIncomingWithStreamingResponse: - return AsyncIncomingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIncomingResourceWithStreamingResponse: + return AsyncIncomingResourceWithStreamingResponse(self) async def create( self, @@ -251,7 +250,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IncomingCreateResponse: + ) -> Optional[IncomingCreateResponse]: """ Create secondary zone configuration for incoming zone transfers. @@ -288,9 +287,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncomingCreateResponse]]._unwrapper, ), - cast_to=cast(Type[IncomingCreateResponse], ResultWrapper[IncomingCreateResponse]), + cast_to=cast(Type[Optional[IncomingCreateResponse]], ResultWrapper[IncomingCreateResponse]), ) async def update( @@ -306,7 +305,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IncomingUpdateResponse: + ) -> Optional[IncomingUpdateResponse]: """ Update secondary zone configuration for incoming zone transfers. @@ -343,22 +342,23 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncomingUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[IncomingUpdateResponse], ResultWrapper[IncomingUpdateResponse]), + cast_to=cast(Type[Optional[IncomingUpdateResponse]], ResultWrapper[IncomingUpdateResponse]), ) async def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> IncomingDeleteResponse: + ) -> Optional[IncomingDeleteResponse]: """ Delete secondary zone configuration for incoming zone transfers. @@ -375,14 +375,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._delete( f"/zones/{zone_id}/secondary_dns/incoming", + body=await async_maybe_transform(body, incoming_delete_params.IncomingDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncomingDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[IncomingDeleteResponse], ResultWrapper[IncomingDeleteResponse]), + cast_to=cast(Type[Optional[IncomingDeleteResponse]], ResultWrapper[IncomingDeleteResponse]), ) async def get( @@ -395,7 +396,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IncomingGetResponse: + ) -> Optional[IncomingGetResponse]: """ Get secondary zone configuration for incoming zone transfers. @@ -417,14 +418,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncomingGetResponse]]._unwrapper, ), - cast_to=cast(Type[IncomingGetResponse], ResultWrapper[IncomingGetResponse]), + cast_to=cast(Type[Optional[IncomingGetResponse]], ResultWrapper[IncomingGetResponse]), ) -class IncomingWithRawResponse: - def __init__(self, incoming: Incoming) -> None: +class IncomingResourceWithRawResponse: + def __init__(self, incoming: IncomingResource) -> None: self._incoming = incoming self.create = to_raw_response_wrapper( @@ -441,8 +442,8 @@ def __init__(self, incoming: Incoming) -> None: ) -class AsyncIncomingWithRawResponse: - def __init__(self, incoming: AsyncIncoming) -> None: +class AsyncIncomingResourceWithRawResponse: + def __init__(self, incoming: AsyncIncomingResource) -> None: self._incoming = incoming self.create = async_to_raw_response_wrapper( @@ -459,8 +460,8 @@ def __init__(self, incoming: AsyncIncoming) -> None: ) -class IncomingWithStreamingResponse: - def __init__(self, incoming: Incoming) -> None: +class IncomingResourceWithStreamingResponse: + def __init__(self, incoming: IncomingResource) -> None: self._incoming = incoming self.create = to_streamed_response_wrapper( @@ -477,8 +478,8 @@ def __init__(self, incoming: Incoming) -> None: ) -class AsyncIncomingWithStreamingResponse: - def __init__(self, incoming: AsyncIncoming) -> None: +class AsyncIncomingResourceWithStreamingResponse: + def __init__(self, incoming: AsyncIncomingResource) -> None: self._incoming = incoming self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/secondary_dns/outgoing/__init__.py b/src/cloudflare/resources/secondary_dns/outgoing/__init__.py index d54d2164137..29fd61f59d2 100644 --- a/src/cloudflare/resources/secondary_dns/outgoing/__init__.py +++ b/src/cloudflare/resources/secondary_dns/outgoing/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .status import ( - Status, - AsyncStatus, - StatusWithRawResponse, - AsyncStatusWithRawResponse, - StatusWithStreamingResponse, - AsyncStatusWithStreamingResponse, + StatusResource, + AsyncStatusResource, + StatusResourceWithRawResponse, + AsyncStatusResourceWithRawResponse, + StatusResourceWithStreamingResponse, + AsyncStatusResourceWithStreamingResponse, ) from .outgoing import ( - Outgoing, - AsyncOutgoing, - OutgoingWithRawResponse, - AsyncOutgoingWithRawResponse, - OutgoingWithStreamingResponse, - AsyncOutgoingWithStreamingResponse, + OutgoingResource, + AsyncOutgoingResource, + OutgoingResourceWithRawResponse, + AsyncOutgoingResourceWithRawResponse, + OutgoingResourceWithStreamingResponse, + AsyncOutgoingResourceWithStreamingResponse, ) __all__ = [ - "Status", - "AsyncStatus", - "StatusWithRawResponse", - "AsyncStatusWithRawResponse", - "StatusWithStreamingResponse", - "AsyncStatusWithStreamingResponse", - "Outgoing", - "AsyncOutgoing", - "OutgoingWithRawResponse", - "AsyncOutgoingWithRawResponse", - "OutgoingWithStreamingResponse", - "AsyncOutgoingWithStreamingResponse", + "StatusResource", + "AsyncStatusResource", + "StatusResourceWithRawResponse", + "AsyncStatusResourceWithRawResponse", + "StatusResourceWithStreamingResponse", + "AsyncStatusResourceWithStreamingResponse", + "OutgoingResource", + "AsyncOutgoingResource", + "OutgoingResourceWithRawResponse", + "AsyncOutgoingResourceWithRawResponse", + "OutgoingResourceWithStreamingResponse", + "AsyncOutgoingResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/secondary_dns/outgoing/outgoing.py b/src/cloudflare/resources/secondary_dns/outgoing/outgoing.py index d0915289719..d330c9bd0e0 100644 --- a/src/cloudflare/resources/secondary_dns/outgoing/outgoing.py +++ b/src/cloudflare/resources/secondary_dns/outgoing/outgoing.py @@ -2,17 +2,17 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast import httpx from .status import ( - Status, - AsyncStatus, - StatusWithRawResponse, - AsyncStatusWithRawResponse, - StatusWithStreamingResponse, - AsyncStatusWithStreamingResponse, + StatusResource, + AsyncStatusResource, + StatusResourceWithRawResponse, + AsyncStatusResourceWithRawResponse, + StatusResourceWithStreamingResponse, + AsyncStatusResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -32,29 +32,36 @@ make_request_options, ) from ....types.secondary_dns import ( - OutgoingGetResponse, - OutgoingCreateResponse, - OutgoingDeleteResponse, - OutgoingUpdateResponse, outgoing_create_params, + outgoing_delete_params, + outgoing_enable_params, outgoing_update_params, + outgoing_disable_params, + outgoing_force_notify_params, ) +from ....types.secondary_dns.enable_transfer import EnableTransfer +from ....types.secondary_dns.disable_transfer import DisableTransfer +from ....types.secondary_dns.outgoing_get_response import OutgoingGetResponse +from ....types.secondary_dns.outgoing_create_response import OutgoingCreateResponse +from ....types.secondary_dns.outgoing_delete_response import OutgoingDeleteResponse +from ....types.secondary_dns.outgoing_update_response import OutgoingUpdateResponse +from ....types.secondary_dns.outgoing_force_notify_response import OutgoingForceNotifyResponse -__all__ = ["Outgoing", "AsyncOutgoing"] +__all__ = ["OutgoingResource", "AsyncOutgoingResource"] -class Outgoing(SyncAPIResource): +class OutgoingResource(SyncAPIResource): @cached_property - def status(self) -> Status: - return Status(self._client) + def status(self) -> StatusResource: + return StatusResource(self._client) @cached_property - def with_raw_response(self) -> OutgoingWithRawResponse: - return OutgoingWithRawResponse(self) + def with_raw_response(self) -> OutgoingResourceWithRawResponse: + return OutgoingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OutgoingWithStreamingResponse: - return OutgoingWithStreamingResponse(self) + def with_streaming_response(self) -> OutgoingResourceWithStreamingResponse: + return OutgoingResourceWithStreamingResponse(self) def create( self, @@ -68,7 +75,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OutgoingCreateResponse: + ) -> Optional[OutgoingCreateResponse]: """ Create primary zone configuration for outgoing zone transfers. @@ -101,9 +108,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingCreateResponse]]._unwrapper, ), - cast_to=cast(Type[OutgoingCreateResponse], ResultWrapper[OutgoingCreateResponse]), + cast_to=cast(Type[Optional[OutgoingCreateResponse]], ResultWrapper[OutgoingCreateResponse]), ) def update( @@ -118,7 +125,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OutgoingUpdateResponse: + ) -> Optional[OutgoingUpdateResponse]: """ Update primary zone configuration for outgoing zone transfers. @@ -151,22 +158,23 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[OutgoingUpdateResponse], ResultWrapper[OutgoingUpdateResponse]), + cast_to=cast(Type[Optional[OutgoingUpdateResponse]], ResultWrapper[OutgoingUpdateResponse]), ) def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> OutgoingDeleteResponse: + ) -> Optional[OutgoingDeleteResponse]: """ Delete primary zone configuration for outgoing zone transfers. @@ -183,20 +191,22 @@ def delete( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._delete( f"/zones/{zone_id}/secondary_dns/outgoing", + body=maybe_transform(body, outgoing_delete_params.OutgoingDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[OutgoingDeleteResponse], ResultWrapper[OutgoingDeleteResponse]), + cast_to=cast(Type[Optional[OutgoingDeleteResponse]], ResultWrapper[OutgoingDeleteResponse]), ) def disable( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -221,12 +231,13 @@ def disable( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._post( f"/zones/{zone_id}/secondary_dns/outgoing/disable", + body=maybe_transform(body, outgoing_disable_params.OutgoingDisableParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DisableTransfer]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -235,6 +246,7 @@ def enable( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -258,12 +270,13 @@ def enable( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._post( f"/zones/{zone_id}/secondary_dns/outgoing/enable", + body=maybe_transform(body, outgoing_enable_params.OutgoingEnableParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EnableTransfer]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -272,6 +285,7 @@ def force_notify( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -295,12 +309,13 @@ def force_notify( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._post( f"/zones/{zone_id}/secondary_dns/outgoing/force_notify", + body=maybe_transform(body, outgoing_force_notify_params.OutgoingForceNotifyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingForceNotifyResponse]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -315,7 +330,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OutgoingGetResponse: + ) -> Optional[OutgoingGetResponse]: """ Get primary zone configuration for outgoing zone transfers. @@ -337,24 +352,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingGetResponse]]._unwrapper, ), - cast_to=cast(Type[OutgoingGetResponse], ResultWrapper[OutgoingGetResponse]), + cast_to=cast(Type[Optional[OutgoingGetResponse]], ResultWrapper[OutgoingGetResponse]), ) -class AsyncOutgoing(AsyncAPIResource): +class AsyncOutgoingResource(AsyncAPIResource): @cached_property - def status(self) -> AsyncStatus: - return AsyncStatus(self._client) + def status(self) -> AsyncStatusResource: + return AsyncStatusResource(self._client) @cached_property - def with_raw_response(self) -> AsyncOutgoingWithRawResponse: - return AsyncOutgoingWithRawResponse(self) + def with_raw_response(self) -> AsyncOutgoingResourceWithRawResponse: + return AsyncOutgoingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOutgoingWithStreamingResponse: - return AsyncOutgoingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOutgoingResourceWithStreamingResponse: + return AsyncOutgoingResourceWithStreamingResponse(self) async def create( self, @@ -368,7 +383,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OutgoingCreateResponse: + ) -> Optional[OutgoingCreateResponse]: """ Create primary zone configuration for outgoing zone transfers. @@ -401,9 +416,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingCreateResponse]]._unwrapper, ), - cast_to=cast(Type[OutgoingCreateResponse], ResultWrapper[OutgoingCreateResponse]), + cast_to=cast(Type[Optional[OutgoingCreateResponse]], ResultWrapper[OutgoingCreateResponse]), ) async def update( @@ -418,7 +433,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OutgoingUpdateResponse: + ) -> Optional[OutgoingUpdateResponse]: """ Update primary zone configuration for outgoing zone transfers. @@ -451,22 +466,23 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[OutgoingUpdateResponse], ResultWrapper[OutgoingUpdateResponse]), + cast_to=cast(Type[Optional[OutgoingUpdateResponse]], ResultWrapper[OutgoingUpdateResponse]), ) async def delete( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> OutgoingDeleteResponse: + ) -> Optional[OutgoingDeleteResponse]: """ Delete primary zone configuration for outgoing zone transfers. @@ -483,20 +499,22 @@ async def delete( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._delete( f"/zones/{zone_id}/secondary_dns/outgoing", + body=await async_maybe_transform(body, outgoing_delete_params.OutgoingDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[OutgoingDeleteResponse], ResultWrapper[OutgoingDeleteResponse]), + cast_to=cast(Type[Optional[OutgoingDeleteResponse]], ResultWrapper[OutgoingDeleteResponse]), ) async def disable( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -521,12 +539,13 @@ async def disable( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._post( f"/zones/{zone_id}/secondary_dns/outgoing/disable", + body=await async_maybe_transform(body, outgoing_disable_params.OutgoingDisableParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DisableTransfer]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -535,6 +554,7 @@ async def enable( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -558,12 +578,13 @@ async def enable( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._post( f"/zones/{zone_id}/secondary_dns/outgoing/enable", + body=await async_maybe_transform(body, outgoing_enable_params.OutgoingEnableParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EnableTransfer]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -572,6 +593,7 @@ async def force_notify( self, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -595,12 +617,13 @@ async def force_notify( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._post( f"/zones/{zone_id}/secondary_dns/outgoing/force_notify", + body=await async_maybe_transform(body, outgoing_force_notify_params.OutgoingForceNotifyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingForceNotifyResponse]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -615,7 +638,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OutgoingGetResponse: + ) -> Optional[OutgoingGetResponse]: """ Get primary zone configuration for outgoing zone transfers. @@ -637,14 +660,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OutgoingGetResponse]]._unwrapper, ), - cast_to=cast(Type[OutgoingGetResponse], ResultWrapper[OutgoingGetResponse]), + cast_to=cast(Type[Optional[OutgoingGetResponse]], ResultWrapper[OutgoingGetResponse]), ) -class OutgoingWithRawResponse: - def __init__(self, outgoing: Outgoing) -> None: +class OutgoingResourceWithRawResponse: + def __init__(self, outgoing: OutgoingResource) -> None: self._outgoing = outgoing self.create = to_raw_response_wrapper( @@ -670,12 +693,12 @@ def __init__(self, outgoing: Outgoing) -> None: ) @cached_property - def status(self) -> StatusWithRawResponse: - return StatusWithRawResponse(self._outgoing.status) + def status(self) -> StatusResourceWithRawResponse: + return StatusResourceWithRawResponse(self._outgoing.status) -class AsyncOutgoingWithRawResponse: - def __init__(self, outgoing: AsyncOutgoing) -> None: +class AsyncOutgoingResourceWithRawResponse: + def __init__(self, outgoing: AsyncOutgoingResource) -> None: self._outgoing = outgoing self.create = async_to_raw_response_wrapper( @@ -701,12 +724,12 @@ def __init__(self, outgoing: AsyncOutgoing) -> None: ) @cached_property - def status(self) -> AsyncStatusWithRawResponse: - return AsyncStatusWithRawResponse(self._outgoing.status) + def status(self) -> AsyncStatusResourceWithRawResponse: + return AsyncStatusResourceWithRawResponse(self._outgoing.status) -class OutgoingWithStreamingResponse: - def __init__(self, outgoing: Outgoing) -> None: +class OutgoingResourceWithStreamingResponse: + def __init__(self, outgoing: OutgoingResource) -> None: self._outgoing = outgoing self.create = to_streamed_response_wrapper( @@ -732,12 +755,12 @@ def __init__(self, outgoing: Outgoing) -> None: ) @cached_property - def status(self) -> StatusWithStreamingResponse: - return StatusWithStreamingResponse(self._outgoing.status) + def status(self) -> StatusResourceWithStreamingResponse: + return StatusResourceWithStreamingResponse(self._outgoing.status) -class AsyncOutgoingWithStreamingResponse: - def __init__(self, outgoing: AsyncOutgoing) -> None: +class AsyncOutgoingResourceWithStreamingResponse: + def __init__(self, outgoing: AsyncOutgoingResource) -> None: self._outgoing = outgoing self.create = async_to_streamed_response_wrapper( @@ -763,5 +786,5 @@ def __init__(self, outgoing: AsyncOutgoing) -> None: ) @cached_property - def status(self) -> AsyncStatusWithStreamingResponse: - return AsyncStatusWithStreamingResponse(self._outgoing.status) + def status(self) -> AsyncStatusResourceWithStreamingResponse: + return AsyncStatusResourceWithStreamingResponse(self._outgoing.status) diff --git a/src/cloudflare/resources/secondary_dns/outgoing/status.py b/src/cloudflare/resources/secondary_dns/outgoing/status.py index 1781141bfa3..6a99e783349 100644 --- a/src/cloudflare/resources/secondary_dns/outgoing/status.py +++ b/src/cloudflare/resources/secondary_dns/outgoing/status.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -19,18 +19,19 @@ from ...._base_client import ( make_request_options, ) +from ....types.secondary_dns.enable_transfer import EnableTransfer -__all__ = ["Status", "AsyncStatus"] +__all__ = ["StatusResource", "AsyncStatusResource"] -class Status(SyncAPIResource): +class StatusResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> StatusWithRawResponse: - return StatusWithRawResponse(self) + def with_raw_response(self) -> StatusResourceWithRawResponse: + return StatusResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> StatusWithStreamingResponse: - return StatusWithStreamingResponse(self) + def with_streaming_response(self) -> StatusResourceWithStreamingResponse: + return StatusResourceWithStreamingResponse(self) def get( self, @@ -64,20 +65,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EnableTransfer]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) -class AsyncStatus(AsyncAPIResource): +class AsyncStatusResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncStatusWithRawResponse: - return AsyncStatusWithRawResponse(self) + def with_raw_response(self) -> AsyncStatusResourceWithRawResponse: + return AsyncStatusResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncStatusWithStreamingResponse: - return AsyncStatusWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncStatusResourceWithStreamingResponse: + return AsyncStatusResourceWithStreamingResponse(self) async def get( self, @@ -111,14 +112,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EnableTransfer]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) -class StatusWithRawResponse: - def __init__(self, status: Status) -> None: +class StatusResourceWithRawResponse: + def __init__(self, status: StatusResource) -> None: self._status = status self.get = to_raw_response_wrapper( @@ -126,8 +127,8 @@ def __init__(self, status: Status) -> None: ) -class AsyncStatusWithRawResponse: - def __init__(self, status: AsyncStatus) -> None: +class AsyncStatusResourceWithRawResponse: + def __init__(self, status: AsyncStatusResource) -> None: self._status = status self.get = async_to_raw_response_wrapper( @@ -135,8 +136,8 @@ def __init__(self, status: AsyncStatus) -> None: ) -class StatusWithStreamingResponse: - def __init__(self, status: Status) -> None: +class StatusResourceWithStreamingResponse: + def __init__(self, status: StatusResource) -> None: self._status = status self.get = to_streamed_response_wrapper( @@ -144,8 +145,8 @@ def __init__(self, status: Status) -> None: ) -class AsyncStatusWithStreamingResponse: - def __init__(self, status: AsyncStatus) -> None: +class AsyncStatusResourceWithStreamingResponse: + def __init__(self, status: AsyncStatusResource) -> None: self._status = status self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/secondary_dns/peers.py b/src/cloudflare/resources/secondary_dns/peers.py index 662e94d3bb6..7e1d1344036 100644 --- a/src/cloudflare/resources/secondary_dns/peers.py +++ b/src/cloudflare/resources/secondary_dns/peers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,21 @@ AsyncPaginator, make_request_options, ) -from ...types.secondary_dns import SecondaryDNSPeer, PeerDeleteResponse, peer_create_params, peer_update_params +from ...types.secondary_dns import peer_create_params, peer_delete_params, peer_update_params +from ...types.secondary_dns.peer import Peer +from ...types.secondary_dns.peer_delete_response import PeerDeleteResponse -__all__ = ["Peers", "AsyncPeers"] +__all__ = ["PeersResource", "AsyncPeersResource"] -class Peers(SyncAPIResource): +class PeersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PeersWithRawResponse: - return PeersWithRawResponse(self) + def with_raw_response(self) -> PeersResourceWithRawResponse: + return PeersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PeersWithStreamingResponse: - return PeersWithStreamingResponse(self) + def with_streaming_response(self) -> PeersResourceWithStreamingResponse: + return PeersResourceWithStreamingResponse(self) def create( self, @@ -50,7 +52,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSPeer: + ) -> Optional[Peer]: """ Create Peer. @@ -73,9 +75,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Peer]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSPeer], ResultWrapper[SecondaryDNSPeer]), + cast_to=cast(Type[Optional[Peer]], ResultWrapper[Peer]), ) def update( @@ -94,7 +96,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSPeer: + ) -> Optional[Peer]: """ Modify Peer. @@ -144,9 +146,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Peer]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSPeer], ResultWrapper[SecondaryDNSPeer]), + cast_to=cast(Type[Optional[Peer]], ResultWrapper[Peer]), ) def list( @@ -159,7 +161,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[SecondaryDNSPeer]: + ) -> SyncSinglePage[Peer]: """ List Peers. @@ -176,11 +178,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/secondary_dns/peers", - page=SyncSinglePage[SecondaryDNSPeer], + page=SyncSinglePage[Peer], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SecondaryDNSPeer, + model=Peer, ) def delete( @@ -188,13 +190,14 @@ def delete( peer_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> PeerDeleteResponse: + ) -> Optional[PeerDeleteResponse]: """ Delete Peer. @@ -213,14 +216,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `peer_id` but received {peer_id!r}") return self._delete( f"/accounts/{account_id}/secondary_dns/peers/{peer_id}", + body=maybe_transform(body, peer_delete_params.PeerDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PeerDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[PeerDeleteResponse], ResultWrapper[PeerDeleteResponse]), + cast_to=cast(Type[Optional[PeerDeleteResponse]], ResultWrapper[PeerDeleteResponse]), ) def get( @@ -234,7 +238,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSPeer: + ) -> Optional[Peer]: """ Get Peer. @@ -258,20 +262,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Peer]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSPeer], ResultWrapper[SecondaryDNSPeer]), + cast_to=cast(Type[Optional[Peer]], ResultWrapper[Peer]), ) -class AsyncPeers(AsyncAPIResource): +class AsyncPeersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPeersWithRawResponse: - return AsyncPeersWithRawResponse(self) + def with_raw_response(self) -> AsyncPeersResourceWithRawResponse: + return AsyncPeersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPeersWithStreamingResponse: - return AsyncPeersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPeersResourceWithStreamingResponse: + return AsyncPeersResourceWithStreamingResponse(self) async def create( self, @@ -284,7 +288,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSPeer: + ) -> Optional[Peer]: """ Create Peer. @@ -307,9 +311,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Peer]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSPeer], ResultWrapper[SecondaryDNSPeer]), + cast_to=cast(Type[Optional[Peer]], ResultWrapper[Peer]), ) async def update( @@ -328,7 +332,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSPeer: + ) -> Optional[Peer]: """ Modify Peer. @@ -378,9 +382,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Peer]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSPeer], ResultWrapper[SecondaryDNSPeer]), + cast_to=cast(Type[Optional[Peer]], ResultWrapper[Peer]), ) def list( @@ -393,7 +397,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[SecondaryDNSPeer, AsyncSinglePage[SecondaryDNSPeer]]: + ) -> AsyncPaginator[Peer, AsyncSinglePage[Peer]]: """ List Peers. @@ -410,11 +414,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/secondary_dns/peers", - page=AsyncSinglePage[SecondaryDNSPeer], + page=AsyncSinglePage[Peer], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SecondaryDNSPeer, + model=Peer, ) async def delete( @@ -422,13 +426,14 @@ async def delete( peer_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> PeerDeleteResponse: + ) -> Optional[PeerDeleteResponse]: """ Delete Peer. @@ -447,14 +452,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `peer_id` but received {peer_id!r}") return await self._delete( f"/accounts/{account_id}/secondary_dns/peers/{peer_id}", + body=await async_maybe_transform(body, peer_delete_params.PeerDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PeerDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[PeerDeleteResponse], ResultWrapper[PeerDeleteResponse]), + cast_to=cast(Type[Optional[PeerDeleteResponse]], ResultWrapper[PeerDeleteResponse]), ) async def get( @@ -468,7 +474,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSPeer: + ) -> Optional[Peer]: """ Get Peer. @@ -492,14 +498,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Peer]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSPeer], ResultWrapper[SecondaryDNSPeer]), + cast_to=cast(Type[Optional[Peer]], ResultWrapper[Peer]), ) -class PeersWithRawResponse: - def __init__(self, peers: Peers) -> None: +class PeersResourceWithRawResponse: + def __init__(self, peers: PeersResource) -> None: self._peers = peers self.create = to_raw_response_wrapper( @@ -519,8 +525,8 @@ def __init__(self, peers: Peers) -> None: ) -class AsyncPeersWithRawResponse: - def __init__(self, peers: AsyncPeers) -> None: +class AsyncPeersResourceWithRawResponse: + def __init__(self, peers: AsyncPeersResource) -> None: self._peers = peers self.create = async_to_raw_response_wrapper( @@ -540,8 +546,8 @@ def __init__(self, peers: AsyncPeers) -> None: ) -class PeersWithStreamingResponse: - def __init__(self, peers: Peers) -> None: +class PeersResourceWithStreamingResponse: + def __init__(self, peers: PeersResource) -> None: self._peers = peers self.create = to_streamed_response_wrapper( @@ -561,8 +567,8 @@ def __init__(self, peers: Peers) -> None: ) -class AsyncPeersWithStreamingResponse: - def __init__(self, peers: AsyncPeers) -> None: +class AsyncPeersResourceWithStreamingResponse: + def __init__(self, peers: AsyncPeersResource) -> None: self._peers = peers self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/secondary_dns/secondary_dns.py b/src/cloudflare/resources/secondary_dns/secondary_dns.py index acbc1eef0d3..de66545fd83 100644 --- a/src/cloudflare/resources/secondary_dns/secondary_dns.py +++ b/src/cloudflare/resources/secondary_dns/secondary_dns.py @@ -3,239 +3,239 @@ from __future__ import annotations from .acls import ( - ACLs, - AsyncACLs, - ACLsWithRawResponse, - AsyncACLsWithRawResponse, - ACLsWithStreamingResponse, - AsyncACLsWithStreamingResponse, + ACLsResource, + AsyncACLsResource, + ACLsResourceWithRawResponse, + AsyncACLsResourceWithRawResponse, + ACLsResourceWithStreamingResponse, + AsyncACLsResourceWithStreamingResponse, ) from .peers import ( - Peers, - AsyncPeers, - PeersWithRawResponse, - AsyncPeersWithRawResponse, - PeersWithStreamingResponse, - AsyncPeersWithStreamingResponse, + PeersResource, + AsyncPeersResource, + PeersResourceWithRawResponse, + AsyncPeersResourceWithRawResponse, + PeersResourceWithStreamingResponse, + AsyncPeersResourceWithStreamingResponse, ) from .tsigs import ( - TSIGs, - AsyncTSIGs, - TSIGsWithRawResponse, - AsyncTSIGsWithRawResponse, - TSIGsWithStreamingResponse, - AsyncTSIGsWithStreamingResponse, + TSIGsResource, + AsyncTSIGsResource, + TSIGsResourceWithRawResponse, + AsyncTSIGsResourceWithRawResponse, + TSIGsResourceWithStreamingResponse, + AsyncTSIGsResourceWithStreamingResponse, ) from .incoming import ( - Incoming, - AsyncIncoming, - IncomingWithRawResponse, - AsyncIncomingWithRawResponse, - IncomingWithStreamingResponse, - AsyncIncomingWithStreamingResponse, + IncomingResource, + AsyncIncomingResource, + IncomingResourceWithRawResponse, + AsyncIncomingResourceWithRawResponse, + IncomingResourceWithStreamingResponse, + AsyncIncomingResourceWithStreamingResponse, ) from .outgoing import ( - Outgoing, - AsyncOutgoing, - OutgoingWithRawResponse, - AsyncOutgoingWithRawResponse, - OutgoingWithStreamingResponse, - AsyncOutgoingWithStreamingResponse, + OutgoingResource, + AsyncOutgoingResource, + OutgoingResourceWithRawResponse, + AsyncOutgoingResourceWithRawResponse, + OutgoingResourceWithStreamingResponse, + AsyncOutgoingResourceWithStreamingResponse, ) from ..._compat import cached_property from .force_axfr import ( - ForceAXFR, - AsyncForceAXFR, - ForceAXFRWithRawResponse, - AsyncForceAXFRWithRawResponse, - ForceAXFRWithStreamingResponse, - AsyncForceAXFRWithStreamingResponse, + ForceAXFRResource, + AsyncForceAXFRResource, + ForceAXFRResourceWithRawResponse, + AsyncForceAXFRResourceWithRawResponse, + ForceAXFRResourceWithStreamingResponse, + AsyncForceAXFRResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .outgoing.outgoing import Outgoing, AsyncOutgoing +from .outgoing.outgoing import OutgoingResource, AsyncOutgoingResource -__all__ = ["SecondaryDNS", "AsyncSecondaryDNS"] +__all__ = ["SecondaryDNSResource", "AsyncSecondaryDNSResource"] -class SecondaryDNS(SyncAPIResource): +class SecondaryDNSResource(SyncAPIResource): @cached_property - def force_axfr(self) -> ForceAXFR: - return ForceAXFR(self._client) + def force_axfr(self) -> ForceAXFRResource: + return ForceAXFRResource(self._client) @cached_property - def incoming(self) -> Incoming: - return Incoming(self._client) + def incoming(self) -> IncomingResource: + return IncomingResource(self._client) @cached_property - def outgoing(self) -> Outgoing: - return Outgoing(self._client) + def outgoing(self) -> OutgoingResource: + return OutgoingResource(self._client) @cached_property - def acls(self) -> ACLs: - return ACLs(self._client) + def acls(self) -> ACLsResource: + return ACLsResource(self._client) @cached_property - def peers(self) -> Peers: - return Peers(self._client) + def peers(self) -> PeersResource: + return PeersResource(self._client) @cached_property - def tsigs(self) -> TSIGs: - return TSIGs(self._client) + def tsigs(self) -> TSIGsResource: + return TSIGsResource(self._client) @cached_property - def with_raw_response(self) -> SecondaryDNSWithRawResponse: - return SecondaryDNSWithRawResponse(self) + def with_raw_response(self) -> SecondaryDNSResourceWithRawResponse: + return SecondaryDNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SecondaryDNSWithStreamingResponse: - return SecondaryDNSWithStreamingResponse(self) + def with_streaming_response(self) -> SecondaryDNSResourceWithStreamingResponse: + return SecondaryDNSResourceWithStreamingResponse(self) -class AsyncSecondaryDNS(AsyncAPIResource): +class AsyncSecondaryDNSResource(AsyncAPIResource): @cached_property - def force_axfr(self) -> AsyncForceAXFR: - return AsyncForceAXFR(self._client) + def force_axfr(self) -> AsyncForceAXFRResource: + return AsyncForceAXFRResource(self._client) @cached_property - def incoming(self) -> AsyncIncoming: - return AsyncIncoming(self._client) + def incoming(self) -> AsyncIncomingResource: + return AsyncIncomingResource(self._client) @cached_property - def outgoing(self) -> AsyncOutgoing: - return AsyncOutgoing(self._client) + def outgoing(self) -> AsyncOutgoingResource: + return AsyncOutgoingResource(self._client) @cached_property - def acls(self) -> AsyncACLs: - return AsyncACLs(self._client) + def acls(self) -> AsyncACLsResource: + return AsyncACLsResource(self._client) @cached_property - def peers(self) -> AsyncPeers: - return AsyncPeers(self._client) + def peers(self) -> AsyncPeersResource: + return AsyncPeersResource(self._client) @cached_property - def tsigs(self) -> AsyncTSIGs: - return AsyncTSIGs(self._client) + def tsigs(self) -> AsyncTSIGsResource: + return AsyncTSIGsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSecondaryDNSWithRawResponse: - return AsyncSecondaryDNSWithRawResponse(self) + def with_raw_response(self) -> AsyncSecondaryDNSResourceWithRawResponse: + return AsyncSecondaryDNSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSecondaryDNSWithStreamingResponse: - return AsyncSecondaryDNSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSecondaryDNSResourceWithStreamingResponse: + return AsyncSecondaryDNSResourceWithStreamingResponse(self) -class SecondaryDNSWithRawResponse: - def __init__(self, secondary_dns: SecondaryDNS) -> None: +class SecondaryDNSResourceWithRawResponse: + def __init__(self, secondary_dns: SecondaryDNSResource) -> None: self._secondary_dns = secondary_dns @cached_property - def force_axfr(self) -> ForceAXFRWithRawResponse: - return ForceAXFRWithRawResponse(self._secondary_dns.force_axfr) + def force_axfr(self) -> ForceAXFRResourceWithRawResponse: + return ForceAXFRResourceWithRawResponse(self._secondary_dns.force_axfr) @cached_property - def incoming(self) -> IncomingWithRawResponse: - return IncomingWithRawResponse(self._secondary_dns.incoming) + def incoming(self) -> IncomingResourceWithRawResponse: + return IncomingResourceWithRawResponse(self._secondary_dns.incoming) @cached_property - def outgoing(self) -> OutgoingWithRawResponse: - return OutgoingWithRawResponse(self._secondary_dns.outgoing) + def outgoing(self) -> OutgoingResourceWithRawResponse: + return OutgoingResourceWithRawResponse(self._secondary_dns.outgoing) @cached_property - def acls(self) -> ACLsWithRawResponse: - return ACLsWithRawResponse(self._secondary_dns.acls) + def acls(self) -> ACLsResourceWithRawResponse: + return ACLsResourceWithRawResponse(self._secondary_dns.acls) @cached_property - def peers(self) -> PeersWithRawResponse: - return PeersWithRawResponse(self._secondary_dns.peers) + def peers(self) -> PeersResourceWithRawResponse: + return PeersResourceWithRawResponse(self._secondary_dns.peers) @cached_property - def tsigs(self) -> TSIGsWithRawResponse: - return TSIGsWithRawResponse(self._secondary_dns.tsigs) + def tsigs(self) -> TSIGsResourceWithRawResponse: + return TSIGsResourceWithRawResponse(self._secondary_dns.tsigs) -class AsyncSecondaryDNSWithRawResponse: - def __init__(self, secondary_dns: AsyncSecondaryDNS) -> None: +class AsyncSecondaryDNSResourceWithRawResponse: + def __init__(self, secondary_dns: AsyncSecondaryDNSResource) -> None: self._secondary_dns = secondary_dns @cached_property - def force_axfr(self) -> AsyncForceAXFRWithRawResponse: - return AsyncForceAXFRWithRawResponse(self._secondary_dns.force_axfr) + def force_axfr(self) -> AsyncForceAXFRResourceWithRawResponse: + return AsyncForceAXFRResourceWithRawResponse(self._secondary_dns.force_axfr) @cached_property - def incoming(self) -> AsyncIncomingWithRawResponse: - return AsyncIncomingWithRawResponse(self._secondary_dns.incoming) + def incoming(self) -> AsyncIncomingResourceWithRawResponse: + return AsyncIncomingResourceWithRawResponse(self._secondary_dns.incoming) @cached_property - def outgoing(self) -> AsyncOutgoingWithRawResponse: - return AsyncOutgoingWithRawResponse(self._secondary_dns.outgoing) + def outgoing(self) -> AsyncOutgoingResourceWithRawResponse: + return AsyncOutgoingResourceWithRawResponse(self._secondary_dns.outgoing) @cached_property - def acls(self) -> AsyncACLsWithRawResponse: - return AsyncACLsWithRawResponse(self._secondary_dns.acls) + def acls(self) -> AsyncACLsResourceWithRawResponse: + return AsyncACLsResourceWithRawResponse(self._secondary_dns.acls) @cached_property - def peers(self) -> AsyncPeersWithRawResponse: - return AsyncPeersWithRawResponse(self._secondary_dns.peers) + def peers(self) -> AsyncPeersResourceWithRawResponse: + return AsyncPeersResourceWithRawResponse(self._secondary_dns.peers) @cached_property - def tsigs(self) -> AsyncTSIGsWithRawResponse: - return AsyncTSIGsWithRawResponse(self._secondary_dns.tsigs) + def tsigs(self) -> AsyncTSIGsResourceWithRawResponse: + return AsyncTSIGsResourceWithRawResponse(self._secondary_dns.tsigs) -class SecondaryDNSWithStreamingResponse: - def __init__(self, secondary_dns: SecondaryDNS) -> None: +class SecondaryDNSResourceWithStreamingResponse: + def __init__(self, secondary_dns: SecondaryDNSResource) -> None: self._secondary_dns = secondary_dns @cached_property - def force_axfr(self) -> ForceAXFRWithStreamingResponse: - return ForceAXFRWithStreamingResponse(self._secondary_dns.force_axfr) + def force_axfr(self) -> ForceAXFRResourceWithStreamingResponse: + return ForceAXFRResourceWithStreamingResponse(self._secondary_dns.force_axfr) @cached_property - def incoming(self) -> IncomingWithStreamingResponse: - return IncomingWithStreamingResponse(self._secondary_dns.incoming) + def incoming(self) -> IncomingResourceWithStreamingResponse: + return IncomingResourceWithStreamingResponse(self._secondary_dns.incoming) @cached_property - def outgoing(self) -> OutgoingWithStreamingResponse: - return OutgoingWithStreamingResponse(self._secondary_dns.outgoing) + def outgoing(self) -> OutgoingResourceWithStreamingResponse: + return OutgoingResourceWithStreamingResponse(self._secondary_dns.outgoing) @cached_property - def acls(self) -> ACLsWithStreamingResponse: - return ACLsWithStreamingResponse(self._secondary_dns.acls) + def acls(self) -> ACLsResourceWithStreamingResponse: + return ACLsResourceWithStreamingResponse(self._secondary_dns.acls) @cached_property - def peers(self) -> PeersWithStreamingResponse: - return PeersWithStreamingResponse(self._secondary_dns.peers) + def peers(self) -> PeersResourceWithStreamingResponse: + return PeersResourceWithStreamingResponse(self._secondary_dns.peers) @cached_property - def tsigs(self) -> TSIGsWithStreamingResponse: - return TSIGsWithStreamingResponse(self._secondary_dns.tsigs) + def tsigs(self) -> TSIGsResourceWithStreamingResponse: + return TSIGsResourceWithStreamingResponse(self._secondary_dns.tsigs) -class AsyncSecondaryDNSWithStreamingResponse: - def __init__(self, secondary_dns: AsyncSecondaryDNS) -> None: +class AsyncSecondaryDNSResourceWithStreamingResponse: + def __init__(self, secondary_dns: AsyncSecondaryDNSResource) -> None: self._secondary_dns = secondary_dns @cached_property - def force_axfr(self) -> AsyncForceAXFRWithStreamingResponse: - return AsyncForceAXFRWithStreamingResponse(self._secondary_dns.force_axfr) + def force_axfr(self) -> AsyncForceAXFRResourceWithStreamingResponse: + return AsyncForceAXFRResourceWithStreamingResponse(self._secondary_dns.force_axfr) @cached_property - def incoming(self) -> AsyncIncomingWithStreamingResponse: - return AsyncIncomingWithStreamingResponse(self._secondary_dns.incoming) + def incoming(self) -> AsyncIncomingResourceWithStreamingResponse: + return AsyncIncomingResourceWithStreamingResponse(self._secondary_dns.incoming) @cached_property - def outgoing(self) -> AsyncOutgoingWithStreamingResponse: - return AsyncOutgoingWithStreamingResponse(self._secondary_dns.outgoing) + def outgoing(self) -> AsyncOutgoingResourceWithStreamingResponse: + return AsyncOutgoingResourceWithStreamingResponse(self._secondary_dns.outgoing) @cached_property - def acls(self) -> AsyncACLsWithStreamingResponse: - return AsyncACLsWithStreamingResponse(self._secondary_dns.acls) + def acls(self) -> AsyncACLsResourceWithStreamingResponse: + return AsyncACLsResourceWithStreamingResponse(self._secondary_dns.acls) @cached_property - def peers(self) -> AsyncPeersWithStreamingResponse: - return AsyncPeersWithStreamingResponse(self._secondary_dns.peers) + def peers(self) -> AsyncPeersResourceWithStreamingResponse: + return AsyncPeersResourceWithStreamingResponse(self._secondary_dns.peers) @cached_property - def tsigs(self) -> AsyncTSIGsWithStreamingResponse: - return AsyncTSIGsWithStreamingResponse(self._secondary_dns.tsigs) + def tsigs(self) -> AsyncTSIGsResourceWithStreamingResponse: + return AsyncTSIGsResourceWithStreamingResponse(self._secondary_dns.tsigs) diff --git a/src/cloudflare/resources/secondary_dns/tsigs.py b/src/cloudflare/resources/secondary_dns/tsigs.py index 6031863ce6b..f1e73271efd 100644 --- a/src/cloudflare/resources/secondary_dns/tsigs.py +++ b/src/cloudflare/resources/secondary_dns/tsigs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,21 @@ AsyncPaginator, make_request_options, ) -from ...types.secondary_dns import SecondaryDNSTSIG, TSIGDeleteResponse, tsig_create_params, tsig_update_params +from ...types.secondary_dns import tsig_create_params, tsig_delete_params, tsig_update_params +from ...types.secondary_dns.tsig import TSIG +from ...types.secondary_dns.tsig_delete_response import TSIGDeleteResponse -__all__ = ["TSIGs", "AsyncTSIGs"] +__all__ = ["TSIGsResource", "AsyncTSIGsResource"] -class TSIGs(SyncAPIResource): +class TSIGsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TSIGsWithRawResponse: - return TSIGsWithRawResponse(self) + def with_raw_response(self) -> TSIGsResourceWithRawResponse: + return TSIGsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TSIGsWithStreamingResponse: - return TSIGsWithStreamingResponse(self) + def with_streaming_response(self) -> TSIGsResourceWithStreamingResponse: + return TSIGsResourceWithStreamingResponse(self) def create( self, @@ -52,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSTSIG: + ) -> Optional[TSIG]: """ Create TSIG. @@ -88,9 +90,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TSIG]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSTSIG], ResultWrapper[SecondaryDNSTSIG]), + cast_to=cast(Type[Optional[TSIG]], ResultWrapper[TSIG]), ) def update( @@ -107,7 +109,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSTSIG: + ) -> Optional[TSIG]: """ Modify TSIG. @@ -145,9 +147,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TSIG]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSTSIG], ResultWrapper[SecondaryDNSTSIG]), + cast_to=cast(Type[Optional[TSIG]], ResultWrapper[TSIG]), ) def list( @@ -160,7 +162,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[SecondaryDNSTSIG]: + ) -> SyncSinglePage[TSIG]: """ List TSIGs. @@ -177,11 +179,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/secondary_dns/tsigs", - page=SyncSinglePage[SecondaryDNSTSIG], + page=SyncSinglePage[TSIG], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SecondaryDNSTSIG, + model=TSIG, ) def delete( @@ -189,13 +191,14 @@ def delete( tsig_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> TSIGDeleteResponse: + ) -> Optional[TSIGDeleteResponse]: """ Delete TSIG. @@ -214,14 +217,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `tsig_id` but received {tsig_id!r}") return self._delete( f"/accounts/{account_id}/secondary_dns/tsigs/{tsig_id}", + body=maybe_transform(body, tsig_delete_params.TSIGDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TSIGDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[TSIGDeleteResponse], ResultWrapper[TSIGDeleteResponse]), + cast_to=cast(Type[Optional[TSIGDeleteResponse]], ResultWrapper[TSIGDeleteResponse]), ) def get( @@ -235,7 +239,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSTSIG: + ) -> Optional[TSIG]: """ Get TSIG. @@ -259,20 +263,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TSIG]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSTSIG], ResultWrapper[SecondaryDNSTSIG]), + cast_to=cast(Type[Optional[TSIG]], ResultWrapper[TSIG]), ) -class AsyncTSIGs(AsyncAPIResource): +class AsyncTSIGsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTSIGsWithRawResponse: - return AsyncTSIGsWithRawResponse(self) + def with_raw_response(self) -> AsyncTSIGsResourceWithRawResponse: + return AsyncTSIGsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTSIGsWithStreamingResponse: - return AsyncTSIGsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTSIGsResourceWithStreamingResponse: + return AsyncTSIGsResourceWithStreamingResponse(self) async def create( self, @@ -287,7 +291,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSTSIG: + ) -> Optional[TSIG]: """ Create TSIG. @@ -323,9 +327,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TSIG]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSTSIG], ResultWrapper[SecondaryDNSTSIG]), + cast_to=cast(Type[Optional[TSIG]], ResultWrapper[TSIG]), ) async def update( @@ -342,7 +346,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSTSIG: + ) -> Optional[TSIG]: """ Modify TSIG. @@ -380,9 +384,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TSIG]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSTSIG], ResultWrapper[SecondaryDNSTSIG]), + cast_to=cast(Type[Optional[TSIG]], ResultWrapper[TSIG]), ) def list( @@ -395,7 +399,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[SecondaryDNSTSIG, AsyncSinglePage[SecondaryDNSTSIG]]: + ) -> AsyncPaginator[TSIG, AsyncSinglePage[TSIG]]: """ List TSIGs. @@ -412,11 +416,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/secondary_dns/tsigs", - page=AsyncSinglePage[SecondaryDNSTSIG], + page=AsyncSinglePage[TSIG], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SecondaryDNSTSIG, + model=TSIG, ) async def delete( @@ -424,13 +428,14 @@ async def delete( tsig_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> TSIGDeleteResponse: + ) -> Optional[TSIGDeleteResponse]: """ Delete TSIG. @@ -449,14 +454,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tsig_id` but received {tsig_id!r}") return await self._delete( f"/accounts/{account_id}/secondary_dns/tsigs/{tsig_id}", + body=await async_maybe_transform(body, tsig_delete_params.TSIGDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TSIGDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[TSIGDeleteResponse], ResultWrapper[TSIGDeleteResponse]), + cast_to=cast(Type[Optional[TSIGDeleteResponse]], ResultWrapper[TSIGDeleteResponse]), ) async def get( @@ -470,7 +476,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecondaryDNSTSIG: + ) -> Optional[TSIG]: """ Get TSIG. @@ -494,14 +500,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TSIG]]._unwrapper, ), - cast_to=cast(Type[SecondaryDNSTSIG], ResultWrapper[SecondaryDNSTSIG]), + cast_to=cast(Type[Optional[TSIG]], ResultWrapper[TSIG]), ) -class TSIGsWithRawResponse: - def __init__(self, tsigs: TSIGs) -> None: +class TSIGsResourceWithRawResponse: + def __init__(self, tsigs: TSIGsResource) -> None: self._tsigs = tsigs self.create = to_raw_response_wrapper( @@ -521,8 +527,8 @@ def __init__(self, tsigs: TSIGs) -> None: ) -class AsyncTSIGsWithRawResponse: - def __init__(self, tsigs: AsyncTSIGs) -> None: +class AsyncTSIGsResourceWithRawResponse: + def __init__(self, tsigs: AsyncTSIGsResource) -> None: self._tsigs = tsigs self.create = async_to_raw_response_wrapper( @@ -542,8 +548,8 @@ def __init__(self, tsigs: AsyncTSIGs) -> None: ) -class TSIGsWithStreamingResponse: - def __init__(self, tsigs: TSIGs) -> None: +class TSIGsResourceWithStreamingResponse: + def __init__(self, tsigs: TSIGsResource) -> None: self._tsigs = tsigs self.create = to_streamed_response_wrapper( @@ -563,8 +569,8 @@ def __init__(self, tsigs: TSIGs) -> None: ) -class AsyncTSIGsWithStreamingResponse: - def __init__(self, tsigs: AsyncTSIGs) -> None: +class AsyncTSIGsResourceWithStreamingResponse: + def __init__(self, tsigs: AsyncTSIGsResource) -> None: self._tsigs = tsigs self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/snippets/__init__.py b/src/cloudflare/resources/snippets/__init__.py index bfdde3f1b19..e3270af6c0a 100644 --- a/src/cloudflare/resources/snippets/__init__.py +++ b/src/cloudflare/resources/snippets/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, + ContentResource, + AsyncContentResource, + ContentResourceWithRawResponse, + AsyncContentResourceWithRawResponse, + ContentResourceWithStreamingResponse, + AsyncContentResourceWithStreamingResponse, ) from .snippets import ( - Snippets, - AsyncSnippets, - SnippetsWithRawResponse, - AsyncSnippetsWithRawResponse, - SnippetsWithStreamingResponse, - AsyncSnippetsWithStreamingResponse, + SnippetsResource, + AsyncSnippetsResource, + SnippetsResourceWithRawResponse, + AsyncSnippetsResourceWithRawResponse, + SnippetsResourceWithStreamingResponse, + AsyncSnippetsResourceWithStreamingResponse, ) __all__ = [ - "Content", - "AsyncContent", - "ContentWithRawResponse", - "AsyncContentWithRawResponse", - "ContentWithStreamingResponse", - "AsyncContentWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "Snippets", - "AsyncSnippets", - "SnippetsWithRawResponse", - "AsyncSnippetsWithRawResponse", - "SnippetsWithStreamingResponse", - "AsyncSnippetsWithStreamingResponse", + "ContentResource", + "AsyncContentResource", + "ContentResourceWithRawResponse", + "AsyncContentResourceWithRawResponse", + "ContentResourceWithStreamingResponse", + "AsyncContentResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "SnippetsResource", + "AsyncSnippetsResource", + "SnippetsResourceWithRawResponse", + "AsyncSnippetsResourceWithRawResponse", + "SnippetsResourceWithStreamingResponse", + "AsyncSnippetsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/snippets/content.py b/src/cloudflare/resources/snippets/content.py index bd36a25554f..3c010cbae16 100644 --- a/src/cloudflare/resources/snippets/content.py +++ b/src/cloudflare/resources/snippets/content.py @@ -21,17 +21,17 @@ make_request_options, ) -__all__ = ["Content", "AsyncContent"] +__all__ = ["ContentResource", "AsyncContentResource"] -class Content(SyncAPIResource): +class ContentResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self) + def with_raw_response(self) -> ContentResourceWithRawResponse: + return ContentResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self) + def with_streaming_response(self) -> ContentResourceWithStreamingResponse: + return ContentResourceWithStreamingResponse(self) def get( self, @@ -75,14 +75,14 @@ def get( ) -class AsyncContent(AsyncAPIResource): +class AsyncContentResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self) + def with_raw_response(self) -> AsyncContentResourceWithRawResponse: + return AsyncContentResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse: + return AsyncContentResourceWithStreamingResponse(self) async def get( self, @@ -126,8 +126,8 @@ async def get( ) -class ContentWithRawResponse: - def __init__(self, content: Content) -> None: +class ContentResourceWithRawResponse: + def __init__(self, content: ContentResource) -> None: self._content = content self.get = to_custom_raw_response_wrapper( @@ -136,8 +136,8 @@ def __init__(self, content: Content) -> None: ) -class AsyncContentWithRawResponse: - def __init__(self, content: AsyncContent) -> None: +class AsyncContentResourceWithRawResponse: + def __init__(self, content: AsyncContentResource) -> None: self._content = content self.get = async_to_custom_raw_response_wrapper( @@ -146,8 +146,8 @@ def __init__(self, content: AsyncContent) -> None: ) -class ContentWithStreamingResponse: - def __init__(self, content: Content) -> None: +class ContentResourceWithStreamingResponse: + def __init__(self, content: ContentResource) -> None: self._content = content self.get = to_custom_streamed_response_wrapper( @@ -156,8 +156,8 @@ def __init__(self, content: Content) -> None: ) -class AsyncContentWithStreamingResponse: - def __init__(self, content: AsyncContent) -> None: +class AsyncContentResourceWithStreamingResponse: + def __init__(self, content: AsyncContentResource) -> None: self._content = content self.get = async_to_custom_streamed_response_wrapper( diff --git a/src/cloudflare/resources/snippets/rules.py b/src/cloudflare/resources/snippets/rules.py index 97ff1902080..29923f06348 100644 --- a/src/cloudflare/resources/snippets/rules.py +++ b/src/cloudflare/resources/snippets/rules.py @@ -25,19 +25,21 @@ AsyncPaginator, make_request_options, ) -from ...types.snippets import RuleListResponse, RuleUpdateResponse, rule_update_params +from ...types.snippets import rule_update_params +from ...types.snippets.rule_list_response import RuleListResponse +from ...types.snippets.rule_update_response import RuleUpdateResponse -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) def update( self, @@ -77,7 +79,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleUpdateResponse]._unwrapper, ), cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), ) @@ -119,14 +121,14 @@ def list( ) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) async def update( self, @@ -166,7 +168,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RuleUpdateResponse]._unwrapper, ), cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), ) @@ -208,8 +210,8 @@ def list( ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.update = to_raw_response_wrapper( @@ -220,8 +222,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.update = async_to_raw_response_wrapper( @@ -232,8 +234,8 @@ def __init__(self, rules: AsyncRules) -> None: ) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.update = to_streamed_response_wrapper( @@ -244,8 +246,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/snippets/snippets.py b/src/cloudflare/resources/snippets/snippets.py index b0427590db5..15d503d6bd1 100644 --- a/src/cloudflare/resources/snippets/snippets.py +++ b/src/cloudflare/resources/snippets/snippets.py @@ -7,21 +7,20 @@ import httpx from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) -from ...types import Snippet, SnippetDeleteResponse, snippet_update_params from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, + ContentResource, + AsyncContentResource, + ContentResourceWithRawResponse, + AsyncContentResourceWithRawResponse, + ContentResourceWithStreamingResponse, + AsyncContentResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( @@ -42,26 +41,29 @@ AsyncPaginator, make_request_options, ) +from ...types.snippets import snippet_update_params +from ...types.snippets.snippet import Snippet +from ...types.snippets.snippet_delete_response import SnippetDeleteResponse -__all__ = ["Snippets", "AsyncSnippets"] +__all__ = ["SnippetsResource", "AsyncSnippetsResource"] -class Snippets(SyncAPIResource): +class SnippetsResource(SyncAPIResource): @cached_property - def content(self) -> Content: - return Content(self._client) + def content(self) -> ContentResource: + return ContentResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def with_raw_response(self) -> SnippetsWithRawResponse: - return SnippetsWithRawResponse(self) + def with_raw_response(self) -> SnippetsResourceWithRawResponse: + return SnippetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SnippetsWithStreamingResponse: - return SnippetsWithStreamingResponse(self) + def with_streaming_response(self) -> SnippetsResourceWithStreamingResponse: + return SnippetsResourceWithStreamingResponse(self) def update( self, @@ -113,7 +115,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Snippet]._unwrapper, ), cast_to=cast(Type[Snippet], ResultWrapper[Snippet]), ) @@ -195,7 +197,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SnippetDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SnippetDeleteResponse] @@ -242,28 +244,28 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Snippet]._unwrapper, ), cast_to=cast(Type[Snippet], ResultWrapper[Snippet]), ) -class AsyncSnippets(AsyncAPIResource): +class AsyncSnippetsResource(AsyncAPIResource): @cached_property - def content(self) -> AsyncContent: - return AsyncContent(self._client) + def content(self) -> AsyncContentResource: + return AsyncContentResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSnippetsWithRawResponse: - return AsyncSnippetsWithRawResponse(self) + def with_raw_response(self) -> AsyncSnippetsResourceWithRawResponse: + return AsyncSnippetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSnippetsWithStreamingResponse: - return AsyncSnippetsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSnippetsResourceWithStreamingResponse: + return AsyncSnippetsResourceWithStreamingResponse(self) async def update( self, @@ -315,7 +317,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Snippet]._unwrapper, ), cast_to=cast(Type[Snippet], ResultWrapper[Snippet]), ) @@ -397,7 +399,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SnippetDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SnippetDeleteResponse] @@ -444,14 +446,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Snippet]._unwrapper, ), cast_to=cast(Type[Snippet], ResultWrapper[Snippet]), ) -class SnippetsWithRawResponse: - def __init__(self, snippets: Snippets) -> None: +class SnippetsResourceWithRawResponse: + def __init__(self, snippets: SnippetsResource) -> None: self._snippets = snippets self.update = to_raw_response_wrapper( @@ -468,16 +470,16 @@ def __init__(self, snippets: Snippets) -> None: ) @cached_property - def content(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self._snippets.content) + def content(self) -> ContentResourceWithRawResponse: + return ContentResourceWithRawResponse(self._snippets.content) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._snippets.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._snippets.rules) -class AsyncSnippetsWithRawResponse: - def __init__(self, snippets: AsyncSnippets) -> None: +class AsyncSnippetsResourceWithRawResponse: + def __init__(self, snippets: AsyncSnippetsResource) -> None: self._snippets = snippets self.update = async_to_raw_response_wrapper( @@ -494,16 +496,16 @@ def __init__(self, snippets: AsyncSnippets) -> None: ) @cached_property - def content(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self._snippets.content) + def content(self) -> AsyncContentResourceWithRawResponse: + return AsyncContentResourceWithRawResponse(self._snippets.content) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._snippets.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._snippets.rules) -class SnippetsWithStreamingResponse: - def __init__(self, snippets: Snippets) -> None: +class SnippetsResourceWithStreamingResponse: + def __init__(self, snippets: SnippetsResource) -> None: self._snippets = snippets self.update = to_streamed_response_wrapper( @@ -520,16 +522,16 @@ def __init__(self, snippets: Snippets) -> None: ) @cached_property - def content(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self._snippets.content) + def content(self) -> ContentResourceWithStreamingResponse: + return ContentResourceWithStreamingResponse(self._snippets.content) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._snippets.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._snippets.rules) -class AsyncSnippetsWithStreamingResponse: - def __init__(self, snippets: AsyncSnippets) -> None: +class AsyncSnippetsResourceWithStreamingResponse: + def __init__(self, snippets: AsyncSnippetsResource) -> None: self._snippets = snippets self.update = async_to_streamed_response_wrapper( @@ -546,9 +548,9 @@ def __init__(self, snippets: AsyncSnippets) -> None: ) @cached_property - def content(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self._snippets.content) + def content(self) -> AsyncContentResourceWithStreamingResponse: + return AsyncContentResourceWithStreamingResponse(self._snippets.content) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._snippets.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._snippets.rules) diff --git a/src/cloudflare/resources/spectrum/__init__.py b/src/cloudflare/resources/spectrum/__init__.py index f33bab49bdf..2b184b88652 100644 --- a/src/cloudflare/resources/spectrum/__init__.py +++ b/src/cloudflare/resources/spectrum/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .apps import ( - Apps, - AsyncApps, - AppsWithRawResponse, - AsyncAppsWithRawResponse, - AppsWithStreamingResponse, - AsyncAppsWithStreamingResponse, + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, ) from .spectrum import ( - Spectrum, - AsyncSpectrum, - SpectrumWithRawResponse, - AsyncSpectrumWithRawResponse, - SpectrumWithStreamingResponse, - AsyncSpectrumWithStreamingResponse, + SpectrumResource, + AsyncSpectrumResource, + SpectrumResourceWithRawResponse, + AsyncSpectrumResourceWithRawResponse, + SpectrumResourceWithStreamingResponse, + AsyncSpectrumResourceWithStreamingResponse, ) from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) __all__ = [ - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", - "Apps", - "AsyncApps", - "AppsWithRawResponse", - "AsyncAppsWithRawResponse", - "AppsWithStreamingResponse", - "AsyncAppsWithStreamingResponse", - "Spectrum", - "AsyncSpectrum", - "SpectrumWithRawResponse", - "AsyncSpectrumWithRawResponse", - "SpectrumWithStreamingResponse", - "AsyncSpectrumWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", + "AppsResource", + "AsyncAppsResource", + "AppsResourceWithRawResponse", + "AsyncAppsResourceWithRawResponse", + "AppsResourceWithStreamingResponse", + "AsyncAppsResourceWithStreamingResponse", + "SpectrumResource", + "AsyncSpectrumResource", + "SpectrumResourceWithRawResponse", + "AsyncSpectrumResourceWithRawResponse", + "SpectrumResourceWithStreamingResponse", + "AsyncSpectrumResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/spectrum/analytics/__init__.py b/src/cloudflare/resources/spectrum/analytics/__init__.py index 02ea2c9ab85..7ac3bc6d763 100644 --- a/src/cloudflare/resources/spectrum/analytics/__init__.py +++ b/src/cloudflare/resources/spectrum/analytics/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, ) from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) from .aggregates import ( - Aggregates, - AsyncAggregates, - AggregatesWithRawResponse, - AsyncAggregatesWithRawResponse, - AggregatesWithStreamingResponse, - AsyncAggregatesWithStreamingResponse, + AggregatesResource, + AsyncAggregatesResource, + AggregatesResourceWithRawResponse, + AsyncAggregatesResourceWithRawResponse, + AggregatesResourceWithStreamingResponse, + AsyncAggregatesResourceWithStreamingResponse, ) __all__ = [ - "Aggregates", - "AsyncAggregates", - "AggregatesWithRawResponse", - "AsyncAggregatesWithRawResponse", - "AggregatesWithStreamingResponse", - "AsyncAggregatesWithStreamingResponse", - "Events", - "AsyncEvents", - "EventsWithRawResponse", - "AsyncEventsWithRawResponse", - "EventsWithStreamingResponse", - "AsyncEventsWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", + "AggregatesResource", + "AsyncAggregatesResource", + "AggregatesResourceWithRawResponse", + "AsyncAggregatesResourceWithRawResponse", + "AggregatesResourceWithStreamingResponse", + "AsyncAggregatesResourceWithStreamingResponse", + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/spectrum/analytics/aggregates/__init__.py b/src/cloudflare/resources/spectrum/analytics/aggregates/__init__.py index 8d9676074e0..0976d5319bb 100644 --- a/src/cloudflare/resources/spectrum/analytics/aggregates/__init__.py +++ b/src/cloudflare/resources/spectrum/analytics/aggregates/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .currents import ( - Currents, - AsyncCurrents, - CurrentsWithRawResponse, - AsyncCurrentsWithRawResponse, - CurrentsWithStreamingResponse, - AsyncCurrentsWithStreamingResponse, + CurrentsResource, + AsyncCurrentsResource, + CurrentsResourceWithRawResponse, + AsyncCurrentsResourceWithRawResponse, + CurrentsResourceWithStreamingResponse, + AsyncCurrentsResourceWithStreamingResponse, ) from .aggregates import ( - Aggregates, - AsyncAggregates, - AggregatesWithRawResponse, - AsyncAggregatesWithRawResponse, - AggregatesWithStreamingResponse, - AsyncAggregatesWithStreamingResponse, + AggregatesResource, + AsyncAggregatesResource, + AggregatesResourceWithRawResponse, + AsyncAggregatesResourceWithRawResponse, + AggregatesResourceWithStreamingResponse, + AsyncAggregatesResourceWithStreamingResponse, ) __all__ = [ - "Currents", - "AsyncCurrents", - "CurrentsWithRawResponse", - "AsyncCurrentsWithRawResponse", - "CurrentsWithStreamingResponse", - "AsyncCurrentsWithStreamingResponse", - "Aggregates", - "AsyncAggregates", - "AggregatesWithRawResponse", - "AsyncAggregatesWithRawResponse", - "AggregatesWithStreamingResponse", - "AsyncAggregatesWithStreamingResponse", + "CurrentsResource", + "AsyncCurrentsResource", + "CurrentsResourceWithRawResponse", + "AsyncCurrentsResourceWithRawResponse", + "CurrentsResourceWithStreamingResponse", + "AsyncCurrentsResourceWithStreamingResponse", + "AggregatesResource", + "AsyncAggregatesResource", + "AggregatesResourceWithRawResponse", + "AsyncAggregatesResourceWithRawResponse", + "AggregatesResourceWithStreamingResponse", + "AsyncAggregatesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/spectrum/analytics/aggregates/aggregates.py b/src/cloudflare/resources/spectrum/analytics/aggregates/aggregates.py index bad78b446b7..706b9766900 100644 --- a/src/cloudflare/resources/spectrum/analytics/aggregates/aggregates.py +++ b/src/cloudflare/resources/spectrum/analytics/aggregates/aggregates.py @@ -3,78 +3,78 @@ from __future__ import annotations from .currents import ( - Currents, - AsyncCurrents, - CurrentsWithRawResponse, - AsyncCurrentsWithRawResponse, - CurrentsWithStreamingResponse, - AsyncCurrentsWithStreamingResponse, + CurrentsResource, + AsyncCurrentsResource, + CurrentsResourceWithRawResponse, + AsyncCurrentsResourceWithRawResponse, + CurrentsResourceWithStreamingResponse, + AsyncCurrentsResourceWithStreamingResponse, ) from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Aggregates", "AsyncAggregates"] +__all__ = ["AggregatesResource", "AsyncAggregatesResource"] -class Aggregates(SyncAPIResource): +class AggregatesResource(SyncAPIResource): @cached_property - def currents(self) -> Currents: - return Currents(self._client) + def currents(self) -> CurrentsResource: + return CurrentsResource(self._client) @cached_property - def with_raw_response(self) -> AggregatesWithRawResponse: - return AggregatesWithRawResponse(self) + def with_raw_response(self) -> AggregatesResourceWithRawResponse: + return AggregatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AggregatesWithStreamingResponse: - return AggregatesWithStreamingResponse(self) + def with_streaming_response(self) -> AggregatesResourceWithStreamingResponse: + return AggregatesResourceWithStreamingResponse(self) -class AsyncAggregates(AsyncAPIResource): +class AsyncAggregatesResource(AsyncAPIResource): @cached_property - def currents(self) -> AsyncCurrents: - return AsyncCurrents(self._client) + def currents(self) -> AsyncCurrentsResource: + return AsyncCurrentsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAggregatesWithRawResponse: - return AsyncAggregatesWithRawResponse(self) + def with_raw_response(self) -> AsyncAggregatesResourceWithRawResponse: + return AsyncAggregatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAggregatesWithStreamingResponse: - return AsyncAggregatesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAggregatesResourceWithStreamingResponse: + return AsyncAggregatesResourceWithStreamingResponse(self) -class AggregatesWithRawResponse: - def __init__(self, aggregates: Aggregates) -> None: +class AggregatesResourceWithRawResponse: + def __init__(self, aggregates: AggregatesResource) -> None: self._aggregates = aggregates @cached_property - def currents(self) -> CurrentsWithRawResponse: - return CurrentsWithRawResponse(self._aggregates.currents) + def currents(self) -> CurrentsResourceWithRawResponse: + return CurrentsResourceWithRawResponse(self._aggregates.currents) -class AsyncAggregatesWithRawResponse: - def __init__(self, aggregates: AsyncAggregates) -> None: +class AsyncAggregatesResourceWithRawResponse: + def __init__(self, aggregates: AsyncAggregatesResource) -> None: self._aggregates = aggregates @cached_property - def currents(self) -> AsyncCurrentsWithRawResponse: - return AsyncCurrentsWithRawResponse(self._aggregates.currents) + def currents(self) -> AsyncCurrentsResourceWithRawResponse: + return AsyncCurrentsResourceWithRawResponse(self._aggregates.currents) -class AggregatesWithStreamingResponse: - def __init__(self, aggregates: Aggregates) -> None: +class AggregatesResourceWithStreamingResponse: + def __init__(self, aggregates: AggregatesResource) -> None: self._aggregates = aggregates @cached_property - def currents(self) -> CurrentsWithStreamingResponse: - return CurrentsWithStreamingResponse(self._aggregates.currents) + def currents(self) -> CurrentsResourceWithStreamingResponse: + return CurrentsResourceWithStreamingResponse(self._aggregates.currents) -class AsyncAggregatesWithStreamingResponse: - def __init__(self, aggregates: AsyncAggregates) -> None: +class AsyncAggregatesResourceWithStreamingResponse: + def __init__(self, aggregates: AsyncAggregatesResource) -> None: self._aggregates = aggregates @cached_property - def currents(self) -> AsyncCurrentsWithStreamingResponse: - return AsyncCurrentsWithStreamingResponse(self._aggregates.currents) + def currents(self) -> AsyncCurrentsResourceWithStreamingResponse: + return AsyncCurrentsResourceWithStreamingResponse(self._aggregates.currents) diff --git a/src/cloudflare/resources/spectrum/analytics/aggregates/currents.py b/src/cloudflare/resources/spectrum/analytics/aggregates/currents.py index f87d96c4642..b8a7869260e 100644 --- a/src/cloudflare/resources/spectrum/analytics/aggregates/currents.py +++ b/src/cloudflare/resources/spectrum/analytics/aggregates/currents.py @@ -23,19 +23,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.spectrum.analytics.aggregates import CurrentGetResponse, current_get_params +from .....types.spectrum.analytics.aggregates import current_get_params +from .....types.spectrum.analytics.aggregates.current_get_response import CurrentGetResponse -__all__ = ["Currents", "AsyncCurrents"] +__all__ = ["CurrentsResource", "AsyncCurrentsResource"] -class Currents(SyncAPIResource): +class CurrentsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CurrentsWithRawResponse: - return CurrentsWithRawResponse(self) + def with_raw_response(self) -> CurrentsResourceWithRawResponse: + return CurrentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CurrentsWithStreamingResponse: - return CurrentsWithStreamingResponse(self) + def with_streaming_response(self) -> CurrentsResourceWithStreamingResponse: + return CurrentsResourceWithStreamingResponse(self) def get( self, @@ -91,20 +92,20 @@ def get( }, current_get_params.CurrentGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CurrentGetResponse]._unwrapper, ), cast_to=cast(Type[CurrentGetResponse], ResultWrapper[CurrentGetResponse]), ) -class AsyncCurrents(AsyncAPIResource): +class AsyncCurrentsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCurrentsWithRawResponse: - return AsyncCurrentsWithRawResponse(self) + def with_raw_response(self) -> AsyncCurrentsResourceWithRawResponse: + return AsyncCurrentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCurrentsWithStreamingResponse: - return AsyncCurrentsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCurrentsResourceWithStreamingResponse: + return AsyncCurrentsResourceWithStreamingResponse(self) async def get( self, @@ -160,14 +161,14 @@ async def get( }, current_get_params.CurrentGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CurrentGetResponse]._unwrapper, ), cast_to=cast(Type[CurrentGetResponse], ResultWrapper[CurrentGetResponse]), ) -class CurrentsWithRawResponse: - def __init__(self, currents: Currents) -> None: +class CurrentsResourceWithRawResponse: + def __init__(self, currents: CurrentsResource) -> None: self._currents = currents self.get = to_raw_response_wrapper( @@ -175,8 +176,8 @@ def __init__(self, currents: Currents) -> None: ) -class AsyncCurrentsWithRawResponse: - def __init__(self, currents: AsyncCurrents) -> None: +class AsyncCurrentsResourceWithRawResponse: + def __init__(self, currents: AsyncCurrentsResource) -> None: self._currents = currents self.get = async_to_raw_response_wrapper( @@ -184,8 +185,8 @@ def __init__(self, currents: AsyncCurrents) -> None: ) -class CurrentsWithStreamingResponse: - def __init__(self, currents: Currents) -> None: +class CurrentsResourceWithStreamingResponse: + def __init__(self, currents: CurrentsResource) -> None: self._currents = currents self.get = to_streamed_response_wrapper( @@ -193,8 +194,8 @@ def __init__(self, currents: Currents) -> None: ) -class AsyncCurrentsWithStreamingResponse: - def __init__(self, currents: AsyncCurrents) -> None: +class AsyncCurrentsResourceWithStreamingResponse: + def __init__(self, currents: AsyncCurrentsResource) -> None: self._currents = currents self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/spectrum/analytics/analytics.py b/src/cloudflare/resources/spectrum/analytics/analytics.py index dec7750f683..57e52bea702 100644 --- a/src/cloudflare/resources/spectrum/analytics/analytics.py +++ b/src/cloudflare/resources/spectrum/analytics/analytics.py @@ -3,112 +3,112 @@ from __future__ import annotations from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, ) from ...._compat import cached_property from .aggregates import ( - Aggregates, - AsyncAggregates, - AggregatesWithRawResponse, - AsyncAggregatesWithRawResponse, - AggregatesWithStreamingResponse, - AsyncAggregatesWithStreamingResponse, + AggregatesResource, + AsyncAggregatesResource, + AggregatesResourceWithRawResponse, + AsyncAggregatesResourceWithRawResponse, + AggregatesResourceWithStreamingResponse, + AsyncAggregatesResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource -from .events.events import Events, AsyncEvents -from .aggregates.aggregates import Aggregates, AsyncAggregates +from .events.events import EventsResource, AsyncEventsResource +from .aggregates.aggregates import AggregatesResource, AsyncAggregatesResource -__all__ = ["Analytics", "AsyncAnalytics"] +__all__ = ["AnalyticsResource", "AsyncAnalyticsResource"] -class Analytics(SyncAPIResource): +class AnalyticsResource(SyncAPIResource): @cached_property - def aggregates(self) -> Aggregates: - return Aggregates(self._client) + def aggregates(self) -> AggregatesResource: + return AggregatesResource(self._client) @cached_property - def events(self) -> Events: - return Events(self._client) + def events(self) -> EventsResource: + return EventsResource(self._client) @cached_property - def with_raw_response(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self) + def with_raw_response(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self) + def with_streaming_response(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self) -class AsyncAnalytics(AsyncAPIResource): +class AsyncAnalyticsResource(AsyncAPIResource): @cached_property - def aggregates(self) -> AsyncAggregates: - return AsyncAggregates(self._client) + def aggregates(self) -> AsyncAggregatesResource: + return AsyncAggregatesResource(self._client) @cached_property - def events(self) -> AsyncEvents: - return AsyncEvents(self._client) + def events(self) -> AsyncEventsResource: + return AsyncEventsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self) + def with_raw_response(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self) -class AnalyticsWithRawResponse: - def __init__(self, analytics: Analytics) -> None: +class AnalyticsResourceWithRawResponse: + def __init__(self, analytics: AnalyticsResource) -> None: self._analytics = analytics @cached_property - def aggregates(self) -> AggregatesWithRawResponse: - return AggregatesWithRawResponse(self._analytics.aggregates) + def aggregates(self) -> AggregatesResourceWithRawResponse: + return AggregatesResourceWithRawResponse(self._analytics.aggregates) @cached_property - def events(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self._analytics.events) + def events(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self._analytics.events) -class AsyncAnalyticsWithRawResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: +class AsyncAnalyticsResourceWithRawResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: self._analytics = analytics @cached_property - def aggregates(self) -> AsyncAggregatesWithRawResponse: - return AsyncAggregatesWithRawResponse(self._analytics.aggregates) + def aggregates(self) -> AsyncAggregatesResourceWithRawResponse: + return AsyncAggregatesResourceWithRawResponse(self._analytics.aggregates) @cached_property - def events(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self._analytics.events) + def events(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self._analytics.events) -class AnalyticsWithStreamingResponse: - def __init__(self, analytics: Analytics) -> None: +class AnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AnalyticsResource) -> None: self._analytics = analytics @cached_property - def aggregates(self) -> AggregatesWithStreamingResponse: - return AggregatesWithStreamingResponse(self._analytics.aggregates) + def aggregates(self) -> AggregatesResourceWithStreamingResponse: + return AggregatesResourceWithStreamingResponse(self._analytics.aggregates) @cached_property - def events(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self._analytics.events) + def events(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self._analytics.events) -class AsyncAnalyticsWithStreamingResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: +class AsyncAnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: self._analytics = analytics @cached_property - def aggregates(self) -> AsyncAggregatesWithStreamingResponse: - return AsyncAggregatesWithStreamingResponse(self._analytics.aggregates) + def aggregates(self) -> AsyncAggregatesResourceWithStreamingResponse: + return AsyncAggregatesResourceWithStreamingResponse(self._analytics.aggregates) @cached_property - def events(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self._analytics.events) + def events(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self._analytics.events) diff --git a/src/cloudflare/resources/spectrum/analytics/events/__init__.py b/src/cloudflare/resources/spectrum/analytics/events/__init__.py index 608d7a1c1f4..58e9283401b 100644 --- a/src/cloudflare/resources/spectrum/analytics/events/__init__.py +++ b/src/cloudflare/resources/spectrum/analytics/events/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, ) from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, + BytimesResource, + AsyncBytimesResource, + BytimesResourceWithRawResponse, + AsyncBytimesResourceWithRawResponse, + BytimesResourceWithStreamingResponse, + AsyncBytimesResourceWithStreamingResponse, ) from .summaries import ( - Summaries, - AsyncSummaries, - SummariesWithRawResponse, - AsyncSummariesWithRawResponse, - SummariesWithStreamingResponse, - AsyncSummariesWithStreamingResponse, + SummariesResource, + AsyncSummariesResource, + SummariesResourceWithRawResponse, + AsyncSummariesResourceWithRawResponse, + SummariesResourceWithStreamingResponse, + AsyncSummariesResourceWithStreamingResponse, ) __all__ = [ - "Bytimes", - "AsyncBytimes", - "BytimesWithRawResponse", - "AsyncBytimesWithRawResponse", - "BytimesWithStreamingResponse", - "AsyncBytimesWithStreamingResponse", - "Summaries", - "AsyncSummaries", - "SummariesWithRawResponse", - "AsyncSummariesWithRawResponse", - "SummariesWithStreamingResponse", - "AsyncSummariesWithStreamingResponse", - "Events", - "AsyncEvents", - "EventsWithRawResponse", - "AsyncEventsWithRawResponse", - "EventsWithStreamingResponse", - "AsyncEventsWithStreamingResponse", + "BytimesResource", + "AsyncBytimesResource", + "BytimesResourceWithRawResponse", + "AsyncBytimesResourceWithRawResponse", + "BytimesResourceWithStreamingResponse", + "AsyncBytimesResourceWithStreamingResponse", + "SummariesResource", + "AsyncSummariesResource", + "SummariesResourceWithRawResponse", + "AsyncSummariesResourceWithRawResponse", + "SummariesResourceWithStreamingResponse", + "AsyncSummariesResourceWithStreamingResponse", + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/spectrum/analytics/events/bytimes.py b/src/cloudflare/resources/spectrum/analytics/events/bytimes.py index c303832c754..81fd0a6f738 100644 --- a/src/cloudflare/resources/spectrum/analytics/events/bytimes.py +++ b/src/cloudflare/resources/spectrum/analytics/events/bytimes.py @@ -25,25 +25,27 @@ from ....._base_client import ( make_request_options, ) -from .....types.spectrum.analytics.events import BytimeGetResponse, bytime_get_params +from .....types.spectrum.analytics.events import bytime_get_params +from .....types.spectrum.analytics.dimension import Dimension +from .....types.spectrum.analytics.events.bytime_get_response import BytimeGetResponse -__all__ = ["Bytimes", "AsyncBytimes"] +__all__ = ["BytimesResource", "AsyncBytimesResource"] -class Bytimes(SyncAPIResource): +class BytimesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self) + def with_raw_response(self) -> BytimesResourceWithRawResponse: + return BytimesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self) + def with_streaming_response(self) -> BytimesResourceWithStreamingResponse: + return BytimesResourceWithStreamingResponse(self) def get( self, zone: str, *, - dimensions: List[Literal["event", "appID", "coloName", "ipVersion"]] | NotGiven = NOT_GIVEN, + dimensions: List[Dimension] | NotGiven = NOT_GIVEN, filters: str | NotGiven = NOT_GIVEN, metrics: List[ Literal[ @@ -150,7 +152,7 @@ def get( }, bytime_get_params.BytimeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BytimeGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BytimeGetResponse] @@ -159,20 +161,20 @@ def get( ) -class AsyncBytimes(AsyncAPIResource): +class AsyncBytimesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self) + def with_raw_response(self) -> AsyncBytimesResourceWithRawResponse: + return AsyncBytimesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBytimesResourceWithStreamingResponse: + return AsyncBytimesResourceWithStreamingResponse(self) async def get( self, zone: str, *, - dimensions: List[Literal["event", "appID", "coloName", "ipVersion"]] | NotGiven = NOT_GIVEN, + dimensions: List[Dimension] | NotGiven = NOT_GIVEN, filters: str | NotGiven = NOT_GIVEN, metrics: List[ Literal[ @@ -279,7 +281,7 @@ async def get( }, bytime_get_params.BytimeGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BytimeGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[BytimeGetResponse] @@ -288,8 +290,8 @@ async def get( ) -class BytimesWithRawResponse: - def __init__(self, bytimes: Bytimes) -> None: +class BytimesResourceWithRawResponse: + def __init__(self, bytimes: BytimesResource) -> None: self._bytimes = bytimes self.get = to_raw_response_wrapper( @@ -297,8 +299,8 @@ def __init__(self, bytimes: Bytimes) -> None: ) -class AsyncBytimesWithRawResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: +class AsyncBytimesResourceWithRawResponse: + def __init__(self, bytimes: AsyncBytimesResource) -> None: self._bytimes = bytimes self.get = async_to_raw_response_wrapper( @@ -306,8 +308,8 @@ def __init__(self, bytimes: AsyncBytimes) -> None: ) -class BytimesWithStreamingResponse: - def __init__(self, bytimes: Bytimes) -> None: +class BytimesResourceWithStreamingResponse: + def __init__(self, bytimes: BytimesResource) -> None: self._bytimes = bytimes self.get = to_streamed_response_wrapper( @@ -315,8 +317,8 @@ def __init__(self, bytimes: Bytimes) -> None: ) -class AsyncBytimesWithStreamingResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: +class AsyncBytimesResourceWithStreamingResponse: + def __init__(self, bytimes: AsyncBytimesResource) -> None: self._bytimes = bytimes self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/spectrum/analytics/events/events.py b/src/cloudflare/resources/spectrum/analytics/events/events.py index bdcdbc1b01d..de874362abb 100644 --- a/src/cloudflare/resources/spectrum/analytics/events/events.py +++ b/src/cloudflare/resources/spectrum/analytics/events/events.py @@ -3,110 +3,110 @@ from __future__ import annotations from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, + BytimesResource, + AsyncBytimesResource, + BytimesResourceWithRawResponse, + AsyncBytimesResourceWithRawResponse, + BytimesResourceWithStreamingResponse, + AsyncBytimesResourceWithStreamingResponse, ) from .summaries import ( - Summaries, - AsyncSummaries, - SummariesWithRawResponse, - AsyncSummariesWithRawResponse, - SummariesWithStreamingResponse, - AsyncSummariesWithStreamingResponse, + SummariesResource, + AsyncSummariesResource, + SummariesResourceWithRawResponse, + AsyncSummariesResourceWithRawResponse, + SummariesResourceWithStreamingResponse, + AsyncSummariesResourceWithStreamingResponse, ) from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Events", "AsyncEvents"] +__all__ = ["EventsResource", "AsyncEventsResource"] -class Events(SyncAPIResource): +class EventsResource(SyncAPIResource): @cached_property - def bytimes(self) -> Bytimes: - return Bytimes(self._client) + def bytimes(self) -> BytimesResource: + return BytimesResource(self._client) @cached_property - def summaries(self) -> Summaries: - return Summaries(self._client) + def summaries(self) -> SummariesResource: + return SummariesResource(self._client) @cached_property - def with_raw_response(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self) + def with_raw_response(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self) + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self) -class AsyncEvents(AsyncAPIResource): +class AsyncEventsResource(AsyncAPIResource): @cached_property - def bytimes(self) -> AsyncBytimes: - return AsyncBytimes(self._client) + def bytimes(self) -> AsyncBytimesResource: + return AsyncBytimesResource(self._client) @cached_property - def summaries(self) -> AsyncSummaries: - return AsyncSummaries(self._client) + def summaries(self) -> AsyncSummariesResource: + return AsyncSummariesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self) + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self) -class EventsWithRawResponse: - def __init__(self, events: Events) -> None: +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: self._events = events @cached_property - def bytimes(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self._events.bytimes) + def bytimes(self) -> BytimesResourceWithRawResponse: + return BytimesResourceWithRawResponse(self._events.bytimes) @cached_property - def summaries(self) -> SummariesWithRawResponse: - return SummariesWithRawResponse(self._events.summaries) + def summaries(self) -> SummariesResourceWithRawResponse: + return SummariesResourceWithRawResponse(self._events.summaries) -class AsyncEventsWithRawResponse: - def __init__(self, events: AsyncEvents) -> None: +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: self._events = events @cached_property - def bytimes(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self._events.bytimes) + def bytimes(self) -> AsyncBytimesResourceWithRawResponse: + return AsyncBytimesResourceWithRawResponse(self._events.bytimes) @cached_property - def summaries(self) -> AsyncSummariesWithRawResponse: - return AsyncSummariesWithRawResponse(self._events.summaries) + def summaries(self) -> AsyncSummariesResourceWithRawResponse: + return AsyncSummariesResourceWithRawResponse(self._events.summaries) -class EventsWithStreamingResponse: - def __init__(self, events: Events) -> None: +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: self._events = events @cached_property - def bytimes(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self._events.bytimes) + def bytimes(self) -> BytimesResourceWithStreamingResponse: + return BytimesResourceWithStreamingResponse(self._events.bytimes) @cached_property - def summaries(self) -> SummariesWithStreamingResponse: - return SummariesWithStreamingResponse(self._events.summaries) + def summaries(self) -> SummariesResourceWithStreamingResponse: + return SummariesResourceWithStreamingResponse(self._events.summaries) -class AsyncEventsWithStreamingResponse: - def __init__(self, events: AsyncEvents) -> None: +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: self._events = events @cached_property - def bytimes(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self._events.bytimes) + def bytimes(self) -> AsyncBytimesResourceWithStreamingResponse: + return AsyncBytimesResourceWithStreamingResponse(self._events.bytimes) @cached_property - def summaries(self) -> AsyncSummariesWithStreamingResponse: - return AsyncSummariesWithStreamingResponse(self._events.summaries) + def summaries(self) -> AsyncSummariesResourceWithStreamingResponse: + return AsyncSummariesResourceWithStreamingResponse(self._events.summaries) diff --git a/src/cloudflare/resources/spectrum/analytics/events/summaries.py b/src/cloudflare/resources/spectrum/analytics/events/summaries.py index a069d2d2e92..23badfc934c 100644 --- a/src/cloudflare/resources/spectrum/analytics/events/summaries.py +++ b/src/cloudflare/resources/spectrum/analytics/events/summaries.py @@ -25,25 +25,27 @@ from ....._base_client import ( make_request_options, ) -from .....types.spectrum.analytics.events import SummaryGetResponse, summary_get_params +from .....types.spectrum.analytics.events import summary_get_params +from .....types.spectrum.analytics.dimension import Dimension +from .....types.spectrum.analytics.events.summary_get_response import SummaryGetResponse -__all__ = ["Summaries", "AsyncSummaries"] +__all__ = ["SummariesResource", "AsyncSummariesResource"] -class Summaries(SyncAPIResource): +class SummariesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SummariesWithRawResponse: - return SummariesWithRawResponse(self) + def with_raw_response(self) -> SummariesResourceWithRawResponse: + return SummariesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SummariesWithStreamingResponse: - return SummariesWithStreamingResponse(self) + def with_streaming_response(self) -> SummariesResourceWithStreamingResponse: + return SummariesResourceWithStreamingResponse(self) def get( self, zone: str, *, - dimensions: List[Literal["event", "appID", "coloName", "ipVersion"]] | NotGiven = NOT_GIVEN, + dimensions: List[Dimension] | NotGiven = NOT_GIVEN, filters: str | NotGiven = NOT_GIVEN, metrics: List[ Literal[ @@ -145,7 +147,7 @@ def get( }, summary_get_params.SummaryGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SummaryGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SummaryGetResponse] @@ -154,20 +156,20 @@ def get( ) -class AsyncSummaries(AsyncAPIResource): +class AsyncSummariesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSummariesWithRawResponse: - return AsyncSummariesWithRawResponse(self) + def with_raw_response(self) -> AsyncSummariesResourceWithRawResponse: + return AsyncSummariesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSummariesWithStreamingResponse: - return AsyncSummariesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSummariesResourceWithStreamingResponse: + return AsyncSummariesResourceWithStreamingResponse(self) async def get( self, zone: str, *, - dimensions: List[Literal["event", "appID", "coloName", "ipVersion"]] | NotGiven = NOT_GIVEN, + dimensions: List[Dimension] | NotGiven = NOT_GIVEN, filters: str | NotGiven = NOT_GIVEN, metrics: List[ Literal[ @@ -269,7 +271,7 @@ async def get( }, summary_get_params.SummaryGetParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SummaryGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SummaryGetResponse] @@ -278,8 +280,8 @@ async def get( ) -class SummariesWithRawResponse: - def __init__(self, summaries: Summaries) -> None: +class SummariesResourceWithRawResponse: + def __init__(self, summaries: SummariesResource) -> None: self._summaries = summaries self.get = to_raw_response_wrapper( @@ -287,8 +289,8 @@ def __init__(self, summaries: Summaries) -> None: ) -class AsyncSummariesWithRawResponse: - def __init__(self, summaries: AsyncSummaries) -> None: +class AsyncSummariesResourceWithRawResponse: + def __init__(self, summaries: AsyncSummariesResource) -> None: self._summaries = summaries self.get = async_to_raw_response_wrapper( @@ -296,8 +298,8 @@ def __init__(self, summaries: AsyncSummaries) -> None: ) -class SummariesWithStreamingResponse: - def __init__(self, summaries: Summaries) -> None: +class SummariesResourceWithStreamingResponse: + def __init__(self, summaries: SummariesResource) -> None: self._summaries = summaries self.get = to_streamed_response_wrapper( @@ -305,8 +307,8 @@ def __init__(self, summaries: Summaries) -> None: ) -class AsyncSummariesWithStreamingResponse: - def __init__(self, summaries: AsyncSummaries) -> None: +class AsyncSummariesResourceWithStreamingResponse: + def __init__(self, summaries: AsyncSummariesResource) -> None: self._summaries = summaries self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/spectrum/apps.py b/src/cloudflare/resources/spectrum/apps.py index b199104dbd5..625cbb07ce5 100644 --- a/src/cloudflare/resources/spectrum/apps.py +++ b/src/cloudflare/resources/spectrum/apps.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Union, Optional, cast +from typing import Any, Type, Optional, cast from typing_extensions import Literal import httpx @@ -27,37 +27,42 @@ make_request_options, ) from ...types.spectrum import ( - AppGetResponse, - AppCreateResponse, - AppDeleteResponse, - AppUpdateResponse, app_list_params, app_create_params, + app_delete_params, app_update_params, ) +from ...types.spectrum.dns_param import DNSParam +from ...types.spectrum.edge_ips_param import EdgeIPsParam +from ...types.spectrum.app_get_response import AppGetResponse +from ...types.spectrum.origin_dns_param import OriginDNSParam +from ...types.spectrum.origin_port_param import OriginPortParam +from ...types.spectrum.app_create_response import AppCreateResponse +from ...types.spectrum.app_delete_response import AppDeleteResponse +from ...types.spectrum.app_update_response import AppUpdateResponse -__all__ = ["Apps", "AsyncApps"] +__all__ = ["AppsResource", "AsyncAppsResource"] -class Apps(SyncAPIResource): +class AppsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AppsWithRawResponse: - return AppsWithRawResponse(self) + def with_raw_response(self) -> AppsResourceWithRawResponse: + return AppsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AppsWithStreamingResponse: - return AppsWithStreamingResponse(self) + def with_streaming_response(self) -> AppsResourceWithStreamingResponse: + return AppsResourceWithStreamingResponse(self) def create( self, zone: str, *, - dns: app_create_params.DNS, - origin_dns: app_create_params.OriginDNS, - origin_port: Union[int, str], + dns: DNSParam, + origin_dns: OriginDNSParam, + origin_port: OriginPortParam, protocol: str, argo_smart_routing: bool | NotGiven = NOT_GIVEN, - edge_ips: app_create_params.EdgeIPs | NotGiven = NOT_GIVEN, + edge_ips: EdgeIPsParam | NotGiven = NOT_GIVEN, ip_firewall: bool | NotGiven = NOT_GIVEN, proxy_protocol: Literal["off", "v1", "v2", "simple"] | NotGiven = NOT_GIVEN, tls: Literal["off", "flexible", "full", "strict"] | NotGiven = NOT_GIVEN, @@ -142,7 +147,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AppCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AppCreateResponse]], ResultWrapper[AppCreateResponse]), ) @@ -152,12 +157,12 @@ def update( app_id: str, *, zone: str, - dns: app_update_params.DNS, - origin_dns: app_update_params.OriginDNS, - origin_port: Union[int, str], + dns: DNSParam, + origin_dns: OriginDNSParam, + origin_port: OriginPortParam, protocol: str, argo_smart_routing: bool | NotGiven = NOT_GIVEN, - edge_ips: app_update_params.EdgeIPs | NotGiven = NOT_GIVEN, + edge_ips: EdgeIPsParam | NotGiven = NOT_GIVEN, ip_firewall: bool | NotGiven = NOT_GIVEN, proxy_protocol: Literal["off", "v1", "v2", "simple"] | NotGiven = NOT_GIVEN, tls: Literal["off", "flexible", "full", "strict"] | NotGiven = NOT_GIVEN, @@ -246,7 +251,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AppUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AppUpdateResponse]], ResultWrapper[AppUpdateResponse]), ) @@ -318,6 +323,7 @@ def delete( app_id: str, *, zone: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -347,12 +353,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") return self._delete( f"/zones/{zone}/spectrum/apps/{app_id}", + body=maybe_transform(body, app_delete_params.AppDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AppDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AppDeleteResponse]], ResultWrapper[AppDeleteResponse]), ) @@ -368,7 +375,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AppGetResponse]: + ) -> AppGetResponse: """ Gets the application configuration of a specific application inside a zone. @@ -390,7 +397,7 @@ def get( if not app_id: raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") return cast( - Optional[AppGetResponse], + AppGetResponse, self._get( f"/zones/{zone}/spectrum/apps/{app_id}", options=make_request_options( @@ -398,7 +405,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AppGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AppGetResponse] @@ -407,25 +414,25 @@ def get( ) -class AsyncApps(AsyncAPIResource): +class AsyncAppsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAppsWithRawResponse: - return AsyncAppsWithRawResponse(self) + def with_raw_response(self) -> AsyncAppsResourceWithRawResponse: + return AsyncAppsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAppsWithStreamingResponse: - return AsyncAppsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse: + return AsyncAppsResourceWithStreamingResponse(self) async def create( self, zone: str, *, - dns: app_create_params.DNS, - origin_dns: app_create_params.OriginDNS, - origin_port: Union[int, str], + dns: DNSParam, + origin_dns: OriginDNSParam, + origin_port: OriginPortParam, protocol: str, argo_smart_routing: bool | NotGiven = NOT_GIVEN, - edge_ips: app_create_params.EdgeIPs | NotGiven = NOT_GIVEN, + edge_ips: EdgeIPsParam | NotGiven = NOT_GIVEN, ip_firewall: bool | NotGiven = NOT_GIVEN, proxy_protocol: Literal["off", "v1", "v2", "simple"] | NotGiven = NOT_GIVEN, tls: Literal["off", "flexible", "full", "strict"] | NotGiven = NOT_GIVEN, @@ -510,7 +517,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AppCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AppCreateResponse]], ResultWrapper[AppCreateResponse]), ) @@ -520,12 +527,12 @@ async def update( app_id: str, *, zone: str, - dns: app_update_params.DNS, - origin_dns: app_update_params.OriginDNS, - origin_port: Union[int, str], + dns: DNSParam, + origin_dns: OriginDNSParam, + origin_port: OriginPortParam, protocol: str, argo_smart_routing: bool | NotGiven = NOT_GIVEN, - edge_ips: app_update_params.EdgeIPs | NotGiven = NOT_GIVEN, + edge_ips: EdgeIPsParam | NotGiven = NOT_GIVEN, ip_firewall: bool | NotGiven = NOT_GIVEN, proxy_protocol: Literal["off", "v1", "v2", "simple"] | NotGiven = NOT_GIVEN, tls: Literal["off", "flexible", "full", "strict"] | NotGiven = NOT_GIVEN, @@ -614,7 +621,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AppUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AppUpdateResponse]], ResultWrapper[AppUpdateResponse]), ) @@ -686,6 +693,7 @@ async def delete( app_id: str, *, zone: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -715,12 +723,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") return await self._delete( f"/zones/{zone}/spectrum/apps/{app_id}", + body=await async_maybe_transform(body, app_delete_params.AppDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AppDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AppDeleteResponse]], ResultWrapper[AppDeleteResponse]), ) @@ -736,7 +745,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AppGetResponse]: + ) -> AppGetResponse: """ Gets the application configuration of a specific application inside a zone. @@ -758,7 +767,7 @@ async def get( if not app_id: raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") return cast( - Optional[AppGetResponse], + AppGetResponse, await self._get( f"/zones/{zone}/spectrum/apps/{app_id}", options=make_request_options( @@ -766,7 +775,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AppGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AppGetResponse] @@ -775,8 +784,8 @@ async def get( ) -class AppsWithRawResponse: - def __init__(self, apps: Apps) -> None: +class AppsResourceWithRawResponse: + def __init__(self, apps: AppsResource) -> None: self._apps = apps self.create = to_raw_response_wrapper( @@ -796,8 +805,8 @@ def __init__(self, apps: Apps) -> None: ) -class AsyncAppsWithRawResponse: - def __init__(self, apps: AsyncApps) -> None: +class AsyncAppsResourceWithRawResponse: + def __init__(self, apps: AsyncAppsResource) -> None: self._apps = apps self.create = async_to_raw_response_wrapper( @@ -817,8 +826,8 @@ def __init__(self, apps: AsyncApps) -> None: ) -class AppsWithStreamingResponse: - def __init__(self, apps: Apps) -> None: +class AppsResourceWithStreamingResponse: + def __init__(self, apps: AppsResource) -> None: self._apps = apps self.create = to_streamed_response_wrapper( @@ -838,8 +847,8 @@ def __init__(self, apps: Apps) -> None: ) -class AsyncAppsWithStreamingResponse: - def __init__(self, apps: AsyncApps) -> None: +class AsyncAppsResourceWithStreamingResponse: + def __init__(self, apps: AsyncAppsResource) -> None: self._apps = apps self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/spectrum/spectrum.py b/src/cloudflare/resources/spectrum/spectrum.py index ccf5e37e616..78a76587802 100644 --- a/src/cloudflare/resources/spectrum/spectrum.py +++ b/src/cloudflare/resources/spectrum/spectrum.py @@ -3,111 +3,111 @@ from __future__ import annotations from .apps import ( - Apps, - AsyncApps, - AppsWithRawResponse, - AsyncAppsWithRawResponse, - AppsWithStreamingResponse, - AsyncAppsWithStreamingResponse, + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, ) from ..._compat import cached_property from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .analytics.analytics import Analytics, AsyncAnalytics +from .analytics.analytics import AnalyticsResource, AsyncAnalyticsResource -__all__ = ["Spectrum", "AsyncSpectrum"] +__all__ = ["SpectrumResource", "AsyncSpectrumResource"] -class Spectrum(SyncAPIResource): +class SpectrumResource(SyncAPIResource): @cached_property - def analytics(self) -> Analytics: - return Analytics(self._client) + def analytics(self) -> AnalyticsResource: + return AnalyticsResource(self._client) @cached_property - def apps(self) -> Apps: - return Apps(self._client) + def apps(self) -> AppsResource: + return AppsResource(self._client) @cached_property - def with_raw_response(self) -> SpectrumWithRawResponse: - return SpectrumWithRawResponse(self) + def with_raw_response(self) -> SpectrumResourceWithRawResponse: + return SpectrumResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SpectrumWithStreamingResponse: - return SpectrumWithStreamingResponse(self) + def with_streaming_response(self) -> SpectrumResourceWithStreamingResponse: + return SpectrumResourceWithStreamingResponse(self) -class AsyncSpectrum(AsyncAPIResource): +class AsyncSpectrumResource(AsyncAPIResource): @cached_property - def analytics(self) -> AsyncAnalytics: - return AsyncAnalytics(self._client) + def analytics(self) -> AsyncAnalyticsResource: + return AsyncAnalyticsResource(self._client) @cached_property - def apps(self) -> AsyncApps: - return AsyncApps(self._client) + def apps(self) -> AsyncAppsResource: + return AsyncAppsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSpectrumWithRawResponse: - return AsyncSpectrumWithRawResponse(self) + def with_raw_response(self) -> AsyncSpectrumResourceWithRawResponse: + return AsyncSpectrumResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSpectrumWithStreamingResponse: - return AsyncSpectrumWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSpectrumResourceWithStreamingResponse: + return AsyncSpectrumResourceWithStreamingResponse(self) -class SpectrumWithRawResponse: - def __init__(self, spectrum: Spectrum) -> None: +class SpectrumResourceWithRawResponse: + def __init__(self, spectrum: SpectrumResource) -> None: self._spectrum = spectrum @cached_property - def analytics(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self._spectrum.analytics) + def analytics(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self._spectrum.analytics) @cached_property - def apps(self) -> AppsWithRawResponse: - return AppsWithRawResponse(self._spectrum.apps) + def apps(self) -> AppsResourceWithRawResponse: + return AppsResourceWithRawResponse(self._spectrum.apps) -class AsyncSpectrumWithRawResponse: - def __init__(self, spectrum: AsyncSpectrum) -> None: +class AsyncSpectrumResourceWithRawResponse: + def __init__(self, spectrum: AsyncSpectrumResource) -> None: self._spectrum = spectrum @cached_property - def analytics(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self._spectrum.analytics) + def analytics(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self._spectrum.analytics) @cached_property - def apps(self) -> AsyncAppsWithRawResponse: - return AsyncAppsWithRawResponse(self._spectrum.apps) + def apps(self) -> AsyncAppsResourceWithRawResponse: + return AsyncAppsResourceWithRawResponse(self._spectrum.apps) -class SpectrumWithStreamingResponse: - def __init__(self, spectrum: Spectrum) -> None: +class SpectrumResourceWithStreamingResponse: + def __init__(self, spectrum: SpectrumResource) -> None: self._spectrum = spectrum @cached_property - def analytics(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self._spectrum.analytics) + def analytics(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self._spectrum.analytics) @cached_property - def apps(self) -> AppsWithStreamingResponse: - return AppsWithStreamingResponse(self._spectrum.apps) + def apps(self) -> AppsResourceWithStreamingResponse: + return AppsResourceWithStreamingResponse(self._spectrum.apps) -class AsyncSpectrumWithStreamingResponse: - def __init__(self, spectrum: AsyncSpectrum) -> None: +class AsyncSpectrumResourceWithStreamingResponse: + def __init__(self, spectrum: AsyncSpectrumResource) -> None: self._spectrum = spectrum @cached_property - def analytics(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self._spectrum.analytics) + def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self._spectrum.analytics) @cached_property - def apps(self) -> AsyncAppsWithStreamingResponse: - return AsyncAppsWithStreamingResponse(self._spectrum.apps) + def apps(self) -> AsyncAppsResourceWithStreamingResponse: + return AsyncAppsResourceWithStreamingResponse(self._spectrum.apps) diff --git a/src/cloudflare/resources/speed/__init__.py b/src/cloudflare/resources/speed/__init__.py index a1febc9cd40..c94c9837fa9 100644 --- a/src/cloudflare/resources/speed/__init__.py +++ b/src/cloudflare/resources/speed/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .pages import ( - Pages, - AsyncPages, - PagesWithRawResponse, - AsyncPagesWithRawResponse, - PagesWithStreamingResponse, - AsyncPagesWithStreamingResponse, + PagesResource, + AsyncPagesResource, + PagesResourceWithRawResponse, + AsyncPagesResourceWithRawResponse, + PagesResourceWithStreamingResponse, + AsyncPagesResourceWithStreamingResponse, ) from .speed import ( - Speed, - AsyncSpeed, - SpeedWithRawResponse, - AsyncSpeedWithRawResponse, - SpeedWithStreamingResponse, - AsyncSpeedWithStreamingResponse, + SpeedResource, + AsyncSpeedResource, + SpeedResourceWithRawResponse, + AsyncSpeedResourceWithRawResponse, + SpeedResourceWithStreamingResponse, + AsyncSpeedResourceWithStreamingResponse, ) from .tests import ( - Tests, - AsyncTests, - TestsWithRawResponse, - AsyncTestsWithRawResponse, - TestsWithStreamingResponse, - AsyncTestsWithStreamingResponse, + TestsResource, + AsyncTestsResource, + TestsResourceWithRawResponse, + AsyncTestsResourceWithRawResponse, + TestsResourceWithStreamingResponse, + AsyncTestsResourceWithStreamingResponse, ) from .schedule import ( - Schedule, - AsyncSchedule, - ScheduleWithRawResponse, - AsyncScheduleWithRawResponse, - ScheduleWithStreamingResponse, - AsyncScheduleWithStreamingResponse, + ScheduleResource, + AsyncScheduleResource, + ScheduleResourceWithRawResponse, + AsyncScheduleResourceWithRawResponse, + ScheduleResourceWithStreamingResponse, + AsyncScheduleResourceWithStreamingResponse, ) from .availabilities import ( - Availabilities, - AsyncAvailabilities, - AvailabilitiesWithRawResponse, - AsyncAvailabilitiesWithRawResponse, - AvailabilitiesWithStreamingResponse, - AsyncAvailabilitiesWithStreamingResponse, + AvailabilitiesResource, + AsyncAvailabilitiesResource, + AvailabilitiesResourceWithRawResponse, + AsyncAvailabilitiesResourceWithRawResponse, + AvailabilitiesResourceWithStreamingResponse, + AsyncAvailabilitiesResourceWithStreamingResponse, ) __all__ = [ - "Tests", - "AsyncTests", - "TestsWithRawResponse", - "AsyncTestsWithRawResponse", - "TestsWithStreamingResponse", - "AsyncTestsWithStreamingResponse", - "Schedule", - "AsyncSchedule", - "ScheduleWithRawResponse", - "AsyncScheduleWithRawResponse", - "ScheduleWithStreamingResponse", - "AsyncScheduleWithStreamingResponse", - "Availabilities", - "AsyncAvailabilities", - "AvailabilitiesWithRawResponse", - "AsyncAvailabilitiesWithRawResponse", - "AvailabilitiesWithStreamingResponse", - "AsyncAvailabilitiesWithStreamingResponse", - "Pages", - "AsyncPages", - "PagesWithRawResponse", - "AsyncPagesWithRawResponse", - "PagesWithStreamingResponse", - "AsyncPagesWithStreamingResponse", - "Speed", - "AsyncSpeed", - "SpeedWithRawResponse", - "AsyncSpeedWithRawResponse", - "SpeedWithStreamingResponse", - "AsyncSpeedWithStreamingResponse", + "TestsResource", + "AsyncTestsResource", + "TestsResourceWithRawResponse", + "AsyncTestsResourceWithRawResponse", + "TestsResourceWithStreamingResponse", + "AsyncTestsResourceWithStreamingResponse", + "ScheduleResource", + "AsyncScheduleResource", + "ScheduleResourceWithRawResponse", + "AsyncScheduleResourceWithRawResponse", + "ScheduleResourceWithStreamingResponse", + "AsyncScheduleResourceWithStreamingResponse", + "AvailabilitiesResource", + "AsyncAvailabilitiesResource", + "AvailabilitiesResourceWithRawResponse", + "AsyncAvailabilitiesResourceWithRawResponse", + "AvailabilitiesResourceWithStreamingResponse", + "AsyncAvailabilitiesResourceWithStreamingResponse", + "PagesResource", + "AsyncPagesResource", + "PagesResourceWithRawResponse", + "AsyncPagesResourceWithRawResponse", + "PagesResourceWithStreamingResponse", + "AsyncPagesResourceWithStreamingResponse", + "SpeedResource", + "AsyncSpeedResource", + "SpeedResourceWithRawResponse", + "AsyncSpeedResourceWithRawResponse", + "SpeedResourceWithStreamingResponse", + "AsyncSpeedResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/speed/availabilities.py b/src/cloudflare/resources/speed/availabilities.py index 1414ca6da88..930d106c8ef 100644 --- a/src/cloudflare/resources/speed/availabilities.py +++ b/src/cloudflare/resources/speed/availabilities.py @@ -16,22 +16,22 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.speed import ObservatoryAvailabilities from ..._base_client import ( make_request_options, ) +from ...types.speed.availability import Availability -__all__ = ["Availabilities", "AsyncAvailabilities"] +__all__ = ["AvailabilitiesResource", "AsyncAvailabilitiesResource"] -class Availabilities(SyncAPIResource): +class AvailabilitiesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AvailabilitiesWithRawResponse: - return AvailabilitiesWithRawResponse(self) + def with_raw_response(self) -> AvailabilitiesResourceWithRawResponse: + return AvailabilitiesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AvailabilitiesWithStreamingResponse: - return AvailabilitiesWithStreamingResponse(self) + def with_streaming_response(self) -> AvailabilitiesResourceWithStreamingResponse: + return AvailabilitiesResourceWithStreamingResponse(self) def list( self, @@ -43,7 +43,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatoryAvailabilities]: + ) -> Optional[Availability]: """ Retrieves quota for all plans, as well as the current zone quota. @@ -67,20 +67,20 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Availability]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatoryAvailabilities]], ResultWrapper[ObservatoryAvailabilities]), + cast_to=cast(Type[Optional[Availability]], ResultWrapper[Availability]), ) -class AsyncAvailabilities(AsyncAPIResource): +class AsyncAvailabilitiesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAvailabilitiesWithRawResponse: - return AsyncAvailabilitiesWithRawResponse(self) + def with_raw_response(self) -> AsyncAvailabilitiesResourceWithRawResponse: + return AsyncAvailabilitiesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAvailabilitiesWithStreamingResponse: - return AsyncAvailabilitiesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAvailabilitiesResourceWithStreamingResponse: + return AsyncAvailabilitiesResourceWithStreamingResponse(self) async def list( self, @@ -92,7 +92,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatoryAvailabilities]: + ) -> Optional[Availability]: """ Retrieves quota for all plans, as well as the current zone quota. @@ -116,14 +116,14 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Availability]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatoryAvailabilities]], ResultWrapper[ObservatoryAvailabilities]), + cast_to=cast(Type[Optional[Availability]], ResultWrapper[Availability]), ) -class AvailabilitiesWithRawResponse: - def __init__(self, availabilities: Availabilities) -> None: +class AvailabilitiesResourceWithRawResponse: + def __init__(self, availabilities: AvailabilitiesResource) -> None: self._availabilities = availabilities self.list = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, availabilities: Availabilities) -> None: ) -class AsyncAvailabilitiesWithRawResponse: - def __init__(self, availabilities: AsyncAvailabilities) -> None: +class AsyncAvailabilitiesResourceWithRawResponse: + def __init__(self, availabilities: AsyncAvailabilitiesResource) -> None: self._availabilities = availabilities self.list = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, availabilities: AsyncAvailabilities) -> None: ) -class AvailabilitiesWithStreamingResponse: - def __init__(self, availabilities: Availabilities) -> None: +class AvailabilitiesResourceWithStreamingResponse: + def __init__(self, availabilities: AvailabilitiesResource) -> None: self._availabilities = availabilities self.list = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, availabilities: Availabilities) -> None: ) -class AsyncAvailabilitiesWithStreamingResponse: - def __init__(self, availabilities: AsyncAvailabilities) -> None: +class AsyncAvailabilitiesResourceWithStreamingResponse: + def __init__(self, availabilities: AsyncAvailabilitiesResource) -> None: self._availabilities = availabilities self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/speed/pages.py b/src/cloudflare/resources/speed/pages.py index 97ec103cef3..b75c1c6d06b 100644 --- a/src/cloudflare/resources/speed/pages.py +++ b/src/cloudflare/resources/speed/pages.py @@ -14,23 +14,23 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncSinglePage, AsyncSinglePage -from ...types.speed import PageListResponse from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.speed.page_list_response import PageListResponse -__all__ = ["Pages", "AsyncPages"] +__all__ = ["PagesResource", "AsyncPagesResource"] -class Pages(SyncAPIResource): +class PagesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PagesWithRawResponse: - return PagesWithRawResponse(self) + def with_raw_response(self) -> PagesResourceWithRawResponse: + return PagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PagesWithStreamingResponse: - return PagesWithStreamingResponse(self) + def with_streaming_response(self) -> PagesResourceWithStreamingResponse: + return PagesResourceWithStreamingResponse(self) def list( self, @@ -69,14 +69,14 @@ def list( ) -class AsyncPages(AsyncAPIResource): +class AsyncPagesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPagesWithRawResponse: - return AsyncPagesWithRawResponse(self) + def with_raw_response(self) -> AsyncPagesResourceWithRawResponse: + return AsyncPagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPagesWithStreamingResponse: - return AsyncPagesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPagesResourceWithStreamingResponse: + return AsyncPagesResourceWithStreamingResponse(self) def list( self, @@ -115,8 +115,8 @@ def list( ) -class PagesWithRawResponse: - def __init__(self, pages: Pages) -> None: +class PagesResourceWithRawResponse: + def __init__(self, pages: PagesResource) -> None: self._pages = pages self.list = to_raw_response_wrapper( @@ -124,8 +124,8 @@ def __init__(self, pages: Pages) -> None: ) -class AsyncPagesWithRawResponse: - def __init__(self, pages: AsyncPages) -> None: +class AsyncPagesResourceWithRawResponse: + def __init__(self, pages: AsyncPagesResource) -> None: self._pages = pages self.list = async_to_raw_response_wrapper( @@ -133,8 +133,8 @@ def __init__(self, pages: AsyncPages) -> None: ) -class PagesWithStreamingResponse: - def __init__(self, pages: Pages) -> None: +class PagesResourceWithStreamingResponse: + def __init__(self, pages: PagesResource) -> None: self._pages = pages self.list = to_streamed_response_wrapper( @@ -142,8 +142,8 @@ def __init__(self, pages: Pages) -> None: ) -class AsyncPagesWithStreamingResponse: - def __init__(self, pages: AsyncPages) -> None: +class AsyncPagesResourceWithStreamingResponse: + def __init__(self, pages: AsyncPagesResource) -> None: self._pages = pages self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/speed/schedule.py b/src/cloudflare/resources/speed/schedule.py index 09ccbb925b1..44ab5e60ffc 100644 --- a/src/cloudflare/resources/speed/schedule.py +++ b/src/cloudflare/resources/speed/schedule.py @@ -21,22 +21,23 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.speed import ScheduleCreateResponse, schedule_create_params +from ...types.speed import schedule_create_params from ..._base_client import ( make_request_options, ) +from ...types.speed.schedule_create_response import ScheduleCreateResponse -__all__ = ["Schedule", "AsyncSchedule"] +__all__ = ["ScheduleResource", "AsyncScheduleResource"] -class Schedule(SyncAPIResource): +class ScheduleResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ScheduleWithRawResponse: - return ScheduleWithRawResponse(self) + def with_raw_response(self) -> ScheduleResourceWithRawResponse: + return ScheduleResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ScheduleWithStreamingResponse: - return ScheduleWithStreamingResponse(self) + def with_streaming_response(self) -> ScheduleResourceWithStreamingResponse: + return ScheduleResourceWithStreamingResponse(self) def create( self, @@ -104,20 +105,20 @@ def create( extra_body=extra_body, timeout=timeout, query=maybe_transform({"region": region}, schedule_create_params.ScheduleCreateParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScheduleCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ScheduleCreateResponse]], ResultWrapper[ScheduleCreateResponse]), ) -class AsyncSchedule(AsyncAPIResource): +class AsyncScheduleResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncScheduleWithRawResponse: - return AsyncScheduleWithRawResponse(self) + def with_raw_response(self) -> AsyncScheduleResourceWithRawResponse: + return AsyncScheduleResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncScheduleWithStreamingResponse: - return AsyncScheduleWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncScheduleResourceWithStreamingResponse: + return AsyncScheduleResourceWithStreamingResponse(self) async def create( self, @@ -185,14 +186,14 @@ async def create( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"region": region}, schedule_create_params.ScheduleCreateParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScheduleCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ScheduleCreateResponse]], ResultWrapper[ScheduleCreateResponse]), ) -class ScheduleWithRawResponse: - def __init__(self, schedule: Schedule) -> None: +class ScheduleResourceWithRawResponse: + def __init__(self, schedule: ScheduleResource) -> None: self._schedule = schedule self.create = to_raw_response_wrapper( @@ -200,8 +201,8 @@ def __init__(self, schedule: Schedule) -> None: ) -class AsyncScheduleWithRawResponse: - def __init__(self, schedule: AsyncSchedule) -> None: +class AsyncScheduleResourceWithRawResponse: + def __init__(self, schedule: AsyncScheduleResource) -> None: self._schedule = schedule self.create = async_to_raw_response_wrapper( @@ -209,8 +210,8 @@ def __init__(self, schedule: AsyncSchedule) -> None: ) -class ScheduleWithStreamingResponse: - def __init__(self, schedule: Schedule) -> None: +class ScheduleResourceWithStreamingResponse: + def __init__(self, schedule: ScheduleResource) -> None: self._schedule = schedule self.create = to_streamed_response_wrapper( @@ -218,8 +219,8 @@ def __init__(self, schedule: Schedule) -> None: ) -class AsyncScheduleWithStreamingResponse: - def __init__(self, schedule: AsyncSchedule) -> None: +class AsyncScheduleResourceWithStreamingResponse: + def __init__(self, schedule: AsyncScheduleResource) -> None: self._schedule = schedule self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/speed/speed.py b/src/cloudflare/resources/speed/speed.py index a28cb6837ba..478aad8507c 100644 --- a/src/cloudflare/resources/speed/speed.py +++ b/src/cloudflare/resources/speed/speed.py @@ -2,34 +2,27 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, Union, Optional, cast +from datetime import datetime from typing_extensions import Literal import httpx from .pages import ( - Pages, - AsyncPages, - PagesWithRawResponse, - AsyncPagesWithRawResponse, - PagesWithStreamingResponse, - AsyncPagesWithStreamingResponse, + PagesResource, + AsyncPagesResource, + PagesResourceWithRawResponse, + AsyncPagesResourceWithRawResponse, + PagesResourceWithStreamingResponse, + AsyncPagesResourceWithStreamingResponse, ) from .tests import ( - Tests, - AsyncTests, - TestsWithRawResponse, - AsyncTestsWithRawResponse, - TestsWithStreamingResponse, - AsyncTestsWithStreamingResponse, -) -from ...types import ( - ObservatoryTrend, - ObservatorySchedule, - SpeedDeleteResponse, - speed_delete_params, - speed_trends_list_params, - speed_schedule_get_params, + TestsResource, + AsyncTestsResource, + TestsResourceWithRawResponse, + AsyncTestsResourceWithRawResponse, + TestsResourceWithStreamingResponse, + AsyncTestsResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( @@ -37,12 +30,12 @@ async_maybe_transform, ) from .schedule import ( - Schedule, - AsyncSchedule, - ScheduleWithRawResponse, - AsyncScheduleWithRawResponse, - ScheduleWithStreamingResponse, - AsyncScheduleWithStreamingResponse, + ScheduleResource, + AsyncScheduleResource, + ScheduleResourceWithRawResponse, + AsyncScheduleResourceWithRawResponse, + ScheduleResourceWithStreamingResponse, + AsyncScheduleResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -53,45 +46,49 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...types.speed import speed_delete_params, speed_trends_list_params, speed_schedule_get_params from ..._base_client import ( make_request_options, ) from .availabilities import ( - Availabilities, - AsyncAvailabilities, - AvailabilitiesWithRawResponse, - AsyncAvailabilitiesWithRawResponse, - AvailabilitiesWithStreamingResponse, - AsyncAvailabilitiesWithStreamingResponse, + AvailabilitiesResource, + AsyncAvailabilitiesResource, + AvailabilitiesResourceWithRawResponse, + AsyncAvailabilitiesResourceWithRawResponse, + AvailabilitiesResourceWithStreamingResponse, + AsyncAvailabilitiesResourceWithStreamingResponse, ) +from ...types.speed.trend import Trend +from ...types.speed.schedule import Schedule +from ...types.speed.speed_delete_response import SpeedDeleteResponse -__all__ = ["Speed", "AsyncSpeed"] +__all__ = ["SpeedResource", "AsyncSpeedResource"] -class Speed(SyncAPIResource): +class SpeedResource(SyncAPIResource): @cached_property - def tests(self) -> Tests: - return Tests(self._client) + def tests(self) -> TestsResource: + return TestsResource(self._client) @cached_property - def schedule(self) -> Schedule: - return Schedule(self._client) + def schedule(self) -> ScheduleResource: + return ScheduleResource(self._client) @cached_property - def availabilities(self) -> Availabilities: - return Availabilities(self._client) + def availabilities(self) -> AvailabilitiesResource: + return AvailabilitiesResource(self._client) @cached_property - def pages(self) -> Pages: - return Pages(self._client) + def pages(self) -> PagesResource: + return PagesResource(self._client) @cached_property - def with_raw_response(self) -> SpeedWithRawResponse: - return SpeedWithRawResponse(self) + def with_raw_response(self) -> SpeedResourceWithRawResponse: + return SpeedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SpeedWithStreamingResponse: - return SpeedWithStreamingResponse(self) + def with_streaming_response(self) -> SpeedResourceWithStreamingResponse: + return SpeedResourceWithStreamingResponse(self) def delete( self, @@ -159,7 +156,7 @@ def delete( extra_body=extra_body, timeout=timeout, query=maybe_transform({"region": region}, speed_delete_params.SpeedDeleteParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SpeedDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SpeedDeleteResponse]], ResultWrapper[SpeedDeleteResponse]), ) @@ -199,7 +196,7 @@ def schedule_get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatorySchedule]: + ) -> Optional[Schedule]: """ Retrieves the test schedule for a page in a specific region. @@ -230,9 +227,9 @@ def schedule_get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"region": region}, speed_schedule_get_params.SpeedScheduleGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Schedule]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatorySchedule]], ResultWrapper[ObservatorySchedule]), + cast_to=cast(Type[Optional[Schedule]], ResultWrapper[Schedule]), ) def trends_list( @@ -265,14 +262,16 @@ def trends_list( "us-south1", "us-west1", ], + start: Union[str, datetime], tz: str, + end: Union[str, datetime] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatoryTrend]: + ) -> Optional[Trend]: """ Lists the core web vital metrics trend over time for a specific page. @@ -313,40 +312,42 @@ def trends_list( "device_type": device_type, "metrics": metrics, "region": region, + "start": start, "tz": tz, + "end": end, }, speed_trends_list_params.SpeedTrendsListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Trend]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatoryTrend]], ResultWrapper[ObservatoryTrend]), + cast_to=cast(Type[Optional[Trend]], ResultWrapper[Trend]), ) -class AsyncSpeed(AsyncAPIResource): +class AsyncSpeedResource(AsyncAPIResource): @cached_property - def tests(self) -> AsyncTests: - return AsyncTests(self._client) + def tests(self) -> AsyncTestsResource: + return AsyncTestsResource(self._client) @cached_property - def schedule(self) -> AsyncSchedule: - return AsyncSchedule(self._client) + def schedule(self) -> AsyncScheduleResource: + return AsyncScheduleResource(self._client) @cached_property - def availabilities(self) -> AsyncAvailabilities: - return AsyncAvailabilities(self._client) + def availabilities(self) -> AsyncAvailabilitiesResource: + return AsyncAvailabilitiesResource(self._client) @cached_property - def pages(self) -> AsyncPages: - return AsyncPages(self._client) + def pages(self) -> AsyncPagesResource: + return AsyncPagesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSpeedWithRawResponse: - return AsyncSpeedWithRawResponse(self) + def with_raw_response(self) -> AsyncSpeedResourceWithRawResponse: + return AsyncSpeedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSpeedWithStreamingResponse: - return AsyncSpeedWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSpeedResourceWithStreamingResponse: + return AsyncSpeedResourceWithStreamingResponse(self) async def delete( self, @@ -414,7 +415,7 @@ async def delete( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"region": region}, speed_delete_params.SpeedDeleteParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SpeedDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SpeedDeleteResponse]], ResultWrapper[SpeedDeleteResponse]), ) @@ -454,7 +455,7 @@ async def schedule_get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatorySchedule]: + ) -> Optional[Schedule]: """ Retrieves the test schedule for a page in a specific region. @@ -485,9 +486,9 @@ async def schedule_get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"region": region}, speed_schedule_get_params.SpeedScheduleGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Schedule]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatorySchedule]], ResultWrapper[ObservatorySchedule]), + cast_to=cast(Type[Optional[Schedule]], ResultWrapper[Schedule]), ) async def trends_list( @@ -520,14 +521,16 @@ async def trends_list( "us-south1", "us-west1", ], + start: Union[str, datetime], tz: str, + end: Union[str, datetime] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatoryTrend]: + ) -> Optional[Trend]: """ Lists the core web vital metrics trend over time for a specific page. @@ -568,18 +571,20 @@ async def trends_list( "device_type": device_type, "metrics": metrics, "region": region, + "start": start, "tz": tz, + "end": end, }, speed_trends_list_params.SpeedTrendsListParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Trend]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatoryTrend]], ResultWrapper[ObservatoryTrend]), + cast_to=cast(Type[Optional[Trend]], ResultWrapper[Trend]), ) -class SpeedWithRawResponse: - def __init__(self, speed: Speed) -> None: +class SpeedResourceWithRawResponse: + def __init__(self, speed: SpeedResource) -> None: self._speed = speed self.delete = to_raw_response_wrapper( @@ -593,24 +598,24 @@ def __init__(self, speed: Speed) -> None: ) @cached_property - def tests(self) -> TestsWithRawResponse: - return TestsWithRawResponse(self._speed.tests) + def tests(self) -> TestsResourceWithRawResponse: + return TestsResourceWithRawResponse(self._speed.tests) @cached_property - def schedule(self) -> ScheduleWithRawResponse: - return ScheduleWithRawResponse(self._speed.schedule) + def schedule(self) -> ScheduleResourceWithRawResponse: + return ScheduleResourceWithRawResponse(self._speed.schedule) @cached_property - def availabilities(self) -> AvailabilitiesWithRawResponse: - return AvailabilitiesWithRawResponse(self._speed.availabilities) + def availabilities(self) -> AvailabilitiesResourceWithRawResponse: + return AvailabilitiesResourceWithRawResponse(self._speed.availabilities) @cached_property - def pages(self) -> PagesWithRawResponse: - return PagesWithRawResponse(self._speed.pages) + def pages(self) -> PagesResourceWithRawResponse: + return PagesResourceWithRawResponse(self._speed.pages) -class AsyncSpeedWithRawResponse: - def __init__(self, speed: AsyncSpeed) -> None: +class AsyncSpeedResourceWithRawResponse: + def __init__(self, speed: AsyncSpeedResource) -> None: self._speed = speed self.delete = async_to_raw_response_wrapper( @@ -624,24 +629,24 @@ def __init__(self, speed: AsyncSpeed) -> None: ) @cached_property - def tests(self) -> AsyncTestsWithRawResponse: - return AsyncTestsWithRawResponse(self._speed.tests) + def tests(self) -> AsyncTestsResourceWithRawResponse: + return AsyncTestsResourceWithRawResponse(self._speed.tests) @cached_property - def schedule(self) -> AsyncScheduleWithRawResponse: - return AsyncScheduleWithRawResponse(self._speed.schedule) + def schedule(self) -> AsyncScheduleResourceWithRawResponse: + return AsyncScheduleResourceWithRawResponse(self._speed.schedule) @cached_property - def availabilities(self) -> AsyncAvailabilitiesWithRawResponse: - return AsyncAvailabilitiesWithRawResponse(self._speed.availabilities) + def availabilities(self) -> AsyncAvailabilitiesResourceWithRawResponse: + return AsyncAvailabilitiesResourceWithRawResponse(self._speed.availabilities) @cached_property - def pages(self) -> AsyncPagesWithRawResponse: - return AsyncPagesWithRawResponse(self._speed.pages) + def pages(self) -> AsyncPagesResourceWithRawResponse: + return AsyncPagesResourceWithRawResponse(self._speed.pages) -class SpeedWithStreamingResponse: - def __init__(self, speed: Speed) -> None: +class SpeedResourceWithStreamingResponse: + def __init__(self, speed: SpeedResource) -> None: self._speed = speed self.delete = to_streamed_response_wrapper( @@ -655,24 +660,24 @@ def __init__(self, speed: Speed) -> None: ) @cached_property - def tests(self) -> TestsWithStreamingResponse: - return TestsWithStreamingResponse(self._speed.tests) + def tests(self) -> TestsResourceWithStreamingResponse: + return TestsResourceWithStreamingResponse(self._speed.tests) @cached_property - def schedule(self) -> ScheduleWithStreamingResponse: - return ScheduleWithStreamingResponse(self._speed.schedule) + def schedule(self) -> ScheduleResourceWithStreamingResponse: + return ScheduleResourceWithStreamingResponse(self._speed.schedule) @cached_property - def availabilities(self) -> AvailabilitiesWithStreamingResponse: - return AvailabilitiesWithStreamingResponse(self._speed.availabilities) + def availabilities(self) -> AvailabilitiesResourceWithStreamingResponse: + return AvailabilitiesResourceWithStreamingResponse(self._speed.availabilities) @cached_property - def pages(self) -> PagesWithStreamingResponse: - return PagesWithStreamingResponse(self._speed.pages) + def pages(self) -> PagesResourceWithStreamingResponse: + return PagesResourceWithStreamingResponse(self._speed.pages) -class AsyncSpeedWithStreamingResponse: - def __init__(self, speed: AsyncSpeed) -> None: +class AsyncSpeedResourceWithStreamingResponse: + def __init__(self, speed: AsyncSpeedResource) -> None: self._speed = speed self.delete = async_to_streamed_response_wrapper( @@ -686,17 +691,17 @@ def __init__(self, speed: AsyncSpeed) -> None: ) @cached_property - def tests(self) -> AsyncTestsWithStreamingResponse: - return AsyncTestsWithStreamingResponse(self._speed.tests) + def tests(self) -> AsyncTestsResourceWithStreamingResponse: + return AsyncTestsResourceWithStreamingResponse(self._speed.tests) @cached_property - def schedule(self) -> AsyncScheduleWithStreamingResponse: - return AsyncScheduleWithStreamingResponse(self._speed.schedule) + def schedule(self) -> AsyncScheduleResourceWithStreamingResponse: + return AsyncScheduleResourceWithStreamingResponse(self._speed.schedule) @cached_property - def availabilities(self) -> AsyncAvailabilitiesWithStreamingResponse: - return AsyncAvailabilitiesWithStreamingResponse(self._speed.availabilities) + def availabilities(self) -> AsyncAvailabilitiesResourceWithStreamingResponse: + return AsyncAvailabilitiesResourceWithStreamingResponse(self._speed.availabilities) @cached_property - def pages(self) -> AsyncPagesWithStreamingResponse: - return AsyncPagesWithStreamingResponse(self._speed.pages) + def pages(self) -> AsyncPagesResourceWithStreamingResponse: + return AsyncPagesResourceWithStreamingResponse(self._speed.pages) diff --git a/src/cloudflare/resources/speed/tests.py b/src/cloudflare/resources/speed/tests.py index 28407048caa..02a984f30a8 100644 --- a/src/cloudflare/resources/speed/tests.py +++ b/src/cloudflare/resources/speed/tests.py @@ -21,31 +21,27 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.speed import ( - TestListResponse, - TestDeleteResponse, - ObservatoryPageTest, - test_list_params, - test_create_params, - test_delete_params, -) +from ...types.speed import test_list_params, test_create_params, test_delete_params from ..._base_client import ( make_request_options, ) +from ...types.speed.test import Test +from ...types.speed.test_list_response import TestListResponse +from ...types.speed.test_delete_response import TestDeleteResponse -__all__ = ["Tests", "AsyncTests"] +__all__ = ["TestsResource", "AsyncTestsResource"] -class Tests(SyncAPIResource): +class TestsResource(SyncAPIResource): __test__ = False @cached_property - def with_raw_response(self) -> TestsWithRawResponse: - return TestsWithRawResponse(self) + def with_raw_response(self) -> TestsResourceWithRawResponse: + return TestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TestsWithStreamingResponse: - return TestsWithStreamingResponse(self) + def with_streaming_response(self) -> TestsResourceWithStreamingResponse: + return TestsResourceWithStreamingResponse(self) def create( self, @@ -82,7 +78,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatoryPageTest]: + ) -> Optional[Test]: """ Starts a test for a specific webpage, in a specific region. @@ -113,9 +109,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Test]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatoryPageTest]], ResultWrapper[ObservatoryPageTest]), + cast_to=cast(Type[Optional[Test]], ResultWrapper[Test]), ) def list( @@ -265,7 +261,7 @@ def delete( extra_body=extra_body, timeout=timeout, query=maybe_transform({"region": region}, test_delete_params.TestDeleteParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TestDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[TestDeleteResponse]], ResultWrapper[TestDeleteResponse]), ) @@ -282,7 +278,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatoryPageTest]: + ) -> Optional[Test]: """ Retrieves the result of a specific test. @@ -312,20 +308,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Test]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatoryPageTest]], ResultWrapper[ObservatoryPageTest]), + cast_to=cast(Type[Optional[Test]], ResultWrapper[Test]), ) -class AsyncTests(AsyncAPIResource): +class AsyncTestsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTestsWithRawResponse: - return AsyncTestsWithRawResponse(self) + def with_raw_response(self) -> AsyncTestsResourceWithRawResponse: + return AsyncTestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTestsWithStreamingResponse: - return AsyncTestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTestsResourceWithStreamingResponse: + return AsyncTestsResourceWithStreamingResponse(self) async def create( self, @@ -362,7 +358,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatoryPageTest]: + ) -> Optional[Test]: """ Starts a test for a specific webpage, in a specific region. @@ -393,9 +389,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Test]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatoryPageTest]], ResultWrapper[ObservatoryPageTest]), + cast_to=cast(Type[Optional[Test]], ResultWrapper[Test]), ) async def list( @@ -545,7 +541,7 @@ async def delete( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"region": region}, test_delete_params.TestDeleteParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TestDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[TestDeleteResponse]], ResultWrapper[TestDeleteResponse]), ) @@ -562,7 +558,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ObservatoryPageTest]: + ) -> Optional[Test]: """ Retrieves the result of a specific test. @@ -592,16 +588,16 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Test]]._unwrapper, ), - cast_to=cast(Type[Optional[ObservatoryPageTest]], ResultWrapper[ObservatoryPageTest]), + cast_to=cast(Type[Optional[Test]], ResultWrapper[Test]), ) -class TestsWithRawResponse: +class TestsResourceWithRawResponse: __test__ = False - def __init__(self, tests: Tests) -> None: + def __init__(self, tests: TestsResource) -> None: self._tests = tests self.create = to_raw_response_wrapper( @@ -618,8 +614,8 @@ def __init__(self, tests: Tests) -> None: ) -class AsyncTestsWithRawResponse: - def __init__(self, tests: AsyncTests) -> None: +class AsyncTestsResourceWithRawResponse: + def __init__(self, tests: AsyncTestsResource) -> None: self._tests = tests self.create = async_to_raw_response_wrapper( @@ -636,10 +632,10 @@ def __init__(self, tests: AsyncTests) -> None: ) -class TestsWithStreamingResponse: +class TestsResourceWithStreamingResponse: __test__ = False - def __init__(self, tests: Tests) -> None: + def __init__(self, tests: TestsResource) -> None: self._tests = tests self.create = to_streamed_response_wrapper( @@ -656,8 +652,8 @@ def __init__(self, tests: Tests) -> None: ) -class AsyncTestsWithStreamingResponse: - def __init__(self, tests: AsyncTests) -> None: +class AsyncTestsResourceWithStreamingResponse: + def __init__(self, tests: AsyncTestsResource) -> None: self._tests = tests self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/ssl/__init__.py b/src/cloudflare/resources/ssl/__init__.py index 3580c169d8a..59245e44dfb 100644 --- a/src/cloudflare/resources/ssl/__init__.py +++ b/src/cloudflare/resources/ssl/__init__.py @@ -1,89 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .ssl import ( - SSL, - AsyncSSL, - SSLWithRawResponse, - AsyncSSLWithRawResponse, - SSLWithStreamingResponse, - AsyncSSLWithStreamingResponse, + SSLResource, + AsyncSSLResource, + SSLResourceWithRawResponse, + AsyncSSLResourceWithRawResponse, + SSLResourceWithStreamingResponse, + AsyncSSLResourceWithStreamingResponse, ) from .analyze import ( - Analyze, - AsyncAnalyze, - AnalyzeWithRawResponse, - AsyncAnalyzeWithRawResponse, - AnalyzeWithStreamingResponse, - AsyncAnalyzeWithStreamingResponse, + AnalyzeResource, + AsyncAnalyzeResource, + AnalyzeResourceWithRawResponse, + AsyncAnalyzeResourceWithRawResponse, + AnalyzeResourceWithStreamingResponse, + AsyncAnalyzeResourceWithStreamingResponse, ) from .universal import ( - Universal, - AsyncUniversal, - UniversalWithRawResponse, - AsyncUniversalWithRawResponse, - UniversalWithStreamingResponse, - AsyncUniversalWithStreamingResponse, + UniversalResource, + AsyncUniversalResource, + UniversalResourceWithRawResponse, + AsyncUniversalResourceWithRawResponse, + UniversalResourceWithStreamingResponse, + AsyncUniversalResourceWithStreamingResponse, ) from .verification import ( - Verification, - AsyncVerification, - VerificationWithRawResponse, - AsyncVerificationWithRawResponse, - VerificationWithStreamingResponse, - AsyncVerificationWithStreamingResponse, + VerificationResource, + AsyncVerificationResource, + VerificationResourceWithRawResponse, + AsyncVerificationResourceWithRawResponse, + VerificationResourceWithStreamingResponse, + AsyncVerificationResourceWithStreamingResponse, ) from .recommendations import ( - Recommendations, - AsyncRecommendations, - RecommendationsWithRawResponse, - AsyncRecommendationsWithRawResponse, - RecommendationsWithStreamingResponse, - AsyncRecommendationsWithStreamingResponse, + RecommendationsResource, + AsyncRecommendationsResource, + RecommendationsResourceWithRawResponse, + AsyncRecommendationsResourceWithRawResponse, + RecommendationsResourceWithStreamingResponse, + AsyncRecommendationsResourceWithStreamingResponse, ) from .certificate_packs import ( - CertificatePacks, - AsyncCertificatePacks, - CertificatePacksWithRawResponse, - AsyncCertificatePacksWithRawResponse, - CertificatePacksWithStreamingResponse, - AsyncCertificatePacksWithStreamingResponse, + CertificatePacksResource, + AsyncCertificatePacksResource, + CertificatePacksResourceWithRawResponse, + AsyncCertificatePacksResourceWithRawResponse, + CertificatePacksResourceWithStreamingResponse, + AsyncCertificatePacksResourceWithStreamingResponse, ) __all__ = [ - "Analyze", - "AsyncAnalyze", - "AnalyzeWithRawResponse", - "AsyncAnalyzeWithRawResponse", - "AnalyzeWithStreamingResponse", - "AsyncAnalyzeWithStreamingResponse", - "CertificatePacks", - "AsyncCertificatePacks", - "CertificatePacksWithRawResponse", - "AsyncCertificatePacksWithRawResponse", - "CertificatePacksWithStreamingResponse", - "AsyncCertificatePacksWithStreamingResponse", - "Recommendations", - "AsyncRecommendations", - "RecommendationsWithRawResponse", - "AsyncRecommendationsWithRawResponse", - "RecommendationsWithStreamingResponse", - "AsyncRecommendationsWithStreamingResponse", - "Universal", - "AsyncUniversal", - "UniversalWithRawResponse", - "AsyncUniversalWithRawResponse", - "UniversalWithStreamingResponse", - "AsyncUniversalWithStreamingResponse", - "Verification", - "AsyncVerification", - "VerificationWithRawResponse", - "AsyncVerificationWithRawResponse", - "VerificationWithStreamingResponse", - "AsyncVerificationWithStreamingResponse", - "SSL", - "AsyncSSL", - "SSLWithRawResponse", - "AsyncSSLWithRawResponse", - "SSLWithStreamingResponse", - "AsyncSSLWithStreamingResponse", + "AnalyzeResource", + "AsyncAnalyzeResource", + "AnalyzeResourceWithRawResponse", + "AsyncAnalyzeResourceWithRawResponse", + "AnalyzeResourceWithStreamingResponse", + "AsyncAnalyzeResourceWithStreamingResponse", + "CertificatePacksResource", + "AsyncCertificatePacksResource", + "CertificatePacksResourceWithRawResponse", + "AsyncCertificatePacksResourceWithRawResponse", + "CertificatePacksResourceWithStreamingResponse", + "AsyncCertificatePacksResourceWithStreamingResponse", + "RecommendationsResource", + "AsyncRecommendationsResource", + "RecommendationsResourceWithRawResponse", + "AsyncRecommendationsResourceWithRawResponse", + "RecommendationsResourceWithStreamingResponse", + "AsyncRecommendationsResourceWithStreamingResponse", + "UniversalResource", + "AsyncUniversalResource", + "UniversalResourceWithRawResponse", + "AsyncUniversalResourceWithRawResponse", + "UniversalResourceWithStreamingResponse", + "AsyncUniversalResourceWithStreamingResponse", + "VerificationResource", + "AsyncVerificationResource", + "VerificationResourceWithRawResponse", + "AsyncVerificationResourceWithRawResponse", + "VerificationResourceWithStreamingResponse", + "AsyncVerificationResourceWithStreamingResponse", + "SSLResource", + "AsyncSSLResource", + "SSLResourceWithRawResponse", + "AsyncSSLResourceWithRawResponse", + "SSLResourceWithStreamingResponse", + "AsyncSSLResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/ssl/analyze.py b/src/cloudflare/resources/ssl/analyze.py index 15bf18adf51..12396528143 100644 --- a/src/cloudflare/resources/ssl/analyze.py +++ b/src/cloudflare/resources/ssl/analyze.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import Any, cast -from typing_extensions import Literal import httpx @@ -21,28 +20,31 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.ssl import AnalyzeCreateResponse, analyze_create_params +from ...types.ssl import analyze_create_params from ..._base_client import ( make_request_options, ) +from ...types.custom_hostnames import BundleMethod +from ...types.ssl.analyze_create_response import AnalyzeCreateResponse +from ...types.custom_hostnames.bundle_method import BundleMethod -__all__ = ["Analyze", "AsyncAnalyze"] +__all__ = ["AnalyzeResource", "AsyncAnalyzeResource"] -class Analyze(SyncAPIResource): +class AnalyzeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AnalyzeWithRawResponse: - return AnalyzeWithRawResponse(self) + def with_raw_response(self) -> AnalyzeResourceWithRawResponse: + return AnalyzeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AnalyzeWithStreamingResponse: - return AnalyzeWithStreamingResponse(self) + def with_streaming_response(self) -> AnalyzeResourceWithStreamingResponse: + return AnalyzeResourceWithStreamingResponse(self) def create( self, *, zone_id: str, - bundle_method: Literal["ubiquitous", "optimal", "force"] | NotGiven = NOT_GIVEN, + bundle_method: BundleMethod | NotGiven = NOT_GIVEN, certificate: 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. @@ -91,7 +93,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AnalyzeCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AnalyzeCreateResponse] @@ -100,20 +102,20 @@ def create( ) -class AsyncAnalyze(AsyncAPIResource): +class AsyncAnalyzeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAnalyzeWithRawResponse: - return AsyncAnalyzeWithRawResponse(self) + def with_raw_response(self) -> AsyncAnalyzeResourceWithRawResponse: + return AsyncAnalyzeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAnalyzeWithStreamingResponse: - return AsyncAnalyzeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAnalyzeResourceWithStreamingResponse: + return AsyncAnalyzeResourceWithStreamingResponse(self) async def create( self, *, zone_id: str, - bundle_method: Literal["ubiquitous", "optimal", "force"] | NotGiven = NOT_GIVEN, + bundle_method: BundleMethod | NotGiven = NOT_GIVEN, certificate: 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. @@ -162,7 +164,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[AnalyzeCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AnalyzeCreateResponse] @@ -171,8 +173,8 @@ async def create( ) -class AnalyzeWithRawResponse: - def __init__(self, analyze: Analyze) -> None: +class AnalyzeResourceWithRawResponse: + def __init__(self, analyze: AnalyzeResource) -> None: self._analyze = analyze self.create = to_raw_response_wrapper( @@ -180,8 +182,8 @@ def __init__(self, analyze: Analyze) -> None: ) -class AsyncAnalyzeWithRawResponse: - def __init__(self, analyze: AsyncAnalyze) -> None: +class AsyncAnalyzeResourceWithRawResponse: + def __init__(self, analyze: AsyncAnalyzeResource) -> None: self._analyze = analyze self.create = async_to_raw_response_wrapper( @@ -189,8 +191,8 @@ def __init__(self, analyze: AsyncAnalyze) -> None: ) -class AnalyzeWithStreamingResponse: - def __init__(self, analyze: Analyze) -> None: +class AnalyzeResourceWithStreamingResponse: + def __init__(self, analyze: AnalyzeResource) -> None: self._analyze = analyze self.create = to_streamed_response_wrapper( @@ -198,8 +200,8 @@ def __init__(self, analyze: Analyze) -> None: ) -class AsyncAnalyzeWithStreamingResponse: - def __init__(self, analyze: AsyncAnalyze) -> None: +class AsyncAnalyzeResourceWithStreamingResponse: + def __init__(self, analyze: AsyncAnalyzeResource) -> None: self._analyze = analyze self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/ssl/certificate_packs/__init__.py b/src/cloudflare/resources/ssl/certificate_packs/__init__.py index b361a636131..ebed46ba670 100644 --- a/src/cloudflare/resources/ssl/certificate_packs/__init__.py +++ b/src/cloudflare/resources/ssl/certificate_packs/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .order import ( - Order, - AsyncOrder, - OrderWithRawResponse, - AsyncOrderWithRawResponse, - OrderWithStreamingResponse, - AsyncOrderWithStreamingResponse, + OrderResource, + AsyncOrderResource, + OrderResourceWithRawResponse, + AsyncOrderResourceWithRawResponse, + OrderResourceWithStreamingResponse, + AsyncOrderResourceWithStreamingResponse, ) from .quota import ( - Quota, - AsyncQuota, - QuotaWithRawResponse, - AsyncQuotaWithRawResponse, - QuotaWithStreamingResponse, - AsyncQuotaWithStreamingResponse, + QuotaResource, + AsyncQuotaResource, + QuotaResourceWithRawResponse, + AsyncQuotaResourceWithRawResponse, + QuotaResourceWithStreamingResponse, + AsyncQuotaResourceWithStreamingResponse, ) from .certificate_packs import ( - CertificatePacks, - AsyncCertificatePacks, - CertificatePacksWithRawResponse, - AsyncCertificatePacksWithRawResponse, - CertificatePacksWithStreamingResponse, - AsyncCertificatePacksWithStreamingResponse, + CertificatePacksResource, + AsyncCertificatePacksResource, + CertificatePacksResourceWithRawResponse, + AsyncCertificatePacksResourceWithRawResponse, + CertificatePacksResourceWithStreamingResponse, + AsyncCertificatePacksResourceWithStreamingResponse, ) __all__ = [ - "Order", - "AsyncOrder", - "OrderWithRawResponse", - "AsyncOrderWithRawResponse", - "OrderWithStreamingResponse", - "AsyncOrderWithStreamingResponse", - "Quota", - "AsyncQuota", - "QuotaWithRawResponse", - "AsyncQuotaWithRawResponse", - "QuotaWithStreamingResponse", - "AsyncQuotaWithStreamingResponse", - "CertificatePacks", - "AsyncCertificatePacks", - "CertificatePacksWithRawResponse", - "AsyncCertificatePacksWithRawResponse", - "CertificatePacksWithStreamingResponse", - "AsyncCertificatePacksWithStreamingResponse", + "OrderResource", + "AsyncOrderResource", + "OrderResourceWithRawResponse", + "AsyncOrderResourceWithRawResponse", + "OrderResourceWithStreamingResponse", + "AsyncOrderResourceWithStreamingResponse", + "QuotaResource", + "AsyncQuotaResource", + "QuotaResourceWithRawResponse", + "AsyncQuotaResourceWithRawResponse", + "QuotaResourceWithStreamingResponse", + "AsyncQuotaResourceWithStreamingResponse", + "CertificatePacksResource", + "AsyncCertificatePacksResource", + "CertificatePacksResourceWithRawResponse", + "AsyncCertificatePacksResourceWithRawResponse", + "CertificatePacksResourceWithStreamingResponse", + "AsyncCertificatePacksResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/ssl/certificate_packs/certificate_packs.py b/src/cloudflare/resources/ssl/certificate_packs/certificate_packs.py index f13bf748f95..895db8720e1 100644 --- a/src/cloudflare/resources/ssl/certificate_packs/certificate_packs.py +++ b/src/cloudflare/resources/ssl/certificate_packs/certificate_packs.py @@ -8,23 +8,26 @@ import httpx from .order import ( - Order, - AsyncOrder, - OrderWithRawResponse, - AsyncOrderWithRawResponse, - OrderWithStreamingResponse, - AsyncOrderWithStreamingResponse, + OrderResource, + AsyncOrderResource, + OrderResourceWithRawResponse, + AsyncOrderResourceWithRawResponse, + OrderResourceWithStreamingResponse, + AsyncOrderResourceWithStreamingResponse, ) from .quota import ( - Quota, - AsyncQuota, - QuotaWithRawResponse, - AsyncQuotaWithRawResponse, - QuotaWithStreamingResponse, - AsyncQuotaWithStreamingResponse, + QuotaResource, + AsyncQuotaResource, + QuotaResourceWithRawResponse, + AsyncQuotaResourceWithRawResponse, + QuotaResourceWithStreamingResponse, + AsyncQuotaResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import maybe_transform +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -34,37 +37,35 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.ssl import ( - CertificatePackGetResponse, - CertificatePackEditResponse, - CertificatePackDeleteResponse, - certificate_pack_list_params, -) +from ....types.ssl import certificate_pack_edit_params, certificate_pack_list_params, certificate_pack_delete_params from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( AsyncPaginator, make_request_options, ) +from ....types.ssl.certificate_pack_get_response import CertificatePackGetResponse +from ....types.ssl.certificate_pack_edit_response import CertificatePackEditResponse +from ....types.ssl.certificate_pack_delete_response import CertificatePackDeleteResponse -__all__ = ["CertificatePacks", "AsyncCertificatePacks"] +__all__ = ["CertificatePacksResource", "AsyncCertificatePacksResource"] -class CertificatePacks(SyncAPIResource): +class CertificatePacksResource(SyncAPIResource): @cached_property - def order(self) -> Order: - return Order(self._client) + def order(self) -> OrderResource: + return OrderResource(self._client) @cached_property - def quota(self) -> Quota: - return Quota(self._client) + def quota(self) -> QuotaResource: + return QuotaResource(self._client) @cached_property - def with_raw_response(self) -> CertificatePacksWithRawResponse: - return CertificatePacksWithRawResponse(self) + def with_raw_response(self) -> CertificatePacksResourceWithRawResponse: + return CertificatePacksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CertificatePacksWithStreamingResponse: - return CertificatePacksWithStreamingResponse(self) + def with_streaming_response(self) -> CertificatePacksResourceWithStreamingResponse: + return CertificatePacksResourceWithStreamingResponse(self) def list( self, @@ -114,6 +115,7 @@ def delete( certificate_pack_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -145,12 +147,13 @@ def delete( ) return self._delete( f"/zones/{zone_id}/ssl/certificate_packs/{certificate_pack_id}", + body=maybe_transform(body, certificate_pack_delete_params.CertificatePackDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificatePackDeleteResponse]._unwrapper, ), cast_to=cast(Type[CertificatePackDeleteResponse], ResultWrapper[CertificatePackDeleteResponse]), ) @@ -160,6 +163,7 @@ def edit( certificate_pack_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -194,12 +198,13 @@ def edit( ) return self._patch( f"/zones/{zone_id}/ssl/certificate_packs/{certificate_pack_id}", + body=maybe_transform(body, certificate_pack_edit_params.CertificatePackEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificatePackEditResponse]._unwrapper, ), cast_to=cast(Type[CertificatePackEditResponse], ResultWrapper[CertificatePackEditResponse]), ) @@ -247,7 +252,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificatePackGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificatePackGetResponse] @@ -256,22 +261,22 @@ def get( ) -class AsyncCertificatePacks(AsyncAPIResource): +class AsyncCertificatePacksResource(AsyncAPIResource): @cached_property - def order(self) -> AsyncOrder: - return AsyncOrder(self._client) + def order(self) -> AsyncOrderResource: + return AsyncOrderResource(self._client) @cached_property - def quota(self) -> AsyncQuota: - return AsyncQuota(self._client) + def quota(self) -> AsyncQuotaResource: + return AsyncQuotaResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCertificatePacksWithRawResponse: - return AsyncCertificatePacksWithRawResponse(self) + def with_raw_response(self) -> AsyncCertificatePacksResourceWithRawResponse: + return AsyncCertificatePacksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCertificatePacksWithStreamingResponse: - return AsyncCertificatePacksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCertificatePacksResourceWithStreamingResponse: + return AsyncCertificatePacksResourceWithStreamingResponse(self) def list( self, @@ -321,6 +326,7 @@ async def delete( certificate_pack_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +358,13 @@ async def delete( ) return await self._delete( f"/zones/{zone_id}/ssl/certificate_packs/{certificate_pack_id}", + body=await async_maybe_transform(body, certificate_pack_delete_params.CertificatePackDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificatePackDeleteResponse]._unwrapper, ), cast_to=cast(Type[CertificatePackDeleteResponse], ResultWrapper[CertificatePackDeleteResponse]), ) @@ -367,6 +374,7 @@ async def edit( certificate_pack_id: str, *, zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -401,12 +409,13 @@ async def edit( ) return await self._patch( f"/zones/{zone_id}/ssl/certificate_packs/{certificate_pack_id}", + body=await async_maybe_transform(body, certificate_pack_edit_params.CertificatePackEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificatePackEditResponse]._unwrapper, ), cast_to=cast(Type[CertificatePackEditResponse], ResultWrapper[CertificatePackEditResponse]), ) @@ -454,7 +463,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CertificatePackGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificatePackGetResponse] @@ -463,8 +472,8 @@ async def get( ) -class CertificatePacksWithRawResponse: - def __init__(self, certificate_packs: CertificatePacks) -> None: +class CertificatePacksResourceWithRawResponse: + def __init__(self, certificate_packs: CertificatePacksResource) -> None: self._certificate_packs = certificate_packs self.list = to_raw_response_wrapper( @@ -481,16 +490,16 @@ def __init__(self, certificate_packs: CertificatePacks) -> None: ) @cached_property - def order(self) -> OrderWithRawResponse: - return OrderWithRawResponse(self._certificate_packs.order) + def order(self) -> OrderResourceWithRawResponse: + return OrderResourceWithRawResponse(self._certificate_packs.order) @cached_property - def quota(self) -> QuotaWithRawResponse: - return QuotaWithRawResponse(self._certificate_packs.quota) + def quota(self) -> QuotaResourceWithRawResponse: + return QuotaResourceWithRawResponse(self._certificate_packs.quota) -class AsyncCertificatePacksWithRawResponse: - def __init__(self, certificate_packs: AsyncCertificatePacks) -> None: +class AsyncCertificatePacksResourceWithRawResponse: + def __init__(self, certificate_packs: AsyncCertificatePacksResource) -> None: self._certificate_packs = certificate_packs self.list = async_to_raw_response_wrapper( @@ -507,16 +516,16 @@ def __init__(self, certificate_packs: AsyncCertificatePacks) -> None: ) @cached_property - def order(self) -> AsyncOrderWithRawResponse: - return AsyncOrderWithRawResponse(self._certificate_packs.order) + def order(self) -> AsyncOrderResourceWithRawResponse: + return AsyncOrderResourceWithRawResponse(self._certificate_packs.order) @cached_property - def quota(self) -> AsyncQuotaWithRawResponse: - return AsyncQuotaWithRawResponse(self._certificate_packs.quota) + def quota(self) -> AsyncQuotaResourceWithRawResponse: + return AsyncQuotaResourceWithRawResponse(self._certificate_packs.quota) -class CertificatePacksWithStreamingResponse: - def __init__(self, certificate_packs: CertificatePacks) -> None: +class CertificatePacksResourceWithStreamingResponse: + def __init__(self, certificate_packs: CertificatePacksResource) -> None: self._certificate_packs = certificate_packs self.list = to_streamed_response_wrapper( @@ -533,16 +542,16 @@ def __init__(self, certificate_packs: CertificatePacks) -> None: ) @cached_property - def order(self) -> OrderWithStreamingResponse: - return OrderWithStreamingResponse(self._certificate_packs.order) + def order(self) -> OrderResourceWithStreamingResponse: + return OrderResourceWithStreamingResponse(self._certificate_packs.order) @cached_property - def quota(self) -> QuotaWithStreamingResponse: - return QuotaWithStreamingResponse(self._certificate_packs.quota) + def quota(self) -> QuotaResourceWithStreamingResponse: + return QuotaResourceWithStreamingResponse(self._certificate_packs.quota) -class AsyncCertificatePacksWithStreamingResponse: - def __init__(self, certificate_packs: AsyncCertificatePacks) -> None: +class AsyncCertificatePacksResourceWithStreamingResponse: + def __init__(self, certificate_packs: AsyncCertificatePacksResource) -> None: self._certificate_packs = certificate_packs self.list = async_to_streamed_response_wrapper( @@ -559,9 +568,9 @@ def __init__(self, certificate_packs: AsyncCertificatePacks) -> None: ) @cached_property - def order(self) -> AsyncOrderWithStreamingResponse: - return AsyncOrderWithStreamingResponse(self._certificate_packs.order) + def order(self) -> AsyncOrderResourceWithStreamingResponse: + return AsyncOrderResourceWithStreamingResponse(self._certificate_packs.order) @cached_property - def quota(self) -> AsyncQuotaWithStreamingResponse: - return AsyncQuotaWithStreamingResponse(self._certificate_packs.quota) + def quota(self) -> AsyncQuotaResourceWithStreamingResponse: + return AsyncQuotaResourceWithStreamingResponse(self._certificate_packs.quota) diff --git a/src/cloudflare/resources/ssl/certificate_packs/order.py b/src/cloudflare/resources/ssl/certificate_packs/order.py index cf95650eeae..05885aa8747 100644 --- a/src/cloudflare/resources/ssl/certificate_packs/order.py +++ b/src/cloudflare/resources/ssl/certificate_packs/order.py @@ -24,26 +24,28 @@ from ...._base_client import ( make_request_options, ) -from ....types.ssl.certificate_packs import OrderCreateResponse, order_create_params +from ....types.ssl.host import Host +from ....types.ssl.certificate_packs import order_create_params +from ....types.ssl.certificate_packs.order_create_response import OrderCreateResponse -__all__ = ["Order", "AsyncOrder"] +__all__ = ["OrderResource", "AsyncOrderResource"] -class Order(SyncAPIResource): +class OrderResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OrderWithRawResponse: - return OrderWithRawResponse(self) + def with_raw_response(self) -> OrderResourceWithRawResponse: + return OrderResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OrderWithStreamingResponse: - return OrderWithStreamingResponse(self) + def with_streaming_response(self) -> OrderResourceWithStreamingResponse: + return OrderResourceWithStreamingResponse(self) def create( self, *, zone_id: str, certificate_authority: Literal["google", "lets_encrypt"], - hosts: List[str], + hosts: List[Host], type: Literal["advanced"], validation_method: Literal["txt", "http", "email"], validity_days: Literal[14, 30, 90, 365], @@ -105,27 +107,27 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OrderCreateResponse]._unwrapper, ), cast_to=cast(Type[OrderCreateResponse], ResultWrapper[OrderCreateResponse]), ) -class AsyncOrder(AsyncAPIResource): +class AsyncOrderResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOrderWithRawResponse: - return AsyncOrderWithRawResponse(self) + def with_raw_response(self) -> AsyncOrderResourceWithRawResponse: + return AsyncOrderResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOrderWithStreamingResponse: - return AsyncOrderWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOrderResourceWithStreamingResponse: + return AsyncOrderResourceWithStreamingResponse(self) async def create( self, *, zone_id: str, certificate_authority: Literal["google", "lets_encrypt"], - hosts: List[str], + hosts: List[Host], type: Literal["advanced"], validation_method: Literal["txt", "http", "email"], validity_days: Literal[14, 30, 90, 365], @@ -187,14 +189,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OrderCreateResponse]._unwrapper, ), cast_to=cast(Type[OrderCreateResponse], ResultWrapper[OrderCreateResponse]), ) -class OrderWithRawResponse: - def __init__(self, order: Order) -> None: +class OrderResourceWithRawResponse: + def __init__(self, order: OrderResource) -> None: self._order = order self.create = to_raw_response_wrapper( @@ -202,8 +204,8 @@ def __init__(self, order: Order) -> None: ) -class AsyncOrderWithRawResponse: - def __init__(self, order: AsyncOrder) -> None: +class AsyncOrderResourceWithRawResponse: + def __init__(self, order: AsyncOrderResource) -> None: self._order = order self.create = async_to_raw_response_wrapper( @@ -211,8 +213,8 @@ def __init__(self, order: AsyncOrder) -> None: ) -class OrderWithStreamingResponse: - def __init__(self, order: Order) -> None: +class OrderResourceWithStreamingResponse: + def __init__(self, order: OrderResource) -> None: self._order = order self.create = to_streamed_response_wrapper( @@ -220,8 +222,8 @@ def __init__(self, order: Order) -> None: ) -class AsyncOrderWithStreamingResponse: - def __init__(self, order: AsyncOrder) -> None: +class AsyncOrderResourceWithStreamingResponse: + def __init__(self, order: AsyncOrderResource) -> None: self._order = order self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/ssl/certificate_packs/quota.py b/src/cloudflare/resources/ssl/certificate_packs/quota.py index aaa69e82c97..33bd534e992 100644 --- a/src/cloudflare/resources/ssl/certificate_packs/quota.py +++ b/src/cloudflare/resources/ssl/certificate_packs/quota.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.ssl.certificate_packs import QuotaGetResponse +from ....types.ssl.certificate_packs.quota_get_response import QuotaGetResponse -__all__ = ["Quota", "AsyncQuota"] +__all__ = ["QuotaResource", "AsyncQuotaResource"] -class Quota(SyncAPIResource): +class QuotaResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> QuotaWithRawResponse: - return QuotaWithRawResponse(self) + def with_raw_response(self) -> QuotaResourceWithRawResponse: + return QuotaResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> QuotaWithStreamingResponse: - return QuotaWithStreamingResponse(self) + def with_streaming_response(self) -> QuotaResourceWithStreamingResponse: + return QuotaResourceWithStreamingResponse(self) def get( self, @@ -67,20 +67,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[QuotaGetResponse]._unwrapper, ), cast_to=cast(Type[QuotaGetResponse], ResultWrapper[QuotaGetResponse]), ) -class AsyncQuota(AsyncAPIResource): +class AsyncQuotaResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncQuotaWithRawResponse: - return AsyncQuotaWithRawResponse(self) + def with_raw_response(self) -> AsyncQuotaResourceWithRawResponse: + return AsyncQuotaResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncQuotaWithStreamingResponse: - return AsyncQuotaWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncQuotaResourceWithStreamingResponse: + return AsyncQuotaResourceWithStreamingResponse(self) async def get( self, @@ -116,14 +116,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[QuotaGetResponse]._unwrapper, ), cast_to=cast(Type[QuotaGetResponse], ResultWrapper[QuotaGetResponse]), ) -class QuotaWithRawResponse: - def __init__(self, quota: Quota) -> None: +class QuotaResourceWithRawResponse: + def __init__(self, quota: QuotaResource) -> None: self._quota = quota self.get = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, quota: Quota) -> None: ) -class AsyncQuotaWithRawResponse: - def __init__(self, quota: AsyncQuota) -> None: +class AsyncQuotaResourceWithRawResponse: + def __init__(self, quota: AsyncQuotaResource) -> None: self._quota = quota self.get = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, quota: AsyncQuota) -> None: ) -class QuotaWithStreamingResponse: - def __init__(self, quota: Quota) -> None: +class QuotaResourceWithStreamingResponse: + def __init__(self, quota: QuotaResource) -> None: self._quota = quota self.get = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, quota: Quota) -> None: ) -class AsyncQuotaWithStreamingResponse: - def __init__(self, quota: AsyncQuota) -> None: +class AsyncQuotaResourceWithStreamingResponse: + def __init__(self, quota: AsyncQuotaResource) -> None: self._quota = quota self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/ssl/recommendations.py b/src/cloudflare/resources/ssl/recommendations.py index ad23e15c9a8..c94199658f6 100644 --- a/src/cloudflare/resources/ssl/recommendations.py +++ b/src/cloudflare/resources/ssl/recommendations.py @@ -16,22 +16,22 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.ssl import RecommendationGetResponse from ..._base_client import ( make_request_options, ) +from ...types.ssl.recommendation_get_response import RecommendationGetResponse -__all__ = ["Recommendations", "AsyncRecommendations"] +__all__ = ["RecommendationsResource", "AsyncRecommendationsResource"] -class Recommendations(SyncAPIResource): +class RecommendationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RecommendationsWithRawResponse: - return RecommendationsWithRawResponse(self) + def with_raw_response(self) -> RecommendationsResourceWithRawResponse: + return RecommendationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RecommendationsWithStreamingResponse: - return RecommendationsWithStreamingResponse(self) + def with_streaming_response(self) -> RecommendationsResourceWithStreamingResponse: + return RecommendationsResourceWithStreamingResponse(self) def get( self, @@ -67,20 +67,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RecommendationGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RecommendationGetResponse]], ResultWrapper[RecommendationGetResponse]), ) -class AsyncRecommendations(AsyncAPIResource): +class AsyncRecommendationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRecommendationsWithRawResponse: - return AsyncRecommendationsWithRawResponse(self) + def with_raw_response(self) -> AsyncRecommendationsResourceWithRawResponse: + return AsyncRecommendationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRecommendationsWithStreamingResponse: - return AsyncRecommendationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRecommendationsResourceWithStreamingResponse: + return AsyncRecommendationsResourceWithStreamingResponse(self) async def get( self, @@ -116,14 +116,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RecommendationGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RecommendationGetResponse]], ResultWrapper[RecommendationGetResponse]), ) -class RecommendationsWithRawResponse: - def __init__(self, recommendations: Recommendations) -> None: +class RecommendationsResourceWithRawResponse: + def __init__(self, recommendations: RecommendationsResource) -> None: self._recommendations = recommendations self.get = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, recommendations: Recommendations) -> None: ) -class AsyncRecommendationsWithRawResponse: - def __init__(self, recommendations: AsyncRecommendations) -> None: +class AsyncRecommendationsResourceWithRawResponse: + def __init__(self, recommendations: AsyncRecommendationsResource) -> None: self._recommendations = recommendations self.get = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, recommendations: AsyncRecommendations) -> None: ) -class RecommendationsWithStreamingResponse: - def __init__(self, recommendations: Recommendations) -> None: +class RecommendationsResourceWithStreamingResponse: + def __init__(self, recommendations: RecommendationsResource) -> None: self._recommendations = recommendations self.get = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, recommendations: Recommendations) -> None: ) -class AsyncRecommendationsWithStreamingResponse: - def __init__(self, recommendations: AsyncRecommendations) -> None: +class AsyncRecommendationsResourceWithStreamingResponse: + def __init__(self, recommendations: AsyncRecommendationsResource) -> None: self._recommendations = recommendations self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/ssl/ssl.py b/src/cloudflare/resources/ssl/ssl.py index ea4a1e5d7a4..45302ec7bf7 100644 --- a/src/cloudflare/resources/ssl/ssl.py +++ b/src/cloudflare/resources/ssl/ssl.py @@ -3,208 +3,208 @@ from __future__ import annotations from .analyze import ( - Analyze, - AsyncAnalyze, - AnalyzeWithRawResponse, - AsyncAnalyzeWithRawResponse, - AnalyzeWithStreamingResponse, - AsyncAnalyzeWithStreamingResponse, + AnalyzeResource, + AsyncAnalyzeResource, + AnalyzeResourceWithRawResponse, + AsyncAnalyzeResourceWithRawResponse, + AnalyzeResourceWithStreamingResponse, + AsyncAnalyzeResourceWithStreamingResponse, ) from ..._compat import cached_property from .universal import ( - Universal, - AsyncUniversal, - UniversalWithRawResponse, - AsyncUniversalWithRawResponse, - UniversalWithStreamingResponse, - AsyncUniversalWithStreamingResponse, + UniversalResource, + AsyncUniversalResource, + UniversalResourceWithRawResponse, + AsyncUniversalResourceWithRawResponse, + UniversalResourceWithStreamingResponse, + AsyncUniversalResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from .verification import ( - Verification, - AsyncVerification, - VerificationWithRawResponse, - AsyncVerificationWithRawResponse, - VerificationWithStreamingResponse, - AsyncVerificationWithStreamingResponse, + VerificationResource, + AsyncVerificationResource, + VerificationResourceWithRawResponse, + AsyncVerificationResourceWithRawResponse, + VerificationResourceWithStreamingResponse, + AsyncVerificationResourceWithStreamingResponse, ) from .recommendations import ( - Recommendations, - AsyncRecommendations, - RecommendationsWithRawResponse, - AsyncRecommendationsWithRawResponse, - RecommendationsWithStreamingResponse, - AsyncRecommendationsWithStreamingResponse, + RecommendationsResource, + AsyncRecommendationsResource, + RecommendationsResourceWithRawResponse, + AsyncRecommendationsResourceWithRawResponse, + RecommendationsResourceWithStreamingResponse, + AsyncRecommendationsResourceWithStreamingResponse, ) from .certificate_packs import ( - CertificatePacks, - AsyncCertificatePacks, - CertificatePacksWithRawResponse, - AsyncCertificatePacksWithRawResponse, - CertificatePacksWithStreamingResponse, - AsyncCertificatePacksWithStreamingResponse, + CertificatePacksResource, + AsyncCertificatePacksResource, + CertificatePacksResourceWithRawResponse, + AsyncCertificatePacksResourceWithRawResponse, + CertificatePacksResourceWithStreamingResponse, + AsyncCertificatePacksResourceWithStreamingResponse, ) -from .universal.universal import Universal, AsyncUniversal -from .certificate_packs.certificate_packs import CertificatePacks, AsyncCertificatePacks +from .universal.universal import UniversalResource, AsyncUniversalResource +from .certificate_packs.certificate_packs import CertificatePacksResource, AsyncCertificatePacksResource -__all__ = ["SSL", "AsyncSSL"] +__all__ = ["SSLResource", "AsyncSSLResource"] -class SSL(SyncAPIResource): +class SSLResource(SyncAPIResource): @cached_property - def analyze(self) -> Analyze: - return Analyze(self._client) + def analyze(self) -> AnalyzeResource: + return AnalyzeResource(self._client) @cached_property - def certificate_packs(self) -> CertificatePacks: - return CertificatePacks(self._client) + def certificate_packs(self) -> CertificatePacksResource: + return CertificatePacksResource(self._client) @cached_property - def recommendations(self) -> Recommendations: - return Recommendations(self._client) + def recommendations(self) -> RecommendationsResource: + return RecommendationsResource(self._client) @cached_property - def universal(self) -> Universal: - return Universal(self._client) + def universal(self) -> UniversalResource: + return UniversalResource(self._client) @cached_property - def verification(self) -> Verification: - return Verification(self._client) + def verification(self) -> VerificationResource: + return VerificationResource(self._client) @cached_property - def with_raw_response(self) -> SSLWithRawResponse: - return SSLWithRawResponse(self) + def with_raw_response(self) -> SSLResourceWithRawResponse: + return SSLResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SSLWithStreamingResponse: - return SSLWithStreamingResponse(self) + def with_streaming_response(self) -> SSLResourceWithStreamingResponse: + return SSLResourceWithStreamingResponse(self) -class AsyncSSL(AsyncAPIResource): +class AsyncSSLResource(AsyncAPIResource): @cached_property - def analyze(self) -> AsyncAnalyze: - return AsyncAnalyze(self._client) + def analyze(self) -> AsyncAnalyzeResource: + return AsyncAnalyzeResource(self._client) @cached_property - def certificate_packs(self) -> AsyncCertificatePacks: - return AsyncCertificatePacks(self._client) + def certificate_packs(self) -> AsyncCertificatePacksResource: + return AsyncCertificatePacksResource(self._client) @cached_property - def recommendations(self) -> AsyncRecommendations: - return AsyncRecommendations(self._client) + def recommendations(self) -> AsyncRecommendationsResource: + return AsyncRecommendationsResource(self._client) @cached_property - def universal(self) -> AsyncUniversal: - return AsyncUniversal(self._client) + def universal(self) -> AsyncUniversalResource: + return AsyncUniversalResource(self._client) @cached_property - def verification(self) -> AsyncVerification: - return AsyncVerification(self._client) + def verification(self) -> AsyncVerificationResource: + return AsyncVerificationResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSSLWithRawResponse: - return AsyncSSLWithRawResponse(self) + def with_raw_response(self) -> AsyncSSLResourceWithRawResponse: + return AsyncSSLResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSSLWithStreamingResponse: - return AsyncSSLWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSSLResourceWithStreamingResponse: + return AsyncSSLResourceWithStreamingResponse(self) -class SSLWithRawResponse: - def __init__(self, ssl: SSL) -> None: +class SSLResourceWithRawResponse: + def __init__(self, ssl: SSLResource) -> None: self._ssl = ssl @cached_property - def analyze(self) -> AnalyzeWithRawResponse: - return AnalyzeWithRawResponse(self._ssl.analyze) + def analyze(self) -> AnalyzeResourceWithRawResponse: + return AnalyzeResourceWithRawResponse(self._ssl.analyze) @cached_property - def certificate_packs(self) -> CertificatePacksWithRawResponse: - return CertificatePacksWithRawResponse(self._ssl.certificate_packs) + def certificate_packs(self) -> CertificatePacksResourceWithRawResponse: + return CertificatePacksResourceWithRawResponse(self._ssl.certificate_packs) @cached_property - def recommendations(self) -> RecommendationsWithRawResponse: - return RecommendationsWithRawResponse(self._ssl.recommendations) + def recommendations(self) -> RecommendationsResourceWithRawResponse: + return RecommendationsResourceWithRawResponse(self._ssl.recommendations) @cached_property - def universal(self) -> UniversalWithRawResponse: - return UniversalWithRawResponse(self._ssl.universal) + def universal(self) -> UniversalResourceWithRawResponse: + return UniversalResourceWithRawResponse(self._ssl.universal) @cached_property - def verification(self) -> VerificationWithRawResponse: - return VerificationWithRawResponse(self._ssl.verification) + def verification(self) -> VerificationResourceWithRawResponse: + return VerificationResourceWithRawResponse(self._ssl.verification) -class AsyncSSLWithRawResponse: - def __init__(self, ssl: AsyncSSL) -> None: +class AsyncSSLResourceWithRawResponse: + def __init__(self, ssl: AsyncSSLResource) -> None: self._ssl = ssl @cached_property - def analyze(self) -> AsyncAnalyzeWithRawResponse: - return AsyncAnalyzeWithRawResponse(self._ssl.analyze) + def analyze(self) -> AsyncAnalyzeResourceWithRawResponse: + return AsyncAnalyzeResourceWithRawResponse(self._ssl.analyze) @cached_property - def certificate_packs(self) -> AsyncCertificatePacksWithRawResponse: - return AsyncCertificatePacksWithRawResponse(self._ssl.certificate_packs) + def certificate_packs(self) -> AsyncCertificatePacksResourceWithRawResponse: + return AsyncCertificatePacksResourceWithRawResponse(self._ssl.certificate_packs) @cached_property - def recommendations(self) -> AsyncRecommendationsWithRawResponse: - return AsyncRecommendationsWithRawResponse(self._ssl.recommendations) + def recommendations(self) -> AsyncRecommendationsResourceWithRawResponse: + return AsyncRecommendationsResourceWithRawResponse(self._ssl.recommendations) @cached_property - def universal(self) -> AsyncUniversalWithRawResponse: - return AsyncUniversalWithRawResponse(self._ssl.universal) + def universal(self) -> AsyncUniversalResourceWithRawResponse: + return AsyncUniversalResourceWithRawResponse(self._ssl.universal) @cached_property - def verification(self) -> AsyncVerificationWithRawResponse: - return AsyncVerificationWithRawResponse(self._ssl.verification) + def verification(self) -> AsyncVerificationResourceWithRawResponse: + return AsyncVerificationResourceWithRawResponse(self._ssl.verification) -class SSLWithStreamingResponse: - def __init__(self, ssl: SSL) -> None: +class SSLResourceWithStreamingResponse: + def __init__(self, ssl: SSLResource) -> None: self._ssl = ssl @cached_property - def analyze(self) -> AnalyzeWithStreamingResponse: - return AnalyzeWithStreamingResponse(self._ssl.analyze) + def analyze(self) -> AnalyzeResourceWithStreamingResponse: + return AnalyzeResourceWithStreamingResponse(self._ssl.analyze) @cached_property - def certificate_packs(self) -> CertificatePacksWithStreamingResponse: - return CertificatePacksWithStreamingResponse(self._ssl.certificate_packs) + def certificate_packs(self) -> CertificatePacksResourceWithStreamingResponse: + return CertificatePacksResourceWithStreamingResponse(self._ssl.certificate_packs) @cached_property - def recommendations(self) -> RecommendationsWithStreamingResponse: - return RecommendationsWithStreamingResponse(self._ssl.recommendations) + def recommendations(self) -> RecommendationsResourceWithStreamingResponse: + return RecommendationsResourceWithStreamingResponse(self._ssl.recommendations) @cached_property - def universal(self) -> UniversalWithStreamingResponse: - return UniversalWithStreamingResponse(self._ssl.universal) + def universal(self) -> UniversalResourceWithStreamingResponse: + return UniversalResourceWithStreamingResponse(self._ssl.universal) @cached_property - def verification(self) -> VerificationWithStreamingResponse: - return VerificationWithStreamingResponse(self._ssl.verification) + def verification(self) -> VerificationResourceWithStreamingResponse: + return VerificationResourceWithStreamingResponse(self._ssl.verification) -class AsyncSSLWithStreamingResponse: - def __init__(self, ssl: AsyncSSL) -> None: +class AsyncSSLResourceWithStreamingResponse: + def __init__(self, ssl: AsyncSSLResource) -> None: self._ssl = ssl @cached_property - def analyze(self) -> AsyncAnalyzeWithStreamingResponse: - return AsyncAnalyzeWithStreamingResponse(self._ssl.analyze) + def analyze(self) -> AsyncAnalyzeResourceWithStreamingResponse: + return AsyncAnalyzeResourceWithStreamingResponse(self._ssl.analyze) @cached_property - def certificate_packs(self) -> AsyncCertificatePacksWithStreamingResponse: - return AsyncCertificatePacksWithStreamingResponse(self._ssl.certificate_packs) + def certificate_packs(self) -> AsyncCertificatePacksResourceWithStreamingResponse: + return AsyncCertificatePacksResourceWithStreamingResponse(self._ssl.certificate_packs) @cached_property - def recommendations(self) -> AsyncRecommendationsWithStreamingResponse: - return AsyncRecommendationsWithStreamingResponse(self._ssl.recommendations) + def recommendations(self) -> AsyncRecommendationsResourceWithStreamingResponse: + return AsyncRecommendationsResourceWithStreamingResponse(self._ssl.recommendations) @cached_property - def universal(self) -> AsyncUniversalWithStreamingResponse: - return AsyncUniversalWithStreamingResponse(self._ssl.universal) + def universal(self) -> AsyncUniversalResourceWithStreamingResponse: + return AsyncUniversalResourceWithStreamingResponse(self._ssl.universal) @cached_property - def verification(self) -> AsyncVerificationWithStreamingResponse: - return AsyncVerificationWithStreamingResponse(self._ssl.verification) + def verification(self) -> AsyncVerificationResourceWithStreamingResponse: + return AsyncVerificationResourceWithStreamingResponse(self._ssl.verification) diff --git a/src/cloudflare/resources/ssl/universal/__init__.py b/src/cloudflare/resources/ssl/universal/__init__.py index bf650c6ed1a..1764132375d 100644 --- a/src/cloudflare/resources/ssl/universal/__init__.py +++ b/src/cloudflare/resources/ssl/universal/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .universal import ( - Universal, - AsyncUniversal, - UniversalWithRawResponse, - AsyncUniversalWithRawResponse, - UniversalWithStreamingResponse, - AsyncUniversalWithStreamingResponse, + UniversalResource, + AsyncUniversalResource, + UniversalResourceWithRawResponse, + AsyncUniversalResourceWithRawResponse, + UniversalResourceWithStreamingResponse, + AsyncUniversalResourceWithStreamingResponse, ) __all__ = [ - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Universal", - "AsyncUniversal", - "UniversalWithRawResponse", - "AsyncUniversalWithRawResponse", - "UniversalWithStreamingResponse", - "AsyncUniversalWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "UniversalResource", + "AsyncUniversalResource", + "UniversalResourceWithRawResponse", + "AsyncUniversalResourceWithRawResponse", + "UniversalResourceWithStreamingResponse", + "AsyncUniversalResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/ssl/universal/settings.py b/src/cloudflare/resources/ssl/universal/settings.py index c81ede1c479..fb5657634bd 100644 --- a/src/cloudflare/resources/ssl/universal/settings.py +++ b/src/cloudflare/resources/ssl/universal/settings.py @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.ssl.universal import UniversalSSLSettings, setting_edit_params +from ....types.ssl.universal import setting_edit_params +from ....types.ssl.universal.universal_ssl_settings import UniversalSSLSettings -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def edit( self, @@ -99,7 +100,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UniversalSSLSettings]._unwrapper, ), cast_to=cast(Type[UniversalSSLSettings], ResultWrapper[UniversalSSLSettings]), ) @@ -138,20 +139,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UniversalSSLSettings]._unwrapper, ), cast_to=cast(Type[UniversalSSLSettings], ResultWrapper[UniversalSSLSettings]), ) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def edit( self, @@ -215,7 +216,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UniversalSSLSettings]._unwrapper, ), cast_to=cast(Type[UniversalSSLSettings], ResultWrapper[UniversalSSLSettings]), ) @@ -254,14 +255,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UniversalSSLSettings]._unwrapper, ), cast_to=cast(Type[UniversalSSLSettings], ResultWrapper[UniversalSSLSettings]), ) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.edit = to_raw_response_wrapper( @@ -272,8 +273,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.edit = async_to_raw_response_wrapper( @@ -284,8 +285,8 @@ def __init__(self, settings: AsyncSettings) -> None: ) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.edit = to_streamed_response_wrapper( @@ -296,8 +297,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/ssl/universal/universal.py b/src/cloudflare/resources/ssl/universal/universal.py index 7a83d28ad21..7f89451e1d5 100644 --- a/src/cloudflare/resources/ssl/universal/universal.py +++ b/src/cloudflare/resources/ssl/universal/universal.py @@ -3,78 +3,78 @@ from __future__ import annotations from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Universal", "AsyncUniversal"] +__all__ = ["UniversalResource", "AsyncUniversalResource"] -class Universal(SyncAPIResource): +class UniversalResource(SyncAPIResource): @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def with_raw_response(self) -> UniversalWithRawResponse: - return UniversalWithRawResponse(self) + def with_raw_response(self) -> UniversalResourceWithRawResponse: + return UniversalResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UniversalWithStreamingResponse: - return UniversalWithStreamingResponse(self) + def with_streaming_response(self) -> UniversalResourceWithStreamingResponse: + return UniversalResourceWithStreamingResponse(self) -class AsyncUniversal(AsyncAPIResource): +class AsyncUniversalResource(AsyncAPIResource): @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncUniversalWithRawResponse: - return AsyncUniversalWithRawResponse(self) + def with_raw_response(self) -> AsyncUniversalResourceWithRawResponse: + return AsyncUniversalResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUniversalWithStreamingResponse: - return AsyncUniversalWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncUniversalResourceWithStreamingResponse: + return AsyncUniversalResourceWithStreamingResponse(self) -class UniversalWithRawResponse: - def __init__(self, universal: Universal) -> None: +class UniversalResourceWithRawResponse: + def __init__(self, universal: UniversalResource) -> None: self._universal = universal @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._universal.settings) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._universal.settings) -class AsyncUniversalWithRawResponse: - def __init__(self, universal: AsyncUniversal) -> None: +class AsyncUniversalResourceWithRawResponse: + def __init__(self, universal: AsyncUniversalResource) -> None: self._universal = universal @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._universal.settings) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._universal.settings) -class UniversalWithStreamingResponse: - def __init__(self, universal: Universal) -> None: +class UniversalResourceWithStreamingResponse: + def __init__(self, universal: UniversalResource) -> None: self._universal = universal @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._universal.settings) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._universal.settings) -class AsyncUniversalWithStreamingResponse: - def __init__(self, universal: AsyncUniversal) -> None: +class AsyncUniversalResourceWithStreamingResponse: + def __init__(self, universal: AsyncUniversalResource) -> None: self._universal = universal @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._universal.settings) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._universal.settings) diff --git a/src/cloudflare/resources/ssl/verification.py b/src/cloudflare/resources/ssl/verification.py index d5173a967d9..d55186e3bb5 100644 --- a/src/cloudflare/resources/ssl/verification.py +++ b/src/cloudflare/resources/ssl/verification.py @@ -21,27 +21,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.ssl import ( - VerificationGetResponse, - VerificationEditResponse, - verification_get_params, - verification_edit_params, -) +from ...types.ssl import verification_get_params, verification_edit_params from ..._base_client import ( make_request_options, ) +from ...types.ssl.verification_get_response import VerificationGetResponse +from ...types.ssl.verification_edit_response import VerificationEditResponse -__all__ = ["Verification", "AsyncVerification"] +__all__ = ["VerificationResource", "AsyncVerificationResource"] -class Verification(SyncAPIResource): +class VerificationResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> VerificationWithRawResponse: - return VerificationWithRawResponse(self) + def with_raw_response(self) -> VerificationResourceWithRawResponse: + return VerificationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VerificationWithStreamingResponse: - return VerificationWithStreamingResponse(self) + def with_streaming_response(self) -> VerificationResourceWithStreamingResponse: + return VerificationResourceWithStreamingResponse(self) def edit( self, @@ -94,7 +91,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VerificationEditResponse]._unwrapper, ), cast_to=cast(Type[VerificationEditResponse], ResultWrapper[VerificationEditResponse]), ) @@ -137,20 +134,20 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"retry": retry}, verification_get_params.VerificationGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[VerificationGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[VerificationGetResponse]], ResultWrapper[VerificationGetResponse]), ) -class AsyncVerification(AsyncAPIResource): +class AsyncVerificationResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncVerificationWithRawResponse: - return AsyncVerificationWithRawResponse(self) + def with_raw_response(self) -> AsyncVerificationResourceWithRawResponse: + return AsyncVerificationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVerificationWithStreamingResponse: - return AsyncVerificationWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVerificationResourceWithStreamingResponse: + return AsyncVerificationResourceWithStreamingResponse(self) async def edit( self, @@ -203,7 +200,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VerificationEditResponse]._unwrapper, ), cast_to=cast(Type[VerificationEditResponse], ResultWrapper[VerificationEditResponse]), ) @@ -246,14 +243,14 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"retry": retry}, verification_get_params.VerificationGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[VerificationGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[VerificationGetResponse]], ResultWrapper[VerificationGetResponse]), ) -class VerificationWithRawResponse: - def __init__(self, verification: Verification) -> None: +class VerificationResourceWithRawResponse: + def __init__(self, verification: VerificationResource) -> None: self._verification = verification self.edit = to_raw_response_wrapper( @@ -264,8 +261,8 @@ def __init__(self, verification: Verification) -> None: ) -class AsyncVerificationWithRawResponse: - def __init__(self, verification: AsyncVerification) -> None: +class AsyncVerificationResourceWithRawResponse: + def __init__(self, verification: AsyncVerificationResource) -> None: self._verification = verification self.edit = async_to_raw_response_wrapper( @@ -276,8 +273,8 @@ def __init__(self, verification: AsyncVerification) -> None: ) -class VerificationWithStreamingResponse: - def __init__(self, verification: Verification) -> None: +class VerificationResourceWithStreamingResponse: + def __init__(self, verification: VerificationResource) -> None: self._verification = verification self.edit = to_streamed_response_wrapper( @@ -288,8 +285,8 @@ def __init__(self, verification: Verification) -> None: ) -class AsyncVerificationWithStreamingResponse: - def __init__(self, verification: AsyncVerification) -> None: +class AsyncVerificationResourceWithStreamingResponse: + def __init__(self, verification: AsyncVerificationResource) -> None: self._verification = verification self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/storage/__init__.py b/src/cloudflare/resources/storage/__init__.py index d9d5283925f..9c22eb0dc9e 100644 --- a/src/cloudflare/resources/storage/__init__.py +++ b/src/cloudflare/resources/storage/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .storage import ( - Storage, - AsyncStorage, - StorageWithRawResponse, - AsyncStorageWithRawResponse, - StorageWithStreamingResponse, - AsyncStorageWithStreamingResponse, + StorageResource, + AsyncStorageResource, + StorageResourceWithRawResponse, + AsyncStorageResourceWithRawResponse, + StorageResourceWithStreamingResponse, + AsyncStorageResourceWithStreamingResponse, ) from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) __all__ = [ - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", - "Storage", - "AsyncStorage", - "StorageWithRawResponse", - "AsyncStorageWithRawResponse", - "StorageWithStreamingResponse", - "AsyncStorageWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", + "StorageResource", + "AsyncStorageResource", + "StorageResourceWithRawResponse", + "AsyncStorageResourceWithRawResponse", + "StorageResourceWithStreamingResponse", + "AsyncStorageResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/storage/analytics.py b/src/cloudflare/resources/storage/analytics.py index e9114e594d2..9a0621a4f2c 100644 --- a/src/cloudflare/resources/storage/analytics.py +++ b/src/cloudflare/resources/storage/analytics.py @@ -23,24 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.storage import ( - WorkersKVSchemasResult, - WorkersKVComponentsSchemasResult, - analytics_list_params, - analytics_stored_params, -) +from ...types.storage import analytics_list_params, analytics_stored_params +from ...types.storage.schema import Schema +from ...types.storage.components import Components -__all__ = ["Analytics", "AsyncAnalytics"] +__all__ = ["AnalyticsResource", "AsyncAnalyticsResource"] -class Analytics(SyncAPIResource): +class AnalyticsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self) + def with_raw_response(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self) + def with_streaming_response(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self) def list( self, @@ -53,7 +50,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersKVSchemasResult: + ) -> Schema: """ Retrieves Workers KV request metrics for the given account. @@ -80,9 +77,9 @@ def list( extra_body=extra_body, timeout=timeout, query=maybe_transform({"query": query}, analytics_list_params.AnalyticsListParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Schema]._unwrapper, ), - cast_to=cast(Type[WorkersKVSchemasResult], ResultWrapper[WorkersKVSchemasResult]), + cast_to=cast(Type[Schema], ResultWrapper[Schema]), ) def stored( @@ -96,7 +93,7 @@ def stored( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersKVComponentsSchemasResult: + ) -> Components: """ Retrieves Workers KV stored data metrics for the given account. @@ -123,20 +120,20 @@ def stored( extra_body=extra_body, timeout=timeout, query=maybe_transform({"query": query}, analytics_stored_params.AnalyticsStoredParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Components]._unwrapper, ), - cast_to=cast(Type[WorkersKVComponentsSchemasResult], ResultWrapper[WorkersKVComponentsSchemasResult]), + cast_to=cast(Type[Components], ResultWrapper[Components]), ) -class AsyncAnalytics(AsyncAPIResource): +class AsyncAnalyticsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self) + def with_raw_response(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self) async def list( self, @@ -149,7 +146,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersKVSchemasResult: + ) -> Schema: """ Retrieves Workers KV request metrics for the given account. @@ -176,9 +173,9 @@ async def list( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"query": query}, analytics_list_params.AnalyticsListParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Schema]._unwrapper, ), - cast_to=cast(Type[WorkersKVSchemasResult], ResultWrapper[WorkersKVSchemasResult]), + cast_to=cast(Type[Schema], ResultWrapper[Schema]), ) async def stored( @@ -192,7 +189,7 @@ async def stored( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersKVComponentsSchemasResult: + ) -> Components: """ Retrieves Workers KV stored data metrics for the given account. @@ -219,14 +216,14 @@ async def stored( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"query": query}, analytics_stored_params.AnalyticsStoredParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Components]._unwrapper, ), - cast_to=cast(Type[WorkersKVComponentsSchemasResult], ResultWrapper[WorkersKVComponentsSchemasResult]), + cast_to=cast(Type[Components], ResultWrapper[Components]), ) -class AnalyticsWithRawResponse: - def __init__(self, analytics: Analytics) -> None: +class AnalyticsResourceWithRawResponse: + def __init__(self, analytics: AnalyticsResource) -> None: self._analytics = analytics self.list = to_raw_response_wrapper( @@ -237,8 +234,8 @@ def __init__(self, analytics: Analytics) -> None: ) -class AsyncAnalyticsWithRawResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: +class AsyncAnalyticsResourceWithRawResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: self._analytics = analytics self.list = async_to_raw_response_wrapper( @@ -249,8 +246,8 @@ def __init__(self, analytics: AsyncAnalytics) -> None: ) -class AnalyticsWithStreamingResponse: - def __init__(self, analytics: Analytics) -> None: +class AnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AnalyticsResource) -> None: self._analytics = analytics self.list = to_streamed_response_wrapper( @@ -261,8 +258,8 @@ def __init__(self, analytics: Analytics) -> None: ) -class AsyncAnalyticsWithStreamingResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: +class AsyncAnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: self._analytics = analytics self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/storage/storage.py b/src/cloudflare/resources/storage/storage.py index 7a7b4be0a33..29fac0d0f7a 100644 --- a/src/cloudflare/resources/storage/storage.py +++ b/src/cloudflare/resources/storage/storage.py @@ -4,77 +4,77 @@ from ..._compat import cached_property from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Storage", "AsyncStorage"] +__all__ = ["StorageResource", "AsyncStorageResource"] -class Storage(SyncAPIResource): +class StorageResource(SyncAPIResource): @cached_property - def analytics(self) -> Analytics: - return Analytics(self._client) + def analytics(self) -> AnalyticsResource: + return AnalyticsResource(self._client) @cached_property - def with_raw_response(self) -> StorageWithRawResponse: - return StorageWithRawResponse(self) + def with_raw_response(self) -> StorageResourceWithRawResponse: + return StorageResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> StorageWithStreamingResponse: - return StorageWithStreamingResponse(self) + def with_streaming_response(self) -> StorageResourceWithStreamingResponse: + return StorageResourceWithStreamingResponse(self) -class AsyncStorage(AsyncAPIResource): +class AsyncStorageResource(AsyncAPIResource): @cached_property - def analytics(self) -> AsyncAnalytics: - return AsyncAnalytics(self._client) + def analytics(self) -> AsyncAnalyticsResource: + return AsyncAnalyticsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncStorageWithRawResponse: - return AsyncStorageWithRawResponse(self) + def with_raw_response(self) -> AsyncStorageResourceWithRawResponse: + return AsyncStorageResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncStorageWithStreamingResponse: - return AsyncStorageWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncStorageResourceWithStreamingResponse: + return AsyncStorageResourceWithStreamingResponse(self) -class StorageWithRawResponse: - def __init__(self, storage: Storage) -> None: +class StorageResourceWithRawResponse: + def __init__(self, storage: StorageResource) -> None: self._storage = storage @cached_property - def analytics(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self._storage.analytics) + def analytics(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self._storage.analytics) -class AsyncStorageWithRawResponse: - def __init__(self, storage: AsyncStorage) -> None: +class AsyncStorageResourceWithRawResponse: + def __init__(self, storage: AsyncStorageResource) -> None: self._storage = storage @cached_property - def analytics(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self._storage.analytics) + def analytics(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self._storage.analytics) -class StorageWithStreamingResponse: - def __init__(self, storage: Storage) -> None: +class StorageResourceWithStreamingResponse: + def __init__(self, storage: StorageResource) -> None: self._storage = storage @cached_property - def analytics(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self._storage.analytics) + def analytics(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self._storage.analytics) -class AsyncStorageWithStreamingResponse: - def __init__(self, storage: AsyncStorage) -> None: +class AsyncStorageResourceWithStreamingResponse: + def __init__(self, storage: AsyncStorageResource) -> None: self._storage = storage @cached_property - def analytics(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self._storage.analytics) + def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self._storage.analytics) diff --git a/src/cloudflare/resources/stream/__init__.py b/src/cloudflare/resources/stream/__init__.py index a3182ce1427..372e6348d9e 100644 --- a/src/cloudflare/resources/stream/__init__.py +++ b/src/cloudflare/resources/stream/__init__.py @@ -1,201 +1,201 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .clip import ( - Clip, - AsyncClip, - ClipWithRawResponse, - AsyncClipWithRawResponse, - ClipWithStreamingResponse, - AsyncClipWithStreamingResponse, + ClipResource, + AsyncClipResource, + ClipResourceWithRawResponse, + AsyncClipResourceWithRawResponse, + ClipResourceWithStreamingResponse, + AsyncClipResourceWithStreamingResponse, ) from .copy import ( - Copy, - AsyncCopy, - CopyWithRawResponse, - AsyncCopyWithRawResponse, - CopyWithStreamingResponse, - AsyncCopyWithStreamingResponse, + CopyResource, + AsyncCopyResource, + CopyResourceWithRawResponse, + AsyncCopyResourceWithRawResponse, + CopyResourceWithStreamingResponse, + AsyncCopyResourceWithStreamingResponse, ) from .keys import ( - Keys, - AsyncKeys, - KeysWithRawResponse, - AsyncKeysWithRawResponse, - KeysWithStreamingResponse, - AsyncKeysWithStreamingResponse, + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, ) from .embed import ( - Embed, - AsyncEmbed, - EmbedWithRawResponse, - AsyncEmbedWithRawResponse, - EmbedWithStreamingResponse, - AsyncEmbedWithStreamingResponse, + EmbedResource, + AsyncEmbedResource, + EmbedResourceWithRawResponse, + AsyncEmbedResourceWithRawResponse, + EmbedResourceWithStreamingResponse, + AsyncEmbedResourceWithStreamingResponse, ) from .token import ( - Token, - AsyncToken, - TokenWithRawResponse, - AsyncTokenWithRawResponse, - TokenWithStreamingResponse, - AsyncTokenWithStreamingResponse, + TokenResource, + AsyncTokenResource, + TokenResourceWithRawResponse, + AsyncTokenResourceWithRawResponse, + TokenResourceWithStreamingResponse, + AsyncTokenResourceWithStreamingResponse, ) from .stream import ( - Stream, - AsyncStream, - StreamWithRawResponse, - AsyncStreamWithRawResponse, - StreamWithStreamingResponse, - AsyncStreamWithStreamingResponse, + StreamResource, + AsyncStreamResource, + StreamResourceWithRawResponse, + AsyncStreamResourceWithRawResponse, + StreamResourceWithStreamingResponse, + AsyncStreamResourceWithStreamingResponse, ) from .videos import ( - Videos, - AsyncVideos, - VideosWithRawResponse, - AsyncVideosWithRawResponse, - VideosWithStreamingResponse, - AsyncVideosWithStreamingResponse, + VideosResource, + AsyncVideosResource, + VideosResourceWithRawResponse, + AsyncVideosResourceWithRawResponse, + VideosResourceWithStreamingResponse, + AsyncVideosResourceWithStreamingResponse, ) from .captions import ( - Captions, - AsyncCaptions, - CaptionsWithRawResponse, - AsyncCaptionsWithRawResponse, - CaptionsWithStreamingResponse, - AsyncCaptionsWithStreamingResponse, + CaptionsResource, + AsyncCaptionsResource, + CaptionsResourceWithRawResponse, + AsyncCaptionsResourceWithRawResponse, + CaptionsResourceWithStreamingResponse, + AsyncCaptionsResourceWithStreamingResponse, ) from .webhooks import ( - Webhooks, - AsyncWebhooks, - WebhooksWithRawResponse, - AsyncWebhooksWithRawResponse, - WebhooksWithStreamingResponse, - AsyncWebhooksWithStreamingResponse, + WebhooksResource, + AsyncWebhooksResource, + WebhooksResourceWithRawResponse, + AsyncWebhooksResourceWithRawResponse, + WebhooksResourceWithStreamingResponse, + AsyncWebhooksResourceWithStreamingResponse, ) from .downloads import ( - Downloads, - AsyncDownloads, - DownloadsWithRawResponse, - AsyncDownloadsWithRawResponse, - DownloadsWithStreamingResponse, - AsyncDownloadsWithStreamingResponse, + DownloadsResource, + AsyncDownloadsResource, + DownloadsResourceWithRawResponse, + AsyncDownloadsResourceWithRawResponse, + DownloadsResourceWithStreamingResponse, + AsyncDownloadsResourceWithStreamingResponse, ) from .watermarks import ( - Watermarks, - AsyncWatermarks, - WatermarksWithRawResponse, - AsyncWatermarksWithRawResponse, - WatermarksWithStreamingResponse, - AsyncWatermarksWithStreamingResponse, + WatermarksResource, + AsyncWatermarksResource, + WatermarksResourceWithRawResponse, + AsyncWatermarksResourceWithRawResponse, + WatermarksResourceWithStreamingResponse, + AsyncWatermarksResourceWithStreamingResponse, ) from .live_inputs import ( - LiveInputs, - AsyncLiveInputs, - LiveInputsWithRawResponse, - AsyncLiveInputsWithRawResponse, - LiveInputsWithStreamingResponse, - AsyncLiveInputsWithStreamingResponse, + LiveInputsResource, + AsyncLiveInputsResource, + LiveInputsResourceWithRawResponse, + AsyncLiveInputsResourceWithRawResponse, + LiveInputsResourceWithStreamingResponse, + AsyncLiveInputsResourceWithStreamingResponse, ) from .audio_tracks import ( - AudioTracks, - AsyncAudioTracks, - AudioTracksWithRawResponse, - AsyncAudioTracksWithRawResponse, - AudioTracksWithStreamingResponse, - AsyncAudioTracksWithStreamingResponse, + AudioTracksResource, + AsyncAudioTracksResource, + AudioTracksResourceWithRawResponse, + AsyncAudioTracksResourceWithRawResponse, + AudioTracksResourceWithStreamingResponse, + AsyncAudioTracksResourceWithStreamingResponse, ) from .direct_upload import ( - DirectUpload, - AsyncDirectUpload, - DirectUploadWithRawResponse, - AsyncDirectUploadWithRawResponse, - DirectUploadWithStreamingResponse, - AsyncDirectUploadWithStreamingResponse, + DirectUploadResource, + AsyncDirectUploadResource, + DirectUploadResourceWithRawResponse, + AsyncDirectUploadResourceWithRawResponse, + DirectUploadResourceWithStreamingResponse, + AsyncDirectUploadResourceWithStreamingResponse, ) __all__ = [ - "AudioTracks", - "AsyncAudioTracks", - "AudioTracksWithRawResponse", - "AsyncAudioTracksWithRawResponse", - "AudioTracksWithStreamingResponse", - "AsyncAudioTracksWithStreamingResponse", - "Videos", - "AsyncVideos", - "VideosWithRawResponse", - "AsyncVideosWithRawResponse", - "VideosWithStreamingResponse", - "AsyncVideosWithStreamingResponse", - "Clip", - "AsyncClip", - "ClipWithRawResponse", - "AsyncClipWithRawResponse", - "ClipWithStreamingResponse", - "AsyncClipWithStreamingResponse", - "Copy", - "AsyncCopy", - "CopyWithRawResponse", - "AsyncCopyWithRawResponse", - "CopyWithStreamingResponse", - "AsyncCopyWithStreamingResponse", - "DirectUpload", - "AsyncDirectUpload", - "DirectUploadWithRawResponse", - "AsyncDirectUploadWithRawResponse", - "DirectUploadWithStreamingResponse", - "AsyncDirectUploadWithStreamingResponse", - "Keys", - "AsyncKeys", - "KeysWithRawResponse", - "AsyncKeysWithRawResponse", - "KeysWithStreamingResponse", - "AsyncKeysWithStreamingResponse", - "LiveInputs", - "AsyncLiveInputs", - "LiveInputsWithRawResponse", - "AsyncLiveInputsWithRawResponse", - "LiveInputsWithStreamingResponse", - "AsyncLiveInputsWithStreamingResponse", - "Watermarks", - "AsyncWatermarks", - "WatermarksWithRawResponse", - "AsyncWatermarksWithRawResponse", - "WatermarksWithStreamingResponse", - "AsyncWatermarksWithStreamingResponse", - "Webhooks", - "AsyncWebhooks", - "WebhooksWithRawResponse", - "AsyncWebhooksWithRawResponse", - "WebhooksWithStreamingResponse", - "AsyncWebhooksWithStreamingResponse", - "Captions", - "AsyncCaptions", - "CaptionsWithRawResponse", - "AsyncCaptionsWithRawResponse", - "CaptionsWithStreamingResponse", - "AsyncCaptionsWithStreamingResponse", - "Downloads", - "AsyncDownloads", - "DownloadsWithRawResponse", - "AsyncDownloadsWithRawResponse", - "DownloadsWithStreamingResponse", - "AsyncDownloadsWithStreamingResponse", - "Embed", - "AsyncEmbed", - "EmbedWithRawResponse", - "AsyncEmbedWithRawResponse", - "EmbedWithStreamingResponse", - "AsyncEmbedWithStreamingResponse", - "Token", - "AsyncToken", - "TokenWithRawResponse", - "AsyncTokenWithRawResponse", - "TokenWithStreamingResponse", - "AsyncTokenWithStreamingResponse", - "Stream", - "AsyncStream", - "StreamWithRawResponse", - "AsyncStreamWithRawResponse", - "StreamWithStreamingResponse", - "AsyncStreamWithStreamingResponse", + "AudioTracksResource", + "AsyncAudioTracksResource", + "AudioTracksResourceWithRawResponse", + "AsyncAudioTracksResourceWithRawResponse", + "AudioTracksResourceWithStreamingResponse", + "AsyncAudioTracksResourceWithStreamingResponse", + "VideosResource", + "AsyncVideosResource", + "VideosResourceWithRawResponse", + "AsyncVideosResourceWithRawResponse", + "VideosResourceWithStreamingResponse", + "AsyncVideosResourceWithStreamingResponse", + "ClipResource", + "AsyncClipResource", + "ClipResourceWithRawResponse", + "AsyncClipResourceWithRawResponse", + "ClipResourceWithStreamingResponse", + "AsyncClipResourceWithStreamingResponse", + "CopyResource", + "AsyncCopyResource", + "CopyResourceWithRawResponse", + "AsyncCopyResourceWithRawResponse", + "CopyResourceWithStreamingResponse", + "AsyncCopyResourceWithStreamingResponse", + "DirectUploadResource", + "AsyncDirectUploadResource", + "DirectUploadResourceWithRawResponse", + "AsyncDirectUploadResourceWithRawResponse", + "DirectUploadResourceWithStreamingResponse", + "AsyncDirectUploadResourceWithStreamingResponse", + "KeysResource", + "AsyncKeysResource", + "KeysResourceWithRawResponse", + "AsyncKeysResourceWithRawResponse", + "KeysResourceWithStreamingResponse", + "AsyncKeysResourceWithStreamingResponse", + "LiveInputsResource", + "AsyncLiveInputsResource", + "LiveInputsResourceWithRawResponse", + "AsyncLiveInputsResourceWithRawResponse", + "LiveInputsResourceWithStreamingResponse", + "AsyncLiveInputsResourceWithStreamingResponse", + "WatermarksResource", + "AsyncWatermarksResource", + "WatermarksResourceWithRawResponse", + "AsyncWatermarksResourceWithRawResponse", + "WatermarksResourceWithStreamingResponse", + "AsyncWatermarksResourceWithStreamingResponse", + "WebhooksResource", + "AsyncWebhooksResource", + "WebhooksResourceWithRawResponse", + "AsyncWebhooksResourceWithRawResponse", + "WebhooksResourceWithStreamingResponse", + "AsyncWebhooksResourceWithStreamingResponse", + "CaptionsResource", + "AsyncCaptionsResource", + "CaptionsResourceWithRawResponse", + "AsyncCaptionsResourceWithRawResponse", + "CaptionsResourceWithStreamingResponse", + "AsyncCaptionsResourceWithStreamingResponse", + "DownloadsResource", + "AsyncDownloadsResource", + "DownloadsResourceWithRawResponse", + "AsyncDownloadsResourceWithRawResponse", + "DownloadsResourceWithStreamingResponse", + "AsyncDownloadsResourceWithStreamingResponse", + "EmbedResource", + "AsyncEmbedResource", + "EmbedResourceWithRawResponse", + "AsyncEmbedResourceWithRawResponse", + "EmbedResourceWithStreamingResponse", + "AsyncEmbedResourceWithStreamingResponse", + "TokenResource", + "AsyncTokenResource", + "TokenResourceWithRawResponse", + "AsyncTokenResourceWithRawResponse", + "TokenResourceWithStreamingResponse", + "AsyncTokenResourceWithStreamingResponse", + "StreamResource", + "AsyncStreamResource", + "StreamResourceWithRawResponse", + "AsyncStreamResourceWithRawResponse", + "StreamResourceWithStreamingResponse", + "AsyncStreamResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/stream/audio_tracks.py b/src/cloudflare/resources/stream/audio_tracks.py index 3ac3d43c20d..5d61f6567e7 100644 --- a/src/cloudflare/resources/stream/audio_tracks.py +++ b/src/cloudflare/resources/stream/audio_tracks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Any, Type, Optional, cast import httpx @@ -23,25 +23,22 @@ from ..._base_client import ( make_request_options, ) -from ...types.stream import ( - StreamAudio, - AudioTrackGetResponse, - AudioTrackDeleteResponse, - audio_track_copy_params, - audio_track_edit_params, -) +from ...types.stream import audio_track_copy_params, audio_track_edit_params +from ...types.stream.audio import Audio +from ...types.stream.audio_track_get_response import AudioTrackGetResponse +from ...types.stream.audio_track_delete_response import AudioTrackDeleteResponse -__all__ = ["AudioTracks", "AsyncAudioTracks"] +__all__ = ["AudioTracksResource", "AsyncAudioTracksResource"] -class AudioTracks(SyncAPIResource): +class AudioTracksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AudioTracksWithRawResponse: - return AudioTracksWithRawResponse(self) + def with_raw_response(self) -> AudioTracksResourceWithRawResponse: + return AudioTracksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AudioTracksWithStreamingResponse: - return AudioTracksWithStreamingResponse(self) + def with_streaming_response(self) -> AudioTracksResourceWithStreamingResponse: + return AudioTracksResourceWithStreamingResponse(self) def delete( self, @@ -55,7 +52,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AudioTrackDeleteResponse: + ) -> Optional[AudioTrackDeleteResponse]: """Deletes additional audio tracks on a video. Deleting a default audio track is @@ -83,7 +80,7 @@ def delete( if not audio_identifier: raise ValueError(f"Expected a non-empty value for `audio_identifier` but received {audio_identifier!r}") return cast( - AudioTrackDeleteResponse, + Optional[AudioTrackDeleteResponse], self._delete( f"/accounts/{account_id}/stream/{identifier}/audio/{audio_identifier}", options=make_request_options( @@ -91,7 +88,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AudioTrackDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AudioTrackDeleteResponse] @@ -112,7 +109,7 @@ def copy( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamAudio: + ) -> Optional[Audio]: """ Adds an additional audio track to a video using the provided audio track URL. @@ -154,9 +151,9 @@ def copy( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Audio]]._unwrapper, ), - cast_to=cast(Type[StreamAudio], ResultWrapper[StreamAudio]), + cast_to=cast(Type[Optional[Audio]], ResultWrapper[Audio]), ) def edit( @@ -173,7 +170,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamAudio: + ) -> Optional[Audio]: """Edits additional audio tracks on a video. Editing the default status of an audio @@ -220,9 +217,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Audio]]._unwrapper, ), - cast_to=cast(Type[StreamAudio], ResultWrapper[StreamAudio]), + cast_to=cast(Type[Optional[Audio]], ResultWrapper[Audio]), ) def get( @@ -236,7 +233,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AudioTrackGetResponse: + ) -> Optional[AudioTrackGetResponse]: """Lists additional audio tracks on a video. Note this API will not return @@ -266,20 +263,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AudioTrackGetResponse]]._unwrapper, ), - cast_to=cast(Type[AudioTrackGetResponse], ResultWrapper[AudioTrackGetResponse]), + cast_to=cast(Type[Optional[AudioTrackGetResponse]], ResultWrapper[AudioTrackGetResponse]), ) -class AsyncAudioTracks(AsyncAPIResource): +class AsyncAudioTracksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAudioTracksWithRawResponse: - return AsyncAudioTracksWithRawResponse(self) + def with_raw_response(self) -> AsyncAudioTracksResourceWithRawResponse: + return AsyncAudioTracksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAudioTracksWithStreamingResponse: - return AsyncAudioTracksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAudioTracksResourceWithStreamingResponse: + return AsyncAudioTracksResourceWithStreamingResponse(self) async def delete( self, @@ -293,7 +290,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AudioTrackDeleteResponse: + ) -> Optional[AudioTrackDeleteResponse]: """Deletes additional audio tracks on a video. Deleting a default audio track is @@ -321,7 +318,7 @@ async def delete( if not audio_identifier: raise ValueError(f"Expected a non-empty value for `audio_identifier` but received {audio_identifier!r}") return cast( - AudioTrackDeleteResponse, + Optional[AudioTrackDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/{identifier}/audio/{audio_identifier}", options=make_request_options( @@ -329,7 +326,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AudioTrackDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AudioTrackDeleteResponse] @@ -350,7 +347,7 @@ async def copy( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamAudio: + ) -> Optional[Audio]: """ Adds an additional audio track to a video using the provided audio track URL. @@ -392,9 +389,9 @@ async def copy( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Audio]]._unwrapper, ), - cast_to=cast(Type[StreamAudio], ResultWrapper[StreamAudio]), + cast_to=cast(Type[Optional[Audio]], ResultWrapper[Audio]), ) async def edit( @@ -411,7 +408,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamAudio: + ) -> Optional[Audio]: """Edits additional audio tracks on a video. Editing the default status of an audio @@ -458,9 +455,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Audio]]._unwrapper, ), - cast_to=cast(Type[StreamAudio], ResultWrapper[StreamAudio]), + cast_to=cast(Type[Optional[Audio]], ResultWrapper[Audio]), ) async def get( @@ -474,7 +471,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AudioTrackGetResponse: + ) -> Optional[AudioTrackGetResponse]: """Lists additional audio tracks on a video. Note this API will not return @@ -504,14 +501,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AudioTrackGetResponse]]._unwrapper, ), - cast_to=cast(Type[AudioTrackGetResponse], ResultWrapper[AudioTrackGetResponse]), + cast_to=cast(Type[Optional[AudioTrackGetResponse]], ResultWrapper[AudioTrackGetResponse]), ) -class AudioTracksWithRawResponse: - def __init__(self, audio_tracks: AudioTracks) -> None: +class AudioTracksResourceWithRawResponse: + def __init__(self, audio_tracks: AudioTracksResource) -> None: self._audio_tracks = audio_tracks self.delete = to_raw_response_wrapper( @@ -528,8 +525,8 @@ def __init__(self, audio_tracks: AudioTracks) -> None: ) -class AsyncAudioTracksWithRawResponse: - def __init__(self, audio_tracks: AsyncAudioTracks) -> None: +class AsyncAudioTracksResourceWithRawResponse: + def __init__(self, audio_tracks: AsyncAudioTracksResource) -> None: self._audio_tracks = audio_tracks self.delete = async_to_raw_response_wrapper( @@ -546,8 +543,8 @@ def __init__(self, audio_tracks: AsyncAudioTracks) -> None: ) -class AudioTracksWithStreamingResponse: - def __init__(self, audio_tracks: AudioTracks) -> None: +class AudioTracksResourceWithStreamingResponse: + def __init__(self, audio_tracks: AudioTracksResource) -> None: self._audio_tracks = audio_tracks self.delete = to_streamed_response_wrapper( @@ -564,8 +561,8 @@ def __init__(self, audio_tracks: AudioTracks) -> None: ) -class AsyncAudioTracksWithStreamingResponse: - def __init__(self, audio_tracks: AsyncAudioTracks) -> None: +class AsyncAudioTracksResourceWithStreamingResponse: + def __init__(self, audio_tracks: AsyncAudioTracksResource) -> None: self._audio_tracks = audio_tracks self.delete = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/captions.py b/src/cloudflare/resources/stream/captions.py deleted file mode 100644 index 1196f1e3d72..00000000000 --- a/src/cloudflare/resources/stream/captions.py +++ /dev/null @@ -1,422 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, Type, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ..._base_client import ( - make_request_options, -) -from ...types.stream import CaptionGetResponse, CaptionDeleteResponse, CaptionUpdateResponse, caption_update_params - -__all__ = ["Captions", "AsyncCaptions"] - - -class Captions(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CaptionsWithRawResponse: - return CaptionsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CaptionsWithStreamingResponse: - return CaptionsWithStreamingResponse(self) - - def update( - self, - language: str, - *, - account_id: str, - identifier: str, - file: 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, - ) -> CaptionUpdateResponse: - """ - Uploads the caption or subtitle file to the endpoint for a specific BCP47 - language. One caption or subtitle file per language is allowed. - - Args: - account_id: Identifier - - identifier: A Cloudflare-generated unique identifier for a media item. - - language: The language tag in BCP 47 format. - - file: The WebVTT file containing the caption or subtitle content. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not language: - raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") - return cast( - CaptionUpdateResponse, - self._put( - f"/accounts/{account_id}/stream/{identifier}/captions/{language}", - body=maybe_transform({"file": file}, caption_update_params.CaptionUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CaptionUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def delete( - self, - language: str, - *, - account_id: str, - identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CaptionDeleteResponse: - """ - Removes the captions or subtitles from a video. - - Args: - account_id: Identifier - - identifier: A Cloudflare-generated unique identifier for a media item. - - language: The language tag in BCP 47 format. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not language: - raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") - return cast( - CaptionDeleteResponse, - self._delete( - f"/accounts/{account_id}/stream/{identifier}/captions/{language}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CaptionDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def get( - self, - identifier: 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, - ) -> CaptionGetResponse: - """ - Lists the available captions or subtitles for a specific video. - - Args: - account_id: Identifier - - identifier: A Cloudflare-generated unique identifier for a media item. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - f"/accounts/{account_id}/stream/{identifier}/captions", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[CaptionGetResponse], ResultWrapper[CaptionGetResponse]), - ) - - -class AsyncCaptions(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCaptionsWithRawResponse: - return AsyncCaptionsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCaptionsWithStreamingResponse: - return AsyncCaptionsWithStreamingResponse(self) - - async def update( - self, - language: str, - *, - account_id: str, - identifier: str, - file: 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, - ) -> CaptionUpdateResponse: - """ - Uploads the caption or subtitle file to the endpoint for a specific BCP47 - language. One caption or subtitle file per language is allowed. - - Args: - account_id: Identifier - - identifier: A Cloudflare-generated unique identifier for a media item. - - language: The language tag in BCP 47 format. - - file: The WebVTT file containing the caption or subtitle content. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not language: - raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") - return cast( - CaptionUpdateResponse, - await self._put( - f"/accounts/{account_id}/stream/{identifier}/captions/{language}", - body=await async_maybe_transform({"file": file}, caption_update_params.CaptionUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CaptionUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def delete( - self, - language: str, - *, - account_id: str, - identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CaptionDeleteResponse: - """ - Removes the captions or subtitles from a video. - - Args: - account_id: Identifier - - identifier: A Cloudflare-generated unique identifier for a media item. - - language: The language tag in BCP 47 format. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - if not language: - raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") - return cast( - CaptionDeleteResponse, - await self._delete( - f"/accounts/{account_id}/stream/{identifier}/captions/{language}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CaptionDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def get( - self, - identifier: 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, - ) -> CaptionGetResponse: - """ - Lists the available captions or subtitles for a specific video. - - Args: - account_id: Identifier - - identifier: A Cloudflare-generated unique identifier for a media item. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - f"/accounts/{account_id}/stream/{identifier}/captions", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[CaptionGetResponse], ResultWrapper[CaptionGetResponse]), - ) - - -class CaptionsWithRawResponse: - def __init__(self, captions: Captions) -> None: - self._captions = captions - - self.update = to_raw_response_wrapper( - captions.update, - ) - self.delete = to_raw_response_wrapper( - captions.delete, - ) - self.get = to_raw_response_wrapper( - captions.get, - ) - - -class AsyncCaptionsWithRawResponse: - def __init__(self, captions: AsyncCaptions) -> None: - self._captions = captions - - self.update = async_to_raw_response_wrapper( - captions.update, - ) - self.delete = async_to_raw_response_wrapper( - captions.delete, - ) - self.get = async_to_raw_response_wrapper( - captions.get, - ) - - -class CaptionsWithStreamingResponse: - def __init__(self, captions: Captions) -> None: - self._captions = captions - - self.update = to_streamed_response_wrapper( - captions.update, - ) - self.delete = to_streamed_response_wrapper( - captions.delete, - ) - self.get = to_streamed_response_wrapper( - captions.get, - ) - - -class AsyncCaptionsWithStreamingResponse: - def __init__(self, captions: AsyncCaptions) -> None: - self._captions = captions - - self.update = async_to_streamed_response_wrapper( - captions.update, - ) - self.delete = async_to_streamed_response_wrapper( - captions.delete, - ) - self.get = async_to_streamed_response_wrapper( - captions.get, - ) diff --git a/src/cloudflare/resources/stream/captions/__init__.py b/src/cloudflare/resources/stream/captions/__init__.py new file mode 100644 index 00000000000..468a1af73d7 --- /dev/null +++ b/src/cloudflare/resources/stream/captions/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .captions import ( + CaptionsResource, + AsyncCaptionsResource, + CaptionsResourceWithRawResponse, + AsyncCaptionsResourceWithRawResponse, + CaptionsResourceWithStreamingResponse, + AsyncCaptionsResourceWithStreamingResponse, +) +from .language import ( + LanguageResource, + AsyncLanguageResource, + LanguageResourceWithRawResponse, + AsyncLanguageResourceWithRawResponse, + LanguageResourceWithStreamingResponse, + AsyncLanguageResourceWithStreamingResponse, +) + +__all__ = [ + "LanguageResource", + "AsyncLanguageResource", + "LanguageResourceWithRawResponse", + "AsyncLanguageResourceWithRawResponse", + "LanguageResourceWithStreamingResponse", + "AsyncLanguageResourceWithStreamingResponse", + "CaptionsResource", + "AsyncCaptionsResource", + "CaptionsResourceWithRawResponse", + "AsyncCaptionsResourceWithRawResponse", + "CaptionsResourceWithStreamingResponse", + "AsyncCaptionsResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/stream/captions/captions.py b/src/cloudflare/resources/stream/captions/captions.py new file mode 100644 index 00000000000..516845ba8d0 --- /dev/null +++ b/src/cloudflare/resources/stream/captions/captions.py @@ -0,0 +1,201 @@ +# 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 .language import ( + LanguageResource, + AsyncLanguageResource, + LanguageResourceWithRawResponse, + AsyncLanguageResourceWithRawResponse, + LanguageResourceWithStreamingResponse, + AsyncLanguageResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._wrappers import ResultWrapper +from ...._base_client import ( + make_request_options, +) +from .language.language import LanguageResource, AsyncLanguageResource +from ....types.stream.caption_get_response import CaptionGetResponse + +__all__ = ["CaptionsResource", "AsyncCaptionsResource"] + + +class CaptionsResource(SyncAPIResource): + @cached_property + def language(self) -> LanguageResource: + return LanguageResource(self._client) + + @cached_property + def with_raw_response(self) -> CaptionsResourceWithRawResponse: + return CaptionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CaptionsResourceWithStreamingResponse: + return CaptionsResourceWithStreamingResponse(self) + + def get( + self, + identifier: 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[CaptionGetResponse]: + """ + Lists the available captions or subtitles for a specific video. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return self._get( + f"/accounts/{account_id}/stream/{identifier}/captions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CaptionGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[CaptionGetResponse]], ResultWrapper[CaptionGetResponse]), + ) + + +class AsyncCaptionsResource(AsyncAPIResource): + @cached_property + def language(self) -> AsyncLanguageResource: + return AsyncLanguageResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncCaptionsResourceWithRawResponse: + return AsyncCaptionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCaptionsResourceWithStreamingResponse: + return AsyncCaptionsResourceWithStreamingResponse(self) + + async def get( + self, + identifier: 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[CaptionGetResponse]: + """ + Lists the available captions or subtitles for a specific video. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return await self._get( + f"/accounts/{account_id}/stream/{identifier}/captions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CaptionGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[CaptionGetResponse]], ResultWrapper[CaptionGetResponse]), + ) + + +class CaptionsResourceWithRawResponse: + def __init__(self, captions: CaptionsResource) -> None: + self._captions = captions + + self.get = to_raw_response_wrapper( + captions.get, + ) + + @cached_property + def language(self) -> LanguageResourceWithRawResponse: + return LanguageResourceWithRawResponse(self._captions.language) + + +class AsyncCaptionsResourceWithRawResponse: + def __init__(self, captions: AsyncCaptionsResource) -> None: + self._captions = captions + + self.get = async_to_raw_response_wrapper( + captions.get, + ) + + @cached_property + def language(self) -> AsyncLanguageResourceWithRawResponse: + return AsyncLanguageResourceWithRawResponse(self._captions.language) + + +class CaptionsResourceWithStreamingResponse: + def __init__(self, captions: CaptionsResource) -> None: + self._captions = captions + + self.get = to_streamed_response_wrapper( + captions.get, + ) + + @cached_property + def language(self) -> LanguageResourceWithStreamingResponse: + return LanguageResourceWithStreamingResponse(self._captions.language) + + +class AsyncCaptionsResourceWithStreamingResponse: + def __init__(self, captions: AsyncCaptionsResource) -> None: + self._captions = captions + + self.get = async_to_streamed_response_wrapper( + captions.get, + ) + + @cached_property + def language(self) -> AsyncLanguageResourceWithStreamingResponse: + return AsyncLanguageResourceWithStreamingResponse(self._captions.language) diff --git a/src/cloudflare/resources/stream/captions/language/__init__.py b/src/cloudflare/resources/stream/captions/language/__init__.py new file mode 100644 index 00000000000..8780a9b70d8 --- /dev/null +++ b/src/cloudflare/resources/stream/captions/language/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .vtt import ( + VttResource, + AsyncVttResource, + VttResourceWithRawResponse, + AsyncVttResourceWithRawResponse, + VttResourceWithStreamingResponse, + AsyncVttResourceWithStreamingResponse, +) +from .language import ( + LanguageResource, + AsyncLanguageResource, + LanguageResourceWithRawResponse, + AsyncLanguageResourceWithRawResponse, + LanguageResourceWithStreamingResponse, + AsyncLanguageResourceWithStreamingResponse, +) + +__all__ = [ + "VttResource", + "AsyncVttResource", + "VttResourceWithRawResponse", + "AsyncVttResourceWithRawResponse", + "VttResourceWithStreamingResponse", + "AsyncVttResourceWithStreamingResponse", + "LanguageResource", + "AsyncLanguageResource", + "LanguageResourceWithRawResponse", + "AsyncLanguageResourceWithRawResponse", + "LanguageResourceWithStreamingResponse", + "AsyncLanguageResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/stream/captions/language/language.py b/src/cloudflare/resources/stream/captions/language/language.py new file mode 100644 index 00000000000..67482e4a9a7 --- /dev/null +++ b/src/cloudflare/resources/stream/captions/language/language.py @@ -0,0 +1,450 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Optional, cast + +import httpx + +from .vtt import ( + VttResource, + AsyncVttResource, + VttResourceWithRawResponse, + AsyncVttResourceWithRawResponse, + VttResourceWithStreamingResponse, + AsyncVttResourceWithStreamingResponse, +) +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.stream.caption import Caption +from .....types.stream.captions import language_delete_params, language_update_params +from .....types.stream.captions.language_delete_response import LanguageDeleteResponse + +__all__ = ["LanguageResource", "AsyncLanguageResource"] + + +class LanguageResource(SyncAPIResource): + @cached_property + def vtt(self) -> VttResource: + return VttResource(self._client) + + @cached_property + def with_raw_response(self) -> LanguageResourceWithRawResponse: + return LanguageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LanguageResourceWithStreamingResponse: + return LanguageResourceWithStreamingResponse(self) + + def update( + self, + language: str, + *, + account_id: str, + identifier: str, + file: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[Caption]: + """ + Uploads the caption or subtitle file to the endpoint for a specific BCP47 + language. One caption or subtitle file per language is allowed. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + language: The language tag in BCP 47 format. + + file: The WebVTT file containing the caption or subtitle content. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + if not language: + raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") + return self._put( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}", + body=maybe_transform({"file": file}, language_update_params.LanguageUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Caption]]._unwrapper, + ), + cast_to=cast(Type[Optional[Caption]], ResultWrapper[Caption]), + ) + + def delete( + self, + language: str, + *, + account_id: str, + identifier: str, + body: object, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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: + """ + Removes the captions or subtitles from a video. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + language: The language tag in BCP 47 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + if not language: + raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") + return self._delete( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}", + body=maybe_transform(body, language_delete_params.LanguageDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[LanguageDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + def get( + self, + language: str, + *, + account_id: str, + identifier: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[Caption]: + """ + Lists the captions or subtitles for provided language. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + language: The language tag in BCP 47 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + if not language: + raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") + return self._get( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Caption]]._unwrapper, + ), + cast_to=cast(Type[Optional[Caption]], ResultWrapper[Caption]), + ) + + +class AsyncLanguageResource(AsyncAPIResource): + @cached_property + def vtt(self) -> AsyncVttResource: + return AsyncVttResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLanguageResourceWithRawResponse: + return AsyncLanguageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLanguageResourceWithStreamingResponse: + return AsyncLanguageResourceWithStreamingResponse(self) + + async def update( + self, + language: str, + *, + account_id: str, + identifier: str, + file: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[Caption]: + """ + Uploads the caption or subtitle file to the endpoint for a specific BCP47 + language. One caption or subtitle file per language is allowed. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + language: The language tag in BCP 47 format. + + file: The WebVTT file containing the caption or subtitle content. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + if not language: + raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") + return await self._put( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}", + body=await async_maybe_transform({"file": file}, language_update_params.LanguageUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Caption]]._unwrapper, + ), + cast_to=cast(Type[Optional[Caption]], ResultWrapper[Caption]), + ) + + async def delete( + self, + language: str, + *, + account_id: str, + identifier: str, + body: object, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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: + """ + Removes the captions or subtitles from a video. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + language: The language tag in BCP 47 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + if not language: + raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") + return await self._delete( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}", + body=await async_maybe_transform(body, language_delete_params.LanguageDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[LanguageDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + async def get( + self, + language: str, + *, + account_id: str, + identifier: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[Caption]: + """ + Lists the captions or subtitles for provided language. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + language: The language tag in BCP 47 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + if not language: + raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") + return await self._get( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Caption]]._unwrapper, + ), + cast_to=cast(Type[Optional[Caption]], ResultWrapper[Caption]), + ) + + +class LanguageResourceWithRawResponse: + def __init__(self, language: LanguageResource) -> None: + self._language = language + + self.update = to_raw_response_wrapper( + language.update, + ) + self.delete = to_raw_response_wrapper( + language.delete, + ) + self.get = to_raw_response_wrapper( + language.get, + ) + + @cached_property + def vtt(self) -> VttResourceWithRawResponse: + return VttResourceWithRawResponse(self._language.vtt) + + +class AsyncLanguageResourceWithRawResponse: + def __init__(self, language: AsyncLanguageResource) -> None: + self._language = language + + self.update = async_to_raw_response_wrapper( + language.update, + ) + self.delete = async_to_raw_response_wrapper( + language.delete, + ) + self.get = async_to_raw_response_wrapper( + language.get, + ) + + @cached_property + def vtt(self) -> AsyncVttResourceWithRawResponse: + return AsyncVttResourceWithRawResponse(self._language.vtt) + + +class LanguageResourceWithStreamingResponse: + def __init__(self, language: LanguageResource) -> None: + self._language = language + + self.update = to_streamed_response_wrapper( + language.update, + ) + self.delete = to_streamed_response_wrapper( + language.delete, + ) + self.get = to_streamed_response_wrapper( + language.get, + ) + + @cached_property + def vtt(self) -> VttResourceWithStreamingResponse: + return VttResourceWithStreamingResponse(self._language.vtt) + + +class AsyncLanguageResourceWithStreamingResponse: + def __init__(self, language: AsyncLanguageResource) -> None: + self._language = language + + self.update = async_to_streamed_response_wrapper( + language.update, + ) + self.delete = async_to_streamed_response_wrapper( + language.delete, + ) + self.get = async_to_streamed_response_wrapper( + language.get, + ) + + @cached_property + def vtt(self) -> AsyncVttResourceWithStreamingResponse: + return AsyncVttResourceWithStreamingResponse(self._language.vtt) diff --git a/src/cloudflare/resources/stream/captions/language/vtt.py b/src/cloudflare/resources/stream/captions/language/vtt.py new file mode 100644 index 00000000000..3136e929c75 --- /dev/null +++ b/src/cloudflare/resources/stream/captions/language/vtt.py @@ -0,0 +1,168 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import ( + make_request_options, +) + +__all__ = ["VttResource", "AsyncVttResource"] + + +class VttResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VttResourceWithRawResponse: + return VttResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VttResourceWithStreamingResponse: + return VttResourceWithStreamingResponse(self) + + def get( + self, + language: str, + *, + account_id: str, + identifier: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> str: + """ + Return WebVTT captions for a provided language. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + language: The language tag in BCP 47 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + if not language: + raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") + extra_headers = {"Accept": "text/vtt", **(extra_headers or {})} + return self._get( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}/vtt", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=str, + ) + + +class AsyncVttResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVttResourceWithRawResponse: + return AsyncVttResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVttResourceWithStreamingResponse: + return AsyncVttResourceWithStreamingResponse(self) + + async def get( + self, + language: str, + *, + account_id: str, + identifier: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> str: + """ + Return WebVTT captions for a provided language. + + Args: + account_id: Identifier + + identifier: A Cloudflare-generated unique identifier for a media item. + + language: The language tag in BCP 47 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + if not language: + raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") + extra_headers = {"Accept": "text/vtt", **(extra_headers or {})} + return await self._get( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}/vtt", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=str, + ) + + +class VttResourceWithRawResponse: + def __init__(self, vtt: VttResource) -> None: + self._vtt = vtt + + self.get = to_raw_response_wrapper( + vtt.get, + ) + + +class AsyncVttResourceWithRawResponse: + def __init__(self, vtt: AsyncVttResource) -> None: + self._vtt = vtt + + self.get = async_to_raw_response_wrapper( + vtt.get, + ) + + +class VttResourceWithStreamingResponse: + def __init__(self, vtt: VttResource) -> None: + self._vtt = vtt + + self.get = to_streamed_response_wrapper( + vtt.get, + ) + + +class AsyncVttResourceWithStreamingResponse: + def __init__(self, vtt: AsyncVttResource) -> None: + self._vtt = vtt + + self.get = async_to_streamed_response_wrapper( + vtt.get, + ) diff --git a/src/cloudflare/resources/stream/clip.py b/src/cloudflare/resources/stream/clip.py index 25449822e06..9c34d5ab4aa 100644 --- a/src/cloudflare/resources/stream/clip.py +++ b/src/cloudflare/resources/stream/clip.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Optional, cast import httpx @@ -23,19 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.stream import StreamClipping, clip_create_params +from ...types.stream import clip_create_params +from ...types.stream.clip import Clip +from ...types.stream.allowed_origins import AllowedOrigins -__all__ = ["Clip", "AsyncClip"] +__all__ = ["ClipResource", "AsyncClipResource"] -class Clip(SyncAPIResource): +class ClipResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ClipWithRawResponse: - return ClipWithRawResponse(self) + def with_raw_response(self) -> ClipResourceWithRawResponse: + return ClipResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ClipWithStreamingResponse: - return ClipWithStreamingResponse(self) + def with_streaming_response(self) -> ClipResourceWithStreamingResponse: + return ClipResourceWithStreamingResponse(self) def create( self, @@ -44,7 +46,7 @@ def create( clipped_from_video_uid: str, end_time_seconds: int, start_time_seconds: int, - allowed_origins: List[str] | NotGiven = NOT_GIVEN, + allowed_origins: List[AllowedOrigins] | NotGiven = NOT_GIVEN, creator: str | NotGiven = NOT_GIVEN, max_duration_seconds: int | NotGiven = NOT_GIVEN, require_signed_urls: bool | NotGiven = NOT_GIVEN, @@ -56,7 +58,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamClipping: + ) -> Optional[Clip]: """ Clips a video based on the specified start and end times provided in seconds. @@ -119,20 +121,20 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Clip]]._unwrapper, ), - cast_to=cast(Type[StreamClipping], ResultWrapper[StreamClipping]), + cast_to=cast(Type[Optional[Clip]], ResultWrapper[Clip]), ) -class AsyncClip(AsyncAPIResource): +class AsyncClipResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncClipWithRawResponse: - return AsyncClipWithRawResponse(self) + def with_raw_response(self) -> AsyncClipResourceWithRawResponse: + return AsyncClipResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncClipWithStreamingResponse: - return AsyncClipWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncClipResourceWithStreamingResponse: + return AsyncClipResourceWithStreamingResponse(self) async def create( self, @@ -141,7 +143,7 @@ async def create( clipped_from_video_uid: str, end_time_seconds: int, start_time_seconds: int, - allowed_origins: List[str] | NotGiven = NOT_GIVEN, + allowed_origins: List[AllowedOrigins] | NotGiven = NOT_GIVEN, creator: str | NotGiven = NOT_GIVEN, max_duration_seconds: int | NotGiven = NOT_GIVEN, require_signed_urls: bool | NotGiven = NOT_GIVEN, @@ -153,7 +155,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamClipping: + ) -> Optional[Clip]: """ Clips a video based on the specified start and end times provided in seconds. @@ -216,14 +218,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Clip]]._unwrapper, ), - cast_to=cast(Type[StreamClipping], ResultWrapper[StreamClipping]), + cast_to=cast(Type[Optional[Clip]], ResultWrapper[Clip]), ) -class ClipWithRawResponse: - def __init__(self, clip: Clip) -> None: +class ClipResourceWithRawResponse: + def __init__(self, clip: ClipResource) -> None: self._clip = clip self.create = to_raw_response_wrapper( @@ -231,8 +233,8 @@ def __init__(self, clip: Clip) -> None: ) -class AsyncClipWithRawResponse: - def __init__(self, clip: AsyncClip) -> None: +class AsyncClipResourceWithRawResponse: + def __init__(self, clip: AsyncClipResource) -> None: self._clip = clip self.create = async_to_raw_response_wrapper( @@ -240,8 +242,8 @@ def __init__(self, clip: AsyncClip) -> None: ) -class ClipWithStreamingResponse: - def __init__(self, clip: Clip) -> None: +class ClipResourceWithStreamingResponse: + def __init__(self, clip: ClipResource) -> None: self._clip = clip self.create = to_streamed_response_wrapper( @@ -249,8 +251,8 @@ def __init__(self, clip: Clip) -> None: ) -class AsyncClipWithStreamingResponse: - def __init__(self, clip: AsyncClip) -> None: +class AsyncClipResourceWithStreamingResponse: + def __init__(self, clip: AsyncClipResource) -> None: self._clip = clip self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/copy.py b/src/cloudflare/resources/stream/copy.py index 753e294a268..426b93d4b48 100644 --- a/src/cloudflare/resources/stream/copy.py +++ b/src/cloudflare/resources/stream/copy.py @@ -2,12 +2,11 @@ from __future__ import annotations -from typing import List, Type, Union, cast +from typing import List, Type, Union, Optional, cast from datetime import datetime import httpx -from ...types import StreamVideos from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -26,25 +25,27 @@ make_request_options, ) from ...types.stream import copy_create_params +from ...types.stream.video import Video +from ...types.stream.allowed_origins import AllowedOrigins -__all__ = ["Copy", "AsyncCopy"] +__all__ = ["CopyResource", "AsyncCopyResource"] -class Copy(SyncAPIResource): +class CopyResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CopyWithRawResponse: - return CopyWithRawResponse(self) + def with_raw_response(self) -> CopyResourceWithRawResponse: + return CopyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CopyWithStreamingResponse: - return CopyWithStreamingResponse(self) + def with_streaming_response(self) -> CopyResourceWithStreamingResponse: + return CopyResourceWithStreamingResponse(self) def create( self, *, account_id: str, url: str, - allowed_origins: List[str] | NotGiven = NOT_GIVEN, + allowed_origins: List[AllowedOrigins] | NotGiven = NOT_GIVEN, creator: str | NotGiven = NOT_GIVEN, meta: object | NotGiven = NOT_GIVEN, require_signed_urls: bool | NotGiven = NOT_GIVEN, @@ -57,7 +58,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamVideos: + ) -> Optional[Video]: """ Uploads a video to Stream from a provided URL. @@ -119,27 +120,27 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Video]]._unwrapper, ), - cast_to=cast(Type[StreamVideos], ResultWrapper[StreamVideos]), + cast_to=cast(Type[Optional[Video]], ResultWrapper[Video]), ) -class AsyncCopy(AsyncAPIResource): +class AsyncCopyResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCopyWithRawResponse: - return AsyncCopyWithRawResponse(self) + def with_raw_response(self) -> AsyncCopyResourceWithRawResponse: + return AsyncCopyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCopyWithStreamingResponse: - return AsyncCopyWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCopyResourceWithStreamingResponse: + return AsyncCopyResourceWithStreamingResponse(self) async def create( self, *, account_id: str, url: str, - allowed_origins: List[str] | NotGiven = NOT_GIVEN, + allowed_origins: List[AllowedOrigins] | NotGiven = NOT_GIVEN, creator: str | NotGiven = NOT_GIVEN, meta: object | NotGiven = NOT_GIVEN, require_signed_urls: bool | NotGiven = NOT_GIVEN, @@ -152,7 +153,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamVideos: + ) -> Optional[Video]: """ Uploads a video to Stream from a provided URL. @@ -214,14 +215,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Video]]._unwrapper, ), - cast_to=cast(Type[StreamVideos], ResultWrapper[StreamVideos]), + cast_to=cast(Type[Optional[Video]], ResultWrapper[Video]), ) -class CopyWithRawResponse: - def __init__(self, copy: Copy) -> None: +class CopyResourceWithRawResponse: + def __init__(self, copy: CopyResource) -> None: self._copy = copy self.create = to_raw_response_wrapper( @@ -229,8 +230,8 @@ def __init__(self, copy: Copy) -> None: ) -class AsyncCopyWithRawResponse: - def __init__(self, copy: AsyncCopy) -> None: +class AsyncCopyResourceWithRawResponse: + def __init__(self, copy: AsyncCopyResource) -> None: self._copy = copy self.create = async_to_raw_response_wrapper( @@ -238,8 +239,8 @@ def __init__(self, copy: AsyncCopy) -> None: ) -class CopyWithStreamingResponse: - def __init__(self, copy: Copy) -> None: +class CopyResourceWithStreamingResponse: + def __init__(self, copy: CopyResource) -> None: self._copy = copy self.create = to_streamed_response_wrapper( @@ -247,8 +248,8 @@ def __init__(self, copy: Copy) -> None: ) -class AsyncCopyWithStreamingResponse: - def __init__(self, copy: AsyncCopy) -> None: +class AsyncCopyResourceWithStreamingResponse: + def __init__(self, copy: AsyncCopyResource) -> None: self._copy = copy self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/direct_upload.py b/src/cloudflare/resources/stream/direct_upload.py index bc679e10de6..de337332a8c 100644 --- a/src/cloudflare/resources/stream/direct_upload.py +++ b/src/cloudflare/resources/stream/direct_upload.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Union, cast +from typing import List, Type, Union, Optional, cast from datetime import datetime import httpx @@ -24,26 +24,28 @@ from ..._base_client import ( make_request_options, ) -from ...types.stream import DirectUploadCreateResponse, direct_upload_create_params +from ...types.stream import direct_upload_create_params +from ...types.stream.allowed_origins import AllowedOrigins +from ...types.stream.direct_upload_create_response import DirectUploadCreateResponse -__all__ = ["DirectUpload", "AsyncDirectUpload"] +__all__ = ["DirectUploadResource", "AsyncDirectUploadResource"] -class DirectUpload(SyncAPIResource): +class DirectUploadResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DirectUploadWithRawResponse: - return DirectUploadWithRawResponse(self) + def with_raw_response(self) -> DirectUploadResourceWithRawResponse: + return DirectUploadResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DirectUploadWithStreamingResponse: - return DirectUploadWithStreamingResponse(self) + def with_streaming_response(self) -> DirectUploadResourceWithStreamingResponse: + return DirectUploadResourceWithStreamingResponse(self) def create( self, *, account_id: str, max_duration_seconds: int, - allowed_origins: List[str] | NotGiven = NOT_GIVEN, + allowed_origins: List[AllowedOrigins] | NotGiven = NOT_GIVEN, creator: str | NotGiven = NOT_GIVEN, expiry: Union[str, datetime] | NotGiven = NOT_GIVEN, meta: object | NotGiven = NOT_GIVEN, @@ -57,7 +59,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DirectUploadCreateResponse: + ) -> Optional[DirectUploadCreateResponse]: """ Creates a direct upload that allows video uploads without an API key. @@ -123,27 +125,27 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DirectUploadCreateResponse]]._unwrapper, ), - cast_to=cast(Type[DirectUploadCreateResponse], ResultWrapper[DirectUploadCreateResponse]), + cast_to=cast(Type[Optional[DirectUploadCreateResponse]], ResultWrapper[DirectUploadCreateResponse]), ) -class AsyncDirectUpload(AsyncAPIResource): +class AsyncDirectUploadResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDirectUploadWithRawResponse: - return AsyncDirectUploadWithRawResponse(self) + def with_raw_response(self) -> AsyncDirectUploadResourceWithRawResponse: + return AsyncDirectUploadResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDirectUploadWithStreamingResponse: - return AsyncDirectUploadWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDirectUploadResourceWithStreamingResponse: + return AsyncDirectUploadResourceWithStreamingResponse(self) async def create( self, *, account_id: str, max_duration_seconds: int, - allowed_origins: List[str] | NotGiven = NOT_GIVEN, + allowed_origins: List[AllowedOrigins] | NotGiven = NOT_GIVEN, creator: str | NotGiven = NOT_GIVEN, expiry: Union[str, datetime] | NotGiven = NOT_GIVEN, meta: object | NotGiven = NOT_GIVEN, @@ -157,7 +159,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DirectUploadCreateResponse: + ) -> Optional[DirectUploadCreateResponse]: """ Creates a direct upload that allows video uploads without an API key. @@ -223,14 +225,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DirectUploadCreateResponse]]._unwrapper, ), - cast_to=cast(Type[DirectUploadCreateResponse], ResultWrapper[DirectUploadCreateResponse]), + cast_to=cast(Type[Optional[DirectUploadCreateResponse]], ResultWrapper[DirectUploadCreateResponse]), ) -class DirectUploadWithRawResponse: - def __init__(self, direct_upload: DirectUpload) -> None: +class DirectUploadResourceWithRawResponse: + def __init__(self, direct_upload: DirectUploadResource) -> None: self._direct_upload = direct_upload self.create = to_raw_response_wrapper( @@ -238,8 +240,8 @@ def __init__(self, direct_upload: DirectUpload) -> None: ) -class AsyncDirectUploadWithRawResponse: - def __init__(self, direct_upload: AsyncDirectUpload) -> None: +class AsyncDirectUploadResourceWithRawResponse: + def __init__(self, direct_upload: AsyncDirectUploadResource) -> None: self._direct_upload = direct_upload self.create = async_to_raw_response_wrapper( @@ -247,8 +249,8 @@ def __init__(self, direct_upload: AsyncDirectUpload) -> None: ) -class DirectUploadWithStreamingResponse: - def __init__(self, direct_upload: DirectUpload) -> None: +class DirectUploadResourceWithStreamingResponse: + def __init__(self, direct_upload: DirectUploadResource) -> None: self._direct_upload = direct_upload self.create = to_streamed_response_wrapper( @@ -256,8 +258,8 @@ def __init__(self, direct_upload: DirectUpload) -> None: ) -class AsyncDirectUploadWithStreamingResponse: - def __init__(self, direct_upload: AsyncDirectUpload) -> None: +class AsyncDirectUploadResourceWithStreamingResponse: + def __init__(self, direct_upload: AsyncDirectUploadResource) -> None: self._direct_upload = direct_upload self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/downloads.py b/src/cloudflare/resources/stream/downloads.py index 8441b43a406..531b646b1bc 100644 --- a/src/cloudflare/resources/stream/downloads.py +++ b/src/cloudflare/resources/stream/downloads.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, 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 ( @@ -19,32 +23,36 @@ from ..._base_client import ( make_request_options, ) -from ...types.stream import DownloadGetResponse, DownloadCreateResponse, DownloadDeleteResponse +from ...types.stream import download_create_params +from ...types.stream.download_get_response import DownloadGetResponse +from ...types.stream.download_create_response import DownloadCreateResponse +from ...types.stream.download_delete_response import DownloadDeleteResponse -__all__ = ["Downloads", "AsyncDownloads"] +__all__ = ["DownloadsResource", "AsyncDownloadsResource"] -class Downloads(SyncAPIResource): +class DownloadsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DownloadsWithRawResponse: - return DownloadsWithRawResponse(self) + def with_raw_response(self) -> DownloadsResourceWithRawResponse: + return DownloadsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DownloadsWithStreamingResponse: - return DownloadsWithStreamingResponse(self) + def with_streaming_response(self) -> DownloadsResourceWithStreamingResponse: + return DownloadsResourceWithStreamingResponse(self) def create( self, identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> DownloadCreateResponse: + ) -> Optional[DownloadCreateResponse]: """ Creates a download for a video when a video is ready to view. @@ -66,15 +74,16 @@ def create( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadCreateResponse, + Optional[DownloadCreateResponse], self._post( f"/accounts/{account_id}/stream/{identifier}/downloads", + body=maybe_transform(body, download_create_params.DownloadCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DownloadCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DownloadCreateResponse] @@ -93,7 +102,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadDeleteResponse: + ) -> Optional[DownloadDeleteResponse]: """ Delete the downloads for a video. @@ -115,7 +124,7 @@ def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadDeleteResponse, + Optional[DownloadDeleteResponse], self._delete( f"/accounts/{account_id}/stream/{identifier}/downloads", options=make_request_options( @@ -123,7 +132,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DownloadDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DownloadDeleteResponse] @@ -142,7 +151,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadGetResponse: + ) -> Optional[DownloadGetResponse]: """ Lists the downloads created for a video. @@ -164,7 +173,7 @@ def get( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadGetResponse, + Optional[DownloadGetResponse], self._get( f"/accounts/{account_id}/stream/{identifier}/downloads", options=make_request_options( @@ -172,7 +181,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DownloadGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DownloadGetResponse] @@ -181,27 +190,28 @@ def get( ) -class AsyncDownloads(AsyncAPIResource): +class AsyncDownloadsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDownloadsWithRawResponse: - return AsyncDownloadsWithRawResponse(self) + def with_raw_response(self) -> AsyncDownloadsResourceWithRawResponse: + return AsyncDownloadsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDownloadsWithStreamingResponse: - return AsyncDownloadsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDownloadsResourceWithStreamingResponse: + return AsyncDownloadsResourceWithStreamingResponse(self) async def create( self, identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> DownloadCreateResponse: + ) -> Optional[DownloadCreateResponse]: """ Creates a download for a video when a video is ready to view. @@ -223,15 +233,16 @@ async def create( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadCreateResponse, + Optional[DownloadCreateResponse], await self._post( f"/accounts/{account_id}/stream/{identifier}/downloads", + body=await async_maybe_transform(body, download_create_params.DownloadCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DownloadCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DownloadCreateResponse] @@ -250,7 +261,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadDeleteResponse: + ) -> Optional[DownloadDeleteResponse]: """ Delete the downloads for a video. @@ -272,7 +283,7 @@ async def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadDeleteResponse, + Optional[DownloadDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/{identifier}/downloads", options=make_request_options( @@ -280,7 +291,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DownloadDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DownloadDeleteResponse] @@ -299,7 +310,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadGetResponse: + ) -> Optional[DownloadGetResponse]: """ Lists the downloads created for a video. @@ -321,7 +332,7 @@ async def get( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadGetResponse, + Optional[DownloadGetResponse], await self._get( f"/accounts/{account_id}/stream/{identifier}/downloads", options=make_request_options( @@ -329,7 +340,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DownloadGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DownloadGetResponse] @@ -338,8 +349,8 @@ async def get( ) -class DownloadsWithRawResponse: - def __init__(self, downloads: Downloads) -> None: +class DownloadsResourceWithRawResponse: + def __init__(self, downloads: DownloadsResource) -> None: self._downloads = downloads self.create = to_raw_response_wrapper( @@ -353,8 +364,8 @@ def __init__(self, downloads: Downloads) -> None: ) -class AsyncDownloadsWithRawResponse: - def __init__(self, downloads: AsyncDownloads) -> None: +class AsyncDownloadsResourceWithRawResponse: + def __init__(self, downloads: AsyncDownloadsResource) -> None: self._downloads = downloads self.create = async_to_raw_response_wrapper( @@ -368,8 +379,8 @@ def __init__(self, downloads: AsyncDownloads) -> None: ) -class DownloadsWithStreamingResponse: - def __init__(self, downloads: Downloads) -> None: +class DownloadsResourceWithStreamingResponse: + def __init__(self, downloads: DownloadsResource) -> None: self._downloads = downloads self.create = to_streamed_response_wrapper( @@ -383,8 +394,8 @@ def __init__(self, downloads: Downloads) -> None: ) -class AsyncDownloadsWithStreamingResponse: - def __init__(self, downloads: AsyncDownloads) -> None: +class AsyncDownloadsResourceWithStreamingResponse: + def __init__(self, downloads: AsyncDownloadsResource) -> None: self._downloads = downloads self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/embed.py b/src/cloudflare/resources/stream/embed.py index 67d3590ca5b..4f1dc61f770 100644 --- a/src/cloudflare/resources/stream/embed.py +++ b/src/cloudflare/resources/stream/embed.py @@ -17,17 +17,17 @@ make_request_options, ) -__all__ = ["Embed", "AsyncEmbed"] +__all__ = ["EmbedResource", "AsyncEmbedResource"] -class Embed(SyncAPIResource): +class EmbedResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> EmbedWithRawResponse: - return EmbedWithRawResponse(self) + def with_raw_response(self) -> EmbedResourceWithRawResponse: + return EmbedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EmbedWithStreamingResponse: - return EmbedWithStreamingResponse(self) + def with_streaming_response(self) -> EmbedResourceWithStreamingResponse: + return EmbedResourceWithStreamingResponse(self) def get( self, @@ -72,14 +72,14 @@ def get( ) -class AsyncEmbed(AsyncAPIResource): +class AsyncEmbedResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncEmbedWithRawResponse: - return AsyncEmbedWithRawResponse(self) + def with_raw_response(self) -> AsyncEmbedResourceWithRawResponse: + return AsyncEmbedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEmbedWithStreamingResponse: - return AsyncEmbedWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEmbedResourceWithStreamingResponse: + return AsyncEmbedResourceWithStreamingResponse(self) async def get( self, @@ -124,8 +124,8 @@ async def get( ) -class EmbedWithRawResponse: - def __init__(self, embed: Embed) -> None: +class EmbedResourceWithRawResponse: + def __init__(self, embed: EmbedResource) -> None: self._embed = embed self.get = to_raw_response_wrapper( @@ -133,8 +133,8 @@ def __init__(self, embed: Embed) -> None: ) -class AsyncEmbedWithRawResponse: - def __init__(self, embed: AsyncEmbed) -> None: +class AsyncEmbedResourceWithRawResponse: + def __init__(self, embed: AsyncEmbedResource) -> None: self._embed = embed self.get = async_to_raw_response_wrapper( @@ -142,8 +142,8 @@ def __init__(self, embed: AsyncEmbed) -> None: ) -class EmbedWithStreamingResponse: - def __init__(self, embed: Embed) -> None: +class EmbedResourceWithStreamingResponse: + def __init__(self, embed: EmbedResource) -> None: self._embed = embed self.get = to_streamed_response_wrapper( @@ -151,8 +151,8 @@ def __init__(self, embed: Embed) -> None: ) -class AsyncEmbedWithStreamingResponse: - def __init__(self, embed: AsyncEmbed) -> None: +class AsyncEmbedResourceWithStreamingResponse: + def __init__(self, embed: AsyncEmbedResource) -> None: self._embed = embed self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/keys.py b/src/cloudflare/resources/stream/keys.py index 9f2718c1e69..979b687da15 100644 --- a/src/cloudflare/resources/stream/keys.py +++ b/src/cloudflare/resources/stream/keys.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Any, 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 ( @@ -19,31 +23,35 @@ from ..._base_client import ( make_request_options, ) -from ...types.stream import StreamKeys, KeyGetResponse, KeyDeleteResponse +from ...types.stream import key_create_params, key_delete_params +from ...types.stream.keys import Keys +from ...types.stream.key_get_response import KeyGetResponse +from ...types.stream.key_delete_response import KeyDeleteResponse -__all__ = ["Keys", "AsyncKeys"] +__all__ = ["KeysResource", "AsyncKeysResource"] -class Keys(SyncAPIResource): +class KeysResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> KeysWithRawResponse: - return KeysWithRawResponse(self) + def with_raw_response(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> KeysWithStreamingResponse: - return KeysWithStreamingResponse(self) + def with_streaming_response(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self) def create( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> StreamKeys: + ) -> Optional[Keys]: """Creates an RSA private key in PEM and JWK formats. Key files are only displayed @@ -65,14 +73,15 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( f"/accounts/{account_id}/stream/keys", + body=maybe_transform(body, key_create_params.KeyCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Keys]]._unwrapper, ), - cast_to=cast(Type[StreamKeys], ResultWrapper[StreamKeys]), + cast_to=cast(Type[Optional[Keys]], ResultWrapper[Keys]), ) def delete( @@ -80,13 +89,14 @@ def delete( identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> KeyDeleteResponse: + ) -> Optional[KeyDeleteResponse]: """ Deletes signing keys and revokes all signed URLs generated with the key. @@ -108,15 +118,16 @@ def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyDeleteResponse, + Optional[KeyDeleteResponse], self._delete( f"/accounts/{account_id}/stream/keys/{identifier}", + body=maybe_transform(body, key_delete_params.KeyDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[KeyDeleteResponse] @@ -134,7 +145,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyGetResponse: + ) -> Optional[KeyGetResponse]: """ Lists the video ID and creation date and time when a signing key was created. @@ -158,32 +169,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyGetResponse]]._unwrapper, ), - cast_to=cast(Type[KeyGetResponse], ResultWrapper[KeyGetResponse]), + cast_to=cast(Type[Optional[KeyGetResponse]], ResultWrapper[KeyGetResponse]), ) -class AsyncKeys(AsyncAPIResource): +class AsyncKeysResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncKeysWithRawResponse: - return AsyncKeysWithRawResponse(self) + def with_raw_response(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncKeysWithStreamingResponse: - return AsyncKeysWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self) async def create( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> StreamKeys: + ) -> Optional[Keys]: """Creates an RSA private key in PEM and JWK formats. Key files are only displayed @@ -205,14 +217,15 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( f"/accounts/{account_id}/stream/keys", + body=await async_maybe_transform(body, key_create_params.KeyCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Keys]]._unwrapper, ), - cast_to=cast(Type[StreamKeys], ResultWrapper[StreamKeys]), + cast_to=cast(Type[Optional[Keys]], ResultWrapper[Keys]), ) async def delete( @@ -220,13 +233,14 @@ async def delete( identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> KeyDeleteResponse: + ) -> Optional[KeyDeleteResponse]: """ Deletes signing keys and revokes all signed URLs generated with the key. @@ -248,15 +262,16 @@ async def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyDeleteResponse, + Optional[KeyDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/keys/{identifier}", + body=await async_maybe_transform(body, key_delete_params.KeyDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[KeyDeleteResponse] @@ -274,7 +289,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyGetResponse: + ) -> Optional[KeyGetResponse]: """ Lists the video ID and creation date and time when a signing key was created. @@ -298,14 +313,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyGetResponse]]._unwrapper, ), - cast_to=cast(Type[KeyGetResponse], ResultWrapper[KeyGetResponse]), + cast_to=cast(Type[Optional[KeyGetResponse]], ResultWrapper[KeyGetResponse]), ) -class KeysWithRawResponse: - def __init__(self, keys: Keys) -> None: +class KeysResourceWithRawResponse: + def __init__(self, keys: KeysResource) -> None: self._keys = keys self.create = to_raw_response_wrapper( @@ -319,8 +334,8 @@ def __init__(self, keys: Keys) -> None: ) -class AsyncKeysWithRawResponse: - def __init__(self, keys: AsyncKeys) -> None: +class AsyncKeysResourceWithRawResponse: + def __init__(self, keys: AsyncKeysResource) -> None: self._keys = keys self.create = async_to_raw_response_wrapper( @@ -334,8 +349,8 @@ def __init__(self, keys: AsyncKeys) -> None: ) -class KeysWithStreamingResponse: - def __init__(self, keys: Keys) -> None: +class KeysResourceWithStreamingResponse: + def __init__(self, keys: KeysResource) -> None: self._keys = keys self.create = to_streamed_response_wrapper( @@ -349,8 +364,8 @@ def __init__(self, keys: Keys) -> None: ) -class AsyncKeysWithStreamingResponse: - def __init__(self, keys: AsyncKeys) -> None: +class AsyncKeysResourceWithStreamingResponse: + def __init__(self, keys: AsyncKeysResource) -> None: self._keys = keys self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/live_inputs/__init__.py b/src/cloudflare/resources/stream/live_inputs/__init__.py index 19fb3ff73f7..427b214e46a 100644 --- a/src/cloudflare/resources/stream/live_inputs/__init__.py +++ b/src/cloudflare/resources/stream/live_inputs/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .outputs import ( - Outputs, - AsyncOutputs, - OutputsWithRawResponse, - AsyncOutputsWithRawResponse, - OutputsWithStreamingResponse, - AsyncOutputsWithStreamingResponse, + OutputsResource, + AsyncOutputsResource, + OutputsResourceWithRawResponse, + AsyncOutputsResourceWithRawResponse, + OutputsResourceWithStreamingResponse, + AsyncOutputsResourceWithStreamingResponse, ) from .live_inputs import ( - LiveInputs, - AsyncLiveInputs, - LiveInputsWithRawResponse, - AsyncLiveInputsWithRawResponse, - LiveInputsWithStreamingResponse, - AsyncLiveInputsWithStreamingResponse, + LiveInputsResource, + AsyncLiveInputsResource, + LiveInputsResourceWithRawResponse, + AsyncLiveInputsResourceWithRawResponse, + LiveInputsResourceWithStreamingResponse, + AsyncLiveInputsResourceWithStreamingResponse, ) __all__ = [ - "Outputs", - "AsyncOutputs", - "OutputsWithRawResponse", - "AsyncOutputsWithRawResponse", - "OutputsWithStreamingResponse", - "AsyncOutputsWithStreamingResponse", - "LiveInputs", - "AsyncLiveInputs", - "LiveInputsWithRawResponse", - "AsyncLiveInputsWithRawResponse", - "LiveInputsWithStreamingResponse", - "AsyncLiveInputsWithStreamingResponse", + "OutputsResource", + "AsyncOutputsResource", + "OutputsResourceWithRawResponse", + "AsyncOutputsResourceWithRawResponse", + "OutputsResourceWithStreamingResponse", + "AsyncOutputsResourceWithStreamingResponse", + "LiveInputsResource", + "AsyncLiveInputsResource", + "LiveInputsResourceWithRawResponse", + "AsyncLiveInputsResourceWithRawResponse", + "LiveInputsResourceWithStreamingResponse", + "AsyncLiveInputsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/stream/live_inputs/live_inputs.py b/src/cloudflare/resources/stream/live_inputs/live_inputs.py index 1be4a397c8a..23522cf5456 100644 --- a/src/cloudflare/resources/stream/live_inputs/live_inputs.py +++ b/src/cloudflare/resources/stream/live_inputs/live_inputs.py @@ -2,17 +2,17 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx from .outputs import ( - Outputs, - AsyncOutputs, - OutputsWithRawResponse, - AsyncOutputsWithRawResponse, - OutputsWithStreamingResponse, - AsyncOutputsWithStreamingResponse, + OutputsResource, + AsyncOutputsResource, + OutputsResourceWithRawResponse, + AsyncOutputsResourceWithRawResponse, + OutputsResourceWithStreamingResponse, + AsyncOutputsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ...._utils import ( @@ -32,28 +32,29 @@ make_request_options, ) from ....types.stream import ( - StreamLiveInput, - LiveInputListResponse, live_input_list_params, live_input_create_params, + live_input_delete_params, live_input_update_params, ) +from ....types.stream.live_input import LiveInput +from ....types.stream.live_input_list_response import LiveInputListResponse -__all__ = ["LiveInputs", "AsyncLiveInputs"] +__all__ = ["LiveInputsResource", "AsyncLiveInputsResource"] -class LiveInputs(SyncAPIResource): +class LiveInputsResource(SyncAPIResource): @cached_property - def outputs(self) -> Outputs: - return Outputs(self._client) + def outputs(self) -> OutputsResource: + return OutputsResource(self._client) @cached_property - def with_raw_response(self) -> LiveInputsWithRawResponse: - return LiveInputsWithRawResponse(self) + def with_raw_response(self) -> LiveInputsResourceWithRawResponse: + return LiveInputsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LiveInputsWithStreamingResponse: - return LiveInputsWithStreamingResponse(self) + def with_streaming_response(self) -> LiveInputsResourceWithStreamingResponse: + return LiveInputsResourceWithStreamingResponse(self) def create( self, @@ -69,7 +70,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamLiveInput: + ) -> Optional[LiveInput]: """ Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream. @@ -118,9 +119,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LiveInput]]._unwrapper, ), - cast_to=cast(Type[StreamLiveInput], ResultWrapper[StreamLiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) def update( @@ -138,7 +139,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamLiveInput: + ) -> Optional[LiveInput]: """ Updates a specified live input. @@ -192,9 +193,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LiveInput]]._unwrapper, ), - cast_to=cast(Type[StreamLiveInput], ResultWrapper[StreamLiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) def list( @@ -208,7 +209,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInputListResponse: + ) -> Optional[LiveInputListResponse]: """Lists the live inputs created for an account. To get the credentials needed to @@ -238,9 +239,9 @@ def list( extra_body=extra_body, timeout=timeout, query=maybe_transform({"include_counts": include_counts}, live_input_list_params.LiveInputListParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LiveInputListResponse]]._unwrapper, ), - cast_to=cast(Type[LiveInputListResponse], ResultWrapper[LiveInputListResponse]), + cast_to=cast(Type[Optional[LiveInputListResponse]], ResultWrapper[LiveInputListResponse]), ) def delete( @@ -248,6 +249,7 @@ def delete( live_input_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -281,6 +283,7 @@ def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( f"/accounts/{account_id}/stream/live_inputs/{live_input_identifier}", + body=maybe_transform(body, live_input_delete_params.LiveInputDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -298,7 +301,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamLiveInput: + ) -> Optional[LiveInput]: """ Retrieves details of an existing live input. @@ -328,24 +331,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LiveInput]]._unwrapper, ), - cast_to=cast(Type[StreamLiveInput], ResultWrapper[StreamLiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) -class AsyncLiveInputs(AsyncAPIResource): +class AsyncLiveInputsResource(AsyncAPIResource): @cached_property - def outputs(self) -> AsyncOutputs: - return AsyncOutputs(self._client) + def outputs(self) -> AsyncOutputsResource: + return AsyncOutputsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLiveInputsWithRawResponse: - return AsyncLiveInputsWithRawResponse(self) + def with_raw_response(self) -> AsyncLiveInputsResourceWithRawResponse: + return AsyncLiveInputsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLiveInputsWithStreamingResponse: - return AsyncLiveInputsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLiveInputsResourceWithStreamingResponse: + return AsyncLiveInputsResourceWithStreamingResponse(self) async def create( self, @@ -361,7 +364,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamLiveInput: + ) -> Optional[LiveInput]: """ Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream. @@ -410,9 +413,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LiveInput]]._unwrapper, ), - cast_to=cast(Type[StreamLiveInput], ResultWrapper[StreamLiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) async def update( @@ -430,7 +433,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamLiveInput: + ) -> Optional[LiveInput]: """ Updates a specified live input. @@ -484,9 +487,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LiveInput]]._unwrapper, ), - cast_to=cast(Type[StreamLiveInput], ResultWrapper[StreamLiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) async def list( @@ -500,7 +503,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInputListResponse: + ) -> Optional[LiveInputListResponse]: """Lists the live inputs created for an account. To get the credentials needed to @@ -532,9 +535,9 @@ async def list( query=await async_maybe_transform( {"include_counts": include_counts}, live_input_list_params.LiveInputListParams ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LiveInputListResponse]]._unwrapper, ), - cast_to=cast(Type[LiveInputListResponse], ResultWrapper[LiveInputListResponse]), + cast_to=cast(Type[Optional[LiveInputListResponse]], ResultWrapper[LiveInputListResponse]), ) async def delete( @@ -542,6 +545,7 @@ async def delete( live_input_identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -575,6 +579,7 @@ async def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( f"/accounts/{account_id}/stream/live_inputs/{live_input_identifier}", + body=await async_maybe_transform(body, live_input_delete_params.LiveInputDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -592,7 +597,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamLiveInput: + ) -> Optional[LiveInput]: """ Retrieves details of an existing live input. @@ -622,14 +627,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LiveInput]]._unwrapper, ), - cast_to=cast(Type[StreamLiveInput], ResultWrapper[StreamLiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) -class LiveInputsWithRawResponse: - def __init__(self, live_inputs: LiveInputs) -> None: +class LiveInputsResourceWithRawResponse: + def __init__(self, live_inputs: LiveInputsResource) -> None: self._live_inputs = live_inputs self.create = to_raw_response_wrapper( @@ -649,12 +654,12 @@ def __init__(self, live_inputs: LiveInputs) -> None: ) @cached_property - def outputs(self) -> OutputsWithRawResponse: - return OutputsWithRawResponse(self._live_inputs.outputs) + def outputs(self) -> OutputsResourceWithRawResponse: + return OutputsResourceWithRawResponse(self._live_inputs.outputs) -class AsyncLiveInputsWithRawResponse: - def __init__(self, live_inputs: AsyncLiveInputs) -> None: +class AsyncLiveInputsResourceWithRawResponse: + def __init__(self, live_inputs: AsyncLiveInputsResource) -> None: self._live_inputs = live_inputs self.create = async_to_raw_response_wrapper( @@ -674,12 +679,12 @@ def __init__(self, live_inputs: AsyncLiveInputs) -> None: ) @cached_property - def outputs(self) -> AsyncOutputsWithRawResponse: - return AsyncOutputsWithRawResponse(self._live_inputs.outputs) + def outputs(self) -> AsyncOutputsResourceWithRawResponse: + return AsyncOutputsResourceWithRawResponse(self._live_inputs.outputs) -class LiveInputsWithStreamingResponse: - def __init__(self, live_inputs: LiveInputs) -> None: +class LiveInputsResourceWithStreamingResponse: + def __init__(self, live_inputs: LiveInputsResource) -> None: self._live_inputs = live_inputs self.create = to_streamed_response_wrapper( @@ -699,12 +704,12 @@ def __init__(self, live_inputs: LiveInputs) -> None: ) @cached_property - def outputs(self) -> OutputsWithStreamingResponse: - return OutputsWithStreamingResponse(self._live_inputs.outputs) + def outputs(self) -> OutputsResourceWithStreamingResponse: + return OutputsResourceWithStreamingResponse(self._live_inputs.outputs) -class AsyncLiveInputsWithStreamingResponse: - def __init__(self, live_inputs: AsyncLiveInputs) -> None: +class AsyncLiveInputsResourceWithStreamingResponse: + def __init__(self, live_inputs: AsyncLiveInputsResource) -> None: self._live_inputs = live_inputs self.create = async_to_streamed_response_wrapper( @@ -724,5 +729,5 @@ def __init__(self, live_inputs: AsyncLiveInputs) -> None: ) @cached_property - def outputs(self) -> AsyncOutputsWithStreamingResponse: - return AsyncOutputsWithStreamingResponse(self._live_inputs.outputs) + def outputs(self) -> AsyncOutputsResourceWithStreamingResponse: + return AsyncOutputsResourceWithStreamingResponse(self._live_inputs.outputs) diff --git a/src/cloudflare/resources/stream/live_inputs/outputs.py b/src/cloudflare/resources/stream/live_inputs/outputs.py index 4bed7a329b8..f786543bccc 100644 --- a/src/cloudflare/resources/stream/live_inputs/outputs.py +++ b/src/cloudflare/resources/stream/live_inputs/outputs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,20 @@ AsyncPaginator, make_request_options, ) -from ....types.stream.live_inputs import StreamOutput, output_create_params, output_update_params +from ....types.stream.live_inputs import output_create_params, output_delete_params, output_update_params +from ....types.stream.live_inputs.output import Output -__all__ = ["Outputs", "AsyncOutputs"] +__all__ = ["OutputsResource", "AsyncOutputsResource"] -class Outputs(SyncAPIResource): +class OutputsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OutputsWithRawResponse: - return OutputsWithRawResponse(self) + def with_raw_response(self) -> OutputsResourceWithRawResponse: + return OutputsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OutputsWithStreamingResponse: - return OutputsWithStreamingResponse(self) + def with_streaming_response(self) -> OutputsResourceWithStreamingResponse: + return OutputsResourceWithStreamingResponse(self) def create( self, @@ -53,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamOutput: + ) -> Optional[Output]: """ Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live @@ -103,9 +104,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Output]]._unwrapper, ), - cast_to=cast(Type[StreamOutput], ResultWrapper[StreamOutput]), + cast_to=cast(Type[Optional[Output]], ResultWrapper[Output]), ) def update( @@ -121,7 +122,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamOutput: + ) -> Optional[Output]: """ Updates the state of an output. @@ -162,9 +163,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Output]]._unwrapper, ), - cast_to=cast(Type[StreamOutput], ResultWrapper[StreamOutput]), + cast_to=cast(Type[Optional[Output]], ResultWrapper[Output]), ) def list( @@ -178,7 +179,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[StreamOutput]: + ) -> SyncSinglePage[Output]: """ Retrieves all outputs associated with a specified live input. @@ -203,11 +204,11 @@ def list( ) return self._get_api_list( f"/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs", - page=SyncSinglePage[StreamOutput], + page=SyncSinglePage[Output], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=StreamOutput, + model=Output, ) def delete( @@ -216,6 +217,7 @@ def delete( *, account_id: str, live_input_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -252,6 +254,7 @@ def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( f"/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}", + body=maybe_transform(body, output_delete_params.OutputDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -259,14 +262,14 @@ def delete( ) -class AsyncOutputs(AsyncAPIResource): +class AsyncOutputsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOutputsWithRawResponse: - return AsyncOutputsWithRawResponse(self) + def with_raw_response(self) -> AsyncOutputsResourceWithRawResponse: + return AsyncOutputsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOutputsWithStreamingResponse: - return AsyncOutputsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOutputsResourceWithStreamingResponse: + return AsyncOutputsResourceWithStreamingResponse(self) async def create( self, @@ -282,7 +285,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamOutput: + ) -> Optional[Output]: """ Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live @@ -332,9 +335,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Output]]._unwrapper, ), - cast_to=cast(Type[StreamOutput], ResultWrapper[StreamOutput]), + cast_to=cast(Type[Optional[Output]], ResultWrapper[Output]), ) async def update( @@ -350,7 +353,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamOutput: + ) -> Optional[Output]: """ Updates the state of an output. @@ -391,9 +394,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Output]]._unwrapper, ), - cast_to=cast(Type[StreamOutput], ResultWrapper[StreamOutput]), + cast_to=cast(Type[Optional[Output]], ResultWrapper[Output]), ) def list( @@ -407,7 +410,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[StreamOutput, AsyncSinglePage[StreamOutput]]: + ) -> AsyncPaginator[Output, AsyncSinglePage[Output]]: """ Retrieves all outputs associated with a specified live input. @@ -432,11 +435,11 @@ def list( ) return self._get_api_list( f"/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs", - page=AsyncSinglePage[StreamOutput], + page=AsyncSinglePage[Output], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=StreamOutput, + model=Output, ) async def delete( @@ -445,6 +448,7 @@ async def delete( *, account_id: str, live_input_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -481,6 +485,7 @@ async def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( f"/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}", + body=await async_maybe_transform(body, output_delete_params.OutputDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -488,8 +493,8 @@ async def delete( ) -class OutputsWithRawResponse: - def __init__(self, outputs: Outputs) -> None: +class OutputsResourceWithRawResponse: + def __init__(self, outputs: OutputsResource) -> None: self._outputs = outputs self.create = to_raw_response_wrapper( @@ -506,8 +511,8 @@ def __init__(self, outputs: Outputs) -> None: ) -class AsyncOutputsWithRawResponse: - def __init__(self, outputs: AsyncOutputs) -> None: +class AsyncOutputsResourceWithRawResponse: + def __init__(self, outputs: AsyncOutputsResource) -> None: self._outputs = outputs self.create = async_to_raw_response_wrapper( @@ -524,8 +529,8 @@ def __init__(self, outputs: AsyncOutputs) -> None: ) -class OutputsWithStreamingResponse: - def __init__(self, outputs: Outputs) -> None: +class OutputsResourceWithStreamingResponse: + def __init__(self, outputs: OutputsResource) -> None: self._outputs = outputs self.create = to_streamed_response_wrapper( @@ -542,8 +547,8 @@ def __init__(self, outputs: Outputs) -> None: ) -class AsyncOutputsWithStreamingResponse: - def __init__(self, outputs: AsyncOutputs) -> None: +class AsyncOutputsResourceWithStreamingResponse: + def __init__(self, outputs: AsyncOutputsResource) -> None: self._outputs = outputs self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/stream.py b/src/cloudflare/resources/stream/stream.py index 1523b2cdec2..8504084ea70 100644 --- a/src/cloudflare/resources/stream/stream.py +++ b/src/cloudflare/resources/stream/stream.py @@ -2,95 +2,97 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime from typing_extensions import Literal import httpx from .clip import ( - Clip, - AsyncClip, - ClipWithRawResponse, - AsyncClipWithRawResponse, - ClipWithStreamingResponse, - AsyncClipWithStreamingResponse, + ClipResource, + AsyncClipResource, + ClipResourceWithRawResponse, + AsyncClipResourceWithRawResponse, + ClipResourceWithStreamingResponse, + AsyncClipResourceWithStreamingResponse, ) from .copy import ( - Copy, - AsyncCopy, - CopyWithRawResponse, - AsyncCopyWithRawResponse, - CopyWithStreamingResponse, - AsyncCopyWithStreamingResponse, + CopyResource, + AsyncCopyResource, + CopyResourceWithRawResponse, + AsyncCopyResourceWithRawResponse, + CopyResourceWithStreamingResponse, + AsyncCopyResourceWithStreamingResponse, ) from .keys import ( - Keys, - AsyncKeys, - KeysWithRawResponse, - AsyncKeysWithRawResponse, - KeysWithStreamingResponse, - AsyncKeysWithStreamingResponse, + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, ) from .embed import ( - Embed, - AsyncEmbed, - EmbedWithRawResponse, - AsyncEmbedWithRawResponse, - EmbedWithStreamingResponse, - AsyncEmbedWithStreamingResponse, + EmbedResource, + AsyncEmbedResource, + EmbedResourceWithRawResponse, + AsyncEmbedResourceWithRawResponse, + EmbedResourceWithStreamingResponse, + AsyncEmbedResourceWithStreamingResponse, ) from .token import ( - Token, - AsyncToken, - TokenWithRawResponse, - AsyncTokenWithRawResponse, - TokenWithStreamingResponse, - AsyncTokenWithStreamingResponse, + TokenResource, + AsyncTokenResource, + TokenResourceWithRawResponse, + AsyncTokenResourceWithRawResponse, + TokenResourceWithStreamingResponse, + AsyncTokenResourceWithStreamingResponse, ) from .videos import ( - Videos, - AsyncVideos, - VideosWithRawResponse, - AsyncVideosWithRawResponse, - VideosWithStreamingResponse, - AsyncVideosWithStreamingResponse, + VideosResource, + AsyncVideosResource, + VideosResourceWithRawResponse, + AsyncVideosResourceWithRawResponse, + VideosResourceWithStreamingResponse, + AsyncVideosResourceWithStreamingResponse, ) -from ...types import StreamVideos, stream_list_params from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven -from ..._utils import maybe_transform +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) from .captions import ( - Captions, - AsyncCaptions, - CaptionsWithRawResponse, - AsyncCaptionsWithRawResponse, - CaptionsWithStreamingResponse, - AsyncCaptionsWithStreamingResponse, + CaptionsResource, + AsyncCaptionsResource, + CaptionsResourceWithRawResponse, + AsyncCaptionsResourceWithRawResponse, + CaptionsResourceWithStreamingResponse, + AsyncCaptionsResourceWithStreamingResponse, ) from .webhooks import ( - Webhooks, - AsyncWebhooks, - WebhooksWithRawResponse, - AsyncWebhooksWithRawResponse, - WebhooksWithStreamingResponse, - AsyncWebhooksWithStreamingResponse, + WebhooksResource, + AsyncWebhooksResource, + WebhooksResourceWithRawResponse, + AsyncWebhooksResourceWithRawResponse, + WebhooksResourceWithStreamingResponse, + AsyncWebhooksResourceWithStreamingResponse, ) from ..._compat import cached_property from .downloads import ( - Downloads, - AsyncDownloads, - DownloadsWithRawResponse, - AsyncDownloadsWithRawResponse, - DownloadsWithStreamingResponse, - AsyncDownloadsWithStreamingResponse, + DownloadsResource, + AsyncDownloadsResource, + DownloadsResourceWithRawResponse, + AsyncDownloadsResourceWithRawResponse, + DownloadsResourceWithStreamingResponse, + AsyncDownloadsResourceWithStreamingResponse, ) from .watermarks import ( - Watermarks, - AsyncWatermarks, - WatermarksWithRawResponse, - AsyncWatermarksWithRawResponse, - WatermarksWithStreamingResponse, - AsyncWatermarksWithStreamingResponse, + WatermarksResource, + AsyncWatermarksResource, + WatermarksResourceWithRawResponse, + AsyncWatermarksResourceWithRawResponse, + WatermarksResourceWithStreamingResponse, + AsyncWatermarksResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -101,104 +103,108 @@ ) from ..._wrappers import ResultWrapper from .live_inputs import ( - LiveInputs, - AsyncLiveInputs, - LiveInputsWithRawResponse, - AsyncLiveInputsWithRawResponse, - LiveInputsWithStreamingResponse, - AsyncLiveInputsWithStreamingResponse, + LiveInputsResource, + AsyncLiveInputsResource, + LiveInputsResourceWithRawResponse, + AsyncLiveInputsResourceWithRawResponse, + LiveInputsResourceWithStreamingResponse, + AsyncLiveInputsResourceWithStreamingResponse, ) from ...pagination import SyncSinglePage, AsyncSinglePage from .audio_tracks import ( - AudioTracks, - AsyncAudioTracks, - AudioTracksWithRawResponse, - AsyncAudioTracksWithRawResponse, - AudioTracksWithStreamingResponse, - AsyncAudioTracksWithStreamingResponse, + AudioTracksResource, + AsyncAudioTracksResource, + AudioTracksResourceWithRawResponse, + AsyncAudioTracksResourceWithRawResponse, + AudioTracksResourceWithStreamingResponse, + AsyncAudioTracksResourceWithStreamingResponse, ) from .direct_upload import ( - DirectUpload, - AsyncDirectUpload, - DirectUploadWithRawResponse, - AsyncDirectUploadWithRawResponse, - DirectUploadWithStreamingResponse, - AsyncDirectUploadWithStreamingResponse, + DirectUploadResource, + AsyncDirectUploadResource, + DirectUploadResourceWithRawResponse, + AsyncDirectUploadResourceWithRawResponse, + DirectUploadResourceWithStreamingResponse, + AsyncDirectUploadResourceWithStreamingResponse, ) from ..._base_client import ( AsyncPaginator, make_request_options, ) -from .live_inputs.live_inputs import LiveInputs, AsyncLiveInputs +from ...types.stream import stream_list_params, stream_create_params, stream_delete_params +from .captions.captions import CaptionsResource, AsyncCaptionsResource +from ...types.stream.video import Video +from .live_inputs.live_inputs import LiveInputsResource, AsyncLiveInputsResource -__all__ = ["Stream", "AsyncStream"] +__all__ = ["StreamResource", "AsyncStreamResource"] -class Stream(SyncAPIResource): +class StreamResource(SyncAPIResource): @cached_property - def audio_tracks(self) -> AudioTracks: - return AudioTracks(self._client) + def audio_tracks(self) -> AudioTracksResource: + return AudioTracksResource(self._client) @cached_property - def videos(self) -> Videos: - return Videos(self._client) + def videos(self) -> VideosResource: + return VideosResource(self._client) @cached_property - def clip(self) -> Clip: - return Clip(self._client) + def clip(self) -> ClipResource: + return ClipResource(self._client) @cached_property - def copy(self) -> Copy: - return Copy(self._client) + def copy(self) -> CopyResource: + return CopyResource(self._client) @cached_property - def direct_upload(self) -> DirectUpload: - return DirectUpload(self._client) + def direct_upload(self) -> DirectUploadResource: + return DirectUploadResource(self._client) @cached_property - def keys(self) -> Keys: - return Keys(self._client) + def keys(self) -> KeysResource: + return KeysResource(self._client) @cached_property - def live_inputs(self) -> LiveInputs: - return LiveInputs(self._client) + def live_inputs(self) -> LiveInputsResource: + return LiveInputsResource(self._client) @cached_property - def watermarks(self) -> Watermarks: - return Watermarks(self._client) + def watermarks(self) -> WatermarksResource: + return WatermarksResource(self._client) @cached_property - def webhooks(self) -> Webhooks: - return Webhooks(self._client) + def webhooks(self) -> WebhooksResource: + return WebhooksResource(self._client) @cached_property - def captions(self) -> Captions: - return Captions(self._client) + def captions(self) -> CaptionsResource: + return CaptionsResource(self._client) @cached_property - def downloads(self) -> Downloads: - return Downloads(self._client) + def downloads(self) -> DownloadsResource: + return DownloadsResource(self._client) @cached_property - def embed(self) -> Embed: - return Embed(self._client) + def embed(self) -> EmbedResource: + return EmbedResource(self._client) @cached_property - def token(self) -> Token: - return Token(self._client) + def token(self) -> TokenResource: + return TokenResource(self._client) @cached_property - def with_raw_response(self) -> StreamWithRawResponse: - return StreamWithRawResponse(self) + def with_raw_response(self) -> StreamResourceWithRawResponse: + return StreamResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> StreamWithStreamingResponse: - return StreamWithStreamingResponse(self) + def with_streaming_response(self) -> StreamResourceWithStreamingResponse: + return StreamResourceWithStreamingResponse(self) def create( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -229,6 +235,7 @@ def create( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( f"/accounts/{account_id}/stream", + body=maybe_transform(body, stream_create_params.StreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -254,7 +261,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[StreamVideos]: + ) -> SyncSinglePage[Video]: """Lists up to 1000 videos from a single request. For a specific range, refer to @@ -293,7 +300,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/stream", - page=SyncSinglePage[StreamVideos], + page=SyncSinglePage[Video], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -313,7 +320,7 @@ def list( stream_list_params.StreamListParams, ), ), - model=StreamVideos, + model=Video, ) def delete( @@ -321,6 +328,7 @@ def delete( identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -351,6 +359,7 @@ def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( f"/accounts/{account_id}/stream/{identifier}", + body=maybe_transform(body, stream_delete_params.StreamDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -368,7 +377,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamVideos: + ) -> Optional[Video]: """ Fetches details for a single video. @@ -396,77 +405,78 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Video]]._unwrapper, ), - cast_to=cast(Type[StreamVideos], ResultWrapper[StreamVideos]), + cast_to=cast(Type[Optional[Video]], ResultWrapper[Video]), ) -class AsyncStream(AsyncAPIResource): +class AsyncStreamResource(AsyncAPIResource): @cached_property - def audio_tracks(self) -> AsyncAudioTracks: - return AsyncAudioTracks(self._client) + def audio_tracks(self) -> AsyncAudioTracksResource: + return AsyncAudioTracksResource(self._client) @cached_property - def videos(self) -> AsyncVideos: - return AsyncVideos(self._client) + def videos(self) -> AsyncVideosResource: + return AsyncVideosResource(self._client) @cached_property - def clip(self) -> AsyncClip: - return AsyncClip(self._client) + def clip(self) -> AsyncClipResource: + return AsyncClipResource(self._client) @cached_property - def copy(self) -> AsyncCopy: - return AsyncCopy(self._client) + def copy(self) -> AsyncCopyResource: + return AsyncCopyResource(self._client) @cached_property - def direct_upload(self) -> AsyncDirectUpload: - return AsyncDirectUpload(self._client) + def direct_upload(self) -> AsyncDirectUploadResource: + return AsyncDirectUploadResource(self._client) @cached_property - def keys(self) -> AsyncKeys: - return AsyncKeys(self._client) + def keys(self) -> AsyncKeysResource: + return AsyncKeysResource(self._client) @cached_property - def live_inputs(self) -> AsyncLiveInputs: - return AsyncLiveInputs(self._client) + def live_inputs(self) -> AsyncLiveInputsResource: + return AsyncLiveInputsResource(self._client) @cached_property - def watermarks(self) -> AsyncWatermarks: - return AsyncWatermarks(self._client) + def watermarks(self) -> AsyncWatermarksResource: + return AsyncWatermarksResource(self._client) @cached_property - def webhooks(self) -> AsyncWebhooks: - return AsyncWebhooks(self._client) + def webhooks(self) -> AsyncWebhooksResource: + return AsyncWebhooksResource(self._client) @cached_property - def captions(self) -> AsyncCaptions: - return AsyncCaptions(self._client) + def captions(self) -> AsyncCaptionsResource: + return AsyncCaptionsResource(self._client) @cached_property - def downloads(self) -> AsyncDownloads: - return AsyncDownloads(self._client) + def downloads(self) -> AsyncDownloadsResource: + return AsyncDownloadsResource(self._client) @cached_property - def embed(self) -> AsyncEmbed: - return AsyncEmbed(self._client) + def embed(self) -> AsyncEmbedResource: + return AsyncEmbedResource(self._client) @cached_property - def token(self) -> AsyncToken: - return AsyncToken(self._client) + def token(self) -> AsyncTokenResource: + return AsyncTokenResource(self._client) @cached_property - def with_raw_response(self) -> AsyncStreamWithRawResponse: - return AsyncStreamWithRawResponse(self) + def with_raw_response(self) -> AsyncStreamResourceWithRawResponse: + return AsyncStreamResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncStreamWithStreamingResponse: - return AsyncStreamWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncStreamResourceWithStreamingResponse: + return AsyncStreamResourceWithStreamingResponse(self) async def create( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -497,6 +507,7 @@ async def create( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( f"/accounts/{account_id}/stream", + body=await async_maybe_transform(body, stream_create_params.StreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -522,7 +533,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[StreamVideos, AsyncSinglePage[StreamVideos]]: + ) -> AsyncPaginator[Video, AsyncSinglePage[Video]]: """Lists up to 1000 videos from a single request. For a specific range, refer to @@ -561,7 +572,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/stream", - page=AsyncSinglePage[StreamVideos], + page=AsyncSinglePage[Video], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -581,7 +592,7 @@ def list( stream_list_params.StreamListParams, ), ), - model=StreamVideos, + model=Video, ) async def delete( @@ -589,6 +600,7 @@ async def delete( identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -619,6 +631,7 @@ async def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( f"/accounts/{account_id}/stream/{identifier}", + body=await async_maybe_transform(body, stream_delete_params.StreamDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -636,7 +649,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamVideos: + ) -> Optional[Video]: """ Fetches details for a single video. @@ -664,14 +677,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Video]]._unwrapper, ), - cast_to=cast(Type[StreamVideos], ResultWrapper[StreamVideos]), + cast_to=cast(Type[Optional[Video]], ResultWrapper[Video]), ) -class StreamWithRawResponse: - def __init__(self, stream: Stream) -> None: +class StreamResourceWithRawResponse: + def __init__(self, stream: StreamResource) -> None: self._stream = stream self.create = to_raw_response_wrapper( @@ -688,60 +701,60 @@ def __init__(self, stream: Stream) -> None: ) @cached_property - def audio_tracks(self) -> AudioTracksWithRawResponse: - return AudioTracksWithRawResponse(self._stream.audio_tracks) + def audio_tracks(self) -> AudioTracksResourceWithRawResponse: + return AudioTracksResourceWithRawResponse(self._stream.audio_tracks) @cached_property - def videos(self) -> VideosWithRawResponse: - return VideosWithRawResponse(self._stream.videos) + def videos(self) -> VideosResourceWithRawResponse: + return VideosResourceWithRawResponse(self._stream.videos) @cached_property - def clip(self) -> ClipWithRawResponse: - return ClipWithRawResponse(self._stream.clip) + def clip(self) -> ClipResourceWithRawResponse: + return ClipResourceWithRawResponse(self._stream.clip) @cached_property - def copy(self) -> CopyWithRawResponse: - return CopyWithRawResponse(self._stream.copy) + def copy(self) -> CopyResourceWithRawResponse: + return CopyResourceWithRawResponse(self._stream.copy) @cached_property - def direct_upload(self) -> DirectUploadWithRawResponse: - return DirectUploadWithRawResponse(self._stream.direct_upload) + def direct_upload(self) -> DirectUploadResourceWithRawResponse: + return DirectUploadResourceWithRawResponse(self._stream.direct_upload) @cached_property - def keys(self) -> KeysWithRawResponse: - return KeysWithRawResponse(self._stream.keys) + def keys(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self._stream.keys) @cached_property - def live_inputs(self) -> LiveInputsWithRawResponse: - return LiveInputsWithRawResponse(self._stream.live_inputs) + def live_inputs(self) -> LiveInputsResourceWithRawResponse: + return LiveInputsResourceWithRawResponse(self._stream.live_inputs) @cached_property - def watermarks(self) -> WatermarksWithRawResponse: - return WatermarksWithRawResponse(self._stream.watermarks) + def watermarks(self) -> WatermarksResourceWithRawResponse: + return WatermarksResourceWithRawResponse(self._stream.watermarks) @cached_property - def webhooks(self) -> WebhooksWithRawResponse: - return WebhooksWithRawResponse(self._stream.webhooks) + def webhooks(self) -> WebhooksResourceWithRawResponse: + return WebhooksResourceWithRawResponse(self._stream.webhooks) @cached_property - def captions(self) -> CaptionsWithRawResponse: - return CaptionsWithRawResponse(self._stream.captions) + def captions(self) -> CaptionsResourceWithRawResponse: + return CaptionsResourceWithRawResponse(self._stream.captions) @cached_property - def downloads(self) -> DownloadsWithRawResponse: - return DownloadsWithRawResponse(self._stream.downloads) + def downloads(self) -> DownloadsResourceWithRawResponse: + return DownloadsResourceWithRawResponse(self._stream.downloads) @cached_property - def embed(self) -> EmbedWithRawResponse: - return EmbedWithRawResponse(self._stream.embed) + def embed(self) -> EmbedResourceWithRawResponse: + return EmbedResourceWithRawResponse(self._stream.embed) @cached_property - def token(self) -> TokenWithRawResponse: - return TokenWithRawResponse(self._stream.token) + def token(self) -> TokenResourceWithRawResponse: + return TokenResourceWithRawResponse(self._stream.token) -class AsyncStreamWithRawResponse: - def __init__(self, stream: AsyncStream) -> None: +class AsyncStreamResourceWithRawResponse: + def __init__(self, stream: AsyncStreamResource) -> None: self._stream = stream self.create = async_to_raw_response_wrapper( @@ -758,60 +771,60 @@ def __init__(self, stream: AsyncStream) -> None: ) @cached_property - def audio_tracks(self) -> AsyncAudioTracksWithRawResponse: - return AsyncAudioTracksWithRawResponse(self._stream.audio_tracks) + def audio_tracks(self) -> AsyncAudioTracksResourceWithRawResponse: + return AsyncAudioTracksResourceWithRawResponse(self._stream.audio_tracks) @cached_property - def videos(self) -> AsyncVideosWithRawResponse: - return AsyncVideosWithRawResponse(self._stream.videos) + def videos(self) -> AsyncVideosResourceWithRawResponse: + return AsyncVideosResourceWithRawResponse(self._stream.videos) @cached_property - def clip(self) -> AsyncClipWithRawResponse: - return AsyncClipWithRawResponse(self._stream.clip) + def clip(self) -> AsyncClipResourceWithRawResponse: + return AsyncClipResourceWithRawResponse(self._stream.clip) @cached_property - def copy(self) -> AsyncCopyWithRawResponse: - return AsyncCopyWithRawResponse(self._stream.copy) + def copy(self) -> AsyncCopyResourceWithRawResponse: + return AsyncCopyResourceWithRawResponse(self._stream.copy) @cached_property - def direct_upload(self) -> AsyncDirectUploadWithRawResponse: - return AsyncDirectUploadWithRawResponse(self._stream.direct_upload) + def direct_upload(self) -> AsyncDirectUploadResourceWithRawResponse: + return AsyncDirectUploadResourceWithRawResponse(self._stream.direct_upload) @cached_property - def keys(self) -> AsyncKeysWithRawResponse: - return AsyncKeysWithRawResponse(self._stream.keys) + def keys(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self._stream.keys) @cached_property - def live_inputs(self) -> AsyncLiveInputsWithRawResponse: - return AsyncLiveInputsWithRawResponse(self._stream.live_inputs) + def live_inputs(self) -> AsyncLiveInputsResourceWithRawResponse: + return AsyncLiveInputsResourceWithRawResponse(self._stream.live_inputs) @cached_property - def watermarks(self) -> AsyncWatermarksWithRawResponse: - return AsyncWatermarksWithRawResponse(self._stream.watermarks) + def watermarks(self) -> AsyncWatermarksResourceWithRawResponse: + return AsyncWatermarksResourceWithRawResponse(self._stream.watermarks) @cached_property - def webhooks(self) -> AsyncWebhooksWithRawResponse: - return AsyncWebhooksWithRawResponse(self._stream.webhooks) + def webhooks(self) -> AsyncWebhooksResourceWithRawResponse: + return AsyncWebhooksResourceWithRawResponse(self._stream.webhooks) @cached_property - def captions(self) -> AsyncCaptionsWithRawResponse: - return AsyncCaptionsWithRawResponse(self._stream.captions) + def captions(self) -> AsyncCaptionsResourceWithRawResponse: + return AsyncCaptionsResourceWithRawResponse(self._stream.captions) @cached_property - def downloads(self) -> AsyncDownloadsWithRawResponse: - return AsyncDownloadsWithRawResponse(self._stream.downloads) + def downloads(self) -> AsyncDownloadsResourceWithRawResponse: + return AsyncDownloadsResourceWithRawResponse(self._stream.downloads) @cached_property - def embed(self) -> AsyncEmbedWithRawResponse: - return AsyncEmbedWithRawResponse(self._stream.embed) + def embed(self) -> AsyncEmbedResourceWithRawResponse: + return AsyncEmbedResourceWithRawResponse(self._stream.embed) @cached_property - def token(self) -> AsyncTokenWithRawResponse: - return AsyncTokenWithRawResponse(self._stream.token) + def token(self) -> AsyncTokenResourceWithRawResponse: + return AsyncTokenResourceWithRawResponse(self._stream.token) -class StreamWithStreamingResponse: - def __init__(self, stream: Stream) -> None: +class StreamResourceWithStreamingResponse: + def __init__(self, stream: StreamResource) -> None: self._stream = stream self.create = to_streamed_response_wrapper( @@ -828,60 +841,60 @@ def __init__(self, stream: Stream) -> None: ) @cached_property - def audio_tracks(self) -> AudioTracksWithStreamingResponse: - return AudioTracksWithStreamingResponse(self._stream.audio_tracks) + def audio_tracks(self) -> AudioTracksResourceWithStreamingResponse: + return AudioTracksResourceWithStreamingResponse(self._stream.audio_tracks) @cached_property - def videos(self) -> VideosWithStreamingResponse: - return VideosWithStreamingResponse(self._stream.videos) + def videos(self) -> VideosResourceWithStreamingResponse: + return VideosResourceWithStreamingResponse(self._stream.videos) @cached_property - def clip(self) -> ClipWithStreamingResponse: - return ClipWithStreamingResponse(self._stream.clip) + def clip(self) -> ClipResourceWithStreamingResponse: + return ClipResourceWithStreamingResponse(self._stream.clip) @cached_property - def copy(self) -> CopyWithStreamingResponse: - return CopyWithStreamingResponse(self._stream.copy) + def copy(self) -> CopyResourceWithStreamingResponse: + return CopyResourceWithStreamingResponse(self._stream.copy) @cached_property - def direct_upload(self) -> DirectUploadWithStreamingResponse: - return DirectUploadWithStreamingResponse(self._stream.direct_upload) + def direct_upload(self) -> DirectUploadResourceWithStreamingResponse: + return DirectUploadResourceWithStreamingResponse(self._stream.direct_upload) @cached_property - def keys(self) -> KeysWithStreamingResponse: - return KeysWithStreamingResponse(self._stream.keys) + def keys(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self._stream.keys) @cached_property - def live_inputs(self) -> LiveInputsWithStreamingResponse: - return LiveInputsWithStreamingResponse(self._stream.live_inputs) + def live_inputs(self) -> LiveInputsResourceWithStreamingResponse: + return LiveInputsResourceWithStreamingResponse(self._stream.live_inputs) @cached_property - def watermarks(self) -> WatermarksWithStreamingResponse: - return WatermarksWithStreamingResponse(self._stream.watermarks) + def watermarks(self) -> WatermarksResourceWithStreamingResponse: + return WatermarksResourceWithStreamingResponse(self._stream.watermarks) @cached_property - def webhooks(self) -> WebhooksWithStreamingResponse: - return WebhooksWithStreamingResponse(self._stream.webhooks) + def webhooks(self) -> WebhooksResourceWithStreamingResponse: + return WebhooksResourceWithStreamingResponse(self._stream.webhooks) @cached_property - def captions(self) -> CaptionsWithStreamingResponse: - return CaptionsWithStreamingResponse(self._stream.captions) + def captions(self) -> CaptionsResourceWithStreamingResponse: + return CaptionsResourceWithStreamingResponse(self._stream.captions) @cached_property - def downloads(self) -> DownloadsWithStreamingResponse: - return DownloadsWithStreamingResponse(self._stream.downloads) + def downloads(self) -> DownloadsResourceWithStreamingResponse: + return DownloadsResourceWithStreamingResponse(self._stream.downloads) @cached_property - def embed(self) -> EmbedWithStreamingResponse: - return EmbedWithStreamingResponse(self._stream.embed) + def embed(self) -> EmbedResourceWithStreamingResponse: + return EmbedResourceWithStreamingResponse(self._stream.embed) @cached_property - def token(self) -> TokenWithStreamingResponse: - return TokenWithStreamingResponse(self._stream.token) + def token(self) -> TokenResourceWithStreamingResponse: + return TokenResourceWithStreamingResponse(self._stream.token) -class AsyncStreamWithStreamingResponse: - def __init__(self, stream: AsyncStream) -> None: +class AsyncStreamResourceWithStreamingResponse: + def __init__(self, stream: AsyncStreamResource) -> None: self._stream = stream self.create = async_to_streamed_response_wrapper( @@ -898,53 +911,53 @@ def __init__(self, stream: AsyncStream) -> None: ) @cached_property - def audio_tracks(self) -> AsyncAudioTracksWithStreamingResponse: - return AsyncAudioTracksWithStreamingResponse(self._stream.audio_tracks) + def audio_tracks(self) -> AsyncAudioTracksResourceWithStreamingResponse: + return AsyncAudioTracksResourceWithStreamingResponse(self._stream.audio_tracks) @cached_property - def videos(self) -> AsyncVideosWithStreamingResponse: - return AsyncVideosWithStreamingResponse(self._stream.videos) + def videos(self) -> AsyncVideosResourceWithStreamingResponse: + return AsyncVideosResourceWithStreamingResponse(self._stream.videos) @cached_property - def clip(self) -> AsyncClipWithStreamingResponse: - return AsyncClipWithStreamingResponse(self._stream.clip) + def clip(self) -> AsyncClipResourceWithStreamingResponse: + return AsyncClipResourceWithStreamingResponse(self._stream.clip) @cached_property - def copy(self) -> AsyncCopyWithStreamingResponse: - return AsyncCopyWithStreamingResponse(self._stream.copy) + def copy(self) -> AsyncCopyResourceWithStreamingResponse: + return AsyncCopyResourceWithStreamingResponse(self._stream.copy) @cached_property - def direct_upload(self) -> AsyncDirectUploadWithStreamingResponse: - return AsyncDirectUploadWithStreamingResponse(self._stream.direct_upload) + def direct_upload(self) -> AsyncDirectUploadResourceWithStreamingResponse: + return AsyncDirectUploadResourceWithStreamingResponse(self._stream.direct_upload) @cached_property - def keys(self) -> AsyncKeysWithStreamingResponse: - return AsyncKeysWithStreamingResponse(self._stream.keys) + def keys(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self._stream.keys) @cached_property - def live_inputs(self) -> AsyncLiveInputsWithStreamingResponse: - return AsyncLiveInputsWithStreamingResponse(self._stream.live_inputs) + def live_inputs(self) -> AsyncLiveInputsResourceWithStreamingResponse: + return AsyncLiveInputsResourceWithStreamingResponse(self._stream.live_inputs) @cached_property - def watermarks(self) -> AsyncWatermarksWithStreamingResponse: - return AsyncWatermarksWithStreamingResponse(self._stream.watermarks) + def watermarks(self) -> AsyncWatermarksResourceWithStreamingResponse: + return AsyncWatermarksResourceWithStreamingResponse(self._stream.watermarks) @cached_property - def webhooks(self) -> AsyncWebhooksWithStreamingResponse: - return AsyncWebhooksWithStreamingResponse(self._stream.webhooks) + def webhooks(self) -> AsyncWebhooksResourceWithStreamingResponse: + return AsyncWebhooksResourceWithStreamingResponse(self._stream.webhooks) @cached_property - def captions(self) -> AsyncCaptionsWithStreamingResponse: - return AsyncCaptionsWithStreamingResponse(self._stream.captions) + def captions(self) -> AsyncCaptionsResourceWithStreamingResponse: + return AsyncCaptionsResourceWithStreamingResponse(self._stream.captions) @cached_property - def downloads(self) -> AsyncDownloadsWithStreamingResponse: - return AsyncDownloadsWithStreamingResponse(self._stream.downloads) + def downloads(self) -> AsyncDownloadsResourceWithStreamingResponse: + return AsyncDownloadsResourceWithStreamingResponse(self._stream.downloads) @cached_property - def embed(self) -> AsyncEmbedWithStreamingResponse: - return AsyncEmbedWithStreamingResponse(self._stream.embed) + def embed(self) -> AsyncEmbedResourceWithStreamingResponse: + return AsyncEmbedResourceWithStreamingResponse(self._stream.embed) @cached_property - def token(self) -> AsyncTokenWithStreamingResponse: - return AsyncTokenWithStreamingResponse(self._stream.token) + def token(self) -> AsyncTokenResourceWithStreamingResponse: + return AsyncTokenResourceWithStreamingResponse(self._stream.token) diff --git a/src/cloudflare/resources/stream/token.py b/src/cloudflare/resources/stream/token.py index a2904a823b7..c52d130dd39 100644 --- a/src/cloudflare/resources/stream/token.py +++ b/src/cloudflare/resources/stream/token.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast import httpx @@ -23,19 +23,20 @@ from ..._base_client import ( make_request_options, ) -from ...types.stream import TokenCreateResponse, token_create_params +from ...types.stream import token_create_params +from ...types.stream.token_create_response import TokenCreateResponse -__all__ = ["Token", "AsyncToken"] +__all__ = ["TokenResource", "AsyncTokenResource"] -class Token(SyncAPIResource): +class TokenResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TokenWithRawResponse: - return TokenWithRawResponse(self) + def with_raw_response(self) -> TokenResourceWithRawResponse: + return TokenResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TokenWithStreamingResponse: - return TokenWithStreamingResponse(self) + def with_streaming_response(self) -> TokenResourceWithStreamingResponse: + return TokenResourceWithStreamingResponse(self) def create( self, @@ -54,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenCreateResponse: + ) -> Optional[TokenCreateResponse]: """Creates a signed URL token for a video. If a body is not provided in the @@ -116,20 +117,20 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TokenCreateResponse]]._unwrapper, ), - cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]), + cast_to=cast(Type[Optional[TokenCreateResponse]], ResultWrapper[TokenCreateResponse]), ) -class AsyncToken(AsyncAPIResource): +class AsyncTokenResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTokenWithRawResponse: - return AsyncTokenWithRawResponse(self) + def with_raw_response(self) -> AsyncTokenResourceWithRawResponse: + return AsyncTokenResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTokenWithStreamingResponse: - return AsyncTokenWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTokenResourceWithStreamingResponse: + return AsyncTokenResourceWithStreamingResponse(self) async def create( self, @@ -148,7 +149,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenCreateResponse: + ) -> Optional[TokenCreateResponse]: """Creates a signed URL token for a video. If a body is not provided in the @@ -210,14 +211,14 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TokenCreateResponse]]._unwrapper, ), - cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]), + cast_to=cast(Type[Optional[TokenCreateResponse]], ResultWrapper[TokenCreateResponse]), ) -class TokenWithRawResponse: - def __init__(self, token: Token) -> None: +class TokenResourceWithRawResponse: + def __init__(self, token: TokenResource) -> None: self._token = token self.create = to_raw_response_wrapper( @@ -225,8 +226,8 @@ def __init__(self, token: Token) -> None: ) -class AsyncTokenWithRawResponse: - def __init__(self, token: AsyncToken) -> None: +class AsyncTokenResourceWithRawResponse: + def __init__(self, token: AsyncTokenResource) -> None: self._token = token self.create = async_to_raw_response_wrapper( @@ -234,8 +235,8 @@ def __init__(self, token: AsyncToken) -> None: ) -class TokenWithStreamingResponse: - def __init__(self, token: Token) -> None: +class TokenResourceWithStreamingResponse: + def __init__(self, token: TokenResource) -> None: self._token = token self.create = to_streamed_response_wrapper( @@ -243,8 +244,8 @@ def __init__(self, token: Token) -> None: ) -class AsyncTokenWithStreamingResponse: - def __init__(self, token: AsyncToken) -> None: +class AsyncTokenResourceWithStreamingResponse: + def __init__(self, token: AsyncTokenResource) -> None: self._token = token self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/videos.py b/src/cloudflare/resources/stream/videos.py index c491c217133..f8ccd3c97a5 100644 --- a/src/cloudflare/resources/stream/videos.py +++ b/src/cloudflare/resources/stream/videos.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,20 @@ from ..._base_client import ( make_request_options, ) -from ...types.stream import VideoStorageUsageResponse, video_storage_usage_params +from ...types.stream import video_storage_usage_params +from ...types.stream.video_storage_usage_response import VideoStorageUsageResponse -__all__ = ["Videos", "AsyncVideos"] +__all__ = ["VideosResource", "AsyncVideosResource"] -class Videos(SyncAPIResource): +class VideosResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> VideosWithRawResponse: - return VideosWithRawResponse(self) + def with_raw_response(self) -> VideosResourceWithRawResponse: + return VideosResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VideosWithStreamingResponse: - return VideosWithStreamingResponse(self) + def with_streaming_response(self) -> VideosResourceWithStreamingResponse: + return VideosResourceWithStreamingResponse(self) def storage_usage( self, @@ -48,7 +49,7 @@ def storage_usage( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VideoStorageUsageResponse: + ) -> Optional[VideoStorageUsageResponse]: """ Returns information about an account's storage use. @@ -75,20 +76,20 @@ def storage_usage( extra_body=extra_body, timeout=timeout, query=maybe_transform({"creator": creator}, video_storage_usage_params.VideoStorageUsageParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[VideoStorageUsageResponse]]._unwrapper, ), - cast_to=cast(Type[VideoStorageUsageResponse], ResultWrapper[VideoStorageUsageResponse]), + cast_to=cast(Type[Optional[VideoStorageUsageResponse]], ResultWrapper[VideoStorageUsageResponse]), ) -class AsyncVideos(AsyncAPIResource): +class AsyncVideosResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncVideosWithRawResponse: - return AsyncVideosWithRawResponse(self) + def with_raw_response(self) -> AsyncVideosResourceWithRawResponse: + return AsyncVideosResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVideosWithStreamingResponse: - return AsyncVideosWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVideosResourceWithStreamingResponse: + return AsyncVideosResourceWithStreamingResponse(self) async def storage_usage( self, @@ -101,7 +102,7 @@ async def storage_usage( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VideoStorageUsageResponse: + ) -> Optional[VideoStorageUsageResponse]: """ Returns information about an account's storage use. @@ -130,14 +131,14 @@ async def storage_usage( query=await async_maybe_transform( {"creator": creator}, video_storage_usage_params.VideoStorageUsageParams ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[VideoStorageUsageResponse]]._unwrapper, ), - cast_to=cast(Type[VideoStorageUsageResponse], ResultWrapper[VideoStorageUsageResponse]), + cast_to=cast(Type[Optional[VideoStorageUsageResponse]], ResultWrapper[VideoStorageUsageResponse]), ) -class VideosWithRawResponse: - def __init__(self, videos: Videos) -> None: +class VideosResourceWithRawResponse: + def __init__(self, videos: VideosResource) -> None: self._videos = videos self.storage_usage = to_raw_response_wrapper( @@ -145,8 +146,8 @@ def __init__(self, videos: Videos) -> None: ) -class AsyncVideosWithRawResponse: - def __init__(self, videos: AsyncVideos) -> None: +class AsyncVideosResourceWithRawResponse: + def __init__(self, videos: AsyncVideosResource) -> None: self._videos = videos self.storage_usage = async_to_raw_response_wrapper( @@ -154,8 +155,8 @@ def __init__(self, videos: AsyncVideos) -> None: ) -class VideosWithStreamingResponse: - def __init__(self, videos: Videos) -> None: +class VideosResourceWithStreamingResponse: + def __init__(self, videos: VideosResource) -> None: self._videos = videos self.storage_usage = to_streamed_response_wrapper( @@ -163,8 +164,8 @@ def __init__(self, videos: Videos) -> None: ) -class AsyncVideosWithStreamingResponse: - def __init__(self, videos: AsyncVideos) -> None: +class AsyncVideosResourceWithStreamingResponse: + def __init__(self, videos: AsyncVideosResource) -> None: self._videos = videos self.storage_usage = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/watermarks.py b/src/cloudflare/resources/stream/watermarks.py index d869bd90f78..7eae7369bd7 100644 --- a/src/cloudflare/resources/stream/watermarks.py +++ b/src/cloudflare/resources/stream/watermarks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Type, Optional, cast import httpx @@ -25,25 +25,21 @@ AsyncPaginator, make_request_options, ) -from ...types.stream import ( - StreamWatermarks, - WatermarkGetResponse, - WatermarkCreateResponse, - WatermarkDeleteResponse, - watermark_create_params, -) +from ...types.stream import watermark_create_params, watermark_delete_params +from ...types.stream.watermark import Watermark +from ...types.stream.watermark_delete_response import WatermarkDeleteResponse -__all__ = ["Watermarks", "AsyncWatermarks"] +__all__ = ["WatermarksResource", "AsyncWatermarksResource"] -class Watermarks(SyncAPIResource): +class WatermarksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WatermarksWithRawResponse: - return WatermarksWithRawResponse(self) + def with_raw_response(self) -> WatermarksResourceWithRawResponse: + return WatermarksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WatermarksWithStreamingResponse: - return WatermarksWithStreamingResponse(self) + def with_streaming_response(self) -> WatermarksResourceWithStreamingResponse: + return WatermarksResourceWithStreamingResponse(self) def create( self, @@ -61,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkCreateResponse: + ) -> Optional[Watermark]: """ Creates watermark profiles using a single `HTTP POST multipart/form-data` request. @@ -100,32 +96,27 @@ def create( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - WatermarkCreateResponse, - self._post( - f"/accounts/{account_id}/stream/watermarks", - body=maybe_transform( - { - "file": file, - "name": name, - "opacity": opacity, - "padding": padding, - "position": position, - "scale": scale, - }, - watermark_create_params.WatermarkCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[WatermarkCreateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._post( + f"/accounts/{account_id}/stream/watermarks", + body=maybe_transform( + { + "file": file, + "name": name, + "opacity": opacity, + "padding": padding, + "position": position, + "scale": scale, + }, + watermark_create_params.WatermarkCreateParams, ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Watermark]]._unwrapper, + ), + cast_to=cast(Type[Optional[Watermark]], ResultWrapper[Watermark]), ) def list( @@ -138,7 +129,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[StreamWatermarks]: + ) -> SyncSinglePage[Watermark]: """ Lists all watermark profiles for an account. @@ -157,11 +148,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/stream/watermarks", - page=SyncSinglePage[StreamWatermarks], + page=SyncSinglePage[Watermark], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=StreamWatermarks, + model=Watermark, ) def delete( @@ -169,13 +160,14 @@ def delete( identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> WatermarkDeleteResponse: + ) -> Optional[WatermarkDeleteResponse]: """ Deletes a watermark profile. @@ -197,15 +189,16 @@ def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - WatermarkDeleteResponse, + Optional[WatermarkDeleteResponse], self._delete( f"/accounts/{account_id}/stream/watermarks/{identifier}", + body=maybe_transform(body, watermark_delete_params.WatermarkDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WatermarkDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WatermarkDeleteResponse] @@ -224,7 +217,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkGetResponse: + ) -> Optional[Watermark]: """ Retrieves details for a single watermark profile. @@ -245,32 +238,27 @@ def get( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return cast( - WatermarkGetResponse, - self._get( - f"/accounts/{account_id}/stream/watermarks/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[WatermarkGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_id}/stream/watermarks/{identifier}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Watermark]]._unwrapper, ), + cast_to=cast(Type[Optional[Watermark]], ResultWrapper[Watermark]), ) -class AsyncWatermarks(AsyncAPIResource): +class AsyncWatermarksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWatermarksWithRawResponse: - return AsyncWatermarksWithRawResponse(self) + def with_raw_response(self) -> AsyncWatermarksResourceWithRawResponse: + return AsyncWatermarksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWatermarksWithStreamingResponse: - return AsyncWatermarksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWatermarksResourceWithStreamingResponse: + return AsyncWatermarksResourceWithStreamingResponse(self) async def create( self, @@ -288,7 +276,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkCreateResponse: + ) -> Optional[Watermark]: """ Creates watermark profiles using a single `HTTP POST multipart/form-data` request. @@ -327,32 +315,27 @@ 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( - WatermarkCreateResponse, - await self._post( - f"/accounts/{account_id}/stream/watermarks", - body=await async_maybe_transform( - { - "file": file, - "name": name, - "opacity": opacity, - "padding": padding, - "position": position, - "scale": scale, - }, - watermark_create_params.WatermarkCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[WatermarkCreateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._post( + f"/accounts/{account_id}/stream/watermarks", + body=await async_maybe_transform( + { + "file": file, + "name": name, + "opacity": opacity, + "padding": padding, + "position": position, + "scale": scale, + }, + watermark_create_params.WatermarkCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Watermark]]._unwrapper, ), + cast_to=cast(Type[Optional[Watermark]], ResultWrapper[Watermark]), ) def list( @@ -365,7 +348,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[StreamWatermarks, AsyncSinglePage[StreamWatermarks]]: + ) -> AsyncPaginator[Watermark, AsyncSinglePage[Watermark]]: """ Lists all watermark profiles for an account. @@ -384,11 +367,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/stream/watermarks", - page=AsyncSinglePage[StreamWatermarks], + page=AsyncSinglePage[Watermark], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=StreamWatermarks, + model=Watermark, ) async def delete( @@ -396,13 +379,14 @@ async def delete( identifier: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> WatermarkDeleteResponse: + ) -> Optional[WatermarkDeleteResponse]: """ Deletes a watermark profile. @@ -424,15 +408,16 @@ async def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - WatermarkDeleteResponse, + Optional[WatermarkDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/watermarks/{identifier}", + body=await async_maybe_transform(body, watermark_delete_params.WatermarkDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WatermarkDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WatermarkDeleteResponse] @@ -451,7 +436,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkGetResponse: + ) -> Optional[Watermark]: """ Retrieves details for a single watermark profile. @@ -472,26 +457,21 @@ async def get( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return cast( - WatermarkGetResponse, - await self._get( - f"/accounts/{account_id}/stream/watermarks/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[WatermarkGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_id}/stream/watermarks/{identifier}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Watermark]]._unwrapper, ), + cast_to=cast(Type[Optional[Watermark]], ResultWrapper[Watermark]), ) -class WatermarksWithRawResponse: - def __init__(self, watermarks: Watermarks) -> None: +class WatermarksResourceWithRawResponse: + def __init__(self, watermarks: WatermarksResource) -> None: self._watermarks = watermarks self.create = to_raw_response_wrapper( @@ -508,8 +488,8 @@ def __init__(self, watermarks: Watermarks) -> None: ) -class AsyncWatermarksWithRawResponse: - def __init__(self, watermarks: AsyncWatermarks) -> None: +class AsyncWatermarksResourceWithRawResponse: + def __init__(self, watermarks: AsyncWatermarksResource) -> None: self._watermarks = watermarks self.create = async_to_raw_response_wrapper( @@ -526,8 +506,8 @@ def __init__(self, watermarks: AsyncWatermarks) -> None: ) -class WatermarksWithStreamingResponse: - def __init__(self, watermarks: Watermarks) -> None: +class WatermarksResourceWithStreamingResponse: + def __init__(self, watermarks: WatermarksResource) -> None: self._watermarks = watermarks self.create = to_streamed_response_wrapper( @@ -544,8 +524,8 @@ def __init__(self, watermarks: Watermarks) -> None: ) -class AsyncWatermarksWithStreamingResponse: - def __init__(self, watermarks: AsyncWatermarks) -> None: +class AsyncWatermarksResourceWithStreamingResponse: + def __init__(self, watermarks: AsyncWatermarksResource) -> None: self._watermarks = watermarks self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/stream/webhooks.py b/src/cloudflare/resources/stream/webhooks.py index 91bd08ff613..421ef3e1355 100644 --- a/src/cloudflare/resources/stream/webhooks.py +++ b/src/cloudflare/resources/stream/webhooks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -23,19 +23,22 @@ from ..._base_client import ( make_request_options, ) -from ...types.stream import WebhookGetResponse, WebhookDeleteResponse, WebhookUpdateResponse, webhook_update_params +from ...types.stream import webhook_delete_params, webhook_update_params +from ...types.stream.webhook_get_response import WebhookGetResponse +from ...types.stream.webhook_delete_response import WebhookDeleteResponse +from ...types.stream.webhook_update_response import WebhookUpdateResponse -__all__ = ["Webhooks", "AsyncWebhooks"] +__all__ = ["WebhooksResource", "AsyncWebhooksResource"] -class Webhooks(SyncAPIResource): +class WebhooksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WebhooksWithRawResponse: - return WebhooksWithRawResponse(self) + def with_raw_response(self) -> WebhooksResourceWithRawResponse: + return WebhooksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WebhooksWithStreamingResponse: - return WebhooksWithStreamingResponse(self) + def with_streaming_response(self) -> WebhooksResourceWithStreamingResponse: + return WebhooksResourceWithStreamingResponse(self) def update( self, @@ -48,7 +51,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookUpdateResponse: + ) -> Optional[WebhookUpdateResponse]: """ Creates a webhook notification. @@ -68,7 +71,7 @@ def update( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookUpdateResponse, + Optional[WebhookUpdateResponse], self._put( f"/accounts/{account_id}/stream/webhook", body=maybe_transform({"notification_url": notification_url}, webhook_update_params.WebhookUpdateParams), @@ -77,7 +80,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebhookUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WebhookUpdateResponse] @@ -89,13 +92,14 @@ def delete( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> WebhookDeleteResponse: + ) -> Optional[WebhookDeleteResponse]: """ Deletes a webhook. @@ -113,15 +117,16 @@ def delete( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookDeleteResponse, + Optional[WebhookDeleteResponse], self._delete( f"/accounts/{account_id}/stream/webhook", + body=maybe_transform(body, webhook_delete_params.WebhookDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebhookDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WebhookDeleteResponse] @@ -139,7 +144,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookGetResponse: + ) -> Optional[WebhookGetResponse]: """ Retrieves a list of webhooks. @@ -157,7 +162,7 @@ def get( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookGetResponse, + Optional[WebhookGetResponse], self._get( f"/accounts/{account_id}/stream/webhook", options=make_request_options( @@ -165,7 +170,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebhookGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WebhookGetResponse] @@ -174,14 +179,14 @@ def get( ) -class AsyncWebhooks(AsyncAPIResource): +class AsyncWebhooksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWebhooksWithRawResponse: - return AsyncWebhooksWithRawResponse(self) + def with_raw_response(self) -> AsyncWebhooksResourceWithRawResponse: + return AsyncWebhooksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWebhooksWithStreamingResponse: - return AsyncWebhooksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWebhooksResourceWithStreamingResponse: + return AsyncWebhooksResourceWithStreamingResponse(self) async def update( self, @@ -194,7 +199,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookUpdateResponse: + ) -> Optional[WebhookUpdateResponse]: """ Creates a webhook notification. @@ -214,7 +219,7 @@ async def update( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookUpdateResponse, + Optional[WebhookUpdateResponse], await self._put( f"/accounts/{account_id}/stream/webhook", body=await async_maybe_transform( @@ -225,7 +230,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebhookUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WebhookUpdateResponse] @@ -237,13 +242,14 @@ async def delete( self, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> WebhookDeleteResponse: + ) -> Optional[WebhookDeleteResponse]: """ Deletes a webhook. @@ -261,15 +267,16 @@ async def delete( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookDeleteResponse, + Optional[WebhookDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/webhook", + body=await async_maybe_transform(body, webhook_delete_params.WebhookDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebhookDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WebhookDeleteResponse] @@ -287,7 +294,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookGetResponse: + ) -> Optional[WebhookGetResponse]: """ Retrieves a list of webhooks. @@ -305,7 +312,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 cast( - WebhookGetResponse, + Optional[WebhookGetResponse], await self._get( f"/accounts/{account_id}/stream/webhook", options=make_request_options( @@ -313,7 +320,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebhookGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WebhookGetResponse] @@ -322,8 +329,8 @@ async def get( ) -class WebhooksWithRawResponse: - def __init__(self, webhooks: Webhooks) -> None: +class WebhooksResourceWithRawResponse: + def __init__(self, webhooks: WebhooksResource) -> None: self._webhooks = webhooks self.update = to_raw_response_wrapper( @@ -337,8 +344,8 @@ def __init__(self, webhooks: Webhooks) -> None: ) -class AsyncWebhooksWithRawResponse: - def __init__(self, webhooks: AsyncWebhooks) -> None: +class AsyncWebhooksResourceWithRawResponse: + def __init__(self, webhooks: AsyncWebhooksResource) -> None: self._webhooks = webhooks self.update = async_to_raw_response_wrapper( @@ -352,8 +359,8 @@ def __init__(self, webhooks: AsyncWebhooks) -> None: ) -class WebhooksWithStreamingResponse: - def __init__(self, webhooks: Webhooks) -> None: +class WebhooksResourceWithStreamingResponse: + def __init__(self, webhooks: WebhooksResource) -> None: self._webhooks = webhooks self.update = to_streamed_response_wrapper( @@ -367,8 +374,8 @@ def __init__(self, webhooks: Webhooks) -> None: ) -class AsyncWebhooksWithStreamingResponse: - def __init__(self, webhooks: AsyncWebhooks) -> None: +class AsyncWebhooksResourceWithStreamingResponse: + def __init__(self, webhooks: AsyncWebhooksResource) -> None: self._webhooks = webhooks self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/subscriptions.py b/src/cloudflare/resources/subscriptions.py index 03ebe32ebe1..2d4496f23f8 100644 --- a/src/cloudflare/resources/subscriptions.py +++ b/src/cloudflare/resources/subscriptions.py @@ -7,15 +7,6 @@ import httpx -from ..types import ( - SubscriptionGetResponse, - SubscriptionListResponse, - SubscriptionCreateResponse, - SubscriptionDeleteResponse, - SubscriptionUpdateResponse, - subscription_create_params, - subscription_update_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -35,28 +26,37 @@ AsyncPaginator, make_request_options, ) +from ..types.subscriptions import subscription_create_params, subscription_delete_params, subscription_update_params +from ..types.user.subscription import Subscription +from ..types.user.rate_plan_param import RatePlanParam +from ..types.user.subscription_zone_param import SubscriptionZoneParam +from ..types.user.subscription_component_param import SubscriptionComponentParam +from ..types.subscriptions.subscription_get_response import SubscriptionGetResponse +from ..types.subscriptions.subscription_create_response import SubscriptionCreateResponse +from ..types.subscriptions.subscription_delete_response import SubscriptionDeleteResponse +from ..types.subscriptions.subscription_update_response import SubscriptionUpdateResponse -__all__ = ["Subscriptions", "AsyncSubscriptions"] +__all__ = ["SubscriptionsResource", "AsyncSubscriptionsResource"] -class Subscriptions(SyncAPIResource): +class SubscriptionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SubscriptionsWithRawResponse: - return SubscriptionsWithRawResponse(self) + def with_raw_response(self) -> SubscriptionsResourceWithRawResponse: + return SubscriptionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SubscriptionsWithStreamingResponse: - return SubscriptionsWithStreamingResponse(self) + def with_streaming_response(self) -> SubscriptionsResourceWithStreamingResponse: + return SubscriptionsResourceWithStreamingResponse(self) def create( self, identifier: str, *, app: subscription_create_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -107,7 +107,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionCreateResponse] @@ -121,10 +121,10 @@ def update( *, account_identifier: str, app: subscription_update_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -181,7 +181,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionUpdateResponse] @@ -199,7 +199,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[SubscriptionListResponse]: + ) -> SyncSinglePage[Subscription]: """ Lists all of an account's subscriptions. @@ -218,11 +218,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/subscriptions", - page=SyncSinglePage[SubscriptionListResponse], + page=SyncSinglePage[Subscription], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SubscriptionListResponse, + model=Subscription, ) def delete( @@ -230,6 +230,7 @@ def delete( subscription_identifier: str, *, account_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -261,12 +262,13 @@ def delete( ) return self._delete( f"/accounts/{account_identifier}/subscriptions/{subscription_identifier}", + body=maybe_transform(body, subscription_delete_params.SubscriptionDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionDeleteResponse]._unwrapper, ), cast_to=cast(Type[SubscriptionDeleteResponse], ResultWrapper[SubscriptionDeleteResponse]), ) @@ -307,7 +309,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionGetResponse] @@ -316,24 +318,24 @@ def get( ) -class AsyncSubscriptions(AsyncAPIResource): +class AsyncSubscriptionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSubscriptionsWithRawResponse: - return AsyncSubscriptionsWithRawResponse(self) + def with_raw_response(self) -> AsyncSubscriptionsResourceWithRawResponse: + return AsyncSubscriptionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSubscriptionsWithStreamingResponse: - return AsyncSubscriptionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSubscriptionsResourceWithStreamingResponse: + return AsyncSubscriptionsResourceWithStreamingResponse(self) async def create( self, identifier: str, *, app: subscription_create_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -384,7 +386,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionCreateResponse] @@ -398,10 +400,10 @@ async def update( *, account_identifier: str, app: subscription_update_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -458,7 +460,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionUpdateResponse] @@ -476,7 +478,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[SubscriptionListResponse, AsyncSinglePage[SubscriptionListResponse]]: + ) -> AsyncPaginator[Subscription, AsyncSinglePage[Subscription]]: """ Lists all of an account's subscriptions. @@ -495,11 +497,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/subscriptions", - page=AsyncSinglePage[SubscriptionListResponse], + page=AsyncSinglePage[Subscription], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SubscriptionListResponse, + model=Subscription, ) async def delete( @@ -507,6 +509,7 @@ async def delete( subscription_identifier: str, *, account_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +541,13 @@ async def delete( ) return await self._delete( f"/accounts/{account_identifier}/subscriptions/{subscription_identifier}", + body=await async_maybe_transform(body, subscription_delete_params.SubscriptionDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionDeleteResponse]._unwrapper, ), cast_to=cast(Type[SubscriptionDeleteResponse], ResultWrapper[SubscriptionDeleteResponse]), ) @@ -584,7 +588,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionGetResponse] @@ -593,8 +597,8 @@ async def get( ) -class SubscriptionsWithRawResponse: - def __init__(self, subscriptions: Subscriptions) -> None: +class SubscriptionsResourceWithRawResponse: + def __init__(self, subscriptions: SubscriptionsResource) -> None: self._subscriptions = subscriptions self.create = to_raw_response_wrapper( @@ -614,8 +618,8 @@ def __init__(self, subscriptions: Subscriptions) -> None: ) -class AsyncSubscriptionsWithRawResponse: - def __init__(self, subscriptions: AsyncSubscriptions) -> None: +class AsyncSubscriptionsResourceWithRawResponse: + def __init__(self, subscriptions: AsyncSubscriptionsResource) -> None: self._subscriptions = subscriptions self.create = async_to_raw_response_wrapper( @@ -635,8 +639,8 @@ def __init__(self, subscriptions: AsyncSubscriptions) -> None: ) -class SubscriptionsWithStreamingResponse: - def __init__(self, subscriptions: Subscriptions) -> None: +class SubscriptionsResourceWithStreamingResponse: + def __init__(self, subscriptions: SubscriptionsResource) -> None: self._subscriptions = subscriptions self.create = to_streamed_response_wrapper( @@ -656,8 +660,8 @@ def __init__(self, subscriptions: Subscriptions) -> None: ) -class AsyncSubscriptionsWithStreamingResponse: - def __init__(self, subscriptions: AsyncSubscriptions) -> None: +class AsyncSubscriptionsResourceWithStreamingResponse: + def __init__(self, subscriptions: AsyncSubscriptionsResource) -> None: self._subscriptions = subscriptions self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/url_normalization.py b/src/cloudflare/resources/url_normalization.py index 7a51ec25fab..3ec4291906e 100644 --- a/src/cloudflare/resources/url_normalization.py +++ b/src/cloudflare/resources/url_normalization.py @@ -4,11 +4,6 @@ import httpx -from ..types import ( - URLNormalizationGetResponse, - URLNormalizationUpdateResponse, - url_normalization_update_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -25,18 +20,21 @@ 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 +from ..types.url_normalization.url_normalization_update_response import URLNormalizationUpdateResponse -__all__ = ["URLNormalization", "AsyncURLNormalization"] +__all__ = ["URLNormalizationResource", "AsyncURLNormalizationResource"] -class URLNormalization(SyncAPIResource): +class URLNormalizationResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> URLNormalizationWithRawResponse: - return URLNormalizationWithRawResponse(self) + def with_raw_response(self) -> URLNormalizationResourceWithRawResponse: + return URLNormalizationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> URLNormalizationWithStreamingResponse: - return URLNormalizationWithStreamingResponse(self) + def with_streaming_response(self) -> URLNormalizationResourceWithStreamingResponse: + return URLNormalizationResourceWithStreamingResponse(self) def update( self, @@ -122,14 +120,14 @@ def get( ) -class AsyncURLNormalization(AsyncAPIResource): +class AsyncURLNormalizationResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncURLNormalizationWithRawResponse: - return AsyncURLNormalizationWithRawResponse(self) + def with_raw_response(self) -> AsyncURLNormalizationResourceWithRawResponse: + return AsyncURLNormalizationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncURLNormalizationWithStreamingResponse: - return AsyncURLNormalizationWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncURLNormalizationResourceWithStreamingResponse: + return AsyncURLNormalizationResourceWithStreamingResponse(self) async def update( self, @@ -215,8 +213,8 @@ async def get( ) -class URLNormalizationWithRawResponse: - def __init__(self, url_normalization: URLNormalization) -> None: +class URLNormalizationResourceWithRawResponse: + def __init__(self, url_normalization: URLNormalizationResource) -> None: self._url_normalization = url_normalization self.update = to_raw_response_wrapper( @@ -227,8 +225,8 @@ def __init__(self, url_normalization: URLNormalization) -> None: ) -class AsyncURLNormalizationWithRawResponse: - def __init__(self, url_normalization: AsyncURLNormalization) -> None: +class AsyncURLNormalizationResourceWithRawResponse: + def __init__(self, url_normalization: AsyncURLNormalizationResource) -> None: self._url_normalization = url_normalization self.update = async_to_raw_response_wrapper( @@ -239,8 +237,8 @@ def __init__(self, url_normalization: AsyncURLNormalization) -> None: ) -class URLNormalizationWithStreamingResponse: - def __init__(self, url_normalization: URLNormalization) -> None: +class URLNormalizationResourceWithStreamingResponse: + def __init__(self, url_normalization: URLNormalizationResource) -> None: self._url_normalization = url_normalization self.update = to_streamed_response_wrapper( @@ -251,8 +249,8 @@ def __init__(self, url_normalization: URLNormalization) -> None: ) -class AsyncURLNormalizationWithStreamingResponse: - def __init__(self, url_normalization: AsyncURLNormalization) -> None: +class AsyncURLNormalizationResourceWithStreamingResponse: + def __init__(self, url_normalization: AsyncURLNormalizationResource) -> None: self._url_normalization = url_normalization self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/url_scanner/__init__.py b/src/cloudflare/resources/url_scanner/__init__.py index ef70f72a953..711e0a9410a 100644 --- a/src/cloudflare/resources/url_scanner/__init__.py +++ b/src/cloudflare/resources/url_scanner/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .scans import ( - Scans, - AsyncScans, - ScansWithRawResponse, - AsyncScansWithRawResponse, - ScansWithStreamingResponse, - AsyncScansWithStreamingResponse, + ScansResource, + AsyncScansResource, + ScansResourceWithRawResponse, + AsyncScansResourceWithRawResponse, + ScansResourceWithStreamingResponse, + AsyncScansResourceWithStreamingResponse, ) from .url_scanner import ( - URLScanner, - AsyncURLScanner, - URLScannerWithRawResponse, - AsyncURLScannerWithRawResponse, - URLScannerWithStreamingResponse, - AsyncURLScannerWithStreamingResponse, + URLScannerResource, + AsyncURLScannerResource, + URLScannerResourceWithRawResponse, + AsyncURLScannerResourceWithRawResponse, + URLScannerResourceWithStreamingResponse, + AsyncURLScannerResourceWithStreamingResponse, ) __all__ = [ - "Scans", - "AsyncScans", - "ScansWithRawResponse", - "AsyncScansWithRawResponse", - "ScansWithStreamingResponse", - "AsyncScansWithStreamingResponse", - "URLScanner", - "AsyncURLScanner", - "URLScannerWithRawResponse", - "AsyncURLScannerWithRawResponse", - "URLScannerWithStreamingResponse", - "AsyncURLScannerWithStreamingResponse", + "ScansResource", + "AsyncScansResource", + "ScansResourceWithRawResponse", + "AsyncScansResourceWithRawResponse", + "ScansResourceWithStreamingResponse", + "AsyncScansResourceWithStreamingResponse", + "URLScannerResource", + "AsyncURLScannerResource", + "URLScannerResourceWithRawResponse", + "AsyncURLScannerResourceWithRawResponse", + "URLScannerResourceWithStreamingResponse", + "AsyncURLScannerResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/url_scanner/scans.py b/src/cloudflare/resources/url_scanner/scans.py index 1c03f332dd1..5708cfda794 100644 --- a/src/cloudflare/resources/url_scanner/scans.py +++ b/src/cloudflare/resources/url_scanner/scans.py @@ -32,25 +32,22 @@ from ..._base_client import ( make_request_options, ) -from ...types.url_scanner import ( - ScanGetResponse, - ScanHarResponse, - ScanCreateResponse, - scan_create_params, - scan_screenshot_params, -) +from ...types.url_scanner import scan_create_params, scan_screenshot_params +from ...types.url_scanner.scan_get_response import ScanGetResponse +from ...types.url_scanner.scan_har_response import ScanHarResponse +from ...types.url_scanner.scan_create_response import ScanCreateResponse -__all__ = ["Scans", "AsyncScans"] +__all__ = ["ScansResource", "AsyncScansResource"] -class Scans(SyncAPIResource): +class ScansResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ScansWithRawResponse: - return ScansWithRawResponse(self) + def with_raw_response(self) -> ScansResourceWithRawResponse: + return ScansResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ScansWithStreamingResponse: - return ScansWithStreamingResponse(self) + def with_streaming_response(self) -> ScansResourceWithStreamingResponse: + return ScansResourceWithStreamingResponse(self) def create( self, @@ -112,7 +109,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ScanCreateResponse]._unwrapper, ), cast_to=cast(Type[ScanCreateResponse], ResultWrapper[ScanCreateResponse]), ) @@ -156,7 +153,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ScanGetResponse]._unwrapper, ), cast_to=cast(Type[ScanGetResponse], ResultWrapper[ScanGetResponse]), ) @@ -202,7 +199,7 @@ def har( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ScanHarResponse]._unwrapper, ), cast_to=cast(Type[ScanHarResponse], ResultWrapper[ScanHarResponse]), ) @@ -256,14 +253,14 @@ def screenshot( ) -class AsyncScans(AsyncAPIResource): +class AsyncScansResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncScansWithRawResponse: - return AsyncScansWithRawResponse(self) + def with_raw_response(self) -> AsyncScansResourceWithRawResponse: + return AsyncScansResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncScansWithStreamingResponse: - return AsyncScansWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncScansResourceWithStreamingResponse: + return AsyncScansResourceWithStreamingResponse(self) async def create( self, @@ -325,7 +322,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ScanCreateResponse]._unwrapper, ), cast_to=cast(Type[ScanCreateResponse], ResultWrapper[ScanCreateResponse]), ) @@ -369,7 +366,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ScanGetResponse]._unwrapper, ), cast_to=cast(Type[ScanGetResponse], ResultWrapper[ScanGetResponse]), ) @@ -415,7 +412,7 @@ async def har( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ScanHarResponse]._unwrapper, ), cast_to=cast(Type[ScanHarResponse], ResultWrapper[ScanHarResponse]), ) @@ -471,8 +468,8 @@ async def screenshot( ) -class ScansWithRawResponse: - def __init__(self, scans: Scans) -> None: +class ScansResourceWithRawResponse: + def __init__(self, scans: ScansResource) -> None: self._scans = scans self.create = to_raw_response_wrapper( @@ -490,8 +487,8 @@ def __init__(self, scans: Scans) -> None: ) -class AsyncScansWithRawResponse: - def __init__(self, scans: AsyncScans) -> None: +class AsyncScansResourceWithRawResponse: + def __init__(self, scans: AsyncScansResource) -> None: self._scans = scans self.create = async_to_raw_response_wrapper( @@ -509,8 +506,8 @@ def __init__(self, scans: AsyncScans) -> None: ) -class ScansWithStreamingResponse: - def __init__(self, scans: Scans) -> None: +class ScansResourceWithStreamingResponse: + def __init__(self, scans: ScansResource) -> None: self._scans = scans self.create = to_streamed_response_wrapper( @@ -528,8 +525,8 @@ def __init__(self, scans: Scans) -> None: ) -class AsyncScansWithStreamingResponse: - def __init__(self, scans: AsyncScans) -> None: +class AsyncScansResourceWithStreamingResponse: + def __init__(self, scans: AsyncScansResource) -> None: self._scans = scans self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/url_scanner/url_scanner.py b/src/cloudflare/resources/url_scanner/url_scanner.py index 1c6f763b68d..f1924bb49e7 100644 --- a/src/cloudflare/resources/url_scanner/url_scanner.py +++ b/src/cloudflare/resources/url_scanner/url_scanner.py @@ -8,14 +8,13 @@ import httpx from .scans import ( - Scans, - AsyncScans, - ScansWithRawResponse, - AsyncScansWithRawResponse, - ScansWithStreamingResponse, - AsyncScansWithStreamingResponse, + ScansResource, + AsyncScansResource, + ScansResourceWithRawResponse, + AsyncScansResourceWithRawResponse, + ScansResourceWithStreamingResponse, + AsyncScansResourceWithStreamingResponse, ) -from ...types import URLScannerScanResponse, url_scanner_scan_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -33,22 +32,24 @@ from ..._base_client import ( make_request_options, ) +from ...types.url_scanner import url_scanner_scan_params +from ...types.url_scanner.url_scanner_scan_response import URLScannerScanResponse -__all__ = ["URLScanner", "AsyncURLScanner"] +__all__ = ["URLScannerResource", "AsyncURLScannerResource"] -class URLScanner(SyncAPIResource): +class URLScannerResource(SyncAPIResource): @cached_property - def scans(self) -> Scans: - return Scans(self._client) + def scans(self) -> ScansResource: + return ScansResource(self._client) @cached_property - def with_raw_response(self) -> URLScannerWithRawResponse: - return URLScannerWithRawResponse(self) + def with_raw_response(self) -> URLScannerResourceWithRawResponse: + return URLScannerResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> URLScannerWithStreamingResponse: - return URLScannerWithStreamingResponse(self) + def with_streaming_response(self) -> URLScannerResourceWithStreamingResponse: + return URLScannerResourceWithStreamingResponse(self) def scan( self, @@ -163,24 +164,24 @@ def scan( }, url_scanner_scan_params.URLScannerScanParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[URLScannerScanResponse]._unwrapper, ), cast_to=cast(Type[URLScannerScanResponse], ResultWrapper[URLScannerScanResponse]), ) -class AsyncURLScanner(AsyncAPIResource): +class AsyncURLScannerResource(AsyncAPIResource): @cached_property - def scans(self) -> AsyncScans: - return AsyncScans(self._client) + def scans(self) -> AsyncScansResource: + return AsyncScansResource(self._client) @cached_property - def with_raw_response(self) -> AsyncURLScannerWithRawResponse: - return AsyncURLScannerWithRawResponse(self) + def with_raw_response(self) -> AsyncURLScannerResourceWithRawResponse: + return AsyncURLScannerResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncURLScannerWithStreamingResponse: - return AsyncURLScannerWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncURLScannerResourceWithStreamingResponse: + return AsyncURLScannerResourceWithStreamingResponse(self) async def scan( self, @@ -295,14 +296,14 @@ async def scan( }, url_scanner_scan_params.URLScannerScanParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[URLScannerScanResponse]._unwrapper, ), cast_to=cast(Type[URLScannerScanResponse], ResultWrapper[URLScannerScanResponse]), ) -class URLScannerWithRawResponse: - def __init__(self, url_scanner: URLScanner) -> None: +class URLScannerResourceWithRawResponse: + def __init__(self, url_scanner: URLScannerResource) -> None: self._url_scanner = url_scanner self.scan = to_raw_response_wrapper( @@ -310,12 +311,12 @@ def __init__(self, url_scanner: URLScanner) -> None: ) @cached_property - def scans(self) -> ScansWithRawResponse: - return ScansWithRawResponse(self._url_scanner.scans) + def scans(self) -> ScansResourceWithRawResponse: + return ScansResourceWithRawResponse(self._url_scanner.scans) -class AsyncURLScannerWithRawResponse: - def __init__(self, url_scanner: AsyncURLScanner) -> None: +class AsyncURLScannerResourceWithRawResponse: + def __init__(self, url_scanner: AsyncURLScannerResource) -> None: self._url_scanner = url_scanner self.scan = async_to_raw_response_wrapper( @@ -323,12 +324,12 @@ def __init__(self, url_scanner: AsyncURLScanner) -> None: ) @cached_property - def scans(self) -> AsyncScansWithRawResponse: - return AsyncScansWithRawResponse(self._url_scanner.scans) + def scans(self) -> AsyncScansResourceWithRawResponse: + return AsyncScansResourceWithRawResponse(self._url_scanner.scans) -class URLScannerWithStreamingResponse: - def __init__(self, url_scanner: URLScanner) -> None: +class URLScannerResourceWithStreamingResponse: + def __init__(self, url_scanner: URLScannerResource) -> None: self._url_scanner = url_scanner self.scan = to_streamed_response_wrapper( @@ -336,12 +337,12 @@ def __init__(self, url_scanner: URLScanner) -> None: ) @cached_property - def scans(self) -> ScansWithStreamingResponse: - return ScansWithStreamingResponse(self._url_scanner.scans) + def scans(self) -> ScansResourceWithStreamingResponse: + return ScansResourceWithStreamingResponse(self._url_scanner.scans) -class AsyncURLScannerWithStreamingResponse: - def __init__(self, url_scanner: AsyncURLScanner) -> None: +class AsyncURLScannerResourceWithStreamingResponse: + def __init__(self, url_scanner: AsyncURLScannerResource) -> None: self._url_scanner = url_scanner self.scan = async_to_streamed_response_wrapper( @@ -349,5 +350,5 @@ def __init__(self, url_scanner: AsyncURLScanner) -> None: ) @cached_property - def scans(self) -> AsyncScansWithStreamingResponse: - return AsyncScansWithStreamingResponse(self._url_scanner.scans) + def scans(self) -> AsyncScansResourceWithStreamingResponse: + return AsyncScansResourceWithStreamingResponse(self._url_scanner.scans) diff --git a/src/cloudflare/resources/user/__init__.py b/src/cloudflare/resources/user/__init__.py index ee1070d2216..1ae3753c27c 100644 --- a/src/cloudflare/resources/user/__init__.py +++ b/src/cloudflare/resources/user/__init__.py @@ -9,119 +9,91 @@ AsyncUserResourceWithStreamingResponse, ) from .tokens import ( - Tokens, - AsyncTokens, - TokensWithRawResponse, - AsyncTokensWithRawResponse, - TokensWithStreamingResponse, - AsyncTokensWithStreamingResponse, + TokensResource, + AsyncTokensResource, + TokensResourceWithRawResponse, + AsyncTokensResourceWithRawResponse, + TokensResourceWithStreamingResponse, + AsyncTokensResourceWithStreamingResponse, ) from .billing import ( - Billing, - AsyncBilling, - BillingWithRawResponse, - AsyncBillingWithRawResponse, - BillingWithStreamingResponse, - AsyncBillingWithStreamingResponse, + BillingResource, + AsyncBillingResource, + BillingResourceWithRawResponse, + AsyncBillingResourceWithRawResponse, + BillingResourceWithStreamingResponse, + AsyncBillingResourceWithStreamingResponse, ) from .invites import ( - Invites, - AsyncInvites, - InvitesWithRawResponse, - AsyncInvitesWithRawResponse, - InvitesWithStreamingResponse, - AsyncInvitesWithStreamingResponse, -) -from .firewall import ( - Firewall, - AsyncFirewall, - FirewallWithRawResponse, - AsyncFirewallWithRawResponse, - FirewallWithStreamingResponse, - AsyncFirewallWithStreamingResponse, + InvitesResource, + AsyncInvitesResource, + InvitesResourceWithRawResponse, + AsyncInvitesResourceWithRawResponse, + InvitesResourceWithStreamingResponse, + AsyncInvitesResourceWithStreamingResponse, ) from .audit_logs import ( - AuditLogs, - AsyncAuditLogs, - AuditLogsWithRawResponse, - AsyncAuditLogsWithRawResponse, - AuditLogsWithStreamingResponse, - AsyncAuditLogsWithStreamingResponse, + AuditLogsResource, + AsyncAuditLogsResource, + AuditLogsResourceWithRawResponse, + AsyncAuditLogsResourceWithRawResponse, + AuditLogsResourceWithStreamingResponse, + AsyncAuditLogsResourceWithStreamingResponse, ) from .organizations import ( - Organizations, - AsyncOrganizations, - OrganizationsWithRawResponse, - AsyncOrganizationsWithRawResponse, - OrganizationsWithStreamingResponse, - AsyncOrganizationsWithStreamingResponse, + OrganizationsResource, + AsyncOrganizationsResource, + OrganizationsResourceWithRawResponse, + AsyncOrganizationsResourceWithRawResponse, + OrganizationsResourceWithStreamingResponse, + AsyncOrganizationsResourceWithStreamingResponse, ) from .subscriptions import ( - Subscriptions, - AsyncSubscriptions, - SubscriptionsWithRawResponse, - AsyncSubscriptionsWithRawResponse, - SubscriptionsWithStreamingResponse, - AsyncSubscriptionsWithStreamingResponse, -) -from .load_balancers import ( - LoadBalancers, - AsyncLoadBalancers, - LoadBalancersWithRawResponse, - AsyncLoadBalancersWithRawResponse, - LoadBalancersWithStreamingResponse, - AsyncLoadBalancersWithStreamingResponse, + SubscriptionsResource, + AsyncSubscriptionsResource, + SubscriptionsResourceWithRawResponse, + AsyncSubscriptionsResourceWithRawResponse, + SubscriptionsResourceWithStreamingResponse, + AsyncSubscriptionsResourceWithStreamingResponse, ) __all__ = [ - "AuditLogs", - "AsyncAuditLogs", - "AuditLogsWithRawResponse", - "AsyncAuditLogsWithRawResponse", - "AuditLogsWithStreamingResponse", - "AsyncAuditLogsWithStreamingResponse", - "Billing", - "AsyncBilling", - "BillingWithRawResponse", - "AsyncBillingWithRawResponse", - "BillingWithStreamingResponse", - "AsyncBillingWithStreamingResponse", - "Firewall", - "AsyncFirewall", - "FirewallWithRawResponse", - "AsyncFirewallWithRawResponse", - "FirewallWithStreamingResponse", - "AsyncFirewallWithStreamingResponse", - "Invites", - "AsyncInvites", - "InvitesWithRawResponse", - "AsyncInvitesWithRawResponse", - "InvitesWithStreamingResponse", - "AsyncInvitesWithStreamingResponse", - "LoadBalancers", - "AsyncLoadBalancers", - "LoadBalancersWithRawResponse", - "AsyncLoadBalancersWithRawResponse", - "LoadBalancersWithStreamingResponse", - "AsyncLoadBalancersWithStreamingResponse", - "Organizations", - "AsyncOrganizations", - "OrganizationsWithRawResponse", - "AsyncOrganizationsWithRawResponse", - "OrganizationsWithStreamingResponse", - "AsyncOrganizationsWithStreamingResponse", - "Subscriptions", - "AsyncSubscriptions", - "SubscriptionsWithRawResponse", - "AsyncSubscriptionsWithRawResponse", - "SubscriptionsWithStreamingResponse", - "AsyncSubscriptionsWithStreamingResponse", - "Tokens", - "AsyncTokens", - "TokensWithRawResponse", - "AsyncTokensWithRawResponse", - "TokensWithStreamingResponse", - "AsyncTokensWithStreamingResponse", + "AuditLogsResource", + "AsyncAuditLogsResource", + "AuditLogsResourceWithRawResponse", + "AsyncAuditLogsResourceWithRawResponse", + "AuditLogsResourceWithStreamingResponse", + "AsyncAuditLogsResourceWithStreamingResponse", + "BillingResource", + "AsyncBillingResource", + "BillingResourceWithRawResponse", + "AsyncBillingResourceWithRawResponse", + "BillingResourceWithStreamingResponse", + "AsyncBillingResourceWithStreamingResponse", + "InvitesResource", + "AsyncInvitesResource", + "InvitesResourceWithRawResponse", + "AsyncInvitesResourceWithRawResponse", + "InvitesResourceWithStreamingResponse", + "AsyncInvitesResourceWithStreamingResponse", + "OrganizationsResource", + "AsyncOrganizationsResource", + "OrganizationsResourceWithRawResponse", + "AsyncOrganizationsResourceWithRawResponse", + "OrganizationsResourceWithStreamingResponse", + "AsyncOrganizationsResourceWithStreamingResponse", + "SubscriptionsResource", + "AsyncSubscriptionsResource", + "SubscriptionsResourceWithRawResponse", + "AsyncSubscriptionsResourceWithRawResponse", + "SubscriptionsResourceWithStreamingResponse", + "AsyncSubscriptionsResourceWithStreamingResponse", + "TokensResource", + "AsyncTokensResource", + "TokensResourceWithRawResponse", + "AsyncTokensResourceWithRawResponse", + "TokensResourceWithStreamingResponse", + "AsyncTokensResourceWithStreamingResponse", "UserResource", "AsyncUserResource", "UserResourceWithRawResponse", diff --git a/src/cloudflare/resources/user/audit_logs.py b/src/cloudflare/resources/user/audit_logs.py index 72dc9767cb5..6699c4aef11 100644 --- a/src/cloudflare/resources/user/audit_logs.py +++ b/src/cloudflare/resources/user/audit_logs.py @@ -19,23 +19,24 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from ...types.user import AuditLogListResponse, audit_log_list_params +from ...types.user import audit_log_list_params from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.shared.audit_log import AuditLog -__all__ = ["AuditLogs", "AsyncAuditLogs"] +__all__ = ["AuditLogsResource", "AsyncAuditLogsResource"] -class AuditLogs(SyncAPIResource): +class AuditLogsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AuditLogsWithRawResponse: - return AuditLogsWithRawResponse(self) + def with_raw_response(self) -> AuditLogsResourceWithRawResponse: + return AuditLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AuditLogsWithStreamingResponse: - return AuditLogsWithStreamingResponse(self) + def with_streaming_response(self) -> AuditLogsResourceWithStreamingResponse: + return AuditLogsResourceWithStreamingResponse(self) def list( self, @@ -57,7 +58,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AuditLogListResponse]: + ) -> SyncV4PagePaginationArray[AuditLog]: """Gets a list of audit logs for a user account. Can be filtered by who made the @@ -92,7 +93,7 @@ def list( """ return self._get_api_list( "/user/audit_logs", - page=SyncV4PagePaginationArray[AuditLogListResponse], + page=SyncV4PagePaginationArray[AuditLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -115,18 +116,18 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=AuditLogListResponse, + model=AuditLog, ) -class AsyncAuditLogs(AsyncAPIResource): +class AsyncAuditLogsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAuditLogsWithRawResponse: - return AsyncAuditLogsWithRawResponse(self) + def with_raw_response(self) -> AsyncAuditLogsResourceWithRawResponse: + return AsyncAuditLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAuditLogsWithStreamingResponse: - return AsyncAuditLogsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAuditLogsResourceWithStreamingResponse: + return AsyncAuditLogsResourceWithStreamingResponse(self) def list( self, @@ -148,7 +149,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AuditLogListResponse, AsyncV4PagePaginationArray[AuditLogListResponse]]: + ) -> AsyncPaginator[AuditLog, AsyncV4PagePaginationArray[AuditLog]]: """Gets a list of audit logs for a user account. Can be filtered by who made the @@ -183,7 +184,7 @@ def list( """ return self._get_api_list( "/user/audit_logs", - page=AsyncV4PagePaginationArray[AuditLogListResponse], + page=AsyncV4PagePaginationArray[AuditLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -206,12 +207,12 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=AuditLogListResponse, + model=AuditLog, ) -class AuditLogsWithRawResponse: - def __init__(self, audit_logs: AuditLogs) -> None: +class AuditLogsResourceWithRawResponse: + def __init__(self, audit_logs: AuditLogsResource) -> None: self._audit_logs = audit_logs self.list = to_raw_response_wrapper( @@ -219,8 +220,8 @@ def __init__(self, audit_logs: AuditLogs) -> None: ) -class AsyncAuditLogsWithRawResponse: - def __init__(self, audit_logs: AsyncAuditLogs) -> None: +class AsyncAuditLogsResourceWithRawResponse: + def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: self._audit_logs = audit_logs self.list = async_to_raw_response_wrapper( @@ -228,8 +229,8 @@ def __init__(self, audit_logs: AsyncAuditLogs) -> None: ) -class AuditLogsWithStreamingResponse: - def __init__(self, audit_logs: AuditLogs) -> None: +class AuditLogsResourceWithStreamingResponse: + def __init__(self, audit_logs: AuditLogsResource) -> None: self._audit_logs = audit_logs self.list = to_streamed_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, audit_logs: AuditLogs) -> None: ) -class AsyncAuditLogsWithStreamingResponse: - def __init__(self, audit_logs: AsyncAuditLogs) -> None: +class AsyncAuditLogsResourceWithStreamingResponse: + def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: self._audit_logs = audit_logs self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/user/billing/__init__.py b/src/cloudflare/resources/user/billing/__init__.py index 304d79a21a9..060ff8f729d 100644 --- a/src/cloudflare/resources/user/billing/__init__.py +++ b/src/cloudflare/resources/user/billing/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .billing import ( - Billing, - AsyncBilling, - BillingWithRawResponse, - AsyncBillingWithRawResponse, - BillingWithStreamingResponse, - AsyncBillingWithStreamingResponse, + BillingResource, + AsyncBillingResource, + BillingResourceWithRawResponse, + AsyncBillingResourceWithRawResponse, + BillingResourceWithStreamingResponse, + AsyncBillingResourceWithStreamingResponse, ) from .history import ( - History, - AsyncHistory, - HistoryWithRawResponse, - AsyncHistoryWithRawResponse, - HistoryWithStreamingResponse, - AsyncHistoryWithStreamingResponse, + HistoryResource, + AsyncHistoryResource, + HistoryResourceWithRawResponse, + AsyncHistoryResourceWithRawResponse, + HistoryResourceWithStreamingResponse, + AsyncHistoryResourceWithStreamingResponse, ) from .profile import ( - Profile, - AsyncProfile, - ProfileWithRawResponse, - AsyncProfileWithRawResponse, - ProfileWithStreamingResponse, - AsyncProfileWithStreamingResponse, + ProfileResource, + AsyncProfileResource, + ProfileResourceWithRawResponse, + AsyncProfileResourceWithRawResponse, + ProfileResourceWithStreamingResponse, + AsyncProfileResourceWithStreamingResponse, ) __all__ = [ - "History", - "AsyncHistory", - "HistoryWithRawResponse", - "AsyncHistoryWithRawResponse", - "HistoryWithStreamingResponse", - "AsyncHistoryWithStreamingResponse", - "Profile", - "AsyncProfile", - "ProfileWithRawResponse", - "AsyncProfileWithRawResponse", - "ProfileWithStreamingResponse", - "AsyncProfileWithStreamingResponse", - "Billing", - "AsyncBilling", - "BillingWithRawResponse", - "AsyncBillingWithRawResponse", - "BillingWithStreamingResponse", - "AsyncBillingWithStreamingResponse", + "HistoryResource", + "AsyncHistoryResource", + "HistoryResourceWithRawResponse", + "AsyncHistoryResourceWithRawResponse", + "HistoryResourceWithStreamingResponse", + "AsyncHistoryResourceWithStreamingResponse", + "ProfileResource", + "AsyncProfileResource", + "ProfileResourceWithRawResponse", + "AsyncProfileResourceWithRawResponse", + "ProfileResourceWithStreamingResponse", + "AsyncProfileResourceWithStreamingResponse", + "BillingResource", + "AsyncBillingResource", + "BillingResourceWithRawResponse", + "AsyncBillingResourceWithRawResponse", + "BillingResourceWithStreamingResponse", + "AsyncBillingResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/user/billing/billing.py b/src/cloudflare/resources/user/billing/billing.py index 02eee039b1e..ceb48cdb474 100644 --- a/src/cloudflare/resources/user/billing/billing.py +++ b/src/cloudflare/resources/user/billing/billing.py @@ -3,110 +3,110 @@ from __future__ import annotations from .history import ( - History, - AsyncHistory, - HistoryWithRawResponse, - AsyncHistoryWithRawResponse, - HistoryWithStreamingResponse, - AsyncHistoryWithStreamingResponse, + HistoryResource, + AsyncHistoryResource, + HistoryResourceWithRawResponse, + AsyncHistoryResourceWithRawResponse, + HistoryResourceWithStreamingResponse, + AsyncHistoryResourceWithStreamingResponse, ) from .profile import ( - Profile, - AsyncProfile, - ProfileWithRawResponse, - AsyncProfileWithRawResponse, - ProfileWithStreamingResponse, - AsyncProfileWithStreamingResponse, + ProfileResource, + AsyncProfileResource, + ProfileResourceWithRawResponse, + AsyncProfileResourceWithRawResponse, + ProfileResourceWithStreamingResponse, + AsyncProfileResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Billing", "AsyncBilling"] +__all__ = ["BillingResource", "AsyncBillingResource"] -class Billing(SyncAPIResource): +class BillingResource(SyncAPIResource): @cached_property - def history(self) -> History: - return History(self._client) + def history(self) -> HistoryResource: + return HistoryResource(self._client) @cached_property - def profile(self) -> Profile: - return Profile(self._client) + def profile(self) -> ProfileResource: + return ProfileResource(self._client) @cached_property - def with_raw_response(self) -> BillingWithRawResponse: - return BillingWithRawResponse(self) + def with_raw_response(self) -> BillingResourceWithRawResponse: + return BillingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BillingWithStreamingResponse: - return BillingWithStreamingResponse(self) + def with_streaming_response(self) -> BillingResourceWithStreamingResponse: + return BillingResourceWithStreamingResponse(self) -class AsyncBilling(AsyncAPIResource): +class AsyncBillingResource(AsyncAPIResource): @cached_property - def history(self) -> AsyncHistory: - return AsyncHistory(self._client) + def history(self) -> AsyncHistoryResource: + return AsyncHistoryResource(self._client) @cached_property - def profile(self) -> AsyncProfile: - return AsyncProfile(self._client) + def profile(self) -> AsyncProfileResource: + return AsyncProfileResource(self._client) @cached_property - def with_raw_response(self) -> AsyncBillingWithRawResponse: - return AsyncBillingWithRawResponse(self) + def with_raw_response(self) -> AsyncBillingResourceWithRawResponse: + return AsyncBillingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBillingWithStreamingResponse: - return AsyncBillingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBillingResourceWithStreamingResponse: + return AsyncBillingResourceWithStreamingResponse(self) -class BillingWithRawResponse: - def __init__(self, billing: Billing) -> None: +class BillingResourceWithRawResponse: + def __init__(self, billing: BillingResource) -> None: self._billing = billing @cached_property - def history(self) -> HistoryWithRawResponse: - return HistoryWithRawResponse(self._billing.history) + def history(self) -> HistoryResourceWithRawResponse: + return HistoryResourceWithRawResponse(self._billing.history) @cached_property - def profile(self) -> ProfileWithRawResponse: - return ProfileWithRawResponse(self._billing.profile) + def profile(self) -> ProfileResourceWithRawResponse: + return ProfileResourceWithRawResponse(self._billing.profile) -class AsyncBillingWithRawResponse: - def __init__(self, billing: AsyncBilling) -> None: +class AsyncBillingResourceWithRawResponse: + def __init__(self, billing: AsyncBillingResource) -> None: self._billing = billing @cached_property - def history(self) -> AsyncHistoryWithRawResponse: - return AsyncHistoryWithRawResponse(self._billing.history) + def history(self) -> AsyncHistoryResourceWithRawResponse: + return AsyncHistoryResourceWithRawResponse(self._billing.history) @cached_property - def profile(self) -> AsyncProfileWithRawResponse: - return AsyncProfileWithRawResponse(self._billing.profile) + def profile(self) -> AsyncProfileResourceWithRawResponse: + return AsyncProfileResourceWithRawResponse(self._billing.profile) -class BillingWithStreamingResponse: - def __init__(self, billing: Billing) -> None: +class BillingResourceWithStreamingResponse: + def __init__(self, billing: BillingResource) -> None: self._billing = billing @cached_property - def history(self) -> HistoryWithStreamingResponse: - return HistoryWithStreamingResponse(self._billing.history) + def history(self) -> HistoryResourceWithStreamingResponse: + return HistoryResourceWithStreamingResponse(self._billing.history) @cached_property - def profile(self) -> ProfileWithStreamingResponse: - return ProfileWithStreamingResponse(self._billing.profile) + def profile(self) -> ProfileResourceWithStreamingResponse: + return ProfileResourceWithStreamingResponse(self._billing.profile) -class AsyncBillingWithStreamingResponse: - def __init__(self, billing: AsyncBilling) -> None: +class AsyncBillingResourceWithStreamingResponse: + def __init__(self, billing: AsyncBillingResource) -> None: self._billing = billing @cached_property - def history(self) -> AsyncHistoryWithStreamingResponse: - return AsyncHistoryWithStreamingResponse(self._billing.history) + def history(self) -> AsyncHistoryResourceWithStreamingResponse: + return AsyncHistoryResourceWithStreamingResponse(self._billing.history) @cached_property - def profile(self) -> AsyncProfileWithStreamingResponse: - return AsyncProfileWithStreamingResponse(self._billing.profile) + def profile(self) -> AsyncProfileResourceWithStreamingResponse: + return AsyncProfileResourceWithStreamingResponse(self._billing.profile) diff --git a/src/cloudflare/resources/user/billing/history.py b/src/cloudflare/resources/user/billing/history.py index 1c4a37625cb..538d34c5186 100644 --- a/src/cloudflare/resources/user/billing/history.py +++ b/src/cloudflare/resources/user/billing/history.py @@ -2,16 +2,14 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Union +from datetime import datetime from typing_extensions import Literal import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -20,47 +18,61 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._wrappers import ResultWrapper +from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.user.billing import HistoryGetResponse, history_get_params +from ....types.user.billing import history_list_params +from ....types.user.billing.billing_history import BillingHistory -__all__ = ["History", "AsyncHistory"] +__all__ = ["HistoryResource", "AsyncHistoryResource"] -class History(SyncAPIResource): +class HistoryResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HistoryWithRawResponse: - return HistoryWithRawResponse(self) + def with_raw_response(self) -> HistoryResourceWithRawResponse: + return HistoryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HistoryWithStreamingResponse: - return HistoryWithStreamingResponse(self) + def with_streaming_response(self) -> HistoryResourceWithStreamingResponse: + return HistoryResourceWithStreamingResponse(self) - def get( + def list( self, *, + action: str | NotGiven = NOT_GIVEN, + occured_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + occurred_at: Union[str, datetime] | NotGiven = NOT_GIVEN, order: Literal["type", "occured_at", "action"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + type: 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[HistoryGetResponse]: + ) -> SyncV4PagePaginationArray[BillingHistory]: """ Accesses your billing history object. Args: + action: The billing item action. + + occured_at: When the billing item was created. + + occurred_at: When the billing item was created. + order: Field to order billing history by. page: Page number of paginated results. per_page: Number of items per page. + type: The billing item type. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -69,8 +81,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/user/billing/history", + page=SyncV4PagePaginationArray[BillingHistory], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -78,50 +91,65 @@ def get( timeout=timeout, query=maybe_transform( { + "action": action, + "occured_at": occured_at, + "occurred_at": occurred_at, "order": order, "page": page, "per_page": per_page, + "type": type, }, - history_get_params.HistoryGetParams, + history_list_params.HistoryListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[HistoryGetResponse]], ResultWrapper[HistoryGetResponse]), + model=BillingHistory, ) -class AsyncHistory(AsyncAPIResource): +class AsyncHistoryResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHistoryWithRawResponse: - return AsyncHistoryWithRawResponse(self) + def with_raw_response(self) -> AsyncHistoryResourceWithRawResponse: + return AsyncHistoryResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHistoryWithStreamingResponse: - return AsyncHistoryWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHistoryResourceWithStreamingResponse: + return AsyncHistoryResourceWithStreamingResponse(self) - async def get( + def list( self, *, + action: str | NotGiven = NOT_GIVEN, + occured_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + occurred_at: Union[str, datetime] | NotGiven = NOT_GIVEN, order: Literal["type", "occured_at", "action"] | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + type: 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[HistoryGetResponse]: + ) -> AsyncPaginator[BillingHistory, AsyncV4PagePaginationArray[BillingHistory]]: """ Accesses your billing history object. Args: + action: The billing item action. + + occured_at: When the billing item was created. + + occurred_at: When the billing item was created. + order: Field to order billing history by. page: Page number of paginated results. per_page: Number of items per page. + type: The billing item type. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -130,58 +158,62 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/user/billing/history", + page=AsyncV4PagePaginationArray[BillingHistory], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { + "action": action, + "occured_at": occured_at, + "occurred_at": occurred_at, "order": order, "page": page, "per_page": per_page, + "type": type, }, - history_get_params.HistoryGetParams, + history_list_params.HistoryListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[HistoryGetResponse]], ResultWrapper[HistoryGetResponse]), + model=BillingHistory, ) -class HistoryWithRawResponse: - def __init__(self, history: History) -> None: +class HistoryResourceWithRawResponse: + def __init__(self, history: HistoryResource) -> None: self._history = history - self.get = to_raw_response_wrapper( - history.get, + self.list = to_raw_response_wrapper( + history.list, ) -class AsyncHistoryWithRawResponse: - def __init__(self, history: AsyncHistory) -> None: +class AsyncHistoryResourceWithRawResponse: + def __init__(self, history: AsyncHistoryResource) -> None: self._history = history - self.get = async_to_raw_response_wrapper( - history.get, + self.list = async_to_raw_response_wrapper( + history.list, ) -class HistoryWithStreamingResponse: - def __init__(self, history: History) -> None: +class HistoryResourceWithStreamingResponse: + def __init__(self, history: HistoryResource) -> None: self._history = history - self.get = to_streamed_response_wrapper( - history.get, + self.list = to_streamed_response_wrapper( + history.list, ) -class AsyncHistoryWithStreamingResponse: - def __init__(self, history: AsyncHistory) -> None: +class AsyncHistoryResourceWithStreamingResponse: + def __init__(self, history: AsyncHistoryResource) -> None: self._history = history - self.get = async_to_streamed_response_wrapper( - history.get, + self.list = async_to_streamed_response_wrapper( + history.list, ) diff --git a/src/cloudflare/resources/user/billing/profile.py b/src/cloudflare/resources/user/billing/profile.py index fd7d55ccca6..1a12d11902a 100644 --- a/src/cloudflare/resources/user/billing/profile.py +++ b/src/cloudflare/resources/user/billing/profile.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.user.billing import ProfileGetResponse +from ....types.user.billing.profile_get_response import ProfileGetResponse -__all__ = ["Profile", "AsyncProfile"] +__all__ = ["ProfileResource", "AsyncProfileResource"] -class Profile(SyncAPIResource): +class ProfileResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ProfileWithRawResponse: - return ProfileWithRawResponse(self) + def with_raw_response(self) -> ProfileResourceWithRawResponse: + return ProfileResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ProfileWithStreamingResponse: - return ProfileWithStreamingResponse(self) + def with_streaming_response(self) -> ProfileResourceWithStreamingResponse: + return ProfileResourceWithStreamingResponse(self) def get( self, @@ -53,7 +53,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProfileGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProfileGetResponse] @@ -62,14 +62,14 @@ def get( ) -class AsyncProfile(AsyncAPIResource): +class AsyncProfileResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncProfileWithRawResponse: - return AsyncProfileWithRawResponse(self) + def with_raw_response(self) -> AsyncProfileResourceWithRawResponse: + return AsyncProfileResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncProfileWithStreamingResponse: - return AsyncProfileWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncProfileResourceWithStreamingResponse: + return AsyncProfileResourceWithStreamingResponse(self) async def get( self, @@ -91,7 +91,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProfileGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProfileGetResponse] @@ -100,8 +100,8 @@ async def get( ) -class ProfileWithRawResponse: - def __init__(self, profile: Profile) -> None: +class ProfileResourceWithRawResponse: + def __init__(self, profile: ProfileResource) -> None: self._profile = profile self.get = to_raw_response_wrapper( @@ -109,8 +109,8 @@ def __init__(self, profile: Profile) -> None: ) -class AsyncProfileWithRawResponse: - def __init__(self, profile: AsyncProfile) -> None: +class AsyncProfileResourceWithRawResponse: + def __init__(self, profile: AsyncProfileResource) -> None: self._profile = profile self.get = async_to_raw_response_wrapper( @@ -118,8 +118,8 @@ def __init__(self, profile: AsyncProfile) -> None: ) -class ProfileWithStreamingResponse: - def __init__(self, profile: Profile) -> None: +class ProfileResourceWithStreamingResponse: + def __init__(self, profile: ProfileResource) -> None: self._profile = profile self.get = to_streamed_response_wrapper( @@ -127,8 +127,8 @@ def __init__(self, profile: Profile) -> None: ) -class AsyncProfileWithStreamingResponse: - def __init__(self, profile: AsyncProfile) -> None: +class AsyncProfileResourceWithStreamingResponse: + def __init__(self, profile: AsyncProfileResource) -> None: self._profile = profile self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/user/firewall/__init__.py b/src/cloudflare/resources/user/firewall/__init__.py deleted file mode 100644 index 4a73d054bf4..00000000000 --- a/src/cloudflare/resources/user/firewall/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .firewall import ( - Firewall, - AsyncFirewall, - FirewallWithRawResponse, - AsyncFirewallWithRawResponse, - FirewallWithStreamingResponse, - AsyncFirewallWithStreamingResponse, -) -from .access_rules import ( - AccessRules, - AsyncAccessRules, - AccessRulesWithRawResponse, - AsyncAccessRulesWithRawResponse, - AccessRulesWithStreamingResponse, - AsyncAccessRulesWithStreamingResponse, -) - -__all__ = [ - "AccessRules", - "AsyncAccessRules", - "AccessRulesWithRawResponse", - "AsyncAccessRulesWithRawResponse", - "AccessRulesWithStreamingResponse", - "AsyncAccessRulesWithStreamingResponse", - "Firewall", - "AsyncFirewall", - "FirewallWithRawResponse", - "AsyncFirewallWithRawResponse", - "FirewallWithStreamingResponse", - "AsyncFirewallWithStreamingResponse", -] diff --git a/src/cloudflare/resources/user/firewall/access_rules.py b/src/cloudflare/resources/user/firewall/access_rules.py deleted file mode 100644 index 762b30cfa70..00000000000 --- a/src/cloudflare/resources/user/firewall/access_rules.py +++ /dev/null @@ -1,549 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - 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 SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) -from ....types.user.firewall import ( - FirewallRule, - AccessRuleDeleteResponse, - access_rule_edit_params, - access_rule_list_params, - access_rule_create_params, -) - -__all__ = ["AccessRules", "AsyncAccessRules"] - - -class AccessRules(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AccessRulesWithRawResponse: - return AccessRulesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AccessRulesWithStreamingResponse: - return AccessRulesWithStreamingResponse(self) - - def create( - self, - *, - configuration: access_rule_create_params.Configuration, - mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"], - notes: 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[FirewallRule]: - """ - Creates a new IP Access rule for all zones owned by the current user. - - Note: To create an IP Access rule that applies to a specific zone, refer to the - [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints. - - Args: - configuration: The rule configuration. - - mode: The action to apply to a matched request. - - notes: An informative summary of the rule, typically used as a reminder or explanation. - - 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 - """ - return self._post( - "/user/firewall/access_rules/rules", - body=maybe_transform( - { - "configuration": configuration, - "mode": mode, - "notes": notes, - }, - access_rule_create_params.AccessRuleCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[FirewallRule]], ResultWrapper[FirewallRule]), - ) - - def list( - self, - *, - direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - egs_pagination: access_rule_list_params.EgsPagination | NotGiven = NOT_GIVEN, - filters: access_rule_list_params.Filters | NotGiven = NOT_GIVEN, - order: Literal["configuration.target", "configuration.value", "mode"] | NotGiven = NOT_GIVEN, - page: float | NotGiven = NOT_GIVEN, - per_page: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[FirewallRule]: - """Fetches IP Access rules of the user. - - You can filter the results using several - optional parameters. - - Args: - direction: The direction used to sort returned rules. - - order: The field used to sort returned rules. - - page: Requested page within paginated list of results. - - per_page: Maximum number of results requested. - - 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 - """ - return self._get_api_list( - "/user/firewall/access_rules/rules", - page=SyncV4PagePaginationArray[FirewallRule], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "direction": direction, - "egs_pagination": egs_pagination, - "filters": filters, - "order": order, - "page": page, - "per_page": per_page, - }, - access_rule_list_params.AccessRuleListParams, - ), - ), - model=FirewallRule, - ) - - def delete( - self, - identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRuleDeleteResponse]: - """ - Deletes an IP Access rule at the user level. - - Note: Deleting a user-level rule will affect all zones owned by the user. - - Args: - identifier: The unique identifier of the IP Access rule. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._delete( - f"/user/firewall/access_rules/rules/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[AccessRuleDeleteResponse]], ResultWrapper[AccessRuleDeleteResponse]), - ) - - def edit( - self, - identifier: str, - *, - mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"] | NotGiven = NOT_GIVEN, - notes: 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[FirewallRule]: - """Updates an IP Access rule defined at the user level. - - You can only update the - rule action (`mode` parameter) and notes. - - Args: - identifier: The unique identifier of the IP Access rule. - - mode: The action to apply to a matched request. - - notes: An informative summary of the rule, typically used as a reminder or explanation. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._patch( - f"/user/firewall/access_rules/rules/{identifier}", - body=maybe_transform( - { - "mode": mode, - "notes": notes, - }, - access_rule_edit_params.AccessRuleEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[FirewallRule]], ResultWrapper[FirewallRule]), - ) - - -class AsyncAccessRules(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAccessRulesWithRawResponse: - return AsyncAccessRulesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAccessRulesWithStreamingResponse: - return AsyncAccessRulesWithStreamingResponse(self) - - async def create( - self, - *, - configuration: access_rule_create_params.Configuration, - mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"], - notes: 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[FirewallRule]: - """ - Creates a new IP Access rule for all zones owned by the current user. - - Note: To create an IP Access rule that applies to a specific zone, refer to the - [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints. - - Args: - configuration: The rule configuration. - - mode: The action to apply to a matched request. - - notes: An informative summary of the rule, typically used as a reminder or explanation. - - 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 - """ - return await self._post( - "/user/firewall/access_rules/rules", - body=await async_maybe_transform( - { - "configuration": configuration, - "mode": mode, - "notes": notes, - }, - access_rule_create_params.AccessRuleCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[FirewallRule]], ResultWrapper[FirewallRule]), - ) - - def list( - self, - *, - direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - egs_pagination: access_rule_list_params.EgsPagination | NotGiven = NOT_GIVEN, - filters: access_rule_list_params.Filters | NotGiven = NOT_GIVEN, - order: Literal["configuration.target", "configuration.value", "mode"] | NotGiven = NOT_GIVEN, - page: float | NotGiven = NOT_GIVEN, - per_page: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[FirewallRule, AsyncV4PagePaginationArray[FirewallRule]]: - """Fetches IP Access rules of the user. - - You can filter the results using several - optional parameters. - - Args: - direction: The direction used to sort returned rules. - - order: The field used to sort returned rules. - - page: Requested page within paginated list of results. - - per_page: Maximum number of results requested. - - 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 - """ - return self._get_api_list( - "/user/firewall/access_rules/rules", - page=AsyncV4PagePaginationArray[FirewallRule], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "direction": direction, - "egs_pagination": egs_pagination, - "filters": filters, - "order": order, - "page": page, - "per_page": per_page, - }, - access_rule_list_params.AccessRuleListParams, - ), - ), - model=FirewallRule, - ) - - async def delete( - self, - identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AccessRuleDeleteResponse]: - """ - Deletes an IP Access rule at the user level. - - Note: Deleting a user-level rule will affect all zones owned by the user. - - Args: - identifier: The unique identifier of the IP Access rule. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._delete( - f"/user/firewall/access_rules/rules/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[AccessRuleDeleteResponse]], ResultWrapper[AccessRuleDeleteResponse]), - ) - - async def edit( - self, - identifier: str, - *, - mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"] | NotGiven = NOT_GIVEN, - notes: 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[FirewallRule]: - """Updates an IP Access rule defined at the user level. - - You can only update the - rule action (`mode` parameter) and notes. - - Args: - identifier: The unique identifier of the IP Access rule. - - mode: The action to apply to a matched request. - - notes: An informative summary of the rule, typically used as a reminder or explanation. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._patch( - f"/user/firewall/access_rules/rules/{identifier}", - body=await async_maybe_transform( - { - "mode": mode, - "notes": notes, - }, - access_rule_edit_params.AccessRuleEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[FirewallRule]], ResultWrapper[FirewallRule]), - ) - - -class AccessRulesWithRawResponse: - def __init__(self, access_rules: AccessRules) -> None: - self._access_rules = access_rules - - self.create = to_raw_response_wrapper( - access_rules.create, - ) - self.list = to_raw_response_wrapper( - access_rules.list, - ) - self.delete = to_raw_response_wrapper( - access_rules.delete, - ) - self.edit = to_raw_response_wrapper( - access_rules.edit, - ) - - -class AsyncAccessRulesWithRawResponse: - def __init__(self, access_rules: AsyncAccessRules) -> None: - self._access_rules = access_rules - - self.create = async_to_raw_response_wrapper( - access_rules.create, - ) - self.list = async_to_raw_response_wrapper( - access_rules.list, - ) - self.delete = async_to_raw_response_wrapper( - access_rules.delete, - ) - self.edit = async_to_raw_response_wrapper( - access_rules.edit, - ) - - -class AccessRulesWithStreamingResponse: - def __init__(self, access_rules: AccessRules) -> None: - self._access_rules = access_rules - - self.create = to_streamed_response_wrapper( - access_rules.create, - ) - self.list = to_streamed_response_wrapper( - access_rules.list, - ) - self.delete = to_streamed_response_wrapper( - access_rules.delete, - ) - self.edit = to_streamed_response_wrapper( - access_rules.edit, - ) - - -class AsyncAccessRulesWithStreamingResponse: - def __init__(self, access_rules: AsyncAccessRules) -> None: - self._access_rules = access_rules - - self.create = async_to_streamed_response_wrapper( - access_rules.create, - ) - self.list = async_to_streamed_response_wrapper( - access_rules.list, - ) - self.delete = async_to_streamed_response_wrapper( - access_rules.delete, - ) - self.edit = async_to_streamed_response_wrapper( - access_rules.edit, - ) diff --git a/src/cloudflare/resources/user/firewall/firewall.py b/src/cloudflare/resources/user/firewall/firewall.py deleted file mode 100644 index bd55802d7d9..00000000000 --- a/src/cloudflare/resources/user/firewall/firewall.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .access_rules import ( - AccessRules, - AsyncAccessRules, - AccessRulesWithRawResponse, - AsyncAccessRulesWithRawResponse, - AccessRulesWithStreamingResponse, - AsyncAccessRulesWithStreamingResponse, -) - -__all__ = ["Firewall", "AsyncFirewall"] - - -class Firewall(SyncAPIResource): - @cached_property - def access_rules(self) -> AccessRules: - return AccessRules(self._client) - - @cached_property - def with_raw_response(self) -> FirewallWithRawResponse: - return FirewallWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FirewallWithStreamingResponse: - return FirewallWithStreamingResponse(self) - - -class AsyncFirewall(AsyncAPIResource): - @cached_property - def access_rules(self) -> AsyncAccessRules: - return AsyncAccessRules(self._client) - - @cached_property - def with_raw_response(self) -> AsyncFirewallWithRawResponse: - return AsyncFirewallWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFirewallWithStreamingResponse: - return AsyncFirewallWithStreamingResponse(self) - - -class FirewallWithRawResponse: - def __init__(self, firewall: Firewall) -> None: - self._firewall = firewall - - @cached_property - def access_rules(self) -> AccessRulesWithRawResponse: - return AccessRulesWithRawResponse(self._firewall.access_rules) - - -class AsyncFirewallWithRawResponse: - def __init__(self, firewall: AsyncFirewall) -> None: - self._firewall = firewall - - @cached_property - def access_rules(self) -> AsyncAccessRulesWithRawResponse: - return AsyncAccessRulesWithRawResponse(self._firewall.access_rules) - - -class FirewallWithStreamingResponse: - def __init__(self, firewall: Firewall) -> None: - self._firewall = firewall - - @cached_property - def access_rules(self) -> AccessRulesWithStreamingResponse: - return AccessRulesWithStreamingResponse(self._firewall.access_rules) - - -class AsyncFirewallWithStreamingResponse: - def __init__(self, firewall: AsyncFirewall) -> None: - self._firewall = firewall - - @cached_property - def access_rules(self) -> AsyncAccessRulesWithStreamingResponse: - return AsyncAccessRulesWithStreamingResponse(self._firewall.access_rules) diff --git a/src/cloudflare/resources/user/invites.py b/src/cloudflare/resources/user/invites.py index 004b6fc05ea..197fa07e530 100644 --- a/src/cloudflare/resources/user/invites.py +++ b/src/cloudflare/resources/user/invites.py @@ -22,23 +22,26 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage -from ...types.user import InviteGetResponse, InviteEditResponse, InviteListResponse, invite_edit_params +from ...types.user import invite_edit_params from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.user.invite import Invite +from ...types.user.invite_get_response import InviteGetResponse +from ...types.user.invite_edit_response import InviteEditResponse -__all__ = ["Invites", "AsyncInvites"] +__all__ = ["InvitesResource", "AsyncInvitesResource"] -class Invites(SyncAPIResource): +class InvitesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> InvitesWithRawResponse: - return InvitesWithRawResponse(self) + def with_raw_response(self) -> InvitesResourceWithRawResponse: + return InvitesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> InvitesWithStreamingResponse: - return InvitesWithStreamingResponse(self) + def with_streaming_response(self) -> InvitesResourceWithStreamingResponse: + return InvitesResourceWithStreamingResponse(self) def list( self, @@ -49,15 +52,15 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[InviteListResponse]: + ) -> SyncSinglePage[Invite]: """Lists all invitations associated with my user.""" return self._get_api_list( "/user/invites", - page=SyncSinglePage[InviteListResponse], + page=SyncSinglePage[Invite], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=InviteListResponse, + model=Invite, ) def edit( @@ -100,7 +103,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[InviteEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[InviteEditResponse] @@ -144,7 +147,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[InviteGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[InviteGetResponse] @@ -153,14 +156,14 @@ def get( ) -class AsyncInvites(AsyncAPIResource): +class AsyncInvitesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncInvitesWithRawResponse: - return AsyncInvitesWithRawResponse(self) + def with_raw_response(self) -> AsyncInvitesResourceWithRawResponse: + return AsyncInvitesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncInvitesWithStreamingResponse: - return AsyncInvitesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncInvitesResourceWithStreamingResponse: + return AsyncInvitesResourceWithStreamingResponse(self) def list( self, @@ -171,15 +174,15 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[InviteListResponse, AsyncSinglePage[InviteListResponse]]: + ) -> AsyncPaginator[Invite, AsyncSinglePage[Invite]]: """Lists all invitations associated with my user.""" return self._get_api_list( "/user/invites", - page=AsyncSinglePage[InviteListResponse], + page=AsyncSinglePage[Invite], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=InviteListResponse, + model=Invite, ) async def edit( @@ -222,7 +225,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[InviteEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[InviteEditResponse] @@ -266,7 +269,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[InviteGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[InviteGetResponse] @@ -275,8 +278,8 @@ async def get( ) -class InvitesWithRawResponse: - def __init__(self, invites: Invites) -> None: +class InvitesResourceWithRawResponse: + def __init__(self, invites: InvitesResource) -> None: self._invites = invites self.list = to_raw_response_wrapper( @@ -290,8 +293,8 @@ def __init__(self, invites: Invites) -> None: ) -class AsyncInvitesWithRawResponse: - def __init__(self, invites: AsyncInvites) -> None: +class AsyncInvitesResourceWithRawResponse: + def __init__(self, invites: AsyncInvitesResource) -> None: self._invites = invites self.list = async_to_raw_response_wrapper( @@ -305,8 +308,8 @@ def __init__(self, invites: AsyncInvites) -> None: ) -class InvitesWithStreamingResponse: - def __init__(self, invites: Invites) -> None: +class InvitesResourceWithStreamingResponse: + def __init__(self, invites: InvitesResource) -> None: self._invites = invites self.list = to_streamed_response_wrapper( @@ -320,8 +323,8 @@ def __init__(self, invites: Invites) -> None: ) -class AsyncInvitesWithStreamingResponse: - def __init__(self, invites: AsyncInvites) -> None: +class AsyncInvitesResourceWithStreamingResponse: + def __init__(self, invites: AsyncInvitesResource) -> None: self._invites = invites self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/user/load_balancers/__init__.py b/src/cloudflare/resources/user/load_balancers/__init__.py deleted file mode 100644 index 53cd31b6fb2..00000000000 --- a/src/cloudflare/resources/user/load_balancers/__init__.py +++ /dev/null @@ -1,75 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .pools import ( - Pools, - AsyncPools, - PoolsWithRawResponse, - AsyncPoolsWithRawResponse, - PoolsWithStreamingResponse, - AsyncPoolsWithStreamingResponse, -) -from .preview import ( - Preview, - AsyncPreview, - PreviewWithRawResponse, - AsyncPreviewWithRawResponse, - PreviewWithStreamingResponse, - AsyncPreviewWithStreamingResponse, -) -from .monitors import ( - Monitors, - AsyncMonitors, - MonitorsWithRawResponse, - AsyncMonitorsWithRawResponse, - MonitorsWithStreamingResponse, - AsyncMonitorsWithStreamingResponse, -) -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) -from .load_balancers import ( - LoadBalancers, - AsyncLoadBalancers, - LoadBalancersWithRawResponse, - AsyncLoadBalancersWithRawResponse, - LoadBalancersWithStreamingResponse, - AsyncLoadBalancersWithStreamingResponse, -) - -__all__ = [ - "Monitors", - "AsyncMonitors", - "MonitorsWithRawResponse", - "AsyncMonitorsWithRawResponse", - "MonitorsWithStreamingResponse", - "AsyncMonitorsWithStreamingResponse", - "Pools", - "AsyncPools", - "PoolsWithRawResponse", - "AsyncPoolsWithRawResponse", - "PoolsWithStreamingResponse", - "AsyncPoolsWithStreamingResponse", - "Preview", - "AsyncPreview", - "PreviewWithRawResponse", - "AsyncPreviewWithRawResponse", - "PreviewWithStreamingResponse", - "AsyncPreviewWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", - "LoadBalancers", - "AsyncLoadBalancers", - "LoadBalancersWithRawResponse", - "AsyncLoadBalancersWithRawResponse", - "LoadBalancersWithStreamingResponse", - "AsyncLoadBalancersWithStreamingResponse", -] diff --git a/src/cloudflare/resources/user/load_balancers/analytics/__init__.py b/src/cloudflare/resources/user/load_balancers/analytics/__init__.py deleted file mode 100644 index 134a224e199..00000000000 --- a/src/cloudflare/resources/user/load_balancers/analytics/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, -) -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) - -__all__ = [ - "Events", - "AsyncEvents", - "EventsWithRawResponse", - "AsyncEventsWithRawResponse", - "EventsWithStreamingResponse", - "AsyncEventsWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/user/load_balancers/analytics/analytics.py b/src/cloudflare/resources/user/load_balancers/analytics/analytics.py deleted file mode 100644 index 40f4c537773..00000000000 --- a/src/cloudflare/resources/user/load_balancers/analytics/analytics.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["Analytics", "AsyncAnalytics"] - - -class Analytics(SyncAPIResource): - @cached_property - def events(self) -> Events: - return Events(self._client) - - @cached_property - def with_raw_response(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self) - - -class AsyncAnalytics(AsyncAPIResource): - @cached_property - def events(self) -> AsyncEvents: - return AsyncEvents(self._client) - - @cached_property - def with_raw_response(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self) - - -class AnalyticsWithRawResponse: - def __init__(self, analytics: Analytics) -> None: - self._analytics = analytics - - @cached_property - def events(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self._analytics.events) - - -class AsyncAnalyticsWithRawResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: - self._analytics = analytics - - @cached_property - def events(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self._analytics.events) - - -class AnalyticsWithStreamingResponse: - def __init__(self, analytics: Analytics) -> None: - self._analytics = analytics - - @cached_property - def events(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self._analytics.events) - - -class AsyncAnalyticsWithStreamingResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: - self._analytics = analytics - - @cached_property - def events(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self._analytics.events) diff --git a/src/cloudflare/resources/user/load_balancers/analytics/events.py b/src/cloudflare/resources/user/load_balancers/analytics/events.py deleted file mode 100644 index 16d130bb45c..00000000000 --- a/src/cloudflare/resources/user/load_balancers/analytics/events.py +++ /dev/null @@ -1,217 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime - -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.user.load_balancers.analytics import LoadBalancingAnalytics, event_list_params - -__all__ = ["Events", "AsyncEvents"] - - -class Events(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self) - - def list( - self, - *, - origin_healthy: bool | NotGiven = NOT_GIVEN, - origin_name: str | NotGiven = NOT_GIVEN, - pool_healthy: bool | NotGiven = NOT_GIVEN, - pool_id: str | NotGiven = NOT_GIVEN, - pool_name: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[LoadBalancingAnalytics]: - """ - List origin health changes. - - Args: - origin_healthy: If true, filter events where the origin status is healthy. If false, filter - events where the origin status is unhealthy. - - origin_name: The name for the origin to filter. - - pool_healthy: If true, filter events where the pool status is healthy. If false, filter events - where the pool status is unhealthy. - - pool_name: The name for the pool to filter. - - since: Start date and time of requesting data period in the ISO8601 format. - - until: End date and time of requesting data period in the ISO8601 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 - """ - return self._get_api_list( - "/user/load_balancing_analytics/events", - page=SyncSinglePage[LoadBalancingAnalytics], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "origin_healthy": origin_healthy, - "origin_name": origin_name, - "pool_healthy": pool_healthy, - "pool_id": pool_id, - "pool_name": pool_name, - "since": since, - "until": until, - }, - event_list_params.EventListParams, - ), - ), - model=LoadBalancingAnalytics, - ) - - -class AsyncEvents(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self) - - def list( - self, - *, - origin_healthy: bool | NotGiven = NOT_GIVEN, - origin_name: str | NotGiven = NOT_GIVEN, - pool_healthy: bool | NotGiven = NOT_GIVEN, - pool_id: str | NotGiven = NOT_GIVEN, - pool_name: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[LoadBalancingAnalytics, AsyncSinglePage[LoadBalancingAnalytics]]: - """ - List origin health changes. - - Args: - origin_healthy: If true, filter events where the origin status is healthy. If false, filter - events where the origin status is unhealthy. - - origin_name: The name for the origin to filter. - - pool_healthy: If true, filter events where the pool status is healthy. If false, filter events - where the pool status is unhealthy. - - pool_name: The name for the pool to filter. - - since: Start date and time of requesting data period in the ISO8601 format. - - until: End date and time of requesting data period in the ISO8601 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 - """ - return self._get_api_list( - "/user/load_balancing_analytics/events", - page=AsyncSinglePage[LoadBalancingAnalytics], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "origin_healthy": origin_healthy, - "origin_name": origin_name, - "pool_healthy": pool_healthy, - "pool_id": pool_id, - "pool_name": pool_name, - "since": since, - "until": until, - }, - event_list_params.EventListParams, - ), - ), - model=LoadBalancingAnalytics, - ) - - -class EventsWithRawResponse: - def __init__(self, events: Events) -> None: - self._events = events - - self.list = to_raw_response_wrapper( - events.list, - ) - - -class AsyncEventsWithRawResponse: - def __init__(self, events: AsyncEvents) -> None: - self._events = events - - self.list = async_to_raw_response_wrapper( - events.list, - ) - - -class EventsWithStreamingResponse: - def __init__(self, events: Events) -> None: - self._events = events - - self.list = to_streamed_response_wrapper( - events.list, - ) - - -class AsyncEventsWithStreamingResponse: - def __init__(self, events: AsyncEvents) -> None: - self._events = events - - self.list = async_to_streamed_response_wrapper( - events.list, - ) diff --git a/src/cloudflare/resources/user/load_balancers/load_balancers.py b/src/cloudflare/resources/user/load_balancers/load_balancers.py deleted file mode 100644 index b6c59991c8a..00000000000 --- a/src/cloudflare/resources/user/load_balancers/load_balancers.py +++ /dev/null @@ -1,177 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .pools import ( - Pools, - AsyncPools, - PoolsWithRawResponse, - AsyncPoolsWithRawResponse, - PoolsWithStreamingResponse, - AsyncPoolsWithStreamingResponse, -) -from .preview import ( - Preview, - AsyncPreview, - PreviewWithRawResponse, - AsyncPreviewWithRawResponse, - PreviewWithStreamingResponse, - AsyncPreviewWithStreamingResponse, -) -from .monitors import ( - Monitors, - AsyncMonitors, - MonitorsWithRawResponse, - AsyncMonitorsWithRawResponse, - MonitorsWithStreamingResponse, - AsyncMonitorsWithStreamingResponse, -) -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .analytics.analytics import Analytics, AsyncAnalytics - -__all__ = ["LoadBalancers", "AsyncLoadBalancers"] - - -class LoadBalancers(SyncAPIResource): - @cached_property - def monitors(self) -> Monitors: - return Monitors(self._client) - - @cached_property - def pools(self) -> Pools: - return Pools(self._client) - - @cached_property - def preview(self) -> Preview: - return Preview(self._client) - - @cached_property - def analytics(self) -> Analytics: - return Analytics(self._client) - - @cached_property - def with_raw_response(self) -> LoadBalancersWithRawResponse: - return LoadBalancersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> LoadBalancersWithStreamingResponse: - return LoadBalancersWithStreamingResponse(self) - - -class AsyncLoadBalancers(AsyncAPIResource): - @cached_property - def monitors(self) -> AsyncMonitors: - return AsyncMonitors(self._client) - - @cached_property - def pools(self) -> AsyncPools: - return AsyncPools(self._client) - - @cached_property - def preview(self) -> AsyncPreview: - return AsyncPreview(self._client) - - @cached_property - def analytics(self) -> AsyncAnalytics: - return AsyncAnalytics(self._client) - - @cached_property - def with_raw_response(self) -> AsyncLoadBalancersWithRawResponse: - return AsyncLoadBalancersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncLoadBalancersWithStreamingResponse: - return AsyncLoadBalancersWithStreamingResponse(self) - - -class LoadBalancersWithRawResponse: - def __init__(self, load_balancers: LoadBalancers) -> None: - self._load_balancers = load_balancers - - @cached_property - def monitors(self) -> MonitorsWithRawResponse: - return MonitorsWithRawResponse(self._load_balancers.monitors) - - @cached_property - def pools(self) -> PoolsWithRawResponse: - return PoolsWithRawResponse(self._load_balancers.pools) - - @cached_property - def preview(self) -> PreviewWithRawResponse: - return PreviewWithRawResponse(self._load_balancers.preview) - - @cached_property - def analytics(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self._load_balancers.analytics) - - -class AsyncLoadBalancersWithRawResponse: - def __init__(self, load_balancers: AsyncLoadBalancers) -> None: - self._load_balancers = load_balancers - - @cached_property - def monitors(self) -> AsyncMonitorsWithRawResponse: - return AsyncMonitorsWithRawResponse(self._load_balancers.monitors) - - @cached_property - def pools(self) -> AsyncPoolsWithRawResponse: - return AsyncPoolsWithRawResponse(self._load_balancers.pools) - - @cached_property - def preview(self) -> AsyncPreviewWithRawResponse: - return AsyncPreviewWithRawResponse(self._load_balancers.preview) - - @cached_property - def analytics(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self._load_balancers.analytics) - - -class LoadBalancersWithStreamingResponse: - def __init__(self, load_balancers: LoadBalancers) -> None: - self._load_balancers = load_balancers - - @cached_property - def monitors(self) -> MonitorsWithStreamingResponse: - return MonitorsWithStreamingResponse(self._load_balancers.monitors) - - @cached_property - def pools(self) -> PoolsWithStreamingResponse: - return PoolsWithStreamingResponse(self._load_balancers.pools) - - @cached_property - def preview(self) -> PreviewWithStreamingResponse: - return PreviewWithStreamingResponse(self._load_balancers.preview) - - @cached_property - def analytics(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self._load_balancers.analytics) - - -class AsyncLoadBalancersWithStreamingResponse: - def __init__(self, load_balancers: AsyncLoadBalancers) -> None: - self._load_balancers = load_balancers - - @cached_property - def monitors(self) -> AsyncMonitorsWithStreamingResponse: - return AsyncMonitorsWithStreamingResponse(self._load_balancers.monitors) - - @cached_property - def pools(self) -> AsyncPoolsWithStreamingResponse: - return AsyncPoolsWithStreamingResponse(self._load_balancers.pools) - - @cached_property - def preview(self) -> AsyncPreviewWithStreamingResponse: - return AsyncPreviewWithStreamingResponse(self._load_balancers.preview) - - @cached_property - def analytics(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self._load_balancers.analytics) diff --git a/src/cloudflare/resources/user/load_balancers/monitors.py b/src/cloudflare/resources/user/load_balancers/monitors.py deleted file mode 100644 index 6fbbc6c5283..00000000000 --- a/src/cloudflare/resources/user/load_balancers/monitors.py +++ /dev/null @@ -1,1424 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - 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.user.load_balancers import ( - LoadBalancingMonitor, - MonitorDeleteResponse, - MonitorPreviewResponse, - MonitorReferencesResponse, - monitor_edit_params, - monitor_create_params, - monitor_update_params, - monitor_preview_params, -) - -__all__ = ["Monitors", "AsyncMonitors"] - - -class Monitors(SyncAPIResource): - @cached_property - def with_raw_response(self) -> MonitorsWithRawResponse: - return MonitorsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MonitorsWithStreamingResponse: - return MonitorsWithStreamingResponse(self) - - def create( - self, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> LoadBalancingMonitor: - """ - Create a configured monitor. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 - """ - return self._post( - "/user/load_balancers/monitors", - body=maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - monitor_create_params.MonitorCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), - ) - - def update( - self, - monitor_id: str, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> LoadBalancingMonitor: - """ - Modify a configured monitor. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return self._put( - f"/user/load_balancers/monitors/{monitor_id}", - body=maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - monitor_update_params.MonitorUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), - ) - - def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[LoadBalancingMonitor]: - """List configured monitors for a user.""" - return self._get_api_list( - "/user/load_balancers/monitors", - page=SyncSinglePage[LoadBalancingMonitor], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=LoadBalancingMonitor, - ) - - def delete( - self, - monitor_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, - ) -> MonitorDeleteResponse: - """ - Delete a configured monitor. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return self._delete( - f"/user/load_balancers/monitors/{monitor_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[MonitorDeleteResponse], ResultWrapper[MonitorDeleteResponse]), - ) - - def edit( - self, - monitor_id: str, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> LoadBalancingMonitor: - """ - Apply changes to an existing monitor, overwriting the supplied properties. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return self._patch( - f"/user/load_balancers/monitors/{monitor_id}", - body=maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - monitor_edit_params.MonitorEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), - ) - - def get( - self, - monitor_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, - ) -> LoadBalancingMonitor: - """ - List a single configured monitor for a user. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return self._get( - f"/user/load_balancers/monitors/{monitor_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), - ) - - def preview( - self, - monitor_id: str, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> MonitorPreviewResponse: - """Preview pools using the specified monitor with provided monitor details. - - The - returned preview_id can be used in the preview endpoint to retrieve the results. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return self._post( - f"/user/load_balancers/monitors/{monitor_id}/preview", - body=maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - monitor_preview_params.MonitorPreviewParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[MonitorPreviewResponse], ResultWrapper[MonitorPreviewResponse]), - ) - - def references( - self, - monitor_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[MonitorReferencesResponse]: - """ - Get the list of resources that reference the provided monitor. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return self._get( - f"/user/load_balancers/monitors/{monitor_id}/references", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[MonitorReferencesResponse]], ResultWrapper[MonitorReferencesResponse]), - ) - - -class AsyncMonitors(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncMonitorsWithRawResponse: - return AsyncMonitorsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMonitorsWithStreamingResponse: - return AsyncMonitorsWithStreamingResponse(self) - - async def create( - self, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> LoadBalancingMonitor: - """ - Create a configured monitor. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 - """ - return await self._post( - "/user/load_balancers/monitors", - body=await async_maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - monitor_create_params.MonitorCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), - ) - - async def update( - self, - monitor_id: str, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> LoadBalancingMonitor: - """ - Modify a configured monitor. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return await self._put( - f"/user/load_balancers/monitors/{monitor_id}", - body=await async_maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - monitor_update_params.MonitorUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), - ) - - def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[LoadBalancingMonitor, AsyncSinglePage[LoadBalancingMonitor]]: - """List configured monitors for a user.""" - return self._get_api_list( - "/user/load_balancers/monitors", - page=AsyncSinglePage[LoadBalancingMonitor], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=LoadBalancingMonitor, - ) - - async def delete( - self, - monitor_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, - ) -> MonitorDeleteResponse: - """ - Delete a configured monitor. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return await self._delete( - f"/user/load_balancers/monitors/{monitor_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[MonitorDeleteResponse], ResultWrapper[MonitorDeleteResponse]), - ) - - async def edit( - self, - monitor_id: str, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> LoadBalancingMonitor: - """ - Apply changes to an existing monitor, overwriting the supplied properties. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return await self._patch( - f"/user/load_balancers/monitors/{monitor_id}", - body=await async_maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - monitor_edit_params.MonitorEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), - ) - - async def get( - self, - monitor_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, - ) -> LoadBalancingMonitor: - """ - List a single configured monitor for a user. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return await self._get( - f"/user/load_balancers/monitors/{monitor_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), - ) - - async def preview( - self, - monitor_id: str, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> MonitorPreviewResponse: - """Preview pools using the specified monitor with provided monitor details. - - The - returned preview_id can be used in the preview endpoint to retrieve the results. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return await self._post( - f"/user/load_balancers/monitors/{monitor_id}/preview", - body=await async_maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - monitor_preview_params.MonitorPreviewParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[MonitorPreviewResponse], ResultWrapper[MonitorPreviewResponse]), - ) - - async def references( - self, - monitor_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[MonitorReferencesResponse]: - """ - Get the list of resources that reference the provided monitor. - - 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 monitor_id: - raise ValueError(f"Expected a non-empty value for `monitor_id` but received {monitor_id!r}") - return await self._get( - f"/user/load_balancers/monitors/{monitor_id}/references", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[MonitorReferencesResponse]], ResultWrapper[MonitorReferencesResponse]), - ) - - -class MonitorsWithRawResponse: - def __init__(self, monitors: Monitors) -> None: - self._monitors = monitors - - self.create = to_raw_response_wrapper( - monitors.create, - ) - self.update = to_raw_response_wrapper( - monitors.update, - ) - self.list = to_raw_response_wrapper( - monitors.list, - ) - self.delete = to_raw_response_wrapper( - monitors.delete, - ) - self.edit = to_raw_response_wrapper( - monitors.edit, - ) - self.get = to_raw_response_wrapper( - monitors.get, - ) - self.preview = to_raw_response_wrapper( - monitors.preview, - ) - self.references = to_raw_response_wrapper( - monitors.references, - ) - - -class AsyncMonitorsWithRawResponse: - def __init__(self, monitors: AsyncMonitors) -> None: - self._monitors = monitors - - self.create = async_to_raw_response_wrapper( - monitors.create, - ) - self.update = async_to_raw_response_wrapper( - monitors.update, - ) - self.list = async_to_raw_response_wrapper( - monitors.list, - ) - self.delete = async_to_raw_response_wrapper( - monitors.delete, - ) - self.edit = async_to_raw_response_wrapper( - monitors.edit, - ) - self.get = async_to_raw_response_wrapper( - monitors.get, - ) - self.preview = async_to_raw_response_wrapper( - monitors.preview, - ) - self.references = async_to_raw_response_wrapper( - monitors.references, - ) - - -class MonitorsWithStreamingResponse: - def __init__(self, monitors: Monitors) -> None: - self._monitors = monitors - - self.create = to_streamed_response_wrapper( - monitors.create, - ) - self.update = to_streamed_response_wrapper( - monitors.update, - ) - self.list = to_streamed_response_wrapper( - monitors.list, - ) - self.delete = to_streamed_response_wrapper( - monitors.delete, - ) - self.edit = to_streamed_response_wrapper( - monitors.edit, - ) - self.get = to_streamed_response_wrapper( - monitors.get, - ) - self.preview = to_streamed_response_wrapper( - monitors.preview, - ) - self.references = to_streamed_response_wrapper( - monitors.references, - ) - - -class AsyncMonitorsWithStreamingResponse: - def __init__(self, monitors: AsyncMonitors) -> None: - self._monitors = monitors - - self.create = async_to_streamed_response_wrapper( - monitors.create, - ) - self.update = async_to_streamed_response_wrapper( - monitors.update, - ) - self.list = async_to_streamed_response_wrapper( - monitors.list, - ) - self.delete = async_to_streamed_response_wrapper( - monitors.delete, - ) - self.edit = async_to_streamed_response_wrapper( - monitors.edit, - ) - self.get = async_to_streamed_response_wrapper( - monitors.get, - ) - self.preview = async_to_streamed_response_wrapper( - monitors.preview, - ) - self.references = async_to_streamed_response_wrapper( - monitors.references, - ) diff --git a/src/cloudflare/resources/user/load_balancers/pools.py b/src/cloudflare/resources/user/load_balancers/pools.py deleted file mode 100644 index 26b35dcb7d7..00000000000 --- a/src/cloudflare/resources/user/load_balancers/pools.py +++ /dev/null @@ -1,1606 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, List, Type, Iterable, Optional, cast -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) -from ....types.user.load_balancers import ( - LoadBalancingPool, - PoolDeleteResponse, - PoolHealthResponse, - PoolPreviewResponse, - PoolReferencesResponse, - pool_edit_params, - pool_list_params, - pool_create_params, - pool_update_params, - pool_preview_params, -) - -__all__ = ["Pools", "AsyncPools"] - - -class Pools(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PoolsWithRawResponse: - return PoolsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PoolsWithStreamingResponse: - return PoolsWithStreamingResponse(self) - - def create( - self, - *, - name: str, - origins: Iterable[pool_create_params.Origin], - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_create_params.LoadShedding | NotGiven = NOT_GIVEN, - longitude: float | NotGiven = NOT_GIVEN, - minimum_origins: int | NotGiven = NOT_GIVEN, - monitor: object | NotGiven = NOT_GIVEN, - notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_create_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_create_params.OriginSteering | 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, - ) -> LoadBalancingPool: - """Create a new pool. - - Args: - name: A short name (tag) for the pool. - - Only alphanumeric characters, hyphens, and - underscores are allowed. - - origins: The list of origins within this pool. Traffic directed at this pool is balanced - across all currently healthy origins, provided the pool itself is healthy. - - check_regions: A list of regions from which to run health checks. Null means every Cloudflare - data center. - - description: A human-readable description of the pool. - - enabled: Whether to enable (the default) or disable this pool. Disabled pools will not - receive traffic and are excluded from health checks. Disabling a pool will cause - any load balancers using it to failover to the next pool (if any). - - latitude: The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - - load_shedding: Configures load shedding policies and percentages for the pool. - - longitude: The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - - minimum_origins: The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - - monitor: The ID of the Monitor to use for checking the health of origins within this - pool. - - notification_email: This field is now deprecated. It has been moved to Cloudflare's Centralized - Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - - notification_filter: Filter pool and origin health notifications by resource type or health status. - Use null to reset. - - origin_steering: Configures origin steering for the pool. Controls how origins are selected for - new sessions and traffic without session affinity. - - 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 - """ - return self._post( - "/user/load_balancers/pools", - body=maybe_transform( - { - "name": name, - "origins": origins, - "check_regions": check_regions, - "description": description, - "enabled": enabled, - "latitude": latitude, - "load_shedding": load_shedding, - "longitude": longitude, - "minimum_origins": minimum_origins, - "monitor": monitor, - "notification_email": notification_email, - "notification_filter": notification_filter, - "origin_steering": origin_steering, - }, - pool_create_params.PoolCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), - ) - - def update( - self, - pool_id: str, - *, - name: str, - origins: Iterable[pool_update_params.Origin], - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_update_params.LoadShedding | NotGiven = NOT_GIVEN, - longitude: float | NotGiven = NOT_GIVEN, - minimum_origins: int | NotGiven = NOT_GIVEN, - monitor: object | NotGiven = NOT_GIVEN, - notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_update_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_update_params.OriginSteering | 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, - ) -> LoadBalancingPool: - """Modify a configured pool. - - Args: - name: A short name (tag) for the pool. - - Only alphanumeric characters, hyphens, and - underscores are allowed. - - origins: The list of origins within this pool. Traffic directed at this pool is balanced - across all currently healthy origins, provided the pool itself is healthy. - - check_regions: A list of regions from which to run health checks. Null means every Cloudflare - data center. - - description: A human-readable description of the pool. - - enabled: Whether to enable (the default) or disable this pool. Disabled pools will not - receive traffic and are excluded from health checks. Disabling a pool will cause - any load balancers using it to failover to the next pool (if any). - - latitude: The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - - load_shedding: Configures load shedding policies and percentages for the pool. - - longitude: The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - - minimum_origins: The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - - monitor: The ID of the Monitor to use for checking the health of origins within this - pool. - - notification_email: This field is now deprecated. It has been moved to Cloudflare's Centralized - Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - - notification_filter: Filter pool and origin health notifications by resource type or health status. - Use null to reset. - - origin_steering: Configures origin steering for the pool. Controls how origins are selected for - new sessions and traffic without session affinity. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return self._put( - f"/user/load_balancers/pools/{pool_id}", - body=maybe_transform( - { - "name": name, - "origins": origins, - "check_regions": check_regions, - "description": description, - "enabled": enabled, - "latitude": latitude, - "load_shedding": load_shedding, - "longitude": longitude, - "minimum_origins": minimum_origins, - "monitor": monitor, - "notification_email": notification_email, - "notification_filter": notification_filter, - "origin_steering": origin_steering, - }, - pool_update_params.PoolUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), - ) - - def list( - self, - *, - monitor: object | 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[LoadBalancingPool]: - """ - List configured pools. - - Args: - monitor: The ID of the Monitor to use for checking the health of origins within this - pool. - - 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 - """ - return self._get_api_list( - "/user/load_balancers/pools", - page=SyncSinglePage[LoadBalancingPool], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), - ), - model=LoadBalancingPool, - ) - - def delete( - self, - pool_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, - ) -> PoolDeleteResponse: - """ - Delete a configured pool. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return self._delete( - f"/user/load_balancers/pools/{pool_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[PoolDeleteResponse], ResultWrapper[PoolDeleteResponse]), - ) - - def edit( - self, - pool_id: str, - *, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_edit_params.LoadShedding | NotGiven = NOT_GIVEN, - longitude: float | NotGiven = NOT_GIVEN, - minimum_origins: int | NotGiven = NOT_GIVEN, - monitor: object | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_edit_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_edit_params.OriginSteering | NotGiven = NOT_GIVEN, - origins: Iterable[pool_edit_params.Origin] | 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, - ) -> LoadBalancingPool: - """ - Apply changes to an existing pool, overwriting the supplied properties. - - Args: - check_regions: A list of regions from which to run health checks. Null means every Cloudflare - data center. - - description: A human-readable description of the pool. - - enabled: Whether to enable (the default) or disable this pool. Disabled pools will not - receive traffic and are excluded from health checks. Disabling a pool will cause - any load balancers using it to failover to the next pool (if any). - - latitude: The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - - load_shedding: Configures load shedding policies and percentages for the pool. - - longitude: The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - - minimum_origins: The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - - monitor: The ID of the Monitor to use for checking the health of origins within this - pool. - - name: A short name (tag) for the pool. Only alphanumeric characters, hyphens, and - underscores are allowed. - - notification_email: This field is now deprecated. It has been moved to Cloudflare's Centralized - Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - - notification_filter: Filter pool and origin health notifications by resource type or health status. - Use null to reset. - - origin_steering: Configures origin steering for the pool. Controls how origins are selected for - new sessions and traffic without session affinity. - - origins: The list of origins within this pool. Traffic directed at this pool is balanced - across all currently healthy origins, provided the pool itself is healthy. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return self._patch( - f"/user/load_balancers/pools/{pool_id}", - body=maybe_transform( - { - "check_regions": check_regions, - "description": description, - "enabled": enabled, - "latitude": latitude, - "load_shedding": load_shedding, - "longitude": longitude, - "minimum_origins": minimum_origins, - "monitor": monitor, - "name": name, - "notification_email": notification_email, - "notification_filter": notification_filter, - "origin_steering": origin_steering, - "origins": origins, - }, - pool_edit_params.PoolEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), - ) - - def get( - self, - pool_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, - ) -> LoadBalancingPool: - """ - Fetch a single configured pool. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return self._get( - f"/user/load_balancers/pools/{pool_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), - ) - - def health( - self, - pool_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, - ) -> PoolHealthResponse: - """ - Fetch the latest pool health status for a single pool. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return cast( - PoolHealthResponse, - self._get( - f"/user/load_balancers/pools/{pool_id}/health", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PoolHealthResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def preview( - self, - pool_id: str, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> PoolPreviewResponse: - """Preview pool health using provided monitor details. - - The returned preview_id can - be used in the preview endpoint to retrieve the results. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return self._post( - f"/user/load_balancers/pools/{pool_id}/preview", - body=maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - pool_preview_params.PoolPreviewParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[PoolPreviewResponse], ResultWrapper[PoolPreviewResponse]), - ) - - def references( - self, - pool_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[PoolReferencesResponse]: - """ - Get the list of resources that reference the provided pool. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return self._get( - f"/user/load_balancers/pools/{pool_id}/references", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[PoolReferencesResponse]], ResultWrapper[PoolReferencesResponse]), - ) - - -class AsyncPools(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPoolsWithRawResponse: - return AsyncPoolsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPoolsWithStreamingResponse: - return AsyncPoolsWithStreamingResponse(self) - - async def create( - self, - *, - name: str, - origins: Iterable[pool_create_params.Origin], - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_create_params.LoadShedding | NotGiven = NOT_GIVEN, - longitude: float | NotGiven = NOT_GIVEN, - minimum_origins: int | NotGiven = NOT_GIVEN, - monitor: object | NotGiven = NOT_GIVEN, - notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_create_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_create_params.OriginSteering | 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, - ) -> LoadBalancingPool: - """Create a new pool. - - Args: - name: A short name (tag) for the pool. - - Only alphanumeric characters, hyphens, and - underscores are allowed. - - origins: The list of origins within this pool. Traffic directed at this pool is balanced - across all currently healthy origins, provided the pool itself is healthy. - - check_regions: A list of regions from which to run health checks. Null means every Cloudflare - data center. - - description: A human-readable description of the pool. - - enabled: Whether to enable (the default) or disable this pool. Disabled pools will not - receive traffic and are excluded from health checks. Disabling a pool will cause - any load balancers using it to failover to the next pool (if any). - - latitude: The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - - load_shedding: Configures load shedding policies and percentages for the pool. - - longitude: The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - - minimum_origins: The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - - monitor: The ID of the Monitor to use for checking the health of origins within this - pool. - - notification_email: This field is now deprecated. It has been moved to Cloudflare's Centralized - Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - - notification_filter: Filter pool and origin health notifications by resource type or health status. - Use null to reset. - - origin_steering: Configures origin steering for the pool. Controls how origins are selected for - new sessions and traffic without session affinity. - - 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 - """ - return await self._post( - "/user/load_balancers/pools", - body=await async_maybe_transform( - { - "name": name, - "origins": origins, - "check_regions": check_regions, - "description": description, - "enabled": enabled, - "latitude": latitude, - "load_shedding": load_shedding, - "longitude": longitude, - "minimum_origins": minimum_origins, - "monitor": monitor, - "notification_email": notification_email, - "notification_filter": notification_filter, - "origin_steering": origin_steering, - }, - pool_create_params.PoolCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), - ) - - async def update( - self, - pool_id: str, - *, - name: str, - origins: Iterable[pool_update_params.Origin], - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_update_params.LoadShedding | NotGiven = NOT_GIVEN, - longitude: float | NotGiven = NOT_GIVEN, - minimum_origins: int | NotGiven = NOT_GIVEN, - monitor: object | NotGiven = NOT_GIVEN, - notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_update_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_update_params.OriginSteering | 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, - ) -> LoadBalancingPool: - """Modify a configured pool. - - Args: - name: A short name (tag) for the pool. - - Only alphanumeric characters, hyphens, and - underscores are allowed. - - origins: The list of origins within this pool. Traffic directed at this pool is balanced - across all currently healthy origins, provided the pool itself is healthy. - - check_regions: A list of regions from which to run health checks. Null means every Cloudflare - data center. - - description: A human-readable description of the pool. - - enabled: Whether to enable (the default) or disable this pool. Disabled pools will not - receive traffic and are excluded from health checks. Disabling a pool will cause - any load balancers using it to failover to the next pool (if any). - - latitude: The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - - load_shedding: Configures load shedding policies and percentages for the pool. - - longitude: The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - - minimum_origins: The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - - monitor: The ID of the Monitor to use for checking the health of origins within this - pool. - - notification_email: This field is now deprecated. It has been moved to Cloudflare's Centralized - Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - - notification_filter: Filter pool and origin health notifications by resource type or health status. - Use null to reset. - - origin_steering: Configures origin steering for the pool. Controls how origins are selected for - new sessions and traffic without session affinity. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return await self._put( - f"/user/load_balancers/pools/{pool_id}", - body=await async_maybe_transform( - { - "name": name, - "origins": origins, - "check_regions": check_regions, - "description": description, - "enabled": enabled, - "latitude": latitude, - "load_shedding": load_shedding, - "longitude": longitude, - "minimum_origins": minimum_origins, - "monitor": monitor, - "notification_email": notification_email, - "notification_filter": notification_filter, - "origin_steering": origin_steering, - }, - pool_update_params.PoolUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), - ) - - def list( - self, - *, - monitor: object | 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[LoadBalancingPool, AsyncSinglePage[LoadBalancingPool]]: - """ - List configured pools. - - Args: - monitor: The ID of the Monitor to use for checking the health of origins within this - pool. - - 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 - """ - return self._get_api_list( - "/user/load_balancers/pools", - page=AsyncSinglePage[LoadBalancingPool], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), - ), - model=LoadBalancingPool, - ) - - async def delete( - self, - pool_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, - ) -> PoolDeleteResponse: - """ - Delete a configured pool. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return await self._delete( - f"/user/load_balancers/pools/{pool_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[PoolDeleteResponse], ResultWrapper[PoolDeleteResponse]), - ) - - async def edit( - self, - pool_id: str, - *, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - latitude: float | NotGiven = NOT_GIVEN, - load_shedding: pool_edit_params.LoadShedding | NotGiven = NOT_GIVEN, - longitude: float | NotGiven = NOT_GIVEN, - minimum_origins: int | NotGiven = NOT_GIVEN, - monitor: object | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - notification_email: str | NotGiven = NOT_GIVEN, - notification_filter: Optional[pool_edit_params.NotificationFilter] | NotGiven = NOT_GIVEN, - origin_steering: pool_edit_params.OriginSteering | NotGiven = NOT_GIVEN, - origins: Iterable[pool_edit_params.Origin] | 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, - ) -> LoadBalancingPool: - """ - Apply changes to an existing pool, overwriting the supplied properties. - - Args: - check_regions: A list of regions from which to run health checks. Null means every Cloudflare - data center. - - description: A human-readable description of the pool. - - enabled: Whether to enable (the default) or disable this pool. Disabled pools will not - receive traffic and are excluded from health checks. Disabling a pool will cause - any load balancers using it to failover to the next pool (if any). - - latitude: The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - - load_shedding: Configures load shedding policies and percentages for the pool. - - longitude: The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - - minimum_origins: The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - - monitor: The ID of the Monitor to use for checking the health of origins within this - pool. - - name: A short name (tag) for the pool. Only alphanumeric characters, hyphens, and - underscores are allowed. - - notification_email: This field is now deprecated. It has been moved to Cloudflare's Centralized - Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - - notification_filter: Filter pool and origin health notifications by resource type or health status. - Use null to reset. - - origin_steering: Configures origin steering for the pool. Controls how origins are selected for - new sessions and traffic without session affinity. - - origins: The list of origins within this pool. Traffic directed at this pool is balanced - across all currently healthy origins, provided the pool itself is healthy. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return await self._patch( - f"/user/load_balancers/pools/{pool_id}", - body=await async_maybe_transform( - { - "check_regions": check_regions, - "description": description, - "enabled": enabled, - "latitude": latitude, - "load_shedding": load_shedding, - "longitude": longitude, - "minimum_origins": minimum_origins, - "monitor": monitor, - "name": name, - "notification_email": notification_email, - "notification_filter": notification_filter, - "origin_steering": origin_steering, - "origins": origins, - }, - pool_edit_params.PoolEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), - ) - - async def get( - self, - pool_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, - ) -> LoadBalancingPool: - """ - Fetch a single configured pool. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return await self._get( - f"/user/load_balancers/pools/{pool_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), - ) - - async def health( - self, - pool_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, - ) -> PoolHealthResponse: - """ - Fetch the latest pool health status for a single pool. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return cast( - PoolHealthResponse, - await self._get( - f"/user/load_balancers/pools/{pool_id}/health", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PoolHealthResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def preview( - self, - pool_id: str, - *, - expected_codes: str, - allow_insecure: bool | NotGiven = NOT_GIVEN, - consecutive_down: int | NotGiven = NOT_GIVEN, - consecutive_up: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - expected_body: str | NotGiven = NOT_GIVEN, - follow_redirects: bool | NotGiven = NOT_GIVEN, - header: object | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - method: str | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - port: int | NotGiven = NOT_GIVEN, - probe_zone: str | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - load_balancer_monitor_timeout: int | NotGiven = NOT_GIVEN, - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] | 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, - ) -> PoolPreviewResponse: - """Preview pool health using provided monitor details. - - The returned preview_id can - be used in the preview endpoint to retrieve the results. - - Args: - expected_codes: The expected HTTP response code or code range of the health check. This - parameter is only valid for HTTP and HTTPS monitors. - - allow_insecure: Do not validate the certificate when monitor use HTTPS. This parameter is - currently only valid for HTTP and HTTPS monitors. - - consecutive_down: To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - - consecutive_up: To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - - description: Object description. - - expected_body: A case-insensitive sub-string to look for in the response body. If this string - is not found, the origin will be marked as unhealthy. This parameter is only - valid for HTTP and HTTPS monitors. - - follow_redirects: Follow redirects if returned by the origin. This parameter is only valid for - HTTP and HTTPS monitors. - - header: The HTTP request headers to send in the health check. It is recommended you set - a Host header by default. The User-Agent header cannot be overridden. This - parameter is only valid for HTTP and HTTPS monitors. - - interval: The interval between each health check. Shorter intervals may improve failover - time, but will increase load on the origins as we check from multiple locations. - - method: The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS - based checks and 'connection_established' for TCP based health checks. - - path: The endpoint path you want to conduct a health check against. This parameter is - only valid for HTTP and HTTPS monitors. - - port: The port number to connect to for the health check. Required for TCP, UDP, and - SMTP checks. HTTP and HTTPS checks should only define the port when using a - non-standard port (HTTP: default 80, HTTPS: default 443). - - probe_zone: Assign this monitor to emulate the specified zone while probing. This parameter - is only valid for HTTP and HTTPS monitors. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - load_balancer_monitor_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return await self._post( - f"/user/load_balancers/pools/{pool_id}/preview", - body=await async_maybe_transform( - { - "expected_codes": expected_codes, - "allow_insecure": allow_insecure, - "consecutive_down": consecutive_down, - "consecutive_up": consecutive_up, - "description": description, - "expected_body": expected_body, - "follow_redirects": follow_redirects, - "header": header, - "interval": interval, - "method": method, - "path": path, - "port": port, - "probe_zone": probe_zone, - "retries": retries, - "timeout": load_balancer_monitor_timeout, - "type": type, - }, - pool_preview_params.PoolPreviewParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[PoolPreviewResponse], ResultWrapper[PoolPreviewResponse]), - ) - - async def references( - self, - pool_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[PoolReferencesResponse]: - """ - Get the list of resources that reference the provided pool. - - 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 pool_id: - raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") - return await self._get( - f"/user/load_balancers/pools/{pool_id}/references", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[PoolReferencesResponse]], ResultWrapper[PoolReferencesResponse]), - ) - - -class PoolsWithRawResponse: - def __init__(self, pools: Pools) -> None: - self._pools = pools - - self.create = to_raw_response_wrapper( - pools.create, - ) - self.update = to_raw_response_wrapper( - pools.update, - ) - self.list = to_raw_response_wrapper( - pools.list, - ) - self.delete = to_raw_response_wrapper( - pools.delete, - ) - self.edit = to_raw_response_wrapper( - pools.edit, - ) - self.get = to_raw_response_wrapper( - pools.get, - ) - self.health = to_raw_response_wrapper( - pools.health, - ) - self.preview = to_raw_response_wrapper( - pools.preview, - ) - self.references = to_raw_response_wrapper( - pools.references, - ) - - -class AsyncPoolsWithRawResponse: - def __init__(self, pools: AsyncPools) -> None: - self._pools = pools - - self.create = async_to_raw_response_wrapper( - pools.create, - ) - self.update = async_to_raw_response_wrapper( - pools.update, - ) - self.list = async_to_raw_response_wrapper( - pools.list, - ) - self.delete = async_to_raw_response_wrapper( - pools.delete, - ) - self.edit = async_to_raw_response_wrapper( - pools.edit, - ) - self.get = async_to_raw_response_wrapper( - pools.get, - ) - self.health = async_to_raw_response_wrapper( - pools.health, - ) - self.preview = async_to_raw_response_wrapper( - pools.preview, - ) - self.references = async_to_raw_response_wrapper( - pools.references, - ) - - -class PoolsWithStreamingResponse: - def __init__(self, pools: Pools) -> None: - self._pools = pools - - self.create = to_streamed_response_wrapper( - pools.create, - ) - self.update = to_streamed_response_wrapper( - pools.update, - ) - self.list = to_streamed_response_wrapper( - pools.list, - ) - self.delete = to_streamed_response_wrapper( - pools.delete, - ) - self.edit = to_streamed_response_wrapper( - pools.edit, - ) - self.get = to_streamed_response_wrapper( - pools.get, - ) - self.health = to_streamed_response_wrapper( - pools.health, - ) - self.preview = to_streamed_response_wrapper( - pools.preview, - ) - self.references = to_streamed_response_wrapper( - pools.references, - ) - - -class AsyncPoolsWithStreamingResponse: - def __init__(self, pools: AsyncPools) -> None: - self._pools = pools - - self.create = async_to_streamed_response_wrapper( - pools.create, - ) - self.update = async_to_streamed_response_wrapper( - pools.update, - ) - self.list = async_to_streamed_response_wrapper( - pools.list, - ) - self.delete = async_to_streamed_response_wrapper( - pools.delete, - ) - self.edit = async_to_streamed_response_wrapper( - pools.edit, - ) - self.get = async_to_streamed_response_wrapper( - pools.get, - ) - self.health = async_to_streamed_response_wrapper( - pools.health, - ) - self.preview = async_to_streamed_response_wrapper( - pools.preview, - ) - self.references = async_to_streamed_response_wrapper( - pools.references, - ) diff --git a/src/cloudflare/resources/user/load_balancers/preview.py b/src/cloudflare/resources/user/load_balancers/preview.py deleted file mode 100644 index ded8823d74b..00000000000 --- a/src/cloudflare/resources/user/load_balancers/preview.py +++ /dev/null @@ -1,154 +0,0 @@ -# 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 ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.user.load_balancers import LoadBalancingPreview - -__all__ = ["Preview", "AsyncPreview"] - - -class Preview(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PreviewWithRawResponse: - return PreviewWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PreviewWithStreamingResponse: - return PreviewWithStreamingResponse(self) - - def get( - self, - preview_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, - ) -> LoadBalancingPreview: - """ - Get the result of a previous preview operation using the provided preview_id. - - 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 preview_id: - raise ValueError(f"Expected a non-empty value for `preview_id` but received {preview_id!r}") - return self._get( - f"/user/load_balancers/preview/{preview_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPreview], ResultWrapper[LoadBalancingPreview]), - ) - - -class AsyncPreview(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPreviewWithRawResponse: - return AsyncPreviewWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPreviewWithStreamingResponse: - return AsyncPreviewWithStreamingResponse(self) - - async def get( - self, - preview_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, - ) -> LoadBalancingPreview: - """ - Get the result of a previous preview operation using the provided preview_id. - - 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 preview_id: - raise ValueError(f"Expected a non-empty value for `preview_id` but received {preview_id!r}") - return await self._get( - f"/user/load_balancers/preview/{preview_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[LoadBalancingPreview], ResultWrapper[LoadBalancingPreview]), - ) - - -class PreviewWithRawResponse: - def __init__(self, preview: Preview) -> None: - self._preview = preview - - self.get = to_raw_response_wrapper( - preview.get, - ) - - -class AsyncPreviewWithRawResponse: - def __init__(self, preview: AsyncPreview) -> None: - self._preview = preview - - self.get = async_to_raw_response_wrapper( - preview.get, - ) - - -class PreviewWithStreamingResponse: - def __init__(self, preview: Preview) -> None: - self._preview = preview - - self.get = to_streamed_response_wrapper( - preview.get, - ) - - -class AsyncPreviewWithStreamingResponse: - def __init__(self, preview: AsyncPreview) -> None: - self._preview = preview - - self.get = async_to_streamed_response_wrapper( - preview.get, - ) diff --git a/src/cloudflare/resources/user/organizations.py b/src/cloudflare/resources/user/organizations.py index 1e3d17f1184..cf0010f5fd1 100644 --- a/src/cloudflare/resources/user/organizations.py +++ b/src/cloudflare/resources/user/organizations.py @@ -8,7 +8,10 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import maybe_transform +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -19,23 +22,26 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from ...types.user import Organization, OrganizationGetResponse, OrganizationDeleteResponse, organization_list_params +from ...types.user import organization_list_params, organization_delete_params from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.user.organization import Organization +from ...types.user.organization_get_response import OrganizationGetResponse +from ...types.user.organization_delete_response import OrganizationDeleteResponse -__all__ = ["Organizations", "AsyncOrganizations"] +__all__ = ["OrganizationsResource", "AsyncOrganizationsResource"] -class Organizations(SyncAPIResource): +class OrganizationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OrganizationsWithRawResponse: - return OrganizationsWithRawResponse(self) + def with_raw_response(self) -> OrganizationsResourceWithRawResponse: + return OrganizationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OrganizationsWithStreamingResponse: - return OrganizationsWithStreamingResponse(self) + def with_streaming_response(self) -> OrganizationsResourceWithStreamingResponse: + return OrganizationsResourceWithStreamingResponse(self) def list( self, @@ -108,6 +114,7 @@ def delete( self, organization_id: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -133,6 +140,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}") return self._delete( f"/user/organizations/{organization_id}", + body=maybe_transform(body, organization_delete_params.OrganizationDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -175,7 +183,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OrganizationGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OrganizationGetResponse] @@ -184,14 +192,14 @@ def get( ) -class AsyncOrganizations(AsyncAPIResource): +class AsyncOrganizationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOrganizationsWithRawResponse: - return AsyncOrganizationsWithRawResponse(self) + def with_raw_response(self) -> AsyncOrganizationsResourceWithRawResponse: + return AsyncOrganizationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOrganizationsWithStreamingResponse: - return AsyncOrganizationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOrganizationsResourceWithStreamingResponse: + return AsyncOrganizationsResourceWithStreamingResponse(self) def list( self, @@ -264,6 +272,7 @@ async def delete( self, organization_id: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -289,6 +298,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}") return await self._delete( f"/user/organizations/{organization_id}", + body=await async_maybe_transform(body, organization_delete_params.OrganizationDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -331,7 +341,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OrganizationGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[OrganizationGetResponse] @@ -340,8 +350,8 @@ async def get( ) -class OrganizationsWithRawResponse: - def __init__(self, organizations: Organizations) -> None: +class OrganizationsResourceWithRawResponse: + def __init__(self, organizations: OrganizationsResource) -> None: self._organizations = organizations self.list = to_raw_response_wrapper( @@ -355,8 +365,8 @@ def __init__(self, organizations: Organizations) -> None: ) -class AsyncOrganizationsWithRawResponse: - def __init__(self, organizations: AsyncOrganizations) -> None: +class AsyncOrganizationsResourceWithRawResponse: + def __init__(self, organizations: AsyncOrganizationsResource) -> None: self._organizations = organizations self.list = async_to_raw_response_wrapper( @@ -370,8 +380,8 @@ def __init__(self, organizations: AsyncOrganizations) -> None: ) -class OrganizationsWithStreamingResponse: - def __init__(self, organizations: Organizations) -> None: +class OrganizationsResourceWithStreamingResponse: + def __init__(self, organizations: OrganizationsResource) -> None: self._organizations = organizations self.list = to_streamed_response_wrapper( @@ -385,8 +395,8 @@ def __init__(self, organizations: Organizations) -> None: ) -class AsyncOrganizationsWithStreamingResponse: - def __init__(self, organizations: AsyncOrganizations) -> None: +class AsyncOrganizationsResourceWithStreamingResponse: + def __init__(self, organizations: AsyncOrganizationsResource) -> None: self._organizations = organizations self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/user/subscriptions.py b/src/cloudflare/resources/user/subscriptions.py index 2738091e1bc..f91857d27e1 100644 --- a/src/cloudflare/resources/user/subscriptions.py +++ b/src/cloudflare/resources/user/subscriptions.py @@ -22,38 +22,42 @@ ) from ..._wrappers import ResultWrapper from ...types.user import ( - SubscriptionGetResponse, - SubscriptionEditResponse, - SubscriptionDeleteResponse, - SubscriptionUpdateResponse, subscription_edit_params, + subscription_delete_params, subscription_update_params, ) from ..._base_client import ( make_request_options, ) +from ...types.user.rate_plan_param import RatePlanParam +from ...types.user.subscription_zone_param import SubscriptionZoneParam +from ...types.user.subscription_get_response import SubscriptionGetResponse +from ...types.user.subscription_edit_response import SubscriptionEditResponse +from ...types.user.subscription_component_param import SubscriptionComponentParam +from ...types.user.subscription_delete_response import SubscriptionDeleteResponse +from ...types.user.subscription_update_response import SubscriptionUpdateResponse -__all__ = ["Subscriptions", "AsyncSubscriptions"] +__all__ = ["SubscriptionsResource", "AsyncSubscriptionsResource"] -class Subscriptions(SyncAPIResource): +class SubscriptionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SubscriptionsWithRawResponse: - return SubscriptionsWithRawResponse(self) + def with_raw_response(self) -> SubscriptionsResourceWithRawResponse: + return SubscriptionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SubscriptionsWithStreamingResponse: - return SubscriptionsWithStreamingResponse(self) + def with_streaming_response(self) -> SubscriptionsResourceWithStreamingResponse: + return SubscriptionsResourceWithStreamingResponse(self) def update( self, identifier: str, *, app: subscription_update_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -104,7 +108,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionUpdateResponse] @@ -116,6 +120,7 @@ def delete( self, identifier: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -141,6 +146,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._delete( f"/user/subscriptions/{identifier}", + body=maybe_transform(body, subscription_delete_params.SubscriptionDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -152,10 +158,10 @@ def edit( identifier: str, *, app: subscription_edit_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_edit_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_edit_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_edit_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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 +212,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionEditResponse] @@ -232,30 +238,30 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SubscriptionGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SubscriptionGetResponse]], ResultWrapper[SubscriptionGetResponse]), ) -class AsyncSubscriptions(AsyncAPIResource): +class AsyncSubscriptionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSubscriptionsWithRawResponse: - return AsyncSubscriptionsWithRawResponse(self) + def with_raw_response(self) -> AsyncSubscriptionsResourceWithRawResponse: + return AsyncSubscriptionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSubscriptionsWithStreamingResponse: - return AsyncSubscriptionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSubscriptionsResourceWithStreamingResponse: + return AsyncSubscriptionsResourceWithStreamingResponse(self) async def update( self, identifier: str, *, app: subscription_update_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -306,7 +312,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionUpdateResponse] @@ -318,6 +324,7 @@ async def delete( self, identifier: str, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -343,6 +350,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return await self._delete( f"/user/subscriptions/{identifier}", + body=await async_maybe_transform(body, subscription_delete_params.SubscriptionDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -354,10 +362,10 @@ async def edit( identifier: str, *, app: subscription_edit_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_edit_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_edit_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_edit_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -408,7 +416,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionEditResponse] @@ -434,14 +442,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SubscriptionGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SubscriptionGetResponse]], ResultWrapper[SubscriptionGetResponse]), ) -class SubscriptionsWithRawResponse: - def __init__(self, subscriptions: Subscriptions) -> None: +class SubscriptionsResourceWithRawResponse: + def __init__(self, subscriptions: SubscriptionsResource) -> None: self._subscriptions = subscriptions self.update = to_raw_response_wrapper( @@ -458,8 +466,8 @@ def __init__(self, subscriptions: Subscriptions) -> None: ) -class AsyncSubscriptionsWithRawResponse: - def __init__(self, subscriptions: AsyncSubscriptions) -> None: +class AsyncSubscriptionsResourceWithRawResponse: + def __init__(self, subscriptions: AsyncSubscriptionsResource) -> None: self._subscriptions = subscriptions self.update = async_to_raw_response_wrapper( @@ -476,8 +484,8 @@ def __init__(self, subscriptions: AsyncSubscriptions) -> None: ) -class SubscriptionsWithStreamingResponse: - def __init__(self, subscriptions: Subscriptions) -> None: +class SubscriptionsResourceWithStreamingResponse: + def __init__(self, subscriptions: SubscriptionsResource) -> None: self._subscriptions = subscriptions self.update = to_streamed_response_wrapper( @@ -494,8 +502,8 @@ def __init__(self, subscriptions: Subscriptions) -> None: ) -class AsyncSubscriptionsWithStreamingResponse: - def __init__(self, subscriptions: AsyncSubscriptions) -> None: +class AsyncSubscriptionsResourceWithStreamingResponse: + def __init__(self, subscriptions: AsyncSubscriptionsResource) -> None: self._subscriptions = subscriptions self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/user/tokens/__init__.py b/src/cloudflare/resources/user/tokens/__init__.py index f6baeff682d..f42f0970969 100644 --- a/src/cloudflare/resources/user/tokens/__init__.py +++ b/src/cloudflare/resources/user/tokens/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .value import ( - Value, - AsyncValue, - ValueWithRawResponse, - AsyncValueWithRawResponse, - ValueWithStreamingResponse, - AsyncValueWithStreamingResponse, + ValueResource, + AsyncValueResource, + ValueResourceWithRawResponse, + AsyncValueResourceWithRawResponse, + ValueResourceWithStreamingResponse, + AsyncValueResourceWithStreamingResponse, ) from .tokens import ( - Tokens, - AsyncTokens, - TokensWithRawResponse, - AsyncTokensWithRawResponse, - TokensWithStreamingResponse, - AsyncTokensWithStreamingResponse, + TokensResource, + AsyncTokensResource, + TokensResourceWithRawResponse, + AsyncTokensResourceWithRawResponse, + TokensResourceWithStreamingResponse, + AsyncTokensResourceWithStreamingResponse, ) from .permission_groups import ( - PermissionGroups, - AsyncPermissionGroups, - PermissionGroupsWithRawResponse, - AsyncPermissionGroupsWithRawResponse, - PermissionGroupsWithStreamingResponse, - AsyncPermissionGroupsWithStreamingResponse, + PermissionGroupsResource, + AsyncPermissionGroupsResource, + PermissionGroupsResourceWithRawResponse, + AsyncPermissionGroupsResourceWithRawResponse, + PermissionGroupsResourceWithStreamingResponse, + AsyncPermissionGroupsResourceWithStreamingResponse, ) __all__ = [ - "PermissionGroups", - "AsyncPermissionGroups", - "PermissionGroupsWithRawResponse", - "AsyncPermissionGroupsWithRawResponse", - "PermissionGroupsWithStreamingResponse", - "AsyncPermissionGroupsWithStreamingResponse", - "Value", - "AsyncValue", - "ValueWithRawResponse", - "AsyncValueWithRawResponse", - "ValueWithStreamingResponse", - "AsyncValueWithStreamingResponse", - "Tokens", - "AsyncTokens", - "TokensWithRawResponse", - "AsyncTokensWithRawResponse", - "TokensWithStreamingResponse", - "AsyncTokensWithStreamingResponse", + "PermissionGroupsResource", + "AsyncPermissionGroupsResource", + "PermissionGroupsResourceWithRawResponse", + "AsyncPermissionGroupsResourceWithRawResponse", + "PermissionGroupsResourceWithStreamingResponse", + "AsyncPermissionGroupsResourceWithStreamingResponse", + "ValueResource", + "AsyncValueResource", + "ValueResourceWithRawResponse", + "AsyncValueResourceWithRawResponse", + "ValueResourceWithStreamingResponse", + "AsyncValueResourceWithStreamingResponse", + "TokensResource", + "AsyncTokensResource", + "TokensResourceWithRawResponse", + "AsyncTokensResourceWithRawResponse", + "TokensResourceWithStreamingResponse", + "AsyncTokensResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/user/tokens/permission_groups.py b/src/cloudflare/resources/user/tokens/permission_groups.py index 56114d8047d..427b3944862 100644 --- a/src/cloudflare/resources/user/tokens/permission_groups.py +++ b/src/cloudflare/resources/user/tokens/permission_groups.py @@ -19,17 +19,17 @@ make_request_options, ) -__all__ = ["PermissionGroups", "AsyncPermissionGroups"] +__all__ = ["PermissionGroupsResource", "AsyncPermissionGroupsResource"] -class PermissionGroups(SyncAPIResource): +class PermissionGroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PermissionGroupsWithRawResponse: - return PermissionGroupsWithRawResponse(self) + def with_raw_response(self) -> PermissionGroupsResourceWithRawResponse: + return PermissionGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PermissionGroupsWithStreamingResponse: - return PermissionGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> PermissionGroupsResourceWithStreamingResponse: + return PermissionGroupsResourceWithStreamingResponse(self) def list( self, @@ -52,14 +52,14 @@ def list( ) -class AsyncPermissionGroups(AsyncAPIResource): +class AsyncPermissionGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPermissionGroupsWithRawResponse: - return AsyncPermissionGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncPermissionGroupsResourceWithRawResponse: + return AsyncPermissionGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPermissionGroupsWithStreamingResponse: - return AsyncPermissionGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPermissionGroupsResourceWithStreamingResponse: + return AsyncPermissionGroupsResourceWithStreamingResponse(self) def list( self, @@ -82,8 +82,8 @@ def list( ) -class PermissionGroupsWithRawResponse: - def __init__(self, permission_groups: PermissionGroups) -> None: +class PermissionGroupsResourceWithRawResponse: + def __init__(self, permission_groups: PermissionGroupsResource) -> None: self._permission_groups = permission_groups self.list = to_raw_response_wrapper( @@ -91,8 +91,8 @@ def __init__(self, permission_groups: PermissionGroups) -> None: ) -class AsyncPermissionGroupsWithRawResponse: - def __init__(self, permission_groups: AsyncPermissionGroups) -> None: +class AsyncPermissionGroupsResourceWithRawResponse: + def __init__(self, permission_groups: AsyncPermissionGroupsResource) -> None: self._permission_groups = permission_groups self.list = async_to_raw_response_wrapper( @@ -100,8 +100,8 @@ def __init__(self, permission_groups: AsyncPermissionGroups) -> None: ) -class PermissionGroupsWithStreamingResponse: - def __init__(self, permission_groups: PermissionGroups) -> None: +class PermissionGroupsResourceWithStreamingResponse: + def __init__(self, permission_groups: PermissionGroupsResource) -> None: self._permission_groups = permission_groups self.list = to_streamed_response_wrapper( @@ -109,8 +109,8 @@ def __init__(self, permission_groups: PermissionGroups) -> None: ) -class AsyncPermissionGroupsWithStreamingResponse: - def __init__(self, permission_groups: AsyncPermissionGroups) -> None: +class AsyncPermissionGroupsResourceWithStreamingResponse: + def __init__(self, permission_groups: AsyncPermissionGroupsResource) -> None: self._permission_groups = permission_groups self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/user/tokens/tokens.py b/src/cloudflare/resources/user/tokens/tokens.py index 36fdcf01ea1..4903b12823e 100644 --- a/src/cloudflare/resources/user/tokens/tokens.py +++ b/src/cloudflare/resources/user/tokens/tokens.py @@ -9,12 +9,12 @@ import httpx from .value import ( - Value, - AsyncValue, - ValueWithRawResponse, - AsyncValueWithRawResponse, - ValueWithStreamingResponse, - AsyncValueWithStreamingResponse, + ValueResource, + AsyncValueResource, + ValueResourceWithRawResponse, + AsyncValueResourceWithRawResponse, + ValueResourceWithStreamingResponse, + AsyncValueResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -31,54 +31,51 @@ ) from ...._wrappers import ResultWrapper from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from ....types.user import ( - TokenGetResponse, - TokenCreateResponse, - TokenDeleteResponse, - TokenUpdateResponse, - TokenVerifyResponse, - token_list_params, - token_create_params, - token_update_params, -) +from ....types.user import token_list_params, token_create_params, token_delete_params, token_update_params from ...._base_client import ( AsyncPaginator, make_request_options, ) from .permission_groups import ( - PermissionGroups, - AsyncPermissionGroups, - PermissionGroupsWithRawResponse, - AsyncPermissionGroupsWithRawResponse, - PermissionGroupsWithStreamingResponse, - AsyncPermissionGroupsWithStreamingResponse, + PermissionGroupsResource, + AsyncPermissionGroupsResource, + PermissionGroupsResourceWithRawResponse, + AsyncPermissionGroupsResourceWithRawResponse, + PermissionGroupsResourceWithStreamingResponse, + AsyncPermissionGroupsResourceWithStreamingResponse, ) +from ....types.user.policy_param import PolicyParam +from ....types.user.token_get_response import TokenGetResponse +from ....types.user.token_create_response import TokenCreateResponse +from ....types.user.token_delete_response import TokenDeleteResponse +from ....types.user.token_update_response import TokenUpdateResponse +from ....types.user.token_verify_response import TokenVerifyResponse -__all__ = ["Tokens", "AsyncTokens"] +__all__ = ["TokensResource", "AsyncTokensResource"] -class Tokens(SyncAPIResource): +class TokensResource(SyncAPIResource): @cached_property - def permission_groups(self) -> PermissionGroups: - return PermissionGroups(self._client) + def permission_groups(self) -> PermissionGroupsResource: + return PermissionGroupsResource(self._client) @cached_property - def value(self) -> Value: - return Value(self._client) + def value(self) -> ValueResource: + return ValueResource(self._client) @cached_property - def with_raw_response(self) -> TokensWithRawResponse: - return TokensWithRawResponse(self) + def with_raw_response(self) -> TokensResourceWithRawResponse: + return TokensResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TokensWithStreamingResponse: - return TokensWithStreamingResponse(self) + def with_streaming_response(self) -> TokensResourceWithStreamingResponse: + return TokensResourceWithStreamingResponse(self) def create( self, *, name: str, - policies: Iterable[token_create_params.Policy], + policies: Iterable[PolicyParam], condition: token_create_params.Condition | NotGiven = NOT_GIVEN, expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN, not_before: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -127,7 +124,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenCreateResponse]._unwrapper, ), cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]), ) @@ -137,7 +134,7 @@ def update( token_id: object, *, name: str, - policies: Iterable[token_update_params.Policy], + policies: Iterable[PolicyParam], status: Literal["active", "disabled", "expired"], condition: token_update_params.Condition | NotGiven = NOT_GIVEN, expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -192,7 +189,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TokenUpdateResponse] @@ -255,6 +252,7 @@ def delete( self, token_id: object, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +274,13 @@ def delete( """ return self._delete( f"/user/tokens/{token_id}", + body=maybe_transform(body, token_delete_params.TokenDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TokenDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[TokenDeleteResponse]], ResultWrapper[TokenDeleteResponse]), ) @@ -318,7 +317,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TokenGetResponse] @@ -344,34 +343,34 @@ def verify( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenVerifyResponse]._unwrapper, ), cast_to=cast(Type[TokenVerifyResponse], ResultWrapper[TokenVerifyResponse]), ) -class AsyncTokens(AsyncAPIResource): +class AsyncTokensResource(AsyncAPIResource): @cached_property - def permission_groups(self) -> AsyncPermissionGroups: - return AsyncPermissionGroups(self._client) + def permission_groups(self) -> AsyncPermissionGroupsResource: + return AsyncPermissionGroupsResource(self._client) @cached_property - def value(self) -> AsyncValue: - return AsyncValue(self._client) + def value(self) -> AsyncValueResource: + return AsyncValueResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTokensWithRawResponse: - return AsyncTokensWithRawResponse(self) + def with_raw_response(self) -> AsyncTokensResourceWithRawResponse: + return AsyncTokensResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTokensWithStreamingResponse: - return AsyncTokensWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTokensResourceWithStreamingResponse: + return AsyncTokensResourceWithStreamingResponse(self) async def create( self, *, name: str, - policies: Iterable[token_create_params.Policy], + policies: Iterable[PolicyParam], condition: token_create_params.Condition | NotGiven = NOT_GIVEN, expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN, not_before: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -420,7 +419,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenCreateResponse]._unwrapper, ), cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]), ) @@ -430,7 +429,7 @@ async def update( token_id: object, *, name: str, - policies: Iterable[token_update_params.Policy], + policies: Iterable[PolicyParam], status: Literal["active", "disabled", "expired"], condition: token_update_params.Condition | NotGiven = NOT_GIVEN, expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -485,7 +484,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TokenUpdateResponse] @@ -548,6 +547,7 @@ async def delete( self, token_id: object, *, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -569,12 +569,13 @@ async def delete( """ return await self._delete( f"/user/tokens/{token_id}", + body=await async_maybe_transform(body, token_delete_params.TokenDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TokenDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[TokenDeleteResponse]], ResultWrapper[TokenDeleteResponse]), ) @@ -611,7 +612,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TokenGetResponse] @@ -637,14 +638,14 @@ async def verify( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenVerifyResponse]._unwrapper, ), cast_to=cast(Type[TokenVerifyResponse], ResultWrapper[TokenVerifyResponse]), ) -class TokensWithRawResponse: - def __init__(self, tokens: Tokens) -> None: +class TokensResourceWithRawResponse: + def __init__(self, tokens: TokensResource) -> None: self._tokens = tokens self.create = to_raw_response_wrapper( @@ -667,16 +668,16 @@ def __init__(self, tokens: Tokens) -> None: ) @cached_property - def permission_groups(self) -> PermissionGroupsWithRawResponse: - return PermissionGroupsWithRawResponse(self._tokens.permission_groups) + def permission_groups(self) -> PermissionGroupsResourceWithRawResponse: + return PermissionGroupsResourceWithRawResponse(self._tokens.permission_groups) @cached_property - def value(self) -> ValueWithRawResponse: - return ValueWithRawResponse(self._tokens.value) + def value(self) -> ValueResourceWithRawResponse: + return ValueResourceWithRawResponse(self._tokens.value) -class AsyncTokensWithRawResponse: - def __init__(self, tokens: AsyncTokens) -> None: +class AsyncTokensResourceWithRawResponse: + def __init__(self, tokens: AsyncTokensResource) -> None: self._tokens = tokens self.create = async_to_raw_response_wrapper( @@ -699,16 +700,16 @@ def __init__(self, tokens: AsyncTokens) -> None: ) @cached_property - def permission_groups(self) -> AsyncPermissionGroupsWithRawResponse: - return AsyncPermissionGroupsWithRawResponse(self._tokens.permission_groups) + def permission_groups(self) -> AsyncPermissionGroupsResourceWithRawResponse: + return AsyncPermissionGroupsResourceWithRawResponse(self._tokens.permission_groups) @cached_property - def value(self) -> AsyncValueWithRawResponse: - return AsyncValueWithRawResponse(self._tokens.value) + def value(self) -> AsyncValueResourceWithRawResponse: + return AsyncValueResourceWithRawResponse(self._tokens.value) -class TokensWithStreamingResponse: - def __init__(self, tokens: Tokens) -> None: +class TokensResourceWithStreamingResponse: + def __init__(self, tokens: TokensResource) -> None: self._tokens = tokens self.create = to_streamed_response_wrapper( @@ -731,16 +732,16 @@ def __init__(self, tokens: Tokens) -> None: ) @cached_property - def permission_groups(self) -> PermissionGroupsWithStreamingResponse: - return PermissionGroupsWithStreamingResponse(self._tokens.permission_groups) + def permission_groups(self) -> PermissionGroupsResourceWithStreamingResponse: + return PermissionGroupsResourceWithStreamingResponse(self._tokens.permission_groups) @cached_property - def value(self) -> ValueWithStreamingResponse: - return ValueWithStreamingResponse(self._tokens.value) + def value(self) -> ValueResourceWithStreamingResponse: + return ValueResourceWithStreamingResponse(self._tokens.value) -class AsyncTokensWithStreamingResponse: - def __init__(self, tokens: AsyncTokens) -> None: +class AsyncTokensResourceWithStreamingResponse: + def __init__(self, tokens: AsyncTokensResource) -> None: self._tokens = tokens self.create = async_to_streamed_response_wrapper( @@ -763,9 +764,9 @@ def __init__(self, tokens: AsyncTokens) -> None: ) @cached_property - def permission_groups(self) -> AsyncPermissionGroupsWithStreamingResponse: - return AsyncPermissionGroupsWithStreamingResponse(self._tokens.permission_groups) + def permission_groups(self) -> AsyncPermissionGroupsResourceWithStreamingResponse: + return AsyncPermissionGroupsResourceWithStreamingResponse(self._tokens.permission_groups) @cached_property - def value(self) -> AsyncValueWithStreamingResponse: - return AsyncValueWithStreamingResponse(self._tokens.value) + def value(self) -> AsyncValueResourceWithStreamingResponse: + return AsyncValueResourceWithStreamingResponse(self._tokens.value) diff --git a/src/cloudflare/resources/user/tokens/value.py b/src/cloudflare/resources/user/tokens/value.py index fda2829c384..1a35ddc543e 100644 --- a/src/cloudflare/resources/user/tokens/value.py +++ b/src/cloudflare/resources/user/tokens/value.py @@ -24,18 +24,19 @@ make_request_options, ) from ....types.user.tokens import value_update_params +from ....types.user.tokens.value import Value -__all__ = ["Value", "AsyncValue"] +__all__ = ["ValueResource", "AsyncValueResource"] -class Value(SyncAPIResource): +class ValueResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ValueWithRawResponse: - return ValueWithRawResponse(self) + def with_raw_response(self) -> ValueResourceWithRawResponse: + return ValueResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ValueWithStreamingResponse: - return ValueWithStreamingResponse(self) + def with_streaming_response(self) -> ValueResourceWithStreamingResponse: + return ValueResourceWithStreamingResponse(self) def update( self, @@ -69,20 +70,20 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Value]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) -class AsyncValue(AsyncAPIResource): +class AsyncValueResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncValueWithRawResponse: - return AsyncValueWithRawResponse(self) + def with_raw_response(self) -> AsyncValueResourceWithRawResponse: + return AsyncValueResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncValueWithStreamingResponse: - return AsyncValueWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncValueResourceWithStreamingResponse: + return AsyncValueResourceWithStreamingResponse(self) async def update( self, @@ -116,14 +117,14 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Value]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) -class ValueWithRawResponse: - def __init__(self, value: Value) -> None: +class ValueResourceWithRawResponse: + def __init__(self, value: ValueResource) -> None: self._value = value self.update = to_raw_response_wrapper( @@ -131,8 +132,8 @@ def __init__(self, value: Value) -> None: ) -class AsyncValueWithRawResponse: - def __init__(self, value: AsyncValue) -> None: +class AsyncValueResourceWithRawResponse: + def __init__(self, value: AsyncValueResource) -> None: self._value = value self.update = async_to_raw_response_wrapper( @@ -140,8 +141,8 @@ def __init__(self, value: AsyncValue) -> None: ) -class ValueWithStreamingResponse: - def __init__(self, value: Value) -> None: +class ValueResourceWithStreamingResponse: + def __init__(self, value: ValueResource) -> None: self._value = value self.update = to_streamed_response_wrapper( @@ -149,8 +150,8 @@ def __init__(self, value: Value) -> None: ) -class AsyncValueWithStreamingResponse: - def __init__(self, value: AsyncValue) -> None: +class AsyncValueResourceWithStreamingResponse: + def __init__(self, value: AsyncValueResource) -> None: self._value = value self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/user/user.py b/src/cloudflare/resources/user/user.py index 18a7229f85c..3e9117a3321 100644 --- a/src/cloudflare/resources/user/user.py +++ b/src/cloudflare/resources/user/user.py @@ -7,51 +7,42 @@ import httpx from .tokens import ( - Tokens, - AsyncTokens, - TokensWithRawResponse, - AsyncTokensWithRawResponse, - TokensWithStreamingResponse, - AsyncTokensWithStreamingResponse, + TokensResource, + AsyncTokensResource, + TokensResourceWithRawResponse, + AsyncTokensResourceWithRawResponse, + TokensResourceWithStreamingResponse, + AsyncTokensResourceWithStreamingResponse, ) -from ...types import UserGetResponse, UserEditResponse, user_edit_params from .billing import ( - Billing, - AsyncBilling, - BillingWithRawResponse, - AsyncBillingWithRawResponse, - BillingWithStreamingResponse, - AsyncBillingWithStreamingResponse, + BillingResource, + AsyncBillingResource, + BillingResourceWithRawResponse, + AsyncBillingResourceWithRawResponse, + BillingResourceWithStreamingResponse, + AsyncBillingResourceWithStreamingResponse, ) from .invites import ( - Invites, - AsyncInvites, - InvitesWithRawResponse, - AsyncInvitesWithRawResponse, - InvitesWithStreamingResponse, - AsyncInvitesWithStreamingResponse, + InvitesResource, + AsyncInvitesResource, + InvitesResourceWithRawResponse, + AsyncInvitesResourceWithRawResponse, + InvitesResourceWithStreamingResponse, + AsyncInvitesResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, async_maybe_transform, ) -from .firewall import ( - Firewall, - AsyncFirewall, - FirewallWithRawResponse, - AsyncFirewallWithRawResponse, - FirewallWithStreamingResponse, - AsyncFirewallWithStreamingResponse, -) from ..._compat import cached_property from .audit_logs import ( - AuditLogs, - AsyncAuditLogs, - AuditLogsWithRawResponse, - AsyncAuditLogsWithRawResponse, - AuditLogsWithStreamingResponse, - AsyncAuditLogsWithStreamingResponse, + AuditLogsResource, + AsyncAuditLogsResource, + AuditLogsResourceWithRawResponse, + AsyncAuditLogsResourceWithRawResponse, + AuditLogsResourceWithStreamingResponse, + AsyncAuditLogsResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -61,73 +52,58 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...types.user import user_edit_params from .organizations import ( - Organizations, - AsyncOrganizations, - OrganizationsWithRawResponse, - AsyncOrganizationsWithRawResponse, - OrganizationsWithStreamingResponse, - AsyncOrganizationsWithStreamingResponse, + OrganizationsResource, + AsyncOrganizationsResource, + OrganizationsResourceWithRawResponse, + AsyncOrganizationsResourceWithRawResponse, + OrganizationsResourceWithStreamingResponse, + AsyncOrganizationsResourceWithStreamingResponse, ) from .subscriptions import ( - Subscriptions, - AsyncSubscriptions, - SubscriptionsWithRawResponse, - AsyncSubscriptionsWithRawResponse, - SubscriptionsWithStreamingResponse, - AsyncSubscriptionsWithStreamingResponse, + SubscriptionsResource, + AsyncSubscriptionsResource, + SubscriptionsResourceWithRawResponse, + AsyncSubscriptionsResourceWithRawResponse, + SubscriptionsResourceWithStreamingResponse, + AsyncSubscriptionsResourceWithStreamingResponse, ) -from .tokens.tokens import Tokens, AsyncTokens +from .tokens.tokens import TokensResource, AsyncTokensResource from ..._base_client import ( make_request_options, ) -from .load_balancers import ( - LoadBalancers, - AsyncLoadBalancers, - LoadBalancersWithRawResponse, - AsyncLoadBalancersWithRawResponse, - LoadBalancersWithStreamingResponse, - AsyncLoadBalancersWithStreamingResponse, -) -from .billing.billing import Billing, AsyncBilling -from .firewall.firewall import Firewall, AsyncFirewall -from .load_balancers.load_balancers import LoadBalancers, AsyncLoadBalancers +from .billing.billing import BillingResource, AsyncBillingResource +from ...types.user.user_get_response import UserGetResponse +from ...types.user.user_edit_response import UserEditResponse __all__ = ["UserResource", "AsyncUserResource"] class UserResource(SyncAPIResource): @cached_property - def audit_logs(self) -> AuditLogs: - return AuditLogs(self._client) - - @cached_property - def billing(self) -> Billing: - return Billing(self._client) + def audit_logs(self) -> AuditLogsResource: + return AuditLogsResource(self._client) @cached_property - def firewall(self) -> Firewall: - return Firewall(self._client) + def billing(self) -> BillingResource: + return BillingResource(self._client) @cached_property - def invites(self) -> Invites: - return Invites(self._client) + def invites(self) -> InvitesResource: + return InvitesResource(self._client) @cached_property - def load_balancers(self) -> LoadBalancers: - return LoadBalancers(self._client) + def organizations(self) -> OrganizationsResource: + return OrganizationsResource(self._client) @cached_property - def organizations(self) -> Organizations: - return Organizations(self._client) + def subscriptions(self) -> SubscriptionsResource: + return SubscriptionsResource(self._client) @cached_property - def subscriptions(self) -> Subscriptions: - return Subscriptions(self._client) - - @cached_property - def tokens(self) -> Tokens: - return Tokens(self._client) + def tokens(self) -> TokensResource: + return TokensResource(self._client) @cached_property def with_raw_response(self) -> UserResourceWithRawResponse: @@ -193,7 +169,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UserEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UserEditResponse] @@ -221,7 +197,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UserGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UserGetResponse] @@ -232,36 +208,28 @@ def get( class AsyncUserResource(AsyncAPIResource): @cached_property - def audit_logs(self) -> AsyncAuditLogs: - return AsyncAuditLogs(self._client) + def audit_logs(self) -> AsyncAuditLogsResource: + return AsyncAuditLogsResource(self._client) @cached_property - def billing(self) -> AsyncBilling: - return AsyncBilling(self._client) + def billing(self) -> AsyncBillingResource: + return AsyncBillingResource(self._client) @cached_property - def firewall(self) -> AsyncFirewall: - return AsyncFirewall(self._client) + def invites(self) -> AsyncInvitesResource: + return AsyncInvitesResource(self._client) @cached_property - def invites(self) -> AsyncInvites: - return AsyncInvites(self._client) + def organizations(self) -> AsyncOrganizationsResource: + return AsyncOrganizationsResource(self._client) @cached_property - def load_balancers(self) -> AsyncLoadBalancers: - return AsyncLoadBalancers(self._client) + def subscriptions(self) -> AsyncSubscriptionsResource: + return AsyncSubscriptionsResource(self._client) @cached_property - def organizations(self) -> AsyncOrganizations: - return AsyncOrganizations(self._client) - - @cached_property - def subscriptions(self) -> AsyncSubscriptions: - return AsyncSubscriptions(self._client) - - @cached_property - def tokens(self) -> AsyncTokens: - return AsyncTokens(self._client) + def tokens(self) -> AsyncTokensResource: + return AsyncTokensResource(self._client) @cached_property def with_raw_response(self) -> AsyncUserResourceWithRawResponse: @@ -327,7 +295,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UserEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UserEditResponse] @@ -355,7 +323,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UserGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UserGetResponse] @@ -376,36 +344,28 @@ def __init__(self, user: UserResource) -> None: ) @cached_property - def audit_logs(self) -> AuditLogsWithRawResponse: - return AuditLogsWithRawResponse(self._user.audit_logs) - - @cached_property - def billing(self) -> BillingWithRawResponse: - return BillingWithRawResponse(self._user.billing) - - @cached_property - def firewall(self) -> FirewallWithRawResponse: - return FirewallWithRawResponse(self._user.firewall) + def audit_logs(self) -> AuditLogsResourceWithRawResponse: + return AuditLogsResourceWithRawResponse(self._user.audit_logs) @cached_property - def invites(self) -> InvitesWithRawResponse: - return InvitesWithRawResponse(self._user.invites) + def billing(self) -> BillingResourceWithRawResponse: + return BillingResourceWithRawResponse(self._user.billing) @cached_property - def load_balancers(self) -> LoadBalancersWithRawResponse: - return LoadBalancersWithRawResponse(self._user.load_balancers) + def invites(self) -> InvitesResourceWithRawResponse: + return InvitesResourceWithRawResponse(self._user.invites) @cached_property - def organizations(self) -> OrganizationsWithRawResponse: - return OrganizationsWithRawResponse(self._user.organizations) + def organizations(self) -> OrganizationsResourceWithRawResponse: + return OrganizationsResourceWithRawResponse(self._user.organizations) @cached_property - def subscriptions(self) -> SubscriptionsWithRawResponse: - return SubscriptionsWithRawResponse(self._user.subscriptions) + def subscriptions(self) -> SubscriptionsResourceWithRawResponse: + return SubscriptionsResourceWithRawResponse(self._user.subscriptions) @cached_property - def tokens(self) -> TokensWithRawResponse: - return TokensWithRawResponse(self._user.tokens) + def tokens(self) -> TokensResourceWithRawResponse: + return TokensResourceWithRawResponse(self._user.tokens) class AsyncUserResourceWithRawResponse: @@ -420,36 +380,28 @@ def __init__(self, user: AsyncUserResource) -> None: ) @cached_property - def audit_logs(self) -> AsyncAuditLogsWithRawResponse: - return AsyncAuditLogsWithRawResponse(self._user.audit_logs) - - @cached_property - def billing(self) -> AsyncBillingWithRawResponse: - return AsyncBillingWithRawResponse(self._user.billing) + def audit_logs(self) -> AsyncAuditLogsResourceWithRawResponse: + return AsyncAuditLogsResourceWithRawResponse(self._user.audit_logs) @cached_property - def firewall(self) -> AsyncFirewallWithRawResponse: - return AsyncFirewallWithRawResponse(self._user.firewall) + def billing(self) -> AsyncBillingResourceWithRawResponse: + return AsyncBillingResourceWithRawResponse(self._user.billing) @cached_property - def invites(self) -> AsyncInvitesWithRawResponse: - return AsyncInvitesWithRawResponse(self._user.invites) + def invites(self) -> AsyncInvitesResourceWithRawResponse: + return AsyncInvitesResourceWithRawResponse(self._user.invites) @cached_property - def load_balancers(self) -> AsyncLoadBalancersWithRawResponse: - return AsyncLoadBalancersWithRawResponse(self._user.load_balancers) + def organizations(self) -> AsyncOrganizationsResourceWithRawResponse: + return AsyncOrganizationsResourceWithRawResponse(self._user.organizations) @cached_property - def organizations(self) -> AsyncOrganizationsWithRawResponse: - return AsyncOrganizationsWithRawResponse(self._user.organizations) + def subscriptions(self) -> AsyncSubscriptionsResourceWithRawResponse: + return AsyncSubscriptionsResourceWithRawResponse(self._user.subscriptions) @cached_property - def subscriptions(self) -> AsyncSubscriptionsWithRawResponse: - return AsyncSubscriptionsWithRawResponse(self._user.subscriptions) - - @cached_property - def tokens(self) -> AsyncTokensWithRawResponse: - return AsyncTokensWithRawResponse(self._user.tokens) + def tokens(self) -> AsyncTokensResourceWithRawResponse: + return AsyncTokensResourceWithRawResponse(self._user.tokens) class UserResourceWithStreamingResponse: @@ -464,36 +416,28 @@ def __init__(self, user: UserResource) -> None: ) @cached_property - def audit_logs(self) -> AuditLogsWithStreamingResponse: - return AuditLogsWithStreamingResponse(self._user.audit_logs) + def audit_logs(self) -> AuditLogsResourceWithStreamingResponse: + return AuditLogsResourceWithStreamingResponse(self._user.audit_logs) @cached_property - def billing(self) -> BillingWithStreamingResponse: - return BillingWithStreamingResponse(self._user.billing) + def billing(self) -> BillingResourceWithStreamingResponse: + return BillingResourceWithStreamingResponse(self._user.billing) @cached_property - def firewall(self) -> FirewallWithStreamingResponse: - return FirewallWithStreamingResponse(self._user.firewall) + def invites(self) -> InvitesResourceWithStreamingResponse: + return InvitesResourceWithStreamingResponse(self._user.invites) @cached_property - def invites(self) -> InvitesWithStreamingResponse: - return InvitesWithStreamingResponse(self._user.invites) + def organizations(self) -> OrganizationsResourceWithStreamingResponse: + return OrganizationsResourceWithStreamingResponse(self._user.organizations) @cached_property - def load_balancers(self) -> LoadBalancersWithStreamingResponse: - return LoadBalancersWithStreamingResponse(self._user.load_balancers) + def subscriptions(self) -> SubscriptionsResourceWithStreamingResponse: + return SubscriptionsResourceWithStreamingResponse(self._user.subscriptions) @cached_property - def organizations(self) -> OrganizationsWithStreamingResponse: - return OrganizationsWithStreamingResponse(self._user.organizations) - - @cached_property - def subscriptions(self) -> SubscriptionsWithStreamingResponse: - return SubscriptionsWithStreamingResponse(self._user.subscriptions) - - @cached_property - def tokens(self) -> TokensWithStreamingResponse: - return TokensWithStreamingResponse(self._user.tokens) + def tokens(self) -> TokensResourceWithStreamingResponse: + return TokensResourceWithStreamingResponse(self._user.tokens) class AsyncUserResourceWithStreamingResponse: @@ -508,33 +452,25 @@ def __init__(self, user: AsyncUserResource) -> None: ) @cached_property - def audit_logs(self) -> AsyncAuditLogsWithStreamingResponse: - return AsyncAuditLogsWithStreamingResponse(self._user.audit_logs) - - @cached_property - def billing(self) -> AsyncBillingWithStreamingResponse: - return AsyncBillingWithStreamingResponse(self._user.billing) - - @cached_property - def firewall(self) -> AsyncFirewallWithStreamingResponse: - return AsyncFirewallWithStreamingResponse(self._user.firewall) + def audit_logs(self) -> AsyncAuditLogsResourceWithStreamingResponse: + return AsyncAuditLogsResourceWithStreamingResponse(self._user.audit_logs) @cached_property - def invites(self) -> AsyncInvitesWithStreamingResponse: - return AsyncInvitesWithStreamingResponse(self._user.invites) + def billing(self) -> AsyncBillingResourceWithStreamingResponse: + return AsyncBillingResourceWithStreamingResponse(self._user.billing) @cached_property - def load_balancers(self) -> AsyncLoadBalancersWithStreamingResponse: - return AsyncLoadBalancersWithStreamingResponse(self._user.load_balancers) + def invites(self) -> AsyncInvitesResourceWithStreamingResponse: + return AsyncInvitesResourceWithStreamingResponse(self._user.invites) @cached_property - def organizations(self) -> AsyncOrganizationsWithStreamingResponse: - return AsyncOrganizationsWithStreamingResponse(self._user.organizations) + def organizations(self) -> AsyncOrganizationsResourceWithStreamingResponse: + return AsyncOrganizationsResourceWithStreamingResponse(self._user.organizations) @cached_property - def subscriptions(self) -> AsyncSubscriptionsWithStreamingResponse: - return AsyncSubscriptionsWithStreamingResponse(self._user.subscriptions) + def subscriptions(self) -> AsyncSubscriptionsResourceWithStreamingResponse: + return AsyncSubscriptionsResourceWithStreamingResponse(self._user.subscriptions) @cached_property - def tokens(self) -> AsyncTokensWithStreamingResponse: - return AsyncTokensWithStreamingResponse(self._user.tokens) + def tokens(self) -> AsyncTokensResourceWithStreamingResponse: + return AsyncTokensResourceWithStreamingResponse(self._user.tokens) diff --git a/src/cloudflare/resources/vectorize/__init__.py b/src/cloudflare/resources/vectorize/__init__.py index ded339e9554..6ec0cbca1b6 100644 --- a/src/cloudflare/resources/vectorize/__init__.py +++ b/src/cloudflare/resources/vectorize/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .indexes import ( - Indexes, - AsyncIndexes, - IndexesWithRawResponse, - AsyncIndexesWithRawResponse, - IndexesWithStreamingResponse, - AsyncIndexesWithStreamingResponse, + IndexesResource, + AsyncIndexesResource, + IndexesResourceWithRawResponse, + AsyncIndexesResourceWithRawResponse, + IndexesResourceWithStreamingResponse, + AsyncIndexesResourceWithStreamingResponse, ) from .vectorize import ( - Vectorize, - AsyncVectorize, - VectorizeWithRawResponse, - AsyncVectorizeWithRawResponse, - VectorizeWithStreamingResponse, - AsyncVectorizeWithStreamingResponse, + VectorizeResource, + AsyncVectorizeResource, + VectorizeResourceWithRawResponse, + AsyncVectorizeResourceWithRawResponse, + VectorizeResourceWithStreamingResponse, + AsyncVectorizeResourceWithStreamingResponse, ) __all__ = [ - "Indexes", - "AsyncIndexes", - "IndexesWithRawResponse", - "AsyncIndexesWithRawResponse", - "IndexesWithStreamingResponse", - "AsyncIndexesWithStreamingResponse", - "Vectorize", - "AsyncVectorize", - "VectorizeWithRawResponse", - "AsyncVectorizeWithRawResponse", - "VectorizeWithStreamingResponse", - "AsyncVectorizeWithStreamingResponse", + "IndexesResource", + "AsyncIndexesResource", + "IndexesResourceWithRawResponse", + "AsyncIndexesResourceWithRawResponse", + "IndexesResourceWithStreamingResponse", + "AsyncIndexesResourceWithStreamingResponse", + "VectorizeResource", + "AsyncVectorizeResource", + "VectorizeResourceWithRawResponse", + "AsyncVectorizeResourceWithRawResponse", + "VectorizeResourceWithStreamingResponse", + "AsyncVectorizeResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/vectorize/indexes.py b/src/cloudflare/resources/vectorize/indexes.py index 345e6f36299..b58a753d658 100644 --- a/src/cloudflare/resources/vectorize/indexes.py +++ b/src/cloudflare/resources/vectorize/indexes.py @@ -26,35 +26,37 @@ make_request_options, ) from ...types.vectorize import ( - IndexDeleteResponse, - VectorizeIndexQuery, - VectorizeCreateIndex, - VectorizeIndexInsert, - VectorizeIndexUpsert, - VectorizeIndexDeleteVectorsByID, index_query_params, index_create_params, + index_insert_params, index_update_params, + index_upsert_params, index_get_by_ids_params, index_delete_by_ids_params, ) +from ...types.vectorize.index_query import IndexQuery +from ...types.vectorize.create_index import CreateIndex +from ...types.vectorize.index_insert import IndexInsert +from ...types.vectorize.index_upsert import IndexUpsert +from ...types.vectorize.index_delete_response import IndexDeleteResponse +from ...types.vectorize.index_delete_vectors_by_id import IndexDeleteVectorsByID -__all__ = ["Indexes", "AsyncIndexes"] +__all__ = ["IndexesResource", "AsyncIndexesResource"] -class Indexes(SyncAPIResource): +class IndexesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IndexesWithRawResponse: - return IndexesWithRawResponse(self) + def with_raw_response(self) -> IndexesResourceWithRawResponse: + return IndexesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IndexesWithStreamingResponse: - return IndexesWithStreamingResponse(self) + def with_streaming_response(self) -> IndexesResourceWithStreamingResponse: + return IndexesResourceWithStreamingResponse(self) def create( self, - account_identifier: str, *, + account_id: str, config: index_create_params.Config, name: str, description: str | NotGiven = NOT_GIVEN, @@ -64,12 +66,12 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VectorizeCreateIndex]: + ) -> Optional[CreateIndex]: """ Creates and returns a new Vectorize Index. Args: - account_identifier: Identifier + account_id: Identifier config: Specifies the type of configuration to use for the index. @@ -83,10 +85,10 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( - f"/accounts/{account_identifier}/vectorize/indexes", + f"/accounts/{account_id}/vectorize/indexes", body=maybe_transform( { "config": config, @@ -100,16 +102,16 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CreateIndex]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeCreateIndex]], ResultWrapper[VectorizeCreateIndex]), + cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), ) def update( self, index_name: str, *, - account_identifier: str, + account_id: str, description: 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. @@ -117,12 +119,12 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VectorizeCreateIndex]: + ) -> Optional[CreateIndex]: """ Updates and returns the specified Vectorize Index. Args: - account_identifier: Identifier + account_id: Identifier description: Specifies the description of the index. @@ -134,39 +136,39 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return self._put( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", + f"/accounts/{account_id}/vectorize/indexes/{index_name}", body=maybe_transform({"description": description}, index_update_params.IndexUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CreateIndex]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeCreateIndex]], ResultWrapper[VectorizeCreateIndex]), + cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), ) def list( self, - account_identifier: 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, - ) -> SyncSinglePage[VectorizeCreateIndex]: + ) -> SyncSinglePage[CreateIndex]: """ Returns a list of Vectorize Indexes Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -176,34 +178,34 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not 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_identifier}/vectorize/indexes", - page=SyncSinglePage[VectorizeCreateIndex], + f"/accounts/{account_id}/vectorize/indexes", + page=SyncSinglePage[CreateIndex], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=VectorizeCreateIndex, + model=CreateIndex, ) def delete( self, index_name: str, *, - account_identifier: 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[IndexDeleteResponse]: + ) -> IndexDeleteResponse: """ Deletes the specified Vectorize Index. Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -213,20 +215,20 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return cast( - Optional[IndexDeleteResponse], + IndexDeleteResponse, self._delete( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", + f"/accounts/{account_id}/vectorize/indexes/{index_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IndexDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IndexDeleteResponse] @@ -238,7 +240,7 @@ def delete_by_ids( self, index_name: str, *, - account_identifier: str, + account_id: str, ids: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -246,12 +248,12 @@ def delete_by_ids( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VectorizeIndexDeleteVectorsByID]: + ) -> Optional[IndexDeleteVectorsByID]: """ Delete a set of vectors from an index by their vector identifiers. Args: - account_identifier: Identifier + account_id: Identifier ids: A list of vector identifiers to delete from the index indicated by the path. @@ -263,42 +265,40 @@ def delete_by_ids( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/delete-by-ids", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/delete-by-ids", body=maybe_transform({"ids": ids}, index_delete_by_ids_params.IndexDeleteByIDsParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[VectorizeIndexDeleteVectorsByID]], ResultWrapper[VectorizeIndexDeleteVectorsByID] + post_parser=ResultWrapper[Optional[IndexDeleteVectorsByID]]._unwrapper, ), + cast_to=cast(Type[Optional[IndexDeleteVectorsByID]], ResultWrapper[IndexDeleteVectorsByID]), ) def get( self, index_name: str, *, - account_identifier: 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[VectorizeCreateIndex]: + ) -> Optional[CreateIndex]: """ Returns the specified Vectorize Index. Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -308,27 +308,27 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return self._get( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", + f"/accounts/{account_id}/vectorize/indexes/{index_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CreateIndex]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeCreateIndex]], ResultWrapper[VectorizeCreateIndex]), + cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), ) def get_by_ids( self, index_name: str, *, - account_identifier: str, + account_id: str, ids: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -341,7 +341,7 @@ def get_by_ids( Get a set of vectors from an index by their vector identifiers. Args: - account_identifier: Identifier + account_id: Identifier ids: A list of vector identifiers to retrieve from the index indicated by the path. @@ -353,19 +353,19 @@ def get_by_ids( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/get-by-ids", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/get-by-ids", body=maybe_transform({"ids": ids}, index_get_by_ids_params.IndexGetByIDsParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -374,20 +374,21 @@ def insert( self, index_name: str, *, - account_identifier: str, + account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[VectorizeIndexInsert]: + ) -> Optional[IndexInsert]: """ Inserts vectors into the specified index and returns the count of the vectors successfully inserted. Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -397,43 +398,49 @@ def insert( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/insert", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/insert", + body=maybe_transform(body, index_insert_params.IndexInsertParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IndexInsert]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeIndexInsert]], ResultWrapper[VectorizeIndexInsert]), + cast_to=cast(Type[Optional[IndexInsert]], ResultWrapper[IndexInsert]), ) def query( self, index_name: str, *, - account_identifier: str, + account_id: str, + vector: Iterable[float], + filter: object | NotGiven = NOT_GIVEN, return_metadata: bool | NotGiven = NOT_GIVEN, return_values: bool | NotGiven = NOT_GIVEN, top_k: float | NotGiven = NOT_GIVEN, - vector: Iterable[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. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VectorizeIndexQuery]: + ) -> Optional[IndexQuery]: """ Finds vectors closest to a given vector in an index. Args: - account_identifier: Identifier + account_id: Identifier + + vector: The search vector that will be used to find the nearest neighbors. + + filter: A metadata filter expression used to limit nearest neighbor results. return_metadata: Whether to return the metadata associated with the closest vectors. @@ -441,8 +448,6 @@ def query( top_k: The number of nearest neighbors to find. - vector: The search vector that will be used to find the nearest neighbors. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -451,18 +456,19 @@ def query( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/query", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/query", body=maybe_transform( { + "vector": vector, + "filter": filter, "return_metadata": return_metadata, "return_values": return_values, "top_k": top_k, - "vector": vector, }, index_query_params.IndexQueryParams, ), @@ -471,29 +477,30 @@ def query( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IndexQuery]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeIndexQuery]], ResultWrapper[VectorizeIndexQuery]), + cast_to=cast(Type[Optional[IndexQuery]], ResultWrapper[IndexQuery]), ) def upsert( self, index_name: str, *, - account_identifier: str, + account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[VectorizeIndexUpsert]: + ) -> Optional[IndexUpsert]: """ Upserts vectors into the specified index, creating them if they do not exist and returns the count of values and ids successfully inserted. Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -503,36 +510,37 @@ def upsert( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/upsert", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/upsert", + body=maybe_transform(body, index_upsert_params.IndexUpsertParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IndexUpsert]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeIndexUpsert]], ResultWrapper[VectorizeIndexUpsert]), + cast_to=cast(Type[Optional[IndexUpsert]], ResultWrapper[IndexUpsert]), ) -class AsyncIndexes(AsyncAPIResource): +class AsyncIndexesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIndexesWithRawResponse: - return AsyncIndexesWithRawResponse(self) + def with_raw_response(self) -> AsyncIndexesResourceWithRawResponse: + return AsyncIndexesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIndexesWithStreamingResponse: - return AsyncIndexesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIndexesResourceWithStreamingResponse: + return AsyncIndexesResourceWithStreamingResponse(self) async def create( self, - account_identifier: str, *, + account_id: str, config: index_create_params.Config, name: str, description: str | NotGiven = NOT_GIVEN, @@ -542,12 +550,12 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VectorizeCreateIndex]: + ) -> Optional[CreateIndex]: """ Creates and returns a new Vectorize Index. Args: - account_identifier: Identifier + account_id: Identifier config: Specifies the type of configuration to use for the index. @@ -561,10 +569,10 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not 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_identifier}/vectorize/indexes", + f"/accounts/{account_id}/vectorize/indexes", body=await async_maybe_transform( { "config": config, @@ -578,16 +586,16 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CreateIndex]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeCreateIndex]], ResultWrapper[VectorizeCreateIndex]), + cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), ) async def update( self, index_name: str, *, - account_identifier: str, + account_id: str, description: 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. @@ -595,12 +603,12 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VectorizeCreateIndex]: + ) -> Optional[CreateIndex]: """ Updates and returns the specified Vectorize Index. Args: - account_identifier: Identifier + account_id: Identifier description: Specifies the description of the index. @@ -612,39 +620,39 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return await self._put( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", + f"/accounts/{account_id}/vectorize/indexes/{index_name}", body=await async_maybe_transform({"description": description}, index_update_params.IndexUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CreateIndex]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeCreateIndex]], ResultWrapper[VectorizeCreateIndex]), + cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), ) def list( self, - account_identifier: 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, - ) -> AsyncPaginator[VectorizeCreateIndex, AsyncSinglePage[VectorizeCreateIndex]]: + ) -> AsyncPaginator[CreateIndex, AsyncSinglePage[CreateIndex]]: """ Returns a list of Vectorize Indexes Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -654,34 +662,34 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not 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_identifier}/vectorize/indexes", - page=AsyncSinglePage[VectorizeCreateIndex], + f"/accounts/{account_id}/vectorize/indexes", + page=AsyncSinglePage[CreateIndex], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=VectorizeCreateIndex, + model=CreateIndex, ) async def delete( self, index_name: str, *, - account_identifier: 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[IndexDeleteResponse]: + ) -> IndexDeleteResponse: """ Deletes the specified Vectorize Index. Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -691,20 +699,20 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return cast( - Optional[IndexDeleteResponse], + IndexDeleteResponse, await self._delete( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", + f"/accounts/{account_id}/vectorize/indexes/{index_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IndexDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IndexDeleteResponse] @@ -716,7 +724,7 @@ async def delete_by_ids( self, index_name: str, *, - account_identifier: str, + account_id: str, ids: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -724,12 +732,12 @@ async def delete_by_ids( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VectorizeIndexDeleteVectorsByID]: + ) -> Optional[IndexDeleteVectorsByID]: """ Delete a set of vectors from an index by their vector identifiers. Args: - account_identifier: Identifier + account_id: Identifier ids: A list of vector identifiers to delete from the index indicated by the path. @@ -741,42 +749,40 @@ async def delete_by_ids( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/delete-by-ids", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/delete-by-ids", body=await async_maybe_transform({"ids": ids}, index_delete_by_ids_params.IndexDeleteByIDsParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[VectorizeIndexDeleteVectorsByID]], ResultWrapper[VectorizeIndexDeleteVectorsByID] + post_parser=ResultWrapper[Optional[IndexDeleteVectorsByID]]._unwrapper, ), + cast_to=cast(Type[Optional[IndexDeleteVectorsByID]], ResultWrapper[IndexDeleteVectorsByID]), ) async def get( self, index_name: str, *, - account_identifier: 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[VectorizeCreateIndex]: + ) -> Optional[CreateIndex]: """ Returns the specified Vectorize Index. Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -786,27 +792,27 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return await self._get( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", + f"/accounts/{account_id}/vectorize/indexes/{index_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CreateIndex]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeCreateIndex]], ResultWrapper[VectorizeCreateIndex]), + cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), ) async def get_by_ids( self, index_name: str, *, - account_identifier: str, + account_id: str, ids: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -819,7 +825,7 @@ async def get_by_ids( Get a set of vectors from an index by their vector identifiers. Args: - account_identifier: Identifier + account_id: Identifier ids: A list of vector identifiers to retrieve from the index indicated by the path. @@ -831,19 +837,19 @@ async def get_by_ids( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/get-by-ids", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/get-by-ids", body=await async_maybe_transform({"ids": ids}, index_get_by_ids_params.IndexGetByIDsParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -852,20 +858,21 @@ async def insert( self, index_name: str, *, - account_identifier: str, + account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[VectorizeIndexInsert]: + ) -> Optional[IndexInsert]: """ Inserts vectors into the specified index and returns the count of the vectors successfully inserted. Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -875,43 +882,49 @@ async def insert( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/insert", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/insert", + body=await async_maybe_transform(body, index_insert_params.IndexInsertParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IndexInsert]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeIndexInsert]], ResultWrapper[VectorizeIndexInsert]), + cast_to=cast(Type[Optional[IndexInsert]], ResultWrapper[IndexInsert]), ) async def query( self, index_name: str, *, - account_identifier: str, + account_id: str, + vector: Iterable[float], + filter: object | NotGiven = NOT_GIVEN, return_metadata: bool | NotGiven = NOT_GIVEN, return_values: bool | NotGiven = NOT_GIVEN, top_k: float | NotGiven = NOT_GIVEN, - vector: Iterable[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. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VectorizeIndexQuery]: + ) -> Optional[IndexQuery]: """ Finds vectors closest to a given vector in an index. Args: - account_identifier: Identifier + account_id: Identifier + + vector: The search vector that will be used to find the nearest neighbors. + + filter: A metadata filter expression used to limit nearest neighbor results. return_metadata: Whether to return the metadata associated with the closest vectors. @@ -919,8 +932,6 @@ async def query( top_k: The number of nearest neighbors to find. - vector: The search vector that will be used to find the nearest neighbors. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -929,18 +940,19 @@ async def query( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/query", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/query", body=await async_maybe_transform( { + "vector": vector, + "filter": filter, "return_metadata": return_metadata, "return_values": return_values, "top_k": top_k, - "vector": vector, }, index_query_params.IndexQueryParams, ), @@ -949,29 +961,30 @@ async def query( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IndexQuery]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeIndexQuery]], ResultWrapper[VectorizeIndexQuery]), + cast_to=cast(Type[Optional[IndexQuery]], ResultWrapper[IndexQuery]), ) async def upsert( self, index_name: str, *, - account_identifier: str, + account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[VectorizeIndexUpsert]: + ) -> Optional[IndexUpsert]: """ Upserts vectors into the specified index, creating them if they do not exist and returns the count of values and ids successfully inserted. Args: - account_identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -981,25 +994,26 @@ async def upsert( timeout: Override the client-level default timeout for this request, in seconds """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/upsert", + f"/accounts/{account_id}/vectorize/indexes/{index_name}/upsert", + body=await async_maybe_transform(body, index_upsert_params.IndexUpsertParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IndexUpsert]]._unwrapper, ), - cast_to=cast(Type[Optional[VectorizeIndexUpsert]], ResultWrapper[VectorizeIndexUpsert]), + cast_to=cast(Type[Optional[IndexUpsert]], ResultWrapper[IndexUpsert]), ) -class IndexesWithRawResponse: - def __init__(self, indexes: Indexes) -> None: +class IndexesResourceWithRawResponse: + def __init__(self, indexes: IndexesResource) -> None: self._indexes = indexes self.create = to_raw_response_wrapper( @@ -1034,8 +1048,8 @@ def __init__(self, indexes: Indexes) -> None: ) -class AsyncIndexesWithRawResponse: - def __init__(self, indexes: AsyncIndexes) -> None: +class AsyncIndexesResourceWithRawResponse: + def __init__(self, indexes: AsyncIndexesResource) -> None: self._indexes = indexes self.create = async_to_raw_response_wrapper( @@ -1070,8 +1084,8 @@ def __init__(self, indexes: AsyncIndexes) -> None: ) -class IndexesWithStreamingResponse: - def __init__(self, indexes: Indexes) -> None: +class IndexesResourceWithStreamingResponse: + def __init__(self, indexes: IndexesResource) -> None: self._indexes = indexes self.create = to_streamed_response_wrapper( @@ -1106,8 +1120,8 @@ def __init__(self, indexes: Indexes) -> None: ) -class AsyncIndexesWithStreamingResponse: - def __init__(self, indexes: AsyncIndexes) -> None: +class AsyncIndexesResourceWithStreamingResponse: + def __init__(self, indexes: AsyncIndexesResource) -> None: self._indexes = indexes self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/vectorize/vectorize.py b/src/cloudflare/resources/vectorize/vectorize.py index bb5adf5237d..189d1279ebc 100644 --- a/src/cloudflare/resources/vectorize/vectorize.py +++ b/src/cloudflare/resources/vectorize/vectorize.py @@ -3,78 +3,78 @@ from __future__ import annotations from .indexes import ( - Indexes, - AsyncIndexes, - IndexesWithRawResponse, - AsyncIndexesWithRawResponse, - IndexesWithStreamingResponse, - AsyncIndexesWithStreamingResponse, + IndexesResource, + AsyncIndexesResource, + IndexesResourceWithRawResponse, + AsyncIndexesResourceWithRawResponse, + IndexesResourceWithStreamingResponse, + AsyncIndexesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["Vectorize", "AsyncVectorize"] +__all__ = ["VectorizeResource", "AsyncVectorizeResource"] -class Vectorize(SyncAPIResource): +class VectorizeResource(SyncAPIResource): @cached_property - def indexes(self) -> Indexes: - return Indexes(self._client) + def indexes(self) -> IndexesResource: + return IndexesResource(self._client) @cached_property - def with_raw_response(self) -> VectorizeWithRawResponse: - return VectorizeWithRawResponse(self) + def with_raw_response(self) -> VectorizeResourceWithRawResponse: + return VectorizeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VectorizeWithStreamingResponse: - return VectorizeWithStreamingResponse(self) + def with_streaming_response(self) -> VectorizeResourceWithStreamingResponse: + return VectorizeResourceWithStreamingResponse(self) -class AsyncVectorize(AsyncAPIResource): +class AsyncVectorizeResource(AsyncAPIResource): @cached_property - def indexes(self) -> AsyncIndexes: - return AsyncIndexes(self._client) + def indexes(self) -> AsyncIndexesResource: + return AsyncIndexesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncVectorizeWithRawResponse: - return AsyncVectorizeWithRawResponse(self) + def with_raw_response(self) -> AsyncVectorizeResourceWithRawResponse: + return AsyncVectorizeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVectorizeWithStreamingResponse: - return AsyncVectorizeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVectorizeResourceWithStreamingResponse: + return AsyncVectorizeResourceWithStreamingResponse(self) -class VectorizeWithRawResponse: - def __init__(self, vectorize: Vectorize) -> None: +class VectorizeResourceWithRawResponse: + def __init__(self, vectorize: VectorizeResource) -> None: self._vectorize = vectorize @cached_property - def indexes(self) -> IndexesWithRawResponse: - return IndexesWithRawResponse(self._vectorize.indexes) + def indexes(self) -> IndexesResourceWithRawResponse: + return IndexesResourceWithRawResponse(self._vectorize.indexes) -class AsyncVectorizeWithRawResponse: - def __init__(self, vectorize: AsyncVectorize) -> None: +class AsyncVectorizeResourceWithRawResponse: + def __init__(self, vectorize: AsyncVectorizeResource) -> None: self._vectorize = vectorize @cached_property - def indexes(self) -> AsyncIndexesWithRawResponse: - return AsyncIndexesWithRawResponse(self._vectorize.indexes) + def indexes(self) -> AsyncIndexesResourceWithRawResponse: + return AsyncIndexesResourceWithRawResponse(self._vectorize.indexes) -class VectorizeWithStreamingResponse: - def __init__(self, vectorize: Vectorize) -> None: +class VectorizeResourceWithStreamingResponse: + def __init__(self, vectorize: VectorizeResource) -> None: self._vectorize = vectorize @cached_property - def indexes(self) -> IndexesWithStreamingResponse: - return IndexesWithStreamingResponse(self._vectorize.indexes) + def indexes(self) -> IndexesResourceWithStreamingResponse: + return IndexesResourceWithStreamingResponse(self._vectorize.indexes) -class AsyncVectorizeWithStreamingResponse: - def __init__(self, vectorize: AsyncVectorize) -> None: +class AsyncVectorizeResourceWithStreamingResponse: + def __init__(self, vectorize: AsyncVectorizeResource) -> None: self._vectorize = vectorize @cached_property - def indexes(self) -> AsyncIndexesWithStreamingResponse: - return AsyncIndexesWithStreamingResponse(self._vectorize.indexes) + def indexes(self) -> AsyncIndexesResourceWithStreamingResponse: + return AsyncIndexesResourceWithStreamingResponse(self._vectorize.indexes) diff --git a/src/cloudflare/resources/waiting_rooms/__init__.py b/src/cloudflare/resources/waiting_rooms/__init__.py index 368198739b8..17c8b90fe06 100644 --- a/src/cloudflare/resources/waiting_rooms/__init__.py +++ b/src/cloudflare/resources/waiting_rooms/__init__.py @@ -1,89 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .page import ( - Page, - AsyncPage, - PageWithRawResponse, - AsyncPageWithRawResponse, - PageWithStreamingResponse, - AsyncPageWithStreamingResponse, + PageResource, + AsyncPageResource, + PageResourceWithRawResponse, + AsyncPageResourceWithRawResponse, + PageResourceWithStreamingResponse, + AsyncPageResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .statuses import ( - Statuses, - AsyncStatuses, - StatusesWithRawResponse, - AsyncStatusesWithRawResponse, - StatusesWithStreamingResponse, - AsyncStatusesWithStreamingResponse, + StatusesResource, + AsyncStatusesResource, + StatusesResourceWithRawResponse, + AsyncStatusesResourceWithRawResponse, + StatusesResourceWithStreamingResponse, + AsyncStatusesResourceWithStreamingResponse, ) from .waiting_rooms import ( - WaitingRooms, - AsyncWaitingRooms, - WaitingRoomsWithRawResponse, - AsyncWaitingRoomsWithRawResponse, - WaitingRoomsWithStreamingResponse, - AsyncWaitingRoomsWithStreamingResponse, + WaitingRoomsResource, + AsyncWaitingRoomsResource, + WaitingRoomsResourceWithRawResponse, + AsyncWaitingRoomsResourceWithRawResponse, + WaitingRoomsResourceWithStreamingResponse, + AsyncWaitingRoomsResourceWithStreamingResponse, ) __all__ = [ - "Page", - "AsyncPage", - "PageWithRawResponse", - "AsyncPageWithRawResponse", - "PageWithStreamingResponse", - "AsyncPageWithStreamingResponse", - "Events", - "AsyncEvents", - "EventsWithRawResponse", - "AsyncEventsWithRawResponse", - "EventsWithStreamingResponse", - "AsyncEventsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "Statuses", - "AsyncStatuses", - "StatusesWithRawResponse", - "AsyncStatusesWithRawResponse", - "StatusesWithStreamingResponse", - "AsyncStatusesWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "WaitingRooms", - "AsyncWaitingRooms", - "WaitingRoomsWithRawResponse", - "AsyncWaitingRoomsWithRawResponse", - "WaitingRoomsWithStreamingResponse", - "AsyncWaitingRoomsWithStreamingResponse", + "PageResource", + "AsyncPageResource", + "PageResourceWithRawResponse", + "AsyncPageResourceWithRawResponse", + "PageResourceWithStreamingResponse", + "AsyncPageResourceWithStreamingResponse", + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "StatusesResource", + "AsyncStatusesResource", + "StatusesResourceWithRawResponse", + "AsyncStatusesResourceWithRawResponse", + "StatusesResourceWithStreamingResponse", + "AsyncStatusesResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "WaitingRoomsResource", + "AsyncWaitingRoomsResource", + "WaitingRoomsResourceWithRawResponse", + "AsyncWaitingRoomsResourceWithRawResponse", + "WaitingRoomsResourceWithStreamingResponse", + "AsyncWaitingRoomsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/waiting_rooms/events/__init__.py b/src/cloudflare/resources/waiting_rooms/events/__init__.py index f4fcffae591..97c5cce8704 100644 --- a/src/cloudflare/resources/waiting_rooms/events/__init__.py +++ b/src/cloudflare/resources/waiting_rooms/events/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, ) from .details import ( - Details, - AsyncDetails, - DetailsWithRawResponse, - AsyncDetailsWithRawResponse, - DetailsWithStreamingResponse, - AsyncDetailsWithStreamingResponse, + DetailsResource, + AsyncDetailsResource, + DetailsResourceWithRawResponse, + AsyncDetailsResourceWithRawResponse, + DetailsResourceWithStreamingResponse, + AsyncDetailsResourceWithStreamingResponse, ) __all__ = [ - "Details", - "AsyncDetails", - "DetailsWithRawResponse", - "AsyncDetailsWithRawResponse", - "DetailsWithStreamingResponse", - "AsyncDetailsWithStreamingResponse", - "Events", - "AsyncEvents", - "EventsWithRawResponse", - "AsyncEventsWithRawResponse", - "EventsWithStreamingResponse", - "AsyncEventsWithStreamingResponse", + "DetailsResource", + "AsyncDetailsResource", + "DetailsResourceWithRawResponse", + "AsyncDetailsResourceWithRawResponse", + "DetailsResourceWithStreamingResponse", + "AsyncDetailsResourceWithStreamingResponse", + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/waiting_rooms/events/details.py b/src/cloudflare/resources/waiting_rooms/events/details.py index 9cdb0fc0c8b..4e99504cb01 100644 --- a/src/cloudflare/resources/waiting_rooms/events/details.py +++ b/src/cloudflare/resources/waiting_rooms/events/details.py @@ -19,25 +19,25 @@ from ...._base_client import ( make_request_options, ) -from ....types.waiting_rooms.events import WaitingroomEventDetails +from ....types.waiting_rooms.events.detail_get_response import DetailGetResponse -__all__ = ["Details", "AsyncDetails"] +__all__ = ["DetailsResource", "AsyncDetailsResource"] -class Details(SyncAPIResource): +class DetailsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DetailsWithRawResponse: - return DetailsWithRawResponse(self) + def with_raw_response(self) -> DetailsResourceWithRawResponse: + return DetailsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DetailsWithStreamingResponse: - return DetailsWithStreamingResponse(self) + def with_streaming_response(self) -> DetailsResourceWithStreamingResponse: + return DetailsResourceWithStreamingResponse(self) def get( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_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. @@ -45,14 +45,14 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEventDetails: + ) -> DetailGetResponse: """Previews an event's configuration as if it was active. Inherited fields from the waiting room will be displayed with their current values. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -62,39 +62,39 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}/details", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DetailGetResponse]._unwrapper, ), - cast_to=cast(Type[WaitingroomEventDetails], ResultWrapper[WaitingroomEventDetails]), + cast_to=cast(Type[DetailGetResponse], ResultWrapper[DetailGetResponse]), ) -class AsyncDetails(AsyncAPIResource): +class AsyncDetailsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDetailsWithRawResponse: - return AsyncDetailsWithRawResponse(self) + def with_raw_response(self) -> AsyncDetailsResourceWithRawResponse: + return AsyncDetailsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDetailsWithStreamingResponse: - return AsyncDetailsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDetailsResourceWithStreamingResponse: + return AsyncDetailsResourceWithStreamingResponse(self) async def get( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_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. @@ -102,14 +102,14 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEventDetails: + ) -> DetailGetResponse: """Previews an event's configuration as if it was active. Inherited fields from the waiting room will be displayed with their current values. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -119,27 +119,27 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}/details", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DetailGetResponse]._unwrapper, ), - cast_to=cast(Type[WaitingroomEventDetails], ResultWrapper[WaitingroomEventDetails]), + cast_to=cast(Type[DetailGetResponse], ResultWrapper[DetailGetResponse]), ) -class DetailsWithRawResponse: - def __init__(self, details: Details) -> None: +class DetailsResourceWithRawResponse: + def __init__(self, details: DetailsResource) -> None: self._details = details self.get = to_raw_response_wrapper( @@ -147,8 +147,8 @@ def __init__(self, details: Details) -> None: ) -class AsyncDetailsWithRawResponse: - def __init__(self, details: AsyncDetails) -> None: +class AsyncDetailsResourceWithRawResponse: + def __init__(self, details: AsyncDetailsResource) -> None: self._details = details self.get = async_to_raw_response_wrapper( @@ -156,8 +156,8 @@ def __init__(self, details: AsyncDetails) -> None: ) -class DetailsWithStreamingResponse: - def __init__(self, details: Details) -> None: +class DetailsResourceWithStreamingResponse: + def __init__(self, details: DetailsResource) -> None: self._details = details self.get = to_streamed_response_wrapper( @@ -165,8 +165,8 @@ def __init__(self, details: Details) -> None: ) -class AsyncDetailsWithStreamingResponse: - def __init__(self, details: AsyncDetails) -> None: +class AsyncDetailsResourceWithStreamingResponse: + def __init__(self, details: AsyncDetailsResource) -> None: self._details = details self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/waiting_rooms/events/events.py b/src/cloudflare/resources/waiting_rooms/events/events.py index 4f640e2a6c9..62dc803843d 100644 --- a/src/cloudflare/resources/waiting_rooms/events/events.py +++ b/src/cloudflare/resources/waiting_rooms/events/events.py @@ -7,12 +7,12 @@ import httpx from .details import ( - Details, - AsyncDetails, - DetailsWithRawResponse, - AsyncDetailsWithRawResponse, - DetailsWithStreamingResponse, - AsyncDetailsWithStreamingResponse, + DetailsResource, + AsyncDetailsResource, + DetailsResourceWithRawResponse, + AsyncDetailsResourceWithRawResponse, + DetailsResourceWithStreamingResponse, + AsyncDetailsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -34,34 +34,36 @@ make_request_options, ) from ....types.waiting_rooms import ( - WaitingroomEvent, - EventDeleteResponse, event_edit_params, + event_list_params, event_create_params, + event_delete_params, event_update_params, ) +from ....types.waiting_rooms.event import Event +from ....types.waiting_rooms.event_delete_response import EventDeleteResponse -__all__ = ["Events", "AsyncEvents"] +__all__ = ["EventsResource", "AsyncEventsResource"] -class Events(SyncAPIResource): +class EventsResource(SyncAPIResource): @cached_property - def details(self) -> Details: - return Details(self._client) + def details(self) -> DetailsResource: + return DetailsResource(self._client) @cached_property - def with_raw_response(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self) + def with_raw_response(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self) + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self) def create( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, event_end_time: str, event_start_time: str, name: str, @@ -81,7 +83,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEvent: + ) -> Event: """Only available for the Waiting Room Advanced subscription. Creates an event for @@ -92,7 +94,7 @@ def create( with each other, so only one event can be active at a time. Args: - zone_identifier: Identifier + zone_id: Identifier event_end_time: An ISO 8601 timestamp that marks the end of the event. @@ -147,12 +149,12 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._post( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events", body=maybe_transform( { "event_end_time": event_end_time, @@ -176,16 +178,16 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Event]._unwrapper, ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), + cast_to=cast(Type[Event], ResultWrapper[Event]), ) def update( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, event_end_time: str, event_start_time: str, @@ -206,12 +208,12 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEvent: + ) -> Event: """ Updates a configured event for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier event_end_time: An ISO 8601 timestamp that marks the end of the event. @@ -266,14 +268,14 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}", body=maybe_transform( { "event_end_time": event_end_time, @@ -297,28 +299,34 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Event]._unwrapper, ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), + cast_to=cast(Type[Event], ResultWrapper[Event]), ) def list( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, + page: object | NotGiven = NOT_GIVEN, + per_page: object | 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[WaitingroomEvent]: + ) -> SyncSinglePage[Event]: """ Lists events for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier + + page: Page number of paginated results. + + per_page: Maximum number of results per page. Must be a multiple of 5. extra_headers: Send extra headers @@ -328,25 +336,36 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", - page=SyncSinglePage[WaitingroomEvent], + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events", + page=SyncSinglePage[Event], 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, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + event_list_params.EventListParams, + ), ), - model=WaitingroomEvent, + model=Event, ) def delete( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -358,7 +377,7 @@ def delete( Deletes an event for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -368,20 +387,21 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}", + body=maybe_transform(body, event_delete_params.EventDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EventDeleteResponse]._unwrapper, ), cast_to=cast(Type[EventDeleteResponse], ResultWrapper[EventDeleteResponse]), ) @@ -390,7 +410,7 @@ def edit( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, event_end_time: str, event_start_time: str, @@ -411,12 +431,12 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEvent: + ) -> Event: """ Patches a configured event for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier event_end_time: An ISO 8601 timestamp that marks the end of the event. @@ -471,14 +491,14 @@ def edit( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}", body=maybe_transform( { "event_end_time": event_end_time, @@ -502,16 +522,16 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Event]._unwrapper, ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), + cast_to=cast(Type[Event], ResultWrapper[Event]), ) def get( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_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. @@ -519,12 +539,12 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEvent: + ) -> Event: """ Fetches a single configured event for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -534,43 +554,43 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Event]._unwrapper, ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), + cast_to=cast(Type[Event], ResultWrapper[Event]), ) -class AsyncEvents(AsyncAPIResource): +class AsyncEventsResource(AsyncAPIResource): @cached_property - def details(self) -> AsyncDetails: - return AsyncDetails(self._client) + def details(self) -> AsyncDetailsResource: + return AsyncDetailsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self) + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self) async def create( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, event_end_time: str, event_start_time: str, name: str, @@ -590,7 +610,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEvent: + ) -> Event: """Only available for the Waiting Room Advanced subscription. Creates an event for @@ -601,7 +621,7 @@ async def create( with each other, so only one event can be active at a time. Args: - zone_identifier: Identifier + zone_id: Identifier event_end_time: An ISO 8601 timestamp that marks the end of the event. @@ -656,12 +676,12 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return await self._post( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events", body=await async_maybe_transform( { "event_end_time": event_end_time, @@ -685,16 +705,16 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Event]._unwrapper, ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), + cast_to=cast(Type[Event], ResultWrapper[Event]), ) async def update( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, event_end_time: str, event_start_time: str, @@ -715,12 +735,12 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEvent: + ) -> Event: """ Updates a configured event for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier event_end_time: An ISO 8601 timestamp that marks the end of the event. @@ -775,14 +795,14 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return await self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}", body=await async_maybe_transform( { "event_end_time": event_end_time, @@ -806,28 +826,34 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Event]._unwrapper, ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), + cast_to=cast(Type[Event], ResultWrapper[Event]), ) def list( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, + page: object | NotGiven = NOT_GIVEN, + per_page: object | 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[WaitingroomEvent, AsyncSinglePage[WaitingroomEvent]]: + ) -> AsyncPaginator[Event, AsyncSinglePage[Event]]: """ Lists events for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier + + page: Page number of paginated results. + + per_page: Maximum number of results per page. Must be a multiple of 5. extra_headers: Send extra headers @@ -837,25 +863,36 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", - page=AsyncSinglePage[WaitingroomEvent], + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events", + page=AsyncSinglePage[Event], 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, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + event_list_params.EventListParams, + ), ), - model=WaitingroomEvent, + model=Event, ) async def delete( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -867,7 +904,7 @@ async def delete( Deletes an event for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -877,20 +914,21 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return await self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}", + body=await async_maybe_transform(body, event_delete_params.EventDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[EventDeleteResponse]._unwrapper, ), cast_to=cast(Type[EventDeleteResponse], ResultWrapper[EventDeleteResponse]), ) @@ -899,7 +937,7 @@ async def edit( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, event_end_time: str, event_start_time: str, @@ -920,12 +958,12 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEvent: + ) -> Event: """ Patches a configured event for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier event_end_time: An ISO 8601 timestamp that marks the end of the event. @@ -980,14 +1018,14 @@ async def edit( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return await self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}", body=await async_maybe_transform( { "event_end_time": event_end_time, @@ -1011,16 +1049,16 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Event]._unwrapper, ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), + cast_to=cast(Type[Event], ResultWrapper[Event]), ) async def get( self, event_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_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. @@ -1028,12 +1066,12 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingroomEvent: + ) -> Event: """ Fetches a single configured event for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -1043,27 +1081,27 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events/{event_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Event]._unwrapper, ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), + cast_to=cast(Type[Event], ResultWrapper[Event]), ) -class EventsWithRawResponse: - def __init__(self, events: Events) -> None: +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: self._events = events self.create = to_raw_response_wrapper( @@ -1086,12 +1124,12 @@ def __init__(self, events: Events) -> None: ) @cached_property - def details(self) -> DetailsWithRawResponse: - return DetailsWithRawResponse(self._events.details) + def details(self) -> DetailsResourceWithRawResponse: + return DetailsResourceWithRawResponse(self._events.details) -class AsyncEventsWithRawResponse: - def __init__(self, events: AsyncEvents) -> None: +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: self._events = events self.create = async_to_raw_response_wrapper( @@ -1114,12 +1152,12 @@ def __init__(self, events: AsyncEvents) -> None: ) @cached_property - def details(self) -> AsyncDetailsWithRawResponse: - return AsyncDetailsWithRawResponse(self._events.details) + def details(self) -> AsyncDetailsResourceWithRawResponse: + return AsyncDetailsResourceWithRawResponse(self._events.details) -class EventsWithStreamingResponse: - def __init__(self, events: Events) -> None: +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: self._events = events self.create = to_streamed_response_wrapper( @@ -1142,12 +1180,12 @@ def __init__(self, events: Events) -> None: ) @cached_property - def details(self) -> DetailsWithStreamingResponse: - return DetailsWithStreamingResponse(self._events.details) + def details(self) -> DetailsResourceWithStreamingResponse: + return DetailsResourceWithStreamingResponse(self._events.details) -class AsyncEventsWithStreamingResponse: - def __init__(self, events: AsyncEvents) -> None: +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: self._events = events self.create = async_to_streamed_response_wrapper( @@ -1170,5 +1208,5 @@ def __init__(self, events: AsyncEvents) -> None: ) @cached_property - def details(self) -> AsyncDetailsWithStreamingResponse: - return AsyncDetailsWithStreamingResponse(self._events.details) + def details(self) -> AsyncDetailsResourceWithStreamingResponse: + return AsyncDetailsResourceWithStreamingResponse(self._events.details) diff --git a/src/cloudflare/resources/waiting_rooms/page.py b/src/cloudflare/resources/waiting_rooms/page.py index 70559f56214..f8d511a8d16 100644 --- a/src/cloudflare/resources/waiting_rooms/page.py +++ b/src/cloudflare/resources/waiting_rooms/page.py @@ -23,24 +23,25 @@ from ..._base_client import ( make_request_options, ) -from ...types.waiting_rooms import PagePreviewResponse, page_preview_params +from ...types.waiting_rooms import page_preview_params +from ...types.waiting_rooms.page_preview_response import PagePreviewResponse -__all__ = ["Page", "AsyncPage"] +__all__ = ["PageResource", "AsyncPageResource"] -class Page(SyncAPIResource): +class PageResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PageWithRawResponse: - return PageWithRawResponse(self) + def with_raw_response(self) -> PageResourceWithRawResponse: + return PageResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PageWithStreamingResponse: - return PageWithStreamingResponse(self) + def with_streaming_response(self) -> PageResourceWithStreamingResponse: + return PageResourceWithStreamingResponse(self) def preview( self, - zone_identifier: str, *, + zone_id: str, custom_html: 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. @@ -89,7 +90,7 @@ def preview( wait time as 50 minutes. Args: - zone_identifier: Identifier + zone_id: Identifier custom_html: Only available for the Waiting Room Advanced subscription. This is a template html file that will be rendered at the edge. If no custom_page_html is provided, @@ -121,35 +122,35 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms/preview", + f"/zones/{zone_id}/waiting_rooms/preview", body=maybe_transform({"custom_html": custom_html}, page_preview_params.PagePreviewParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PagePreviewResponse]._unwrapper, ), cast_to=cast(Type[PagePreviewResponse], ResultWrapper[PagePreviewResponse]), ) -class AsyncPage(AsyncAPIResource): +class AsyncPageResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPageWithRawResponse: - return AsyncPageWithRawResponse(self) + def with_raw_response(self) -> AsyncPageResourceWithRawResponse: + return AsyncPageResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPageWithStreamingResponse: - return AsyncPageWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPageResourceWithStreamingResponse: + return AsyncPageResourceWithStreamingResponse(self) async def preview( self, - zone_identifier: str, *, + zone_id: str, custom_html: 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. @@ -198,7 +199,7 @@ async def preview( wait time as 50 minutes. Args: - zone_identifier: Identifier + zone_id: Identifier custom_html: Only available for the Waiting Room Advanced subscription. This is a template html file that will be rendered at the edge. If no custom_page_html is provided, @@ -230,24 +231,24 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms/preview", + f"/zones/{zone_id}/waiting_rooms/preview", body=await async_maybe_transform({"custom_html": custom_html}, page_preview_params.PagePreviewParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PagePreviewResponse]._unwrapper, ), cast_to=cast(Type[PagePreviewResponse], ResultWrapper[PagePreviewResponse]), ) -class PageWithRawResponse: - def __init__(self, page: Page) -> None: +class PageResourceWithRawResponse: + def __init__(self, page: PageResource) -> None: self._page = page self.preview = to_raw_response_wrapper( @@ -255,8 +256,8 @@ def __init__(self, page: Page) -> None: ) -class AsyncPageWithRawResponse: - def __init__(self, page: AsyncPage) -> None: +class AsyncPageResourceWithRawResponse: + def __init__(self, page: AsyncPageResource) -> None: self._page = page self.preview = async_to_raw_response_wrapper( @@ -264,8 +265,8 @@ def __init__(self, page: AsyncPage) -> None: ) -class PageWithStreamingResponse: - def __init__(self, page: Page) -> None: +class PageResourceWithStreamingResponse: + def __init__(self, page: PageResource) -> None: self._page = page self.preview = to_streamed_response_wrapper( @@ -273,8 +274,8 @@ def __init__(self, page: Page) -> None: ) -class AsyncPageWithStreamingResponse: - def __init__(self, page: AsyncPage) -> None: +class AsyncPageResourceWithStreamingResponse: + def __init__(self, page: AsyncPageResource) -> None: self._page = page self.preview = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/waiting_rooms/rules.py b/src/cloudflare/resources/waiting_rooms/rules.py index 78bd8d41228..61f18ee6d83 100644 --- a/src/cloudflare/resources/waiting_rooms/rules.py +++ b/src/cloudflare/resources/waiting_rooms/rules.py @@ -26,34 +26,30 @@ AsyncPaginator, make_request_options, ) -from ...types.waiting_rooms import ( - WaitingroomRule, - RuleEditResponse, - RuleCreateResponse, - RuleDeleteResponse, - RuleUpdateResponse, - rule_edit_params, - rule_create_params, - rule_update_params, -) +from ...types.waiting_rooms import rule_edit_params, rule_create_params, rule_delete_params, rule_update_params +from ...types.waiting_rooms.waiting_room_rule import WaitingRoomRule +from ...types.waiting_rooms.rule_edit_response import RuleEditResponse +from ...types.waiting_rooms.rule_create_response import RuleCreateResponse +from ...types.waiting_rooms.rule_delete_response import RuleDeleteResponse +from ...types.waiting_rooms.rule_update_response import RuleUpdateResponse -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) def create( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, action: Literal["bypass_waiting_room"], expression: str, description: str | NotGiven = NOT_GIVEN, @@ -71,7 +67,7 @@ def create( waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier action: The action to take when the expression matches. @@ -89,12 +85,12 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._post( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules", body=maybe_transform( { "action": action, @@ -109,7 +105,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), ) @@ -118,7 +114,7 @@ def update( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, body: Iterable[rule_update_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. @@ -133,7 +129,7 @@ def update( for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -143,19 +139,19 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules", body=maybe_transform(body, 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._unwrapper, + post_parser=ResultWrapper[Optional[RuleUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), ) @@ -164,19 +160,19 @@ def list( self, waiting_room_id: str, *, - zone_identifier: 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, - ) -> SyncSinglePage[WaitingroomRule]: + ) -> SyncSinglePage[WaitingRoomRule]: """ Lists rules for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -186,25 +182,26 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", - page=SyncSinglePage[WaitingroomRule], + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules", + page=SyncSinglePage[WaitingRoomRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=WaitingroomRule, + model=WaitingRoomRule, ) def delete( self, rule_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -216,7 +213,7 @@ def delete( Deletes a rule for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier rule_id: The ID of the rule. @@ -228,20 +225,21 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_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"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", + body=maybe_transform(body, rule_delete_params.RuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleDeleteResponse]], ResultWrapper[RuleDeleteResponse]), ) @@ -250,7 +248,7 @@ def edit( self, rule_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, action: Literal["bypass_waiting_room"], expression: str, @@ -268,7 +266,7 @@ def edit( Patches a rule for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier rule_id: The ID of the rule. @@ -290,14 +288,14 @@ def edit( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", body=maybe_transform( { "action": action, @@ -313,26 +311,26 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleEditResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleEditResponse]], ResultWrapper[RuleEditResponse]), ) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) async def create( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, action: Literal["bypass_waiting_room"], expression: str, description: str | NotGiven = NOT_GIVEN, @@ -350,7 +348,7 @@ async def create( waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier action: The action to take when the expression matches. @@ -368,12 +366,12 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return await self._post( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules", body=await async_maybe_transform( { "action": action, @@ -388,7 +386,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), ) @@ -397,7 +395,7 @@ async def update( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, body: Iterable[rule_update_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. @@ -412,7 +410,7 @@ async def update( for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -422,19 +420,19 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return await self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules", body=await async_maybe_transform(body, 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._unwrapper, + post_parser=ResultWrapper[Optional[RuleUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), ) @@ -443,19 +441,19 @@ def list( self, waiting_room_id: str, *, - zone_identifier: 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, - ) -> AsyncPaginator[WaitingroomRule, AsyncSinglePage[WaitingroomRule]]: + ) -> AsyncPaginator[WaitingRoomRule, AsyncSinglePage[WaitingRoomRule]]: """ Lists rules for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -465,25 +463,26 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", - page=AsyncSinglePage[WaitingroomRule], + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules", + page=AsyncSinglePage[WaitingRoomRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=WaitingroomRule, + model=WaitingRoomRule, ) async def delete( self, rule_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -495,7 +494,7 @@ async def delete( Deletes a rule for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier rule_id: The ID of the rule. @@ -507,20 +506,21 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_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"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", + body=await async_maybe_transform(body, rule_delete_params.RuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleDeleteResponse]], ResultWrapper[RuleDeleteResponse]), ) @@ -529,7 +529,7 @@ async def edit( self, rule_id: str, *, - zone_identifier: str, + zone_id: str, waiting_room_id: str, action: Literal["bypass_waiting_room"], expression: str, @@ -547,7 +547,7 @@ async def edit( Patches a rule for a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier rule_id: The ID of the rule. @@ -569,14 +569,14 @@ async def edit( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_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._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -592,14 +592,14 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleEditResponse]]._unwrapper, ), cast_to=cast(Type[Optional[RuleEditResponse]], ResultWrapper[RuleEditResponse]), ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_raw_response_wrapper( @@ -619,8 +619,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_raw_response_wrapper( @@ -640,8 +640,8 @@ def __init__(self, rules: AsyncRules) -> None: ) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_streamed_response_wrapper( @@ -661,8 +661,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/waiting_rooms/settings.py b/src/cloudflare/resources/waiting_rooms/settings.py index 0f942309554..2c793777bc2 100644 --- a/src/cloudflare/resources/waiting_rooms/settings.py +++ b/src/cloudflare/resources/waiting_rooms/settings.py @@ -23,30 +23,27 @@ from ..._base_client import ( make_request_options, ) -from ...types.waiting_rooms import ( - SettingGetResponse, - SettingEditResponse, - SettingUpdateResponse, - setting_edit_params, - setting_update_params, -) +from ...types.waiting_rooms import setting_edit_params, setting_update_params +from ...types.waiting_rooms.setting_get_response import SettingGetResponse +from ...types.waiting_rooms.setting_edit_response import SettingEditResponse +from ...types.waiting_rooms.setting_update_response import SettingUpdateResponse -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def update( self, - zone_identifier: str, *, + zone_id: str, search_engine_crawler_bypass: 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. @@ -59,7 +56,7 @@ def update( Update zone-level Waiting Room settings Args: - zone_identifier: Identifier + zone_id: Identifier search_engine_crawler_bypass: Whether to allow verified search engine crawlers to bypass all waiting rooms on this zone. Verified search engine crawlers will not be tracked or counted by the @@ -73,10 +70,10 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._put( - f"/zones/{zone_identifier}/waiting_rooms/settings", + f"/zones/{zone_id}/waiting_rooms/settings", body=maybe_transform( {"search_engine_crawler_bypass": search_engine_crawler_bypass}, setting_update_params.SettingUpdateParams, @@ -86,15 +83,15 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingUpdateResponse]._unwrapper, ), cast_to=cast(Type[SettingUpdateResponse], ResultWrapper[SettingUpdateResponse]), ) def edit( self, - zone_identifier: str, *, + zone_id: str, search_engine_crawler_bypass: 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. @@ -107,7 +104,7 @@ def edit( Patch zone-level Waiting Room settings Args: - zone_identifier: Identifier + zone_id: Identifier search_engine_crawler_bypass: Whether to allow verified search engine crawlers to bypass all waiting rooms on this zone. Verified search engine crawlers will not be tracked or counted by the @@ -121,10 +118,10 @@ def edit( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms/settings", + f"/zones/{zone_id}/waiting_rooms/settings", body=maybe_transform( {"search_engine_crawler_bypass": search_engine_crawler_bypass}, setting_edit_params.SettingEditParams ), @@ -133,15 +130,15 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingEditResponse]._unwrapper, ), cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), ) def get( self, - zone_identifier: 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, @@ -153,7 +150,7 @@ def get( Get zone-level Waiting Room settings Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -163,34 +160,34 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms/settings", + f"/zones/{zone_id}/waiting_rooms/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingGetResponse]._unwrapper, ), cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), ) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def update( self, - zone_identifier: str, *, + zone_id: str, search_engine_crawler_bypass: 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. @@ -203,7 +200,7 @@ async def update( Update zone-level Waiting Room settings Args: - zone_identifier: Identifier + zone_id: Identifier search_engine_crawler_bypass: Whether to allow verified search engine crawlers to bypass all waiting rooms on this zone. Verified search engine crawlers will not be tracked or counted by the @@ -217,10 +214,10 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._put( - f"/zones/{zone_identifier}/waiting_rooms/settings", + f"/zones/{zone_id}/waiting_rooms/settings", body=await async_maybe_transform( {"search_engine_crawler_bypass": search_engine_crawler_bypass}, setting_update_params.SettingUpdateParams, @@ -230,15 +227,15 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingUpdateResponse]._unwrapper, ), cast_to=cast(Type[SettingUpdateResponse], ResultWrapper[SettingUpdateResponse]), ) async def edit( self, - zone_identifier: str, *, + zone_id: str, search_engine_crawler_bypass: 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. @@ -251,7 +248,7 @@ async def edit( Patch zone-level Waiting Room settings Args: - zone_identifier: Identifier + zone_id: Identifier search_engine_crawler_bypass: Whether to allow verified search engine crawlers to bypass all waiting rooms on this zone. Verified search engine crawlers will not be tracked or counted by the @@ -265,10 +262,10 @@ async def edit( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms/settings", + f"/zones/{zone_id}/waiting_rooms/settings", body=await async_maybe_transform( {"search_engine_crawler_bypass": search_engine_crawler_bypass}, setting_edit_params.SettingEditParams ), @@ -277,15 +274,15 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingEditResponse]._unwrapper, ), cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), ) async def get( self, - zone_identifier: 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, @@ -297,7 +294,7 @@ async def get( Get zone-level Waiting Room settings Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -307,23 +304,23 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms/settings", + f"/zones/{zone_id}/waiting_rooms/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SettingGetResponse]._unwrapper, ), cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), ) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.update = to_raw_response_wrapper( @@ -337,8 +334,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.update = async_to_raw_response_wrapper( @@ -352,8 +349,8 @@ def __init__(self, settings: AsyncSettings) -> None: ) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.update = to_streamed_response_wrapper( @@ -367,8 +364,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/waiting_rooms/statuses.py b/src/cloudflare/resources/waiting_rooms/statuses.py index 5c5348f0345..81dc369cb7f 100644 --- a/src/cloudflare/resources/waiting_rooms/statuses.py +++ b/src/cloudflare/resources/waiting_rooms/statuses.py @@ -19,25 +19,25 @@ from ..._base_client import ( make_request_options, ) -from ...types.waiting_rooms import StatusGetResponse +from ...types.waiting_rooms.status_get_response import StatusGetResponse -__all__ = ["Statuses", "AsyncStatuses"] +__all__ = ["StatusesResource", "AsyncStatusesResource"] -class Statuses(SyncAPIResource): +class StatusesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> StatusesWithRawResponse: - return StatusesWithRawResponse(self) + def with_raw_response(self) -> StatusesResourceWithRawResponse: + return StatusesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> StatusesWithStreamingResponse: - return StatusesWithStreamingResponse(self) + def with_streaming_response(self) -> StatusesResourceWithStreamingResponse: + return StatusesResourceWithStreamingResponse(self) def get( self, waiting_room_id: str, *, - zone_identifier: 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, @@ -67,7 +67,7 @@ def get( presented to the users. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -77,37 +77,37 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/status", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[StatusGetResponse]._unwrapper, ), cast_to=cast(Type[StatusGetResponse], ResultWrapper[StatusGetResponse]), ) -class AsyncStatuses(AsyncAPIResource): +class AsyncStatusesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncStatusesWithRawResponse: - return AsyncStatusesWithRawResponse(self) + def with_raw_response(self) -> AsyncStatusesResourceWithRawResponse: + return AsyncStatusesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncStatusesWithStreamingResponse: - return AsyncStatusesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncStatusesResourceWithStreamingResponse: + return AsyncStatusesResourceWithStreamingResponse(self) async def get( self, waiting_room_id: str, *, - zone_identifier: 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, @@ -137,7 +137,7 @@ async def get( presented to the users. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -147,25 +147,25 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/status", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[StatusGetResponse]._unwrapper, ), cast_to=cast(Type[StatusGetResponse], ResultWrapper[StatusGetResponse]), ) -class StatusesWithRawResponse: - def __init__(self, statuses: Statuses) -> None: +class StatusesResourceWithRawResponse: + def __init__(self, statuses: StatusesResource) -> None: self._statuses = statuses self.get = to_raw_response_wrapper( @@ -173,8 +173,8 @@ def __init__(self, statuses: Statuses) -> None: ) -class AsyncStatusesWithRawResponse: - def __init__(self, statuses: AsyncStatuses) -> None: +class AsyncStatusesResourceWithRawResponse: + def __init__(self, statuses: AsyncStatusesResource) -> None: self._statuses = statuses self.get = async_to_raw_response_wrapper( @@ -182,8 +182,8 @@ def __init__(self, statuses: AsyncStatuses) -> None: ) -class StatusesWithStreamingResponse: - def __init__(self, statuses: Statuses) -> None: +class StatusesResourceWithStreamingResponse: + def __init__(self, statuses: StatusesResource) -> None: self._statuses = statuses self.get = to_streamed_response_wrapper( @@ -191,8 +191,8 @@ def __init__(self, statuses: Statuses) -> None: ) -class AsyncStatusesWithStreamingResponse: - def __init__(self, statuses: AsyncStatuses) -> None: +class AsyncStatusesResourceWithStreamingResponse: + def __init__(self, statuses: AsyncStatusesResource) -> None: self._statuses = statuses self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py index d7db5dfc32a..e89685b2d40 100644 --- a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py +++ b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py @@ -8,35 +8,28 @@ import httpx from .page import ( - Page, - AsyncPage, - PageWithRawResponse, - AsyncPageWithRawResponse, - PageWithStreamingResponse, - AsyncPageWithStreamingResponse, + PageResource, + AsyncPageResource, + PageResourceWithRawResponse, + AsyncPageResourceWithRawResponse, + PageResourceWithStreamingResponse, + AsyncPageResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, -) -from ...types import ( - WaitingRoom, - WaitingRoomDeleteResponse, - waiting_room_edit_params, - waiting_room_create_params, - waiting_room_update_params, + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( @@ -44,20 +37,20 @@ async_maybe_transform, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .statuses import ( - Statuses, - AsyncStatuses, - StatusesWithRawResponse, - AsyncStatusesWithRawResponse, - StatusesWithStreamingResponse, - AsyncStatusesWithStreamingResponse, + StatusesResource, + AsyncStatusesResource, + StatusesResourceWithRawResponse, + AsyncStatusesResourceWithRawResponse, + StatusesResourceWithStreamingResponse, + AsyncStatusesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -69,54 +62,65 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage -from .events.events import Events, AsyncEvents +from .events.events import EventsResource, AsyncEventsResource from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.waiting_rooms import ( + waiting_room_edit_params, + waiting_room_list_params, + waiting_room_create_params, + waiting_room_delete_params, + waiting_room_update_params, +) +from ...types.waiting_rooms.waiting_room import WaitingRoom +from ...types.waiting_rooms.additional_routes_param import AdditionalRoutesParam +from ...types.waiting_rooms.cookie_attributes_param import CookieAttributesParam +from ...types.waiting_rooms.waiting_room_delete_response import WaitingRoomDeleteResponse -__all__ = ["WaitingRooms", "AsyncWaitingRooms"] +__all__ = ["WaitingRoomsResource", "AsyncWaitingRoomsResource"] -class WaitingRooms(SyncAPIResource): +class WaitingRoomsResource(SyncAPIResource): @cached_property - def page(self) -> Page: - return Page(self._client) + def page(self) -> PageResource: + return PageResource(self._client) @cached_property - def events(self) -> Events: - return Events(self._client) + def events(self) -> EventsResource: + return EventsResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def statuses(self) -> Statuses: - return Statuses(self._client) + def statuses(self) -> StatusesResource: + return StatusesResource(self._client) @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def with_raw_response(self) -> WaitingRoomsWithRawResponse: - return WaitingRoomsWithRawResponse(self) + def with_raw_response(self) -> WaitingRoomsResourceWithRawResponse: + return WaitingRoomsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WaitingRoomsWithStreamingResponse: - return WaitingRoomsWithStreamingResponse(self) + def with_streaming_response(self) -> WaitingRoomsResourceWithStreamingResponse: + return WaitingRoomsResourceWithStreamingResponse(self) def create( self, - zone_identifier: str, *, + zone_id: str, host: str, name: str, new_users_per_minute: int, total_active_users: int, - additional_routes: Iterable[waiting_room_create_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_create_params.CookieAttributes | NotGiven = NOT_GIVEN, + additional_routes: Iterable[AdditionalRoutesParam] | NotGiven = NOT_GIVEN, + cookie_attributes: CookieAttributesParam | NotGiven = NOT_GIVEN, cookie_suffix: str | NotGiven = NOT_GIVEN, custom_page_html: str | NotGiven = NOT_GIVEN, default_template_language: Literal[ @@ -159,7 +163,7 @@ def create( Creates a new waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier host: The host name to which the waiting room will be applied (no wildcards). Please do not include the scheme (http:// or https://). The host and path combination @@ -425,10 +429,10 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms", + f"/zones/{zone_id}/waiting_rooms", body=maybe_transform( { "host": host, @@ -457,7 +461,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoom]._unwrapper, ), cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) @@ -466,13 +470,13 @@ def update( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, host: str, name: str, new_users_per_minute: int, total_active_users: int, - additional_routes: Iterable[waiting_room_update_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_update_params.CookieAttributes | NotGiven = NOT_GIVEN, + additional_routes: Iterable[AdditionalRoutesParam] | NotGiven = NOT_GIVEN, + cookie_attributes: CookieAttributesParam | NotGiven = NOT_GIVEN, cookie_suffix: str | NotGiven = NOT_GIVEN, custom_page_html: str | NotGiven = NOT_GIVEN, default_template_language: Literal[ @@ -515,7 +519,7 @@ def update( Updates a configured waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier host: The host name to which the waiting room will be applied (no wildcards). Please do not include the scheme (http:// or https://). The host and path combination @@ -781,12 +785,12 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}", body=maybe_transform( { "host": host, @@ -815,15 +819,17 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoom]._unwrapper, ), cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) def list( self, - zone_identifier: str, *, + zone_id: str, + page: object | NotGiven = NOT_GIVEN, + per_page: object | 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, @@ -835,7 +841,11 @@ def list( Lists waiting rooms. Args: - zone_identifier: Identifier + zone_id: Identifier + + page: Page number of paginated results. + + per_page: Maximum number of results per page. Must be a multiple of 5. extra_headers: Send extra headers @@ -845,13 +855,23 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms", + f"/zones/{zone_id}/waiting_rooms", page=SyncSinglePage[WaitingRoom], 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, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + waiting_room_list_params.WaitingRoomListParams, + ), ), model=WaitingRoom, ) @@ -860,7 +880,8 @@ def delete( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -872,7 +893,7 @@ def delete( Deletes a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -882,18 +903,19 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}", + body=maybe_transform(body, waiting_room_delete_params.WaitingRoomDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoomDeleteResponse]._unwrapper, ), cast_to=cast(Type[WaitingRoomDeleteResponse], ResultWrapper[WaitingRoomDeleteResponse]), ) @@ -902,13 +924,13 @@ def edit( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, host: str, name: str, new_users_per_minute: int, total_active_users: int, - additional_routes: Iterable[waiting_room_edit_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_edit_params.CookieAttributes | NotGiven = NOT_GIVEN, + additional_routes: Iterable[AdditionalRoutesParam] | NotGiven = NOT_GIVEN, + cookie_attributes: CookieAttributesParam | NotGiven = NOT_GIVEN, cookie_suffix: str | NotGiven = NOT_GIVEN, custom_page_html: str | NotGiven = NOT_GIVEN, default_template_language: Literal[ @@ -951,7 +973,7 @@ def edit( Patches a configured waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier host: The host name to which the waiting room will be applied (no wildcards). Please do not include the scheme (http:// or https://). The host and path combination @@ -1217,12 +1239,12 @@ def edit( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}", body=maybe_transform( { "host": host, @@ -1251,7 +1273,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoom]._unwrapper, ), cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) @@ -1260,7 +1282,7 @@ def get( self, waiting_room_id: str, *, - zone_identifier: 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, @@ -1272,7 +1294,7 @@ def get( Fetches a single configured waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -1282,62 +1304,62 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoom]._unwrapper, ), cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) -class AsyncWaitingRooms(AsyncAPIResource): +class AsyncWaitingRoomsResource(AsyncAPIResource): @cached_property - def page(self) -> AsyncPage: - return AsyncPage(self._client) + def page(self) -> AsyncPageResource: + return AsyncPageResource(self._client) @cached_property - def events(self) -> AsyncEvents: - return AsyncEvents(self._client) + def events(self) -> AsyncEventsResource: + return AsyncEventsResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def statuses(self) -> AsyncStatuses: - return AsyncStatuses(self._client) + def statuses(self) -> AsyncStatusesResource: + return AsyncStatusesResource(self._client) @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncWaitingRoomsWithRawResponse: - return AsyncWaitingRoomsWithRawResponse(self) + def with_raw_response(self) -> AsyncWaitingRoomsResourceWithRawResponse: + return AsyncWaitingRoomsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWaitingRoomsWithStreamingResponse: - return AsyncWaitingRoomsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWaitingRoomsResourceWithStreamingResponse: + return AsyncWaitingRoomsResourceWithStreamingResponse(self) async def create( self, - zone_identifier: str, *, + zone_id: str, host: str, name: str, new_users_per_minute: int, total_active_users: int, - additional_routes: Iterable[waiting_room_create_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_create_params.CookieAttributes | NotGiven = NOT_GIVEN, + additional_routes: Iterable[AdditionalRoutesParam] | NotGiven = NOT_GIVEN, + cookie_attributes: CookieAttributesParam | NotGiven = NOT_GIVEN, cookie_suffix: str | NotGiven = NOT_GIVEN, custom_page_html: str | NotGiven = NOT_GIVEN, default_template_language: Literal[ @@ -1380,7 +1402,7 @@ async def create( Creates a new waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier host: The host name to which the waiting room will be applied (no wildcards). Please do not include the scheme (http:// or https://). The host and path combination @@ -1646,10 +1668,10 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms", + f"/zones/{zone_id}/waiting_rooms", body=await async_maybe_transform( { "host": host, @@ -1678,7 +1700,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoom]._unwrapper, ), cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) @@ -1687,13 +1709,13 @@ async def update( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, host: str, name: str, new_users_per_minute: int, total_active_users: int, - additional_routes: Iterable[waiting_room_update_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_update_params.CookieAttributes | NotGiven = NOT_GIVEN, + additional_routes: Iterable[AdditionalRoutesParam] | NotGiven = NOT_GIVEN, + cookie_attributes: CookieAttributesParam | NotGiven = NOT_GIVEN, cookie_suffix: str | NotGiven = NOT_GIVEN, custom_page_html: str | NotGiven = NOT_GIVEN, default_template_language: Literal[ @@ -1736,7 +1758,7 @@ async def update( Updates a configured waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier host: The host name to which the waiting room will be applied (no wildcards). Please do not include the scheme (http:// or https://). The host and path combination @@ -2002,12 +2024,12 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return await self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}", body=await async_maybe_transform( { "host": host, @@ -2036,15 +2058,17 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoom]._unwrapper, ), cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) def list( self, - zone_identifier: str, *, + zone_id: str, + page: object | NotGiven = NOT_GIVEN, + per_page: object | 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, @@ -2056,7 +2080,11 @@ def list( Lists waiting rooms. Args: - zone_identifier: Identifier + zone_id: Identifier + + page: Page number of paginated results. + + per_page: Maximum number of results per page. Must be a multiple of 5. extra_headers: Send extra headers @@ -2066,13 +2094,23 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + 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_identifier}/waiting_rooms", + f"/zones/{zone_id}/waiting_rooms", page=AsyncSinglePage[WaitingRoom], 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, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + waiting_room_list_params.WaitingRoomListParams, + ), ), model=WaitingRoom, ) @@ -2081,7 +2119,8 @@ async def delete( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2093,7 +2132,7 @@ async def delete( Deletes a waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -2103,18 +2142,19 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return await self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}", + body=await async_maybe_transform(body, waiting_room_delete_params.WaitingRoomDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoomDeleteResponse]._unwrapper, ), cast_to=cast(Type[WaitingRoomDeleteResponse], ResultWrapper[WaitingRoomDeleteResponse]), ) @@ -2123,13 +2163,13 @@ async def edit( self, waiting_room_id: str, *, - zone_identifier: str, + zone_id: str, host: str, name: str, new_users_per_minute: int, total_active_users: int, - additional_routes: Iterable[waiting_room_edit_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_edit_params.CookieAttributes | NotGiven = NOT_GIVEN, + additional_routes: Iterable[AdditionalRoutesParam] | NotGiven = NOT_GIVEN, + cookie_attributes: CookieAttributesParam | NotGiven = NOT_GIVEN, cookie_suffix: str | NotGiven = NOT_GIVEN, custom_page_html: str | NotGiven = NOT_GIVEN, default_template_language: Literal[ @@ -2172,7 +2212,7 @@ async def edit( Patches a configured waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier host: The host name to which the waiting room will be applied (no wildcards). Please do not include the scheme (http:// or https://). The host and path combination @@ -2438,12 +2478,12 @@ async def edit( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return await self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}", body=await async_maybe_transform( { "host": host, @@ -2472,7 +2512,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoom]._unwrapper, ), cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) @@ -2481,7 +2521,7 @@ async def get( self, waiting_room_id: str, *, - zone_identifier: 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, @@ -2493,7 +2533,7 @@ async def get( Fetches a single configured waiting room. Args: - zone_identifier: Identifier + zone_id: Identifier extra_headers: Send extra headers @@ -2503,25 +2543,25 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", + f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WaitingRoom]._unwrapper, ), cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) -class WaitingRoomsWithRawResponse: - def __init__(self, waiting_rooms: WaitingRooms) -> None: +class WaitingRoomsResourceWithRawResponse: + def __init__(self, waiting_rooms: WaitingRoomsResource) -> None: self._waiting_rooms = waiting_rooms self.create = to_raw_response_wrapper( @@ -2544,28 +2584,28 @@ def __init__(self, waiting_rooms: WaitingRooms) -> None: ) @cached_property - def page(self) -> PageWithRawResponse: - return PageWithRawResponse(self._waiting_rooms.page) + def page(self) -> PageResourceWithRawResponse: + return PageResourceWithRawResponse(self._waiting_rooms.page) @cached_property - def events(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self._waiting_rooms.events) + def events(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self._waiting_rooms.events) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._waiting_rooms.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._waiting_rooms.rules) @cached_property - def statuses(self) -> StatusesWithRawResponse: - return StatusesWithRawResponse(self._waiting_rooms.statuses) + def statuses(self) -> StatusesResourceWithRawResponse: + return StatusesResourceWithRawResponse(self._waiting_rooms.statuses) @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._waiting_rooms.settings) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._waiting_rooms.settings) -class AsyncWaitingRoomsWithRawResponse: - def __init__(self, waiting_rooms: AsyncWaitingRooms) -> None: +class AsyncWaitingRoomsResourceWithRawResponse: + def __init__(self, waiting_rooms: AsyncWaitingRoomsResource) -> None: self._waiting_rooms = waiting_rooms self.create = async_to_raw_response_wrapper( @@ -2588,28 +2628,28 @@ def __init__(self, waiting_rooms: AsyncWaitingRooms) -> None: ) @cached_property - def page(self) -> AsyncPageWithRawResponse: - return AsyncPageWithRawResponse(self._waiting_rooms.page) + def page(self) -> AsyncPageResourceWithRawResponse: + return AsyncPageResourceWithRawResponse(self._waiting_rooms.page) @cached_property - def events(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self._waiting_rooms.events) + def events(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self._waiting_rooms.events) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._waiting_rooms.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._waiting_rooms.rules) @cached_property - def statuses(self) -> AsyncStatusesWithRawResponse: - return AsyncStatusesWithRawResponse(self._waiting_rooms.statuses) + def statuses(self) -> AsyncStatusesResourceWithRawResponse: + return AsyncStatusesResourceWithRawResponse(self._waiting_rooms.statuses) @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._waiting_rooms.settings) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._waiting_rooms.settings) -class WaitingRoomsWithStreamingResponse: - def __init__(self, waiting_rooms: WaitingRooms) -> None: +class WaitingRoomsResourceWithStreamingResponse: + def __init__(self, waiting_rooms: WaitingRoomsResource) -> None: self._waiting_rooms = waiting_rooms self.create = to_streamed_response_wrapper( @@ -2632,28 +2672,28 @@ def __init__(self, waiting_rooms: WaitingRooms) -> None: ) @cached_property - def page(self) -> PageWithStreamingResponse: - return PageWithStreamingResponse(self._waiting_rooms.page) + def page(self) -> PageResourceWithStreamingResponse: + return PageResourceWithStreamingResponse(self._waiting_rooms.page) @cached_property - def events(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self._waiting_rooms.events) + def events(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self._waiting_rooms.events) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._waiting_rooms.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._waiting_rooms.rules) @cached_property - def statuses(self) -> StatusesWithStreamingResponse: - return StatusesWithStreamingResponse(self._waiting_rooms.statuses) + def statuses(self) -> StatusesResourceWithStreamingResponse: + return StatusesResourceWithStreamingResponse(self._waiting_rooms.statuses) @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._waiting_rooms.settings) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._waiting_rooms.settings) -class AsyncWaitingRoomsWithStreamingResponse: - def __init__(self, waiting_rooms: AsyncWaitingRooms) -> None: +class AsyncWaitingRoomsResourceWithStreamingResponse: + def __init__(self, waiting_rooms: AsyncWaitingRoomsResource) -> None: self._waiting_rooms = waiting_rooms self.create = async_to_streamed_response_wrapper( @@ -2676,21 +2716,21 @@ def __init__(self, waiting_rooms: AsyncWaitingRooms) -> None: ) @cached_property - def page(self) -> AsyncPageWithStreamingResponse: - return AsyncPageWithStreamingResponse(self._waiting_rooms.page) + def page(self) -> AsyncPageResourceWithStreamingResponse: + return AsyncPageResourceWithStreamingResponse(self._waiting_rooms.page) @cached_property - def events(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self._waiting_rooms.events) + def events(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self._waiting_rooms.events) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._waiting_rooms.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._waiting_rooms.rules) @cached_property - def statuses(self) -> AsyncStatusesWithStreamingResponse: - return AsyncStatusesWithStreamingResponse(self._waiting_rooms.statuses) + def statuses(self) -> AsyncStatusesResourceWithStreamingResponse: + return AsyncStatusesResourceWithStreamingResponse(self._waiting_rooms.statuses) @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._waiting_rooms.settings) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._waiting_rooms.settings) diff --git a/src/cloudflare/resources/warp_connector.py b/src/cloudflare/resources/warp_connector.py index 906122298aa..72aa5b4b7e4 100644 --- a/src/cloudflare/resources/warp_connector.py +++ b/src/cloudflare/resources/warp_connector.py @@ -7,18 +7,6 @@ import httpx -from ..types import ( - WARPConnectorGetResponse, - WARPConnectorEditResponse, - WARPConnectorListResponse, - WARPConnectorTokenResponse, - WARPConnectorCreateResponse, - WARPConnectorDeleteResponse, - warp_connector_edit_params, - warp_connector_list_params, - warp_connector_create_params, - warp_connector_delete_params, -) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -38,18 +26,30 @@ AsyncPaginator, make_request_options, ) +from ..types.warp_connector import ( + warp_connector_edit_params, + warp_connector_list_params, + warp_connector_create_params, + warp_connector_delete_params, +) +from ..types.warp_connector.warp_connector_get_response import WARPConnectorGetResponse +from ..types.warp_connector.warp_connector_edit_response import WARPConnectorEditResponse +from ..types.warp_connector.warp_connector_list_response import WARPConnectorListResponse +from ..types.warp_connector.warp_connector_token_response import WARPConnectorTokenResponse +from ..types.warp_connector.warp_connector_create_response import WARPConnectorCreateResponse +from ..types.warp_connector.warp_connector_delete_response import WARPConnectorDeleteResponse -__all__ = ["WARPConnector", "AsyncWARPConnector"] +__all__ = ["WARPConnectorResource", "AsyncWARPConnectorResource"] -class WARPConnector(SyncAPIResource): +class WARPConnectorResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WARPConnectorWithRawResponse: - return WARPConnectorWithRawResponse(self) + def with_raw_response(self) -> WARPConnectorResourceWithRawResponse: + return WARPConnectorResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WARPConnectorWithStreamingResponse: - return WARPConnectorWithStreamingResponse(self) + def with_streaming_response(self) -> WARPConnectorResourceWithStreamingResponse: + return WARPConnectorResourceWithStreamingResponse(self) def create( self, @@ -69,7 +69,7 @@ def create( Args: account_id: Cloudflare account ID - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. extra_headers: Send extra headers @@ -91,7 +91,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorCreateResponse] @@ -110,6 +110,7 @@ def list( name: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + uuid: str | NotGiven = NOT_GIVEN, was_active_at: Union[str, datetime] | NotGiven = NOT_GIVEN, was_inactive_at: Union[str, datetime] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -137,6 +138,8 @@ def list( per_page: Number of results to display. + uuid: UUID of the tunnel. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -164,6 +167,7 @@ def list( "name": name, "page": page, "per_page": per_page, + "uuid": uuid, "was_active_at": was_active_at, "was_inactive_at": was_inactive_at, }, @@ -218,7 +222,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorDeleteResponse] @@ -248,7 +252,7 @@ def edit( tunnel_id: UUID of the tunnel. - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. @@ -281,7 +285,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorEditResponse] @@ -330,7 +334,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorGetResponse] @@ -380,7 +384,7 @@ def token( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorTokenResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorTokenResponse] @@ -389,14 +393,14 @@ def token( ) -class AsyncWARPConnector(AsyncAPIResource): +class AsyncWARPConnectorResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWARPConnectorWithRawResponse: - return AsyncWARPConnectorWithRawResponse(self) + def with_raw_response(self) -> AsyncWARPConnectorResourceWithRawResponse: + return AsyncWARPConnectorResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWARPConnectorWithStreamingResponse: - return AsyncWARPConnectorWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWARPConnectorResourceWithStreamingResponse: + return AsyncWARPConnectorResourceWithStreamingResponse(self) async def create( self, @@ -416,7 +420,7 @@ async def create( Args: account_id: Cloudflare account ID - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. extra_headers: Send extra headers @@ -440,7 +444,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorCreateResponse] @@ -459,6 +463,7 @@ def list( name: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + uuid: str | NotGiven = NOT_GIVEN, was_active_at: Union[str, datetime] | NotGiven = NOT_GIVEN, was_inactive_at: Union[str, datetime] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -486,6 +491,8 @@ def list( per_page: Number of results to display. + uuid: UUID of the tunnel. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -513,6 +520,7 @@ def list( "name": name, "page": page, "per_page": per_page, + "uuid": uuid, "was_active_at": was_active_at, "was_inactive_at": was_inactive_at, }, @@ -567,7 +575,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorDeleteResponse] @@ -597,7 +605,7 @@ async def edit( tunnel_id: UUID of the tunnel. - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. @@ -630,7 +638,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorEditResponse] @@ -679,7 +687,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorGetResponse] @@ -729,7 +737,7 @@ async def token( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[WARPConnectorTokenResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[WARPConnectorTokenResponse] @@ -738,8 +746,8 @@ async def token( ) -class WARPConnectorWithRawResponse: - def __init__(self, warp_connector: WARPConnector) -> None: +class WARPConnectorResourceWithRawResponse: + def __init__(self, warp_connector: WARPConnectorResource) -> None: self._warp_connector = warp_connector self.create = to_raw_response_wrapper( @@ -762,8 +770,8 @@ def __init__(self, warp_connector: WARPConnector) -> None: ) -class AsyncWARPConnectorWithRawResponse: - def __init__(self, warp_connector: AsyncWARPConnector) -> None: +class AsyncWARPConnectorResourceWithRawResponse: + def __init__(self, warp_connector: AsyncWARPConnectorResource) -> None: self._warp_connector = warp_connector self.create = async_to_raw_response_wrapper( @@ -786,8 +794,8 @@ def __init__(self, warp_connector: AsyncWARPConnector) -> None: ) -class WARPConnectorWithStreamingResponse: - def __init__(self, warp_connector: WARPConnector) -> None: +class WARPConnectorResourceWithStreamingResponse: + def __init__(self, warp_connector: WARPConnectorResource) -> None: self._warp_connector = warp_connector self.create = to_streamed_response_wrapper( @@ -810,8 +818,8 @@ def __init__(self, warp_connector: WARPConnector) -> None: ) -class AsyncWARPConnectorWithStreamingResponse: - def __init__(self, warp_connector: AsyncWARPConnector) -> None: +class AsyncWARPConnectorResourceWithStreamingResponse: + def __init__(self, warp_connector: AsyncWARPConnectorResource) -> None: self._warp_connector = warp_connector self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/web3/__init__.py b/src/cloudflare/resources/web3/__init__.py index c80c98c61a8..584ed0c432c 100644 --- a/src/cloudflare/resources/web3/__init__.py +++ b/src/cloudflare/resources/web3/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .web3 import ( - Web3, - AsyncWeb3, - Web3WithRawResponse, - AsyncWeb3WithRawResponse, - Web3WithStreamingResponse, - AsyncWeb3WithStreamingResponse, + Web3Resource, + AsyncWeb3Resource, + Web3ResourceWithRawResponse, + AsyncWeb3ResourceWithRawResponse, + Web3ResourceWithStreamingResponse, + AsyncWeb3ResourceWithStreamingResponse, ) from .hostnames import ( - Hostnames, - AsyncHostnames, - HostnamesWithRawResponse, - AsyncHostnamesWithRawResponse, - HostnamesWithStreamingResponse, - AsyncHostnamesWithStreamingResponse, + HostnamesResource, + AsyncHostnamesResource, + HostnamesResourceWithRawResponse, + AsyncHostnamesResourceWithRawResponse, + HostnamesResourceWithStreamingResponse, + AsyncHostnamesResourceWithStreamingResponse, ) __all__ = [ - "Hostnames", - "AsyncHostnames", - "HostnamesWithRawResponse", - "AsyncHostnamesWithRawResponse", - "HostnamesWithStreamingResponse", - "AsyncHostnamesWithStreamingResponse", - "Web3", - "AsyncWeb3", - "Web3WithRawResponse", - "AsyncWeb3WithRawResponse", - "Web3WithStreamingResponse", - "AsyncWeb3WithStreamingResponse", + "HostnamesResource", + "AsyncHostnamesResource", + "HostnamesResourceWithRawResponse", + "AsyncHostnamesResourceWithRawResponse", + "HostnamesResourceWithStreamingResponse", + "AsyncHostnamesResourceWithStreamingResponse", + "Web3Resource", + "AsyncWeb3Resource", + "Web3ResourceWithRawResponse", + "AsyncWeb3ResourceWithRawResponse", + "Web3ResourceWithStreamingResponse", + "AsyncWeb3ResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/web3/hostnames/__init__.py b/src/cloudflare/resources/web3/hostnames/__init__.py index 2f967680c54..00e23f582c9 100644 --- a/src/cloudflare/resources/web3/hostnames/__init__.py +++ b/src/cloudflare/resources/web3/hostnames/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .hostnames import ( - Hostnames, - AsyncHostnames, - HostnamesWithRawResponse, - AsyncHostnamesWithRawResponse, - HostnamesWithStreamingResponse, - AsyncHostnamesWithStreamingResponse, + HostnamesResource, + AsyncHostnamesResource, + HostnamesResourceWithRawResponse, + AsyncHostnamesResourceWithRawResponse, + HostnamesResourceWithStreamingResponse, + AsyncHostnamesResourceWithStreamingResponse, ) from .ipfs_universal_paths import ( - IPFSUniversalPaths, - AsyncIPFSUniversalPaths, - IPFSUniversalPathsWithRawResponse, - AsyncIPFSUniversalPathsWithRawResponse, - IPFSUniversalPathsWithStreamingResponse, - AsyncIPFSUniversalPathsWithStreamingResponse, + IPFSUniversalPathsResource, + AsyncIPFSUniversalPathsResource, + IPFSUniversalPathsResourceWithRawResponse, + AsyncIPFSUniversalPathsResourceWithRawResponse, + IPFSUniversalPathsResourceWithStreamingResponse, + AsyncIPFSUniversalPathsResourceWithStreamingResponse, ) __all__ = [ - "IPFSUniversalPaths", - "AsyncIPFSUniversalPaths", - "IPFSUniversalPathsWithRawResponse", - "AsyncIPFSUniversalPathsWithRawResponse", - "IPFSUniversalPathsWithStreamingResponse", - "AsyncIPFSUniversalPathsWithStreamingResponse", - "Hostnames", - "AsyncHostnames", - "HostnamesWithRawResponse", - "AsyncHostnamesWithRawResponse", - "HostnamesWithStreamingResponse", - "AsyncHostnamesWithStreamingResponse", + "IPFSUniversalPathsResource", + "AsyncIPFSUniversalPathsResource", + "IPFSUniversalPathsResourceWithRawResponse", + "AsyncIPFSUniversalPathsResourceWithRawResponse", + "IPFSUniversalPathsResourceWithStreamingResponse", + "AsyncIPFSUniversalPathsResourceWithStreamingResponse", + "HostnamesResource", + "AsyncHostnamesResource", + "HostnamesResourceWithRawResponse", + "AsyncHostnamesResourceWithRawResponse", + "HostnamesResourceWithStreamingResponse", + "AsyncHostnamesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/web3/hostnames/hostnames.py b/src/cloudflare/resources/web3/hostnames/hostnames.py index 368e8f12e60..f4dd3aa6e91 100644 --- a/src/cloudflare/resources/web3/hostnames/hostnames.py +++ b/src/cloudflare/resources/web3/hostnames/hostnames.py @@ -22,36 +22,38 @@ ) from ...._wrappers import ResultWrapper from ....pagination import SyncSinglePage, AsyncSinglePage -from ....types.web3 import DistributedWebHostname, HostnameDeleteResponse, hostname_edit_params, hostname_create_params +from ....types.web3 import hostname_edit_params, hostname_create_params, hostname_delete_params from ...._base_client import ( AsyncPaginator, make_request_options, ) from .ipfs_universal_paths import ( - IPFSUniversalPaths, - AsyncIPFSUniversalPaths, - IPFSUniversalPathsWithRawResponse, - AsyncIPFSUniversalPathsWithRawResponse, - IPFSUniversalPathsWithStreamingResponse, - AsyncIPFSUniversalPathsWithStreamingResponse, + IPFSUniversalPathsResource, + AsyncIPFSUniversalPathsResource, + IPFSUniversalPathsResourceWithRawResponse, + AsyncIPFSUniversalPathsResourceWithRawResponse, + IPFSUniversalPathsResourceWithStreamingResponse, + AsyncIPFSUniversalPathsResourceWithStreamingResponse, ) -from .ipfs_universal_paths.ipfs_universal_paths import IPFSUniversalPaths, AsyncIPFSUniversalPaths +from ....types.web3.hostname import Hostname +from ....types.web3.hostname_delete_response import HostnameDeleteResponse +from .ipfs_universal_paths.ipfs_universal_paths import IPFSUniversalPathsResource, AsyncIPFSUniversalPathsResource -__all__ = ["Hostnames", "AsyncHostnames"] +__all__ = ["HostnamesResource", "AsyncHostnamesResource"] -class Hostnames(SyncAPIResource): +class HostnamesResource(SyncAPIResource): @cached_property - def ipfs_universal_paths(self) -> IPFSUniversalPaths: - return IPFSUniversalPaths(self._client) + def ipfs_universal_paths(self) -> IPFSUniversalPathsResource: + return IPFSUniversalPathsResource(self._client) @cached_property - def with_raw_response(self) -> HostnamesWithRawResponse: - return HostnamesWithRawResponse(self) + def with_raw_response(self) -> HostnamesResourceWithRawResponse: + return HostnamesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HostnamesWithStreamingResponse: - return HostnamesWithStreamingResponse(self) + def with_streaming_response(self) -> HostnamesResourceWithStreamingResponse: + return HostnamesResourceWithStreamingResponse(self) def create( self, @@ -66,7 +68,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebHostname: + ) -> Hostname: """ Create Web3 Hostname @@ -104,9 +106,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Hostname]._unwrapper, ), - cast_to=cast(Type[DistributedWebHostname], ResultWrapper[DistributedWebHostname]), + cast_to=cast(Type[Hostname], ResultWrapper[Hostname]), ) def list( @@ -119,7 +121,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DistributedWebHostname]: + ) -> SyncSinglePage[Hostname]: """ List Web3 Hostnames @@ -138,11 +140,11 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/web3/hostnames", - page=SyncSinglePage[DistributedWebHostname], + page=SyncSinglePage[Hostname], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DistributedWebHostname, + model=Hostname, ) def delete( @@ -150,6 +152,7 @@ def delete( identifier: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +182,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._delete( f"/zones/{zone_identifier}/web3/hostnames/{identifier}", + body=maybe_transform(body, hostname_delete_params.HostnameDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HostnameDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[HostnameDeleteResponse]], ResultWrapper[HostnameDeleteResponse]), ) @@ -202,7 +206,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebHostname: + ) -> Hostname: """ Edit Web3 Hostname @@ -241,9 +245,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Hostname]._unwrapper, ), - cast_to=cast(Type[DistributedWebHostname], ResultWrapper[DistributedWebHostname]), + cast_to=cast(Type[Hostname], ResultWrapper[Hostname]), ) def get( @@ -257,7 +261,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebHostname: + ) -> Hostname: """ Web3 Hostname Details @@ -285,24 +289,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Hostname]._unwrapper, ), - cast_to=cast(Type[DistributedWebHostname], ResultWrapper[DistributedWebHostname]), + cast_to=cast(Type[Hostname], ResultWrapper[Hostname]), ) -class AsyncHostnames(AsyncAPIResource): +class AsyncHostnamesResource(AsyncAPIResource): @cached_property - def ipfs_universal_paths(self) -> AsyncIPFSUniversalPaths: - return AsyncIPFSUniversalPaths(self._client) + def ipfs_universal_paths(self) -> AsyncIPFSUniversalPathsResource: + return AsyncIPFSUniversalPathsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncHostnamesWithRawResponse: - return AsyncHostnamesWithRawResponse(self) + def with_raw_response(self) -> AsyncHostnamesResourceWithRawResponse: + return AsyncHostnamesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHostnamesWithStreamingResponse: - return AsyncHostnamesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHostnamesResourceWithStreamingResponse: + return AsyncHostnamesResourceWithStreamingResponse(self) async def create( self, @@ -317,7 +321,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebHostname: + ) -> Hostname: """ Create Web3 Hostname @@ -355,9 +359,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Hostname]._unwrapper, ), - cast_to=cast(Type[DistributedWebHostname], ResultWrapper[DistributedWebHostname]), + cast_to=cast(Type[Hostname], ResultWrapper[Hostname]), ) def list( @@ -370,7 +374,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DistributedWebHostname, AsyncSinglePage[DistributedWebHostname]]: + ) -> AsyncPaginator[Hostname, AsyncSinglePage[Hostname]]: """ List Web3 Hostnames @@ -389,11 +393,11 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._get_api_list( f"/zones/{zone_identifier}/web3/hostnames", - page=AsyncSinglePage[DistributedWebHostname], + page=AsyncSinglePage[Hostname], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DistributedWebHostname, + model=Hostname, ) async def delete( @@ -401,6 +405,7 @@ async def delete( identifier: str, *, zone_identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -430,12 +435,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return await self._delete( f"/zones/{zone_identifier}/web3/hostnames/{identifier}", + body=await async_maybe_transform(body, hostname_delete_params.HostnameDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HostnameDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[HostnameDeleteResponse]], ResultWrapper[HostnameDeleteResponse]), ) @@ -453,7 +459,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebHostname: + ) -> Hostname: """ Edit Web3 Hostname @@ -492,9 +498,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Hostname]._unwrapper, ), - cast_to=cast(Type[DistributedWebHostname], ResultWrapper[DistributedWebHostname]), + cast_to=cast(Type[Hostname], ResultWrapper[Hostname]), ) async def get( @@ -508,7 +514,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebHostname: + ) -> Hostname: """ Web3 Hostname Details @@ -536,14 +542,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Hostname]._unwrapper, ), - cast_to=cast(Type[DistributedWebHostname], ResultWrapper[DistributedWebHostname]), + cast_to=cast(Type[Hostname], ResultWrapper[Hostname]), ) -class HostnamesWithRawResponse: - def __init__(self, hostnames: Hostnames) -> None: +class HostnamesResourceWithRawResponse: + def __init__(self, hostnames: HostnamesResource) -> None: self._hostnames = hostnames self.create = to_raw_response_wrapper( @@ -563,12 +569,12 @@ def __init__(self, hostnames: Hostnames) -> None: ) @cached_property - def ipfs_universal_paths(self) -> IPFSUniversalPathsWithRawResponse: - return IPFSUniversalPathsWithRawResponse(self._hostnames.ipfs_universal_paths) + def ipfs_universal_paths(self) -> IPFSUniversalPathsResourceWithRawResponse: + return IPFSUniversalPathsResourceWithRawResponse(self._hostnames.ipfs_universal_paths) -class AsyncHostnamesWithRawResponse: - def __init__(self, hostnames: AsyncHostnames) -> None: +class AsyncHostnamesResourceWithRawResponse: + def __init__(self, hostnames: AsyncHostnamesResource) -> None: self._hostnames = hostnames self.create = async_to_raw_response_wrapper( @@ -588,12 +594,12 @@ def __init__(self, hostnames: AsyncHostnames) -> None: ) @cached_property - def ipfs_universal_paths(self) -> AsyncIPFSUniversalPathsWithRawResponse: - return AsyncIPFSUniversalPathsWithRawResponse(self._hostnames.ipfs_universal_paths) + def ipfs_universal_paths(self) -> AsyncIPFSUniversalPathsResourceWithRawResponse: + return AsyncIPFSUniversalPathsResourceWithRawResponse(self._hostnames.ipfs_universal_paths) -class HostnamesWithStreamingResponse: - def __init__(self, hostnames: Hostnames) -> None: +class HostnamesResourceWithStreamingResponse: + def __init__(self, hostnames: HostnamesResource) -> None: self._hostnames = hostnames self.create = to_streamed_response_wrapper( @@ -613,12 +619,12 @@ def __init__(self, hostnames: Hostnames) -> None: ) @cached_property - def ipfs_universal_paths(self) -> IPFSUniversalPathsWithStreamingResponse: - return IPFSUniversalPathsWithStreamingResponse(self._hostnames.ipfs_universal_paths) + def ipfs_universal_paths(self) -> IPFSUniversalPathsResourceWithStreamingResponse: + return IPFSUniversalPathsResourceWithStreamingResponse(self._hostnames.ipfs_universal_paths) -class AsyncHostnamesWithStreamingResponse: - def __init__(self, hostnames: AsyncHostnames) -> None: +class AsyncHostnamesResourceWithStreamingResponse: + def __init__(self, hostnames: AsyncHostnamesResource) -> None: self._hostnames = hostnames self.create = async_to_streamed_response_wrapper( @@ -638,5 +644,5 @@ def __init__(self, hostnames: AsyncHostnames) -> None: ) @cached_property - def ipfs_universal_paths(self) -> AsyncIPFSUniversalPathsWithStreamingResponse: - return AsyncIPFSUniversalPathsWithStreamingResponse(self._hostnames.ipfs_universal_paths) + def ipfs_universal_paths(self) -> AsyncIPFSUniversalPathsResourceWithStreamingResponse: + return AsyncIPFSUniversalPathsResourceWithStreamingResponse(self._hostnames.ipfs_universal_paths) diff --git a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/__init__.py b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/__init__.py index a37b8814637..7be509cf9dd 100644 --- a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/__init__.py +++ b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .content_lists import ( - ContentLists, - AsyncContentLists, - ContentListsWithRawResponse, - AsyncContentListsWithRawResponse, - ContentListsWithStreamingResponse, - AsyncContentListsWithStreamingResponse, + ContentListsResource, + AsyncContentListsResource, + ContentListsResourceWithRawResponse, + AsyncContentListsResourceWithRawResponse, + ContentListsResourceWithStreamingResponse, + AsyncContentListsResourceWithStreamingResponse, ) from .ipfs_universal_paths import ( - IPFSUniversalPaths, - AsyncIPFSUniversalPaths, - IPFSUniversalPathsWithRawResponse, - AsyncIPFSUniversalPathsWithRawResponse, - IPFSUniversalPathsWithStreamingResponse, - AsyncIPFSUniversalPathsWithStreamingResponse, + IPFSUniversalPathsResource, + AsyncIPFSUniversalPathsResource, + IPFSUniversalPathsResourceWithRawResponse, + AsyncIPFSUniversalPathsResourceWithRawResponse, + IPFSUniversalPathsResourceWithStreamingResponse, + AsyncIPFSUniversalPathsResourceWithStreamingResponse, ) __all__ = [ - "ContentLists", - "AsyncContentLists", - "ContentListsWithRawResponse", - "AsyncContentListsWithRawResponse", - "ContentListsWithStreamingResponse", - "AsyncContentListsWithStreamingResponse", - "IPFSUniversalPaths", - "AsyncIPFSUniversalPaths", - "IPFSUniversalPathsWithRawResponse", - "AsyncIPFSUniversalPathsWithRawResponse", - "IPFSUniversalPathsWithStreamingResponse", - "AsyncIPFSUniversalPathsWithStreamingResponse", + "ContentListsResource", + "AsyncContentListsResource", + "ContentListsResourceWithRawResponse", + "AsyncContentListsResourceWithRawResponse", + "ContentListsResourceWithStreamingResponse", + "AsyncContentListsResourceWithStreamingResponse", + "IPFSUniversalPathsResource", + "AsyncIPFSUniversalPathsResource", + "IPFSUniversalPathsResourceWithRawResponse", + "AsyncIPFSUniversalPathsResourceWithRawResponse", + "IPFSUniversalPathsResourceWithStreamingResponse", + "AsyncIPFSUniversalPathsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/__init__.py b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/__init__.py index 48f2261cbf5..65385e07114 100644 --- a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/__init__.py +++ b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .entries import ( - Entries, - AsyncEntries, - EntriesWithRawResponse, - AsyncEntriesWithRawResponse, - EntriesWithStreamingResponse, - AsyncEntriesWithStreamingResponse, + EntriesResource, + AsyncEntriesResource, + EntriesResourceWithRawResponse, + AsyncEntriesResourceWithRawResponse, + EntriesResourceWithStreamingResponse, + AsyncEntriesResourceWithStreamingResponse, ) from .content_lists import ( - ContentLists, - AsyncContentLists, - ContentListsWithRawResponse, - AsyncContentListsWithRawResponse, - ContentListsWithStreamingResponse, - AsyncContentListsWithStreamingResponse, + ContentListsResource, + AsyncContentListsResource, + ContentListsResourceWithRawResponse, + AsyncContentListsResourceWithRawResponse, + ContentListsResourceWithStreamingResponse, + AsyncContentListsResourceWithStreamingResponse, ) __all__ = [ - "Entries", - "AsyncEntries", - "EntriesWithRawResponse", - "AsyncEntriesWithRawResponse", - "EntriesWithStreamingResponse", - "AsyncEntriesWithStreamingResponse", - "ContentLists", - "AsyncContentLists", - "ContentListsWithRawResponse", - "AsyncContentListsWithRawResponse", - "ContentListsWithStreamingResponse", - "AsyncContentListsWithStreamingResponse", + "EntriesResource", + "AsyncEntriesResource", + "EntriesResourceWithRawResponse", + "AsyncEntriesResourceWithRawResponse", + "EntriesResourceWithStreamingResponse", + "AsyncEntriesResourceWithStreamingResponse", + "ContentListsResource", + "AsyncContentListsResource", + "ContentListsResourceWithRawResponse", + "AsyncContentListsResourceWithRawResponse", + "ContentListsResourceWithStreamingResponse", + "AsyncContentListsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/content_lists.py b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/content_lists.py index c3119b5683d..d8c028bfc32 100644 --- a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/content_lists.py +++ b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/content_lists.py @@ -8,12 +8,12 @@ import httpx from .entries import ( - Entries, - AsyncEntries, - EntriesWithRawResponse, - AsyncEntriesWithRawResponse, - EntriesWithStreamingResponse, - AsyncEntriesWithStreamingResponse, + EntriesResource, + AsyncEntriesResource, + EntriesResourceWithRawResponse, + AsyncEntriesResourceWithRawResponse, + EntriesResourceWithStreamingResponse, + AsyncEntriesResourceWithStreamingResponse, ) from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven from ......_utils import ( @@ -32,24 +32,24 @@ from ......_base_client import ( make_request_options, ) -from ......types.web3.hostnames.ipfs_universal_paths import DistributedWebConfigContentList, content_list_update_params -from ......types.web3.hostnames.ipfs_universal_paths.content_lists import DistributedWebConfigContentListEntryParam +from ......types.web3.hostnames.ipfs_universal_paths import content_list_update_params +from ......types.web3.hostnames.ipfs_universal_paths.content_list import ContentList -__all__ = ["ContentLists", "AsyncContentLists"] +__all__ = ["ContentListsResource", "AsyncContentListsResource"] -class ContentLists(SyncAPIResource): +class ContentListsResource(SyncAPIResource): @cached_property - def entries(self) -> Entries: - return Entries(self._client) + def entries(self) -> EntriesResource: + return EntriesResource(self._client) @cached_property - def with_raw_response(self) -> ContentListsWithRawResponse: - return ContentListsWithRawResponse(self) + def with_raw_response(self) -> ContentListsResourceWithRawResponse: + return ContentListsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ContentListsWithStreamingResponse: - return ContentListsWithStreamingResponse(self) + def with_streaming_response(self) -> ContentListsResourceWithStreamingResponse: + return ContentListsResourceWithStreamingResponse(self) def update( self, @@ -57,14 +57,14 @@ def update( *, zone_identifier: str, action: Literal["block"], - entries: Iterable[DistributedWebConfigContentListEntryParam], + entries: Iterable[content_list_update_params.Entry], # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> DistributedWebConfigContentList: + ) -> ContentList: """ Update IPFS Universal Path Gateway Content List @@ -103,9 +103,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ContentList]._unwrapper, ), - cast_to=cast(Type[DistributedWebConfigContentList], ResultWrapper[DistributedWebConfigContentList]), + cast_to=cast(Type[ContentList], ResultWrapper[ContentList]), ) def get( @@ -119,7 +119,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebConfigContentList: + ) -> ContentList: """ IPFS Universal Path Gateway Content List Details @@ -147,24 +147,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ContentList]._unwrapper, ), - cast_to=cast(Type[DistributedWebConfigContentList], ResultWrapper[DistributedWebConfigContentList]), + cast_to=cast(Type[ContentList], ResultWrapper[ContentList]), ) -class AsyncContentLists(AsyncAPIResource): +class AsyncContentListsResource(AsyncAPIResource): @cached_property - def entries(self) -> AsyncEntries: - return AsyncEntries(self._client) + def entries(self) -> AsyncEntriesResource: + return AsyncEntriesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncContentListsWithRawResponse: - return AsyncContentListsWithRawResponse(self) + def with_raw_response(self) -> AsyncContentListsResourceWithRawResponse: + return AsyncContentListsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncContentListsWithStreamingResponse: - return AsyncContentListsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncContentListsResourceWithStreamingResponse: + return AsyncContentListsResourceWithStreamingResponse(self) async def update( self, @@ -172,14 +172,14 @@ async def update( *, zone_identifier: str, action: Literal["block"], - entries: Iterable[DistributedWebConfigContentListEntryParam], + entries: Iterable[content_list_update_params.Entry], # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> DistributedWebConfigContentList: + ) -> ContentList: """ Update IPFS Universal Path Gateway Content List @@ -218,9 +218,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ContentList]._unwrapper, ), - cast_to=cast(Type[DistributedWebConfigContentList], ResultWrapper[DistributedWebConfigContentList]), + cast_to=cast(Type[ContentList], ResultWrapper[ContentList]), ) async def get( @@ -234,7 +234,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebConfigContentList: + ) -> ContentList: """ IPFS Universal Path Gateway Content List Details @@ -262,14 +262,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ContentList]._unwrapper, ), - cast_to=cast(Type[DistributedWebConfigContentList], ResultWrapper[DistributedWebConfigContentList]), + cast_to=cast(Type[ContentList], ResultWrapper[ContentList]), ) -class ContentListsWithRawResponse: - def __init__(self, content_lists: ContentLists) -> None: +class ContentListsResourceWithRawResponse: + def __init__(self, content_lists: ContentListsResource) -> None: self._content_lists = content_lists self.update = to_raw_response_wrapper( @@ -280,12 +280,12 @@ def __init__(self, content_lists: ContentLists) -> None: ) @cached_property - def entries(self) -> EntriesWithRawResponse: - return EntriesWithRawResponse(self._content_lists.entries) + def entries(self) -> EntriesResourceWithRawResponse: + return EntriesResourceWithRawResponse(self._content_lists.entries) -class AsyncContentListsWithRawResponse: - def __init__(self, content_lists: AsyncContentLists) -> None: +class AsyncContentListsResourceWithRawResponse: + def __init__(self, content_lists: AsyncContentListsResource) -> None: self._content_lists = content_lists self.update = async_to_raw_response_wrapper( @@ -296,12 +296,12 @@ def __init__(self, content_lists: AsyncContentLists) -> None: ) @cached_property - def entries(self) -> AsyncEntriesWithRawResponse: - return AsyncEntriesWithRawResponse(self._content_lists.entries) + def entries(self) -> AsyncEntriesResourceWithRawResponse: + return AsyncEntriesResourceWithRawResponse(self._content_lists.entries) -class ContentListsWithStreamingResponse: - def __init__(self, content_lists: ContentLists) -> None: +class ContentListsResourceWithStreamingResponse: + def __init__(self, content_lists: ContentListsResource) -> None: self._content_lists = content_lists self.update = to_streamed_response_wrapper( @@ -312,12 +312,12 @@ def __init__(self, content_lists: ContentLists) -> None: ) @cached_property - def entries(self) -> EntriesWithStreamingResponse: - return EntriesWithStreamingResponse(self._content_lists.entries) + def entries(self) -> EntriesResourceWithStreamingResponse: + return EntriesResourceWithStreamingResponse(self._content_lists.entries) -class AsyncContentListsWithStreamingResponse: - def __init__(self, content_lists: AsyncContentLists) -> None: +class AsyncContentListsResourceWithStreamingResponse: + def __init__(self, content_lists: AsyncContentListsResource) -> None: self._content_lists = content_lists self.update = async_to_streamed_response_wrapper( @@ -328,5 +328,5 @@ def __init__(self, content_lists: AsyncContentLists) -> None: ) @cached_property - def entries(self) -> AsyncEntriesWithStreamingResponse: - return AsyncEntriesWithStreamingResponse(self._content_lists.entries) + def entries(self) -> AsyncEntriesResourceWithStreamingResponse: + return AsyncEntriesResourceWithStreamingResponse(self._content_lists.entries) diff --git a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/entries.py b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/entries.py index 5c3b41f76dd..7bb201431cd 100644 --- a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/entries.py +++ b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/content_lists/entries.py @@ -25,24 +25,27 @@ make_request_options, ) from ......types.web3.hostnames.ipfs_universal_paths.content_lists import ( - EntryListResponse, - EntryDeleteResponse, - DistributedWebConfigContentListEntry, entry_create_params, + entry_delete_params, entry_update_params, ) +from ......types.web3.hostnames.ipfs_universal_paths.content_lists.entry_get_response import EntryGetResponse +from ......types.web3.hostnames.ipfs_universal_paths.content_lists.entry_list_response import EntryListResponse +from ......types.web3.hostnames.ipfs_universal_paths.content_lists.entry_create_response import EntryCreateResponse +from ......types.web3.hostnames.ipfs_universal_paths.content_lists.entry_delete_response import EntryDeleteResponse +from ......types.web3.hostnames.ipfs_universal_paths.content_lists.entry_update_response import EntryUpdateResponse -__all__ = ["Entries", "AsyncEntries"] +__all__ = ["EntriesResource", "AsyncEntriesResource"] -class Entries(SyncAPIResource): +class EntriesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> EntriesWithRawResponse: - return EntriesWithRawResponse(self) + def with_raw_response(self) -> EntriesResourceWithRawResponse: + return EntriesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EntriesWithStreamingResponse: - return EntriesWithStreamingResponse(self) + def with_streaming_response(self) -> EntriesResourceWithStreamingResponse: + return EntriesResourceWithStreamingResponse(self) def create( self, @@ -58,7 +61,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebConfigContentListEntry: + ) -> EntryCreateResponse: """ Create IPFS Universal Path Gateway Content List Entry @@ -100,11 +103,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DistributedWebConfigContentListEntry], ResultWrapper[DistributedWebConfigContentListEntry] + post_parser=ResultWrapper[EntryCreateResponse]._unwrapper, ), + cast_to=cast(Type[EntryCreateResponse], ResultWrapper[EntryCreateResponse]), ) def update( @@ -122,7 +123,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebConfigContentListEntry: + ) -> EntryUpdateResponse: """ Edit IPFS Universal Path Gateway Content List Entry @@ -170,11 +171,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DistributedWebConfigContentListEntry], ResultWrapper[DistributedWebConfigContentListEntry] + post_parser=ResultWrapper[EntryUpdateResponse]._unwrapper, ), + cast_to=cast(Type[EntryUpdateResponse], ResultWrapper[EntryUpdateResponse]), ) def list( @@ -216,7 +215,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EntryListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[EntryListResponse]], ResultWrapper[EntryListResponse]), ) @@ -227,6 +226,7 @@ def delete( *, zone_identifier: str, identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -262,12 +262,13 @@ def delete( ) return self._delete( f"/zones/{zone_identifier}/web3/hostnames/{identifier}/ipfs_universal_path/content_list/entries/{content_list_entry_identifier}", + body=maybe_transform(body, entry_delete_params.EntryDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EntryDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[EntryDeleteResponse]], ResultWrapper[EntryDeleteResponse]), ) @@ -284,7 +285,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebConfigContentListEntry: + ) -> EntryGetResponse: """ IPFS Universal Path Gateway Content List Entry Details @@ -318,22 +319,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DistributedWebConfigContentListEntry], ResultWrapper[DistributedWebConfigContentListEntry] + post_parser=ResultWrapper[EntryGetResponse]._unwrapper, ), + cast_to=cast(Type[EntryGetResponse], ResultWrapper[EntryGetResponse]), ) -class AsyncEntries(AsyncAPIResource): +class AsyncEntriesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncEntriesWithRawResponse: - return AsyncEntriesWithRawResponse(self) + def with_raw_response(self) -> AsyncEntriesResourceWithRawResponse: + return AsyncEntriesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEntriesWithStreamingResponse: - return AsyncEntriesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEntriesResourceWithStreamingResponse: + return AsyncEntriesResourceWithStreamingResponse(self) async def create( self, @@ -349,7 +348,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebConfigContentListEntry: + ) -> EntryCreateResponse: """ Create IPFS Universal Path Gateway Content List Entry @@ -391,11 +390,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DistributedWebConfigContentListEntry], ResultWrapper[DistributedWebConfigContentListEntry] + post_parser=ResultWrapper[EntryCreateResponse]._unwrapper, ), + cast_to=cast(Type[EntryCreateResponse], ResultWrapper[EntryCreateResponse]), ) async def update( @@ -413,7 +410,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebConfigContentListEntry: + ) -> EntryUpdateResponse: """ Edit IPFS Universal Path Gateway Content List Entry @@ -461,11 +458,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DistributedWebConfigContentListEntry], ResultWrapper[DistributedWebConfigContentListEntry] + post_parser=ResultWrapper[EntryUpdateResponse]._unwrapper, ), + cast_to=cast(Type[EntryUpdateResponse], ResultWrapper[EntryUpdateResponse]), ) async def list( @@ -507,7 +502,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EntryListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[EntryListResponse]], ResultWrapper[EntryListResponse]), ) @@ -518,6 +513,7 @@ async def delete( *, zone_identifier: str, identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -553,12 +549,13 @@ async def delete( ) return await self._delete( f"/zones/{zone_identifier}/web3/hostnames/{identifier}/ipfs_universal_path/content_list/entries/{content_list_entry_identifier}", + body=await async_maybe_transform(body, entry_delete_params.EntryDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EntryDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[EntryDeleteResponse]], ResultWrapper[EntryDeleteResponse]), ) @@ -575,7 +572,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DistributedWebConfigContentListEntry: + ) -> EntryGetResponse: """ IPFS Universal Path Gateway Content List Entry Details @@ -609,16 +606,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DistributedWebConfigContentListEntry], ResultWrapper[DistributedWebConfigContentListEntry] + post_parser=ResultWrapper[EntryGetResponse]._unwrapper, ), + cast_to=cast(Type[EntryGetResponse], ResultWrapper[EntryGetResponse]), ) -class EntriesWithRawResponse: - def __init__(self, entries: Entries) -> None: +class EntriesResourceWithRawResponse: + def __init__(self, entries: EntriesResource) -> None: self._entries = entries self.create = to_raw_response_wrapper( @@ -638,8 +633,8 @@ def __init__(self, entries: Entries) -> None: ) -class AsyncEntriesWithRawResponse: - def __init__(self, entries: AsyncEntries) -> None: +class AsyncEntriesResourceWithRawResponse: + def __init__(self, entries: AsyncEntriesResource) -> None: self._entries = entries self.create = async_to_raw_response_wrapper( @@ -659,8 +654,8 @@ def __init__(self, entries: AsyncEntries) -> None: ) -class EntriesWithStreamingResponse: - def __init__(self, entries: Entries) -> None: +class EntriesResourceWithStreamingResponse: + def __init__(self, entries: EntriesResource) -> None: self._entries = entries self.create = to_streamed_response_wrapper( @@ -680,8 +675,8 @@ def __init__(self, entries: Entries) -> None: ) -class AsyncEntriesWithStreamingResponse: - def __init__(self, entries: AsyncEntries) -> None: +class AsyncEntriesResourceWithStreamingResponse: + def __init__(self, entries: AsyncEntriesResource) -> None: self._entries = entries self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/ipfs_universal_paths.py b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/ipfs_universal_paths.py index 3530470b001..d47da398b84 100644 --- a/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/ipfs_universal_paths.py +++ b/src/cloudflare/resources/web3/hostnames/ipfs_universal_paths/ipfs_universal_paths.py @@ -5,77 +5,77 @@ from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from .content_lists import ( - ContentLists, - AsyncContentLists, - ContentListsWithRawResponse, - AsyncContentListsWithRawResponse, - ContentListsWithStreamingResponse, - AsyncContentListsWithStreamingResponse, + ContentListsResource, + AsyncContentListsResource, + ContentListsResourceWithRawResponse, + AsyncContentListsResourceWithRawResponse, + ContentListsResourceWithStreamingResponse, + AsyncContentListsResourceWithStreamingResponse, ) -from .content_lists.content_lists import ContentLists, AsyncContentLists +from .content_lists.content_lists import ContentListsResource, AsyncContentListsResource -__all__ = ["IPFSUniversalPaths", "AsyncIPFSUniversalPaths"] +__all__ = ["IPFSUniversalPathsResource", "AsyncIPFSUniversalPathsResource"] -class IPFSUniversalPaths(SyncAPIResource): +class IPFSUniversalPathsResource(SyncAPIResource): @cached_property - def content_lists(self) -> ContentLists: - return ContentLists(self._client) + def content_lists(self) -> ContentListsResource: + return ContentListsResource(self._client) @cached_property - def with_raw_response(self) -> IPFSUniversalPathsWithRawResponse: - return IPFSUniversalPathsWithRawResponse(self) + def with_raw_response(self) -> IPFSUniversalPathsResourceWithRawResponse: + return IPFSUniversalPathsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPFSUniversalPathsWithStreamingResponse: - return IPFSUniversalPathsWithStreamingResponse(self) + def with_streaming_response(self) -> IPFSUniversalPathsResourceWithStreamingResponse: + return IPFSUniversalPathsResourceWithStreamingResponse(self) -class AsyncIPFSUniversalPaths(AsyncAPIResource): +class AsyncIPFSUniversalPathsResource(AsyncAPIResource): @cached_property - def content_lists(self) -> AsyncContentLists: - return AsyncContentLists(self._client) + def content_lists(self) -> AsyncContentListsResource: + return AsyncContentListsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncIPFSUniversalPathsWithRawResponse: - return AsyncIPFSUniversalPathsWithRawResponse(self) + def with_raw_response(self) -> AsyncIPFSUniversalPathsResourceWithRawResponse: + return AsyncIPFSUniversalPathsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPFSUniversalPathsWithStreamingResponse: - return AsyncIPFSUniversalPathsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPFSUniversalPathsResourceWithStreamingResponse: + return AsyncIPFSUniversalPathsResourceWithStreamingResponse(self) -class IPFSUniversalPathsWithRawResponse: - def __init__(self, ipfs_universal_paths: IPFSUniversalPaths) -> None: +class IPFSUniversalPathsResourceWithRawResponse: + def __init__(self, ipfs_universal_paths: IPFSUniversalPathsResource) -> None: self._ipfs_universal_paths = ipfs_universal_paths @cached_property - def content_lists(self) -> ContentListsWithRawResponse: - return ContentListsWithRawResponse(self._ipfs_universal_paths.content_lists) + def content_lists(self) -> ContentListsResourceWithRawResponse: + return ContentListsResourceWithRawResponse(self._ipfs_universal_paths.content_lists) -class AsyncIPFSUniversalPathsWithRawResponse: - def __init__(self, ipfs_universal_paths: AsyncIPFSUniversalPaths) -> None: +class AsyncIPFSUniversalPathsResourceWithRawResponse: + def __init__(self, ipfs_universal_paths: AsyncIPFSUniversalPathsResource) -> None: self._ipfs_universal_paths = ipfs_universal_paths @cached_property - def content_lists(self) -> AsyncContentListsWithRawResponse: - return AsyncContentListsWithRawResponse(self._ipfs_universal_paths.content_lists) + def content_lists(self) -> AsyncContentListsResourceWithRawResponse: + return AsyncContentListsResourceWithRawResponse(self._ipfs_universal_paths.content_lists) -class IPFSUniversalPathsWithStreamingResponse: - def __init__(self, ipfs_universal_paths: IPFSUniversalPaths) -> None: +class IPFSUniversalPathsResourceWithStreamingResponse: + def __init__(self, ipfs_universal_paths: IPFSUniversalPathsResource) -> None: self._ipfs_universal_paths = ipfs_universal_paths @cached_property - def content_lists(self) -> ContentListsWithStreamingResponse: - return ContentListsWithStreamingResponse(self._ipfs_universal_paths.content_lists) + def content_lists(self) -> ContentListsResourceWithStreamingResponse: + return ContentListsResourceWithStreamingResponse(self._ipfs_universal_paths.content_lists) -class AsyncIPFSUniversalPathsWithStreamingResponse: - def __init__(self, ipfs_universal_paths: AsyncIPFSUniversalPaths) -> None: +class AsyncIPFSUniversalPathsResourceWithStreamingResponse: + def __init__(self, ipfs_universal_paths: AsyncIPFSUniversalPathsResource) -> None: self._ipfs_universal_paths = ipfs_universal_paths @cached_property - def content_lists(self) -> AsyncContentListsWithStreamingResponse: - return AsyncContentListsWithStreamingResponse(self._ipfs_universal_paths.content_lists) + def content_lists(self) -> AsyncContentListsResourceWithStreamingResponse: + return AsyncContentListsResourceWithStreamingResponse(self._ipfs_universal_paths.content_lists) diff --git a/src/cloudflare/resources/web3/web3.py b/src/cloudflare/resources/web3/web3.py index 43868c6b5d9..642a8781cd1 100644 --- a/src/cloudflare/resources/web3/web3.py +++ b/src/cloudflare/resources/web3/web3.py @@ -4,78 +4,78 @@ from ..._compat import cached_property from .hostnames import ( - Hostnames, - AsyncHostnames, - HostnamesWithRawResponse, - AsyncHostnamesWithRawResponse, - HostnamesWithStreamingResponse, - AsyncHostnamesWithStreamingResponse, + HostnamesResource, + AsyncHostnamesResource, + HostnamesResourceWithRawResponse, + AsyncHostnamesResourceWithRawResponse, + HostnamesResourceWithStreamingResponse, + AsyncHostnamesResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .hostnames.hostnames import Hostnames, AsyncHostnames +from .hostnames.hostnames import HostnamesResource, AsyncHostnamesResource -__all__ = ["Web3", "AsyncWeb3"] +__all__ = ["Web3Resource", "AsyncWeb3Resource"] -class Web3(SyncAPIResource): +class Web3Resource(SyncAPIResource): @cached_property - def hostnames(self) -> Hostnames: - return Hostnames(self._client) + def hostnames(self) -> HostnamesResource: + return HostnamesResource(self._client) @cached_property - def with_raw_response(self) -> Web3WithRawResponse: - return Web3WithRawResponse(self) + def with_raw_response(self) -> Web3ResourceWithRawResponse: + return Web3ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> Web3WithStreamingResponse: - return Web3WithStreamingResponse(self) + def with_streaming_response(self) -> Web3ResourceWithStreamingResponse: + return Web3ResourceWithStreamingResponse(self) -class AsyncWeb3(AsyncAPIResource): +class AsyncWeb3Resource(AsyncAPIResource): @cached_property - def hostnames(self) -> AsyncHostnames: - return AsyncHostnames(self._client) + def hostnames(self) -> AsyncHostnamesResource: + return AsyncHostnamesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncWeb3WithRawResponse: - return AsyncWeb3WithRawResponse(self) + def with_raw_response(self) -> AsyncWeb3ResourceWithRawResponse: + return AsyncWeb3ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWeb3WithStreamingResponse: - return AsyncWeb3WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWeb3ResourceWithStreamingResponse: + return AsyncWeb3ResourceWithStreamingResponse(self) -class Web3WithRawResponse: - def __init__(self, web3: Web3) -> None: +class Web3ResourceWithRawResponse: + def __init__(self, web3: Web3Resource) -> None: self._web3 = web3 @cached_property - def hostnames(self) -> HostnamesWithRawResponse: - return HostnamesWithRawResponse(self._web3.hostnames) + def hostnames(self) -> HostnamesResourceWithRawResponse: + return HostnamesResourceWithRawResponse(self._web3.hostnames) -class AsyncWeb3WithRawResponse: - def __init__(self, web3: AsyncWeb3) -> None: +class AsyncWeb3ResourceWithRawResponse: + def __init__(self, web3: AsyncWeb3Resource) -> None: self._web3 = web3 @cached_property - def hostnames(self) -> AsyncHostnamesWithRawResponse: - return AsyncHostnamesWithRawResponse(self._web3.hostnames) + def hostnames(self) -> AsyncHostnamesResourceWithRawResponse: + return AsyncHostnamesResourceWithRawResponse(self._web3.hostnames) -class Web3WithStreamingResponse: - def __init__(self, web3: Web3) -> None: +class Web3ResourceWithStreamingResponse: + def __init__(self, web3: Web3Resource) -> None: self._web3 = web3 @cached_property - def hostnames(self) -> HostnamesWithStreamingResponse: - return HostnamesWithStreamingResponse(self._web3.hostnames) + def hostnames(self) -> HostnamesResourceWithStreamingResponse: + return HostnamesResourceWithStreamingResponse(self._web3.hostnames) -class AsyncWeb3WithStreamingResponse: - def __init__(self, web3: AsyncWeb3) -> None: +class AsyncWeb3ResourceWithStreamingResponse: + def __init__(self, web3: AsyncWeb3Resource) -> None: self._web3 = web3 @cached_property - def hostnames(self) -> AsyncHostnamesWithStreamingResponse: - return AsyncHostnamesWithStreamingResponse(self._web3.hostnames) + def hostnames(self) -> AsyncHostnamesResourceWithStreamingResponse: + return AsyncHostnamesResourceWithStreamingResponse(self._web3.hostnames) diff --git a/src/cloudflare/resources/workers/__init__.py b/src/cloudflare/resources/workers/__init__.py index 031bbab828a..fd4a31df9d7 100644 --- a/src/cloudflare/resources/workers/__init__.py +++ b/src/cloudflare/resources/workers/__init__.py @@ -1,145 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .ai import ( - AI, - AsyncAI, - AIWithRawResponse, - AsyncAIWithRawResponse, - AIWithStreamingResponse, - AsyncAIWithStreamingResponse, -) -from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + AIResource, + AsyncAIResource, + AIResourceWithRawResponse, + AsyncAIResourceWithRawResponse, + AIResourceWithStreamingResponse, + AsyncAIResourceWithStreamingResponse, ) from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, -) -from .filters import ( - Filters, - AsyncFilters, - FiltersWithRawResponse, - AsyncFiltersWithRawResponse, - FiltersWithStreamingResponse, - AsyncFiltersWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, + ScriptsResource, + AsyncScriptsResource, + ScriptsResourceWithRawResponse, + AsyncScriptsResourceWithRawResponse, + ScriptsResourceWithStreamingResponse, + AsyncScriptsResourceWithStreamingResponse, ) from .workers import ( - Workers, - AsyncWorkers, - WorkersWithRawResponse, - AsyncWorkersWithRawResponse, - WorkersWithStreamingResponse, - AsyncWorkersWithStreamingResponse, -) -from .services import ( - Services, - AsyncServices, - ServicesWithRawResponse, - AsyncServicesWithRawResponse, - ServicesWithStreamingResponse, - AsyncServicesWithStreamingResponse, + WorkersResource, + AsyncWorkersResource, + WorkersResourceWithRawResponse, + AsyncWorkersResourceWithRawResponse, + WorkersResourceWithStreamingResponse, + AsyncWorkersResourceWithStreamingResponse, ) from .subdomains import ( - Subdomains, - AsyncSubdomains, - SubdomainsWithRawResponse, - AsyncSubdomainsWithRawResponse, - SubdomainsWithStreamingResponse, - AsyncSubdomainsWithStreamingResponse, -) -from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, + SubdomainsResource, + AsyncSubdomainsResource, + SubdomainsResourceWithRawResponse, + AsyncSubdomainsResourceWithRawResponse, + SubdomainsResourceWithStreamingResponse, + AsyncSubdomainsResourceWithStreamingResponse, ) from .account_settings import ( - AccountSettings, - AsyncAccountSettings, - AccountSettingsWithRawResponse, - AsyncAccountSettingsWithRawResponse, - AccountSettingsWithStreamingResponse, - AsyncAccountSettingsWithStreamingResponse, + AccountSettingsResource, + AsyncAccountSettingsResource, + AccountSettingsResourceWithRawResponse, + AsyncAccountSettingsResourceWithRawResponse, + AccountSettingsResourceWithStreamingResponse, + AsyncAccountSettingsResourceWithStreamingResponse, ) __all__ = [ - "AI", - "AsyncAI", - "AIWithRawResponse", - "AsyncAIWithRawResponse", - "AIWithStreamingResponse", - "AsyncAIWithStreamingResponse", - "Scripts", - "AsyncScripts", - "ScriptsWithRawResponse", - "AsyncScriptsWithRawResponse", - "ScriptsWithStreamingResponse", - "AsyncScriptsWithStreamingResponse", - "Filters", - "AsyncFilters", - "FiltersWithRawResponse", - "AsyncFiltersWithRawResponse", - "FiltersWithStreamingResponse", - "AsyncFiltersWithStreamingResponse", - "Routes", - "AsyncRoutes", - "RoutesWithRawResponse", - "AsyncRoutesWithRawResponse", - "RoutesWithStreamingResponse", - "AsyncRoutesWithStreamingResponse", - "AccountSettings", - "AsyncAccountSettings", - "AccountSettingsWithRawResponse", - "AsyncAccountSettingsWithRawResponse", - "AccountSettingsWithStreamingResponse", - "AsyncAccountSettingsWithStreamingResponse", - "Deployments", - "AsyncDeployments", - "DeploymentsWithRawResponse", - "AsyncDeploymentsWithRawResponse", - "DeploymentsWithStreamingResponse", - "AsyncDeploymentsWithStreamingResponse", - "Domains", - "AsyncDomains", - "DomainsWithRawResponse", - "AsyncDomainsWithRawResponse", - "DomainsWithStreamingResponse", - "AsyncDomainsWithStreamingResponse", - "Subdomains", - "AsyncSubdomains", - "SubdomainsWithRawResponse", - "AsyncSubdomainsWithRawResponse", - "SubdomainsWithStreamingResponse", - "AsyncSubdomainsWithStreamingResponse", - "Services", - "AsyncServices", - "ServicesWithRawResponse", - "AsyncServicesWithRawResponse", - "ServicesWithStreamingResponse", - "AsyncServicesWithStreamingResponse", - "Workers", - "AsyncWorkers", - "WorkersWithRawResponse", - "AsyncWorkersWithRawResponse", - "WorkersWithStreamingResponse", - "AsyncWorkersWithStreamingResponse", + "AIResource", + "AsyncAIResource", + "AIResourceWithRawResponse", + "AsyncAIResourceWithRawResponse", + "AIResourceWithStreamingResponse", + "AsyncAIResourceWithStreamingResponse", + "ScriptsResource", + "AsyncScriptsResource", + "ScriptsResourceWithRawResponse", + "AsyncScriptsResourceWithRawResponse", + "ScriptsResourceWithStreamingResponse", + "AsyncScriptsResourceWithStreamingResponse", + "AccountSettingsResource", + "AsyncAccountSettingsResource", + "AccountSettingsResourceWithRawResponse", + "AsyncAccountSettingsResourceWithRawResponse", + "AccountSettingsResourceWithStreamingResponse", + "AsyncAccountSettingsResourceWithStreamingResponse", + "DomainsResource", + "AsyncDomainsResource", + "DomainsResourceWithRawResponse", + "AsyncDomainsResourceWithRawResponse", + "DomainsResourceWithStreamingResponse", + "AsyncDomainsResourceWithStreamingResponse", + "SubdomainsResource", + "AsyncSubdomainsResource", + "SubdomainsResourceWithRawResponse", + "AsyncSubdomainsResourceWithRawResponse", + "SubdomainsResourceWithStreamingResponse", + "AsyncSubdomainsResourceWithStreamingResponse", + "WorkersResource", + "AsyncWorkersResource", + "WorkersResourceWithRawResponse", + "AsyncWorkersResourceWithRawResponse", + "WorkersResourceWithStreamingResponse", + "AsyncWorkersResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/workers/account_settings.py b/src/cloudflare/resources/workers/account_settings.py index 562a83c49c4..ed3dea6115c 100644 --- a/src/cloudflare/resources/workers/account_settings.py +++ b/src/cloudflare/resources/workers/account_settings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.workers import AccountSettingGetResponse, AccountSettingUpdateResponse, account_setting_update_params +from ...types.workers import account_setting_update_params +from ...types.workers.account_setting_get_response import AccountSettingGetResponse +from ...types.workers.account_setting_update_response import AccountSettingUpdateResponse -__all__ = ["AccountSettings", "AsyncAccountSettings"] +__all__ = ["AccountSettingsResource", "AsyncAccountSettingsResource"] -class AccountSettings(SyncAPIResource): +class AccountSettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountSettingsWithRawResponse: - return AccountSettingsWithRawResponse(self) + def with_raw_response(self) -> AccountSettingsResourceWithRawResponse: + return AccountSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountSettingsWithStreamingResponse: - return AccountSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AccountSettingsResourceWithStreamingResponse: + return AccountSettingsResourceWithStreamingResponse(self) def update( self, @@ -48,7 +50,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountSettingUpdateResponse: + ) -> Optional[AccountSettingUpdateResponse]: """ Creates Worker account settings for an account. @@ -73,9 +75,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AccountSettingUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[AccountSettingUpdateResponse], ResultWrapper[AccountSettingUpdateResponse]), + cast_to=cast(Type[Optional[AccountSettingUpdateResponse]], ResultWrapper[AccountSettingUpdateResponse]), ) def get( @@ -88,7 +90,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountSettingGetResponse: + ) -> Optional[AccountSettingGetResponse]: """ Fetches Worker account settings for an account. @@ -112,20 +114,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AccountSettingGetResponse]]._unwrapper, ), - cast_to=cast(Type[AccountSettingGetResponse], ResultWrapper[AccountSettingGetResponse]), + cast_to=cast(Type[Optional[AccountSettingGetResponse]], ResultWrapper[AccountSettingGetResponse]), ) -class AsyncAccountSettings(AsyncAPIResource): +class AsyncAccountSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountSettingsWithRawResponse: - return AsyncAccountSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountSettingsResourceWithRawResponse: + return AsyncAccountSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountSettingsWithStreamingResponse: - return AsyncAccountSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountSettingsResourceWithStreamingResponse: + return AsyncAccountSettingsResourceWithStreamingResponse(self) async def update( self, @@ -138,7 +140,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountSettingUpdateResponse: + ) -> Optional[AccountSettingUpdateResponse]: """ Creates Worker account settings for an account. @@ -163,9 +165,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AccountSettingUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[AccountSettingUpdateResponse], ResultWrapper[AccountSettingUpdateResponse]), + cast_to=cast(Type[Optional[AccountSettingUpdateResponse]], ResultWrapper[AccountSettingUpdateResponse]), ) async def get( @@ -178,7 +180,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountSettingGetResponse: + ) -> Optional[AccountSettingGetResponse]: """ Fetches Worker account settings for an account. @@ -202,14 +204,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AccountSettingGetResponse]]._unwrapper, ), - cast_to=cast(Type[AccountSettingGetResponse], ResultWrapper[AccountSettingGetResponse]), + cast_to=cast(Type[Optional[AccountSettingGetResponse]], ResultWrapper[AccountSettingGetResponse]), ) -class AccountSettingsWithRawResponse: - def __init__(self, account_settings: AccountSettings) -> None: +class AccountSettingsResourceWithRawResponse: + def __init__(self, account_settings: AccountSettingsResource) -> None: self._account_settings = account_settings self.update = to_raw_response_wrapper( @@ -220,8 +222,8 @@ def __init__(self, account_settings: AccountSettings) -> None: ) -class AsyncAccountSettingsWithRawResponse: - def __init__(self, account_settings: AsyncAccountSettings) -> None: +class AsyncAccountSettingsResourceWithRawResponse: + def __init__(self, account_settings: AsyncAccountSettingsResource) -> None: self._account_settings = account_settings self.update = async_to_raw_response_wrapper( @@ -232,8 +234,8 @@ def __init__(self, account_settings: AsyncAccountSettings) -> None: ) -class AccountSettingsWithStreamingResponse: - def __init__(self, account_settings: AccountSettings) -> None: +class AccountSettingsResourceWithStreamingResponse: + def __init__(self, account_settings: AccountSettingsResource) -> None: self._account_settings = account_settings self.update = to_streamed_response_wrapper( @@ -244,8 +246,8 @@ def __init__(self, account_settings: AccountSettings) -> None: ) -class AsyncAccountSettingsWithStreamingResponse: - def __init__(self, account_settings: AsyncAccountSettings) -> None: +class AsyncAccountSettingsResourceWithStreamingResponse: + def __init__(self, account_settings: AsyncAccountSettingsResource) -> None: self._account_settings = account_settings self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/workers/ai.py b/src/cloudflare/resources/workers/ai.py index bfa50dff4b9..fa587e8cf49 100644 --- a/src/cloudflare/resources/workers/ai.py +++ b/src/cloudflare/resources/workers/ai.py @@ -24,19 +24,20 @@ from ..._base_client import ( make_request_options, ) -from ...types.workers import AIRunResponse, ai_run_params +from ...types.workers import ai_run_params +from ...types.workers.ai_run_response import AIRunResponse -__all__ = ["AI", "AsyncAI"] +__all__ = ["AIResource", "AsyncAIResource"] -class AI(SyncAPIResource): +class AIResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AIWithRawResponse: - return AIWithRawResponse(self) + def with_raw_response(self) -> AIResourceWithRawResponse: + return AIResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AIWithStreamingResponse: - return AIWithStreamingResponse(self) + def with_streaming_response(self) -> AIResourceWithStreamingResponse: + return AIResourceWithStreamingResponse(self) @overload def run( @@ -418,9 +419,12 @@ def run( model_name: str, *, account_id: str, - image: Iterable[float] | NotGiven = NOT_GIVEN, + image: Iterable[float], max_tokens: int | NotGiven = NOT_GIVEN, + messages: Iterable[ai_run_params.ImageToTextMessage] | NotGiven = NOT_GIVEN, prompt: str | NotGiven = NOT_GIVEN, + raw: bool | NotGiven = NOT_GIVEN, + temperature: 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. extra_headers: Headers | None = None, @@ -461,7 +465,7 @@ def run( ["account_id"], ["account_id", "target_lang", "text"], ["account_id", "input_text"], - ["account_id"], + ["account_id", "image"], ) def run( self, @@ -487,6 +491,7 @@ def run( source_lang: str | NotGiven = NOT_GIVEN, input_text: str | NotGiven = NOT_GIVEN, max_length: int | NotGiven = NOT_GIVEN, + temperature: 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. extra_headers: Headers | None = None, @@ -523,6 +528,7 @@ def run( "source_lang": source_lang, "input_text": input_text, "max_length": max_length, + "temperature": temperature, }, ai_run_params.AIRunParams, ), @@ -531,7 +537,7 @@ def run( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AIRunResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AIRunResponse] @@ -540,14 +546,14 @@ def run( ) -class AsyncAI(AsyncAPIResource): +class AsyncAIResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAIWithRawResponse: - return AsyncAIWithRawResponse(self) + def with_raw_response(self) -> AsyncAIResourceWithRawResponse: + return AsyncAIResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAIWithStreamingResponse: - return AsyncAIWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAIResourceWithStreamingResponse: + return AsyncAIResourceWithStreamingResponse(self) @overload async def run( @@ -929,9 +935,12 @@ async def run( model_name: str, *, account_id: str, - image: Iterable[float] | NotGiven = NOT_GIVEN, + image: Iterable[float], max_tokens: int | NotGiven = NOT_GIVEN, + messages: Iterable[ai_run_params.ImageToTextMessage] | NotGiven = NOT_GIVEN, prompt: str | NotGiven = NOT_GIVEN, + raw: bool | NotGiven = NOT_GIVEN, + temperature: 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. extra_headers: Headers | None = None, @@ -972,7 +981,7 @@ async def run( ["account_id"], ["account_id", "target_lang", "text"], ["account_id", "input_text"], - ["account_id"], + ["account_id", "image"], ) async def run( self, @@ -998,6 +1007,7 @@ async def run( source_lang: str | NotGiven = NOT_GIVEN, input_text: str | NotGiven = NOT_GIVEN, max_length: int | NotGiven = NOT_GIVEN, + temperature: 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. extra_headers: Headers | None = None, @@ -1034,6 +1044,7 @@ async def run( "source_lang": source_lang, "input_text": input_text, "max_length": max_length, + "temperature": temperature, }, ai_run_params.AIRunParams, ), @@ -1042,7 +1053,7 @@ async def run( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AIRunResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[AIRunResponse] @@ -1051,8 +1062,8 @@ async def run( ) -class AIWithRawResponse: - def __init__(self, ai: AI) -> None: +class AIResourceWithRawResponse: + def __init__(self, ai: AIResource) -> None: self._ai = ai self.run = to_raw_response_wrapper( @@ -1060,8 +1071,8 @@ def __init__(self, ai: AI) -> None: ) -class AsyncAIWithRawResponse: - def __init__(self, ai: AsyncAI) -> None: +class AsyncAIResourceWithRawResponse: + def __init__(self, ai: AsyncAIResource) -> None: self._ai = ai self.run = async_to_raw_response_wrapper( @@ -1069,8 +1080,8 @@ def __init__(self, ai: AsyncAI) -> None: ) -class AIWithStreamingResponse: - def __init__(self, ai: AI) -> None: +class AIResourceWithStreamingResponse: + def __init__(self, ai: AIResource) -> None: self._ai = ai self.run = to_streamed_response_wrapper( @@ -1078,8 +1089,8 @@ def __init__(self, ai: AI) -> None: ) -class AsyncAIWithStreamingResponse: - def __init__(self, ai: AsyncAI) -> None: +class AsyncAIResourceWithStreamingResponse: + def __init__(self, ai: AsyncAIResource) -> None: self._ai = ai self.run = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/workers/deployments/__init__.py b/src/cloudflare/resources/workers/deployments/__init__.py deleted file mode 100644 index 82159ecdf63..00000000000 --- a/src/cloudflare/resources/workers/deployments/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .by_scripts import ( - ByScripts, - AsyncByScripts, - ByScriptsWithRawResponse, - AsyncByScriptsWithRawResponse, - ByScriptsWithStreamingResponse, - AsyncByScriptsWithStreamingResponse, -) -from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, -) - -__all__ = [ - "ByScripts", - "AsyncByScripts", - "ByScriptsWithRawResponse", - "AsyncByScriptsWithRawResponse", - "ByScriptsWithStreamingResponse", - "AsyncByScriptsWithStreamingResponse", - "Deployments", - "AsyncDeployments", - "DeploymentsWithRawResponse", - "AsyncDeploymentsWithRawResponse", - "DeploymentsWithStreamingResponse", - "AsyncDeploymentsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/deployments/by_scripts/__init__.py b/src/cloudflare/resources/workers/deployments/by_scripts/__init__.py deleted file mode 100644 index ca888b7a109..00000000000 --- a/src/cloudflare/resources/workers/deployments/by_scripts/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .details import ( - Details, - AsyncDetails, - DetailsWithRawResponse, - AsyncDetailsWithRawResponse, - DetailsWithStreamingResponse, - AsyncDetailsWithStreamingResponse, -) -from .by_scripts import ( - ByScripts, - AsyncByScripts, - ByScriptsWithRawResponse, - AsyncByScriptsWithRawResponse, - ByScriptsWithStreamingResponse, - AsyncByScriptsWithStreamingResponse, -) - -__all__ = [ - "Details", - "AsyncDetails", - "DetailsWithRawResponse", - "AsyncDetailsWithRawResponse", - "DetailsWithStreamingResponse", - "AsyncDetailsWithStreamingResponse", - "ByScripts", - "AsyncByScripts", - "ByScriptsWithRawResponse", - "AsyncByScriptsWithRawResponse", - "ByScriptsWithStreamingResponse", - "AsyncByScriptsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/deployments/by_scripts/by_scripts.py b/src/cloudflare/resources/workers/deployments/by_scripts/by_scripts.py deleted file mode 100644 index a79795ff480..00000000000 --- a/src/cloudflare/resources/workers/deployments/by_scripts/by_scripts.py +++ /dev/null @@ -1,196 +0,0 @@ -# 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 .details import ( - Details, - AsyncDetails, - DetailsWithRawResponse, - AsyncDetailsWithRawResponse, - DetailsWithStreamingResponse, - AsyncDetailsWithStreamingResponse, -) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from ....._base_client import ( - make_request_options, -) -from .....types.workers.deployments import ByScriptGetResponse - -__all__ = ["ByScripts", "AsyncByScripts"] - - -class ByScripts(SyncAPIResource): - @cached_property - def details(self) -> Details: - return Details(self._client) - - @cached_property - def with_raw_response(self) -> ByScriptsWithRawResponse: - return ByScriptsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ByScriptsWithStreamingResponse: - return ByScriptsWithStreamingResponse(self) - - def get( - self, - script_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, - ) -> ByScriptGetResponse: - """ - List Deployments - - Args: - account_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_id: - raise ValueError(f"Expected a non-empty value for `script_id` but received {script_id!r}") - return self._get( - f"/accounts/{account_id}/workers/deployments/by-script/{script_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[ByScriptGetResponse], ResultWrapper[ByScriptGetResponse]), - ) - - -class AsyncByScripts(AsyncAPIResource): - @cached_property - def details(self) -> AsyncDetails: - return AsyncDetails(self._client) - - @cached_property - def with_raw_response(self) -> AsyncByScriptsWithRawResponse: - return AsyncByScriptsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncByScriptsWithStreamingResponse: - return AsyncByScriptsWithStreamingResponse(self) - - async def get( - self, - script_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, - ) -> ByScriptGetResponse: - """ - List Deployments - - Args: - account_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_id: - raise ValueError(f"Expected a non-empty value for `script_id` but received {script_id!r}") - return await self._get( - f"/accounts/{account_id}/workers/deployments/by-script/{script_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[ByScriptGetResponse], ResultWrapper[ByScriptGetResponse]), - ) - - -class ByScriptsWithRawResponse: - def __init__(self, by_scripts: ByScripts) -> None: - self._by_scripts = by_scripts - - self.get = to_raw_response_wrapper( - by_scripts.get, - ) - - @cached_property - def details(self) -> DetailsWithRawResponse: - return DetailsWithRawResponse(self._by_scripts.details) - - -class AsyncByScriptsWithRawResponse: - def __init__(self, by_scripts: AsyncByScripts) -> None: - self._by_scripts = by_scripts - - self.get = async_to_raw_response_wrapper( - by_scripts.get, - ) - - @cached_property - def details(self) -> AsyncDetailsWithRawResponse: - return AsyncDetailsWithRawResponse(self._by_scripts.details) - - -class ByScriptsWithStreamingResponse: - def __init__(self, by_scripts: ByScripts) -> None: - self._by_scripts = by_scripts - - self.get = to_streamed_response_wrapper( - by_scripts.get, - ) - - @cached_property - def details(self) -> DetailsWithStreamingResponse: - return DetailsWithStreamingResponse(self._by_scripts.details) - - -class AsyncByScriptsWithStreamingResponse: - def __init__(self, by_scripts: AsyncByScripts) -> None: - self._by_scripts = by_scripts - - self.get = async_to_streamed_response_wrapper( - by_scripts.get, - ) - - @cached_property - def details(self) -> AsyncDetailsWithStreamingResponse: - return AsyncDetailsWithStreamingResponse(self._by_scripts.details) diff --git a/src/cloudflare/resources/workers/deployments/by_scripts/details.py b/src/cloudflare/resources/workers/deployments/by_scripts/details.py deleted file mode 100644 index 2cefee37462..00000000000 --- a/src/cloudflare/resources/workers/deployments/by_scripts/details.py +++ /dev/null @@ -1,170 +0,0 @@ -# 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 ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from ....._base_client import ( - make_request_options, -) -from .....types.workers.deployments.by_scripts import DetailGetResponse - -__all__ = ["Details", "AsyncDetails"] - - -class Details(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DetailsWithRawResponse: - return DetailsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DetailsWithStreamingResponse: - return DetailsWithStreamingResponse(self) - - def get( - self, - deployment_id: str, - *, - account_id: str, - script_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, - ) -> DetailGetResponse: - """ - Get Deployment Detail - - Args: - account_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_id: - raise ValueError(f"Expected a non-empty value for `script_id` but received {script_id!r}") - if not deployment_id: - raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") - return self._get( - f"/accounts/{account_id}/workers/deployments/by-script/{script_id}/detail/{deployment_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DetailGetResponse], ResultWrapper[DetailGetResponse]), - ) - - -class AsyncDetails(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDetailsWithRawResponse: - return AsyncDetailsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDetailsWithStreamingResponse: - return AsyncDetailsWithStreamingResponse(self) - - async def get( - self, - deployment_id: str, - *, - account_id: str, - script_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, - ) -> DetailGetResponse: - """ - Get Deployment Detail - - Args: - account_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_id: - raise ValueError(f"Expected a non-empty value for `script_id` but received {script_id!r}") - if not deployment_id: - raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") - return await self._get( - f"/accounts/{account_id}/workers/deployments/by-script/{script_id}/detail/{deployment_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DetailGetResponse], ResultWrapper[DetailGetResponse]), - ) - - -class DetailsWithRawResponse: - def __init__(self, details: Details) -> None: - self._details = details - - self.get = to_raw_response_wrapper( - details.get, - ) - - -class AsyncDetailsWithRawResponse: - def __init__(self, details: AsyncDetails) -> None: - self._details = details - - self.get = async_to_raw_response_wrapper( - details.get, - ) - - -class DetailsWithStreamingResponse: - def __init__(self, details: Details) -> None: - self._details = details - - self.get = to_streamed_response_wrapper( - details.get, - ) - - -class AsyncDetailsWithStreamingResponse: - def __init__(self, details: AsyncDetails) -> None: - self._details = details - - self.get = async_to_streamed_response_wrapper( - details.get, - ) diff --git a/src/cloudflare/resources/workers/deployments/deployments.py b/src/cloudflare/resources/workers/deployments/deployments.py deleted file mode 100644 index fc2375aa29e..00000000000 --- a/src/cloudflare/resources/workers/deployments/deployments.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ...._compat import cached_property -from .by_scripts import ( - ByScripts, - AsyncByScripts, - ByScriptsWithRawResponse, - AsyncByScriptsWithRawResponse, - ByScriptsWithStreamingResponse, - AsyncByScriptsWithStreamingResponse, -) -from ...._resource import SyncAPIResource, AsyncAPIResource -from .by_scripts.by_scripts import ByScripts, AsyncByScripts - -__all__ = ["Deployments", "AsyncDeployments"] - - -class Deployments(SyncAPIResource): - @cached_property - def by_scripts(self) -> ByScripts: - return ByScripts(self._client) - - @cached_property - def with_raw_response(self) -> DeploymentsWithRawResponse: - return DeploymentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DeploymentsWithStreamingResponse: - return DeploymentsWithStreamingResponse(self) - - -class AsyncDeployments(AsyncAPIResource): - @cached_property - def by_scripts(self) -> AsyncByScripts: - return AsyncByScripts(self._client) - - @cached_property - def with_raw_response(self) -> AsyncDeploymentsWithRawResponse: - return AsyncDeploymentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDeploymentsWithStreamingResponse: - return AsyncDeploymentsWithStreamingResponse(self) - - -class DeploymentsWithRawResponse: - def __init__(self, deployments: Deployments) -> None: - self._deployments = deployments - - @cached_property - def by_scripts(self) -> ByScriptsWithRawResponse: - return ByScriptsWithRawResponse(self._deployments.by_scripts) - - -class AsyncDeploymentsWithRawResponse: - def __init__(self, deployments: AsyncDeployments) -> None: - self._deployments = deployments - - @cached_property - def by_scripts(self) -> AsyncByScriptsWithRawResponse: - return AsyncByScriptsWithRawResponse(self._deployments.by_scripts) - - -class DeploymentsWithStreamingResponse: - def __init__(self, deployments: Deployments) -> None: - self._deployments = deployments - - @cached_property - def by_scripts(self) -> ByScriptsWithStreamingResponse: - return ByScriptsWithStreamingResponse(self._deployments.by_scripts) - - -class AsyncDeploymentsWithStreamingResponse: - def __init__(self, deployments: AsyncDeployments) -> None: - self._deployments = deployments - - @cached_property - def by_scripts(self) -> AsyncByScriptsWithStreamingResponse: - return AsyncByScriptsWithStreamingResponse(self._deployments.by_scripts) diff --git a/src/cloudflare/resources/workers/domains.py b/src/cloudflare/resources/workers/domains.py index 6fbc1af6e8c..bcf3872c03a 100644 --- a/src/cloudflare/resources/workers/domains.py +++ b/src/cloudflare/resources/workers/domains.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,20 @@ AsyncPaginator, make_request_options, ) -from ...types.workers import WorkersDomain, domain_list_params, domain_update_params +from ...types.workers import domain_list_params, domain_delete_params, domain_update_params +from ...types.workers.domain import Domain -__all__ = ["Domains", "AsyncDomains"] +__all__ = ["DomainsResource", "AsyncDomainsResource"] -class Domains(SyncAPIResource): +class DomainsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DomainsWithRawResponse: - return DomainsWithRawResponse(self) + def with_raw_response(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DomainsWithStreamingResponse: - return DomainsWithStreamingResponse(self) + def with_streaming_response(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self) def update( self, @@ -53,7 +54,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersDomain: + ) -> Optional[Domain]: """ Attaches a Worker to a zone and hostname. @@ -92,9 +93,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Domain]]._unwrapper, ), - cast_to=cast(Type[WorkersDomain], ResultWrapper[WorkersDomain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) def list( @@ -112,7 +113,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[WorkersDomain]: + ) -> SyncSinglePage[Domain]: """ Lists all Worker Domains for an account. @@ -139,7 +140,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/workers/domains", - page=SyncSinglePage[WorkersDomain], + page=SyncSinglePage[Domain], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -156,7 +157,7 @@ def list( domain_list_params.DomainListParams, ), ), - model=WorkersDomain, + model=Domain, ) def delete( @@ -164,6 +165,7 @@ def delete( domain_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -192,6 +194,7 @@ def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( f"/accounts/{account_id}/workers/domains/{domain_id}", + body=maybe_transform(body, domain_delete_params.DomainDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -209,7 +212,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersDomain: + ) -> Optional[Domain]: """ Gets a Worker domain. @@ -235,20 +238,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Domain]]._unwrapper, ), - cast_to=cast(Type[WorkersDomain], ResultWrapper[WorkersDomain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) -class AsyncDomains(AsyncAPIResource): +class AsyncDomainsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDomainsWithRawResponse: - return AsyncDomainsWithRawResponse(self) + def with_raw_response(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDomainsWithStreamingResponse: - return AsyncDomainsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self) async def update( self, @@ -264,7 +267,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersDomain: + ) -> Optional[Domain]: """ Attaches a Worker to a zone and hostname. @@ -303,9 +306,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Domain]]._unwrapper, ), - cast_to=cast(Type[WorkersDomain], ResultWrapper[WorkersDomain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) def list( @@ -323,7 +326,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WorkersDomain, AsyncSinglePage[WorkersDomain]]: + ) -> AsyncPaginator[Domain, AsyncSinglePage[Domain]]: """ Lists all Worker Domains for an account. @@ -350,7 +353,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/workers/domains", - page=AsyncSinglePage[WorkersDomain], + page=AsyncSinglePage[Domain], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -367,7 +370,7 @@ def list( domain_list_params.DomainListParams, ), ), - model=WorkersDomain, + model=Domain, ) async def delete( @@ -375,6 +378,7 @@ async def delete( domain_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -403,6 +407,7 @@ async def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( f"/accounts/{account_id}/workers/domains/{domain_id}", + body=await async_maybe_transform(body, domain_delete_params.DomainDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -420,7 +425,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersDomain: + ) -> Optional[Domain]: """ Gets a Worker domain. @@ -446,14 +451,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Domain]]._unwrapper, ), - cast_to=cast(Type[WorkersDomain], ResultWrapper[WorkersDomain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) -class DomainsWithRawResponse: - def __init__(self, domains: Domains) -> None: +class DomainsResourceWithRawResponse: + def __init__(self, domains: DomainsResource) -> None: self._domains = domains self.update = to_raw_response_wrapper( @@ -470,8 +475,8 @@ def __init__(self, domains: Domains) -> None: ) -class AsyncDomainsWithRawResponse: - def __init__(self, domains: AsyncDomains) -> None: +class AsyncDomainsResourceWithRawResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: self._domains = domains self.update = async_to_raw_response_wrapper( @@ -488,8 +493,8 @@ def __init__(self, domains: AsyncDomains) -> None: ) -class DomainsWithStreamingResponse: - def __init__(self, domains: Domains) -> None: +class DomainsResourceWithStreamingResponse: + def __init__(self, domains: DomainsResource) -> None: self._domains = domains self.update = to_streamed_response_wrapper( @@ -506,8 +511,8 @@ def __init__(self, domains: Domains) -> None: ) -class AsyncDomainsWithStreamingResponse: - def __init__(self, domains: AsyncDomains) -> None: +class AsyncDomainsResourceWithStreamingResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: self._domains = domains self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/workers/filters.py b/src/cloudflare/resources/workers/filters.py deleted file mode 100644 index f9b067df2f0..00000000000 --- a/src/cloudflare/resources/workers/filters.py +++ /dev/null @@ -1,490 +0,0 @@ -# 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 ( - WorkersFilter, - FilterCreateResponse, - FilterDeleteResponse, - filter_create_params, - filter_update_params, -) - -__all__ = ["Filters", "AsyncFilters"] - - -class Filters(SyncAPIResource): - @cached_property - def with_raw_response(self) -> FiltersWithRawResponse: - return FiltersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FiltersWithStreamingResponse: - return FiltersWithStreamingResponse(self) - - def create( - self, - *, - zone_id: str, - enabled: bool, - pattern: 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[FilterCreateResponse]: - """ - Create Filter - - 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}/workers/filters", - body=maybe_transform( - { - "enabled": enabled, - "pattern": pattern, - }, - filter_create_params.FilterCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[FilterCreateResponse]], ResultWrapper[FilterCreateResponse]), - ) - - def update( - self, - filter_id: str, - *, - zone_id: str, - enabled: bool, - pattern: 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, - ) -> WorkersFilter: - """ - Update Filter - - Args: - zone_id: Identifier - - filter_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 filter_id: - raise ValueError(f"Expected a non-empty value for `filter_id` but received {filter_id!r}") - return self._put( - f"/zones/{zone_id}/workers/filters/{filter_id}", - body=maybe_transform( - { - "enabled": enabled, - "pattern": pattern, - }, - filter_update_params.FilterUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WorkersFilter], ResultWrapper[WorkersFilter]), - ) - - 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[WorkersFilter]: - """ - List Filters - - 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/filters", - page=SyncSinglePage[WorkersFilter], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WorkersFilter, - ) - - def delete( - self, - filter_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[FilterDeleteResponse]: - """ - Delete Filter - - Args: - zone_id: Identifier - - filter_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 filter_id: - raise ValueError(f"Expected a non-empty value for `filter_id` but received {filter_id!r}") - return self._delete( - f"/zones/{zone_id}/workers/filters/{filter_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[FilterDeleteResponse]], ResultWrapper[FilterDeleteResponse]), - ) - - -class AsyncFilters(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncFiltersWithRawResponse: - return AsyncFiltersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFiltersWithStreamingResponse: - return AsyncFiltersWithStreamingResponse(self) - - async def create( - self, - *, - zone_id: str, - enabled: bool, - pattern: 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[FilterCreateResponse]: - """ - Create Filter - - 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}/workers/filters", - body=await async_maybe_transform( - { - "enabled": enabled, - "pattern": pattern, - }, - filter_create_params.FilterCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[FilterCreateResponse]], ResultWrapper[FilterCreateResponse]), - ) - - async def update( - self, - filter_id: str, - *, - zone_id: str, - enabled: bool, - pattern: 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, - ) -> WorkersFilter: - """ - Update Filter - - Args: - zone_id: Identifier - - filter_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 filter_id: - raise ValueError(f"Expected a non-empty value for `filter_id` but received {filter_id!r}") - return await self._put( - f"/zones/{zone_id}/workers/filters/{filter_id}", - body=await async_maybe_transform( - { - "enabled": enabled, - "pattern": pattern, - }, - filter_update_params.FilterUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WorkersFilter], ResultWrapper[WorkersFilter]), - ) - - 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[WorkersFilter, AsyncSinglePage[WorkersFilter]]: - """ - List Filters - - 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/filters", - page=AsyncSinglePage[WorkersFilter], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WorkersFilter, - ) - - async def delete( - self, - filter_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[FilterDeleteResponse]: - """ - Delete Filter - - Args: - zone_id: Identifier - - filter_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 filter_id: - raise ValueError(f"Expected a non-empty value for `filter_id` but received {filter_id!r}") - return await self._delete( - f"/zones/{zone_id}/workers/filters/{filter_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[FilterDeleteResponse]], ResultWrapper[FilterDeleteResponse]), - ) - - -class FiltersWithRawResponse: - def __init__(self, filters: Filters) -> None: - self._filters = filters - - self.create = to_raw_response_wrapper( - filters.create, - ) - self.update = to_raw_response_wrapper( - filters.update, - ) - self.list = to_raw_response_wrapper( - filters.list, - ) - self.delete = to_raw_response_wrapper( - filters.delete, - ) - - -class AsyncFiltersWithRawResponse: - def __init__(self, filters: AsyncFilters) -> None: - self._filters = filters - - self.create = async_to_raw_response_wrapper( - filters.create, - ) - self.update = async_to_raw_response_wrapper( - filters.update, - ) - self.list = async_to_raw_response_wrapper( - filters.list, - ) - self.delete = async_to_raw_response_wrapper( - filters.delete, - ) - - -class FiltersWithStreamingResponse: - def __init__(self, filters: Filters) -> None: - self._filters = filters - - self.create = to_streamed_response_wrapper( - filters.create, - ) - self.update = to_streamed_response_wrapper( - filters.update, - ) - self.list = to_streamed_response_wrapper( - filters.list, - ) - self.delete = to_streamed_response_wrapper( - filters.delete, - ) - - -class AsyncFiltersWithStreamingResponse: - def __init__(self, filters: AsyncFilters) -> None: - self._filters = filters - - self.create = async_to_streamed_response_wrapper( - filters.create, - ) - self.update = async_to_streamed_response_wrapper( - filters.update, - ) - self.list = async_to_streamed_response_wrapper( - filters.list, - ) - self.delete = async_to_streamed_response_wrapper( - filters.delete, - ) diff --git a/src/cloudflare/resources/workers/routes.py b/src/cloudflare/resources/workers/routes.py deleted file mode 100644 index 4b5b565e3f7..00000000000 --- a/src/cloudflare/resources/workers/routes.py +++ /dev/null @@ -1,618 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, Type, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ...pagination import SyncSinglePage, AsyncSinglePage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) -from ...types.workers import ( - WorkersRoute, - RouteCreateResponse, - RouteDeleteResponse, - route_create_params, - route_update_params, -) - -__all__ = ["Routes", "AsyncRoutes"] - - -class Routes(SyncAPIResource): - @cached_property - def with_raw_response(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(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 cast( - RouteCreateResponse, - 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, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[RouteCreateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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, - ) -> WorkersRoute: - """ - 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._unwrapper, - ), - cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), - ) - - 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[WorkersRoute]: - """ - 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[WorkersRoute], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WorkersRoute, - ) - - 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 cast( - RouteDeleteResponse, - 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, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[RouteDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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, - ) -> WorkersRoute: - """ - 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._unwrapper, - ), - cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), - ) - - -class AsyncRoutes(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(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 cast( - RouteCreateResponse, - 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, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[RouteCreateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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, - ) -> WorkersRoute: - """ - 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._unwrapper, - ), - cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), - ) - - 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[WorkersRoute, AsyncSinglePage[WorkersRoute]]: - """ - 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[WorkersRoute], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WorkersRoute, - ) - - 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 cast( - RouteDeleteResponse, - 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, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[RouteDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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, - ) -> WorkersRoute: - """ - 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._unwrapper, - ), - cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), - ) - - -class RoutesWithRawResponse: - def __init__(self, routes: Routes) -> 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 AsyncRoutesWithRawResponse: - def __init__(self, routes: AsyncRoutes) -> 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 RoutesWithStreamingResponse: - def __init__(self, routes: Routes) -> 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 AsyncRoutesWithStreamingResponse: - def __init__(self, routes: AsyncRoutes) -> 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/__init__.py b/src/cloudflare/resources/workers/scripts/__init__.py index 5629fca6f7a..8ddeb820ca6 100644 --- a/src/cloudflare/resources/workers/scripts/__init__.py +++ b/src/cloudflare/resources/workers/scripts/__init__.py @@ -1,117 +1,103 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .tail import ( - Tail, - AsyncTail, - TailWithRawResponse, - AsyncTailWithRawResponse, - TailWithStreamingResponse, - AsyncTailWithStreamingResponse, + TailResource, + AsyncTailResource, + TailResourceWithRawResponse, + AsyncTailResourceWithRawResponse, + TailResourceWithStreamingResponse, + AsyncTailResourceWithStreamingResponse, ) from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, + ContentResource, + AsyncContentResource, + ContentResourceWithRawResponse, + AsyncContentResourceWithRawResponse, + ContentResourceWithStreamingResponse, + AsyncContentResourceWithStreamingResponse, ) from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, -) -from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, + ScriptsResource, + AsyncScriptsResource, + ScriptsResourceWithRawResponse, + AsyncScriptsResourceWithRawResponse, + ScriptsResourceWithStreamingResponse, + AsyncScriptsResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) -from .schedules import ( - Schedules, - AsyncSchedules, - SchedulesWithRawResponse, - AsyncSchedulesWithRawResponse, - SchedulesWithStreamingResponse, - AsyncSchedulesWithStreamingResponse, +from .versions import ( + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, ) -from .content_v2 import ( - ContentV2, - AsyncContentV2, - ContentV2WithRawResponse, - AsyncContentV2WithRawResponse, - ContentV2WithStreamingResponse, - AsyncContentV2WithStreamingResponse, +from .schedules import ( + SchedulesResource, + AsyncSchedulesResource, + SchedulesResourceWithRawResponse, + AsyncSchedulesResourceWithRawResponse, + SchedulesResourceWithStreamingResponse, + AsyncSchedulesResourceWithStreamingResponse, ) -from .usage_model import ( - UsageModel, - AsyncUsageModel, - UsageModelWithRawResponse, - AsyncUsageModelWithRawResponse, - UsageModelWithStreamingResponse, - AsyncUsageModelWithStreamingResponse, +from .deployments import ( + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, ) __all__ = [ - "Bindings", - "AsyncBindings", - "BindingsWithRawResponse", - "AsyncBindingsWithRawResponse", - "BindingsWithStreamingResponse", - "AsyncBindingsWithStreamingResponse", - "Schedules", - "AsyncSchedules", - "SchedulesWithRawResponse", - "AsyncSchedulesWithRawResponse", - "SchedulesWithStreamingResponse", - "AsyncSchedulesWithStreamingResponse", - "Tail", - "AsyncTail", - "TailWithRawResponse", - "AsyncTailWithRawResponse", - "TailWithStreamingResponse", - "AsyncTailWithStreamingResponse", - "UsageModel", - "AsyncUsageModel", - "UsageModelWithRawResponse", - "AsyncUsageModelWithRawResponse", - "UsageModelWithStreamingResponse", - "AsyncUsageModelWithStreamingResponse", - "Content", - "AsyncContent", - "ContentWithRawResponse", - "AsyncContentWithRawResponse", - "ContentWithStreamingResponse", - "AsyncContentWithStreamingResponse", - "ContentV2", - "AsyncContentV2", - "ContentV2WithRawResponse", - "AsyncContentV2WithRawResponse", - "ContentV2WithStreamingResponse", - "AsyncContentV2WithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Scripts", - "AsyncScripts", - "ScriptsWithRawResponse", - "AsyncScriptsWithRawResponse", - "ScriptsWithStreamingResponse", - "AsyncScriptsWithStreamingResponse", + "SchedulesResource", + "AsyncSchedulesResource", + "SchedulesResourceWithRawResponse", + "AsyncSchedulesResourceWithRawResponse", + "SchedulesResourceWithStreamingResponse", + "AsyncSchedulesResourceWithStreamingResponse", + "TailResource", + "AsyncTailResource", + "TailResourceWithRawResponse", + "AsyncTailResourceWithRawResponse", + "TailResourceWithStreamingResponse", + "AsyncTailResourceWithStreamingResponse", + "ContentResource", + "AsyncContentResource", + "ContentResourceWithRawResponse", + "AsyncContentResourceWithRawResponse", + "ContentResourceWithStreamingResponse", + "AsyncContentResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "DeploymentsResource", + "AsyncDeploymentsResource", + "DeploymentsResourceWithRawResponse", + "AsyncDeploymentsResourceWithRawResponse", + "DeploymentsResourceWithStreamingResponse", + "AsyncDeploymentsResourceWithStreamingResponse", + "VersionsResource", + "AsyncVersionsResource", + "VersionsResourceWithRawResponse", + "AsyncVersionsResourceWithRawResponse", + "VersionsResourceWithStreamingResponse", + "AsyncVersionsResourceWithStreamingResponse", + "ScriptsResource", + "AsyncScriptsResource", + "ScriptsResourceWithRawResponse", + "AsyncScriptsResourceWithRawResponse", + "ScriptsResourceWithStreamingResponse", + "AsyncScriptsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/workers/scripts/bindings.py b/src/cloudflare/resources/workers/scripts/bindings.py deleted file mode 100644 index c02a306bd31..00000000000 --- a/src/cloudflare/resources/workers/scripts/bindings.py +++ /dev/null @@ -1,158 +0,0 @@ -# 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 ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.workers.scripts import BindingGetResponse - -__all__ = ["Bindings", "AsyncBindings"] - - -class Bindings(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self) - - def get( - 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, - ) -> BindingGetResponse: - """ - List the bindings for a Workers script. - - 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( - f"/zones/{zone_id}/workers/script/bindings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[BindingGetResponse], ResultWrapper[BindingGetResponse]), - ) - - -class AsyncBindings(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self) - - async def get( - 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, - ) -> BindingGetResponse: - """ - List the bindings for a Workers script. - - 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._get( - f"/zones/{zone_id}/workers/script/bindings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[BindingGetResponse], ResultWrapper[BindingGetResponse]), - ) - - -class BindingsWithRawResponse: - def __init__(self, bindings: Bindings) -> None: - self._bindings = bindings - - self.get = to_raw_response_wrapper( - bindings.get, - ) - - -class AsyncBindingsWithRawResponse: - def __init__(self, bindings: AsyncBindings) -> None: - self._bindings = bindings - - self.get = async_to_raw_response_wrapper( - bindings.get, - ) - - -class BindingsWithStreamingResponse: - def __init__(self, bindings: Bindings) -> None: - self._bindings = bindings - - self.get = to_streamed_response_wrapper( - bindings.get, - ) - - -class AsyncBindingsWithStreamingResponse: - def __init__(self, bindings: AsyncBindings) -> None: - self._bindings = bindings - - self.get = async_to_streamed_response_wrapper( - bindings.get, - ) diff --git a/src/cloudflare/resources/workers/scripts/content.py b/src/cloudflare/resources/workers/scripts/content.py index 2eeeb184cb3..04ea3cd8771 100644 --- a/src/cloudflare/resources/workers/scripts/content.py +++ b/src/cloudflare/resources/workers/scripts/content.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Mapping, cast +from typing import List, Type, Mapping, Optional, cast import httpx @@ -16,29 +16,38 @@ 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.workers import WorkersScript +from ....types.workers.script import Script from ....types.workers.scripts import content_update_params +from ....types.workers.worker_metadata_param import WorkerMetadataParam -__all__ = ["Content", "AsyncContent"] +__all__ = ["ContentResource", "AsyncContentResource"] -class Content(SyncAPIResource): +class ContentResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self) + def with_raw_response(self) -> ContentResourceWithRawResponse: + return ContentResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self) + def with_streaming_response(self) -> ContentResourceWithStreamingResponse: + return ContentResourceWithStreamingResponse(self) def update( self, @@ -46,14 +55,14 @@ def update( *, account_id: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: content_update_params.Metadata | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam | 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, - ) -> WorkersScript: + ) -> Optional[Script]: """ Put script content without touching config or metadata @@ -66,7 +75,8 @@ def update( 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. + (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. @@ -103,20 +113,61 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Script]]._unwrapper, ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) + def get( + self, + script_name: 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: + """ + Fetch script content only + + Args: + account_id: Identifier + + script_name: Name of the script, used in URLs and route configuration. + + extra_headers: Send extra headers -class AsyncContent(AsyncAPIResource): + 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 script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = {"Accept": "string", **(extra_headers or {})} + return self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BinaryAPIResponse, + ) + + +class AsyncContentResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self) + def with_raw_response(self) -> AsyncContentResourceWithRawResponse: + return AsyncContentResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse: + return AsyncContentResourceWithStreamingResponse(self) async def update( self, @@ -124,14 +175,14 @@ async def update( *, account_id: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: content_update_params.Metadata | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam | 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, - ) -> WorkersScript: + ) -> Optional[Script]: """ Put script content without touching config or metadata @@ -144,7 +195,8 @@ async def update( 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. + (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. @@ -181,43 +233,100 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Script]]._unwrapper, + ), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), + ) + + async def get( + self, + script_name: 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: + """ + Fetch script content only + + Args: + account_id: Identifier + + script_name: 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 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}") + extra_headers = {"Accept": "string", **(extra_headers or {})} + return await self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), + cast_to=AsyncBinaryAPIResponse, ) -class ContentWithRawResponse: - def __init__(self, content: Content) -> None: +class ContentResourceWithRawResponse: + def __init__(self, content: ContentResource) -> None: self._content = content self.update = to_raw_response_wrapper( content.update, ) + self.get = to_custom_raw_response_wrapper( + content.get, + BinaryAPIResponse, + ) -class AsyncContentWithRawResponse: - def __init__(self, content: AsyncContent) -> None: +class AsyncContentResourceWithRawResponse: + def __init__(self, content: AsyncContentResource) -> None: self._content = content self.update = async_to_raw_response_wrapper( content.update, ) + self.get = async_to_custom_raw_response_wrapper( + content.get, + AsyncBinaryAPIResponse, + ) -class ContentWithStreamingResponse: - def __init__(self, content: Content) -> None: +class ContentResourceWithStreamingResponse: + def __init__(self, content: ContentResource) -> None: self._content = content self.update = to_streamed_response_wrapper( content.update, ) + self.get = to_custom_streamed_response_wrapper( + content.get, + StreamedBinaryAPIResponse, + ) -class AsyncContentWithStreamingResponse: - def __init__(self, content: AsyncContent) -> None: +class AsyncContentResourceWithStreamingResponse: + def __init__(self, content: AsyncContentResource) -> None: self._content = content self.update = async_to_streamed_response_wrapper( content.update, ) + self.get = async_to_custom_streamed_response_wrapper( + content.get, + AsyncStreamedBinaryAPIResponse, + ) diff --git a/src/cloudflare/resources/workers/scripts/content_v2.py b/src/cloudflare/resources/workers/scripts/content_v2.py deleted file mode 100644 index 0066d76d0a0..00000000000 --- a/src/cloudflare/resources/workers/scripts/content_v2.py +++ /dev/null @@ -1,166 +0,0 @@ -# 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 ( - 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__ = ["ContentV2", "AsyncContentV2"] - - -class ContentV2(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ContentV2WithRawResponse: - return ContentV2WithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ContentV2WithStreamingResponse: - return ContentV2WithStreamingResponse(self) - - def get( - self, - script_name: 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: - """ - Fetch script content only - - Args: - account_id: Identifier - - script_name: 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 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}") - extra_headers = {"Accept": "string", **(extra_headers or {})} - return self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BinaryAPIResponse, - ) - - -class AsyncContentV2(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncContentV2WithRawResponse: - return AsyncContentV2WithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncContentV2WithStreamingResponse: - return AsyncContentV2WithStreamingResponse(self) - - async def get( - self, - script_name: 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: - """ - Fetch script content only - - Args: - account_id: Identifier - - script_name: 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 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}") - extra_headers = {"Accept": "string", **(extra_headers or {})} - return await self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AsyncBinaryAPIResponse, - ) - - -class ContentV2WithRawResponse: - def __init__(self, content_v2: ContentV2) -> None: - self._content_v2 = content_v2 - - self.get = to_custom_raw_response_wrapper( - content_v2.get, - BinaryAPIResponse, - ) - - -class AsyncContentV2WithRawResponse: - def __init__(self, content_v2: AsyncContentV2) -> None: - self._content_v2 = content_v2 - - self.get = async_to_custom_raw_response_wrapper( - content_v2.get, - AsyncBinaryAPIResponse, - ) - - -class ContentV2WithStreamingResponse: - def __init__(self, content_v2: ContentV2) -> None: - self._content_v2 = content_v2 - - self.get = to_custom_streamed_response_wrapper( - content_v2.get, - StreamedBinaryAPIResponse, - ) - - -class AsyncContentV2WithStreamingResponse: - def __init__(self, content_v2: AsyncContentV2) -> None: - self._content_v2 = content_v2 - - self.get = async_to_custom_streamed_response_wrapper( - content_v2.get, - AsyncStreamedBinaryAPIResponse, - ) diff --git a/src/cloudflare/resources/workers/scripts/deployments.py b/src/cloudflare/resources/workers/scripts/deployments.py new file mode 100644 index 00000000000..25a76d167d7 --- /dev/null +++ b/src/cloudflare/resources/workers/scripts/deployments.py @@ -0,0 +1,303 @@ +# 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.workers.scripts import deployment_create_params +from ....types.workers.scripts.deployment_param import DeploymentParam +from ....types.workers.scripts.deployment_get_response import DeploymentGetResponse +from ....types.workers.scripts.deployment_create_response import DeploymentCreateResponse + +__all__ = ["DeploymentsResource", "AsyncDeploymentsResource"] + + +class DeploymentsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> DeploymentsResourceWithRawResponse: + return DeploymentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DeploymentsResourceWithStreamingResponse: + return DeploymentsResourceWithStreamingResponse(self) + + def create( + self, + script_name: str, + *, + account_id: str, + annotations: DeploymentParam | NotGiven = NOT_GIVEN, + strategy: 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[DeploymentCreateResponse]: + """ + Deployments configure how + [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions) + are deployed to traffic. A deployment can consist of one or two versions of a + Worker. + + Args: + account_id: Identifier + + script_name: Name of the script. + + 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 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/scripts/{script_name}/deployments", + body=maybe_transform( + { + "annotations": annotations, + "strategy": strategy, + }, + deployment_create_params.DeploymentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[DeploymentCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[DeploymentCreateResponse]], ResultWrapper[DeploymentCreateResponse]), + ) + + def get( + self, + script_name: 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[DeploymentGetResponse]: + """List of Worker Deployments. + + The first deployment in the list is the latest + deployment actively serving traffic. + + Args: + account_id: Identifier + + script_name: Name of the script. + + 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 script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + return self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/deployments", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[DeploymentGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[DeploymentGetResponse]], ResultWrapper[DeploymentGetResponse]), + ) + + +class AsyncDeploymentsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncDeploymentsResourceWithRawResponse: + return AsyncDeploymentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDeploymentsResourceWithStreamingResponse: + return AsyncDeploymentsResourceWithStreamingResponse(self) + + async def create( + self, + script_name: str, + *, + account_id: str, + annotations: DeploymentParam | NotGiven = NOT_GIVEN, + strategy: 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[DeploymentCreateResponse]: + """ + Deployments configure how + [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions) + are deployed to traffic. A deployment can consist of one or two versions of a + Worker. + + Args: + account_id: Identifier + + script_name: Name of the script. + + 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 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/scripts/{script_name}/deployments", + body=await async_maybe_transform( + { + "annotations": annotations, + "strategy": strategy, + }, + deployment_create_params.DeploymentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[DeploymentCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[DeploymentCreateResponse]], ResultWrapper[DeploymentCreateResponse]), + ) + + async def get( + self, + script_name: 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[DeploymentGetResponse]: + """List of Worker Deployments. + + The first deployment in the list is the latest + deployment actively serving traffic. + + Args: + account_id: Identifier + + script_name: Name of the script. + + 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 script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + return await self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/deployments", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[DeploymentGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[DeploymentGetResponse]], ResultWrapper[DeploymentGetResponse]), + ) + + +class DeploymentsResourceWithRawResponse: + def __init__(self, deployments: DeploymentsResource) -> None: + self._deployments = deployments + + self.create = to_raw_response_wrapper( + deployments.create, + ) + self.get = to_raw_response_wrapper( + deployments.get, + ) + + +class AsyncDeploymentsResourceWithRawResponse: + def __init__(self, deployments: AsyncDeploymentsResource) -> None: + self._deployments = deployments + + self.create = async_to_raw_response_wrapper( + deployments.create, + ) + self.get = async_to_raw_response_wrapper( + deployments.get, + ) + + +class DeploymentsResourceWithStreamingResponse: + def __init__(self, deployments: DeploymentsResource) -> None: + self._deployments = deployments + + self.create = to_streamed_response_wrapper( + deployments.create, + ) + self.get = to_streamed_response_wrapper( + deployments.get, + ) + + +class AsyncDeploymentsResourceWithStreamingResponse: + def __init__(self, deployments: AsyncDeploymentsResource) -> None: + self._deployments = deployments + + self.create = async_to_streamed_response_wrapper( + deployments.create, + ) + self.get = async_to_streamed_response_wrapper( + deployments.get, + ) diff --git a/src/cloudflare/resources/workers/scripts/schedules.py b/src/cloudflare/resources/workers/scripts/schedules.py index 08b74387001..229fcc45ebc 100644 --- a/src/cloudflare/resources/workers/scripts/schedules.py +++ b/src/cloudflare/resources/workers/scripts/schedules.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.workers.scripts import ScheduleGetResponse, ScheduleUpdateResponse, schedule_update_params +from ....types.workers.scripts import schedule_update_params +from ....types.workers.scripts.schedule_get_response import ScheduleGetResponse +from ....types.workers.scripts.schedule_update_response import ScheduleUpdateResponse -__all__ = ["Schedules", "AsyncSchedules"] +__all__ = ["SchedulesResource", "AsyncSchedulesResource"] -class Schedules(SyncAPIResource): +class SchedulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SchedulesWithRawResponse: - return SchedulesWithRawResponse(self) + def with_raw_response(self) -> SchedulesResourceWithRawResponse: + return SchedulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SchedulesWithStreamingResponse: - return SchedulesWithStreamingResponse(self) + def with_streaming_response(self) -> SchedulesResourceWithStreamingResponse: + return SchedulesResourceWithStreamingResponse(self) def update( self, @@ -49,7 +51,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleUpdateResponse: + ) -> Optional[ScheduleUpdateResponse]: """ Updates Cron Triggers for a Worker. @@ -78,9 +80,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScheduleUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[ScheduleUpdateResponse], ResultWrapper[ScheduleUpdateResponse]), + cast_to=cast(Type[Optional[ScheduleUpdateResponse]], ResultWrapper[ScheduleUpdateResponse]), ) def get( @@ -94,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleGetResponse: + ) -> Optional[ScheduleGetResponse]: """ Fetches Cron Triggers for a Worker. @@ -122,20 +124,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScheduleGetResponse]]._unwrapper, ), - cast_to=cast(Type[ScheduleGetResponse], ResultWrapper[ScheduleGetResponse]), + cast_to=cast(Type[Optional[ScheduleGetResponse]], ResultWrapper[ScheduleGetResponse]), ) -class AsyncSchedules(AsyncAPIResource): +class AsyncSchedulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSchedulesWithRawResponse: - return AsyncSchedulesWithRawResponse(self) + def with_raw_response(self) -> AsyncSchedulesResourceWithRawResponse: + return AsyncSchedulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSchedulesWithStreamingResponse: - return AsyncSchedulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSchedulesResourceWithStreamingResponse: + return AsyncSchedulesResourceWithStreamingResponse(self) async def update( self, @@ -149,7 +151,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleUpdateResponse: + ) -> Optional[ScheduleUpdateResponse]: """ Updates Cron Triggers for a Worker. @@ -178,9 +180,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScheduleUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[ScheduleUpdateResponse], ResultWrapper[ScheduleUpdateResponse]), + cast_to=cast(Type[Optional[ScheduleUpdateResponse]], ResultWrapper[ScheduleUpdateResponse]), ) async def get( @@ -194,7 +196,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleGetResponse: + ) -> Optional[ScheduleGetResponse]: """ Fetches Cron Triggers for a Worker. @@ -222,14 +224,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScheduleGetResponse]]._unwrapper, ), - cast_to=cast(Type[ScheduleGetResponse], ResultWrapper[ScheduleGetResponse]), + cast_to=cast(Type[Optional[ScheduleGetResponse]], ResultWrapper[ScheduleGetResponse]), ) -class SchedulesWithRawResponse: - def __init__(self, schedules: Schedules) -> None: +class SchedulesResourceWithRawResponse: + def __init__(self, schedules: SchedulesResource) -> None: self._schedules = schedules self.update = to_raw_response_wrapper( @@ -240,8 +242,8 @@ def __init__(self, schedules: Schedules) -> None: ) -class AsyncSchedulesWithRawResponse: - def __init__(self, schedules: AsyncSchedules) -> None: +class AsyncSchedulesResourceWithRawResponse: + def __init__(self, schedules: AsyncSchedulesResource) -> None: self._schedules = schedules self.update = async_to_raw_response_wrapper( @@ -252,8 +254,8 @@ def __init__(self, schedules: AsyncSchedules) -> None: ) -class SchedulesWithStreamingResponse: - def __init__(self, schedules: Schedules) -> None: +class SchedulesResourceWithStreamingResponse: + def __init__(self, schedules: SchedulesResource) -> None: self._schedules = schedules self.update = to_streamed_response_wrapper( @@ -264,8 +266,8 @@ def __init__(self, schedules: Schedules) -> None: ) -class AsyncSchedulesWithStreamingResponse: - def __init__(self, schedules: AsyncSchedules) -> None: +class AsyncSchedulesResourceWithStreamingResponse: + def __init__(self, schedules: AsyncSchedulesResource) -> None: self._schedules = schedules self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py index 80ae6ca12c3..437479de3a1 100644 --- a/src/cloudflare/resources/workers/scripts/scripts.py +++ b/src/cloudflare/resources/workers/scripts/scripts.py @@ -2,41 +2,41 @@ from __future__ import annotations -from typing import List, Type, cast, overload +from typing import List, Type, Optional, cast, overload import httpx from .tail import ( - Tail, - AsyncTail, - TailWithRawResponse, - AsyncTailWithRawResponse, - TailWithStreamingResponse, - AsyncTailWithStreamingResponse, + TailResource, + AsyncTailResource, + TailResourceWithRawResponse, + AsyncTailResourceWithRawResponse, + TailResourceWithStreamingResponse, + AsyncTailResourceWithStreamingResponse, ) from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, -) -from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, + ContentResource, + AsyncContentResource, + ContentResourceWithRawResponse, + AsyncContentResourceWithRawResponse, + ContentResourceWithStreamingResponse, + AsyncContentResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from .versions import ( + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes from ...._utils import ( @@ -45,29 +45,21 @@ async_maybe_transform, ) from .schedules import ( - Schedules, - AsyncSchedules, - SchedulesWithRawResponse, - AsyncSchedulesWithRawResponse, - SchedulesWithStreamingResponse, - AsyncSchedulesWithStreamingResponse, + SchedulesResource, + AsyncSchedulesResource, + SchedulesResourceWithRawResponse, + AsyncSchedulesResourceWithRawResponse, + SchedulesResourceWithStreamingResponse, + AsyncSchedulesResourceWithStreamingResponse, ) from ...._compat import cached_property -from .content_v2 import ( - ContentV2, - AsyncContentV2, - ContentV2WithRawResponse, - AsyncContentV2WithRawResponse, - ContentV2WithStreamingResponse, - AsyncContentV2WithStreamingResponse, -) -from .usage_model import ( - UsageModel, - AsyncUsageModel, - UsageModelWithRawResponse, - AsyncUsageModelWithRawResponse, - UsageModelWithStreamingResponse, - AsyncUsageModelWithStreamingResponse, +from .deployments import ( + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -90,47 +82,44 @@ AsyncPaginator, make_request_options, ) -from ....types.workers import WorkersScript, script_delete_params, script_update_params - -__all__ = ["Scripts", "AsyncScripts"] +from ....types.workers import script_delete_params, script_update_params +from ....types.workers.script import Script +__all__ = ["ScriptsResource", "AsyncScriptsResource"] -class Scripts(SyncAPIResource): - @cached_property - def bindings(self) -> Bindings: - return Bindings(self._client) +class ScriptsResource(SyncAPIResource): @cached_property - def schedules(self) -> Schedules: - return Schedules(self._client) + def schedules(self) -> SchedulesResource: + return SchedulesResource(self._client) @cached_property - def tail(self) -> Tail: - return Tail(self._client) + def tail(self) -> TailResource: + return TailResource(self._client) @cached_property - def usage_model(self) -> UsageModel: - return UsageModel(self._client) + def content(self) -> ContentResource: + return ContentResource(self._client) @cached_property - def content(self) -> Content: - return Content(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def content_v2(self) -> ContentV2: - return ContentV2(self._client) + def deployments(self) -> DeploymentsResource: + return DeploymentsResource(self._client) @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def versions(self) -> VersionsResource: + return VersionsResource(self._client) @cached_property - def with_raw_response(self) -> ScriptsWithRawResponse: - return ScriptsWithRawResponse(self) + def with_raw_response(self) -> ScriptsResourceWithRawResponse: + return ScriptsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ScriptsWithStreamingResponse: - return ScriptsWithStreamingResponse(self) + def with_streaming_response(self) -> ScriptsResourceWithStreamingResponse: + return ScriptsResourceWithStreamingResponse(self) @overload def update( @@ -147,7 +136,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: + ) -> Optional[Script]: """ Upload a worker module. @@ -163,6 +152,8 @@ def update( 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. @@ -190,7 +181,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: + ) -> Optional[Script]: """ Upload a worker module. @@ -232,7 +223,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: + ) -> Optional[Script]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: @@ -253,9 +244,9 @@ def update( extra_body=extra_body, timeout=timeout, query=maybe_transform({"rollback_to": rollback_to}, script_update_params.ScriptUpdateParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Script]]._unwrapper, ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) def list( @@ -268,7 +259,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[WorkersScript]: + ) -> SyncSinglePage[Script]: """ Fetch a list of uploaded workers. @@ -287,11 +278,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/workers/scripts", - page=SyncSinglePage[WorkersScript], + page=SyncSinglePage[Script], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=WorkersScript, + model=Script, ) def delete( @@ -299,6 +290,7 @@ def delete( script_name: str, *, account_id: str, + body: object, force: 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. @@ -335,6 +327,7 @@ def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( f"/accounts/{account_id}/workers/scripts/{script_name}", + body=maybe_transform(body, script_delete_params.ScriptDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -389,42 +382,38 @@ def get( ) -class AsyncScripts(AsyncAPIResource): - @cached_property - def bindings(self) -> AsyncBindings: - return AsyncBindings(self._client) - +class AsyncScriptsResource(AsyncAPIResource): @cached_property - def schedules(self) -> AsyncSchedules: - return AsyncSchedules(self._client) + def schedules(self) -> AsyncSchedulesResource: + return AsyncSchedulesResource(self._client) @cached_property - def tail(self) -> AsyncTail: - return AsyncTail(self._client) + def tail(self) -> AsyncTailResource: + return AsyncTailResource(self._client) @cached_property - def usage_model(self) -> AsyncUsageModel: - return AsyncUsageModel(self._client) + def content(self) -> AsyncContentResource: + return AsyncContentResource(self._client) @cached_property - def content(self) -> AsyncContent: - return AsyncContent(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def content_v2(self) -> AsyncContentV2: - return AsyncContentV2(self._client) + def deployments(self) -> AsyncDeploymentsResource: + return AsyncDeploymentsResource(self._client) @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def versions(self) -> AsyncVersionsResource: + return AsyncVersionsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncScriptsWithRawResponse: - return AsyncScriptsWithRawResponse(self) + def with_raw_response(self) -> AsyncScriptsResourceWithRawResponse: + return AsyncScriptsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncScriptsWithStreamingResponse: - return AsyncScriptsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncScriptsResourceWithStreamingResponse: + return AsyncScriptsResourceWithStreamingResponse(self) @overload async def update( @@ -441,7 +430,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: + ) -> Optional[Script]: """ Upload a worker module. @@ -457,6 +446,8 @@ async def update( 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. @@ -484,7 +475,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: + ) -> Optional[Script]: """ Upload a worker module. @@ -526,7 +517,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: + ) -> Optional[Script]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: @@ -549,9 +540,9 @@ async def update( query=await async_maybe_transform( {"rollback_to": rollback_to}, script_update_params.ScriptUpdateParams ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Script]]._unwrapper, ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) def list( @@ -564,7 +555,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WorkersScript, AsyncSinglePage[WorkersScript]]: + ) -> AsyncPaginator[Script, AsyncSinglePage[Script]]: """ Fetch a list of uploaded workers. @@ -583,11 +574,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/workers/scripts", - page=AsyncSinglePage[WorkersScript], + page=AsyncSinglePage[Script], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=WorkersScript, + model=Script, ) async def delete( @@ -595,6 +586,7 @@ async def delete( script_name: str, *, account_id: str, + body: object, force: 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. @@ -631,6 +623,7 @@ async def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( f"/accounts/{account_id}/workers/scripts/{script_name}", + body=await async_maybe_transform(body, script_delete_params.ScriptDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -685,8 +678,8 @@ async def get( ) -class ScriptsWithRawResponse: - def __init__(self, scripts: Scripts) -> None: +class ScriptsResourceWithRawResponse: + def __init__(self, scripts: ScriptsResource) -> None: self._scripts = scripts self.update = to_raw_response_wrapper( @@ -704,36 +697,32 @@ def __init__(self, scripts: Scripts) -> None: ) @cached_property - def bindings(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self._scripts.bindings) + def schedules(self) -> SchedulesResourceWithRawResponse: + return SchedulesResourceWithRawResponse(self._scripts.schedules) @cached_property - def schedules(self) -> SchedulesWithRawResponse: - return SchedulesWithRawResponse(self._scripts.schedules) + def tail(self) -> TailResourceWithRawResponse: + return TailResourceWithRawResponse(self._scripts.tail) @cached_property - def tail(self) -> TailWithRawResponse: - return TailWithRawResponse(self._scripts.tail) + def content(self) -> ContentResourceWithRawResponse: + return ContentResourceWithRawResponse(self._scripts.content) @cached_property - def usage_model(self) -> UsageModelWithRawResponse: - return UsageModelWithRawResponse(self._scripts.usage_model) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._scripts.settings) @cached_property - def content(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self._scripts.content) + def deployments(self) -> DeploymentsResourceWithRawResponse: + return DeploymentsResourceWithRawResponse(self._scripts.deployments) @cached_property - def content_v2(self) -> ContentV2WithRawResponse: - return ContentV2WithRawResponse(self._scripts.content_v2) + def versions(self) -> VersionsResourceWithRawResponse: + return VersionsResourceWithRawResponse(self._scripts.versions) - @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._scripts.settings) - -class AsyncScriptsWithRawResponse: - def __init__(self, scripts: AsyncScripts) -> None: +class AsyncScriptsResourceWithRawResponse: + def __init__(self, scripts: AsyncScriptsResource) -> None: self._scripts = scripts self.update = async_to_raw_response_wrapper( @@ -751,36 +740,32 @@ def __init__(self, scripts: AsyncScripts) -> None: ) @cached_property - def bindings(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self._scripts.bindings) - - @cached_property - def schedules(self) -> AsyncSchedulesWithRawResponse: - return AsyncSchedulesWithRawResponse(self._scripts.schedules) + def schedules(self) -> AsyncSchedulesResourceWithRawResponse: + return AsyncSchedulesResourceWithRawResponse(self._scripts.schedules) @cached_property - def tail(self) -> AsyncTailWithRawResponse: - return AsyncTailWithRawResponse(self._scripts.tail) + def tail(self) -> AsyncTailResourceWithRawResponse: + return AsyncTailResourceWithRawResponse(self._scripts.tail) @cached_property - def usage_model(self) -> AsyncUsageModelWithRawResponse: - return AsyncUsageModelWithRawResponse(self._scripts.usage_model) + def content(self) -> AsyncContentResourceWithRawResponse: + return AsyncContentResourceWithRawResponse(self._scripts.content) @cached_property - def content(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self._scripts.content) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._scripts.settings) @cached_property - def content_v2(self) -> AsyncContentV2WithRawResponse: - return AsyncContentV2WithRawResponse(self._scripts.content_v2) + def deployments(self) -> AsyncDeploymentsResourceWithRawResponse: + return AsyncDeploymentsResourceWithRawResponse(self._scripts.deployments) @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._scripts.settings) + def versions(self) -> AsyncVersionsResourceWithRawResponse: + return AsyncVersionsResourceWithRawResponse(self._scripts.versions) -class ScriptsWithStreamingResponse: - def __init__(self, scripts: Scripts) -> None: +class ScriptsResourceWithStreamingResponse: + def __init__(self, scripts: ScriptsResource) -> None: self._scripts = scripts self.update = to_streamed_response_wrapper( @@ -798,36 +783,32 @@ def __init__(self, scripts: Scripts) -> None: ) @cached_property - def bindings(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self._scripts.bindings) + def schedules(self) -> SchedulesResourceWithStreamingResponse: + return SchedulesResourceWithStreamingResponse(self._scripts.schedules) @cached_property - def schedules(self) -> SchedulesWithStreamingResponse: - return SchedulesWithStreamingResponse(self._scripts.schedules) + def tail(self) -> TailResourceWithStreamingResponse: + return TailResourceWithStreamingResponse(self._scripts.tail) @cached_property - def tail(self) -> TailWithStreamingResponse: - return TailWithStreamingResponse(self._scripts.tail) + def content(self) -> ContentResourceWithStreamingResponse: + return ContentResourceWithStreamingResponse(self._scripts.content) @cached_property - def usage_model(self) -> UsageModelWithStreamingResponse: - return UsageModelWithStreamingResponse(self._scripts.usage_model) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._scripts.settings) @cached_property - def content(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self._scripts.content) + def deployments(self) -> DeploymentsResourceWithStreamingResponse: + return DeploymentsResourceWithStreamingResponse(self._scripts.deployments) @cached_property - def content_v2(self) -> ContentV2WithStreamingResponse: - return ContentV2WithStreamingResponse(self._scripts.content_v2) + def versions(self) -> VersionsResourceWithStreamingResponse: + return VersionsResourceWithStreamingResponse(self._scripts.versions) - @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._scripts.settings) - -class AsyncScriptsWithStreamingResponse: - def __init__(self, scripts: AsyncScripts) -> None: +class AsyncScriptsResourceWithStreamingResponse: + def __init__(self, scripts: AsyncScriptsResource) -> None: self._scripts = scripts self.update = async_to_streamed_response_wrapper( @@ -845,29 +826,25 @@ def __init__(self, scripts: AsyncScripts) -> None: ) @cached_property - def bindings(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self._scripts.bindings) - - @cached_property - def schedules(self) -> AsyncSchedulesWithStreamingResponse: - return AsyncSchedulesWithStreamingResponse(self._scripts.schedules) + def schedules(self) -> AsyncSchedulesResourceWithStreamingResponse: + return AsyncSchedulesResourceWithStreamingResponse(self._scripts.schedules) @cached_property - def tail(self) -> AsyncTailWithStreamingResponse: - return AsyncTailWithStreamingResponse(self._scripts.tail) + def tail(self) -> AsyncTailResourceWithStreamingResponse: + return AsyncTailResourceWithStreamingResponse(self._scripts.tail) @cached_property - def usage_model(self) -> AsyncUsageModelWithStreamingResponse: - return AsyncUsageModelWithStreamingResponse(self._scripts.usage_model) + def content(self) -> AsyncContentResourceWithStreamingResponse: + return AsyncContentResourceWithStreamingResponse(self._scripts.content) @cached_property - def content(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self._scripts.content) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._scripts.settings) @cached_property - def content_v2(self) -> AsyncContentV2WithStreamingResponse: - return AsyncContentV2WithStreamingResponse(self._scripts.content_v2) + def deployments(self) -> AsyncDeploymentsResourceWithStreamingResponse: + return AsyncDeploymentsResourceWithStreamingResponse(self._scripts.deployments) @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._scripts.settings) + def versions(self) -> AsyncVersionsResourceWithStreamingResponse: + return AsyncVersionsResourceWithStreamingResponse(self._scripts.versions) diff --git a/src/cloudflare/resources/workers/scripts/settings.py b/src/cloudflare/resources/workers/scripts/settings.py index 8cf8611f780..0e094f58b04 100644 --- a/src/cloudflare/resources/workers/scripts/settings.py +++ b/src/cloudflare/resources/workers/scripts/settings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Iterable, Optional, cast import httpx @@ -23,41 +23,50 @@ from ...._base_client import ( make_request_options, ) -from ....types.workers.scripts import SettingGetResponse, SettingEditResponse, setting_edit_params +from ....types.workers.scripts import setting_edit_params +from ....types.workers.script_setting import ScriptSetting +from ....types.workers.scripts.consumer_script_param import ConsumerScriptParam -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def edit( self, script_name: str, *, account_id: str, - settings: setting_edit_params.Settings | NotGiven = NOT_GIVEN, + logpush: bool | NotGiven = NOT_GIVEN, + tail_consumers: Iterable[ConsumerScriptParam] | 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, - ) -> SettingEditResponse: + ) -> Optional[ScriptSetting]: """ - Patch script metadata or config, such as bindings or usage model + Patch script-level settings when using + [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). + Includes Logpush and Tail Consumers. Args: account_id: Identifier script_name: Name of the script, used in URLs and route configuration. + logpush: Whether Logpush is turned on for the Worker. + + tail_consumers: List of Workers that will consume logs from the attached Worker. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -71,16 +80,22 @@ def edit( if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return self._patch( - f"/accounts/{account_id}/workers/scripts/{script_name}/settings", - body=maybe_transform({"settings": settings}, setting_edit_params.SettingEditParams), + f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings", + body=maybe_transform( + { + "logpush": logpush, + "tail_consumers": tail_consumers, + }, + setting_edit_params.SettingEditParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScriptSetting]]._unwrapper, ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), + cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]), ) def get( @@ -94,9 +109,11 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingGetResponse: + ) -> Optional[ScriptSetting]: """ - Get script metadata and config, such as bindings or usage model + Get script-level settings when using + [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). + Includes Logpush and Tail Consumers. Args: account_id: Identifier @@ -116,48 +133,55 @@ def get( if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/settings", + f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScriptSetting]]._unwrapper, ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), + cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]), ) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def edit( self, script_name: str, *, account_id: str, - settings: setting_edit_params.Settings | NotGiven = NOT_GIVEN, + logpush: bool | NotGiven = NOT_GIVEN, + tail_consumers: Iterable[ConsumerScriptParam] | 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, - ) -> SettingEditResponse: + ) -> Optional[ScriptSetting]: """ - Patch script metadata or config, such as bindings or usage model + Patch script-level settings when using + [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). + Includes Logpush and Tail Consumers. Args: account_id: Identifier script_name: Name of the script, used in URLs and route configuration. + logpush: Whether Logpush is turned on for the Worker. + + tail_consumers: List of Workers that will consume logs from the attached Worker. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -171,16 +195,22 @@ async def edit( if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return await self._patch( - f"/accounts/{account_id}/workers/scripts/{script_name}/settings", - body=await async_maybe_transform({"settings": settings}, setting_edit_params.SettingEditParams), + f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings", + body=await async_maybe_transform( + { + "logpush": logpush, + "tail_consumers": tail_consumers, + }, + setting_edit_params.SettingEditParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScriptSetting]]._unwrapper, ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), + cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]), ) async def get( @@ -194,9 +224,11 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingGetResponse: + ) -> Optional[ScriptSetting]: """ - Get script metadata and config, such as bindings or usage model + Get script-level settings when using + [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). + Includes Logpush and Tail Consumers. Args: account_id: Identifier @@ -216,20 +248,20 @@ async def get( if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return await self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/settings", + f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ScriptSetting]]._unwrapper, ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), + cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]), ) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.edit = to_raw_response_wrapper( @@ -240,8 +272,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.edit = async_to_raw_response_wrapper( @@ -252,8 +284,8 @@ def __init__(self, settings: AsyncSettings) -> None: ) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.edit = to_streamed_response_wrapper( @@ -264,8 +296,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/workers/scripts/tail.py b/src/cloudflare/resources/workers/scripts/tail.py index b040ce28bc1..c0185a5b22b 100644 --- a/src/cloudflare/resources/workers/scripts/tail.py +++ b/src/cloudflare/resources/workers/scripts/tail.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing import Any, Type, cast +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 ( @@ -19,32 +23,36 @@ from ...._base_client import ( make_request_options, ) -from ....types.workers.scripts import TailGetResponse, TailCreateResponse, TailDeleteResponse +from ....types.workers.scripts import tail_create_params, tail_delete_params +from ....types.workers.scripts.tail_get_response import TailGetResponse +from ....types.workers.scripts.tail_create_response import TailCreateResponse +from ....types.workers.scripts.tail_delete_response import TailDeleteResponse -__all__ = ["Tail", "AsyncTail"] +__all__ = ["TailResource", "AsyncTailResource"] -class Tail(SyncAPIResource): +class TailResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TailWithRawResponse: - return TailWithRawResponse(self) + def with_raw_response(self) -> TailResourceWithRawResponse: + return TailResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TailWithStreamingResponse: - return TailWithStreamingResponse(self) + def with_streaming_response(self) -> TailResourceWithStreamingResponse: + return TailResourceWithStreamingResponse(self) def create( self, script_name: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> TailCreateResponse: + ) -> Optional[TailCreateResponse]: """ Starts a tail that receives logs and exception from a Worker. @@ -67,14 +75,15 @@ def create( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return self._post( f"/accounts/{account_id}/workers/scripts/{script_name}/tails", + body=maybe_transform(body, tail_create_params.TailCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TailCreateResponse]]._unwrapper, ), - cast_to=cast(Type[TailCreateResponse], ResultWrapper[TailCreateResponse]), + cast_to=cast(Type[Optional[TailCreateResponse]], ResultWrapper[TailCreateResponse]), ) def delete( @@ -83,6 +92,7 @@ def delete( *, account_id: str, script_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -114,21 +124,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return cast( - TailDeleteResponse, - self._delete( - f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TailDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}", + body=maybe_transform(body, tail_delete_params.TailDeleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=TailDeleteResponse, ) def get( @@ -142,7 +144,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TailGetResponse: + ) -> Optional[TailGetResponse]: """ Get list of tails currently deployed on a Worker. @@ -170,33 +172,34 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TailGetResponse]]._unwrapper, ), - cast_to=cast(Type[TailGetResponse], ResultWrapper[TailGetResponse]), + cast_to=cast(Type[Optional[TailGetResponse]], ResultWrapper[TailGetResponse]), ) -class AsyncTail(AsyncAPIResource): +class AsyncTailResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTailWithRawResponse: - return AsyncTailWithRawResponse(self) + def with_raw_response(self) -> AsyncTailResourceWithRawResponse: + return AsyncTailResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTailWithStreamingResponse: - return AsyncTailWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTailResourceWithStreamingResponse: + return AsyncTailResourceWithStreamingResponse(self) async def create( self, script_name: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> TailCreateResponse: + ) -> Optional[TailCreateResponse]: """ Starts a tail that receives logs and exception from a Worker. @@ -219,14 +222,15 @@ async def create( 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/scripts/{script_name}/tails", + body=await async_maybe_transform(body, tail_create_params.TailCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TailCreateResponse]]._unwrapper, ), - cast_to=cast(Type[TailCreateResponse], ResultWrapper[TailCreateResponse]), + cast_to=cast(Type[Optional[TailCreateResponse]], ResultWrapper[TailCreateResponse]), ) async def delete( @@ -235,6 +239,7 @@ async def delete( *, account_id: str, script_name: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -266,21 +271,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return cast( - TailDeleteResponse, - await self._delete( - f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TailDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}", + body=await async_maybe_transform(body, tail_delete_params.TailDeleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=TailDeleteResponse, ) async def get( @@ -294,7 +291,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TailGetResponse: + ) -> Optional[TailGetResponse]: """ Get list of tails currently deployed on a Worker. @@ -322,14 +319,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TailGetResponse]]._unwrapper, ), - cast_to=cast(Type[TailGetResponse], ResultWrapper[TailGetResponse]), + cast_to=cast(Type[Optional[TailGetResponse]], ResultWrapper[TailGetResponse]), ) -class TailWithRawResponse: - def __init__(self, tail: Tail) -> None: +class TailResourceWithRawResponse: + def __init__(self, tail: TailResource) -> None: self._tail = tail self.create = to_raw_response_wrapper( @@ -343,8 +340,8 @@ def __init__(self, tail: Tail) -> None: ) -class AsyncTailWithRawResponse: - def __init__(self, tail: AsyncTail) -> None: +class AsyncTailResourceWithRawResponse: + def __init__(self, tail: AsyncTailResource) -> None: self._tail = tail self.create = async_to_raw_response_wrapper( @@ -358,8 +355,8 @@ def __init__(self, tail: AsyncTail) -> None: ) -class TailWithStreamingResponse: - def __init__(self, tail: Tail) -> None: +class TailResourceWithStreamingResponse: + def __init__(self, tail: TailResource) -> None: self._tail = tail self.create = to_streamed_response_wrapper( @@ -373,8 +370,8 @@ def __init__(self, tail: Tail) -> None: ) -class AsyncTailWithStreamingResponse: - def __init__(self, tail: AsyncTail) -> None: +class AsyncTailResourceWithStreamingResponse: + def __init__(self, tail: AsyncTailResource) -> None: self._tail = tail self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/workers/scripts/usage_model.py b/src/cloudflare/resources/workers/scripts/usage_model.py deleted file mode 100644 index b008bdb3cca..00000000000 --- a/src/cloudflare/resources/workers/scripts/usage_model.py +++ /dev/null @@ -1,280 +0,0 @@ -# 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 ...._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.scripts import UsageModelGetResponse, UsageModelUpdateResponse, usage_model_update_params - -__all__ = ["UsageModel", "AsyncUsageModel"] - - -class UsageModel(SyncAPIResource): - @cached_property - def with_raw_response(self) -> UsageModelWithRawResponse: - return UsageModelWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UsageModelWithStreamingResponse: - return UsageModelWithStreamingResponse(self) - - def update( - self, - script_name: str, - *, - account_id: str, - body: 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, - ) -> UsageModelUpdateResponse: - """Updates the Usage Model for a given Worker. - - Requires a Workers Paid - subscription. - - Args: - account_id: Identifier - - script_name: 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 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}/usage-model", - body=maybe_transform(body, usage_model_update_params.UsageModelUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[UsageModelUpdateResponse], ResultWrapper[UsageModelUpdateResponse]), - ) - - def get( - self, - script_name: 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, - ) -> UsageModelGetResponse: - """ - Fetches the Usage Model for a given Worker. - - Args: - account_id: Identifier - - script_name: 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 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._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/usage-model", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[UsageModelGetResponse], ResultWrapper[UsageModelGetResponse]), - ) - - -class AsyncUsageModel(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncUsageModelWithRawResponse: - return AsyncUsageModelWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUsageModelWithStreamingResponse: - return AsyncUsageModelWithStreamingResponse(self) - - async def update( - self, - script_name: str, - *, - account_id: str, - body: 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, - ) -> UsageModelUpdateResponse: - """Updates the Usage Model for a given Worker. - - Requires a Workers Paid - subscription. - - Args: - account_id: Identifier - - script_name: 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 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}/usage-model", - body=await async_maybe_transform(body, usage_model_update_params.UsageModelUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[UsageModelUpdateResponse], ResultWrapper[UsageModelUpdateResponse]), - ) - - async def get( - self, - script_name: 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, - ) -> UsageModelGetResponse: - """ - Fetches the Usage Model for a given Worker. - - Args: - account_id: Identifier - - script_name: 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 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._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/usage-model", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[UsageModelGetResponse], ResultWrapper[UsageModelGetResponse]), - ) - - -class UsageModelWithRawResponse: - def __init__(self, usage_model: UsageModel) -> None: - self._usage_model = usage_model - - self.update = to_raw_response_wrapper( - usage_model.update, - ) - self.get = to_raw_response_wrapper( - usage_model.get, - ) - - -class AsyncUsageModelWithRawResponse: - def __init__(self, usage_model: AsyncUsageModel) -> None: - self._usage_model = usage_model - - self.update = async_to_raw_response_wrapper( - usage_model.update, - ) - self.get = async_to_raw_response_wrapper( - usage_model.get, - ) - - -class UsageModelWithStreamingResponse: - def __init__(self, usage_model: UsageModel) -> None: - self._usage_model = usage_model - - self.update = to_streamed_response_wrapper( - usage_model.update, - ) - self.get = to_streamed_response_wrapper( - usage_model.get, - ) - - -class AsyncUsageModelWithStreamingResponse: - def __init__(self, usage_model: AsyncUsageModel) -> None: - self._usage_model = usage_model - - self.update = async_to_streamed_response_wrapper( - usage_model.update, - ) - self.get = async_to_streamed_response_wrapper( - usage_model.get, - ) diff --git a/src/cloudflare/resources/workers/scripts/versions.py b/src/cloudflare/resources/workers/scripts/versions.py new file mode 100644 index 00000000000..493ece2bd84 --- /dev/null +++ b/src/cloudflare/resources/workers/scripts/versions.py @@ -0,0 +1,429 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Type, Mapping, Optional, 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.workers.scripts import version_create_params +from ....types.workers.scripts.version_get_response import VersionGetResponse +from ....types.workers.scripts.version_list_response import VersionListResponse +from ....types.workers.scripts.version_create_response import VersionCreateResponse + +__all__ = ["VersionsResource", "AsyncVersionsResource"] + + +class VersionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VersionsResourceWithRawResponse: + return VersionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VersionsResourceWithStreamingResponse: + return VersionsResourceWithStreamingResponse(self) + + def create( + self, + script_name: str, + *, + account_id: str, + any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, + metadata: version_create_params.Metadata | 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[VersionCreateResponse]: + """ + Upload a Worker Version without deploying to Cloudflare's network. + + Args: + account_id: Identifier + + 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 + + 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 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=[["", ""]]) + if files: + # 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, + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[VersionCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[VersionCreateResponse]], ResultWrapper[VersionCreateResponse]), + ) + + def list( + self, + script_name: 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[VersionListResponse]: + """List of Worker Versions. + + The first version in the list is the latest version. + + Args: + account_id: Identifier + + script_name: Name of the script. + + 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 script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + return self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/versions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[VersionListResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[VersionListResponse]], ResultWrapper[VersionListResponse]), + ) + + def get( + self, + version_id: str, + *, + account_id: str, + script_name: 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[VersionGetResponse]: + """ + Get Version Detail + + Args: + account_id: Identifier + + script_name: Name of the script. + + 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 script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + if not version_id: + raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}") + return self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[VersionGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[VersionGetResponse]], ResultWrapper[VersionGetResponse]), + ) + + +class AsyncVersionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVersionsResourceWithRawResponse: + return AsyncVersionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVersionsResourceWithStreamingResponse: + return AsyncVersionsResourceWithStreamingResponse(self) + + async def create( + self, + script_name: str, + *, + account_id: str, + any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, + metadata: version_create_params.Metadata | 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[VersionCreateResponse]: + """ + Upload a Worker Version without deploying to Cloudflare's network. + + Args: + account_id: Identifier + + 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 + + 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 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=[["", ""]]) + if files: + # 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, + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[VersionCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[VersionCreateResponse]], ResultWrapper[VersionCreateResponse]), + ) + + async def list( + self, + script_name: 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[VersionListResponse]: + """List of Worker Versions. + + The first version in the list is the latest version. + + Args: + account_id: Identifier + + script_name: Name of the script. + + 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 script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + return await self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/versions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[VersionListResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[VersionListResponse]], ResultWrapper[VersionListResponse]), + ) + + async def get( + self, + version_id: str, + *, + account_id: str, + script_name: 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[VersionGetResponse]: + """ + Get Version Detail + + Args: + account_id: Identifier + + script_name: Name of the script. + + 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 script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + if not version_id: + raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}") + return await self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[VersionGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[VersionGetResponse]], ResultWrapper[VersionGetResponse]), + ) + + +class VersionsResourceWithRawResponse: + def __init__(self, versions: VersionsResource) -> None: + self._versions = versions + + self.create = to_raw_response_wrapper( + versions.create, + ) + self.list = to_raw_response_wrapper( + versions.list, + ) + self.get = to_raw_response_wrapper( + versions.get, + ) + + +class AsyncVersionsResourceWithRawResponse: + def __init__(self, versions: AsyncVersionsResource) -> None: + self._versions = versions + + self.create = async_to_raw_response_wrapper( + versions.create, + ) + self.list = async_to_raw_response_wrapper( + versions.list, + ) + self.get = async_to_raw_response_wrapper( + versions.get, + ) + + +class VersionsResourceWithStreamingResponse: + def __init__(self, versions: VersionsResource) -> None: + self._versions = versions + + self.create = to_streamed_response_wrapper( + versions.create, + ) + self.list = to_streamed_response_wrapper( + versions.list, + ) + self.get = to_streamed_response_wrapper( + versions.get, + ) + + +class AsyncVersionsResourceWithStreamingResponse: + def __init__(self, versions: AsyncVersionsResource) -> None: + self._versions = versions + + self.create = async_to_streamed_response_wrapper( + versions.create, + ) + self.list = async_to_streamed_response_wrapper( + versions.list, + ) + self.get = async_to_streamed_response_wrapper( + versions.get, + ) diff --git a/src/cloudflare/resources/workers/services/__init__.py b/src/cloudflare/resources/workers/services/__init__.py deleted file mode 100644 index 96650dff04d..00000000000 --- a/src/cloudflare/resources/workers/services/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .services import ( - Services, - AsyncServices, - ServicesWithRawResponse, - AsyncServicesWithRawResponse, - ServicesWithStreamingResponse, - AsyncServicesWithStreamingResponse, -) -from .environments import ( - Environments, - AsyncEnvironments, - EnvironmentsWithRawResponse, - AsyncEnvironmentsWithRawResponse, - EnvironmentsWithStreamingResponse, - AsyncEnvironmentsWithStreamingResponse, -) - -__all__ = [ - "Environments", - "AsyncEnvironments", - "EnvironmentsWithRawResponse", - "AsyncEnvironmentsWithRawResponse", - "EnvironmentsWithStreamingResponse", - "AsyncEnvironmentsWithStreamingResponse", - "Services", - "AsyncServices", - "ServicesWithRawResponse", - "AsyncServicesWithRawResponse", - "ServicesWithStreamingResponse", - "AsyncServicesWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/services/environments/__init__.py b/src/cloudflare/resources/workers/services/environments/__init__.py deleted file mode 100644 index 5717ce990a4..00000000000 --- a/src/cloudflare/resources/workers/services/environments/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, -) -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) -from .environments import ( - Environments, - AsyncEnvironments, - EnvironmentsWithRawResponse, - AsyncEnvironmentsWithRawResponse, - EnvironmentsWithStreamingResponse, - AsyncEnvironmentsWithStreamingResponse, -) - -__all__ = [ - "Content", - "AsyncContent", - "ContentWithRawResponse", - "AsyncContentWithRawResponse", - "ContentWithStreamingResponse", - "AsyncContentWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Environments", - "AsyncEnvironments", - "EnvironmentsWithRawResponse", - "AsyncEnvironmentsWithRawResponse", - "EnvironmentsWithStreamingResponse", - "AsyncEnvironmentsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/services/environments/content.py b/src/cloudflare/resources/workers/services/environments/content.py deleted file mode 100644 index de0711bacb6..00000000000 --- a/src/cloudflare/resources/workers/services/environments/content.py +++ /dev/null @@ -1,349 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, 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 ( - 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.workers import WorkersScript -from .....types.workers.services.environments import content_update_params - -__all__ = ["Content", "AsyncContent"] - - -class Content(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self) - - def update( - self, - environment_name: str, - *, - account_id: str, - service_name: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: content_update_params.Metadata | 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, - ) -> WorkersScript: - """ - Put script content from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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. - - metadata: JSON encoded metadata about the uploaded parts and Worker 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) - if files: - # 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/services/{service_name}/environments/{environment_name}/content", - body=maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), - ) - - def get( - self, - environment_name: str, - *, - account_id: str, - service_name: 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: - """ - Get script content from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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 service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - extra_headers = {"Accept": "string", **(extra_headers or {})} - return self._get( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/content", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BinaryAPIResponse, - ) - - -class AsyncContent(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self) - - async def update( - self, - environment_name: str, - *, - account_id: str, - service_name: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: content_update_params.Metadata | 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, - ) -> WorkersScript: - """ - Put script content from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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. - - metadata: JSON encoded metadata about the uploaded parts and Worker 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) - if files: - # 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/services/{service_name}/environments/{environment_name}/content", - body=await async_maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), - ) - - async def get( - self, - environment_name: str, - *, - account_id: str, - service_name: 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: - """ - Get script content from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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 service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - extra_headers = {"Accept": "string", **(extra_headers or {})} - return await self._get( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/content", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AsyncBinaryAPIResponse, - ) - - -class ContentWithRawResponse: - def __init__(self, content: Content) -> None: - self._content = content - - self.update = to_raw_response_wrapper( - content.update, - ) - self.get = to_custom_raw_response_wrapper( - content.get, - BinaryAPIResponse, - ) - - -class AsyncContentWithRawResponse: - def __init__(self, content: AsyncContent) -> None: - self._content = content - - self.update = async_to_raw_response_wrapper( - content.update, - ) - self.get = async_to_custom_raw_response_wrapper( - content.get, - AsyncBinaryAPIResponse, - ) - - -class ContentWithStreamingResponse: - def __init__(self, content: Content) -> None: - self._content = content - - self.update = to_streamed_response_wrapper( - content.update, - ) - self.get = to_custom_streamed_response_wrapper( - content.get, - StreamedBinaryAPIResponse, - ) - - -class AsyncContentWithStreamingResponse: - def __init__(self, content: AsyncContent) -> None: - self._content = content - - self.update = async_to_streamed_response_wrapper( - content.update, - ) - self.get = async_to_custom_streamed_response_wrapper( - content.get, - AsyncStreamedBinaryAPIResponse, - ) diff --git a/src/cloudflare/resources/workers/services/environments/environments.py b/src/cloudflare/resources/workers/services/environments/environments.py deleted file mode 100644 index 445c827e40a..00000000000 --- a/src/cloudflare/resources/workers/services/environments/environments.py +++ /dev/null @@ -1,112 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, -) -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["Environments", "AsyncEnvironments"] - - -class Environments(SyncAPIResource): - @cached_property - def content(self) -> Content: - return Content(self._client) - - @cached_property - def settings(self) -> Settings: - return Settings(self._client) - - @cached_property - def with_raw_response(self) -> EnvironmentsWithRawResponse: - return EnvironmentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EnvironmentsWithStreamingResponse: - return EnvironmentsWithStreamingResponse(self) - - -class AsyncEnvironments(AsyncAPIResource): - @cached_property - def content(self) -> AsyncContent: - return AsyncContent(self._client) - - @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) - - @cached_property - def with_raw_response(self) -> AsyncEnvironmentsWithRawResponse: - return AsyncEnvironmentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEnvironmentsWithStreamingResponse: - return AsyncEnvironmentsWithStreamingResponse(self) - - -class EnvironmentsWithRawResponse: - def __init__(self, environments: Environments) -> None: - self._environments = environments - - @cached_property - def content(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self._environments.content) - - @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._environments.settings) - - -class AsyncEnvironmentsWithRawResponse: - def __init__(self, environments: AsyncEnvironments) -> None: - self._environments = environments - - @cached_property - def content(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self._environments.content) - - @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._environments.settings) - - -class EnvironmentsWithStreamingResponse: - def __init__(self, environments: Environments) -> None: - self._environments = environments - - @cached_property - def content(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self._environments.content) - - @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._environments.settings) - - -class AsyncEnvironmentsWithStreamingResponse: - def __init__(self, environments: AsyncEnvironments) -> None: - self._environments = environments - - @cached_property - def content(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self._environments.content) - - @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._environments.settings) diff --git a/src/cloudflare/resources/workers/services/environments/settings.py b/src/cloudflare/resources/workers/services/environments/settings.py deleted file mode 100644 index 89ebd37de6d..00000000000 --- a/src/cloudflare/resources/workers/services/environments/settings.py +++ /dev/null @@ -1,323 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Iterable, 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.workers.services.environments import SettingGetResponse, SettingEditResponse, setting_edit_params - -__all__ = ["Settings", "AsyncSettings"] - - -class Settings(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) - - def edit( - self, - environment_name: str, - *, - account_id: str, - service_name: str, - errors: Iterable[setting_edit_params.Error], - messages: Iterable[setting_edit_params.Message], - result: setting_edit_params.Result, - success: Literal[True], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> SettingEditResponse: - """ - Patch script metadata, such as bindings - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - success: Whether the API call was successful - - 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 service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - return self._patch( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/settings", - body=maybe_transform( - { - "errors": errors, - "messages": messages, - "result": result, - "success": success, - }, - setting_edit_params.SettingEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), - ) - - def get( - self, - environment_name: str, - *, - account_id: str, - service_name: 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, - ) -> SettingGetResponse: - """ - Get script settings from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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 service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - return self._get( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), - ) - - -class AsyncSettings(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) - - async def edit( - self, - environment_name: str, - *, - account_id: str, - service_name: str, - errors: Iterable[setting_edit_params.Error], - messages: Iterable[setting_edit_params.Message], - result: setting_edit_params.Result, - success: Literal[True], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> SettingEditResponse: - """ - Patch script metadata, such as bindings - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - success: Whether the API call was successful - - 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 service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - return await self._patch( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/settings", - body=await async_maybe_transform( - { - "errors": errors, - "messages": messages, - "result": result, - "success": success, - }, - setting_edit_params.SettingEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), - ) - - async def get( - self, - environment_name: str, - *, - account_id: str, - service_name: 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, - ) -> SettingGetResponse: - """ - Get script settings from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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 service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - return await self._get( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), - ) - - -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: - self._settings = settings - - self.edit = to_raw_response_wrapper( - settings.edit, - ) - self.get = to_raw_response_wrapper( - settings.get, - ) - - -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: - self._settings = settings - - self.edit = async_to_raw_response_wrapper( - settings.edit, - ) - self.get = async_to_raw_response_wrapper( - settings.get, - ) - - -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: - self._settings = settings - - self.edit = to_streamed_response_wrapper( - settings.edit, - ) - self.get = to_streamed_response_wrapper( - settings.get, - ) - - -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: - self._settings = settings - - self.edit = async_to_streamed_response_wrapper( - settings.edit, - ) - self.get = async_to_streamed_response_wrapper( - settings.get, - ) diff --git a/src/cloudflare/resources/workers/services/services.py b/src/cloudflare/resources/workers/services/services.py deleted file mode 100644 index 0f63305c3bd..00000000000 --- a/src/cloudflare/resources/workers/services/services.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .environments import ( - Environments, - AsyncEnvironments, - EnvironmentsWithRawResponse, - AsyncEnvironmentsWithRawResponse, - EnvironmentsWithStreamingResponse, - AsyncEnvironmentsWithStreamingResponse, -) -from .environments.environments import Environments, AsyncEnvironments - -__all__ = ["Services", "AsyncServices"] - - -class Services(SyncAPIResource): - @cached_property - def environments(self) -> Environments: - return Environments(self._client) - - @cached_property - def with_raw_response(self) -> ServicesWithRawResponse: - return ServicesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ServicesWithStreamingResponse: - return ServicesWithStreamingResponse(self) - - -class AsyncServices(AsyncAPIResource): - @cached_property - def environments(self) -> AsyncEnvironments: - return AsyncEnvironments(self._client) - - @cached_property - def with_raw_response(self) -> AsyncServicesWithRawResponse: - return AsyncServicesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncServicesWithStreamingResponse: - return AsyncServicesWithStreamingResponse(self) - - -class ServicesWithRawResponse: - def __init__(self, services: Services) -> None: - self._services = services - - @cached_property - def environments(self) -> EnvironmentsWithRawResponse: - return EnvironmentsWithRawResponse(self._services.environments) - - -class AsyncServicesWithRawResponse: - def __init__(self, services: AsyncServices) -> None: - self._services = services - - @cached_property - def environments(self) -> AsyncEnvironmentsWithRawResponse: - return AsyncEnvironmentsWithRawResponse(self._services.environments) - - -class ServicesWithStreamingResponse: - def __init__(self, services: Services) -> None: - self._services = services - - @cached_property - def environments(self) -> EnvironmentsWithStreamingResponse: - return EnvironmentsWithStreamingResponse(self._services.environments) - - -class AsyncServicesWithStreamingResponse: - def __init__(self, services: AsyncServices) -> None: - self._services = services - - @cached_property - def environments(self) -> AsyncEnvironmentsWithStreamingResponse: - return AsyncEnvironmentsWithStreamingResponse(self._services.environments) diff --git a/src/cloudflare/resources/workers/subdomains.py b/src/cloudflare/resources/workers/subdomains.py index 53e6c2ff836..de75ee895ef 100644 --- a/src/cloudflare/resources/workers/subdomains.py +++ b/src/cloudflare/resources/workers/subdomains.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.workers import SubdomainGetResponse, SubdomainUpdateResponse, subdomain_update_params +from ...types.workers import subdomain_update_params +from ...types.workers.subdomain_get_response import SubdomainGetResponse +from ...types.workers.subdomain_update_response import SubdomainUpdateResponse -__all__ = ["Subdomains", "AsyncSubdomains"] +__all__ = ["SubdomainsResource", "AsyncSubdomainsResource"] -class Subdomains(SyncAPIResource): +class SubdomainsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SubdomainsWithRawResponse: - return SubdomainsWithRawResponse(self) + def with_raw_response(self) -> SubdomainsResourceWithRawResponse: + return SubdomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SubdomainsWithStreamingResponse: - return SubdomainsWithStreamingResponse(self) + def with_streaming_response(self) -> SubdomainsResourceWithStreamingResponse: + return SubdomainsResourceWithStreamingResponse(self) def update( self, @@ -48,7 +50,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SubdomainUpdateResponse: + ) -> Optional[SubdomainUpdateResponse]: """ Creates a Workers subdomain for an account. @@ -73,9 +75,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SubdomainUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[SubdomainUpdateResponse], ResultWrapper[SubdomainUpdateResponse]), + cast_to=cast(Type[Optional[SubdomainUpdateResponse]], ResultWrapper[SubdomainUpdateResponse]), ) def get( @@ -88,7 +90,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SubdomainGetResponse: + ) -> Optional[SubdomainGetResponse]: """ Returns a Workers subdomain for an account. @@ -112,20 +114,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SubdomainGetResponse]]._unwrapper, ), - cast_to=cast(Type[SubdomainGetResponse], ResultWrapper[SubdomainGetResponse]), + cast_to=cast(Type[Optional[SubdomainGetResponse]], ResultWrapper[SubdomainGetResponse]), ) -class AsyncSubdomains(AsyncAPIResource): +class AsyncSubdomainsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSubdomainsWithRawResponse: - return AsyncSubdomainsWithRawResponse(self) + def with_raw_response(self) -> AsyncSubdomainsResourceWithRawResponse: + return AsyncSubdomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSubdomainsWithStreamingResponse: - return AsyncSubdomainsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSubdomainsResourceWithStreamingResponse: + return AsyncSubdomainsResourceWithStreamingResponse(self) async def update( self, @@ -138,7 +140,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SubdomainUpdateResponse: + ) -> Optional[SubdomainUpdateResponse]: """ Creates a Workers subdomain for an account. @@ -163,9 +165,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SubdomainUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[SubdomainUpdateResponse], ResultWrapper[SubdomainUpdateResponse]), + cast_to=cast(Type[Optional[SubdomainUpdateResponse]], ResultWrapper[SubdomainUpdateResponse]), ) async def get( @@ -178,7 +180,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SubdomainGetResponse: + ) -> Optional[SubdomainGetResponse]: """ Returns a Workers subdomain for an account. @@ -202,14 +204,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SubdomainGetResponse]]._unwrapper, ), - cast_to=cast(Type[SubdomainGetResponse], ResultWrapper[SubdomainGetResponse]), + cast_to=cast(Type[Optional[SubdomainGetResponse]], ResultWrapper[SubdomainGetResponse]), ) -class SubdomainsWithRawResponse: - def __init__(self, subdomains: Subdomains) -> None: +class SubdomainsResourceWithRawResponse: + def __init__(self, subdomains: SubdomainsResource) -> None: self._subdomains = subdomains self.update = to_raw_response_wrapper( @@ -220,8 +222,8 @@ def __init__(self, subdomains: Subdomains) -> None: ) -class AsyncSubdomainsWithRawResponse: - def __init__(self, subdomains: AsyncSubdomains) -> None: +class AsyncSubdomainsResourceWithRawResponse: + def __init__(self, subdomains: AsyncSubdomainsResource) -> None: self._subdomains = subdomains self.update = async_to_raw_response_wrapper( @@ -232,8 +234,8 @@ def __init__(self, subdomains: AsyncSubdomains) -> None: ) -class SubdomainsWithStreamingResponse: - def __init__(self, subdomains: Subdomains) -> None: +class SubdomainsResourceWithStreamingResponse: + def __init__(self, subdomains: SubdomainsResource) -> None: self._subdomains = subdomains self.update = to_streamed_response_wrapper( @@ -244,8 +246,8 @@ def __init__(self, subdomains: Subdomains) -> None: ) -class AsyncSubdomainsWithStreamingResponse: - def __init__(self, subdomains: AsyncSubdomains) -> None: +class AsyncSubdomainsResourceWithStreamingResponse: + def __init__(self, subdomains: AsyncSubdomainsResource) -> None: self._subdomains = subdomains self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/workers/workers.py b/src/cloudflare/resources/workers/workers.py index 9438f5c7ed2..195b4a21670 100644 --- a/src/cloudflare/resources/workers/workers.py +++ b/src/cloudflare/resources/workers/workers.py @@ -3,337 +3,207 @@ from __future__ import annotations from .ai import ( - AI, - AsyncAI, - AIWithRawResponse, - AsyncAIWithRawResponse, - AIWithStreamingResponse, - AsyncAIWithStreamingResponse, -) -from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + AIResource, + AsyncAIResource, + AIResourceWithRawResponse, + AsyncAIResourceWithRawResponse, + AIResourceWithStreamingResponse, + AsyncAIResourceWithStreamingResponse, ) from .domains import ( - Domains, - AsyncDomains, - DomainsWithRawResponse, - AsyncDomainsWithRawResponse, - DomainsWithStreamingResponse, - AsyncDomainsWithStreamingResponse, -) -from .filters import ( - Filters, - AsyncFilters, - FiltersWithRawResponse, - AsyncFiltersWithRawResponse, - FiltersWithStreamingResponse, - AsyncFiltersWithStreamingResponse, + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, ) from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, -) -from .services import ( - Services, - AsyncServices, - ServicesWithRawResponse, - AsyncServicesWithRawResponse, - ServicesWithStreamingResponse, - AsyncServicesWithStreamingResponse, + ScriptsResource, + AsyncScriptsResource, + ScriptsResourceWithRawResponse, + AsyncScriptsResourceWithRawResponse, + ScriptsResourceWithStreamingResponse, + AsyncScriptsResourceWithStreamingResponse, ) from ..._compat import cached_property from .subdomains import ( - Subdomains, - AsyncSubdomains, - SubdomainsWithRawResponse, - AsyncSubdomainsWithRawResponse, - SubdomainsWithStreamingResponse, - AsyncSubdomainsWithStreamingResponse, + SubdomainsResource, + AsyncSubdomainsResource, + SubdomainsResourceWithRawResponse, + AsyncSubdomainsResourceWithRawResponse, + SubdomainsResourceWithStreamingResponse, + AsyncSubdomainsResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, -) -from .scripts.scripts import Scripts, AsyncScripts +from .scripts.scripts import ScriptsResource, AsyncScriptsResource from .account_settings import ( - AccountSettings, - AsyncAccountSettings, - AccountSettingsWithRawResponse, - AsyncAccountSettingsWithRawResponse, - AccountSettingsWithStreamingResponse, - AsyncAccountSettingsWithStreamingResponse, + AccountSettingsResource, + AsyncAccountSettingsResource, + AccountSettingsResourceWithRawResponse, + AsyncAccountSettingsResourceWithRawResponse, + AccountSettingsResourceWithStreamingResponse, + AsyncAccountSettingsResourceWithStreamingResponse, ) -from .services.services import Services, AsyncServices -from .deployments.deployments import Deployments, AsyncDeployments - -__all__ = ["Workers", "AsyncWorkers"] - - -class Workers(SyncAPIResource): - @cached_property - def ai(self) -> AI: - return AI(self._client) - - @cached_property - def scripts(self) -> Scripts: - return Scripts(self._client) - - @cached_property - def filters(self) -> Filters: - return Filters(self._client) - - @cached_property - def routes(self) -> Routes: - return Routes(self._client) - @cached_property - def account_settings(self) -> AccountSettings: - return AccountSettings(self._client) +__all__ = ["WorkersResource", "AsyncWorkersResource"] - @cached_property - def deployments(self) -> Deployments: - return Deployments(self._client) +class WorkersResource(SyncAPIResource): @cached_property - def domains(self) -> Domains: - return Domains(self._client) + def ai(self) -> AIResource: + return AIResource(self._client) @cached_property - def subdomains(self) -> Subdomains: - return Subdomains(self._client) + def scripts(self) -> ScriptsResource: + return ScriptsResource(self._client) @cached_property - def services(self) -> Services: - return Services(self._client) + def account_settings(self) -> AccountSettingsResource: + return AccountSettingsResource(self._client) @cached_property - def with_raw_response(self) -> WorkersWithRawResponse: - return WorkersWithRawResponse(self) + def domains(self) -> DomainsResource: + return DomainsResource(self._client) @cached_property - def with_streaming_response(self) -> WorkersWithStreamingResponse: - return WorkersWithStreamingResponse(self) - + def subdomains(self) -> SubdomainsResource: + return SubdomainsResource(self._client) -class AsyncWorkers(AsyncAPIResource): @cached_property - def ai(self) -> AsyncAI: - return AsyncAI(self._client) + def with_raw_response(self) -> WorkersResourceWithRawResponse: + return WorkersResourceWithRawResponse(self) @cached_property - def scripts(self) -> AsyncScripts: - return AsyncScripts(self._client) + def with_streaming_response(self) -> WorkersResourceWithStreamingResponse: + return WorkersResourceWithStreamingResponse(self) - @cached_property - def filters(self) -> AsyncFilters: - return AsyncFilters(self._client) - - @cached_property - def routes(self) -> AsyncRoutes: - return AsyncRoutes(self._client) +class AsyncWorkersResource(AsyncAPIResource): @cached_property - def account_settings(self) -> AsyncAccountSettings: - return AsyncAccountSettings(self._client) + def ai(self) -> AsyncAIResource: + return AsyncAIResource(self._client) @cached_property - def deployments(self) -> AsyncDeployments: - return AsyncDeployments(self._client) + def scripts(self) -> AsyncScriptsResource: + return AsyncScriptsResource(self._client) @cached_property - def domains(self) -> AsyncDomains: - return AsyncDomains(self._client) + def account_settings(self) -> AsyncAccountSettingsResource: + return AsyncAccountSettingsResource(self._client) @cached_property - def subdomains(self) -> AsyncSubdomains: - return AsyncSubdomains(self._client) + def domains(self) -> AsyncDomainsResource: + return AsyncDomainsResource(self._client) @cached_property - def services(self) -> AsyncServices: - return AsyncServices(self._client) + def subdomains(self) -> AsyncSubdomainsResource: + return AsyncSubdomainsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncWorkersWithRawResponse: - return AsyncWorkersWithRawResponse(self) + def with_raw_response(self) -> AsyncWorkersResourceWithRawResponse: + return AsyncWorkersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWorkersWithStreamingResponse: - return AsyncWorkersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWorkersResourceWithStreamingResponse: + return AsyncWorkersResourceWithStreamingResponse(self) -class WorkersWithRawResponse: - def __init__(self, workers: Workers) -> None: +class WorkersResourceWithRawResponse: + def __init__(self, workers: WorkersResource) -> None: self._workers = workers @cached_property - def ai(self) -> AIWithRawResponse: - return AIWithRawResponse(self._workers.ai) - - @cached_property - def scripts(self) -> ScriptsWithRawResponse: - return ScriptsWithRawResponse(self._workers.scripts) - - @cached_property - def filters(self) -> FiltersWithRawResponse: - return FiltersWithRawResponse(self._workers.filters) - - @cached_property - def routes(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self._workers.routes) + def ai(self) -> AIResourceWithRawResponse: + return AIResourceWithRawResponse(self._workers.ai) @cached_property - def account_settings(self) -> AccountSettingsWithRawResponse: - return AccountSettingsWithRawResponse(self._workers.account_settings) + def scripts(self) -> ScriptsResourceWithRawResponse: + return ScriptsResourceWithRawResponse(self._workers.scripts) @cached_property - def deployments(self) -> DeploymentsWithRawResponse: - return DeploymentsWithRawResponse(self._workers.deployments) + def account_settings(self) -> AccountSettingsResourceWithRawResponse: + return AccountSettingsResourceWithRawResponse(self._workers.account_settings) @cached_property - def domains(self) -> DomainsWithRawResponse: - return DomainsWithRawResponse(self._workers.domains) + def domains(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self._workers.domains) @cached_property - def subdomains(self) -> SubdomainsWithRawResponse: - return SubdomainsWithRawResponse(self._workers.subdomains) - - @cached_property - def services(self) -> ServicesWithRawResponse: - return ServicesWithRawResponse(self._workers.services) + def subdomains(self) -> SubdomainsResourceWithRawResponse: + return SubdomainsResourceWithRawResponse(self._workers.subdomains) -class AsyncWorkersWithRawResponse: - def __init__(self, workers: AsyncWorkers) -> None: +class AsyncWorkersResourceWithRawResponse: + def __init__(self, workers: AsyncWorkersResource) -> None: self._workers = workers @cached_property - def ai(self) -> AsyncAIWithRawResponse: - return AsyncAIWithRawResponse(self._workers.ai) - - @cached_property - def scripts(self) -> AsyncScriptsWithRawResponse: - return AsyncScriptsWithRawResponse(self._workers.scripts) + def ai(self) -> AsyncAIResourceWithRawResponse: + return AsyncAIResourceWithRawResponse(self._workers.ai) @cached_property - def filters(self) -> AsyncFiltersWithRawResponse: - return AsyncFiltersWithRawResponse(self._workers.filters) + def scripts(self) -> AsyncScriptsResourceWithRawResponse: + return AsyncScriptsResourceWithRawResponse(self._workers.scripts) @cached_property - def routes(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self._workers.routes) + def account_settings(self) -> AsyncAccountSettingsResourceWithRawResponse: + return AsyncAccountSettingsResourceWithRawResponse(self._workers.account_settings) @cached_property - def account_settings(self) -> AsyncAccountSettingsWithRawResponse: - return AsyncAccountSettingsWithRawResponse(self._workers.account_settings) + def domains(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self._workers.domains) @cached_property - def deployments(self) -> AsyncDeploymentsWithRawResponse: - return AsyncDeploymentsWithRawResponse(self._workers.deployments) + def subdomains(self) -> AsyncSubdomainsResourceWithRawResponse: + return AsyncSubdomainsResourceWithRawResponse(self._workers.subdomains) - @cached_property - def domains(self) -> AsyncDomainsWithRawResponse: - return AsyncDomainsWithRawResponse(self._workers.domains) - - @cached_property - def subdomains(self) -> AsyncSubdomainsWithRawResponse: - return AsyncSubdomainsWithRawResponse(self._workers.subdomains) - @cached_property - def services(self) -> AsyncServicesWithRawResponse: - return AsyncServicesWithRawResponse(self._workers.services) - - -class WorkersWithStreamingResponse: - def __init__(self, workers: Workers) -> None: +class WorkersResourceWithStreamingResponse: + def __init__(self, workers: WorkersResource) -> None: self._workers = workers @cached_property - def ai(self) -> AIWithStreamingResponse: - return AIWithStreamingResponse(self._workers.ai) - - @cached_property - def scripts(self) -> ScriptsWithStreamingResponse: - return ScriptsWithStreamingResponse(self._workers.scripts) - - @cached_property - def filters(self) -> FiltersWithStreamingResponse: - return FiltersWithStreamingResponse(self._workers.filters) - - @cached_property - def routes(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(self._workers.routes) + def ai(self) -> AIResourceWithStreamingResponse: + return AIResourceWithStreamingResponse(self._workers.ai) @cached_property - def account_settings(self) -> AccountSettingsWithStreamingResponse: - return AccountSettingsWithStreamingResponse(self._workers.account_settings) + def scripts(self) -> ScriptsResourceWithStreamingResponse: + return ScriptsResourceWithStreamingResponse(self._workers.scripts) @cached_property - def deployments(self) -> DeploymentsWithStreamingResponse: - return DeploymentsWithStreamingResponse(self._workers.deployments) + def account_settings(self) -> AccountSettingsResourceWithStreamingResponse: + return AccountSettingsResourceWithStreamingResponse(self._workers.account_settings) @cached_property - def domains(self) -> DomainsWithStreamingResponse: - return DomainsWithStreamingResponse(self._workers.domains) + def domains(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self._workers.domains) @cached_property - def subdomains(self) -> SubdomainsWithStreamingResponse: - return SubdomainsWithStreamingResponse(self._workers.subdomains) + def subdomains(self) -> SubdomainsResourceWithStreamingResponse: + return SubdomainsResourceWithStreamingResponse(self._workers.subdomains) - @cached_property - def services(self) -> ServicesWithStreamingResponse: - return ServicesWithStreamingResponse(self._workers.services) - -class AsyncWorkersWithStreamingResponse: - def __init__(self, workers: AsyncWorkers) -> None: +class AsyncWorkersResourceWithStreamingResponse: + def __init__(self, workers: AsyncWorkersResource) -> None: self._workers = workers @cached_property - def ai(self) -> AsyncAIWithStreamingResponse: - return AsyncAIWithStreamingResponse(self._workers.ai) - - @cached_property - def scripts(self) -> AsyncScriptsWithStreamingResponse: - return AsyncScriptsWithStreamingResponse(self._workers.scripts) - - @cached_property - def filters(self) -> AsyncFiltersWithStreamingResponse: - return AsyncFiltersWithStreamingResponse(self._workers.filters) - - @cached_property - def routes(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(self._workers.routes) - - @cached_property - def account_settings(self) -> AsyncAccountSettingsWithStreamingResponse: - return AsyncAccountSettingsWithStreamingResponse(self._workers.account_settings) + def ai(self) -> AsyncAIResourceWithStreamingResponse: + return AsyncAIResourceWithStreamingResponse(self._workers.ai) @cached_property - def deployments(self) -> AsyncDeploymentsWithStreamingResponse: - return AsyncDeploymentsWithStreamingResponse(self._workers.deployments) + def scripts(self) -> AsyncScriptsResourceWithStreamingResponse: + return AsyncScriptsResourceWithStreamingResponse(self._workers.scripts) @cached_property - def domains(self) -> AsyncDomainsWithStreamingResponse: - return AsyncDomainsWithStreamingResponse(self._workers.domains) + def account_settings(self) -> AsyncAccountSettingsResourceWithStreamingResponse: + return AsyncAccountSettingsResourceWithStreamingResponse(self._workers.account_settings) @cached_property - def subdomains(self) -> AsyncSubdomainsWithStreamingResponse: - return AsyncSubdomainsWithStreamingResponse(self._workers.subdomains) + def domains(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self._workers.domains) @cached_property - def services(self) -> AsyncServicesWithStreamingResponse: - return AsyncServicesWithStreamingResponse(self._workers.services) + def subdomains(self) -> AsyncSubdomainsResourceWithStreamingResponse: + return AsyncSubdomainsResourceWithStreamingResponse(self._workers.subdomains) diff --git a/src/cloudflare/resources/workers_for_platforms/__init__.py b/src/cloudflare/resources/workers_for_platforms/__init__.py index 1341a8aacb0..2b1b30bdee8 100644 --- a/src/cloudflare/resources/workers_for_platforms/__init__.py +++ b/src/cloudflare/resources/workers_for_platforms/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .dispatch import ( - Dispatch, - AsyncDispatch, - DispatchWithRawResponse, - AsyncDispatchWithRawResponse, - DispatchWithStreamingResponse, - AsyncDispatchWithStreamingResponse, + DispatchResource, + AsyncDispatchResource, + DispatchResourceWithRawResponse, + AsyncDispatchResourceWithRawResponse, + DispatchResourceWithStreamingResponse, + AsyncDispatchResourceWithStreamingResponse, ) from .workers_for_platforms import ( - WorkersForPlatforms, - AsyncWorkersForPlatforms, - WorkersForPlatformsWithRawResponse, - AsyncWorkersForPlatformsWithRawResponse, - WorkersForPlatformsWithStreamingResponse, - AsyncWorkersForPlatformsWithStreamingResponse, + WorkersForPlatformsResource, + AsyncWorkersForPlatformsResource, + WorkersForPlatformsResourceWithRawResponse, + AsyncWorkersForPlatformsResourceWithRawResponse, + WorkersForPlatformsResourceWithStreamingResponse, + AsyncWorkersForPlatformsResourceWithStreamingResponse, ) __all__ = [ - "Dispatch", - "AsyncDispatch", - "DispatchWithRawResponse", - "AsyncDispatchWithRawResponse", - "DispatchWithStreamingResponse", - "AsyncDispatchWithStreamingResponse", - "WorkersForPlatforms", - "AsyncWorkersForPlatforms", - "WorkersForPlatformsWithRawResponse", - "AsyncWorkersForPlatformsWithRawResponse", - "WorkersForPlatformsWithStreamingResponse", - "AsyncWorkersForPlatformsWithStreamingResponse", + "DispatchResource", + "AsyncDispatchResource", + "DispatchResourceWithRawResponse", + "AsyncDispatchResourceWithRawResponse", + "DispatchResourceWithStreamingResponse", + "AsyncDispatchResourceWithStreamingResponse", + "WorkersForPlatformsResource", + "AsyncWorkersForPlatformsResource", + "WorkersForPlatformsResourceWithRawResponse", + "AsyncWorkersForPlatformsResourceWithRawResponse", + "WorkersForPlatformsResourceWithStreamingResponse", + "AsyncWorkersForPlatformsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/__init__.py b/src/cloudflare/resources/workers_for_platforms/dispatch/__init__.py index d77d0f97119..f74ee5c8900 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/__init__.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .dispatch import ( - Dispatch, - AsyncDispatch, - DispatchWithRawResponse, - AsyncDispatchWithRawResponse, - DispatchWithStreamingResponse, - AsyncDispatchWithStreamingResponse, + DispatchResource, + AsyncDispatchResource, + DispatchResourceWithRawResponse, + AsyncDispatchResourceWithRawResponse, + DispatchResourceWithStreamingResponse, + AsyncDispatchResourceWithStreamingResponse, ) from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) __all__ = [ - "Namespaces", - "AsyncNamespaces", - "NamespacesWithRawResponse", - "AsyncNamespacesWithRawResponse", - "NamespacesWithStreamingResponse", - "AsyncNamespacesWithStreamingResponse", - "Dispatch", - "AsyncDispatch", - "DispatchWithRawResponse", - "AsyncDispatchWithRawResponse", - "DispatchWithStreamingResponse", - "AsyncDispatchWithStreamingResponse", + "NamespacesResource", + "AsyncNamespacesResource", + "NamespacesResourceWithRawResponse", + "AsyncNamespacesResourceWithRawResponse", + "NamespacesResourceWithStreamingResponse", + "AsyncNamespacesResourceWithStreamingResponse", + "DispatchResource", + "AsyncDispatchResource", + "DispatchResourceWithRawResponse", + "AsyncDispatchResourceWithRawResponse", + "DispatchResourceWithStreamingResponse", + "AsyncDispatchResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/dispatch.py b/src/cloudflare/resources/workers_for_platforms/dispatch/dispatch.py index 4f8864618aa..dd56b95c0d8 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/dispatch.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/dispatch.py @@ -4,78 +4,78 @@ from ...._compat import cached_property from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource -from .namespaces.namespaces import Namespaces, AsyncNamespaces +from .namespaces.namespaces import NamespacesResource, AsyncNamespacesResource -__all__ = ["Dispatch", "AsyncDispatch"] +__all__ = ["DispatchResource", "AsyncDispatchResource"] -class Dispatch(SyncAPIResource): +class DispatchResource(SyncAPIResource): @cached_property - def namespaces(self) -> Namespaces: - return Namespaces(self._client) + def namespaces(self) -> NamespacesResource: + return NamespacesResource(self._client) @cached_property - def with_raw_response(self) -> DispatchWithRawResponse: - return DispatchWithRawResponse(self) + def with_raw_response(self) -> DispatchResourceWithRawResponse: + return DispatchResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DispatchWithStreamingResponse: - return DispatchWithStreamingResponse(self) + def with_streaming_response(self) -> DispatchResourceWithStreamingResponse: + return DispatchResourceWithStreamingResponse(self) -class AsyncDispatch(AsyncAPIResource): +class AsyncDispatchResource(AsyncAPIResource): @cached_property - def namespaces(self) -> AsyncNamespaces: - return AsyncNamespaces(self._client) + def namespaces(self) -> AsyncNamespacesResource: + return AsyncNamespacesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDispatchWithRawResponse: - return AsyncDispatchWithRawResponse(self) + def with_raw_response(self) -> AsyncDispatchResourceWithRawResponse: + return AsyncDispatchResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDispatchWithStreamingResponse: - return AsyncDispatchWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDispatchResourceWithStreamingResponse: + return AsyncDispatchResourceWithStreamingResponse(self) -class DispatchWithRawResponse: - def __init__(self, dispatch: Dispatch) -> None: +class DispatchResourceWithRawResponse: + def __init__(self, dispatch: DispatchResource) -> None: self._dispatch = dispatch @cached_property - def namespaces(self) -> NamespacesWithRawResponse: - return NamespacesWithRawResponse(self._dispatch.namespaces) + def namespaces(self) -> NamespacesResourceWithRawResponse: + return NamespacesResourceWithRawResponse(self._dispatch.namespaces) -class AsyncDispatchWithRawResponse: - def __init__(self, dispatch: AsyncDispatch) -> None: +class AsyncDispatchResourceWithRawResponse: + def __init__(self, dispatch: AsyncDispatchResource) -> None: self._dispatch = dispatch @cached_property - def namespaces(self) -> AsyncNamespacesWithRawResponse: - return AsyncNamespacesWithRawResponse(self._dispatch.namespaces) + def namespaces(self) -> AsyncNamespacesResourceWithRawResponse: + return AsyncNamespacesResourceWithRawResponse(self._dispatch.namespaces) -class DispatchWithStreamingResponse: - def __init__(self, dispatch: Dispatch) -> None: +class DispatchResourceWithStreamingResponse: + def __init__(self, dispatch: DispatchResource) -> None: self._dispatch = dispatch @cached_property - def namespaces(self) -> NamespacesWithStreamingResponse: - return NamespacesWithStreamingResponse(self._dispatch.namespaces) + def namespaces(self) -> NamespacesResourceWithStreamingResponse: + return NamespacesResourceWithStreamingResponse(self._dispatch.namespaces) -class AsyncDispatchWithStreamingResponse: - def __init__(self, dispatch: AsyncDispatch) -> None: +class AsyncDispatchResourceWithStreamingResponse: + def __init__(self, dispatch: AsyncDispatchResource) -> None: self._dispatch = dispatch @cached_property - def namespaces(self) -> AsyncNamespacesWithStreamingResponse: - return AsyncNamespacesWithStreamingResponse(self._dispatch.namespaces) + def namespaces(self) -> AsyncNamespacesResourceWithStreamingResponse: + return AsyncNamespacesResourceWithStreamingResponse(self._dispatch.namespaces) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/__init__.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/__init__.py index 055570b9064..7a4687c92c5 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/__init__.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, + ScriptsResource, + AsyncScriptsResource, + ScriptsResourceWithRawResponse, + AsyncScriptsResourceWithRawResponse, + ScriptsResourceWithStreamingResponse, + AsyncScriptsResourceWithStreamingResponse, ) from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, + NamespacesResource, + AsyncNamespacesResource, + NamespacesResourceWithRawResponse, + AsyncNamespacesResourceWithRawResponse, + NamespacesResourceWithStreamingResponse, + AsyncNamespacesResourceWithStreamingResponse, ) __all__ = [ - "Scripts", - "AsyncScripts", - "ScriptsWithRawResponse", - "AsyncScriptsWithRawResponse", - "ScriptsWithStreamingResponse", - "AsyncScriptsWithStreamingResponse", - "Namespaces", - "AsyncNamespaces", - "NamespacesWithRawResponse", - "AsyncNamespacesWithRawResponse", - "NamespacesWithStreamingResponse", - "AsyncNamespacesWithStreamingResponse", + "ScriptsResource", + "AsyncScriptsResource", + "ScriptsResourceWithRawResponse", + "AsyncScriptsResourceWithRawResponse", + "ScriptsResourceWithStreamingResponse", + "AsyncScriptsResourceWithStreamingResponse", + "NamespacesResource", + "AsyncNamespacesResource", + "NamespacesResourceWithRawResponse", + "AsyncNamespacesResourceWithRawResponse", + "NamespacesResourceWithStreamingResponse", + "AsyncNamespacesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py index 0f025e9189a..b986e638da3 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py @@ -2,17 +2,17 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, + ScriptsResource, + AsyncScriptsResource, + ScriptsResourceWithRawResponse, + AsyncScriptsResourceWithRawResponse, + ScriptsResourceWithStreamingResponse, + AsyncScriptsResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -29,33 +29,31 @@ ) from ....._wrappers import ResultWrapper from .....pagination import SyncSinglePage, AsyncSinglePage -from .scripts.scripts import Scripts, AsyncScripts +from .scripts.scripts import ScriptsResource, AsyncScriptsResource from ....._base_client import ( AsyncPaginator, make_request_options, ) -from .....types.workers_for_platforms.dispatch import ( - NamespaceGetResponse, - NamespaceListResponse, - NamespaceCreateResponse, - namespace_create_params, -) +from .....types.workers_for_platforms.dispatch import namespace_create_params +from .....types.workers_for_platforms.dispatch.namespace_get_response import NamespaceGetResponse +from .....types.workers_for_platforms.dispatch.namespace_list_response import NamespaceListResponse +from .....types.workers_for_platforms.dispatch.namespace_create_response import NamespaceCreateResponse -__all__ = ["Namespaces", "AsyncNamespaces"] +__all__ = ["NamespacesResource", "AsyncNamespacesResource"] -class Namespaces(SyncAPIResource): +class NamespacesResource(SyncAPIResource): @cached_property - def scripts(self) -> Scripts: - return Scripts(self._client) + def scripts(self) -> ScriptsResource: + return ScriptsResource(self._client) @cached_property - def with_raw_response(self) -> NamespacesWithRawResponse: - return NamespacesWithRawResponse(self) + def with_raw_response(self) -> NamespacesResourceWithRawResponse: + return NamespacesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NamespacesWithStreamingResponse: - return NamespacesWithStreamingResponse(self) + def with_streaming_response(self) -> NamespacesResourceWithStreamingResponse: + return NamespacesResourceWithStreamingResponse(self) def create( self, @@ -68,7 +66,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceCreateResponse: + ) -> Optional[NamespaceCreateResponse]: """ Create a new Workers for Platforms namespace. @@ -95,9 +93,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NamespaceCreateResponse]]._unwrapper, ), - cast_to=cast(Type[NamespaceCreateResponse], ResultWrapper[NamespaceCreateResponse]), + cast_to=cast(Type[Optional[NamespaceCreateResponse]], ResultWrapper[NamespaceCreateResponse]), ) def list( @@ -175,7 +173,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -191,9 +189,9 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceGetResponse: + ) -> Optional[NamespaceGetResponse]: """ - Fetch a Workers for Platforms namespace. + Get a Workers for Platforms namespace. Args: account_id: Identifier @@ -219,24 +217,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NamespaceGetResponse]]._unwrapper, ), - cast_to=cast(Type[NamespaceGetResponse], ResultWrapper[NamespaceGetResponse]), + cast_to=cast(Type[Optional[NamespaceGetResponse]], ResultWrapper[NamespaceGetResponse]), ) -class AsyncNamespaces(AsyncAPIResource): +class AsyncNamespacesResource(AsyncAPIResource): @cached_property - def scripts(self) -> AsyncScripts: - return AsyncScripts(self._client) + def scripts(self) -> AsyncScriptsResource: + return AsyncScriptsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncNamespacesWithRawResponse: - return AsyncNamespacesWithRawResponse(self) + def with_raw_response(self) -> AsyncNamespacesResourceWithRawResponse: + return AsyncNamespacesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNamespacesWithStreamingResponse: - return AsyncNamespacesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNamespacesResourceWithStreamingResponse: + return AsyncNamespacesResourceWithStreamingResponse(self) async def create( self, @@ -249,7 +247,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceCreateResponse: + ) -> Optional[NamespaceCreateResponse]: """ Create a new Workers for Platforms namespace. @@ -276,9 +274,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NamespaceCreateResponse]]._unwrapper, ), - cast_to=cast(Type[NamespaceCreateResponse], ResultWrapper[NamespaceCreateResponse]), + cast_to=cast(Type[Optional[NamespaceCreateResponse]], ResultWrapper[NamespaceCreateResponse]), ) def list( @@ -356,7 +354,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -372,9 +370,9 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceGetResponse: + ) -> Optional[NamespaceGetResponse]: """ - Fetch a Workers for Platforms namespace. + Get a Workers for Platforms namespace. Args: account_id: Identifier @@ -400,14 +398,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NamespaceGetResponse]]._unwrapper, ), - cast_to=cast(Type[NamespaceGetResponse], ResultWrapper[NamespaceGetResponse]), + cast_to=cast(Type[Optional[NamespaceGetResponse]], ResultWrapper[NamespaceGetResponse]), ) -class NamespacesWithRawResponse: - def __init__(self, namespaces: Namespaces) -> None: +class NamespacesResourceWithRawResponse: + def __init__(self, namespaces: NamespacesResource) -> None: self._namespaces = namespaces self.create = to_raw_response_wrapper( @@ -424,12 +422,12 @@ def __init__(self, namespaces: Namespaces) -> None: ) @cached_property - def scripts(self) -> ScriptsWithRawResponse: - return ScriptsWithRawResponse(self._namespaces.scripts) + def scripts(self) -> ScriptsResourceWithRawResponse: + return ScriptsResourceWithRawResponse(self._namespaces.scripts) -class AsyncNamespacesWithRawResponse: - def __init__(self, namespaces: AsyncNamespaces) -> None: +class AsyncNamespacesResourceWithRawResponse: + def __init__(self, namespaces: AsyncNamespacesResource) -> None: self._namespaces = namespaces self.create = async_to_raw_response_wrapper( @@ -446,12 +444,12 @@ def __init__(self, namespaces: AsyncNamespaces) -> None: ) @cached_property - def scripts(self) -> AsyncScriptsWithRawResponse: - return AsyncScriptsWithRawResponse(self._namespaces.scripts) + def scripts(self) -> AsyncScriptsResourceWithRawResponse: + return AsyncScriptsResourceWithRawResponse(self._namespaces.scripts) -class NamespacesWithStreamingResponse: - def __init__(self, namespaces: Namespaces) -> None: +class NamespacesResourceWithStreamingResponse: + def __init__(self, namespaces: NamespacesResource) -> None: self._namespaces = namespaces self.create = to_streamed_response_wrapper( @@ -468,12 +466,12 @@ def __init__(self, namespaces: Namespaces) -> None: ) @cached_property - def scripts(self) -> ScriptsWithStreamingResponse: - return ScriptsWithStreamingResponse(self._namespaces.scripts) + def scripts(self) -> ScriptsResourceWithStreamingResponse: + return ScriptsResourceWithStreamingResponse(self._namespaces.scripts) -class AsyncNamespacesWithStreamingResponse: - def __init__(self, namespaces: AsyncNamespaces) -> None: +class AsyncNamespacesResourceWithStreamingResponse: + def __init__(self, namespaces: AsyncNamespacesResource) -> None: self._namespaces = namespaces self.create = async_to_streamed_response_wrapper( @@ -490,5 +488,5 @@ def __init__(self, namespaces: AsyncNamespaces) -> None: ) @cached_property - def scripts(self) -> AsyncScriptsWithStreamingResponse: - return AsyncScriptsWithStreamingResponse(self._namespaces.scripts) + def scripts(self) -> AsyncScriptsResourceWithStreamingResponse: + return AsyncScriptsResourceWithStreamingResponse(self._namespaces.scripts) 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 0b995bdf832..fd5a962f515 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 @@ -1,61 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .tags import ( + TagsResource, + AsyncTagsResource, + TagsResourceWithRawResponse, + AsyncTagsResourceWithRawResponse, + TagsResourceWithStreamingResponse, + AsyncTagsResourceWithStreamingResponse, +) from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, + ContentResource, + AsyncContentResource, + ContentResourceWithRawResponse, + AsyncContentResourceWithRawResponse, + ContentResourceWithStreamingResponse, + AsyncContentResourceWithStreamingResponse, ) from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, + ScriptsResource, + AsyncScriptsResource, + ScriptsResourceWithRawResponse, + AsyncScriptsResourceWithRawResponse, + ScriptsResourceWithStreamingResponse, + AsyncScriptsResourceWithStreamingResponse, +) +from .secrets import ( + SecretsResource, + AsyncSecretsResource, + SecretsResourceWithRawResponse, + AsyncSecretsResourceWithRawResponse, + SecretsResourceWithStreamingResponse, + AsyncSecretsResourceWithStreamingResponse, ) from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, + BindingsResource, + AsyncBindingsResource, + BindingsResourceWithRawResponse, + AsyncBindingsResourceWithRawResponse, + BindingsResourceWithStreamingResponse, + AsyncBindingsResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) __all__ = [ - "Content", - "AsyncContent", - "ContentWithRawResponse", - "AsyncContentWithRawResponse", - "ContentWithStreamingResponse", - "AsyncContentWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Bindings", - "AsyncBindings", - "BindingsWithRawResponse", - "AsyncBindingsWithRawResponse", - "BindingsWithStreamingResponse", - "AsyncBindingsWithStreamingResponse", - "Scripts", - "AsyncScripts", - "ScriptsWithRawResponse", - "AsyncScriptsWithRawResponse", - "ScriptsWithStreamingResponse", - "AsyncScriptsWithStreamingResponse", + "ContentResource", + "AsyncContentResource", + "ContentResourceWithRawResponse", + "AsyncContentResourceWithRawResponse", + "ContentResourceWithStreamingResponse", + "AsyncContentResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "BindingsResource", + "AsyncBindingsResource", + "BindingsResourceWithRawResponse", + "AsyncBindingsResourceWithRawResponse", + "BindingsResourceWithStreamingResponse", + "AsyncBindingsResourceWithStreamingResponse", + "SecretsResource", + "AsyncSecretsResource", + "SecretsResourceWithRawResponse", + "AsyncSecretsResourceWithRawResponse", + "SecretsResourceWithStreamingResponse", + "AsyncSecretsResourceWithStreamingResponse", + "TagsResource", + "AsyncTagsResource", + "TagsResourceWithRawResponse", + "AsyncTagsResourceWithRawResponse", + "TagsResourceWithStreamingResponse", + "AsyncTagsResourceWithStreamingResponse", + "ScriptsResource", + "AsyncScriptsResource", + "ScriptsResourceWithRawResponse", + "AsyncScriptsResourceWithRawResponse", + "ScriptsResourceWithStreamingResponse", + "AsyncScriptsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py index 02756b35d56..d2cc4084bc3 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast import httpx @@ -15,22 +15,23 @@ 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 BindingGetResponse +from ......types.workers_for_platforms.dispatch.namespaces.scripts.binding_get_response import BindingGetResponse -__all__ = ["Bindings", "AsyncBindings"] +__all__ = ["BindingsResource", "AsyncBindingsResource"] -class Bindings(SyncAPIResource): +class BindingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self) + def with_raw_response(self) -> BindingsResourceWithRawResponse: + return BindingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self) + def with_streaming_response(self) -> BindingsResourceWithStreamingResponse: + return BindingsResourceWithStreamingResponse(self) def get( self, @@ -44,7 +45,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BindingGetResponse: + ) -> Optional[BindingGetResponse]: """ Fetch script bindings from a script uploaded to a Workers for Platforms namespace. @@ -70,28 +71,27 @@ def get( 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 cast( - BindingGetResponse, - self._get( - f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, BindingGetResponse - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[BindingGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[BindingGetResponse]], ResultWrapper[BindingGetResponse]), ) -class AsyncBindings(AsyncAPIResource): +class AsyncBindingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self) + def with_raw_response(self) -> AsyncBindingsResourceWithRawResponse: + return AsyncBindingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBindingsResourceWithStreamingResponse: + return AsyncBindingsResourceWithStreamingResponse(self) async def get( self, @@ -105,7 +105,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BindingGetResponse: + ) -> Optional[BindingGetResponse]: """ Fetch script bindings from a script uploaded to a Workers for Platforms namespace. @@ -131,22 +131,21 @@ async def get( 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 cast( - BindingGetResponse, - await self._get( - f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, BindingGetResponse - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[BindingGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[BindingGetResponse]], ResultWrapper[BindingGetResponse]), ) -class BindingsWithRawResponse: - def __init__(self, bindings: Bindings) -> None: +class BindingsResourceWithRawResponse: + def __init__(self, bindings: BindingsResource) -> None: self._bindings = bindings self.get = to_raw_response_wrapper( @@ -154,8 +153,8 @@ def __init__(self, bindings: Bindings) -> None: ) -class AsyncBindingsWithRawResponse: - def __init__(self, bindings: AsyncBindings) -> None: +class AsyncBindingsResourceWithRawResponse: + def __init__(self, bindings: AsyncBindingsResource) -> None: self._bindings = bindings self.get = async_to_raw_response_wrapper( @@ -163,8 +162,8 @@ def __init__(self, bindings: AsyncBindings) -> None: ) -class BindingsWithStreamingResponse: - def __init__(self, bindings: Bindings) -> None: +class BindingsResourceWithStreamingResponse: + def __init__(self, bindings: BindingsResource) -> None: self._bindings = bindings self.get = to_streamed_response_wrapper( @@ -172,8 +171,8 @@ def __init__(self, bindings: Bindings) -> None: ) -class AsyncBindingsWithStreamingResponse: - def __init__(self, bindings: AsyncBindings) -> None: +class AsyncBindingsResourceWithStreamingResponse: + def __init__(self, bindings: AsyncBindingsResource) -> None: self._bindings = bindings self.get = async_to_streamed_response_wrapper( 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 f7ecc203ed3..66185449605 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,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Mapping, cast +from typing import List, Type, Mapping, Optional, cast import httpx @@ -33,20 +33,21 @@ from ......_base_client import ( make_request_options, ) -from ......types.workers import WorkersScript +from ......types.workers.script import Script +from ......types.workers.worker_metadata_param import WorkerMetadataParam from ......types.workers_for_platforms.dispatch.namespaces.scripts import content_update_params -__all__ = ["Content", "AsyncContent"] +__all__ = ["ContentResource", "AsyncContentResource"] -class Content(SyncAPIResource): +class ContentResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self) + def with_raw_response(self) -> ContentResourceWithRawResponse: + return ContentResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self) + def with_streaming_response(self) -> ContentResourceWithStreamingResponse: + return ContentResourceWithStreamingResponse(self) def update( self, @@ -55,14 +56,14 @@ def update( account_id: str, dispatch_namespace: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: content_update_params.Metadata | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam | 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, - ) -> WorkersScript: + ) -> Optional[Script]: """ Put script content for a script uploaded to a Workers for Platforms namespace. @@ -77,7 +78,8 @@ def update( 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. + (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. @@ -116,9 +118,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Script]]._unwrapper, ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) def get( @@ -169,14 +171,14 @@ def get( ) -class AsyncContent(AsyncAPIResource): +class AsyncContentResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self) + def with_raw_response(self) -> AsyncContentResourceWithRawResponse: + return AsyncContentResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse: + return AsyncContentResourceWithStreamingResponse(self) async def update( self, @@ -185,14 +187,14 @@ async def update( account_id: str, dispatch_namespace: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: content_update_params.Metadata | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam | 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, - ) -> WorkersScript: + ) -> Optional[Script]: """ Put script content for a script uploaded to a Workers for Platforms namespace. @@ -207,7 +209,8 @@ async def update( 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. + (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. @@ -246,9 +249,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Script]]._unwrapper, ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) async def get( @@ -299,8 +302,8 @@ async def get( ) -class ContentWithRawResponse: - def __init__(self, content: Content) -> None: +class ContentResourceWithRawResponse: + def __init__(self, content: ContentResource) -> None: self._content = content self.update = to_raw_response_wrapper( @@ -312,8 +315,8 @@ def __init__(self, content: Content) -> None: ) -class AsyncContentWithRawResponse: - def __init__(self, content: AsyncContent) -> None: +class AsyncContentResourceWithRawResponse: + def __init__(self, content: AsyncContentResource) -> None: self._content = content self.update = async_to_raw_response_wrapper( @@ -325,8 +328,8 @@ def __init__(self, content: AsyncContent) -> None: ) -class ContentWithStreamingResponse: - def __init__(self, content: Content) -> None: +class ContentResourceWithStreamingResponse: + def __init__(self, content: ContentResource) -> None: self._content = content self.update = to_streamed_response_wrapper( @@ -338,8 +341,8 @@ def __init__(self, content: Content) -> None: ) -class AsyncContentWithStreamingResponse: - def __init__(self, content: AsyncContent) -> None: +class AsyncContentResourceWithStreamingResponse: + def __init__(self, content: AsyncContentResource) -> None: self._content = content self.update = async_to_streamed_response_wrapper( 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 98e0600546d..2860f178ff6 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,33 +2,49 @@ from __future__ import annotations -from typing import List, Type, cast, overload +from typing import List, Type, Optional, cast, overload import httpx +from .tags import ( + TagsResource, + AsyncTagsResource, + TagsResourceWithRawResponse, + AsyncTagsResourceWithRawResponse, + TagsResourceWithStreamingResponse, + AsyncTagsResourceWithStreamingResponse, +) from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, + ContentResource, + AsyncContentResource, + ContentResourceWithRawResponse, + AsyncContentResourceWithRawResponse, + ContentResourceWithStreamingResponse, + AsyncContentResourceWithStreamingResponse, +) +from .secrets import ( + SecretsResource, + AsyncSecretsResource, + SecretsResourceWithRawResponse, + AsyncSecretsResourceWithRawResponse, + SecretsResourceWithStreamingResponse, + AsyncSecretsResourceWithStreamingResponse, ) from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, + BindingsResource, + AsyncBindingsResource, + BindingsResourceWithRawResponse, + AsyncBindingsResourceWithRawResponse, + BindingsResourceWithStreamingResponse, + AsyncBindingsResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes from ......_utils import ( @@ -48,36 +64,41 @@ from ......_base_client import ( make_request_options, ) -from ......types.workers import WorkersScript -from ......types.workers_for_platforms.dispatch.namespaces import ( - WorkersForPlatformsNamespaceScript, - script_delete_params, - script_update_params, -) +from ......types.workers.script import Script as WorkersScript +from ......types.workers_for_platforms.dispatch.namespaces import script_delete_params, script_update_params +from ......types.workers_for_platforms.dispatch.namespaces.script import Script as NamespacesScript -__all__ = ["Scripts", "AsyncScripts"] +__all__ = ["ScriptsResource", "AsyncScriptsResource"] -class Scripts(SyncAPIResource): +class ScriptsResource(SyncAPIResource): + @cached_property + def content(self) -> ContentResource: + return ContentResource(self._client) + @cached_property - def content(self) -> Content: - return Content(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def bindings(self) -> BindingsResource: + return BindingsResource(self._client) @cached_property - def bindings(self) -> Bindings: - return Bindings(self._client) + def secrets(self) -> SecretsResource: + return SecretsResource(self._client) @cached_property - def with_raw_response(self) -> ScriptsWithRawResponse: - return ScriptsWithRawResponse(self) + def tags(self) -> TagsResource: + return TagsResource(self._client) @cached_property - def with_streaming_response(self) -> ScriptsWithStreamingResponse: - return ScriptsWithStreamingResponse(self) + def with_raw_response(self) -> ScriptsResourceWithRawResponse: + return ScriptsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ScriptsResourceWithStreamingResponse: + return ScriptsResourceWithStreamingResponse(self) @overload def update( @@ -94,9 +115,12 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: - """ - Upload a worker module to a Workers for Platforms namespace. + ) -> Optional[WorkersScript]: + """Upload a worker module to a Workers for Platforms namespace. + + You can find an + example of the metadata on our docs: + https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/ Args: account_id: Identifier @@ -108,6 +132,8 @@ def update( 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. @@ -135,9 +161,12 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: - """ - Upload a worker module to a Workers for Platforms namespace. + ) -> Optional[WorkersScript]: + """Upload a worker module to a Workers for Platforms namespace. + + You can find an + example of the metadata on our docs: + https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/ Args: account_id: Identifier @@ -175,7 +204,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: + ) -> Optional[WorkersScript]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not dispatch_namespace: @@ -197,9 +226,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WorkersScript]]._unwrapper, ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), + cast_to=cast(Type[Optional[WorkersScript]], ResultWrapper[WorkersScript]), ) def delete( @@ -208,6 +237,7 @@ def delete( *, account_id: str, dispatch_namespace: str, + body: object, force: 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. @@ -249,6 +279,7 @@ def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", + body=maybe_transform(body, script_delete_params.ScriptDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -271,7 +302,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersForPlatformsNamespaceScript: + ) -> Optional[NamespacesScript]: """ Fetch information about a script uploaded to a Workers for Platforms namespace. @@ -303,32 +334,40 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NamespacesScript]]._unwrapper, ), - cast_to=cast(Type[WorkersForPlatformsNamespaceScript], ResultWrapper[WorkersForPlatformsNamespaceScript]), + cast_to=cast(Type[Optional[NamespacesScript]], ResultWrapper[NamespacesScript]), ) -class AsyncScripts(AsyncAPIResource): +class AsyncScriptsResource(AsyncAPIResource): @cached_property - def content(self) -> AsyncContent: - return AsyncContent(self._client) + def content(self) -> AsyncContentResource: + return AsyncContentResource(self._client) @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def bindings(self) -> AsyncBindings: - return AsyncBindings(self._client) + def bindings(self) -> AsyncBindingsResource: + return AsyncBindingsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncScriptsWithRawResponse: - return AsyncScriptsWithRawResponse(self) + def secrets(self) -> AsyncSecretsResource: + return AsyncSecretsResource(self._client) @cached_property - def with_streaming_response(self) -> AsyncScriptsWithStreamingResponse: - return AsyncScriptsWithStreamingResponse(self) + def tags(self) -> AsyncTagsResource: + return AsyncTagsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncScriptsResourceWithRawResponse: + return AsyncScriptsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncScriptsResourceWithStreamingResponse: + return AsyncScriptsResourceWithStreamingResponse(self) @overload async def update( @@ -345,9 +384,12 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: - """ - Upload a worker module to a Workers for Platforms namespace. + ) -> Optional[WorkersScript]: + """Upload a worker module to a Workers for Platforms namespace. + + You can find an + example of the metadata on our docs: + https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/ Args: account_id: Identifier @@ -359,6 +401,8 @@ async def update( 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. @@ -386,9 +430,12 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: - """ - Upload a worker module to a Workers for Platforms namespace. + ) -> Optional[WorkersScript]: + """Upload a worker module to a Workers for Platforms namespace. + + You can find an + example of the metadata on our docs: + https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/ Args: account_id: Identifier @@ -426,7 +473,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersScript: + ) -> Optional[WorkersScript]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not dispatch_namespace: @@ -448,9 +495,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WorkersScript]]._unwrapper, ), - cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), + cast_to=cast(Type[Optional[WorkersScript]], ResultWrapper[WorkersScript]), ) async def delete( @@ -459,6 +506,7 @@ async def delete( *, account_id: str, dispatch_namespace: str, + body: object, force: 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. @@ -500,6 +548,7 @@ async def delete( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", + body=await async_maybe_transform(body, script_delete_params.ScriptDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -522,7 +571,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WorkersForPlatformsNamespaceScript: + ) -> Optional[NamespacesScript]: """ Fetch information about a script uploaded to a Workers for Platforms namespace. @@ -554,14 +603,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NamespacesScript]]._unwrapper, ), - cast_to=cast(Type[WorkersForPlatformsNamespaceScript], ResultWrapper[WorkersForPlatformsNamespaceScript]), + cast_to=cast(Type[Optional[NamespacesScript]], ResultWrapper[NamespacesScript]), ) -class ScriptsWithRawResponse: - def __init__(self, scripts: Scripts) -> None: +class ScriptsResourceWithRawResponse: + def __init__(self, scripts: ScriptsResource) -> None: self._scripts = scripts self.update = to_raw_response_wrapper( @@ -575,20 +624,28 @@ def __init__(self, scripts: Scripts) -> None: ) @cached_property - def content(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self._scripts.content) + def content(self) -> ContentResourceWithRawResponse: + return ContentResourceWithRawResponse(self._scripts.content) + + @cached_property + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._scripts.settings) + + @cached_property + def bindings(self) -> BindingsResourceWithRawResponse: + return BindingsResourceWithRawResponse(self._scripts.bindings) @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._scripts.settings) + def secrets(self) -> SecretsResourceWithRawResponse: + return SecretsResourceWithRawResponse(self._scripts.secrets) @cached_property - def bindings(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self._scripts.bindings) + def tags(self) -> TagsResourceWithRawResponse: + return TagsResourceWithRawResponse(self._scripts.tags) -class AsyncScriptsWithRawResponse: - def __init__(self, scripts: AsyncScripts) -> None: +class AsyncScriptsResourceWithRawResponse: + def __init__(self, scripts: AsyncScriptsResource) -> None: self._scripts = scripts self.update = async_to_raw_response_wrapper( @@ -602,20 +659,28 @@ def __init__(self, scripts: AsyncScripts) -> None: ) @cached_property - def content(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self._scripts.content) + def content(self) -> AsyncContentResourceWithRawResponse: + return AsyncContentResourceWithRawResponse(self._scripts.content) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._scripts.settings) + + @cached_property + def bindings(self) -> AsyncBindingsResourceWithRawResponse: + return AsyncBindingsResourceWithRawResponse(self._scripts.bindings) @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._scripts.settings) + def secrets(self) -> AsyncSecretsResourceWithRawResponse: + return AsyncSecretsResourceWithRawResponse(self._scripts.secrets) @cached_property - def bindings(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self._scripts.bindings) + def tags(self) -> AsyncTagsResourceWithRawResponse: + return AsyncTagsResourceWithRawResponse(self._scripts.tags) -class ScriptsWithStreamingResponse: - def __init__(self, scripts: Scripts) -> None: +class ScriptsResourceWithStreamingResponse: + def __init__(self, scripts: ScriptsResource) -> None: self._scripts = scripts self.update = to_streamed_response_wrapper( @@ -629,20 +694,28 @@ def __init__(self, scripts: Scripts) -> None: ) @cached_property - def content(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self._scripts.content) + def content(self) -> ContentResourceWithStreamingResponse: + return ContentResourceWithStreamingResponse(self._scripts.content) @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._scripts.settings) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._scripts.settings) @cached_property - def bindings(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self._scripts.bindings) + def bindings(self) -> BindingsResourceWithStreamingResponse: + return BindingsResourceWithStreamingResponse(self._scripts.bindings) + + @cached_property + def secrets(self) -> SecretsResourceWithStreamingResponse: + return SecretsResourceWithStreamingResponse(self._scripts.secrets) + + @cached_property + def tags(self) -> TagsResourceWithStreamingResponse: + return TagsResourceWithStreamingResponse(self._scripts.tags) -class AsyncScriptsWithStreamingResponse: - def __init__(self, scripts: AsyncScripts) -> None: +class AsyncScriptsResourceWithStreamingResponse: + def __init__(self, scripts: AsyncScriptsResource) -> None: self._scripts = scripts self.update = async_to_streamed_response_wrapper( @@ -656,13 +729,21 @@ def __init__(self, scripts: AsyncScripts) -> None: ) @cached_property - def content(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self._scripts.content) + def content(self) -> AsyncContentResourceWithStreamingResponse: + return AsyncContentResourceWithStreamingResponse(self._scripts.content) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._scripts.settings) + + @cached_property + def bindings(self) -> AsyncBindingsResourceWithStreamingResponse: + return AsyncBindingsResourceWithStreamingResponse(self._scripts.bindings) @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._scripts.settings) + def secrets(self) -> AsyncSecretsResourceWithStreamingResponse: + return AsyncSecretsResourceWithStreamingResponse(self._scripts.secrets) @cached_property - def bindings(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self._scripts.bindings) + def tags(self) -> AsyncTagsResourceWithStreamingResponse: + return AsyncTagsResourceWithStreamingResponse(self._scripts.tags) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py new file mode 100644 index 00000000000..ba851e673be --- /dev/null +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py @@ -0,0 +1,325 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +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 ( + 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_for_platforms.dispatch.namespaces.scripts import secret_update_params +from ......types.workers_for_platforms.dispatch.namespaces.scripts.secret_list_response import SecretListResponse +from ......types.workers_for_platforms.dispatch.namespaces.scripts.secret_update_response import SecretUpdateResponse + +__all__ = ["SecretsResource", "AsyncSecretsResource"] + + +class SecretsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SecretsResourceWithRawResponse: + return SecretsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: + return SecretsResourceWithStreamingResponse(self) + + def update( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + name: str | NotGiven = NOT_GIVEN, + text: str | NotGiven = NOT_GIVEN, + type: Literal["secret_text"] | 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[SecretUpdateResponse]: + """ + Put secrets to a script uploaded to a Workers for Platforms namespace. + + 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. + + name: The name of this secret, this is what will be to access it inside the Worker. + + text: The value of the secret. + + type: The type of secret to put. + + 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._put( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets", + body=maybe_transform( + { + "name": name, + "text": text, + "type": type, + }, + secret_update_params.SecretUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SecretUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SecretUpdateResponse]], ResultWrapper[SecretUpdateResponse]), + ) + + def list( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: 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[SecretListResponse]: + """ + Fetch secrets from a script uploaded to a Workers for Platforms namespace. + + 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. + + 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._get_api_list( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets", + page=SyncSinglePage[SecretListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=SecretListResponse, + ) + + +class AsyncSecretsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSecretsResourceWithRawResponse: + return AsyncSecretsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: + return AsyncSecretsResourceWithStreamingResponse(self) + + async def update( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + name: str | NotGiven = NOT_GIVEN, + text: str | NotGiven = NOT_GIVEN, + type: Literal["secret_text"] | 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[SecretUpdateResponse]: + """ + Put secrets to a script uploaded to a Workers for Platforms namespace. + + 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. + + name: The name of this secret, this is what will be to access it inside the Worker. + + text: The value of the secret. + + type: The type of secret to put. + + 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._put( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets", + body=await async_maybe_transform( + { + "name": name, + "text": text, + "type": type, + }, + secret_update_params.SecretUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SecretUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SecretUpdateResponse]], ResultWrapper[SecretUpdateResponse]), + ) + + def list( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: 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[SecretListResponse, AsyncSinglePage[SecretListResponse]]: + """ + Fetch secrets from a script uploaded to a Workers for Platforms namespace. + + 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. + + 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._get_api_list( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets", + page=AsyncSinglePage[SecretListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=SecretListResponse, + ) + + +class SecretsResourceWithRawResponse: + def __init__(self, secrets: SecretsResource) -> None: + self._secrets = secrets + + self.update = to_raw_response_wrapper( + secrets.update, + ) + self.list = to_raw_response_wrapper( + secrets.list, + ) + + +class AsyncSecretsResourceWithRawResponse: + def __init__(self, secrets: AsyncSecretsResource) -> None: + self._secrets = secrets + + self.update = async_to_raw_response_wrapper( + secrets.update, + ) + self.list = async_to_raw_response_wrapper( + secrets.list, + ) + + +class SecretsResourceWithStreamingResponse: + def __init__(self, secrets: SecretsResource) -> None: + self._secrets = secrets + + self.update = to_streamed_response_wrapper( + secrets.update, + ) + self.list = to_streamed_response_wrapper( + secrets.list, + ) + + +class AsyncSecretsResourceWithStreamingResponse: + def __init__(self, secrets: AsyncSecretsResource) -> None: + self._secrets = secrets + + self.update = async_to_streamed_response_wrapper( + secrets.update, + ) + self.list = async_to_streamed_response_wrapper( + secrets.list, + ) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py index a7f47326564..cd5dbad7f9d 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py @@ -2,8 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast -from typing_extensions import Literal +from typing import Type, Optional, cast import httpx @@ -24,23 +23,21 @@ from ......_base_client import ( make_request_options, ) -from ......types.workers_for_platforms.dispatch.namespaces.scripts import ( - SettingGetResponse, - SettingEditResponse, - setting_edit_params, -) +from ......types.workers_for_platforms.dispatch.namespaces.scripts import setting_edit_params +from ......types.workers_for_platforms.dispatch.namespaces.scripts.setting_get_response import SettingGetResponse +from ......types.workers_for_platforms.dispatch.namespaces.scripts.setting_edit_response import SettingEditResponse -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def edit( self, @@ -48,17 +45,14 @@ def edit( *, account_id: str, dispatch_namespace: str, - errors: Iterable[setting_edit_params.Error], - messages: Iterable[setting_edit_params.Message], - result: setting_edit_params.Result, - success: Literal[True], + settings: setting_edit_params.Settings | 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, - ) -> SettingEditResponse: + ) -> Optional[SettingEditResponse]: """ Patch script metadata, such as bindings @@ -69,8 +63,6 @@ def edit( script_name: Name of the script, used in URLs and route configuration. - success: Whether the API call was successful - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -87,23 +79,15 @@ def edit( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return self._patch( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings", - body=maybe_transform( - { - "errors": errors, - "messages": messages, - "result": result, - "success": success, - }, - setting_edit_params.SettingEditParams, - ), + body=maybe_transform({"settings": settings}, setting_edit_params.SettingEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingEditResponse]]._unwrapper, ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), + cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), ) def get( @@ -118,7 +102,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingGetResponse: + ) -> Optional[SettingGetResponse]: """ Get script settings from a script uploaded to a Workers for Platforms namespace. @@ -150,20 +134,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingGetResponse]]._unwrapper, ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), + cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), ) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def edit( self, @@ -171,17 +155,14 @@ async def edit( *, account_id: str, dispatch_namespace: str, - errors: Iterable[setting_edit_params.Error], - messages: Iterable[setting_edit_params.Message], - result: setting_edit_params.Result, - success: Literal[True], + settings: setting_edit_params.Settings | 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, - ) -> SettingEditResponse: + ) -> Optional[SettingEditResponse]: """ Patch script metadata, such as bindings @@ -192,8 +173,6 @@ async def edit( script_name: Name of the script, used in URLs and route configuration. - success: Whether the API call was successful - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -210,23 +189,15 @@ async def edit( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return await self._patch( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings", - body=await async_maybe_transform( - { - "errors": errors, - "messages": messages, - "result": result, - "success": success, - }, - setting_edit_params.SettingEditParams, - ), + body=await async_maybe_transform({"settings": settings}, setting_edit_params.SettingEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingEditResponse]]._unwrapper, ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), + cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), ) async def get( @@ -241,7 +212,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingGetResponse: + ) -> Optional[SettingGetResponse]: """ Get script settings from a script uploaded to a Workers for Platforms namespace. @@ -273,14 +244,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingGetResponse]]._unwrapper, ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), + cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), ) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.edit = to_raw_response_wrapper( @@ -291,8 +262,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.edit = async_to_raw_response_wrapper( @@ -303,8 +274,8 @@ def __init__(self, settings: AsyncSettings) -> None: ) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.edit = to_streamed_response_wrapper( @@ -315,8 +286,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py new file mode 100644 index 00000000000..3576cecadb9 --- /dev/null +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py @@ -0,0 +1,418 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, 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_for_platforms.dispatch.namespaces.scripts import tag_update_params +from ......types.workers_for_platforms.dispatch.namespaces.scripts.tag_list_response import TagListResponse +from ......types.workers_for_platforms.dispatch.namespaces.scripts.tag_update_response import TagUpdateResponse + +__all__ = ["TagsResource", "AsyncTagsResource"] + + +class TagsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TagsResourceWithRawResponse: + return TagsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TagsResourceWithStreamingResponse: + return TagsResourceWithStreamingResponse(self) + + def update( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + body: List[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[TagUpdateResponse]: + """ + Put script tags for a script uploaded to a Workers for Platforms namespace. + + 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. + + body: Tags to help you manage your Workers + + 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._put( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags", + body=maybe_transform(body, tag_update_params.TagUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[TagUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[TagUpdateResponse]], ResultWrapper[TagUpdateResponse]), + ) + + def list( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: 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[TagListResponse]: + """ + Fetch tags from a script uploaded to a Workers for Platforms namespace. + + 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. + + 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._get_api_list( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags", + page=SyncSinglePage[TagListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=str, + ) + + def delete( + self, + tag: str, + *, + account_id: str, + dispatch_namespace: str, + script_name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """ + Delete script tag for a script uploaded to a Workers for Platforms namespace. + + 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. + + tag: Tag to help you manage your Worker + + 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}") + if not tag: + raise ValueError(f"Expected a non-empty value for `tag` but received {tag!r}") + return self._delete( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags/{tag}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, + ), + cast_to=cast(Type[object], ResultWrapper[object]), + ) + + +class AsyncTagsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTagsResourceWithRawResponse: + return AsyncTagsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: + return AsyncTagsResourceWithStreamingResponse(self) + + async def update( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + body: List[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[TagUpdateResponse]: + """ + Put script tags for a script uploaded to a Workers for Platforms namespace. + + 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. + + body: Tags to help you manage your Workers + + 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._put( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags", + body=await async_maybe_transform(body, tag_update_params.TagUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[TagUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[TagUpdateResponse]], ResultWrapper[TagUpdateResponse]), + ) + + def list( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: 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[TagListResponse, AsyncSinglePage[TagListResponse]]: + """ + Fetch tags from a script uploaded to a Workers for Platforms namespace. + + 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. + + 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._get_api_list( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags", + page=AsyncSinglePage[TagListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=str, + ) + + async def delete( + self, + tag: str, + *, + account_id: str, + dispatch_namespace: str, + script_name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """ + Delete script tag for a script uploaded to a Workers for Platforms namespace. + + 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. + + tag: Tag to help you manage your Worker + + 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}") + if not tag: + raise ValueError(f"Expected a non-empty value for `tag` but received {tag!r}") + return await self._delete( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags/{tag}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, + ), + cast_to=cast(Type[object], ResultWrapper[object]), + ) + + +class TagsResourceWithRawResponse: + def __init__(self, tags: TagsResource) -> None: + self._tags = tags + + self.update = to_raw_response_wrapper( + tags.update, + ) + self.list = to_raw_response_wrapper( + tags.list, + ) + self.delete = to_raw_response_wrapper( + tags.delete, + ) + + +class AsyncTagsResourceWithRawResponse: + def __init__(self, tags: AsyncTagsResource) -> None: + self._tags = tags + + self.update = async_to_raw_response_wrapper( + tags.update, + ) + self.list = async_to_raw_response_wrapper( + tags.list, + ) + self.delete = async_to_raw_response_wrapper( + tags.delete, + ) + + +class TagsResourceWithStreamingResponse: + def __init__(self, tags: TagsResource) -> None: + self._tags = tags + + self.update = to_streamed_response_wrapper( + tags.update, + ) + self.list = to_streamed_response_wrapper( + tags.list, + ) + self.delete = to_streamed_response_wrapper( + tags.delete, + ) + + +class AsyncTagsResourceWithStreamingResponse: + def __init__(self, tags: AsyncTagsResource) -> None: + self._tags = tags + + self.update = async_to_streamed_response_wrapper( + tags.update, + ) + self.list = async_to_streamed_response_wrapper( + tags.list, + ) + self.delete = async_to_streamed_response_wrapper( + tags.delete, + ) diff --git a/src/cloudflare/resources/workers_for_platforms/workers_for_platforms.py b/src/cloudflare/resources/workers_for_platforms/workers_for_platforms.py index 19eefb037aa..9506783f096 100644 --- a/src/cloudflare/resources/workers_for_platforms/workers_for_platforms.py +++ b/src/cloudflare/resources/workers_for_platforms/workers_for_platforms.py @@ -3,79 +3,79 @@ from __future__ import annotations from .dispatch import ( - Dispatch, - AsyncDispatch, - DispatchWithRawResponse, - AsyncDispatchWithRawResponse, - DispatchWithStreamingResponse, - AsyncDispatchWithStreamingResponse, + DispatchResource, + AsyncDispatchResource, + DispatchResourceWithRawResponse, + AsyncDispatchResourceWithRawResponse, + DispatchResourceWithStreamingResponse, + AsyncDispatchResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .dispatch.dispatch import Dispatch, AsyncDispatch +from .dispatch.dispatch import DispatchResource, AsyncDispatchResource -__all__ = ["WorkersForPlatforms", "AsyncWorkersForPlatforms"] +__all__ = ["WorkersForPlatformsResource", "AsyncWorkersForPlatformsResource"] -class WorkersForPlatforms(SyncAPIResource): +class WorkersForPlatformsResource(SyncAPIResource): @cached_property - def dispatch(self) -> Dispatch: - return Dispatch(self._client) + def dispatch(self) -> DispatchResource: + return DispatchResource(self._client) @cached_property - def with_raw_response(self) -> WorkersForPlatformsWithRawResponse: - return WorkersForPlatformsWithRawResponse(self) + def with_raw_response(self) -> WorkersForPlatformsResourceWithRawResponse: + return WorkersForPlatformsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WorkersForPlatformsWithStreamingResponse: - return WorkersForPlatformsWithStreamingResponse(self) + def with_streaming_response(self) -> WorkersForPlatformsResourceWithStreamingResponse: + return WorkersForPlatformsResourceWithStreamingResponse(self) -class AsyncWorkersForPlatforms(AsyncAPIResource): +class AsyncWorkersForPlatformsResource(AsyncAPIResource): @cached_property - def dispatch(self) -> AsyncDispatch: - return AsyncDispatch(self._client) + def dispatch(self) -> AsyncDispatchResource: + return AsyncDispatchResource(self._client) @cached_property - def with_raw_response(self) -> AsyncWorkersForPlatformsWithRawResponse: - return AsyncWorkersForPlatformsWithRawResponse(self) + def with_raw_response(self) -> AsyncWorkersForPlatformsResourceWithRawResponse: + return AsyncWorkersForPlatformsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWorkersForPlatformsWithStreamingResponse: - return AsyncWorkersForPlatformsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWorkersForPlatformsResourceWithStreamingResponse: + return AsyncWorkersForPlatformsResourceWithStreamingResponse(self) -class WorkersForPlatformsWithRawResponse: - def __init__(self, workers_for_platforms: WorkersForPlatforms) -> None: +class WorkersForPlatformsResourceWithRawResponse: + def __init__(self, workers_for_platforms: WorkersForPlatformsResource) -> None: self._workers_for_platforms = workers_for_platforms @cached_property - def dispatch(self) -> DispatchWithRawResponse: - return DispatchWithRawResponse(self._workers_for_platforms.dispatch) + def dispatch(self) -> DispatchResourceWithRawResponse: + return DispatchResourceWithRawResponse(self._workers_for_platforms.dispatch) -class AsyncWorkersForPlatformsWithRawResponse: - def __init__(self, workers_for_platforms: AsyncWorkersForPlatforms) -> None: +class AsyncWorkersForPlatformsResourceWithRawResponse: + def __init__(self, workers_for_platforms: AsyncWorkersForPlatformsResource) -> None: self._workers_for_platforms = workers_for_platforms @cached_property - def dispatch(self) -> AsyncDispatchWithRawResponse: - return AsyncDispatchWithRawResponse(self._workers_for_platforms.dispatch) + def dispatch(self) -> AsyncDispatchResourceWithRawResponse: + return AsyncDispatchResourceWithRawResponse(self._workers_for_platforms.dispatch) -class WorkersForPlatformsWithStreamingResponse: - def __init__(self, workers_for_platforms: WorkersForPlatforms) -> None: +class WorkersForPlatformsResourceWithStreamingResponse: + def __init__(self, workers_for_platforms: WorkersForPlatformsResource) -> None: self._workers_for_platforms = workers_for_platforms @cached_property - def dispatch(self) -> DispatchWithStreamingResponse: - return DispatchWithStreamingResponse(self._workers_for_platforms.dispatch) + def dispatch(self) -> DispatchResourceWithStreamingResponse: + return DispatchResourceWithStreamingResponse(self._workers_for_platforms.dispatch) -class AsyncWorkersForPlatformsWithStreamingResponse: - def __init__(self, workers_for_platforms: AsyncWorkersForPlatforms) -> None: +class AsyncWorkersForPlatformsResourceWithStreamingResponse: + def __init__(self, workers_for_platforms: AsyncWorkersForPlatformsResource) -> None: self._workers_for_platforms = workers_for_platforms @cached_property - def dispatch(self) -> AsyncDispatchWithStreamingResponse: - return AsyncDispatchWithStreamingResponse(self._workers_for_platforms.dispatch) + def dispatch(self) -> AsyncDispatchResourceWithStreamingResponse: + return AsyncDispatchResourceWithStreamingResponse(self._workers_for_platforms.dispatch) diff --git a/src/cloudflare/resources/zero_trust/__init__.py b/src/cloudflare/resources/zero_trust/__init__.py index 1558206aa79..7703df18c9b 100644 --- a/src/cloudflare/resources/zero_trust/__init__.py +++ b/src/cloudflare/resources/zero_trust/__init__.py @@ -1,173 +1,187 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .dex import ( - DEX, - AsyncDEX, - DEXWithRawResponse, - AsyncDEXWithRawResponse, - DEXWithStreamingResponse, - AsyncDEXWithStreamingResponse, + DEXResource, + AsyncDEXResource, + DEXResourceWithRawResponse, + AsyncDEXResourceWithRawResponse, + DEXResourceWithStreamingResponse, + AsyncDEXResourceWithStreamingResponse, ) from .dlp import ( - DLP, - AsyncDLP, - DLPWithRawResponse, - AsyncDLPWithRawResponse, - DLPWithStreamingResponse, - AsyncDLPWithStreamingResponse, + DLPResource, + AsyncDLPResource, + DLPResourceWithRawResponse, + AsyncDLPResourceWithRawResponse, + DLPResourceWithStreamingResponse, + AsyncDLPResourceWithStreamingResponse, ) from .seats import ( - Seats, - AsyncSeats, - SeatsWithRawResponse, - AsyncSeatsWithRawResponse, - SeatsWithStreamingResponse, - AsyncSeatsWithStreamingResponse, + SeatsResource, + AsyncSeatsResource, + SeatsResourceWithRawResponse, + AsyncSeatsResourceWithRawResponse, + SeatsResourceWithStreamingResponse, + AsyncSeatsResourceWithStreamingResponse, ) from .access import ( - Access, - AsyncAccess, - AccessWithRawResponse, - AsyncAccessWithRawResponse, - AccessWithStreamingResponse, - AsyncAccessWithStreamingResponse, + AccessResource, + AsyncAccessResource, + AccessResourceWithRawResponse, + AsyncAccessResourceWithRawResponse, + AccessResourceWithStreamingResponse, + AsyncAccessResourceWithStreamingResponse, ) from .devices import ( - Devices, - AsyncDevices, - DevicesWithRawResponse, - AsyncDevicesWithRawResponse, - DevicesWithStreamingResponse, - AsyncDevicesWithStreamingResponse, + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, ) from .gateway import ( - Gateway, - AsyncGateway, - GatewayWithRawResponse, - AsyncGatewayWithRawResponse, - GatewayWithStreamingResponse, - AsyncGatewayWithStreamingResponse, + GatewayResource, + AsyncGatewayResource, + GatewayResourceWithRawResponse, + AsyncGatewayResourceWithRawResponse, + GatewayResourceWithStreamingResponse, + AsyncGatewayResourceWithStreamingResponse, ) from .tunnels import ( - Tunnels, - AsyncTunnels, - TunnelsWithRawResponse, - AsyncTunnelsWithRawResponse, - TunnelsWithStreamingResponse, - AsyncTunnelsWithStreamingResponse, + TunnelsResource, + AsyncTunnelsResource, + TunnelsResourceWithRawResponse, + AsyncTunnelsResourceWithRawResponse, + TunnelsResourceWithStreamingResponse, + AsyncTunnelsResourceWithStreamingResponse, ) from .networks import ( - Networks, - AsyncNetworks, - NetworksWithRawResponse, - AsyncNetworksWithRawResponse, - NetworksWithStreamingResponse, - AsyncNetworksWithStreamingResponse, + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, ) from .zero_trust import ( - ZeroTrust, - AsyncZeroTrust, - ZeroTrustWithRawResponse, - AsyncZeroTrustWithRawResponse, - ZeroTrustWithStreamingResponse, - AsyncZeroTrustWithStreamingResponse, + ZeroTrustResource, + AsyncZeroTrustResource, + ZeroTrustResourceWithRawResponse, + AsyncZeroTrustResourceWithRawResponse, + ZeroTrustResourceWithStreamingResponse, + AsyncZeroTrustResourceWithStreamingResponse, +) +from .risk_scoring import ( + RiskScoringResource, + AsyncRiskScoringResource, + RiskScoringResourceWithRawResponse, + AsyncRiskScoringResourceWithRawResponse, + RiskScoringResourceWithStreamingResponse, + AsyncRiskScoringResourceWithStreamingResponse, ) from .organizations import ( - Organizations, - AsyncOrganizations, - OrganizationsWithRawResponse, - AsyncOrganizationsWithRawResponse, - OrganizationsWithStreamingResponse, - AsyncOrganizationsWithStreamingResponse, + OrganizationsResource, + AsyncOrganizationsResource, + OrganizationsResourceWithRawResponse, + AsyncOrganizationsResourceWithRawResponse, + OrganizationsResourceWithStreamingResponse, + AsyncOrganizationsResourceWithStreamingResponse, ) from .identity_providers import ( - IdentityProviders, - AsyncIdentityProviders, - IdentityProvidersWithRawResponse, - AsyncIdentityProvidersWithRawResponse, - IdentityProvidersWithStreamingResponse, - AsyncIdentityProvidersWithStreamingResponse, + IdentityProvidersResource, + AsyncIdentityProvidersResource, + IdentityProvidersResourceWithRawResponse, + AsyncIdentityProvidersResourceWithRawResponse, + IdentityProvidersResourceWithStreamingResponse, + AsyncIdentityProvidersResourceWithStreamingResponse, ) from .connectivity_settings import ( - ConnectivitySettings, - AsyncConnectivitySettings, - ConnectivitySettingsWithRawResponse, - AsyncConnectivitySettingsWithRawResponse, - ConnectivitySettingsWithStreamingResponse, - AsyncConnectivitySettingsWithStreamingResponse, + ConnectivitySettingsResource, + AsyncConnectivitySettingsResource, + ConnectivitySettingsResourceWithRawResponse, + AsyncConnectivitySettingsResourceWithRawResponse, + ConnectivitySettingsResourceWithStreamingResponse, + AsyncConnectivitySettingsResourceWithStreamingResponse, ) __all__ = [ - "Devices", - "AsyncDevices", - "DevicesWithRawResponse", - "AsyncDevicesWithRawResponse", - "DevicesWithStreamingResponse", - "AsyncDevicesWithStreamingResponse", - "IdentityProviders", - "AsyncIdentityProviders", - "IdentityProvidersWithRawResponse", - "AsyncIdentityProvidersWithRawResponse", - "IdentityProvidersWithStreamingResponse", - "AsyncIdentityProvidersWithStreamingResponse", - "Organizations", - "AsyncOrganizations", - "OrganizationsWithRawResponse", - "AsyncOrganizationsWithRawResponse", - "OrganizationsWithStreamingResponse", - "AsyncOrganizationsWithStreamingResponse", - "Seats", - "AsyncSeats", - "SeatsWithRawResponse", - "AsyncSeatsWithRawResponse", - "SeatsWithStreamingResponse", - "AsyncSeatsWithStreamingResponse", - "Access", - "AsyncAccess", - "AccessWithRawResponse", - "AsyncAccessWithRawResponse", - "AccessWithStreamingResponse", - "AsyncAccessWithStreamingResponse", - "DEX", - "AsyncDEX", - "DEXWithRawResponse", - "AsyncDEXWithRawResponse", - "DEXWithStreamingResponse", - "AsyncDEXWithStreamingResponse", - "Tunnels", - "AsyncTunnels", - "TunnelsWithRawResponse", - "AsyncTunnelsWithRawResponse", - "TunnelsWithStreamingResponse", - "AsyncTunnelsWithStreamingResponse", - "ConnectivitySettings", - "AsyncConnectivitySettings", - "ConnectivitySettingsWithRawResponse", - "AsyncConnectivitySettingsWithRawResponse", - "ConnectivitySettingsWithStreamingResponse", - "AsyncConnectivitySettingsWithStreamingResponse", - "DLP", - "AsyncDLP", - "DLPWithRawResponse", - "AsyncDLPWithRawResponse", - "DLPWithStreamingResponse", - "AsyncDLPWithStreamingResponse", - "Gateway", - "AsyncGateway", - "GatewayWithRawResponse", - "AsyncGatewayWithRawResponse", - "GatewayWithStreamingResponse", - "AsyncGatewayWithStreamingResponse", - "Networks", - "AsyncNetworks", - "NetworksWithRawResponse", - "AsyncNetworksWithRawResponse", - "NetworksWithStreamingResponse", - "AsyncNetworksWithStreamingResponse", - "ZeroTrust", - "AsyncZeroTrust", - "ZeroTrustWithRawResponse", - "AsyncZeroTrustWithRawResponse", - "ZeroTrustWithStreamingResponse", - "AsyncZeroTrustWithStreamingResponse", + "DevicesResource", + "AsyncDevicesResource", + "DevicesResourceWithRawResponse", + "AsyncDevicesResourceWithRawResponse", + "DevicesResourceWithStreamingResponse", + "AsyncDevicesResourceWithStreamingResponse", + "IdentityProvidersResource", + "AsyncIdentityProvidersResource", + "IdentityProvidersResourceWithRawResponse", + "AsyncIdentityProvidersResourceWithRawResponse", + "IdentityProvidersResourceWithStreamingResponse", + "AsyncIdentityProvidersResourceWithStreamingResponse", + "OrganizationsResource", + "AsyncOrganizationsResource", + "OrganizationsResourceWithRawResponse", + "AsyncOrganizationsResourceWithRawResponse", + "OrganizationsResourceWithStreamingResponse", + "AsyncOrganizationsResourceWithStreamingResponse", + "SeatsResource", + "AsyncSeatsResource", + "SeatsResourceWithRawResponse", + "AsyncSeatsResourceWithRawResponse", + "SeatsResourceWithStreamingResponse", + "AsyncSeatsResourceWithStreamingResponse", + "AccessResource", + "AsyncAccessResource", + "AccessResourceWithRawResponse", + "AsyncAccessResourceWithRawResponse", + "AccessResourceWithStreamingResponse", + "AsyncAccessResourceWithStreamingResponse", + "DEXResource", + "AsyncDEXResource", + "DEXResourceWithRawResponse", + "AsyncDEXResourceWithRawResponse", + "DEXResourceWithStreamingResponse", + "AsyncDEXResourceWithStreamingResponse", + "TunnelsResource", + "AsyncTunnelsResource", + "TunnelsResourceWithRawResponse", + "AsyncTunnelsResourceWithRawResponse", + "TunnelsResourceWithStreamingResponse", + "AsyncTunnelsResourceWithStreamingResponse", + "ConnectivitySettingsResource", + "AsyncConnectivitySettingsResource", + "ConnectivitySettingsResourceWithRawResponse", + "AsyncConnectivitySettingsResourceWithRawResponse", + "ConnectivitySettingsResourceWithStreamingResponse", + "AsyncConnectivitySettingsResourceWithStreamingResponse", + "DLPResource", + "AsyncDLPResource", + "DLPResourceWithRawResponse", + "AsyncDLPResourceWithRawResponse", + "DLPResourceWithStreamingResponse", + "AsyncDLPResourceWithStreamingResponse", + "GatewayResource", + "AsyncGatewayResource", + "GatewayResourceWithRawResponse", + "AsyncGatewayResourceWithRawResponse", + "GatewayResourceWithStreamingResponse", + "AsyncGatewayResourceWithStreamingResponse", + "NetworksResource", + "AsyncNetworksResource", + "NetworksResourceWithRawResponse", + "AsyncNetworksResourceWithRawResponse", + "NetworksResourceWithStreamingResponse", + "AsyncNetworksResourceWithStreamingResponse", + "RiskScoringResource", + "AsyncRiskScoringResource", + "RiskScoringResourceWithRawResponse", + "AsyncRiskScoringResourceWithRawResponse", + "RiskScoringResourceWithStreamingResponse", + "AsyncRiskScoringResourceWithStreamingResponse", + "ZeroTrustResource", + "AsyncZeroTrustResource", + "ZeroTrustResourceWithRawResponse", + "AsyncZeroTrustResourceWithRawResponse", + "ZeroTrustResourceWithStreamingResponse", + "AsyncZeroTrustResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/access/__init__.py b/src/cloudflare/resources/zero_trust/access/__init__.py index 198f90998c4..b34af407a86 100644 --- a/src/cloudflare/resources/zero_trust/access/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/__init__.py @@ -1,159 +1,159 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .keys import ( - Keys, - AsyncKeys, - KeysWithRawResponse, - AsyncKeysWithRawResponse, - KeysWithStreamingResponse, - AsyncKeysWithStreamingResponse, + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, ) from .logs import ( - Logs, - AsyncLogs, - LogsWithRawResponse, - AsyncLogsWithRawResponse, - LogsWithStreamingResponse, - AsyncLogsWithStreamingResponse, + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, ) from .tags import ( - Tags, - AsyncTags, - TagsWithRawResponse, - AsyncTagsWithRawResponse, - TagsWithStreamingResponse, - AsyncTagsWithStreamingResponse, + TagsResource, + AsyncTagsResource, + TagsResourceWithRawResponse, + AsyncTagsResourceWithRawResponse, + TagsResourceWithStreamingResponse, + AsyncTagsResourceWithStreamingResponse, ) from .users import ( - Users, - AsyncUsers, - UsersWithRawResponse, - AsyncUsersWithRawResponse, - UsersWithStreamingResponse, - AsyncUsersWithStreamingResponse, + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, ) from .access import ( - Access, - AsyncAccess, - AccessWithRawResponse, - AsyncAccessWithRawResponse, - AccessWithStreamingResponse, - AsyncAccessWithStreamingResponse, + AccessResource, + AsyncAccessResource, + AccessResourceWithRawResponse, + AsyncAccessResourceWithRawResponse, + AccessResourceWithStreamingResponse, + AsyncAccessResourceWithStreamingResponse, ) from .groups import ( - Groups, - AsyncGroups, - GroupsWithRawResponse, - AsyncGroupsWithRawResponse, - GroupsWithStreamingResponse, - AsyncGroupsWithStreamingResponse, + GroupsResource, + AsyncGroupsResource, + GroupsResourceWithRawResponse, + AsyncGroupsResourceWithRawResponse, + GroupsResourceWithStreamingResponse, + AsyncGroupsResourceWithStreamingResponse, ) from .bookmarks import ( - Bookmarks, - AsyncBookmarks, - BookmarksWithRawResponse, - AsyncBookmarksWithRawResponse, - BookmarksWithStreamingResponse, - AsyncBookmarksWithStreamingResponse, + BookmarksResource, + AsyncBookmarksResource, + BookmarksResourceWithRawResponse, + AsyncBookmarksResourceWithRawResponse, + BookmarksResourceWithStreamingResponse, + AsyncBookmarksResourceWithStreamingResponse, ) from .applications import ( - Applications, - AsyncApplications, - ApplicationsWithRawResponse, - AsyncApplicationsWithRawResponse, - ApplicationsWithStreamingResponse, - AsyncApplicationsWithStreamingResponse, + ApplicationsResource, + AsyncApplicationsResource, + ApplicationsResourceWithRawResponse, + AsyncApplicationsResourceWithRawResponse, + ApplicationsResourceWithStreamingResponse, + AsyncApplicationsResourceWithStreamingResponse, ) from .certificates import ( - Certificates, - AsyncCertificates, - CertificatesWithRawResponse, - AsyncCertificatesWithRawResponse, - CertificatesWithStreamingResponse, - AsyncCertificatesWithStreamingResponse, + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, ) from .custom_pages import ( - CustomPages, - AsyncCustomPages, - CustomPagesWithRawResponse, - AsyncCustomPagesWithRawResponse, - CustomPagesWithStreamingResponse, - AsyncCustomPagesWithStreamingResponse, + CustomPagesResource, + AsyncCustomPagesResource, + CustomPagesResourceWithRawResponse, + AsyncCustomPagesResourceWithRawResponse, + CustomPagesResourceWithStreamingResponse, + AsyncCustomPagesResourceWithStreamingResponse, ) from .service_tokens import ( - ServiceTokens, - AsyncServiceTokens, - ServiceTokensWithRawResponse, - AsyncServiceTokensWithRawResponse, - ServiceTokensWithStreamingResponse, - AsyncServiceTokensWithStreamingResponse, + ServiceTokensResource, + AsyncServiceTokensResource, + ServiceTokensResourceWithRawResponse, + AsyncServiceTokensResourceWithRawResponse, + ServiceTokensResourceWithStreamingResponse, + AsyncServiceTokensResourceWithStreamingResponse, ) __all__ = [ - "Applications", - "AsyncApplications", - "ApplicationsWithRawResponse", - "AsyncApplicationsWithRawResponse", - "ApplicationsWithStreamingResponse", - "AsyncApplicationsWithStreamingResponse", - "Certificates", - "AsyncCertificates", - "CertificatesWithRawResponse", - "AsyncCertificatesWithRawResponse", - "CertificatesWithStreamingResponse", - "AsyncCertificatesWithStreamingResponse", - "Groups", - "AsyncGroups", - "GroupsWithRawResponse", - "AsyncGroupsWithRawResponse", - "GroupsWithStreamingResponse", - "AsyncGroupsWithStreamingResponse", - "ServiceTokens", - "AsyncServiceTokens", - "ServiceTokensWithRawResponse", - "AsyncServiceTokensWithRawResponse", - "ServiceTokensWithStreamingResponse", - "AsyncServiceTokensWithStreamingResponse", - "Bookmarks", - "AsyncBookmarks", - "BookmarksWithRawResponse", - "AsyncBookmarksWithRawResponse", - "BookmarksWithStreamingResponse", - "AsyncBookmarksWithStreamingResponse", - "Keys", - "AsyncKeys", - "KeysWithRawResponse", - "AsyncKeysWithRawResponse", - "KeysWithStreamingResponse", - "AsyncKeysWithStreamingResponse", - "Logs", - "AsyncLogs", - "LogsWithRawResponse", - "AsyncLogsWithRawResponse", - "LogsWithStreamingResponse", - "AsyncLogsWithStreamingResponse", - "Users", - "AsyncUsers", - "UsersWithRawResponse", - "AsyncUsersWithRawResponse", - "UsersWithStreamingResponse", - "AsyncUsersWithStreamingResponse", - "CustomPages", - "AsyncCustomPages", - "CustomPagesWithRawResponse", - "AsyncCustomPagesWithRawResponse", - "CustomPagesWithStreamingResponse", - "AsyncCustomPagesWithStreamingResponse", - "Tags", - "AsyncTags", - "TagsWithRawResponse", - "AsyncTagsWithRawResponse", - "TagsWithStreamingResponse", - "AsyncTagsWithStreamingResponse", - "Access", - "AsyncAccess", - "AccessWithRawResponse", - "AsyncAccessWithRawResponse", - "AccessWithStreamingResponse", - "AsyncAccessWithStreamingResponse", + "ApplicationsResource", + "AsyncApplicationsResource", + "ApplicationsResourceWithRawResponse", + "AsyncApplicationsResourceWithRawResponse", + "ApplicationsResourceWithStreamingResponse", + "AsyncApplicationsResourceWithStreamingResponse", + "CertificatesResource", + "AsyncCertificatesResource", + "CertificatesResourceWithRawResponse", + "AsyncCertificatesResourceWithRawResponse", + "CertificatesResourceWithStreamingResponse", + "AsyncCertificatesResourceWithStreamingResponse", + "GroupsResource", + "AsyncGroupsResource", + "GroupsResourceWithRawResponse", + "AsyncGroupsResourceWithRawResponse", + "GroupsResourceWithStreamingResponse", + "AsyncGroupsResourceWithStreamingResponse", + "ServiceTokensResource", + "AsyncServiceTokensResource", + "ServiceTokensResourceWithRawResponse", + "AsyncServiceTokensResourceWithRawResponse", + "ServiceTokensResourceWithStreamingResponse", + "AsyncServiceTokensResourceWithStreamingResponse", + "BookmarksResource", + "AsyncBookmarksResource", + "BookmarksResourceWithRawResponse", + "AsyncBookmarksResourceWithRawResponse", + "BookmarksResourceWithStreamingResponse", + "AsyncBookmarksResourceWithStreamingResponse", + "KeysResource", + "AsyncKeysResource", + "KeysResourceWithRawResponse", + "AsyncKeysResourceWithRawResponse", + "KeysResourceWithStreamingResponse", + "AsyncKeysResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", + "CustomPagesResource", + "AsyncCustomPagesResource", + "CustomPagesResourceWithRawResponse", + "AsyncCustomPagesResourceWithRawResponse", + "CustomPagesResourceWithStreamingResponse", + "AsyncCustomPagesResourceWithStreamingResponse", + "TagsResource", + "AsyncTagsResource", + "TagsResourceWithRawResponse", + "AsyncTagsResourceWithRawResponse", + "TagsResourceWithStreamingResponse", + "AsyncTagsResourceWithStreamingResponse", + "AccessResource", + "AsyncAccessResource", + "AccessResourceWithRawResponse", + "AsyncAccessResourceWithRawResponse", + "AccessResourceWithStreamingResponse", + "AsyncAccessResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/access/access.py b/src/cloudflare/resources/zero_trust/access/access.py index 079457e9b97..6707c0f7745 100644 --- a/src/cloudflare/resources/zero_trust/access/access.py +++ b/src/cloudflare/resources/zero_trust/access/access.py @@ -3,370 +3,370 @@ from __future__ import annotations from .keys import ( - Keys, - AsyncKeys, - KeysWithRawResponse, - AsyncKeysWithRawResponse, - KeysWithStreamingResponse, - AsyncKeysWithStreamingResponse, + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, ) from .logs import ( - Logs, - AsyncLogs, - LogsWithRawResponse, - AsyncLogsWithRawResponse, - LogsWithStreamingResponse, - AsyncLogsWithStreamingResponse, + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, ) from .tags import ( - Tags, - AsyncTags, - TagsWithRawResponse, - AsyncTagsWithRawResponse, - TagsWithStreamingResponse, - AsyncTagsWithStreamingResponse, + TagsResource, + AsyncTagsResource, + TagsResourceWithRawResponse, + AsyncTagsResourceWithRawResponse, + TagsResourceWithStreamingResponse, + AsyncTagsResourceWithStreamingResponse, ) from .users import ( - Users, - AsyncUsers, - UsersWithRawResponse, - AsyncUsersWithRawResponse, - UsersWithStreamingResponse, - AsyncUsersWithStreamingResponse, + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, ) from .groups import ( - Groups, - AsyncGroups, - GroupsWithRawResponse, - AsyncGroupsWithRawResponse, - GroupsWithStreamingResponse, - AsyncGroupsWithStreamingResponse, + GroupsResource, + AsyncGroupsResource, + GroupsResourceWithRawResponse, + AsyncGroupsResourceWithRawResponse, + GroupsResourceWithStreamingResponse, + AsyncGroupsResourceWithStreamingResponse, ) from .bookmarks import ( - Bookmarks, - AsyncBookmarks, - BookmarksWithRawResponse, - AsyncBookmarksWithRawResponse, - BookmarksWithStreamingResponse, - AsyncBookmarksWithStreamingResponse, + BookmarksResource, + AsyncBookmarksResource, + BookmarksResourceWithRawResponse, + AsyncBookmarksResourceWithRawResponse, + BookmarksResourceWithStreamingResponse, + AsyncBookmarksResourceWithStreamingResponse, ) -from .logs.logs import Logs, AsyncLogs +from .logs.logs import LogsResource, AsyncLogsResource from ...._compat import cached_property -from .users.users import Users, AsyncUsers +from .users.users import UsersResource, AsyncUsersResource from ...._resource import SyncAPIResource, AsyncAPIResource from .applications import ( - Applications, - AsyncApplications, - ApplicationsWithRawResponse, - AsyncApplicationsWithRawResponse, - ApplicationsWithStreamingResponse, - AsyncApplicationsWithStreamingResponse, + ApplicationsResource, + AsyncApplicationsResource, + ApplicationsResourceWithRawResponse, + AsyncApplicationsResourceWithRawResponse, + ApplicationsResourceWithStreamingResponse, + AsyncApplicationsResourceWithStreamingResponse, ) from .certificates import ( - Certificates, - AsyncCertificates, - CertificatesWithRawResponse, - AsyncCertificatesWithRawResponse, - CertificatesWithStreamingResponse, - AsyncCertificatesWithStreamingResponse, + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, ) from .custom_pages import ( - CustomPages, - AsyncCustomPages, - CustomPagesWithRawResponse, - AsyncCustomPagesWithRawResponse, - CustomPagesWithStreamingResponse, - AsyncCustomPagesWithStreamingResponse, + CustomPagesResource, + AsyncCustomPagesResource, + CustomPagesResourceWithRawResponse, + AsyncCustomPagesResourceWithRawResponse, + CustomPagesResourceWithStreamingResponse, + AsyncCustomPagesResourceWithStreamingResponse, ) from .service_tokens import ( - ServiceTokens, - AsyncServiceTokens, - ServiceTokensWithRawResponse, - AsyncServiceTokensWithRawResponse, - ServiceTokensWithStreamingResponse, - AsyncServiceTokensWithStreamingResponse, + ServiceTokensResource, + AsyncServiceTokensResource, + ServiceTokensResourceWithRawResponse, + AsyncServiceTokensResourceWithRawResponse, + ServiceTokensResourceWithStreamingResponse, + AsyncServiceTokensResourceWithStreamingResponse, ) -from .applications.applications import Applications, AsyncApplications -from .certificates.certificates import Certificates, AsyncCertificates +from .applications.applications import ApplicationsResource, AsyncApplicationsResource +from .certificates.certificates import CertificatesResource, AsyncCertificatesResource -__all__ = ["Access", "AsyncAccess"] +__all__ = ["AccessResource", "AsyncAccessResource"] -class Access(SyncAPIResource): +class AccessResource(SyncAPIResource): @cached_property - def applications(self) -> Applications: - return Applications(self._client) + def applications(self) -> ApplicationsResource: + return ApplicationsResource(self._client) @cached_property - def certificates(self) -> Certificates: - return Certificates(self._client) + def certificates(self) -> CertificatesResource: + return CertificatesResource(self._client) @cached_property - def groups(self) -> Groups: - return Groups(self._client) + def groups(self) -> GroupsResource: + return GroupsResource(self._client) @cached_property - def service_tokens(self) -> ServiceTokens: - return ServiceTokens(self._client) + def service_tokens(self) -> ServiceTokensResource: + return ServiceTokensResource(self._client) @cached_property - def bookmarks(self) -> Bookmarks: - return Bookmarks(self._client) + def bookmarks(self) -> BookmarksResource: + return BookmarksResource(self._client) @cached_property - def keys(self) -> Keys: - return Keys(self._client) + def keys(self) -> KeysResource: + return KeysResource(self._client) @cached_property - def logs(self) -> Logs: - return Logs(self._client) + def logs(self) -> LogsResource: + return LogsResource(self._client) @cached_property - def users(self) -> Users: - return Users(self._client) + def users(self) -> UsersResource: + return UsersResource(self._client) @cached_property - def custom_pages(self) -> CustomPages: - return CustomPages(self._client) + def custom_pages(self) -> CustomPagesResource: + return CustomPagesResource(self._client) @cached_property - def tags(self) -> Tags: - return Tags(self._client) + def tags(self) -> TagsResource: + return TagsResource(self._client) @cached_property - def with_raw_response(self) -> AccessWithRawResponse: - return AccessWithRawResponse(self) + def with_raw_response(self) -> AccessResourceWithRawResponse: + return AccessResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccessWithStreamingResponse: - return AccessWithStreamingResponse(self) + def with_streaming_response(self) -> AccessResourceWithStreamingResponse: + return AccessResourceWithStreamingResponse(self) -class AsyncAccess(AsyncAPIResource): +class AsyncAccessResource(AsyncAPIResource): @cached_property - def applications(self) -> AsyncApplications: - return AsyncApplications(self._client) + def applications(self) -> AsyncApplicationsResource: + return AsyncApplicationsResource(self._client) @cached_property - def certificates(self) -> AsyncCertificates: - return AsyncCertificates(self._client) + def certificates(self) -> AsyncCertificatesResource: + return AsyncCertificatesResource(self._client) @cached_property - def groups(self) -> AsyncGroups: - return AsyncGroups(self._client) + def groups(self) -> AsyncGroupsResource: + return AsyncGroupsResource(self._client) @cached_property - def service_tokens(self) -> AsyncServiceTokens: - return AsyncServiceTokens(self._client) + def service_tokens(self) -> AsyncServiceTokensResource: + return AsyncServiceTokensResource(self._client) @cached_property - def bookmarks(self) -> AsyncBookmarks: - return AsyncBookmarks(self._client) + def bookmarks(self) -> AsyncBookmarksResource: + return AsyncBookmarksResource(self._client) @cached_property - def keys(self) -> AsyncKeys: - return AsyncKeys(self._client) + def keys(self) -> AsyncKeysResource: + return AsyncKeysResource(self._client) @cached_property - def logs(self) -> AsyncLogs: - return AsyncLogs(self._client) + def logs(self) -> AsyncLogsResource: + return AsyncLogsResource(self._client) @cached_property - def users(self) -> AsyncUsers: - return AsyncUsers(self._client) + def users(self) -> AsyncUsersResource: + return AsyncUsersResource(self._client) @cached_property - def custom_pages(self) -> AsyncCustomPages: - return AsyncCustomPages(self._client) + def custom_pages(self) -> AsyncCustomPagesResource: + return AsyncCustomPagesResource(self._client) @cached_property - def tags(self) -> AsyncTags: - return AsyncTags(self._client) + def tags(self) -> AsyncTagsResource: + return AsyncTagsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncAccessWithRawResponse: - return AsyncAccessWithRawResponse(self) + def with_raw_response(self) -> AsyncAccessResourceWithRawResponse: + return AsyncAccessResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccessWithStreamingResponse: - return AsyncAccessWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccessResourceWithStreamingResponse: + return AsyncAccessResourceWithStreamingResponse(self) -class AccessWithRawResponse: - def __init__(self, access: Access) -> None: +class AccessResourceWithRawResponse: + def __init__(self, access: AccessResource) -> None: self._access = access @cached_property - def applications(self) -> ApplicationsWithRawResponse: - return ApplicationsWithRawResponse(self._access.applications) + def applications(self) -> ApplicationsResourceWithRawResponse: + return ApplicationsResourceWithRawResponse(self._access.applications) @cached_property - def certificates(self) -> CertificatesWithRawResponse: - return CertificatesWithRawResponse(self._access.certificates) + def certificates(self) -> CertificatesResourceWithRawResponse: + return CertificatesResourceWithRawResponse(self._access.certificates) @cached_property - def groups(self) -> GroupsWithRawResponse: - return GroupsWithRawResponse(self._access.groups) + def groups(self) -> GroupsResourceWithRawResponse: + return GroupsResourceWithRawResponse(self._access.groups) @cached_property - def service_tokens(self) -> ServiceTokensWithRawResponse: - return ServiceTokensWithRawResponse(self._access.service_tokens) + def service_tokens(self) -> ServiceTokensResourceWithRawResponse: + return ServiceTokensResourceWithRawResponse(self._access.service_tokens) @cached_property - def bookmarks(self) -> BookmarksWithRawResponse: - return BookmarksWithRawResponse(self._access.bookmarks) + def bookmarks(self) -> BookmarksResourceWithRawResponse: + return BookmarksResourceWithRawResponse(self._access.bookmarks) @cached_property - def keys(self) -> KeysWithRawResponse: - return KeysWithRawResponse(self._access.keys) + def keys(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self._access.keys) @cached_property - def logs(self) -> LogsWithRawResponse: - return LogsWithRawResponse(self._access.logs) + def logs(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self._access.logs) @cached_property - def users(self) -> UsersWithRawResponse: - return UsersWithRawResponse(self._access.users) + def users(self) -> UsersResourceWithRawResponse: + return UsersResourceWithRawResponse(self._access.users) @cached_property - def custom_pages(self) -> CustomPagesWithRawResponse: - return CustomPagesWithRawResponse(self._access.custom_pages) + def custom_pages(self) -> CustomPagesResourceWithRawResponse: + return CustomPagesResourceWithRawResponse(self._access.custom_pages) @cached_property - def tags(self) -> TagsWithRawResponse: - return TagsWithRawResponse(self._access.tags) + def tags(self) -> TagsResourceWithRawResponse: + return TagsResourceWithRawResponse(self._access.tags) -class AsyncAccessWithRawResponse: - def __init__(self, access: AsyncAccess) -> None: +class AsyncAccessResourceWithRawResponse: + def __init__(self, access: AsyncAccessResource) -> None: self._access = access @cached_property - def applications(self) -> AsyncApplicationsWithRawResponse: - return AsyncApplicationsWithRawResponse(self._access.applications) + def applications(self) -> AsyncApplicationsResourceWithRawResponse: + return AsyncApplicationsResourceWithRawResponse(self._access.applications) @cached_property - def certificates(self) -> AsyncCertificatesWithRawResponse: - return AsyncCertificatesWithRawResponse(self._access.certificates) + def certificates(self) -> AsyncCertificatesResourceWithRawResponse: + return AsyncCertificatesResourceWithRawResponse(self._access.certificates) @cached_property - def groups(self) -> AsyncGroupsWithRawResponse: - return AsyncGroupsWithRawResponse(self._access.groups) + def groups(self) -> AsyncGroupsResourceWithRawResponse: + return AsyncGroupsResourceWithRawResponse(self._access.groups) @cached_property - def service_tokens(self) -> AsyncServiceTokensWithRawResponse: - return AsyncServiceTokensWithRawResponse(self._access.service_tokens) + def service_tokens(self) -> AsyncServiceTokensResourceWithRawResponse: + return AsyncServiceTokensResourceWithRawResponse(self._access.service_tokens) @cached_property - def bookmarks(self) -> AsyncBookmarksWithRawResponse: - return AsyncBookmarksWithRawResponse(self._access.bookmarks) + def bookmarks(self) -> AsyncBookmarksResourceWithRawResponse: + return AsyncBookmarksResourceWithRawResponse(self._access.bookmarks) @cached_property - def keys(self) -> AsyncKeysWithRawResponse: - return AsyncKeysWithRawResponse(self._access.keys) + def keys(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self._access.keys) @cached_property - def logs(self) -> AsyncLogsWithRawResponse: - return AsyncLogsWithRawResponse(self._access.logs) + def logs(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self._access.logs) @cached_property - def users(self) -> AsyncUsersWithRawResponse: - return AsyncUsersWithRawResponse(self._access.users) + def users(self) -> AsyncUsersResourceWithRawResponse: + return AsyncUsersResourceWithRawResponse(self._access.users) @cached_property - def custom_pages(self) -> AsyncCustomPagesWithRawResponse: - return AsyncCustomPagesWithRawResponse(self._access.custom_pages) + def custom_pages(self) -> AsyncCustomPagesResourceWithRawResponse: + return AsyncCustomPagesResourceWithRawResponse(self._access.custom_pages) @cached_property - def tags(self) -> AsyncTagsWithRawResponse: - return AsyncTagsWithRawResponse(self._access.tags) + def tags(self) -> AsyncTagsResourceWithRawResponse: + return AsyncTagsResourceWithRawResponse(self._access.tags) -class AccessWithStreamingResponse: - def __init__(self, access: Access) -> None: +class AccessResourceWithStreamingResponse: + def __init__(self, access: AccessResource) -> None: self._access = access @cached_property - def applications(self) -> ApplicationsWithStreamingResponse: - return ApplicationsWithStreamingResponse(self._access.applications) + def applications(self) -> ApplicationsResourceWithStreamingResponse: + return ApplicationsResourceWithStreamingResponse(self._access.applications) @cached_property - def certificates(self) -> CertificatesWithStreamingResponse: - return CertificatesWithStreamingResponse(self._access.certificates) + def certificates(self) -> CertificatesResourceWithStreamingResponse: + return CertificatesResourceWithStreamingResponse(self._access.certificates) @cached_property - def groups(self) -> GroupsWithStreamingResponse: - return GroupsWithStreamingResponse(self._access.groups) + def groups(self) -> GroupsResourceWithStreamingResponse: + return GroupsResourceWithStreamingResponse(self._access.groups) @cached_property - def service_tokens(self) -> ServiceTokensWithStreamingResponse: - return ServiceTokensWithStreamingResponse(self._access.service_tokens) + def service_tokens(self) -> ServiceTokensResourceWithStreamingResponse: + return ServiceTokensResourceWithStreamingResponse(self._access.service_tokens) @cached_property - def bookmarks(self) -> BookmarksWithStreamingResponse: - return BookmarksWithStreamingResponse(self._access.bookmarks) + def bookmarks(self) -> BookmarksResourceWithStreamingResponse: + return BookmarksResourceWithStreamingResponse(self._access.bookmarks) @cached_property - def keys(self) -> KeysWithStreamingResponse: - return KeysWithStreamingResponse(self._access.keys) + def keys(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self._access.keys) @cached_property - def logs(self) -> LogsWithStreamingResponse: - return LogsWithStreamingResponse(self._access.logs) + def logs(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self._access.logs) @cached_property - def users(self) -> UsersWithStreamingResponse: - return UsersWithStreamingResponse(self._access.users) + def users(self) -> UsersResourceWithStreamingResponse: + return UsersResourceWithStreamingResponse(self._access.users) @cached_property - def custom_pages(self) -> CustomPagesWithStreamingResponse: - return CustomPagesWithStreamingResponse(self._access.custom_pages) + def custom_pages(self) -> CustomPagesResourceWithStreamingResponse: + return CustomPagesResourceWithStreamingResponse(self._access.custom_pages) @cached_property - def tags(self) -> TagsWithStreamingResponse: - return TagsWithStreamingResponse(self._access.tags) + def tags(self) -> TagsResourceWithStreamingResponse: + return TagsResourceWithStreamingResponse(self._access.tags) -class AsyncAccessWithStreamingResponse: - def __init__(self, access: AsyncAccess) -> None: +class AsyncAccessResourceWithStreamingResponse: + def __init__(self, access: AsyncAccessResource) -> None: self._access = access @cached_property - def applications(self) -> AsyncApplicationsWithStreamingResponse: - return AsyncApplicationsWithStreamingResponse(self._access.applications) + def applications(self) -> AsyncApplicationsResourceWithStreamingResponse: + return AsyncApplicationsResourceWithStreamingResponse(self._access.applications) @cached_property - def certificates(self) -> AsyncCertificatesWithStreamingResponse: - return AsyncCertificatesWithStreamingResponse(self._access.certificates) + def certificates(self) -> AsyncCertificatesResourceWithStreamingResponse: + return AsyncCertificatesResourceWithStreamingResponse(self._access.certificates) @cached_property - def groups(self) -> AsyncGroupsWithStreamingResponse: - return AsyncGroupsWithStreamingResponse(self._access.groups) + def groups(self) -> AsyncGroupsResourceWithStreamingResponse: + return AsyncGroupsResourceWithStreamingResponse(self._access.groups) @cached_property - def service_tokens(self) -> AsyncServiceTokensWithStreamingResponse: - return AsyncServiceTokensWithStreamingResponse(self._access.service_tokens) + def service_tokens(self) -> AsyncServiceTokensResourceWithStreamingResponse: + return AsyncServiceTokensResourceWithStreamingResponse(self._access.service_tokens) @cached_property - def bookmarks(self) -> AsyncBookmarksWithStreamingResponse: - return AsyncBookmarksWithStreamingResponse(self._access.bookmarks) + def bookmarks(self) -> AsyncBookmarksResourceWithStreamingResponse: + return AsyncBookmarksResourceWithStreamingResponse(self._access.bookmarks) @cached_property - def keys(self) -> AsyncKeysWithStreamingResponse: - return AsyncKeysWithStreamingResponse(self._access.keys) + def keys(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self._access.keys) @cached_property - def logs(self) -> AsyncLogsWithStreamingResponse: - return AsyncLogsWithStreamingResponse(self._access.logs) + def logs(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self._access.logs) @cached_property - def users(self) -> AsyncUsersWithStreamingResponse: - return AsyncUsersWithStreamingResponse(self._access.users) + def users(self) -> AsyncUsersResourceWithStreamingResponse: + return AsyncUsersResourceWithStreamingResponse(self._access.users) @cached_property - def custom_pages(self) -> AsyncCustomPagesWithStreamingResponse: - return AsyncCustomPagesWithStreamingResponse(self._access.custom_pages) + def custom_pages(self) -> AsyncCustomPagesResourceWithStreamingResponse: + return AsyncCustomPagesResourceWithStreamingResponse(self._access.custom_pages) @cached_property - def tags(self) -> AsyncTagsWithStreamingResponse: - return AsyncTagsWithStreamingResponse(self._access.tags) + def tags(self) -> AsyncTagsResourceWithStreamingResponse: + return AsyncTagsResourceWithStreamingResponse(self._access.tags) diff --git a/src/cloudflare/resources/zero_trust/access/applications/__init__.py b/src/cloudflare/resources/zero_trust/access/applications/__init__.py index 5b5d92cb586..8b6f39c4dd8 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/applications/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .cas import ( - CAs, - AsyncCAs, - CAsWithRawResponse, - AsyncCAsWithRawResponse, - CAsWithStreamingResponse, - AsyncCAsWithStreamingResponse, + CAsResource, + AsyncCAsResource, + CAsResourceWithRawResponse, + AsyncCAsResourceWithRawResponse, + CAsResourceWithStreamingResponse, + AsyncCAsResourceWithStreamingResponse, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from .applications import ( - Applications, - AsyncApplications, - ApplicationsWithRawResponse, - AsyncApplicationsWithRawResponse, - ApplicationsWithStreamingResponse, - AsyncApplicationsWithStreamingResponse, + ApplicationsResource, + AsyncApplicationsResource, + ApplicationsResourceWithRawResponse, + AsyncApplicationsResourceWithRawResponse, + ApplicationsResourceWithStreamingResponse, + AsyncApplicationsResourceWithStreamingResponse, ) from .user_policy_checks import ( - UserPolicyChecks, - AsyncUserPolicyChecks, - UserPolicyChecksWithRawResponse, - AsyncUserPolicyChecksWithRawResponse, - UserPolicyChecksWithStreamingResponse, - AsyncUserPolicyChecksWithStreamingResponse, + UserPolicyChecksResource, + AsyncUserPolicyChecksResource, + UserPolicyChecksResourceWithRawResponse, + AsyncUserPolicyChecksResourceWithRawResponse, + UserPolicyChecksResourceWithStreamingResponse, + AsyncUserPolicyChecksResourceWithStreamingResponse, ) __all__ = [ - "CAs", - "AsyncCAs", - "CAsWithRawResponse", - "AsyncCAsWithRawResponse", - "CAsWithStreamingResponse", - "AsyncCAsWithStreamingResponse", - "UserPolicyChecks", - "AsyncUserPolicyChecks", - "UserPolicyChecksWithRawResponse", - "AsyncUserPolicyChecksWithRawResponse", - "UserPolicyChecksWithStreamingResponse", - "AsyncUserPolicyChecksWithStreamingResponse", - "Policies", - "AsyncPolicies", - "PoliciesWithRawResponse", - "AsyncPoliciesWithRawResponse", - "PoliciesWithStreamingResponse", - "AsyncPoliciesWithStreamingResponse", - "Applications", - "AsyncApplications", - "ApplicationsWithRawResponse", - "AsyncApplicationsWithRawResponse", - "ApplicationsWithStreamingResponse", - "AsyncApplicationsWithStreamingResponse", + "CAsResource", + "AsyncCAsResource", + "CAsResourceWithRawResponse", + "AsyncCAsResourceWithRawResponse", + "CAsResourceWithStreamingResponse", + "AsyncCAsResourceWithStreamingResponse", + "UserPolicyChecksResource", + "AsyncUserPolicyChecksResource", + "UserPolicyChecksResourceWithRawResponse", + "AsyncUserPolicyChecksResourceWithRawResponse", + "UserPolicyChecksResourceWithStreamingResponse", + "AsyncUserPolicyChecksResourceWithStreamingResponse", + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", + "ApplicationsResource", + "AsyncApplicationsResource", + "ApplicationsResourceWithRawResponse", + "AsyncApplicationsResourceWithRawResponse", + "ApplicationsResourceWithStreamingResponse", + "AsyncApplicationsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/access/applications/applications.py b/src/cloudflare/resources/zero_trust/access/applications/applications.py index 1fc1f0789fd..784827d16fd 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/applications.py +++ b/src/cloudflare/resources/zero_trust/access/applications/applications.py @@ -2,26 +2,26 @@ from __future__ import annotations -from typing import Any, List, Type, Union, cast, overload +from typing import Any, List, Type, Optional, cast, overload from typing_extensions import Literal import httpx from .cas import ( - CAs, - AsyncCAs, - CAsWithRawResponse, - AsyncCAsWithRawResponse, - CAsWithStreamingResponse, - AsyncCAsWithStreamingResponse, + CAsResource, + AsyncCAsResource, + CAsResourceWithRawResponse, + AsyncCAsResourceWithRawResponse, + CAsResourceWithStreamingResponse, + AsyncCAsResourceWithStreamingResponse, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -43,43 +43,45 @@ make_request_options, ) from .user_policy_checks import ( - UserPolicyChecks, - AsyncUserPolicyChecks, - UserPolicyChecksWithRawResponse, - AsyncUserPolicyChecksWithRawResponse, - UserPolicyChecksWithStreamingResponse, - AsyncUserPolicyChecksWithStreamingResponse, -) -from .....types.zero_trust.access import ( - ZeroTrustApps, - ApplicationDeleteResponse, - application_create_params, - application_update_params, + UserPolicyChecksResource, + AsyncUserPolicyChecksResource, + UserPolicyChecksResourceWithRawResponse, + AsyncUserPolicyChecksResourceWithRawResponse, + UserPolicyChecksResourceWithStreamingResponse, + AsyncUserPolicyChecksResourceWithStreamingResponse, ) +from .....types.zero_trust.access import application_create_params, application_update_params +from .....types.zero_trust.access.application import Application +from .....types.zero_trust.access.app_id_param import AppIDParam +from .....types.zero_trust.access.allowed_idpsh import AllowedIdpsh +from .....types.zero_trust.access.custom_pagesh import CustomPagesh +from .....types.zero_trust.access.cors_headers_param import CORSHeadersParam +from .....types.zero_trust.access.self_hosted_domainsh import SelfHostedDomainsh +from .....types.zero_trust.access.application_delete_response import ApplicationDeleteResponse -__all__ = ["Applications", "AsyncApplications"] +__all__ = ["ApplicationsResource", "AsyncApplicationsResource"] -class Applications(SyncAPIResource): +class ApplicationsResource(SyncAPIResource): @cached_property - def cas(self) -> CAs: - return CAs(self._client) + def cas(self) -> CAsResource: + return CAsResource(self._client) @cached_property - def user_policy_checks(self) -> UserPolicyChecks: - return UserPolicyChecks(self._client) + def user_policy_checks(self) -> UserPolicyChecksResource: + return UserPolicyChecksResource(self._client) @cached_property - def policies(self) -> Policies: - return Policies(self._client) + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) @cached_property - def with_raw_response(self) -> ApplicationsWithRawResponse: - return ApplicationsWithRawResponse(self) + def with_raw_response(self) -> ApplicationsResourceWithRawResponse: + return ApplicationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ApplicationsWithStreamingResponse: - return ApplicationsWithStreamingResponse(self) + def with_streaming_response(self) -> ApplicationsResourceWithStreamingResponse: + return ApplicationsResourceWithStreamingResponse(self) @overload def create( @@ -90,21 +92,22 @@ def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_create_params.SelfHostedApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -115,7 +118,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -163,6 +166,9 @@ def create( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -198,13 +204,13 @@ def create( *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - saas_app: application_create_params.SaaSApplicationSaasApp | NotGiven = NOT_GIVEN, + saas_app: application_create_params.SaaSApplicationSaaSApp | NotGiven = NOT_GIVEN, tags: List[str] | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -213,7 +219,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -260,21 +266,22 @@ def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_create_params.BrowserSSHApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -285,7 +292,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -333,6 +340,9 @@ def create( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -371,21 +381,22 @@ def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_create_params.BrowserVncApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -396,7 +407,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -444,6 +455,9 @@ def create( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -480,7 +494,7 @@ def create( type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -489,7 +503,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -527,7 +541,7 @@ def create( type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -536,7 +550,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -574,7 +588,7 @@ def create( type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -583,7 +597,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -632,7 +646,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -674,39 +688,34 @@ def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_create_params.SelfHostedApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, tags: List[str] | NotGiven = NOT_GIVEN, - saas_app: application_create_params.SaaSApplicationSaasApp | NotGiven = NOT_GIVEN, + saas_app: application_create_params.SaaSApplicationSaaSApp | 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, - ) -> ZeroTrustApps: - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") + ) -> Optional[Application]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -714,10 +723,13 @@ def create( 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 cast( - ZeroTrustApps, + Optional[Application], self._post( f"/{account_or_zone}/{account_or_zone_id}/access/apps", body=maybe_transform( @@ -737,6 +749,7 @@ def create( "http_only_cookie_attribute": http_only_cookie_attribute, "logo_url": logo_url, "name": name, + "options_preflight_bypass": options_preflight_bypass, "path_cookie_attribute": path_cookie_attribute, "same_site_cookie_attribute": same_site_cookie_attribute, "self_hosted_domains": self_hosted_domains, @@ -753,10 +766,10 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Application]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustApps] + Any, ResultWrapper[Application] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -764,28 +777,29 @@ def create( @overload def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, domain: str, type: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_update_params.SelfHostedApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -796,7 +810,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -846,6 +860,9 @@ def update( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -878,17 +895,17 @@ def update( @overload def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - saas_app: application_update_params.SaaSApplicationSaasApp | NotGiven = NOT_GIVEN, + saas_app: application_update_params.SaaSApplicationSaaSApp | NotGiven = NOT_GIVEN, tags: List[str] | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -897,7 +914,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -940,28 +957,29 @@ def update( @overload def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, domain: str, type: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_update_params.BrowserSSHApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -972,7 +990,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -1022,6 +1040,9 @@ def update( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -1054,28 +1075,29 @@ def update( @overload def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, domain: str, type: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_update_params.BrowserVncApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -1086,7 +1108,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -1136,6 +1158,9 @@ def update( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -1168,12 +1193,12 @@ def update( @overload def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1182,7 +1207,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -1218,12 +1243,12 @@ def update( @overload def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1232,7 +1257,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -1268,12 +1293,12 @@ def update( @overload def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1282,7 +1307,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -1318,7 +1343,7 @@ def update( @overload def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -1334,7 +1359,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -1370,7 +1395,7 @@ def update( def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, domain: str | NotGiven = NOT_GIVEN, type: str @@ -1379,39 +1404,34 @@ def update( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_update_params.SelfHostedApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, tags: List[str] | NotGiven = NOT_GIVEN, - saas_app: application_update_params.SaaSApplicationSaasApp | NotGiven = NOT_GIVEN, + saas_app: application_update_params.SaaSApplicationSaaSApp | 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, - ) -> ZeroTrustApps: - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") + ) -> Optional[Application]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1419,10 +1439,13 @@ def update( 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 cast( - ZeroTrustApps, + Optional[Application], self._put( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}", body=maybe_transform( @@ -1442,6 +1465,7 @@ def update( "http_only_cookie_attribute": http_only_cookie_attribute, "logo_url": logo_url, "name": name, + "options_preflight_bypass": options_preflight_bypass, "path_cookie_attribute": path_cookie_attribute, "same_site_cookie_attribute": same_site_cookie_attribute, "self_hosted_domains": self_hosted_domains, @@ -1458,10 +1482,10 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Application]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustApps] + Any, ResultWrapper[Application] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -1477,7 +1501,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustApps]: + ) -> SyncSinglePage[Application]: """ Lists all Access applications in an account or zone. @@ -1494,12 +1518,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1507,20 +1525,23 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps", - page=SyncSinglePage[ZeroTrustApps], + page=SyncSinglePage[Application], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=cast(Any, ZeroTrustApps), # Union types cannot be passed in as arguments in the type system + model=cast(Any, Application), # Union types cannot be passed in as arguments in the type system ) def delete( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -1530,7 +1551,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ApplicationDeleteResponse: + ) -> Optional[ApplicationDeleteResponse]: """ Deletes an application from Access. @@ -1549,12 +1570,6 @@ def delete( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1562,6 +1577,9 @@ def delete( 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._delete( @@ -1571,14 +1589,14 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ApplicationDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[ApplicationDeleteResponse], ResultWrapper[ApplicationDeleteResponse]), + cast_to=cast(Type[Optional[ApplicationDeleteResponse]], ResultWrapper[ApplicationDeleteResponse]), ) def get( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -1588,7 +1606,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Fetches information about an Access application. @@ -1607,12 +1625,6 @@ def get( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1620,10 +1632,13 @@ def get( 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 cast( - ZeroTrustApps, + Optional[Application], self._get( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}", options=make_request_options( @@ -1631,17 +1646,17 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Application]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustApps] + Any, ResultWrapper[Application] ), # Union types cannot be passed in as arguments in the type system ), ) def revoke_tokens( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -1670,12 +1685,6 @@ def revoke_tokens( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1683,6 +1692,9 @@ def revoke_tokens( 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( @@ -1692,32 +1704,32 @@ def revoke_tokens( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) -class AsyncApplications(AsyncAPIResource): +class AsyncApplicationsResource(AsyncAPIResource): @cached_property - def cas(self) -> AsyncCAs: - return AsyncCAs(self._client) + def cas(self) -> AsyncCAsResource: + return AsyncCAsResource(self._client) @cached_property - def user_policy_checks(self) -> AsyncUserPolicyChecks: - return AsyncUserPolicyChecks(self._client) + def user_policy_checks(self) -> AsyncUserPolicyChecksResource: + return AsyncUserPolicyChecksResource(self._client) @cached_property - def policies(self) -> AsyncPolicies: - return AsyncPolicies(self._client) + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncApplicationsWithRawResponse: - return AsyncApplicationsWithRawResponse(self) + def with_raw_response(self) -> AsyncApplicationsResourceWithRawResponse: + return AsyncApplicationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncApplicationsWithStreamingResponse: - return AsyncApplicationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncApplicationsResourceWithStreamingResponse: + return AsyncApplicationsResourceWithStreamingResponse(self) @overload async def create( @@ -1728,21 +1740,22 @@ async def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_create_params.SelfHostedApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -1753,7 +1766,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -1801,6 +1814,9 @@ async def create( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -1836,13 +1852,13 @@ async def create( *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - saas_app: application_create_params.SaaSApplicationSaasApp | NotGiven = NOT_GIVEN, + saas_app: application_create_params.SaaSApplicationSaaSApp | NotGiven = NOT_GIVEN, tags: List[str] | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1851,7 +1867,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -1898,21 +1914,22 @@ async def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_create_params.BrowserSSHApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -1923,7 +1940,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -1971,6 +1988,9 @@ async def create( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -2009,21 +2029,22 @@ async def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_create_params.BrowserVncApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -2034,7 +2055,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -2082,6 +2103,9 @@ async def create( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -2118,7 +2142,7 @@ async def create( type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -2127,7 +2151,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -2165,7 +2189,7 @@ async def create( type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -2174,7 +2198,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -2212,7 +2236,7 @@ async def create( type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -2221,7 +2245,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -2270,7 +2294,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Adds a new application to Access. @@ -2312,39 +2336,34 @@ async def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_create_params.SelfHostedApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, tags: List[str] | NotGiven = NOT_GIVEN, - saas_app: application_create_params.SaaSApplicationSaasApp | NotGiven = NOT_GIVEN, + saas_app: application_create_params.SaaSApplicationSaaSApp | 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, - ) -> ZeroTrustApps: - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") + ) -> Optional[Application]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -2352,10 +2371,13 @@ async def create( 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 cast( - ZeroTrustApps, + Optional[Application], await self._post( f"/{account_or_zone}/{account_or_zone_id}/access/apps", body=await async_maybe_transform( @@ -2375,6 +2397,7 @@ async def create( "http_only_cookie_attribute": http_only_cookie_attribute, "logo_url": logo_url, "name": name, + "options_preflight_bypass": options_preflight_bypass, "path_cookie_attribute": path_cookie_attribute, "same_site_cookie_attribute": same_site_cookie_attribute, "self_hosted_domains": self_hosted_domains, @@ -2391,10 +2414,10 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Application]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustApps] + Any, ResultWrapper[Application] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -2402,28 +2425,29 @@ async def create( @overload async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, domain: str, type: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_update_params.SelfHostedApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -2434,7 +2458,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -2484,6 +2508,9 @@ async def update( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -2516,17 +2543,17 @@ async def update( @overload async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - saas_app: application_update_params.SaaSApplicationSaasApp | NotGiven = NOT_GIVEN, + saas_app: application_update_params.SaaSApplicationSaaSApp | NotGiven = NOT_GIVEN, tags: List[str] | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -2535,7 +2562,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -2578,28 +2605,29 @@ async def update( @overload async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, domain: str, type: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_update_params.BrowserSSHApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -2610,7 +2638,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -2660,6 +2688,9 @@ async def update( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -2692,28 +2723,29 @@ async def update( @overload async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, domain: str, type: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_update_params.BrowserVncApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, @@ -2724,7 +2756,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -2774,6 +2806,9 @@ async def update( name: The name of the application. + options_preflight_bypass: Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + path_cookie_attribute: Enables cookie paths to scope an application's JWT to the application path. If disabled, the JWT will scope to the hostname by default @@ -2806,12 +2841,12 @@ async def update( @overload async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -2820,7 +2855,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -2856,12 +2891,12 @@ async def update( @overload async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -2870,7 +2905,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -2906,12 +2941,12 @@ async def update( @overload async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -2920,7 +2955,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -2956,7 +2991,7 @@ async def update( @overload async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -2972,7 +3007,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Updates an Access application. @@ -3008,7 +3043,7 @@ async def update( async def update( self, - app_id: Union[str, str], + app_id: AppIDParam, *, domain: str | NotGiven = NOT_GIVEN, type: str @@ -3017,39 +3052,34 @@ async def update( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, - allowed_idps: List[str] | NotGiven = NOT_GIVEN, + allowed_idps: List[AllowedIdpsh] | NotGiven = NOT_GIVEN, app_launcher_visible: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, - cors_headers: application_update_params.SelfHostedApplicationCorsHeaders | NotGiven = NOT_GIVEN, + cors_headers: CORSHeadersParam | NotGiven = NOT_GIVEN, custom_deny_message: str | NotGiven = NOT_GIVEN, custom_deny_url: str | NotGiven = NOT_GIVEN, custom_non_identity_deny_url: str | NotGiven = NOT_GIVEN, - custom_pages: List[str] | NotGiven = NOT_GIVEN, + custom_pages: List[CustomPagesh] | NotGiven = NOT_GIVEN, enable_binding_cookie: bool | NotGiven = NOT_GIVEN, http_only_cookie_attribute: bool | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, - self_hosted_domains: List[str] | NotGiven = NOT_GIVEN, + self_hosted_domains: List[SelfHostedDomainsh] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, skip_interstitial: bool | NotGiven = NOT_GIVEN, tags: List[str] | NotGiven = NOT_GIVEN, - saas_app: application_update_params.SaaSApplicationSaasApp | NotGiven = NOT_GIVEN, + saas_app: application_update_params.SaaSApplicationSaaSApp | 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, - ) -> ZeroTrustApps: - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") + ) -> Optional[Application]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3057,10 +3087,13 @@ async def update( 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 cast( - ZeroTrustApps, + Optional[Application], await self._put( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}", body=await async_maybe_transform( @@ -3080,6 +3113,7 @@ async def update( "http_only_cookie_attribute": http_only_cookie_attribute, "logo_url": logo_url, "name": name, + "options_preflight_bypass": options_preflight_bypass, "path_cookie_attribute": path_cookie_attribute, "same_site_cookie_attribute": same_site_cookie_attribute, "self_hosted_domains": self_hosted_domains, @@ -3096,10 +3130,10 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Application]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustApps] + Any, ResultWrapper[Application] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -3115,7 +3149,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustApps, AsyncSinglePage[ZeroTrustApps]]: + ) -> AsyncPaginator[Application, AsyncSinglePage[Application]]: """ Lists all Access applications in an account or zone. @@ -3132,12 +3166,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3145,20 +3173,23 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps", - page=AsyncSinglePage[ZeroTrustApps], + page=AsyncSinglePage[Application], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=cast(Any, ZeroTrustApps), # Union types cannot be passed in as arguments in the type system + model=cast(Any, Application), # Union types cannot be passed in as arguments in the type system ) async def delete( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -3168,7 +3199,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ApplicationDeleteResponse: + ) -> Optional[ApplicationDeleteResponse]: """ Deletes an application from Access. @@ -3187,12 +3218,6 @@ async def delete( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3200,6 +3225,9 @@ async def delete( 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._delete( @@ -3209,14 +3237,14 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ApplicationDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[ApplicationDeleteResponse], ResultWrapper[ApplicationDeleteResponse]), + cast_to=cast(Type[Optional[ApplicationDeleteResponse]], ResultWrapper[ApplicationDeleteResponse]), ) async def get( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -3226,7 +3254,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustApps: + ) -> Optional[Application]: """ Fetches information about an Access application. @@ -3245,12 +3273,6 @@ async def get( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3258,10 +3280,13 @@ async def get( 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 cast( - ZeroTrustApps, + Optional[Application], await self._get( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}", options=make_request_options( @@ -3269,17 +3294,17 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Application]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustApps] + Any, ResultWrapper[Application] ), # Union types cannot be passed in as arguments in the type system ), ) async def revoke_tokens( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -3308,12 +3333,6 @@ async def revoke_tokens( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3321,6 +3340,9 @@ async def revoke_tokens( 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( @@ -3330,14 +3352,14 @@ async def revoke_tokens( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) -class ApplicationsWithRawResponse: - def __init__(self, applications: Applications) -> None: +class ApplicationsResourceWithRawResponse: + def __init__(self, applications: ApplicationsResource) -> None: self._applications = applications self.create = to_raw_response_wrapper( @@ -3360,20 +3382,20 @@ def __init__(self, applications: Applications) -> None: ) @cached_property - def cas(self) -> CAsWithRawResponse: - return CAsWithRawResponse(self._applications.cas) + def cas(self) -> CAsResourceWithRawResponse: + return CAsResourceWithRawResponse(self._applications.cas) @cached_property - def user_policy_checks(self) -> UserPolicyChecksWithRawResponse: - return UserPolicyChecksWithRawResponse(self._applications.user_policy_checks) + def user_policy_checks(self) -> UserPolicyChecksResourceWithRawResponse: + return UserPolicyChecksResourceWithRawResponse(self._applications.user_policy_checks) @cached_property - def policies(self) -> PoliciesWithRawResponse: - return PoliciesWithRawResponse(self._applications.policies) + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._applications.policies) -class AsyncApplicationsWithRawResponse: - def __init__(self, applications: AsyncApplications) -> None: +class AsyncApplicationsResourceWithRawResponse: + def __init__(self, applications: AsyncApplicationsResource) -> None: self._applications = applications self.create = async_to_raw_response_wrapper( @@ -3396,20 +3418,20 @@ def __init__(self, applications: AsyncApplications) -> None: ) @cached_property - def cas(self) -> AsyncCAsWithRawResponse: - return AsyncCAsWithRawResponse(self._applications.cas) + def cas(self) -> AsyncCAsResourceWithRawResponse: + return AsyncCAsResourceWithRawResponse(self._applications.cas) @cached_property - def user_policy_checks(self) -> AsyncUserPolicyChecksWithRawResponse: - return AsyncUserPolicyChecksWithRawResponse(self._applications.user_policy_checks) + def user_policy_checks(self) -> AsyncUserPolicyChecksResourceWithRawResponse: + return AsyncUserPolicyChecksResourceWithRawResponse(self._applications.user_policy_checks) @cached_property - def policies(self) -> AsyncPoliciesWithRawResponse: - return AsyncPoliciesWithRawResponse(self._applications.policies) + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._applications.policies) -class ApplicationsWithStreamingResponse: - def __init__(self, applications: Applications) -> None: +class ApplicationsResourceWithStreamingResponse: + def __init__(self, applications: ApplicationsResource) -> None: self._applications = applications self.create = to_streamed_response_wrapper( @@ -3432,20 +3454,20 @@ def __init__(self, applications: Applications) -> None: ) @cached_property - def cas(self) -> CAsWithStreamingResponse: - return CAsWithStreamingResponse(self._applications.cas) + def cas(self) -> CAsResourceWithStreamingResponse: + return CAsResourceWithStreamingResponse(self._applications.cas) @cached_property - def user_policy_checks(self) -> UserPolicyChecksWithStreamingResponse: - return UserPolicyChecksWithStreamingResponse(self._applications.user_policy_checks) + def user_policy_checks(self) -> UserPolicyChecksResourceWithStreamingResponse: + return UserPolicyChecksResourceWithStreamingResponse(self._applications.user_policy_checks) @cached_property - def policies(self) -> PoliciesWithStreamingResponse: - return PoliciesWithStreamingResponse(self._applications.policies) + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._applications.policies) -class AsyncApplicationsWithStreamingResponse: - def __init__(self, applications: AsyncApplications) -> None: +class AsyncApplicationsResourceWithStreamingResponse: + def __init__(self, applications: AsyncApplicationsResource) -> None: self._applications = applications self.create = async_to_streamed_response_wrapper( @@ -3468,13 +3490,13 @@ def __init__(self, applications: AsyncApplications) -> None: ) @cached_property - def cas(self) -> AsyncCAsWithStreamingResponse: - return AsyncCAsWithStreamingResponse(self._applications.cas) + def cas(self) -> AsyncCAsResourceWithStreamingResponse: + return AsyncCAsResourceWithStreamingResponse(self._applications.cas) @cached_property - def user_policy_checks(self) -> AsyncUserPolicyChecksWithStreamingResponse: - return AsyncUserPolicyChecksWithStreamingResponse(self._applications.user_policy_checks) + def user_policy_checks(self) -> AsyncUserPolicyChecksResourceWithStreamingResponse: + return AsyncUserPolicyChecksResourceWithStreamingResponse(self._applications.user_policy_checks) @cached_property - def policies(self) -> AsyncPoliciesWithStreamingResponse: - return AsyncPoliciesWithStreamingResponse(self._applications.policies) + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._applications.policies) diff --git a/src/cloudflare/resources/zero_trust/access/applications/cas.py b/src/cloudflare/resources/zero_trust/access/applications/cas.py index 34262b5b4fd..36c6f5f0483 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/cas.py +++ b/src/cloudflare/resources/zero_trust/access/applications/cas.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Any, Type, Optional, cast import httpx @@ -21,19 +21,22 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.access.applications import ZeroTrustCA, CAGetResponse, CACreateResponse, CADeleteResponse +from .....types.zero_trust.access.applications.ca import CA +from .....types.zero_trust.access.applications.ca_get_response import CAGetResponse +from .....types.zero_trust.access.applications.ca_create_response import CACreateResponse +from .....types.zero_trust.access.applications.ca_delete_response import CADeleteResponse -__all__ = ["CAs", "AsyncCAs"] +__all__ = ["CAsResource", "AsyncCAsResource"] -class CAs(SyncAPIResource): +class CAsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CAsWithRawResponse: - return CAsWithRawResponse(self) + def with_raw_response(self) -> CAsResourceWithRawResponse: + return CAsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CAsWithStreamingResponse: - return CAsWithStreamingResponse(self) + def with_streaming_response(self) -> CAsResourceWithStreamingResponse: + return CAsResourceWithStreamingResponse(self) def create( self, @@ -47,7 +50,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CACreateResponse: + ) -> Optional[CACreateResponse]: """ Generates a new short-lived certificate CA and public key. @@ -68,12 +71,6 @@ def create( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -81,10 +78,13 @@ def create( 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 cast( - CACreateResponse, + Optional[CACreateResponse], self._post( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", options=make_request_options( @@ -92,7 +92,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CACreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CACreateResponse] @@ -111,7 +111,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustCA]: + ) -> SyncSinglePage[CA]: """ Lists short-lived certificate CAs and their public keys. @@ -128,12 +128,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -141,15 +135,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps/ca", - page=SyncSinglePage[ZeroTrustCA], + page=SyncSinglePage[CA], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustCA, + model=CA, ) def delete( @@ -164,7 +161,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CADeleteResponse: + ) -> Optional[CADeleteResponse]: """ Deletes a short-lived certificate CA. @@ -185,12 +182,6 @@ def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -198,6 +189,9 @@ def delete( 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._delete( @@ -207,9 +201,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CADeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CADeleteResponse], ResultWrapper[CADeleteResponse]), + cast_to=cast(Type[Optional[CADeleteResponse]], ResultWrapper[CADeleteResponse]), ) def get( @@ -224,7 +218,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CAGetResponse: + ) -> Optional[CAGetResponse]: """ Fetches a short-lived certificate CA and its public key. @@ -245,12 +239,6 @@ def get( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -258,10 +246,13 @@ def get( 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 cast( - CAGetResponse, + Optional[CAGetResponse], self._get( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", options=make_request_options( @@ -269,7 +260,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CAGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CAGetResponse] @@ -278,14 +269,14 @@ def get( ) -class AsyncCAs(AsyncAPIResource): +class AsyncCAsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCAsWithRawResponse: - return AsyncCAsWithRawResponse(self) + def with_raw_response(self) -> AsyncCAsResourceWithRawResponse: + return AsyncCAsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCAsWithStreamingResponse: - return AsyncCAsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCAsResourceWithStreamingResponse: + return AsyncCAsResourceWithStreamingResponse(self) async def create( self, @@ -299,7 +290,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CACreateResponse: + ) -> Optional[CACreateResponse]: """ Generates a new short-lived certificate CA and public key. @@ -320,12 +311,6 @@ async def create( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -333,10 +318,13 @@ async def create( 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 cast( - CACreateResponse, + Optional[CACreateResponse], await self._post( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", options=make_request_options( @@ -344,7 +332,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CACreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CACreateResponse] @@ -363,7 +351,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustCA, AsyncSinglePage[ZeroTrustCA]]: + ) -> AsyncPaginator[CA, AsyncSinglePage[CA]]: """ Lists short-lived certificate CAs and their public keys. @@ -380,12 +368,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -393,15 +375,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps/ca", - page=AsyncSinglePage[ZeroTrustCA], + page=AsyncSinglePage[CA], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustCA, + model=CA, ) async def delete( @@ -416,7 +401,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CADeleteResponse: + ) -> Optional[CADeleteResponse]: """ Deletes a short-lived certificate CA. @@ -437,12 +422,6 @@ async def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -450,6 +429,9 @@ async def delete( 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._delete( @@ -459,9 +441,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CADeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CADeleteResponse], ResultWrapper[CADeleteResponse]), + cast_to=cast(Type[Optional[CADeleteResponse]], ResultWrapper[CADeleteResponse]), ) async def get( @@ -476,7 +458,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CAGetResponse: + ) -> Optional[CAGetResponse]: """ Fetches a short-lived certificate CA and its public key. @@ -497,12 +479,6 @@ async def get( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -510,10 +486,13 @@ async def get( 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 cast( - CAGetResponse, + Optional[CAGetResponse], await self._get( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", options=make_request_options( @@ -521,7 +500,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CAGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CAGetResponse] @@ -530,8 +509,8 @@ async def get( ) -class CAsWithRawResponse: - def __init__(self, cas: CAs) -> None: +class CAsResourceWithRawResponse: + def __init__(self, cas: CAsResource) -> None: self._cas = cas self.create = to_raw_response_wrapper( @@ -548,8 +527,8 @@ def __init__(self, cas: CAs) -> None: ) -class AsyncCAsWithRawResponse: - def __init__(self, cas: AsyncCAs) -> None: +class AsyncCAsResourceWithRawResponse: + def __init__(self, cas: AsyncCAsResource) -> None: self._cas = cas self.create = async_to_raw_response_wrapper( @@ -566,8 +545,8 @@ def __init__(self, cas: AsyncCAs) -> None: ) -class CAsWithStreamingResponse: - def __init__(self, cas: CAs) -> None: +class CAsResourceWithStreamingResponse: + def __init__(self, cas: CAsResource) -> None: self._cas = cas self.create = to_streamed_response_wrapper( @@ -584,8 +563,8 @@ def __init__(self, cas: CAs) -> None: ) -class AsyncCAsWithStreamingResponse: - def __init__(self, cas: AsyncCAs) -> None: +class AsyncCAsResourceWithStreamingResponse: + def __init__(self, cas: AsyncCAsResource) -> None: self._cas = cas self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/applications/policies.py b/src/cloudflare/resources/zero_trust/access/applications/policies.py index cab5e55073f..14423705cf1 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/policies.py +++ b/src/cloudflare/resources/zero_trust/access/applications/policies.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast from typing_extensions import Literal import httpx @@ -26,42 +26,41 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.access.applications import ( - ZeroTrustPolicies, - PolicyDeleteResponse, - policy_create_params, - policy_update_params, -) +from .....types.zero_trust.access_rule_param import AccessRuleParam +from .....types.zero_trust.access.applications import policy_create_params, policy_update_params +from .....types.zero_trust.access.applications.policy import Policy +from .....types.zero_trust.access.applications.approval_group_param import ApprovalGroupParam +from .....types.zero_trust.access.applications.policy_delete_response import PolicyDeleteResponse -__all__ = ["Policies", "AsyncPolicies"] +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] -class Policies(SyncAPIResource): +class PoliciesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PoliciesWithRawResponse: - return PoliciesWithRawResponse(self) + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PoliciesWithStreamingResponse: - return PoliciesWithStreamingResponse(self) + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self) def create( self, uuid: str, *, decision: Literal["allow", "deny", "non_identity", "bypass"], - include: Iterable[policy_create_params.Include], + include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - approval_groups: Iterable[policy_create_params.ApprovalGroup] | NotGiven = NOT_GIVEN, + approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, approval_required: bool | NotGiven = NOT_GIVEN, - exclude: Iterable[policy_create_params.Exclude] | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, isolation_required: bool | NotGiven = NOT_GIVEN, precedence: int | NotGiven = NOT_GIVEN, purpose_justification_prompt: str | NotGiven = NOT_GIVEN, purpose_justification_required: bool | NotGiven = NOT_GIVEN, - require: Iterable[policy_create_params.Require] | NotGiven = NOT_GIVEN, + require: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, session_duration: 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. @@ -69,7 +68,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustPolicies: + ) -> Optional[Policy]: """ Create a new Access policy for an application. @@ -122,12 +121,6 @@ def create( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -135,6 +128,9 @@ def create( 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( @@ -161,9 +157,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Policy]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustPolicies], ResultWrapper[ZeroTrustPolicies]), + cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), ) def update( @@ -172,18 +168,18 @@ def update( *, uuid1: str, decision: Literal["allow", "deny", "non_identity", "bypass"], - include: Iterable[policy_update_params.Include], + include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - approval_groups: Iterable[policy_update_params.ApprovalGroup] | NotGiven = NOT_GIVEN, + approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, approval_required: bool | NotGiven = NOT_GIVEN, - exclude: Iterable[policy_update_params.Exclude] | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, isolation_required: bool | NotGiven = NOT_GIVEN, precedence: int | NotGiven = NOT_GIVEN, purpose_justification_prompt: str | NotGiven = NOT_GIVEN, purpose_justification_required: bool | NotGiven = NOT_GIVEN, - require: Iterable[policy_update_params.Require] | NotGiven = NOT_GIVEN, + require: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, session_duration: 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. @@ -191,7 +187,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustPolicies: + ) -> Optional[Policy]: """ Update a configured Access policy. @@ -248,12 +244,6 @@ def update( raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -261,6 +251,9 @@ def update( 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._put( @@ -287,9 +280,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Policy]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustPolicies], ResultWrapper[ZeroTrustPolicies]), + cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), ) def list( @@ -304,7 +297,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustPolicies]: + ) -> SyncSinglePage[Policy]: """ Lists Access policies configured for an application. @@ -325,12 +318,6 @@ def list( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -338,15 +325,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", - page=SyncSinglePage[ZeroTrustPolicies], + page=SyncSinglePage[Policy], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustPolicies, + model=Policy, ) def delete( @@ -362,7 +352,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PolicyDeleteResponse: + ) -> Optional[PolicyDeleteResponse]: """ Delete an Access policy. @@ -387,12 +377,6 @@ def delete( raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -400,6 +384,9 @@ def delete( 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._delete( @@ -409,9 +396,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[PolicyDeleteResponse], ResultWrapper[PolicyDeleteResponse]), + cast_to=cast(Type[Optional[PolicyDeleteResponse]], ResultWrapper[PolicyDeleteResponse]), ) def get( @@ -427,7 +414,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustPolicies: + ) -> Optional[Policy]: """ Fetches a single Access policy. @@ -452,12 +439,6 @@ def get( raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -465,6 +446,9 @@ def get( 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._get( @@ -474,38 +458,38 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Policy]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustPolicies], ResultWrapper[ZeroTrustPolicies]), + cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), ) -class AsyncPolicies(AsyncAPIResource): +class AsyncPoliciesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPoliciesWithRawResponse: - return AsyncPoliciesWithRawResponse(self) + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPoliciesWithStreamingResponse: - return AsyncPoliciesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self) async def create( self, uuid: str, *, decision: Literal["allow", "deny", "non_identity", "bypass"], - include: Iterable[policy_create_params.Include], + include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - approval_groups: Iterable[policy_create_params.ApprovalGroup] | NotGiven = NOT_GIVEN, + approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, approval_required: bool | NotGiven = NOT_GIVEN, - exclude: Iterable[policy_create_params.Exclude] | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, isolation_required: bool | NotGiven = NOT_GIVEN, precedence: int | NotGiven = NOT_GIVEN, purpose_justification_prompt: str | NotGiven = NOT_GIVEN, purpose_justification_required: bool | NotGiven = NOT_GIVEN, - require: Iterable[policy_create_params.Require] | NotGiven = NOT_GIVEN, + require: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, session_duration: 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. @@ -513,7 +497,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustPolicies: + ) -> Optional[Policy]: """ Create a new Access policy for an application. @@ -566,12 +550,6 @@ async def create( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -579,6 +557,9 @@ async def create( 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( @@ -605,9 +586,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Policy]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustPolicies], ResultWrapper[ZeroTrustPolicies]), + cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), ) async def update( @@ -616,18 +597,18 @@ async def update( *, uuid1: str, decision: Literal["allow", "deny", "non_identity", "bypass"], - include: Iterable[policy_update_params.Include], + include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - approval_groups: Iterable[policy_update_params.ApprovalGroup] | NotGiven = NOT_GIVEN, + approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, approval_required: bool | NotGiven = NOT_GIVEN, - exclude: Iterable[policy_update_params.Exclude] | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, isolation_required: bool | NotGiven = NOT_GIVEN, precedence: int | NotGiven = NOT_GIVEN, purpose_justification_prompt: str | NotGiven = NOT_GIVEN, purpose_justification_required: bool | NotGiven = NOT_GIVEN, - require: Iterable[policy_update_params.Require] | NotGiven = NOT_GIVEN, + require: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, session_duration: 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. @@ -635,7 +616,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustPolicies: + ) -> Optional[Policy]: """ Update a configured Access policy. @@ -692,12 +673,6 @@ async def update( raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -705,6 +680,9 @@ async def update( 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._put( @@ -731,9 +709,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Policy]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustPolicies], ResultWrapper[ZeroTrustPolicies]), + cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), ) def list( @@ -748,7 +726,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustPolicies, AsyncSinglePage[ZeroTrustPolicies]]: + ) -> AsyncPaginator[Policy, AsyncSinglePage[Policy]]: """ Lists Access policies configured for an application. @@ -769,12 +747,6 @@ def list( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -782,15 +754,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", - page=AsyncSinglePage[ZeroTrustPolicies], + page=AsyncSinglePage[Policy], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustPolicies, + model=Policy, ) async def delete( @@ -806,7 +781,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PolicyDeleteResponse: + ) -> Optional[PolicyDeleteResponse]: """ Delete an Access policy. @@ -831,12 +806,6 @@ async def delete( raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -844,6 +813,9 @@ async def delete( 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._delete( @@ -853,9 +825,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[PolicyDeleteResponse], ResultWrapper[PolicyDeleteResponse]), + cast_to=cast(Type[Optional[PolicyDeleteResponse]], ResultWrapper[PolicyDeleteResponse]), ) async def get( @@ -871,7 +843,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustPolicies: + ) -> Optional[Policy]: """ Fetches a single Access policy. @@ -896,12 +868,6 @@ async def get( raise ValueError(f"Expected a non-empty value for `uuid1` but received {uuid1!r}") if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -909,6 +875,9 @@ async def get( 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._get( @@ -918,14 +887,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Policy]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustPolicies], ResultWrapper[ZeroTrustPolicies]), + cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), ) -class PoliciesWithRawResponse: - def __init__(self, policies: Policies) -> None: +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: self._policies = policies self.create = to_raw_response_wrapper( @@ -945,8 +914,8 @@ def __init__(self, policies: Policies) -> None: ) -class AsyncPoliciesWithRawResponse: - def __init__(self, policies: AsyncPolicies) -> None: +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: self._policies = policies self.create = async_to_raw_response_wrapper( @@ -966,8 +935,8 @@ def __init__(self, policies: AsyncPolicies) -> None: ) -class PoliciesWithStreamingResponse: - def __init__(self, policies: Policies) -> None: +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: self._policies = policies self.create = to_streamed_response_wrapper( @@ -987,8 +956,8 @@ def __init__(self, policies: Policies) -> None: ) -class AsyncPoliciesWithStreamingResponse: - def __init__(self, policies: AsyncPolicies) -> None: +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: self._policies = policies self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/applications/user_policy_checks.py b/src/cloudflare/resources/zero_trust/access/applications/user_policy_checks.py index c016ba052f7..3513a7db218 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/user_policy_checks.py +++ b/src/cloudflare/resources/zero_trust/access/applications/user_policy_checks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Optional, cast import httpx @@ -19,23 +19,24 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.access.applications import UserPolicyCheckListResponse +from .....types.zero_trust.access.app_id_param import AppIDParam +from .....types.zero_trust.access.applications.user_policy_check_list_response import UserPolicyCheckListResponse -__all__ = ["UserPolicyChecks", "AsyncUserPolicyChecks"] +__all__ = ["UserPolicyChecksResource", "AsyncUserPolicyChecksResource"] -class UserPolicyChecks(SyncAPIResource): +class UserPolicyChecksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> UserPolicyChecksWithRawResponse: - return UserPolicyChecksWithRawResponse(self) + def with_raw_response(self) -> UserPolicyChecksResourceWithRawResponse: + return UserPolicyChecksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UserPolicyChecksWithStreamingResponse: - return UserPolicyChecksWithStreamingResponse(self) + def with_streaming_response(self) -> UserPolicyChecksResourceWithStreamingResponse: + return UserPolicyChecksResourceWithStreamingResponse(self) def list( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -45,7 +46,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserPolicyCheckListResponse: + ) -> Optional[UserPolicyCheckListResponse]: """ Tests if a specific user has permission to access an application. @@ -64,12 +65,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -77,6 +72,9 @@ def list( 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._get( @@ -86,24 +84,24 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[UserPolicyCheckListResponse]]._unwrapper, ), - cast_to=cast(Type[UserPolicyCheckListResponse], ResultWrapper[UserPolicyCheckListResponse]), + cast_to=cast(Type[Optional[UserPolicyCheckListResponse]], ResultWrapper[UserPolicyCheckListResponse]), ) -class AsyncUserPolicyChecks(AsyncAPIResource): +class AsyncUserPolicyChecksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncUserPolicyChecksWithRawResponse: - return AsyncUserPolicyChecksWithRawResponse(self) + def with_raw_response(self) -> AsyncUserPolicyChecksResourceWithRawResponse: + return AsyncUserPolicyChecksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUserPolicyChecksWithStreamingResponse: - return AsyncUserPolicyChecksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncUserPolicyChecksResourceWithStreamingResponse: + return AsyncUserPolicyChecksResourceWithStreamingResponse(self) async def list( self, - app_id: Union[str, str], + app_id: AppIDParam, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -113,7 +111,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserPolicyCheckListResponse: + ) -> Optional[UserPolicyCheckListResponse]: """ Tests if a specific user has permission to access an application. @@ -132,12 +130,6 @@ async def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -145,6 +137,9 @@ async def list( 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._get( @@ -154,14 +149,14 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[UserPolicyCheckListResponse]]._unwrapper, ), - cast_to=cast(Type[UserPolicyCheckListResponse], ResultWrapper[UserPolicyCheckListResponse]), + cast_to=cast(Type[Optional[UserPolicyCheckListResponse]], ResultWrapper[UserPolicyCheckListResponse]), ) -class UserPolicyChecksWithRawResponse: - def __init__(self, user_policy_checks: UserPolicyChecks) -> None: +class UserPolicyChecksResourceWithRawResponse: + def __init__(self, user_policy_checks: UserPolicyChecksResource) -> None: self._user_policy_checks = user_policy_checks self.list = to_raw_response_wrapper( @@ -169,8 +164,8 @@ def __init__(self, user_policy_checks: UserPolicyChecks) -> None: ) -class AsyncUserPolicyChecksWithRawResponse: - def __init__(self, user_policy_checks: AsyncUserPolicyChecks) -> None: +class AsyncUserPolicyChecksResourceWithRawResponse: + def __init__(self, user_policy_checks: AsyncUserPolicyChecksResource) -> None: self._user_policy_checks = user_policy_checks self.list = async_to_raw_response_wrapper( @@ -178,8 +173,8 @@ def __init__(self, user_policy_checks: AsyncUserPolicyChecks) -> None: ) -class UserPolicyChecksWithStreamingResponse: - def __init__(self, user_policy_checks: UserPolicyChecks) -> None: +class UserPolicyChecksResourceWithStreamingResponse: + def __init__(self, user_policy_checks: UserPolicyChecksResource) -> None: self._user_policy_checks = user_policy_checks self.list = to_streamed_response_wrapper( @@ -187,8 +182,8 @@ def __init__(self, user_policy_checks: UserPolicyChecks) -> None: ) -class AsyncUserPolicyChecksWithStreamingResponse: - def __init__(self, user_policy_checks: AsyncUserPolicyChecks) -> None: +class AsyncUserPolicyChecksResourceWithStreamingResponse: + def __init__(self, user_policy_checks: AsyncUserPolicyChecksResource) -> None: self._user_policy_checks = user_policy_checks self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/bookmarks.py b/src/cloudflare/resources/zero_trust/access/bookmarks.py index 283c3ef36b0..51956d890fa 100644 --- a/src/cloudflare/resources/zero_trust/access/bookmarks.py +++ b/src/cloudflare/resources/zero_trust/access/bookmarks.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing import Type, cast +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 ( @@ -21,32 +25,35 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import ZeroTrustBookmarks, BookmarkDeleteResponse +from ....types.zero_trust.access import bookmark_create_params, bookmark_delete_params, bookmark_update_params +from ....types.zero_trust.access.bookmark import Bookmark +from ....types.zero_trust.access.bookmark_delete_response import BookmarkDeleteResponse -__all__ = ["Bookmarks", "AsyncBookmarks"] +__all__ = ["BookmarksResource", "AsyncBookmarksResource"] -class Bookmarks(SyncAPIResource): +class BookmarksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BookmarksWithRawResponse: - return BookmarksWithRawResponse(self) + def with_raw_response(self) -> BookmarksResourceWithRawResponse: + return BookmarksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BookmarksWithStreamingResponse: - return BookmarksWithStreamingResponse(self) + def with_streaming_response(self) -> BookmarksResourceWithStreamingResponse: + return BookmarksResourceWithStreamingResponse(self) def create( self, uuid: str, *, identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> ZeroTrustBookmarks: + ) -> Optional[Bookmark]: """ Create a new Bookmark application. @@ -67,14 +74,15 @@ def create( raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") return self._post( f"/accounts/{identifier}/access/bookmarks/{uuid}", + body=maybe_transform(body, bookmark_create_params.BookmarkCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustBookmarks], ResultWrapper[ZeroTrustBookmarks]), + cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), ) def update( @@ -82,13 +90,14 @@ def update( uuid: str, *, identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> ZeroTrustBookmarks: + ) -> Optional[Bookmark]: """ Updates a configured Bookmark application. @@ -109,14 +118,15 @@ def update( raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") return self._put( f"/accounts/{identifier}/access/bookmarks/{uuid}", + body=maybe_transform(body, bookmark_update_params.BookmarkUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustBookmarks], ResultWrapper[ZeroTrustBookmarks]), + cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), ) def list( @@ -129,7 +139,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustBookmarks]: + ) -> SyncSinglePage[Bookmark]: """ Lists Bookmark applications. @@ -146,11 +156,11 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._get_api_list( f"/accounts/{identifier}/access/bookmarks", - page=SyncSinglePage[ZeroTrustBookmarks], + page=SyncSinglePage[Bookmark], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustBookmarks, + model=Bookmark, ) def delete( @@ -158,13 +168,14 @@ def delete( uuid: str, *, identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> BookmarkDeleteResponse: + ) -> Optional[BookmarkDeleteResponse]: """ Deletes a Bookmark application. @@ -185,14 +196,15 @@ def delete( raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") return self._delete( f"/accounts/{identifier}/access/bookmarks/{uuid}", + body=maybe_transform(body, bookmark_delete_params.BookmarkDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BookmarkDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[BookmarkDeleteResponse], ResultWrapper[BookmarkDeleteResponse]), + cast_to=cast(Type[Optional[BookmarkDeleteResponse]], ResultWrapper[BookmarkDeleteResponse]), ) def get( @@ -206,7 +218,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustBookmarks: + ) -> Optional[Bookmark]: """ Fetches a single Bookmark application. @@ -232,33 +244,34 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustBookmarks], ResultWrapper[ZeroTrustBookmarks]), + cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), ) -class AsyncBookmarks(AsyncAPIResource): +class AsyncBookmarksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBookmarksWithRawResponse: - return AsyncBookmarksWithRawResponse(self) + def with_raw_response(self) -> AsyncBookmarksResourceWithRawResponse: + return AsyncBookmarksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBookmarksWithStreamingResponse: - return AsyncBookmarksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBookmarksResourceWithStreamingResponse: + return AsyncBookmarksResourceWithStreamingResponse(self) async def create( self, uuid: str, *, identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> ZeroTrustBookmarks: + ) -> Optional[Bookmark]: """ Create a new Bookmark application. @@ -279,14 +292,15 @@ async def create( raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") return await self._post( f"/accounts/{identifier}/access/bookmarks/{uuid}", + body=await async_maybe_transform(body, bookmark_create_params.BookmarkCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustBookmarks], ResultWrapper[ZeroTrustBookmarks]), + cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), ) async def update( @@ -294,13 +308,14 @@ async def update( uuid: str, *, identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> ZeroTrustBookmarks: + ) -> Optional[Bookmark]: """ Updates a configured Bookmark application. @@ -321,14 +336,15 @@ async def update( raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") return await self._put( f"/accounts/{identifier}/access/bookmarks/{uuid}", + body=await async_maybe_transform(body, bookmark_update_params.BookmarkUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustBookmarks], ResultWrapper[ZeroTrustBookmarks]), + cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), ) def list( @@ -341,7 +357,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustBookmarks, AsyncSinglePage[ZeroTrustBookmarks]]: + ) -> AsyncPaginator[Bookmark, AsyncSinglePage[Bookmark]]: """ Lists Bookmark applications. @@ -358,11 +374,11 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._get_api_list( f"/accounts/{identifier}/access/bookmarks", - page=AsyncSinglePage[ZeroTrustBookmarks], + page=AsyncSinglePage[Bookmark], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustBookmarks, + model=Bookmark, ) async def delete( @@ -370,13 +386,14 @@ async def delete( uuid: str, *, identifier: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> BookmarkDeleteResponse: + ) -> Optional[BookmarkDeleteResponse]: """ Deletes a Bookmark application. @@ -397,14 +414,15 @@ async def delete( raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") return await self._delete( f"/accounts/{identifier}/access/bookmarks/{uuid}", + body=await async_maybe_transform(body, bookmark_delete_params.BookmarkDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BookmarkDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[BookmarkDeleteResponse], ResultWrapper[BookmarkDeleteResponse]), + cast_to=cast(Type[Optional[BookmarkDeleteResponse]], ResultWrapper[BookmarkDeleteResponse]), ) async def get( @@ -418,7 +436,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustBookmarks: + ) -> Optional[Bookmark]: """ Fetches a single Bookmark application. @@ -444,14 +462,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Bookmark]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustBookmarks], ResultWrapper[ZeroTrustBookmarks]), + cast_to=cast(Type[Optional[Bookmark]], ResultWrapper[Bookmark]), ) -class BookmarksWithRawResponse: - def __init__(self, bookmarks: Bookmarks) -> None: +class BookmarksResourceWithRawResponse: + def __init__(self, bookmarks: BookmarksResource) -> None: self._bookmarks = bookmarks self.create = to_raw_response_wrapper( @@ -471,8 +489,8 @@ def __init__(self, bookmarks: Bookmarks) -> None: ) -class AsyncBookmarksWithRawResponse: - def __init__(self, bookmarks: AsyncBookmarks) -> None: +class AsyncBookmarksResourceWithRawResponse: + def __init__(self, bookmarks: AsyncBookmarksResource) -> None: self._bookmarks = bookmarks self.create = async_to_raw_response_wrapper( @@ -492,8 +510,8 @@ def __init__(self, bookmarks: AsyncBookmarks) -> None: ) -class BookmarksWithStreamingResponse: - def __init__(self, bookmarks: Bookmarks) -> None: +class BookmarksResourceWithStreamingResponse: + def __init__(self, bookmarks: BookmarksResource) -> None: self._bookmarks = bookmarks self.create = to_streamed_response_wrapper( @@ -513,8 +531,8 @@ def __init__(self, bookmarks: Bookmarks) -> None: ) -class AsyncBookmarksWithStreamingResponse: - def __init__(self, bookmarks: AsyncBookmarks) -> None: +class AsyncBookmarksResourceWithStreamingResponse: + def __init__(self, bookmarks: AsyncBookmarksResource) -> None: self._bookmarks = bookmarks self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/certificates/__init__.py b/src/cloudflare/resources/zero_trust/access/certificates/__init__.py index c72ae5ac0e3..41b51f15d9e 100644 --- a/src/cloudflare/resources/zero_trust/access/certificates/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/certificates/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .certificates import ( - Certificates, - AsyncCertificates, - CertificatesWithRawResponse, - AsyncCertificatesWithRawResponse, - CertificatesWithStreamingResponse, - AsyncCertificatesWithStreamingResponse, + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, ) __all__ = [ - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Certificates", - "AsyncCertificates", - "CertificatesWithRawResponse", - "AsyncCertificatesWithRawResponse", - "CertificatesWithStreamingResponse", - "AsyncCertificatesWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "CertificatesResource", + "AsyncCertificatesResource", + "CertificatesResourceWithRawResponse", + "AsyncCertificatesResourceWithRawResponse", + "CertificatesResourceWithStreamingResponse", + "AsyncCertificatesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py index 72886a437a4..e0e729cb755 100644 --- a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py +++ b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py @@ -2,17 +2,17 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Optional, cast import httpx from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -33,28 +33,26 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.access import ( - ZeroTrustCertificates, - CertificateDeleteResponse, - certificate_create_params, - certificate_update_params, -) +from .....types.zero_trust.access import certificate_create_params, certificate_update_params +from .....types.zero_trust.access.certificate import Certificate +from .....types.zero_trust.access.associated_hostnames import AssociatedHostnames +from .....types.zero_trust.access.certificate_delete_response import CertificateDeleteResponse -__all__ = ["Certificates", "AsyncCertificates"] +__all__ = ["CertificatesResource", "AsyncCertificatesResource"] -class Certificates(SyncAPIResource): +class CertificatesResource(SyncAPIResource): @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def with_raw_response(self) -> CertificatesWithRawResponse: - return CertificatesWithRawResponse(self) + def with_raw_response(self) -> CertificatesResourceWithRawResponse: + return CertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CertificatesWithStreamingResponse: - return CertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> CertificatesResourceWithStreamingResponse: + return CertificatesResourceWithStreamingResponse(self) def create( self, @@ -63,14 +61,14 @@ def create( name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - associated_hostnames: List[str] | NotGiven = NOT_GIVEN, + associated_hostnames: List[AssociatedHostnames] | 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, - ) -> ZeroTrustCertificates: + ) -> Optional[Certificate]: """ Adds a new mTLS root certificate to Access. @@ -93,12 +91,6 @@ def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -106,6 +98,9 @@ def create( 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( @@ -123,16 +118,16 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCertificates], ResultWrapper[ZeroTrustCertificates]), + cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), ) def update( self, uuid: str, *, - associated_hostnames: List[str], + associated_hostnames: List[AssociatedHostnames], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, @@ -142,7 +137,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCertificates: + ) -> Optional[Certificate]: """ Updates a configured mTLS certificate. @@ -167,12 +162,6 @@ def update( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -180,6 +169,9 @@ def update( 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._put( @@ -196,9 +188,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCertificates], ResultWrapper[ZeroTrustCertificates]), + cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), ) def list( @@ -212,7 +204,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustCertificates]: + ) -> SyncSinglePage[Certificate]: """ Lists all mTLS root certificates. @@ -229,12 +221,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -242,15 +228,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/certificates", - page=SyncSinglePage[ZeroTrustCertificates], + page=SyncSinglePage[Certificate], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustCertificates, + model=Certificate, ) def delete( @@ -265,7 +254,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateDeleteResponse: + ) -> Optional[CertificateDeleteResponse]: """ Deletes an mTLS certificate. @@ -286,12 +275,6 @@ def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -299,6 +282,9 @@ def delete( 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._delete( @@ -308,9 +294,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CertificateDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CertificateDeleteResponse], ResultWrapper[CertificateDeleteResponse]), + cast_to=cast(Type[Optional[CertificateDeleteResponse]], ResultWrapper[CertificateDeleteResponse]), ) def get( @@ -325,7 +311,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCertificates: + ) -> Optional[Certificate]: """ Fetches a single mTLS certificate. @@ -346,12 +332,6 @@ def get( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -359,6 +339,9 @@ def get( 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._get( @@ -368,24 +351,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCertificates], ResultWrapper[ZeroTrustCertificates]), + cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), ) -class AsyncCertificates(AsyncAPIResource): +class AsyncCertificatesResource(AsyncAPIResource): @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCertificatesWithRawResponse: - return AsyncCertificatesWithRawResponse(self) + def with_raw_response(self) -> AsyncCertificatesResourceWithRawResponse: + return AsyncCertificatesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCertificatesWithStreamingResponse: - return AsyncCertificatesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCertificatesResourceWithStreamingResponse: + return AsyncCertificatesResourceWithStreamingResponse(self) async def create( self, @@ -394,14 +377,14 @@ async def create( name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - associated_hostnames: List[str] | NotGiven = NOT_GIVEN, + associated_hostnames: List[AssociatedHostnames] | 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, - ) -> ZeroTrustCertificates: + ) -> Optional[Certificate]: """ Adds a new mTLS root certificate to Access. @@ -424,12 +407,6 @@ async def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -437,6 +414,9 @@ async def create( 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( @@ -454,16 +434,16 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCertificates], ResultWrapper[ZeroTrustCertificates]), + cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), ) async def update( self, uuid: str, *, - associated_hostnames: List[str], + associated_hostnames: List[AssociatedHostnames], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, @@ -473,7 +453,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCertificates: + ) -> Optional[Certificate]: """ Updates a configured mTLS certificate. @@ -498,12 +478,6 @@ async def update( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -511,6 +485,9 @@ async def update( 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._put( @@ -527,9 +504,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCertificates], ResultWrapper[ZeroTrustCertificates]), + cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), ) def list( @@ -543,7 +520,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustCertificates, AsyncSinglePage[ZeroTrustCertificates]]: + ) -> AsyncPaginator[Certificate, AsyncSinglePage[Certificate]]: """ Lists all mTLS root certificates. @@ -560,12 +537,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -573,15 +544,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/certificates", - page=AsyncSinglePage[ZeroTrustCertificates], + page=AsyncSinglePage[Certificate], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustCertificates, + model=Certificate, ) async def delete( @@ -596,7 +570,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateDeleteResponse: + ) -> Optional[CertificateDeleteResponse]: """ Deletes an mTLS certificate. @@ -617,12 +591,6 @@ async def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -630,6 +598,9 @@ async def delete( 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._delete( @@ -639,9 +610,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CertificateDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CertificateDeleteResponse], ResultWrapper[CertificateDeleteResponse]), + cast_to=cast(Type[Optional[CertificateDeleteResponse]], ResultWrapper[CertificateDeleteResponse]), ) async def get( @@ -656,7 +627,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCertificates: + ) -> Optional[Certificate]: """ Fetches a single mTLS certificate. @@ -677,12 +648,6 @@ async def get( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -690,6 +655,9 @@ async def get( 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._get( @@ -699,14 +667,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Certificate]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCertificates], ResultWrapper[ZeroTrustCertificates]), + cast_to=cast(Type[Optional[Certificate]], ResultWrapper[Certificate]), ) -class CertificatesWithRawResponse: - def __init__(self, certificates: Certificates) -> None: +class CertificatesResourceWithRawResponse: + def __init__(self, certificates: CertificatesResource) -> None: self._certificates = certificates self.create = to_raw_response_wrapper( @@ -726,12 +694,12 @@ def __init__(self, certificates: Certificates) -> None: ) @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._certificates.settings) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._certificates.settings) -class AsyncCertificatesWithRawResponse: - def __init__(self, certificates: AsyncCertificates) -> None: +class AsyncCertificatesResourceWithRawResponse: + def __init__(self, certificates: AsyncCertificatesResource) -> None: self._certificates = certificates self.create = async_to_raw_response_wrapper( @@ -751,12 +719,12 @@ def __init__(self, certificates: AsyncCertificates) -> None: ) @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._certificates.settings) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._certificates.settings) -class CertificatesWithStreamingResponse: - def __init__(self, certificates: Certificates) -> None: +class CertificatesResourceWithStreamingResponse: + def __init__(self, certificates: CertificatesResource) -> None: self._certificates = certificates self.create = to_streamed_response_wrapper( @@ -776,12 +744,12 @@ def __init__(self, certificates: Certificates) -> None: ) @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._certificates.settings) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._certificates.settings) -class AsyncCertificatesWithStreamingResponse: - def __init__(self, certificates: AsyncCertificates) -> None: +class AsyncCertificatesResourceWithStreamingResponse: + def __init__(self, certificates: AsyncCertificatesResource) -> None: self._certificates = certificates self.create = async_to_streamed_response_wrapper( @@ -801,5 +769,5 @@ def __init__(self, certificates: AsyncCertificates) -> None: ) @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._certificates.settings) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._certificates.settings) diff --git a/src/cloudflare/resources/zero_trust/access/certificates/settings.py b/src/cloudflare/resources/zero_trust/access/certificates/settings.py index a526bed3ef1..b4001aa3cd2 100644 --- a/src/cloudflare/resources/zero_trust/access/certificates/settings.py +++ b/src/cloudflare/resources/zero_trust/access/certificates/settings.py @@ -23,29 +23,27 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.access.certificates import ( - SettingGetResponse, - SettingUpdateResponse, - ZeroTrustSettingsParam, - setting_update_params, -) +from .....types.zero_trust.access.certificates import setting_update_params +from .....types.zero_trust.access.certificates.setting_get_response import SettingGetResponse +from .....types.zero_trust.access.certificates.setting_update_response import SettingUpdateResponse +from .....types.zero_trust.access.certificates.certificate_settings_param import CertificateSettingsParam -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def update( self, *, - settings: Iterable[ZeroTrustSettingsParam], + settings: Iterable[CertificateSettingsParam], 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. @@ -71,12 +69,6 @@ def update( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -84,6 +76,9 @@ def update( 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._put( @@ -94,7 +89,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SettingUpdateResponse]], ResultWrapper[SettingUpdateResponse]), ) @@ -127,12 +122,6 @@ def get( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -140,6 +129,9 @@ def get( 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._get( @@ -149,25 +141,25 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), ) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def update( self, *, - settings: Iterable[ZeroTrustSettingsParam], + settings: Iterable[CertificateSettingsParam], 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. @@ -193,12 +185,6 @@ async def update( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -206,6 +192,9 @@ async def update( 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._put( @@ -216,7 +205,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SettingUpdateResponse]], ResultWrapper[SettingUpdateResponse]), ) @@ -249,12 +238,6 @@ async def get( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -262,6 +245,9 @@ async def get( 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._get( @@ -271,14 +257,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), ) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.update = to_raw_response_wrapper( @@ -289,8 +275,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.update = async_to_raw_response_wrapper( @@ -301,8 +287,8 @@ def __init__(self, settings: AsyncSettings) -> None: ) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.update = to_streamed_response_wrapper( @@ -313,8 +299,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/custom_pages.py b/src/cloudflare/resources/zero_trust/access/custom_pages.py index 1e65a80ae45..1314c7e01b9 100644 --- a/src/cloudflare/resources/zero_trust/access/custom_pages.py +++ b/src/cloudflare/resources/zero_trust/access/custom_pages.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 @@ -26,25 +26,22 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import ( - ZeroTrustCustomPage, - CustomPageDeleteResponse, - ZeroTrustCustomPageWithoutHTML, - custom_page_create_params, - custom_page_update_params, -) +from ....types.zero_trust.access import custom_page_create_params, custom_page_update_params +from ....types.zero_trust.access.custom_page import CustomPage +from ....types.zero_trust.access.custom_page_without_html import CustomPageWithoutHTML +from ....types.zero_trust.access.custom_page_delete_response import CustomPageDeleteResponse -__all__ = ["CustomPages", "AsyncCustomPages"] +__all__ = ["CustomPagesResource", "AsyncCustomPagesResource"] -class CustomPages(SyncAPIResource): +class CustomPagesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CustomPagesWithRawResponse: - return CustomPagesWithRawResponse(self) + def with_raw_response(self) -> CustomPagesResourceWithRawResponse: + return CustomPagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CustomPagesWithStreamingResponse: - return CustomPagesWithStreamingResponse(self) + def with_streaming_response(self) -> CustomPagesResourceWithStreamingResponse: + return CustomPagesResourceWithStreamingResponse(self) def create( self, @@ -60,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCustomPageWithoutHTML: + ) -> Optional[CustomPageWithoutHTML]: """ Create a custom page @@ -101,9 +98,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomPageWithoutHTML]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCustomPageWithoutHTML], ResultWrapper[ZeroTrustCustomPageWithoutHTML]), + cast_to=cast(Type[Optional[CustomPageWithoutHTML]], ResultWrapper[CustomPageWithoutHTML]), ) def update( @@ -121,7 +118,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCustomPageWithoutHTML: + ) -> Optional[CustomPageWithoutHTML]: """ Update a custom page @@ -166,9 +163,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomPageWithoutHTML]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCustomPageWithoutHTML], ResultWrapper[ZeroTrustCustomPageWithoutHTML]), + cast_to=cast(Type[Optional[CustomPageWithoutHTML]], ResultWrapper[CustomPageWithoutHTML]), ) def list( @@ -181,7 +178,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustCustomPageWithoutHTML]: + ) -> SyncSinglePage[CustomPageWithoutHTML]: """ List custom pages @@ -200,11 +197,11 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._get_api_list( f"/accounts/{identifier}/access/custom_pages", - page=SyncSinglePage[ZeroTrustCustomPageWithoutHTML], + page=SyncSinglePage[CustomPageWithoutHTML], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustCustomPageWithoutHTML, + model=CustomPageWithoutHTML, ) def delete( @@ -218,7 +215,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomPageDeleteResponse: + ) -> Optional[CustomPageDeleteResponse]: """ Delete a custom page @@ -246,9 +243,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomPageDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CustomPageDeleteResponse], ResultWrapper[CustomPageDeleteResponse]), + cast_to=cast(Type[Optional[CustomPageDeleteResponse]], ResultWrapper[CustomPageDeleteResponse]), ) def get( @@ -262,7 +259,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCustomPage: + ) -> Optional[CustomPage]: """ Fetches a custom page and also returns its HTML. @@ -290,20 +287,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomPage]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCustomPage], ResultWrapper[ZeroTrustCustomPage]), + cast_to=cast(Type[Optional[CustomPage]], ResultWrapper[CustomPage]), ) -class AsyncCustomPages(AsyncAPIResource): +class AsyncCustomPagesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCustomPagesWithRawResponse: - return AsyncCustomPagesWithRawResponse(self) + def with_raw_response(self) -> AsyncCustomPagesResourceWithRawResponse: + return AsyncCustomPagesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCustomPagesWithStreamingResponse: - return AsyncCustomPagesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCustomPagesResourceWithStreamingResponse: + return AsyncCustomPagesResourceWithStreamingResponse(self) async def create( self, @@ -319,7 +316,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCustomPageWithoutHTML: + ) -> Optional[CustomPageWithoutHTML]: """ Create a custom page @@ -360,9 +357,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomPageWithoutHTML]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCustomPageWithoutHTML], ResultWrapper[ZeroTrustCustomPageWithoutHTML]), + cast_to=cast(Type[Optional[CustomPageWithoutHTML]], ResultWrapper[CustomPageWithoutHTML]), ) async def update( @@ -380,7 +377,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCustomPageWithoutHTML: + ) -> Optional[CustomPageWithoutHTML]: """ Update a custom page @@ -425,9 +422,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomPageWithoutHTML]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCustomPageWithoutHTML], ResultWrapper[ZeroTrustCustomPageWithoutHTML]), + cast_to=cast(Type[Optional[CustomPageWithoutHTML]], ResultWrapper[CustomPageWithoutHTML]), ) def list( @@ -440,7 +437,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustCustomPageWithoutHTML, AsyncSinglePage[ZeroTrustCustomPageWithoutHTML]]: + ) -> AsyncPaginator[CustomPageWithoutHTML, AsyncSinglePage[CustomPageWithoutHTML]]: """ List custom pages @@ -459,11 +456,11 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._get_api_list( f"/accounts/{identifier}/access/custom_pages", - page=AsyncSinglePage[ZeroTrustCustomPageWithoutHTML], + page=AsyncSinglePage[CustomPageWithoutHTML], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustCustomPageWithoutHTML, + model=CustomPageWithoutHTML, ) async def delete( @@ -477,7 +474,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomPageDeleteResponse: + ) -> Optional[CustomPageDeleteResponse]: """ Delete a custom page @@ -505,9 +502,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomPageDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CustomPageDeleteResponse], ResultWrapper[CustomPageDeleteResponse]), + cast_to=cast(Type[Optional[CustomPageDeleteResponse]], ResultWrapper[CustomPageDeleteResponse]), ) async def get( @@ -521,7 +518,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustCustomPage: + ) -> Optional[CustomPage]: """ Fetches a custom page and also returns its HTML. @@ -549,14 +546,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomPage]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustCustomPage], ResultWrapper[ZeroTrustCustomPage]), + cast_to=cast(Type[Optional[CustomPage]], ResultWrapper[CustomPage]), ) -class CustomPagesWithRawResponse: - def __init__(self, custom_pages: CustomPages) -> None: +class CustomPagesResourceWithRawResponse: + def __init__(self, custom_pages: CustomPagesResource) -> None: self._custom_pages = custom_pages self.create = to_raw_response_wrapper( @@ -576,8 +573,8 @@ def __init__(self, custom_pages: CustomPages) -> None: ) -class AsyncCustomPagesWithRawResponse: - def __init__(self, custom_pages: AsyncCustomPages) -> None: +class AsyncCustomPagesResourceWithRawResponse: + def __init__(self, custom_pages: AsyncCustomPagesResource) -> None: self._custom_pages = custom_pages self.create = async_to_raw_response_wrapper( @@ -597,8 +594,8 @@ def __init__(self, custom_pages: AsyncCustomPages) -> None: ) -class CustomPagesWithStreamingResponse: - def __init__(self, custom_pages: CustomPages) -> None: +class CustomPagesResourceWithStreamingResponse: + def __init__(self, custom_pages: CustomPagesResource) -> None: self._custom_pages = custom_pages self.create = to_streamed_response_wrapper( @@ -618,8 +615,8 @@ def __init__(self, custom_pages: CustomPages) -> None: ) -class AsyncCustomPagesWithStreamingResponse: - def __init__(self, custom_pages: AsyncCustomPages) -> None: +class AsyncCustomPagesResourceWithStreamingResponse: + def __init__(self, custom_pages: AsyncCustomPagesResource) -> None: self._custom_pages = custom_pages self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/groups.py b/src/cloudflare/resources/zero_trust/access/groups.py index 5920fb6f57b..62bde18942b 100644 --- a/src/cloudflare/resources/zero_trust/access/groups.py +++ b/src/cloudflare/resources/zero_trust/access/groups.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast import httpx @@ -25,37 +25,40 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import ZeroTrustGroups, GroupDeleteResponse, group_create_params, group_update_params +from ....types.zero_trust.access import group_create_params, group_update_params +from ....types.zero_trust.access_rule_param import AccessRuleParam +from ....types.zero_trust.access.zero_trust_group import ZeroTrustGroup +from ....types.zero_trust.access.group_delete_response import GroupDeleteResponse -__all__ = ["Groups", "AsyncGroups"] +__all__ = ["GroupsResource", "AsyncGroupsResource"] -class Groups(SyncAPIResource): +class GroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> GroupsWithRawResponse: - return GroupsWithRawResponse(self) + def with_raw_response(self) -> GroupsResourceWithRawResponse: + return GroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> GroupsWithStreamingResponse: - return GroupsWithStreamingResponse(self) + def with_streaming_response(self) -> GroupsResourceWithStreamingResponse: + return GroupsResourceWithStreamingResponse(self) def create( self, *, - include: Iterable[group_create_params.Include], + include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - exclude: Iterable[group_create_params.Exclude] | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, is_default: bool | NotGiven = NOT_GIVEN, - require: Iterable[group_create_params.Require] | NotGiven = NOT_GIVEN, + require: Iterable[AccessRuleParam] | 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, - ) -> ZeroTrustGroups: + ) -> Optional[ZeroTrustGroup]: """ Creates a new Access group. @@ -85,12 +88,6 @@ def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -98,6 +95,9 @@ def create( 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( @@ -117,29 +117,29 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGroups], ResultWrapper[ZeroTrustGroups]), + cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), ) def update( self, uuid: str, *, - include: Iterable[group_update_params.Include], + include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - exclude: Iterable[group_update_params.Exclude] | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, is_default: bool | NotGiven = NOT_GIVEN, - require: Iterable[group_update_params.Require] | NotGiven = NOT_GIVEN, + require: Iterable[AccessRuleParam] | 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, - ) -> ZeroTrustGroups: + ) -> Optional[ZeroTrustGroup]: """ Updates a configured Access group. @@ -173,12 +173,6 @@ def update( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -186,6 +180,9 @@ def update( 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._put( @@ -205,9 +202,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGroups], ResultWrapper[ZeroTrustGroups]), + cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), ) def list( @@ -221,7 +218,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustGroups]: + ) -> SyncSinglePage[ZeroTrustGroup]: """ Lists all Access groups. @@ -238,12 +235,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -251,15 +242,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/groups", - page=SyncSinglePage[ZeroTrustGroups], + page=SyncSinglePage[ZeroTrustGroup], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGroups, + model=ZeroTrustGroup, ) def delete( @@ -274,7 +268,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GroupDeleteResponse: + ) -> Optional[GroupDeleteResponse]: """ Deletes an Access group. @@ -295,12 +289,6 @@ def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -308,6 +296,9 @@ def delete( 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._delete( @@ -317,9 +308,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GroupDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[GroupDeleteResponse], ResultWrapper[GroupDeleteResponse]), + cast_to=cast(Type[Optional[GroupDeleteResponse]], ResultWrapper[GroupDeleteResponse]), ) def get( @@ -334,7 +325,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGroups: + ) -> Optional[ZeroTrustGroup]: """ Fetches a single Access group. @@ -355,12 +346,6 @@ def get( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -368,6 +353,9 @@ def get( 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._get( @@ -377,38 +365,38 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGroups], ResultWrapper[ZeroTrustGroups]), + cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), ) -class AsyncGroups(AsyncAPIResource): +class AsyncGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncGroupsWithRawResponse: - return AsyncGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncGroupsResourceWithRawResponse: + return AsyncGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncGroupsWithStreamingResponse: - return AsyncGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncGroupsResourceWithStreamingResponse: + return AsyncGroupsResourceWithStreamingResponse(self) async def create( self, *, - include: Iterable[group_create_params.Include], + include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - exclude: Iterable[group_create_params.Exclude] | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, is_default: bool | NotGiven = NOT_GIVEN, - require: Iterable[group_create_params.Require] | NotGiven = NOT_GIVEN, + require: Iterable[AccessRuleParam] | 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, - ) -> ZeroTrustGroups: + ) -> Optional[ZeroTrustGroup]: """ Creates a new Access group. @@ -438,12 +426,6 @@ async def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -451,6 +433,9 @@ async def create( 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( @@ -470,29 +455,29 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGroups], ResultWrapper[ZeroTrustGroups]), + cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), ) async def update( self, uuid: str, *, - include: Iterable[group_update_params.Include], + include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - exclude: Iterable[group_update_params.Exclude] | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, is_default: bool | NotGiven = NOT_GIVEN, - require: Iterable[group_update_params.Require] | NotGiven = NOT_GIVEN, + require: Iterable[AccessRuleParam] | 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, - ) -> ZeroTrustGroups: + ) -> Optional[ZeroTrustGroup]: """ Updates a configured Access group. @@ -526,12 +511,6 @@ async def update( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -539,6 +518,9 @@ async def update( 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._put( @@ -558,9 +540,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGroups], ResultWrapper[ZeroTrustGroups]), + cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), ) def list( @@ -574,7 +556,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustGroups, AsyncSinglePage[ZeroTrustGroups]]: + ) -> AsyncPaginator[ZeroTrustGroup, AsyncSinglePage[ZeroTrustGroup]]: """ Lists all Access groups. @@ -591,12 +573,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -604,15 +580,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/groups", - page=AsyncSinglePage[ZeroTrustGroups], + page=AsyncSinglePage[ZeroTrustGroup], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGroups, + model=ZeroTrustGroup, ) async def delete( @@ -627,7 +606,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GroupDeleteResponse: + ) -> Optional[GroupDeleteResponse]: """ Deletes an Access group. @@ -648,12 +627,6 @@ async def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -661,6 +634,9 @@ async def delete( 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._delete( @@ -670,9 +646,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GroupDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[GroupDeleteResponse], ResultWrapper[GroupDeleteResponse]), + cast_to=cast(Type[Optional[GroupDeleteResponse]], ResultWrapper[GroupDeleteResponse]), ) async def get( @@ -687,7 +663,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGroups: + ) -> Optional[ZeroTrustGroup]: """ Fetches a single Access group. @@ -708,12 +684,6 @@ async def get( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -721,6 +691,9 @@ async def get( 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._get( @@ -730,14 +703,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroTrustGroup]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGroups], ResultWrapper[ZeroTrustGroups]), + cast_to=cast(Type[Optional[ZeroTrustGroup]], ResultWrapper[ZeroTrustGroup]), ) -class GroupsWithRawResponse: - def __init__(self, groups: Groups) -> None: +class GroupsResourceWithRawResponse: + def __init__(self, groups: GroupsResource) -> None: self._groups = groups self.create = to_raw_response_wrapper( @@ -757,8 +730,8 @@ def __init__(self, groups: Groups) -> None: ) -class AsyncGroupsWithRawResponse: - def __init__(self, groups: AsyncGroups) -> None: +class AsyncGroupsResourceWithRawResponse: + def __init__(self, groups: AsyncGroupsResource) -> None: self._groups = groups self.create = async_to_raw_response_wrapper( @@ -778,8 +751,8 @@ def __init__(self, groups: AsyncGroups) -> None: ) -class GroupsWithStreamingResponse: - def __init__(self, groups: Groups) -> None: +class GroupsResourceWithStreamingResponse: + def __init__(self, groups: GroupsResource) -> None: self._groups = groups self.create = to_streamed_response_wrapper( @@ -799,8 +772,8 @@ def __init__(self, groups: Groups) -> None: ) -class AsyncGroupsWithStreamingResponse: - def __init__(self, groups: AsyncGroups) -> None: +class AsyncGroupsResourceWithStreamingResponse: + def __init__(self, groups: AsyncGroupsResource) -> None: self._groups = groups self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/keys.py b/src/cloudflare/resources/zero_trust/access/keys.py index ae4837b10ac..dcb6a69a3d2 100644 --- a/src/cloudflare/resources/zero_trust/access/keys.py +++ b/src/cloudflare/resources/zero_trust/access/keys.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -23,19 +23,22 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.access import KeyGetResponse, KeyRotateResponse, KeyUpdateResponse, key_update_params +from ....types.zero_trust.access import key_update_params +from ....types.zero_trust.access.key_get_response import KeyGetResponse +from ....types.zero_trust.access.key_rotate_response import KeyRotateResponse +from ....types.zero_trust.access.key_update_response import KeyUpdateResponse -__all__ = ["Keys", "AsyncKeys"] +__all__ = ["KeysResource", "AsyncKeysResource"] -class Keys(SyncAPIResource): +class KeysResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> KeysWithRawResponse: - return KeysWithRawResponse(self) + def with_raw_response(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> KeysWithStreamingResponse: - return KeysWithStreamingResponse(self) + def with_streaming_response(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self) def update( self, @@ -48,7 +51,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyUpdateResponse: + ) -> Optional[KeyUpdateResponse]: """ Updates the Access key rotation settings for an account. @@ -68,7 +71,7 @@ def update( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyUpdateResponse, + Optional[KeyUpdateResponse], self._put( f"/accounts/{identifier}/access/keys", body=maybe_transform( @@ -79,7 +82,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[KeyUpdateResponse] @@ -97,7 +100,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyGetResponse: + ) -> Optional[KeyGetResponse]: """ Gets the Access key rotation settings for an account. @@ -115,7 +118,7 @@ def get( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyGetResponse, + Optional[KeyGetResponse], self._get( f"/accounts/{identifier}/access/keys", options=make_request_options( @@ -123,7 +126,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[KeyGetResponse] @@ -141,7 +144,7 @@ def rotate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyRotateResponse: + ) -> Optional[KeyRotateResponse]: """ Perfoms a key rotation for an account. @@ -159,7 +162,7 @@ def rotate( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyRotateResponse, + Optional[KeyRotateResponse], self._post( f"/accounts/{identifier}/access/keys/rotate", options=make_request_options( @@ -167,7 +170,7 @@ def rotate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyRotateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[KeyRotateResponse] @@ -176,14 +179,14 @@ def rotate( ) -class AsyncKeys(AsyncAPIResource): +class AsyncKeysResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncKeysWithRawResponse: - return AsyncKeysWithRawResponse(self) + def with_raw_response(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncKeysWithStreamingResponse: - return AsyncKeysWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self) async def update( self, @@ -196,7 +199,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyUpdateResponse: + ) -> Optional[KeyUpdateResponse]: """ Updates the Access key rotation settings for an account. @@ -216,7 +219,7 @@ async def update( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyUpdateResponse, + Optional[KeyUpdateResponse], await self._put( f"/accounts/{identifier}/access/keys", body=await async_maybe_transform( @@ -227,7 +230,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[KeyUpdateResponse] @@ -245,7 +248,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyGetResponse: + ) -> Optional[KeyGetResponse]: """ Gets the Access key rotation settings for an account. @@ -263,7 +266,7 @@ async def get( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyGetResponse, + Optional[KeyGetResponse], await self._get( f"/accounts/{identifier}/access/keys", options=make_request_options( @@ -271,7 +274,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[KeyGetResponse] @@ -289,7 +292,7 @@ async def rotate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyRotateResponse: + ) -> Optional[KeyRotateResponse]: """ Perfoms a key rotation for an account. @@ -307,7 +310,7 @@ async def rotate( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyRotateResponse, + Optional[KeyRotateResponse], await self._post( f"/accounts/{identifier}/access/keys/rotate", options=make_request_options( @@ -315,7 +318,7 @@ async def rotate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[KeyRotateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[KeyRotateResponse] @@ -324,8 +327,8 @@ async def rotate( ) -class KeysWithRawResponse: - def __init__(self, keys: Keys) -> None: +class KeysResourceWithRawResponse: + def __init__(self, keys: KeysResource) -> None: self._keys = keys self.update = to_raw_response_wrapper( @@ -339,8 +342,8 @@ def __init__(self, keys: Keys) -> None: ) -class AsyncKeysWithRawResponse: - def __init__(self, keys: AsyncKeys) -> None: +class AsyncKeysResourceWithRawResponse: + def __init__(self, keys: AsyncKeysResource) -> None: self._keys = keys self.update = async_to_raw_response_wrapper( @@ -354,8 +357,8 @@ def __init__(self, keys: AsyncKeys) -> None: ) -class KeysWithStreamingResponse: - def __init__(self, keys: Keys) -> None: +class KeysResourceWithStreamingResponse: + def __init__(self, keys: KeysResource) -> None: self._keys = keys self.update = to_streamed_response_wrapper( @@ -369,8 +372,8 @@ def __init__(self, keys: Keys) -> None: ) -class AsyncKeysWithStreamingResponse: - def __init__(self, keys: AsyncKeys) -> None: +class AsyncKeysResourceWithStreamingResponse: + def __init__(self, keys: AsyncKeysResource) -> None: self._keys = keys self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/logs/__init__.py b/src/cloudflare/resources/zero_trust/access/logs/__init__.py index 3c42da38e00..7479c1fbef8 100644 --- a/src/cloudflare/resources/zero_trust/access/logs/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/logs/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .logs import ( - Logs, - AsyncLogs, - LogsWithRawResponse, - AsyncLogsWithRawResponse, - LogsWithStreamingResponse, - AsyncLogsWithStreamingResponse, + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, ) from .access_requests import ( - AccessRequests, - AsyncAccessRequests, - AccessRequestsWithRawResponse, - AsyncAccessRequestsWithRawResponse, - AccessRequestsWithStreamingResponse, - AsyncAccessRequestsWithStreamingResponse, + AccessRequestsResource, + AsyncAccessRequestsResource, + AccessRequestsResourceWithRawResponse, + AsyncAccessRequestsResourceWithRawResponse, + AccessRequestsResourceWithStreamingResponse, + AsyncAccessRequestsResourceWithStreamingResponse, ) __all__ = [ - "AccessRequests", - "AsyncAccessRequests", - "AccessRequestsWithRawResponse", - "AsyncAccessRequestsWithRawResponse", - "AccessRequestsWithStreamingResponse", - "AsyncAccessRequestsWithStreamingResponse", - "Logs", - "AsyncLogs", - "LogsWithRawResponse", - "AsyncLogsWithRawResponse", - "LogsWithStreamingResponse", - "AsyncLogsWithStreamingResponse", + "AccessRequestsResource", + "AsyncAccessRequestsResource", + "AccessRequestsResourceWithRawResponse", + "AsyncAccessRequestsResourceWithRawResponse", + "AccessRequestsResourceWithStreamingResponse", + "AsyncAccessRequestsResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/access/logs/access_requests.py b/src/cloudflare/resources/zero_trust/access/logs/access_requests.py index aed119fd469..8425be9c392 100644 --- a/src/cloudflare/resources/zero_trust/access/logs/access_requests.py +++ b/src/cloudflare/resources/zero_trust/access/logs/access_requests.py @@ -19,19 +19,19 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.access.logs import AccessRequestListResponse +from .....types.zero_trust.access.logs.access_request_list_response import AccessRequestListResponse -__all__ = ["AccessRequests", "AsyncAccessRequests"] +__all__ = ["AccessRequestsResource", "AsyncAccessRequestsResource"] -class AccessRequests(SyncAPIResource): +class AccessRequestsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccessRequestsWithRawResponse: - return AccessRequestsWithRawResponse(self) + def with_raw_response(self) -> AccessRequestsResourceWithRawResponse: + return AccessRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccessRequestsWithStreamingResponse: - return AccessRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> AccessRequestsResourceWithStreamingResponse: + return AccessRequestsResourceWithStreamingResponse(self) def list( self, @@ -67,20 +67,20 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AccessRequestListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AccessRequestListResponse]], ResultWrapper[AccessRequestListResponse]), ) -class AsyncAccessRequests(AsyncAPIResource): +class AsyncAccessRequestsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccessRequestsWithRawResponse: - return AsyncAccessRequestsWithRawResponse(self) + def with_raw_response(self) -> AsyncAccessRequestsResourceWithRawResponse: + return AsyncAccessRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccessRequestsWithStreamingResponse: - return AsyncAccessRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccessRequestsResourceWithStreamingResponse: + return AsyncAccessRequestsResourceWithStreamingResponse(self) async def list( self, @@ -116,14 +116,14 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AccessRequestListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AccessRequestListResponse]], ResultWrapper[AccessRequestListResponse]), ) -class AccessRequestsWithRawResponse: - def __init__(self, access_requests: AccessRequests) -> None: +class AccessRequestsResourceWithRawResponse: + def __init__(self, access_requests: AccessRequestsResource) -> None: self._access_requests = access_requests self.list = to_raw_response_wrapper( @@ -131,8 +131,8 @@ def __init__(self, access_requests: AccessRequests) -> None: ) -class AsyncAccessRequestsWithRawResponse: - def __init__(self, access_requests: AsyncAccessRequests) -> None: +class AsyncAccessRequestsResourceWithRawResponse: + def __init__(self, access_requests: AsyncAccessRequestsResource) -> None: self._access_requests = access_requests self.list = async_to_raw_response_wrapper( @@ -140,8 +140,8 @@ def __init__(self, access_requests: AsyncAccessRequests) -> None: ) -class AccessRequestsWithStreamingResponse: - def __init__(self, access_requests: AccessRequests) -> None: +class AccessRequestsResourceWithStreamingResponse: + def __init__(self, access_requests: AccessRequestsResource) -> None: self._access_requests = access_requests self.list = to_streamed_response_wrapper( @@ -149,8 +149,8 @@ def __init__(self, access_requests: AccessRequests) -> None: ) -class AsyncAccessRequestsWithStreamingResponse: - def __init__(self, access_requests: AsyncAccessRequests) -> None: +class AsyncAccessRequestsResourceWithStreamingResponse: + def __init__(self, access_requests: AsyncAccessRequestsResource) -> None: self._access_requests = access_requests self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/logs/logs.py b/src/cloudflare/resources/zero_trust/access/logs/logs.py index 1d4b4855661..39226d42917 100644 --- a/src/cloudflare/resources/zero_trust/access/logs/logs.py +++ b/src/cloudflare/resources/zero_trust/access/logs/logs.py @@ -5,76 +5,76 @@ from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from .access_requests import ( - AccessRequests, - AsyncAccessRequests, - AccessRequestsWithRawResponse, - AsyncAccessRequestsWithRawResponse, - AccessRequestsWithStreamingResponse, - AsyncAccessRequestsWithStreamingResponse, + AccessRequestsResource, + AsyncAccessRequestsResource, + AccessRequestsResourceWithRawResponse, + AsyncAccessRequestsResourceWithRawResponse, + AccessRequestsResourceWithStreamingResponse, + AsyncAccessRequestsResourceWithStreamingResponse, ) -__all__ = ["Logs", "AsyncLogs"] +__all__ = ["LogsResource", "AsyncLogsResource"] -class Logs(SyncAPIResource): +class LogsResource(SyncAPIResource): @cached_property - def access_requests(self) -> AccessRequests: - return AccessRequests(self._client) + def access_requests(self) -> AccessRequestsResource: + return AccessRequestsResource(self._client) @cached_property - def with_raw_response(self) -> LogsWithRawResponse: - return LogsWithRawResponse(self) + def with_raw_response(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LogsWithStreamingResponse: - return LogsWithStreamingResponse(self) + def with_streaming_response(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self) -class AsyncLogs(AsyncAPIResource): +class AsyncLogsResource(AsyncAPIResource): @cached_property - def access_requests(self) -> AsyncAccessRequests: - return AsyncAccessRequests(self._client) + def access_requests(self) -> AsyncAccessRequestsResource: + return AsyncAccessRequestsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncLogsWithRawResponse: - return AsyncLogsWithRawResponse(self) + def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLogsWithStreamingResponse: - return AsyncLogsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self) -class LogsWithRawResponse: - def __init__(self, logs: Logs) -> None: +class LogsResourceWithRawResponse: + def __init__(self, logs: LogsResource) -> None: self._logs = logs @cached_property - def access_requests(self) -> AccessRequestsWithRawResponse: - return AccessRequestsWithRawResponse(self._logs.access_requests) + def access_requests(self) -> AccessRequestsResourceWithRawResponse: + return AccessRequestsResourceWithRawResponse(self._logs.access_requests) -class AsyncLogsWithRawResponse: - def __init__(self, logs: AsyncLogs) -> None: +class AsyncLogsResourceWithRawResponse: + def __init__(self, logs: AsyncLogsResource) -> None: self._logs = logs @cached_property - def access_requests(self) -> AsyncAccessRequestsWithRawResponse: - return AsyncAccessRequestsWithRawResponse(self._logs.access_requests) + def access_requests(self) -> AsyncAccessRequestsResourceWithRawResponse: + return AsyncAccessRequestsResourceWithRawResponse(self._logs.access_requests) -class LogsWithStreamingResponse: - def __init__(self, logs: Logs) -> None: +class LogsResourceWithStreamingResponse: + def __init__(self, logs: LogsResource) -> None: self._logs = logs @cached_property - def access_requests(self) -> AccessRequestsWithStreamingResponse: - return AccessRequestsWithStreamingResponse(self._logs.access_requests) + def access_requests(self) -> AccessRequestsResourceWithStreamingResponse: + return AccessRequestsResourceWithStreamingResponse(self._logs.access_requests) -class AsyncLogsWithStreamingResponse: - def __init__(self, logs: AsyncLogs) -> None: +class AsyncLogsResourceWithStreamingResponse: + def __init__(self, logs: AsyncLogsResource) -> None: self._logs = logs @cached_property - def access_requests(self) -> AsyncAccessRequestsWithStreamingResponse: - return AsyncAccessRequestsWithStreamingResponse(self._logs.access_requests) + def access_requests(self) -> AsyncAccessRequestsResourceWithStreamingResponse: + return AsyncAccessRequestsResourceWithStreamingResponse(self._logs.access_requests) diff --git a/src/cloudflare/resources/zero_trust/access/service_tokens.py b/src/cloudflare/resources/zero_trust/access/service_tokens.py index 953e58131ec..716761647d3 100644 --- a/src/cloudflare/resources/zero_trust/access/service_tokens.py +++ b/src/cloudflare/resources/zero_trust/access/service_tokens.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,25 +25,22 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import ( - ZeroTrustServiceTokens, - ServiceTokenCreateResponse, - ServiceTokenRotateResponse, - service_token_create_params, - service_token_update_params, -) +from ....types.zero_trust.access import service_token_create_params, service_token_update_params +from ....types.zero_trust.access.service_token import ServiceToken +from ....types.zero_trust.access.service_token_create_response import ServiceTokenCreateResponse +from ....types.zero_trust.access.service_token_rotate_response import ServiceTokenRotateResponse -__all__ = ["ServiceTokens", "AsyncServiceTokens"] +__all__ = ["ServiceTokensResource", "AsyncServiceTokensResource"] -class ServiceTokens(SyncAPIResource): +class ServiceTokensResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ServiceTokensWithRawResponse: - return ServiceTokensWithRawResponse(self) + def with_raw_response(self) -> ServiceTokensResourceWithRawResponse: + return ServiceTokensResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ServiceTokensWithStreamingResponse: - return ServiceTokensWithStreamingResponse(self) + def with_streaming_response(self) -> ServiceTokensResourceWithStreamingResponse: + return ServiceTokensResourceWithStreamingResponse(self) def create( self, @@ -58,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceTokenCreateResponse: + ) -> Optional[ServiceTokenCreateResponse]: """Generates a new service token. **Note:** This is the only time you can get the @@ -84,12 +81,6 @@ def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -97,6 +88,9 @@ def create( 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( @@ -113,9 +107,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceTokenCreateResponse]]._unwrapper, ), - cast_to=cast(Type[ServiceTokenCreateResponse], ResultWrapper[ServiceTokenCreateResponse]), + cast_to=cast(Type[Optional[ServiceTokenCreateResponse]], ResultWrapper[ServiceTokenCreateResponse]), ) def update( @@ -132,7 +126,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustServiceTokens: + ) -> Optional[ServiceToken]: """ Updates a configured service token. @@ -159,12 +153,6 @@ def update( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -172,6 +160,9 @@ def update( 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._put( @@ -188,9 +179,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustServiceTokens], ResultWrapper[ZeroTrustServiceTokens]), + cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), ) def list( @@ -204,7 +195,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustServiceTokens]: + ) -> SyncSinglePage[ServiceToken]: """ Lists all service tokens. @@ -221,12 +212,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -234,15 +219,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens", - page=SyncSinglePage[ZeroTrustServiceTokens], + page=SyncSinglePage[ServiceToken], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustServiceTokens, + model=ServiceToken, ) def delete( @@ -257,7 +245,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustServiceTokens: + ) -> Optional[ServiceToken]: """ Deletes a service token. @@ -278,12 +266,6 @@ def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -291,6 +273,9 @@ def delete( 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._delete( @@ -300,9 +285,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustServiceTokens], ResultWrapper[ZeroTrustServiceTokens]), + cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), ) def refresh( @@ -316,7 +301,7 @@ def refresh( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustServiceTokens: + ) -> Optional[ServiceToken]: """ Refreshes the expiration of a service token. @@ -344,9 +329,9 @@ def refresh( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustServiceTokens], ResultWrapper[ZeroTrustServiceTokens]), + cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), ) def rotate( @@ -360,7 +345,7 @@ def rotate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceTokenRotateResponse: + ) -> Optional[ServiceTokenRotateResponse]: """ Generates a new Client Secret for a service token and revokes the old one. @@ -388,20 +373,20 @@ def rotate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceTokenRotateResponse]]._unwrapper, ), - cast_to=cast(Type[ServiceTokenRotateResponse], ResultWrapper[ServiceTokenRotateResponse]), + cast_to=cast(Type[Optional[ServiceTokenRotateResponse]], ResultWrapper[ServiceTokenRotateResponse]), ) -class AsyncServiceTokens(AsyncAPIResource): +class AsyncServiceTokensResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncServiceTokensWithRawResponse: - return AsyncServiceTokensWithRawResponse(self) + def with_raw_response(self) -> AsyncServiceTokensResourceWithRawResponse: + return AsyncServiceTokensResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncServiceTokensWithStreamingResponse: - return AsyncServiceTokensWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncServiceTokensResourceWithStreamingResponse: + return AsyncServiceTokensResourceWithStreamingResponse(self) async def create( self, @@ -416,7 +401,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceTokenCreateResponse: + ) -> Optional[ServiceTokenCreateResponse]: """Generates a new service token. **Note:** This is the only time you can get the @@ -442,12 +427,6 @@ async def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -455,6 +434,9 @@ async def create( 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( @@ -471,9 +453,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceTokenCreateResponse]]._unwrapper, ), - cast_to=cast(Type[ServiceTokenCreateResponse], ResultWrapper[ServiceTokenCreateResponse]), + cast_to=cast(Type[Optional[ServiceTokenCreateResponse]], ResultWrapper[ServiceTokenCreateResponse]), ) async def update( @@ -490,7 +472,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustServiceTokens: + ) -> Optional[ServiceToken]: """ Updates a configured service token. @@ -517,12 +499,6 @@ async def update( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -530,6 +506,9 @@ async def update( 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._put( @@ -546,9 +525,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustServiceTokens], ResultWrapper[ZeroTrustServiceTokens]), + cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), ) def list( @@ -562,7 +541,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustServiceTokens, AsyncSinglePage[ZeroTrustServiceTokens]]: + ) -> AsyncPaginator[ServiceToken, AsyncSinglePage[ServiceToken]]: """ Lists all service tokens. @@ -579,12 +558,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -592,15 +565,18 @@ def list( 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._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens", - page=AsyncSinglePage[ZeroTrustServiceTokens], + page=AsyncSinglePage[ServiceToken], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustServiceTokens, + model=ServiceToken, ) async def delete( @@ -615,7 +591,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustServiceTokens: + ) -> Optional[ServiceToken]: """ Deletes a service token. @@ -636,12 +612,6 @@ async def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -649,6 +619,9 @@ async def delete( 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._delete( @@ -658,9 +631,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustServiceTokens], ResultWrapper[ZeroTrustServiceTokens]), + cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), ) async def refresh( @@ -674,7 +647,7 @@ async def refresh( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustServiceTokens: + ) -> Optional[ServiceToken]: """ Refreshes the expiration of a service token. @@ -702,9 +675,9 @@ async def refresh( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustServiceTokens], ResultWrapper[ZeroTrustServiceTokens]), + cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), ) async def rotate( @@ -718,7 +691,7 @@ async def rotate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceTokenRotateResponse: + ) -> Optional[ServiceTokenRotateResponse]: """ Generates a new Client Secret for a service token and revokes the old one. @@ -746,14 +719,14 @@ async def rotate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServiceTokenRotateResponse]]._unwrapper, ), - cast_to=cast(Type[ServiceTokenRotateResponse], ResultWrapper[ServiceTokenRotateResponse]), + cast_to=cast(Type[Optional[ServiceTokenRotateResponse]], ResultWrapper[ServiceTokenRotateResponse]), ) -class ServiceTokensWithRawResponse: - def __init__(self, service_tokens: ServiceTokens) -> None: +class ServiceTokensResourceWithRawResponse: + def __init__(self, service_tokens: ServiceTokensResource) -> None: self._service_tokens = service_tokens self.create = to_raw_response_wrapper( @@ -776,8 +749,8 @@ def __init__(self, service_tokens: ServiceTokens) -> None: ) -class AsyncServiceTokensWithRawResponse: - def __init__(self, service_tokens: AsyncServiceTokens) -> None: +class AsyncServiceTokensResourceWithRawResponse: + def __init__(self, service_tokens: AsyncServiceTokensResource) -> None: self._service_tokens = service_tokens self.create = async_to_raw_response_wrapper( @@ -800,8 +773,8 @@ def __init__(self, service_tokens: AsyncServiceTokens) -> None: ) -class ServiceTokensWithStreamingResponse: - def __init__(self, service_tokens: ServiceTokens) -> None: +class ServiceTokensResourceWithStreamingResponse: + def __init__(self, service_tokens: ServiceTokensResource) -> None: self._service_tokens = service_tokens self.create = to_streamed_response_wrapper( @@ -824,8 +797,8 @@ def __init__(self, service_tokens: ServiceTokens) -> None: ) -class AsyncServiceTokensWithStreamingResponse: - def __init__(self, service_tokens: AsyncServiceTokens) -> None: +class AsyncServiceTokensResourceWithStreamingResponse: + def __init__(self, service_tokens: AsyncServiceTokensResource) -> None: self._service_tokens = service_tokens self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/tags.py b/src/cloudflare/resources/zero_trust/access/tags.py index 0bfece83082..d7ba373faf7 100644 --- a/src/cloudflare/resources/zero_trust/access/tags.py +++ b/src/cloudflare/resources/zero_trust/access/tags.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -25,19 +25,21 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import ZeroTrustTag, TagDeleteResponse, tag_create_params, tag_update_params +from ....types.zero_trust.access import tag_create_params, tag_update_params +from ....types.zero_trust.access.tag import Tag +from ....types.zero_trust.access.tag_delete_response import TagDeleteResponse -__all__ = ["Tags", "AsyncTags"] +__all__ = ["TagsResource", "AsyncTagsResource"] -class Tags(SyncAPIResource): +class TagsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TagsWithRawResponse: - return TagsWithRawResponse(self) + def with_raw_response(self) -> TagsResourceWithRawResponse: + return TagsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TagsWithStreamingResponse: - return TagsWithStreamingResponse(self) + def with_streaming_response(self) -> TagsResourceWithStreamingResponse: + return TagsResourceWithStreamingResponse(self) def create( self, @@ -50,7 +52,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustTag: + ) -> Optional[Tag]: """ Create a tag @@ -77,9 +79,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Tag]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustTag], ResultWrapper[ZeroTrustTag]), + cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), ) def update( @@ -94,7 +96,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustTag: + ) -> Optional[Tag]: """ Update a tag @@ -125,9 +127,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Tag]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustTag], ResultWrapper[ZeroTrustTag]), + cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), ) def list( @@ -140,7 +142,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustTag]: + ) -> SyncSinglePage[Tag]: """ List tags @@ -159,11 +161,11 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._get_api_list( f"/accounts/{identifier}/access/tags", - page=SyncSinglePage[ZeroTrustTag], + page=SyncSinglePage[Tag], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustTag, + model=Tag, ) def delete( @@ -177,7 +179,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TagDeleteResponse: + ) -> Optional[TagDeleteResponse]: """ Delete a tag @@ -205,9 +207,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TagDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[TagDeleteResponse], ResultWrapper[TagDeleteResponse]), + cast_to=cast(Type[Optional[TagDeleteResponse]], ResultWrapper[TagDeleteResponse]), ) def get( @@ -221,7 +223,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustTag: + ) -> Optional[Tag]: """ Get a tag @@ -249,20 +251,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Tag]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustTag], ResultWrapper[ZeroTrustTag]), + cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), ) -class AsyncTags(AsyncAPIResource): +class AsyncTagsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTagsWithRawResponse: - return AsyncTagsWithRawResponse(self) + def with_raw_response(self) -> AsyncTagsResourceWithRawResponse: + return AsyncTagsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTagsWithStreamingResponse: - return AsyncTagsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: + return AsyncTagsResourceWithStreamingResponse(self) async def create( self, @@ -275,7 +277,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustTag: + ) -> Optional[Tag]: """ Create a tag @@ -302,9 +304,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Tag]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustTag], ResultWrapper[ZeroTrustTag]), + cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), ) async def update( @@ -319,7 +321,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustTag: + ) -> Optional[Tag]: """ Update a tag @@ -350,9 +352,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Tag]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustTag], ResultWrapper[ZeroTrustTag]), + cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), ) def list( @@ -365,7 +367,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustTag, AsyncSinglePage[ZeroTrustTag]]: + ) -> AsyncPaginator[Tag, AsyncSinglePage[Tag]]: """ List tags @@ -384,11 +386,11 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._get_api_list( f"/accounts/{identifier}/access/tags", - page=AsyncSinglePage[ZeroTrustTag], + page=AsyncSinglePage[Tag], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustTag, + model=Tag, ) async def delete( @@ -402,7 +404,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TagDeleteResponse: + ) -> Optional[TagDeleteResponse]: """ Delete a tag @@ -430,9 +432,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TagDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[TagDeleteResponse], ResultWrapper[TagDeleteResponse]), + cast_to=cast(Type[Optional[TagDeleteResponse]], ResultWrapper[TagDeleteResponse]), ) async def get( @@ -446,7 +448,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustTag: + ) -> Optional[Tag]: """ Get a tag @@ -474,14 +476,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Tag]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustTag], ResultWrapper[ZeroTrustTag]), + cast_to=cast(Type[Optional[Tag]], ResultWrapper[Tag]), ) -class TagsWithRawResponse: - def __init__(self, tags: Tags) -> None: +class TagsResourceWithRawResponse: + def __init__(self, tags: TagsResource) -> None: self._tags = tags self.create = to_raw_response_wrapper( @@ -501,8 +503,8 @@ def __init__(self, tags: Tags) -> None: ) -class AsyncTagsWithRawResponse: - def __init__(self, tags: AsyncTags) -> None: +class AsyncTagsResourceWithRawResponse: + def __init__(self, tags: AsyncTagsResource) -> None: self._tags = tags self.create = async_to_raw_response_wrapper( @@ -522,8 +524,8 @@ def __init__(self, tags: AsyncTags) -> None: ) -class TagsWithStreamingResponse: - def __init__(self, tags: Tags) -> None: +class TagsResourceWithStreamingResponse: + def __init__(self, tags: TagsResource) -> None: self._tags = tags self.create = to_streamed_response_wrapper( @@ -543,8 +545,8 @@ def __init__(self, tags: Tags) -> None: ) -class AsyncTagsWithStreamingResponse: - def __init__(self, tags: AsyncTags) -> None: +class AsyncTagsResourceWithStreamingResponse: + def __init__(self, tags: AsyncTagsResource) -> None: self._tags = tags self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/users/__init__.py b/src/cloudflare/resources/zero_trust/access/users/__init__.py index 3ffb7d57285..c5766c1427a 100644 --- a/src/cloudflare/resources/zero_trust/access/users/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/users/__init__.py @@ -1,61 +1,61 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .users import ( - Users, - AsyncUsers, - UsersWithRawResponse, - AsyncUsersWithRawResponse, - UsersWithStreamingResponse, - AsyncUsersWithStreamingResponse, + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, ) from .failed_logins import ( - FailedLogins, - AsyncFailedLogins, - FailedLoginsWithRawResponse, - AsyncFailedLoginsWithRawResponse, - FailedLoginsWithStreamingResponse, - AsyncFailedLoginsWithStreamingResponse, + FailedLoginsResource, + AsyncFailedLoginsResource, + FailedLoginsResourceWithRawResponse, + AsyncFailedLoginsResourceWithRawResponse, + FailedLoginsResourceWithStreamingResponse, + AsyncFailedLoginsResourceWithStreamingResponse, ) from .active_sessions import ( - ActiveSessions, - AsyncActiveSessions, - ActiveSessionsWithRawResponse, - AsyncActiveSessionsWithRawResponse, - ActiveSessionsWithStreamingResponse, - AsyncActiveSessionsWithStreamingResponse, + ActiveSessionsResource, + AsyncActiveSessionsResource, + ActiveSessionsResourceWithRawResponse, + AsyncActiveSessionsResourceWithRawResponse, + ActiveSessionsResourceWithStreamingResponse, + AsyncActiveSessionsResourceWithStreamingResponse, ) from .last_seen_identity import ( - LastSeenIdentity, - AsyncLastSeenIdentity, - LastSeenIdentityWithRawResponse, - AsyncLastSeenIdentityWithRawResponse, - LastSeenIdentityWithStreamingResponse, - AsyncLastSeenIdentityWithStreamingResponse, + LastSeenIdentityResource, + AsyncLastSeenIdentityResource, + LastSeenIdentityResourceWithRawResponse, + AsyncLastSeenIdentityResourceWithRawResponse, + LastSeenIdentityResourceWithStreamingResponse, + AsyncLastSeenIdentityResourceWithStreamingResponse, ) __all__ = [ - "ActiveSessions", - "AsyncActiveSessions", - "ActiveSessionsWithRawResponse", - "AsyncActiveSessionsWithRawResponse", - "ActiveSessionsWithStreamingResponse", - "AsyncActiveSessionsWithStreamingResponse", - "LastSeenIdentity", - "AsyncLastSeenIdentity", - "LastSeenIdentityWithRawResponse", - "AsyncLastSeenIdentityWithRawResponse", - "LastSeenIdentityWithStreamingResponse", - "AsyncLastSeenIdentityWithStreamingResponse", - "FailedLogins", - "AsyncFailedLogins", - "FailedLoginsWithRawResponse", - "AsyncFailedLoginsWithRawResponse", - "FailedLoginsWithStreamingResponse", - "AsyncFailedLoginsWithStreamingResponse", - "Users", - "AsyncUsers", - "UsersWithRawResponse", - "AsyncUsersWithRawResponse", - "UsersWithStreamingResponse", - "AsyncUsersWithStreamingResponse", + "ActiveSessionsResource", + "AsyncActiveSessionsResource", + "ActiveSessionsResourceWithRawResponse", + "AsyncActiveSessionsResourceWithRawResponse", + "ActiveSessionsResourceWithStreamingResponse", + "AsyncActiveSessionsResourceWithStreamingResponse", + "LastSeenIdentityResource", + "AsyncLastSeenIdentityResource", + "LastSeenIdentityResourceWithRawResponse", + "AsyncLastSeenIdentityResourceWithRawResponse", + "LastSeenIdentityResourceWithStreamingResponse", + "AsyncLastSeenIdentityResourceWithStreamingResponse", + "FailedLoginsResource", + "AsyncFailedLoginsResource", + "FailedLoginsResourceWithRawResponse", + "AsyncFailedLoginsResourceWithRawResponse", + "FailedLoginsResourceWithStreamingResponse", + "AsyncFailedLoginsResourceWithStreamingResponse", + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/access/users/active_sessions.py b/src/cloudflare/resources/zero_trust/access/users/active_sessions.py index 92e9fc65093..0a39ccddb3d 100644 --- a/src/cloudflare/resources/zero_trust/access/users/active_sessions.py +++ b/src/cloudflare/resources/zero_trust/access/users/active_sessions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -21,19 +21,20 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.access.users import ActiveSessionGetResponse, ActiveSessionListResponse +from .....types.zero_trust.access.users.active_session_get_response import ActiveSessionGetResponse +from .....types.zero_trust.access.users.active_session_list_response import ActiveSessionListResponse -__all__ = ["ActiveSessions", "AsyncActiveSessions"] +__all__ = ["ActiveSessionsResource", "AsyncActiveSessionsResource"] -class ActiveSessions(SyncAPIResource): +class ActiveSessionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ActiveSessionsWithRawResponse: - return ActiveSessionsWithRawResponse(self) + def with_raw_response(self) -> ActiveSessionsResourceWithRawResponse: + return ActiveSessionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ActiveSessionsWithStreamingResponse: - return ActiveSessionsWithStreamingResponse(self) + def with_streaming_response(self) -> ActiveSessionsResourceWithStreamingResponse: + return ActiveSessionsResourceWithStreamingResponse(self) def list( self, @@ -88,7 +89,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ActiveSessionGetResponse: + ) -> Optional[ActiveSessionGetResponse]: """ Get an active session for a single user. @@ -118,20 +119,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ActiveSessionGetResponse]]._unwrapper, ), - cast_to=cast(Type[ActiveSessionGetResponse], ResultWrapper[ActiveSessionGetResponse]), + cast_to=cast(Type[Optional[ActiveSessionGetResponse]], ResultWrapper[ActiveSessionGetResponse]), ) -class AsyncActiveSessions(AsyncAPIResource): +class AsyncActiveSessionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncActiveSessionsWithRawResponse: - return AsyncActiveSessionsWithRawResponse(self) + def with_raw_response(self) -> AsyncActiveSessionsResourceWithRawResponse: + return AsyncActiveSessionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncActiveSessionsWithStreamingResponse: - return AsyncActiveSessionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncActiveSessionsResourceWithStreamingResponse: + return AsyncActiveSessionsResourceWithStreamingResponse(self) def list( self, @@ -186,7 +187,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ActiveSessionGetResponse: + ) -> Optional[ActiveSessionGetResponse]: """ Get an active session for a single user. @@ -216,14 +217,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ActiveSessionGetResponse]]._unwrapper, ), - cast_to=cast(Type[ActiveSessionGetResponse], ResultWrapper[ActiveSessionGetResponse]), + cast_to=cast(Type[Optional[ActiveSessionGetResponse]], ResultWrapper[ActiveSessionGetResponse]), ) -class ActiveSessionsWithRawResponse: - def __init__(self, active_sessions: ActiveSessions) -> None: +class ActiveSessionsResourceWithRawResponse: + def __init__(self, active_sessions: ActiveSessionsResource) -> None: self._active_sessions = active_sessions self.list = to_raw_response_wrapper( @@ -234,8 +235,8 @@ def __init__(self, active_sessions: ActiveSessions) -> None: ) -class AsyncActiveSessionsWithRawResponse: - def __init__(self, active_sessions: AsyncActiveSessions) -> None: +class AsyncActiveSessionsResourceWithRawResponse: + def __init__(self, active_sessions: AsyncActiveSessionsResource) -> None: self._active_sessions = active_sessions self.list = async_to_raw_response_wrapper( @@ -246,8 +247,8 @@ def __init__(self, active_sessions: AsyncActiveSessions) -> None: ) -class ActiveSessionsWithStreamingResponse: - def __init__(self, active_sessions: ActiveSessions) -> None: +class ActiveSessionsResourceWithStreamingResponse: + def __init__(self, active_sessions: ActiveSessionsResource) -> None: self._active_sessions = active_sessions self.list = to_streamed_response_wrapper( @@ -258,8 +259,8 @@ def __init__(self, active_sessions: ActiveSessions) -> None: ) -class AsyncActiveSessionsWithStreamingResponse: - def __init__(self, active_sessions: AsyncActiveSessions) -> None: +class AsyncActiveSessionsResourceWithStreamingResponse: + def __init__(self, active_sessions: AsyncActiveSessionsResource) -> None: self._active_sessions = active_sessions self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/users/failed_logins.py b/src/cloudflare/resources/zero_trust/access/users/failed_logins.py index 7f37f31f146..6b2b7d19f57 100644 --- a/src/cloudflare/resources/zero_trust/access/users/failed_logins.py +++ b/src/cloudflare/resources/zero_trust/access/users/failed_logins.py @@ -18,19 +18,19 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.access.users import FailedLoginListResponse +from .....types.zero_trust.access.users.failed_login_list_response import FailedLoginListResponse -__all__ = ["FailedLogins", "AsyncFailedLogins"] +__all__ = ["FailedLoginsResource", "AsyncFailedLoginsResource"] -class FailedLogins(SyncAPIResource): +class FailedLoginsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FailedLoginsWithRawResponse: - return FailedLoginsWithRawResponse(self) + def with_raw_response(self) -> FailedLoginsResourceWithRawResponse: + return FailedLoginsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FailedLoginsWithStreamingResponse: - return FailedLoginsWithStreamingResponse(self) + def with_streaming_response(self) -> FailedLoginsResourceWithStreamingResponse: + return FailedLoginsResourceWithStreamingResponse(self) def list( self, @@ -74,14 +74,14 @@ def list( ) -class AsyncFailedLogins(AsyncAPIResource): +class AsyncFailedLoginsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFailedLoginsWithRawResponse: - return AsyncFailedLoginsWithRawResponse(self) + def with_raw_response(self) -> AsyncFailedLoginsResourceWithRawResponse: + return AsyncFailedLoginsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFailedLoginsWithStreamingResponse: - return AsyncFailedLoginsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFailedLoginsResourceWithStreamingResponse: + return AsyncFailedLoginsResourceWithStreamingResponse(self) def list( self, @@ -125,8 +125,8 @@ def list( ) -class FailedLoginsWithRawResponse: - def __init__(self, failed_logins: FailedLogins) -> None: +class FailedLoginsResourceWithRawResponse: + def __init__(self, failed_logins: FailedLoginsResource) -> None: self._failed_logins = failed_logins self.list = to_raw_response_wrapper( @@ -134,8 +134,8 @@ def __init__(self, failed_logins: FailedLogins) -> None: ) -class AsyncFailedLoginsWithRawResponse: - def __init__(self, failed_logins: AsyncFailedLogins) -> None: +class AsyncFailedLoginsResourceWithRawResponse: + def __init__(self, failed_logins: AsyncFailedLoginsResource) -> None: self._failed_logins = failed_logins self.list = async_to_raw_response_wrapper( @@ -143,8 +143,8 @@ def __init__(self, failed_logins: AsyncFailedLogins) -> None: ) -class FailedLoginsWithStreamingResponse: - def __init__(self, failed_logins: FailedLogins) -> None: +class FailedLoginsResourceWithStreamingResponse: + def __init__(self, failed_logins: FailedLoginsResource) -> None: self._failed_logins = failed_logins self.list = to_streamed_response_wrapper( @@ -152,8 +152,8 @@ def __init__(self, failed_logins: FailedLogins) -> None: ) -class AsyncFailedLoginsWithStreamingResponse: - def __init__(self, failed_logins: AsyncFailedLogins) -> None: +class AsyncFailedLoginsResourceWithStreamingResponse: + def __init__(self, failed_logins: AsyncFailedLoginsResource) -> None: self._failed_logins = failed_logins self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py b/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py index 851f87f1182..4e913e2720c 100644 --- a/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py +++ b/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -19,19 +19,19 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.access.users import ZeroTrustIdentity +from .....types.zero_trust.access.users.identity import Identity -__all__ = ["LastSeenIdentity", "AsyncLastSeenIdentity"] +__all__ = ["LastSeenIdentityResource", "AsyncLastSeenIdentityResource"] -class LastSeenIdentity(SyncAPIResource): +class LastSeenIdentityResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LastSeenIdentityWithRawResponse: - return LastSeenIdentityWithRawResponse(self) + def with_raw_response(self) -> LastSeenIdentityResourceWithRawResponse: + return LastSeenIdentityResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LastSeenIdentityWithStreamingResponse: - return LastSeenIdentityWithStreamingResponse(self) + def with_streaming_response(self) -> LastSeenIdentityResourceWithStreamingResponse: + return LastSeenIdentityResourceWithStreamingResponse(self) def get( self, @@ -44,7 +44,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustIdentity: + ) -> Optional[Identity]: """ Get last seen identity for a single user. @@ -72,20 +72,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Identity]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustIdentity], ResultWrapper[ZeroTrustIdentity]), + cast_to=cast(Type[Optional[Identity]], ResultWrapper[Identity]), ) -class AsyncLastSeenIdentity(AsyncAPIResource): +class AsyncLastSeenIdentityResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLastSeenIdentityWithRawResponse: - return AsyncLastSeenIdentityWithRawResponse(self) + def with_raw_response(self) -> AsyncLastSeenIdentityResourceWithRawResponse: + return AsyncLastSeenIdentityResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLastSeenIdentityWithStreamingResponse: - return AsyncLastSeenIdentityWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLastSeenIdentityResourceWithStreamingResponse: + return AsyncLastSeenIdentityResourceWithStreamingResponse(self) async def get( self, @@ -98,7 +98,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustIdentity: + ) -> Optional[Identity]: """ Get last seen identity for a single user. @@ -126,14 +126,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Identity]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustIdentity], ResultWrapper[ZeroTrustIdentity]), + cast_to=cast(Type[Optional[Identity]], ResultWrapper[Identity]), ) -class LastSeenIdentityWithRawResponse: - def __init__(self, last_seen_identity: LastSeenIdentity) -> None: +class LastSeenIdentityResourceWithRawResponse: + def __init__(self, last_seen_identity: LastSeenIdentityResource) -> None: self._last_seen_identity = last_seen_identity self.get = to_raw_response_wrapper( @@ -141,8 +141,8 @@ def __init__(self, last_seen_identity: LastSeenIdentity) -> None: ) -class AsyncLastSeenIdentityWithRawResponse: - def __init__(self, last_seen_identity: AsyncLastSeenIdentity) -> None: +class AsyncLastSeenIdentityResourceWithRawResponse: + def __init__(self, last_seen_identity: AsyncLastSeenIdentityResource) -> None: self._last_seen_identity = last_seen_identity self.get = async_to_raw_response_wrapper( @@ -150,8 +150,8 @@ def __init__(self, last_seen_identity: AsyncLastSeenIdentity) -> None: ) -class LastSeenIdentityWithStreamingResponse: - def __init__(self, last_seen_identity: LastSeenIdentity) -> None: +class LastSeenIdentityResourceWithStreamingResponse: + def __init__(self, last_seen_identity: LastSeenIdentityResource) -> None: self._last_seen_identity = last_seen_identity self.get = to_streamed_response_wrapper( @@ -159,8 +159,8 @@ def __init__(self, last_seen_identity: LastSeenIdentity) -> None: ) -class AsyncLastSeenIdentityWithStreamingResponse: - def __init__(self, last_seen_identity: AsyncLastSeenIdentity) -> None: +class AsyncLastSeenIdentityResourceWithStreamingResponse: + def __init__(self, last_seen_identity: AsyncLastSeenIdentityResource) -> None: self._last_seen_identity = last_seen_identity self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/access/users/users.py b/src/cloudflare/resources/zero_trust/access/users/users.py index 0d656b5f90b..97bce1fa075 100644 --- a/src/cloudflare/resources/zero_trust/access/users/users.py +++ b/src/cloudflare/resources/zero_trust/access/users/users.py @@ -14,59 +14,59 @@ async_to_streamed_response_wrapper, ) from .failed_logins import ( - FailedLogins, - AsyncFailedLogins, - FailedLoginsWithRawResponse, - AsyncFailedLoginsWithRawResponse, - FailedLoginsWithStreamingResponse, - AsyncFailedLoginsWithStreamingResponse, + FailedLoginsResource, + AsyncFailedLoginsResource, + FailedLoginsResourceWithRawResponse, + AsyncFailedLoginsResourceWithRawResponse, + FailedLoginsResourceWithStreamingResponse, + AsyncFailedLoginsResourceWithStreamingResponse, ) from .....pagination import SyncSinglePage, AsyncSinglePage from .active_sessions import ( - ActiveSessions, - AsyncActiveSessions, - ActiveSessionsWithRawResponse, - AsyncActiveSessionsWithRawResponse, - ActiveSessionsWithStreamingResponse, - AsyncActiveSessionsWithStreamingResponse, + ActiveSessionsResource, + AsyncActiveSessionsResource, + ActiveSessionsResourceWithRawResponse, + AsyncActiveSessionsResourceWithRawResponse, + ActiveSessionsResourceWithStreamingResponse, + AsyncActiveSessionsResourceWithStreamingResponse, ) from ....._base_client import ( AsyncPaginator, make_request_options, ) from .last_seen_identity import ( - LastSeenIdentity, - AsyncLastSeenIdentity, - LastSeenIdentityWithRawResponse, - AsyncLastSeenIdentityWithRawResponse, - LastSeenIdentityWithStreamingResponse, - AsyncLastSeenIdentityWithStreamingResponse, + LastSeenIdentityResource, + AsyncLastSeenIdentityResource, + LastSeenIdentityResourceWithRawResponse, + AsyncLastSeenIdentityResourceWithRawResponse, + LastSeenIdentityResourceWithStreamingResponse, + AsyncLastSeenIdentityResourceWithStreamingResponse, ) -from .....types.zero_trust.access import ZeroTrustUsers +from .....types.zero_trust.access.access_user import AccessUser -__all__ = ["Users", "AsyncUsers"] +__all__ = ["UsersResource", "AsyncUsersResource"] -class Users(SyncAPIResource): +class UsersResource(SyncAPIResource): @cached_property - def active_sessions(self) -> ActiveSessions: - return ActiveSessions(self._client) + def active_sessions(self) -> ActiveSessionsResource: + return ActiveSessionsResource(self._client) @cached_property - def last_seen_identity(self) -> LastSeenIdentity: - return LastSeenIdentity(self._client) + def last_seen_identity(self) -> LastSeenIdentityResource: + return LastSeenIdentityResource(self._client) @cached_property - def failed_logins(self) -> FailedLogins: - return FailedLogins(self._client) + def failed_logins(self) -> FailedLoginsResource: + return FailedLoginsResource(self._client) @cached_property - def with_raw_response(self) -> UsersWithRawResponse: - return UsersWithRawResponse(self) + def with_raw_response(self) -> UsersResourceWithRawResponse: + return UsersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UsersWithStreamingResponse: - return UsersWithStreamingResponse(self) + def with_streaming_response(self) -> UsersResourceWithStreamingResponse: + return UsersResourceWithStreamingResponse(self) def list( self, @@ -78,7 +78,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustUsers]: + ) -> SyncSinglePage[AccessUser]: """ Gets a list of users for an account. @@ -97,34 +97,34 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._get_api_list( f"/accounts/{identifier}/access/users", - page=SyncSinglePage[ZeroTrustUsers], + page=SyncSinglePage[AccessUser], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustUsers, + model=AccessUser, ) -class AsyncUsers(AsyncAPIResource): +class AsyncUsersResource(AsyncAPIResource): @cached_property - def active_sessions(self) -> AsyncActiveSessions: - return AsyncActiveSessions(self._client) + def active_sessions(self) -> AsyncActiveSessionsResource: + return AsyncActiveSessionsResource(self._client) @cached_property - def last_seen_identity(self) -> AsyncLastSeenIdentity: - return AsyncLastSeenIdentity(self._client) + def last_seen_identity(self) -> AsyncLastSeenIdentityResource: + return AsyncLastSeenIdentityResource(self._client) @cached_property - def failed_logins(self) -> AsyncFailedLogins: - return AsyncFailedLogins(self._client) + def failed_logins(self) -> AsyncFailedLoginsResource: + return AsyncFailedLoginsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncUsersWithRawResponse: - return AsyncUsersWithRawResponse(self) + def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: + return AsyncUsersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUsersWithStreamingResponse: - return AsyncUsersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: + return AsyncUsersResourceWithStreamingResponse(self) def list( self, @@ -136,7 +136,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustUsers, AsyncSinglePage[ZeroTrustUsers]]: + ) -> AsyncPaginator[AccessUser, AsyncSinglePage[AccessUser]]: """ Gets a list of users for an account. @@ -155,16 +155,16 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return self._get_api_list( f"/accounts/{identifier}/access/users", - page=AsyncSinglePage[ZeroTrustUsers], + page=AsyncSinglePage[AccessUser], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustUsers, + model=AccessUser, ) -class UsersWithRawResponse: - def __init__(self, users: Users) -> None: +class UsersResourceWithRawResponse: + def __init__(self, users: UsersResource) -> None: self._users = users self.list = to_raw_response_wrapper( @@ -172,20 +172,20 @@ def __init__(self, users: Users) -> None: ) @cached_property - def active_sessions(self) -> ActiveSessionsWithRawResponse: - return ActiveSessionsWithRawResponse(self._users.active_sessions) + def active_sessions(self) -> ActiveSessionsResourceWithRawResponse: + return ActiveSessionsResourceWithRawResponse(self._users.active_sessions) @cached_property - def last_seen_identity(self) -> LastSeenIdentityWithRawResponse: - return LastSeenIdentityWithRawResponse(self._users.last_seen_identity) + def last_seen_identity(self) -> LastSeenIdentityResourceWithRawResponse: + return LastSeenIdentityResourceWithRawResponse(self._users.last_seen_identity) @cached_property - def failed_logins(self) -> FailedLoginsWithRawResponse: - return FailedLoginsWithRawResponse(self._users.failed_logins) + def failed_logins(self) -> FailedLoginsResourceWithRawResponse: + return FailedLoginsResourceWithRawResponse(self._users.failed_logins) -class AsyncUsersWithRawResponse: - def __init__(self, users: AsyncUsers) -> None: +class AsyncUsersResourceWithRawResponse: + def __init__(self, users: AsyncUsersResource) -> None: self._users = users self.list = async_to_raw_response_wrapper( @@ -193,20 +193,20 @@ def __init__(self, users: AsyncUsers) -> None: ) @cached_property - def active_sessions(self) -> AsyncActiveSessionsWithRawResponse: - return AsyncActiveSessionsWithRawResponse(self._users.active_sessions) + def active_sessions(self) -> AsyncActiveSessionsResourceWithRawResponse: + return AsyncActiveSessionsResourceWithRawResponse(self._users.active_sessions) @cached_property - def last_seen_identity(self) -> AsyncLastSeenIdentityWithRawResponse: - return AsyncLastSeenIdentityWithRawResponse(self._users.last_seen_identity) + def last_seen_identity(self) -> AsyncLastSeenIdentityResourceWithRawResponse: + return AsyncLastSeenIdentityResourceWithRawResponse(self._users.last_seen_identity) @cached_property - def failed_logins(self) -> AsyncFailedLoginsWithRawResponse: - return AsyncFailedLoginsWithRawResponse(self._users.failed_logins) + def failed_logins(self) -> AsyncFailedLoginsResourceWithRawResponse: + return AsyncFailedLoginsResourceWithRawResponse(self._users.failed_logins) -class UsersWithStreamingResponse: - def __init__(self, users: Users) -> None: +class UsersResourceWithStreamingResponse: + def __init__(self, users: UsersResource) -> None: self._users = users self.list = to_streamed_response_wrapper( @@ -214,20 +214,20 @@ def __init__(self, users: Users) -> None: ) @cached_property - def active_sessions(self) -> ActiveSessionsWithStreamingResponse: - return ActiveSessionsWithStreamingResponse(self._users.active_sessions) + def active_sessions(self) -> ActiveSessionsResourceWithStreamingResponse: + return ActiveSessionsResourceWithStreamingResponse(self._users.active_sessions) @cached_property - def last_seen_identity(self) -> LastSeenIdentityWithStreamingResponse: - return LastSeenIdentityWithStreamingResponse(self._users.last_seen_identity) + def last_seen_identity(self) -> LastSeenIdentityResourceWithStreamingResponse: + return LastSeenIdentityResourceWithStreamingResponse(self._users.last_seen_identity) @cached_property - def failed_logins(self) -> FailedLoginsWithStreamingResponse: - return FailedLoginsWithStreamingResponse(self._users.failed_logins) + def failed_logins(self) -> FailedLoginsResourceWithStreamingResponse: + return FailedLoginsResourceWithStreamingResponse(self._users.failed_logins) -class AsyncUsersWithStreamingResponse: - def __init__(self, users: AsyncUsers) -> None: +class AsyncUsersResourceWithStreamingResponse: + def __init__(self, users: AsyncUsersResource) -> None: self._users = users self.list = async_to_streamed_response_wrapper( @@ -235,13 +235,13 @@ def __init__(self, users: AsyncUsers) -> None: ) @cached_property - def active_sessions(self) -> AsyncActiveSessionsWithStreamingResponse: - return AsyncActiveSessionsWithStreamingResponse(self._users.active_sessions) + def active_sessions(self) -> AsyncActiveSessionsResourceWithStreamingResponse: + return AsyncActiveSessionsResourceWithStreamingResponse(self._users.active_sessions) @cached_property - def last_seen_identity(self) -> AsyncLastSeenIdentityWithStreamingResponse: - return AsyncLastSeenIdentityWithStreamingResponse(self._users.last_seen_identity) + def last_seen_identity(self) -> AsyncLastSeenIdentityResourceWithStreamingResponse: + return AsyncLastSeenIdentityResourceWithStreamingResponse(self._users.last_seen_identity) @cached_property - def failed_logins(self) -> AsyncFailedLoginsWithStreamingResponse: - return AsyncFailedLoginsWithStreamingResponse(self._users.failed_logins) + def failed_logins(self) -> AsyncFailedLoginsResourceWithStreamingResponse: + return AsyncFailedLoginsResourceWithStreamingResponse(self._users.failed_logins) diff --git a/src/cloudflare/resources/zero_trust/connectivity_settings.py b/src/cloudflare/resources/zero_trust/connectivity_settings.py index c16dd2cc704..6514c8d16f6 100644 --- a/src/cloudflare/resources/zero_trust/connectivity_settings.py +++ b/src/cloudflare/resources/zero_trust/connectivity_settings.py @@ -23,23 +23,21 @@ from ..._base_client import ( make_request_options, ) -from ...types.zero_trust import ( - ConnectivitySettingGetResponse, - ConnectivitySettingEditResponse, - connectivity_setting_edit_params, -) +from ...types.zero_trust import connectivity_setting_edit_params +from ...types.zero_trust.connectivity_setting_get_response import ConnectivitySettingGetResponse +from ...types.zero_trust.connectivity_setting_edit_response import ConnectivitySettingEditResponse -__all__ = ["ConnectivitySettings", "AsyncConnectivitySettings"] +__all__ = ["ConnectivitySettingsResource", "AsyncConnectivitySettingsResource"] -class ConnectivitySettings(SyncAPIResource): +class ConnectivitySettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConnectivitySettingsWithRawResponse: - return ConnectivitySettingsWithRawResponse(self) + def with_raw_response(self) -> ConnectivitySettingsResourceWithRawResponse: + return ConnectivitySettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConnectivitySettingsWithStreamingResponse: - return ConnectivitySettingsWithStreamingResponse(self) + def with_streaming_response(self) -> ConnectivitySettingsResourceWithStreamingResponse: + return ConnectivitySettingsResourceWithStreamingResponse(self) def edit( self, @@ -88,7 +86,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectivitySettingEditResponse]._unwrapper, ), cast_to=cast(Type[ConnectivitySettingEditResponse], ResultWrapper[ConnectivitySettingEditResponse]), ) @@ -127,20 +125,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectivitySettingGetResponse]._unwrapper, ), cast_to=cast(Type[ConnectivitySettingGetResponse], ResultWrapper[ConnectivitySettingGetResponse]), ) -class AsyncConnectivitySettings(AsyncAPIResource): +class AsyncConnectivitySettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConnectivitySettingsWithRawResponse: - return AsyncConnectivitySettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncConnectivitySettingsResourceWithRawResponse: + return AsyncConnectivitySettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConnectivitySettingsWithStreamingResponse: - return AsyncConnectivitySettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConnectivitySettingsResourceWithStreamingResponse: + return AsyncConnectivitySettingsResourceWithStreamingResponse(self) async def edit( self, @@ -189,7 +187,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectivitySettingEditResponse]._unwrapper, ), cast_to=cast(Type[ConnectivitySettingEditResponse], ResultWrapper[ConnectivitySettingEditResponse]), ) @@ -228,14 +226,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectivitySettingGetResponse]._unwrapper, ), cast_to=cast(Type[ConnectivitySettingGetResponse], ResultWrapper[ConnectivitySettingGetResponse]), ) -class ConnectivitySettingsWithRawResponse: - def __init__(self, connectivity_settings: ConnectivitySettings) -> None: +class ConnectivitySettingsResourceWithRawResponse: + def __init__(self, connectivity_settings: ConnectivitySettingsResource) -> None: self._connectivity_settings = connectivity_settings self.edit = to_raw_response_wrapper( @@ -246,8 +244,8 @@ def __init__(self, connectivity_settings: ConnectivitySettings) -> None: ) -class AsyncConnectivitySettingsWithRawResponse: - def __init__(self, connectivity_settings: AsyncConnectivitySettings) -> None: +class AsyncConnectivitySettingsResourceWithRawResponse: + def __init__(self, connectivity_settings: AsyncConnectivitySettingsResource) -> None: self._connectivity_settings = connectivity_settings self.edit = async_to_raw_response_wrapper( @@ -258,8 +256,8 @@ def __init__(self, connectivity_settings: AsyncConnectivitySettings) -> None: ) -class ConnectivitySettingsWithStreamingResponse: - def __init__(self, connectivity_settings: ConnectivitySettings) -> None: +class ConnectivitySettingsResourceWithStreamingResponse: + def __init__(self, connectivity_settings: ConnectivitySettingsResource) -> None: self._connectivity_settings = connectivity_settings self.edit = to_streamed_response_wrapper( @@ -270,8 +268,8 @@ def __init__(self, connectivity_settings: ConnectivitySettings) -> None: ) -class AsyncConnectivitySettingsWithStreamingResponse: - def __init__(self, connectivity_settings: AsyncConnectivitySettings) -> None: +class AsyncConnectivitySettingsResourceWithStreamingResponse: + def __init__(self, connectivity_settings: AsyncConnectivitySettingsResource) -> None: self._connectivity_settings = connectivity_settings self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/__init__.py b/src/cloudflare/resources/zero_trust/devices/__init__.py index 719cd4c0842..3002bba6155 100644 --- a/src/cloudflare/resources/zero_trust/devices/__init__.py +++ b/src/cloudflare/resources/zero_trust/devices/__init__.py @@ -1,131 +1,131 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .revoke import ( - Revoke, - AsyncRevoke, - RevokeWithRawResponse, - AsyncRevokeWithRawResponse, - RevokeWithStreamingResponse, - AsyncRevokeWithStreamingResponse, + RevokeResource, + AsyncRevokeResource, + RevokeResourceWithRawResponse, + AsyncRevokeResourceWithRawResponse, + RevokeResourceWithStreamingResponse, + AsyncRevokeResourceWithStreamingResponse, ) from .devices import ( - Devices, - AsyncDevices, - DevicesWithRawResponse, - AsyncDevicesWithRawResponse, - DevicesWithStreamingResponse, - AsyncDevicesWithStreamingResponse, + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, ) from .posture import ( - Posture, - AsyncPosture, - PostureWithRawResponse, - AsyncPostureWithRawResponse, - PostureWithStreamingResponse, - AsyncPostureWithStreamingResponse, + PostureResource, + AsyncPostureResource, + PostureResourceWithRawResponse, + AsyncPostureResourceWithRawResponse, + PostureResourceWithStreamingResponse, + AsyncPostureResourceWithStreamingResponse, ) from .networks import ( - Networks, - AsyncNetworks, - NetworksWithRawResponse, - AsyncNetworksWithRawResponse, - NetworksWithStreamingResponse, - AsyncNetworksWithStreamingResponse, + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .unrevoke import ( - Unrevoke, - AsyncUnrevoke, - UnrevokeWithRawResponse, - AsyncUnrevokeWithRawResponse, - UnrevokeWithStreamingResponse, - AsyncUnrevokeWithStreamingResponse, + UnrevokeResource, + AsyncUnrevokeResource, + UnrevokeResourceWithRawResponse, + AsyncUnrevokeResourceWithRawResponse, + UnrevokeResourceWithStreamingResponse, + AsyncUnrevokeResourceWithStreamingResponse, ) from .dex_tests import ( - DEXTests, - AsyncDEXTests, - DEXTestsWithRawResponse, - AsyncDEXTestsWithRawResponse, - DEXTestsWithStreamingResponse, - AsyncDEXTestsWithStreamingResponse, + DEXTestsResource, + AsyncDEXTestsResource, + DEXTestsResourceWithRawResponse, + AsyncDEXTestsResourceWithRawResponse, + DEXTestsResourceWithStreamingResponse, + AsyncDEXTestsResourceWithStreamingResponse, ) from .override_codes import ( - OverrideCodes, - AsyncOverrideCodes, - OverrideCodesWithRawResponse, - AsyncOverrideCodesWithRawResponse, - OverrideCodesWithStreamingResponse, - AsyncOverrideCodesWithStreamingResponse, + OverrideCodesResource, + AsyncOverrideCodesResource, + OverrideCodesResourceWithRawResponse, + AsyncOverrideCodesResourceWithRawResponse, + OverrideCodesResourceWithStreamingResponse, + AsyncOverrideCodesResourceWithStreamingResponse, ) __all__ = [ - "DEXTests", - "AsyncDEXTests", - "DEXTestsWithRawResponse", - "AsyncDEXTestsWithRawResponse", - "DEXTestsWithStreamingResponse", - "AsyncDEXTestsWithStreamingResponse", - "Networks", - "AsyncNetworks", - "NetworksWithRawResponse", - "AsyncNetworksWithRawResponse", - "NetworksWithStreamingResponse", - "AsyncNetworksWithStreamingResponse", - "Policies", - "AsyncPolicies", - "PoliciesWithRawResponse", - "AsyncPoliciesWithRawResponse", - "PoliciesWithStreamingResponse", - "AsyncPoliciesWithStreamingResponse", - "Posture", - "AsyncPosture", - "PostureWithRawResponse", - "AsyncPostureWithRawResponse", - "PostureWithStreamingResponse", - "AsyncPostureWithStreamingResponse", - "Revoke", - "AsyncRevoke", - "RevokeWithRawResponse", - "AsyncRevokeWithRawResponse", - "RevokeWithStreamingResponse", - "AsyncRevokeWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Unrevoke", - "AsyncUnrevoke", - "UnrevokeWithRawResponse", - "AsyncUnrevokeWithRawResponse", - "UnrevokeWithStreamingResponse", - "AsyncUnrevokeWithStreamingResponse", - "OverrideCodes", - "AsyncOverrideCodes", - "OverrideCodesWithRawResponse", - "AsyncOverrideCodesWithRawResponse", - "OverrideCodesWithStreamingResponse", - "AsyncOverrideCodesWithStreamingResponse", - "Devices", - "AsyncDevices", - "DevicesWithRawResponse", - "AsyncDevicesWithRawResponse", - "DevicesWithStreamingResponse", - "AsyncDevicesWithStreamingResponse", + "DEXTestsResource", + "AsyncDEXTestsResource", + "DEXTestsResourceWithRawResponse", + "AsyncDEXTestsResourceWithRawResponse", + "DEXTestsResourceWithStreamingResponse", + "AsyncDEXTestsResourceWithStreamingResponse", + "NetworksResource", + "AsyncNetworksResource", + "NetworksResourceWithRawResponse", + "AsyncNetworksResourceWithRawResponse", + "NetworksResourceWithStreamingResponse", + "AsyncNetworksResourceWithStreamingResponse", + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", + "PostureResource", + "AsyncPostureResource", + "PostureResourceWithRawResponse", + "AsyncPostureResourceWithRawResponse", + "PostureResourceWithStreamingResponse", + "AsyncPostureResourceWithStreamingResponse", + "RevokeResource", + "AsyncRevokeResource", + "RevokeResourceWithRawResponse", + "AsyncRevokeResourceWithRawResponse", + "RevokeResourceWithStreamingResponse", + "AsyncRevokeResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "UnrevokeResource", + "AsyncUnrevokeResource", + "UnrevokeResourceWithRawResponse", + "AsyncUnrevokeResourceWithRawResponse", + "UnrevokeResourceWithStreamingResponse", + "AsyncUnrevokeResourceWithStreamingResponse", + "OverrideCodesResource", + "AsyncOverrideCodesResource", + "OverrideCodesResourceWithRawResponse", + "AsyncOverrideCodesResourceWithRawResponse", + "OverrideCodesResourceWithStreamingResponse", + "AsyncOverrideCodesResourceWithStreamingResponse", + "DevicesResource", + "AsyncDevicesResource", + "DevicesResourceWithRawResponse", + "AsyncDevicesResourceWithRawResponse", + "DevicesResourceWithStreamingResponse", + "AsyncDevicesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/devices/devices.py b/src/cloudflare/resources/zero_trust/devices/devices.py index c8462bafd41..67ff8295c8d 100644 --- a/src/cloudflare/resources/zero_trust/devices/devices.py +++ b/src/cloudflare/resources/zero_trust/devices/devices.py @@ -2,66 +2,66 @@ from __future__ import annotations -from typing import Any, Optional, cast +from typing import Any, cast import httpx from .revoke import ( - Revoke, - AsyncRevoke, - RevokeWithRawResponse, - AsyncRevokeWithRawResponse, - RevokeWithStreamingResponse, - AsyncRevokeWithStreamingResponse, + RevokeResource, + AsyncRevokeResource, + RevokeResourceWithRawResponse, + AsyncRevokeResourceWithRawResponse, + RevokeResourceWithStreamingResponse, + AsyncRevokeResourceWithStreamingResponse, ) from .posture import ( - Posture, - AsyncPosture, - PostureWithRawResponse, - AsyncPostureWithRawResponse, - PostureWithStreamingResponse, - AsyncPostureWithStreamingResponse, + PostureResource, + AsyncPostureResource, + PostureResourceWithRawResponse, + AsyncPostureResourceWithRawResponse, + PostureResourceWithStreamingResponse, + AsyncPostureResourceWithStreamingResponse, ) from .networks import ( - Networks, - AsyncNetworks, - NetworksWithRawResponse, - AsyncNetworksWithRawResponse, - NetworksWithStreamingResponse, - AsyncNetworksWithStreamingResponse, + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .unrevoke import ( - Unrevoke, - AsyncUnrevoke, - UnrevokeWithRawResponse, - AsyncUnrevokeWithRawResponse, - UnrevokeWithStreamingResponse, - AsyncUnrevokeWithStreamingResponse, + UnrevokeResource, + AsyncUnrevokeResource, + UnrevokeResourceWithRawResponse, + AsyncUnrevokeResourceWithRawResponse, + UnrevokeResourceWithStreamingResponse, + AsyncUnrevokeResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .dex_tests import ( - DEXTests, - AsyncDEXTests, - DEXTestsWithRawResponse, - AsyncDEXTestsWithRawResponse, - DEXTestsWithStreamingResponse, - AsyncDEXTestsWithStreamingResponse, + DEXTestsResource, + AsyncDEXTestsResource, + DEXTestsResourceWithRawResponse, + AsyncDEXTestsResourceWithRawResponse, + DEXTestsResourceWithStreamingResponse, + AsyncDEXTestsResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -74,64 +74,65 @@ from ...._wrappers import ResultWrapper from ....pagination import SyncSinglePage, AsyncSinglePage from .override_codes import ( - OverrideCodes, - AsyncOverrideCodes, - OverrideCodesWithRawResponse, - AsyncOverrideCodesWithRawResponse, - OverrideCodesWithStreamingResponse, - AsyncOverrideCodesWithStreamingResponse, + OverrideCodesResource, + AsyncOverrideCodesResource, + OverrideCodesResourceWithRawResponse, + AsyncOverrideCodesResourceWithRawResponse, + OverrideCodesResourceWithStreamingResponse, + AsyncOverrideCodesResourceWithStreamingResponse, ) from ...._base_client import ( AsyncPaginator, make_request_options, ) -from .posture.posture import Posture, AsyncPosture -from .policies.policies import Policies, AsyncPolicies -from ....types.zero_trust import ZeroTrustDevices, DeviceGetResponse +from .posture.posture import PostureResource, AsyncPostureResource +from .policies.policies import PoliciesResource, AsyncPoliciesResource +from ....types.zero_trust.device import Device +from ....types.zero_trust.device_get_response import DeviceGetResponse -__all__ = ["Devices", "AsyncDevices"] +__all__ = ["DevicesResource", "AsyncDevicesResource"] -class Devices(SyncAPIResource): +class DevicesResource(SyncAPIResource): @cached_property - def dex_tests(self) -> DEXTests: - return DEXTests(self._client) + def dex_tests(self) -> DEXTestsResource: + return DEXTestsResource(self._client) @cached_property - def networks(self) -> Networks: - return Networks(self._client) + def networks(self) -> NetworksResource: + return NetworksResource(self._client) @cached_property - def policies(self) -> Policies: - return Policies(self._client) + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) @cached_property - def posture(self) -> Posture: - return Posture(self._client) + def posture(self) -> PostureResource: + return PostureResource(self._client) @cached_property - def revoke(self) -> Revoke: - return Revoke(self._client) + def revoke(self) -> RevokeResource: + return RevokeResource(self._client) @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def unrevoke(self) -> Unrevoke: - return Unrevoke(self._client) + def unrevoke(self) -> UnrevokeResource: + return UnrevokeResource(self._client) @cached_property - def override_codes(self) -> OverrideCodes: - return OverrideCodes(self._client) + def override_codes(self) -> OverrideCodesResource: + return OverrideCodesResource(self._client) @cached_property - def with_raw_response(self) -> DevicesWithRawResponse: - return DevicesWithRawResponse(self) + def with_raw_response(self) -> DevicesResourceWithRawResponse: + return DevicesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DevicesWithStreamingResponse: - return DevicesWithStreamingResponse(self) + def with_streaming_response(self) -> DevicesResourceWithStreamingResponse: + return DevicesResourceWithStreamingResponse(self) def list( self, @@ -143,7 +144,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustDevices]: + ) -> SyncSinglePage[Device]: """ Fetches a list of enrolled devices. @@ -160,11 +161,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices", - page=SyncSinglePage[ZeroTrustDevices], + page=SyncSinglePage[Device], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustDevices, + model=Device, ) def get( @@ -178,7 +179,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceGetResponse]: + ) -> DeviceGetResponse: """ Fetches details for a single device. @@ -198,7 +199,7 @@ def get( if not device_id: raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") return cast( - Optional[DeviceGetResponse], + DeviceGetResponse, self._get( f"/accounts/{account_id}/devices/{device_id}", options=make_request_options( @@ -206,7 +207,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DeviceGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DeviceGetResponse] @@ -215,46 +216,46 @@ def get( ) -class AsyncDevices(AsyncAPIResource): +class AsyncDevicesResource(AsyncAPIResource): @cached_property - def dex_tests(self) -> AsyncDEXTests: - return AsyncDEXTests(self._client) + def dex_tests(self) -> AsyncDEXTestsResource: + return AsyncDEXTestsResource(self._client) @cached_property - def networks(self) -> AsyncNetworks: - return AsyncNetworks(self._client) + def networks(self) -> AsyncNetworksResource: + return AsyncNetworksResource(self._client) @cached_property - def policies(self) -> AsyncPolicies: - return AsyncPolicies(self._client) + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) @cached_property - def posture(self) -> AsyncPosture: - return AsyncPosture(self._client) + def posture(self) -> AsyncPostureResource: + return AsyncPostureResource(self._client) @cached_property - def revoke(self) -> AsyncRevoke: - return AsyncRevoke(self._client) + def revoke(self) -> AsyncRevokeResource: + return AsyncRevokeResource(self._client) @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def unrevoke(self) -> AsyncUnrevoke: - return AsyncUnrevoke(self._client) + def unrevoke(self) -> AsyncUnrevokeResource: + return AsyncUnrevokeResource(self._client) @cached_property - def override_codes(self) -> AsyncOverrideCodes: - return AsyncOverrideCodes(self._client) + def override_codes(self) -> AsyncOverrideCodesResource: + return AsyncOverrideCodesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDevicesWithRawResponse: - return AsyncDevicesWithRawResponse(self) + def with_raw_response(self) -> AsyncDevicesResourceWithRawResponse: + return AsyncDevicesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDevicesWithStreamingResponse: - return AsyncDevicesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDevicesResourceWithStreamingResponse: + return AsyncDevicesResourceWithStreamingResponse(self) def list( self, @@ -266,7 +267,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustDevices, AsyncSinglePage[ZeroTrustDevices]]: + ) -> AsyncPaginator[Device, AsyncSinglePage[Device]]: """ Fetches a list of enrolled devices. @@ -283,11 +284,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices", - page=AsyncSinglePage[ZeroTrustDevices], + page=AsyncSinglePage[Device], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustDevices, + model=Device, ) async def get( @@ -301,7 +302,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceGetResponse]: + ) -> DeviceGetResponse: """ Fetches details for a single device. @@ -321,7 +322,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 cast( - Optional[DeviceGetResponse], + DeviceGetResponse, await self._get( f"/accounts/{account_id}/devices/{device_id}", options=make_request_options( @@ -329,7 +330,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[DeviceGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DeviceGetResponse] @@ -338,8 +339,8 @@ async def get( ) -class DevicesWithRawResponse: - def __init__(self, devices: Devices) -> None: +class DevicesResourceWithRawResponse: + def __init__(self, devices: DevicesResource) -> None: self._devices = devices self.list = to_raw_response_wrapper( @@ -350,40 +351,40 @@ def __init__(self, devices: Devices) -> None: ) @cached_property - def dex_tests(self) -> DEXTestsWithRawResponse: - return DEXTestsWithRawResponse(self._devices.dex_tests) + def dex_tests(self) -> DEXTestsResourceWithRawResponse: + return DEXTestsResourceWithRawResponse(self._devices.dex_tests) @cached_property - def networks(self) -> NetworksWithRawResponse: - return NetworksWithRawResponse(self._devices.networks) + def networks(self) -> NetworksResourceWithRawResponse: + return NetworksResourceWithRawResponse(self._devices.networks) @cached_property - def policies(self) -> PoliciesWithRawResponse: - return PoliciesWithRawResponse(self._devices.policies) + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._devices.policies) @cached_property - def posture(self) -> PostureWithRawResponse: - return PostureWithRawResponse(self._devices.posture) + def posture(self) -> PostureResourceWithRawResponse: + return PostureResourceWithRawResponse(self._devices.posture) @cached_property - def revoke(self) -> RevokeWithRawResponse: - return RevokeWithRawResponse(self._devices.revoke) + def revoke(self) -> RevokeResourceWithRawResponse: + return RevokeResourceWithRawResponse(self._devices.revoke) @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._devices.settings) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._devices.settings) @cached_property - def unrevoke(self) -> UnrevokeWithRawResponse: - return UnrevokeWithRawResponse(self._devices.unrevoke) + def unrevoke(self) -> UnrevokeResourceWithRawResponse: + return UnrevokeResourceWithRawResponse(self._devices.unrevoke) @cached_property - def override_codes(self) -> OverrideCodesWithRawResponse: - return OverrideCodesWithRawResponse(self._devices.override_codes) + def override_codes(self) -> OverrideCodesResourceWithRawResponse: + return OverrideCodesResourceWithRawResponse(self._devices.override_codes) -class AsyncDevicesWithRawResponse: - def __init__(self, devices: AsyncDevices) -> None: +class AsyncDevicesResourceWithRawResponse: + def __init__(self, devices: AsyncDevicesResource) -> None: self._devices = devices self.list = async_to_raw_response_wrapper( @@ -394,40 +395,40 @@ def __init__(self, devices: AsyncDevices) -> None: ) @cached_property - def dex_tests(self) -> AsyncDEXTestsWithRawResponse: - return AsyncDEXTestsWithRawResponse(self._devices.dex_tests) + def dex_tests(self) -> AsyncDEXTestsResourceWithRawResponse: + return AsyncDEXTestsResourceWithRawResponse(self._devices.dex_tests) @cached_property - def networks(self) -> AsyncNetworksWithRawResponse: - return AsyncNetworksWithRawResponse(self._devices.networks) + def networks(self) -> AsyncNetworksResourceWithRawResponse: + return AsyncNetworksResourceWithRawResponse(self._devices.networks) @cached_property - def policies(self) -> AsyncPoliciesWithRawResponse: - return AsyncPoliciesWithRawResponse(self._devices.policies) + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._devices.policies) @cached_property - def posture(self) -> AsyncPostureWithRawResponse: - return AsyncPostureWithRawResponse(self._devices.posture) + def posture(self) -> AsyncPostureResourceWithRawResponse: + return AsyncPostureResourceWithRawResponse(self._devices.posture) @cached_property - def revoke(self) -> AsyncRevokeWithRawResponse: - return AsyncRevokeWithRawResponse(self._devices.revoke) + def revoke(self) -> AsyncRevokeResourceWithRawResponse: + return AsyncRevokeResourceWithRawResponse(self._devices.revoke) @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._devices.settings) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._devices.settings) @cached_property - def unrevoke(self) -> AsyncUnrevokeWithRawResponse: - return AsyncUnrevokeWithRawResponse(self._devices.unrevoke) + def unrevoke(self) -> AsyncUnrevokeResourceWithRawResponse: + return AsyncUnrevokeResourceWithRawResponse(self._devices.unrevoke) @cached_property - def override_codes(self) -> AsyncOverrideCodesWithRawResponse: - return AsyncOverrideCodesWithRawResponse(self._devices.override_codes) + def override_codes(self) -> AsyncOverrideCodesResourceWithRawResponse: + return AsyncOverrideCodesResourceWithRawResponse(self._devices.override_codes) -class DevicesWithStreamingResponse: - def __init__(self, devices: Devices) -> None: +class DevicesResourceWithStreamingResponse: + def __init__(self, devices: DevicesResource) -> None: self._devices = devices self.list = to_streamed_response_wrapper( @@ -438,40 +439,40 @@ def __init__(self, devices: Devices) -> None: ) @cached_property - def dex_tests(self) -> DEXTestsWithStreamingResponse: - return DEXTestsWithStreamingResponse(self._devices.dex_tests) + def dex_tests(self) -> DEXTestsResourceWithStreamingResponse: + return DEXTestsResourceWithStreamingResponse(self._devices.dex_tests) @cached_property - def networks(self) -> NetworksWithStreamingResponse: - return NetworksWithStreamingResponse(self._devices.networks) + def networks(self) -> NetworksResourceWithStreamingResponse: + return NetworksResourceWithStreamingResponse(self._devices.networks) @cached_property - def policies(self) -> PoliciesWithStreamingResponse: - return PoliciesWithStreamingResponse(self._devices.policies) + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._devices.policies) @cached_property - def posture(self) -> PostureWithStreamingResponse: - return PostureWithStreamingResponse(self._devices.posture) + def posture(self) -> PostureResourceWithStreamingResponse: + return PostureResourceWithStreamingResponse(self._devices.posture) @cached_property - def revoke(self) -> RevokeWithStreamingResponse: - return RevokeWithStreamingResponse(self._devices.revoke) + def revoke(self) -> RevokeResourceWithStreamingResponse: + return RevokeResourceWithStreamingResponse(self._devices.revoke) @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._devices.settings) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._devices.settings) @cached_property - def unrevoke(self) -> UnrevokeWithStreamingResponse: - return UnrevokeWithStreamingResponse(self._devices.unrevoke) + def unrevoke(self) -> UnrevokeResourceWithStreamingResponse: + return UnrevokeResourceWithStreamingResponse(self._devices.unrevoke) @cached_property - def override_codes(self) -> OverrideCodesWithStreamingResponse: - return OverrideCodesWithStreamingResponse(self._devices.override_codes) + def override_codes(self) -> OverrideCodesResourceWithStreamingResponse: + return OverrideCodesResourceWithStreamingResponse(self._devices.override_codes) -class AsyncDevicesWithStreamingResponse: - def __init__(self, devices: AsyncDevices) -> None: +class AsyncDevicesResourceWithStreamingResponse: + def __init__(self, devices: AsyncDevicesResource) -> None: self._devices = devices self.list = async_to_streamed_response_wrapper( @@ -482,33 +483,33 @@ def __init__(self, devices: AsyncDevices) -> None: ) @cached_property - def dex_tests(self) -> AsyncDEXTestsWithStreamingResponse: - return AsyncDEXTestsWithStreamingResponse(self._devices.dex_tests) + def dex_tests(self) -> AsyncDEXTestsResourceWithStreamingResponse: + return AsyncDEXTestsResourceWithStreamingResponse(self._devices.dex_tests) @cached_property - def networks(self) -> AsyncNetworksWithStreamingResponse: - return AsyncNetworksWithStreamingResponse(self._devices.networks) + def networks(self) -> AsyncNetworksResourceWithStreamingResponse: + return AsyncNetworksResourceWithStreamingResponse(self._devices.networks) @cached_property - def policies(self) -> AsyncPoliciesWithStreamingResponse: - return AsyncPoliciesWithStreamingResponse(self._devices.policies) + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._devices.policies) @cached_property - def posture(self) -> AsyncPostureWithStreamingResponse: - return AsyncPostureWithStreamingResponse(self._devices.posture) + def posture(self) -> AsyncPostureResourceWithStreamingResponse: + return AsyncPostureResourceWithStreamingResponse(self._devices.posture) @cached_property - def revoke(self) -> AsyncRevokeWithStreamingResponse: - return AsyncRevokeWithStreamingResponse(self._devices.revoke) + def revoke(self) -> AsyncRevokeResourceWithStreamingResponse: + return AsyncRevokeResourceWithStreamingResponse(self._devices.revoke) @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._devices.settings) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._devices.settings) @cached_property - def unrevoke(self) -> AsyncUnrevokeWithStreamingResponse: - return AsyncUnrevokeWithStreamingResponse(self._devices.unrevoke) + def unrevoke(self) -> AsyncUnrevokeResourceWithStreamingResponse: + return AsyncUnrevokeResourceWithStreamingResponse(self._devices.unrevoke) @cached_property - def override_codes(self) -> AsyncOverrideCodesWithStreamingResponse: - return AsyncOverrideCodesWithStreamingResponse(self._devices.override_codes) + def override_codes(self) -> AsyncOverrideCodesResourceWithStreamingResponse: + return AsyncOverrideCodesResourceWithStreamingResponse(self._devices.override_codes) diff --git a/src/cloudflare/resources/zero_trust/devices/dex_tests.py b/src/cloudflare/resources/zero_trust/devices/dex_tests.py index 65ad0e65432..63f779e24ad 100644 --- a/src/cloudflare/resources/zero_trust/devices/dex_tests.py +++ b/src/cloudflare/resources/zero_trust/devices/dex_tests.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, Iterable, Optional, cast import httpx @@ -25,41 +25,41 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.devices import ( - DEXTestSchemasHTTP, - DEXTestDeleteResponse, - dex_test_create_params, - dex_test_update_params, -) +from ....types.zero_trust.devices import dex_test_create_params, dex_test_update_params +from ....types.zero_trust.devices.schema_http import SchemaHTTP +from ....types.zero_trust.devices.schema_data_param import SchemaDataParam +from ....types.zero_trust.devices.dex_test_delete_response import DEXTestDeleteResponse -__all__ = ["DEXTests", "AsyncDEXTests"] +__all__ = ["DEXTestsResource", "AsyncDEXTestsResource"] -class DEXTests(SyncAPIResource): +class DEXTestsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DEXTestsWithRawResponse: - return DEXTestsWithRawResponse(self) + def with_raw_response(self) -> DEXTestsResourceWithRawResponse: + return DEXTestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DEXTestsWithStreamingResponse: - return DEXTestsWithStreamingResponse(self) + def with_streaming_response(self) -> DEXTestsResourceWithStreamingResponse: + return DEXTestsResourceWithStreamingResponse(self) def create( self, *, account_id: str, - data: dex_test_create_params.Data, + data: SchemaDataParam, enabled: bool, interval: str, name: str, description: str | NotGiven = NOT_GIVEN, + target_policies: Iterable[dex_test_create_params.TargetPolicy] | NotGiven = NOT_GIVEN, + targeted: 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, - ) -> Optional[DEXTestSchemasHTTP]: + ) -> Optional[SchemaHTTP]: """ Create a DEX test. @@ -75,6 +75,8 @@ def create( description: Additional details about the test. + target_policies: Device settings profiles targeted by this test + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -94,6 +96,8 @@ def create( "interval": interval, "name": name, "description": description, + "target_policies": target_policies, + "targeted": targeted, }, dex_test_create_params.DEXTestCreateParams, ), @@ -102,9 +106,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SchemaHTTP]]._unwrapper, ), - cast_to=cast(Type[Optional[DEXTestSchemasHTTP]], ResultWrapper[DEXTestSchemasHTTP]), + cast_to=cast(Type[Optional[SchemaHTTP]], ResultWrapper[SchemaHTTP]), ) def update( @@ -112,18 +116,20 @@ def update( dex_test_id: str, *, account_id: str, - data: dex_test_update_params.Data, + data: SchemaDataParam, enabled: bool, interval: str, name: str, description: str | NotGiven = NOT_GIVEN, + target_policies: Iterable[dex_test_update_params.TargetPolicy] | NotGiven = NOT_GIVEN, + targeted: 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, - ) -> Optional[DEXTestSchemasHTTP]: + ) -> Optional[SchemaHTTP]: """ Update a DEX test. @@ -141,6 +147,8 @@ def update( description: Additional details about the test. + target_policies: Device settings profiles targeted by this test + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -162,6 +170,8 @@ def update( "interval": interval, "name": name, "description": description, + "target_policies": target_policies, + "targeted": targeted, }, dex_test_update_params.DEXTestUpdateParams, ), @@ -170,9 +180,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SchemaHTTP]]._unwrapper, ), - cast_to=cast(Type[Optional[DEXTestSchemasHTTP]], ResultWrapper[DEXTestSchemasHTTP]), + cast_to=cast(Type[Optional[SchemaHTTP]], ResultWrapper[SchemaHTTP]), ) def list( @@ -185,7 +195,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DEXTestSchemasHTTP]: + ) -> SyncSinglePage[SchemaHTTP]: """ Fetch all DEX tests. @@ -202,11 +212,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/dex_tests", - page=SyncSinglePage[DEXTestSchemasHTTP], + page=SyncSinglePage[SchemaHTTP], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DEXTestSchemasHTTP, + model=SchemaHTTP, ) def delete( @@ -248,7 +258,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DEXTestDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[DEXTestDeleteResponse]], ResultWrapper[DEXTestDeleteResponse]), ) @@ -264,7 +274,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DEXTestSchemasHTTP]: + ) -> Optional[SchemaHTTP]: """ Fetch a single DEX test. @@ -290,37 +300,39 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SchemaHTTP]]._unwrapper, ), - cast_to=cast(Type[Optional[DEXTestSchemasHTTP]], ResultWrapper[DEXTestSchemasHTTP]), + cast_to=cast(Type[Optional[SchemaHTTP]], ResultWrapper[SchemaHTTP]), ) -class AsyncDEXTests(AsyncAPIResource): +class AsyncDEXTestsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDEXTestsWithRawResponse: - return AsyncDEXTestsWithRawResponse(self) + def with_raw_response(self) -> AsyncDEXTestsResourceWithRawResponse: + return AsyncDEXTestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDEXTestsWithStreamingResponse: - return AsyncDEXTestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDEXTestsResourceWithStreamingResponse: + return AsyncDEXTestsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, - data: dex_test_create_params.Data, + data: SchemaDataParam, enabled: bool, interval: str, name: str, description: str | NotGiven = NOT_GIVEN, + target_policies: Iterable[dex_test_create_params.TargetPolicy] | NotGiven = NOT_GIVEN, + targeted: 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, - ) -> Optional[DEXTestSchemasHTTP]: + ) -> Optional[SchemaHTTP]: """ Create a DEX test. @@ -336,6 +348,8 @@ async def create( description: Additional details about the test. + target_policies: Device settings profiles targeted by this test + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -355,6 +369,8 @@ async def create( "interval": interval, "name": name, "description": description, + "target_policies": target_policies, + "targeted": targeted, }, dex_test_create_params.DEXTestCreateParams, ), @@ -363,9 +379,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SchemaHTTP]]._unwrapper, ), - cast_to=cast(Type[Optional[DEXTestSchemasHTTP]], ResultWrapper[DEXTestSchemasHTTP]), + cast_to=cast(Type[Optional[SchemaHTTP]], ResultWrapper[SchemaHTTP]), ) async def update( @@ -373,18 +389,20 @@ async def update( dex_test_id: str, *, account_id: str, - data: dex_test_update_params.Data, + data: SchemaDataParam, enabled: bool, interval: str, name: str, description: str | NotGiven = NOT_GIVEN, + target_policies: Iterable[dex_test_update_params.TargetPolicy] | NotGiven = NOT_GIVEN, + targeted: 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, - ) -> Optional[DEXTestSchemasHTTP]: + ) -> Optional[SchemaHTTP]: """ Update a DEX test. @@ -402,6 +420,8 @@ async def update( description: Additional details about the test. + target_policies: Device settings profiles targeted by this test + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -423,6 +443,8 @@ async def update( "interval": interval, "name": name, "description": description, + "target_policies": target_policies, + "targeted": targeted, }, dex_test_update_params.DEXTestUpdateParams, ), @@ -431,9 +453,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SchemaHTTP]]._unwrapper, ), - cast_to=cast(Type[Optional[DEXTestSchemasHTTP]], ResultWrapper[DEXTestSchemasHTTP]), + cast_to=cast(Type[Optional[SchemaHTTP]], ResultWrapper[SchemaHTTP]), ) def list( @@ -446,7 +468,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DEXTestSchemasHTTP, AsyncSinglePage[DEXTestSchemasHTTP]]: + ) -> AsyncPaginator[SchemaHTTP, AsyncSinglePage[SchemaHTTP]]: """ Fetch all DEX tests. @@ -463,11 +485,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/dex_tests", - page=AsyncSinglePage[DEXTestSchemasHTTP], + page=AsyncSinglePage[SchemaHTTP], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DEXTestSchemasHTTP, + model=SchemaHTTP, ) async def delete( @@ -509,7 +531,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DEXTestDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[DEXTestDeleteResponse]], ResultWrapper[DEXTestDeleteResponse]), ) @@ -525,7 +547,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DEXTestSchemasHTTP]: + ) -> Optional[SchemaHTTP]: """ Fetch a single DEX test. @@ -551,14 +573,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SchemaHTTP]]._unwrapper, ), - cast_to=cast(Type[Optional[DEXTestSchemasHTTP]], ResultWrapper[DEXTestSchemasHTTP]), + cast_to=cast(Type[Optional[SchemaHTTP]], ResultWrapper[SchemaHTTP]), ) -class DEXTestsWithRawResponse: - def __init__(self, dex_tests: DEXTests) -> None: +class DEXTestsResourceWithRawResponse: + def __init__(self, dex_tests: DEXTestsResource) -> None: self._dex_tests = dex_tests self.create = to_raw_response_wrapper( @@ -578,8 +600,8 @@ def __init__(self, dex_tests: DEXTests) -> None: ) -class AsyncDEXTestsWithRawResponse: - def __init__(self, dex_tests: AsyncDEXTests) -> None: +class AsyncDEXTestsResourceWithRawResponse: + def __init__(self, dex_tests: AsyncDEXTestsResource) -> None: self._dex_tests = dex_tests self.create = async_to_raw_response_wrapper( @@ -599,8 +621,8 @@ def __init__(self, dex_tests: AsyncDEXTests) -> None: ) -class DEXTestsWithStreamingResponse: - def __init__(self, dex_tests: DEXTests) -> None: +class DEXTestsResourceWithStreamingResponse: + def __init__(self, dex_tests: DEXTestsResource) -> None: self._dex_tests = dex_tests self.create = to_streamed_response_wrapper( @@ -620,8 +642,8 @@ def __init__(self, dex_tests: DEXTests) -> None: ) -class AsyncDEXTestsWithStreamingResponse: - def __init__(self, dex_tests: AsyncDEXTests) -> None: +class AsyncDEXTestsResourceWithStreamingResponse: + def __init__(self, dex_tests: AsyncDEXTestsResource) -> None: self._dex_tests = dex_tests self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/networks.py b/src/cloudflare/resources/zero_trust/devices/networks.py index 0e1f3328fea..645114237fe 100644 --- a/src/cloudflare/resources/zero_trust/devices/networks.py +++ b/src/cloudflare/resources/zero_trust/devices/networks.py @@ -26,24 +26,21 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.devices import ( - DeviceManagedNetworks, - NetworkDeleteResponse, - network_create_params, - network_update_params, -) +from ....types.zero_trust.devices import network_create_params, network_delete_params, network_update_params +from ....types.zero_trust.devices.device_network import DeviceNetwork +from ....types.zero_trust.devices.network_delete_response import NetworkDeleteResponse -__all__ = ["Networks", "AsyncNetworks"] +__all__ = ["NetworksResource", "AsyncNetworksResource"] -class Networks(SyncAPIResource): +class NetworksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> NetworksWithRawResponse: - return NetworksWithRawResponse(self) + def with_raw_response(self) -> NetworksResourceWithRawResponse: + return NetworksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NetworksWithStreamingResponse: - return NetworksWithStreamingResponse(self) + def with_streaming_response(self) -> NetworksResourceWithStreamingResponse: + return NetworksResourceWithStreamingResponse(self) def create( self, @@ -58,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceManagedNetworks]: + ) -> Optional[DeviceNetwork]: """ Creates a new device managed network. @@ -95,9 +92,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceNetwork]]._unwrapper, ), - cast_to=cast(Type[Optional[DeviceManagedNetworks]], ResultWrapper[DeviceManagedNetworks]), + cast_to=cast(Type[Optional[DeviceNetwork]], ResultWrapper[DeviceNetwork]), ) def update( @@ -114,7 +111,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceManagedNetworks]: + ) -> Optional[DeviceNetwork]: """ Updates a configured device managed network. @@ -155,9 +152,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceNetwork]]._unwrapper, ), - cast_to=cast(Type[Optional[DeviceManagedNetworks]], ResultWrapper[DeviceManagedNetworks]), + cast_to=cast(Type[Optional[DeviceNetwork]], ResultWrapper[DeviceNetwork]), ) def list( @@ -170,7 +167,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DeviceManagedNetworks]: + ) -> SyncSinglePage[DeviceNetwork]: """ Fetches a list of managed networks for an account. @@ -187,11 +184,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/networks", - page=SyncSinglePage[DeviceManagedNetworks], + page=SyncSinglePage[DeviceNetwork], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DeviceManagedNetworks, + model=DeviceNetwork, ) def delete( @@ -199,6 +196,7 @@ def delete( network_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -227,12 +225,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( f"/accounts/{account_id}/devices/networks/{network_id}", + body=maybe_transform(body, network_delete_params.NetworkDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NetworkDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[NetworkDeleteResponse]], ResultWrapper[NetworkDeleteResponse]), ) @@ -248,7 +247,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceManagedNetworks]: + ) -> Optional[DeviceNetwork]: """ Fetches details for a single managed network. @@ -274,20 +273,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceNetwork]]._unwrapper, ), - cast_to=cast(Type[Optional[DeviceManagedNetworks]], ResultWrapper[DeviceManagedNetworks]), + cast_to=cast(Type[Optional[DeviceNetwork]], ResultWrapper[DeviceNetwork]), ) -class AsyncNetworks(AsyncAPIResource): +class AsyncNetworksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncNetworksWithRawResponse: - return AsyncNetworksWithRawResponse(self) + def with_raw_response(self) -> AsyncNetworksResourceWithRawResponse: + return AsyncNetworksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNetworksWithStreamingResponse: - return AsyncNetworksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNetworksResourceWithStreamingResponse: + return AsyncNetworksResourceWithStreamingResponse(self) async def create( self, @@ -302,7 +301,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceManagedNetworks]: + ) -> Optional[DeviceNetwork]: """ Creates a new device managed network. @@ -339,9 +338,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceNetwork]]._unwrapper, ), - cast_to=cast(Type[Optional[DeviceManagedNetworks]], ResultWrapper[DeviceManagedNetworks]), + cast_to=cast(Type[Optional[DeviceNetwork]], ResultWrapper[DeviceNetwork]), ) async def update( @@ -358,7 +357,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceManagedNetworks]: + ) -> Optional[DeviceNetwork]: """ Updates a configured device managed network. @@ -399,9 +398,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceNetwork]]._unwrapper, ), - cast_to=cast(Type[Optional[DeviceManagedNetworks]], ResultWrapper[DeviceManagedNetworks]), + cast_to=cast(Type[Optional[DeviceNetwork]], ResultWrapper[DeviceNetwork]), ) def list( @@ -414,7 +413,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DeviceManagedNetworks, AsyncSinglePage[DeviceManagedNetworks]]: + ) -> AsyncPaginator[DeviceNetwork, AsyncSinglePage[DeviceNetwork]]: """ Fetches a list of managed networks for an account. @@ -431,11 +430,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/networks", - page=AsyncSinglePage[DeviceManagedNetworks], + page=AsyncSinglePage[DeviceNetwork], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DeviceManagedNetworks, + model=DeviceNetwork, ) async def delete( @@ -443,6 +442,7 @@ async def delete( network_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -471,12 +471,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( f"/accounts/{account_id}/devices/networks/{network_id}", + body=await async_maybe_transform(body, network_delete_params.NetworkDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NetworkDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[NetworkDeleteResponse]], ResultWrapper[NetworkDeleteResponse]), ) @@ -492,7 +493,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceManagedNetworks]: + ) -> Optional[DeviceNetwork]: """ Fetches details for a single managed network. @@ -518,14 +519,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceNetwork]]._unwrapper, ), - cast_to=cast(Type[Optional[DeviceManagedNetworks]], ResultWrapper[DeviceManagedNetworks]), + cast_to=cast(Type[Optional[DeviceNetwork]], ResultWrapper[DeviceNetwork]), ) -class NetworksWithRawResponse: - def __init__(self, networks: Networks) -> None: +class NetworksResourceWithRawResponse: + def __init__(self, networks: NetworksResource) -> None: self._networks = networks self.create = to_raw_response_wrapper( @@ -545,8 +546,8 @@ def __init__(self, networks: Networks) -> None: ) -class AsyncNetworksWithRawResponse: - def __init__(self, networks: AsyncNetworks) -> None: +class AsyncNetworksResourceWithRawResponse: + def __init__(self, networks: AsyncNetworksResource) -> None: self._networks = networks self.create = async_to_raw_response_wrapper( @@ -566,8 +567,8 @@ def __init__(self, networks: AsyncNetworks) -> None: ) -class NetworksWithStreamingResponse: - def __init__(self, networks: Networks) -> None: +class NetworksResourceWithStreamingResponse: + def __init__(self, networks: NetworksResource) -> None: self._networks = networks self.create = to_streamed_response_wrapper( @@ -587,8 +588,8 @@ def __init__(self, networks: Networks) -> None: ) -class AsyncNetworksWithStreamingResponse: - def __init__(self, networks: AsyncNetworks) -> None: +class AsyncNetworksResourceWithStreamingResponse: + def __init__(self, networks: AsyncNetworksResource) -> None: self._networks = networks self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/override_codes.py b/src/cloudflare/resources/zero_trust/devices/override_codes.py index af2ce33f15c..bd6353f2f46 100644 --- a/src/cloudflare/resources/zero_trust/devices/override_codes.py +++ b/src/cloudflare/resources/zero_trust/devices/override_codes.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.devices import OverrideCodeListResponse +from ....types.zero_trust.devices.override_code_list_response import OverrideCodeListResponse -__all__ = ["OverrideCodes", "AsyncOverrideCodes"] +__all__ = ["OverrideCodesResource", "AsyncOverrideCodesResource"] -class OverrideCodes(SyncAPIResource): +class OverrideCodesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OverrideCodesWithRawResponse: - return OverrideCodesWithRawResponse(self) + def with_raw_response(self) -> OverrideCodesResourceWithRawResponse: + return OverrideCodesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OverrideCodesWithStreamingResponse: - return OverrideCodesWithStreamingResponse(self) + def with_streaming_response(self) -> OverrideCodesResourceWithStreamingResponse: + return OverrideCodesResourceWithStreamingResponse(self) def list( self, @@ -72,20 +72,20 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OverrideCodeListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[OverrideCodeListResponse]], ResultWrapper[OverrideCodeListResponse]), ) -class AsyncOverrideCodes(AsyncAPIResource): +class AsyncOverrideCodesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOverrideCodesWithRawResponse: - return AsyncOverrideCodesWithRawResponse(self) + def with_raw_response(self) -> AsyncOverrideCodesResourceWithRawResponse: + return AsyncOverrideCodesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOverrideCodesWithStreamingResponse: - return AsyncOverrideCodesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOverrideCodesResourceWithStreamingResponse: + return AsyncOverrideCodesResourceWithStreamingResponse(self) async def list( self, @@ -126,14 +126,14 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OverrideCodeListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[OverrideCodeListResponse]], ResultWrapper[OverrideCodeListResponse]), ) -class OverrideCodesWithRawResponse: - def __init__(self, override_codes: OverrideCodes) -> None: +class OverrideCodesResourceWithRawResponse: + def __init__(self, override_codes: OverrideCodesResource) -> None: self._override_codes = override_codes self.list = to_raw_response_wrapper( @@ -141,8 +141,8 @@ def __init__(self, override_codes: OverrideCodes) -> None: ) -class AsyncOverrideCodesWithRawResponse: - def __init__(self, override_codes: AsyncOverrideCodes) -> None: +class AsyncOverrideCodesResourceWithRawResponse: + def __init__(self, override_codes: AsyncOverrideCodesResource) -> None: self._override_codes = override_codes self.list = async_to_raw_response_wrapper( @@ -150,8 +150,8 @@ def __init__(self, override_codes: AsyncOverrideCodes) -> None: ) -class OverrideCodesWithStreamingResponse: - def __init__(self, override_codes: OverrideCodes) -> None: +class OverrideCodesResourceWithStreamingResponse: + def __init__(self, override_codes: OverrideCodesResource) -> None: self._override_codes = override_codes self.list = to_streamed_response_wrapper( @@ -159,8 +159,8 @@ def __init__(self, override_codes: OverrideCodes) -> None: ) -class AsyncOverrideCodesWithStreamingResponse: - def __init__(self, override_codes: AsyncOverrideCodes) -> None: +class AsyncOverrideCodesResourceWithStreamingResponse: + def __init__(self, override_codes: AsyncOverrideCodesResource) -> None: self._override_codes = override_codes self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/__init__.py b/src/cloudflare/resources/zero_trust/devices/policies/__init__.py index 42ddfaf9516..31e6fce91a4 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/__init__.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .excludes import ( - Excludes, - AsyncExcludes, - ExcludesWithRawResponse, - AsyncExcludesWithRawResponse, - ExcludesWithStreamingResponse, - AsyncExcludesWithStreamingResponse, + ExcludesResource, + AsyncExcludesResource, + ExcludesResourceWithRawResponse, + AsyncExcludesResourceWithRawResponse, + ExcludesResourceWithStreamingResponse, + AsyncExcludesResourceWithStreamingResponse, ) from .includes import ( - Includes, - AsyncIncludes, - IncludesWithRawResponse, - AsyncIncludesWithRawResponse, - IncludesWithStreamingResponse, - AsyncIncludesWithStreamingResponse, + IncludesResource, + AsyncIncludesResource, + IncludesResourceWithRawResponse, + AsyncIncludesResourceWithRawResponse, + IncludesResourceWithStreamingResponse, + AsyncIncludesResourceWithStreamingResponse, ) from .policies import ( - Policies, - AsyncPolicies, - PoliciesWithRawResponse, - AsyncPoliciesWithRawResponse, - PoliciesWithStreamingResponse, - AsyncPoliciesWithStreamingResponse, + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from .default_policy import ( - DefaultPolicy, - AsyncDefaultPolicy, - DefaultPolicyWithRawResponse, - AsyncDefaultPolicyWithRawResponse, - DefaultPolicyWithStreamingResponse, - AsyncDefaultPolicyWithStreamingResponse, + DefaultPolicyResource, + AsyncDefaultPolicyResource, + DefaultPolicyResourceWithRawResponse, + AsyncDefaultPolicyResourceWithRawResponse, + DefaultPolicyResourceWithStreamingResponse, + AsyncDefaultPolicyResourceWithStreamingResponse, ) from .fallback_domains import ( - FallbackDomains, - AsyncFallbackDomains, - FallbackDomainsWithRawResponse, - AsyncFallbackDomainsWithRawResponse, - FallbackDomainsWithStreamingResponse, - AsyncFallbackDomainsWithStreamingResponse, + FallbackDomainsResource, + AsyncFallbackDomainsResource, + FallbackDomainsResourceWithRawResponse, + AsyncFallbackDomainsResourceWithRawResponse, + FallbackDomainsResourceWithStreamingResponse, + AsyncFallbackDomainsResourceWithStreamingResponse, ) __all__ = [ - "DefaultPolicy", - "AsyncDefaultPolicy", - "DefaultPolicyWithRawResponse", - "AsyncDefaultPolicyWithRawResponse", - "DefaultPolicyWithStreamingResponse", - "AsyncDefaultPolicyWithStreamingResponse", - "Excludes", - "AsyncExcludes", - "ExcludesWithRawResponse", - "AsyncExcludesWithRawResponse", - "ExcludesWithStreamingResponse", - "AsyncExcludesWithStreamingResponse", - "FallbackDomains", - "AsyncFallbackDomains", - "FallbackDomainsWithRawResponse", - "AsyncFallbackDomainsWithRawResponse", - "FallbackDomainsWithStreamingResponse", - "AsyncFallbackDomainsWithStreamingResponse", - "Includes", - "AsyncIncludes", - "IncludesWithRawResponse", - "AsyncIncludesWithRawResponse", - "IncludesWithStreamingResponse", - "AsyncIncludesWithStreamingResponse", - "Policies", - "AsyncPolicies", - "PoliciesWithRawResponse", - "AsyncPoliciesWithRawResponse", - "PoliciesWithStreamingResponse", - "AsyncPoliciesWithStreamingResponse", + "DefaultPolicyResource", + "AsyncDefaultPolicyResource", + "DefaultPolicyResourceWithRawResponse", + "AsyncDefaultPolicyResourceWithRawResponse", + "DefaultPolicyResourceWithStreamingResponse", + "AsyncDefaultPolicyResourceWithStreamingResponse", + "ExcludesResource", + "AsyncExcludesResource", + "ExcludesResourceWithRawResponse", + "AsyncExcludesResourceWithRawResponse", + "ExcludesResourceWithStreamingResponse", + "AsyncExcludesResourceWithStreamingResponse", + "FallbackDomainsResource", + "AsyncFallbackDomainsResource", + "FallbackDomainsResourceWithRawResponse", + "AsyncFallbackDomainsResourceWithRawResponse", + "FallbackDomainsResourceWithStreamingResponse", + "AsyncFallbackDomainsResourceWithStreamingResponse", + "IncludesResource", + "AsyncIncludesResource", + "IncludesResourceWithRawResponse", + "AsyncIncludesResourceWithRawResponse", + "IncludesResourceWithStreamingResponse", + "AsyncIncludesResourceWithStreamingResponse", + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/devices/policies/default_policy.py b/src/cloudflare/resources/zero_trust/devices/policies/default_policy.py index e2c2488da63..b14defafd12 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/default_policy.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/default_policy.py @@ -19,19 +19,19 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.devices.policies import DefaultPolicyGetResponse +from .....types.zero_trust.devices.policies.default_policy_get_response import DefaultPolicyGetResponse -__all__ = ["DefaultPolicy", "AsyncDefaultPolicy"] +__all__ = ["DefaultPolicyResource", "AsyncDefaultPolicyResource"] -class DefaultPolicy(SyncAPIResource): +class DefaultPolicyResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DefaultPolicyWithRawResponse: - return DefaultPolicyWithRawResponse(self) + def with_raw_response(self) -> DefaultPolicyResourceWithRawResponse: + return DefaultPolicyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DefaultPolicyWithStreamingResponse: - return DefaultPolicyWithStreamingResponse(self) + def with_streaming_response(self) -> DefaultPolicyResourceWithStreamingResponse: + return DefaultPolicyResourceWithStreamingResponse(self) def get( self, @@ -65,20 +65,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DefaultPolicyGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[DefaultPolicyGetResponse]], ResultWrapper[DefaultPolicyGetResponse]), ) -class AsyncDefaultPolicy(AsyncAPIResource): +class AsyncDefaultPolicyResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDefaultPolicyWithRawResponse: - return AsyncDefaultPolicyWithRawResponse(self) + def with_raw_response(self) -> AsyncDefaultPolicyResourceWithRawResponse: + return AsyncDefaultPolicyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDefaultPolicyWithStreamingResponse: - return AsyncDefaultPolicyWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDefaultPolicyResourceWithStreamingResponse: + return AsyncDefaultPolicyResourceWithStreamingResponse(self) async def get( self, @@ -112,14 +112,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DefaultPolicyGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[DefaultPolicyGetResponse]], ResultWrapper[DefaultPolicyGetResponse]), ) -class DefaultPolicyWithRawResponse: - def __init__(self, default_policy: DefaultPolicy) -> None: +class DefaultPolicyResourceWithRawResponse: + def __init__(self, default_policy: DefaultPolicyResource) -> None: self._default_policy = default_policy self.get = to_raw_response_wrapper( @@ -127,8 +127,8 @@ def __init__(self, default_policy: DefaultPolicy) -> None: ) -class AsyncDefaultPolicyWithRawResponse: - def __init__(self, default_policy: AsyncDefaultPolicy) -> None: +class AsyncDefaultPolicyResourceWithRawResponse: + def __init__(self, default_policy: AsyncDefaultPolicyResource) -> None: self._default_policy = default_policy self.get = async_to_raw_response_wrapper( @@ -136,8 +136,8 @@ def __init__(self, default_policy: AsyncDefaultPolicy) -> None: ) -class DefaultPolicyWithStreamingResponse: - def __init__(self, default_policy: DefaultPolicy) -> None: +class DefaultPolicyResourceWithStreamingResponse: + def __init__(self, default_policy: DefaultPolicyResource) -> None: self._default_policy = default_policy self.get = to_streamed_response_wrapper( @@ -145,8 +145,8 @@ def __init__(self, default_policy: DefaultPolicy) -> None: ) -class AsyncDefaultPolicyWithStreamingResponse: - def __init__(self, default_policy: AsyncDefaultPolicy) -> None: +class AsyncDefaultPolicyResourceWithStreamingResponse: + def __init__(self, default_policy: AsyncDefaultPolicyResource) -> None: self._default_policy = default_policy self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/excludes.py b/src/cloudflare/resources/zero_trust/devices/policies/excludes.py index 9ee1ea2922b..c72143a1b7c 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/excludes.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/excludes.py @@ -25,31 +25,29 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.devices.policies import ( - DevicesSplitTunnel, - ExcludeGetResponse, - ExcludeUpdateResponse, - DevicesSplitTunnelParam, - exclude_update_params, -) +from .....types.zero_trust.devices.policies import exclude_update_params +from .....types.zero_trust.devices.policies.exclude_get_response import ExcludeGetResponse +from .....types.zero_trust.devices.policies.split_tunnel_exclude import SplitTunnelExclude +from .....types.zero_trust.devices.policies.exclude_update_response import ExcludeUpdateResponse +from .....types.zero_trust.devices.policies.split_tunnel_exclude_param import SplitTunnelExcludeParam -__all__ = ["Excludes", "AsyncExcludes"] +__all__ = ["ExcludesResource", "AsyncExcludesResource"] -class Excludes(SyncAPIResource): +class ExcludesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ExcludesWithRawResponse: - return ExcludesWithRawResponse(self) + def with_raw_response(self) -> ExcludesResourceWithRawResponse: + return ExcludesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ExcludesWithStreamingResponse: - return ExcludesWithStreamingResponse(self) + def with_streaming_response(self) -> ExcludesResourceWithStreamingResponse: + return ExcludesResourceWithStreamingResponse(self) def update( self, *, account_id: str, - body: Iterable[DevicesSplitTunnelParam], + body: Iterable[SplitTunnelExcludeParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -79,7 +77,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ExcludeUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ExcludeUpdateResponse]], ResultWrapper[ExcludeUpdateResponse]), ) @@ -94,7 +92,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DevicesSplitTunnel]: + ) -> SyncSinglePage[SplitTunnelExclude]: """ Fetches the list of routes excluded from the WARP client's tunnel. @@ -111,11 +109,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/policy/exclude", - page=SyncSinglePage[DevicesSplitTunnel], + page=SyncSinglePage[SplitTunnelExclude], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicesSplitTunnel, + model=SplitTunnelExclude, ) def get( @@ -156,26 +154,26 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ExcludeGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ExcludeGetResponse]], ResultWrapper[ExcludeGetResponse]), ) -class AsyncExcludes(AsyncAPIResource): +class AsyncExcludesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncExcludesWithRawResponse: - return AsyncExcludesWithRawResponse(self) + def with_raw_response(self) -> AsyncExcludesResourceWithRawResponse: + return AsyncExcludesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncExcludesWithStreamingResponse: - return AsyncExcludesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncExcludesResourceWithStreamingResponse: + return AsyncExcludesResourceWithStreamingResponse(self) async def update( self, *, account_id: str, - body: Iterable[DevicesSplitTunnelParam], + body: Iterable[SplitTunnelExcludeParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -205,7 +203,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ExcludeUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ExcludeUpdateResponse]], ResultWrapper[ExcludeUpdateResponse]), ) @@ -220,7 +218,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DevicesSplitTunnel, AsyncSinglePage[DevicesSplitTunnel]]: + ) -> AsyncPaginator[SplitTunnelExclude, AsyncSinglePage[SplitTunnelExclude]]: """ Fetches the list of routes excluded from the WARP client's tunnel. @@ -237,11 +235,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/policy/exclude", - page=AsyncSinglePage[DevicesSplitTunnel], + page=AsyncSinglePage[SplitTunnelExclude], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicesSplitTunnel, + model=SplitTunnelExclude, ) async def get( @@ -282,14 +280,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ExcludeGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ExcludeGetResponse]], ResultWrapper[ExcludeGetResponse]), ) -class ExcludesWithRawResponse: - def __init__(self, excludes: Excludes) -> None: +class ExcludesResourceWithRawResponse: + def __init__(self, excludes: ExcludesResource) -> None: self._excludes = excludes self.update = to_raw_response_wrapper( @@ -303,8 +301,8 @@ def __init__(self, excludes: Excludes) -> None: ) -class AsyncExcludesWithRawResponse: - def __init__(self, excludes: AsyncExcludes) -> None: +class AsyncExcludesResourceWithRawResponse: + def __init__(self, excludes: AsyncExcludesResource) -> None: self._excludes = excludes self.update = async_to_raw_response_wrapper( @@ -318,8 +316,8 @@ def __init__(self, excludes: AsyncExcludes) -> None: ) -class ExcludesWithStreamingResponse: - def __init__(self, excludes: Excludes) -> None: +class ExcludesResourceWithStreamingResponse: + def __init__(self, excludes: ExcludesResource) -> None: self._excludes = excludes self.update = to_streamed_response_wrapper( @@ -333,8 +331,8 @@ def __init__(self, excludes: Excludes) -> None: ) -class AsyncExcludesWithStreamingResponse: - def __init__(self, excludes: AsyncExcludes) -> None: +class AsyncExcludesResourceWithStreamingResponse: + def __init__(self, excludes: AsyncExcludesResource) -> None: self._excludes = excludes self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/fallback_domains.py b/src/cloudflare/resources/zero_trust/devices/policies/fallback_domains.py index 4c968946186..949d226d832 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/fallback_domains.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/fallback_domains.py @@ -25,32 +25,30 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.devices.policies import ( - DevicesFallbackDomain, - FallbackDomainGetResponse, - DevicesFallbackDomainParam, - FallbackDomainUpdateResponse, - fallback_domain_update_params, -) +from .....types.zero_trust.devices.policies import fallback_domain_update_params +from .....types.zero_trust.devices.policies.fallback_domain import FallbackDomain +from .....types.zero_trust.devices.policies.fallback_domain_param import FallbackDomainParam +from .....types.zero_trust.devices.policies.fallback_domain_get_response import FallbackDomainGetResponse +from .....types.zero_trust.devices.policies.fallback_domain_update_response import FallbackDomainUpdateResponse -__all__ = ["FallbackDomains", "AsyncFallbackDomains"] +__all__ = ["FallbackDomainsResource", "AsyncFallbackDomainsResource"] -class FallbackDomains(SyncAPIResource): +class FallbackDomainsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FallbackDomainsWithRawResponse: - return FallbackDomainsWithRawResponse(self) + def with_raw_response(self) -> FallbackDomainsResourceWithRawResponse: + return FallbackDomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FallbackDomainsWithStreamingResponse: - return FallbackDomainsWithStreamingResponse(self) + def with_streaming_response(self) -> FallbackDomainsResourceWithStreamingResponse: + return FallbackDomainsResourceWithStreamingResponse(self) def update( self, policy_id: str, *, account_id: str, - body: Iterable[DevicesFallbackDomainParam], + body: Iterable[FallbackDomainParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -87,7 +85,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FallbackDomainUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[FallbackDomainUpdateResponse]], ResultWrapper[FallbackDomainUpdateResponse]), ) @@ -102,7 +100,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DevicesFallbackDomain]: + ) -> SyncSinglePage[FallbackDomain]: """Fetches a list of domains to bypass Gateway DNS resolution. These domains will @@ -121,11 +119,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/policy/fallback_domains", - page=SyncSinglePage[DevicesFallbackDomain], + page=SyncSinglePage[FallbackDomain], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicesFallbackDomain, + model=FallbackDomain, ) def get( @@ -167,27 +165,27 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FallbackDomainGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[FallbackDomainGetResponse]], ResultWrapper[FallbackDomainGetResponse]), ) -class AsyncFallbackDomains(AsyncAPIResource): +class AsyncFallbackDomainsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFallbackDomainsWithRawResponse: - return AsyncFallbackDomainsWithRawResponse(self) + def with_raw_response(self) -> AsyncFallbackDomainsResourceWithRawResponse: + return AsyncFallbackDomainsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFallbackDomainsWithStreamingResponse: - return AsyncFallbackDomainsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFallbackDomainsResourceWithStreamingResponse: + return AsyncFallbackDomainsResourceWithStreamingResponse(self) async def update( self, policy_id: str, *, account_id: str, - body: Iterable[DevicesFallbackDomainParam], + body: Iterable[FallbackDomainParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -224,7 +222,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FallbackDomainUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[FallbackDomainUpdateResponse]], ResultWrapper[FallbackDomainUpdateResponse]), ) @@ -239,7 +237,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DevicesFallbackDomain, AsyncSinglePage[DevicesFallbackDomain]]: + ) -> AsyncPaginator[FallbackDomain, AsyncSinglePage[FallbackDomain]]: """Fetches a list of domains to bypass Gateway DNS resolution. These domains will @@ -258,11 +256,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/policy/fallback_domains", - page=AsyncSinglePage[DevicesFallbackDomain], + page=AsyncSinglePage[FallbackDomain], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicesFallbackDomain, + model=FallbackDomain, ) async def get( @@ -304,14 +302,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FallbackDomainGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[FallbackDomainGetResponse]], ResultWrapper[FallbackDomainGetResponse]), ) -class FallbackDomainsWithRawResponse: - def __init__(self, fallback_domains: FallbackDomains) -> None: +class FallbackDomainsResourceWithRawResponse: + def __init__(self, fallback_domains: FallbackDomainsResource) -> None: self._fallback_domains = fallback_domains self.update = to_raw_response_wrapper( @@ -325,8 +323,8 @@ def __init__(self, fallback_domains: FallbackDomains) -> None: ) -class AsyncFallbackDomainsWithRawResponse: - def __init__(self, fallback_domains: AsyncFallbackDomains) -> None: +class AsyncFallbackDomainsResourceWithRawResponse: + def __init__(self, fallback_domains: AsyncFallbackDomainsResource) -> None: self._fallback_domains = fallback_domains self.update = async_to_raw_response_wrapper( @@ -340,8 +338,8 @@ def __init__(self, fallback_domains: AsyncFallbackDomains) -> None: ) -class FallbackDomainsWithStreamingResponse: - def __init__(self, fallback_domains: FallbackDomains) -> None: +class FallbackDomainsResourceWithStreamingResponse: + def __init__(self, fallback_domains: FallbackDomainsResource) -> None: self._fallback_domains = fallback_domains self.update = to_streamed_response_wrapper( @@ -355,8 +353,8 @@ def __init__(self, fallback_domains: FallbackDomains) -> None: ) -class AsyncFallbackDomainsWithStreamingResponse: - def __init__(self, fallback_domains: AsyncFallbackDomains) -> None: +class AsyncFallbackDomainsResourceWithStreamingResponse: + def __init__(self, fallback_domains: AsyncFallbackDomainsResource) -> None: self._fallback_domains = fallback_domains self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/includes.py b/src/cloudflare/resources/zero_trust/devices/policies/includes.py index 7a6d7b9880b..ba8b35f0189 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/includes.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/includes.py @@ -25,31 +25,29 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.devices.policies import ( - IncludeGetResponse, - IncludeUpdateResponse, - DevicesSplitTunnelInclude, - DevicesSplitTunnelIncludeParam, - include_update_params, -) +from .....types.zero_trust.devices.policies import include_update_params +from .....types.zero_trust.devices.policies.include_get_response import IncludeGetResponse +from .....types.zero_trust.devices.policies.split_tunnel_include import SplitTunnelInclude +from .....types.zero_trust.devices.policies.include_update_response import IncludeUpdateResponse +from .....types.zero_trust.devices.policies.split_tunnel_include_param import SplitTunnelIncludeParam -__all__ = ["Includes", "AsyncIncludes"] +__all__ = ["IncludesResource", "AsyncIncludesResource"] -class Includes(SyncAPIResource): +class IncludesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IncludesWithRawResponse: - return IncludesWithRawResponse(self) + def with_raw_response(self) -> IncludesResourceWithRawResponse: + return IncludesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IncludesWithStreamingResponse: - return IncludesWithStreamingResponse(self) + def with_streaming_response(self) -> IncludesResourceWithStreamingResponse: + return IncludesResourceWithStreamingResponse(self) def update( self, *, account_id: str, - body: Iterable[DevicesSplitTunnelIncludeParam], + body: Iterable[SplitTunnelIncludeParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -79,7 +77,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncludeUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[IncludeUpdateResponse]], ResultWrapper[IncludeUpdateResponse]), ) @@ -94,7 +92,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DevicesSplitTunnelInclude]: + ) -> SyncSinglePage[SplitTunnelInclude]: """ Fetches the list of routes included in the WARP client's tunnel. @@ -111,11 +109,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/policy/include", - page=SyncSinglePage[DevicesSplitTunnelInclude], + page=SyncSinglePage[SplitTunnelInclude], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicesSplitTunnelInclude, + model=SplitTunnelInclude, ) def get( @@ -156,26 +154,26 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncludeGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[IncludeGetResponse]], ResultWrapper[IncludeGetResponse]), ) -class AsyncIncludes(AsyncAPIResource): +class AsyncIncludesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIncludesWithRawResponse: - return AsyncIncludesWithRawResponse(self) + def with_raw_response(self) -> AsyncIncludesResourceWithRawResponse: + return AsyncIncludesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIncludesWithStreamingResponse: - return AsyncIncludesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIncludesResourceWithStreamingResponse: + return AsyncIncludesResourceWithStreamingResponse(self) async def update( self, *, account_id: str, - body: Iterable[DevicesSplitTunnelIncludeParam], + body: Iterable[SplitTunnelIncludeParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -205,7 +203,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncludeUpdateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[IncludeUpdateResponse]], ResultWrapper[IncludeUpdateResponse]), ) @@ -220,7 +218,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DevicesSplitTunnelInclude, AsyncSinglePage[DevicesSplitTunnelInclude]]: + ) -> AsyncPaginator[SplitTunnelInclude, AsyncSinglePage[SplitTunnelInclude]]: """ Fetches the list of routes included in the WARP client's tunnel. @@ -237,11 +235,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/policy/include", - page=AsyncSinglePage[DevicesSplitTunnelInclude], + page=AsyncSinglePage[SplitTunnelInclude], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicesSplitTunnelInclude, + model=SplitTunnelInclude, ) async def get( @@ -282,14 +280,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IncludeGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[IncludeGetResponse]], ResultWrapper[IncludeGetResponse]), ) -class IncludesWithRawResponse: - def __init__(self, includes: Includes) -> None: +class IncludesResourceWithRawResponse: + def __init__(self, includes: IncludesResource) -> None: self._includes = includes self.update = to_raw_response_wrapper( @@ -303,8 +301,8 @@ def __init__(self, includes: Includes) -> None: ) -class AsyncIncludesWithRawResponse: - def __init__(self, includes: AsyncIncludes) -> None: +class AsyncIncludesResourceWithRawResponse: + def __init__(self, includes: AsyncIncludesResource) -> None: self._includes = includes self.update = async_to_raw_response_wrapper( @@ -318,8 +316,8 @@ def __init__(self, includes: AsyncIncludes) -> None: ) -class IncludesWithStreamingResponse: - def __init__(self, includes: Includes) -> None: +class IncludesResourceWithStreamingResponse: + def __init__(self, includes: IncludesResource) -> None: self._includes = includes self.update = to_streamed_response_wrapper( @@ -333,8 +331,8 @@ def __init__(self, includes: Includes) -> None: ) -class AsyncIncludesWithStreamingResponse: - def __init__(self, includes: AsyncIncludes) -> None: +class AsyncIncludesResourceWithStreamingResponse: + def __init__(self, includes: AsyncIncludesResource) -> None: self._includes = includes self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/policies.py b/src/cloudflare/resources/zero_trust/devices/policies/policies.py index 9a84c73442b..57b8423f9f1 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/policies.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/policies.py @@ -7,20 +7,20 @@ import httpx from .excludes import ( - Excludes, - AsyncExcludes, - ExcludesWithRawResponse, - AsyncExcludesWithRawResponse, - ExcludesWithStreamingResponse, - AsyncExcludesWithStreamingResponse, + ExcludesResource, + AsyncExcludesResource, + ExcludesResourceWithRawResponse, + AsyncExcludesResourceWithRawResponse, + ExcludesResourceWithStreamingResponse, + AsyncExcludesResourceWithStreamingResponse, ) from .includes import ( - Includes, - AsyncIncludes, - IncludesWithRawResponse, - AsyncIncludesWithRawResponse, - IncludesWithStreamingResponse, - AsyncIncludesWithStreamingResponse, + IncludesResource, + AsyncIncludesResource, + IncludesResourceWithRawResponse, + AsyncIncludesResourceWithRawResponse, + IncludesResourceWithStreamingResponse, + AsyncIncludesResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -38,59 +38,56 @@ from ....._wrappers import ResultWrapper from .....pagination import SyncSinglePage, AsyncSinglePage from .default_policy import ( - DefaultPolicy, - AsyncDefaultPolicy, - DefaultPolicyWithRawResponse, - AsyncDefaultPolicyWithRawResponse, - DefaultPolicyWithStreamingResponse, - AsyncDefaultPolicyWithStreamingResponse, + DefaultPolicyResource, + AsyncDefaultPolicyResource, + DefaultPolicyResourceWithRawResponse, + AsyncDefaultPolicyResourceWithRawResponse, + DefaultPolicyResourceWithStreamingResponse, + AsyncDefaultPolicyResourceWithStreamingResponse, ) from ....._base_client import ( AsyncPaginator, make_request_options, ) from .fallback_domains import ( - FallbackDomains, - AsyncFallbackDomains, - FallbackDomainsWithRawResponse, - AsyncFallbackDomainsWithRawResponse, - FallbackDomainsWithStreamingResponse, - AsyncFallbackDomainsWithStreamingResponse, -) -from .....types.zero_trust.devices import ( - PolicyDeleteResponse, - DevicesDeviceSettingsPolicy, - policy_edit_params, - policy_create_params, + FallbackDomainsResource, + AsyncFallbackDomainsResource, + FallbackDomainsResourceWithRawResponse, + AsyncFallbackDomainsResourceWithRawResponse, + FallbackDomainsResourceWithStreamingResponse, + AsyncFallbackDomainsResourceWithStreamingResponse, ) +from .....types.zero_trust.devices import policy_edit_params, policy_create_params, policy_delete_params +from .....types.zero_trust.devices.settings_policy import SettingsPolicy +from .....types.zero_trust.devices.policy_delete_response import PolicyDeleteResponse -__all__ = ["Policies", "AsyncPolicies"] +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] -class Policies(SyncAPIResource): +class PoliciesResource(SyncAPIResource): @cached_property - def default_policy(self) -> DefaultPolicy: - return DefaultPolicy(self._client) + def default_policy(self) -> DefaultPolicyResource: + return DefaultPolicyResource(self._client) @cached_property - def excludes(self) -> Excludes: - return Excludes(self._client) + def excludes(self) -> ExcludesResource: + return ExcludesResource(self._client) @cached_property - def fallback_domains(self) -> FallbackDomains: - return FallbackDomains(self._client) + def fallback_domains(self) -> FallbackDomainsResource: + return FallbackDomainsResource(self._client) @cached_property - def includes(self) -> Includes: - return Includes(self._client) + def includes(self) -> IncludesResource: + return IncludesResource(self._client) @cached_property - def with_raw_response(self) -> PoliciesWithRawResponse: - return PoliciesWithRawResponse(self) + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PoliciesWithStreamingResponse: - return PoliciesWithStreamingResponse(self) + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self) def create( self, @@ -119,7 +116,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicesDeviceSettingsPolicy]: + ) -> Optional[SettingsPolicy]: """ Creates a device settings profile to be applied to certain devices matching the criteria. @@ -204,9 +201,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingsPolicy]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicesDeviceSettingsPolicy]], ResultWrapper[DevicesDeviceSettingsPolicy]), + cast_to=cast(Type[Optional[SettingsPolicy]], ResultWrapper[SettingsPolicy]), ) def list( @@ -219,7 +216,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DevicesDeviceSettingsPolicy]: + ) -> SyncSinglePage[SettingsPolicy]: """ Fetches a list of the device settings profiles for an account. @@ -236,11 +233,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/policies", - page=SyncSinglePage[DevicesDeviceSettingsPolicy], + page=SyncSinglePage[SettingsPolicy], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicesDeviceSettingsPolicy, + model=SettingsPolicy, ) def delete( @@ -248,6 +245,7 @@ def delete( policy_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +274,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._delete( f"/accounts/{account_id}/devices/policy/{policy_id}", + body=maybe_transform(body, policy_delete_params.PolicyDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PolicyDeleteResponse]], ResultWrapper[PolicyDeleteResponse]), ) @@ -312,7 +311,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicesDeviceSettingsPolicy]: + ) -> Optional[SettingsPolicy]: """ Updates a configured device settings profile. @@ -390,9 +389,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingsPolicy]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicesDeviceSettingsPolicy]], ResultWrapper[DevicesDeviceSettingsPolicy]), + cast_to=cast(Type[Optional[SettingsPolicy]], ResultWrapper[SettingsPolicy]), ) def get( @@ -406,7 +405,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicesDeviceSettingsPolicy]: + ) -> Optional[SettingsPolicy]: """ Fetches a device settings profile by ID. @@ -432,36 +431,36 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingsPolicy]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicesDeviceSettingsPolicy]], ResultWrapper[DevicesDeviceSettingsPolicy]), + cast_to=cast(Type[Optional[SettingsPolicy]], ResultWrapper[SettingsPolicy]), ) -class AsyncPolicies(AsyncAPIResource): +class AsyncPoliciesResource(AsyncAPIResource): @cached_property - def default_policy(self) -> AsyncDefaultPolicy: - return AsyncDefaultPolicy(self._client) + def default_policy(self) -> AsyncDefaultPolicyResource: + return AsyncDefaultPolicyResource(self._client) @cached_property - def excludes(self) -> AsyncExcludes: - return AsyncExcludes(self._client) + def excludes(self) -> AsyncExcludesResource: + return AsyncExcludesResource(self._client) @cached_property - def fallback_domains(self) -> AsyncFallbackDomains: - return AsyncFallbackDomains(self._client) + def fallback_domains(self) -> AsyncFallbackDomainsResource: + return AsyncFallbackDomainsResource(self._client) @cached_property - def includes(self) -> AsyncIncludes: - return AsyncIncludes(self._client) + def includes(self) -> AsyncIncludesResource: + return AsyncIncludesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPoliciesWithRawResponse: - return AsyncPoliciesWithRawResponse(self) + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPoliciesWithStreamingResponse: - return AsyncPoliciesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self) async def create( self, @@ -490,7 +489,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicesDeviceSettingsPolicy]: + ) -> Optional[SettingsPolicy]: """ Creates a device settings profile to be applied to certain devices matching the criteria. @@ -575,9 +574,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingsPolicy]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicesDeviceSettingsPolicy]], ResultWrapper[DevicesDeviceSettingsPolicy]), + cast_to=cast(Type[Optional[SettingsPolicy]], ResultWrapper[SettingsPolicy]), ) def list( @@ -590,7 +589,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DevicesDeviceSettingsPolicy, AsyncSinglePage[DevicesDeviceSettingsPolicy]]: + ) -> AsyncPaginator[SettingsPolicy, AsyncSinglePage[SettingsPolicy]]: """ Fetches a list of the device settings profiles for an account. @@ -607,11 +606,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/policies", - page=AsyncSinglePage[DevicesDeviceSettingsPolicy], + page=AsyncSinglePage[SettingsPolicy], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicesDeviceSettingsPolicy, + model=SettingsPolicy, ) async def delete( @@ -619,6 +618,7 @@ async def delete( policy_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -647,12 +647,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._delete( f"/accounts/{account_id}/devices/policy/{policy_id}", + body=await async_maybe_transform(body, policy_delete_params.PolicyDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PolicyDeleteResponse]], ResultWrapper[PolicyDeleteResponse]), ) @@ -683,7 +684,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicesDeviceSettingsPolicy]: + ) -> Optional[SettingsPolicy]: """ Updates a configured device settings profile. @@ -761,9 +762,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingsPolicy]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicesDeviceSettingsPolicy]], ResultWrapper[DevicesDeviceSettingsPolicy]), + cast_to=cast(Type[Optional[SettingsPolicy]], ResultWrapper[SettingsPolicy]), ) async def get( @@ -777,7 +778,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicesDeviceSettingsPolicy]: + ) -> Optional[SettingsPolicy]: """ Fetches a device settings profile by ID. @@ -803,14 +804,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SettingsPolicy]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicesDeviceSettingsPolicy]], ResultWrapper[DevicesDeviceSettingsPolicy]), + cast_to=cast(Type[Optional[SettingsPolicy]], ResultWrapper[SettingsPolicy]), ) -class PoliciesWithRawResponse: - def __init__(self, policies: Policies) -> None: +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: self._policies = policies self.create = to_raw_response_wrapper( @@ -830,24 +831,24 @@ def __init__(self, policies: Policies) -> None: ) @cached_property - def default_policy(self) -> DefaultPolicyWithRawResponse: - return DefaultPolicyWithRawResponse(self._policies.default_policy) + def default_policy(self) -> DefaultPolicyResourceWithRawResponse: + return DefaultPolicyResourceWithRawResponse(self._policies.default_policy) @cached_property - def excludes(self) -> ExcludesWithRawResponse: - return ExcludesWithRawResponse(self._policies.excludes) + def excludes(self) -> ExcludesResourceWithRawResponse: + return ExcludesResourceWithRawResponse(self._policies.excludes) @cached_property - def fallback_domains(self) -> FallbackDomainsWithRawResponse: - return FallbackDomainsWithRawResponse(self._policies.fallback_domains) + def fallback_domains(self) -> FallbackDomainsResourceWithRawResponse: + return FallbackDomainsResourceWithRawResponse(self._policies.fallback_domains) @cached_property - def includes(self) -> IncludesWithRawResponse: - return IncludesWithRawResponse(self._policies.includes) + def includes(self) -> IncludesResourceWithRawResponse: + return IncludesResourceWithRawResponse(self._policies.includes) -class AsyncPoliciesWithRawResponse: - def __init__(self, policies: AsyncPolicies) -> None: +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: self._policies = policies self.create = async_to_raw_response_wrapper( @@ -867,24 +868,24 @@ def __init__(self, policies: AsyncPolicies) -> None: ) @cached_property - def default_policy(self) -> AsyncDefaultPolicyWithRawResponse: - return AsyncDefaultPolicyWithRawResponse(self._policies.default_policy) + def default_policy(self) -> AsyncDefaultPolicyResourceWithRawResponse: + return AsyncDefaultPolicyResourceWithRawResponse(self._policies.default_policy) @cached_property - def excludes(self) -> AsyncExcludesWithRawResponse: - return AsyncExcludesWithRawResponse(self._policies.excludes) + def excludes(self) -> AsyncExcludesResourceWithRawResponse: + return AsyncExcludesResourceWithRawResponse(self._policies.excludes) @cached_property - def fallback_domains(self) -> AsyncFallbackDomainsWithRawResponse: - return AsyncFallbackDomainsWithRawResponse(self._policies.fallback_domains) + def fallback_domains(self) -> AsyncFallbackDomainsResourceWithRawResponse: + return AsyncFallbackDomainsResourceWithRawResponse(self._policies.fallback_domains) @cached_property - def includes(self) -> AsyncIncludesWithRawResponse: - return AsyncIncludesWithRawResponse(self._policies.includes) + def includes(self) -> AsyncIncludesResourceWithRawResponse: + return AsyncIncludesResourceWithRawResponse(self._policies.includes) -class PoliciesWithStreamingResponse: - def __init__(self, policies: Policies) -> None: +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: self._policies = policies self.create = to_streamed_response_wrapper( @@ -904,24 +905,24 @@ def __init__(self, policies: Policies) -> None: ) @cached_property - def default_policy(self) -> DefaultPolicyWithStreamingResponse: - return DefaultPolicyWithStreamingResponse(self._policies.default_policy) + def default_policy(self) -> DefaultPolicyResourceWithStreamingResponse: + return DefaultPolicyResourceWithStreamingResponse(self._policies.default_policy) @cached_property - def excludes(self) -> ExcludesWithStreamingResponse: - return ExcludesWithStreamingResponse(self._policies.excludes) + def excludes(self) -> ExcludesResourceWithStreamingResponse: + return ExcludesResourceWithStreamingResponse(self._policies.excludes) @cached_property - def fallback_domains(self) -> FallbackDomainsWithStreamingResponse: - return FallbackDomainsWithStreamingResponse(self._policies.fallback_domains) + def fallback_domains(self) -> FallbackDomainsResourceWithStreamingResponse: + return FallbackDomainsResourceWithStreamingResponse(self._policies.fallback_domains) @cached_property - def includes(self) -> IncludesWithStreamingResponse: - return IncludesWithStreamingResponse(self._policies.includes) + def includes(self) -> IncludesResourceWithStreamingResponse: + return IncludesResourceWithStreamingResponse(self._policies.includes) -class AsyncPoliciesWithStreamingResponse: - def __init__(self, policies: AsyncPolicies) -> None: +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: self._policies = policies self.create = async_to_streamed_response_wrapper( @@ -941,17 +942,17 @@ def __init__(self, policies: AsyncPolicies) -> None: ) @cached_property - def default_policy(self) -> AsyncDefaultPolicyWithStreamingResponse: - return AsyncDefaultPolicyWithStreamingResponse(self._policies.default_policy) + def default_policy(self) -> AsyncDefaultPolicyResourceWithStreamingResponse: + return AsyncDefaultPolicyResourceWithStreamingResponse(self._policies.default_policy) @cached_property - def excludes(self) -> AsyncExcludesWithStreamingResponse: - return AsyncExcludesWithStreamingResponse(self._policies.excludes) + def excludes(self) -> AsyncExcludesResourceWithStreamingResponse: + return AsyncExcludesResourceWithStreamingResponse(self._policies.excludes) @cached_property - def fallback_domains(self) -> AsyncFallbackDomainsWithStreamingResponse: - return AsyncFallbackDomainsWithStreamingResponse(self._policies.fallback_domains) + def fallback_domains(self) -> AsyncFallbackDomainsResourceWithStreamingResponse: + return AsyncFallbackDomainsResourceWithStreamingResponse(self._policies.fallback_domains) @cached_property - def includes(self) -> AsyncIncludesWithStreamingResponse: - return AsyncIncludesWithStreamingResponse(self._policies.includes) + def includes(self) -> AsyncIncludesResourceWithStreamingResponse: + return AsyncIncludesResourceWithStreamingResponse(self._policies.includes) diff --git a/src/cloudflare/resources/zero_trust/devices/posture/__init__.py b/src/cloudflare/resources/zero_trust/devices/posture/__init__.py index 02703608e14..b43760546c3 100644 --- a/src/cloudflare/resources/zero_trust/devices/posture/__init__.py +++ b/src/cloudflare/resources/zero_trust/devices/posture/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .posture import ( - Posture, - AsyncPosture, - PostureWithRawResponse, - AsyncPostureWithRawResponse, - PostureWithStreamingResponse, - AsyncPostureWithStreamingResponse, + PostureResource, + AsyncPostureResource, + PostureResourceWithRawResponse, + AsyncPostureResourceWithRawResponse, + PostureResourceWithStreamingResponse, + AsyncPostureResourceWithStreamingResponse, ) from .integrations import ( - Integrations, - AsyncIntegrations, - IntegrationsWithRawResponse, - AsyncIntegrationsWithRawResponse, - IntegrationsWithStreamingResponse, - AsyncIntegrationsWithStreamingResponse, + IntegrationsResource, + AsyncIntegrationsResource, + IntegrationsResourceWithRawResponse, + AsyncIntegrationsResourceWithRawResponse, + IntegrationsResourceWithStreamingResponse, + AsyncIntegrationsResourceWithStreamingResponse, ) __all__ = [ - "Integrations", - "AsyncIntegrations", - "IntegrationsWithRawResponse", - "AsyncIntegrationsWithRawResponse", - "IntegrationsWithStreamingResponse", - "AsyncIntegrationsWithStreamingResponse", - "Posture", - "AsyncPosture", - "PostureWithRawResponse", - "AsyncPostureWithRawResponse", - "PostureWithStreamingResponse", - "AsyncPostureWithStreamingResponse", + "IntegrationsResource", + "AsyncIntegrationsResource", + "IntegrationsResourceWithRawResponse", + "AsyncIntegrationsResourceWithRawResponse", + "IntegrationsResourceWithStreamingResponse", + "AsyncIntegrationsResourceWithStreamingResponse", + "PostureResource", + "AsyncPostureResource", + "PostureResourceWithRawResponse", + "AsyncPostureResourceWithRawResponse", + "PostureResourceWithStreamingResponse", + "AsyncPostureResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/devices/posture/integrations.py b/src/cloudflare/resources/zero_trust/devices/posture/integrations.py index 9bc0de48001..160d7a87247 100644 --- a/src/cloudflare/resources/zero_trust/devices/posture/integrations.py +++ b/src/cloudflare/resources/zero_trust/devices/posture/integrations.py @@ -27,23 +27,24 @@ make_request_options, ) from .....types.zero_trust.devices.posture import ( - DevicePostureIntegrations, - IntegrationDeleteResponse, integration_edit_params, integration_create_params, + integration_delete_params, ) +from .....types.zero_trust.devices.posture.integration import Integration +from .....types.zero_trust.devices.posture.integration_delete_response import IntegrationDeleteResponse -__all__ = ["Integrations", "AsyncIntegrations"] +__all__ = ["IntegrationsResource", "AsyncIntegrationsResource"] -class Integrations(SyncAPIResource): +class IntegrationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IntegrationsWithRawResponse: - return IntegrationsWithRawResponse(self) + def with_raw_response(self) -> IntegrationsResourceWithRawResponse: + return IntegrationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IntegrationsWithStreamingResponse: - return IntegrationsWithStreamingResponse(self) + def with_streaming_response(self) -> IntegrationsResourceWithStreamingResponse: + return IntegrationsResourceWithStreamingResponse(self) def create( self, @@ -59,7 +60,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureIntegrations]: + ) -> Optional[Integration]: """ Create a new device posture integration. @@ -99,9 +100,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Integration]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureIntegrations]], ResultWrapper[DevicePostureIntegrations]), + cast_to=cast(Type[Optional[Integration]], ResultWrapper[Integration]), ) def list( @@ -114,7 +115,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DevicePostureIntegrations]: + ) -> SyncSinglePage[Integration]: """ Fetches the list of device posture integrations for an account. @@ -131,11 +132,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/posture/integration", - page=SyncSinglePage[DevicePostureIntegrations], + page=SyncSinglePage[Integration], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicePostureIntegrations, + model=Integration, ) def delete( @@ -143,13 +144,14 @@ def delete( integration_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[IntegrationDeleteResponse]: + ) -> IntegrationDeleteResponse: """ Delete a configured device posture integration. @@ -169,15 +171,16 @@ def delete( if not integration_id: raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") return cast( - Optional[IntegrationDeleteResponse], + IntegrationDeleteResponse, self._delete( f"/accounts/{account_id}/devices/posture/integration/{integration_id}", + body=maybe_transform(body, integration_delete_params.IntegrationDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IntegrationDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IntegrationDeleteResponse] @@ -201,7 +204,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureIntegrations]: + ) -> Optional[Integration]: """ Updates a configured device posture integration. @@ -245,9 +248,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Integration]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureIntegrations]], ResultWrapper[DevicePostureIntegrations]), + cast_to=cast(Type[Optional[Integration]], ResultWrapper[Integration]), ) def get( @@ -261,7 +264,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureIntegrations]: + ) -> Optional[Integration]: """ Fetches details for a single device posture integration. @@ -287,20 +290,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Integration]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureIntegrations]], ResultWrapper[DevicePostureIntegrations]), + cast_to=cast(Type[Optional[Integration]], ResultWrapper[Integration]), ) -class AsyncIntegrations(AsyncAPIResource): +class AsyncIntegrationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIntegrationsWithRawResponse: - return AsyncIntegrationsWithRawResponse(self) + def with_raw_response(self) -> AsyncIntegrationsResourceWithRawResponse: + return AsyncIntegrationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIntegrationsWithStreamingResponse: - return AsyncIntegrationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIntegrationsResourceWithStreamingResponse: + return AsyncIntegrationsResourceWithStreamingResponse(self) async def create( self, @@ -316,7 +319,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureIntegrations]: + ) -> Optional[Integration]: """ Create a new device posture integration. @@ -356,9 +359,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Integration]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureIntegrations]], ResultWrapper[DevicePostureIntegrations]), + cast_to=cast(Type[Optional[Integration]], ResultWrapper[Integration]), ) def list( @@ -371,7 +374,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DevicePostureIntegrations, AsyncSinglePage[DevicePostureIntegrations]]: + ) -> AsyncPaginator[Integration, AsyncSinglePage[Integration]]: """ Fetches the list of device posture integrations for an account. @@ -388,11 +391,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/posture/integration", - page=AsyncSinglePage[DevicePostureIntegrations], + page=AsyncSinglePage[Integration], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicePostureIntegrations, + model=Integration, ) async def delete( @@ -400,13 +403,14 @@ async def delete( integration_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[IntegrationDeleteResponse]: + ) -> IntegrationDeleteResponse: """ Delete a configured device posture integration. @@ -426,15 +430,16 @@ 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( - Optional[IntegrationDeleteResponse], + IntegrationDeleteResponse, await self._delete( f"/accounts/{account_id}/devices/posture/integration/{integration_id}", + body=await async_maybe_transform(body, integration_delete_params.IntegrationDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[IntegrationDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IntegrationDeleteResponse] @@ -458,7 +463,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureIntegrations]: + ) -> Optional[Integration]: """ Updates a configured device posture integration. @@ -502,9 +507,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Integration]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureIntegrations]], ResultWrapper[DevicePostureIntegrations]), + cast_to=cast(Type[Optional[Integration]], ResultWrapper[Integration]), ) async def get( @@ -518,7 +523,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureIntegrations]: + ) -> Optional[Integration]: """ Fetches details for a single device posture integration. @@ -544,14 +549,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Integration]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureIntegrations]], ResultWrapper[DevicePostureIntegrations]), + cast_to=cast(Type[Optional[Integration]], ResultWrapper[Integration]), ) -class IntegrationsWithRawResponse: - def __init__(self, integrations: Integrations) -> None: +class IntegrationsResourceWithRawResponse: + def __init__(self, integrations: IntegrationsResource) -> None: self._integrations = integrations self.create = to_raw_response_wrapper( @@ -571,8 +576,8 @@ def __init__(self, integrations: Integrations) -> None: ) -class AsyncIntegrationsWithRawResponse: - def __init__(self, integrations: AsyncIntegrations) -> None: +class AsyncIntegrationsResourceWithRawResponse: + def __init__(self, integrations: AsyncIntegrationsResource) -> None: self._integrations = integrations self.create = async_to_raw_response_wrapper( @@ -592,8 +597,8 @@ def __init__(self, integrations: AsyncIntegrations) -> None: ) -class IntegrationsWithStreamingResponse: - def __init__(self, integrations: Integrations) -> None: +class IntegrationsResourceWithStreamingResponse: + def __init__(self, integrations: IntegrationsResource) -> None: self._integrations = integrations self.create = to_streamed_response_wrapper( @@ -613,8 +618,8 @@ def __init__(self, integrations: Integrations) -> None: ) -class AsyncIntegrationsWithStreamingResponse: - def __init__(self, integrations: AsyncIntegrations) -> None: +class AsyncIntegrationsResourceWithStreamingResponse: + def __init__(self, integrations: AsyncIntegrationsResource) -> None: self._integrations = integrations self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/posture/posture.py b/src/cloudflare/resources/zero_trust/devices/posture/posture.py index 93c970a7bbc..fedb1495ce2 100644 --- a/src/cloudflare/resources/zero_trust/devices/posture/posture.py +++ b/src/cloudflare/resources/zero_trust/devices/posture/posture.py @@ -14,12 +14,12 @@ ) from ....._compat import cached_property from .integrations import ( - Integrations, - AsyncIntegrations, - IntegrationsWithRawResponse, - AsyncIntegrationsWithRawResponse, - IntegrationsWithStreamingResponse, - AsyncIntegrationsWithStreamingResponse, + IntegrationsResource, + AsyncIntegrationsResource, + IntegrationsResourceWithRawResponse, + AsyncIntegrationsResourceWithRawResponse, + IntegrationsResourceWithStreamingResponse, + AsyncIntegrationsResourceWithStreamingResponse, ) from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( @@ -35,27 +35,30 @@ make_request_options, ) from .....types.zero_trust.devices import ( - DevicePostureRules, - PostureDeleteResponse, posture_create_params, + posture_delete_params, posture_update_params, ) +from .....types.zero_trust.devices.device_input_param import DeviceInputParam +from .....types.zero_trust.devices.device_match_param import DeviceMatchParam +from .....types.zero_trust.devices.device_posture_rule import DevicePostureRule +from .....types.zero_trust.devices.posture_delete_response import PostureDeleteResponse -__all__ = ["Posture", "AsyncPosture"] +__all__ = ["PostureResource", "AsyncPostureResource"] -class Posture(SyncAPIResource): +class PostureResource(SyncAPIResource): @cached_property - def integrations(self) -> Integrations: - return Integrations(self._client) + def integrations(self) -> IntegrationsResource: + return IntegrationsResource(self._client) @cached_property - def with_raw_response(self) -> PostureWithRawResponse: - return PostureWithRawResponse(self) + def with_raw_response(self) -> PostureResourceWithRawResponse: + return PostureResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PostureWithStreamingResponse: - return PostureWithStreamingResponse(self) + def with_streaming_response(self) -> PostureResourceWithStreamingResponse: + return PostureResourceWithStreamingResponse(self) def create( self, @@ -85,8 +88,8 @@ def create( ], description: str | NotGiven = NOT_GIVEN, expiration: str | NotGiven = NOT_GIVEN, - input: posture_create_params.Input | NotGiven = NOT_GIVEN, - match: Iterable[posture_create_params.Match] | NotGiven = NOT_GIVEN, + input: DeviceInputParam | NotGiven = NOT_GIVEN, + match: Iterable[DeviceMatchParam] | NotGiven = NOT_GIVEN, schedule: 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. @@ -94,7 +97,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureRules]: + ) -> Optional[DevicePostureRule]: """ Creates a new device posture rule. @@ -144,9 +147,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevicePostureRule]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureRules]], ResultWrapper[DevicePostureRules]), + cast_to=cast(Type[Optional[DevicePostureRule]], ResultWrapper[DevicePostureRule]), ) def update( @@ -178,8 +181,8 @@ def update( ], description: str | NotGiven = NOT_GIVEN, expiration: str | NotGiven = NOT_GIVEN, - input: posture_update_params.Input | NotGiven = NOT_GIVEN, - match: Iterable[posture_update_params.Match] | NotGiven = NOT_GIVEN, + input: DeviceInputParam | NotGiven = NOT_GIVEN, + match: Iterable[DeviceMatchParam] | NotGiven = NOT_GIVEN, schedule: 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. @@ -187,7 +190,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureRules]: + ) -> Optional[DevicePostureRule]: """ Updates a device posture rule. @@ -241,9 +244,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevicePostureRule]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureRules]], ResultWrapper[DevicePostureRules]), + cast_to=cast(Type[Optional[DevicePostureRule]], ResultWrapper[DevicePostureRule]), ) def list( @@ -256,7 +259,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DevicePostureRules]: + ) -> SyncSinglePage[DevicePostureRule]: """ Fetches device posture rules for a Zero Trust account. @@ -273,11 +276,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/posture", - page=SyncSinglePage[DevicePostureRules], + page=SyncSinglePage[DevicePostureRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicePostureRules, + model=DevicePostureRule, ) def delete( @@ -285,6 +288,7 @@ def delete( rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -312,12 +316,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._delete( f"/accounts/{account_id}/devices/posture/{rule_id}", + body=maybe_transform(body, posture_delete_params.PostureDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PostureDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PostureDeleteResponse]], ResultWrapper[PostureDeleteResponse]), ) @@ -333,7 +338,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureRules]: + ) -> Optional[DevicePostureRule]: """ Fetches a single device posture rule. @@ -359,24 +364,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevicePostureRule]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureRules]], ResultWrapper[DevicePostureRules]), + cast_to=cast(Type[Optional[DevicePostureRule]], ResultWrapper[DevicePostureRule]), ) -class AsyncPosture(AsyncAPIResource): +class AsyncPostureResource(AsyncAPIResource): @cached_property - def integrations(self) -> AsyncIntegrations: - return AsyncIntegrations(self._client) + def integrations(self) -> AsyncIntegrationsResource: + return AsyncIntegrationsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPostureWithRawResponse: - return AsyncPostureWithRawResponse(self) + def with_raw_response(self) -> AsyncPostureResourceWithRawResponse: + return AsyncPostureResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPostureWithStreamingResponse: - return AsyncPostureWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPostureResourceWithStreamingResponse: + return AsyncPostureResourceWithStreamingResponse(self) async def create( self, @@ -406,8 +411,8 @@ async def create( ], description: str | NotGiven = NOT_GIVEN, expiration: str | NotGiven = NOT_GIVEN, - input: posture_create_params.Input | NotGiven = NOT_GIVEN, - match: Iterable[posture_create_params.Match] | NotGiven = NOT_GIVEN, + input: DeviceInputParam | NotGiven = NOT_GIVEN, + match: Iterable[DeviceMatchParam] | NotGiven = NOT_GIVEN, schedule: 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. @@ -415,7 +420,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureRules]: + ) -> Optional[DevicePostureRule]: """ Creates a new device posture rule. @@ -465,9 +470,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevicePostureRule]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureRules]], ResultWrapper[DevicePostureRules]), + cast_to=cast(Type[Optional[DevicePostureRule]], ResultWrapper[DevicePostureRule]), ) async def update( @@ -499,8 +504,8 @@ async def update( ], description: str | NotGiven = NOT_GIVEN, expiration: str | NotGiven = NOT_GIVEN, - input: posture_update_params.Input | NotGiven = NOT_GIVEN, - match: Iterable[posture_update_params.Match] | NotGiven = NOT_GIVEN, + input: DeviceInputParam | NotGiven = NOT_GIVEN, + match: Iterable[DeviceMatchParam] | NotGiven = NOT_GIVEN, schedule: 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. @@ -508,7 +513,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureRules]: + ) -> Optional[DevicePostureRule]: """ Updates a device posture rule. @@ -562,9 +567,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevicePostureRule]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureRules]], ResultWrapper[DevicePostureRules]), + cast_to=cast(Type[Optional[DevicePostureRule]], ResultWrapper[DevicePostureRule]), ) def list( @@ -577,7 +582,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DevicePostureRules, AsyncSinglePage[DevicePostureRules]]: + ) -> AsyncPaginator[DevicePostureRule, AsyncSinglePage[DevicePostureRule]]: """ Fetches device posture rules for a Zero Trust account. @@ -594,11 +599,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/devices/posture", - page=AsyncSinglePage[DevicePostureRules], + page=AsyncSinglePage[DevicePostureRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DevicePostureRules, + model=DevicePostureRule, ) async def delete( @@ -606,6 +611,7 @@ async def delete( rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -633,12 +639,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._delete( f"/accounts/{account_id}/devices/posture/{rule_id}", + body=await async_maybe_transform(body, posture_delete_params.PostureDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PostureDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[PostureDeleteResponse]], ResultWrapper[PostureDeleteResponse]), ) @@ -654,7 +661,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevicePostureRules]: + ) -> Optional[DevicePostureRule]: """ Fetches a single device posture rule. @@ -680,14 +687,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevicePostureRule]]._unwrapper, ), - cast_to=cast(Type[Optional[DevicePostureRules]], ResultWrapper[DevicePostureRules]), + cast_to=cast(Type[Optional[DevicePostureRule]], ResultWrapper[DevicePostureRule]), ) -class PostureWithRawResponse: - def __init__(self, posture: Posture) -> None: +class PostureResourceWithRawResponse: + def __init__(self, posture: PostureResource) -> None: self._posture = posture self.create = to_raw_response_wrapper( @@ -707,12 +714,12 @@ def __init__(self, posture: Posture) -> None: ) @cached_property - def integrations(self) -> IntegrationsWithRawResponse: - return IntegrationsWithRawResponse(self._posture.integrations) + def integrations(self) -> IntegrationsResourceWithRawResponse: + return IntegrationsResourceWithRawResponse(self._posture.integrations) -class AsyncPostureWithRawResponse: - def __init__(self, posture: AsyncPosture) -> None: +class AsyncPostureResourceWithRawResponse: + def __init__(self, posture: AsyncPostureResource) -> None: self._posture = posture self.create = async_to_raw_response_wrapper( @@ -732,12 +739,12 @@ def __init__(self, posture: AsyncPosture) -> None: ) @cached_property - def integrations(self) -> AsyncIntegrationsWithRawResponse: - return AsyncIntegrationsWithRawResponse(self._posture.integrations) + def integrations(self) -> AsyncIntegrationsResourceWithRawResponse: + return AsyncIntegrationsResourceWithRawResponse(self._posture.integrations) -class PostureWithStreamingResponse: - def __init__(self, posture: Posture) -> None: +class PostureResourceWithStreamingResponse: + def __init__(self, posture: PostureResource) -> None: self._posture = posture self.create = to_streamed_response_wrapper( @@ -757,12 +764,12 @@ def __init__(self, posture: Posture) -> None: ) @cached_property - def integrations(self) -> IntegrationsWithStreamingResponse: - return IntegrationsWithStreamingResponse(self._posture.integrations) + def integrations(self) -> IntegrationsResourceWithStreamingResponse: + return IntegrationsResourceWithStreamingResponse(self._posture.integrations) -class AsyncPostureWithStreamingResponse: - def __init__(self, posture: AsyncPosture) -> None: +class AsyncPostureResourceWithStreamingResponse: + def __init__(self, posture: AsyncPostureResource) -> None: self._posture = posture self.create = async_to_streamed_response_wrapper( @@ -782,5 +789,5 @@ def __init__(self, posture: AsyncPosture) -> None: ) @cached_property - def integrations(self) -> AsyncIntegrationsWithStreamingResponse: - return AsyncIntegrationsWithStreamingResponse(self._posture.integrations) + def integrations(self) -> AsyncIntegrationsResourceWithStreamingResponse: + return AsyncIntegrationsResourceWithStreamingResponse(self._posture.integrations) diff --git a/src/cloudflare/resources/zero_trust/devices/revoke.py b/src/cloudflare/resources/zero_trust/devices/revoke.py index 2cad8a4c6d1..c9a37723494 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, Optional, cast +from typing import Any, List, cast import httpx @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.devices import RevokeCreateResponse, revoke_create_params +from ....types.zero_trust.devices import revoke_create_params +from ....types.zero_trust.devices.revoke_create_response import RevokeCreateResponse -__all__ = ["Revoke", "AsyncRevoke"] +__all__ = ["RevokeResource", "AsyncRevokeResource"] -class Revoke(SyncAPIResource): +class RevokeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RevokeWithRawResponse: - return RevokeWithRawResponse(self) + def with_raw_response(self) -> RevokeResourceWithRawResponse: + return RevokeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RevokeWithStreamingResponse: - return RevokeWithStreamingResponse(self) + def with_streaming_response(self) -> RevokeResourceWithStreamingResponse: + return RevokeResourceWithStreamingResponse(self) def create( self, @@ -48,7 +49,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RevokeCreateResponse]: + ) -> RevokeCreateResponse: """ Revokes a list of devices. @@ -66,7 +67,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( - Optional[RevokeCreateResponse], + RevokeCreateResponse, self._post( f"/accounts/{account_id}/devices/revoke", body=maybe_transform(body, revoke_create_params.RevokeCreateParams), @@ -75,7 +76,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RevokeCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RevokeCreateResponse] @@ -84,14 +85,14 @@ def create( ) -class AsyncRevoke(AsyncAPIResource): +class AsyncRevokeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRevokeWithRawResponse: - return AsyncRevokeWithRawResponse(self) + def with_raw_response(self) -> AsyncRevokeResourceWithRawResponse: + return AsyncRevokeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRevokeWithStreamingResponse: - return AsyncRevokeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRevokeResourceWithStreamingResponse: + return AsyncRevokeResourceWithStreamingResponse(self) async def create( self, @@ -104,7 +105,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RevokeCreateResponse]: + ) -> RevokeCreateResponse: """ Revokes a list of devices. @@ -122,7 +123,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( - Optional[RevokeCreateResponse], + RevokeCreateResponse, await self._post( f"/accounts/{account_id}/devices/revoke", body=await async_maybe_transform(body, revoke_create_params.RevokeCreateParams), @@ -131,7 +132,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[RevokeCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RevokeCreateResponse] @@ -140,8 +141,8 @@ async def create( ) -class RevokeWithRawResponse: - def __init__(self, revoke: Revoke) -> None: +class RevokeResourceWithRawResponse: + def __init__(self, revoke: RevokeResource) -> None: self._revoke = revoke self.create = to_raw_response_wrapper( @@ -149,8 +150,8 @@ def __init__(self, revoke: Revoke) -> None: ) -class AsyncRevokeWithRawResponse: - def __init__(self, revoke: AsyncRevoke) -> None: +class AsyncRevokeResourceWithRawResponse: + def __init__(self, revoke: AsyncRevokeResource) -> None: self._revoke = revoke self.create = async_to_raw_response_wrapper( @@ -158,8 +159,8 @@ def __init__(self, revoke: AsyncRevoke) -> None: ) -class RevokeWithStreamingResponse: - def __init__(self, revoke: Revoke) -> None: +class RevokeResourceWithStreamingResponse: + def __init__(self, revoke: RevokeResource) -> None: self._revoke = revoke self.create = to_streamed_response_wrapper( @@ -167,8 +168,8 @@ def __init__(self, revoke: Revoke) -> None: ) -class AsyncRevokeWithStreamingResponse: - def __init__(self, revoke: AsyncRevoke) -> None: +class AsyncRevokeResourceWithStreamingResponse: + def __init__(self, revoke: AsyncRevokeResource) -> None: self._revoke = revoke self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/settings.py b/src/cloudflare/resources/zero_trust/devices/settings.py index 8fb8a01800d..0b1ae97a6d8 100644 --- a/src/cloudflare/resources/zero_trust/devices/settings.py +++ b/src/cloudflare/resources/zero_trust/devices/settings.py @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.devices import ZeroTrustAccountDeviceSettings, setting_update_params +from ....types.zero_trust.devices import setting_update_params +from ....types.zero_trust.devices.device_settings import DeviceSettings -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def update( self, @@ -51,7 +52,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroTrustAccountDeviceSettings]: + ) -> Optional[DeviceSettings]: """ Updates the current device settings for a Zero Trust account. @@ -90,9 +91,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceSettings]]._unwrapper, ), - cast_to=cast(Type[Optional[ZeroTrustAccountDeviceSettings]], ResultWrapper[ZeroTrustAccountDeviceSettings]), + cast_to=cast(Type[Optional[DeviceSettings]], ResultWrapper[DeviceSettings]), ) def list( @@ -105,7 +106,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroTrustAccountDeviceSettings]: + ) -> Optional[DeviceSettings]: """ Describes the current device settings for a Zero Trust account. @@ -127,20 +128,20 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceSettings]]._unwrapper, ), - cast_to=cast(Type[Optional[ZeroTrustAccountDeviceSettings]], ResultWrapper[ZeroTrustAccountDeviceSettings]), + cast_to=cast(Type[Optional[DeviceSettings]], ResultWrapper[DeviceSettings]), ) -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def update( self, @@ -156,7 +157,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroTrustAccountDeviceSettings]: + ) -> Optional[DeviceSettings]: """ Updates the current device settings for a Zero Trust account. @@ -195,9 +196,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceSettings]]._unwrapper, ), - cast_to=cast(Type[Optional[ZeroTrustAccountDeviceSettings]], ResultWrapper[ZeroTrustAccountDeviceSettings]), + cast_to=cast(Type[Optional[DeviceSettings]], ResultWrapper[DeviceSettings]), ) async def list( @@ -210,7 +211,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroTrustAccountDeviceSettings]: + ) -> Optional[DeviceSettings]: """ Describes the current device settings for a Zero Trust account. @@ -232,14 +233,14 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DeviceSettings]]._unwrapper, ), - cast_to=cast(Type[Optional[ZeroTrustAccountDeviceSettings]], ResultWrapper[ZeroTrustAccountDeviceSettings]), + cast_to=cast(Type[Optional[DeviceSettings]], ResultWrapper[DeviceSettings]), ) -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.update = to_raw_response_wrapper( @@ -250,8 +251,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.update = async_to_raw_response_wrapper( @@ -262,8 +263,8 @@ def __init__(self, settings: AsyncSettings) -> None: ) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings self.update = to_streamed_response_wrapper( @@ -274,8 +275,8 @@ def __init__(self, settings: Settings) -> None: ) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/devices/unrevoke.py b/src/cloudflare/resources/zero_trust/devices/unrevoke.py index af66f3e37f9..7a35660c2ef 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, Optional, cast +from typing import Any, List, cast import httpx @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.devices import UnrevokeCreateResponse, unrevoke_create_params +from ....types.zero_trust.devices import unrevoke_create_params +from ....types.zero_trust.devices.unrevoke_create_response import UnrevokeCreateResponse -__all__ = ["Unrevoke", "AsyncUnrevoke"] +__all__ = ["UnrevokeResource", "AsyncUnrevokeResource"] -class Unrevoke(SyncAPIResource): +class UnrevokeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> UnrevokeWithRawResponse: - return UnrevokeWithRawResponse(self) + def with_raw_response(self) -> UnrevokeResourceWithRawResponse: + return UnrevokeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UnrevokeWithStreamingResponse: - return UnrevokeWithStreamingResponse(self) + def with_streaming_response(self) -> UnrevokeResourceWithStreamingResponse: + return UnrevokeResourceWithStreamingResponse(self) def create( self, @@ -48,7 +49,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UnrevokeCreateResponse]: + ) -> UnrevokeCreateResponse: """ Unrevokes a list of devices. @@ -66,7 +67,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( - Optional[UnrevokeCreateResponse], + UnrevokeCreateResponse, self._post( f"/accounts/{account_id}/devices/unrevoke", body=maybe_transform(body, unrevoke_create_params.UnrevokeCreateParams), @@ -75,7 +76,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UnrevokeCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UnrevokeCreateResponse] @@ -84,14 +85,14 @@ def create( ) -class AsyncUnrevoke(AsyncAPIResource): +class AsyncUnrevokeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncUnrevokeWithRawResponse: - return AsyncUnrevokeWithRawResponse(self) + def with_raw_response(self) -> AsyncUnrevokeResourceWithRawResponse: + return AsyncUnrevokeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUnrevokeWithStreamingResponse: - return AsyncUnrevokeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncUnrevokeResourceWithStreamingResponse: + return AsyncUnrevokeResourceWithStreamingResponse(self) async def create( self, @@ -104,7 +105,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UnrevokeCreateResponse]: + ) -> UnrevokeCreateResponse: """ Unrevokes a list of devices. @@ -122,7 +123,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( - Optional[UnrevokeCreateResponse], + UnrevokeCreateResponse, await self._post( f"/accounts/{account_id}/devices/unrevoke", body=await async_maybe_transform(body, unrevoke_create_params.UnrevokeCreateParams), @@ -131,7 +132,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[UnrevokeCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UnrevokeCreateResponse] @@ -140,8 +141,8 @@ async def create( ) -class UnrevokeWithRawResponse: - def __init__(self, unrevoke: Unrevoke) -> None: +class UnrevokeResourceWithRawResponse: + def __init__(self, unrevoke: UnrevokeResource) -> None: self._unrevoke = unrevoke self.create = to_raw_response_wrapper( @@ -149,8 +150,8 @@ def __init__(self, unrevoke: Unrevoke) -> None: ) -class AsyncUnrevokeWithRawResponse: - def __init__(self, unrevoke: AsyncUnrevoke) -> None: +class AsyncUnrevokeResourceWithRawResponse: + def __init__(self, unrevoke: AsyncUnrevokeResource) -> None: self._unrevoke = unrevoke self.create = async_to_raw_response_wrapper( @@ -158,8 +159,8 @@ def __init__(self, unrevoke: AsyncUnrevoke) -> None: ) -class UnrevokeWithStreamingResponse: - def __init__(self, unrevoke: Unrevoke) -> None: +class UnrevokeResourceWithStreamingResponse: + def __init__(self, unrevoke: UnrevokeResource) -> None: self._unrevoke = unrevoke self.create = to_streamed_response_wrapper( @@ -167,8 +168,8 @@ def __init__(self, unrevoke: Unrevoke) -> None: ) -class AsyncUnrevokeWithStreamingResponse: - def __init__(self, unrevoke: AsyncUnrevoke) -> None: +class AsyncUnrevokeResourceWithStreamingResponse: + def __init__(self, unrevoke: AsyncUnrevokeResource) -> None: self._unrevoke = unrevoke self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dex/__init__.py b/src/cloudflare/resources/zero_trust/dex/__init__.py index ff9474a4e7e..b79e8e9ec69 100644 --- a/src/cloudflare/resources/zero_trust/dex/__init__.py +++ b/src/cloudflare/resources/zero_trust/dex/__init__.py @@ -1,103 +1,103 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .dex import ( - DEX, - AsyncDEX, - DEXWithRawResponse, - AsyncDEXWithRawResponse, - DEXWithStreamingResponse, - AsyncDEXWithStreamingResponse, + DEXResource, + AsyncDEXResource, + DEXResourceWithRawResponse, + AsyncDEXResourceWithRawResponse, + DEXResourceWithStreamingResponse, + AsyncDEXResourceWithStreamingResponse, ) from .colos import ( - Colos, - AsyncColos, - ColosWithRawResponse, - AsyncColosWithRawResponse, - ColosWithStreamingResponse, - AsyncColosWithStreamingResponse, + ColosResource, + AsyncColosResource, + ColosResourceWithRawResponse, + AsyncColosResourceWithRawResponse, + ColosResourceWithStreamingResponse, + AsyncColosResourceWithStreamingResponse, ) from .tests import ( - Tests, - AsyncTests, - TestsWithRawResponse, - AsyncTestsWithRawResponse, - TestsWithStreamingResponse, - AsyncTestsWithStreamingResponse, + TestsResource, + AsyncTestsResource, + TestsResourceWithRawResponse, + AsyncTestsResourceWithRawResponse, + TestsResourceWithStreamingResponse, + AsyncTestsResourceWithStreamingResponse, ) from .http_tests import ( - HTTPTests, - AsyncHTTPTests, - HTTPTestsWithRawResponse, - AsyncHTTPTestsWithRawResponse, - HTTPTestsWithStreamingResponse, - AsyncHTTPTestsWithStreamingResponse, + HTTPTestsResource, + AsyncHTTPTestsResource, + HTTPTestsResourceWithRawResponse, + AsyncHTTPTestsResourceWithRawResponse, + HTTPTestsResourceWithStreamingResponse, + AsyncHTTPTestsResourceWithStreamingResponse, ) from .fleet_status import ( - FleetStatus, - AsyncFleetStatus, - FleetStatusWithRawResponse, - AsyncFleetStatusWithRawResponse, - FleetStatusWithStreamingResponse, - AsyncFleetStatusWithStreamingResponse, + FleetStatusResource, + AsyncFleetStatusResource, + FleetStatusResourceWithRawResponse, + AsyncFleetStatusResourceWithRawResponse, + FleetStatusResourceWithStreamingResponse, + AsyncFleetStatusResourceWithStreamingResponse, ) from .traceroute_tests import ( - TracerouteTests, - AsyncTracerouteTests, - TracerouteTestsWithRawResponse, - AsyncTracerouteTestsWithRawResponse, - TracerouteTestsWithStreamingResponse, - AsyncTracerouteTestsWithStreamingResponse, + TracerouteTestsResource, + AsyncTracerouteTestsResource, + TracerouteTestsResourceWithRawResponse, + AsyncTracerouteTestsResourceWithRawResponse, + TracerouteTestsResourceWithStreamingResponse, + AsyncTracerouteTestsResourceWithStreamingResponse, ) from .traceroute_test_results import ( - TracerouteTestResults, - AsyncTracerouteTestResults, - TracerouteTestResultsWithRawResponse, - AsyncTracerouteTestResultsWithRawResponse, - TracerouteTestResultsWithStreamingResponse, - AsyncTracerouteTestResultsWithStreamingResponse, + TracerouteTestResultsResource, + AsyncTracerouteTestResultsResource, + TracerouteTestResultsResourceWithRawResponse, + AsyncTracerouteTestResultsResourceWithRawResponse, + TracerouteTestResultsResourceWithStreamingResponse, + AsyncTracerouteTestResultsResourceWithStreamingResponse, ) __all__ = [ - "Colos", - "AsyncColos", - "ColosWithRawResponse", - "AsyncColosWithRawResponse", - "ColosWithStreamingResponse", - "AsyncColosWithStreamingResponse", - "FleetStatus", - "AsyncFleetStatus", - "FleetStatusWithRawResponse", - "AsyncFleetStatusWithRawResponse", - "FleetStatusWithStreamingResponse", - "AsyncFleetStatusWithStreamingResponse", - "HTTPTests", - "AsyncHTTPTests", - "HTTPTestsWithRawResponse", - "AsyncHTTPTestsWithRawResponse", - "HTTPTestsWithStreamingResponse", - "AsyncHTTPTestsWithStreamingResponse", - "Tests", - "AsyncTests", - "TestsWithRawResponse", - "AsyncTestsWithRawResponse", - "TestsWithStreamingResponse", - "AsyncTestsWithStreamingResponse", - "TracerouteTestResults", - "AsyncTracerouteTestResults", - "TracerouteTestResultsWithRawResponse", - "AsyncTracerouteTestResultsWithRawResponse", - "TracerouteTestResultsWithStreamingResponse", - "AsyncTracerouteTestResultsWithStreamingResponse", - "TracerouteTests", - "AsyncTracerouteTests", - "TracerouteTestsWithRawResponse", - "AsyncTracerouteTestsWithRawResponse", - "TracerouteTestsWithStreamingResponse", - "AsyncTracerouteTestsWithStreamingResponse", - "DEX", - "AsyncDEX", - "DEXWithRawResponse", - "AsyncDEXWithRawResponse", - "DEXWithStreamingResponse", - "AsyncDEXWithStreamingResponse", + "ColosResource", + "AsyncColosResource", + "ColosResourceWithRawResponse", + "AsyncColosResourceWithRawResponse", + "ColosResourceWithStreamingResponse", + "AsyncColosResourceWithStreamingResponse", + "FleetStatusResource", + "AsyncFleetStatusResource", + "FleetStatusResourceWithRawResponse", + "AsyncFleetStatusResourceWithRawResponse", + "FleetStatusResourceWithStreamingResponse", + "AsyncFleetStatusResourceWithStreamingResponse", + "HTTPTestsResource", + "AsyncHTTPTestsResource", + "HTTPTestsResourceWithRawResponse", + "AsyncHTTPTestsResourceWithRawResponse", + "HTTPTestsResourceWithStreamingResponse", + "AsyncHTTPTestsResourceWithStreamingResponse", + "TestsResource", + "AsyncTestsResource", + "TestsResourceWithRawResponse", + "AsyncTestsResourceWithRawResponse", + "TestsResourceWithStreamingResponse", + "AsyncTestsResourceWithStreamingResponse", + "TracerouteTestResultsResource", + "AsyncTracerouteTestResultsResource", + "TracerouteTestResultsResourceWithRawResponse", + "AsyncTracerouteTestResultsResourceWithRawResponse", + "TracerouteTestResultsResourceWithStreamingResponse", + "AsyncTracerouteTestResultsResourceWithStreamingResponse", + "TracerouteTestsResource", + "AsyncTracerouteTestsResource", + "TracerouteTestsResourceWithRawResponse", + "AsyncTracerouteTestsResourceWithRawResponse", + "TracerouteTestsResourceWithStreamingResponse", + "AsyncTracerouteTestsResourceWithStreamingResponse", + "DEXResource", + "AsyncDEXResource", + "DEXResourceWithRawResponse", + "AsyncDEXResourceWithRawResponse", + "DEXResourceWithStreamingResponse", + "AsyncDEXResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/dex/colos.py b/src/cloudflare/resources/zero_trust/dex/colos.py index 8d49fdc332a..6423b82ef5a 100644 --- a/src/cloudflare/resources/zero_trust/dex/colos.py +++ b/src/cloudflare/resources/zero_trust/dex/colos.py @@ -23,17 +23,17 @@ ) from ....types.zero_trust.dex import colo_list_params -__all__ = ["Colos", "AsyncColos"] +__all__ = ["ColosResource", "AsyncColosResource"] -class Colos(SyncAPIResource): +class ColosResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ColosWithRawResponse: - return ColosWithRawResponse(self) + def with_raw_response(self) -> ColosResourceWithRawResponse: + return ColosResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ColosWithStreamingResponse: - return ColosWithStreamingResponse(self) + def with_streaming_response(self) -> ColosResourceWithStreamingResponse: + return ColosResourceWithStreamingResponse(self) def list( self, @@ -93,14 +93,14 @@ def list( ) -class AsyncColos(AsyncAPIResource): +class AsyncColosResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncColosWithRawResponse: - return AsyncColosWithRawResponse(self) + def with_raw_response(self) -> AsyncColosResourceWithRawResponse: + return AsyncColosResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncColosWithStreamingResponse: - return AsyncColosWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncColosResourceWithStreamingResponse: + return AsyncColosResourceWithStreamingResponse(self) def list( self, @@ -160,8 +160,8 @@ def list( ) -class ColosWithRawResponse: - def __init__(self, colos: Colos) -> None: +class ColosResourceWithRawResponse: + def __init__(self, colos: ColosResource) -> None: self._colos = colos self.list = to_raw_response_wrapper( @@ -169,8 +169,8 @@ def __init__(self, colos: Colos) -> None: ) -class AsyncColosWithRawResponse: - def __init__(self, colos: AsyncColos) -> None: +class AsyncColosResourceWithRawResponse: + def __init__(self, colos: AsyncColosResource) -> None: self._colos = colos self.list = async_to_raw_response_wrapper( @@ -178,8 +178,8 @@ def __init__(self, colos: AsyncColos) -> None: ) -class ColosWithStreamingResponse: - def __init__(self, colos: Colos) -> None: +class ColosResourceWithStreamingResponse: + def __init__(self, colos: ColosResource) -> None: self._colos = colos self.list = to_streamed_response_wrapper( @@ -187,8 +187,8 @@ def __init__(self, colos: Colos) -> None: ) -class AsyncColosWithStreamingResponse: - def __init__(self, colos: AsyncColos) -> None: +class AsyncColosResourceWithStreamingResponse: + def __init__(self, colos: AsyncColosResource) -> None: self._colos = colos self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dex/dex.py b/src/cloudflare/resources/zero_trust/dex/dex.py index 20d04b7ecaa..51c3e3dadf3 100644 --- a/src/cloudflare/resources/zero_trust/dex/dex.py +++ b/src/cloudflare/resources/zero_trust/dex/dex.py @@ -3,242 +3,245 @@ from __future__ import annotations from .colos import ( - Colos, - AsyncColos, - ColosWithRawResponse, - AsyncColosWithRawResponse, - ColosWithStreamingResponse, - AsyncColosWithStreamingResponse, + ColosResource, + AsyncColosResource, + ColosResourceWithRawResponse, + AsyncColosResourceWithRawResponse, + ColosResourceWithStreamingResponse, + AsyncColosResourceWithStreamingResponse, ) from .tests import ( - Tests, - AsyncTests, - TestsWithRawResponse, - AsyncTestsWithRawResponse, - TestsWithStreamingResponse, - AsyncTestsWithStreamingResponse, + TestsResource, + AsyncTestsResource, + TestsResourceWithRawResponse, + AsyncTestsResourceWithRawResponse, + TestsResourceWithStreamingResponse, + AsyncTestsResourceWithStreamingResponse, ) from ...._compat import cached_property from .http_tests import ( - HTTPTests, - AsyncHTTPTests, - HTTPTestsWithRawResponse, - AsyncHTTPTestsWithRawResponse, - HTTPTestsWithStreamingResponse, - AsyncHTTPTestsWithStreamingResponse, + HTTPTestsResource, + AsyncHTTPTestsResource, + HTTPTestsResourceWithRawResponse, + AsyncHTTPTestsResourceWithRawResponse, + HTTPTestsResourceWithStreamingResponse, + AsyncHTTPTestsResourceWithStreamingResponse, ) -from .tests.tests import Tests, AsyncTests +from .tests.tests import TestsResource, AsyncTestsResource from ...._resource import SyncAPIResource, AsyncAPIResource from .fleet_status import ( - FleetStatus, - AsyncFleetStatus, - FleetStatusWithRawResponse, - AsyncFleetStatusWithRawResponse, - FleetStatusWithStreamingResponse, - AsyncFleetStatusWithStreamingResponse, + FleetStatusResource, + AsyncFleetStatusResource, + FleetStatusResourceWithRawResponse, + AsyncFleetStatusResourceWithRawResponse, + FleetStatusResourceWithStreamingResponse, + AsyncFleetStatusResourceWithStreamingResponse, ) from .traceroute_tests import ( - TracerouteTests, - AsyncTracerouteTests, - TracerouteTestsWithRawResponse, - AsyncTracerouteTestsWithRawResponse, - TracerouteTestsWithStreamingResponse, - AsyncTracerouteTestsWithStreamingResponse, + TracerouteTestsResource, + AsyncTracerouteTestsResource, + TracerouteTestsResourceWithRawResponse, + AsyncTracerouteTestsResourceWithRawResponse, + TracerouteTestsResourceWithStreamingResponse, + AsyncTracerouteTestsResourceWithStreamingResponse, ) -from .http_tests.http_tests import HTTPTests, AsyncHTTPTests +from .http_tests.http_tests import HTTPTestsResource, AsyncHTTPTestsResource from .traceroute_test_results import ( - TracerouteTestResults, - AsyncTracerouteTestResults, - TracerouteTestResultsWithRawResponse, - AsyncTracerouteTestResultsWithRawResponse, - TracerouteTestResultsWithStreamingResponse, - AsyncTracerouteTestResultsWithStreamingResponse, + TracerouteTestResultsResource, + AsyncTracerouteTestResultsResource, + TracerouteTestResultsResourceWithRawResponse, + AsyncTracerouteTestResultsResourceWithRawResponse, + TracerouteTestResultsResourceWithStreamingResponse, + AsyncTracerouteTestResultsResourceWithStreamingResponse, +) +from .fleet_status.fleet_status import FleetStatusResource, AsyncFleetStatusResource +from .traceroute_test_results.traceroute_test_results import ( + TracerouteTestResultsResource, + AsyncTracerouteTestResultsResource, ) -from .fleet_status.fleet_status import FleetStatus, AsyncFleetStatus -from .traceroute_test_results.traceroute_test_results import TracerouteTestResults, AsyncTracerouteTestResults -__all__ = ["DEX", "AsyncDEX"] +__all__ = ["DEXResource", "AsyncDEXResource"] -class DEX(SyncAPIResource): +class DEXResource(SyncAPIResource): @cached_property - def colos(self) -> Colos: - return Colos(self._client) + def colos(self) -> ColosResource: + return ColosResource(self._client) @cached_property - def fleet_status(self) -> FleetStatus: - return FleetStatus(self._client) + def fleet_status(self) -> FleetStatusResource: + return FleetStatusResource(self._client) @cached_property - def http_tests(self) -> HTTPTests: - return HTTPTests(self._client) + def http_tests(self) -> HTTPTestsResource: + return HTTPTestsResource(self._client) @cached_property - def tests(self) -> Tests: - return Tests(self._client) + def tests(self) -> TestsResource: + return TestsResource(self._client) @cached_property - def traceroute_test_results(self) -> TracerouteTestResults: - return TracerouteTestResults(self._client) + def traceroute_test_results(self) -> TracerouteTestResultsResource: + return TracerouteTestResultsResource(self._client) @cached_property - def traceroute_tests(self) -> TracerouteTests: - return TracerouteTests(self._client) + def traceroute_tests(self) -> TracerouteTestsResource: + return TracerouteTestsResource(self._client) @cached_property - def with_raw_response(self) -> DEXWithRawResponse: - return DEXWithRawResponse(self) + def with_raw_response(self) -> DEXResourceWithRawResponse: + return DEXResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DEXWithStreamingResponse: - return DEXWithStreamingResponse(self) + def with_streaming_response(self) -> DEXResourceWithStreamingResponse: + return DEXResourceWithStreamingResponse(self) -class AsyncDEX(AsyncAPIResource): +class AsyncDEXResource(AsyncAPIResource): @cached_property - def colos(self) -> AsyncColos: - return AsyncColos(self._client) + def colos(self) -> AsyncColosResource: + return AsyncColosResource(self._client) @cached_property - def fleet_status(self) -> AsyncFleetStatus: - return AsyncFleetStatus(self._client) + def fleet_status(self) -> AsyncFleetStatusResource: + return AsyncFleetStatusResource(self._client) @cached_property - def http_tests(self) -> AsyncHTTPTests: - return AsyncHTTPTests(self._client) + def http_tests(self) -> AsyncHTTPTestsResource: + return AsyncHTTPTestsResource(self._client) @cached_property - def tests(self) -> AsyncTests: - return AsyncTests(self._client) + def tests(self) -> AsyncTestsResource: + return AsyncTestsResource(self._client) @cached_property - def traceroute_test_results(self) -> AsyncTracerouteTestResults: - return AsyncTracerouteTestResults(self._client) + def traceroute_test_results(self) -> AsyncTracerouteTestResultsResource: + return AsyncTracerouteTestResultsResource(self._client) @cached_property - def traceroute_tests(self) -> AsyncTracerouteTests: - return AsyncTracerouteTests(self._client) + def traceroute_tests(self) -> AsyncTracerouteTestsResource: + return AsyncTracerouteTestsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDEXWithRawResponse: - return AsyncDEXWithRawResponse(self) + def with_raw_response(self) -> AsyncDEXResourceWithRawResponse: + return AsyncDEXResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDEXWithStreamingResponse: - return AsyncDEXWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDEXResourceWithStreamingResponse: + return AsyncDEXResourceWithStreamingResponse(self) -class DEXWithRawResponse: - def __init__(self, dex: DEX) -> None: +class DEXResourceWithRawResponse: + def __init__(self, dex: DEXResource) -> None: self._dex = dex @cached_property - def colos(self) -> ColosWithRawResponse: - return ColosWithRawResponse(self._dex.colos) + def colos(self) -> ColosResourceWithRawResponse: + return ColosResourceWithRawResponse(self._dex.colos) @cached_property - def fleet_status(self) -> FleetStatusWithRawResponse: - return FleetStatusWithRawResponse(self._dex.fleet_status) + def fleet_status(self) -> FleetStatusResourceWithRawResponse: + return FleetStatusResourceWithRawResponse(self._dex.fleet_status) @cached_property - def http_tests(self) -> HTTPTestsWithRawResponse: - return HTTPTestsWithRawResponse(self._dex.http_tests) + def http_tests(self) -> HTTPTestsResourceWithRawResponse: + return HTTPTestsResourceWithRawResponse(self._dex.http_tests) @cached_property - def tests(self) -> TestsWithRawResponse: - return TestsWithRawResponse(self._dex.tests) + def tests(self) -> TestsResourceWithRawResponse: + return TestsResourceWithRawResponse(self._dex.tests) @cached_property - def traceroute_test_results(self) -> TracerouteTestResultsWithRawResponse: - return TracerouteTestResultsWithRawResponse(self._dex.traceroute_test_results) + def traceroute_test_results(self) -> TracerouteTestResultsResourceWithRawResponse: + return TracerouteTestResultsResourceWithRawResponse(self._dex.traceroute_test_results) @cached_property - def traceroute_tests(self) -> TracerouteTestsWithRawResponse: - return TracerouteTestsWithRawResponse(self._dex.traceroute_tests) + def traceroute_tests(self) -> TracerouteTestsResourceWithRawResponse: + return TracerouteTestsResourceWithRawResponse(self._dex.traceroute_tests) -class AsyncDEXWithRawResponse: - def __init__(self, dex: AsyncDEX) -> None: +class AsyncDEXResourceWithRawResponse: + def __init__(self, dex: AsyncDEXResource) -> None: self._dex = dex @cached_property - def colos(self) -> AsyncColosWithRawResponse: - return AsyncColosWithRawResponse(self._dex.colos) + def colos(self) -> AsyncColosResourceWithRawResponse: + return AsyncColosResourceWithRawResponse(self._dex.colos) @cached_property - def fleet_status(self) -> AsyncFleetStatusWithRawResponse: - return AsyncFleetStatusWithRawResponse(self._dex.fleet_status) + def fleet_status(self) -> AsyncFleetStatusResourceWithRawResponse: + return AsyncFleetStatusResourceWithRawResponse(self._dex.fleet_status) @cached_property - def http_tests(self) -> AsyncHTTPTestsWithRawResponse: - return AsyncHTTPTestsWithRawResponse(self._dex.http_tests) + def http_tests(self) -> AsyncHTTPTestsResourceWithRawResponse: + return AsyncHTTPTestsResourceWithRawResponse(self._dex.http_tests) @cached_property - def tests(self) -> AsyncTestsWithRawResponse: - return AsyncTestsWithRawResponse(self._dex.tests) + def tests(self) -> AsyncTestsResourceWithRawResponse: + return AsyncTestsResourceWithRawResponse(self._dex.tests) @cached_property - def traceroute_test_results(self) -> AsyncTracerouteTestResultsWithRawResponse: - return AsyncTracerouteTestResultsWithRawResponse(self._dex.traceroute_test_results) + def traceroute_test_results(self) -> AsyncTracerouteTestResultsResourceWithRawResponse: + return AsyncTracerouteTestResultsResourceWithRawResponse(self._dex.traceroute_test_results) @cached_property - def traceroute_tests(self) -> AsyncTracerouteTestsWithRawResponse: - return AsyncTracerouteTestsWithRawResponse(self._dex.traceroute_tests) + def traceroute_tests(self) -> AsyncTracerouteTestsResourceWithRawResponse: + return AsyncTracerouteTestsResourceWithRawResponse(self._dex.traceroute_tests) -class DEXWithStreamingResponse: - def __init__(self, dex: DEX) -> None: +class DEXResourceWithStreamingResponse: + def __init__(self, dex: DEXResource) -> None: self._dex = dex @cached_property - def colos(self) -> ColosWithStreamingResponse: - return ColosWithStreamingResponse(self._dex.colos) + def colos(self) -> ColosResourceWithStreamingResponse: + return ColosResourceWithStreamingResponse(self._dex.colos) @cached_property - def fleet_status(self) -> FleetStatusWithStreamingResponse: - return FleetStatusWithStreamingResponse(self._dex.fleet_status) + def fleet_status(self) -> FleetStatusResourceWithStreamingResponse: + return FleetStatusResourceWithStreamingResponse(self._dex.fleet_status) @cached_property - def http_tests(self) -> HTTPTestsWithStreamingResponse: - return HTTPTestsWithStreamingResponse(self._dex.http_tests) + def http_tests(self) -> HTTPTestsResourceWithStreamingResponse: + return HTTPTestsResourceWithStreamingResponse(self._dex.http_tests) @cached_property - def tests(self) -> TestsWithStreamingResponse: - return TestsWithStreamingResponse(self._dex.tests) + def tests(self) -> TestsResourceWithStreamingResponse: + return TestsResourceWithStreamingResponse(self._dex.tests) @cached_property - def traceroute_test_results(self) -> TracerouteTestResultsWithStreamingResponse: - return TracerouteTestResultsWithStreamingResponse(self._dex.traceroute_test_results) + def traceroute_test_results(self) -> TracerouteTestResultsResourceWithStreamingResponse: + return TracerouteTestResultsResourceWithStreamingResponse(self._dex.traceroute_test_results) @cached_property - def traceroute_tests(self) -> TracerouteTestsWithStreamingResponse: - return TracerouteTestsWithStreamingResponse(self._dex.traceroute_tests) + def traceroute_tests(self) -> TracerouteTestsResourceWithStreamingResponse: + return TracerouteTestsResourceWithStreamingResponse(self._dex.traceroute_tests) -class AsyncDEXWithStreamingResponse: - def __init__(self, dex: AsyncDEX) -> None: +class AsyncDEXResourceWithStreamingResponse: + def __init__(self, dex: AsyncDEXResource) -> None: self._dex = dex @cached_property - def colos(self) -> AsyncColosWithStreamingResponse: - return AsyncColosWithStreamingResponse(self._dex.colos) + def colos(self) -> AsyncColosResourceWithStreamingResponse: + return AsyncColosResourceWithStreamingResponse(self._dex.colos) @cached_property - def fleet_status(self) -> AsyncFleetStatusWithStreamingResponse: - return AsyncFleetStatusWithStreamingResponse(self._dex.fleet_status) + def fleet_status(self) -> AsyncFleetStatusResourceWithStreamingResponse: + return AsyncFleetStatusResourceWithStreamingResponse(self._dex.fleet_status) @cached_property - def http_tests(self) -> AsyncHTTPTestsWithStreamingResponse: - return AsyncHTTPTestsWithStreamingResponse(self._dex.http_tests) + def http_tests(self) -> AsyncHTTPTestsResourceWithStreamingResponse: + return AsyncHTTPTestsResourceWithStreamingResponse(self._dex.http_tests) @cached_property - def tests(self) -> AsyncTestsWithStreamingResponse: - return AsyncTestsWithStreamingResponse(self._dex.tests) + def tests(self) -> AsyncTestsResourceWithStreamingResponse: + return AsyncTestsResourceWithStreamingResponse(self._dex.tests) @cached_property - def traceroute_test_results(self) -> AsyncTracerouteTestResultsWithStreamingResponse: - return AsyncTracerouteTestResultsWithStreamingResponse(self._dex.traceroute_test_results) + def traceroute_test_results(self) -> AsyncTracerouteTestResultsResourceWithStreamingResponse: + return AsyncTracerouteTestResultsResourceWithStreamingResponse(self._dex.traceroute_test_results) @cached_property - def traceroute_tests(self) -> AsyncTracerouteTestsWithStreamingResponse: - return AsyncTracerouteTestsWithStreamingResponse(self._dex.traceroute_tests) + def traceroute_tests(self) -> AsyncTracerouteTestsResourceWithStreamingResponse: + return AsyncTracerouteTestsResourceWithStreamingResponse(self._dex.traceroute_tests) diff --git a/src/cloudflare/resources/zero_trust/dex/fleet_status/__init__.py b/src/cloudflare/resources/zero_trust/dex/fleet_status/__init__.py index f0d4513677d..7d9516cc125 100644 --- a/src/cloudflare/resources/zero_trust/dex/fleet_status/__init__.py +++ b/src/cloudflare/resources/zero_trust/dex/fleet_status/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .devices import ( - Devices, - AsyncDevices, - DevicesWithRawResponse, - AsyncDevicesWithRawResponse, - DevicesWithStreamingResponse, - AsyncDevicesWithStreamingResponse, + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, ) from .fleet_status import ( - FleetStatus, - AsyncFleetStatus, - FleetStatusWithRawResponse, - AsyncFleetStatusWithRawResponse, - FleetStatusWithStreamingResponse, - AsyncFleetStatusWithStreamingResponse, + FleetStatusResource, + AsyncFleetStatusResource, + FleetStatusResourceWithRawResponse, + AsyncFleetStatusResourceWithRawResponse, + FleetStatusResourceWithStreamingResponse, + AsyncFleetStatusResourceWithStreamingResponse, ) __all__ = [ - "Devices", - "AsyncDevices", - "DevicesWithRawResponse", - "AsyncDevicesWithRawResponse", - "DevicesWithStreamingResponse", - "AsyncDevicesWithStreamingResponse", - "FleetStatus", - "AsyncFleetStatus", - "FleetStatusWithRawResponse", - "AsyncFleetStatusWithRawResponse", - "FleetStatusWithStreamingResponse", - "AsyncFleetStatusWithStreamingResponse", + "DevicesResource", + "AsyncDevicesResource", + "DevicesResourceWithRawResponse", + "AsyncDevicesResourceWithRawResponse", + "DevicesResourceWithStreamingResponse", + "AsyncDevicesResourceWithStreamingResponse", + "FleetStatusResource", + "AsyncFleetStatusResource", + "FleetStatusResourceWithRawResponse", + "AsyncFleetStatusResourceWithRawResponse", + "FleetStatusResourceWithStreamingResponse", + "AsyncFleetStatusResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/dex/fleet_status/devices.py b/src/cloudflare/resources/zero_trust/dex/fleet_status/devices.py index 434df9b70f3..34a786574f9 100644 --- a/src/cloudflare/resources/zero_trust/dex/fleet_status/devices.py +++ b/src/cloudflare/resources/zero_trust/dex/fleet_status/devices.py @@ -21,19 +21,20 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.dex.fleet_status import DigitalExperienceMonitoringDevice, device_list_params +from .....types.zero_trust.dex.fleet_status import device_list_params +from .....types.zero_trust.dex.fleet_status.device_list_response import DeviceListResponse -__all__ = ["Devices", "AsyncDevices"] +__all__ = ["DevicesResource", "AsyncDevicesResource"] -class Devices(SyncAPIResource): +class DevicesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DevicesWithRawResponse: - return DevicesWithRawResponse(self) + def with_raw_response(self) -> DevicesResourceWithRawResponse: + return DevicesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DevicesWithStreamingResponse: - return DevicesWithStreamingResponse(self) + def with_streaming_response(self) -> DevicesResourceWithStreamingResponse: + return DevicesResourceWithStreamingResponse(self) def list( self, @@ -57,7 +58,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[DigitalExperienceMonitoringDevice]: + ) -> SyncV4PagePaginationArray[DeviceListResponse]: """ List details for devices using WARP @@ -96,7 +97,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/dex/fleet-status/devices", - page=SyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], + page=SyncV4PagePaginationArray[DeviceListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -119,18 +120,18 @@ def list( device_list_params.DeviceListParams, ), ), - model=DigitalExperienceMonitoringDevice, + model=DeviceListResponse, ) -class AsyncDevices(AsyncAPIResource): +class AsyncDevicesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDevicesWithRawResponse: - return AsyncDevicesWithRawResponse(self) + def with_raw_response(self) -> AsyncDevicesResourceWithRawResponse: + return AsyncDevicesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDevicesWithStreamingResponse: - return AsyncDevicesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDevicesResourceWithStreamingResponse: + return AsyncDevicesResourceWithStreamingResponse(self) def list( self, @@ -154,9 +155,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ - DigitalExperienceMonitoringDevice, AsyncV4PagePaginationArray[DigitalExperienceMonitoringDevice] - ]: + ) -> AsyncPaginator[DeviceListResponse, AsyncV4PagePaginationArray[DeviceListResponse]]: """ List details for devices using WARP @@ -195,7 +194,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/dex/fleet-status/devices", - page=AsyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], + page=AsyncV4PagePaginationArray[DeviceListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -218,12 +217,12 @@ def list( device_list_params.DeviceListParams, ), ), - model=DigitalExperienceMonitoringDevice, + model=DeviceListResponse, ) -class DevicesWithRawResponse: - def __init__(self, devices: Devices) -> None: +class DevicesResourceWithRawResponse: + def __init__(self, devices: DevicesResource) -> None: self._devices = devices self.list = to_raw_response_wrapper( @@ -231,8 +230,8 @@ def __init__(self, devices: Devices) -> None: ) -class AsyncDevicesWithRawResponse: - def __init__(self, devices: AsyncDevices) -> None: +class AsyncDevicesResourceWithRawResponse: + def __init__(self, devices: AsyncDevicesResource) -> None: self._devices = devices self.list = async_to_raw_response_wrapper( @@ -240,8 +239,8 @@ def __init__(self, devices: AsyncDevices) -> None: ) -class DevicesWithStreamingResponse: - def __init__(self, devices: Devices) -> None: +class DevicesResourceWithStreamingResponse: + def __init__(self, devices: DevicesResource) -> None: self._devices = devices self.list = to_streamed_response_wrapper( @@ -249,8 +248,8 @@ def __init__(self, devices: Devices) -> None: ) -class AsyncDevicesWithStreamingResponse: - def __init__(self, devices: AsyncDevices) -> None: +class AsyncDevicesResourceWithStreamingResponse: + def __init__(self, devices: AsyncDevicesResource) -> None: self._devices = devices self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dex/fleet_status/fleet_status.py b/src/cloudflare/resources/zero_trust/dex/fleet_status/fleet_status.py index 1493bad0088..23033b3ea99 100644 --- a/src/cloudflare/resources/zero_trust/dex/fleet_status/fleet_status.py +++ b/src/cloudflare/resources/zero_trust/dex/fleet_status/fleet_status.py @@ -2,17 +2,17 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx from .devices import ( - Devices, - AsyncDevices, - DevicesWithRawResponse, - AsyncDevicesWithRawResponse, - DevicesWithStreamingResponse, - AsyncDevicesWithStreamingResponse, + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ....._utils import ( @@ -31,23 +31,24 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.dex import FleetStatusLiveResponse, fleet_status_live_params, fleet_status_over_time_params +from .....types.zero_trust.dex import fleet_status_live_params, fleet_status_over_time_params +from .....types.zero_trust.dex.fleet_status_live_response import FleetStatusLiveResponse -__all__ = ["FleetStatus", "AsyncFleetStatus"] +__all__ = ["FleetStatusResource", "AsyncFleetStatusResource"] -class FleetStatus(SyncAPIResource): +class FleetStatusResource(SyncAPIResource): @cached_property - def devices(self) -> Devices: - return Devices(self._client) + def devices(self) -> DevicesResource: + return DevicesResource(self._client) @cached_property - def with_raw_response(self) -> FleetStatusWithRawResponse: - return FleetStatusWithRawResponse(self) + def with_raw_response(self) -> FleetStatusResourceWithRawResponse: + return FleetStatusResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FleetStatusWithStreamingResponse: - return FleetStatusWithStreamingResponse(self) + def with_streaming_response(self) -> FleetStatusResourceWithStreamingResponse: + return FleetStatusResourceWithStreamingResponse(self) def live( self, @@ -60,7 +61,7 @@ def live( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FleetStatusLiveResponse: + ) -> Optional[FleetStatusLiveResponse]: """ List details for live (up to 60 minutes) devices using WARP @@ -85,9 +86,9 @@ def live( extra_body=extra_body, timeout=timeout, query=maybe_transform({"since_minutes": since_minutes}, fleet_status_live_params.FleetStatusLiveParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FleetStatusLiveResponse]]._unwrapper, ), - cast_to=cast(Type[FleetStatusLiveResponse], ResultWrapper[FleetStatusLiveResponse]), + cast_to=cast(Type[Optional[FleetStatusLiveResponse]], ResultWrapper[FleetStatusLiveResponse]), ) def over_time( @@ -149,18 +150,18 @@ def over_time( ) -class AsyncFleetStatus(AsyncAPIResource): +class AsyncFleetStatusResource(AsyncAPIResource): @cached_property - def devices(self) -> AsyncDevices: - return AsyncDevices(self._client) + def devices(self) -> AsyncDevicesResource: + return AsyncDevicesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncFleetStatusWithRawResponse: - return AsyncFleetStatusWithRawResponse(self) + def with_raw_response(self) -> AsyncFleetStatusResourceWithRawResponse: + return AsyncFleetStatusResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFleetStatusWithStreamingResponse: - return AsyncFleetStatusWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFleetStatusResourceWithStreamingResponse: + return AsyncFleetStatusResourceWithStreamingResponse(self) async def live( self, @@ -173,7 +174,7 @@ async def live( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FleetStatusLiveResponse: + ) -> Optional[FleetStatusLiveResponse]: """ List details for live (up to 60 minutes) devices using WARP @@ -200,9 +201,9 @@ async def live( query=await async_maybe_transform( {"since_minutes": since_minutes}, fleet_status_live_params.FleetStatusLiveParams ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FleetStatusLiveResponse]]._unwrapper, ), - cast_to=cast(Type[FleetStatusLiveResponse], ResultWrapper[FleetStatusLiveResponse]), + cast_to=cast(Type[Optional[FleetStatusLiveResponse]], ResultWrapper[FleetStatusLiveResponse]), ) async def over_time( @@ -264,8 +265,8 @@ async def over_time( ) -class FleetStatusWithRawResponse: - def __init__(self, fleet_status: FleetStatus) -> None: +class FleetStatusResourceWithRawResponse: + def __init__(self, fleet_status: FleetStatusResource) -> None: self._fleet_status = fleet_status self.live = to_raw_response_wrapper( @@ -276,12 +277,12 @@ def __init__(self, fleet_status: FleetStatus) -> None: ) @cached_property - def devices(self) -> DevicesWithRawResponse: - return DevicesWithRawResponse(self._fleet_status.devices) + def devices(self) -> DevicesResourceWithRawResponse: + return DevicesResourceWithRawResponse(self._fleet_status.devices) -class AsyncFleetStatusWithRawResponse: - def __init__(self, fleet_status: AsyncFleetStatus) -> None: +class AsyncFleetStatusResourceWithRawResponse: + def __init__(self, fleet_status: AsyncFleetStatusResource) -> None: self._fleet_status = fleet_status self.live = async_to_raw_response_wrapper( @@ -292,12 +293,12 @@ def __init__(self, fleet_status: AsyncFleetStatus) -> None: ) @cached_property - def devices(self) -> AsyncDevicesWithRawResponse: - return AsyncDevicesWithRawResponse(self._fleet_status.devices) + def devices(self) -> AsyncDevicesResourceWithRawResponse: + return AsyncDevicesResourceWithRawResponse(self._fleet_status.devices) -class FleetStatusWithStreamingResponse: - def __init__(self, fleet_status: FleetStatus) -> None: +class FleetStatusResourceWithStreamingResponse: + def __init__(self, fleet_status: FleetStatusResource) -> None: self._fleet_status = fleet_status self.live = to_streamed_response_wrapper( @@ -308,12 +309,12 @@ def __init__(self, fleet_status: FleetStatus) -> None: ) @cached_property - def devices(self) -> DevicesWithStreamingResponse: - return DevicesWithStreamingResponse(self._fleet_status.devices) + def devices(self) -> DevicesResourceWithStreamingResponse: + return DevicesResourceWithStreamingResponse(self._fleet_status.devices) -class AsyncFleetStatusWithStreamingResponse: - def __init__(self, fleet_status: AsyncFleetStatus) -> None: +class AsyncFleetStatusResourceWithStreamingResponse: + def __init__(self, fleet_status: AsyncFleetStatusResource) -> None: self._fleet_status = fleet_status self.live = async_to_streamed_response_wrapper( @@ -324,5 +325,5 @@ def __init__(self, fleet_status: AsyncFleetStatus) -> None: ) @cached_property - def devices(self) -> AsyncDevicesWithStreamingResponse: - return AsyncDevicesWithStreamingResponse(self._fleet_status.devices) + def devices(self) -> AsyncDevicesResourceWithStreamingResponse: + return AsyncDevicesResourceWithStreamingResponse(self._fleet_status.devices) diff --git a/src/cloudflare/resources/zero_trust/dex/http_tests/__init__.py b/src/cloudflare/resources/zero_trust/dex/http_tests/__init__.py index 842d182cff0..f2d51e982be 100644 --- a/src/cloudflare/resources/zero_trust/dex/http_tests/__init__.py +++ b/src/cloudflare/resources/zero_trust/dex/http_tests/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .http_tests import ( - HTTPTests, - AsyncHTTPTests, - HTTPTestsWithRawResponse, - AsyncHTTPTestsWithRawResponse, - HTTPTestsWithStreamingResponse, - AsyncHTTPTestsWithStreamingResponse, + HTTPTestsResource, + AsyncHTTPTestsResource, + HTTPTestsResourceWithRawResponse, + AsyncHTTPTestsResourceWithRawResponse, + HTTPTestsResourceWithStreamingResponse, + AsyncHTTPTestsResourceWithStreamingResponse, ) from .percentiles import ( - Percentiles, - AsyncPercentiles, - PercentilesWithRawResponse, - AsyncPercentilesWithRawResponse, - PercentilesWithStreamingResponse, - AsyncPercentilesWithStreamingResponse, + PercentilesResource, + AsyncPercentilesResource, + PercentilesResourceWithRawResponse, + AsyncPercentilesResourceWithRawResponse, + PercentilesResourceWithStreamingResponse, + AsyncPercentilesResourceWithStreamingResponse, ) __all__ = [ - "Percentiles", - "AsyncPercentiles", - "PercentilesWithRawResponse", - "AsyncPercentilesWithRawResponse", - "PercentilesWithStreamingResponse", - "AsyncPercentilesWithStreamingResponse", - "HTTPTests", - "AsyncHTTPTests", - "HTTPTestsWithRawResponse", - "AsyncHTTPTestsWithRawResponse", - "HTTPTestsWithStreamingResponse", - "AsyncHTTPTestsWithStreamingResponse", + "PercentilesResource", + "AsyncPercentilesResource", + "PercentilesResourceWithRawResponse", + "AsyncPercentilesResourceWithRawResponse", + "PercentilesResourceWithStreamingResponse", + "AsyncPercentilesResourceWithStreamingResponse", + "HTTPTestsResource", + "AsyncHTTPTestsResource", + "HTTPTestsResourceWithRawResponse", + "AsyncHTTPTestsResourceWithRawResponse", + "HTTPTestsResourceWithStreamingResponse", + "AsyncHTTPTestsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/dex/http_tests/http_tests.py b/src/cloudflare/resources/zero_trust/dex/http_tests/http_tests.py index cdaf706b472..31b71442618 100644 --- a/src/cloudflare/resources/zero_trust/dex/http_tests/http_tests.py +++ b/src/cloudflare/resources/zero_trust/dex/http_tests/http_tests.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Optional, cast from typing_extensions import Literal import httpx @@ -14,12 +14,12 @@ ) from ....._compat import cached_property from .percentiles import ( - Percentiles, - AsyncPercentiles, - PercentilesWithRawResponse, - AsyncPercentilesWithRawResponse, - PercentilesWithStreamingResponse, - AsyncPercentilesWithStreamingResponse, + PercentilesResource, + AsyncPercentilesResource, + PercentilesResourceWithRawResponse, + AsyncPercentilesResourceWithRawResponse, + PercentilesResourceWithStreamingResponse, + AsyncPercentilesResourceWithStreamingResponse, ) from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( @@ -32,23 +32,24 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.dex import DigitalExperienceMonitoringHTTPDetails, http_test_get_params +from .....types.zero_trust.dex import http_test_get_params +from .....types.zero_trust.dex.http_details import HTTPDetails -__all__ = ["HTTPTests", "AsyncHTTPTests"] +__all__ = ["HTTPTestsResource", "AsyncHTTPTestsResource"] -class HTTPTests(SyncAPIResource): +class HTTPTestsResource(SyncAPIResource): @cached_property - def percentiles(self) -> Percentiles: - return Percentiles(self._client) + def percentiles(self) -> PercentilesResource: + return PercentilesResource(self._client) @cached_property - def with_raw_response(self) -> HTTPTestsWithRawResponse: - return HTTPTestsWithRawResponse(self) + def with_raw_response(self) -> HTTPTestsResourceWithRawResponse: + return HTTPTestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HTTPTestsWithStreamingResponse: - return HTTPTestsWithStreamingResponse(self) + def with_streaming_response(self) -> HTTPTestsResourceWithStreamingResponse: + return HTTPTestsResourceWithStreamingResponse(self) def get( self, @@ -66,7 +67,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringHTTPDetails: + ) -> Optional[HTTPDetails]: """ Get test details and aggregate performance metrics for an http test for a given time period between 1 hour and 7 days. @@ -115,26 +116,24 @@ def get( }, http_test_get_params.HTTPTestGetParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringHTTPDetails], ResultWrapper[DigitalExperienceMonitoringHTTPDetails] + post_parser=ResultWrapper[Optional[HTTPDetails]]._unwrapper, ), + cast_to=cast(Type[Optional[HTTPDetails]], ResultWrapper[HTTPDetails]), ) -class AsyncHTTPTests(AsyncAPIResource): +class AsyncHTTPTestsResource(AsyncAPIResource): @cached_property - def percentiles(self) -> AsyncPercentiles: - return AsyncPercentiles(self._client) + def percentiles(self) -> AsyncPercentilesResource: + return AsyncPercentilesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncHTTPTestsWithRawResponse: - return AsyncHTTPTestsWithRawResponse(self) + def with_raw_response(self) -> AsyncHTTPTestsResourceWithRawResponse: + return AsyncHTTPTestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHTTPTestsWithStreamingResponse: - return AsyncHTTPTestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHTTPTestsResourceWithStreamingResponse: + return AsyncHTTPTestsResourceWithStreamingResponse(self) async def get( self, @@ -152,7 +151,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringHTTPDetails: + ) -> Optional[HTTPDetails]: """ Get test details and aggregate performance metrics for an http test for a given time period between 1 hour and 7 days. @@ -201,16 +200,14 @@ async def get( }, http_test_get_params.HTTPTestGetParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringHTTPDetails], ResultWrapper[DigitalExperienceMonitoringHTTPDetails] + post_parser=ResultWrapper[Optional[HTTPDetails]]._unwrapper, ), + cast_to=cast(Type[Optional[HTTPDetails]], ResultWrapper[HTTPDetails]), ) -class HTTPTestsWithRawResponse: - def __init__(self, http_tests: HTTPTests) -> None: +class HTTPTestsResourceWithRawResponse: + def __init__(self, http_tests: HTTPTestsResource) -> None: self._http_tests = http_tests self.get = to_raw_response_wrapper( @@ -218,12 +215,12 @@ def __init__(self, http_tests: HTTPTests) -> None: ) @cached_property - def percentiles(self) -> PercentilesWithRawResponse: - return PercentilesWithRawResponse(self._http_tests.percentiles) + def percentiles(self) -> PercentilesResourceWithRawResponse: + return PercentilesResourceWithRawResponse(self._http_tests.percentiles) -class AsyncHTTPTestsWithRawResponse: - def __init__(self, http_tests: AsyncHTTPTests) -> None: +class AsyncHTTPTestsResourceWithRawResponse: + def __init__(self, http_tests: AsyncHTTPTestsResource) -> None: self._http_tests = http_tests self.get = async_to_raw_response_wrapper( @@ -231,12 +228,12 @@ def __init__(self, http_tests: AsyncHTTPTests) -> None: ) @cached_property - def percentiles(self) -> AsyncPercentilesWithRawResponse: - return AsyncPercentilesWithRawResponse(self._http_tests.percentiles) + def percentiles(self) -> AsyncPercentilesResourceWithRawResponse: + return AsyncPercentilesResourceWithRawResponse(self._http_tests.percentiles) -class HTTPTestsWithStreamingResponse: - def __init__(self, http_tests: HTTPTests) -> None: +class HTTPTestsResourceWithStreamingResponse: + def __init__(self, http_tests: HTTPTestsResource) -> None: self._http_tests = http_tests self.get = to_streamed_response_wrapper( @@ -244,12 +241,12 @@ def __init__(self, http_tests: HTTPTests) -> None: ) @cached_property - def percentiles(self) -> PercentilesWithStreamingResponse: - return PercentilesWithStreamingResponse(self._http_tests.percentiles) + def percentiles(self) -> PercentilesResourceWithStreamingResponse: + return PercentilesResourceWithStreamingResponse(self._http_tests.percentiles) -class AsyncHTTPTestsWithStreamingResponse: - def __init__(self, http_tests: AsyncHTTPTests) -> None: +class AsyncHTTPTestsResourceWithStreamingResponse: + def __init__(self, http_tests: AsyncHTTPTestsResource) -> None: self._http_tests = http_tests self.get = async_to_streamed_response_wrapper( @@ -257,5 +254,5 @@ def __init__(self, http_tests: AsyncHTTPTests) -> None: ) @cached_property - def percentiles(self) -> AsyncPercentilesWithStreamingResponse: - return AsyncPercentilesWithStreamingResponse(self._http_tests.percentiles) + def percentiles(self) -> AsyncPercentilesResourceWithStreamingResponse: + return AsyncPercentilesResourceWithStreamingResponse(self._http_tests.percentiles) diff --git a/src/cloudflare/resources/zero_trust/dex/http_tests/percentiles.py b/src/cloudflare/resources/zero_trust/dex/http_tests/percentiles.py index ef01c391a80..b8b4330a11c 100644 --- a/src/cloudflare/resources/zero_trust/dex/http_tests/percentiles.py +++ b/src/cloudflare/resources/zero_trust/dex/http_tests/percentiles.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Optional, cast import httpx @@ -23,22 +23,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.dex.http_tests import ( - DigitalExperienceMonitoringHTTPDetailsPercentiles, - percentile_get_params, -) +from .....types.zero_trust.dex.http_tests import percentile_get_params +from .....types.zero_trust.dex.http_tests.http_details_percentiles import HTTPDetailsPercentiles -__all__ = ["Percentiles", "AsyncPercentiles"] +__all__ = ["PercentilesResource", "AsyncPercentilesResource"] -class Percentiles(SyncAPIResource): +class PercentilesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PercentilesWithRawResponse: - return PercentilesWithRawResponse(self) + def with_raw_response(self) -> PercentilesResourceWithRawResponse: + return PercentilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PercentilesWithStreamingResponse: - return PercentilesWithStreamingResponse(self) + def with_streaming_response(self) -> PercentilesResourceWithStreamingResponse: + return PercentilesResourceWithStreamingResponse(self) def get( self, @@ -55,7 +53,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringHTTPDetailsPercentiles: + ) -> Optional[HTTPDetailsPercentiles]: """ Get percentiles for an http test for a given time period between 1 hour and 7 days. @@ -101,23 +99,20 @@ def get( }, percentile_get_params.PercentileGetParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringHTTPDetailsPercentiles], - ResultWrapper[DigitalExperienceMonitoringHTTPDetailsPercentiles], + post_parser=ResultWrapper[Optional[HTTPDetailsPercentiles]]._unwrapper, ), + cast_to=cast(Type[Optional[HTTPDetailsPercentiles]], ResultWrapper[HTTPDetailsPercentiles]), ) -class AsyncPercentiles(AsyncAPIResource): +class AsyncPercentilesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPercentilesWithRawResponse: - return AsyncPercentilesWithRawResponse(self) + def with_raw_response(self) -> AsyncPercentilesResourceWithRawResponse: + return AsyncPercentilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPercentilesWithStreamingResponse: - return AsyncPercentilesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPercentilesResourceWithStreamingResponse: + return AsyncPercentilesResourceWithStreamingResponse(self) async def get( self, @@ -134,7 +129,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringHTTPDetailsPercentiles: + ) -> Optional[HTTPDetailsPercentiles]: """ Get percentiles for an http test for a given time period between 1 hour and 7 days. @@ -180,17 +175,14 @@ async def get( }, percentile_get_params.PercentileGetParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringHTTPDetailsPercentiles], - ResultWrapper[DigitalExperienceMonitoringHTTPDetailsPercentiles], + post_parser=ResultWrapper[Optional[HTTPDetailsPercentiles]]._unwrapper, ), + cast_to=cast(Type[Optional[HTTPDetailsPercentiles]], ResultWrapper[HTTPDetailsPercentiles]), ) -class PercentilesWithRawResponse: - def __init__(self, percentiles: Percentiles) -> None: +class PercentilesResourceWithRawResponse: + def __init__(self, percentiles: PercentilesResource) -> None: self._percentiles = percentiles self.get = to_raw_response_wrapper( @@ -198,8 +190,8 @@ def __init__(self, percentiles: Percentiles) -> None: ) -class AsyncPercentilesWithRawResponse: - def __init__(self, percentiles: AsyncPercentiles) -> None: +class AsyncPercentilesResourceWithRawResponse: + def __init__(self, percentiles: AsyncPercentilesResource) -> None: self._percentiles = percentiles self.get = async_to_raw_response_wrapper( @@ -207,8 +199,8 @@ def __init__(self, percentiles: AsyncPercentiles) -> None: ) -class PercentilesWithStreamingResponse: - def __init__(self, percentiles: Percentiles) -> None: +class PercentilesResourceWithStreamingResponse: + def __init__(self, percentiles: PercentilesResource) -> None: self._percentiles = percentiles self.get = to_streamed_response_wrapper( @@ -216,8 +208,8 @@ def __init__(self, percentiles: Percentiles) -> None: ) -class AsyncPercentilesWithStreamingResponse: - def __init__(self, percentiles: AsyncPercentiles) -> None: +class AsyncPercentilesResourceWithStreamingResponse: + def __init__(self, percentiles: AsyncPercentilesResource) -> None: self._percentiles = percentiles self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dex/tests/__init__.py b/src/cloudflare/resources/zero_trust/dex/tests/__init__.py index 693f7b88a37..ab45ccf229c 100644 --- a/src/cloudflare/resources/zero_trust/dex/tests/__init__.py +++ b/src/cloudflare/resources/zero_trust/dex/tests/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .tests import ( - Tests, - AsyncTests, - TestsWithRawResponse, - AsyncTestsWithRawResponse, - TestsWithStreamingResponse, - AsyncTestsWithStreamingResponse, + TestsResource, + AsyncTestsResource, + TestsResourceWithRawResponse, + AsyncTestsResourceWithRawResponse, + TestsResourceWithStreamingResponse, + AsyncTestsResourceWithStreamingResponse, ) from .unique_devices import ( - UniqueDevices, - AsyncUniqueDevices, - UniqueDevicesWithRawResponse, - AsyncUniqueDevicesWithRawResponse, - UniqueDevicesWithStreamingResponse, - AsyncUniqueDevicesWithStreamingResponse, + UniqueDevicesResource, + AsyncUniqueDevicesResource, + UniqueDevicesResourceWithRawResponse, + AsyncUniqueDevicesResourceWithRawResponse, + UniqueDevicesResourceWithStreamingResponse, + AsyncUniqueDevicesResourceWithStreamingResponse, ) __all__ = [ - "UniqueDevices", - "AsyncUniqueDevices", - "UniqueDevicesWithRawResponse", - "AsyncUniqueDevicesWithRawResponse", - "UniqueDevicesWithStreamingResponse", - "AsyncUniqueDevicesWithStreamingResponse", - "Tests", - "AsyncTests", - "TestsWithRawResponse", - "AsyncTestsWithRawResponse", - "TestsWithStreamingResponse", - "AsyncTestsWithStreamingResponse", + "UniqueDevicesResource", + "AsyncUniqueDevicesResource", + "UniqueDevicesResourceWithRawResponse", + "AsyncUniqueDevicesResourceWithRawResponse", + "UniqueDevicesResourceWithStreamingResponse", + "AsyncUniqueDevicesResourceWithStreamingResponse", + "TestsResource", + "AsyncTestsResource", + "TestsResourceWithRawResponse", + "AsyncTestsResourceWithRawResponse", + "TestsResourceWithStreamingResponse", + "AsyncTestsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/dex/tests/tests.py b/src/cloudflare/resources/zero_trust/dex/tests/tests.py index 9d6a4b39bd7..b13668e0746 100644 --- a/src/cloudflare/resources/zero_trust/dex/tests/tests.py +++ b/src/cloudflare/resources/zero_trust/dex/tests/tests.py @@ -18,36 +18,37 @@ ) from .....pagination import SyncV4PagePagination, AsyncV4PagePagination from .unique_devices import ( - UniqueDevices, - AsyncUniqueDevices, - UniqueDevicesWithRawResponse, - AsyncUniqueDevicesWithRawResponse, - UniqueDevicesWithStreamingResponse, - AsyncUniqueDevicesWithStreamingResponse, + UniqueDevicesResource, + AsyncUniqueDevicesResource, + UniqueDevicesResourceWithRawResponse, + AsyncUniqueDevicesResourceWithRawResponse, + UniqueDevicesResourceWithStreamingResponse, + AsyncUniqueDevicesResourceWithStreamingResponse, ) from ....._base_client import ( AsyncPaginator, make_request_options, ) -from .....types.zero_trust.dex import TestListResponse, test_list_params +from .....types.zero_trust.dex import test_list_params +from .....types.zero_trust.dex.test_list_response import TestListResponse -__all__ = ["Tests", "AsyncTests"] +__all__ = ["TestsResource", "AsyncTestsResource"] -class Tests(SyncAPIResource): +class TestsResource(SyncAPIResource): __test__ = False @cached_property - def unique_devices(self) -> UniqueDevices: - return UniqueDevices(self._client) + def unique_devices(self) -> UniqueDevicesResource: + return UniqueDevicesResource(self._client) @cached_property - def with_raw_response(self) -> TestsWithRawResponse: - return TestsWithRawResponse(self) + def with_raw_response(self) -> TestsResourceWithRawResponse: + return TestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TestsWithStreamingResponse: - return TestsWithStreamingResponse(self) + def with_streaming_response(self) -> TestsResourceWithStreamingResponse: + return TestsResourceWithStreamingResponse(self) def list( self, @@ -114,18 +115,18 @@ def list( ) -class AsyncTests(AsyncAPIResource): +class AsyncTestsResource(AsyncAPIResource): @cached_property - def unique_devices(self) -> AsyncUniqueDevices: - return AsyncUniqueDevices(self._client) + def unique_devices(self) -> AsyncUniqueDevicesResource: + return AsyncUniqueDevicesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTestsWithRawResponse: - return AsyncTestsWithRawResponse(self) + def with_raw_response(self) -> AsyncTestsResourceWithRawResponse: + return AsyncTestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTestsWithStreamingResponse: - return AsyncTestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTestsResourceWithStreamingResponse: + return AsyncTestsResourceWithStreamingResponse(self) def list( self, @@ -192,10 +193,10 @@ def list( ) -class TestsWithRawResponse: +class TestsResourceWithRawResponse: __test__ = False - def __init__(self, tests: Tests) -> None: + def __init__(self, tests: TestsResource) -> None: self._tests = tests self.list = to_raw_response_wrapper( @@ -203,12 +204,12 @@ def __init__(self, tests: Tests) -> None: ) @cached_property - def unique_devices(self) -> UniqueDevicesWithRawResponse: - return UniqueDevicesWithRawResponse(self._tests.unique_devices) + def unique_devices(self) -> UniqueDevicesResourceWithRawResponse: + return UniqueDevicesResourceWithRawResponse(self._tests.unique_devices) -class AsyncTestsWithRawResponse: - def __init__(self, tests: AsyncTests) -> None: +class AsyncTestsResourceWithRawResponse: + def __init__(self, tests: AsyncTestsResource) -> None: self._tests = tests self.list = async_to_raw_response_wrapper( @@ -216,14 +217,14 @@ def __init__(self, tests: AsyncTests) -> None: ) @cached_property - def unique_devices(self) -> AsyncUniqueDevicesWithRawResponse: - return AsyncUniqueDevicesWithRawResponse(self._tests.unique_devices) + def unique_devices(self) -> AsyncUniqueDevicesResourceWithRawResponse: + return AsyncUniqueDevicesResourceWithRawResponse(self._tests.unique_devices) -class TestsWithStreamingResponse: +class TestsResourceWithStreamingResponse: __test__ = False - def __init__(self, tests: Tests) -> None: + def __init__(self, tests: TestsResource) -> None: self._tests = tests self.list = to_streamed_response_wrapper( @@ -231,12 +232,12 @@ def __init__(self, tests: Tests) -> None: ) @cached_property - def unique_devices(self) -> UniqueDevicesWithStreamingResponse: - return UniqueDevicesWithStreamingResponse(self._tests.unique_devices) + def unique_devices(self) -> UniqueDevicesResourceWithStreamingResponse: + return UniqueDevicesResourceWithStreamingResponse(self._tests.unique_devices) -class AsyncTestsWithStreamingResponse: - def __init__(self, tests: AsyncTests) -> None: +class AsyncTestsResourceWithStreamingResponse: + def __init__(self, tests: AsyncTestsResource) -> None: self._tests = tests self.list = async_to_streamed_response_wrapper( @@ -244,5 +245,5 @@ def __init__(self, tests: AsyncTests) -> None: ) @cached_property - def unique_devices(self) -> AsyncUniqueDevicesWithStreamingResponse: - return AsyncUniqueDevicesWithStreamingResponse(self._tests.unique_devices) + def unique_devices(self) -> AsyncUniqueDevicesResourceWithStreamingResponse: + return AsyncUniqueDevicesResourceWithStreamingResponse(self._tests.unique_devices) diff --git a/src/cloudflare/resources/zero_trust/dex/tests/unique_devices.py b/src/cloudflare/resources/zero_trust/dex/tests/unique_devices.py index eb6c0c8e12f..2f42ec7c808 100644 --- a/src/cloudflare/resources/zero_trust/dex/tests/unique_devices.py +++ b/src/cloudflare/resources/zero_trust/dex/tests/unique_devices.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Optional, cast import httpx @@ -23,19 +23,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.dex.tests import DigitalExperienceMonitoringUniqueDevices, unique_device_list_params +from .....types.zero_trust.dex.tests import unique_device_list_params +from .....types.zero_trust.dex.tests.unique_devices import UniqueDevices -__all__ = ["UniqueDevices", "AsyncUniqueDevices"] +__all__ = ["UniqueDevicesResource", "AsyncUniqueDevicesResource"] -class UniqueDevices(SyncAPIResource): +class UniqueDevicesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> UniqueDevicesWithRawResponse: - return UniqueDevicesWithRawResponse(self) + def with_raw_response(self) -> UniqueDevicesResourceWithRawResponse: + return UniqueDevicesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UniqueDevicesWithStreamingResponse: - return UniqueDevicesWithStreamingResponse(self) + def with_streaming_response(self) -> UniqueDevicesResourceWithStreamingResponse: + return UniqueDevicesResourceWithStreamingResponse(self) def list( self, @@ -49,7 +50,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringUniqueDevices: + ) -> Optional[UniqueDevices]: """ Returns unique count of devices that have run synthetic application monitoring tests in the past 7 days. @@ -84,22 +85,20 @@ def list( }, unique_device_list_params.UniqueDeviceListParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringUniqueDevices], ResultWrapper[DigitalExperienceMonitoringUniqueDevices] + post_parser=ResultWrapper[Optional[UniqueDevices]]._unwrapper, ), + cast_to=cast(Type[Optional[UniqueDevices]], ResultWrapper[UniqueDevices]), ) -class AsyncUniqueDevices(AsyncAPIResource): +class AsyncUniqueDevicesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncUniqueDevicesWithRawResponse: - return AsyncUniqueDevicesWithRawResponse(self) + def with_raw_response(self) -> AsyncUniqueDevicesResourceWithRawResponse: + return AsyncUniqueDevicesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUniqueDevicesWithStreamingResponse: - return AsyncUniqueDevicesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncUniqueDevicesResourceWithStreamingResponse: + return AsyncUniqueDevicesResourceWithStreamingResponse(self) async def list( self, @@ -113,7 +112,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringUniqueDevices: + ) -> Optional[UniqueDevices]: """ Returns unique count of devices that have run synthetic application monitoring tests in the past 7 days. @@ -148,16 +147,14 @@ async def list( }, unique_device_list_params.UniqueDeviceListParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringUniqueDevices], ResultWrapper[DigitalExperienceMonitoringUniqueDevices] + post_parser=ResultWrapper[Optional[UniqueDevices]]._unwrapper, ), + cast_to=cast(Type[Optional[UniqueDevices]], ResultWrapper[UniqueDevices]), ) -class UniqueDevicesWithRawResponse: - def __init__(self, unique_devices: UniqueDevices) -> None: +class UniqueDevicesResourceWithRawResponse: + def __init__(self, unique_devices: UniqueDevicesResource) -> None: self._unique_devices = unique_devices self.list = to_raw_response_wrapper( @@ -165,8 +162,8 @@ def __init__(self, unique_devices: UniqueDevices) -> None: ) -class AsyncUniqueDevicesWithRawResponse: - def __init__(self, unique_devices: AsyncUniqueDevices) -> None: +class AsyncUniqueDevicesResourceWithRawResponse: + def __init__(self, unique_devices: AsyncUniqueDevicesResource) -> None: self._unique_devices = unique_devices self.list = async_to_raw_response_wrapper( @@ -174,8 +171,8 @@ def __init__(self, unique_devices: AsyncUniqueDevices) -> None: ) -class UniqueDevicesWithStreamingResponse: - def __init__(self, unique_devices: UniqueDevices) -> None: +class UniqueDevicesResourceWithStreamingResponse: + def __init__(self, unique_devices: UniqueDevicesResource) -> None: self._unique_devices = unique_devices self.list = to_streamed_response_wrapper( @@ -183,8 +180,8 @@ def __init__(self, unique_devices: UniqueDevices) -> None: ) -class AsyncUniqueDevicesWithStreamingResponse: - def __init__(self, unique_devices: AsyncUniqueDevices) -> None: +class AsyncUniqueDevicesResourceWithStreamingResponse: + def __init__(self, unique_devices: AsyncUniqueDevicesResource) -> None: self._unique_devices = unique_devices self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/__init__.py b/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/__init__.py index 29ddac57979..7f21e0c037c 100644 --- a/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/__init__.py +++ b/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .network_path import ( - NetworkPath, - AsyncNetworkPath, - NetworkPathWithRawResponse, - AsyncNetworkPathWithRawResponse, - NetworkPathWithStreamingResponse, - AsyncNetworkPathWithStreamingResponse, + NetworkPathResource, + AsyncNetworkPathResource, + NetworkPathResourceWithRawResponse, + AsyncNetworkPathResourceWithRawResponse, + NetworkPathResourceWithStreamingResponse, + AsyncNetworkPathResourceWithStreamingResponse, ) from .traceroute_test_results import ( - TracerouteTestResults, - AsyncTracerouteTestResults, - TracerouteTestResultsWithRawResponse, - AsyncTracerouteTestResultsWithRawResponse, - TracerouteTestResultsWithStreamingResponse, - AsyncTracerouteTestResultsWithStreamingResponse, + TracerouteTestResultsResource, + AsyncTracerouteTestResultsResource, + TracerouteTestResultsResourceWithRawResponse, + AsyncTracerouteTestResultsResourceWithRawResponse, + TracerouteTestResultsResourceWithStreamingResponse, + AsyncTracerouteTestResultsResourceWithStreamingResponse, ) __all__ = [ - "NetworkPath", - "AsyncNetworkPath", - "NetworkPathWithRawResponse", - "AsyncNetworkPathWithRawResponse", - "NetworkPathWithStreamingResponse", - "AsyncNetworkPathWithStreamingResponse", - "TracerouteTestResults", - "AsyncTracerouteTestResults", - "TracerouteTestResultsWithRawResponse", - "AsyncTracerouteTestResultsWithRawResponse", - "TracerouteTestResultsWithStreamingResponse", - "AsyncTracerouteTestResultsWithStreamingResponse", + "NetworkPathResource", + "AsyncNetworkPathResource", + "NetworkPathResourceWithRawResponse", + "AsyncNetworkPathResourceWithRawResponse", + "NetworkPathResourceWithStreamingResponse", + "AsyncNetworkPathResourceWithStreamingResponse", + "TracerouteTestResultsResource", + "AsyncTracerouteTestResultsResource", + "TracerouteTestResultsResourceWithRawResponse", + "AsyncTracerouteTestResultsResourceWithRawResponse", + "TracerouteTestResultsResourceWithStreamingResponse", + "AsyncTracerouteTestResultsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/network_path.py b/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/network_path.py index 32e683022f6..043485044c6 100644 --- a/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/network_path.py +++ b/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/network_path.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -19,19 +19,19 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.dex.traceroute_test_results import DigitalExperienceMonitoringTracerouteTestResultNetworkPath +from .....types.zero_trust.dex.traceroute_test_results.network_path_get_response import NetworkPathGetResponse -__all__ = ["NetworkPath", "AsyncNetworkPath"] +__all__ = ["NetworkPathResource", "AsyncNetworkPathResource"] -class NetworkPath(SyncAPIResource): +class NetworkPathResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> NetworkPathWithRawResponse: - return NetworkPathWithRawResponse(self) + def with_raw_response(self) -> NetworkPathResourceWithRawResponse: + return NetworkPathResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NetworkPathWithStreamingResponse: - return NetworkPathWithStreamingResponse(self) + def with_streaming_response(self) -> NetworkPathResourceWithStreamingResponse: + return NetworkPathResourceWithStreamingResponse(self) def get( self, @@ -44,7 +44,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringTracerouteTestResultNetworkPath: + ) -> Optional[NetworkPathGetResponse]: """ Get a breakdown of hops and performance metrics for a specific traceroute test run @@ -71,23 +71,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringTracerouteTestResultNetworkPath], - ResultWrapper[DigitalExperienceMonitoringTracerouteTestResultNetworkPath], + post_parser=ResultWrapper[Optional[NetworkPathGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[NetworkPathGetResponse]], ResultWrapper[NetworkPathGetResponse]), ) -class AsyncNetworkPath(AsyncAPIResource): +class AsyncNetworkPathResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncNetworkPathWithRawResponse: - return AsyncNetworkPathWithRawResponse(self) + def with_raw_response(self) -> AsyncNetworkPathResourceWithRawResponse: + return AsyncNetworkPathResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNetworkPathWithStreamingResponse: - return AsyncNetworkPathWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNetworkPathResourceWithStreamingResponse: + return AsyncNetworkPathResourceWithStreamingResponse(self) async def get( self, @@ -100,7 +97,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringTracerouteTestResultNetworkPath: + ) -> Optional[NetworkPathGetResponse]: """ Get a breakdown of hops and performance metrics for a specific traceroute test run @@ -127,17 +124,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringTracerouteTestResultNetworkPath], - ResultWrapper[DigitalExperienceMonitoringTracerouteTestResultNetworkPath], + post_parser=ResultWrapper[Optional[NetworkPathGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[NetworkPathGetResponse]], ResultWrapper[NetworkPathGetResponse]), ) -class NetworkPathWithRawResponse: - def __init__(self, network_path: NetworkPath) -> None: +class NetworkPathResourceWithRawResponse: + def __init__(self, network_path: NetworkPathResource) -> None: self._network_path = network_path self.get = to_raw_response_wrapper( @@ -145,8 +139,8 @@ def __init__(self, network_path: NetworkPath) -> None: ) -class AsyncNetworkPathWithRawResponse: - def __init__(self, network_path: AsyncNetworkPath) -> None: +class AsyncNetworkPathResourceWithRawResponse: + def __init__(self, network_path: AsyncNetworkPathResource) -> None: self._network_path = network_path self.get = async_to_raw_response_wrapper( @@ -154,8 +148,8 @@ def __init__(self, network_path: AsyncNetworkPath) -> None: ) -class NetworkPathWithStreamingResponse: - def __init__(self, network_path: NetworkPath) -> None: +class NetworkPathResourceWithStreamingResponse: + def __init__(self, network_path: NetworkPathResource) -> None: self._network_path = network_path self.get = to_streamed_response_wrapper( @@ -163,8 +157,8 @@ def __init__(self, network_path: NetworkPath) -> None: ) -class AsyncNetworkPathWithStreamingResponse: - def __init__(self, network_path: AsyncNetworkPath) -> None: +class AsyncNetworkPathResourceWithStreamingResponse: + def __init__(self, network_path: AsyncNetworkPathResource) -> None: self._network_path = network_path self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/traceroute_test_results.py b/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/traceroute_test_results.py index 6b536de666a..abc3834ee8b 100644 --- a/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/traceroute_test_results.py +++ b/src/cloudflare/resources/zero_trust/dex/traceroute_test_results/traceroute_test_results.py @@ -4,77 +4,77 @@ from ....._compat import cached_property from .network_path import ( - NetworkPath, - AsyncNetworkPath, - NetworkPathWithRawResponse, - AsyncNetworkPathWithRawResponse, - NetworkPathWithStreamingResponse, - AsyncNetworkPathWithStreamingResponse, + NetworkPathResource, + AsyncNetworkPathResource, + NetworkPathResourceWithRawResponse, + AsyncNetworkPathResourceWithRawResponse, + NetworkPathResourceWithStreamingResponse, + AsyncNetworkPathResourceWithStreamingResponse, ) from ....._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["TracerouteTestResults", "AsyncTracerouteTestResults"] +__all__ = ["TracerouteTestResultsResource", "AsyncTracerouteTestResultsResource"] -class TracerouteTestResults(SyncAPIResource): +class TracerouteTestResultsResource(SyncAPIResource): @cached_property - def network_path(self) -> NetworkPath: - return NetworkPath(self._client) + def network_path(self) -> NetworkPathResource: + return NetworkPathResource(self._client) @cached_property - def with_raw_response(self) -> TracerouteTestResultsWithRawResponse: - return TracerouteTestResultsWithRawResponse(self) + def with_raw_response(self) -> TracerouteTestResultsResourceWithRawResponse: + return TracerouteTestResultsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TracerouteTestResultsWithStreamingResponse: - return TracerouteTestResultsWithStreamingResponse(self) + def with_streaming_response(self) -> TracerouteTestResultsResourceWithStreamingResponse: + return TracerouteTestResultsResourceWithStreamingResponse(self) -class AsyncTracerouteTestResults(AsyncAPIResource): +class AsyncTracerouteTestResultsResource(AsyncAPIResource): @cached_property - def network_path(self) -> AsyncNetworkPath: - return AsyncNetworkPath(self._client) + def network_path(self) -> AsyncNetworkPathResource: + return AsyncNetworkPathResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTracerouteTestResultsWithRawResponse: - return AsyncTracerouteTestResultsWithRawResponse(self) + def with_raw_response(self) -> AsyncTracerouteTestResultsResourceWithRawResponse: + return AsyncTracerouteTestResultsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTracerouteTestResultsWithStreamingResponse: - return AsyncTracerouteTestResultsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTracerouteTestResultsResourceWithStreamingResponse: + return AsyncTracerouteTestResultsResourceWithStreamingResponse(self) -class TracerouteTestResultsWithRawResponse: - def __init__(self, traceroute_test_results: TracerouteTestResults) -> None: +class TracerouteTestResultsResourceWithRawResponse: + def __init__(self, traceroute_test_results: TracerouteTestResultsResource) -> None: self._traceroute_test_results = traceroute_test_results @cached_property - def network_path(self) -> NetworkPathWithRawResponse: - return NetworkPathWithRawResponse(self._traceroute_test_results.network_path) + def network_path(self) -> NetworkPathResourceWithRawResponse: + return NetworkPathResourceWithRawResponse(self._traceroute_test_results.network_path) -class AsyncTracerouteTestResultsWithRawResponse: - def __init__(self, traceroute_test_results: AsyncTracerouteTestResults) -> None: +class AsyncTracerouteTestResultsResourceWithRawResponse: + def __init__(self, traceroute_test_results: AsyncTracerouteTestResultsResource) -> None: self._traceroute_test_results = traceroute_test_results @cached_property - def network_path(self) -> AsyncNetworkPathWithRawResponse: - return AsyncNetworkPathWithRawResponse(self._traceroute_test_results.network_path) + def network_path(self) -> AsyncNetworkPathResourceWithRawResponse: + return AsyncNetworkPathResourceWithRawResponse(self._traceroute_test_results.network_path) -class TracerouteTestResultsWithStreamingResponse: - def __init__(self, traceroute_test_results: TracerouteTestResults) -> None: +class TracerouteTestResultsResourceWithStreamingResponse: + def __init__(self, traceroute_test_results: TracerouteTestResultsResource) -> None: self._traceroute_test_results = traceroute_test_results @cached_property - def network_path(self) -> NetworkPathWithStreamingResponse: - return NetworkPathWithStreamingResponse(self._traceroute_test_results.network_path) + def network_path(self) -> NetworkPathResourceWithStreamingResponse: + return NetworkPathResourceWithStreamingResponse(self._traceroute_test_results.network_path) -class AsyncTracerouteTestResultsWithStreamingResponse: - def __init__(self, traceroute_test_results: AsyncTracerouteTestResults) -> None: +class AsyncTracerouteTestResultsResourceWithStreamingResponse: + def __init__(self, traceroute_test_results: AsyncTracerouteTestResultsResource) -> None: self._traceroute_test_results = traceroute_test_results @cached_property - def network_path(self) -> AsyncNetworkPathWithStreamingResponse: - return AsyncNetworkPathWithStreamingResponse(self._traceroute_test_results.network_path) + def network_path(self) -> AsyncNetworkPathResourceWithStreamingResponse: + return AsyncNetworkPathResourceWithStreamingResponse(self._traceroute_test_results.network_path) diff --git a/src/cloudflare/resources/zero_trust/dex/traceroute_tests.py b/src/cloudflare/resources/zero_trust/dex/traceroute_tests.py index b93ff798594..ebbf05826a8 100644 --- a/src/cloudflare/resources/zero_trust/dex/traceroute_tests.py +++ b/src/cloudflare/resources/zero_trust/dex/traceroute_tests.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Optional, cast from typing_extensions import Literal import httpx @@ -25,25 +25,25 @@ make_request_options, ) from ....types.zero_trust.dex import ( - DigitalExperienceMonitoringTracerouteDetails, - DigitalExperienceMonitoringTracerouteTestNetworkPath, - DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test_get_params, traceroute_test_percentiles_params, traceroute_test_network_path_params, ) +from ....types.zero_trust.dex.traceroute import Traceroute +from ....types.zero_trust.network_path_response import NetworkPathResponse +from ....types.zero_trust.dex.traceroute_test_percentiles_response import TracerouteTestPercentilesResponse -__all__ = ["TracerouteTests", "AsyncTracerouteTests"] +__all__ = ["TracerouteTestsResource", "AsyncTracerouteTestsResource"] -class TracerouteTests(SyncAPIResource): +class TracerouteTestsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TracerouteTestsWithRawResponse: - return TracerouteTestsWithRawResponse(self) + def with_raw_response(self) -> TracerouteTestsResourceWithRawResponse: + return TracerouteTestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TracerouteTestsWithStreamingResponse: - return TracerouteTestsWithStreamingResponse(self) + def with_streaming_response(self) -> TracerouteTestsResourceWithStreamingResponse: + return TracerouteTestsResourceWithStreamingResponse(self) def get( self, @@ -61,7 +61,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringTracerouteDetails: + ) -> Optional[Traceroute]: """ Get test details and aggregate performance metrics for an traceroute test for a given time period between 1 hour and 7 days. @@ -110,12 +110,9 @@ def get( }, traceroute_test_get_params.TracerouteTestGetParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringTracerouteDetails], - ResultWrapper[DigitalExperienceMonitoringTracerouteDetails], + post_parser=ResultWrapper[Optional[Traceroute]]._unwrapper, ), + cast_to=cast(Type[Optional[Traceroute]], ResultWrapper[Traceroute]), ) def network_path( @@ -133,7 +130,7 @@ def network_path( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringTracerouteTestNetworkPath: + ) -> Optional[NetworkPathResponse]: """ Get a breakdown of metrics by hop for individual traceroute test runs @@ -176,12 +173,9 @@ def network_path( }, traceroute_test_network_path_params.TracerouteTestNetworkPathParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringTracerouteTestNetworkPath], - ResultWrapper[DigitalExperienceMonitoringTracerouteTestNetworkPath], + post_parser=ResultWrapper[Optional[NetworkPathResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[NetworkPathResponse]], ResultWrapper[NetworkPathResponse]), ) def percentiles( @@ -199,7 +193,7 @@ def percentiles( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringTracerouteDetailsPercentiles: + ) -> Optional[TracerouteTestPercentilesResponse]: """ Get percentiles for a traceroute test for a given time period between 1 hour and 7 days. @@ -245,23 +239,22 @@ def percentiles( }, traceroute_test_percentiles_params.TracerouteTestPercentilesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TracerouteTestPercentilesResponse]]._unwrapper, ), cast_to=cast( - Type[DigitalExperienceMonitoringTracerouteDetailsPercentiles], - ResultWrapper[DigitalExperienceMonitoringTracerouteDetailsPercentiles], + Type[Optional[TracerouteTestPercentilesResponse]], ResultWrapper[TracerouteTestPercentilesResponse] ), ) -class AsyncTracerouteTests(AsyncAPIResource): +class AsyncTracerouteTestsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTracerouteTestsWithRawResponse: - return AsyncTracerouteTestsWithRawResponse(self) + def with_raw_response(self) -> AsyncTracerouteTestsResourceWithRawResponse: + return AsyncTracerouteTestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTracerouteTestsWithStreamingResponse: - return AsyncTracerouteTestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTracerouteTestsResourceWithStreamingResponse: + return AsyncTracerouteTestsResourceWithStreamingResponse(self) async def get( self, @@ -279,7 +272,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringTracerouteDetails: + ) -> Optional[Traceroute]: """ Get test details and aggregate performance metrics for an traceroute test for a given time period between 1 hour and 7 days. @@ -328,12 +321,9 @@ async def get( }, traceroute_test_get_params.TracerouteTestGetParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringTracerouteDetails], - ResultWrapper[DigitalExperienceMonitoringTracerouteDetails], + post_parser=ResultWrapper[Optional[Traceroute]]._unwrapper, ), + cast_to=cast(Type[Optional[Traceroute]], ResultWrapper[Traceroute]), ) async def network_path( @@ -351,7 +341,7 @@ async def network_path( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringTracerouteTestNetworkPath: + ) -> Optional[NetworkPathResponse]: """ Get a breakdown of metrics by hop for individual traceroute test runs @@ -394,12 +384,9 @@ async def network_path( }, traceroute_test_network_path_params.TracerouteTestNetworkPathParams, ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[DigitalExperienceMonitoringTracerouteTestNetworkPath], - ResultWrapper[DigitalExperienceMonitoringTracerouteTestNetworkPath], + post_parser=ResultWrapper[Optional[NetworkPathResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[NetworkPathResponse]], ResultWrapper[NetworkPathResponse]), ) async def percentiles( @@ -417,7 +404,7 @@ async def percentiles( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DigitalExperienceMonitoringTracerouteDetailsPercentiles: + ) -> Optional[TracerouteTestPercentilesResponse]: """ Get percentiles for a traceroute test for a given time period between 1 hour and 7 days. @@ -463,17 +450,16 @@ async def percentiles( }, traceroute_test_percentiles_params.TracerouteTestPercentilesParams, ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TracerouteTestPercentilesResponse]]._unwrapper, ), cast_to=cast( - Type[DigitalExperienceMonitoringTracerouteDetailsPercentiles], - ResultWrapper[DigitalExperienceMonitoringTracerouteDetailsPercentiles], + Type[Optional[TracerouteTestPercentilesResponse]], ResultWrapper[TracerouteTestPercentilesResponse] ), ) -class TracerouteTestsWithRawResponse: - def __init__(self, traceroute_tests: TracerouteTests) -> None: +class TracerouteTestsResourceWithRawResponse: + def __init__(self, traceroute_tests: TracerouteTestsResource) -> None: self._traceroute_tests = traceroute_tests self.get = to_raw_response_wrapper( @@ -487,8 +473,8 @@ def __init__(self, traceroute_tests: TracerouteTests) -> None: ) -class AsyncTracerouteTestsWithRawResponse: - def __init__(self, traceroute_tests: AsyncTracerouteTests) -> None: +class AsyncTracerouteTestsResourceWithRawResponse: + def __init__(self, traceroute_tests: AsyncTracerouteTestsResource) -> None: self._traceroute_tests = traceroute_tests self.get = async_to_raw_response_wrapper( @@ -502,8 +488,8 @@ def __init__(self, traceroute_tests: AsyncTracerouteTests) -> None: ) -class TracerouteTestsWithStreamingResponse: - def __init__(self, traceroute_tests: TracerouteTests) -> None: +class TracerouteTestsResourceWithStreamingResponse: + def __init__(self, traceroute_tests: TracerouteTestsResource) -> None: self._traceroute_tests = traceroute_tests self.get = to_streamed_response_wrapper( @@ -517,8 +503,8 @@ def __init__(self, traceroute_tests: TracerouteTests) -> None: ) -class AsyncTracerouteTestsWithStreamingResponse: - def __init__(self, traceroute_tests: AsyncTracerouteTests) -> None: +class AsyncTracerouteTestsResourceWithStreamingResponse: + def __init__(self, traceroute_tests: AsyncTracerouteTestsResource) -> None: self._traceroute_tests = traceroute_tests self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dlp/__init__.py b/src/cloudflare/resources/zero_trust/dlp/__init__.py index e7ff958c95c..4a0820bb653 100644 --- a/src/cloudflare/resources/zero_trust/dlp/__init__.py +++ b/src/cloudflare/resources/zero_trust/dlp/__init__.py @@ -1,75 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .dlp import ( - DLP, - AsyncDLP, - DLPWithRawResponse, - AsyncDLPWithRawResponse, - DLPWithStreamingResponse, - AsyncDLPWithStreamingResponse, + DLPResource, + AsyncDLPResource, + DLPResourceWithRawResponse, + AsyncDLPResourceWithRawResponse, + DLPResourceWithStreamingResponse, + AsyncDLPResourceWithStreamingResponse, ) from .datasets import ( - Datasets, - AsyncDatasets, - DatasetsWithRawResponse, - AsyncDatasetsWithRawResponse, - DatasetsWithStreamingResponse, - AsyncDatasetsWithStreamingResponse, + DatasetsResource, + AsyncDatasetsResource, + DatasetsResourceWithRawResponse, + AsyncDatasetsResourceWithRawResponse, + DatasetsResourceWithStreamingResponse, + AsyncDatasetsResourceWithStreamingResponse, ) from .patterns import ( - Patterns, - AsyncPatterns, - PatternsWithRawResponse, - AsyncPatternsWithRawResponse, - PatternsWithStreamingResponse, - AsyncPatternsWithStreamingResponse, + PatternsResource, + AsyncPatternsResource, + PatternsResourceWithRawResponse, + AsyncPatternsResourceWithRawResponse, + PatternsResourceWithStreamingResponse, + AsyncPatternsResourceWithStreamingResponse, ) from .profiles import ( - Profiles, - AsyncProfiles, - ProfilesWithRawResponse, - AsyncProfilesWithRawResponse, - ProfilesWithStreamingResponse, - AsyncProfilesWithStreamingResponse, + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, ) from .payload_logs import ( - PayloadLogs, - AsyncPayloadLogs, - PayloadLogsWithRawResponse, - AsyncPayloadLogsWithRawResponse, - PayloadLogsWithStreamingResponse, - AsyncPayloadLogsWithStreamingResponse, + PayloadLogsResource, + AsyncPayloadLogsResource, + PayloadLogsResourceWithRawResponse, + AsyncPayloadLogsResourceWithRawResponse, + PayloadLogsResourceWithStreamingResponse, + AsyncPayloadLogsResourceWithStreamingResponse, ) __all__ = [ - "Datasets", - "AsyncDatasets", - "DatasetsWithRawResponse", - "AsyncDatasetsWithRawResponse", - "DatasetsWithStreamingResponse", - "AsyncDatasetsWithStreamingResponse", - "Patterns", - "AsyncPatterns", - "PatternsWithRawResponse", - "AsyncPatternsWithRawResponse", - "PatternsWithStreamingResponse", - "AsyncPatternsWithStreamingResponse", - "PayloadLogs", - "AsyncPayloadLogs", - "PayloadLogsWithRawResponse", - "AsyncPayloadLogsWithRawResponse", - "PayloadLogsWithStreamingResponse", - "AsyncPayloadLogsWithStreamingResponse", - "Profiles", - "AsyncProfiles", - "ProfilesWithRawResponse", - "AsyncProfilesWithRawResponse", - "ProfilesWithStreamingResponse", - "AsyncProfilesWithStreamingResponse", - "DLP", - "AsyncDLP", - "DLPWithRawResponse", - "AsyncDLPWithRawResponse", - "DLPWithStreamingResponse", - "AsyncDLPWithStreamingResponse", + "DatasetsResource", + "AsyncDatasetsResource", + "DatasetsResourceWithRawResponse", + "AsyncDatasetsResourceWithRawResponse", + "DatasetsResourceWithStreamingResponse", + "AsyncDatasetsResourceWithStreamingResponse", + "PatternsResource", + "AsyncPatternsResource", + "PatternsResourceWithRawResponse", + "AsyncPatternsResourceWithRawResponse", + "PatternsResourceWithStreamingResponse", + "AsyncPatternsResourceWithStreamingResponse", + "PayloadLogsResource", + "AsyncPayloadLogsResource", + "PayloadLogsResourceWithRawResponse", + "AsyncPayloadLogsResourceWithRawResponse", + "PayloadLogsResourceWithStreamingResponse", + "AsyncPayloadLogsResourceWithStreamingResponse", + "ProfilesResource", + "AsyncProfilesResource", + "ProfilesResourceWithRawResponse", + "AsyncProfilesResourceWithRawResponse", + "ProfilesResourceWithStreamingResponse", + "AsyncProfilesResourceWithStreamingResponse", + "DLPResource", + "AsyncDLPResource", + "DLPResourceWithRawResponse", + "AsyncDLPResourceWithRawResponse", + "DLPResourceWithStreamingResponse", + "AsyncDLPResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/dlp/datasets/__init__.py b/src/cloudflare/resources/zero_trust/dlp/datasets/__init__.py index aa0a37a3ea8..a7431639eca 100644 --- a/src/cloudflare/resources/zero_trust/dlp/datasets/__init__.py +++ b/src/cloudflare/resources/zero_trust/dlp/datasets/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .upload import ( - Upload, - AsyncUpload, - UploadWithRawResponse, - AsyncUploadWithRawResponse, - UploadWithStreamingResponse, - AsyncUploadWithStreamingResponse, + UploadResource, + AsyncUploadResource, + UploadResourceWithRawResponse, + AsyncUploadResourceWithRawResponse, + UploadResourceWithStreamingResponse, + AsyncUploadResourceWithStreamingResponse, ) from .datasets import ( - Datasets, - AsyncDatasets, - DatasetsWithRawResponse, - AsyncDatasetsWithRawResponse, - DatasetsWithStreamingResponse, - AsyncDatasetsWithStreamingResponse, + DatasetsResource, + AsyncDatasetsResource, + DatasetsResourceWithRawResponse, + AsyncDatasetsResourceWithRawResponse, + DatasetsResourceWithStreamingResponse, + AsyncDatasetsResourceWithStreamingResponse, ) __all__ = [ - "Upload", - "AsyncUpload", - "UploadWithRawResponse", - "AsyncUploadWithRawResponse", - "UploadWithStreamingResponse", - "AsyncUploadWithStreamingResponse", - "Datasets", - "AsyncDatasets", - "DatasetsWithRawResponse", - "AsyncDatasetsWithRawResponse", - "DatasetsWithStreamingResponse", - "AsyncDatasetsWithStreamingResponse", + "UploadResource", + "AsyncUploadResource", + "UploadResourceWithRawResponse", + "AsyncUploadResourceWithRawResponse", + "UploadResourceWithStreamingResponse", + "AsyncUploadResourceWithStreamingResponse", + "DatasetsResource", + "AsyncDatasetsResource", + "DatasetsResourceWithRawResponse", + "AsyncDatasetsResourceWithRawResponse", + "DatasetsResourceWithStreamingResponse", + "AsyncDatasetsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/dlp/datasets/datasets.py b/src/cloudflare/resources/zero_trust/dlp/datasets/datasets.py index edb57507ffe..6cce46a91d7 100644 --- a/src/cloudflare/resources/zero_trust/dlp/datasets/datasets.py +++ b/src/cloudflare/resources/zero_trust/dlp/datasets/datasets.py @@ -7,12 +7,12 @@ import httpx from .upload import ( - Upload, - AsyncUpload, - UploadWithRawResponse, - AsyncUploadWithRawResponse, - UploadWithStreamingResponse, - AsyncUploadWithStreamingResponse, + UploadResource, + AsyncUploadResource, + UploadResourceWithRawResponse, + AsyncUploadResourceWithRawResponse, + UploadResourceWithStreamingResponse, + AsyncUploadResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ....._utils import ( @@ -33,23 +33,25 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.dlp import DLPDataset, DLPDatasetCreation, dataset_create_params, dataset_update_params +from .....types.zero_trust.dlp import dataset_create_params, dataset_update_params +from .....types.zero_trust.dlp.dataset import Dataset +from .....types.zero_trust.dlp.dataset_creation import DatasetCreation -__all__ = ["Datasets", "AsyncDatasets"] +__all__ = ["DatasetsResource", "AsyncDatasetsResource"] -class Datasets(SyncAPIResource): +class DatasetsResource(SyncAPIResource): @cached_property - def upload(self) -> Upload: - return Upload(self._client) + def upload(self) -> UploadResource: + return UploadResource(self._client) @cached_property - def with_raw_response(self) -> DatasetsWithRawResponse: - return DatasetsWithRawResponse(self) + def with_raw_response(self) -> DatasetsResourceWithRawResponse: + return DatasetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DatasetsWithStreamingResponse: - return DatasetsWithStreamingResponse(self) + def with_streaming_response(self) -> DatasetsResourceWithStreamingResponse: + return DatasetsResourceWithStreamingResponse(self) def create( self, @@ -64,7 +66,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDatasetCreation]: + ) -> Optional[DatasetCreation]: """ Create a new dataset. @@ -99,9 +101,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DatasetCreation]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDatasetCreation]], ResultWrapper[DLPDatasetCreation]), + cast_to=cast(Type[Optional[DatasetCreation]], ResultWrapper[DatasetCreation]), ) def update( @@ -117,7 +119,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDataset]: + ) -> Optional[Dataset]: """ Update details about a dataset. @@ -148,9 +150,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Dataset]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDataset]], ResultWrapper[DLPDataset]), + cast_to=cast(Type[Optional[Dataset]], ResultWrapper[Dataset]), ) def list( @@ -163,7 +165,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DLPDataset]: + ) -> SyncSinglePage[Dataset]: """ Fetch all datasets with information about available versions. @@ -180,11 +182,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/dlp/datasets", - page=SyncSinglePage[DLPDataset], + page=SyncSinglePage[Dataset], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DLPDataset, + model=Dataset, ) def delete( @@ -237,7 +239,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDataset]: + ) -> Optional[Dataset]: """ Fetch a specific dataset with information about available versions. @@ -261,24 +263,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Dataset]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDataset]], ResultWrapper[DLPDataset]), + cast_to=cast(Type[Optional[Dataset]], ResultWrapper[Dataset]), ) -class AsyncDatasets(AsyncAPIResource): +class AsyncDatasetsResource(AsyncAPIResource): @cached_property - def upload(self) -> AsyncUpload: - return AsyncUpload(self._client) + def upload(self) -> AsyncUploadResource: + return AsyncUploadResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDatasetsWithRawResponse: - return AsyncDatasetsWithRawResponse(self) + def with_raw_response(self) -> AsyncDatasetsResourceWithRawResponse: + return AsyncDatasetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDatasetsWithStreamingResponse: - return AsyncDatasetsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDatasetsResourceWithStreamingResponse: + return AsyncDatasetsResourceWithStreamingResponse(self) async def create( self, @@ -293,7 +295,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDatasetCreation]: + ) -> Optional[DatasetCreation]: """ Create a new dataset. @@ -328,9 +330,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DatasetCreation]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDatasetCreation]], ResultWrapper[DLPDatasetCreation]), + cast_to=cast(Type[Optional[DatasetCreation]], ResultWrapper[DatasetCreation]), ) async def update( @@ -346,7 +348,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDataset]: + ) -> Optional[Dataset]: """ Update details about a dataset. @@ -377,9 +379,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Dataset]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDataset]], ResultWrapper[DLPDataset]), + cast_to=cast(Type[Optional[Dataset]], ResultWrapper[Dataset]), ) def list( @@ -392,7 +394,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DLPDataset, AsyncSinglePage[DLPDataset]]: + ) -> AsyncPaginator[Dataset, AsyncSinglePage[Dataset]]: """ Fetch all datasets with information about available versions. @@ -409,11 +411,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/dlp/datasets", - page=AsyncSinglePage[DLPDataset], + page=AsyncSinglePage[Dataset], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=DLPDataset, + model=Dataset, ) async def delete( @@ -466,7 +468,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDataset]: + ) -> Optional[Dataset]: """ Fetch a specific dataset with information about available versions. @@ -490,14 +492,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Dataset]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDataset]], ResultWrapper[DLPDataset]), + cast_to=cast(Type[Optional[Dataset]], ResultWrapper[Dataset]), ) -class DatasetsWithRawResponse: - def __init__(self, datasets: Datasets) -> None: +class DatasetsResourceWithRawResponse: + def __init__(self, datasets: DatasetsResource) -> None: self._datasets = datasets self.create = to_raw_response_wrapper( @@ -517,12 +519,12 @@ def __init__(self, datasets: Datasets) -> None: ) @cached_property - def upload(self) -> UploadWithRawResponse: - return UploadWithRawResponse(self._datasets.upload) + def upload(self) -> UploadResourceWithRawResponse: + return UploadResourceWithRawResponse(self._datasets.upload) -class AsyncDatasetsWithRawResponse: - def __init__(self, datasets: AsyncDatasets) -> None: +class AsyncDatasetsResourceWithRawResponse: + def __init__(self, datasets: AsyncDatasetsResource) -> None: self._datasets = datasets self.create = async_to_raw_response_wrapper( @@ -542,12 +544,12 @@ def __init__(self, datasets: AsyncDatasets) -> None: ) @cached_property - def upload(self) -> AsyncUploadWithRawResponse: - return AsyncUploadWithRawResponse(self._datasets.upload) + def upload(self) -> AsyncUploadResourceWithRawResponse: + return AsyncUploadResourceWithRawResponse(self._datasets.upload) -class DatasetsWithStreamingResponse: - def __init__(self, datasets: Datasets) -> None: +class DatasetsResourceWithStreamingResponse: + def __init__(self, datasets: DatasetsResource) -> None: self._datasets = datasets self.create = to_streamed_response_wrapper( @@ -567,12 +569,12 @@ def __init__(self, datasets: Datasets) -> None: ) @cached_property - def upload(self) -> UploadWithStreamingResponse: - return UploadWithStreamingResponse(self._datasets.upload) + def upload(self) -> UploadResourceWithStreamingResponse: + return UploadResourceWithStreamingResponse(self._datasets.upload) -class AsyncDatasetsWithStreamingResponse: - def __init__(self, datasets: AsyncDatasets) -> None: +class AsyncDatasetsResourceWithStreamingResponse: + def __init__(self, datasets: AsyncDatasetsResource) -> None: self._datasets = datasets self.create = async_to_streamed_response_wrapper( @@ -592,5 +594,5 @@ def __init__(self, datasets: AsyncDatasets) -> None: ) @cached_property - def upload(self) -> AsyncUploadWithStreamingResponse: - return AsyncUploadWithStreamingResponse(self._datasets.upload) + def upload(self) -> AsyncUploadResourceWithStreamingResponse: + return AsyncUploadResourceWithStreamingResponse(self._datasets.upload) diff --git a/src/cloudflare/resources/zero_trust/dlp/datasets/upload.py b/src/cloudflare/resources/zero_trust/dlp/datasets/upload.py index 4c5e56ba783..8ae70bace70 100644 --- a/src/cloudflare/resources/zero_trust/dlp/datasets/upload.py +++ b/src/cloudflare/resources/zero_trust/dlp/datasets/upload.py @@ -7,6 +7,10 @@ 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 ( @@ -19,20 +23,21 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.dlp import DLPDataset -from .....types.zero_trust.dlp.datasets import DLPDatasetNewVersion +from .....types.zero_trust.dlp.dataset import Dataset +from .....types.zero_trust.dlp.datasets import upload_edit_params +from .....types.zero_trust.dlp.datasets.new_version import NewVersion -__all__ = ["Upload", "AsyncUpload"] +__all__ = ["UploadResource", "AsyncUploadResource"] -class Upload(SyncAPIResource): +class UploadResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> UploadWithRawResponse: - return UploadWithRawResponse(self) + def with_raw_response(self) -> UploadResourceWithRawResponse: + return UploadResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UploadWithStreamingResponse: - return UploadWithStreamingResponse(self) + def with_streaming_response(self) -> UploadResourceWithStreamingResponse: + return UploadResourceWithStreamingResponse(self) def create( self, @@ -45,7 +50,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDatasetNewVersion]: + ) -> Optional[NewVersion]: """ Prepare to upload a new version of a dataset. @@ -69,9 +74,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NewVersion]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDatasetNewVersion]], ResultWrapper[DLPDatasetNewVersion]), + cast_to=cast(Type[Optional[NewVersion]], ResultWrapper[NewVersion]), ) def edit( @@ -80,13 +85,14 @@ def edit( *, account_id: str, dataset_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[DLPDataset]: + ) -> Optional[Dataset]: """ Upload a new version of a dataset. @@ -105,25 +111,26 @@ def edit( raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}") return self._post( f"/accounts/{account_id}/dlp/datasets/{dataset_id}/upload/{version}", + body=maybe_transform(body, upload_edit_params.UploadEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Dataset]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDataset]], ResultWrapper[DLPDataset]), + cast_to=cast(Type[Optional[Dataset]], ResultWrapper[Dataset]), ) -class AsyncUpload(AsyncAPIResource): +class AsyncUploadResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncUploadWithRawResponse: - return AsyncUploadWithRawResponse(self) + def with_raw_response(self) -> AsyncUploadResourceWithRawResponse: + return AsyncUploadResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUploadWithStreamingResponse: - return AsyncUploadWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncUploadResourceWithStreamingResponse: + return AsyncUploadResourceWithStreamingResponse(self) async def create( self, @@ -136,7 +143,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDatasetNewVersion]: + ) -> Optional[NewVersion]: """ Prepare to upload a new version of a dataset. @@ -160,9 +167,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NewVersion]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDatasetNewVersion]], ResultWrapper[DLPDatasetNewVersion]), + cast_to=cast(Type[Optional[NewVersion]], ResultWrapper[NewVersion]), ) async def edit( @@ -171,13 +178,14 @@ async def edit( *, account_id: str, dataset_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[DLPDataset]: + ) -> Optional[Dataset]: """ Upload a new version of a dataset. @@ -196,19 +204,20 @@ async def edit( raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}") return await self._post( f"/accounts/{account_id}/dlp/datasets/{dataset_id}/upload/{version}", + body=await async_maybe_transform(body, upload_edit_params.UploadEditParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Dataset]]._unwrapper, ), - cast_to=cast(Type[Optional[DLPDataset]], ResultWrapper[DLPDataset]), + cast_to=cast(Type[Optional[Dataset]], ResultWrapper[Dataset]), ) -class UploadWithRawResponse: - def __init__(self, upload: Upload) -> None: +class UploadResourceWithRawResponse: + def __init__(self, upload: UploadResource) -> None: self._upload = upload self.create = to_raw_response_wrapper( @@ -219,8 +228,8 @@ def __init__(self, upload: Upload) -> None: ) -class AsyncUploadWithRawResponse: - def __init__(self, upload: AsyncUpload) -> None: +class AsyncUploadResourceWithRawResponse: + def __init__(self, upload: AsyncUploadResource) -> None: self._upload = upload self.create = async_to_raw_response_wrapper( @@ -231,8 +240,8 @@ def __init__(self, upload: AsyncUpload) -> None: ) -class UploadWithStreamingResponse: - def __init__(self, upload: Upload) -> None: +class UploadResourceWithStreamingResponse: + def __init__(self, upload: UploadResource) -> None: self._upload = upload self.create = to_streamed_response_wrapper( @@ -243,8 +252,8 @@ def __init__(self, upload: Upload) -> None: ) -class AsyncUploadWithStreamingResponse: - def __init__(self, upload: AsyncUpload) -> None: +class AsyncUploadResourceWithStreamingResponse: + def __init__(self, upload: AsyncUploadResource) -> None: self._upload = upload self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dlp/dlp.py b/src/cloudflare/resources/zero_trust/dlp/dlp.py index 323b386fdc9..324653e2509 100644 --- a/src/cloudflare/resources/zero_trust/dlp/dlp.py +++ b/src/cloudflare/resources/zero_trust/dlp/dlp.py @@ -3,176 +3,176 @@ from __future__ import annotations from .datasets import ( - Datasets, - AsyncDatasets, - DatasetsWithRawResponse, - AsyncDatasetsWithRawResponse, - DatasetsWithStreamingResponse, - AsyncDatasetsWithStreamingResponse, + DatasetsResource, + AsyncDatasetsResource, + DatasetsResourceWithRawResponse, + AsyncDatasetsResourceWithRawResponse, + DatasetsResourceWithStreamingResponse, + AsyncDatasetsResourceWithStreamingResponse, ) from .patterns import ( - Patterns, - AsyncPatterns, - PatternsWithRawResponse, - AsyncPatternsWithRawResponse, - PatternsWithStreamingResponse, - AsyncPatternsWithStreamingResponse, + PatternsResource, + AsyncPatternsResource, + PatternsResourceWithRawResponse, + AsyncPatternsResourceWithRawResponse, + PatternsResourceWithStreamingResponse, + AsyncPatternsResourceWithStreamingResponse, ) from .profiles import ( - Profiles, - AsyncProfiles, - ProfilesWithRawResponse, - AsyncProfilesWithRawResponse, - ProfilesWithStreamingResponse, - AsyncProfilesWithStreamingResponse, + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from .payload_logs import ( - PayloadLogs, - AsyncPayloadLogs, - PayloadLogsWithRawResponse, - AsyncPayloadLogsWithRawResponse, - PayloadLogsWithStreamingResponse, - AsyncPayloadLogsWithStreamingResponse, + PayloadLogsResource, + AsyncPayloadLogsResource, + PayloadLogsResourceWithRawResponse, + AsyncPayloadLogsResourceWithRawResponse, + PayloadLogsResourceWithStreamingResponse, + AsyncPayloadLogsResourceWithStreamingResponse, ) -from .datasets.datasets import Datasets, AsyncDatasets -from .profiles.profiles import Profiles, AsyncProfiles +from .datasets.datasets import DatasetsResource, AsyncDatasetsResource +from .profiles.profiles import ProfilesResource, AsyncProfilesResource -__all__ = ["DLP", "AsyncDLP"] +__all__ = ["DLPResource", "AsyncDLPResource"] -class DLP(SyncAPIResource): +class DLPResource(SyncAPIResource): @cached_property - def datasets(self) -> Datasets: - return Datasets(self._client) + def datasets(self) -> DatasetsResource: + return DatasetsResource(self._client) @cached_property - def patterns(self) -> Patterns: - return Patterns(self._client) + def patterns(self) -> PatternsResource: + return PatternsResource(self._client) @cached_property - def payload_logs(self) -> PayloadLogs: - return PayloadLogs(self._client) + def payload_logs(self) -> PayloadLogsResource: + return PayloadLogsResource(self._client) @cached_property - def profiles(self) -> Profiles: - return Profiles(self._client) + def profiles(self) -> ProfilesResource: + return ProfilesResource(self._client) @cached_property - def with_raw_response(self) -> DLPWithRawResponse: - return DLPWithRawResponse(self) + def with_raw_response(self) -> DLPResourceWithRawResponse: + return DLPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DLPWithStreamingResponse: - return DLPWithStreamingResponse(self) + def with_streaming_response(self) -> DLPResourceWithStreamingResponse: + return DLPResourceWithStreamingResponse(self) -class AsyncDLP(AsyncAPIResource): +class AsyncDLPResource(AsyncAPIResource): @cached_property - def datasets(self) -> AsyncDatasets: - return AsyncDatasets(self._client) + def datasets(self) -> AsyncDatasetsResource: + return AsyncDatasetsResource(self._client) @cached_property - def patterns(self) -> AsyncPatterns: - return AsyncPatterns(self._client) + def patterns(self) -> AsyncPatternsResource: + return AsyncPatternsResource(self._client) @cached_property - def payload_logs(self) -> AsyncPayloadLogs: - return AsyncPayloadLogs(self._client) + def payload_logs(self) -> AsyncPayloadLogsResource: + return AsyncPayloadLogsResource(self._client) @cached_property - def profiles(self) -> AsyncProfiles: - return AsyncProfiles(self._client) + def profiles(self) -> AsyncProfilesResource: + return AsyncProfilesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncDLPWithRawResponse: - return AsyncDLPWithRawResponse(self) + def with_raw_response(self) -> AsyncDLPResourceWithRawResponse: + return AsyncDLPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDLPWithStreamingResponse: - return AsyncDLPWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDLPResourceWithStreamingResponse: + return AsyncDLPResourceWithStreamingResponse(self) -class DLPWithRawResponse: - def __init__(self, dlp: DLP) -> None: +class DLPResourceWithRawResponse: + def __init__(self, dlp: DLPResource) -> None: self._dlp = dlp @cached_property - def datasets(self) -> DatasetsWithRawResponse: - return DatasetsWithRawResponse(self._dlp.datasets) + def datasets(self) -> DatasetsResourceWithRawResponse: + return DatasetsResourceWithRawResponse(self._dlp.datasets) @cached_property - def patterns(self) -> PatternsWithRawResponse: - return PatternsWithRawResponse(self._dlp.patterns) + def patterns(self) -> PatternsResourceWithRawResponse: + return PatternsResourceWithRawResponse(self._dlp.patterns) @cached_property - def payload_logs(self) -> PayloadLogsWithRawResponse: - return PayloadLogsWithRawResponse(self._dlp.payload_logs) + def payload_logs(self) -> PayloadLogsResourceWithRawResponse: + return PayloadLogsResourceWithRawResponse(self._dlp.payload_logs) @cached_property - def profiles(self) -> ProfilesWithRawResponse: - return ProfilesWithRawResponse(self._dlp.profiles) + def profiles(self) -> ProfilesResourceWithRawResponse: + return ProfilesResourceWithRawResponse(self._dlp.profiles) -class AsyncDLPWithRawResponse: - def __init__(self, dlp: AsyncDLP) -> None: +class AsyncDLPResourceWithRawResponse: + def __init__(self, dlp: AsyncDLPResource) -> None: self._dlp = dlp @cached_property - def datasets(self) -> AsyncDatasetsWithRawResponse: - return AsyncDatasetsWithRawResponse(self._dlp.datasets) + def datasets(self) -> AsyncDatasetsResourceWithRawResponse: + return AsyncDatasetsResourceWithRawResponse(self._dlp.datasets) @cached_property - def patterns(self) -> AsyncPatternsWithRawResponse: - return AsyncPatternsWithRawResponse(self._dlp.patterns) + def patterns(self) -> AsyncPatternsResourceWithRawResponse: + return AsyncPatternsResourceWithRawResponse(self._dlp.patterns) @cached_property - def payload_logs(self) -> AsyncPayloadLogsWithRawResponse: - return AsyncPayloadLogsWithRawResponse(self._dlp.payload_logs) + def payload_logs(self) -> AsyncPayloadLogsResourceWithRawResponse: + return AsyncPayloadLogsResourceWithRawResponse(self._dlp.payload_logs) @cached_property - def profiles(self) -> AsyncProfilesWithRawResponse: - return AsyncProfilesWithRawResponse(self._dlp.profiles) + def profiles(self) -> AsyncProfilesResourceWithRawResponse: + return AsyncProfilesResourceWithRawResponse(self._dlp.profiles) -class DLPWithStreamingResponse: - def __init__(self, dlp: DLP) -> None: +class DLPResourceWithStreamingResponse: + def __init__(self, dlp: DLPResource) -> None: self._dlp = dlp @cached_property - def datasets(self) -> DatasetsWithStreamingResponse: - return DatasetsWithStreamingResponse(self._dlp.datasets) + def datasets(self) -> DatasetsResourceWithStreamingResponse: + return DatasetsResourceWithStreamingResponse(self._dlp.datasets) @cached_property - def patterns(self) -> PatternsWithStreamingResponse: - return PatternsWithStreamingResponse(self._dlp.patterns) + def patterns(self) -> PatternsResourceWithStreamingResponse: + return PatternsResourceWithStreamingResponse(self._dlp.patterns) @cached_property - def payload_logs(self) -> PayloadLogsWithStreamingResponse: - return PayloadLogsWithStreamingResponse(self._dlp.payload_logs) + def payload_logs(self) -> PayloadLogsResourceWithStreamingResponse: + return PayloadLogsResourceWithStreamingResponse(self._dlp.payload_logs) @cached_property - def profiles(self) -> ProfilesWithStreamingResponse: - return ProfilesWithStreamingResponse(self._dlp.profiles) + def profiles(self) -> ProfilesResourceWithStreamingResponse: + return ProfilesResourceWithStreamingResponse(self._dlp.profiles) -class AsyncDLPWithStreamingResponse: - def __init__(self, dlp: AsyncDLP) -> None: +class AsyncDLPResourceWithStreamingResponse: + def __init__(self, dlp: AsyncDLPResource) -> None: self._dlp = dlp @cached_property - def datasets(self) -> AsyncDatasetsWithStreamingResponse: - return AsyncDatasetsWithStreamingResponse(self._dlp.datasets) + def datasets(self) -> AsyncDatasetsResourceWithStreamingResponse: + return AsyncDatasetsResourceWithStreamingResponse(self._dlp.datasets) @cached_property - def patterns(self) -> AsyncPatternsWithStreamingResponse: - return AsyncPatternsWithStreamingResponse(self._dlp.patterns) + def patterns(self) -> AsyncPatternsResourceWithStreamingResponse: + return AsyncPatternsResourceWithStreamingResponse(self._dlp.patterns) @cached_property - def payload_logs(self) -> AsyncPayloadLogsWithStreamingResponse: - return AsyncPayloadLogsWithStreamingResponse(self._dlp.payload_logs) + def payload_logs(self) -> AsyncPayloadLogsResourceWithStreamingResponse: + return AsyncPayloadLogsResourceWithStreamingResponse(self._dlp.payload_logs) @cached_property - def profiles(self) -> AsyncProfilesWithStreamingResponse: - return AsyncProfilesWithStreamingResponse(self._dlp.profiles) + def profiles(self) -> AsyncProfilesResourceWithStreamingResponse: + return AsyncProfilesResourceWithStreamingResponse(self._dlp.profiles) diff --git a/src/cloudflare/resources/zero_trust/dlp/patterns.py b/src/cloudflare/resources/zero_trust/dlp/patterns.py index 0005c230756..dbf71741b8e 100644 --- a/src/cloudflare/resources/zero_trust/dlp/patterns.py +++ b/src/cloudflare/resources/zero_trust/dlp/patterns.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.dlp import PatternValidateResponse, pattern_validate_params +from ....types.zero_trust.dlp import pattern_validate_params +from ....types.logpush.ownership_validation import OwnershipValidation -__all__ = ["Patterns", "AsyncPatterns"] +__all__ = ["PatternsResource", "AsyncPatternsResource"] -class Patterns(SyncAPIResource): +class PatternsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PatternsWithRawResponse: - return PatternsWithRawResponse(self) + def with_raw_response(self) -> PatternsResourceWithRawResponse: + return PatternsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PatternsWithStreamingResponse: - return PatternsWithStreamingResponse(self) + def with_streaming_response(self) -> PatternsResourceWithStreamingResponse: + return PatternsResourceWithStreamingResponse(self) def validate( self, @@ -48,7 +49,7 @@ def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PatternValidateResponse: + ) -> Optional[OwnershipValidation]: """Validates whether this pattern is a valid regular expression. Rejects it if the @@ -79,20 +80,20 @@ def validate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OwnershipValidation]]._unwrapper, ), - cast_to=cast(Type[PatternValidateResponse], ResultWrapper[PatternValidateResponse]), + cast_to=cast(Type[Optional[OwnershipValidation]], ResultWrapper[OwnershipValidation]), ) -class AsyncPatterns(AsyncAPIResource): +class AsyncPatternsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPatternsWithRawResponse: - return AsyncPatternsWithRawResponse(self) + def with_raw_response(self) -> AsyncPatternsResourceWithRawResponse: + return AsyncPatternsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPatternsWithStreamingResponse: - return AsyncPatternsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPatternsResourceWithStreamingResponse: + return AsyncPatternsResourceWithStreamingResponse(self) async def validate( self, @@ -105,7 +106,7 @@ async def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PatternValidateResponse: + ) -> Optional[OwnershipValidation]: """Validates whether this pattern is a valid regular expression. Rejects it if the @@ -136,14 +137,14 @@ async def validate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OwnershipValidation]]._unwrapper, ), - cast_to=cast(Type[PatternValidateResponse], ResultWrapper[PatternValidateResponse]), + cast_to=cast(Type[Optional[OwnershipValidation]], ResultWrapper[OwnershipValidation]), ) -class PatternsWithRawResponse: - def __init__(self, patterns: Patterns) -> None: +class PatternsResourceWithRawResponse: + def __init__(self, patterns: PatternsResource) -> None: self._patterns = patterns self.validate = to_raw_response_wrapper( @@ -151,8 +152,8 @@ def __init__(self, patterns: Patterns) -> None: ) -class AsyncPatternsWithRawResponse: - def __init__(self, patterns: AsyncPatterns) -> None: +class AsyncPatternsResourceWithRawResponse: + def __init__(self, patterns: AsyncPatternsResource) -> None: self._patterns = patterns self.validate = async_to_raw_response_wrapper( @@ -160,8 +161,8 @@ def __init__(self, patterns: AsyncPatterns) -> None: ) -class PatternsWithStreamingResponse: - def __init__(self, patterns: Patterns) -> None: +class PatternsResourceWithStreamingResponse: + def __init__(self, patterns: PatternsResource) -> None: self._patterns = patterns self.validate = to_streamed_response_wrapper( @@ -169,8 +170,8 @@ def __init__(self, patterns: Patterns) -> None: ) -class AsyncPatternsWithStreamingResponse: - def __init__(self, patterns: AsyncPatterns) -> None: +class AsyncPatternsResourceWithStreamingResponse: + def __init__(self, patterns: AsyncPatternsResource) -> None: self._patterns = patterns self.validate = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dlp/payload_logs.py b/src/cloudflare/resources/zero_trust/dlp/payload_logs.py index f8284726097..6cb2849102c 100644 --- a/src/cloudflare/resources/zero_trust/dlp/payload_logs.py +++ b/src/cloudflare/resources/zero_trust/dlp/payload_logs.py @@ -23,19 +23,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.dlp import PayloadLogGetResponse, PayloadLogUpdateResponse, payload_log_update_params +from ....types.zero_trust.dlp import payload_log_update_params +from ....types.zero_trust.dlp.payload_log_get_response import PayloadLogGetResponse +from ....types.zero_trust.dlp.payload_log_update_response import PayloadLogUpdateResponse -__all__ = ["PayloadLogs", "AsyncPayloadLogs"] +__all__ = ["PayloadLogsResource", "AsyncPayloadLogsResource"] -class PayloadLogs(SyncAPIResource): +class PayloadLogsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PayloadLogsWithRawResponse: - return PayloadLogsWithRawResponse(self) + def with_raw_response(self) -> PayloadLogsResourceWithRawResponse: + return PayloadLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PayloadLogsWithStreamingResponse: - return PayloadLogsWithStreamingResponse(self) + def with_streaming_response(self) -> PayloadLogsResourceWithStreamingResponse: + return PayloadLogsResourceWithStreamingResponse(self) def update( self, @@ -75,7 +77,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PayloadLogUpdateResponse]._unwrapper, ), cast_to=cast(Type[PayloadLogUpdateResponse], ResultWrapper[PayloadLogUpdateResponse]), ) @@ -114,20 +116,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PayloadLogGetResponse]._unwrapper, ), cast_to=cast(Type[PayloadLogGetResponse], ResultWrapper[PayloadLogGetResponse]), ) -class AsyncPayloadLogs(AsyncAPIResource): +class AsyncPayloadLogsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPayloadLogsWithRawResponse: - return AsyncPayloadLogsWithRawResponse(self) + def with_raw_response(self) -> AsyncPayloadLogsResourceWithRawResponse: + return AsyncPayloadLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPayloadLogsWithStreamingResponse: - return AsyncPayloadLogsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPayloadLogsResourceWithStreamingResponse: + return AsyncPayloadLogsResourceWithStreamingResponse(self) async def update( self, @@ -169,7 +171,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PayloadLogUpdateResponse]._unwrapper, ), cast_to=cast(Type[PayloadLogUpdateResponse], ResultWrapper[PayloadLogUpdateResponse]), ) @@ -208,14 +210,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PayloadLogGetResponse]._unwrapper, ), cast_to=cast(Type[PayloadLogGetResponse], ResultWrapper[PayloadLogGetResponse]), ) -class PayloadLogsWithRawResponse: - def __init__(self, payload_logs: PayloadLogs) -> None: +class PayloadLogsResourceWithRawResponse: + def __init__(self, payload_logs: PayloadLogsResource) -> None: self._payload_logs = payload_logs self.update = to_raw_response_wrapper( @@ -226,8 +228,8 @@ def __init__(self, payload_logs: PayloadLogs) -> None: ) -class AsyncPayloadLogsWithRawResponse: - def __init__(self, payload_logs: AsyncPayloadLogs) -> None: +class AsyncPayloadLogsResourceWithRawResponse: + def __init__(self, payload_logs: AsyncPayloadLogsResource) -> None: self._payload_logs = payload_logs self.update = async_to_raw_response_wrapper( @@ -238,8 +240,8 @@ def __init__(self, payload_logs: AsyncPayloadLogs) -> None: ) -class PayloadLogsWithStreamingResponse: - def __init__(self, payload_logs: PayloadLogs) -> None: +class PayloadLogsResourceWithStreamingResponse: + def __init__(self, payload_logs: PayloadLogsResource) -> None: self._payload_logs = payload_logs self.update = to_streamed_response_wrapper( @@ -250,8 +252,8 @@ def __init__(self, payload_logs: PayloadLogs) -> None: ) -class AsyncPayloadLogsWithStreamingResponse: - def __init__(self, payload_logs: AsyncPayloadLogs) -> None: +class AsyncPayloadLogsResourceWithStreamingResponse: + def __init__(self, payload_logs: AsyncPayloadLogsResource) -> None: self._payload_logs = payload_logs self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dlp/profiles/__init__.py b/src/cloudflare/resources/zero_trust/dlp/profiles/__init__.py index 10f49b061a9..967f99cb142 100644 --- a/src/cloudflare/resources/zero_trust/dlp/profiles/__init__.py +++ b/src/cloudflare/resources/zero_trust/dlp/profiles/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .custom import ( - Custom, - AsyncCustom, - CustomWithRawResponse, - AsyncCustomWithRawResponse, - CustomWithStreamingResponse, - AsyncCustomWithStreamingResponse, + CustomResource, + AsyncCustomResource, + CustomResourceWithRawResponse, + AsyncCustomResourceWithRawResponse, + CustomResourceWithStreamingResponse, + AsyncCustomResourceWithStreamingResponse, ) from .profiles import ( - Profiles, - AsyncProfiles, - ProfilesWithRawResponse, - AsyncProfilesWithRawResponse, - ProfilesWithStreamingResponse, - AsyncProfilesWithStreamingResponse, + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, ) from .predefined import ( - Predefined, - AsyncPredefined, - PredefinedWithRawResponse, - AsyncPredefinedWithRawResponse, - PredefinedWithStreamingResponse, - AsyncPredefinedWithStreamingResponse, + PredefinedResource, + AsyncPredefinedResource, + PredefinedResourceWithRawResponse, + AsyncPredefinedResourceWithRawResponse, + PredefinedResourceWithStreamingResponse, + AsyncPredefinedResourceWithStreamingResponse, ) __all__ = [ - "Custom", - "AsyncCustom", - "CustomWithRawResponse", - "AsyncCustomWithRawResponse", - "CustomWithStreamingResponse", - "AsyncCustomWithStreamingResponse", - "Predefined", - "AsyncPredefined", - "PredefinedWithRawResponse", - "AsyncPredefinedWithRawResponse", - "PredefinedWithStreamingResponse", - "AsyncPredefinedWithStreamingResponse", - "Profiles", - "AsyncProfiles", - "ProfilesWithRawResponse", - "AsyncProfilesWithRawResponse", - "ProfilesWithStreamingResponse", - "AsyncProfilesWithStreamingResponse", + "CustomResource", + "AsyncCustomResource", + "CustomResourceWithRawResponse", + "AsyncCustomResourceWithRawResponse", + "CustomResourceWithStreamingResponse", + "AsyncCustomResourceWithStreamingResponse", + "PredefinedResource", + "AsyncPredefinedResource", + "PredefinedResourceWithRawResponse", + "AsyncPredefinedResourceWithRawResponse", + "PredefinedResourceWithStreamingResponse", + "AsyncPredefinedResourceWithStreamingResponse", + "ProfilesResource", + "AsyncProfilesResource", + "ProfilesResourceWithRawResponse", + "AsyncProfilesResourceWithRawResponse", + "ProfilesResourceWithStreamingResponse", + "AsyncProfilesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/dlp/profiles/custom.py b/src/cloudflare/resources/zero_trust/dlp/profiles/custom.py index 4a68854a3e8..a9265d0ffc6 100644 --- a/src/cloudflare/resources/zero_trust/dlp/profiles/custom.py +++ b/src/cloudflare/resources/zero_trust/dlp/profiles/custom.py @@ -23,25 +23,23 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.dlp.profiles import ( - DLPCustomProfile, - CustomCreateResponse, - CustomDeleteResponse, - custom_create_params, - custom_update_params, -) +from .....types.zero_trust.dlp.profiles import custom_create_params, custom_delete_params, custom_update_params +from .....types.zero_trust.dlp.context_awareness_param import ContextAwarenessParam +from .....types.zero_trust.dlp.profiles.custom_profile import CustomProfile +from .....types.zero_trust.dlp.profiles.custom_create_response import CustomCreateResponse +from .....types.zero_trust.dlp.profiles.custom_delete_response import CustomDeleteResponse -__all__ = ["Custom", "AsyncCustom"] +__all__ = ["CustomResource", "AsyncCustomResource"] -class Custom(SyncAPIResource): +class CustomResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CustomWithRawResponse: - return CustomWithRawResponse(self) + def with_raw_response(self) -> CustomResourceWithRawResponse: + return CustomResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CustomWithStreamingResponse: - return CustomWithStreamingResponse(self) + def with_streaming_response(self) -> CustomResourceWithStreamingResponse: + return CustomResourceWithStreamingResponse(self) def create( self, @@ -79,7 +77,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[CustomCreateResponse]], ResultWrapper[CustomCreateResponse]), ) @@ -90,7 +88,7 @@ def update( *, account_id: str, allowed_match_count: float | NotGiven = NOT_GIVEN, - context_awareness: custom_update_params.ContextAwareness | NotGiven = NOT_GIVEN, + context_awareness: ContextAwarenessParam | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, entries: Iterable[custom_update_params.Entry] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, @@ -102,7 +100,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DLPCustomProfile: + ) -> CustomProfile: """ Updates a DLP custom profile. @@ -158,7 +156,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DLPCustomProfile, + cast_to=CustomProfile, ) def delete( @@ -166,6 +164,7 @@ def delete( profile_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -197,12 +196,13 @@ def delete( CustomDeleteResponse, self._delete( f"/accounts/{account_id}/dlp/profiles/custom/{profile_id}", + body=maybe_transform(body, custom_delete_params.CustomDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomDeleteResponse] @@ -221,7 +221,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DLPCustomProfile: + ) -> CustomProfile: """ Fetches a custom DLP profile. @@ -249,20 +249,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomProfile]._unwrapper, ), - cast_to=cast(Type[DLPCustomProfile], ResultWrapper[DLPCustomProfile]), + cast_to=cast(Type[CustomProfile], ResultWrapper[CustomProfile]), ) -class AsyncCustom(AsyncAPIResource): +class AsyncCustomResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCustomWithRawResponse: - return AsyncCustomWithRawResponse(self) + def with_raw_response(self) -> AsyncCustomResourceWithRawResponse: + return AsyncCustomResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCustomWithStreamingResponse: - return AsyncCustomWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCustomResourceWithStreamingResponse: + return AsyncCustomResourceWithStreamingResponse(self) async def create( self, @@ -300,7 +300,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomCreateResponse]]._unwrapper, ), cast_to=cast(Type[Optional[CustomCreateResponse]], ResultWrapper[CustomCreateResponse]), ) @@ -311,7 +311,7 @@ async def update( *, account_id: str, allowed_match_count: float | NotGiven = NOT_GIVEN, - context_awareness: custom_update_params.ContextAwareness | NotGiven = NOT_GIVEN, + context_awareness: ContextAwarenessParam | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, entries: Iterable[custom_update_params.Entry] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, @@ -323,7 +323,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DLPCustomProfile: + ) -> CustomProfile: """ Updates a DLP custom profile. @@ -379,7 +379,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DLPCustomProfile, + cast_to=CustomProfile, ) async def delete( @@ -387,6 +387,7 @@ async def delete( profile_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -418,12 +419,13 @@ async def delete( CustomDeleteResponse, await self._delete( f"/accounts/{account_id}/dlp/profiles/custom/{profile_id}", + body=await async_maybe_transform(body, custom_delete_params.CustomDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomDeleteResponse] @@ -442,7 +444,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DLPCustomProfile: + ) -> CustomProfile: """ Fetches a custom DLP profile. @@ -470,14 +472,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[CustomProfile]._unwrapper, ), - cast_to=cast(Type[DLPCustomProfile], ResultWrapper[DLPCustomProfile]), + cast_to=cast(Type[CustomProfile], ResultWrapper[CustomProfile]), ) -class CustomWithRawResponse: - def __init__(self, custom: Custom) -> None: +class CustomResourceWithRawResponse: + def __init__(self, custom: CustomResource) -> None: self._custom = custom self.create = to_raw_response_wrapper( @@ -494,8 +496,8 @@ def __init__(self, custom: Custom) -> None: ) -class AsyncCustomWithRawResponse: - def __init__(self, custom: AsyncCustom) -> None: +class AsyncCustomResourceWithRawResponse: + def __init__(self, custom: AsyncCustomResource) -> None: self._custom = custom self.create = async_to_raw_response_wrapper( @@ -512,8 +514,8 @@ def __init__(self, custom: AsyncCustom) -> None: ) -class CustomWithStreamingResponse: - def __init__(self, custom: Custom) -> None: +class CustomResourceWithStreamingResponse: + def __init__(self, custom: CustomResource) -> None: self._custom = custom self.create = to_streamed_response_wrapper( @@ -530,8 +532,8 @@ def __init__(self, custom: Custom) -> None: ) -class AsyncCustomWithStreamingResponse: - def __init__(self, custom: AsyncCustom) -> None: +class AsyncCustomResourceWithStreamingResponse: + def __init__(self, custom: AsyncCustomResource) -> None: self._custom = custom self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dlp/profiles/predefined.py b/src/cloudflare/resources/zero_trust/dlp/profiles/predefined.py index 3405cc538f1..2b8664d00c4 100644 --- a/src/cloudflare/resources/zero_trust/dlp/profiles/predefined.py +++ b/src/cloudflare/resources/zero_trust/dlp/profiles/predefined.py @@ -23,19 +23,21 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.dlp.profiles import DLPPredefinedProfile, predefined_update_params +from .....types.zero_trust.dlp.profiles import predefined_update_params +from .....types.zero_trust.dlp.context_awareness_param import ContextAwarenessParam +from .....types.zero_trust.dlp.profiles.predefined_profile import PredefinedProfile -__all__ = ["Predefined", "AsyncPredefined"] +__all__ = ["PredefinedResource", "AsyncPredefinedResource"] -class Predefined(SyncAPIResource): +class PredefinedResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PredefinedWithRawResponse: - return PredefinedWithRawResponse(self) + def with_raw_response(self) -> PredefinedResourceWithRawResponse: + return PredefinedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PredefinedWithStreamingResponse: - return PredefinedWithStreamingResponse(self) + def with_streaming_response(self) -> PredefinedResourceWithStreamingResponse: + return PredefinedResourceWithStreamingResponse(self) def update( self, @@ -43,7 +45,7 @@ def update( *, account_id: str, allowed_match_count: float | NotGiven = NOT_GIVEN, - context_awareness: predefined_update_params.ContextAwareness | NotGiven = NOT_GIVEN, + context_awareness: ContextAwarenessParam | NotGiven = NOT_GIVEN, entries: Iterable[predefined_update_params.Entry] | NotGiven = NOT_GIVEN, ocr_enabled: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -52,7 +54,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DLPPredefinedProfile: + ) -> PredefinedProfile: """Updates a DLP predefined profile. Only supports enabling/disabling entries. @@ -97,7 +99,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DLPPredefinedProfile, + cast_to=PredefinedProfile, ) def get( @@ -111,7 +113,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DLPPredefinedProfile: + ) -> PredefinedProfile: """ Fetches a predefined DLP profile. @@ -139,20 +141,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PredefinedProfile]._unwrapper, ), - cast_to=cast(Type[DLPPredefinedProfile], ResultWrapper[DLPPredefinedProfile]), + cast_to=cast(Type[PredefinedProfile], ResultWrapper[PredefinedProfile]), ) -class AsyncPredefined(AsyncAPIResource): +class AsyncPredefinedResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPredefinedWithRawResponse: - return AsyncPredefinedWithRawResponse(self) + def with_raw_response(self) -> AsyncPredefinedResourceWithRawResponse: + return AsyncPredefinedResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPredefinedWithStreamingResponse: - return AsyncPredefinedWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPredefinedResourceWithStreamingResponse: + return AsyncPredefinedResourceWithStreamingResponse(self) async def update( self, @@ -160,7 +162,7 @@ async def update( *, account_id: str, allowed_match_count: float | NotGiven = NOT_GIVEN, - context_awareness: predefined_update_params.ContextAwareness | NotGiven = NOT_GIVEN, + context_awareness: ContextAwarenessParam | NotGiven = NOT_GIVEN, entries: Iterable[predefined_update_params.Entry] | NotGiven = NOT_GIVEN, ocr_enabled: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -169,7 +171,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DLPPredefinedProfile: + ) -> PredefinedProfile: """Updates a DLP predefined profile. Only supports enabling/disabling entries. @@ -214,7 +216,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DLPPredefinedProfile, + cast_to=PredefinedProfile, ) async def get( @@ -228,7 +230,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DLPPredefinedProfile: + ) -> PredefinedProfile: """ Fetches a predefined DLP profile. @@ -256,14 +258,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[PredefinedProfile]._unwrapper, ), - cast_to=cast(Type[DLPPredefinedProfile], ResultWrapper[DLPPredefinedProfile]), + cast_to=cast(Type[PredefinedProfile], ResultWrapper[PredefinedProfile]), ) -class PredefinedWithRawResponse: - def __init__(self, predefined: Predefined) -> None: +class PredefinedResourceWithRawResponse: + def __init__(self, predefined: PredefinedResource) -> None: self._predefined = predefined self.update = to_raw_response_wrapper( @@ -274,8 +276,8 @@ def __init__(self, predefined: Predefined) -> None: ) -class AsyncPredefinedWithRawResponse: - def __init__(self, predefined: AsyncPredefined) -> None: +class AsyncPredefinedResourceWithRawResponse: + def __init__(self, predefined: AsyncPredefinedResource) -> None: self._predefined = predefined self.update = async_to_raw_response_wrapper( @@ -286,8 +288,8 @@ def __init__(self, predefined: AsyncPredefined) -> None: ) -class PredefinedWithStreamingResponse: - def __init__(self, predefined: Predefined) -> None: +class PredefinedResourceWithStreamingResponse: + def __init__(self, predefined: PredefinedResource) -> None: self._predefined = predefined self.update = to_streamed_response_wrapper( @@ -298,8 +300,8 @@ def __init__(self, predefined: Predefined) -> None: ) -class AsyncPredefinedWithStreamingResponse: - def __init__(self, predefined: AsyncPredefined) -> None: +class AsyncPredefinedResourceWithStreamingResponse: + def __init__(self, predefined: AsyncPredefinedResource) -> None: self._predefined = predefined self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/dlp/profiles/profiles.py b/src/cloudflare/resources/zero_trust/dlp/profiles/profiles.py index 04d6aa9cb2c..217be9367b3 100644 --- a/src/cloudflare/resources/zero_trust/dlp/profiles/profiles.py +++ b/src/cloudflare/resources/zero_trust/dlp/profiles/profiles.py @@ -7,21 +7,21 @@ import httpx from .custom import ( - Custom, - AsyncCustom, - CustomWithRawResponse, - AsyncCustomWithRawResponse, - CustomWithStreamingResponse, - AsyncCustomWithStreamingResponse, + CustomResource, + AsyncCustomResource, + CustomResourceWithRawResponse, + AsyncCustomResourceWithRawResponse, + CustomResourceWithStreamingResponse, + AsyncCustomResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .predefined import ( - Predefined, - AsyncPredefined, - PredefinedWithRawResponse, - AsyncPredefinedWithRawResponse, - PredefinedWithStreamingResponse, - AsyncPredefinedWithStreamingResponse, + PredefinedResource, + AsyncPredefinedResource, + PredefinedResourceWithRawResponse, + AsyncPredefinedResourceWithRawResponse, + PredefinedResourceWithStreamingResponse, + AsyncPredefinedResourceWithStreamingResponse, ) from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -37,27 +37,28 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.dlp import DLPProfiles, ProfileGetResponse +from .....types.zero_trust.dlp.profile import Profile +from .....types.zero_trust.dlp.profile_get_response import ProfileGetResponse -__all__ = ["Profiles", "AsyncProfiles"] +__all__ = ["ProfilesResource", "AsyncProfilesResource"] -class Profiles(SyncAPIResource): +class ProfilesResource(SyncAPIResource): @cached_property - def custom(self) -> Custom: - return Custom(self._client) + def custom(self) -> CustomResource: + return CustomResource(self._client) @cached_property - def predefined(self) -> Predefined: - return Predefined(self._client) + def predefined(self) -> PredefinedResource: + return PredefinedResource(self._client) @cached_property - def with_raw_response(self) -> ProfilesWithRawResponse: - return ProfilesWithRawResponse(self) + def with_raw_response(self) -> ProfilesResourceWithRawResponse: + return ProfilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ProfilesWithStreamingResponse: - return ProfilesWithStreamingResponse(self) + def with_streaming_response(self) -> ProfilesResourceWithStreamingResponse: + return ProfilesResourceWithStreamingResponse(self) def list( self, @@ -69,7 +70,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DLPProfiles]: + ) -> SyncSinglePage[Profile]: """ Lists all DLP profiles in an account. @@ -88,11 +89,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/dlp/profiles", - page=SyncSinglePage[DLPProfiles], + page=SyncSinglePage[Profile], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=cast(Any, DLPProfiles), # Union types cannot be passed in as arguments in the type system + model=cast(Any, Profile), # Union types cannot be passed in as arguments in the type system ) def get( @@ -137,7 +138,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProfileGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProfileGetResponse] @@ -146,22 +147,22 @@ def get( ) -class AsyncProfiles(AsyncAPIResource): +class AsyncProfilesResource(AsyncAPIResource): @cached_property - def custom(self) -> AsyncCustom: - return AsyncCustom(self._client) + def custom(self) -> AsyncCustomResource: + return AsyncCustomResource(self._client) @cached_property - def predefined(self) -> AsyncPredefined: - return AsyncPredefined(self._client) + def predefined(self) -> AsyncPredefinedResource: + return AsyncPredefinedResource(self._client) @cached_property - def with_raw_response(self) -> AsyncProfilesWithRawResponse: - return AsyncProfilesWithRawResponse(self) + def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: + return AsyncProfilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncProfilesWithStreamingResponse: - return AsyncProfilesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncProfilesResourceWithStreamingResponse: + return AsyncProfilesResourceWithStreamingResponse(self) def list( self, @@ -173,7 +174,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DLPProfiles, AsyncSinglePage[DLPProfiles]]: + ) -> AsyncPaginator[Profile, AsyncSinglePage[Profile]]: """ Lists all DLP profiles in an account. @@ -192,11 +193,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/dlp/profiles", - page=AsyncSinglePage[DLPProfiles], + page=AsyncSinglePage[Profile], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=cast(Any, DLPProfiles), # Union types cannot be passed in as arguments in the type system + model=cast(Any, Profile), # Union types cannot be passed in as arguments in the type system ) async def get( @@ -241,7 +242,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ProfileGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProfileGetResponse] @@ -250,8 +251,8 @@ async def get( ) -class ProfilesWithRawResponse: - def __init__(self, profiles: Profiles) -> None: +class ProfilesResourceWithRawResponse: + def __init__(self, profiles: ProfilesResource) -> None: self._profiles = profiles self.list = to_raw_response_wrapper( @@ -262,16 +263,16 @@ def __init__(self, profiles: Profiles) -> None: ) @cached_property - def custom(self) -> CustomWithRawResponse: - return CustomWithRawResponse(self._profiles.custom) + def custom(self) -> CustomResourceWithRawResponse: + return CustomResourceWithRawResponse(self._profiles.custom) @cached_property - def predefined(self) -> PredefinedWithRawResponse: - return PredefinedWithRawResponse(self._profiles.predefined) + def predefined(self) -> PredefinedResourceWithRawResponse: + return PredefinedResourceWithRawResponse(self._profiles.predefined) -class AsyncProfilesWithRawResponse: - def __init__(self, profiles: AsyncProfiles) -> None: +class AsyncProfilesResourceWithRawResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: self._profiles = profiles self.list = async_to_raw_response_wrapper( @@ -282,16 +283,16 @@ def __init__(self, profiles: AsyncProfiles) -> None: ) @cached_property - def custom(self) -> AsyncCustomWithRawResponse: - return AsyncCustomWithRawResponse(self._profiles.custom) + def custom(self) -> AsyncCustomResourceWithRawResponse: + return AsyncCustomResourceWithRawResponse(self._profiles.custom) @cached_property - def predefined(self) -> AsyncPredefinedWithRawResponse: - return AsyncPredefinedWithRawResponse(self._profiles.predefined) + def predefined(self) -> AsyncPredefinedResourceWithRawResponse: + return AsyncPredefinedResourceWithRawResponse(self._profiles.predefined) -class ProfilesWithStreamingResponse: - def __init__(self, profiles: Profiles) -> None: +class ProfilesResourceWithStreamingResponse: + def __init__(self, profiles: ProfilesResource) -> None: self._profiles = profiles self.list = to_streamed_response_wrapper( @@ -302,16 +303,16 @@ def __init__(self, profiles: Profiles) -> None: ) @cached_property - def custom(self) -> CustomWithStreamingResponse: - return CustomWithStreamingResponse(self._profiles.custom) + def custom(self) -> CustomResourceWithStreamingResponse: + return CustomResourceWithStreamingResponse(self._profiles.custom) @cached_property - def predefined(self) -> PredefinedWithStreamingResponse: - return PredefinedWithStreamingResponse(self._profiles.predefined) + def predefined(self) -> PredefinedResourceWithStreamingResponse: + return PredefinedResourceWithStreamingResponse(self._profiles.predefined) -class AsyncProfilesWithStreamingResponse: - def __init__(self, profiles: AsyncProfiles) -> None: +class AsyncProfilesResourceWithStreamingResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: self._profiles = profiles self.list = async_to_streamed_response_wrapper( @@ -322,9 +323,9 @@ def __init__(self, profiles: AsyncProfiles) -> None: ) @cached_property - def custom(self) -> AsyncCustomWithStreamingResponse: - return AsyncCustomWithStreamingResponse(self._profiles.custom) + def custom(self) -> AsyncCustomResourceWithStreamingResponse: + return AsyncCustomResourceWithStreamingResponse(self._profiles.custom) @cached_property - def predefined(self) -> AsyncPredefinedWithStreamingResponse: - return AsyncPredefinedWithStreamingResponse(self._profiles.predefined) + def predefined(self) -> AsyncPredefinedResourceWithStreamingResponse: + return AsyncPredefinedResourceWithStreamingResponse(self._profiles.predefined) diff --git a/src/cloudflare/resources/zero_trust/gateway/__init__.py b/src/cloudflare/resources/zero_trust/gateway/__init__.py index 38b69870994..e121dd0022f 100644 --- a/src/cloudflare/resources/zero_trust/gateway/__init__.py +++ b/src/cloudflare/resources/zero_trust/gateway/__init__.py @@ -1,145 +1,145 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .lists import ( - Lists, - AsyncLists, - ListsWithRawResponse, - AsyncListsWithRawResponse, - ListsWithStreamingResponse, - AsyncListsWithStreamingResponse, + ListsResource, + AsyncListsResource, + ListsResourceWithRawResponse, + AsyncListsResourceWithRawResponse, + ListsResourceWithStreamingResponse, + AsyncListsResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .gateway import ( - Gateway, - AsyncGateway, - GatewayWithRawResponse, - AsyncGatewayWithRawResponse, - GatewayWithStreamingResponse, - AsyncGatewayWithStreamingResponse, + GatewayResource, + AsyncGatewayResource, + GatewayResourceWithRawResponse, + AsyncGatewayResourceWithRawResponse, + GatewayResourceWithStreamingResponse, + AsyncGatewayResourceWithStreamingResponse, ) from .logging import ( - Logging, - AsyncLogging, - LoggingWithRawResponse, - AsyncLoggingWithRawResponse, - LoggingWithStreamingResponse, - AsyncLoggingWithStreamingResponse, + LoggingResource, + AsyncLoggingResource, + LoggingResourceWithRawResponse, + AsyncLoggingResourceWithRawResponse, + LoggingResourceWithStreamingResponse, + AsyncLoggingResourceWithStreamingResponse, ) from .app_types import ( - AppTypes, - AsyncAppTypes, - AppTypesWithRawResponse, - AsyncAppTypesWithRawResponse, - AppTypesWithStreamingResponse, - AsyncAppTypesWithStreamingResponse, + AppTypesResource, + AsyncAppTypesResource, + AppTypesResourceWithRawResponse, + AsyncAppTypesResourceWithRawResponse, + AppTypesResourceWithStreamingResponse, + AsyncAppTypesResourceWithStreamingResponse, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from .categories import ( - Categories, - AsyncCategories, - CategoriesWithRawResponse, - AsyncCategoriesWithRawResponse, - CategoriesWithStreamingResponse, - AsyncCategoriesWithStreamingResponse, + CategoriesResource, + AsyncCategoriesResource, + CategoriesResourceWithRawResponse, + AsyncCategoriesResourceWithRawResponse, + CategoriesResourceWithStreamingResponse, + AsyncCategoriesResourceWithStreamingResponse, ) from .configurations import ( - Configurations, - AsyncConfigurations, - ConfigurationsWithRawResponse, - AsyncConfigurationsWithRawResponse, - ConfigurationsWithStreamingResponse, - AsyncConfigurationsWithStreamingResponse, + ConfigurationsResource, + AsyncConfigurationsResource, + ConfigurationsResourceWithRawResponse, + AsyncConfigurationsResourceWithRawResponse, + ConfigurationsResourceWithStreamingResponse, + AsyncConfigurationsResourceWithStreamingResponse, ) from .proxy_endpoints import ( - ProxyEndpoints, - AsyncProxyEndpoints, - ProxyEndpointsWithRawResponse, - AsyncProxyEndpointsWithRawResponse, - ProxyEndpointsWithStreamingResponse, - AsyncProxyEndpointsWithStreamingResponse, + ProxyEndpointsResource, + AsyncProxyEndpointsResource, + ProxyEndpointsResourceWithRawResponse, + AsyncProxyEndpointsResourceWithRawResponse, + ProxyEndpointsResourceWithStreamingResponse, + AsyncProxyEndpointsResourceWithStreamingResponse, ) from .audit_ssh_settings import ( - AuditSSHSettings, - AsyncAuditSSHSettings, - AuditSSHSettingsWithRawResponse, - AsyncAuditSSHSettingsWithRawResponse, - AuditSSHSettingsWithStreamingResponse, - AsyncAuditSSHSettingsWithStreamingResponse, + AuditSSHSettingsResource, + AsyncAuditSSHSettingsResource, + AuditSSHSettingsResourceWithRawResponse, + AsyncAuditSSHSettingsResourceWithRawResponse, + AuditSSHSettingsResourceWithStreamingResponse, + AsyncAuditSSHSettingsResourceWithStreamingResponse, ) __all__ = [ - "AuditSSHSettings", - "AsyncAuditSSHSettings", - "AuditSSHSettingsWithRawResponse", - "AsyncAuditSSHSettingsWithRawResponse", - "AuditSSHSettingsWithStreamingResponse", - "AsyncAuditSSHSettingsWithStreamingResponse", - "Categories", - "AsyncCategories", - "CategoriesWithRawResponse", - "AsyncCategoriesWithRawResponse", - "CategoriesWithStreamingResponse", - "AsyncCategoriesWithStreamingResponse", - "AppTypes", - "AsyncAppTypes", - "AppTypesWithRawResponse", - "AsyncAppTypesWithRawResponse", - "AppTypesWithStreamingResponse", - "AsyncAppTypesWithStreamingResponse", - "Configurations", - "AsyncConfigurations", - "ConfigurationsWithRawResponse", - "AsyncConfigurationsWithRawResponse", - "ConfigurationsWithStreamingResponse", - "AsyncConfigurationsWithStreamingResponse", - "Lists", - "AsyncLists", - "ListsWithRawResponse", - "AsyncListsWithRawResponse", - "ListsWithStreamingResponse", - "AsyncListsWithStreamingResponse", - "Locations", - "AsyncLocations", - "LocationsWithRawResponse", - "AsyncLocationsWithRawResponse", - "LocationsWithStreamingResponse", - "AsyncLocationsWithStreamingResponse", - "Logging", - "AsyncLogging", - "LoggingWithRawResponse", - "AsyncLoggingWithRawResponse", - "LoggingWithStreamingResponse", - "AsyncLoggingWithStreamingResponse", - "ProxyEndpoints", - "AsyncProxyEndpoints", - "ProxyEndpointsWithRawResponse", - "AsyncProxyEndpointsWithRawResponse", - "ProxyEndpointsWithStreamingResponse", - "AsyncProxyEndpointsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "Gateway", - "AsyncGateway", - "GatewayWithRawResponse", - "AsyncGatewayWithRawResponse", - "GatewayWithStreamingResponse", - "AsyncGatewayWithStreamingResponse", + "AuditSSHSettingsResource", + "AsyncAuditSSHSettingsResource", + "AuditSSHSettingsResourceWithRawResponse", + "AsyncAuditSSHSettingsResourceWithRawResponse", + "AuditSSHSettingsResourceWithStreamingResponse", + "AsyncAuditSSHSettingsResourceWithStreamingResponse", + "CategoriesResource", + "AsyncCategoriesResource", + "CategoriesResourceWithRawResponse", + "AsyncCategoriesResourceWithRawResponse", + "CategoriesResourceWithStreamingResponse", + "AsyncCategoriesResourceWithStreamingResponse", + "AppTypesResource", + "AsyncAppTypesResource", + "AppTypesResourceWithRawResponse", + "AsyncAppTypesResourceWithRawResponse", + "AppTypesResourceWithStreamingResponse", + "AsyncAppTypesResourceWithStreamingResponse", + "ConfigurationsResource", + "AsyncConfigurationsResource", + "ConfigurationsResourceWithRawResponse", + "AsyncConfigurationsResourceWithRawResponse", + "ConfigurationsResourceWithStreamingResponse", + "AsyncConfigurationsResourceWithStreamingResponse", + "ListsResource", + "AsyncListsResource", + "ListsResourceWithRawResponse", + "AsyncListsResourceWithRawResponse", + "ListsResourceWithStreamingResponse", + "AsyncListsResourceWithStreamingResponse", + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", + "LoggingResource", + "AsyncLoggingResource", + "LoggingResourceWithRawResponse", + "AsyncLoggingResourceWithRawResponse", + "LoggingResourceWithStreamingResponse", + "AsyncLoggingResourceWithStreamingResponse", + "ProxyEndpointsResource", + "AsyncProxyEndpointsResource", + "ProxyEndpointsResourceWithRawResponse", + "AsyncProxyEndpointsResourceWithRawResponse", + "ProxyEndpointsResourceWithStreamingResponse", + "AsyncProxyEndpointsResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "GatewayResource", + "AsyncGatewayResource", + "GatewayResourceWithRawResponse", + "AsyncGatewayResourceWithRawResponse", + "GatewayResourceWithStreamingResponse", + "AsyncGatewayResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/gateway/app_types.py b/src/cloudflare/resources/zero_trust/gateway/app_types.py index c7b75140620..7a10d91cabd 100644 --- a/src/cloudflare/resources/zero_trust/gateway/app_types.py +++ b/src/cloudflare/resources/zero_trust/gateway/app_types.py @@ -20,19 +20,19 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.gateway import ZeroTrustGatewayAppTypes +from ....types.zero_trust.gateway.app_type import AppType -__all__ = ["AppTypes", "AsyncAppTypes"] +__all__ = ["AppTypesResource", "AsyncAppTypesResource"] -class AppTypes(SyncAPIResource): +class AppTypesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AppTypesWithRawResponse: - return AppTypesWithRawResponse(self) + def with_raw_response(self) -> AppTypesResourceWithRawResponse: + return AppTypesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AppTypesWithStreamingResponse: - return AppTypesWithStreamingResponse(self) + def with_streaming_response(self) -> AppTypesResourceWithStreamingResponse: + return AppTypesResourceWithStreamingResponse(self) def list( self, @@ -44,7 +44,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustGatewayAppTypes]: + ) -> SyncSinglePage[AppType]: """ Fetches all application and application type mappings. @@ -63,24 +63,22 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/app_types", - page=SyncSinglePage[ZeroTrustGatewayAppTypes], + page=SyncSinglePage[AppType], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=cast( - Any, ZeroTrustGatewayAppTypes - ), # Union types cannot be passed in as arguments in the type system + model=cast(Any, AppType), # Union types cannot be passed in as arguments in the type system ) -class AsyncAppTypes(AsyncAPIResource): +class AsyncAppTypesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAppTypesWithRawResponse: - return AsyncAppTypesWithRawResponse(self) + def with_raw_response(self) -> AsyncAppTypesResourceWithRawResponse: + return AsyncAppTypesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAppTypesWithStreamingResponse: - return AsyncAppTypesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAppTypesResourceWithStreamingResponse: + return AsyncAppTypesResourceWithStreamingResponse(self) def list( self, @@ -92,7 +90,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustGatewayAppTypes, AsyncSinglePage[ZeroTrustGatewayAppTypes]]: + ) -> AsyncPaginator[AppType, AsyncSinglePage[AppType]]: """ Fetches all application and application type mappings. @@ -111,18 +109,16 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/app_types", - page=AsyncSinglePage[ZeroTrustGatewayAppTypes], + page=AsyncSinglePage[AppType], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=cast( - Any, ZeroTrustGatewayAppTypes - ), # Union types cannot be passed in as arguments in the type system + model=cast(Any, AppType), # Union types cannot be passed in as arguments in the type system ) -class AppTypesWithRawResponse: - def __init__(self, app_types: AppTypes) -> None: +class AppTypesResourceWithRawResponse: + def __init__(self, app_types: AppTypesResource) -> None: self._app_types = app_types self.list = to_raw_response_wrapper( @@ -130,8 +126,8 @@ def __init__(self, app_types: AppTypes) -> None: ) -class AsyncAppTypesWithRawResponse: - def __init__(self, app_types: AsyncAppTypes) -> None: +class AsyncAppTypesResourceWithRawResponse: + def __init__(self, app_types: AsyncAppTypesResource) -> None: self._app_types = app_types self.list = async_to_raw_response_wrapper( @@ -139,8 +135,8 @@ def __init__(self, app_types: AsyncAppTypes) -> None: ) -class AppTypesWithStreamingResponse: - def __init__(self, app_types: AppTypes) -> None: +class AppTypesResourceWithStreamingResponse: + def __init__(self, app_types: AppTypesResource) -> None: self._app_types = app_types self.list = to_streamed_response_wrapper( @@ -148,8 +144,8 @@ def __init__(self, app_types: AppTypes) -> None: ) -class AsyncAppTypesWithStreamingResponse: - def __init__(self, app_types: AsyncAppTypes) -> None: +class AsyncAppTypesResourceWithStreamingResponse: + def __init__(self, app_types: AsyncAppTypesResource) -> None: self._app_types = app_types self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/gateway/audit_ssh_settings.py b/src/cloudflare/resources/zero_trust/gateway/audit_ssh_settings.py index 281c53afc38..6b3800f4df4 100644 --- a/src/cloudflare/resources/zero_trust/gateway/audit_ssh_settings.py +++ b/src/cloudflare/resources/zero_trust/gateway/audit_ssh_settings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.gateway import ZeroTrustGatewaySettings, audit_ssh_setting_update_params +from ....types.zero_trust.gateway import audit_ssh_setting_update_params +from ....types.zero_trust.gateway.gateway_settings import GatewaySettings -__all__ = ["AuditSSHSettings", "AsyncAuditSSHSettings"] +__all__ = ["AuditSSHSettingsResource", "AsyncAuditSSHSettingsResource"] -class AuditSSHSettings(SyncAPIResource): +class AuditSSHSettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AuditSSHSettingsWithRawResponse: - return AuditSSHSettingsWithRawResponse(self) + def with_raw_response(self) -> AuditSSHSettingsResourceWithRawResponse: + return AuditSSHSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AuditSSHSettingsWithStreamingResponse: - return AuditSSHSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AuditSSHSettingsResourceWithStreamingResponse: + return AuditSSHSettingsResourceWithStreamingResponse(self) def update( self, @@ -49,7 +50,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewaySettings: + ) -> Optional[GatewaySettings]: """ Updates Zero Trust Audit SSH settings. @@ -82,9 +83,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewaySettings]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewaySettings], ResultWrapper[ZeroTrustGatewaySettings]), + cast_to=cast(Type[Optional[GatewaySettings]], ResultWrapper[GatewaySettings]), ) def get( @@ -97,7 +98,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewaySettings: + ) -> Optional[GatewaySettings]: """ Get all Zero Trust Audit SSH settings for an account. @@ -119,20 +120,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewaySettings]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewaySettings], ResultWrapper[ZeroTrustGatewaySettings]), + cast_to=cast(Type[Optional[GatewaySettings]], ResultWrapper[GatewaySettings]), ) -class AsyncAuditSSHSettings(AsyncAPIResource): +class AsyncAuditSSHSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAuditSSHSettingsWithRawResponse: - return AsyncAuditSSHSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncAuditSSHSettingsResourceWithRawResponse: + return AsyncAuditSSHSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAuditSSHSettingsWithStreamingResponse: - return AsyncAuditSSHSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAuditSSHSettingsResourceWithStreamingResponse: + return AsyncAuditSSHSettingsResourceWithStreamingResponse(self) async def update( self, @@ -146,7 +147,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewaySettings: + ) -> Optional[GatewaySettings]: """ Updates Zero Trust Audit SSH settings. @@ -179,9 +180,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewaySettings]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewaySettings], ResultWrapper[ZeroTrustGatewaySettings]), + cast_to=cast(Type[Optional[GatewaySettings]], ResultWrapper[GatewaySettings]), ) async def get( @@ -194,7 +195,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewaySettings: + ) -> Optional[GatewaySettings]: """ Get all Zero Trust Audit SSH settings for an account. @@ -216,14 +217,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewaySettings]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewaySettings], ResultWrapper[ZeroTrustGatewaySettings]), + cast_to=cast(Type[Optional[GatewaySettings]], ResultWrapper[GatewaySettings]), ) -class AuditSSHSettingsWithRawResponse: - def __init__(self, audit_ssh_settings: AuditSSHSettings) -> None: +class AuditSSHSettingsResourceWithRawResponse: + def __init__(self, audit_ssh_settings: AuditSSHSettingsResource) -> None: self._audit_ssh_settings = audit_ssh_settings self.update = to_raw_response_wrapper( @@ -234,8 +235,8 @@ def __init__(self, audit_ssh_settings: AuditSSHSettings) -> None: ) -class AsyncAuditSSHSettingsWithRawResponse: - def __init__(self, audit_ssh_settings: AsyncAuditSSHSettings) -> None: +class AsyncAuditSSHSettingsResourceWithRawResponse: + def __init__(self, audit_ssh_settings: AsyncAuditSSHSettingsResource) -> None: self._audit_ssh_settings = audit_ssh_settings self.update = async_to_raw_response_wrapper( @@ -246,8 +247,8 @@ def __init__(self, audit_ssh_settings: AsyncAuditSSHSettings) -> None: ) -class AuditSSHSettingsWithStreamingResponse: - def __init__(self, audit_ssh_settings: AuditSSHSettings) -> None: +class AuditSSHSettingsResourceWithStreamingResponse: + def __init__(self, audit_ssh_settings: AuditSSHSettingsResource) -> None: self._audit_ssh_settings = audit_ssh_settings self.update = to_streamed_response_wrapper( @@ -258,8 +259,8 @@ def __init__(self, audit_ssh_settings: AuditSSHSettings) -> None: ) -class AsyncAuditSSHSettingsWithStreamingResponse: - def __init__(self, audit_ssh_settings: AsyncAuditSSHSettings) -> None: +class AsyncAuditSSHSettingsResourceWithStreamingResponse: + def __init__(self, audit_ssh_settings: AsyncAuditSSHSettingsResource) -> None: self._audit_ssh_settings = audit_ssh_settings self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/gateway/categories.py b/src/cloudflare/resources/zero_trust/gateway/categories.py index 430e44ef82f..567a0b88a36 100644 --- a/src/cloudflare/resources/zero_trust/gateway/categories.py +++ b/src/cloudflare/resources/zero_trust/gateway/categories.py @@ -18,19 +18,19 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.gateway import ZeroTrustGatewayCategories +from ....types.zero_trust.gateway.category import Category -__all__ = ["Categories", "AsyncCategories"] +__all__ = ["CategoriesResource", "AsyncCategoriesResource"] -class Categories(SyncAPIResource): +class CategoriesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CategoriesWithRawResponse: - return CategoriesWithRawResponse(self) + def with_raw_response(self) -> CategoriesResourceWithRawResponse: + return CategoriesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CategoriesWithStreamingResponse: - return CategoriesWithStreamingResponse(self) + def with_streaming_response(self) -> CategoriesResourceWithStreamingResponse: + return CategoriesResourceWithStreamingResponse(self) def list( self, @@ -42,7 +42,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustGatewayCategories]: + ) -> SyncSinglePage[Category]: """ Fetches a list of all categories. @@ -61,22 +61,22 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/categories", - page=SyncSinglePage[ZeroTrustGatewayCategories], + page=SyncSinglePage[Category], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayCategories, + model=Category, ) -class AsyncCategories(AsyncAPIResource): +class AsyncCategoriesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCategoriesWithRawResponse: - return AsyncCategoriesWithRawResponse(self) + def with_raw_response(self) -> AsyncCategoriesResourceWithRawResponse: + return AsyncCategoriesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCategoriesWithStreamingResponse: - return AsyncCategoriesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCategoriesResourceWithStreamingResponse: + return AsyncCategoriesResourceWithStreamingResponse(self) def list( self, @@ -88,7 +88,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustGatewayCategories, AsyncSinglePage[ZeroTrustGatewayCategories]]: + ) -> AsyncPaginator[Category, AsyncSinglePage[Category]]: """ Fetches a list of all categories. @@ -107,16 +107,16 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/categories", - page=AsyncSinglePage[ZeroTrustGatewayCategories], + page=AsyncSinglePage[Category], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayCategories, + model=Category, ) -class CategoriesWithRawResponse: - def __init__(self, categories: Categories) -> None: +class CategoriesResourceWithRawResponse: + def __init__(self, categories: CategoriesResource) -> None: self._categories = categories self.list = to_raw_response_wrapper( @@ -124,8 +124,8 @@ def __init__(self, categories: Categories) -> None: ) -class AsyncCategoriesWithRawResponse: - def __init__(self, categories: AsyncCategories) -> None: +class AsyncCategoriesResourceWithRawResponse: + def __init__(self, categories: AsyncCategoriesResource) -> None: self._categories = categories self.list = async_to_raw_response_wrapper( @@ -133,8 +133,8 @@ def __init__(self, categories: AsyncCategories) -> None: ) -class CategoriesWithStreamingResponse: - def __init__(self, categories: Categories) -> None: +class CategoriesResourceWithStreamingResponse: + def __init__(self, categories: CategoriesResource) -> None: self._categories = categories self.list = to_streamed_response_wrapper( @@ -142,8 +142,8 @@ def __init__(self, categories: Categories) -> None: ) -class AsyncCategoriesWithStreamingResponse: - def __init__(self, categories: AsyncCategories) -> None: +class AsyncCategoriesResourceWithStreamingResponse: + def __init__(self, categories: AsyncCategoriesResource) -> None: self._categories = categories self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/gateway/configurations.py b/src/cloudflare/resources/zero_trust/gateway/configurations.py index 0479cfe4a78..ce316798e47 100644 --- a/src/cloudflare/resources/zero_trust/gateway/configurations.py +++ b/src/cloudflare/resources/zero_trust/gateway/configurations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -24,37 +24,38 @@ make_request_options, ) from ....types.zero_trust.gateway import ( - ConfigurationGetResponse, - ConfigurationEditResponse, - ConfigurationUpdateResponse, configuration_edit_params, configuration_update_params, ) +from ....types.zero_trust.gateway.configuration_get_response import ConfigurationGetResponse +from ....types.zero_trust.gateway.configuration_edit_response import ConfigurationEditResponse +from ....types.zero_trust.gateway.configuration_update_response import ConfigurationUpdateResponse +from ....types.zero_trust.gateway.gateway_configuration_settings_param import GatewayConfigurationSettingsParam -__all__ = ["Configurations", "AsyncConfigurations"] +__all__ = ["ConfigurationsResource", "AsyncConfigurationsResource"] -class Configurations(SyncAPIResource): +class ConfigurationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConfigurationsWithRawResponse: - return ConfigurationsWithRawResponse(self) + def with_raw_response(self) -> ConfigurationsResourceWithRawResponse: + return ConfigurationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConfigurationsWithStreamingResponse: - return ConfigurationsWithStreamingResponse(self) + def with_streaming_response(self) -> ConfigurationsResourceWithStreamingResponse: + return ConfigurationsResourceWithStreamingResponse(self) def update( self, *, account_id: str, - settings: configuration_update_params.Settings | NotGiven = NOT_GIVEN, + settings: GatewayConfigurationSettingsParam | 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, - ) -> ConfigurationUpdateResponse: + ) -> Optional[ConfigurationUpdateResponse]: """ Updates the current Zero Trust account configuration. @@ -79,23 +80,23 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConfigurationUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[ConfigurationUpdateResponse], ResultWrapper[ConfigurationUpdateResponse]), + cast_to=cast(Type[Optional[ConfigurationUpdateResponse]], ResultWrapper[ConfigurationUpdateResponse]), ) def edit( self, *, account_id: str, - settings: configuration_edit_params.Settings | NotGiven = NOT_GIVEN, + settings: GatewayConfigurationSettingsParam | 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, - ) -> ConfigurationEditResponse: + ) -> Optional[ConfigurationEditResponse]: """Patches the current Zero Trust account configuration. This endpoint can update a @@ -125,9 +126,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConfigurationEditResponse]]._unwrapper, ), - cast_to=cast(Type[ConfigurationEditResponse], ResultWrapper[ConfigurationEditResponse]), + cast_to=cast(Type[Optional[ConfigurationEditResponse]], ResultWrapper[ConfigurationEditResponse]), ) def get( @@ -140,7 +141,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigurationGetResponse: + ) -> Optional[ConfigurationGetResponse]: """ Fetches the current Zero Trust account configuration. @@ -162,33 +163,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConfigurationGetResponse]]._unwrapper, ), - cast_to=cast(Type[ConfigurationGetResponse], ResultWrapper[ConfigurationGetResponse]), + cast_to=cast(Type[Optional[ConfigurationGetResponse]], ResultWrapper[ConfigurationGetResponse]), ) -class AsyncConfigurations(AsyncAPIResource): +class AsyncConfigurationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConfigurationsWithRawResponse: - return AsyncConfigurationsWithRawResponse(self) + def with_raw_response(self) -> AsyncConfigurationsResourceWithRawResponse: + return AsyncConfigurationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConfigurationsWithStreamingResponse: - return AsyncConfigurationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConfigurationsResourceWithStreamingResponse: + return AsyncConfigurationsResourceWithStreamingResponse(self) async def update( self, *, account_id: str, - settings: configuration_update_params.Settings | NotGiven = NOT_GIVEN, + settings: GatewayConfigurationSettingsParam | 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, - ) -> ConfigurationUpdateResponse: + ) -> Optional[ConfigurationUpdateResponse]: """ Updates the current Zero Trust account configuration. @@ -215,23 +216,23 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConfigurationUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[ConfigurationUpdateResponse], ResultWrapper[ConfigurationUpdateResponse]), + cast_to=cast(Type[Optional[ConfigurationUpdateResponse]], ResultWrapper[ConfigurationUpdateResponse]), ) async def edit( self, *, account_id: str, - settings: configuration_edit_params.Settings | NotGiven = NOT_GIVEN, + settings: GatewayConfigurationSettingsParam | 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, - ) -> ConfigurationEditResponse: + ) -> Optional[ConfigurationEditResponse]: """Patches the current Zero Trust account configuration. This endpoint can update a @@ -261,9 +262,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConfigurationEditResponse]]._unwrapper, ), - cast_to=cast(Type[ConfigurationEditResponse], ResultWrapper[ConfigurationEditResponse]), + cast_to=cast(Type[Optional[ConfigurationEditResponse]], ResultWrapper[ConfigurationEditResponse]), ) async def get( @@ -276,7 +277,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigurationGetResponse: + ) -> Optional[ConfigurationGetResponse]: """ Fetches the current Zero Trust account configuration. @@ -298,14 +299,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConfigurationGetResponse]]._unwrapper, ), - cast_to=cast(Type[ConfigurationGetResponse], ResultWrapper[ConfigurationGetResponse]), + cast_to=cast(Type[Optional[ConfigurationGetResponse]], ResultWrapper[ConfigurationGetResponse]), ) -class ConfigurationsWithRawResponse: - def __init__(self, configurations: Configurations) -> None: +class ConfigurationsResourceWithRawResponse: + def __init__(self, configurations: ConfigurationsResource) -> None: self._configurations = configurations self.update = to_raw_response_wrapper( @@ -319,8 +320,8 @@ def __init__(self, configurations: Configurations) -> None: ) -class AsyncConfigurationsWithRawResponse: - def __init__(self, configurations: AsyncConfigurations) -> None: +class AsyncConfigurationsResourceWithRawResponse: + def __init__(self, configurations: AsyncConfigurationsResource) -> None: self._configurations = configurations self.update = async_to_raw_response_wrapper( @@ -334,8 +335,8 @@ def __init__(self, configurations: AsyncConfigurations) -> None: ) -class ConfigurationsWithStreamingResponse: - def __init__(self, configurations: Configurations) -> None: +class ConfigurationsResourceWithStreamingResponse: + def __init__(self, configurations: ConfigurationsResource) -> None: self._configurations = configurations self.update = to_streamed_response_wrapper( @@ -349,8 +350,8 @@ def __init__(self, configurations: Configurations) -> None: ) -class AsyncConfigurationsWithStreamingResponse: - def __init__(self, configurations: AsyncConfigurations) -> None: +class AsyncConfigurationsResourceWithStreamingResponse: + def __init__(self, configurations: AsyncConfigurationsResource) -> None: self._configurations = configurations self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/gateway/gateway.py b/src/cloudflare/resources/zero_trust/gateway/gateway.py index 49eb8d2dbd2..a2e994272d9 100644 --- a/src/cloudflare/resources/zero_trust/gateway/gateway.py +++ b/src/cloudflare/resources/zero_trust/gateway/gateway.py @@ -2,61 +2,61 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx from .lists import ( - Lists, - AsyncLists, - ListsWithRawResponse, - AsyncListsWithRawResponse, - ListsWithStreamingResponse, - AsyncListsWithStreamingResponse, + ListsResource, + AsyncListsResource, + ListsResourceWithRawResponse, + AsyncListsResourceWithRawResponse, + ListsResourceWithStreamingResponse, + AsyncListsResourceWithStreamingResponse, ) from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, ) from .logging import ( - Logging, - AsyncLogging, - LoggingWithRawResponse, - AsyncLoggingWithRawResponse, - LoggingWithStreamingResponse, - AsyncLoggingWithStreamingResponse, + LoggingResource, + AsyncLoggingResource, + LoggingResourceWithRawResponse, + AsyncLoggingResourceWithRawResponse, + LoggingResourceWithStreamingResponse, + AsyncLoggingResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .app_types import ( - AppTypes, - AsyncAppTypes, - AppTypesWithRawResponse, - AsyncAppTypesWithRawResponse, - AppTypesWithStreamingResponse, - AsyncAppTypesWithStreamingResponse, + AppTypesResource, + AsyncAppTypesResource, + AppTypesResourceWithRawResponse, + AsyncAppTypesResourceWithRawResponse, + AppTypesResourceWithStreamingResponse, + AsyncAppTypesResourceWithStreamingResponse, ) from .locations import ( - Locations, - AsyncLocations, - LocationsWithRawResponse, - AsyncLocationsWithRawResponse, - LocationsWithStreamingResponse, - AsyncLocationsWithStreamingResponse, + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, ) from ...._compat import cached_property from .categories import ( - Categories, - AsyncCategories, - CategoriesWithRawResponse, - AsyncCategoriesWithRawResponse, - CategoriesWithStreamingResponse, - AsyncCategoriesWithStreamingResponse, + CategoriesResource, + AsyncCategoriesResource, + CategoriesResourceWithRawResponse, + AsyncCategoriesResourceWithRawResponse, + CategoriesResourceWithStreamingResponse, + AsyncCategoriesResourceWithStreamingResponse, ) -from .lists.lists import Lists, AsyncLists +from .lists.lists import ListsResource, AsyncListsResource from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( to_raw_response_wrapper, @@ -66,81 +66,82 @@ ) from ...._wrappers import ResultWrapper from .configurations import ( - Configurations, - AsyncConfigurations, - ConfigurationsWithRawResponse, - AsyncConfigurationsWithRawResponse, - ConfigurationsWithStreamingResponse, - AsyncConfigurationsWithStreamingResponse, + ConfigurationsResource, + AsyncConfigurationsResource, + ConfigurationsResourceWithRawResponse, + AsyncConfigurationsResourceWithRawResponse, + ConfigurationsResourceWithStreamingResponse, + AsyncConfigurationsResourceWithStreamingResponse, ) from ...._base_client import ( make_request_options, ) from .proxy_endpoints import ( - ProxyEndpoints, - AsyncProxyEndpoints, - ProxyEndpointsWithRawResponse, - AsyncProxyEndpointsWithRawResponse, - ProxyEndpointsWithStreamingResponse, - AsyncProxyEndpointsWithStreamingResponse, + ProxyEndpointsResource, + AsyncProxyEndpointsResource, + ProxyEndpointsResourceWithRawResponse, + AsyncProxyEndpointsResourceWithRawResponse, + ProxyEndpointsResourceWithStreamingResponse, + AsyncProxyEndpointsResourceWithStreamingResponse, ) from .audit_ssh_settings import ( - AuditSSHSettings, - AsyncAuditSSHSettings, - AuditSSHSettingsWithRawResponse, - AsyncAuditSSHSettingsWithRawResponse, - AuditSSHSettingsWithStreamingResponse, - AsyncAuditSSHSettingsWithStreamingResponse, + AuditSSHSettingsResource, + AsyncAuditSSHSettingsResource, + AuditSSHSettingsResourceWithRawResponse, + AsyncAuditSSHSettingsResourceWithRawResponse, + AuditSSHSettingsResourceWithStreamingResponse, + AsyncAuditSSHSettingsResourceWithStreamingResponse, ) -from ....types.zero_trust import GatewayListResponse, GatewayCreateResponse +from ....types.zero_trust.gateway_list_response import GatewayListResponse +from ....types.zero_trust.gateway_create_response import GatewayCreateResponse -__all__ = ["Gateway", "AsyncGateway"] +__all__ = ["GatewayResource", "AsyncGatewayResource"] -class Gateway(SyncAPIResource): +class GatewayResource(SyncAPIResource): @cached_property - def audit_ssh_settings(self) -> AuditSSHSettings: - return AuditSSHSettings(self._client) + def audit_ssh_settings(self) -> AuditSSHSettingsResource: + return AuditSSHSettingsResource(self._client) @cached_property - def categories(self) -> Categories: - return Categories(self._client) + def categories(self) -> CategoriesResource: + return CategoriesResource(self._client) @cached_property - def app_types(self) -> AppTypes: - return AppTypes(self._client) + def app_types(self) -> AppTypesResource: + return AppTypesResource(self._client) @cached_property - def configurations(self) -> Configurations: - return Configurations(self._client) + def configurations(self) -> ConfigurationsResource: + return ConfigurationsResource(self._client) @cached_property - def lists(self) -> Lists: - return Lists(self._client) + def lists(self) -> ListsResource: + return ListsResource(self._client) @cached_property - def locations(self) -> Locations: - return Locations(self._client) + def locations(self) -> LocationsResource: + return LocationsResource(self._client) @cached_property - def logging(self) -> Logging: - return Logging(self._client) + def logging(self) -> LoggingResource: + return LoggingResource(self._client) @cached_property - def proxy_endpoints(self) -> ProxyEndpoints: - return ProxyEndpoints(self._client) + def proxy_endpoints(self) -> ProxyEndpointsResource: + return ProxyEndpointsResource(self._client) @cached_property - def rules(self) -> Rules: - return Rules(self._client) + def rules(self) -> RulesResource: + return RulesResource(self._client) @cached_property - def with_raw_response(self) -> GatewayWithRawResponse: - return GatewayWithRawResponse(self) + def with_raw_response(self) -> GatewayResourceWithRawResponse: + return GatewayResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> GatewayWithStreamingResponse: - return GatewayWithStreamingResponse(self) + def with_streaming_response(self) -> GatewayResourceWithStreamingResponse: + return GatewayResourceWithStreamingResponse(self) def create( self, @@ -152,7 +153,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GatewayCreateResponse: + ) -> Optional[GatewayCreateResponse]: """ Creates a Zero Trust account with an existing Cloudflare account. @@ -174,9 +175,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayCreateResponse]]._unwrapper, ), - cast_to=cast(Type[GatewayCreateResponse], ResultWrapper[GatewayCreateResponse]), + cast_to=cast(Type[Optional[GatewayCreateResponse]], ResultWrapper[GatewayCreateResponse]), ) def list( @@ -189,7 +190,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GatewayListResponse: + ) -> Optional[GatewayListResponse]: """ Gets information about the current Zero Trust account. @@ -211,56 +212,56 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayListResponse]]._unwrapper, ), - cast_to=cast(Type[GatewayListResponse], ResultWrapper[GatewayListResponse]), + cast_to=cast(Type[Optional[GatewayListResponse]], ResultWrapper[GatewayListResponse]), ) -class AsyncGateway(AsyncAPIResource): +class AsyncGatewayResource(AsyncAPIResource): @cached_property - def audit_ssh_settings(self) -> AsyncAuditSSHSettings: - return AsyncAuditSSHSettings(self._client) + def audit_ssh_settings(self) -> AsyncAuditSSHSettingsResource: + return AsyncAuditSSHSettingsResource(self._client) @cached_property - def categories(self) -> AsyncCategories: - return AsyncCategories(self._client) + def categories(self) -> AsyncCategoriesResource: + return AsyncCategoriesResource(self._client) @cached_property - def app_types(self) -> AsyncAppTypes: - return AsyncAppTypes(self._client) + def app_types(self) -> AsyncAppTypesResource: + return AsyncAppTypesResource(self._client) @cached_property - def configurations(self) -> AsyncConfigurations: - return AsyncConfigurations(self._client) + def configurations(self) -> AsyncConfigurationsResource: + return AsyncConfigurationsResource(self._client) @cached_property - def lists(self) -> AsyncLists: - return AsyncLists(self._client) + def lists(self) -> AsyncListsResource: + return AsyncListsResource(self._client) @cached_property - def locations(self) -> AsyncLocations: - return AsyncLocations(self._client) + def locations(self) -> AsyncLocationsResource: + return AsyncLocationsResource(self._client) @cached_property - def logging(self) -> AsyncLogging: - return AsyncLogging(self._client) + def logging(self) -> AsyncLoggingResource: + return AsyncLoggingResource(self._client) @cached_property - def proxy_endpoints(self) -> AsyncProxyEndpoints: - return AsyncProxyEndpoints(self._client) + def proxy_endpoints(self) -> AsyncProxyEndpointsResource: + return AsyncProxyEndpointsResource(self._client) @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncGatewayWithRawResponse: - return AsyncGatewayWithRawResponse(self) + def with_raw_response(self) -> AsyncGatewayResourceWithRawResponse: + return AsyncGatewayResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncGatewayWithStreamingResponse: - return AsyncGatewayWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncGatewayResourceWithStreamingResponse: + return AsyncGatewayResourceWithStreamingResponse(self) async def create( self, @@ -272,7 +273,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GatewayCreateResponse: + ) -> Optional[GatewayCreateResponse]: """ Creates a Zero Trust account with an existing Cloudflare account. @@ -294,9 +295,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayCreateResponse]]._unwrapper, ), - cast_to=cast(Type[GatewayCreateResponse], ResultWrapper[GatewayCreateResponse]), + cast_to=cast(Type[Optional[GatewayCreateResponse]], ResultWrapper[GatewayCreateResponse]), ) async def list( @@ -309,7 +310,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GatewayListResponse: + ) -> Optional[GatewayListResponse]: """ Gets information about the current Zero Trust account. @@ -331,14 +332,14 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayListResponse]]._unwrapper, ), - cast_to=cast(Type[GatewayListResponse], ResultWrapper[GatewayListResponse]), + cast_to=cast(Type[Optional[GatewayListResponse]], ResultWrapper[GatewayListResponse]), ) -class GatewayWithRawResponse: - def __init__(self, gateway: Gateway) -> None: +class GatewayResourceWithRawResponse: + def __init__(self, gateway: GatewayResource) -> None: self._gateway = gateway self.create = to_raw_response_wrapper( @@ -349,44 +350,44 @@ def __init__(self, gateway: Gateway) -> None: ) @cached_property - def audit_ssh_settings(self) -> AuditSSHSettingsWithRawResponse: - return AuditSSHSettingsWithRawResponse(self._gateway.audit_ssh_settings) + def audit_ssh_settings(self) -> AuditSSHSettingsResourceWithRawResponse: + return AuditSSHSettingsResourceWithRawResponse(self._gateway.audit_ssh_settings) @cached_property - def categories(self) -> CategoriesWithRawResponse: - return CategoriesWithRawResponse(self._gateway.categories) + def categories(self) -> CategoriesResourceWithRawResponse: + return CategoriesResourceWithRawResponse(self._gateway.categories) @cached_property - def app_types(self) -> AppTypesWithRawResponse: - return AppTypesWithRawResponse(self._gateway.app_types) + def app_types(self) -> AppTypesResourceWithRawResponse: + return AppTypesResourceWithRawResponse(self._gateway.app_types) @cached_property - def configurations(self) -> ConfigurationsWithRawResponse: - return ConfigurationsWithRawResponse(self._gateway.configurations) + def configurations(self) -> ConfigurationsResourceWithRawResponse: + return ConfigurationsResourceWithRawResponse(self._gateway.configurations) @cached_property - def lists(self) -> ListsWithRawResponse: - return ListsWithRawResponse(self._gateway.lists) + def lists(self) -> ListsResourceWithRawResponse: + return ListsResourceWithRawResponse(self._gateway.lists) @cached_property - def locations(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self._gateway.locations) + def locations(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self._gateway.locations) @cached_property - def logging(self) -> LoggingWithRawResponse: - return LoggingWithRawResponse(self._gateway.logging) + def logging(self) -> LoggingResourceWithRawResponse: + return LoggingResourceWithRawResponse(self._gateway.logging) @cached_property - def proxy_endpoints(self) -> ProxyEndpointsWithRawResponse: - return ProxyEndpointsWithRawResponse(self._gateway.proxy_endpoints) + def proxy_endpoints(self) -> ProxyEndpointsResourceWithRawResponse: + return ProxyEndpointsResourceWithRawResponse(self._gateway.proxy_endpoints) @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._gateway.rules) + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._gateway.rules) -class AsyncGatewayWithRawResponse: - def __init__(self, gateway: AsyncGateway) -> None: +class AsyncGatewayResourceWithRawResponse: + def __init__(self, gateway: AsyncGatewayResource) -> None: self._gateway = gateway self.create = async_to_raw_response_wrapper( @@ -397,44 +398,44 @@ def __init__(self, gateway: AsyncGateway) -> None: ) @cached_property - def audit_ssh_settings(self) -> AsyncAuditSSHSettingsWithRawResponse: - return AsyncAuditSSHSettingsWithRawResponse(self._gateway.audit_ssh_settings) + def audit_ssh_settings(self) -> AsyncAuditSSHSettingsResourceWithRawResponse: + return AsyncAuditSSHSettingsResourceWithRawResponse(self._gateway.audit_ssh_settings) @cached_property - def categories(self) -> AsyncCategoriesWithRawResponse: - return AsyncCategoriesWithRawResponse(self._gateway.categories) + def categories(self) -> AsyncCategoriesResourceWithRawResponse: + return AsyncCategoriesResourceWithRawResponse(self._gateway.categories) @cached_property - def app_types(self) -> AsyncAppTypesWithRawResponse: - return AsyncAppTypesWithRawResponse(self._gateway.app_types) + def app_types(self) -> AsyncAppTypesResourceWithRawResponse: + return AsyncAppTypesResourceWithRawResponse(self._gateway.app_types) @cached_property - def configurations(self) -> AsyncConfigurationsWithRawResponse: - return AsyncConfigurationsWithRawResponse(self._gateway.configurations) + def configurations(self) -> AsyncConfigurationsResourceWithRawResponse: + return AsyncConfigurationsResourceWithRawResponse(self._gateway.configurations) @cached_property - def lists(self) -> AsyncListsWithRawResponse: - return AsyncListsWithRawResponse(self._gateway.lists) + def lists(self) -> AsyncListsResourceWithRawResponse: + return AsyncListsResourceWithRawResponse(self._gateway.lists) @cached_property - def locations(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self._gateway.locations) + def locations(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self._gateway.locations) @cached_property - def logging(self) -> AsyncLoggingWithRawResponse: - return AsyncLoggingWithRawResponse(self._gateway.logging) + def logging(self) -> AsyncLoggingResourceWithRawResponse: + return AsyncLoggingResourceWithRawResponse(self._gateway.logging) @cached_property - def proxy_endpoints(self) -> AsyncProxyEndpointsWithRawResponse: - return AsyncProxyEndpointsWithRawResponse(self._gateway.proxy_endpoints) + def proxy_endpoints(self) -> AsyncProxyEndpointsResourceWithRawResponse: + return AsyncProxyEndpointsResourceWithRawResponse(self._gateway.proxy_endpoints) @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._gateway.rules) + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._gateway.rules) -class GatewayWithStreamingResponse: - def __init__(self, gateway: Gateway) -> None: +class GatewayResourceWithStreamingResponse: + def __init__(self, gateway: GatewayResource) -> None: self._gateway = gateway self.create = to_streamed_response_wrapper( @@ -445,44 +446,44 @@ def __init__(self, gateway: Gateway) -> None: ) @cached_property - def audit_ssh_settings(self) -> AuditSSHSettingsWithStreamingResponse: - return AuditSSHSettingsWithStreamingResponse(self._gateway.audit_ssh_settings) + def audit_ssh_settings(self) -> AuditSSHSettingsResourceWithStreamingResponse: + return AuditSSHSettingsResourceWithStreamingResponse(self._gateway.audit_ssh_settings) @cached_property - def categories(self) -> CategoriesWithStreamingResponse: - return CategoriesWithStreamingResponse(self._gateway.categories) + def categories(self) -> CategoriesResourceWithStreamingResponse: + return CategoriesResourceWithStreamingResponse(self._gateway.categories) @cached_property - def app_types(self) -> AppTypesWithStreamingResponse: - return AppTypesWithStreamingResponse(self._gateway.app_types) + def app_types(self) -> AppTypesResourceWithStreamingResponse: + return AppTypesResourceWithStreamingResponse(self._gateway.app_types) @cached_property - def configurations(self) -> ConfigurationsWithStreamingResponse: - return ConfigurationsWithStreamingResponse(self._gateway.configurations) + def configurations(self) -> ConfigurationsResourceWithStreamingResponse: + return ConfigurationsResourceWithStreamingResponse(self._gateway.configurations) @cached_property - def lists(self) -> ListsWithStreamingResponse: - return ListsWithStreamingResponse(self._gateway.lists) + def lists(self) -> ListsResourceWithStreamingResponse: + return ListsResourceWithStreamingResponse(self._gateway.lists) @cached_property - def locations(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self._gateway.locations) + def locations(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self._gateway.locations) @cached_property - def logging(self) -> LoggingWithStreamingResponse: - return LoggingWithStreamingResponse(self._gateway.logging) + def logging(self) -> LoggingResourceWithStreamingResponse: + return LoggingResourceWithStreamingResponse(self._gateway.logging) @cached_property - def proxy_endpoints(self) -> ProxyEndpointsWithStreamingResponse: - return ProxyEndpointsWithStreamingResponse(self._gateway.proxy_endpoints) + def proxy_endpoints(self) -> ProxyEndpointsResourceWithStreamingResponse: + return ProxyEndpointsResourceWithStreamingResponse(self._gateway.proxy_endpoints) @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._gateway.rules) + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._gateway.rules) -class AsyncGatewayWithStreamingResponse: - def __init__(self, gateway: AsyncGateway) -> None: +class AsyncGatewayResourceWithStreamingResponse: + def __init__(self, gateway: AsyncGatewayResource) -> None: self._gateway = gateway self.create = async_to_streamed_response_wrapper( @@ -493,37 +494,37 @@ def __init__(self, gateway: AsyncGateway) -> None: ) @cached_property - def audit_ssh_settings(self) -> AsyncAuditSSHSettingsWithStreamingResponse: - return AsyncAuditSSHSettingsWithStreamingResponse(self._gateway.audit_ssh_settings) + def audit_ssh_settings(self) -> AsyncAuditSSHSettingsResourceWithStreamingResponse: + return AsyncAuditSSHSettingsResourceWithStreamingResponse(self._gateway.audit_ssh_settings) @cached_property - def categories(self) -> AsyncCategoriesWithStreamingResponse: - return AsyncCategoriesWithStreamingResponse(self._gateway.categories) + def categories(self) -> AsyncCategoriesResourceWithStreamingResponse: + return AsyncCategoriesResourceWithStreamingResponse(self._gateway.categories) @cached_property - def app_types(self) -> AsyncAppTypesWithStreamingResponse: - return AsyncAppTypesWithStreamingResponse(self._gateway.app_types) + def app_types(self) -> AsyncAppTypesResourceWithStreamingResponse: + return AsyncAppTypesResourceWithStreamingResponse(self._gateway.app_types) @cached_property - def configurations(self) -> AsyncConfigurationsWithStreamingResponse: - return AsyncConfigurationsWithStreamingResponse(self._gateway.configurations) + def configurations(self) -> AsyncConfigurationsResourceWithStreamingResponse: + return AsyncConfigurationsResourceWithStreamingResponse(self._gateway.configurations) @cached_property - def lists(self) -> AsyncListsWithStreamingResponse: - return AsyncListsWithStreamingResponse(self._gateway.lists) + def lists(self) -> AsyncListsResourceWithStreamingResponse: + return AsyncListsResourceWithStreamingResponse(self._gateway.lists) @cached_property - def locations(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self._gateway.locations) + def locations(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self._gateway.locations) @cached_property - def logging(self) -> AsyncLoggingWithStreamingResponse: - return AsyncLoggingWithStreamingResponse(self._gateway.logging) + def logging(self) -> AsyncLoggingResourceWithStreamingResponse: + return AsyncLoggingResourceWithStreamingResponse(self._gateway.logging) @cached_property - def proxy_endpoints(self) -> AsyncProxyEndpointsWithStreamingResponse: - return AsyncProxyEndpointsWithStreamingResponse(self._gateway.proxy_endpoints) + def proxy_endpoints(self) -> AsyncProxyEndpointsResourceWithStreamingResponse: + return AsyncProxyEndpointsResourceWithStreamingResponse(self._gateway.proxy_endpoints) @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._gateway.rules) + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._gateway.rules) diff --git a/src/cloudflare/resources/zero_trust/gateway/lists/__init__.py b/src/cloudflare/resources/zero_trust/gateway/lists/__init__.py index b10351d7804..5646bb1ae63 100644 --- a/src/cloudflare/resources/zero_trust/gateway/lists/__init__.py +++ b/src/cloudflare/resources/zero_trust/gateway/lists/__init__.py @@ -1,33 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .items import ( - Items, - AsyncItems, - ItemsWithRawResponse, - AsyncItemsWithRawResponse, - ItemsWithStreamingResponse, - AsyncItemsWithStreamingResponse, + ItemsResource, + AsyncItemsResource, + ItemsResourceWithRawResponse, + AsyncItemsResourceWithRawResponse, + ItemsResourceWithStreamingResponse, + AsyncItemsResourceWithStreamingResponse, ) from .lists import ( - Lists, - AsyncLists, - ListsWithRawResponse, - AsyncListsWithRawResponse, - ListsWithStreamingResponse, - AsyncListsWithStreamingResponse, + ListsResource, + AsyncListsResource, + ListsResourceWithRawResponse, + AsyncListsResourceWithRawResponse, + ListsResourceWithStreamingResponse, + AsyncListsResourceWithStreamingResponse, ) __all__ = [ - "Items", - "AsyncItems", - "ItemsWithRawResponse", - "AsyncItemsWithRawResponse", - "ItemsWithStreamingResponse", - "AsyncItemsWithStreamingResponse", - "Lists", - "AsyncLists", - "ListsWithRawResponse", - "AsyncListsWithRawResponse", - "ListsWithStreamingResponse", - "AsyncListsWithStreamingResponse", + "ItemsResource", + "AsyncItemsResource", + "ItemsResourceWithRawResponse", + "AsyncItemsResourceWithRawResponse", + "ItemsResourceWithStreamingResponse", + "AsyncItemsResourceWithStreamingResponse", + "ListsResource", + "AsyncListsResource", + "ListsResourceWithRawResponse", + "AsyncListsResourceWithRawResponse", + "ListsResourceWithStreamingResponse", + "AsyncListsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/gateway/lists/items.py b/src/cloudflare/resources/zero_trust/gateway/lists/items.py index ef83861be8d..a8aa06368d5 100644 --- a/src/cloudflare/resources/zero_trust/gateway/lists/items.py +++ b/src/cloudflare/resources/zero_trust/gateway/lists/items.py @@ -18,19 +18,19 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.gateway.lists import ItemListResponse +from .....types.zero_trust.gateway.lists.item_list_response import ItemListResponse -__all__ = ["Items", "AsyncItems"] +__all__ = ["ItemsResource", "AsyncItemsResource"] -class Items(SyncAPIResource): +class ItemsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ItemsWithRawResponse: - return ItemsWithRawResponse(self) + def with_raw_response(self) -> ItemsResourceWithRawResponse: + return ItemsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ItemsWithStreamingResponse: - return ItemsWithStreamingResponse(self) + def with_streaming_response(self) -> ItemsResourceWithStreamingResponse: + return ItemsResourceWithStreamingResponse(self) def list( self, @@ -72,14 +72,14 @@ def list( ) -class AsyncItems(AsyncAPIResource): +class AsyncItemsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncItemsWithRawResponse: - return AsyncItemsWithRawResponse(self) + def with_raw_response(self) -> AsyncItemsResourceWithRawResponse: + return AsyncItemsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncItemsWithStreamingResponse: - return AsyncItemsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncItemsResourceWithStreamingResponse: + return AsyncItemsResourceWithStreamingResponse(self) def list( self, @@ -121,8 +121,8 @@ def list( ) -class ItemsWithRawResponse: - def __init__(self, items: Items) -> None: +class ItemsResourceWithRawResponse: + def __init__(self, items: ItemsResource) -> None: self._items = items self.list = to_raw_response_wrapper( @@ -130,8 +130,8 @@ def __init__(self, items: Items) -> None: ) -class AsyncItemsWithRawResponse: - def __init__(self, items: AsyncItems) -> None: +class AsyncItemsResourceWithRawResponse: + def __init__(self, items: AsyncItemsResource) -> None: self._items = items self.list = async_to_raw_response_wrapper( @@ -139,8 +139,8 @@ def __init__(self, items: AsyncItems) -> None: ) -class ItemsWithStreamingResponse: - def __init__(self, items: Items) -> None: +class ItemsResourceWithStreamingResponse: + def __init__(self, items: ItemsResource) -> None: self._items = items self.list = to_streamed_response_wrapper( @@ -148,8 +148,8 @@ def __init__(self, items: Items) -> None: ) -class AsyncItemsWithStreamingResponse: - def __init__(self, items: AsyncItems) -> None: +class AsyncItemsResourceWithStreamingResponse: + def __init__(self, items: AsyncItemsResource) -> None: self._items = items self.list = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/gateway/lists/lists.py b/src/cloudflare/resources/zero_trust/gateway/lists/lists.py index 3c8587631cc..f63c0fac6a4 100644 --- a/src/cloudflare/resources/zero_trust/gateway/lists/lists.py +++ b/src/cloudflare/resources/zero_trust/gateway/lists/lists.py @@ -2,18 +2,18 @@ from __future__ import annotations -from typing import Any, List, Type, Iterable, cast +from typing import Any, List, Type, Iterable, Optional, cast from typing_extensions import Literal import httpx from .items import ( - Items, - AsyncItems, - ItemsWithRawResponse, - AsyncItemsWithRawResponse, - ItemsWithStreamingResponse, - AsyncItemsWithStreamingResponse, + ItemsResource, + AsyncItemsResource, + ItemsResourceWithRawResponse, + AsyncItemsResourceWithRawResponse, + ItemsResourceWithStreamingResponse, + AsyncItemsResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -34,30 +34,27 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.gateway import ( - ListCreateResponse, - ListDeleteResponse, - ZeroTrustGatewayLists, - list_edit_params, - list_create_params, - list_update_params, -) +from .....types.zero_trust.gateway import list_edit_params, list_create_params, list_delete_params, list_update_params +from .....types.zero_trust.gateway.gateway_list import GatewayList +from .....types.zero_trust.gateway.gateway_item_param import GatewayItemParam +from .....types.zero_trust.gateway.list_create_response import ListCreateResponse +from .....types.zero_trust.gateway.list_delete_response import ListDeleteResponse -__all__ = ["Lists", "AsyncLists"] +__all__ = ["ListsResource", "AsyncListsResource"] -class Lists(SyncAPIResource): +class ListsResource(SyncAPIResource): @cached_property - def items(self) -> Items: - return Items(self._client) + def items(self) -> ItemsResource: + return ItemsResource(self._client) @cached_property - def with_raw_response(self) -> ListsWithRawResponse: - return ListsWithRawResponse(self) + def with_raw_response(self) -> ListsResourceWithRawResponse: + return ListsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ListsWithStreamingResponse: - return ListsWithStreamingResponse(self) + def with_streaming_response(self) -> ListsResourceWithStreamingResponse: + return ListsResourceWithStreamingResponse(self) def create( self, @@ -66,14 +63,14 @@ def create( name: str, type: Literal["SERIAL", "URL", "DOMAIN", "EMAIL", "IP"], description: str | NotGiven = NOT_GIVEN, - items: Iterable[list_create_params.Item] | 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, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ListCreateResponse: + ) -> Optional[ListCreateResponse]: """ Creates a new Zero Trust list. @@ -112,9 +109,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListCreateResponse]]._unwrapper, ), - cast_to=cast(Type[ListCreateResponse], ResultWrapper[ListCreateResponse]), + cast_to=cast(Type[Optional[ListCreateResponse]], ResultWrapper[ListCreateResponse]), ) def update( @@ -130,7 +127,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayLists: + ) -> Optional[GatewayList]: """ Updates a configured Zero Trust list. @@ -167,9 +164,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayList]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLists], ResultWrapper[ZeroTrustGatewayLists]), + cast_to=cast(Type[Optional[GatewayList]], ResultWrapper[GatewayList]), ) def list( @@ -182,7 +179,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustGatewayLists]: + ) -> SyncSinglePage[GatewayList]: """ Fetches all Zero Trust lists for an account. @@ -199,11 +196,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/lists", - page=SyncSinglePage[ZeroTrustGatewayLists], + page=SyncSinglePage[GatewayList], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayLists, + model=GatewayList, ) def delete( @@ -211,13 +208,14 @@ def delete( list_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> ListDeleteResponse: + ) -> Optional[ListDeleteResponse]: """ Deletes a Zero Trust list. @@ -237,15 +235,16 @@ def delete( if not list_id: raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") return cast( - ListDeleteResponse, + Optional[ListDeleteResponse], self._delete( f"/accounts/{account_id}/gateway/lists/{list_id}", + body=maybe_transform(body, list_delete_params.ListDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ListDeleteResponse] @@ -258,7 +257,7 @@ def edit( list_id: str, *, account_id: str, - append: Iterable[list_edit_params.Append] | NotGiven = NOT_GIVEN, + append: Iterable[GatewayItemParam] | NotGiven = NOT_GIVEN, remove: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -266,7 +265,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayLists: + ) -> Optional[GatewayList]: """ Appends or removes an item from a configured Zero Trust list. @@ -303,9 +302,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayList]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLists], ResultWrapper[ZeroTrustGatewayLists]), + cast_to=cast(Type[Optional[GatewayList]], ResultWrapper[GatewayList]), ) def get( @@ -319,7 +318,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayLists: + ) -> Optional[GatewayList]: """ Fetches a single Zero Trust list. @@ -345,24 +344,24 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayList]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLists], ResultWrapper[ZeroTrustGatewayLists]), + cast_to=cast(Type[Optional[GatewayList]], ResultWrapper[GatewayList]), ) -class AsyncLists(AsyncAPIResource): +class AsyncListsResource(AsyncAPIResource): @cached_property - def items(self) -> AsyncItems: - return AsyncItems(self._client) + def items(self) -> AsyncItemsResource: + return AsyncItemsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncListsWithRawResponse: - return AsyncListsWithRawResponse(self) + def with_raw_response(self) -> AsyncListsResourceWithRawResponse: + return AsyncListsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncListsWithStreamingResponse: - return AsyncListsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncListsResourceWithStreamingResponse: + return AsyncListsResourceWithStreamingResponse(self) async def create( self, @@ -371,14 +370,14 @@ async def create( name: str, type: Literal["SERIAL", "URL", "DOMAIN", "EMAIL", "IP"], description: str | NotGiven = NOT_GIVEN, - items: Iterable[list_create_params.Item] | 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, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ListCreateResponse: + ) -> Optional[ListCreateResponse]: """ Creates a new Zero Trust list. @@ -417,9 +416,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListCreateResponse]]._unwrapper, ), - cast_to=cast(Type[ListCreateResponse], ResultWrapper[ListCreateResponse]), + cast_to=cast(Type[Optional[ListCreateResponse]], ResultWrapper[ListCreateResponse]), ) async def update( @@ -435,7 +434,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayLists: + ) -> Optional[GatewayList]: """ Updates a configured Zero Trust list. @@ -472,9 +471,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayList]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLists], ResultWrapper[ZeroTrustGatewayLists]), + cast_to=cast(Type[Optional[GatewayList]], ResultWrapper[GatewayList]), ) def list( @@ -487,7 +486,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustGatewayLists, AsyncSinglePage[ZeroTrustGatewayLists]]: + ) -> AsyncPaginator[GatewayList, AsyncSinglePage[GatewayList]]: """ Fetches all Zero Trust lists for an account. @@ -504,11 +503,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/lists", - page=AsyncSinglePage[ZeroTrustGatewayLists], + page=AsyncSinglePage[GatewayList], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayLists, + model=GatewayList, ) async def delete( @@ -516,13 +515,14 @@ async def delete( list_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> ListDeleteResponse: + ) -> Optional[ListDeleteResponse]: """ Deletes a Zero Trust list. @@ -542,15 +542,16 @@ async def delete( if not list_id: raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") return cast( - ListDeleteResponse, + Optional[ListDeleteResponse], await self._delete( f"/accounts/{account_id}/gateway/lists/{list_id}", + body=await async_maybe_transform(body, list_delete_params.ListDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ListDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ListDeleteResponse] @@ -563,7 +564,7 @@ async def edit( list_id: str, *, account_id: str, - append: Iterable[list_edit_params.Append] | NotGiven = NOT_GIVEN, + append: Iterable[GatewayItemParam] | NotGiven = NOT_GIVEN, remove: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -571,7 +572,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayLists: + ) -> Optional[GatewayList]: """ Appends or removes an item from a configured Zero Trust list. @@ -608,9 +609,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayList]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLists], ResultWrapper[ZeroTrustGatewayLists]), + cast_to=cast(Type[Optional[GatewayList]], ResultWrapper[GatewayList]), ) async def get( @@ -624,7 +625,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayLists: + ) -> Optional[GatewayList]: """ Fetches a single Zero Trust list. @@ -650,14 +651,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayList]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLists], ResultWrapper[ZeroTrustGatewayLists]), + cast_to=cast(Type[Optional[GatewayList]], ResultWrapper[GatewayList]), ) -class ListsWithRawResponse: - def __init__(self, lists: Lists) -> None: +class ListsResourceWithRawResponse: + def __init__(self, lists: ListsResource) -> None: self._lists = lists self.create = to_raw_response_wrapper( @@ -680,12 +681,12 @@ def __init__(self, lists: Lists) -> None: ) @cached_property - def items(self) -> ItemsWithRawResponse: - return ItemsWithRawResponse(self._lists.items) + def items(self) -> ItemsResourceWithRawResponse: + return ItemsResourceWithRawResponse(self._lists.items) -class AsyncListsWithRawResponse: - def __init__(self, lists: AsyncLists) -> None: +class AsyncListsResourceWithRawResponse: + def __init__(self, lists: AsyncListsResource) -> None: self._lists = lists self.create = async_to_raw_response_wrapper( @@ -708,12 +709,12 @@ def __init__(self, lists: AsyncLists) -> None: ) @cached_property - def items(self) -> AsyncItemsWithRawResponse: - return AsyncItemsWithRawResponse(self._lists.items) + def items(self) -> AsyncItemsResourceWithRawResponse: + return AsyncItemsResourceWithRawResponse(self._lists.items) -class ListsWithStreamingResponse: - def __init__(self, lists: Lists) -> None: +class ListsResourceWithStreamingResponse: + def __init__(self, lists: ListsResource) -> None: self._lists = lists self.create = to_streamed_response_wrapper( @@ -736,12 +737,12 @@ def __init__(self, lists: Lists) -> None: ) @cached_property - def items(self) -> ItemsWithStreamingResponse: - return ItemsWithStreamingResponse(self._lists.items) + def items(self) -> ItemsResourceWithStreamingResponse: + return ItemsResourceWithStreamingResponse(self._lists.items) -class AsyncListsWithStreamingResponse: - def __init__(self, lists: AsyncLists) -> None: +class AsyncListsResourceWithStreamingResponse: + def __init__(self, lists: AsyncListsResource) -> None: self._lists = lists self.create = async_to_streamed_response_wrapper( @@ -764,5 +765,5 @@ def __init__(self, lists: AsyncLists) -> None: ) @cached_property - def items(self) -> AsyncItemsWithStreamingResponse: - return AsyncItemsWithStreamingResponse(self._lists.items) + def items(self) -> AsyncItemsResourceWithStreamingResponse: + return AsyncItemsResourceWithStreamingResponse(self._lists.items) diff --git a/src/cloudflare/resources/zero_trust/gateway/locations.py b/src/cloudflare/resources/zero_trust/gateway/locations.py index f0795637204..8c374c6ad27 100644 --- a/src/cloudflare/resources/zero_trust/gateway/locations.py +++ b/src/cloudflare/resources/zero_trust/gateway/locations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Iterable, cast +from typing import Any, Type, Iterable, Optional, cast import httpx @@ -25,24 +25,22 @@ AsyncPaginator, make_request_options, ) -from ....types.zero_trust.gateway import ( - LocationDeleteResponse, - ZeroTrustGatewayLocations, - location_create_params, - location_update_params, -) +from ....types.zero_trust.gateway import location_create_params, location_delete_params, location_update_params +from ....types.zero_trust.gateway.location import Location +from ....types.zero_trust.gateway.location_network_param import LocationNetworkParam +from ....types.zero_trust.gateway.location_delete_response import LocationDeleteResponse -__all__ = ["Locations", "AsyncLocations"] +__all__ = ["LocationsResource", "AsyncLocationsResource"] -class Locations(SyncAPIResource): +class LocationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LocationsWithRawResponse: - return LocationsWithRawResponse(self) + def with_raw_response(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LocationsWithStreamingResponse: - return LocationsWithStreamingResponse(self) + def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self) def create( self, @@ -51,14 +49,14 @@ def create( name: str, client_default: bool | NotGiven = NOT_GIVEN, ecs_support: bool | NotGiven = NOT_GIVEN, - networks: Iterable[location_create_params.Network] | NotGiven = NOT_GIVEN, + networks: Iterable[LocationNetworkParam] | 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, - ) -> ZeroTrustGatewayLocations: + ) -> Optional[Location]: """ Creates a new Zero Trust Gateway location. @@ -97,9 +95,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Location]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLocations], ResultWrapper[ZeroTrustGatewayLocations]), + cast_to=cast(Type[Optional[Location]], ResultWrapper[Location]), ) def update( @@ -110,14 +108,14 @@ def update( name: str, client_default: bool | NotGiven = NOT_GIVEN, ecs_support: bool | NotGiven = NOT_GIVEN, - networks: Iterable[location_update_params.Network] | NotGiven = NOT_GIVEN, + networks: Iterable[LocationNetworkParam] | 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, - ) -> ZeroTrustGatewayLocations: + ) -> Optional[Location]: """ Updates a configured Zero Trust Gateway location. @@ -158,9 +156,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Location]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLocations], ResultWrapper[ZeroTrustGatewayLocations]), + cast_to=cast(Type[Optional[Location]], ResultWrapper[Location]), ) def list( @@ -173,7 +171,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustGatewayLocations]: + ) -> SyncSinglePage[Location]: """ Fetches Zero Trust Gateway locations for an account. @@ -190,11 +188,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/locations", - page=SyncSinglePage[ZeroTrustGatewayLocations], + page=SyncSinglePage[Location], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayLocations, + model=Location, ) def delete( @@ -202,13 +200,14 @@ def delete( location_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> LocationDeleteResponse: + ) -> Optional[LocationDeleteResponse]: """ Deletes a configured Zero Trust Gateway location. @@ -226,15 +225,16 @@ def delete( if not location_id: raise ValueError(f"Expected a non-empty value for `location_id` but received {location_id!r}") return cast( - LocationDeleteResponse, + Optional[LocationDeleteResponse], self._delete( f"/accounts/{account_id}/gateway/locations/{location_id}", + body=maybe_transform(body, location_delete_params.LocationDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LocationDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[LocationDeleteResponse] @@ -253,7 +253,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayLocations: + ) -> Optional[Location]: """ Fetches a single Zero Trust Gateway location. @@ -277,20 +277,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Location]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLocations], ResultWrapper[ZeroTrustGatewayLocations]), + cast_to=cast(Type[Optional[Location]], ResultWrapper[Location]), ) -class AsyncLocations(AsyncAPIResource): +class AsyncLocationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLocationsWithRawResponse: - return AsyncLocationsWithRawResponse(self) + def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLocationsWithStreamingResponse: - return AsyncLocationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self) async def create( self, @@ -299,14 +299,14 @@ async def create( name: str, client_default: bool | NotGiven = NOT_GIVEN, ecs_support: bool | NotGiven = NOT_GIVEN, - networks: Iterable[location_create_params.Network] | NotGiven = NOT_GIVEN, + networks: Iterable[LocationNetworkParam] | 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, - ) -> ZeroTrustGatewayLocations: + ) -> Optional[Location]: """ Creates a new Zero Trust Gateway location. @@ -345,9 +345,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Location]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLocations], ResultWrapper[ZeroTrustGatewayLocations]), + cast_to=cast(Type[Optional[Location]], ResultWrapper[Location]), ) async def update( @@ -358,14 +358,14 @@ async def update( name: str, client_default: bool | NotGiven = NOT_GIVEN, ecs_support: bool | NotGiven = NOT_GIVEN, - networks: Iterable[location_update_params.Network] | NotGiven = NOT_GIVEN, + networks: Iterable[LocationNetworkParam] | 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, - ) -> ZeroTrustGatewayLocations: + ) -> Optional[Location]: """ Updates a configured Zero Trust Gateway location. @@ -406,9 +406,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Location]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLocations], ResultWrapper[ZeroTrustGatewayLocations]), + cast_to=cast(Type[Optional[Location]], ResultWrapper[Location]), ) def list( @@ -421,7 +421,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustGatewayLocations, AsyncSinglePage[ZeroTrustGatewayLocations]]: + ) -> AsyncPaginator[Location, AsyncSinglePage[Location]]: """ Fetches Zero Trust Gateway locations for an account. @@ -438,11 +438,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/locations", - page=AsyncSinglePage[ZeroTrustGatewayLocations], + page=AsyncSinglePage[Location], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayLocations, + model=Location, ) async def delete( @@ -450,13 +450,14 @@ async def delete( location_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> LocationDeleteResponse: + ) -> Optional[LocationDeleteResponse]: """ Deletes a configured Zero Trust Gateway location. @@ -474,15 +475,16 @@ async def delete( if not location_id: raise ValueError(f"Expected a non-empty value for `location_id` but received {location_id!r}") return cast( - LocationDeleteResponse, + Optional[LocationDeleteResponse], await self._delete( f"/accounts/{account_id}/gateway/locations/{location_id}", + body=await async_maybe_transform(body, location_delete_params.LocationDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[LocationDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[LocationDeleteResponse] @@ -501,7 +503,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayLocations: + ) -> Optional[Location]: """ Fetches a single Zero Trust Gateway location. @@ -525,14 +527,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Location]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayLocations], ResultWrapper[ZeroTrustGatewayLocations]), + cast_to=cast(Type[Optional[Location]], ResultWrapper[Location]), ) -class LocationsWithRawResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithRawResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.create = to_raw_response_wrapper( @@ -552,8 +554,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithRawResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithRawResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.create = async_to_raw_response_wrapper( @@ -573,8 +575,8 @@ def __init__(self, locations: AsyncLocations) -> None: ) -class LocationsWithStreamingResponse: - def __init__(self, locations: Locations) -> None: +class LocationsResourceWithStreamingResponse: + def __init__(self, locations: LocationsResource) -> None: self._locations = locations self.create = to_streamed_response_wrapper( @@ -594,8 +596,8 @@ def __init__(self, locations: Locations) -> None: ) -class AsyncLocationsWithStreamingResponse: - def __init__(self, locations: AsyncLocations) -> None: +class AsyncLocationsResourceWithStreamingResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/gateway/logging.py b/src/cloudflare/resources/zero_trust/gateway/logging.py index 6dfba1dff9e..3a150ccf4e3 100644 --- a/src/cloudflare/resources/zero_trust/gateway/logging.py +++ b/src/cloudflare/resources/zero_trust/gateway/logging.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.gateway import ZeroTrustGatewayGatewayAccountLoggingSettings, logging_update_params +from ....types.zero_trust.gateway import logging_update_params +from ....types.zero_trust.gateway.logging_setting import LoggingSetting -__all__ = ["Logging", "AsyncLogging"] +__all__ = ["LoggingResource", "AsyncLoggingResource"] -class Logging(SyncAPIResource): +class LoggingResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> LoggingWithRawResponse: - return LoggingWithRawResponse(self) + def with_raw_response(self) -> LoggingResourceWithRawResponse: + return LoggingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LoggingWithStreamingResponse: - return LoggingWithStreamingResponse(self) + def with_streaming_response(self) -> LoggingResourceWithStreamingResponse: + return LoggingResourceWithStreamingResponse(self) def update( self, @@ -49,7 +50,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayGatewayAccountLoggingSettings: + ) -> Optional[LoggingSetting]: """ Updates logging settings for the current Zero Trust account. @@ -83,12 +84,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[ZeroTrustGatewayGatewayAccountLoggingSettings], - ResultWrapper[ZeroTrustGatewayGatewayAccountLoggingSettings], + post_parser=ResultWrapper[Optional[LoggingSetting]]._unwrapper, ), + cast_to=cast(Type[Optional[LoggingSetting]], ResultWrapper[LoggingSetting]), ) def get( @@ -101,7 +99,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayGatewayAccountLoggingSettings: + ) -> Optional[LoggingSetting]: """ Fetches the current logging settings for Zero Trust account. @@ -123,23 +121,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[ZeroTrustGatewayGatewayAccountLoggingSettings], - ResultWrapper[ZeroTrustGatewayGatewayAccountLoggingSettings], + post_parser=ResultWrapper[Optional[LoggingSetting]]._unwrapper, ), + cast_to=cast(Type[Optional[LoggingSetting]], ResultWrapper[LoggingSetting]), ) -class AsyncLogging(AsyncAPIResource): +class AsyncLoggingResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLoggingWithRawResponse: - return AsyncLoggingWithRawResponse(self) + def with_raw_response(self) -> AsyncLoggingResourceWithRawResponse: + return AsyncLoggingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLoggingWithStreamingResponse: - return AsyncLoggingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLoggingResourceWithStreamingResponse: + return AsyncLoggingResourceWithStreamingResponse(self) async def update( self, @@ -153,7 +148,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayGatewayAccountLoggingSettings: + ) -> Optional[LoggingSetting]: """ Updates logging settings for the current Zero Trust account. @@ -187,12 +182,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[ZeroTrustGatewayGatewayAccountLoggingSettings], - ResultWrapper[ZeroTrustGatewayGatewayAccountLoggingSettings], + post_parser=ResultWrapper[Optional[LoggingSetting]]._unwrapper, ), + cast_to=cast(Type[Optional[LoggingSetting]], ResultWrapper[LoggingSetting]), ) async def get( @@ -205,7 +197,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayGatewayAccountLoggingSettings: + ) -> Optional[LoggingSetting]: """ Fetches the current logging settings for Zero Trust account. @@ -227,17 +219,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[ZeroTrustGatewayGatewayAccountLoggingSettings], - ResultWrapper[ZeroTrustGatewayGatewayAccountLoggingSettings], + post_parser=ResultWrapper[Optional[LoggingSetting]]._unwrapper, ), + cast_to=cast(Type[Optional[LoggingSetting]], ResultWrapper[LoggingSetting]), ) -class LoggingWithRawResponse: - def __init__(self, logging: Logging) -> None: +class LoggingResourceWithRawResponse: + def __init__(self, logging: LoggingResource) -> None: self._logging = logging self.update = to_raw_response_wrapper( @@ -248,8 +237,8 @@ def __init__(self, logging: Logging) -> None: ) -class AsyncLoggingWithRawResponse: - def __init__(self, logging: AsyncLogging) -> None: +class AsyncLoggingResourceWithRawResponse: + def __init__(self, logging: AsyncLoggingResource) -> None: self._logging = logging self.update = async_to_raw_response_wrapper( @@ -260,8 +249,8 @@ def __init__(self, logging: AsyncLogging) -> None: ) -class LoggingWithStreamingResponse: - def __init__(self, logging: Logging) -> None: +class LoggingResourceWithStreamingResponse: + def __init__(self, logging: LoggingResource) -> None: self._logging = logging self.update = to_streamed_response_wrapper( @@ -272,8 +261,8 @@ def __init__(self, logging: Logging) -> None: ) -class AsyncLoggingWithStreamingResponse: - def __init__(self, logging: AsyncLogging) -> None: +class AsyncLoggingResourceWithStreamingResponse: + def __init__(self, logging: AsyncLoggingResource) -> None: self._logging = logging self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py b/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py index f9d72d45d45..1c0da998f19 100644 --- a/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py +++ b/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, cast +from typing import Any, List, Type, Optional, cast import httpx @@ -26,38 +26,39 @@ make_request_options, ) from ....types.zero_trust.gateway import ( - ProxyEndpointDeleteResponse, - ZeroTrustGatewayProxyEndpoints, proxy_endpoint_edit_params, proxy_endpoint_create_params, + proxy_endpoint_delete_params, ) +from ....types.zero_trust.gateway.gateway_ips import GatewayIPs +from ....types.zero_trust.gateway.proxy_endpoint import ProxyEndpoint +from ....types.zero_trust.gateway.proxy_endpoint_delete_response import ProxyEndpointDeleteResponse -__all__ = ["ProxyEndpoints", "AsyncProxyEndpoints"] +__all__ = ["ProxyEndpointsResource", "AsyncProxyEndpointsResource"] -class ProxyEndpoints(SyncAPIResource): +class ProxyEndpointsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ProxyEndpointsWithRawResponse: - return ProxyEndpointsWithRawResponse(self) + def with_raw_response(self) -> ProxyEndpointsResourceWithRawResponse: + return ProxyEndpointsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ProxyEndpointsWithStreamingResponse: - return ProxyEndpointsWithStreamingResponse(self) + def with_streaming_response(self) -> ProxyEndpointsResourceWithStreamingResponse: + return ProxyEndpointsResourceWithStreamingResponse(self) def create( self, *, account_id: str, - ips: List[str], + ips: List[GatewayIPs], name: str, - subdomain: 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, - ) -> ZeroTrustGatewayProxyEndpoints: + ) -> Optional[ProxyEndpoint]: """ Creates a new Zero Trust Gateway proxy endpoint. @@ -66,8 +67,6 @@ def create( name: The name of the proxy endpoint. - subdomain: The subdomain to be used as the destination in the proxy client. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -84,7 +83,6 @@ def create( { "ips": ips, "name": name, - "subdomain": subdomain, }, proxy_endpoint_create_params.ProxyEndpointCreateParams, ), @@ -93,9 +91,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayProxyEndpoints], ResultWrapper[ZeroTrustGatewayProxyEndpoints]), + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) def list( @@ -108,7 +106,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustGatewayProxyEndpoints]: + ) -> SyncSinglePage[ProxyEndpoint]: """ Fetches a single Zero Trust Gateway proxy endpoint. @@ -125,11 +123,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/proxy_endpoints", - page=SyncSinglePage[ZeroTrustGatewayProxyEndpoints], + page=SyncSinglePage[ProxyEndpoint], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayProxyEndpoints, + model=ProxyEndpoint, ) def delete( @@ -137,13 +135,14 @@ def delete( proxy_endpoint_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> ProxyEndpointDeleteResponse: + ) -> Optional[ProxyEndpointDeleteResponse]: """ Deletes a configured Zero Trust Gateway proxy endpoint. @@ -161,15 +160,16 @@ def delete( if not proxy_endpoint_id: raise ValueError(f"Expected a non-empty value for `proxy_endpoint_id` but received {proxy_endpoint_id!r}") return cast( - ProxyEndpointDeleteResponse, + Optional[ProxyEndpointDeleteResponse], self._delete( f"/accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}", + body=maybe_transform(body, proxy_endpoint_delete_params.ProxyEndpointDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpointDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProxyEndpointDeleteResponse] @@ -182,16 +182,15 @@ def edit( proxy_endpoint_id: str, *, account_id: str, - ips: List[str] | NotGiven = NOT_GIVEN, + ips: List[GatewayIPs] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - subdomain: 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, - ) -> ZeroTrustGatewayProxyEndpoints: + ) -> Optional[ProxyEndpoint]: """ Updates a configured Zero Trust Gateway proxy endpoint. @@ -200,8 +199,6 @@ def edit( name: The name of the proxy endpoint. - subdomain: The subdomain to be used as the destination in the proxy client. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -220,7 +217,6 @@ def edit( { "ips": ips, "name": name, - "subdomain": subdomain, }, proxy_endpoint_edit_params.ProxyEndpointEditParams, ), @@ -229,9 +225,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayProxyEndpoints], ResultWrapper[ZeroTrustGatewayProxyEndpoints]), + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) def get( @@ -245,7 +241,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayProxyEndpoints: + ) -> Optional[ProxyEndpoint]: """ Fetches all Zero Trust Gateway proxy endpoints for an account. @@ -269,35 +265,34 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayProxyEndpoints], ResultWrapper[ZeroTrustGatewayProxyEndpoints]), + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) -class AsyncProxyEndpoints(AsyncAPIResource): +class AsyncProxyEndpointsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncProxyEndpointsWithRawResponse: - return AsyncProxyEndpointsWithRawResponse(self) + def with_raw_response(self) -> AsyncProxyEndpointsResourceWithRawResponse: + return AsyncProxyEndpointsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncProxyEndpointsWithStreamingResponse: - return AsyncProxyEndpointsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncProxyEndpointsResourceWithStreamingResponse: + return AsyncProxyEndpointsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, - ips: List[str], + ips: List[GatewayIPs], name: str, - subdomain: 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, - ) -> ZeroTrustGatewayProxyEndpoints: + ) -> Optional[ProxyEndpoint]: """ Creates a new Zero Trust Gateway proxy endpoint. @@ -306,8 +301,6 @@ async def create( name: The name of the proxy endpoint. - subdomain: The subdomain to be used as the destination in the proxy client. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -324,7 +317,6 @@ async def create( { "ips": ips, "name": name, - "subdomain": subdomain, }, proxy_endpoint_create_params.ProxyEndpointCreateParams, ), @@ -333,9 +325,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayProxyEndpoints], ResultWrapper[ZeroTrustGatewayProxyEndpoints]), + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) def list( @@ -348,7 +340,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustGatewayProxyEndpoints, AsyncSinglePage[ZeroTrustGatewayProxyEndpoints]]: + ) -> AsyncPaginator[ProxyEndpoint, AsyncSinglePage[ProxyEndpoint]]: """ Fetches a single Zero Trust Gateway proxy endpoint. @@ -365,11 +357,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/proxy_endpoints", - page=AsyncSinglePage[ZeroTrustGatewayProxyEndpoints], + page=AsyncSinglePage[ProxyEndpoint], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayProxyEndpoints, + model=ProxyEndpoint, ) async def delete( @@ -377,13 +369,14 @@ async def delete( proxy_endpoint_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> ProxyEndpointDeleteResponse: + ) -> Optional[ProxyEndpointDeleteResponse]: """ Deletes a configured Zero Trust Gateway proxy endpoint. @@ -401,15 +394,16 @@ async def delete( if not proxy_endpoint_id: raise ValueError(f"Expected a non-empty value for `proxy_endpoint_id` but received {proxy_endpoint_id!r}") return cast( - ProxyEndpointDeleteResponse, + Optional[ProxyEndpointDeleteResponse], await self._delete( f"/accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}", + body=await async_maybe_transform(body, proxy_endpoint_delete_params.ProxyEndpointDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpointDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ProxyEndpointDeleteResponse] @@ -422,16 +416,15 @@ async def edit( proxy_endpoint_id: str, *, account_id: str, - ips: List[str] | NotGiven = NOT_GIVEN, + ips: List[GatewayIPs] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - subdomain: 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, - ) -> ZeroTrustGatewayProxyEndpoints: + ) -> Optional[ProxyEndpoint]: """ Updates a configured Zero Trust Gateway proxy endpoint. @@ -440,8 +433,6 @@ async def edit( name: The name of the proxy endpoint. - subdomain: The subdomain to be used as the destination in the proxy client. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -460,7 +451,6 @@ async def edit( { "ips": ips, "name": name, - "subdomain": subdomain, }, proxy_endpoint_edit_params.ProxyEndpointEditParams, ), @@ -469,9 +459,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayProxyEndpoints], ResultWrapper[ZeroTrustGatewayProxyEndpoints]), + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) async def get( @@ -485,7 +475,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayProxyEndpoints: + ) -> Optional[ProxyEndpoint]: """ Fetches all Zero Trust Gateway proxy endpoints for an account. @@ -509,14 +499,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayProxyEndpoints], ResultWrapper[ZeroTrustGatewayProxyEndpoints]), + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) -class ProxyEndpointsWithRawResponse: - def __init__(self, proxy_endpoints: ProxyEndpoints) -> None: +class ProxyEndpointsResourceWithRawResponse: + def __init__(self, proxy_endpoints: ProxyEndpointsResource) -> None: self._proxy_endpoints = proxy_endpoints self.create = to_raw_response_wrapper( @@ -536,8 +526,8 @@ def __init__(self, proxy_endpoints: ProxyEndpoints) -> None: ) -class AsyncProxyEndpointsWithRawResponse: - def __init__(self, proxy_endpoints: AsyncProxyEndpoints) -> None: +class AsyncProxyEndpointsResourceWithRawResponse: + def __init__(self, proxy_endpoints: AsyncProxyEndpointsResource) -> None: self._proxy_endpoints = proxy_endpoints self.create = async_to_raw_response_wrapper( @@ -557,8 +547,8 @@ def __init__(self, proxy_endpoints: AsyncProxyEndpoints) -> None: ) -class ProxyEndpointsWithStreamingResponse: - def __init__(self, proxy_endpoints: ProxyEndpoints) -> None: +class ProxyEndpointsResourceWithStreamingResponse: + def __init__(self, proxy_endpoints: ProxyEndpointsResource) -> None: self._proxy_endpoints = proxy_endpoints self.create = to_streamed_response_wrapper( @@ -578,8 +568,8 @@ def __init__(self, proxy_endpoints: ProxyEndpoints) -> None: ) -class AsyncProxyEndpointsWithStreamingResponse: - def __init__(self, proxy_endpoints: AsyncProxyEndpoints) -> None: +class AsyncProxyEndpointsResourceWithStreamingResponse: + def __init__(self, proxy_endpoints: AsyncProxyEndpointsResource) -> None: self._proxy_endpoints = proxy_endpoints self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/gateway/rules.py b/src/cloudflare/resources/zero_trust/gateway/rules.py index 9330728e9ac..d61fac4c73b 100644 --- a/src/cloudflare/resources/zero_trust/gateway/rules.py +++ b/src/cloudflare/resources/zero_trust/gateway/rules.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, cast +from typing import Any, List, Type, Optional, cast from typing_extensions import Literal import httpx @@ -27,23 +27,27 @@ make_request_options, ) from ....types.zero_trust.gateway import ( - RuleDeleteResponse, - ZeroTrustGatewayRules, rule_create_params, + rule_delete_params, rule_update_params, ) +from ....types.zero_trust.gateway.gateway_rule import GatewayRule +from ....types.zero_trust.gateway.gateway_filter import GatewayFilter +from ....types.zero_trust.gateway.schedule_param import ScheduleParam +from ....types.zero_trust.gateway.rule_setting_param import RuleSettingParam +from ....types.zero_trust.gateway.rule_delete_response import RuleDeleteResponse -__all__ = ["Rules", "AsyncRules"] +__all__ = ["RulesResource", "AsyncRulesResource"] -class Rules(SyncAPIResource): +class RulesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) def create( self, @@ -64,16 +68,17 @@ def create( "l4_override", "egress", "audit_ssh", + "resolve", ], name: str, description: str | NotGiven = NOT_GIVEN, device_posture: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - filters: List[Literal["http", "dns", "l4", "egress"]] | NotGiven = NOT_GIVEN, + filters: List[GatewayFilter] | NotGiven = NOT_GIVEN, identity: str | NotGiven = NOT_GIVEN, precedence: int | NotGiven = NOT_GIVEN, - rule_settings: rule_create_params.RuleSettings | NotGiven = NOT_GIVEN, - schedule: rule_create_params.Schedule | NotGiven = NOT_GIVEN, + rule_settings: RuleSettingParam | NotGiven = NOT_GIVEN, + schedule: ScheduleParam | NotGiven = NOT_GIVEN, traffic: 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. @@ -81,7 +86,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayRules: + ) -> Optional[GatewayRule]: """ Creates a new Zero Trust Gateway rule. @@ -146,9 +151,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayRule]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayRules], ResultWrapper[ZeroTrustGatewayRules]), + cast_to=cast(Type[Optional[GatewayRule]], ResultWrapper[GatewayRule]), ) def update( @@ -171,16 +176,17 @@ def update( "l4_override", "egress", "audit_ssh", + "resolve", ], name: str, description: str | NotGiven = NOT_GIVEN, device_posture: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - filters: List[Literal["http", "dns", "l4", "egress"]] | NotGiven = NOT_GIVEN, + filters: List[GatewayFilter] | NotGiven = NOT_GIVEN, identity: str | NotGiven = NOT_GIVEN, precedence: int | NotGiven = NOT_GIVEN, - rule_settings: rule_update_params.RuleSettings | NotGiven = NOT_GIVEN, - schedule: rule_update_params.Schedule | NotGiven = NOT_GIVEN, + rule_settings: RuleSettingParam | NotGiven = NOT_GIVEN, + schedule: ScheduleParam | NotGiven = NOT_GIVEN, traffic: 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. @@ -188,7 +194,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayRules: + ) -> Optional[GatewayRule]: """ Updates a configured Zero Trust Gateway rule. @@ -257,9 +263,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayRule]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayRules], ResultWrapper[ZeroTrustGatewayRules]), + cast_to=cast(Type[Optional[GatewayRule]], ResultWrapper[GatewayRule]), ) def list( @@ -272,7 +278,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ZeroTrustGatewayRules]: + ) -> SyncSinglePage[GatewayRule]: """ Fetches the Zero Trust Gateway rules for an account. @@ -289,11 +295,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/rules", - page=SyncSinglePage[ZeroTrustGatewayRules], + page=SyncSinglePage[GatewayRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayRules, + model=GatewayRule, ) def delete( @@ -301,13 +307,14 @@ def delete( rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> RuleDeleteResponse: + ) -> Optional[RuleDeleteResponse]: """ Deletes a Zero Trust Gateway rule. @@ -327,15 +334,16 @@ def delete( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return cast( - RuleDeleteResponse, + Optional[RuleDeleteResponse], self._delete( f"/accounts/{account_id}/gateway/rules/{rule_id}", + body=maybe_transform(body, rule_delete_params.RuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RuleDeleteResponse] @@ -354,7 +362,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayRules: + ) -> Optional[GatewayRule]: """ Fetches a single Zero Trust Gateway rule. @@ -380,20 +388,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayRule]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayRules], ResultWrapper[ZeroTrustGatewayRules]), + cast_to=cast(Type[Optional[GatewayRule]], ResultWrapper[GatewayRule]), ) -class AsyncRules(AsyncAPIResource): +class AsyncRulesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) async def create( self, @@ -414,16 +422,17 @@ async def create( "l4_override", "egress", "audit_ssh", + "resolve", ], name: str, description: str | NotGiven = NOT_GIVEN, device_posture: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - filters: List[Literal["http", "dns", "l4", "egress"]] | NotGiven = NOT_GIVEN, + filters: List[GatewayFilter] | NotGiven = NOT_GIVEN, identity: str | NotGiven = NOT_GIVEN, precedence: int | NotGiven = NOT_GIVEN, - rule_settings: rule_create_params.RuleSettings | NotGiven = NOT_GIVEN, - schedule: rule_create_params.Schedule | NotGiven = NOT_GIVEN, + rule_settings: RuleSettingParam | NotGiven = NOT_GIVEN, + schedule: ScheduleParam | NotGiven = NOT_GIVEN, traffic: 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. @@ -431,7 +440,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayRules: + ) -> Optional[GatewayRule]: """ Creates a new Zero Trust Gateway rule. @@ -496,9 +505,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayRule]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayRules], ResultWrapper[ZeroTrustGatewayRules]), + cast_to=cast(Type[Optional[GatewayRule]], ResultWrapper[GatewayRule]), ) async def update( @@ -521,16 +530,17 @@ async def update( "l4_override", "egress", "audit_ssh", + "resolve", ], name: str, description: str | NotGiven = NOT_GIVEN, device_posture: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, - filters: List[Literal["http", "dns", "l4", "egress"]] | NotGiven = NOT_GIVEN, + filters: List[GatewayFilter] | NotGiven = NOT_GIVEN, identity: str | NotGiven = NOT_GIVEN, precedence: int | NotGiven = NOT_GIVEN, - rule_settings: rule_update_params.RuleSettings | NotGiven = NOT_GIVEN, - schedule: rule_update_params.Schedule | NotGiven = NOT_GIVEN, + rule_settings: RuleSettingParam | NotGiven = NOT_GIVEN, + schedule: ScheduleParam | NotGiven = NOT_GIVEN, traffic: 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. @@ -538,7 +548,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayRules: + ) -> Optional[GatewayRule]: """ Updates a configured Zero Trust Gateway rule. @@ -607,9 +617,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayRule]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayRules], ResultWrapper[ZeroTrustGatewayRules]), + cast_to=cast(Type[Optional[GatewayRule]], ResultWrapper[GatewayRule]), ) def list( @@ -622,7 +632,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ZeroTrustGatewayRules, AsyncSinglePage[ZeroTrustGatewayRules]]: + ) -> AsyncPaginator[GatewayRule, AsyncSinglePage[GatewayRule]]: """ Fetches the Zero Trust Gateway rules for an account. @@ -639,11 +649,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/gateway/rules", - page=AsyncSinglePage[ZeroTrustGatewayRules], + page=AsyncSinglePage[GatewayRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=ZeroTrustGatewayRules, + model=GatewayRule, ) async def delete( @@ -651,13 +661,14 @@ async def delete( rule_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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, - ) -> RuleDeleteResponse: + ) -> Optional[RuleDeleteResponse]: """ Deletes a Zero Trust Gateway rule. @@ -677,15 +688,16 @@ async def delete( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return cast( - RuleDeleteResponse, + Optional[RuleDeleteResponse], await self._delete( f"/accounts/{account_id}/gateway/rules/{rule_id}", + body=await async_maybe_transform(body, rule_delete_params.RuleDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RuleDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RuleDeleteResponse] @@ -704,7 +716,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustGatewayRules: + ) -> Optional[GatewayRule]: """ Fetches a single Zero Trust Gateway rule. @@ -730,14 +742,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[GatewayRule]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustGatewayRules], ResultWrapper[ZeroTrustGatewayRules]), + cast_to=cast(Type[Optional[GatewayRule]], ResultWrapper[GatewayRule]), ) -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_raw_response_wrapper( @@ -757,8 +769,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_raw_response_wrapper( @@ -778,8 +790,8 @@ def __init__(self, rules: AsyncRules) -> None: ) -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: self._rules = rules self.create = to_streamed_response_wrapper( @@ -799,8 +811,8 @@ def __init__(self, rules: Rules) -> None: ) -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/identity_providers.py b/src/cloudflare/resources/zero_trust/identity_providers.py index c265b813a21..3e9508b349d 100644 --- a/src/cloudflare/resources/zero_trust/identity_providers.py +++ b/src/cloudflare/resources/zero_trust/identity_providers.py @@ -2,8 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast, overload -from typing_extensions import Literal +from typing import Any, Type, Optional, cast, overload import httpx @@ -28,57 +27,46 @@ make_request_options, ) from ...types.zero_trust import ( - ZeroTrustIdentityProviders, - IdentityProviderListResponse, - IdentityProviderDeleteResponse, + IdentityProviderType, identity_provider_create_params, identity_provider_update_params, ) +from ...types.zero_trust.identity_provider import IdentityProvider +from ...types.zero_trust.scim_config_param import ScimConfigParam +from ...types.zero_trust.identity_provider_type import IdentityProviderType +from ...types.zero_trust.generic_oauth_config_param import GenericOAuthConfigParam +from ...types.zero_trust.identity_provider_list_response import IdentityProviderListResponse +from ...types.zero_trust.identity_provider_delete_response import IdentityProviderDeleteResponse -__all__ = ["IdentityProviders", "AsyncIdentityProviders"] +__all__ = ["IdentityProvidersResource", "AsyncIdentityProvidersResource"] -class IdentityProviders(SyncAPIResource): +class IdentityProvidersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IdentityProvidersWithRawResponse: - return IdentityProvidersWithRawResponse(self) + def with_raw_response(self) -> IdentityProvidersResourceWithRawResponse: + return IdentityProvidersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IdentityProvidersWithStreamingResponse: - return IdentityProvidersWithStreamingResponse(self) + def with_streaming_response(self) -> IdentityProvidersResourceWithStreamingResponse: + return IdentityProvidersResourceWithStreamingResponse(self) @overload def create( self, *, - config: identity_provider_create_params.AccessAzureAdConfig, + config: identity_provider_create_params.AzureADConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessAzureAdScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -116,32 +104,17 @@ def create( *, config: identity_provider_create_params.AccessCentrifyConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessCentrifyScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -177,34 +150,19 @@ def create( def create( self, *, - config: identity_provider_create_params.AccessFacebookConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessFacebookScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -240,34 +198,19 @@ def create( def create( self, *, - config: identity_provider_create_params.AccessGitHubConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessGitHubScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -305,32 +248,17 @@ def create( *, config: identity_provider_create_params.AccessGoogleConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessGoogleScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -368,32 +296,17 @@ def create( *, config: identity_provider_create_params.AccessGoogleAppsConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessGoogleAppsScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -429,34 +342,19 @@ def create( def create( self, *, - config: identity_provider_create_params.AccessLinkedinConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessLinkedinScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -492,34 +390,19 @@ def create( def create( self, *, - config: identity_provider_create_params.AccessOidcConfig, + config: identity_provider_create_params.AccessOIDCConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessOidcScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -557,32 +440,17 @@ def create( *, config: identity_provider_create_params.AccessOktaConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessOktaScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -620,32 +488,17 @@ def create( *, config: identity_provider_create_params.AccessOneloginConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessOneloginScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -683,32 +536,17 @@ def create( *, config: identity_provider_create_params.AccessPingoneConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessPingoneScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -744,34 +582,19 @@ def create( def create( self, *, - config: identity_provider_create_params.AccessSamlConfig, + config: identity_provider_create_params.AccessSAMLConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessSamlScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -807,34 +630,19 @@ def create( def create( self, *, - config: identity_provider_create_params.AccessYandexConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessYandexScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -872,32 +680,17 @@ def create( *, config: object, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessOnetimepinScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -948,50 +741,29 @@ def create( def create( self, *, - config: identity_provider_create_params.AccessAzureAdConfig + config: identity_provider_create_params.AzureADConfig | identity_provider_create_params.AccessCentrifyConfig - | identity_provider_create_params.AccessFacebookConfig + | GenericOAuthConfigParam | identity_provider_create_params.AccessGoogleConfig | identity_provider_create_params.AccessGoogleAppsConfig - | identity_provider_create_params.AccessOidcConfig + | identity_provider_create_params.AccessOIDCConfig | identity_provider_create_params.AccessOktaConfig | identity_provider_create_params.AccessOneloginConfig | identity_provider_create_params.AccessPingoneConfig - | identity_provider_create_params.AccessSamlConfig + | identity_provider_create_params.AccessSAMLConfig | object, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessAzureAdScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") + ) -> Optional[IdentityProvider]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -999,10 +771,13 @@ def create( 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 cast( - ZeroTrustIdentityProviders, + Optional[IdentityProvider], self._post( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", body=maybe_transform( @@ -1019,10 +794,10 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustIdentityProviders] + Any, ResultWrapper[IdentityProvider] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -1032,34 +807,19 @@ def update( self, uuid: str, *, - config: identity_provider_update_params.AccessAzureAdConfig, + config: identity_provider_update_params.AzureADConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessAzureAdScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1100,32 +860,17 @@ def update( *, config: identity_provider_update_params.AccessCentrifyConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessCentrifyScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1164,34 +909,19 @@ def update( self, uuid: str, *, - config: identity_provider_update_params.AccessFacebookConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessFacebookScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1230,34 +960,19 @@ def update( self, uuid: str, *, - config: identity_provider_update_params.AccessGitHubConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessGitHubScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1298,32 +1013,17 @@ def update( *, config: identity_provider_update_params.AccessGoogleConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessGoogleScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1364,32 +1064,17 @@ def update( *, config: identity_provider_update_params.AccessGoogleAppsConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessGoogleAppsScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1428,34 +1113,19 @@ def update( self, uuid: str, *, - config: identity_provider_update_params.AccessLinkedinConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessLinkedinScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1494,34 +1164,19 @@ def update( self, uuid: str, *, - config: identity_provider_update_params.AccessOidcConfig, + config: identity_provider_update_params.AccessOIDCConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessOidcScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1562,32 +1217,17 @@ def update( *, config: identity_provider_update_params.AccessOktaConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessOktaScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1628,32 +1268,17 @@ def update( *, config: identity_provider_update_params.AccessOneloginConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessOneloginScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1694,32 +1319,17 @@ def update( *, config: identity_provider_update_params.AccessPingoneConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessPingoneScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1758,34 +1368,19 @@ def update( self, uuid: str, *, - config: identity_provider_update_params.AccessSamlConfig, + config: identity_provider_update_params.AccessSAMLConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessSamlScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1824,34 +1419,19 @@ def update( self, uuid: str, *, - config: identity_provider_update_params.AccessYandexConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessYandexScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1892,32 +1472,17 @@ def update( *, config: object, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessOnetimepinScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -1971,52 +1536,31 @@ def update( self, uuid: str, *, - config: identity_provider_update_params.AccessAzureAdConfig + config: identity_provider_update_params.AzureADConfig | identity_provider_update_params.AccessCentrifyConfig - | identity_provider_update_params.AccessFacebookConfig + | GenericOAuthConfigParam | identity_provider_update_params.AccessGoogleConfig | identity_provider_update_params.AccessGoogleAppsConfig - | identity_provider_update_params.AccessOidcConfig + | identity_provider_update_params.AccessOIDCConfig | identity_provider_update_params.AccessOktaConfig | identity_provider_update_params.AccessOneloginConfig | identity_provider_update_params.AccessPingoneConfig - | identity_provider_update_params.AccessSamlConfig + | identity_provider_update_params.AccessSAMLConfig | object, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessAzureAdScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -2024,10 +1568,13 @@ def update( 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 cast( - ZeroTrustIdentityProviders, + Optional[IdentityProvider], self._put( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", body=maybe_transform( @@ -2044,10 +1591,10 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustIdentityProviders] + Any, ResultWrapper[IdentityProvider] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -2080,12 +1627,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -2093,6 +1634,9 @@ def list( 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._get_api_list( @@ -2118,7 +1662,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IdentityProviderDeleteResponse: + ) -> Optional[IdentityProviderDeleteResponse]: """ Deletes an identity provider from Access. @@ -2139,12 +1683,6 @@ def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -2152,6 +1690,9 @@ def delete( 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._delete( @@ -2161,9 +1702,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IdentityProviderDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[IdentityProviderDeleteResponse], ResultWrapper[IdentityProviderDeleteResponse]), + cast_to=cast(Type[Optional[IdentityProviderDeleteResponse]], ResultWrapper[IdentityProviderDeleteResponse]), ) def get( @@ -2178,7 +1719,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Fetches a configured identity provider. @@ -2199,12 +1740,6 @@ def get( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -2212,10 +1747,13 @@ def get( 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 cast( - ZeroTrustIdentityProviders, + Optional[IdentityProvider], self._get( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", options=make_request_options( @@ -2223,56 +1761,41 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustIdentityProviders] + Any, ResultWrapper[IdentityProvider] ), # Union types cannot be passed in as arguments in the type system ), ) -class AsyncIdentityProviders(AsyncAPIResource): +class AsyncIdentityProvidersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIdentityProvidersWithRawResponse: - return AsyncIdentityProvidersWithRawResponse(self) + def with_raw_response(self) -> AsyncIdentityProvidersResourceWithRawResponse: + return AsyncIdentityProvidersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIdentityProvidersWithStreamingResponse: - return AsyncIdentityProvidersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIdentityProvidersResourceWithStreamingResponse: + return AsyncIdentityProvidersResourceWithStreamingResponse(self) @overload async def create( self, *, - config: identity_provider_create_params.AccessAzureAdConfig, + config: identity_provider_create_params.AzureADConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessAzureAdScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2310,32 +1833,17 @@ async def create( *, config: identity_provider_create_params.AccessCentrifyConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessCentrifyScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2371,34 +1879,19 @@ async def create( async def create( self, *, - config: identity_provider_create_params.AccessFacebookConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessFacebookScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2434,34 +1927,19 @@ async def create( async def create( self, *, - config: identity_provider_create_params.AccessGitHubConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessGitHubScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2499,32 +1977,17 @@ async def create( *, config: identity_provider_create_params.AccessGoogleConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessGoogleScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2562,32 +2025,17 @@ async def create( *, config: identity_provider_create_params.AccessGoogleAppsConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessGoogleAppsScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2623,34 +2071,19 @@ async def create( async def create( self, *, - config: identity_provider_create_params.AccessLinkedinConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessLinkedinScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2686,34 +2119,19 @@ async def create( async def create( self, *, - config: identity_provider_create_params.AccessOidcConfig, + config: identity_provider_create_params.AccessOIDCConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessOidcScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2751,32 +2169,17 @@ async def create( *, config: identity_provider_create_params.AccessOktaConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessOktaScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2814,32 +2217,17 @@ async def create( *, config: identity_provider_create_params.AccessOneloginConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessOneloginScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2877,32 +2265,17 @@ async def create( *, config: identity_provider_create_params.AccessPingoneConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessPingoneScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -2938,34 +2311,19 @@ async def create( async def create( self, *, - config: identity_provider_create_params.AccessSamlConfig, + config: identity_provider_create_params.AccessSAMLConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessSamlScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -3001,34 +2359,19 @@ async def create( async def create( self, *, - config: identity_provider_create_params.AccessYandexConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessYandexScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -3066,32 +2409,17 @@ async def create( *, config: object, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessOnetimepinScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Adds a new identity provider to Access. @@ -3142,50 +2470,29 @@ async def create( async def create( self, *, - config: identity_provider_create_params.AccessAzureAdConfig + config: identity_provider_create_params.AzureADConfig | identity_provider_create_params.AccessCentrifyConfig - | identity_provider_create_params.AccessFacebookConfig + | GenericOAuthConfigParam | identity_provider_create_params.AccessGoogleConfig | identity_provider_create_params.AccessGoogleAppsConfig - | identity_provider_create_params.AccessOidcConfig + | identity_provider_create_params.AccessOIDCConfig | identity_provider_create_params.AccessOktaConfig | identity_provider_create_params.AccessOneloginConfig | identity_provider_create_params.AccessPingoneConfig - | identity_provider_create_params.AccessSamlConfig + | identity_provider_create_params.AccessSAMLConfig | object, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_create_params.AccessAzureAdScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") + ) -> Optional[IdentityProvider]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3193,10 +2500,13 @@ async def create( 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 cast( - ZeroTrustIdentityProviders, + Optional[IdentityProvider], await self._post( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", body=await async_maybe_transform( @@ -3213,10 +2523,10 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustIdentityProviders] + Any, ResultWrapper[IdentityProvider] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -3226,34 +2536,19 @@ async def update( self, uuid: str, *, - config: identity_provider_update_params.AccessAzureAdConfig, + config: identity_provider_update_params.AzureADConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessAzureAdScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3294,32 +2589,17 @@ async def update( *, config: identity_provider_update_params.AccessCentrifyConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessCentrifyScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3358,34 +2638,19 @@ async def update( self, uuid: str, *, - config: identity_provider_update_params.AccessFacebookConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessFacebookScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3424,34 +2689,19 @@ async def update( self, uuid: str, *, - config: identity_provider_update_params.AccessGitHubConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessGitHubScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3492,32 +2742,17 @@ async def update( *, config: identity_provider_update_params.AccessGoogleConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessGoogleScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3558,32 +2793,17 @@ async def update( *, config: identity_provider_update_params.AccessGoogleAppsConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessGoogleAppsScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3622,34 +2842,19 @@ async def update( self, uuid: str, *, - config: identity_provider_update_params.AccessLinkedinConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessLinkedinScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3688,34 +2893,19 @@ async def update( self, uuid: str, *, - config: identity_provider_update_params.AccessOidcConfig, + config: identity_provider_update_params.AccessOIDCConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessOidcScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3756,32 +2946,17 @@ async def update( *, config: identity_provider_update_params.AccessOktaConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessOktaScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3822,32 +2997,17 @@ async def update( *, config: identity_provider_update_params.AccessOneloginConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessOneloginScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3888,32 +3048,17 @@ async def update( *, config: identity_provider_update_params.AccessPingoneConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessPingoneScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -3952,34 +3097,19 @@ async def update( self, uuid: str, *, - config: identity_provider_update_params.AccessSamlConfig, + config: identity_provider_update_params.AccessSAMLConfig, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessSamlScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -4018,34 +3148,19 @@ async def update( self, uuid: str, *, - config: identity_provider_update_params.AccessYandexConfig, + config: GenericOAuthConfigParam, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessYandexScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -4086,32 +3201,17 @@ async def update( *, config: object, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessOnetimepinScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Updates a configured identity provider. @@ -4165,52 +3265,31 @@ async def update( self, uuid: str, *, - config: identity_provider_update_params.AccessAzureAdConfig + config: identity_provider_update_params.AzureADConfig | identity_provider_update_params.AccessCentrifyConfig - | identity_provider_update_params.AccessFacebookConfig + | GenericOAuthConfigParam | identity_provider_update_params.AccessGoogleConfig | identity_provider_update_params.AccessGoogleAppsConfig - | identity_provider_update_params.AccessOidcConfig + | identity_provider_update_params.AccessOIDCConfig | identity_provider_update_params.AccessOktaConfig | identity_provider_update_params.AccessOneloginConfig | identity_provider_update_params.AccessPingoneConfig - | identity_provider_update_params.AccessSamlConfig + | identity_provider_update_params.AccessSAMLConfig | object, name: str, - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ], + type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: identity_provider_update_params.AccessAzureAdScimConfig | NotGiven = NOT_GIVEN, + scim_config: ScimConfigParam | 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, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -4218,10 +3297,13 @@ async def update( 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 cast( - ZeroTrustIdentityProviders, + Optional[IdentityProvider], await self._put( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", body=await async_maybe_transform( @@ -4238,10 +3320,10 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustIdentityProviders] + Any, ResultWrapper[IdentityProvider] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -4274,12 +3356,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -4287,6 +3363,9 @@ def list( 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._get_api_list( @@ -4312,7 +3391,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IdentityProviderDeleteResponse: + ) -> Optional[IdentityProviderDeleteResponse]: """ Deletes an identity provider from Access. @@ -4333,12 +3412,6 @@ async def delete( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -4346,6 +3419,9 @@ async def delete( 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._delete( @@ -4355,9 +3431,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IdentityProviderDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[IdentityProviderDeleteResponse], ResultWrapper[IdentityProviderDeleteResponse]), + cast_to=cast(Type[Optional[IdentityProviderDeleteResponse]], ResultWrapper[IdentityProviderDeleteResponse]), ) async def get( @@ -4372,7 +3448,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustIdentityProviders: + ) -> Optional[IdentityProvider]: """ Fetches a configured identity provider. @@ -4393,12 +3469,6 @@ async def get( """ if not uuid: raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -4406,10 +3476,13 @@ async def get( 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 cast( - ZeroTrustIdentityProviders, + Optional[IdentityProvider], await self._get( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", options=make_request_options( @@ -4417,17 +3490,17 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IdentityProvider]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[ZeroTrustIdentityProviders] + Any, ResultWrapper[IdentityProvider] ), # Union types cannot be passed in as arguments in the type system ), ) -class IdentityProvidersWithRawResponse: - def __init__(self, identity_providers: IdentityProviders) -> None: +class IdentityProvidersResourceWithRawResponse: + def __init__(self, identity_providers: IdentityProvidersResource) -> None: self._identity_providers = identity_providers self.create = to_raw_response_wrapper( @@ -4447,8 +3520,8 @@ def __init__(self, identity_providers: IdentityProviders) -> None: ) -class AsyncIdentityProvidersWithRawResponse: - def __init__(self, identity_providers: AsyncIdentityProviders) -> None: +class AsyncIdentityProvidersResourceWithRawResponse: + def __init__(self, identity_providers: AsyncIdentityProvidersResource) -> None: self._identity_providers = identity_providers self.create = async_to_raw_response_wrapper( @@ -4468,8 +3541,8 @@ def __init__(self, identity_providers: AsyncIdentityProviders) -> None: ) -class IdentityProvidersWithStreamingResponse: - def __init__(self, identity_providers: IdentityProviders) -> None: +class IdentityProvidersResourceWithStreamingResponse: + def __init__(self, identity_providers: IdentityProvidersResource) -> None: self._identity_providers = identity_providers self.create = to_streamed_response_wrapper( @@ -4489,8 +3562,8 @@ def __init__(self, identity_providers: IdentityProviders) -> None: ) -class AsyncIdentityProvidersWithStreamingResponse: - def __init__(self, identity_providers: AsyncIdentityProviders) -> None: +class AsyncIdentityProvidersResourceWithStreamingResponse: + def __init__(self, identity_providers: AsyncIdentityProvidersResource) -> None: self._identity_providers = identity_providers self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/networks/__init__.py b/src/cloudflare/resources/zero_trust/networks/__init__.py index f07fc1e8754..0672f0849f0 100644 --- a/src/cloudflare/resources/zero_trust/networks/__init__.py +++ b/src/cloudflare/resources/zero_trust/networks/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, ) from .networks import ( - Networks, - AsyncNetworks, - NetworksWithRawResponse, - AsyncNetworksWithRawResponse, - NetworksWithStreamingResponse, - AsyncNetworksWithStreamingResponse, + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, ) from .virtual_networks import ( - VirtualNetworks, - AsyncVirtualNetworks, - VirtualNetworksWithRawResponse, - AsyncVirtualNetworksWithRawResponse, - VirtualNetworksWithStreamingResponse, - AsyncVirtualNetworksWithStreamingResponse, + VirtualNetworksResource, + AsyncVirtualNetworksResource, + VirtualNetworksResourceWithRawResponse, + AsyncVirtualNetworksResourceWithRawResponse, + VirtualNetworksResourceWithStreamingResponse, + AsyncVirtualNetworksResourceWithStreamingResponse, ) __all__ = [ - "Routes", - "AsyncRoutes", - "RoutesWithRawResponse", - "AsyncRoutesWithRawResponse", - "RoutesWithStreamingResponse", - "AsyncRoutesWithStreamingResponse", - "VirtualNetworks", - "AsyncVirtualNetworks", - "VirtualNetworksWithRawResponse", - "AsyncVirtualNetworksWithRawResponse", - "VirtualNetworksWithStreamingResponse", - "AsyncVirtualNetworksWithStreamingResponse", - "Networks", - "AsyncNetworks", - "NetworksWithRawResponse", - "AsyncNetworksWithRawResponse", - "NetworksWithStreamingResponse", - "AsyncNetworksWithStreamingResponse", + "RoutesResource", + "AsyncRoutesResource", + "RoutesResourceWithRawResponse", + "AsyncRoutesResourceWithRawResponse", + "RoutesResourceWithStreamingResponse", + "AsyncRoutesResourceWithStreamingResponse", + "VirtualNetworksResource", + "AsyncVirtualNetworksResource", + "VirtualNetworksResourceWithRawResponse", + "AsyncVirtualNetworksResourceWithRawResponse", + "VirtualNetworksResourceWithStreamingResponse", + "AsyncVirtualNetworksResourceWithStreamingResponse", + "NetworksResource", + "AsyncNetworksResource", + "NetworksResourceWithRawResponse", + "AsyncNetworksResourceWithRawResponse", + "NetworksResourceWithStreamingResponse", + "AsyncNetworksResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/networks/networks.py b/src/cloudflare/resources/zero_trust/networks/networks.py index 73a095697d6..0fb746f07a6 100644 --- a/src/cloudflare/resources/zero_trust/networks/networks.py +++ b/src/cloudflare/resources/zero_trust/networks/networks.py @@ -3,111 +3,111 @@ from __future__ import annotations from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -from .routes.routes import Routes, AsyncRoutes +from .routes.routes import RoutesResource, AsyncRoutesResource from .virtual_networks import ( - VirtualNetworks, - AsyncVirtualNetworks, - VirtualNetworksWithRawResponse, - AsyncVirtualNetworksWithRawResponse, - VirtualNetworksWithStreamingResponse, - AsyncVirtualNetworksWithStreamingResponse, + VirtualNetworksResource, + AsyncVirtualNetworksResource, + VirtualNetworksResourceWithRawResponse, + AsyncVirtualNetworksResourceWithRawResponse, + VirtualNetworksResourceWithStreamingResponse, + AsyncVirtualNetworksResourceWithStreamingResponse, ) -__all__ = ["Networks", "AsyncNetworks"] +__all__ = ["NetworksResource", "AsyncNetworksResource"] -class Networks(SyncAPIResource): +class NetworksResource(SyncAPIResource): @cached_property - def routes(self) -> Routes: - return Routes(self._client) + def routes(self) -> RoutesResource: + return RoutesResource(self._client) @cached_property - def virtual_networks(self) -> VirtualNetworks: - return VirtualNetworks(self._client) + def virtual_networks(self) -> VirtualNetworksResource: + return VirtualNetworksResource(self._client) @cached_property - def with_raw_response(self) -> NetworksWithRawResponse: - return NetworksWithRawResponse(self) + def with_raw_response(self) -> NetworksResourceWithRawResponse: + return NetworksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NetworksWithStreamingResponse: - return NetworksWithStreamingResponse(self) + def with_streaming_response(self) -> NetworksResourceWithStreamingResponse: + return NetworksResourceWithStreamingResponse(self) -class AsyncNetworks(AsyncAPIResource): +class AsyncNetworksResource(AsyncAPIResource): @cached_property - def routes(self) -> AsyncRoutes: - return AsyncRoutes(self._client) + def routes(self) -> AsyncRoutesResource: + return AsyncRoutesResource(self._client) @cached_property - def virtual_networks(self) -> AsyncVirtualNetworks: - return AsyncVirtualNetworks(self._client) + def virtual_networks(self) -> AsyncVirtualNetworksResource: + return AsyncVirtualNetworksResource(self._client) @cached_property - def with_raw_response(self) -> AsyncNetworksWithRawResponse: - return AsyncNetworksWithRawResponse(self) + def with_raw_response(self) -> AsyncNetworksResourceWithRawResponse: + return AsyncNetworksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNetworksWithStreamingResponse: - return AsyncNetworksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNetworksResourceWithStreamingResponse: + return AsyncNetworksResourceWithStreamingResponse(self) -class NetworksWithRawResponse: - def __init__(self, networks: Networks) -> None: +class NetworksResourceWithRawResponse: + def __init__(self, networks: NetworksResource) -> None: self._networks = networks @cached_property - def routes(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self._networks.routes) + def routes(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self._networks.routes) @cached_property - def virtual_networks(self) -> VirtualNetworksWithRawResponse: - return VirtualNetworksWithRawResponse(self._networks.virtual_networks) + def virtual_networks(self) -> VirtualNetworksResourceWithRawResponse: + return VirtualNetworksResourceWithRawResponse(self._networks.virtual_networks) -class AsyncNetworksWithRawResponse: - def __init__(self, networks: AsyncNetworks) -> None: +class AsyncNetworksResourceWithRawResponse: + def __init__(self, networks: AsyncNetworksResource) -> None: self._networks = networks @cached_property - def routes(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self._networks.routes) + def routes(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self._networks.routes) @cached_property - def virtual_networks(self) -> AsyncVirtualNetworksWithRawResponse: - return AsyncVirtualNetworksWithRawResponse(self._networks.virtual_networks) + def virtual_networks(self) -> AsyncVirtualNetworksResourceWithRawResponse: + return AsyncVirtualNetworksResourceWithRawResponse(self._networks.virtual_networks) -class NetworksWithStreamingResponse: - def __init__(self, networks: Networks) -> None: +class NetworksResourceWithStreamingResponse: + def __init__(self, networks: NetworksResource) -> None: self._networks = networks @cached_property - def routes(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(self._networks.routes) + def routes(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self._networks.routes) @cached_property - def virtual_networks(self) -> VirtualNetworksWithStreamingResponse: - return VirtualNetworksWithStreamingResponse(self._networks.virtual_networks) + def virtual_networks(self) -> VirtualNetworksResourceWithStreamingResponse: + return VirtualNetworksResourceWithStreamingResponse(self._networks.virtual_networks) -class AsyncNetworksWithStreamingResponse: - def __init__(self, networks: AsyncNetworks) -> None: +class AsyncNetworksResourceWithStreamingResponse: + def __init__(self, networks: AsyncNetworksResource) -> None: self._networks = networks @cached_property - def routes(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(self._networks.routes) + def routes(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self._networks.routes) @cached_property - def virtual_networks(self) -> AsyncVirtualNetworksWithStreamingResponse: - return AsyncVirtualNetworksWithStreamingResponse(self._networks.virtual_networks) + def virtual_networks(self) -> AsyncVirtualNetworksResourceWithStreamingResponse: + return AsyncVirtualNetworksResourceWithStreamingResponse(self._networks.virtual_networks) diff --git a/src/cloudflare/resources/zero_trust/networks/routes/__init__.py b/src/cloudflare/resources/zero_trust/networks/routes/__init__.py index 4f073406ea2..ab04f3fbcac 100644 --- a/src/cloudflare/resources/zero_trust/networks/routes/__init__.py +++ b/src/cloudflare/resources/zero_trust/networks/routes/__init__.py @@ -1,47 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .ips import ( - IPs, - AsyncIPs, - IPsWithRawResponse, - AsyncIPsWithRawResponse, - IPsWithStreamingResponse, - AsyncIPsWithStreamingResponse, + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, ) from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, ) from .networks import ( - Networks, - AsyncNetworks, - NetworksWithRawResponse, - AsyncNetworksWithRawResponse, - NetworksWithStreamingResponse, - AsyncNetworksWithStreamingResponse, + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, ) __all__ = [ - "IPs", - "AsyncIPs", - "IPsWithRawResponse", - "AsyncIPsWithRawResponse", - "IPsWithStreamingResponse", - "AsyncIPsWithStreamingResponse", - "Networks", - "AsyncNetworks", - "NetworksWithRawResponse", - "AsyncNetworksWithRawResponse", - "NetworksWithStreamingResponse", - "AsyncNetworksWithStreamingResponse", - "Routes", - "AsyncRoutes", - "RoutesWithRawResponse", - "AsyncRoutesWithRawResponse", - "RoutesWithStreamingResponse", - "AsyncRoutesWithStreamingResponse", + "IPsResource", + "AsyncIPsResource", + "IPsResourceWithRawResponse", + "AsyncIPsResourceWithRawResponse", + "IPsResourceWithStreamingResponse", + "AsyncIPsResourceWithStreamingResponse", + "NetworksResource", + "AsyncNetworksResource", + "NetworksResourceWithRawResponse", + "AsyncNetworksResourceWithRawResponse", + "NetworksResourceWithStreamingResponse", + "AsyncNetworksResourceWithStreamingResponse", + "RoutesResource", + "AsyncRoutesResource", + "RoutesResourceWithRawResponse", + "AsyncRoutesResourceWithRawResponse", + "RoutesResourceWithStreamingResponse", + "AsyncRoutesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/networks/routes/ips.py b/src/cloudflare/resources/zero_trust/networks/routes/ips.py index 6afdcc378db..a8864c8a8cb 100644 --- a/src/cloudflare/resources/zero_trust/networks/routes/ips.py +++ b/src/cloudflare/resources/zero_trust/networks/routes/ips.py @@ -23,43 +23,41 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.networks import TunnelTeamnet from .....types.zero_trust.networks.routes import ip_get_params +from .....types.zero_trust.networks.teamnet import Teamnet -__all__ = ["IPs", "AsyncIPs"] +__all__ = ["IPsResource", "AsyncIPsResource"] -class IPs(SyncAPIResource): +class IPsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPsWithRawResponse: - return IPsWithRawResponse(self) + def with_raw_response(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPsWithStreamingResponse: - return IPsWithStreamingResponse(self) + def with_streaming_response(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self) def get( self, ip: str, *, account_id: str, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelTeamnet: + ) -> Teamnet: """ Fetches routes that contain the given IP address. Args: account_id: Cloudflare account ID - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -81,43 +79,41 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"virtual_network_id": virtual_network_id}, ip_get_params.IPGetParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Teamnet]._unwrapper, ), - cast_to=cast(Type[TunnelTeamnet], ResultWrapper[TunnelTeamnet]), + cast_to=cast(Type[Teamnet], ResultWrapper[Teamnet]), ) -class AsyncIPs(AsyncAPIResource): +class AsyncIPsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPsWithRawResponse: - return AsyncIPsWithRawResponse(self) + def with_raw_response(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPsWithStreamingResponse: - return AsyncIPsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self) async def get( self, ip: str, *, account_id: str, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelTeamnet: + ) -> Teamnet: """ Fetches routes that contain the given IP address. Args: account_id: Cloudflare account ID - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -141,14 +137,14 @@ async def get( query=await async_maybe_transform( {"virtual_network_id": virtual_network_id}, ip_get_params.IPGetParams ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Teamnet]._unwrapper, ), - cast_to=cast(Type[TunnelTeamnet], ResultWrapper[TunnelTeamnet]), + cast_to=cast(Type[Teamnet], ResultWrapper[Teamnet]), ) -class IPsWithRawResponse: - def __init__(self, ips: IPs) -> None: +class IPsResourceWithRawResponse: + def __init__(self, ips: IPsResource) -> None: self._ips = ips self.get = to_raw_response_wrapper( @@ -156,8 +152,8 @@ def __init__(self, ips: IPs) -> None: ) -class AsyncIPsWithRawResponse: - def __init__(self, ips: AsyncIPs) -> None: +class AsyncIPsResourceWithRawResponse: + def __init__(self, ips: AsyncIPsResource) -> None: self._ips = ips self.get = async_to_raw_response_wrapper( @@ -165,8 +161,8 @@ def __init__(self, ips: AsyncIPs) -> None: ) -class IPsWithStreamingResponse: - def __init__(self, ips: IPs) -> None: +class IPsResourceWithStreamingResponse: + def __init__(self, ips: IPsResource) -> None: self._ips = ips self.get = to_streamed_response_wrapper( @@ -174,8 +170,8 @@ def __init__(self, ips: IPs) -> None: ) -class AsyncIPsWithStreamingResponse: - def __init__(self, ips: AsyncIPs) -> None: +class AsyncIPsResourceWithStreamingResponse: + def __init__(self, ips: AsyncIPsResource) -> None: self._ips = ips self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/networks/routes/networks.py b/src/cloudflare/resources/zero_trust/networks/routes/networks.py index 452d91ff52b..e125b34a288 100644 --- a/src/cloudflare/resources/zero_trust/networks/routes/networks.py +++ b/src/cloudflare/resources/zero_trust/networks/routes/networks.py @@ -24,20 +24,20 @@ from ....._base_client import ( make_request_options, ) -from .....types.zero_trust.networks import TunnelRoute +from .....types.zero_trust.networks.route import Route from .....types.zero_trust.networks.routes import network_create_params, network_delete_params -__all__ = ["Networks", "AsyncNetworks"] +__all__ = ["NetworksResource", "AsyncNetworksResource"] -class Networks(SyncAPIResource): +class NetworksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> NetworksWithRawResponse: - return NetworksWithRawResponse(self) + def with_raw_response(self) -> NetworksResourceWithRawResponse: + return NetworksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NetworksWithStreamingResponse: - return NetworksWithStreamingResponse(self) + def with_streaming_response(self) -> NetworksResourceWithStreamingResponse: + return NetworksResourceWithStreamingResponse(self) def create( self, @@ -45,14 +45,14 @@ def create( *, account_id: str, comment: str | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelRoute: + ) -> Route: """Routes a private network through a Cloudflare Tunnel. The CIDR in @@ -65,9 +65,7 @@ def create( comment: Optional remark describing the route. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -95,9 +93,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) def delete( @@ -106,13 +104,15 @@ def delete( *, account_id: str, tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] | NotGiven = NOT_GIVEN, + tunnel_id: str | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelRoute: + ) -> Route: """Deletes a private network route from an account. The CIDR in @@ -130,6 +130,10 @@ def delete( tun_type: The type of tunnel. + tunnel_id: UUID of the tunnel. + + virtual_network_id: UUID of the virtual network. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -149,10 +153,17 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform({"tun_type": tun_type}, network_delete_params.NetworkDeleteParams), - post_parser=ResultWrapper._unwrapper, + query=maybe_transform( + { + "tun_type": tun_type, + "tunnel_id": tunnel_id, + "virtual_network_id": virtual_network_id, + }, + network_delete_params.NetworkDeleteParams, + ), + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) def edit( @@ -166,7 +177,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelRoute: + ) -> Route: """Updates an existing private network route in an account. The CIDR in @@ -196,20 +207,20 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) -class AsyncNetworks(AsyncAPIResource): +class AsyncNetworksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncNetworksWithRawResponse: - return AsyncNetworksWithRawResponse(self) + def with_raw_response(self) -> AsyncNetworksResourceWithRawResponse: + return AsyncNetworksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNetworksWithStreamingResponse: - return AsyncNetworksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNetworksResourceWithStreamingResponse: + return AsyncNetworksResourceWithStreamingResponse(self) async def create( self, @@ -217,14 +228,14 @@ async def create( *, account_id: str, comment: str | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelRoute: + ) -> Route: """Routes a private network through a Cloudflare Tunnel. The CIDR in @@ -237,9 +248,7 @@ async def create( comment: Optional remark describing the route. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -267,9 +276,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) async def delete( @@ -278,13 +287,15 @@ async def delete( *, account_id: str, tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] | NotGiven = NOT_GIVEN, + tunnel_id: str | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelRoute: + ) -> Route: """Deletes a private network route from an account. The CIDR in @@ -302,6 +313,10 @@ async def delete( tun_type: The type of tunnel. + tunnel_id: UUID of the tunnel. + + virtual_network_id: UUID of the virtual network. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -321,10 +336,17 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform({"tun_type": tun_type}, network_delete_params.NetworkDeleteParams), - post_parser=ResultWrapper._unwrapper, + query=await async_maybe_transform( + { + "tun_type": tun_type, + "tunnel_id": tunnel_id, + "virtual_network_id": virtual_network_id, + }, + network_delete_params.NetworkDeleteParams, + ), + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) async def edit( @@ -338,7 +360,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelRoute: + ) -> Route: """Updates an existing private network route in an account. The CIDR in @@ -368,14 +390,14 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) -class NetworksWithRawResponse: - def __init__(self, networks: Networks) -> None: +class NetworksResourceWithRawResponse: + def __init__(self, networks: NetworksResource) -> None: self._networks = networks self.create = to_raw_response_wrapper( @@ -389,8 +411,8 @@ def __init__(self, networks: Networks) -> None: ) -class AsyncNetworksWithRawResponse: - def __init__(self, networks: AsyncNetworks) -> None: +class AsyncNetworksResourceWithRawResponse: + def __init__(self, networks: AsyncNetworksResource) -> None: self._networks = networks self.create = async_to_raw_response_wrapper( @@ -404,8 +426,8 @@ def __init__(self, networks: AsyncNetworks) -> None: ) -class NetworksWithStreamingResponse: - def __init__(self, networks: Networks) -> None: +class NetworksResourceWithStreamingResponse: + def __init__(self, networks: NetworksResource) -> None: self._networks = networks self.create = to_streamed_response_wrapper( @@ -419,8 +441,8 @@ def __init__(self, networks: Networks) -> None: ) -class AsyncNetworksWithStreamingResponse: - def __init__(self, networks: AsyncNetworks) -> None: +class AsyncNetworksResourceWithStreamingResponse: + def __init__(self, networks: AsyncNetworksResource) -> None: self._networks = networks self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/networks/routes/routes.py b/src/cloudflare/resources/zero_trust/networks/routes/routes.py index 568feaee4c9..9a6cd15ba68 100644 --- a/src/cloudflare/resources/zero_trust/networks/routes/routes.py +++ b/src/cloudflare/resources/zero_trust/networks/routes/routes.py @@ -2,26 +2,26 @@ from __future__ import annotations -from typing import Type, cast -from typing_extensions import Literal +from typing import Type, Union, cast +from datetime import datetime import httpx from .ips import ( - IPs, - AsyncIPs, - IPsWithRawResponse, - AsyncIPsWithRawResponse, - IPsWithStreamingResponse, - AsyncIPsWithStreamingResponse, + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, ) from .networks import ( - Networks, - AsyncNetworks, - NetworksWithRawResponse, - AsyncNetworksWithRawResponse, - NetworksWithStreamingResponse, - AsyncNetworksWithStreamingResponse, + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, ) from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ....._utils import ( @@ -42,61 +42,55 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.networks import ( - TunnelRoute, - TunnelTeamnet, - route_edit_params, - route_list_params, - route_create_params, -) +from .....types.zero_trust.networks import route_edit_params, route_list_params, route_create_params +from .....types.zero_trust.networks.route import Route +from .....types.zero_trust.networks.teamnet import Teamnet -__all__ = ["Routes", "AsyncRoutes"] +__all__ = ["RoutesResource", "AsyncRoutesResource"] -class Routes(SyncAPIResource): +class RoutesResource(SyncAPIResource): @cached_property - def ips(self) -> IPs: - return IPs(self._client) + def ips(self) -> IPsResource: + return IPsResource(self._client) @cached_property - def networks(self) -> Networks: - return Networks(self._client) + def networks(self) -> NetworksResource: + return NetworksResource(self._client) @cached_property - def with_raw_response(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self) + def with_raw_response(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(self) + def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self) def create( self, *, account_id: str, - ip_network: str, + network: str, comment: str | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelRoute: + ) -> Route: """ Routes a private network through a Cloudflare Tunnel. Args: account_id: Cloudflare account ID - ip_network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. + network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. comment: Optional remark describing the route. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -112,7 +106,7 @@ def create( f"/accounts/{account_id}/teamnet/routes", body=maybe_transform( { - "ip_network": ip_network, + "network": network, "comment": comment, "virtual_network_id": virtual_network_id, }, @@ -123,9 +117,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) def list( @@ -133,22 +127,23 @@ def list( *, account_id: str, comment: str | NotGiven = NOT_GIVEN, - existed_at: object | NotGiven = NOT_GIVEN, - is_deleted: object | NotGiven = NOT_GIVEN, - network_subset: object | NotGiven = NOT_GIVEN, - network_superset: object | NotGiven = NOT_GIVEN, + existed_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + is_deleted: bool | NotGiven = NOT_GIVEN, + network_subset: str | NotGiven = NOT_GIVEN, + network_superset: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + route_id: str | NotGiven = NOT_GIVEN, tun_types: str | NotGiven = NOT_GIVEN, - tunnel_id: object | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + tunnel_id: str | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> SyncV4PagePaginationArray[TunnelTeamnet]: + ) -> SyncV4PagePaginationArray[Teamnet]: """ Lists and filters private network routes in an account. @@ -157,8 +152,8 @@ def list( comment: Optional remark describing the route. - existed_at: If provided, include only routes that were created (and not deleted) before this - time. + existed_at: If provided, include only tunnels that were created (and not deleted) before + this time. is_deleted: If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. @@ -171,13 +166,13 @@ def list( per_page: Number of results to display. + route_id: UUID of the route. + tun_types: The types of tunnels to filter separated by a comma. - tunnel_id: UUID of the Cloudflare Tunnel serving the route. + tunnel_id: UUID of the tunnel. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -191,7 +186,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/teamnet/routes", - page=SyncV4PagePaginationArray[TunnelTeamnet], + page=SyncV4PagePaginationArray[Teamnet], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -206,6 +201,7 @@ def list( "network_superset": network_superset, "page": page, "per_page": per_page, + "route_id": route_id, "tun_types": tun_types, "tunnel_id": tunnel_id, "virtual_network_id": virtual_network_id, @@ -213,7 +209,7 @@ def list( route_list_params.RouteListParams, ), ), - model=TunnelTeamnet, + model=Teamnet, ) def delete( @@ -227,7 +223,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelRoute: + ) -> Route: """ Deletes a private network route from an account. @@ -255,9 +251,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) def edit( @@ -267,16 +263,14 @@ def edit( account_id: str, comment: str | NotGiven = NOT_GIVEN, network: str | NotGiven = NOT_GIVEN, - tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] | NotGiven = NOT_GIVEN, - tunnel_id: object | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelRoute: + ) -> Route: """Updates an existing private network route in an account. The fields that are @@ -291,13 +285,7 @@ def edit( network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. - tun_type: The type of tunnel. - - tunnel_id: UUID of the Cloudflare Tunnel serving the route. - - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -317,8 +305,6 @@ def edit( { "comment": comment, "network": network, - "tun_type": tun_type, - "tunnel_id": tunnel_id, "virtual_network_id": virtual_network_id, }, route_edit_params.RouteEditParams, @@ -328,56 +314,54 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) -class AsyncRoutes(AsyncAPIResource): +class AsyncRoutesResource(AsyncAPIResource): @cached_property - def ips(self) -> AsyncIPs: - return AsyncIPs(self._client) + def ips(self) -> AsyncIPsResource: + return AsyncIPsResource(self._client) @cached_property - def networks(self) -> AsyncNetworks: - return AsyncNetworks(self._client) + def networks(self) -> AsyncNetworksResource: + return AsyncNetworksResource(self._client) @cached_property - def with_raw_response(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self) + def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self) async def create( self, *, account_id: str, - ip_network: str, + network: str, comment: str | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelRoute: + ) -> Route: """ Routes a private network through a Cloudflare Tunnel. Args: account_id: Cloudflare account ID - ip_network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. + network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. comment: Optional remark describing the route. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -393,7 +377,7 @@ async def create( f"/accounts/{account_id}/teamnet/routes", body=await async_maybe_transform( { - "ip_network": ip_network, + "network": network, "comment": comment, "virtual_network_id": virtual_network_id, }, @@ -404,9 +388,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) def list( @@ -414,22 +398,23 @@ def list( *, account_id: str, comment: str | NotGiven = NOT_GIVEN, - existed_at: object | NotGiven = NOT_GIVEN, - is_deleted: object | NotGiven = NOT_GIVEN, - network_subset: object | NotGiven = NOT_GIVEN, - network_superset: object | NotGiven = NOT_GIVEN, + existed_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + is_deleted: bool | NotGiven = NOT_GIVEN, + network_subset: str | NotGiven = NOT_GIVEN, + network_superset: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + route_id: str | NotGiven = NOT_GIVEN, tun_types: str | NotGiven = NOT_GIVEN, - tunnel_id: object | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + tunnel_id: str | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> AsyncPaginator[TunnelTeamnet, AsyncV4PagePaginationArray[TunnelTeamnet]]: + ) -> AsyncPaginator[Teamnet, AsyncV4PagePaginationArray[Teamnet]]: """ Lists and filters private network routes in an account. @@ -438,8 +423,8 @@ def list( comment: Optional remark describing the route. - existed_at: If provided, include only routes that were created (and not deleted) before this - time. + existed_at: If provided, include only tunnels that were created (and not deleted) before + this time. is_deleted: If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. @@ -452,13 +437,13 @@ def list( per_page: Number of results to display. + route_id: UUID of the route. + tun_types: The types of tunnels to filter separated by a comma. - tunnel_id: UUID of the Cloudflare Tunnel serving the route. + tunnel_id: UUID of the tunnel. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -472,7 +457,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/teamnet/routes", - page=AsyncV4PagePaginationArray[TunnelTeamnet], + page=AsyncV4PagePaginationArray[Teamnet], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -487,6 +472,7 @@ def list( "network_superset": network_superset, "page": page, "per_page": per_page, + "route_id": route_id, "tun_types": tun_types, "tunnel_id": tunnel_id, "virtual_network_id": virtual_network_id, @@ -494,7 +480,7 @@ def list( route_list_params.RouteListParams, ), ), - model=TunnelTeamnet, + model=Teamnet, ) async def delete( @@ -508,7 +494,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelRoute: + ) -> Route: """ Deletes a private network route from an account. @@ -536,9 +522,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) async def edit( @@ -548,16 +534,14 @@ async def edit( account_id: str, comment: str | NotGiven = NOT_GIVEN, network: str | NotGiven = NOT_GIVEN, - tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] | NotGiven = NOT_GIVEN, - tunnel_id: object | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_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, - ) -> TunnelRoute: + ) -> Route: """Updates an existing private network route in an account. The fields that are @@ -572,13 +556,7 @@ async def edit( network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. - tun_type: The type of tunnel. - - tunnel_id: UUID of the Cloudflare Tunnel serving the route. - - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -598,8 +576,6 @@ async def edit( { "comment": comment, "network": network, - "tun_type": tun_type, - "tunnel_id": tunnel_id, "virtual_network_id": virtual_network_id, }, route_edit_params.RouteEditParams, @@ -609,14 +585,14 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Route]._unwrapper, ), - cast_to=cast(Type[TunnelRoute], ResultWrapper[TunnelRoute]), + cast_to=cast(Type[Route], ResultWrapper[Route]), ) -class RoutesWithRawResponse: - def __init__(self, routes: Routes) -> None: +class RoutesResourceWithRawResponse: + def __init__(self, routes: RoutesResource) -> None: self._routes = routes self.create = to_raw_response_wrapper( @@ -633,16 +609,16 @@ def __init__(self, routes: Routes) -> None: ) @cached_property - def ips(self) -> IPsWithRawResponse: - return IPsWithRawResponse(self._routes.ips) + def ips(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self._routes.ips) @cached_property - def networks(self) -> NetworksWithRawResponse: - return NetworksWithRawResponse(self._routes.networks) + def networks(self) -> NetworksResourceWithRawResponse: + return NetworksResourceWithRawResponse(self._routes.networks) -class AsyncRoutesWithRawResponse: - def __init__(self, routes: AsyncRoutes) -> None: +class AsyncRoutesResourceWithRawResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: self._routes = routes self.create = async_to_raw_response_wrapper( @@ -659,16 +635,16 @@ def __init__(self, routes: AsyncRoutes) -> None: ) @cached_property - def ips(self) -> AsyncIPsWithRawResponse: - return AsyncIPsWithRawResponse(self._routes.ips) + def ips(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self._routes.ips) @cached_property - def networks(self) -> AsyncNetworksWithRawResponse: - return AsyncNetworksWithRawResponse(self._routes.networks) + def networks(self) -> AsyncNetworksResourceWithRawResponse: + return AsyncNetworksResourceWithRawResponse(self._routes.networks) -class RoutesWithStreamingResponse: - def __init__(self, routes: Routes) -> None: +class RoutesResourceWithStreamingResponse: + def __init__(self, routes: RoutesResource) -> None: self._routes = routes self.create = to_streamed_response_wrapper( @@ -685,16 +661,16 @@ def __init__(self, routes: Routes) -> None: ) @cached_property - def ips(self) -> IPsWithStreamingResponse: - return IPsWithStreamingResponse(self._routes.ips) + def ips(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self._routes.ips) @cached_property - def networks(self) -> NetworksWithStreamingResponse: - return NetworksWithStreamingResponse(self._routes.networks) + def networks(self) -> NetworksResourceWithStreamingResponse: + return NetworksResourceWithStreamingResponse(self._routes.networks) -class AsyncRoutesWithStreamingResponse: - def __init__(self, routes: AsyncRoutes) -> None: +class AsyncRoutesResourceWithStreamingResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: self._routes = routes self.create = async_to_streamed_response_wrapper( @@ -711,9 +687,9 @@ def __init__(self, routes: AsyncRoutes) -> None: ) @cached_property - def ips(self) -> AsyncIPsWithStreamingResponse: - return AsyncIPsWithStreamingResponse(self._routes.ips) + def ips(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self._routes.ips) @cached_property - def networks(self) -> AsyncNetworksWithStreamingResponse: - return AsyncNetworksWithStreamingResponse(self._routes.networks) + def networks(self) -> AsyncNetworksResourceWithStreamingResponse: + return AsyncNetworksResourceWithStreamingResponse(self._routes.networks) diff --git a/src/cloudflare/resources/zero_trust/networks/virtual_networks.py b/src/cloudflare/resources/zero_trust/networks/virtual_networks.py index 0144eed7a10..8c7611adaee 100644 --- a/src/cloudflare/resources/zero_trust/networks/virtual_networks.py +++ b/src/cloudflare/resources/zero_trust/networks/virtual_networks.py @@ -26,26 +26,27 @@ make_request_options, ) from ....types.zero_trust.networks import ( - TunnelVirtualNetwork, - VirtualNetworkEditResponse, - VirtualNetworkCreateResponse, - VirtualNetworkDeleteResponse, virtual_network_edit_params, virtual_network_list_params, virtual_network_create_params, + virtual_network_delete_params, ) +from ....types.zero_trust.networks.virtual_network import VirtualNetwork +from ....types.zero_trust.networks.virtual_network_edit_response import VirtualNetworkEditResponse +from ....types.zero_trust.networks.virtual_network_create_response import VirtualNetworkCreateResponse +from ....types.zero_trust.networks.virtual_network_delete_response import VirtualNetworkDeleteResponse -__all__ = ["VirtualNetworks", "AsyncVirtualNetworks"] +__all__ = ["VirtualNetworksResource", "AsyncVirtualNetworksResource"] -class VirtualNetworks(SyncAPIResource): +class VirtualNetworksResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> VirtualNetworksWithRawResponse: - return VirtualNetworksWithRawResponse(self) + def with_raw_response(self) -> VirtualNetworksResourceWithRawResponse: + return VirtualNetworksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VirtualNetworksWithStreamingResponse: - return VirtualNetworksWithStreamingResponse(self) + def with_streaming_response(self) -> VirtualNetworksResourceWithStreamingResponse: + return VirtualNetworksResourceWithStreamingResponse(self) def create( self, @@ -100,7 +101,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VirtualNetworkCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[VirtualNetworkCreateResponse] @@ -112,23 +113,25 @@ def list( self, *, account_id: str, - is_default: object | NotGiven = NOT_GIVEN, - is_deleted: object | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + is_default: bool | NotGiven = NOT_GIVEN, + is_deleted: bool | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - vnet_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, - ) -> SyncSinglePage[TunnelVirtualNetwork]: + ) -> SyncSinglePage[VirtualNetwork]: """ Lists and filters virtual networks in an account. Args: account_id: Cloudflare account ID + id: UUID of the virtual network. + is_default: If `true`, only include the default virtual network. If `false`, exclude the default virtual network. If empty, all virtual networks will be included. @@ -137,8 +140,6 @@ def list( name: A user-friendly name for the virtual network. - vnet_name: A user-friendly name for the virtual network. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -151,7 +152,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/teamnet/virtual_networks", - page=SyncSinglePage[TunnelVirtualNetwork], + page=SyncSinglePage[VirtualNetwork], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -159,15 +160,15 @@ def list( timeout=timeout, query=maybe_transform( { + "id": id, "is_default": is_default, "is_deleted": is_deleted, "name": name, - "vnet_name": vnet_name, }, virtual_network_list_params.VirtualNetworkListParams, ), ), - model=TunnelVirtualNetwork, + model=VirtualNetwork, ) def delete( @@ -175,6 +176,7 @@ def delete( virtual_network_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +208,13 @@ def delete( VirtualNetworkDeleteResponse, self._delete( f"/accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}", + body=maybe_transform(body, virtual_network_delete_params.VirtualNetworkDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VirtualNetworkDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[VirtualNetworkDeleteResponse] @@ -277,7 +280,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VirtualNetworkEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[VirtualNetworkEditResponse] @@ -286,14 +289,14 @@ def edit( ) -class AsyncVirtualNetworks(AsyncAPIResource): +class AsyncVirtualNetworksResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncVirtualNetworksWithRawResponse: - return AsyncVirtualNetworksWithRawResponse(self) + def with_raw_response(self) -> AsyncVirtualNetworksResourceWithRawResponse: + return AsyncVirtualNetworksResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVirtualNetworksWithStreamingResponse: - return AsyncVirtualNetworksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncVirtualNetworksResourceWithStreamingResponse: + return AsyncVirtualNetworksResourceWithStreamingResponse(self) async def create( self, @@ -348,7 +351,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VirtualNetworkCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[VirtualNetworkCreateResponse] @@ -360,23 +363,25 @@ def list( self, *, account_id: str, - is_default: object | NotGiven = NOT_GIVEN, - is_deleted: object | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + is_default: bool | NotGiven = NOT_GIVEN, + is_deleted: bool | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - vnet_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[TunnelVirtualNetwork, AsyncSinglePage[TunnelVirtualNetwork]]: + ) -> AsyncPaginator[VirtualNetwork, AsyncSinglePage[VirtualNetwork]]: """ Lists and filters virtual networks in an account. Args: account_id: Cloudflare account ID + id: UUID of the virtual network. + is_default: If `true`, only include the default virtual network. If `false`, exclude the default virtual network. If empty, all virtual networks will be included. @@ -385,8 +390,6 @@ def list( name: A user-friendly name for the virtual network. - vnet_name: A user-friendly name for the virtual network. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -399,7 +402,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/teamnet/virtual_networks", - page=AsyncSinglePage[TunnelVirtualNetwork], + page=AsyncSinglePage[VirtualNetwork], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -407,15 +410,15 @@ def list( timeout=timeout, query=maybe_transform( { + "id": id, "is_default": is_default, "is_deleted": is_deleted, "name": name, - "vnet_name": vnet_name, }, virtual_network_list_params.VirtualNetworkListParams, ), ), - model=TunnelVirtualNetwork, + model=VirtualNetwork, ) async def delete( @@ -423,6 +426,7 @@ async def delete( virtual_network_id: str, *, account_id: str, + body: object, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,12 +458,13 @@ async def delete( VirtualNetworkDeleteResponse, await self._delete( f"/accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}", + body=await async_maybe_transform(body, virtual_network_delete_params.VirtualNetworkDeleteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VirtualNetworkDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[VirtualNetworkDeleteResponse] @@ -525,7 +530,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[VirtualNetworkEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[VirtualNetworkEditResponse] @@ -534,8 +539,8 @@ async def edit( ) -class VirtualNetworksWithRawResponse: - def __init__(self, virtual_networks: VirtualNetworks) -> None: +class VirtualNetworksResourceWithRawResponse: + def __init__(self, virtual_networks: VirtualNetworksResource) -> None: self._virtual_networks = virtual_networks self.create = to_raw_response_wrapper( @@ -552,8 +557,8 @@ def __init__(self, virtual_networks: VirtualNetworks) -> None: ) -class AsyncVirtualNetworksWithRawResponse: - def __init__(self, virtual_networks: AsyncVirtualNetworks) -> None: +class AsyncVirtualNetworksResourceWithRawResponse: + def __init__(self, virtual_networks: AsyncVirtualNetworksResource) -> None: self._virtual_networks = virtual_networks self.create = async_to_raw_response_wrapper( @@ -570,8 +575,8 @@ def __init__(self, virtual_networks: AsyncVirtualNetworks) -> None: ) -class VirtualNetworksWithStreamingResponse: - def __init__(self, virtual_networks: VirtualNetworks) -> None: +class VirtualNetworksResourceWithStreamingResponse: + def __init__(self, virtual_networks: VirtualNetworksResource) -> None: self._virtual_networks = virtual_networks self.create = to_streamed_response_wrapper( @@ -588,8 +593,8 @@ def __init__(self, virtual_networks: VirtualNetworks) -> None: ) -class AsyncVirtualNetworksWithStreamingResponse: - def __init__(self, virtual_networks: AsyncVirtualNetworks) -> None: +class AsyncVirtualNetworksResourceWithStreamingResponse: + def __init__(self, virtual_networks: AsyncVirtualNetworksResource) -> None: self._virtual_networks = virtual_networks self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/organizations.py b/src/cloudflare/resources/zero_trust/organizations.py index 97ed2e833a3..57abae8cc92 100644 --- a/src/cloudflare/resources/zero_trust/organizations.py +++ b/src/cloudflare/resources/zero_trust/organizations.py @@ -24,24 +24,25 @@ make_request_options, ) from ...types.zero_trust import ( - ZeroTrustOrganizations, - OrganizationRevokeUsersResponse, organization_create_params, organization_update_params, organization_revoke_users_params, ) +from ...types.zero_trust.organization import Organization +from ...types.zero_trust.login_design_param import LoginDesignParam +from ...types.zero_trust.organization_revoke_users_response import OrganizationRevokeUsersResponse -__all__ = ["Organizations", "AsyncOrganizations"] +__all__ = ["OrganizationsResource", "AsyncOrganizationsResource"] -class Organizations(SyncAPIResource): +class OrganizationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OrganizationsWithRawResponse: - return OrganizationsWithRawResponse(self) + def with_raw_response(self) -> OrganizationsResourceWithRawResponse: + return OrganizationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OrganizationsWithStreamingResponse: - return OrganizationsWithStreamingResponse(self) + def with_streaming_response(self) -> OrganizationsResourceWithStreamingResponse: + return OrganizationsResourceWithStreamingResponse(self) def create( self, @@ -53,7 +54,7 @@ def create( allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, is_ui_read_only: bool | NotGiven = NOT_GIVEN, - login_design: organization_create_params.LoginDesign | NotGiven = NOT_GIVEN, + login_design: LoginDesignParam | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, ui_read_only_toggle_reason: str | NotGiven = NOT_GIVEN, user_seat_expiration_inactive_time: str | NotGiven = NOT_GIVEN, @@ -64,7 +65,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustOrganizations: + ) -> Optional[Organization]: """ Sets up a Zero Trust organization for your account or zone. @@ -108,12 +109,6 @@ def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -121,6 +116,9 @@ def create( 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( @@ -145,9 +143,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Organization]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustOrganizations], ResultWrapper[ZeroTrustOrganizations]), + cast_to=cast(Type[Optional[Organization]], ResultWrapper[Organization]), ) def update( @@ -160,7 +158,7 @@ def update( auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, custom_pages: organization_update_params.CustomPages | NotGiven = NOT_GIVEN, is_ui_read_only: bool | NotGiven = NOT_GIVEN, - login_design: organization_update_params.LoginDesign | NotGiven = NOT_GIVEN, + login_design: LoginDesignParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, ui_read_only_toggle_reason: str | NotGiven = NOT_GIVEN, @@ -172,7 +170,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustOrganizations: + ) -> Optional[Organization]: """ Updates the configuration for your Zero Trust organization. @@ -216,12 +214,6 @@ def update( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -229,6 +221,9 @@ def update( 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._put( @@ -254,9 +249,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Organization]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustOrganizations], ResultWrapper[ZeroTrustOrganizations]), + cast_to=cast(Type[Optional[Organization]], ResultWrapper[Organization]), ) def list( @@ -270,7 +265,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustOrganizations: + ) -> Optional[Organization]: """ Returns the configuration for your Zero Trust organization. @@ -287,12 +282,6 @@ def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -300,6 +289,9 @@ def list( 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._get( @@ -309,9 +301,9 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Organization]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustOrganizations], ResultWrapper[ZeroTrustOrganizations]), + cast_to=cast(Type[Optional[Organization]], ResultWrapper[Organization]), ) def revoke_users( @@ -345,12 +337,6 @@ def revoke_users( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -358,6 +344,9 @@ def revoke_users( 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( @@ -368,7 +357,7 @@ def revoke_users( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OrganizationRevokeUsersResponse]]._unwrapper, ), cast_to=cast( Type[Optional[OrganizationRevokeUsersResponse]], ResultWrapper[OrganizationRevokeUsersResponse] @@ -376,14 +365,14 @@ def revoke_users( ) -class AsyncOrganizations(AsyncAPIResource): +class AsyncOrganizationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOrganizationsWithRawResponse: - return AsyncOrganizationsWithRawResponse(self) + def with_raw_response(self) -> AsyncOrganizationsResourceWithRawResponse: + return AsyncOrganizationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOrganizationsWithStreamingResponse: - return AsyncOrganizationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOrganizationsResourceWithStreamingResponse: + return AsyncOrganizationsResourceWithStreamingResponse(self) async def create( self, @@ -395,7 +384,7 @@ async def create( allow_authenticate_via_warp: bool | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, is_ui_read_only: bool | NotGiven = NOT_GIVEN, - login_design: organization_create_params.LoginDesign | NotGiven = NOT_GIVEN, + login_design: LoginDesignParam | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, ui_read_only_toggle_reason: str | NotGiven = NOT_GIVEN, user_seat_expiration_inactive_time: str | NotGiven = NOT_GIVEN, @@ -406,7 +395,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustOrganizations: + ) -> Optional[Organization]: """ Sets up a Zero Trust organization for your account or zone. @@ -450,12 +439,6 @@ async def create( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -463,6 +446,9 @@ async def create( 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( @@ -487,9 +473,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Organization]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustOrganizations], ResultWrapper[ZeroTrustOrganizations]), + cast_to=cast(Type[Optional[Organization]], ResultWrapper[Organization]), ) async def update( @@ -502,7 +488,7 @@ async def update( auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, custom_pages: organization_update_params.CustomPages | NotGiven = NOT_GIVEN, is_ui_read_only: bool | NotGiven = NOT_GIVEN, - login_design: organization_update_params.LoginDesign | NotGiven = NOT_GIVEN, + login_design: LoginDesignParam | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, ui_read_only_toggle_reason: str | NotGiven = NOT_GIVEN, @@ -514,7 +500,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustOrganizations: + ) -> Optional[Organization]: """ Updates the configuration for your Zero Trust organization. @@ -558,12 +544,6 @@ async def update( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -571,6 +551,9 @@ async def update( 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._put( @@ -596,9 +579,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Organization]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustOrganizations], ResultWrapper[ZeroTrustOrganizations]), + cast_to=cast(Type[Optional[Organization]], ResultWrapper[Organization]), ) async def list( @@ -612,7 +595,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZeroTrustOrganizations: + ) -> Optional[Organization]: """ Returns the configuration for your Zero Trust organization. @@ -629,12 +612,6 @@ async def list( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -642,6 +619,9 @@ async def list( 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._get( @@ -651,9 +631,9 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Organization]]._unwrapper, ), - cast_to=cast(Type[ZeroTrustOrganizations], ResultWrapper[ZeroTrustOrganizations]), + cast_to=cast(Type[Optional[Organization]], ResultWrapper[Organization]), ) async def revoke_users( @@ -687,12 +667,6 @@ async def revoke_users( 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 zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - if not account_id and not zone_id: - raise ValueError("You must provide either account_id or zone_id") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -700,6 +674,9 @@ async def revoke_users( 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( @@ -712,7 +689,7 @@ async def revoke_users( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OrganizationRevokeUsersResponse]]._unwrapper, ), cast_to=cast( Type[Optional[OrganizationRevokeUsersResponse]], ResultWrapper[OrganizationRevokeUsersResponse] @@ -720,8 +697,8 @@ async def revoke_users( ) -class OrganizationsWithRawResponse: - def __init__(self, organizations: Organizations) -> None: +class OrganizationsResourceWithRawResponse: + def __init__(self, organizations: OrganizationsResource) -> None: self._organizations = organizations self.create = to_raw_response_wrapper( @@ -738,8 +715,8 @@ def __init__(self, organizations: Organizations) -> None: ) -class AsyncOrganizationsWithRawResponse: - def __init__(self, organizations: AsyncOrganizations) -> None: +class AsyncOrganizationsResourceWithRawResponse: + def __init__(self, organizations: AsyncOrganizationsResource) -> None: self._organizations = organizations self.create = async_to_raw_response_wrapper( @@ -756,8 +733,8 @@ def __init__(self, organizations: AsyncOrganizations) -> None: ) -class OrganizationsWithStreamingResponse: - def __init__(self, organizations: Organizations) -> None: +class OrganizationsResourceWithStreamingResponse: + def __init__(self, organizations: OrganizationsResource) -> None: self._organizations = organizations self.create = to_streamed_response_wrapper( @@ -774,8 +751,8 @@ def __init__(self, organizations: Organizations) -> None: ) -class AsyncOrganizationsWithStreamingResponse: - def __init__(self, organizations: AsyncOrganizations) -> None: +class AsyncOrganizationsResourceWithStreamingResponse: + def __init__(self, organizations: AsyncOrganizationsResource) -> None: self._organizations = organizations self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/risk_scoring/__init__.py b/src/cloudflare/resources/zero_trust/risk_scoring/__init__.py new file mode 100644 index 00000000000..786697e73dd --- /dev/null +++ b/src/cloudflare/resources/zero_trust/risk_scoring/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .summary import ( + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, +) +from .behaviours import ( + BehavioursResource, + AsyncBehavioursResource, + BehavioursResourceWithRawResponse, + AsyncBehavioursResourceWithRawResponse, + BehavioursResourceWithStreamingResponse, + AsyncBehavioursResourceWithStreamingResponse, +) +from .risk_scoring import ( + RiskScoringResource, + AsyncRiskScoringResource, + RiskScoringResourceWithRawResponse, + AsyncRiskScoringResourceWithRawResponse, + RiskScoringResourceWithStreamingResponse, + AsyncRiskScoringResourceWithStreamingResponse, +) + +__all__ = [ + "BehavioursResource", + "AsyncBehavioursResource", + "BehavioursResourceWithRawResponse", + "AsyncBehavioursResourceWithRawResponse", + "BehavioursResourceWithStreamingResponse", + "AsyncBehavioursResourceWithStreamingResponse", + "SummaryResource", + "AsyncSummaryResource", + "SummaryResourceWithRawResponse", + "AsyncSummaryResourceWithRawResponse", + "SummaryResourceWithStreamingResponse", + "AsyncSummaryResourceWithStreamingResponse", + "RiskScoringResource", + "AsyncRiskScoringResource", + "RiskScoringResourceWithRawResponse", + "AsyncRiskScoringResourceWithRawResponse", + "RiskScoringResourceWithStreamingResponse", + "AsyncRiskScoringResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/zero_trust/risk_scoring/behaviours.py b/src/cloudflare/resources/zero_trust/risk_scoring/behaviours.py new file mode 100644 index 00000000000..4e294213fb7 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/risk_scoring/behaviours.py @@ -0,0 +1,258 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Type, cast + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._wrappers import ResultWrapper +from ...._base_client import ( + make_request_options, +) +from ....types.zero_trust.risk_scoring import behaviour_update_params +from ....types.zero_trust.risk_scoring.behaviour_get_response import BehaviourGetResponse +from ....types.zero_trust.risk_scoring.behaviour_update_response import BehaviourUpdateResponse + +__all__ = ["BehavioursResource", "AsyncBehavioursResource"] + + +class BehavioursResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BehavioursResourceWithRawResponse: + return BehavioursResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BehavioursResourceWithStreamingResponse: + return BehavioursResourceWithStreamingResponse(self) + + def update( + self, + account_identifier: str, + *, + behaviors: Dict[str, behaviour_update_params.Behaviors] | 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, + ) -> BehaviourUpdateResponse: + """ + Update configuration for risk behaviors + + Args: + account_identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + return self._put( + f"/accounts/{account_identifier}/zt_risk_scoring/behaviors", + body=maybe_transform({"behaviors": behaviors}, behaviour_update_params.BehaviourUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[BehaviourUpdateResponse]._unwrapper, + ), + cast_to=cast(Type[BehaviourUpdateResponse], ResultWrapper[BehaviourUpdateResponse]), + ) + + def get( + self, + account_identifier: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BehaviourGetResponse: + """ + Get all behaviors and associated configuration + + Args: + account_identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + return self._get( + f"/accounts/{account_identifier}/zt_risk_scoring/behaviors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[BehaviourGetResponse]._unwrapper, + ), + cast_to=cast(Type[BehaviourGetResponse], ResultWrapper[BehaviourGetResponse]), + ) + + +class AsyncBehavioursResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBehavioursResourceWithRawResponse: + return AsyncBehavioursResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBehavioursResourceWithStreamingResponse: + return AsyncBehavioursResourceWithStreamingResponse(self) + + async def update( + self, + account_identifier: str, + *, + behaviors: Dict[str, behaviour_update_params.Behaviors] | 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, + ) -> BehaviourUpdateResponse: + """ + Update configuration for risk behaviors + + Args: + account_identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + return await self._put( + f"/accounts/{account_identifier}/zt_risk_scoring/behaviors", + body=await async_maybe_transform({"behaviors": behaviors}, behaviour_update_params.BehaviourUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[BehaviourUpdateResponse]._unwrapper, + ), + cast_to=cast(Type[BehaviourUpdateResponse], ResultWrapper[BehaviourUpdateResponse]), + ) + + async def get( + self, + account_identifier: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BehaviourGetResponse: + """ + Get all behaviors and associated configuration + + Args: + account_identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + return await self._get( + f"/accounts/{account_identifier}/zt_risk_scoring/behaviors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[BehaviourGetResponse]._unwrapper, + ), + cast_to=cast(Type[BehaviourGetResponse], ResultWrapper[BehaviourGetResponse]), + ) + + +class BehavioursResourceWithRawResponse: + def __init__(self, behaviours: BehavioursResource) -> None: + self._behaviours = behaviours + + self.update = to_raw_response_wrapper( + behaviours.update, + ) + self.get = to_raw_response_wrapper( + behaviours.get, + ) + + +class AsyncBehavioursResourceWithRawResponse: + def __init__(self, behaviours: AsyncBehavioursResource) -> None: + self._behaviours = behaviours + + self.update = async_to_raw_response_wrapper( + behaviours.update, + ) + self.get = async_to_raw_response_wrapper( + behaviours.get, + ) + + +class BehavioursResourceWithStreamingResponse: + def __init__(self, behaviours: BehavioursResource) -> None: + self._behaviours = behaviours + + self.update = to_streamed_response_wrapper( + behaviours.update, + ) + self.get = to_streamed_response_wrapper( + behaviours.get, + ) + + +class AsyncBehavioursResourceWithStreamingResponse: + def __init__(self, behaviours: AsyncBehavioursResource) -> None: + self._behaviours = behaviours + + self.update = async_to_streamed_response_wrapper( + behaviours.update, + ) + self.get = async_to_streamed_response_wrapper( + behaviours.get, + ) diff --git a/src/cloudflare/resources/zero_trust/risk_scoring/risk_scoring.py b/src/cloudflare/resources/zero_trust/risk_scoring/risk_scoring.py new file mode 100644 index 00000000000..fcf0c234dca --- /dev/null +++ b/src/cloudflare/resources/zero_trust/risk_scoring/risk_scoring.py @@ -0,0 +1,375 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, Type, cast +from typing_extensions import Literal + +import httpx + +from .summary import ( + SummaryResource, + AsyncSummaryResource, + SummaryResourceWithRawResponse, + AsyncSummaryResourceWithRawResponse, + SummaryResourceWithStreamingResponse, + AsyncSummaryResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from .behaviours import ( + BehavioursResource, + AsyncBehavioursResource, + BehavioursResourceWithRawResponse, + AsyncBehavioursResourceWithRawResponse, + BehavioursResourceWithStreamingResponse, + AsyncBehavioursResourceWithStreamingResponse, +) +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 import risk_scoring_get_params +from ....types.zero_trust.risk_scoring_get_response import RiskScoringGetResponse +from ....types.zero_trust.risk_scoring_reset_response import RiskScoringResetResponse + +__all__ = ["RiskScoringResource", "AsyncRiskScoringResource"] + + +class RiskScoringResource(SyncAPIResource): + @cached_property + def behaviours(self) -> BehavioursResource: + return BehavioursResource(self._client) + + @cached_property + def summary(self) -> SummaryResource: + return SummaryResource(self._client) + + @cached_property + def with_raw_response(self) -> RiskScoringResourceWithRawResponse: + return RiskScoringResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RiskScoringResourceWithStreamingResponse: + return RiskScoringResourceWithStreamingResponse(self) + + def get( + self, + user_id: str, + *, + account_identifier: str, + direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + order_by: Literal["timestamp", "risk_level"] | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RiskScoringGetResponse: + """ + Get risk event/score information for a specific user + + Args: + account_identifier: Identifier + + user_id: The ID for a user + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + return self._get( + f"/accounts/{account_identifier}/zt_risk_scoring/{user_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "direction": direction, + "order_by": order_by, + "page": page, + "per_page": per_page, + }, + risk_scoring_get_params.RiskScoringGetParams, + ), + post_parser=ResultWrapper[RiskScoringGetResponse]._unwrapper, + ), + cast_to=cast(Type[RiskScoringGetResponse], ResultWrapper[RiskScoringGetResponse]), + ) + + def reset( + self, + user_id: str, + *, + account_identifier: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RiskScoringResetResponse: + """ + Clear the risk score for a particular user + + Args: + account_identifier: Identifier + + user_id: The ID for a user + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + return cast( + RiskScoringResetResponse, + self._post( + f"/accounts/{account_identifier}/zt_risk_scoring/{user_id}/reset", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[RiskScoringResetResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[RiskScoringResetResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class AsyncRiskScoringResource(AsyncAPIResource): + @cached_property + def behaviours(self) -> AsyncBehavioursResource: + return AsyncBehavioursResource(self._client) + + @cached_property + def summary(self) -> AsyncSummaryResource: + return AsyncSummaryResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncRiskScoringResourceWithRawResponse: + return AsyncRiskScoringResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRiskScoringResourceWithStreamingResponse: + return AsyncRiskScoringResourceWithStreamingResponse(self) + + async def get( + self, + user_id: str, + *, + account_identifier: str, + direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + order_by: Literal["timestamp", "risk_level"] | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RiskScoringGetResponse: + """ + Get risk event/score information for a specific user + + Args: + account_identifier: Identifier + + user_id: The ID for a user + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + return await self._get( + f"/accounts/{account_identifier}/zt_risk_scoring/{user_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "direction": direction, + "order_by": order_by, + "page": page, + "per_page": per_page, + }, + risk_scoring_get_params.RiskScoringGetParams, + ), + post_parser=ResultWrapper[RiskScoringGetResponse]._unwrapper, + ), + cast_to=cast(Type[RiskScoringGetResponse], ResultWrapper[RiskScoringGetResponse]), + ) + + async def reset( + self, + user_id: str, + *, + account_identifier: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RiskScoringResetResponse: + """ + Clear the risk score for a particular user + + Args: + account_identifier: Identifier + + user_id: The ID for a user + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + return cast( + RiskScoringResetResponse, + await self._post( + f"/accounts/{account_identifier}/zt_risk_scoring/{user_id}/reset", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[RiskScoringResetResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[RiskScoringResetResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class RiskScoringResourceWithRawResponse: + def __init__(self, risk_scoring: RiskScoringResource) -> None: + self._risk_scoring = risk_scoring + + self.get = to_raw_response_wrapper( + risk_scoring.get, + ) + self.reset = to_raw_response_wrapper( + risk_scoring.reset, + ) + + @cached_property + def behaviours(self) -> BehavioursResourceWithRawResponse: + return BehavioursResourceWithRawResponse(self._risk_scoring.behaviours) + + @cached_property + def summary(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self._risk_scoring.summary) + + +class AsyncRiskScoringResourceWithRawResponse: + def __init__(self, risk_scoring: AsyncRiskScoringResource) -> None: + self._risk_scoring = risk_scoring + + self.get = async_to_raw_response_wrapper( + risk_scoring.get, + ) + self.reset = async_to_raw_response_wrapper( + risk_scoring.reset, + ) + + @cached_property + def behaviours(self) -> AsyncBehavioursResourceWithRawResponse: + return AsyncBehavioursResourceWithRawResponse(self._risk_scoring.behaviours) + + @cached_property + def summary(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self._risk_scoring.summary) + + +class RiskScoringResourceWithStreamingResponse: + def __init__(self, risk_scoring: RiskScoringResource) -> None: + self._risk_scoring = risk_scoring + + self.get = to_streamed_response_wrapper( + risk_scoring.get, + ) + self.reset = to_streamed_response_wrapper( + risk_scoring.reset, + ) + + @cached_property + def behaviours(self) -> BehavioursResourceWithStreamingResponse: + return BehavioursResourceWithStreamingResponse(self._risk_scoring.behaviours) + + @cached_property + def summary(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self._risk_scoring.summary) + + +class AsyncRiskScoringResourceWithStreamingResponse: + def __init__(self, risk_scoring: AsyncRiskScoringResource) -> None: + self._risk_scoring = risk_scoring + + self.get = async_to_streamed_response_wrapper( + risk_scoring.get, + ) + self.reset = async_to_streamed_response_wrapper( + risk_scoring.reset, + ) + + @cached_property + def behaviours(self) -> AsyncBehavioursResourceWithStreamingResponse: + return AsyncBehavioursResourceWithStreamingResponse(self._risk_scoring.behaviours) + + @cached_property + def summary(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self._risk_scoring.summary) diff --git a/src/cloudflare/resources/zero_trust/risk_scoring/summary.py b/src/cloudflare/resources/zero_trust/risk_scoring/summary.py new file mode 100644 index 00000000000..cb117e9adf8 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/risk_scoring/summary.py @@ -0,0 +1,190 @@ +# 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.zero_trust.risk_scoring import summary_get_params +from ....types.zero_trust.risk_scoring.summary_get_response import SummaryGetResponse + +__all__ = ["SummaryResource", "AsyncSummaryResource"] + + +class SummaryResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SummaryResourceWithRawResponse: + return SummaryResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SummaryResourceWithStreamingResponse: + return SummaryResourceWithStreamingResponse(self) + + def get( + self, + account_identifier: str, + *, + direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + order_by: Literal["timestamp", "event_count", "max_risk_level"] | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SummaryGetResponse: + """ + Get risk score info for all users in the account + + Args: + account_identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + return self._get( + f"/accounts/{account_identifier}/zt_risk_scoring/summary", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "direction": direction, + "order_by": order_by, + "page": page, + "per_page": per_page, + }, + summary_get_params.SummaryGetParams, + ), + post_parser=ResultWrapper[SummaryGetResponse]._unwrapper, + ), + cast_to=cast(Type[SummaryGetResponse], ResultWrapper[SummaryGetResponse]), + ) + + +class AsyncSummaryResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSummaryResourceWithRawResponse: + return AsyncSummaryResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSummaryResourceWithStreamingResponse: + return AsyncSummaryResourceWithStreamingResponse(self) + + async def get( + self, + account_identifier: str, + *, + direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + order_by: Literal["timestamp", "event_count", "max_risk_level"] | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SummaryGetResponse: + """ + Get risk score info for all users in the account + + Args: + account_identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + return await self._get( + f"/accounts/{account_identifier}/zt_risk_scoring/summary", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "direction": direction, + "order_by": order_by, + "page": page, + "per_page": per_page, + }, + summary_get_params.SummaryGetParams, + ), + post_parser=ResultWrapper[SummaryGetResponse]._unwrapper, + ), + cast_to=cast(Type[SummaryGetResponse], ResultWrapper[SummaryGetResponse]), + ) + + +class SummaryResourceWithRawResponse: + def __init__(self, summary: SummaryResource) -> None: + self._summary = summary + + self.get = to_raw_response_wrapper( + summary.get, + ) + + +class AsyncSummaryResourceWithRawResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: + self._summary = summary + + self.get = async_to_raw_response_wrapper( + summary.get, + ) + + +class SummaryResourceWithStreamingResponse: + def __init__(self, summary: SummaryResource) -> None: + self._summary = summary + + self.get = to_streamed_response_wrapper( + summary.get, + ) + + +class AsyncSummaryResourceWithStreamingResponse: + def __init__(self, summary: AsyncSummaryResource) -> None: + self._summary = summary + + self.get = async_to_streamed_response_wrapper( + summary.get, + ) diff --git a/src/cloudflare/resources/zero_trust/seats.py b/src/cloudflare/resources/zero_trust/seats.py index e8ddddf791e..c1368cd0512 100644 --- a/src/cloudflare/resources/zero_trust/seats.py +++ b/src/cloudflare/resources/zero_trust/seats.py @@ -23,19 +23,20 @@ from ..._base_client import ( make_request_options, ) -from ...types.zero_trust import SeatEditResponse, seat_edit_params +from ...types.zero_trust import seat_edit_params +from ...types.zero_trust.seat_edit_response import SeatEditResponse -__all__ = ["Seats", "AsyncSeats"] +__all__ = ["SeatsResource", "AsyncSeatsResource"] -class Seats(SyncAPIResource): +class SeatsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SeatsWithRawResponse: - return SeatsWithRawResponse(self) + def with_raw_response(self) -> SeatsResourceWithRawResponse: + return SeatsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SeatsWithStreamingResponse: - return SeatsWithStreamingResponse(self) + def with_streaming_response(self) -> SeatsResourceWithStreamingResponse: + return SeatsResourceWithStreamingResponse(self) def edit( self, @@ -74,20 +75,20 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SeatEditResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SeatEditResponse]], ResultWrapper[SeatEditResponse]), ) -class AsyncSeats(AsyncAPIResource): +class AsyncSeatsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSeatsWithRawResponse: - return AsyncSeatsWithRawResponse(self) + def with_raw_response(self) -> AsyncSeatsResourceWithRawResponse: + return AsyncSeatsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSeatsWithStreamingResponse: - return AsyncSeatsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSeatsResourceWithStreamingResponse: + return AsyncSeatsResourceWithStreamingResponse(self) async def edit( self, @@ -126,14 +127,14 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SeatEditResponse]]._unwrapper, ), cast_to=cast(Type[Optional[SeatEditResponse]], ResultWrapper[SeatEditResponse]), ) -class SeatsWithRawResponse: - def __init__(self, seats: Seats) -> None: +class SeatsResourceWithRawResponse: + def __init__(self, seats: SeatsResource) -> None: self._seats = seats self.edit = to_raw_response_wrapper( @@ -141,8 +142,8 @@ def __init__(self, seats: Seats) -> None: ) -class AsyncSeatsWithRawResponse: - def __init__(self, seats: AsyncSeats) -> None: +class AsyncSeatsResourceWithRawResponse: + def __init__(self, seats: AsyncSeatsResource) -> None: self._seats = seats self.edit = async_to_raw_response_wrapper( @@ -150,8 +151,8 @@ def __init__(self, seats: AsyncSeats) -> None: ) -class SeatsWithStreamingResponse: - def __init__(self, seats: Seats) -> None: +class SeatsResourceWithStreamingResponse: + def __init__(self, seats: SeatsResource) -> None: self._seats = seats self.edit = to_streamed_response_wrapper( @@ -159,8 +160,8 @@ def __init__(self, seats: Seats) -> None: ) -class AsyncSeatsWithStreamingResponse: - def __init__(self, seats: AsyncSeats) -> None: +class AsyncSeatsResourceWithStreamingResponse: + def __init__(self, seats: AsyncSeatsResource) -> None: self._seats = seats self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/tunnels/__init__.py b/src/cloudflare/resources/zero_trust/tunnels/__init__.py index 87951343750..6b6b14ed647 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/__init__.py +++ b/src/cloudflare/resources/zero_trust/tunnels/__init__.py @@ -1,89 +1,89 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .token import ( - Token, - AsyncToken, - TokenWithRawResponse, - AsyncTokenWithRawResponse, - TokenWithStreamingResponse, - AsyncTokenWithStreamingResponse, + TokenResource, + AsyncTokenResource, + TokenResourceWithRawResponse, + AsyncTokenResourceWithRawResponse, + TokenResourceWithStreamingResponse, + AsyncTokenResourceWithStreamingResponse, ) from .tunnels import ( - Tunnels, - AsyncTunnels, - TunnelsWithRawResponse, - AsyncTunnelsWithRawResponse, - TunnelsWithStreamingResponse, - AsyncTunnelsWithStreamingResponse, + TunnelsResource, + AsyncTunnelsResource, + TunnelsResourceWithRawResponse, + AsyncTunnelsResourceWithRawResponse, + TunnelsResourceWithStreamingResponse, + AsyncTunnelsResourceWithStreamingResponse, ) from .connectors import ( - Connectors, - AsyncConnectors, - ConnectorsWithRawResponse, - AsyncConnectorsWithRawResponse, - ConnectorsWithStreamingResponse, - AsyncConnectorsWithStreamingResponse, + ConnectorsResource, + AsyncConnectorsResource, + ConnectorsResourceWithRawResponse, + AsyncConnectorsResourceWithRawResponse, + ConnectorsResourceWithStreamingResponse, + AsyncConnectorsResourceWithStreamingResponse, ) from .management import ( - Management, - AsyncManagement, - ManagementWithRawResponse, - AsyncManagementWithRawResponse, - ManagementWithStreamingResponse, - AsyncManagementWithStreamingResponse, + ManagementResource, + AsyncManagementResource, + ManagementResourceWithRawResponse, + AsyncManagementResourceWithRawResponse, + ManagementResourceWithStreamingResponse, + AsyncManagementResourceWithStreamingResponse, ) from .connections import ( - Connections, - AsyncConnections, - ConnectionsWithRawResponse, - AsyncConnectionsWithRawResponse, - ConnectionsWithStreamingResponse, - AsyncConnectionsWithStreamingResponse, + ConnectionsResource, + AsyncConnectionsResource, + ConnectionsResourceWithRawResponse, + AsyncConnectionsResourceWithRawResponse, + ConnectionsResourceWithStreamingResponse, + AsyncConnectionsResourceWithStreamingResponse, ) from .configurations import ( - Configurations, - AsyncConfigurations, - ConfigurationsWithRawResponse, - AsyncConfigurationsWithRawResponse, - ConfigurationsWithStreamingResponse, - AsyncConfigurationsWithStreamingResponse, + ConfigurationsResource, + AsyncConfigurationsResource, + ConfigurationsResourceWithRawResponse, + AsyncConfigurationsResourceWithRawResponse, + ConfigurationsResourceWithStreamingResponse, + AsyncConfigurationsResourceWithStreamingResponse, ) __all__ = [ - "Configurations", - "AsyncConfigurations", - "ConfigurationsWithRawResponse", - "AsyncConfigurationsWithRawResponse", - "ConfigurationsWithStreamingResponse", - "AsyncConfigurationsWithStreamingResponse", - "Connections", - "AsyncConnections", - "ConnectionsWithRawResponse", - "AsyncConnectionsWithRawResponse", - "ConnectionsWithStreamingResponse", - "AsyncConnectionsWithStreamingResponse", - "Token", - "AsyncToken", - "TokenWithRawResponse", - "AsyncTokenWithRawResponse", - "TokenWithStreamingResponse", - "AsyncTokenWithStreamingResponse", - "Connectors", - "AsyncConnectors", - "ConnectorsWithRawResponse", - "AsyncConnectorsWithRawResponse", - "ConnectorsWithStreamingResponse", - "AsyncConnectorsWithStreamingResponse", - "Management", - "AsyncManagement", - "ManagementWithRawResponse", - "AsyncManagementWithRawResponse", - "ManagementWithStreamingResponse", - "AsyncManagementWithStreamingResponse", - "Tunnels", - "AsyncTunnels", - "TunnelsWithRawResponse", - "AsyncTunnelsWithRawResponse", - "TunnelsWithStreamingResponse", - "AsyncTunnelsWithStreamingResponse", + "ConfigurationsResource", + "AsyncConfigurationsResource", + "ConfigurationsResourceWithRawResponse", + "AsyncConfigurationsResourceWithRawResponse", + "ConfigurationsResourceWithStreamingResponse", + "AsyncConfigurationsResourceWithStreamingResponse", + "ConnectionsResource", + "AsyncConnectionsResource", + "ConnectionsResourceWithRawResponse", + "AsyncConnectionsResourceWithRawResponse", + "ConnectionsResourceWithStreamingResponse", + "AsyncConnectionsResourceWithStreamingResponse", + "TokenResource", + "AsyncTokenResource", + "TokenResourceWithRawResponse", + "AsyncTokenResourceWithRawResponse", + "TokenResourceWithStreamingResponse", + "AsyncTokenResourceWithStreamingResponse", + "ConnectorsResource", + "AsyncConnectorsResource", + "ConnectorsResourceWithRawResponse", + "AsyncConnectorsResourceWithRawResponse", + "ConnectorsResourceWithStreamingResponse", + "AsyncConnectorsResourceWithStreamingResponse", + "ManagementResource", + "AsyncManagementResource", + "ManagementResourceWithRawResponse", + "AsyncManagementResourceWithRawResponse", + "ManagementResourceWithStreamingResponse", + "AsyncManagementResourceWithStreamingResponse", + "TunnelsResource", + "AsyncTunnelsResource", + "TunnelsResourceWithRawResponse", + "AsyncTunnelsResourceWithRawResponse", + "TunnelsResourceWithStreamingResponse", + "AsyncTunnelsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zero_trust/tunnels/configurations.py b/src/cloudflare/resources/zero_trust/tunnels/configurations.py index 95c44333428..c120a5e7be4 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/configurations.py +++ b/src/cloudflare/resources/zero_trust/tunnels/configurations.py @@ -23,23 +23,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.tunnels import ( - ConfigurationGetResponse, - ConfigurationUpdateResponse, - configuration_update_params, -) +from ....types.zero_trust.tunnels import configuration_update_params +from ....types.zero_trust.tunnels.configuration_get_response import ConfigurationGetResponse +from ....types.zero_trust.tunnels.configuration_update_response import ConfigurationUpdateResponse -__all__ = ["Configurations", "AsyncConfigurations"] +__all__ = ["ConfigurationsResource", "AsyncConfigurationsResource"] -class Configurations(SyncAPIResource): +class ConfigurationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConfigurationsWithRawResponse: - return ConfigurationsWithRawResponse(self) + def with_raw_response(self) -> ConfigurationsResourceWithRawResponse: + return ConfigurationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConfigurationsWithStreamingResponse: - return ConfigurationsWithStreamingResponse(self) + def with_streaming_response(self) -> ConfigurationsResourceWithStreamingResponse: + return ConfigurationsResourceWithStreamingResponse(self) def update( self, @@ -58,7 +56,7 @@ def update( Adds or updates the configuration for a remotely-managed tunnel. Args: - account_id: Identifier + account_id: Cloudflare account ID tunnel_id: UUID of the tunnel. @@ -86,7 +84,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConfigurationUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConfigurationUpdateResponse] @@ -110,7 +108,7 @@ def get( Gets the configuration for a remotely-managed tunnel Args: - account_id: Identifier + account_id: Cloudflare account ID tunnel_id: UUID of the tunnel. @@ -135,7 +133,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConfigurationGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConfigurationGetResponse] @@ -144,14 +142,14 @@ def get( ) -class AsyncConfigurations(AsyncAPIResource): +class AsyncConfigurationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConfigurationsWithRawResponse: - return AsyncConfigurationsWithRawResponse(self) + def with_raw_response(self) -> AsyncConfigurationsResourceWithRawResponse: + return AsyncConfigurationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConfigurationsWithStreamingResponse: - return AsyncConfigurationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConfigurationsResourceWithStreamingResponse: + return AsyncConfigurationsResourceWithStreamingResponse(self) async def update( self, @@ -170,7 +168,7 @@ async def update( Adds or updates the configuration for a remotely-managed tunnel. Args: - account_id: Identifier + account_id: Cloudflare account ID tunnel_id: UUID of the tunnel. @@ -200,7 +198,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConfigurationUpdateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConfigurationUpdateResponse] @@ -224,7 +222,7 @@ async def get( Gets the configuration for a remotely-managed tunnel Args: - account_id: Identifier + account_id: Cloudflare account ID tunnel_id: UUID of the tunnel. @@ -249,7 +247,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConfigurationGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConfigurationGetResponse] @@ -258,8 +256,8 @@ async def get( ) -class ConfigurationsWithRawResponse: - def __init__(self, configurations: Configurations) -> None: +class ConfigurationsResourceWithRawResponse: + def __init__(self, configurations: ConfigurationsResource) -> None: self._configurations = configurations self.update = to_raw_response_wrapper( @@ -270,8 +268,8 @@ def __init__(self, configurations: Configurations) -> None: ) -class AsyncConfigurationsWithRawResponse: - def __init__(self, configurations: AsyncConfigurations) -> None: +class AsyncConfigurationsResourceWithRawResponse: + def __init__(self, configurations: AsyncConfigurationsResource) -> None: self._configurations = configurations self.update = async_to_raw_response_wrapper( @@ -282,8 +280,8 @@ def __init__(self, configurations: AsyncConfigurations) -> None: ) -class ConfigurationsWithStreamingResponse: - def __init__(self, configurations: Configurations) -> None: +class ConfigurationsResourceWithStreamingResponse: + def __init__(self, configurations: ConfigurationsResource) -> None: self._configurations = configurations self.update = to_streamed_response_wrapper( @@ -294,8 +292,8 @@ def __init__(self, configurations: Configurations) -> None: ) -class AsyncConfigurationsWithStreamingResponse: - def __init__(self, configurations: AsyncConfigurations) -> None: +class AsyncConfigurationsResourceWithStreamingResponse: + def __init__(self, configurations: AsyncConfigurationsResource) -> None: self._configurations = configurations self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/tunnels/connections.py b/src/cloudflare/resources/zero_trust/tunnels/connections.py index 76114b8aa27..f0b505d8e83 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/connections.py +++ b/src/cloudflare/resources/zero_trust/tunnels/connections.py @@ -23,19 +23,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.tunnels import ConnectionGetResponse, ConnectionDeleteResponse, connection_delete_params +from ....types.zero_trust.tunnels import connection_delete_params +from ....types.zero_trust.tunnels.connection_get_response import ConnectionGetResponse +from ....types.zero_trust.tunnels.connection_delete_response import ConnectionDeleteResponse -__all__ = ["Connections", "AsyncConnections"] +__all__ = ["ConnectionsResource", "AsyncConnectionsResource"] -class Connections(SyncAPIResource): +class ConnectionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConnectionsWithRawResponse: - return ConnectionsWithRawResponse(self) + def with_raw_response(self) -> ConnectionsResourceWithRawResponse: + return ConnectionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConnectionsWithStreamingResponse: - return ConnectionsWithStreamingResponse(self) + def with_streaming_response(self) -> ConnectionsResourceWithStreamingResponse: + return ConnectionsResourceWithStreamingResponse(self) def delete( self, @@ -82,7 +84,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectionDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConnectionDeleteResponse] @@ -129,20 +131,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConnectionGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ConnectionGetResponse]], ResultWrapper[ConnectionGetResponse]), ) -class AsyncConnections(AsyncAPIResource): +class AsyncConnectionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConnectionsWithRawResponse: - return AsyncConnectionsWithRawResponse(self) + def with_raw_response(self) -> AsyncConnectionsResourceWithRawResponse: + return AsyncConnectionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConnectionsWithStreamingResponse: - return AsyncConnectionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConnectionsResourceWithStreamingResponse: + return AsyncConnectionsResourceWithStreamingResponse(self) async def delete( self, @@ -189,7 +191,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ConnectionDeleteResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConnectionDeleteResponse] @@ -236,14 +238,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ConnectionGetResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ConnectionGetResponse]], ResultWrapper[ConnectionGetResponse]), ) -class ConnectionsWithRawResponse: - def __init__(self, connections: Connections) -> None: +class ConnectionsResourceWithRawResponse: + def __init__(self, connections: ConnectionsResource) -> None: self._connections = connections self.delete = to_raw_response_wrapper( @@ -254,8 +256,8 @@ def __init__(self, connections: Connections) -> None: ) -class AsyncConnectionsWithRawResponse: - def __init__(self, connections: AsyncConnections) -> None: +class AsyncConnectionsResourceWithRawResponse: + def __init__(self, connections: AsyncConnectionsResource) -> None: self._connections = connections self.delete = async_to_raw_response_wrapper( @@ -266,8 +268,8 @@ def __init__(self, connections: AsyncConnections) -> None: ) -class ConnectionsWithStreamingResponse: - def __init__(self, connections: Connections) -> None: +class ConnectionsResourceWithStreamingResponse: + def __init__(self, connections: ConnectionsResource) -> None: self._connections = connections self.delete = to_streamed_response_wrapper( @@ -278,8 +280,8 @@ def __init__(self, connections: Connections) -> None: ) -class AsyncConnectionsWithStreamingResponse: - def __init__(self, connections: AsyncConnections) -> None: +class AsyncConnectionsResourceWithStreamingResponse: + def __init__(self, connections: AsyncConnectionsResource) -> None: self._connections = connections self.delete = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/tunnels/connectors.py b/src/cloudflare/resources/zero_trust/tunnels/connectors.py index 39c7c2ff689..808e77b4305 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/connectors.py +++ b/src/cloudflare/resources/zero_trust/tunnels/connectors.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.tunnels import TunnelTunnelClient +from ....types.zero_trust.tunnels.client import Client -__all__ = ["Connectors", "AsyncConnectors"] +__all__ = ["ConnectorsResource", "AsyncConnectorsResource"] -class Connectors(SyncAPIResource): +class ConnectorsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ConnectorsWithRawResponse: - return ConnectorsWithRawResponse(self) + def with_raw_response(self) -> ConnectorsResourceWithRawResponse: + return ConnectorsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ConnectorsWithStreamingResponse: - return ConnectorsWithStreamingResponse(self) + def with_streaming_response(self) -> ConnectorsResourceWithStreamingResponse: + return ConnectorsResourceWithStreamingResponse(self) def get( self, @@ -45,7 +45,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelTunnelClient: + ) -> Client: """ Fetches connector and connection details for a Cloudflare Tunnel. @@ -54,7 +54,7 @@ def get( tunnel_id: UUID of the tunnel. - connector_id: UUID of the Cloudflare Tunnel client. + connector_id: UUID of the Cloudflare Tunnel connector. extra_headers: Send extra headers @@ -77,20 +77,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Client]._unwrapper, ), - cast_to=cast(Type[TunnelTunnelClient], ResultWrapper[TunnelTunnelClient]), + cast_to=cast(Type[Client], ResultWrapper[Client]), ) -class AsyncConnectors(AsyncAPIResource): +class AsyncConnectorsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncConnectorsWithRawResponse: - return AsyncConnectorsWithRawResponse(self) + def with_raw_response(self) -> AsyncConnectorsResourceWithRawResponse: + return AsyncConnectorsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncConnectorsWithStreamingResponse: - return AsyncConnectorsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncConnectorsResourceWithStreamingResponse: + return AsyncConnectorsResourceWithStreamingResponse(self) async def get( self, @@ -104,7 +104,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelTunnelClient: + ) -> Client: """ Fetches connector and connection details for a Cloudflare Tunnel. @@ -113,7 +113,7 @@ async def get( tunnel_id: UUID of the tunnel. - connector_id: UUID of the Cloudflare Tunnel client. + connector_id: UUID of the Cloudflare Tunnel connector. extra_headers: Send extra headers @@ -136,14 +136,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Client]._unwrapper, ), - cast_to=cast(Type[TunnelTunnelClient], ResultWrapper[TunnelTunnelClient]), + cast_to=cast(Type[Client], ResultWrapper[Client]), ) -class ConnectorsWithRawResponse: - def __init__(self, connectors: Connectors) -> None: +class ConnectorsResourceWithRawResponse: + def __init__(self, connectors: ConnectorsResource) -> None: self._connectors = connectors self.get = to_raw_response_wrapper( @@ -151,8 +151,8 @@ def __init__(self, connectors: Connectors) -> None: ) -class AsyncConnectorsWithRawResponse: - def __init__(self, connectors: AsyncConnectors) -> None: +class AsyncConnectorsResourceWithRawResponse: + def __init__(self, connectors: AsyncConnectorsResource) -> None: self._connectors = connectors self.get = async_to_raw_response_wrapper( @@ -160,8 +160,8 @@ def __init__(self, connectors: AsyncConnectors) -> None: ) -class ConnectorsWithStreamingResponse: - def __init__(self, connectors: Connectors) -> None: +class ConnectorsResourceWithStreamingResponse: + def __init__(self, connectors: ConnectorsResource) -> None: self._connectors = connectors self.get = to_streamed_response_wrapper( @@ -169,8 +169,8 @@ def __init__(self, connectors: Connectors) -> None: ) -class AsyncConnectorsWithStreamingResponse: - def __init__(self, connectors: AsyncConnectors) -> None: +class AsyncConnectorsResourceWithStreamingResponse: + def __init__(self, connectors: AsyncConnectorsResource) -> None: self._connectors = connectors self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/tunnels/management.py b/src/cloudflare/resources/zero_trust/tunnels/management.py index 8f26fe03c47..4f25c400020 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/management.py +++ b/src/cloudflare/resources/zero_trust/tunnels/management.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.tunnels import ManagementCreateResponse, management_create_params +from ....types.zero_trust.tunnels import management_create_params +from ....types.zero_trust.tunnels.management_create_response import ManagementCreateResponse -__all__ = ["Management", "AsyncManagement"] +__all__ = ["ManagementResource", "AsyncManagementResource"] -class Management(SyncAPIResource): +class ManagementResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ManagementWithRawResponse: - return ManagementWithRawResponse(self) + def with_raw_response(self) -> ManagementResourceWithRawResponse: + return ManagementResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ManagementWithStreamingResponse: - return ManagementWithStreamingResponse(self) + def with_streaming_response(self) -> ManagementResourceWithStreamingResponse: + return ManagementResourceWithStreamingResponse(self) def create( self, @@ -83,7 +84,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ManagementCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ManagementCreateResponse] @@ -92,14 +93,14 @@ def create( ) -class AsyncManagement(AsyncAPIResource): +class AsyncManagementResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncManagementWithRawResponse: - return AsyncManagementWithRawResponse(self) + def with_raw_response(self) -> AsyncManagementResourceWithRawResponse: + return AsyncManagementResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncManagementWithStreamingResponse: - return AsyncManagementWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncManagementResourceWithStreamingResponse: + return AsyncManagementResourceWithStreamingResponse(self) async def create( self, @@ -148,7 +149,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ManagementCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ManagementCreateResponse] @@ -157,8 +158,8 @@ async def create( ) -class ManagementWithRawResponse: - def __init__(self, management: Management) -> None: +class ManagementResourceWithRawResponse: + def __init__(self, management: ManagementResource) -> None: self._management = management self.create = to_raw_response_wrapper( @@ -166,8 +167,8 @@ def __init__(self, management: Management) -> None: ) -class AsyncManagementWithRawResponse: - def __init__(self, management: AsyncManagement) -> None: +class AsyncManagementResourceWithRawResponse: + def __init__(self, management: AsyncManagementResource) -> None: self._management = management self.create = async_to_raw_response_wrapper( @@ -175,8 +176,8 @@ def __init__(self, management: AsyncManagement) -> None: ) -class ManagementWithStreamingResponse: - def __init__(self, management: Management) -> None: +class ManagementResourceWithStreamingResponse: + def __init__(self, management: ManagementResource) -> None: self._management = management self.create = to_streamed_response_wrapper( @@ -184,8 +185,8 @@ def __init__(self, management: Management) -> None: ) -class AsyncManagementWithStreamingResponse: - def __init__(self, management: AsyncManagement) -> None: +class AsyncManagementResourceWithStreamingResponse: + def __init__(self, management: AsyncManagementResource) -> None: self._management = management self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/tunnels/token.py b/src/cloudflare/resources/zero_trust/tunnels/token.py index 40c23a8f01f..944e0d9b817 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/token.py +++ b/src/cloudflare/resources/zero_trust/tunnels/token.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.zero_trust.tunnels import TokenGetResponse +from ....types.zero_trust.tunnels.token_get_response import TokenGetResponse -__all__ = ["Token", "AsyncToken"] +__all__ = ["TokenResource", "AsyncTokenResource"] -class Token(SyncAPIResource): +class TokenResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TokenWithRawResponse: - return TokenWithRawResponse(self) + def with_raw_response(self) -> TokenResourceWithRawResponse: + return TokenResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TokenWithStreamingResponse: - return TokenWithStreamingResponse(self) + def with_streaming_response(self) -> TokenResourceWithStreamingResponse: + return TokenResourceWithStreamingResponse(self) def get( self, @@ -74,7 +74,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TokenGetResponse] @@ -83,14 +83,14 @@ def get( ) -class AsyncToken(AsyncAPIResource): +class AsyncTokenResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTokenWithRawResponse: - return AsyncTokenWithRawResponse(self) + def with_raw_response(self) -> AsyncTokenResourceWithRawResponse: + return AsyncTokenResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTokenWithStreamingResponse: - return AsyncTokenWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTokenResourceWithStreamingResponse: + return AsyncTokenResourceWithStreamingResponse(self) async def get( self, @@ -133,7 +133,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TokenGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TokenGetResponse] @@ -142,8 +142,8 @@ async def get( ) -class TokenWithRawResponse: - def __init__(self, token: Token) -> None: +class TokenResourceWithRawResponse: + def __init__(self, token: TokenResource) -> None: self._token = token self.get = to_raw_response_wrapper( @@ -151,8 +151,8 @@ def __init__(self, token: Token) -> None: ) -class AsyncTokenWithRawResponse: - def __init__(self, token: AsyncToken) -> None: +class AsyncTokenResourceWithRawResponse: + def __init__(self, token: AsyncTokenResource) -> None: self._token = token self.get = async_to_raw_response_wrapper( @@ -160,8 +160,8 @@ def __init__(self, token: AsyncToken) -> None: ) -class TokenWithStreamingResponse: - def __init__(self, token: Token) -> None: +class TokenResourceWithStreamingResponse: + def __init__(self, token: TokenResource) -> None: self._token = token self.get = to_streamed_response_wrapper( @@ -169,8 +169,8 @@ def __init__(self, token: Token) -> None: ) -class AsyncTokenWithStreamingResponse: - def __init__(self, token: AsyncToken) -> None: +class AsyncTokenResourceWithStreamingResponse: + def __init__(self, token: AsyncTokenResource) -> None: self._token = token self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py index fccb00b7e0f..7513cd0df48 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py +++ b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py @@ -8,12 +8,12 @@ import httpx from .token import ( - Token, - AsyncToken, - TokenWithRawResponse, - AsyncTokenWithRawResponse, - TokenWithStreamingResponse, - AsyncTokenWithStreamingResponse, + TokenResource, + AsyncTokenResource, + TokenResourceWithRawResponse, + AsyncTokenResourceWithRawResponse, + TokenResourceWithStreamingResponse, + AsyncTokenResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( @@ -22,28 +22,28 @@ ) from ...._compat import cached_property from .connectors import ( - Connectors, - AsyncConnectors, - ConnectorsWithRawResponse, - AsyncConnectorsWithRawResponse, - ConnectorsWithStreamingResponse, - AsyncConnectorsWithStreamingResponse, + ConnectorsResource, + AsyncConnectorsResource, + ConnectorsResourceWithRawResponse, + AsyncConnectorsResourceWithRawResponse, + ConnectorsResourceWithStreamingResponse, + AsyncConnectorsResourceWithStreamingResponse, ) from .management import ( - Management, - AsyncManagement, - ManagementWithRawResponse, - AsyncManagementWithRawResponse, - ManagementWithStreamingResponse, - AsyncManagementWithStreamingResponse, + ManagementResource, + AsyncManagementResource, + ManagementResourceWithRawResponse, + AsyncManagementResourceWithRawResponse, + ManagementResourceWithStreamingResponse, + AsyncManagementResourceWithStreamingResponse, ) from .connections import ( - Connections, - AsyncConnections, - ConnectionsWithRawResponse, - AsyncConnectionsWithRawResponse, - ConnectionsWithStreamingResponse, - AsyncConnectionsWithStreamingResponse, + ConnectionsResource, + AsyncConnectionsResource, + ConnectionsResourceWithRawResponse, + AsyncConnectionsResourceWithRawResponse, + ConnectionsResourceWithStreamingResponse, + AsyncConnectionsResourceWithStreamingResponse, ) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -55,82 +55,79 @@ from ...._wrappers import ResultWrapper from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from .configurations import ( - Configurations, - AsyncConfigurations, - ConfigurationsWithRawResponse, - AsyncConfigurationsWithRawResponse, - ConfigurationsWithStreamingResponse, - AsyncConfigurationsWithStreamingResponse, + ConfigurationsResource, + AsyncConfigurationsResource, + ConfigurationsResourceWithRawResponse, + AsyncConfigurationsResourceWithRawResponse, + ConfigurationsResourceWithStreamingResponse, + AsyncConfigurationsResourceWithStreamingResponse, ) from ...._base_client import ( AsyncPaginator, make_request_options, ) -from ....types.zero_trust import ( - TunnelArgoTunnel, - TunnelEditResponse, - TunnelListResponse, - tunnel_edit_params, - tunnel_list_params, - tunnel_create_params, - tunnel_delete_params, -) +from ....types.zero_trust import tunnel_edit_params, tunnel_list_params, tunnel_create_params, tunnel_delete_params +from ....types.zero_trust.tunnel_get_response import TunnelGetResponse +from ....types.zero_trust.tunnel_edit_response import TunnelEditResponse +from ....types.zero_trust.tunnel_list_response import TunnelListResponse +from ....types.zero_trust.tunnel_create_response import TunnelCreateResponse +from ....types.zero_trust.tunnel_delete_response import TunnelDeleteResponse -__all__ = ["Tunnels", "AsyncTunnels"] +__all__ = ["TunnelsResource", "AsyncTunnelsResource"] -class Tunnels(SyncAPIResource): +class TunnelsResource(SyncAPIResource): @cached_property - def configurations(self) -> Configurations: - return Configurations(self._client) + def configurations(self) -> ConfigurationsResource: + return ConfigurationsResource(self._client) @cached_property - def connections(self) -> Connections: - return Connections(self._client) + def connections(self) -> ConnectionsResource: + return ConnectionsResource(self._client) @cached_property - def token(self) -> Token: - return Token(self._client) + def token(self) -> TokenResource: + return TokenResource(self._client) @cached_property - def connectors(self) -> Connectors: - return Connectors(self._client) + def connectors(self) -> ConnectorsResource: + return ConnectorsResource(self._client) @cached_property - def management(self) -> Management: - return Management(self._client) + def management(self) -> ManagementResource: + return ManagementResource(self._client) @cached_property - def with_raw_response(self) -> TunnelsWithRawResponse: - return TunnelsWithRawResponse(self) + def with_raw_response(self) -> TunnelsResourceWithRawResponse: + return TunnelsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TunnelsWithStreamingResponse: - return TunnelsWithStreamingResponse(self) + def with_streaming_response(self) -> TunnelsResourceWithStreamingResponse: + return TunnelsResourceWithStreamingResponse(self) def create( self, *, account_id: str, name: str, - tunnel_secret: object, + tunnel_secret: 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, - ) -> TunnelArgoTunnel: + ) -> TunnelCreateResponse: """ Creates a new Argo Tunnel in an account. Args: account_id: Cloudflare account ID - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. - tunnel_secret: Sets the password required to run the tunnel. Must be at least 32 bytes and - encoded as a base64 string. + tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 + bytes and encoded as a base64 string. extra_headers: Send extra headers @@ -156,9 +153,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TunnelCreateResponse]._unwrapper, ), - cast_to=cast(Type[TunnelArgoTunnel], ResultWrapper[TunnelArgoTunnel]), + cast_to=cast(Type[TunnelCreateResponse], ResultWrapper[TunnelCreateResponse]), ) def list( @@ -173,6 +170,7 @@ def list( page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, tun_types: str | NotGiven = NOT_GIVEN, + uuid: str | NotGiven = NOT_GIVEN, was_active_at: Union[str, datetime] | NotGiven = NOT_GIVEN, was_inactive_at: Union[str, datetime] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -202,6 +200,8 @@ def list( tun_types: The types of tunnels to filter separated by a comma. + uuid: UUID of the tunnel. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -230,6 +230,7 @@ def list( "page": page, "per_page": per_page, "tun_types": tun_types, + "uuid": uuid, "was_active_at": was_active_at, "was_inactive_at": was_inactive_at, }, @@ -251,7 +252,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelArgoTunnel: + ) -> TunnelDeleteResponse: """ Deletes an Argo Tunnel from an account. @@ -280,9 +281,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TunnelDeleteResponse]._unwrapper, ), - cast_to=cast(Type[TunnelArgoTunnel], ResultWrapper[TunnelArgoTunnel]), + cast_to=cast(Type[TunnelDeleteResponse], ResultWrapper[TunnelDeleteResponse]), ) def edit( @@ -307,7 +308,7 @@ def edit( tunnel_id: UUID of the tunnel. - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. @@ -340,7 +341,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TunnelEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TunnelEditResponse] @@ -359,7 +360,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelArgoTunnel: + ) -> TunnelGetResponse: """ Fetches a single Argo Tunnel. @@ -387,64 +388,64 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TunnelGetResponse]._unwrapper, ), - cast_to=cast(Type[TunnelArgoTunnel], ResultWrapper[TunnelArgoTunnel]), + cast_to=cast(Type[TunnelGetResponse], ResultWrapper[TunnelGetResponse]), ) -class AsyncTunnels(AsyncAPIResource): +class AsyncTunnelsResource(AsyncAPIResource): @cached_property - def configurations(self) -> AsyncConfigurations: - return AsyncConfigurations(self._client) + def configurations(self) -> AsyncConfigurationsResource: + return AsyncConfigurationsResource(self._client) @cached_property - def connections(self) -> AsyncConnections: - return AsyncConnections(self._client) + def connections(self) -> AsyncConnectionsResource: + return AsyncConnectionsResource(self._client) @cached_property - def token(self) -> AsyncToken: - return AsyncToken(self._client) + def token(self) -> AsyncTokenResource: + return AsyncTokenResource(self._client) @cached_property - def connectors(self) -> AsyncConnectors: - return AsyncConnectors(self._client) + def connectors(self) -> AsyncConnectorsResource: + return AsyncConnectorsResource(self._client) @cached_property - def management(self) -> AsyncManagement: - return AsyncManagement(self._client) + def management(self) -> AsyncManagementResource: + return AsyncManagementResource(self._client) @cached_property - def with_raw_response(self) -> AsyncTunnelsWithRawResponse: - return AsyncTunnelsWithRawResponse(self) + def with_raw_response(self) -> AsyncTunnelsResourceWithRawResponse: + return AsyncTunnelsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTunnelsWithStreamingResponse: - return AsyncTunnelsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTunnelsResourceWithStreamingResponse: + return AsyncTunnelsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, name: str, - tunnel_secret: object, + tunnel_secret: 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, - ) -> TunnelArgoTunnel: + ) -> TunnelCreateResponse: """ Creates a new Argo Tunnel in an account. Args: account_id: Cloudflare account ID - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. - tunnel_secret: Sets the password required to run the tunnel. Must be at least 32 bytes and - encoded as a base64 string. + tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 + bytes and encoded as a base64 string. extra_headers: Send extra headers @@ -470,9 +471,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TunnelCreateResponse]._unwrapper, ), - cast_to=cast(Type[TunnelArgoTunnel], ResultWrapper[TunnelArgoTunnel]), + cast_to=cast(Type[TunnelCreateResponse], ResultWrapper[TunnelCreateResponse]), ) def list( @@ -487,6 +488,7 @@ def list( page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, tun_types: str | NotGiven = NOT_GIVEN, + uuid: str | NotGiven = NOT_GIVEN, was_active_at: Union[str, datetime] | NotGiven = NOT_GIVEN, was_inactive_at: Union[str, datetime] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -516,6 +518,8 @@ def list( tun_types: The types of tunnels to filter separated by a comma. + uuid: UUID of the tunnel. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -544,6 +548,7 @@ def list( "page": page, "per_page": per_page, "tun_types": tun_types, + "uuid": uuid, "was_active_at": was_active_at, "was_inactive_at": was_inactive_at, }, @@ -565,7 +570,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelArgoTunnel: + ) -> TunnelDeleteResponse: """ Deletes an Argo Tunnel from an account. @@ -594,9 +599,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TunnelDeleteResponse]._unwrapper, ), - cast_to=cast(Type[TunnelArgoTunnel], ResultWrapper[TunnelArgoTunnel]), + cast_to=cast(Type[TunnelDeleteResponse], ResultWrapper[TunnelDeleteResponse]), ) async def edit( @@ -621,7 +626,7 @@ async def edit( tunnel_id: UUID of the tunnel. - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. @@ -654,7 +659,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TunnelEditResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[TunnelEditResponse] @@ -673,7 +678,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TunnelArgoTunnel: + ) -> TunnelGetResponse: """ Fetches a single Argo Tunnel. @@ -701,14 +706,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[TunnelGetResponse]._unwrapper, ), - cast_to=cast(Type[TunnelArgoTunnel], ResultWrapper[TunnelArgoTunnel]), + cast_to=cast(Type[TunnelGetResponse], ResultWrapper[TunnelGetResponse]), ) -class TunnelsWithRawResponse: - def __init__(self, tunnels: Tunnels) -> None: +class TunnelsResourceWithRawResponse: + def __init__(self, tunnels: TunnelsResource) -> None: self._tunnels = tunnels self.create = to_raw_response_wrapper( @@ -728,28 +733,28 @@ def __init__(self, tunnels: Tunnels) -> None: ) @cached_property - def configurations(self) -> ConfigurationsWithRawResponse: - return ConfigurationsWithRawResponse(self._tunnels.configurations) + def configurations(self) -> ConfigurationsResourceWithRawResponse: + return ConfigurationsResourceWithRawResponse(self._tunnels.configurations) @cached_property - def connections(self) -> ConnectionsWithRawResponse: - return ConnectionsWithRawResponse(self._tunnels.connections) + def connections(self) -> ConnectionsResourceWithRawResponse: + return ConnectionsResourceWithRawResponse(self._tunnels.connections) @cached_property - def token(self) -> TokenWithRawResponse: - return TokenWithRawResponse(self._tunnels.token) + def token(self) -> TokenResourceWithRawResponse: + return TokenResourceWithRawResponse(self._tunnels.token) @cached_property - def connectors(self) -> ConnectorsWithRawResponse: - return ConnectorsWithRawResponse(self._tunnels.connectors) + def connectors(self) -> ConnectorsResourceWithRawResponse: + return ConnectorsResourceWithRawResponse(self._tunnels.connectors) @cached_property - def management(self) -> ManagementWithRawResponse: - return ManagementWithRawResponse(self._tunnels.management) + def management(self) -> ManagementResourceWithRawResponse: + return ManagementResourceWithRawResponse(self._tunnels.management) -class AsyncTunnelsWithRawResponse: - def __init__(self, tunnels: AsyncTunnels) -> None: +class AsyncTunnelsResourceWithRawResponse: + def __init__(self, tunnels: AsyncTunnelsResource) -> None: self._tunnels = tunnels self.create = async_to_raw_response_wrapper( @@ -769,28 +774,28 @@ def __init__(self, tunnels: AsyncTunnels) -> None: ) @cached_property - def configurations(self) -> AsyncConfigurationsWithRawResponse: - return AsyncConfigurationsWithRawResponse(self._tunnels.configurations) + def configurations(self) -> AsyncConfigurationsResourceWithRawResponse: + return AsyncConfigurationsResourceWithRawResponse(self._tunnels.configurations) @cached_property - def connections(self) -> AsyncConnectionsWithRawResponse: - return AsyncConnectionsWithRawResponse(self._tunnels.connections) + def connections(self) -> AsyncConnectionsResourceWithRawResponse: + return AsyncConnectionsResourceWithRawResponse(self._tunnels.connections) @cached_property - def token(self) -> AsyncTokenWithRawResponse: - return AsyncTokenWithRawResponse(self._tunnels.token) + def token(self) -> AsyncTokenResourceWithRawResponse: + return AsyncTokenResourceWithRawResponse(self._tunnels.token) @cached_property - def connectors(self) -> AsyncConnectorsWithRawResponse: - return AsyncConnectorsWithRawResponse(self._tunnels.connectors) + def connectors(self) -> AsyncConnectorsResourceWithRawResponse: + return AsyncConnectorsResourceWithRawResponse(self._tunnels.connectors) @cached_property - def management(self) -> AsyncManagementWithRawResponse: - return AsyncManagementWithRawResponse(self._tunnels.management) + def management(self) -> AsyncManagementResourceWithRawResponse: + return AsyncManagementResourceWithRawResponse(self._tunnels.management) -class TunnelsWithStreamingResponse: - def __init__(self, tunnels: Tunnels) -> None: +class TunnelsResourceWithStreamingResponse: + def __init__(self, tunnels: TunnelsResource) -> None: self._tunnels = tunnels self.create = to_streamed_response_wrapper( @@ -810,28 +815,28 @@ def __init__(self, tunnels: Tunnels) -> None: ) @cached_property - def configurations(self) -> ConfigurationsWithStreamingResponse: - return ConfigurationsWithStreamingResponse(self._tunnels.configurations) + def configurations(self) -> ConfigurationsResourceWithStreamingResponse: + return ConfigurationsResourceWithStreamingResponse(self._tunnels.configurations) @cached_property - def connections(self) -> ConnectionsWithStreamingResponse: - return ConnectionsWithStreamingResponse(self._tunnels.connections) + def connections(self) -> ConnectionsResourceWithStreamingResponse: + return ConnectionsResourceWithStreamingResponse(self._tunnels.connections) @cached_property - def token(self) -> TokenWithStreamingResponse: - return TokenWithStreamingResponse(self._tunnels.token) + def token(self) -> TokenResourceWithStreamingResponse: + return TokenResourceWithStreamingResponse(self._tunnels.token) @cached_property - def connectors(self) -> ConnectorsWithStreamingResponse: - return ConnectorsWithStreamingResponse(self._tunnels.connectors) + def connectors(self) -> ConnectorsResourceWithStreamingResponse: + return ConnectorsResourceWithStreamingResponse(self._tunnels.connectors) @cached_property - def management(self) -> ManagementWithStreamingResponse: - return ManagementWithStreamingResponse(self._tunnels.management) + def management(self) -> ManagementResourceWithStreamingResponse: + return ManagementResourceWithStreamingResponse(self._tunnels.management) -class AsyncTunnelsWithStreamingResponse: - def __init__(self, tunnels: AsyncTunnels) -> None: +class AsyncTunnelsResourceWithStreamingResponse: + def __init__(self, tunnels: AsyncTunnelsResource) -> None: self._tunnels = tunnels self.create = async_to_streamed_response_wrapper( @@ -851,21 +856,21 @@ def __init__(self, tunnels: AsyncTunnels) -> None: ) @cached_property - def configurations(self) -> AsyncConfigurationsWithStreamingResponse: - return AsyncConfigurationsWithStreamingResponse(self._tunnels.configurations) + def configurations(self) -> AsyncConfigurationsResourceWithStreamingResponse: + return AsyncConfigurationsResourceWithStreamingResponse(self._tunnels.configurations) @cached_property - def connections(self) -> AsyncConnectionsWithStreamingResponse: - return AsyncConnectionsWithStreamingResponse(self._tunnels.connections) + def connections(self) -> AsyncConnectionsResourceWithStreamingResponse: + return AsyncConnectionsResourceWithStreamingResponse(self._tunnels.connections) @cached_property - def token(self) -> AsyncTokenWithStreamingResponse: - return AsyncTokenWithStreamingResponse(self._tunnels.token) + def token(self) -> AsyncTokenResourceWithStreamingResponse: + return AsyncTokenResourceWithStreamingResponse(self._tunnels.token) @cached_property - def connectors(self) -> AsyncConnectorsWithStreamingResponse: - return AsyncConnectorsWithStreamingResponse(self._tunnels.connectors) + def connectors(self) -> AsyncConnectorsResourceWithStreamingResponse: + return AsyncConnectorsResourceWithStreamingResponse(self._tunnels.connectors) @cached_property - def management(self) -> AsyncManagementWithStreamingResponse: - return AsyncManagementWithStreamingResponse(self._tunnels.management) + def management(self) -> AsyncManagementResourceWithStreamingResponse: + return AsyncManagementResourceWithStreamingResponse(self._tunnels.management) diff --git a/src/cloudflare/resources/zero_trust/zero_trust.py b/src/cloudflare/resources/zero_trust/zero_trust.py index 108c0a02003..63aefc65ac1 100644 --- a/src/cloudflare/resources/zero_trust/zero_trust.py +++ b/src/cloudflare/resources/zero_trust/zero_trust.py @@ -3,405 +3,438 @@ from __future__ import annotations from .dex import ( - DEX, - AsyncDEX, - DEXWithRawResponse, - AsyncDEXWithRawResponse, - DEXWithStreamingResponse, - AsyncDEXWithStreamingResponse, + DEXResource, + AsyncDEXResource, + DEXResourceWithRawResponse, + AsyncDEXResourceWithRawResponse, + DEXResourceWithStreamingResponse, + AsyncDEXResourceWithStreamingResponse, ) from .dlp import ( - DLP, - AsyncDLP, - DLPWithRawResponse, - AsyncDLPWithRawResponse, - DLPWithStreamingResponse, - AsyncDLPWithStreamingResponse, + DLPResource, + AsyncDLPResource, + DLPResourceWithRawResponse, + AsyncDLPResourceWithRawResponse, + DLPResourceWithStreamingResponse, + AsyncDLPResourceWithStreamingResponse, ) from .seats import ( - Seats, - AsyncSeats, - SeatsWithRawResponse, - AsyncSeatsWithRawResponse, - SeatsWithStreamingResponse, - AsyncSeatsWithStreamingResponse, + SeatsResource, + AsyncSeatsResource, + SeatsResourceWithRawResponse, + AsyncSeatsResourceWithRawResponse, + SeatsResourceWithStreamingResponse, + AsyncSeatsResourceWithStreamingResponse, ) from .access import ( - Access, - AsyncAccess, - AccessWithRawResponse, - AsyncAccessWithRawResponse, - AccessWithStreamingResponse, - AsyncAccessWithStreamingResponse, + AccessResource, + AsyncAccessResource, + AccessResourceWithRawResponse, + AsyncAccessResourceWithRawResponse, + AccessResourceWithStreamingResponse, + AsyncAccessResourceWithStreamingResponse, ) from .devices import ( - Devices, - AsyncDevices, - DevicesWithRawResponse, - AsyncDevicesWithRawResponse, - DevicesWithStreamingResponse, - AsyncDevicesWithStreamingResponse, + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, ) -from .dex.dex import DEX, AsyncDEX -from .dlp.dlp import DLP, AsyncDLP +from .dex.dex import DEXResource, AsyncDEXResource +from .dlp.dlp import DLPResource, AsyncDLPResource from .gateway import ( - Gateway, - AsyncGateway, - GatewayWithRawResponse, - AsyncGatewayWithRawResponse, - GatewayWithStreamingResponse, - AsyncGatewayWithStreamingResponse, + GatewayResource, + AsyncGatewayResource, + GatewayResourceWithRawResponse, + AsyncGatewayResourceWithRawResponse, + GatewayResourceWithStreamingResponse, + AsyncGatewayResourceWithStreamingResponse, ) from .tunnels import ( - Tunnels, - AsyncTunnels, - TunnelsWithRawResponse, - AsyncTunnelsWithRawResponse, - TunnelsWithStreamingResponse, - AsyncTunnelsWithStreamingResponse, + TunnelsResource, + AsyncTunnelsResource, + TunnelsResourceWithRawResponse, + AsyncTunnelsResourceWithRawResponse, + TunnelsResourceWithStreamingResponse, + AsyncTunnelsResourceWithStreamingResponse, ) from .networks import ( - Networks, - AsyncNetworks, - NetworksWithRawResponse, - AsyncNetworksWithRawResponse, - NetworksWithStreamingResponse, - AsyncNetworksWithStreamingResponse, + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .access.access import Access, AsyncAccess +from .risk_scoring import ( + RiskScoringResource, + AsyncRiskScoringResource, + RiskScoringResourceWithRawResponse, + AsyncRiskScoringResourceWithRawResponse, + RiskScoringResourceWithStreamingResponse, + AsyncRiskScoringResourceWithStreamingResponse, +) +from .access.access import AccessResource, AsyncAccessResource from .organizations import ( - Organizations, - AsyncOrganizations, - OrganizationsWithRawResponse, - AsyncOrganizationsWithRawResponse, - OrganizationsWithStreamingResponse, - AsyncOrganizationsWithStreamingResponse, + OrganizationsResource, + AsyncOrganizationsResource, + OrganizationsResourceWithRawResponse, + AsyncOrganizationsResourceWithRawResponse, + OrganizationsResourceWithStreamingResponse, + AsyncOrganizationsResourceWithStreamingResponse, ) -from .devices.devices import Devices, AsyncDevices -from .gateway.gateway import Gateway, AsyncGateway -from .tunnels.tunnels import Tunnels, AsyncTunnels -from .networks.networks import Networks, AsyncNetworks +from .devices.devices import DevicesResource, AsyncDevicesResource +from .gateway.gateway import GatewayResource, AsyncGatewayResource +from .tunnels.tunnels import TunnelsResource, AsyncTunnelsResource +from .networks.networks import NetworksResource, AsyncNetworksResource from .identity_providers import ( - IdentityProviders, - AsyncIdentityProviders, - IdentityProvidersWithRawResponse, - AsyncIdentityProvidersWithRawResponse, - IdentityProvidersWithStreamingResponse, - AsyncIdentityProvidersWithStreamingResponse, + IdentityProvidersResource, + AsyncIdentityProvidersResource, + IdentityProvidersResourceWithRawResponse, + AsyncIdentityProvidersResourceWithRawResponse, + IdentityProvidersResourceWithStreamingResponse, + AsyncIdentityProvidersResourceWithStreamingResponse, ) from .connectivity_settings import ( - ConnectivitySettings, - AsyncConnectivitySettings, - ConnectivitySettingsWithRawResponse, - AsyncConnectivitySettingsWithRawResponse, - ConnectivitySettingsWithStreamingResponse, - AsyncConnectivitySettingsWithStreamingResponse, + ConnectivitySettingsResource, + AsyncConnectivitySettingsResource, + ConnectivitySettingsResourceWithRawResponse, + AsyncConnectivitySettingsResourceWithRawResponse, + ConnectivitySettingsResourceWithStreamingResponse, + AsyncConnectivitySettingsResourceWithStreamingResponse, ) +from .risk_scoring.risk_scoring import RiskScoringResource, AsyncRiskScoringResource + +__all__ = ["ZeroTrustResource", "AsyncZeroTrustResource"] -__all__ = ["ZeroTrust", "AsyncZeroTrust"] +class ZeroTrustResource(SyncAPIResource): + @cached_property + def devices(self) -> DevicesResource: + return DevicesResource(self._client) -class ZeroTrust(SyncAPIResource): @cached_property - def devices(self) -> Devices: - return Devices(self._client) + def identity_providers(self) -> IdentityProvidersResource: + return IdentityProvidersResource(self._client) @cached_property - def identity_providers(self) -> IdentityProviders: - return IdentityProviders(self._client) + def organizations(self) -> OrganizationsResource: + return OrganizationsResource(self._client) @cached_property - def organizations(self) -> Organizations: - return Organizations(self._client) + def seats(self) -> SeatsResource: + return SeatsResource(self._client) @cached_property - def seats(self) -> Seats: - return Seats(self._client) + def access(self) -> AccessResource: + return AccessResource(self._client) @cached_property - def access(self) -> Access: - return Access(self._client) + def dex(self) -> DEXResource: + return DEXResource(self._client) @cached_property - def dex(self) -> DEX: - return DEX(self._client) + def tunnels(self) -> TunnelsResource: + return TunnelsResource(self._client) @cached_property - def tunnels(self) -> Tunnels: - return Tunnels(self._client) + def connectivity_settings(self) -> ConnectivitySettingsResource: + return ConnectivitySettingsResource(self._client) @cached_property - def connectivity_settings(self) -> ConnectivitySettings: - return ConnectivitySettings(self._client) + def dlp(self) -> DLPResource: + return DLPResource(self._client) @cached_property - def dlp(self) -> DLP: - return DLP(self._client) + def gateway(self) -> GatewayResource: + return GatewayResource(self._client) @cached_property - def gateway(self) -> Gateway: - return Gateway(self._client) + def networks(self) -> NetworksResource: + return NetworksResource(self._client) @cached_property - def networks(self) -> Networks: - return Networks(self._client) + def risk_scoring(self) -> RiskScoringResource: + return RiskScoringResource(self._client) @cached_property - def with_raw_response(self) -> ZeroTrustWithRawResponse: - return ZeroTrustWithRawResponse(self) + def with_raw_response(self) -> ZeroTrustResourceWithRawResponse: + return ZeroTrustResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ZeroTrustWithStreamingResponse: - return ZeroTrustWithStreamingResponse(self) + def with_streaming_response(self) -> ZeroTrustResourceWithStreamingResponse: + return ZeroTrustResourceWithStreamingResponse(self) -class AsyncZeroTrust(AsyncAPIResource): +class AsyncZeroTrustResource(AsyncAPIResource): @cached_property - def devices(self) -> AsyncDevices: - return AsyncDevices(self._client) + def devices(self) -> AsyncDevicesResource: + return AsyncDevicesResource(self._client) @cached_property - def identity_providers(self) -> AsyncIdentityProviders: - return AsyncIdentityProviders(self._client) + def identity_providers(self) -> AsyncIdentityProvidersResource: + return AsyncIdentityProvidersResource(self._client) @cached_property - def organizations(self) -> AsyncOrganizations: - return AsyncOrganizations(self._client) + def organizations(self) -> AsyncOrganizationsResource: + return AsyncOrganizationsResource(self._client) @cached_property - def seats(self) -> AsyncSeats: - return AsyncSeats(self._client) + def seats(self) -> AsyncSeatsResource: + return AsyncSeatsResource(self._client) @cached_property - def access(self) -> AsyncAccess: - return AsyncAccess(self._client) + def access(self) -> AsyncAccessResource: + return AsyncAccessResource(self._client) @cached_property - def dex(self) -> AsyncDEX: - return AsyncDEX(self._client) + def dex(self) -> AsyncDEXResource: + return AsyncDEXResource(self._client) @cached_property - def tunnels(self) -> AsyncTunnels: - return AsyncTunnels(self._client) + def tunnels(self) -> AsyncTunnelsResource: + return AsyncTunnelsResource(self._client) @cached_property - def connectivity_settings(self) -> AsyncConnectivitySettings: - return AsyncConnectivitySettings(self._client) + def connectivity_settings(self) -> AsyncConnectivitySettingsResource: + return AsyncConnectivitySettingsResource(self._client) @cached_property - def dlp(self) -> AsyncDLP: - return AsyncDLP(self._client) + def dlp(self) -> AsyncDLPResource: + return AsyncDLPResource(self._client) @cached_property - def gateway(self) -> AsyncGateway: - return AsyncGateway(self._client) + def gateway(self) -> AsyncGatewayResource: + return AsyncGatewayResource(self._client) @cached_property - def networks(self) -> AsyncNetworks: - return AsyncNetworks(self._client) + def networks(self) -> AsyncNetworksResource: + return AsyncNetworksResource(self._client) @cached_property - def with_raw_response(self) -> AsyncZeroTrustWithRawResponse: - return AsyncZeroTrustWithRawResponse(self) + def risk_scoring(self) -> AsyncRiskScoringResource: + return AsyncRiskScoringResource(self._client) @cached_property - def with_streaming_response(self) -> AsyncZeroTrustWithStreamingResponse: - return AsyncZeroTrustWithStreamingResponse(self) + def with_raw_response(self) -> AsyncZeroTrustResourceWithRawResponse: + return AsyncZeroTrustResourceWithRawResponse(self) + @cached_property + def with_streaming_response(self) -> AsyncZeroTrustResourceWithStreamingResponse: + return AsyncZeroTrustResourceWithStreamingResponse(self) -class ZeroTrustWithRawResponse: - def __init__(self, zero_trust: ZeroTrust) -> None: + +class ZeroTrustResourceWithRawResponse: + def __init__(self, zero_trust: ZeroTrustResource) -> None: self._zero_trust = zero_trust @cached_property - def devices(self) -> DevicesWithRawResponse: - return DevicesWithRawResponse(self._zero_trust.devices) + def devices(self) -> DevicesResourceWithRawResponse: + return DevicesResourceWithRawResponse(self._zero_trust.devices) + + @cached_property + def identity_providers(self) -> IdentityProvidersResourceWithRawResponse: + return IdentityProvidersResourceWithRawResponse(self._zero_trust.identity_providers) @cached_property - def identity_providers(self) -> IdentityProvidersWithRawResponse: - return IdentityProvidersWithRawResponse(self._zero_trust.identity_providers) + def organizations(self) -> OrganizationsResourceWithRawResponse: + return OrganizationsResourceWithRawResponse(self._zero_trust.organizations) @cached_property - def organizations(self) -> OrganizationsWithRawResponse: - return OrganizationsWithRawResponse(self._zero_trust.organizations) + def seats(self) -> SeatsResourceWithRawResponse: + return SeatsResourceWithRawResponse(self._zero_trust.seats) @cached_property - def seats(self) -> SeatsWithRawResponse: - return SeatsWithRawResponse(self._zero_trust.seats) + def access(self) -> AccessResourceWithRawResponse: + return AccessResourceWithRawResponse(self._zero_trust.access) @cached_property - def access(self) -> AccessWithRawResponse: - return AccessWithRawResponse(self._zero_trust.access) + def dex(self) -> DEXResourceWithRawResponse: + return DEXResourceWithRawResponse(self._zero_trust.dex) @cached_property - def dex(self) -> DEXWithRawResponse: - return DEXWithRawResponse(self._zero_trust.dex) + def tunnels(self) -> TunnelsResourceWithRawResponse: + return TunnelsResourceWithRawResponse(self._zero_trust.tunnels) @cached_property - def tunnels(self) -> TunnelsWithRawResponse: - return TunnelsWithRawResponse(self._zero_trust.tunnels) + def connectivity_settings(self) -> ConnectivitySettingsResourceWithRawResponse: + return ConnectivitySettingsResourceWithRawResponse(self._zero_trust.connectivity_settings) @cached_property - def connectivity_settings(self) -> ConnectivitySettingsWithRawResponse: - return ConnectivitySettingsWithRawResponse(self._zero_trust.connectivity_settings) + def dlp(self) -> DLPResourceWithRawResponse: + return DLPResourceWithRawResponse(self._zero_trust.dlp) @cached_property - def dlp(self) -> DLPWithRawResponse: - return DLPWithRawResponse(self._zero_trust.dlp) + def gateway(self) -> GatewayResourceWithRawResponse: + return GatewayResourceWithRawResponse(self._zero_trust.gateway) @cached_property - def gateway(self) -> GatewayWithRawResponse: - return GatewayWithRawResponse(self._zero_trust.gateway) + def networks(self) -> NetworksResourceWithRawResponse: + return NetworksResourceWithRawResponse(self._zero_trust.networks) @cached_property - def networks(self) -> NetworksWithRawResponse: - return NetworksWithRawResponse(self._zero_trust.networks) + def risk_scoring(self) -> RiskScoringResourceWithRawResponse: + return RiskScoringResourceWithRawResponse(self._zero_trust.risk_scoring) -class AsyncZeroTrustWithRawResponse: - def __init__(self, zero_trust: AsyncZeroTrust) -> None: +class AsyncZeroTrustResourceWithRawResponse: + def __init__(self, zero_trust: AsyncZeroTrustResource) -> None: self._zero_trust = zero_trust @cached_property - def devices(self) -> AsyncDevicesWithRawResponse: - return AsyncDevicesWithRawResponse(self._zero_trust.devices) + def devices(self) -> AsyncDevicesResourceWithRawResponse: + return AsyncDevicesResourceWithRawResponse(self._zero_trust.devices) @cached_property - def identity_providers(self) -> AsyncIdentityProvidersWithRawResponse: - return AsyncIdentityProvidersWithRawResponse(self._zero_trust.identity_providers) + def identity_providers(self) -> AsyncIdentityProvidersResourceWithRawResponse: + return AsyncIdentityProvidersResourceWithRawResponse(self._zero_trust.identity_providers) @cached_property - def organizations(self) -> AsyncOrganizationsWithRawResponse: - return AsyncOrganizationsWithRawResponse(self._zero_trust.organizations) + def organizations(self) -> AsyncOrganizationsResourceWithRawResponse: + return AsyncOrganizationsResourceWithRawResponse(self._zero_trust.organizations) @cached_property - def seats(self) -> AsyncSeatsWithRawResponse: - return AsyncSeatsWithRawResponse(self._zero_trust.seats) + def seats(self) -> AsyncSeatsResourceWithRawResponse: + return AsyncSeatsResourceWithRawResponse(self._zero_trust.seats) @cached_property - def access(self) -> AsyncAccessWithRawResponse: - return AsyncAccessWithRawResponse(self._zero_trust.access) + def access(self) -> AsyncAccessResourceWithRawResponse: + return AsyncAccessResourceWithRawResponse(self._zero_trust.access) @cached_property - def dex(self) -> AsyncDEXWithRawResponse: - return AsyncDEXWithRawResponse(self._zero_trust.dex) + def dex(self) -> AsyncDEXResourceWithRawResponse: + return AsyncDEXResourceWithRawResponse(self._zero_trust.dex) @cached_property - def tunnels(self) -> AsyncTunnelsWithRawResponse: - return AsyncTunnelsWithRawResponse(self._zero_trust.tunnels) + def tunnels(self) -> AsyncTunnelsResourceWithRawResponse: + return AsyncTunnelsResourceWithRawResponse(self._zero_trust.tunnels) @cached_property - def connectivity_settings(self) -> AsyncConnectivitySettingsWithRawResponse: - return AsyncConnectivitySettingsWithRawResponse(self._zero_trust.connectivity_settings) + def connectivity_settings(self) -> AsyncConnectivitySettingsResourceWithRawResponse: + return AsyncConnectivitySettingsResourceWithRawResponse(self._zero_trust.connectivity_settings) @cached_property - def dlp(self) -> AsyncDLPWithRawResponse: - return AsyncDLPWithRawResponse(self._zero_trust.dlp) + def dlp(self) -> AsyncDLPResourceWithRawResponse: + return AsyncDLPResourceWithRawResponse(self._zero_trust.dlp) @cached_property - def gateway(self) -> AsyncGatewayWithRawResponse: - return AsyncGatewayWithRawResponse(self._zero_trust.gateway) + def gateway(self) -> AsyncGatewayResourceWithRawResponse: + return AsyncGatewayResourceWithRawResponse(self._zero_trust.gateway) @cached_property - def networks(self) -> AsyncNetworksWithRawResponse: - return AsyncNetworksWithRawResponse(self._zero_trust.networks) + def networks(self) -> AsyncNetworksResourceWithRawResponse: + return AsyncNetworksResourceWithRawResponse(self._zero_trust.networks) + + @cached_property + def risk_scoring(self) -> AsyncRiskScoringResourceWithRawResponse: + return AsyncRiskScoringResourceWithRawResponse(self._zero_trust.risk_scoring) -class ZeroTrustWithStreamingResponse: - def __init__(self, zero_trust: ZeroTrust) -> None: +class ZeroTrustResourceWithStreamingResponse: + def __init__(self, zero_trust: ZeroTrustResource) -> None: self._zero_trust = zero_trust @cached_property - def devices(self) -> DevicesWithStreamingResponse: - return DevicesWithStreamingResponse(self._zero_trust.devices) + def devices(self) -> DevicesResourceWithStreamingResponse: + return DevicesResourceWithStreamingResponse(self._zero_trust.devices) + + @cached_property + def identity_providers(self) -> IdentityProvidersResourceWithStreamingResponse: + return IdentityProvidersResourceWithStreamingResponse(self._zero_trust.identity_providers) @cached_property - def identity_providers(self) -> IdentityProvidersWithStreamingResponse: - return IdentityProvidersWithStreamingResponse(self._zero_trust.identity_providers) + def organizations(self) -> OrganizationsResourceWithStreamingResponse: + return OrganizationsResourceWithStreamingResponse(self._zero_trust.organizations) @cached_property - def organizations(self) -> OrganizationsWithStreamingResponse: - return OrganizationsWithStreamingResponse(self._zero_trust.organizations) + def seats(self) -> SeatsResourceWithStreamingResponse: + return SeatsResourceWithStreamingResponse(self._zero_trust.seats) @cached_property - def seats(self) -> SeatsWithStreamingResponse: - return SeatsWithStreamingResponse(self._zero_trust.seats) + def access(self) -> AccessResourceWithStreamingResponse: + return AccessResourceWithStreamingResponse(self._zero_trust.access) @cached_property - def access(self) -> AccessWithStreamingResponse: - return AccessWithStreamingResponse(self._zero_trust.access) + def dex(self) -> DEXResourceWithStreamingResponse: + return DEXResourceWithStreamingResponse(self._zero_trust.dex) @cached_property - def dex(self) -> DEXWithStreamingResponse: - return DEXWithStreamingResponse(self._zero_trust.dex) + def tunnels(self) -> TunnelsResourceWithStreamingResponse: + return TunnelsResourceWithStreamingResponse(self._zero_trust.tunnels) @cached_property - def tunnels(self) -> TunnelsWithStreamingResponse: - return TunnelsWithStreamingResponse(self._zero_trust.tunnels) + def connectivity_settings(self) -> ConnectivitySettingsResourceWithStreamingResponse: + return ConnectivitySettingsResourceWithStreamingResponse(self._zero_trust.connectivity_settings) @cached_property - def connectivity_settings(self) -> ConnectivitySettingsWithStreamingResponse: - return ConnectivitySettingsWithStreamingResponse(self._zero_trust.connectivity_settings) + def dlp(self) -> DLPResourceWithStreamingResponse: + return DLPResourceWithStreamingResponse(self._zero_trust.dlp) @cached_property - def dlp(self) -> DLPWithStreamingResponse: - return DLPWithStreamingResponse(self._zero_trust.dlp) + def gateway(self) -> GatewayResourceWithStreamingResponse: + return GatewayResourceWithStreamingResponse(self._zero_trust.gateway) @cached_property - def gateway(self) -> GatewayWithStreamingResponse: - return GatewayWithStreamingResponse(self._zero_trust.gateway) + def networks(self) -> NetworksResourceWithStreamingResponse: + return NetworksResourceWithStreamingResponse(self._zero_trust.networks) @cached_property - def networks(self) -> NetworksWithStreamingResponse: - return NetworksWithStreamingResponse(self._zero_trust.networks) + def risk_scoring(self) -> RiskScoringResourceWithStreamingResponse: + return RiskScoringResourceWithStreamingResponse(self._zero_trust.risk_scoring) -class AsyncZeroTrustWithStreamingResponse: - def __init__(self, zero_trust: AsyncZeroTrust) -> None: +class AsyncZeroTrustResourceWithStreamingResponse: + def __init__(self, zero_trust: AsyncZeroTrustResource) -> None: self._zero_trust = zero_trust @cached_property - def devices(self) -> AsyncDevicesWithStreamingResponse: - return AsyncDevicesWithStreamingResponse(self._zero_trust.devices) + def devices(self) -> AsyncDevicesResourceWithStreamingResponse: + return AsyncDevicesResourceWithStreamingResponse(self._zero_trust.devices) + + @cached_property + def identity_providers(self) -> AsyncIdentityProvidersResourceWithStreamingResponse: + return AsyncIdentityProvidersResourceWithStreamingResponse(self._zero_trust.identity_providers) @cached_property - def identity_providers(self) -> AsyncIdentityProvidersWithStreamingResponse: - return AsyncIdentityProvidersWithStreamingResponse(self._zero_trust.identity_providers) + def organizations(self) -> AsyncOrganizationsResourceWithStreamingResponse: + return AsyncOrganizationsResourceWithStreamingResponse(self._zero_trust.organizations) @cached_property - def organizations(self) -> AsyncOrganizationsWithStreamingResponse: - return AsyncOrganizationsWithStreamingResponse(self._zero_trust.organizations) + def seats(self) -> AsyncSeatsResourceWithStreamingResponse: + return AsyncSeatsResourceWithStreamingResponse(self._zero_trust.seats) @cached_property - def seats(self) -> AsyncSeatsWithStreamingResponse: - return AsyncSeatsWithStreamingResponse(self._zero_trust.seats) + def access(self) -> AsyncAccessResourceWithStreamingResponse: + return AsyncAccessResourceWithStreamingResponse(self._zero_trust.access) @cached_property - def access(self) -> AsyncAccessWithStreamingResponse: - return AsyncAccessWithStreamingResponse(self._zero_trust.access) + def dex(self) -> AsyncDEXResourceWithStreamingResponse: + return AsyncDEXResourceWithStreamingResponse(self._zero_trust.dex) @cached_property - def dex(self) -> AsyncDEXWithStreamingResponse: - return AsyncDEXWithStreamingResponse(self._zero_trust.dex) + def tunnels(self) -> AsyncTunnelsResourceWithStreamingResponse: + return AsyncTunnelsResourceWithStreamingResponse(self._zero_trust.tunnels) @cached_property - def tunnels(self) -> AsyncTunnelsWithStreamingResponse: - return AsyncTunnelsWithStreamingResponse(self._zero_trust.tunnels) + def connectivity_settings(self) -> AsyncConnectivitySettingsResourceWithStreamingResponse: + return AsyncConnectivitySettingsResourceWithStreamingResponse(self._zero_trust.connectivity_settings) @cached_property - def connectivity_settings(self) -> AsyncConnectivitySettingsWithStreamingResponse: - return AsyncConnectivitySettingsWithStreamingResponse(self._zero_trust.connectivity_settings) + def dlp(self) -> AsyncDLPResourceWithStreamingResponse: + return AsyncDLPResourceWithStreamingResponse(self._zero_trust.dlp) @cached_property - def dlp(self) -> AsyncDLPWithStreamingResponse: - return AsyncDLPWithStreamingResponse(self._zero_trust.dlp) + def gateway(self) -> AsyncGatewayResourceWithStreamingResponse: + return AsyncGatewayResourceWithStreamingResponse(self._zero_trust.gateway) @cached_property - def gateway(self) -> AsyncGatewayWithStreamingResponse: - return AsyncGatewayWithStreamingResponse(self._zero_trust.gateway) + def networks(self) -> AsyncNetworksResourceWithStreamingResponse: + return AsyncNetworksResourceWithStreamingResponse(self._zero_trust.networks) @cached_property - def networks(self) -> AsyncNetworksWithStreamingResponse: - return AsyncNetworksWithStreamingResponse(self._zero_trust.networks) + def risk_scoring(self) -> AsyncRiskScoringResourceWithStreamingResponse: + return AsyncRiskScoringResourceWithStreamingResponse(self._zero_trust.risk_scoring) diff --git a/src/cloudflare/resources/zones/__init__.py b/src/cloudflare/resources/zones/__init__.py index f5c9439914a..fe02e52f39d 100644 --- a/src/cloudflare/resources/zones/__init__.py +++ b/src/cloudflare/resources/zones/__init__.py @@ -1,117 +1,103 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .holds import ( - Holds, - AsyncHolds, - HoldsWithRawResponse, - AsyncHoldsWithRawResponse, - HoldsWithStreamingResponse, - AsyncHoldsWithStreamingResponse, + HoldsResource, + AsyncHoldsResource, + HoldsResourceWithRawResponse, + AsyncHoldsResourceWithRawResponse, + HoldsResourceWithStreamingResponse, + AsyncHoldsResourceWithStreamingResponse, ) from .zones import ( - Zones, - AsyncZones, - ZonesWithRawResponse, - AsyncZonesWithRawResponse, - ZonesWithStreamingResponse, - AsyncZonesWithStreamingResponse, -) -from .workers import ( - Workers, - AsyncWorkers, - WorkersWithRawResponse, - AsyncWorkersWithRawResponse, - WorkersWithStreamingResponse, - AsyncWorkersWithStreamingResponse, + ZonesResource, + AsyncZonesResource, + ZonesResourceWithRawResponse, + AsyncZonesResourceWithRawResponse, + ZonesResourceWithStreamingResponse, + AsyncZonesResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .dns_settings import ( - DNSSettings, - AsyncDNSSettings, - DNSSettingsWithRawResponse, - AsyncDNSSettingsWithRawResponse, - DNSSettingsWithStreamingResponse, - AsyncDNSSettingsWithStreamingResponse, + DNSSettingsResource, + AsyncDNSSettingsResource, + DNSSettingsResourceWithRawResponse, + AsyncDNSSettingsResourceWithRawResponse, + DNSSettingsResourceWithStreamingResponse, + AsyncDNSSettingsResourceWithStreamingResponse, ) from .subscriptions import ( - Subscriptions, - AsyncSubscriptions, - SubscriptionsWithRawResponse, - AsyncSubscriptionsWithRawResponse, - SubscriptionsWithStreamingResponse, - AsyncSubscriptionsWithStreamingResponse, + SubscriptionsResource, + AsyncSubscriptionsResource, + SubscriptionsResourceWithRawResponse, + AsyncSubscriptionsResourceWithRawResponse, + SubscriptionsResourceWithStreamingResponse, + AsyncSubscriptionsResourceWithStreamingResponse, ) from .activation_check import ( - ActivationCheck, - AsyncActivationCheck, - ActivationCheckWithRawResponse, - AsyncActivationCheckWithRawResponse, - ActivationCheckWithStreamingResponse, - AsyncActivationCheckWithStreamingResponse, + ActivationCheckResource, + AsyncActivationCheckResource, + ActivationCheckResourceWithRawResponse, + AsyncActivationCheckResourceWithRawResponse, + ActivationCheckResourceWithStreamingResponse, + AsyncActivationCheckResourceWithStreamingResponse, ) from .custom_nameservers import ( - CustomNameservers, - AsyncCustomNameservers, - CustomNameserversWithRawResponse, - AsyncCustomNameserversWithRawResponse, - CustomNameserversWithStreamingResponse, - AsyncCustomNameserversWithStreamingResponse, + CustomNameserversResource, + AsyncCustomNameserversResource, + CustomNameserversResourceWithRawResponse, + AsyncCustomNameserversResourceWithRawResponse, + CustomNameserversResourceWithStreamingResponse, + AsyncCustomNameserversResourceWithStreamingResponse, ) __all__ = [ - "ActivationCheck", - "AsyncActivationCheck", - "ActivationCheckWithRawResponse", - "AsyncActivationCheckWithRawResponse", - "ActivationCheckWithStreamingResponse", - "AsyncActivationCheckWithStreamingResponse", - "DNSSettings", - "AsyncDNSSettings", - "DNSSettingsWithRawResponse", - "AsyncDNSSettingsWithRawResponse", - "DNSSettingsWithStreamingResponse", - "AsyncDNSSettingsWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "CustomNameservers", - "AsyncCustomNameservers", - "CustomNameserversWithRawResponse", - "AsyncCustomNameserversWithRawResponse", - "CustomNameserversWithStreamingResponse", - "AsyncCustomNameserversWithStreamingResponse", - "Holds", - "AsyncHolds", - "HoldsWithRawResponse", - "AsyncHoldsWithRawResponse", - "HoldsWithStreamingResponse", - "AsyncHoldsWithStreamingResponse", - "Workers", - "AsyncWorkers", - "WorkersWithRawResponse", - "AsyncWorkersWithRawResponse", - "WorkersWithStreamingResponse", - "AsyncWorkersWithStreamingResponse", - "Subscriptions", - "AsyncSubscriptions", - "SubscriptionsWithRawResponse", - "AsyncSubscriptionsWithRawResponse", - "SubscriptionsWithStreamingResponse", - "AsyncSubscriptionsWithStreamingResponse", - "Zones", - "AsyncZones", - "ZonesWithRawResponse", - "AsyncZonesWithRawResponse", - "ZonesWithStreamingResponse", - "AsyncZonesWithStreamingResponse", + "ActivationCheckResource", + "AsyncActivationCheckResource", + "ActivationCheckResourceWithRawResponse", + "AsyncActivationCheckResourceWithRawResponse", + "ActivationCheckResourceWithStreamingResponse", + "AsyncActivationCheckResourceWithStreamingResponse", + "DNSSettingsResource", + "AsyncDNSSettingsResource", + "DNSSettingsResourceWithRawResponse", + "AsyncDNSSettingsResourceWithRawResponse", + "DNSSettingsResourceWithStreamingResponse", + "AsyncDNSSettingsResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "CustomNameserversResource", + "AsyncCustomNameserversResource", + "CustomNameserversResourceWithRawResponse", + "AsyncCustomNameserversResourceWithRawResponse", + "CustomNameserversResourceWithStreamingResponse", + "AsyncCustomNameserversResourceWithStreamingResponse", + "HoldsResource", + "AsyncHoldsResource", + "HoldsResourceWithRawResponse", + "AsyncHoldsResourceWithRawResponse", + "HoldsResourceWithStreamingResponse", + "AsyncHoldsResourceWithStreamingResponse", + "SubscriptionsResource", + "AsyncSubscriptionsResource", + "SubscriptionsResourceWithRawResponse", + "AsyncSubscriptionsResourceWithRawResponse", + "SubscriptionsResourceWithStreamingResponse", + "AsyncSubscriptionsResourceWithStreamingResponse", + "ZonesResource", + "AsyncZonesResource", + "ZonesResourceWithRawResponse", + "AsyncZonesResourceWithRawResponse", + "ZonesResourceWithStreamingResponse", + "AsyncZonesResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zones/activation_check.py b/src/cloudflare/resources/zones/activation_check.py index e134766c559..6a09257b5fe 100644 --- a/src/cloudflare/resources/zones/activation_check.py +++ b/src/cloudflare/resources/zones/activation_check.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -16,22 +16,22 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.zones import ActivationCheckTriggerResponse from ..._base_client import ( make_request_options, ) +from ...types.zones.activation_check_trigger_response import ActivationCheckTriggerResponse -__all__ = ["ActivationCheck", "AsyncActivationCheck"] +__all__ = ["ActivationCheckResource", "AsyncActivationCheckResource"] -class ActivationCheck(SyncAPIResource): +class ActivationCheckResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ActivationCheckWithRawResponse: - return ActivationCheckWithRawResponse(self) + def with_raw_response(self) -> ActivationCheckResourceWithRawResponse: + return ActivationCheckResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ActivationCheckWithStreamingResponse: - return ActivationCheckWithStreamingResponse(self) + def with_streaming_response(self) -> ActivationCheckResourceWithStreamingResponse: + return ActivationCheckResourceWithStreamingResponse(self) def trigger( self, @@ -43,7 +43,7 @@ def trigger( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ActivationCheckTriggerResponse: + ) -> Optional[ActivationCheckTriggerResponse]: """Triggeres a new activation check for a PENDING Zone. This can be triggered every @@ -69,20 +69,20 @@ def trigger( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ActivationCheckTriggerResponse]]._unwrapper, ), - cast_to=cast(Type[ActivationCheckTriggerResponse], ResultWrapper[ActivationCheckTriggerResponse]), + cast_to=cast(Type[Optional[ActivationCheckTriggerResponse]], ResultWrapper[ActivationCheckTriggerResponse]), ) -class AsyncActivationCheck(AsyncAPIResource): +class AsyncActivationCheckResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncActivationCheckWithRawResponse: - return AsyncActivationCheckWithRawResponse(self) + def with_raw_response(self) -> AsyncActivationCheckResourceWithRawResponse: + return AsyncActivationCheckResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncActivationCheckWithStreamingResponse: - return AsyncActivationCheckWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncActivationCheckResourceWithStreamingResponse: + return AsyncActivationCheckResourceWithStreamingResponse(self) async def trigger( self, @@ -94,7 +94,7 @@ async def trigger( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ActivationCheckTriggerResponse: + ) -> Optional[ActivationCheckTriggerResponse]: """Triggeres a new activation check for a PENDING Zone. This can be triggered every @@ -120,14 +120,14 @@ async def trigger( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ActivationCheckTriggerResponse]]._unwrapper, ), - cast_to=cast(Type[ActivationCheckTriggerResponse], ResultWrapper[ActivationCheckTriggerResponse]), + cast_to=cast(Type[Optional[ActivationCheckTriggerResponse]], ResultWrapper[ActivationCheckTriggerResponse]), ) -class ActivationCheckWithRawResponse: - def __init__(self, activation_check: ActivationCheck) -> None: +class ActivationCheckResourceWithRawResponse: + def __init__(self, activation_check: ActivationCheckResource) -> None: self._activation_check = activation_check self.trigger = to_raw_response_wrapper( @@ -135,8 +135,8 @@ def __init__(self, activation_check: ActivationCheck) -> None: ) -class AsyncActivationCheckWithRawResponse: - def __init__(self, activation_check: AsyncActivationCheck) -> None: +class AsyncActivationCheckResourceWithRawResponse: + def __init__(self, activation_check: AsyncActivationCheckResource) -> None: self._activation_check = activation_check self.trigger = async_to_raw_response_wrapper( @@ -144,8 +144,8 @@ def __init__(self, activation_check: AsyncActivationCheck) -> None: ) -class ActivationCheckWithStreamingResponse: - def __init__(self, activation_check: ActivationCheck) -> None: +class ActivationCheckResourceWithStreamingResponse: + def __init__(self, activation_check: ActivationCheckResource) -> None: self._activation_check = activation_check self.trigger = to_streamed_response_wrapper( @@ -153,8 +153,8 @@ def __init__(self, activation_check: ActivationCheck) -> None: ) -class AsyncActivationCheckWithStreamingResponse: - def __init__(self, activation_check: AsyncActivationCheck) -> None: +class AsyncActivationCheckResourceWithStreamingResponse: + def __init__(self, activation_check: AsyncActivationCheckResource) -> None: self._activation_check = activation_check self.trigger = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/custom_nameservers.py b/src/cloudflare/resources/zones/custom_nameservers.py index f5a2db1748d..ba334b39387 100644 --- a/src/cloudflare/resources/zones/custom_nameservers.py +++ b/src/cloudflare/resources/zones/custom_nameservers.py @@ -20,22 +20,24 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.zones import CustomNameserverGetResponse, CustomNameserverUpdateResponse, custom_nameserver_update_params +from ...types.zones import custom_nameserver_update_params from ..._base_client import ( make_request_options, ) +from ...types.zones.custom_nameserver_get_response import CustomNameserverGetResponse +from ...types.zones.custom_nameserver_update_response import CustomNameserverUpdateResponse -__all__ = ["CustomNameservers", "AsyncCustomNameservers"] +__all__ = ["CustomNameserversResource", "AsyncCustomNameserversResource"] -class CustomNameservers(SyncAPIResource): +class CustomNameserversResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CustomNameserversWithRawResponse: - return CustomNameserversWithRawResponse(self) + def with_raw_response(self) -> CustomNameserversResourceWithRawResponse: + return CustomNameserversResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CustomNameserversWithStreamingResponse: - return CustomNameserversWithStreamingResponse(self) + def with_streaming_response(self) -> CustomNameserversResourceWithStreamingResponse: + return CustomNameserversResourceWithStreamingResponse(self) def update( self, @@ -90,7 +92,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomNameserverUpdateResponse] @@ -134,7 +136,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomNameserverGetResponse] @@ -143,14 +145,14 @@ def get( ) -class AsyncCustomNameservers(AsyncAPIResource): +class AsyncCustomNameserversResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCustomNameserversWithRawResponse: - return AsyncCustomNameserversWithRawResponse(self) + def with_raw_response(self) -> AsyncCustomNameserversResourceWithRawResponse: + return AsyncCustomNameserversResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCustomNameserversWithStreamingResponse: - return AsyncCustomNameserversWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCustomNameserversResourceWithStreamingResponse: + return AsyncCustomNameserversResourceWithStreamingResponse(self) async def update( self, @@ -205,7 +207,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomNameserverUpdateResponse] @@ -249,7 +251,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserverGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CustomNameserverGetResponse] @@ -258,8 +260,8 @@ async def get( ) -class CustomNameserversWithRawResponse: - def __init__(self, custom_nameservers: CustomNameservers) -> None: +class CustomNameserversResourceWithRawResponse: + def __init__(self, custom_nameservers: CustomNameserversResource) -> None: self._custom_nameservers = custom_nameservers self.update = to_raw_response_wrapper( @@ -270,8 +272,8 @@ def __init__(self, custom_nameservers: CustomNameservers) -> None: ) -class AsyncCustomNameserversWithRawResponse: - def __init__(self, custom_nameservers: AsyncCustomNameservers) -> None: +class AsyncCustomNameserversResourceWithRawResponse: + def __init__(self, custom_nameservers: AsyncCustomNameserversResource) -> None: self._custom_nameservers = custom_nameservers self.update = async_to_raw_response_wrapper( @@ -282,8 +284,8 @@ def __init__(self, custom_nameservers: AsyncCustomNameservers) -> None: ) -class CustomNameserversWithStreamingResponse: - def __init__(self, custom_nameservers: CustomNameservers) -> None: +class CustomNameserversResourceWithStreamingResponse: + def __init__(self, custom_nameservers: CustomNameserversResource) -> None: self._custom_nameservers = custom_nameservers self.update = to_streamed_response_wrapper( @@ -294,8 +296,8 @@ def __init__(self, custom_nameservers: CustomNameservers) -> None: ) -class AsyncCustomNameserversWithStreamingResponse: - def __init__(self, custom_nameservers: AsyncCustomNameservers) -> None: +class AsyncCustomNameserversResourceWithStreamingResponse: + def __init__(self, custom_nameservers: AsyncCustomNameserversResource) -> None: self._custom_nameservers = custom_nameservers self.update = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/dns_settings.py b/src/cloudflare/resources/zones/dns_settings.py index b09d13d1041..6da4a2d86ff 100644 --- a/src/cloudflare/resources/zones/dns_settings.py +++ b/src/cloudflare/resources/zones/dns_settings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -20,43 +20,57 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.zones import DNSSettingGetResponse, DNSSettingEditResponse, dns_setting_edit_params +from ...types.zones import dns_setting_edit_params from ..._base_client import ( make_request_options, ) +from ...types.zones.dns_setting import DNSSetting +from ...types.zones.nameserver_param import NameserverParam -__all__ = ["DNSSettings", "AsyncDNSSettings"] +__all__ = ["DNSSettingsResource", "AsyncDNSSettingsResource"] -class DNSSettings(SyncAPIResource): +class DNSSettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DNSSettingsWithRawResponse: - return DNSSettingsWithRawResponse(self) + def with_raw_response(self) -> DNSSettingsResourceWithRawResponse: + return DNSSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DNSSettingsWithStreamingResponse: - return DNSSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> DNSSettingsResourceWithStreamingResponse: + return DNSSettingsResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - nameservers: dns_setting_edit_params.Nameservers | NotGiven = NOT_GIVEN, + foundation_dns: bool | NotGiven = NOT_GIVEN, + multi_provider: bool | NotGiven = NOT_GIVEN, + nameservers: NameserverParam | NotGiven = NOT_GIVEN, + secondary_overrides: 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, - ) -> DNSSettingEditResponse: + ) -> Optional[DNSSetting]: """ Update DNS settings for a zone Args: zone_id: Identifier + foundation_dns: Whether to enable Foundation DNS Advanced Nameservers on the zone. + + multi_provider: Whether to enable multi-provider DNS, which causes Cloudflare to activate the + zone even when non-Cloudflare NS records exist, and to respect NS records at the + zone apex during outbound zone transfers. + nameservers: Settings determining the nameservers through which the zone should be available. + secondary_overrides: Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -69,15 +83,23 @@ def edit( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._patch( f"/zones/{zone_id}/dns_settings", - body=maybe_transform({"nameservers": nameservers}, dns_setting_edit_params.DNSSettingEditParams), + body=maybe_transform( + { + "foundation_dns": foundation_dns, + "multi_provider": multi_provider, + "nameservers": nameservers, + "secondary_overrides": secondary_overrides, + }, + dns_setting_edit_params.DNSSettingEditParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, ), - cast_to=cast(Type[DNSSettingEditResponse], ResultWrapper[DNSSettingEditResponse]), + cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), ) def get( @@ -90,7 +112,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSSettingGetResponse: + ) -> Optional[DNSSetting]: """ Show DNS settings for a zone @@ -114,41 +136,53 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, ), - cast_to=cast(Type[DNSSettingGetResponse], ResultWrapper[DNSSettingGetResponse]), + cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), ) -class AsyncDNSSettings(AsyncAPIResource): +class AsyncDNSSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDNSSettingsWithRawResponse: - return AsyncDNSSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncDNSSettingsResourceWithRawResponse: + return AsyncDNSSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDNSSettingsWithStreamingResponse: - return AsyncDNSSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDNSSettingsResourceWithStreamingResponse: + return AsyncDNSSettingsResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - nameservers: dns_setting_edit_params.Nameservers | NotGiven = NOT_GIVEN, + foundation_dns: bool | NotGiven = NOT_GIVEN, + multi_provider: bool | NotGiven = NOT_GIVEN, + nameservers: NameserverParam | NotGiven = NOT_GIVEN, + secondary_overrides: 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, - ) -> DNSSettingEditResponse: + ) -> Optional[DNSSetting]: """ Update DNS settings for a zone Args: zone_id: Identifier + foundation_dns: Whether to enable Foundation DNS Advanced Nameservers on the zone. + + multi_provider: Whether to enable multi-provider DNS, which causes Cloudflare to activate the + zone even when non-Cloudflare NS records exist, and to respect NS records at the + zone apex during outbound zone transfers. + nameservers: Settings determining the nameservers through which the zone should be available. + secondary_overrides: Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -162,16 +196,22 @@ async def edit( return await self._patch( f"/zones/{zone_id}/dns_settings", body=await async_maybe_transform( - {"nameservers": nameservers}, dns_setting_edit_params.DNSSettingEditParams + { + "foundation_dns": foundation_dns, + "multi_provider": multi_provider, + "nameservers": nameservers, + "secondary_overrides": secondary_overrides, + }, + dns_setting_edit_params.DNSSettingEditParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, ), - cast_to=cast(Type[DNSSettingEditResponse], ResultWrapper[DNSSettingEditResponse]), + cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), ) async def get( @@ -184,7 +224,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSSettingGetResponse: + ) -> Optional[DNSSetting]: """ Show DNS settings for a zone @@ -208,14 +248,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, ), - cast_to=cast(Type[DNSSettingGetResponse], ResultWrapper[DNSSettingGetResponse]), + cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), ) -class DNSSettingsWithRawResponse: - def __init__(self, dns_settings: DNSSettings) -> None: +class DNSSettingsResourceWithRawResponse: + def __init__(self, dns_settings: DNSSettingsResource) -> None: self._dns_settings = dns_settings self.edit = to_raw_response_wrapper( @@ -226,8 +266,8 @@ def __init__(self, dns_settings: DNSSettings) -> None: ) -class AsyncDNSSettingsWithRawResponse: - def __init__(self, dns_settings: AsyncDNSSettings) -> None: +class AsyncDNSSettingsResourceWithRawResponse: + def __init__(self, dns_settings: AsyncDNSSettingsResource) -> None: self._dns_settings = dns_settings self.edit = async_to_raw_response_wrapper( @@ -238,8 +278,8 @@ def __init__(self, dns_settings: AsyncDNSSettings) -> None: ) -class DNSSettingsWithStreamingResponse: - def __init__(self, dns_settings: DNSSettings) -> None: +class DNSSettingsResourceWithStreamingResponse: + def __init__(self, dns_settings: DNSSettingsResource) -> None: self._dns_settings = dns_settings self.edit = to_streamed_response_wrapper( @@ -250,8 +290,8 @@ def __init__(self, dns_settings: DNSSettings) -> None: ) -class AsyncDNSSettingsWithStreamingResponse: - def __init__(self, dns_settings: AsyncDNSSettings) -> None: +class AsyncDNSSettingsResourceWithStreamingResponse: + def __init__(self, dns_settings: AsyncDNSSettingsResource) -> None: self._dns_settings = dns_settings self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/holds.py b/src/cloudflare/resources/zones/holds.py index 96a4032d17b..120d910d5cf 100644 --- a/src/cloudflare/resources/zones/holds.py +++ b/src/cloudflare/resources/zones/holds.py @@ -20,28 +20,23 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...types.zones import ( - HoldGetResponse, - HoldCreateResponse, - HoldDeleteResponse, - hold_create_params, - hold_delete_params, -) +from ...types.zones import hold_create_params, hold_delete_params from ..._base_client import ( make_request_options, ) +from ...types.zones.zone_hold import ZoneHold -__all__ = ["Holds", "AsyncHolds"] +__all__ = ["HoldsResource", "AsyncHoldsResource"] -class Holds(SyncAPIResource): +class HoldsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HoldsWithRawResponse: - return HoldsWithRawResponse(self) + def with_raw_response(self) -> HoldsResourceWithRawResponse: + return HoldsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HoldsWithStreamingResponse: - return HoldsWithStreamingResponse(self) + def with_streaming_response(self) -> HoldsResourceWithStreamingResponse: + return HoldsResourceWithStreamingResponse(self) def create( self, @@ -54,7 +49,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HoldCreateResponse: + ) -> ZoneHold: """ Enforce a zone hold on the zone, blocking the creation and activation of zones with this zone's hostname. @@ -85,9 +80,9 @@ def create( extra_body=extra_body, timeout=timeout, query=maybe_transform({"include_subdomains": include_subdomains}, hold_create_params.HoldCreateParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ZoneHold]._unwrapper, ), - cast_to=cast(Type[HoldCreateResponse], ResultWrapper[HoldCreateResponse]), + cast_to=cast(Type[ZoneHold], ResultWrapper[ZoneHold]), ) def delete( @@ -101,7 +96,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HoldDeleteResponse]: + ) -> Optional[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. @@ -131,9 +126,9 @@ def delete( extra_body=extra_body, timeout=timeout, query=maybe_transform({"hold_after": hold_after}, hold_delete_params.HoldDeleteParams), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZoneHold]]._unwrapper, ), - cast_to=cast(Type[Optional[HoldDeleteResponse]], ResultWrapper[HoldDeleteResponse]), + cast_to=cast(Type[Optional[ZoneHold]], ResultWrapper[ZoneHold]), ) def get( @@ -146,7 +141,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HoldGetResponse: + ) -> ZoneHold: """ Retrieve whether the zone is subject to a zone hold, and metadata about the hold. @@ -171,20 +166,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ZoneHold]._unwrapper, ), - cast_to=cast(Type[HoldGetResponse], ResultWrapper[HoldGetResponse]), + cast_to=cast(Type[ZoneHold], ResultWrapper[ZoneHold]), ) -class AsyncHolds(AsyncAPIResource): +class AsyncHoldsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHoldsWithRawResponse: - return AsyncHoldsWithRawResponse(self) + def with_raw_response(self) -> AsyncHoldsResourceWithRawResponse: + return AsyncHoldsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHoldsWithStreamingResponse: - return AsyncHoldsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHoldsResourceWithStreamingResponse: + return AsyncHoldsResourceWithStreamingResponse(self) async def create( self, @@ -197,7 +192,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HoldCreateResponse: + ) -> ZoneHold: """ Enforce a zone hold on the zone, blocking the creation and activation of zones with this zone's hostname. @@ -230,9 +225,9 @@ async def create( query=await async_maybe_transform( {"include_subdomains": include_subdomains}, hold_create_params.HoldCreateParams ), - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ZoneHold]._unwrapper, ), - cast_to=cast(Type[HoldCreateResponse], ResultWrapper[HoldCreateResponse]), + cast_to=cast(Type[ZoneHold], ResultWrapper[ZoneHold]), ) async def delete( @@ -246,7 +241,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HoldDeleteResponse]: + ) -> Optional[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. @@ -276,9 +271,9 @@ 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._unwrapper, + post_parser=ResultWrapper[Optional[ZoneHold]]._unwrapper, ), - cast_to=cast(Type[Optional[HoldDeleteResponse]], ResultWrapper[HoldDeleteResponse]), + cast_to=cast(Type[Optional[ZoneHold]], ResultWrapper[ZoneHold]), ) async def get( @@ -291,7 +286,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HoldGetResponse: + ) -> ZoneHold: """ Retrieve whether the zone is subject to a zone hold, and metadata about the hold. @@ -316,14 +311,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[ZoneHold]._unwrapper, ), - cast_to=cast(Type[HoldGetResponse], ResultWrapper[HoldGetResponse]), + cast_to=cast(Type[ZoneHold], ResultWrapper[ZoneHold]), ) -class HoldsWithRawResponse: - def __init__(self, holds: Holds) -> None: +class HoldsResourceWithRawResponse: + def __init__(self, holds: HoldsResource) -> None: self._holds = holds self.create = to_raw_response_wrapper( @@ -337,8 +332,8 @@ def __init__(self, holds: Holds) -> None: ) -class AsyncHoldsWithRawResponse: - def __init__(self, holds: AsyncHolds) -> None: +class AsyncHoldsResourceWithRawResponse: + def __init__(self, holds: AsyncHoldsResource) -> None: self._holds = holds self.create = async_to_raw_response_wrapper( @@ -352,8 +347,8 @@ def __init__(self, holds: AsyncHolds) -> None: ) -class HoldsWithStreamingResponse: - def __init__(self, holds: Holds) -> None: +class HoldsResourceWithStreamingResponse: + def __init__(self, holds: HoldsResource) -> None: self._holds = holds self.create = to_streamed_response_wrapper( @@ -367,8 +362,8 @@ def __init__(self, holds: Holds) -> None: ) -class AsyncHoldsWithStreamingResponse: - def __init__(self, holds: AsyncHolds) -> None: +class AsyncHoldsResourceWithStreamingResponse: + def __init__(self, holds: AsyncHoldsResource) -> None: self._holds = holds self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/__init__.py b/src/cloudflare/resources/zones/settings/__init__.py index 95ca89ea01b..1ac5af2ef0a 100644 --- a/src/cloudflare/resources/zones/settings/__init__.py +++ b/src/cloudflare/resources/zones/settings/__init__.py @@ -1,733 +1,733 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .nel import ( - NEL, - AsyncNEL, - NELWithRawResponse, - AsyncNELWithRawResponse, - NELWithStreamingResponse, - AsyncNELWithStreamingResponse, + NELResource, + AsyncNELResource, + NELResourceWithRawResponse, + AsyncNELResourceWithRawResponse, + NELResourceWithStreamingResponse, + AsyncNELResourceWithStreamingResponse, ) from .ssl import ( - SSL, - AsyncSSL, - SSLWithRawResponse, - AsyncSSLWithRawResponse, - SSLWithStreamingResponse, - AsyncSSLWithStreamingResponse, + SSLResource, + AsyncSSLResource, + SSLResourceWithRawResponse, + AsyncSSLResourceWithRawResponse, + SSLResourceWithStreamingResponse, + AsyncSSLResourceWithStreamingResponse, ) from .waf import ( - WAF, - AsyncWAF, - WAFWithRawResponse, - AsyncWAFWithRawResponse, - WAFWithStreamingResponse, - AsyncWAFWithStreamingResponse, + WAFResource, + AsyncWAFResource, + WAFResourceWithRawResponse, + AsyncWAFResourceWithRawResponse, + WAFResourceWithStreamingResponse, + AsyncWAFResourceWithStreamingResponse, ) from .ipv6 import ( - IPV6, - AsyncIPV6, - IPV6WithRawResponse, - AsyncIPV6WithRawResponse, - IPV6WithStreamingResponse, - AsyncIPV6WithStreamingResponse, + IPV6Resource, + AsyncIPV6Resource, + IPV6ResourceWithRawResponse, + AsyncIPV6ResourceWithRawResponse, + IPV6ResourceWithStreamingResponse, + AsyncIPV6ResourceWithStreamingResponse, ) from .webp import ( - WebP, - AsyncWebP, - WebPWithRawResponse, - AsyncWebPWithRawResponse, - WebPWithStreamingResponse, - AsyncWebPWithStreamingResponse, + WebPResource, + AsyncWebPResource, + WebPResourceWithRawResponse, + AsyncWebPResourceWithRawResponse, + WebPResourceWithStreamingResponse, + AsyncWebPResourceWithStreamingResponse, ) from .http2 import ( - HTTP2, - AsyncHTTP2, - HTTP2WithRawResponse, - AsyncHTTP2WithRawResponse, - HTTP2WithStreamingResponse, - AsyncHTTP2WithStreamingResponse, + HTTP2Resource, + AsyncHTTP2Resource, + HTTP2ResourceWithRawResponse, + AsyncHTTP2ResourceWithRawResponse, + HTTP2ResourceWithStreamingResponse, + AsyncHTTP2ResourceWithStreamingResponse, ) from .http3 import ( - HTTP3, - AsyncHTTP3, - HTTP3WithRawResponse, - AsyncHTTP3WithRawResponse, - HTTP3WithStreamingResponse, - AsyncHTTP3WithStreamingResponse, + HTTP3Resource, + AsyncHTTP3Resource, + HTTP3ResourceWithRawResponse, + AsyncHTTP3ResourceWithRawResponse, + HTTP3ResourceWithStreamingResponse, + AsyncHTTP3ResourceWithStreamingResponse, ) from .brotli import ( - Brotli, - AsyncBrotli, - BrotliWithRawResponse, - AsyncBrotliWithRawResponse, - BrotliWithStreamingResponse, - AsyncBrotliWithStreamingResponse, + BrotliResource, + AsyncBrotliResource, + BrotliResourceWithRawResponse, + AsyncBrotliResourceWithRawResponse, + BrotliResourceWithStreamingResponse, + AsyncBrotliResourceWithStreamingResponse, ) from .minify import ( - Minify, - AsyncMinify, - MinifyWithRawResponse, - AsyncMinifyWithRawResponse, - MinifyWithStreamingResponse, - AsyncMinifyWithStreamingResponse, + MinifyResource, + AsyncMinifyResource, + MinifyResourceWithRawResponse, + AsyncMinifyResourceWithRawResponse, + MinifyResourceWithStreamingResponse, + AsyncMinifyResourceWithStreamingResponse, ) from .mirage import ( - Mirage, - AsyncMirage, - MirageWithRawResponse, - AsyncMirageWithRawResponse, - MirageWithStreamingResponse, - AsyncMirageWithStreamingResponse, + MirageResource, + AsyncMirageResource, + MirageResourceWithRawResponse, + AsyncMirageResourceWithRawResponse, + MirageResourceWithStreamingResponse, + AsyncMirageResourceWithStreamingResponse, ) from .polish import ( - Polish, - AsyncPolish, - PolishWithRawResponse, - AsyncPolishWithRawResponse, - PolishWithStreamingResponse, - AsyncPolishWithStreamingResponse, + PolishResource, + AsyncPolishResource, + PolishResourceWithRawResponse, + AsyncPolishResourceWithRawResponse, + PolishResourceWithStreamingResponse, + AsyncPolishResourceWithStreamingResponse, ) from .ciphers import ( - Ciphers, - AsyncCiphers, - CiphersWithRawResponse, - AsyncCiphersWithRawResponse, - CiphersWithStreamingResponse, - AsyncCiphersWithStreamingResponse, + CiphersResource, + AsyncCiphersResource, + CiphersResourceWithRawResponse, + AsyncCiphersResourceWithRawResponse, + CiphersResourceWithStreamingResponse, + AsyncCiphersResourceWithStreamingResponse, ) from .tls_1_3 import ( - TLS1_3, - AsyncTLS1_3, - TLS1_3WithRawResponse, - AsyncTLS1_3WithRawResponse, - TLS1_3WithStreamingResponse, - AsyncTLS1_3WithStreamingResponse, + TLS1_3Resource, + AsyncTLS1_3Resource, + TLS1_3ResourceWithRawResponse, + AsyncTLS1_3ResourceWithRawResponse, + TLS1_3ResourceWithStreamingResponse, + AsyncTLS1_3ResourceWithStreamingResponse, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from .zero_rtt import ( - ZeroRTT, - AsyncZeroRTT, - ZeroRTTWithRawResponse, - AsyncZeroRTTWithRawResponse, - ZeroRTTWithStreamingResponse, - AsyncZeroRTTWithStreamingResponse, + ZeroRTTResource, + AsyncZeroRTTResource, + ZeroRTTResourceWithRawResponse, + AsyncZeroRTTResourceWithRawResponse, + ZeroRTTResourceWithStreamingResponse, + AsyncZeroRTTResourceWithStreamingResponse, ) from .websocket import ( - Websocket, - AsyncWebsocket, - WebsocketWithRawResponse, - AsyncWebsocketWithRawResponse, - WebsocketWithStreamingResponse, - AsyncWebsocketWithStreamingResponse, + WebsocketResource, + AsyncWebsocketResource, + WebsocketResourceWithRawResponse, + AsyncWebsocketResourceWithRawResponse, + WebsocketResourceWithStreamingResponse, + AsyncWebsocketResourceWithStreamingResponse, ) from .cache_level import ( - CacheLevel, - AsyncCacheLevel, - CacheLevelWithRawResponse, - AsyncCacheLevelWithRawResponse, - CacheLevelWithStreamingResponse, - AsyncCacheLevelWithStreamingResponse, + CacheLevelResource, + AsyncCacheLevelResource, + CacheLevelResourceWithRawResponse, + AsyncCacheLevelResourceWithRawResponse, + CacheLevelResourceWithStreamingResponse, + AsyncCacheLevelResourceWithStreamingResponse, ) from .early_hints import ( - EarlyHints, - AsyncEarlyHints, - EarlyHintsWithRawResponse, - AsyncEarlyHintsWithRawResponse, - EarlyHintsWithStreamingResponse, - AsyncEarlyHintsWithStreamingResponse, + EarlyHintsResource, + AsyncEarlyHintsResource, + EarlyHintsResourceWithRawResponse, + AsyncEarlyHintsResourceWithRawResponse, + EarlyHintsResourceWithStreamingResponse, + AsyncEarlyHintsResourceWithStreamingResponse, ) from .pseudo_ipv4 import ( - PseudoIPV4, - AsyncPseudoIPV4, - PseudoIPV4WithRawResponse, - AsyncPseudoIPV4WithRawResponse, - PseudoIPV4WithStreamingResponse, - AsyncPseudoIPV4WithStreamingResponse, + PseudoIPV4Resource, + AsyncPseudoIPV4Resource, + PseudoIPV4ResourceWithRawResponse, + AsyncPseudoIPV4ResourceWithRawResponse, + PseudoIPV4ResourceWithStreamingResponse, + AsyncPseudoIPV4ResourceWithStreamingResponse, ) from .advanced_ddos import ( - AdvancedDDoS, - AsyncAdvancedDDoS, - AdvancedDDoSWithRawResponse, - AsyncAdvancedDDoSWithRawResponse, - AdvancedDDoSWithStreamingResponse, - AsyncAdvancedDDoSWithStreamingResponse, + AdvancedDDoSResource, + AsyncAdvancedDDoSResource, + AdvancedDDoSResourceWithRawResponse, + AsyncAdvancedDDoSResourceWithRawResponse, + AdvancedDDoSResourceWithStreamingResponse, + AsyncAdvancedDDoSResourceWithStreamingResponse, ) from .always_online import ( - AlwaysOnline, - AsyncAlwaysOnline, - AlwaysOnlineWithRawResponse, - AsyncAlwaysOnlineWithRawResponse, - AlwaysOnlineWithStreamingResponse, - AsyncAlwaysOnlineWithStreamingResponse, + AlwaysOnlineResource, + AsyncAlwaysOnlineResource, + AlwaysOnlineResourceWithRawResponse, + AsyncAlwaysOnlineResourceWithRawResponse, + AlwaysOnlineResourceWithStreamingResponse, + AsyncAlwaysOnlineResourceWithStreamingResponse, ) from .browser_check import ( - BrowserCheck, - AsyncBrowserCheck, - BrowserCheckWithRawResponse, - AsyncBrowserCheckWithRawResponse, - BrowserCheckWithStreamingResponse, - AsyncBrowserCheckWithStreamingResponse, + BrowserCheckResource, + AsyncBrowserCheckResource, + BrowserCheckResourceWithRawResponse, + AsyncBrowserCheckResourceWithRawResponse, + BrowserCheckResourceWithStreamingResponse, + AsyncBrowserCheckResourceWithStreamingResponse, ) from .challenge_ttl import ( - ChallengeTTL, - AsyncChallengeTTL, - ChallengeTTLWithRawResponse, - AsyncChallengeTTLWithRawResponse, - ChallengeTTLWithStreamingResponse, - AsyncChallengeTTLWithStreamingResponse, + ChallengeTTLResource, + AsyncChallengeTTLResource, + ChallengeTTLResourceWithRawResponse, + AsyncChallengeTTLResourceWithRawResponse, + ChallengeTTLResourceWithStreamingResponse, + AsyncChallengeTTLResourceWithStreamingResponse, ) from .font_settings import ( - FontSettings, - AsyncFontSettings, - FontSettingsWithRawResponse, - AsyncFontSettingsWithRawResponse, - FontSettingsWithStreamingResponse, - AsyncFontSettingsWithStreamingResponse, + FontSettingsResource, + AsyncFontSettingsResource, + FontSettingsResourceWithRawResponse, + AsyncFontSettingsResourceWithRawResponse, + FontSettingsResourceWithStreamingResponse, + AsyncFontSettingsResourceWithStreamingResponse, ) from .rocket_loader import ( - RocketLoader, - AsyncRocketLoader, - RocketLoaderWithRawResponse, - AsyncRocketLoaderWithRawResponse, - RocketLoaderWithStreamingResponse, - AsyncRocketLoaderWithStreamingResponse, + RocketLoaderResource, + AsyncRocketLoaderResource, + RocketLoaderResourceWithRawResponse, + AsyncRocketLoaderResourceWithRawResponse, + RocketLoaderResourceWithStreamingResponse, + AsyncRocketLoaderResourceWithStreamingResponse, ) from .image_resizing import ( - ImageResizing, - AsyncImageResizing, - ImageResizingWithRawResponse, - AsyncImageResizingWithRawResponse, - ImageResizingWithStreamingResponse, - AsyncImageResizingWithStreamingResponse, + ImageResizingResource, + AsyncImageResizingResource, + ImageResizingResourceWithRawResponse, + AsyncImageResizingResourceWithRawResponse, + ImageResizingResourceWithStreamingResponse, + AsyncImageResizingResourceWithStreamingResponse, ) from .ip_geolocation import ( - IPGeolocation, - AsyncIPGeolocation, - IPGeolocationWithRawResponse, - AsyncIPGeolocationWithRawResponse, - IPGeolocationWithStreamingResponse, - AsyncIPGeolocationWithStreamingResponse, + IPGeolocationResource, + AsyncIPGeolocationResource, + IPGeolocationResourceWithRawResponse, + AsyncIPGeolocationResourceWithRawResponse, + IPGeolocationResourceWithStreamingResponse, + AsyncIPGeolocationResourceWithStreamingResponse, ) from .security_level import ( - SecurityLevel, - AsyncSecurityLevel, - SecurityLevelWithRawResponse, - AsyncSecurityLevelWithRawResponse, - SecurityLevelWithStreamingResponse, - AsyncSecurityLevelWithStreamingResponse, + SecurityLevelResource, + AsyncSecurityLevelResource, + SecurityLevelResourceWithRawResponse, + AsyncSecurityLevelResourceWithRawResponse, + SecurityLevelResourceWithStreamingResponse, + AsyncSecurityLevelResourceWithStreamingResponse, ) from .min_tls_version import ( - MinTLSVersion, - AsyncMinTLSVersion, - MinTLSVersionWithRawResponse, - AsyncMinTLSVersionWithRawResponse, - MinTLSVersionWithStreamingResponse, - AsyncMinTLSVersionWithStreamingResponse, + MinTLSVersionResource, + AsyncMinTLSVersionResource, + MinTLSVersionResourceWithRawResponse, + AsyncMinTLSVersionResourceWithRawResponse, + MinTLSVersionResourceWithStreamingResponse, + AsyncMinTLSVersionResourceWithStreamingResponse, ) from .mobile_redirect import ( - MobileRedirect, - AsyncMobileRedirect, - MobileRedirectWithRawResponse, - AsyncMobileRedirectWithRawResponse, - MobileRedirectWithStreamingResponse, - AsyncMobileRedirectWithStreamingResponse, + MobileRedirectResource, + AsyncMobileRedirectResource, + MobileRedirectResourceWithRawResponse, + AsyncMobileRedirectResourceWithRawResponse, + MobileRedirectResourceWithStreamingResponse, + AsyncMobileRedirectResourceWithStreamingResponse, ) from .ssl_recommender import ( - SSLRecommender, - AsyncSSLRecommender, - SSLRecommenderWithRawResponse, - AsyncSSLRecommenderWithRawResponse, - SSLRecommenderWithStreamingResponse, - AsyncSSLRecommenderWithStreamingResponse, + SSLRecommenderResource, + AsyncSSLRecommenderResource, + SSLRecommenderResourceWithRawResponse, + AsyncSSLRecommenderResourceWithRawResponse, + SSLRecommenderResourceWithStreamingResponse, + AsyncSSLRecommenderResourceWithStreamingResponse, ) from .tls_client_auth import ( - TLSClientAuth, - AsyncTLSClientAuth, - TLSClientAuthWithRawResponse, - AsyncTLSClientAuthWithRawResponse, - TLSClientAuthWithStreamingResponse, - AsyncTLSClientAuthWithStreamingResponse, + TLSClientAuthResource, + AsyncTLSClientAuthResource, + TLSClientAuthResourceWithRawResponse, + AsyncTLSClientAuthResourceWithRawResponse, + TLSClientAuthResourceWithStreamingResponse, + AsyncTLSClientAuthResourceWithStreamingResponse, ) from .always_use_https import ( - AlwaysUseHTTPS, - AsyncAlwaysUseHTTPS, - AlwaysUseHTTPSWithRawResponse, - AsyncAlwaysUseHTTPSWithRawResponse, - AlwaysUseHTTPSWithStreamingResponse, - AsyncAlwaysUseHTTPSWithStreamingResponse, + AlwaysUseHTTPSResource, + AsyncAlwaysUseHTTPSResource, + AlwaysUseHTTPSResourceWithRawResponse, + AsyncAlwaysUseHTTPSResourceWithRawResponse, + AlwaysUseHTTPSResourceWithStreamingResponse, + AsyncAlwaysUseHTTPSResourceWithStreamingResponse, ) from .development_mode import ( - DevelopmentMode, - AsyncDevelopmentMode, - DevelopmentModeWithRawResponse, - AsyncDevelopmentModeWithRawResponse, - DevelopmentModeWithStreamingResponse, - AsyncDevelopmentModeWithStreamingResponse, + DevelopmentModeResource, + AsyncDevelopmentModeResource, + DevelopmentModeResourceWithRawResponse, + AsyncDevelopmentModeResourceWithRawResponse, + DevelopmentModeResourceWithStreamingResponse, + AsyncDevelopmentModeResourceWithStreamingResponse, ) from .orange_to_orange import ( - OrangeToOrange, - AsyncOrangeToOrange, - OrangeToOrangeWithRawResponse, - AsyncOrangeToOrangeWithRawResponse, - OrangeToOrangeWithStreamingResponse, - AsyncOrangeToOrangeWithStreamingResponse, + OrangeToOrangeResource, + AsyncOrangeToOrangeResource, + OrangeToOrangeResourceWithRawResponse, + AsyncOrangeToOrangeResourceWithRawResponse, + OrangeToOrangeResourceWithStreamingResponse, + AsyncOrangeToOrangeResourceWithStreamingResponse, ) from .prefetch_preload import ( - PrefetchPreload, - AsyncPrefetchPreload, - PrefetchPreloadWithRawResponse, - AsyncPrefetchPreloadWithRawResponse, - PrefetchPreloadWithStreamingResponse, - AsyncPrefetchPreloadWithStreamingResponse, + PrefetchPreloadResource, + AsyncPrefetchPreloadResource, + PrefetchPreloadResourceWithRawResponse, + AsyncPrefetchPreloadResourceWithRawResponse, + PrefetchPreloadResourceWithStreamingResponse, + AsyncPrefetchPreloadResourceWithStreamingResponse, ) from .security_headers import ( - SecurityHeaders, - AsyncSecurityHeaders, - SecurityHeadersWithRawResponse, - AsyncSecurityHeadersWithRawResponse, - SecurityHeadersWithStreamingResponse, - AsyncSecurityHeadersWithStreamingResponse, + SecurityHeadersResource, + AsyncSecurityHeadersResource, + SecurityHeadersResourceWithRawResponse, + AsyncSecurityHeadersResourceWithRawResponse, + SecurityHeadersResourceWithStreamingResponse, + AsyncSecurityHeadersResourceWithStreamingResponse, ) from .browser_cache_ttl import ( - BrowserCacheTTL, - AsyncBrowserCacheTTL, - BrowserCacheTTLWithRawResponse, - AsyncBrowserCacheTTLWithRawResponse, - BrowserCacheTTLWithStreamingResponse, - AsyncBrowserCacheTTLWithStreamingResponse, + BrowserCacheTTLResource, + AsyncBrowserCacheTTLResource, + BrowserCacheTTLResourceWithRawResponse, + AsyncBrowserCacheTTLResourceWithRawResponse, + BrowserCacheTTLResourceWithStreamingResponse, + AsyncBrowserCacheTTLResourceWithStreamingResponse, ) from .email_obfuscation import ( - EmailObfuscation, - AsyncEmailObfuscation, - EmailObfuscationWithRawResponse, - AsyncEmailObfuscationWithRawResponse, - EmailObfuscationWithStreamingResponse, - AsyncEmailObfuscationWithStreamingResponse, + EmailObfuscationResource, + AsyncEmailObfuscationResource, + EmailObfuscationResourceWithRawResponse, + AsyncEmailObfuscationResourceWithRawResponse, + EmailObfuscationResourceWithStreamingResponse, + AsyncEmailObfuscationResourceWithStreamingResponse, ) from .h2_prioritization import ( - H2Prioritization, - AsyncH2Prioritization, - H2PrioritizationWithRawResponse, - AsyncH2PrioritizationWithRawResponse, - H2PrioritizationWithStreamingResponse, - AsyncH2PrioritizationWithStreamingResponse, + H2PrioritizationResource, + AsyncH2PrioritizationResource, + H2PrioritizationResourceWithRawResponse, + AsyncH2PrioritizationResourceWithRawResponse, + H2PrioritizationResourceWithStreamingResponse, + AsyncH2PrioritizationResourceWithStreamingResponse, ) from .hotlink_protection import ( - HotlinkProtection, - AsyncHotlinkProtection, - HotlinkProtectionWithRawResponse, - AsyncHotlinkProtectionWithRawResponse, - HotlinkProtectionWithStreamingResponse, - AsyncHotlinkProtectionWithStreamingResponse, + HotlinkProtectionResource, + AsyncHotlinkProtectionResource, + HotlinkProtectionResourceWithRawResponse, + AsyncHotlinkProtectionResourceWithRawResponse, + HotlinkProtectionResourceWithStreamingResponse, + AsyncHotlinkProtectionResourceWithStreamingResponse, ) from .proxy_read_timeout import ( - ProxyReadTimeout, - AsyncProxyReadTimeout, - ProxyReadTimeoutWithRawResponse, - AsyncProxyReadTimeoutWithRawResponse, - ProxyReadTimeoutWithStreamingResponse, - AsyncProxyReadTimeoutWithStreamingResponse, + ProxyReadTimeoutResource, + AsyncProxyReadTimeoutResource, + ProxyReadTimeoutResourceWithRawResponse, + AsyncProxyReadTimeoutResourceWithRawResponse, + ProxyReadTimeoutResourceWithStreamingResponse, + AsyncProxyReadTimeoutResourceWithStreamingResponse, ) from .response_buffering import ( - ResponseBuffering, - AsyncResponseBuffering, - ResponseBufferingWithRawResponse, - AsyncResponseBufferingWithRawResponse, - ResponseBufferingWithStreamingResponse, - AsyncResponseBufferingWithStreamingResponse, + ResponseBufferingResource, + AsyncResponseBufferingResource, + ResponseBufferingResourceWithRawResponse, + AsyncResponseBufferingResourceWithRawResponse, + ResponseBufferingResourceWithStreamingResponse, + AsyncResponseBufferingResourceWithStreamingResponse, ) from .opportunistic_onion import ( - OpportunisticOnion, - AsyncOpportunisticOnion, - OpportunisticOnionWithRawResponse, - AsyncOpportunisticOnionWithRawResponse, - OpportunisticOnionWithStreamingResponse, - AsyncOpportunisticOnionWithStreamingResponse, + OpportunisticOnionResource, + AsyncOpportunisticOnionResource, + OpportunisticOnionResourceWithRawResponse, + AsyncOpportunisticOnionResourceWithRawResponse, + OpportunisticOnionResourceWithStreamingResponse, + AsyncOpportunisticOnionResourceWithStreamingResponse, ) from .server_side_excludes import ( - ServerSideExcludes, - AsyncServerSideExcludes, - ServerSideExcludesWithRawResponse, - AsyncServerSideExcludesWithRawResponse, - ServerSideExcludesWithStreamingResponse, - AsyncServerSideExcludesWithStreamingResponse, + ServerSideExcludesResource, + AsyncServerSideExcludesResource, + ServerSideExcludesResourceWithRawResponse, + AsyncServerSideExcludesResourceWithRawResponse, + ServerSideExcludesResourceWithStreamingResponse, + AsyncServerSideExcludesResourceWithStreamingResponse, ) from .true_client_ip_header import ( - TrueClientIPHeader, - AsyncTrueClientIPHeader, - TrueClientIPHeaderWithRawResponse, - AsyncTrueClientIPHeaderWithRawResponse, - TrueClientIPHeaderWithStreamingResponse, - AsyncTrueClientIPHeaderWithStreamingResponse, + TrueClientIPHeaderResource, + AsyncTrueClientIPHeaderResource, + TrueClientIPHeaderResourceWithRawResponse, + AsyncTrueClientIPHeaderResourceWithRawResponse, + TrueClientIPHeaderResourceWithStreamingResponse, + AsyncTrueClientIPHeaderResourceWithStreamingResponse, ) from .origin_max_http_version import ( - OriginMaxHTTPVersion, - AsyncOriginMaxHTTPVersion, - OriginMaxHTTPVersionWithRawResponse, - AsyncOriginMaxHTTPVersionWithRawResponse, - OriginMaxHTTPVersionWithStreamingResponse, - AsyncOriginMaxHTTPVersionWithStreamingResponse, + OriginMaxHTTPVersionResource, + AsyncOriginMaxHTTPVersionResource, + OriginMaxHTTPVersionResourceWithRawResponse, + AsyncOriginMaxHTTPVersionResourceWithRawResponse, + OriginMaxHTTPVersionResourceWithStreamingResponse, + AsyncOriginMaxHTTPVersionResourceWithStreamingResponse, ) from .automatic_https_rewrites import ( - AutomaticHTTPSRewrites, - AsyncAutomaticHTTPSRewrites, - AutomaticHTTPSRewritesWithRawResponse, - AsyncAutomaticHTTPSRewritesWithRawResponse, - AutomaticHTTPSRewritesWithStreamingResponse, - AsyncAutomaticHTTPSRewritesWithStreamingResponse, + AutomaticHTTPSRewritesResource, + AsyncAutomaticHTTPSRewritesResource, + AutomaticHTTPSRewritesResourceWithRawResponse, + AsyncAutomaticHTTPSRewritesResourceWithRawResponse, + AutomaticHTTPSRewritesResourceWithStreamingResponse, + AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse, ) from .opportunistic_encryption import ( - OpportunisticEncryption, - AsyncOpportunisticEncryption, - OpportunisticEncryptionWithRawResponse, - AsyncOpportunisticEncryptionWithRawResponse, - OpportunisticEncryptionWithStreamingResponse, - AsyncOpportunisticEncryptionWithStreamingResponse, + OpportunisticEncryptionResource, + AsyncOpportunisticEncryptionResource, + OpportunisticEncryptionResourceWithRawResponse, + AsyncOpportunisticEncryptionResourceWithRawResponse, + OpportunisticEncryptionResourceWithStreamingResponse, + AsyncOpportunisticEncryptionResourceWithStreamingResponse, ) from .origin_error_page_pass_thru import ( - OriginErrorPagePassThru, - AsyncOriginErrorPagePassThru, - OriginErrorPagePassThruWithRawResponse, - AsyncOriginErrorPagePassThruWithRawResponse, - OriginErrorPagePassThruWithStreamingResponse, - AsyncOriginErrorPagePassThruWithStreamingResponse, + OriginErrorPagePassThruResource, + AsyncOriginErrorPagePassThruResource, + OriginErrorPagePassThruResourceWithRawResponse, + AsyncOriginErrorPagePassThruResourceWithRawResponse, + OriginErrorPagePassThruResourceWithStreamingResponse, + AsyncOriginErrorPagePassThruResourceWithStreamingResponse, ) from .sort_query_string_for_cache import ( - SortQueryStringForCache, - AsyncSortQueryStringForCache, - SortQueryStringForCacheWithRawResponse, - AsyncSortQueryStringForCacheWithRawResponse, - SortQueryStringForCacheWithStreamingResponse, - AsyncSortQueryStringForCacheWithStreamingResponse, + SortQueryStringForCacheResource, + AsyncSortQueryStringForCacheResource, + SortQueryStringForCacheResourceWithRawResponse, + AsyncSortQueryStringForCacheResourceWithRawResponse, + SortQueryStringForCacheResourceWithStreamingResponse, + AsyncSortQueryStringForCacheResourceWithStreamingResponse, ) from .automatic_platform_optimization import ( - AutomaticPlatformOptimization, - AsyncAutomaticPlatformOptimization, - AutomaticPlatformOptimizationWithRawResponse, - AsyncAutomaticPlatformOptimizationWithRawResponse, - AutomaticPlatformOptimizationWithStreamingResponse, - AsyncAutomaticPlatformOptimizationWithStreamingResponse, + AutomaticPlatformOptimizationResource, + AsyncAutomaticPlatformOptimizationResource, + AutomaticPlatformOptimizationResourceWithRawResponse, + AsyncAutomaticPlatformOptimizationResourceWithRawResponse, + AutomaticPlatformOptimizationResourceWithStreamingResponse, + AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse, ) __all__ = [ - "ZeroRTT", - "AsyncZeroRTT", - "ZeroRTTWithRawResponse", - "AsyncZeroRTTWithRawResponse", - "ZeroRTTWithStreamingResponse", - "AsyncZeroRTTWithStreamingResponse", - "AdvancedDDoS", - "AsyncAdvancedDDoS", - "AdvancedDDoSWithRawResponse", - "AsyncAdvancedDDoSWithRawResponse", - "AdvancedDDoSWithStreamingResponse", - "AsyncAdvancedDDoSWithStreamingResponse", - "AlwaysOnline", - "AsyncAlwaysOnline", - "AlwaysOnlineWithRawResponse", - "AsyncAlwaysOnlineWithRawResponse", - "AlwaysOnlineWithStreamingResponse", - "AsyncAlwaysOnlineWithStreamingResponse", - "AlwaysUseHTTPS", - "AsyncAlwaysUseHTTPS", - "AlwaysUseHTTPSWithRawResponse", - "AsyncAlwaysUseHTTPSWithRawResponse", - "AlwaysUseHTTPSWithStreamingResponse", - "AsyncAlwaysUseHTTPSWithStreamingResponse", - "AutomaticHTTPSRewrites", - "AsyncAutomaticHTTPSRewrites", - "AutomaticHTTPSRewritesWithRawResponse", - "AsyncAutomaticHTTPSRewritesWithRawResponse", - "AutomaticHTTPSRewritesWithStreamingResponse", - "AsyncAutomaticHTTPSRewritesWithStreamingResponse", - "AutomaticPlatformOptimization", - "AsyncAutomaticPlatformOptimization", - "AutomaticPlatformOptimizationWithRawResponse", - "AsyncAutomaticPlatformOptimizationWithRawResponse", - "AutomaticPlatformOptimizationWithStreamingResponse", - "AsyncAutomaticPlatformOptimizationWithStreamingResponse", - "Brotli", - "AsyncBrotli", - "BrotliWithRawResponse", - "AsyncBrotliWithRawResponse", - "BrotliWithStreamingResponse", - "AsyncBrotliWithStreamingResponse", - "BrowserCacheTTL", - "AsyncBrowserCacheTTL", - "BrowserCacheTTLWithRawResponse", - "AsyncBrowserCacheTTLWithRawResponse", - "BrowserCacheTTLWithStreamingResponse", - "AsyncBrowserCacheTTLWithStreamingResponse", - "BrowserCheck", - "AsyncBrowserCheck", - "BrowserCheckWithRawResponse", - "AsyncBrowserCheckWithRawResponse", - "BrowserCheckWithStreamingResponse", - "AsyncBrowserCheckWithStreamingResponse", - "CacheLevel", - "AsyncCacheLevel", - "CacheLevelWithRawResponse", - "AsyncCacheLevelWithRawResponse", - "CacheLevelWithStreamingResponse", - "AsyncCacheLevelWithStreamingResponse", - "ChallengeTTL", - "AsyncChallengeTTL", - "ChallengeTTLWithRawResponse", - "AsyncChallengeTTLWithRawResponse", - "ChallengeTTLWithStreamingResponse", - "AsyncChallengeTTLWithStreamingResponse", - "Ciphers", - "AsyncCiphers", - "CiphersWithRawResponse", - "AsyncCiphersWithRawResponse", - "CiphersWithStreamingResponse", - "AsyncCiphersWithStreamingResponse", - "DevelopmentMode", - "AsyncDevelopmentMode", - "DevelopmentModeWithRawResponse", - "AsyncDevelopmentModeWithRawResponse", - "DevelopmentModeWithStreamingResponse", - "AsyncDevelopmentModeWithStreamingResponse", - "EarlyHints", - "AsyncEarlyHints", - "EarlyHintsWithRawResponse", - "AsyncEarlyHintsWithRawResponse", - "EarlyHintsWithStreamingResponse", - "AsyncEarlyHintsWithStreamingResponse", - "EmailObfuscation", - "AsyncEmailObfuscation", - "EmailObfuscationWithRawResponse", - "AsyncEmailObfuscationWithRawResponse", - "EmailObfuscationWithStreamingResponse", - "AsyncEmailObfuscationWithStreamingResponse", - "H2Prioritization", - "AsyncH2Prioritization", - "H2PrioritizationWithRawResponse", - "AsyncH2PrioritizationWithRawResponse", - "H2PrioritizationWithStreamingResponse", - "AsyncH2PrioritizationWithStreamingResponse", - "HotlinkProtection", - "AsyncHotlinkProtection", - "HotlinkProtectionWithRawResponse", - "AsyncHotlinkProtectionWithRawResponse", - "HotlinkProtectionWithStreamingResponse", - "AsyncHotlinkProtectionWithStreamingResponse", - "HTTP2", - "AsyncHTTP2", - "HTTP2WithRawResponse", - "AsyncHTTP2WithRawResponse", - "HTTP2WithStreamingResponse", - "AsyncHTTP2WithStreamingResponse", - "HTTP3", - "AsyncHTTP3", - "HTTP3WithRawResponse", - "AsyncHTTP3WithRawResponse", - "HTTP3WithStreamingResponse", - "AsyncHTTP3WithStreamingResponse", - "ImageResizing", - "AsyncImageResizing", - "ImageResizingWithRawResponse", - "AsyncImageResizingWithRawResponse", - "ImageResizingWithStreamingResponse", - "AsyncImageResizingWithStreamingResponse", - "IPGeolocation", - "AsyncIPGeolocation", - "IPGeolocationWithRawResponse", - "AsyncIPGeolocationWithRawResponse", - "IPGeolocationWithStreamingResponse", - "AsyncIPGeolocationWithStreamingResponse", - "IPV6", - "AsyncIPV6", - "IPV6WithRawResponse", - "AsyncIPV6WithRawResponse", - "IPV6WithStreamingResponse", - "AsyncIPV6WithStreamingResponse", - "MinTLSVersion", - "AsyncMinTLSVersion", - "MinTLSVersionWithRawResponse", - "AsyncMinTLSVersionWithRawResponse", - "MinTLSVersionWithStreamingResponse", - "AsyncMinTLSVersionWithStreamingResponse", - "Minify", - "AsyncMinify", - "MinifyWithRawResponse", - "AsyncMinifyWithRawResponse", - "MinifyWithStreamingResponse", - "AsyncMinifyWithStreamingResponse", - "Mirage", - "AsyncMirage", - "MirageWithRawResponse", - "AsyncMirageWithRawResponse", - "MirageWithStreamingResponse", - "AsyncMirageWithStreamingResponse", - "MobileRedirect", - "AsyncMobileRedirect", - "MobileRedirectWithRawResponse", - "AsyncMobileRedirectWithRawResponse", - "MobileRedirectWithStreamingResponse", - "AsyncMobileRedirectWithStreamingResponse", - "NEL", - "AsyncNEL", - "NELWithRawResponse", - "AsyncNELWithRawResponse", - "NELWithStreamingResponse", - "AsyncNELWithStreamingResponse", - "OpportunisticEncryption", - "AsyncOpportunisticEncryption", - "OpportunisticEncryptionWithRawResponse", - "AsyncOpportunisticEncryptionWithRawResponse", - "OpportunisticEncryptionWithStreamingResponse", - "AsyncOpportunisticEncryptionWithStreamingResponse", - "OpportunisticOnion", - "AsyncOpportunisticOnion", - "OpportunisticOnionWithRawResponse", - "AsyncOpportunisticOnionWithRawResponse", - "OpportunisticOnionWithStreamingResponse", - "AsyncOpportunisticOnionWithStreamingResponse", - "OrangeToOrange", - "AsyncOrangeToOrange", - "OrangeToOrangeWithRawResponse", - "AsyncOrangeToOrangeWithRawResponse", - "OrangeToOrangeWithStreamingResponse", - "AsyncOrangeToOrangeWithStreamingResponse", - "OriginErrorPagePassThru", - "AsyncOriginErrorPagePassThru", - "OriginErrorPagePassThruWithRawResponse", - "AsyncOriginErrorPagePassThruWithRawResponse", - "OriginErrorPagePassThruWithStreamingResponse", - "AsyncOriginErrorPagePassThruWithStreamingResponse", - "OriginMaxHTTPVersion", - "AsyncOriginMaxHTTPVersion", - "OriginMaxHTTPVersionWithRawResponse", - "AsyncOriginMaxHTTPVersionWithRawResponse", - "OriginMaxHTTPVersionWithStreamingResponse", - "AsyncOriginMaxHTTPVersionWithStreamingResponse", - "Polish", - "AsyncPolish", - "PolishWithRawResponse", - "AsyncPolishWithRawResponse", - "PolishWithStreamingResponse", - "AsyncPolishWithStreamingResponse", - "PrefetchPreload", - "AsyncPrefetchPreload", - "PrefetchPreloadWithRawResponse", - "AsyncPrefetchPreloadWithRawResponse", - "PrefetchPreloadWithStreamingResponse", - "AsyncPrefetchPreloadWithStreamingResponse", - "ProxyReadTimeout", - "AsyncProxyReadTimeout", - "ProxyReadTimeoutWithRawResponse", - "AsyncProxyReadTimeoutWithRawResponse", - "ProxyReadTimeoutWithStreamingResponse", - "AsyncProxyReadTimeoutWithStreamingResponse", - "PseudoIPV4", - "AsyncPseudoIPV4", - "PseudoIPV4WithRawResponse", - "AsyncPseudoIPV4WithRawResponse", - "PseudoIPV4WithStreamingResponse", - "AsyncPseudoIPV4WithStreamingResponse", - "ResponseBuffering", - "AsyncResponseBuffering", - "ResponseBufferingWithRawResponse", - "AsyncResponseBufferingWithRawResponse", - "ResponseBufferingWithStreamingResponse", - "AsyncResponseBufferingWithStreamingResponse", - "RocketLoader", - "AsyncRocketLoader", - "RocketLoaderWithRawResponse", - "AsyncRocketLoaderWithRawResponse", - "RocketLoaderWithStreamingResponse", - "AsyncRocketLoaderWithStreamingResponse", - "SecurityHeaders", - "AsyncSecurityHeaders", - "SecurityHeadersWithRawResponse", - "AsyncSecurityHeadersWithRawResponse", - "SecurityHeadersWithStreamingResponse", - "AsyncSecurityHeadersWithStreamingResponse", - "SecurityLevel", - "AsyncSecurityLevel", - "SecurityLevelWithRawResponse", - "AsyncSecurityLevelWithRawResponse", - "SecurityLevelWithStreamingResponse", - "AsyncSecurityLevelWithStreamingResponse", - "ServerSideExcludes", - "AsyncServerSideExcludes", - "ServerSideExcludesWithRawResponse", - "AsyncServerSideExcludesWithRawResponse", - "ServerSideExcludesWithStreamingResponse", - "AsyncServerSideExcludesWithStreamingResponse", - "SortQueryStringForCache", - "AsyncSortQueryStringForCache", - "SortQueryStringForCacheWithRawResponse", - "AsyncSortQueryStringForCacheWithRawResponse", - "SortQueryStringForCacheWithStreamingResponse", - "AsyncSortQueryStringForCacheWithStreamingResponse", - "SSL", - "AsyncSSL", - "SSLWithRawResponse", - "AsyncSSLWithRawResponse", - "SSLWithStreamingResponse", - "AsyncSSLWithStreamingResponse", - "SSLRecommender", - "AsyncSSLRecommender", - "SSLRecommenderWithRawResponse", - "AsyncSSLRecommenderWithRawResponse", - "SSLRecommenderWithStreamingResponse", - "AsyncSSLRecommenderWithStreamingResponse", - "TLS1_3", - "AsyncTLS1_3", - "TLS1_3WithRawResponse", - "AsyncTLS1_3WithRawResponse", - "TLS1_3WithStreamingResponse", - "AsyncTLS1_3WithStreamingResponse", - "TLSClientAuth", - "AsyncTLSClientAuth", - "TLSClientAuthWithRawResponse", - "AsyncTLSClientAuthWithRawResponse", - "TLSClientAuthWithStreamingResponse", - "AsyncTLSClientAuthWithStreamingResponse", - "TrueClientIPHeader", - "AsyncTrueClientIPHeader", - "TrueClientIPHeaderWithRawResponse", - "AsyncTrueClientIPHeaderWithRawResponse", - "TrueClientIPHeaderWithStreamingResponse", - "AsyncTrueClientIPHeaderWithStreamingResponse", - "WAF", - "AsyncWAF", - "WAFWithRawResponse", - "AsyncWAFWithRawResponse", - "WAFWithStreamingResponse", - "AsyncWAFWithStreamingResponse", - "WebP", - "AsyncWebP", - "WebPWithRawResponse", - "AsyncWebPWithRawResponse", - "WebPWithStreamingResponse", - "AsyncWebPWithStreamingResponse", - "Websocket", - "AsyncWebsocket", - "WebsocketWithRawResponse", - "AsyncWebsocketWithRawResponse", - "WebsocketWithStreamingResponse", - "AsyncWebsocketWithStreamingResponse", - "FontSettings", - "AsyncFontSettings", - "FontSettingsWithRawResponse", - "AsyncFontSettingsWithRawResponse", - "FontSettingsWithStreamingResponse", - "AsyncFontSettingsWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", + "ZeroRTTResource", + "AsyncZeroRTTResource", + "ZeroRTTResourceWithRawResponse", + "AsyncZeroRTTResourceWithRawResponse", + "ZeroRTTResourceWithStreamingResponse", + "AsyncZeroRTTResourceWithStreamingResponse", + "AdvancedDDoSResource", + "AsyncAdvancedDDoSResource", + "AdvancedDDoSResourceWithRawResponse", + "AsyncAdvancedDDoSResourceWithRawResponse", + "AdvancedDDoSResourceWithStreamingResponse", + "AsyncAdvancedDDoSResourceWithStreamingResponse", + "AlwaysOnlineResource", + "AsyncAlwaysOnlineResource", + "AlwaysOnlineResourceWithRawResponse", + "AsyncAlwaysOnlineResourceWithRawResponse", + "AlwaysOnlineResourceWithStreamingResponse", + "AsyncAlwaysOnlineResourceWithStreamingResponse", + "AlwaysUseHTTPSResource", + "AsyncAlwaysUseHTTPSResource", + "AlwaysUseHTTPSResourceWithRawResponse", + "AsyncAlwaysUseHTTPSResourceWithRawResponse", + "AlwaysUseHTTPSResourceWithStreamingResponse", + "AsyncAlwaysUseHTTPSResourceWithStreamingResponse", + "AutomaticHTTPSRewritesResource", + "AsyncAutomaticHTTPSRewritesResource", + "AutomaticHTTPSRewritesResourceWithRawResponse", + "AsyncAutomaticHTTPSRewritesResourceWithRawResponse", + "AutomaticHTTPSRewritesResourceWithStreamingResponse", + "AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse", + "AutomaticPlatformOptimizationResource", + "AsyncAutomaticPlatformOptimizationResource", + "AutomaticPlatformOptimizationResourceWithRawResponse", + "AsyncAutomaticPlatformOptimizationResourceWithRawResponse", + "AutomaticPlatformOptimizationResourceWithStreamingResponse", + "AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse", + "BrotliResource", + "AsyncBrotliResource", + "BrotliResourceWithRawResponse", + "AsyncBrotliResourceWithRawResponse", + "BrotliResourceWithStreamingResponse", + "AsyncBrotliResourceWithStreamingResponse", + "BrowserCacheTTLResource", + "AsyncBrowserCacheTTLResource", + "BrowserCacheTTLResourceWithRawResponse", + "AsyncBrowserCacheTTLResourceWithRawResponse", + "BrowserCacheTTLResourceWithStreamingResponse", + "AsyncBrowserCacheTTLResourceWithStreamingResponse", + "BrowserCheckResource", + "AsyncBrowserCheckResource", + "BrowserCheckResourceWithRawResponse", + "AsyncBrowserCheckResourceWithRawResponse", + "BrowserCheckResourceWithStreamingResponse", + "AsyncBrowserCheckResourceWithStreamingResponse", + "CacheLevelResource", + "AsyncCacheLevelResource", + "CacheLevelResourceWithRawResponse", + "AsyncCacheLevelResourceWithRawResponse", + "CacheLevelResourceWithStreamingResponse", + "AsyncCacheLevelResourceWithStreamingResponse", + "ChallengeTTLResource", + "AsyncChallengeTTLResource", + "ChallengeTTLResourceWithRawResponse", + "AsyncChallengeTTLResourceWithRawResponse", + "ChallengeTTLResourceWithStreamingResponse", + "AsyncChallengeTTLResourceWithStreamingResponse", + "CiphersResource", + "AsyncCiphersResource", + "CiphersResourceWithRawResponse", + "AsyncCiphersResourceWithRawResponse", + "CiphersResourceWithStreamingResponse", + "AsyncCiphersResourceWithStreamingResponse", + "DevelopmentModeResource", + "AsyncDevelopmentModeResource", + "DevelopmentModeResourceWithRawResponse", + "AsyncDevelopmentModeResourceWithRawResponse", + "DevelopmentModeResourceWithStreamingResponse", + "AsyncDevelopmentModeResourceWithStreamingResponse", + "EarlyHintsResource", + "AsyncEarlyHintsResource", + "EarlyHintsResourceWithRawResponse", + "AsyncEarlyHintsResourceWithRawResponse", + "EarlyHintsResourceWithStreamingResponse", + "AsyncEarlyHintsResourceWithStreamingResponse", + "EmailObfuscationResource", + "AsyncEmailObfuscationResource", + "EmailObfuscationResourceWithRawResponse", + "AsyncEmailObfuscationResourceWithRawResponse", + "EmailObfuscationResourceWithStreamingResponse", + "AsyncEmailObfuscationResourceWithStreamingResponse", + "H2PrioritizationResource", + "AsyncH2PrioritizationResource", + "H2PrioritizationResourceWithRawResponse", + "AsyncH2PrioritizationResourceWithRawResponse", + "H2PrioritizationResourceWithStreamingResponse", + "AsyncH2PrioritizationResourceWithStreamingResponse", + "HotlinkProtectionResource", + "AsyncHotlinkProtectionResource", + "HotlinkProtectionResourceWithRawResponse", + "AsyncHotlinkProtectionResourceWithRawResponse", + "HotlinkProtectionResourceWithStreamingResponse", + "AsyncHotlinkProtectionResourceWithStreamingResponse", + "HTTP2Resource", + "AsyncHTTP2Resource", + "HTTP2ResourceWithRawResponse", + "AsyncHTTP2ResourceWithRawResponse", + "HTTP2ResourceWithStreamingResponse", + "AsyncHTTP2ResourceWithStreamingResponse", + "HTTP3Resource", + "AsyncHTTP3Resource", + "HTTP3ResourceWithRawResponse", + "AsyncHTTP3ResourceWithRawResponse", + "HTTP3ResourceWithStreamingResponse", + "AsyncHTTP3ResourceWithStreamingResponse", + "ImageResizingResource", + "AsyncImageResizingResource", + "ImageResizingResourceWithRawResponse", + "AsyncImageResizingResourceWithRawResponse", + "ImageResizingResourceWithStreamingResponse", + "AsyncImageResizingResourceWithStreamingResponse", + "IPGeolocationResource", + "AsyncIPGeolocationResource", + "IPGeolocationResourceWithRawResponse", + "AsyncIPGeolocationResourceWithRawResponse", + "IPGeolocationResourceWithStreamingResponse", + "AsyncIPGeolocationResourceWithStreamingResponse", + "IPV6Resource", + "AsyncIPV6Resource", + "IPV6ResourceWithRawResponse", + "AsyncIPV6ResourceWithRawResponse", + "IPV6ResourceWithStreamingResponse", + "AsyncIPV6ResourceWithStreamingResponse", + "MinTLSVersionResource", + "AsyncMinTLSVersionResource", + "MinTLSVersionResourceWithRawResponse", + "AsyncMinTLSVersionResourceWithRawResponse", + "MinTLSVersionResourceWithStreamingResponse", + "AsyncMinTLSVersionResourceWithStreamingResponse", + "MinifyResource", + "AsyncMinifyResource", + "MinifyResourceWithRawResponse", + "AsyncMinifyResourceWithRawResponse", + "MinifyResourceWithStreamingResponse", + "AsyncMinifyResourceWithStreamingResponse", + "MirageResource", + "AsyncMirageResource", + "MirageResourceWithRawResponse", + "AsyncMirageResourceWithRawResponse", + "MirageResourceWithStreamingResponse", + "AsyncMirageResourceWithStreamingResponse", + "MobileRedirectResource", + "AsyncMobileRedirectResource", + "MobileRedirectResourceWithRawResponse", + "AsyncMobileRedirectResourceWithRawResponse", + "MobileRedirectResourceWithStreamingResponse", + "AsyncMobileRedirectResourceWithStreamingResponse", + "NELResource", + "AsyncNELResource", + "NELResourceWithRawResponse", + "AsyncNELResourceWithRawResponse", + "NELResourceWithStreamingResponse", + "AsyncNELResourceWithStreamingResponse", + "OpportunisticEncryptionResource", + "AsyncOpportunisticEncryptionResource", + "OpportunisticEncryptionResourceWithRawResponse", + "AsyncOpportunisticEncryptionResourceWithRawResponse", + "OpportunisticEncryptionResourceWithStreamingResponse", + "AsyncOpportunisticEncryptionResourceWithStreamingResponse", + "OpportunisticOnionResource", + "AsyncOpportunisticOnionResource", + "OpportunisticOnionResourceWithRawResponse", + "AsyncOpportunisticOnionResourceWithRawResponse", + "OpportunisticOnionResourceWithStreamingResponse", + "AsyncOpportunisticOnionResourceWithStreamingResponse", + "OrangeToOrangeResource", + "AsyncOrangeToOrangeResource", + "OrangeToOrangeResourceWithRawResponse", + "AsyncOrangeToOrangeResourceWithRawResponse", + "OrangeToOrangeResourceWithStreamingResponse", + "AsyncOrangeToOrangeResourceWithStreamingResponse", + "OriginErrorPagePassThruResource", + "AsyncOriginErrorPagePassThruResource", + "OriginErrorPagePassThruResourceWithRawResponse", + "AsyncOriginErrorPagePassThruResourceWithRawResponse", + "OriginErrorPagePassThruResourceWithStreamingResponse", + "AsyncOriginErrorPagePassThruResourceWithStreamingResponse", + "OriginMaxHTTPVersionResource", + "AsyncOriginMaxHTTPVersionResource", + "OriginMaxHTTPVersionResourceWithRawResponse", + "AsyncOriginMaxHTTPVersionResourceWithRawResponse", + "OriginMaxHTTPVersionResourceWithStreamingResponse", + "AsyncOriginMaxHTTPVersionResourceWithStreamingResponse", + "PolishResource", + "AsyncPolishResource", + "PolishResourceWithRawResponse", + "AsyncPolishResourceWithRawResponse", + "PolishResourceWithStreamingResponse", + "AsyncPolishResourceWithStreamingResponse", + "PrefetchPreloadResource", + "AsyncPrefetchPreloadResource", + "PrefetchPreloadResourceWithRawResponse", + "AsyncPrefetchPreloadResourceWithRawResponse", + "PrefetchPreloadResourceWithStreamingResponse", + "AsyncPrefetchPreloadResourceWithStreamingResponse", + "ProxyReadTimeoutResource", + "AsyncProxyReadTimeoutResource", + "ProxyReadTimeoutResourceWithRawResponse", + "AsyncProxyReadTimeoutResourceWithRawResponse", + "ProxyReadTimeoutResourceWithStreamingResponse", + "AsyncProxyReadTimeoutResourceWithStreamingResponse", + "PseudoIPV4Resource", + "AsyncPseudoIPV4Resource", + "PseudoIPV4ResourceWithRawResponse", + "AsyncPseudoIPV4ResourceWithRawResponse", + "PseudoIPV4ResourceWithStreamingResponse", + "AsyncPseudoIPV4ResourceWithStreamingResponse", + "ResponseBufferingResource", + "AsyncResponseBufferingResource", + "ResponseBufferingResourceWithRawResponse", + "AsyncResponseBufferingResourceWithRawResponse", + "ResponseBufferingResourceWithStreamingResponse", + "AsyncResponseBufferingResourceWithStreamingResponse", + "RocketLoaderResource", + "AsyncRocketLoaderResource", + "RocketLoaderResourceWithRawResponse", + "AsyncRocketLoaderResourceWithRawResponse", + "RocketLoaderResourceWithStreamingResponse", + "AsyncRocketLoaderResourceWithStreamingResponse", + "SecurityHeadersResource", + "AsyncSecurityHeadersResource", + "SecurityHeadersResourceWithRawResponse", + "AsyncSecurityHeadersResourceWithRawResponse", + "SecurityHeadersResourceWithStreamingResponse", + "AsyncSecurityHeadersResourceWithStreamingResponse", + "SecurityLevelResource", + "AsyncSecurityLevelResource", + "SecurityLevelResourceWithRawResponse", + "AsyncSecurityLevelResourceWithRawResponse", + "SecurityLevelResourceWithStreamingResponse", + "AsyncSecurityLevelResourceWithStreamingResponse", + "ServerSideExcludesResource", + "AsyncServerSideExcludesResource", + "ServerSideExcludesResourceWithRawResponse", + "AsyncServerSideExcludesResourceWithRawResponse", + "ServerSideExcludesResourceWithStreamingResponse", + "AsyncServerSideExcludesResourceWithStreamingResponse", + "SortQueryStringForCacheResource", + "AsyncSortQueryStringForCacheResource", + "SortQueryStringForCacheResourceWithRawResponse", + "AsyncSortQueryStringForCacheResourceWithRawResponse", + "SortQueryStringForCacheResourceWithStreamingResponse", + "AsyncSortQueryStringForCacheResourceWithStreamingResponse", + "SSLResource", + "AsyncSSLResource", + "SSLResourceWithRawResponse", + "AsyncSSLResourceWithRawResponse", + "SSLResourceWithStreamingResponse", + "AsyncSSLResourceWithStreamingResponse", + "SSLRecommenderResource", + "AsyncSSLRecommenderResource", + "SSLRecommenderResourceWithRawResponse", + "AsyncSSLRecommenderResourceWithRawResponse", + "SSLRecommenderResourceWithStreamingResponse", + "AsyncSSLRecommenderResourceWithStreamingResponse", + "TLS1_3Resource", + "AsyncTLS1_3Resource", + "TLS1_3ResourceWithRawResponse", + "AsyncTLS1_3ResourceWithRawResponse", + "TLS1_3ResourceWithStreamingResponse", + "AsyncTLS1_3ResourceWithStreamingResponse", + "TLSClientAuthResource", + "AsyncTLSClientAuthResource", + "TLSClientAuthResourceWithRawResponse", + "AsyncTLSClientAuthResourceWithRawResponse", + "TLSClientAuthResourceWithStreamingResponse", + "AsyncTLSClientAuthResourceWithStreamingResponse", + "TrueClientIPHeaderResource", + "AsyncTrueClientIPHeaderResource", + "TrueClientIPHeaderResourceWithRawResponse", + "AsyncTrueClientIPHeaderResourceWithRawResponse", + "TrueClientIPHeaderResourceWithStreamingResponse", + "AsyncTrueClientIPHeaderResourceWithStreamingResponse", + "WAFResource", + "AsyncWAFResource", + "WAFResourceWithRawResponse", + "AsyncWAFResourceWithRawResponse", + "WAFResourceWithStreamingResponse", + "AsyncWAFResourceWithStreamingResponse", + "WebPResource", + "AsyncWebPResource", + "WebPResourceWithRawResponse", + "AsyncWebPResourceWithRawResponse", + "WebPResourceWithStreamingResponse", + "AsyncWebPResourceWithStreamingResponse", + "WebsocketResource", + "AsyncWebsocketResource", + "WebsocketResourceWithRawResponse", + "AsyncWebsocketResourceWithRawResponse", + "WebsocketResourceWithStreamingResponse", + "AsyncWebsocketResourceWithStreamingResponse", + "FontSettingsResource", + "AsyncFontSettingsResource", + "FontSettingsResourceWithRawResponse", + "AsyncFontSettingsResourceWithRawResponse", + "FontSettingsResourceWithStreamingResponse", + "AsyncFontSettingsResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/zones/settings/advanced_ddos.py b/src/cloudflare/resources/zones/settings/advanced_ddos.py index 824148d44d0..0b862955cf6 100644 --- a/src/cloudflare/resources/zones/settings/advanced_ddos.py +++ b/src/cloudflare/resources/zones/settings/advanced_ddos.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingAdvancedDDoS +from ....types.zones.settings.advanced_ddos import AdvancedDDoS -__all__ = ["AdvancedDDoS", "AsyncAdvancedDDoS"] +__all__ = ["AdvancedDDoSResource", "AsyncAdvancedDDoSResource"] -class AdvancedDDoS(SyncAPIResource): +class AdvancedDDoSResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AdvancedDDoSWithRawResponse: - return AdvancedDDoSWithRawResponse(self) + def with_raw_response(self) -> AdvancedDDoSResourceWithRawResponse: + return AdvancedDDoSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AdvancedDDoSWithStreamingResponse: - return AdvancedDDoSWithStreamingResponse(self) + def with_streaming_response(self) -> AdvancedDDoSResourceWithStreamingResponse: + return AdvancedDDoSResourceWithStreamingResponse(self) def get( self, @@ -43,7 +43,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAdvancedDDoS]: + ) -> Optional[AdvancedDDoS]: """ Advanced protection from Distributed Denial of Service (DDoS) attacks on your website. This is an uneditable value that is 'on' in the case of Business and @@ -69,20 +69,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AdvancedDDoS]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAdvancedDDoS]], ResultWrapper[ZoneSettingAdvancedDDoS]), + cast_to=cast(Type[Optional[AdvancedDDoS]], ResultWrapper[AdvancedDDoS]), ) -class AsyncAdvancedDDoS(AsyncAPIResource): +class AsyncAdvancedDDoSResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAdvancedDDoSWithRawResponse: - return AsyncAdvancedDDoSWithRawResponse(self) + def with_raw_response(self) -> AsyncAdvancedDDoSResourceWithRawResponse: + return AsyncAdvancedDDoSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAdvancedDDoSWithStreamingResponse: - return AsyncAdvancedDDoSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAdvancedDDoSResourceWithStreamingResponse: + return AsyncAdvancedDDoSResourceWithStreamingResponse(self) async def get( self, @@ -94,7 +94,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAdvancedDDoS]: + ) -> Optional[AdvancedDDoS]: """ Advanced protection from Distributed Denial of Service (DDoS) attacks on your website. This is an uneditable value that is 'on' in the case of Business and @@ -120,14 +120,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AdvancedDDoS]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAdvancedDDoS]], ResultWrapper[ZoneSettingAdvancedDDoS]), + cast_to=cast(Type[Optional[AdvancedDDoS]], ResultWrapper[AdvancedDDoS]), ) -class AdvancedDDoSWithRawResponse: - def __init__(self, advanced_ddos: AdvancedDDoS) -> None: +class AdvancedDDoSResourceWithRawResponse: + def __init__(self, advanced_ddos: AdvancedDDoSResource) -> None: self._advanced_ddos = advanced_ddos self.get = to_raw_response_wrapper( @@ -135,8 +135,8 @@ def __init__(self, advanced_ddos: AdvancedDDoS) -> None: ) -class AsyncAdvancedDDoSWithRawResponse: - def __init__(self, advanced_ddos: AsyncAdvancedDDoS) -> None: +class AsyncAdvancedDDoSResourceWithRawResponse: + def __init__(self, advanced_ddos: AsyncAdvancedDDoSResource) -> None: self._advanced_ddos = advanced_ddos self.get = async_to_raw_response_wrapper( @@ -144,8 +144,8 @@ def __init__(self, advanced_ddos: AsyncAdvancedDDoS) -> None: ) -class AdvancedDDoSWithStreamingResponse: - def __init__(self, advanced_ddos: AdvancedDDoS) -> None: +class AdvancedDDoSResourceWithStreamingResponse: + def __init__(self, advanced_ddos: AdvancedDDoSResource) -> None: self._advanced_ddos = advanced_ddos self.get = to_streamed_response_wrapper( @@ -153,8 +153,8 @@ def __init__(self, advanced_ddos: AdvancedDDoS) -> None: ) -class AsyncAdvancedDDoSWithStreamingResponse: - def __init__(self, advanced_ddos: AsyncAdvancedDDoS) -> None: +class AsyncAdvancedDDoSResourceWithStreamingResponse: + def __init__(self, advanced_ddos: AsyncAdvancedDDoSResource) -> None: self._advanced_ddos = advanced_ddos self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/always_online.py b/src/cloudflare/resources/zones/settings/always_online.py index 83205d34902..df0c7324373 100644 --- a/src/cloudflare/resources/zones/settings/always_online.py +++ b/src/cloudflare/resources/zones/settings/always_online.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingAlwaysOnline, always_online_edit_params +from ....types.zones.settings import always_online_edit_params +from ....types.zones.settings.always_online import AlwaysOnline -__all__ = ["AlwaysOnline", "AsyncAlwaysOnline"] +__all__ = ["AlwaysOnlineResource", "AsyncAlwaysOnlineResource"] -class AlwaysOnline(SyncAPIResource): +class AlwaysOnlineResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AlwaysOnlineWithRawResponse: - return AlwaysOnlineWithRawResponse(self) + def with_raw_response(self) -> AlwaysOnlineResourceWithRawResponse: + return AlwaysOnlineResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AlwaysOnlineWithStreamingResponse: - return AlwaysOnlineWithStreamingResponse(self) + def with_streaming_response(self) -> AlwaysOnlineResourceWithStreamingResponse: + return AlwaysOnlineResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAlwaysOnline]: + ) -> Optional[AlwaysOnline]: """ When enabled, Cloudflare serves limited copies of web pages available from the [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is @@ -80,9 +81,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AlwaysOnline]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAlwaysOnline]], ResultWrapper[ZoneSettingAlwaysOnline]), + cast_to=cast(Type[Optional[AlwaysOnline]], ResultWrapper[AlwaysOnline]), ) def get( @@ -95,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAlwaysOnline]: + ) -> Optional[AlwaysOnline]: """ When enabled, Cloudflare serves limited copies of web pages available from the [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is @@ -123,20 +124,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AlwaysOnline]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAlwaysOnline]], ResultWrapper[ZoneSettingAlwaysOnline]), + cast_to=cast(Type[Optional[AlwaysOnline]], ResultWrapper[AlwaysOnline]), ) -class AsyncAlwaysOnline(AsyncAPIResource): +class AsyncAlwaysOnlineResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAlwaysOnlineWithRawResponse: - return AsyncAlwaysOnlineWithRawResponse(self) + def with_raw_response(self) -> AsyncAlwaysOnlineResourceWithRawResponse: + return AsyncAlwaysOnlineResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAlwaysOnlineWithStreamingResponse: - return AsyncAlwaysOnlineWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAlwaysOnlineResourceWithStreamingResponse: + return AsyncAlwaysOnlineResourceWithStreamingResponse(self) async def edit( self, @@ -149,7 +150,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAlwaysOnline]: + ) -> Optional[AlwaysOnline]: """ When enabled, Cloudflare serves limited copies of web pages available from the [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is @@ -180,9 +181,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AlwaysOnline]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAlwaysOnline]], ResultWrapper[ZoneSettingAlwaysOnline]), + cast_to=cast(Type[Optional[AlwaysOnline]], ResultWrapper[AlwaysOnline]), ) async def get( @@ -195,7 +196,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAlwaysOnline]: + ) -> Optional[AlwaysOnline]: """ When enabled, Cloudflare serves limited copies of web pages available from the [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is @@ -223,14 +224,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AlwaysOnline]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAlwaysOnline]], ResultWrapper[ZoneSettingAlwaysOnline]), + cast_to=cast(Type[Optional[AlwaysOnline]], ResultWrapper[AlwaysOnline]), ) -class AlwaysOnlineWithRawResponse: - def __init__(self, always_online: AlwaysOnline) -> None: +class AlwaysOnlineResourceWithRawResponse: + def __init__(self, always_online: AlwaysOnlineResource) -> None: self._always_online = always_online self.edit = to_raw_response_wrapper( @@ -241,8 +242,8 @@ def __init__(self, always_online: AlwaysOnline) -> None: ) -class AsyncAlwaysOnlineWithRawResponse: - def __init__(self, always_online: AsyncAlwaysOnline) -> None: +class AsyncAlwaysOnlineResourceWithRawResponse: + def __init__(self, always_online: AsyncAlwaysOnlineResource) -> None: self._always_online = always_online self.edit = async_to_raw_response_wrapper( @@ -253,8 +254,8 @@ def __init__(self, always_online: AsyncAlwaysOnline) -> None: ) -class AlwaysOnlineWithStreamingResponse: - def __init__(self, always_online: AlwaysOnline) -> None: +class AlwaysOnlineResourceWithStreamingResponse: + def __init__(self, always_online: AlwaysOnlineResource) -> None: self._always_online = always_online self.edit = to_streamed_response_wrapper( @@ -265,8 +266,8 @@ def __init__(self, always_online: AlwaysOnline) -> None: ) -class AsyncAlwaysOnlineWithStreamingResponse: - def __init__(self, always_online: AsyncAlwaysOnline) -> None: +class AsyncAlwaysOnlineResourceWithStreamingResponse: + def __init__(self, always_online: AsyncAlwaysOnlineResource) -> None: self._always_online = always_online self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/always_use_https.py b/src/cloudflare/resources/zones/settings/always_use_https.py index e0f3523f82d..3e9a208f93d 100644 --- a/src/cloudflare/resources/zones/settings/always_use_https.py +++ b/src/cloudflare/resources/zones/settings/always_use_https.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingAlwaysUseHTTPS, always_use_https_edit_params +from ....types.zones.settings import always_use_https_edit_params +from ....types.zones.settings.always_use_https import AlwaysUseHTTPS -__all__ = ["AlwaysUseHTTPS", "AsyncAlwaysUseHTTPS"] +__all__ = ["AlwaysUseHTTPSResource", "AsyncAlwaysUseHTTPSResource"] -class AlwaysUseHTTPS(SyncAPIResource): +class AlwaysUseHTTPSResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AlwaysUseHTTPSWithRawResponse: - return AlwaysUseHTTPSWithRawResponse(self) + def with_raw_response(self) -> AlwaysUseHTTPSResourceWithRawResponse: + return AlwaysUseHTTPSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AlwaysUseHTTPSWithStreamingResponse: - return AlwaysUseHTTPSWithStreamingResponse(self) + def with_streaming_response(self) -> AlwaysUseHTTPSResourceWithStreamingResponse: + return AlwaysUseHTTPSResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAlwaysUseHTTPS]: + ) -> Optional[AlwaysUseHTTPS]: """ Reply to all requests for URLs that use "http" with a 301 redirect to the equivalent "https" URL. If you only want to redirect for a subset of requests, @@ -78,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AlwaysUseHTTPS]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAlwaysUseHTTPS]], ResultWrapper[ZoneSettingAlwaysUseHTTPS]), + cast_to=cast(Type[Optional[AlwaysUseHTTPS]], ResultWrapper[AlwaysUseHTTPS]), ) def get( @@ -93,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAlwaysUseHTTPS]: + ) -> Optional[AlwaysUseHTTPS]: """ Reply to all requests for URLs that use "http" with a 301 redirect to the equivalent "https" URL. If you only want to redirect for a subset of requests, @@ -119,20 +120,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AlwaysUseHTTPS]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAlwaysUseHTTPS]], ResultWrapper[ZoneSettingAlwaysUseHTTPS]), + cast_to=cast(Type[Optional[AlwaysUseHTTPS]], ResultWrapper[AlwaysUseHTTPS]), ) -class AsyncAlwaysUseHTTPS(AsyncAPIResource): +class AsyncAlwaysUseHTTPSResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAlwaysUseHTTPSWithRawResponse: - return AsyncAlwaysUseHTTPSWithRawResponse(self) + def with_raw_response(self) -> AsyncAlwaysUseHTTPSResourceWithRawResponse: + return AsyncAlwaysUseHTTPSResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAlwaysUseHTTPSWithStreamingResponse: - return AsyncAlwaysUseHTTPSWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAlwaysUseHTTPSResourceWithStreamingResponse: + return AsyncAlwaysUseHTTPSResourceWithStreamingResponse(self) async def edit( self, @@ -145,7 +146,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAlwaysUseHTTPS]: + ) -> Optional[AlwaysUseHTTPS]: """ Reply to all requests for URLs that use "http" with a 301 redirect to the equivalent "https" URL. If you only want to redirect for a subset of requests, @@ -174,9 +175,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AlwaysUseHTTPS]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAlwaysUseHTTPS]], ResultWrapper[ZoneSettingAlwaysUseHTTPS]), + cast_to=cast(Type[Optional[AlwaysUseHTTPS]], ResultWrapper[AlwaysUseHTTPS]), ) async def get( @@ -189,7 +190,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAlwaysUseHTTPS]: + ) -> Optional[AlwaysUseHTTPS]: """ Reply to all requests for URLs that use "http" with a 301 redirect to the equivalent "https" URL. If you only want to redirect for a subset of requests, @@ -215,14 +216,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[AlwaysUseHTTPS]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingAlwaysUseHTTPS]], ResultWrapper[ZoneSettingAlwaysUseHTTPS]), + cast_to=cast(Type[Optional[AlwaysUseHTTPS]], ResultWrapper[AlwaysUseHTTPS]), ) -class AlwaysUseHTTPSWithRawResponse: - def __init__(self, always_use_https: AlwaysUseHTTPS) -> None: +class AlwaysUseHTTPSResourceWithRawResponse: + def __init__(self, always_use_https: AlwaysUseHTTPSResource) -> None: self._always_use_https = always_use_https self.edit = to_raw_response_wrapper( @@ -233,8 +234,8 @@ def __init__(self, always_use_https: AlwaysUseHTTPS) -> None: ) -class AsyncAlwaysUseHTTPSWithRawResponse: - def __init__(self, always_use_https: AsyncAlwaysUseHTTPS) -> None: +class AsyncAlwaysUseHTTPSResourceWithRawResponse: + def __init__(self, always_use_https: AsyncAlwaysUseHTTPSResource) -> None: self._always_use_https = always_use_https self.edit = async_to_raw_response_wrapper( @@ -245,8 +246,8 @@ def __init__(self, always_use_https: AsyncAlwaysUseHTTPS) -> None: ) -class AlwaysUseHTTPSWithStreamingResponse: - def __init__(self, always_use_https: AlwaysUseHTTPS) -> None: +class AlwaysUseHTTPSResourceWithStreamingResponse: + def __init__(self, always_use_https: AlwaysUseHTTPSResource) -> None: self._always_use_https = always_use_https self.edit = to_streamed_response_wrapper( @@ -257,8 +258,8 @@ def __init__(self, always_use_https: AlwaysUseHTTPS) -> None: ) -class AsyncAlwaysUseHTTPSWithStreamingResponse: - def __init__(self, always_use_https: AsyncAlwaysUseHTTPS) -> None: +class AsyncAlwaysUseHTTPSResourceWithStreamingResponse: + def __init__(self, always_use_https: AsyncAlwaysUseHTTPSResource) -> None: self._always_use_https = always_use_https self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/automatic_https_rewrites.py b/src/cloudflare/resources/zones/settings/automatic_https_rewrites.py index 2950a699243..329edb96881 100644 --- a/src/cloudflare/resources/zones/settings/automatic_https_rewrites.py +++ b/src/cloudflare/resources/zones/settings/automatic_https_rewrites.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingAutomaticHTTPSRewrites, automatic_https_rewrite_edit_params +from ....types.zones.settings import automatic_https_rewrite_edit_params +from ....types.zones.settings.automatic_https_rewrites import AutomaticHTTPSRewrites -__all__ = ["AutomaticHTTPSRewrites", "AsyncAutomaticHTTPSRewrites"] +__all__ = ["AutomaticHTTPSRewritesResource", "AsyncAutomaticHTTPSRewritesResource"] -class AutomaticHTTPSRewrites(SyncAPIResource): +class AutomaticHTTPSRewritesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AutomaticHTTPSRewritesWithRawResponse: - return AutomaticHTTPSRewritesWithRawResponse(self) + def with_raw_response(self) -> AutomaticHTTPSRewritesResourceWithRawResponse: + return AutomaticHTTPSRewritesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AutomaticHTTPSRewritesWithStreamingResponse: - return AutomaticHTTPSRewritesWithStreamingResponse(self) + def with_streaming_response(self) -> AutomaticHTTPSRewritesResourceWithStreamingResponse: + return AutomaticHTTPSRewritesResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAutomaticHTTPSRewrites]: + ) -> Optional[AutomaticHTTPSRewrites]: """ Enable the Automatic HTTPS Rewrites feature for this zone. @@ -77,11 +78,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingAutomaticHTTPSRewrites]], ResultWrapper[ZoneSettingAutomaticHTTPSRewrites] + post_parser=ResultWrapper[Optional[AutomaticHTTPSRewrites]]._unwrapper, ), + cast_to=cast(Type[Optional[AutomaticHTTPSRewrites]], ResultWrapper[AutomaticHTTPSRewrites]), ) def get( @@ -94,7 +93,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAutomaticHTTPSRewrites]: + ) -> Optional[AutomaticHTTPSRewrites]: """ Enable the Automatic HTTPS Rewrites feature for this zone. @@ -118,22 +117,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingAutomaticHTTPSRewrites]], ResultWrapper[ZoneSettingAutomaticHTTPSRewrites] + post_parser=ResultWrapper[Optional[AutomaticHTTPSRewrites]]._unwrapper, ), + cast_to=cast(Type[Optional[AutomaticHTTPSRewrites]], ResultWrapper[AutomaticHTTPSRewrites]), ) -class AsyncAutomaticHTTPSRewrites(AsyncAPIResource): +class AsyncAutomaticHTTPSRewritesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAutomaticHTTPSRewritesWithRawResponse: - return AsyncAutomaticHTTPSRewritesWithRawResponse(self) + def with_raw_response(self) -> AsyncAutomaticHTTPSRewritesResourceWithRawResponse: + return AsyncAutomaticHTTPSRewritesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAutomaticHTTPSRewritesWithStreamingResponse: - return AsyncAutomaticHTTPSRewritesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse: + return AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse(self) async def edit( self, @@ -146,7 +143,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAutomaticHTTPSRewrites]: + ) -> Optional[AutomaticHTTPSRewrites]: """ Enable the Automatic HTTPS Rewrites feature for this zone. @@ -176,11 +173,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingAutomaticHTTPSRewrites]], ResultWrapper[ZoneSettingAutomaticHTTPSRewrites] + post_parser=ResultWrapper[Optional[AutomaticHTTPSRewrites]]._unwrapper, ), + cast_to=cast(Type[Optional[AutomaticHTTPSRewrites]], ResultWrapper[AutomaticHTTPSRewrites]), ) async def get( @@ -193,7 +188,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAutomaticHTTPSRewrites]: + ) -> Optional[AutomaticHTTPSRewrites]: """ Enable the Automatic HTTPS Rewrites feature for this zone. @@ -217,16 +212,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingAutomaticHTTPSRewrites]], ResultWrapper[ZoneSettingAutomaticHTTPSRewrites] + post_parser=ResultWrapper[Optional[AutomaticHTTPSRewrites]]._unwrapper, ), + cast_to=cast(Type[Optional[AutomaticHTTPSRewrites]], ResultWrapper[AutomaticHTTPSRewrites]), ) -class AutomaticHTTPSRewritesWithRawResponse: - def __init__(self, automatic_https_rewrites: AutomaticHTTPSRewrites) -> None: +class AutomaticHTTPSRewritesResourceWithRawResponse: + def __init__(self, automatic_https_rewrites: AutomaticHTTPSRewritesResource) -> None: self._automatic_https_rewrites = automatic_https_rewrites self.edit = to_raw_response_wrapper( @@ -237,8 +230,8 @@ def __init__(self, automatic_https_rewrites: AutomaticHTTPSRewrites) -> None: ) -class AsyncAutomaticHTTPSRewritesWithRawResponse: - def __init__(self, automatic_https_rewrites: AsyncAutomaticHTTPSRewrites) -> None: +class AsyncAutomaticHTTPSRewritesResourceWithRawResponse: + def __init__(self, automatic_https_rewrites: AsyncAutomaticHTTPSRewritesResource) -> None: self._automatic_https_rewrites = automatic_https_rewrites self.edit = async_to_raw_response_wrapper( @@ -249,8 +242,8 @@ def __init__(self, automatic_https_rewrites: AsyncAutomaticHTTPSRewrites) -> Non ) -class AutomaticHTTPSRewritesWithStreamingResponse: - def __init__(self, automatic_https_rewrites: AutomaticHTTPSRewrites) -> None: +class AutomaticHTTPSRewritesResourceWithStreamingResponse: + def __init__(self, automatic_https_rewrites: AutomaticHTTPSRewritesResource) -> None: self._automatic_https_rewrites = automatic_https_rewrites self.edit = to_streamed_response_wrapper( @@ -261,8 +254,8 @@ def __init__(self, automatic_https_rewrites: AutomaticHTTPSRewrites) -> None: ) -class AsyncAutomaticHTTPSRewritesWithStreamingResponse: - def __init__(self, automatic_https_rewrites: AsyncAutomaticHTTPSRewrites) -> None: +class AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse: + def __init__(self, automatic_https_rewrites: AsyncAutomaticHTTPSRewritesResource) -> None: self._automatic_https_rewrites = automatic_https_rewrites self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/automatic_platform_optimization.py b/src/cloudflare/resources/zones/settings/automatic_platform_optimization.py index c8f97509389..5bb239a25aa 100644 --- a/src/cloudflare/resources/zones/settings/automatic_platform_optimization.py +++ b/src/cloudflare/resources/zones/settings/automatic_platform_optimization.py @@ -23,36 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ( - ZoneSettingAutomaticPlatformOptimization, - ZoneSettingAutomaticPlatformOptimizationParam, - automatic_platform_optimization_edit_params, -) +from ....types.zones.settings import AutomaticPlatformOptimization, automatic_platform_optimization_edit_params +from ....types.zones.settings.automatic_platform_optimization import AutomaticPlatformOptimization +from ....types.zones.settings.automatic_platform_optimization_param import AutomaticPlatformOptimizationParam -__all__ = ["AutomaticPlatformOptimization", "AsyncAutomaticPlatformOptimization"] +__all__ = ["AutomaticPlatformOptimizationResource", "AsyncAutomaticPlatformOptimizationResource"] -class AutomaticPlatformOptimization(SyncAPIResource): +class AutomaticPlatformOptimizationResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AutomaticPlatformOptimizationWithRawResponse: - return AutomaticPlatformOptimizationWithRawResponse(self) + def with_raw_response(self) -> AutomaticPlatformOptimizationResourceWithRawResponse: + return AutomaticPlatformOptimizationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AutomaticPlatformOptimizationWithStreamingResponse: - return AutomaticPlatformOptimizationWithStreamingResponse(self) + def with_streaming_response(self) -> AutomaticPlatformOptimizationResourceWithStreamingResponse: + return AutomaticPlatformOptimizationResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingAutomaticPlatformOptimizationParam, + value: AutomaticPlatformOptimizationParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingAutomaticPlatformOptimization]: + ) -> Optional[AutomaticPlatformOptimization]: """ [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) serves your WordPress site from Cloudflare's edge network and caches third-party @@ -81,12 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingAutomaticPlatformOptimization]], - ResultWrapper[ZoneSettingAutomaticPlatformOptimization], + post_parser=ResultWrapper[Optional[AutomaticPlatformOptimization]]._unwrapper, ), + cast_to=cast(Type[Optional[AutomaticPlatformOptimization]], ResultWrapper[AutomaticPlatformOptimization]), ) def get( @@ -99,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAutomaticPlatformOptimization]: + ) -> Optional[AutomaticPlatformOptimization]: """ [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) serves your WordPress site from Cloudflare's edge network and caches third-party @@ -125,36 +120,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingAutomaticPlatformOptimization]], - ResultWrapper[ZoneSettingAutomaticPlatformOptimization], + post_parser=ResultWrapper[Optional[AutomaticPlatformOptimization]]._unwrapper, ), + cast_to=cast(Type[Optional[AutomaticPlatformOptimization]], ResultWrapper[AutomaticPlatformOptimization]), ) -class AsyncAutomaticPlatformOptimization(AsyncAPIResource): +class AsyncAutomaticPlatformOptimizationResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAutomaticPlatformOptimizationWithRawResponse: - return AsyncAutomaticPlatformOptimizationWithRawResponse(self) + def with_raw_response(self) -> AsyncAutomaticPlatformOptimizationResourceWithRawResponse: + return AsyncAutomaticPlatformOptimizationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAutomaticPlatformOptimizationWithStreamingResponse: - return AsyncAutomaticPlatformOptimizationWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse: + return AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingAutomaticPlatformOptimizationParam, + value: AutomaticPlatformOptimizationParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingAutomaticPlatformOptimization]: + ) -> Optional[AutomaticPlatformOptimization]: """ [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) serves your WordPress site from Cloudflare's edge network and caches third-party @@ -183,12 +175,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingAutomaticPlatformOptimization]], - ResultWrapper[ZoneSettingAutomaticPlatformOptimization], + post_parser=ResultWrapper[Optional[AutomaticPlatformOptimization]]._unwrapper, ), + cast_to=cast(Type[Optional[AutomaticPlatformOptimization]], ResultWrapper[AutomaticPlatformOptimization]), ) async def get( @@ -201,7 +190,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingAutomaticPlatformOptimization]: + ) -> Optional[AutomaticPlatformOptimization]: """ [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) serves your WordPress site from Cloudflare's edge network and caches third-party @@ -227,17 +216,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingAutomaticPlatformOptimization]], - ResultWrapper[ZoneSettingAutomaticPlatformOptimization], + post_parser=ResultWrapper[Optional[AutomaticPlatformOptimization]]._unwrapper, ), + cast_to=cast(Type[Optional[AutomaticPlatformOptimization]], ResultWrapper[AutomaticPlatformOptimization]), ) -class AutomaticPlatformOptimizationWithRawResponse: - def __init__(self, automatic_platform_optimization: AutomaticPlatformOptimization) -> None: +class AutomaticPlatformOptimizationResourceWithRawResponse: + def __init__(self, automatic_platform_optimization: AutomaticPlatformOptimizationResource) -> None: self._automatic_platform_optimization = automatic_platform_optimization self.edit = to_raw_response_wrapper( @@ -248,8 +234,8 @@ def __init__(self, automatic_platform_optimization: AutomaticPlatformOptimizatio ) -class AsyncAutomaticPlatformOptimizationWithRawResponse: - def __init__(self, automatic_platform_optimization: AsyncAutomaticPlatformOptimization) -> None: +class AsyncAutomaticPlatformOptimizationResourceWithRawResponse: + def __init__(self, automatic_platform_optimization: AsyncAutomaticPlatformOptimizationResource) -> None: self._automatic_platform_optimization = automatic_platform_optimization self.edit = async_to_raw_response_wrapper( @@ -260,8 +246,8 @@ def __init__(self, automatic_platform_optimization: AsyncAutomaticPlatformOptimi ) -class AutomaticPlatformOptimizationWithStreamingResponse: - def __init__(self, automatic_platform_optimization: AutomaticPlatformOptimization) -> None: +class AutomaticPlatformOptimizationResourceWithStreamingResponse: + def __init__(self, automatic_platform_optimization: AutomaticPlatformOptimizationResource) -> None: self._automatic_platform_optimization = automatic_platform_optimization self.edit = to_streamed_response_wrapper( @@ -272,8 +258,8 @@ def __init__(self, automatic_platform_optimization: AutomaticPlatformOptimizatio ) -class AsyncAutomaticPlatformOptimizationWithStreamingResponse: - def __init__(self, automatic_platform_optimization: AsyncAutomaticPlatformOptimization) -> None: +class AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse: + def __init__(self, automatic_platform_optimization: AsyncAutomaticPlatformOptimizationResource) -> None: self._automatic_platform_optimization = automatic_platform_optimization self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/brotli.py b/src/cloudflare/resources/zones/settings/brotli.py index 3c9d6bb215e..33912623ca6 100644 --- a/src/cloudflare/resources/zones/settings/brotli.py +++ b/src/cloudflare/resources/zones/settings/brotli.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingBrotli, brotli_edit_params +from ....types.zones.settings import brotli_edit_params +from ....types.zones.settings.brotli import Brotli -__all__ = ["Brotli", "AsyncBrotli"] +__all__ = ["BrotliResource", "AsyncBrotliResource"] -class Brotli(SyncAPIResource): +class BrotliResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BrotliWithRawResponse: - return BrotliWithRawResponse(self) + def with_raw_response(self) -> BrotliResourceWithRawResponse: + return BrotliResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BrotliWithStreamingResponse: - return BrotliWithStreamingResponse(self) + def with_streaming_response(self) -> BrotliResourceWithStreamingResponse: + return BrotliResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrotli]: + ) -> Optional[Brotli]: """ When the client requesting an asset supports the Brotli compression algorithm, Cloudflare will serve a Brotli compressed version of the asset. @@ -77,9 +78,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Brotli]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrotli]], ResultWrapper[ZoneSettingBrotli]), + cast_to=cast(Type[Optional[Brotli]], ResultWrapper[Brotli]), ) def get( @@ -92,7 +93,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrotli]: + ) -> Optional[Brotli]: """ When the client requesting an asset supports the Brotli compression algorithm, Cloudflare will serve a Brotli compressed version of the asset. @@ -117,20 +118,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Brotli]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrotli]], ResultWrapper[ZoneSettingBrotli]), + cast_to=cast(Type[Optional[Brotli]], ResultWrapper[Brotli]), ) -class AsyncBrotli(AsyncAPIResource): +class AsyncBrotliResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBrotliWithRawResponse: - return AsyncBrotliWithRawResponse(self) + def with_raw_response(self) -> AsyncBrotliResourceWithRawResponse: + return AsyncBrotliResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBrotliWithStreamingResponse: - return AsyncBrotliWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBrotliResourceWithStreamingResponse: + return AsyncBrotliResourceWithStreamingResponse(self) async def edit( self, @@ -143,7 +144,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrotli]: + ) -> Optional[Brotli]: """ When the client requesting an asset supports the Brotli compression algorithm, Cloudflare will serve a Brotli compressed version of the asset. @@ -171,9 +172,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Brotli]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrotli]], ResultWrapper[ZoneSettingBrotli]), + cast_to=cast(Type[Optional[Brotli]], ResultWrapper[Brotli]), ) async def get( @@ -186,7 +187,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrotli]: + ) -> Optional[Brotli]: """ When the client requesting an asset supports the Brotli compression algorithm, Cloudflare will serve a Brotli compressed version of the asset. @@ -211,14 +212,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Brotli]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrotli]], ResultWrapper[ZoneSettingBrotli]), + cast_to=cast(Type[Optional[Brotli]], ResultWrapper[Brotli]), ) -class BrotliWithRawResponse: - def __init__(self, brotli: Brotli) -> None: +class BrotliResourceWithRawResponse: + def __init__(self, brotli: BrotliResource) -> None: self._brotli = brotli self.edit = to_raw_response_wrapper( @@ -229,8 +230,8 @@ def __init__(self, brotli: Brotli) -> None: ) -class AsyncBrotliWithRawResponse: - def __init__(self, brotli: AsyncBrotli) -> None: +class AsyncBrotliResourceWithRawResponse: + def __init__(self, brotli: AsyncBrotliResource) -> None: self._brotli = brotli self.edit = async_to_raw_response_wrapper( @@ -241,8 +242,8 @@ def __init__(self, brotli: AsyncBrotli) -> None: ) -class BrotliWithStreamingResponse: - def __init__(self, brotli: Brotli) -> None: +class BrotliResourceWithStreamingResponse: + def __init__(self, brotli: BrotliResource) -> None: self._brotli = brotli self.edit = to_streamed_response_wrapper( @@ -253,8 +254,8 @@ def __init__(self, brotli: Brotli) -> None: ) -class AsyncBrotliWithStreamingResponse: - def __init__(self, brotli: AsyncBrotli) -> None: +class AsyncBrotliResourceWithStreamingResponse: + def __init__(self, brotli: AsyncBrotliResource) -> None: self._brotli = brotli self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/browser_cache_ttl.py b/src/cloudflare/resources/zones/settings/browser_cache_ttl.py index ffa3a59e1b2..56eb8d8c62c 100644 --- a/src/cloudflare/resources/zones/settings/browser_cache_ttl.py +++ b/src/cloudflare/resources/zones/settings/browser_cache_ttl.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingBrowserCacheTTL, browser_cache_ttl_edit_params +from ....types.zones.settings import browser_cache_ttl_edit_params +from ....types.zones.settings.browser_cache_ttl import BrowserCacheTTL -__all__ = ["BrowserCacheTTL", "AsyncBrowserCacheTTL"] +__all__ = ["BrowserCacheTTLResource", "AsyncBrowserCacheTTLResource"] -class BrowserCacheTTL(SyncAPIResource): +class BrowserCacheTTLResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BrowserCacheTTLWithRawResponse: - return BrowserCacheTTLWithRawResponse(self) + def with_raw_response(self) -> BrowserCacheTTLResourceWithRawResponse: + return BrowserCacheTTLResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BrowserCacheTTLWithStreamingResponse: - return BrowserCacheTTLWithStreamingResponse(self) + def with_streaming_response(self) -> BrowserCacheTTLResourceWithStreamingResponse: + return BrowserCacheTTLResourceWithStreamingResponse(self) def edit( self, @@ -78,7 +79,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrowserCacheTTL]: + ) -> Optional[BrowserCacheTTL]: """ Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources will remain on your visitors' computers. Cloudflare will honor any larger times @@ -109,9 +110,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BrowserCacheTTL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrowserCacheTTL]], ResultWrapper[ZoneSettingBrowserCacheTTL]), + cast_to=cast(Type[Optional[BrowserCacheTTL]], ResultWrapper[BrowserCacheTTL]), ) def get( @@ -124,7 +125,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrowserCacheTTL]: + ) -> Optional[BrowserCacheTTL]: """ Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources will remain on your visitors' computers. Cloudflare will honor any larger times @@ -151,20 +152,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BrowserCacheTTL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrowserCacheTTL]], ResultWrapper[ZoneSettingBrowserCacheTTL]), + cast_to=cast(Type[Optional[BrowserCacheTTL]], ResultWrapper[BrowserCacheTTL]), ) -class AsyncBrowserCacheTTL(AsyncAPIResource): +class AsyncBrowserCacheTTLResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBrowserCacheTTLWithRawResponse: - return AsyncBrowserCacheTTLWithRawResponse(self) + def with_raw_response(self) -> AsyncBrowserCacheTTLResourceWithRawResponse: + return AsyncBrowserCacheTTLResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBrowserCacheTTLWithStreamingResponse: - return AsyncBrowserCacheTTLWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBrowserCacheTTLResourceWithStreamingResponse: + return AsyncBrowserCacheTTLResourceWithStreamingResponse(self) async def edit( self, @@ -206,7 +207,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrowserCacheTTL]: + ) -> Optional[BrowserCacheTTL]: """ Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources will remain on your visitors' computers. Cloudflare will honor any larger times @@ -237,9 +238,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BrowserCacheTTL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrowserCacheTTL]], ResultWrapper[ZoneSettingBrowserCacheTTL]), + cast_to=cast(Type[Optional[BrowserCacheTTL]], ResultWrapper[BrowserCacheTTL]), ) async def get( @@ -252,7 +253,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrowserCacheTTL]: + ) -> Optional[BrowserCacheTTL]: """ Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources will remain on your visitors' computers. Cloudflare will honor any larger times @@ -279,14 +280,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BrowserCacheTTL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrowserCacheTTL]], ResultWrapper[ZoneSettingBrowserCacheTTL]), + cast_to=cast(Type[Optional[BrowserCacheTTL]], ResultWrapper[BrowserCacheTTL]), ) -class BrowserCacheTTLWithRawResponse: - def __init__(self, browser_cache_ttl: BrowserCacheTTL) -> None: +class BrowserCacheTTLResourceWithRawResponse: + def __init__(self, browser_cache_ttl: BrowserCacheTTLResource) -> None: self._browser_cache_ttl = browser_cache_ttl self.edit = to_raw_response_wrapper( @@ -297,8 +298,8 @@ def __init__(self, browser_cache_ttl: BrowserCacheTTL) -> None: ) -class AsyncBrowserCacheTTLWithRawResponse: - def __init__(self, browser_cache_ttl: AsyncBrowserCacheTTL) -> None: +class AsyncBrowserCacheTTLResourceWithRawResponse: + def __init__(self, browser_cache_ttl: AsyncBrowserCacheTTLResource) -> None: self._browser_cache_ttl = browser_cache_ttl self.edit = async_to_raw_response_wrapper( @@ -309,8 +310,8 @@ def __init__(self, browser_cache_ttl: AsyncBrowserCacheTTL) -> None: ) -class BrowserCacheTTLWithStreamingResponse: - def __init__(self, browser_cache_ttl: BrowserCacheTTL) -> None: +class BrowserCacheTTLResourceWithStreamingResponse: + def __init__(self, browser_cache_ttl: BrowserCacheTTLResource) -> None: self._browser_cache_ttl = browser_cache_ttl self.edit = to_streamed_response_wrapper( @@ -321,8 +322,8 @@ def __init__(self, browser_cache_ttl: BrowserCacheTTL) -> None: ) -class AsyncBrowserCacheTTLWithStreamingResponse: - def __init__(self, browser_cache_ttl: AsyncBrowserCacheTTL) -> None: +class AsyncBrowserCacheTTLResourceWithStreamingResponse: + def __init__(self, browser_cache_ttl: AsyncBrowserCacheTTLResource) -> None: self._browser_cache_ttl = browser_cache_ttl self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/browser_check.py b/src/cloudflare/resources/zones/settings/browser_check.py index ab4b6e9e7ec..20516575677 100644 --- a/src/cloudflare/resources/zones/settings/browser_check.py +++ b/src/cloudflare/resources/zones/settings/browser_check.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingBrowserCheck, browser_check_edit_params +from ....types.zones.settings import browser_check_edit_params +from ....types.zones.settings.browser_check import BrowserCheck -__all__ = ["BrowserCheck", "AsyncBrowserCheck"] +__all__ = ["BrowserCheckResource", "AsyncBrowserCheckResource"] -class BrowserCheck(SyncAPIResource): +class BrowserCheckResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BrowserCheckWithRawResponse: - return BrowserCheckWithRawResponse(self) + def with_raw_response(self) -> BrowserCheckResourceWithRawResponse: + return BrowserCheckResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BrowserCheckWithStreamingResponse: - return BrowserCheckWithStreamingResponse(self) + def with_streaming_response(self) -> BrowserCheckResourceWithStreamingResponse: + return BrowserCheckResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrowserCheck]: + ) -> Optional[BrowserCheck]: """ Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will @@ -80,9 +81,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BrowserCheck]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrowserCheck]], ResultWrapper[ZoneSettingBrowserCheck]), + cast_to=cast(Type[Optional[BrowserCheck]], ResultWrapper[BrowserCheck]), ) def get( @@ -95,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrowserCheck]: + ) -> Optional[BrowserCheck]: """ Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will @@ -123,20 +124,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BrowserCheck]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrowserCheck]], ResultWrapper[ZoneSettingBrowserCheck]), + cast_to=cast(Type[Optional[BrowserCheck]], ResultWrapper[BrowserCheck]), ) -class AsyncBrowserCheck(AsyncAPIResource): +class AsyncBrowserCheckResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBrowserCheckWithRawResponse: - return AsyncBrowserCheckWithRawResponse(self) + def with_raw_response(self) -> AsyncBrowserCheckResourceWithRawResponse: + return AsyncBrowserCheckResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBrowserCheckWithStreamingResponse: - return AsyncBrowserCheckWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBrowserCheckResourceWithStreamingResponse: + return AsyncBrowserCheckResourceWithStreamingResponse(self) async def edit( self, @@ -149,7 +150,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrowserCheck]: + ) -> Optional[BrowserCheck]: """ Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will @@ -180,9 +181,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BrowserCheck]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrowserCheck]], ResultWrapper[ZoneSettingBrowserCheck]), + cast_to=cast(Type[Optional[BrowserCheck]], ResultWrapper[BrowserCheck]), ) async def get( @@ -195,7 +196,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBrowserCheck]: + ) -> Optional[BrowserCheck]: """ Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will @@ -223,14 +224,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[BrowserCheck]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBrowserCheck]], ResultWrapper[ZoneSettingBrowserCheck]), + cast_to=cast(Type[Optional[BrowserCheck]], ResultWrapper[BrowserCheck]), ) -class BrowserCheckWithRawResponse: - def __init__(self, browser_check: BrowserCheck) -> None: +class BrowserCheckResourceWithRawResponse: + def __init__(self, browser_check: BrowserCheckResource) -> None: self._browser_check = browser_check self.edit = to_raw_response_wrapper( @@ -241,8 +242,8 @@ def __init__(self, browser_check: BrowserCheck) -> None: ) -class AsyncBrowserCheckWithRawResponse: - def __init__(self, browser_check: AsyncBrowserCheck) -> None: +class AsyncBrowserCheckResourceWithRawResponse: + def __init__(self, browser_check: AsyncBrowserCheckResource) -> None: self._browser_check = browser_check self.edit = async_to_raw_response_wrapper( @@ -253,8 +254,8 @@ def __init__(self, browser_check: AsyncBrowserCheck) -> None: ) -class BrowserCheckWithStreamingResponse: - def __init__(self, browser_check: BrowserCheck) -> None: +class BrowserCheckResourceWithStreamingResponse: + def __init__(self, browser_check: BrowserCheckResource) -> None: self._browser_check = browser_check self.edit = to_streamed_response_wrapper( @@ -265,8 +266,8 @@ def __init__(self, browser_check: BrowserCheck) -> None: ) -class AsyncBrowserCheckWithStreamingResponse: - def __init__(self, browser_check: AsyncBrowserCheck) -> None: +class AsyncBrowserCheckResourceWithStreamingResponse: + def __init__(self, browser_check: AsyncBrowserCheckResource) -> None: self._browser_check = browser_check self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/cache_level.py b/src/cloudflare/resources/zones/settings/cache_level.py index eeff2a8091d..444c3b71f2c 100644 --- a/src/cloudflare/resources/zones/settings/cache_level.py +++ b/src/cloudflare/resources/zones/settings/cache_level.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingCacheLevel, cache_level_edit_params +from ....types.zones.settings import cache_level_edit_params +from ....types.zones.settings.cache_level import CacheLevel -__all__ = ["CacheLevel", "AsyncCacheLevel"] +__all__ = ["CacheLevelResource", "AsyncCacheLevelResource"] -class CacheLevel(SyncAPIResource): +class CacheLevelResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CacheLevelWithRawResponse: - return CacheLevelWithRawResponse(self) + def with_raw_response(self) -> CacheLevelResourceWithRawResponse: + return CacheLevelResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CacheLevelWithStreamingResponse: - return CacheLevelWithStreamingResponse(self) + def with_streaming_response(self) -> CacheLevelResourceWithStreamingResponse: + return CacheLevelResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingCacheLevel]: + ) -> Optional[CacheLevel]: """Cache Level functions based off the setting level. The basic setting will cache @@ -81,9 +82,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CacheLevel]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingCacheLevel]], ResultWrapper[ZoneSettingCacheLevel]), + cast_to=cast(Type[Optional[CacheLevel]], ResultWrapper[CacheLevel]), ) def get( @@ -96,7 +97,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingCacheLevel]: + ) -> Optional[CacheLevel]: """Cache Level functions based off the setting level. The basic setting will cache @@ -125,20 +126,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CacheLevel]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingCacheLevel]], ResultWrapper[ZoneSettingCacheLevel]), + cast_to=cast(Type[Optional[CacheLevel]], ResultWrapper[CacheLevel]), ) -class AsyncCacheLevel(AsyncAPIResource): +class AsyncCacheLevelResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCacheLevelWithRawResponse: - return AsyncCacheLevelWithRawResponse(self) + def with_raw_response(self) -> AsyncCacheLevelResourceWithRawResponse: + return AsyncCacheLevelResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCacheLevelWithStreamingResponse: - return AsyncCacheLevelWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCacheLevelResourceWithStreamingResponse: + return AsyncCacheLevelResourceWithStreamingResponse(self) async def edit( self, @@ -151,7 +152,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingCacheLevel]: + ) -> Optional[CacheLevel]: """Cache Level functions based off the setting level. The basic setting will cache @@ -183,9 +184,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CacheLevel]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingCacheLevel]], ResultWrapper[ZoneSettingCacheLevel]), + cast_to=cast(Type[Optional[CacheLevel]], ResultWrapper[CacheLevel]), ) async def get( @@ -198,7 +199,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingCacheLevel]: + ) -> Optional[CacheLevel]: """Cache Level functions based off the setting level. The basic setting will cache @@ -227,14 +228,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[CacheLevel]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingCacheLevel]], ResultWrapper[ZoneSettingCacheLevel]), + cast_to=cast(Type[Optional[CacheLevel]], ResultWrapper[CacheLevel]), ) -class CacheLevelWithRawResponse: - def __init__(self, cache_level: CacheLevel) -> None: +class CacheLevelResourceWithRawResponse: + def __init__(self, cache_level: CacheLevelResource) -> None: self._cache_level = cache_level self.edit = to_raw_response_wrapper( @@ -245,8 +246,8 @@ def __init__(self, cache_level: CacheLevel) -> None: ) -class AsyncCacheLevelWithRawResponse: - def __init__(self, cache_level: AsyncCacheLevel) -> None: +class AsyncCacheLevelResourceWithRawResponse: + def __init__(self, cache_level: AsyncCacheLevelResource) -> None: self._cache_level = cache_level self.edit = async_to_raw_response_wrapper( @@ -257,8 +258,8 @@ def __init__(self, cache_level: AsyncCacheLevel) -> None: ) -class CacheLevelWithStreamingResponse: - def __init__(self, cache_level: CacheLevel) -> None: +class CacheLevelResourceWithStreamingResponse: + def __init__(self, cache_level: CacheLevelResource) -> None: self._cache_level = cache_level self.edit = to_streamed_response_wrapper( @@ -269,8 +270,8 @@ def __init__(self, cache_level: CacheLevel) -> None: ) -class AsyncCacheLevelWithStreamingResponse: - def __init__(self, cache_level: AsyncCacheLevel) -> None: +class AsyncCacheLevelResourceWithStreamingResponse: + def __init__(self, cache_level: AsyncCacheLevelResource) -> None: self._cache_level = cache_level self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/challenge_ttl.py b/src/cloudflare/resources/zones/settings/challenge_ttl.py index b1c812074f9..7730173627d 100644 --- a/src/cloudflare/resources/zones/settings/challenge_ttl.py +++ b/src/cloudflare/resources/zones/settings/challenge_ttl.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingChallengeTTL, challenge_ttl_edit_params +from ....types.zones.settings import challenge_ttl_edit_params +from ....types.zones.settings.challenge_ttl import ChallengeTTL -__all__ = ["ChallengeTTL", "AsyncChallengeTTL"] +__all__ = ["ChallengeTTLResource", "AsyncChallengeTTLResource"] -class ChallengeTTL(SyncAPIResource): +class ChallengeTTLResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ChallengeTTLWithRawResponse: - return ChallengeTTLWithRawResponse(self) + def with_raw_response(self) -> ChallengeTTLResourceWithRawResponse: + return ChallengeTTLResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ChallengeTTLWithStreamingResponse: - return ChallengeTTLWithStreamingResponse(self) + def with_streaming_response(self) -> ChallengeTTLResourceWithStreamingResponse: + return ChallengeTTLResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingChallengeTTL]: + ) -> Optional[ChallengeTTL]: """ Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the @@ -80,9 +81,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ChallengeTTL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingChallengeTTL]], ResultWrapper[ZoneSettingChallengeTTL]), + cast_to=cast(Type[Optional[ChallengeTTL]], ResultWrapper[ChallengeTTL]), ) def get( @@ -95,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingChallengeTTL]: + ) -> Optional[ChallengeTTL]: """ Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the @@ -123,20 +124,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ChallengeTTL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingChallengeTTL]], ResultWrapper[ZoneSettingChallengeTTL]), + cast_to=cast(Type[Optional[ChallengeTTL]], ResultWrapper[ChallengeTTL]), ) -class AsyncChallengeTTL(AsyncAPIResource): +class AsyncChallengeTTLResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncChallengeTTLWithRawResponse: - return AsyncChallengeTTLWithRawResponse(self) + def with_raw_response(self) -> AsyncChallengeTTLResourceWithRawResponse: + return AsyncChallengeTTLResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncChallengeTTLWithStreamingResponse: - return AsyncChallengeTTLWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncChallengeTTLResourceWithStreamingResponse: + return AsyncChallengeTTLResourceWithStreamingResponse(self) async def edit( self, @@ -149,7 +150,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingChallengeTTL]: + ) -> Optional[ChallengeTTL]: """ Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the @@ -180,9 +181,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ChallengeTTL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingChallengeTTL]], ResultWrapper[ZoneSettingChallengeTTL]), + cast_to=cast(Type[Optional[ChallengeTTL]], ResultWrapper[ChallengeTTL]), ) async def get( @@ -195,7 +196,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingChallengeTTL]: + ) -> Optional[ChallengeTTL]: """ Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the @@ -223,14 +224,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ChallengeTTL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingChallengeTTL]], ResultWrapper[ZoneSettingChallengeTTL]), + cast_to=cast(Type[Optional[ChallengeTTL]], ResultWrapper[ChallengeTTL]), ) -class ChallengeTTLWithRawResponse: - def __init__(self, challenge_ttl: ChallengeTTL) -> None: +class ChallengeTTLResourceWithRawResponse: + def __init__(self, challenge_ttl: ChallengeTTLResource) -> None: self._challenge_ttl = challenge_ttl self.edit = to_raw_response_wrapper( @@ -241,8 +242,8 @@ def __init__(self, challenge_ttl: ChallengeTTL) -> None: ) -class AsyncChallengeTTLWithRawResponse: - def __init__(self, challenge_ttl: AsyncChallengeTTL) -> None: +class AsyncChallengeTTLResourceWithRawResponse: + def __init__(self, challenge_ttl: AsyncChallengeTTLResource) -> None: self._challenge_ttl = challenge_ttl self.edit = async_to_raw_response_wrapper( @@ -253,8 +254,8 @@ def __init__(self, challenge_ttl: AsyncChallengeTTL) -> None: ) -class ChallengeTTLWithStreamingResponse: - def __init__(self, challenge_ttl: ChallengeTTL) -> None: +class ChallengeTTLResourceWithStreamingResponse: + def __init__(self, challenge_ttl: ChallengeTTLResource) -> None: self._challenge_ttl = challenge_ttl self.edit = to_streamed_response_wrapper( @@ -265,8 +266,8 @@ def __init__(self, challenge_ttl: ChallengeTTL) -> None: ) -class AsyncChallengeTTLWithStreamingResponse: - def __init__(self, challenge_ttl: AsyncChallengeTTL) -> None: +class AsyncChallengeTTLResourceWithStreamingResponse: + def __init__(self, challenge_ttl: AsyncChallengeTTLResource) -> None: self._challenge_ttl = challenge_ttl self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/ciphers.py b/src/cloudflare/resources/zones/settings/ciphers.py index 7a3ae57a9c6..c17128d464a 100644 --- a/src/cloudflare/resources/zones/settings/ciphers.py +++ b/src/cloudflare/resources/zones/settings/ciphers.py @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingCiphers, cipher_edit_params +from ....types.zones.settings import cipher_edit_params +from ....types.zones.settings.ciphers import Ciphers -__all__ = ["Ciphers", "AsyncCiphers"] +__all__ = ["CiphersResource", "AsyncCiphersResource"] -class Ciphers(SyncAPIResource): +class CiphersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CiphersWithRawResponse: - return CiphersWithRawResponse(self) + def with_raw_response(self) -> CiphersResourceWithRawResponse: + return CiphersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CiphersWithStreamingResponse: - return CiphersWithStreamingResponse(self) + def with_streaming_response(self) -> CiphersResourceWithStreamingResponse: + return CiphersResourceWithStreamingResponse(self) def edit( self, @@ -48,7 +49,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingCiphers]: + ) -> Optional[Ciphers]: """ Changes ciphers setting. @@ -75,9 +76,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Ciphers]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingCiphers]], ResultWrapper[ZoneSettingCiphers]), + cast_to=cast(Type[Optional[Ciphers]], ResultWrapper[Ciphers]), ) def get( @@ -90,7 +91,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingCiphers]: + ) -> Optional[Ciphers]: """ Gets ciphers setting. @@ -114,20 +115,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Ciphers]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingCiphers]], ResultWrapper[ZoneSettingCiphers]), + cast_to=cast(Type[Optional[Ciphers]], ResultWrapper[Ciphers]), ) -class AsyncCiphers(AsyncAPIResource): +class AsyncCiphersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCiphersWithRawResponse: - return AsyncCiphersWithRawResponse(self) + def with_raw_response(self) -> AsyncCiphersResourceWithRawResponse: + return AsyncCiphersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCiphersWithStreamingResponse: - return AsyncCiphersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCiphersResourceWithStreamingResponse: + return AsyncCiphersResourceWithStreamingResponse(self) async def edit( self, @@ -140,7 +141,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingCiphers]: + ) -> Optional[Ciphers]: """ Changes ciphers setting. @@ -167,9 +168,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Ciphers]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingCiphers]], ResultWrapper[ZoneSettingCiphers]), + cast_to=cast(Type[Optional[Ciphers]], ResultWrapper[Ciphers]), ) async def get( @@ -182,7 +183,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingCiphers]: + ) -> Optional[Ciphers]: """ Gets ciphers setting. @@ -206,14 +207,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Ciphers]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingCiphers]], ResultWrapper[ZoneSettingCiphers]), + cast_to=cast(Type[Optional[Ciphers]], ResultWrapper[Ciphers]), ) -class CiphersWithRawResponse: - def __init__(self, ciphers: Ciphers) -> None: +class CiphersResourceWithRawResponse: + def __init__(self, ciphers: CiphersResource) -> None: self._ciphers = ciphers self.edit = to_raw_response_wrapper( @@ -224,8 +225,8 @@ def __init__(self, ciphers: Ciphers) -> None: ) -class AsyncCiphersWithRawResponse: - def __init__(self, ciphers: AsyncCiphers) -> None: +class AsyncCiphersResourceWithRawResponse: + def __init__(self, ciphers: AsyncCiphersResource) -> None: self._ciphers = ciphers self.edit = async_to_raw_response_wrapper( @@ -236,8 +237,8 @@ def __init__(self, ciphers: AsyncCiphers) -> None: ) -class CiphersWithStreamingResponse: - def __init__(self, ciphers: Ciphers) -> None: +class CiphersResourceWithStreamingResponse: + def __init__(self, ciphers: CiphersResource) -> None: self._ciphers = ciphers self.edit = to_streamed_response_wrapper( @@ -248,8 +249,8 @@ def __init__(self, ciphers: Ciphers) -> None: ) -class AsyncCiphersWithStreamingResponse: - def __init__(self, ciphers: AsyncCiphers) -> None: +class AsyncCiphersResourceWithStreamingResponse: + def __init__(self, ciphers: AsyncCiphersResource) -> None: self._ciphers = ciphers self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/development_mode.py b/src/cloudflare/resources/zones/settings/development_mode.py index a79b455bbb2..d5a609c139a 100644 --- a/src/cloudflare/resources/zones/settings/development_mode.py +++ b/src/cloudflare/resources/zones/settings/development_mode.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingDevelopmentMode, development_mode_edit_params +from ....types.zones.settings import development_mode_edit_params +from ....types.zones.settings.development_mode import DevelopmentMode -__all__ = ["DevelopmentMode", "AsyncDevelopmentMode"] +__all__ = ["DevelopmentModeResource", "AsyncDevelopmentModeResource"] -class DevelopmentMode(SyncAPIResource): +class DevelopmentModeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DevelopmentModeWithRawResponse: - return DevelopmentModeWithRawResponse(self) + def with_raw_response(self) -> DevelopmentModeResourceWithRawResponse: + return DevelopmentModeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DevelopmentModeWithStreamingResponse: - return DevelopmentModeWithStreamingResponse(self) + def with_streaming_response(self) -> DevelopmentModeResourceWithStreamingResponse: + return DevelopmentModeResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingDevelopmentMode]: + ) -> Optional[DevelopmentMode]: """ Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site. This will bypass Cloudflare's @@ -81,9 +82,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevelopmentMode]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingDevelopmentMode]], ResultWrapper[ZoneSettingDevelopmentMode]), + cast_to=cast(Type[Optional[DevelopmentMode]], ResultWrapper[DevelopmentMode]), ) def get( @@ -96,7 +97,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingDevelopmentMode]: + ) -> Optional[DevelopmentMode]: """ Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site. This will bypass Cloudflare's @@ -125,20 +126,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevelopmentMode]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingDevelopmentMode]], ResultWrapper[ZoneSettingDevelopmentMode]), + cast_to=cast(Type[Optional[DevelopmentMode]], ResultWrapper[DevelopmentMode]), ) -class AsyncDevelopmentMode(AsyncAPIResource): +class AsyncDevelopmentModeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDevelopmentModeWithRawResponse: - return AsyncDevelopmentModeWithRawResponse(self) + def with_raw_response(self) -> AsyncDevelopmentModeResourceWithRawResponse: + return AsyncDevelopmentModeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDevelopmentModeWithStreamingResponse: - return AsyncDevelopmentModeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDevelopmentModeResourceWithStreamingResponse: + return AsyncDevelopmentModeResourceWithStreamingResponse(self) async def edit( self, @@ -151,7 +152,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingDevelopmentMode]: + ) -> Optional[DevelopmentMode]: """ Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site. This will bypass Cloudflare's @@ -183,9 +184,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevelopmentMode]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingDevelopmentMode]], ResultWrapper[ZoneSettingDevelopmentMode]), + cast_to=cast(Type[Optional[DevelopmentMode]], ResultWrapper[DevelopmentMode]), ) async def get( @@ -198,7 +199,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingDevelopmentMode]: + ) -> Optional[DevelopmentMode]: """ Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site. This will bypass Cloudflare's @@ -227,14 +228,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[DevelopmentMode]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingDevelopmentMode]], ResultWrapper[ZoneSettingDevelopmentMode]), + cast_to=cast(Type[Optional[DevelopmentMode]], ResultWrapper[DevelopmentMode]), ) -class DevelopmentModeWithRawResponse: - def __init__(self, development_mode: DevelopmentMode) -> None: +class DevelopmentModeResourceWithRawResponse: + def __init__(self, development_mode: DevelopmentModeResource) -> None: self._development_mode = development_mode self.edit = to_raw_response_wrapper( @@ -245,8 +246,8 @@ def __init__(self, development_mode: DevelopmentMode) -> None: ) -class AsyncDevelopmentModeWithRawResponse: - def __init__(self, development_mode: AsyncDevelopmentMode) -> None: +class AsyncDevelopmentModeResourceWithRawResponse: + def __init__(self, development_mode: AsyncDevelopmentModeResource) -> None: self._development_mode = development_mode self.edit = async_to_raw_response_wrapper( @@ -257,8 +258,8 @@ def __init__(self, development_mode: AsyncDevelopmentMode) -> None: ) -class DevelopmentModeWithStreamingResponse: - def __init__(self, development_mode: DevelopmentMode) -> None: +class DevelopmentModeResourceWithStreamingResponse: + def __init__(self, development_mode: DevelopmentModeResource) -> None: self._development_mode = development_mode self.edit = to_streamed_response_wrapper( @@ -269,8 +270,8 @@ def __init__(self, development_mode: DevelopmentMode) -> None: ) -class AsyncDevelopmentModeWithStreamingResponse: - def __init__(self, development_mode: AsyncDevelopmentMode) -> None: +class AsyncDevelopmentModeResourceWithStreamingResponse: + def __init__(self, development_mode: AsyncDevelopmentModeResource) -> None: self._development_mode = development_mode self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/early_hints.py b/src/cloudflare/resources/zones/settings/early_hints.py index d4b971bdf17..4c751097ced 100644 --- a/src/cloudflare/resources/zones/settings/early_hints.py +++ b/src/cloudflare/resources/zones/settings/early_hints.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingEarlyHints, early_hint_edit_params +from ....types.zones.settings import early_hint_edit_params +from ....types.zones.settings.early_hints import EarlyHints -__all__ = ["EarlyHints", "AsyncEarlyHints"] +__all__ = ["EarlyHintsResource", "AsyncEarlyHintsResource"] -class EarlyHints(SyncAPIResource): +class EarlyHintsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> EarlyHintsWithRawResponse: - return EarlyHintsWithRawResponse(self) + def with_raw_response(self) -> EarlyHintsResourceWithRawResponse: + return EarlyHintsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EarlyHintsWithStreamingResponse: - return EarlyHintsWithStreamingResponse(self) + def with_streaming_response(self) -> EarlyHintsResourceWithStreamingResponse: + return EarlyHintsResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingEarlyHints]: + ) -> Optional[EarlyHints]: """ When enabled, Cloudflare will attempt to speed up overall page loads by serving `103` responses with `Link` headers from the final response. Refer to @@ -79,9 +80,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EarlyHints]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingEarlyHints]], ResultWrapper[ZoneSettingEarlyHints]), + cast_to=cast(Type[Optional[EarlyHints]], ResultWrapper[EarlyHints]), ) def get( @@ -94,7 +95,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingEarlyHints]: + ) -> Optional[EarlyHints]: """ When enabled, Cloudflare will attempt to speed up overall page loads by serving `103` responses with `Link` headers from the final response. Refer to @@ -121,20 +122,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EarlyHints]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingEarlyHints]], ResultWrapper[ZoneSettingEarlyHints]), + cast_to=cast(Type[Optional[EarlyHints]], ResultWrapper[EarlyHints]), ) -class AsyncEarlyHints(AsyncAPIResource): +class AsyncEarlyHintsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncEarlyHintsWithRawResponse: - return AsyncEarlyHintsWithRawResponse(self) + def with_raw_response(self) -> AsyncEarlyHintsResourceWithRawResponse: + return AsyncEarlyHintsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEarlyHintsWithStreamingResponse: - return AsyncEarlyHintsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEarlyHintsResourceWithStreamingResponse: + return AsyncEarlyHintsResourceWithStreamingResponse(self) async def edit( self, @@ -147,7 +148,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingEarlyHints]: + ) -> Optional[EarlyHints]: """ When enabled, Cloudflare will attempt to speed up overall page loads by serving `103` responses with `Link` headers from the final response. Refer to @@ -177,9 +178,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EarlyHints]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingEarlyHints]], ResultWrapper[ZoneSettingEarlyHints]), + cast_to=cast(Type[Optional[EarlyHints]], ResultWrapper[EarlyHints]), ) async def get( @@ -192,7 +193,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingEarlyHints]: + ) -> Optional[EarlyHints]: """ When enabled, Cloudflare will attempt to speed up overall page loads by serving `103` responses with `Link` headers from the final response. Refer to @@ -219,14 +220,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EarlyHints]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingEarlyHints]], ResultWrapper[ZoneSettingEarlyHints]), + cast_to=cast(Type[Optional[EarlyHints]], ResultWrapper[EarlyHints]), ) -class EarlyHintsWithRawResponse: - def __init__(self, early_hints: EarlyHints) -> None: +class EarlyHintsResourceWithRawResponse: + def __init__(self, early_hints: EarlyHintsResource) -> None: self._early_hints = early_hints self.edit = to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, early_hints: EarlyHints) -> None: ) -class AsyncEarlyHintsWithRawResponse: - def __init__(self, early_hints: AsyncEarlyHints) -> None: +class AsyncEarlyHintsResourceWithRawResponse: + def __init__(self, early_hints: AsyncEarlyHintsResource) -> None: self._early_hints = early_hints self.edit = async_to_raw_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, early_hints: AsyncEarlyHints) -> None: ) -class EarlyHintsWithStreamingResponse: - def __init__(self, early_hints: EarlyHints) -> None: +class EarlyHintsResourceWithStreamingResponse: + def __init__(self, early_hints: EarlyHintsResource) -> None: self._early_hints = early_hints self.edit = to_streamed_response_wrapper( @@ -261,8 +262,8 @@ def __init__(self, early_hints: EarlyHints) -> None: ) -class AsyncEarlyHintsWithStreamingResponse: - def __init__(self, early_hints: AsyncEarlyHints) -> None: +class AsyncEarlyHintsResourceWithStreamingResponse: + def __init__(self, early_hints: AsyncEarlyHintsResource) -> None: self._early_hints = early_hints self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/email_obfuscation.py b/src/cloudflare/resources/zones/settings/email_obfuscation.py index 2e544bb44af..da8a7e0e288 100644 --- a/src/cloudflare/resources/zones/settings/email_obfuscation.py +++ b/src/cloudflare/resources/zones/settings/email_obfuscation.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingEmailObfuscation, email_obfuscation_edit_params +from ....types.zones.settings import email_obfuscation_edit_params +from ....types.zones.settings.email_obfuscation import EmailObfuscation -__all__ = ["EmailObfuscation", "AsyncEmailObfuscation"] +__all__ = ["EmailObfuscationResource", "AsyncEmailObfuscationResource"] -class EmailObfuscation(SyncAPIResource): +class EmailObfuscationResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> EmailObfuscationWithRawResponse: - return EmailObfuscationWithRawResponse(self) + def with_raw_response(self) -> EmailObfuscationResourceWithRawResponse: + return EmailObfuscationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EmailObfuscationWithStreamingResponse: - return EmailObfuscationWithStreamingResponse(self) + def with_streaming_response(self) -> EmailObfuscationResourceWithStreamingResponse: + return EmailObfuscationResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingEmailObfuscation]: + ) -> Optional[EmailObfuscation]: """ Encrypt email adresses on your web page from bots, while keeping them visible to humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). @@ -77,9 +78,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EmailObfuscation]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingEmailObfuscation]], ResultWrapper[ZoneSettingEmailObfuscation]), + cast_to=cast(Type[Optional[EmailObfuscation]], ResultWrapper[EmailObfuscation]), ) def get( @@ -92,7 +93,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingEmailObfuscation]: + ) -> Optional[EmailObfuscation]: """ Encrypt email adresses on your web page from bots, while keeping them visible to humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). @@ -117,20 +118,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EmailObfuscation]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingEmailObfuscation]], ResultWrapper[ZoneSettingEmailObfuscation]), + cast_to=cast(Type[Optional[EmailObfuscation]], ResultWrapper[EmailObfuscation]), ) -class AsyncEmailObfuscation(AsyncAPIResource): +class AsyncEmailObfuscationResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncEmailObfuscationWithRawResponse: - return AsyncEmailObfuscationWithRawResponse(self) + def with_raw_response(self) -> AsyncEmailObfuscationResourceWithRawResponse: + return AsyncEmailObfuscationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEmailObfuscationWithStreamingResponse: - return AsyncEmailObfuscationWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEmailObfuscationResourceWithStreamingResponse: + return AsyncEmailObfuscationResourceWithStreamingResponse(self) async def edit( self, @@ -143,7 +144,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingEmailObfuscation]: + ) -> Optional[EmailObfuscation]: """ Encrypt email adresses on your web page from bots, while keeping them visible to humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). @@ -173,9 +174,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EmailObfuscation]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingEmailObfuscation]], ResultWrapper[ZoneSettingEmailObfuscation]), + cast_to=cast(Type[Optional[EmailObfuscation]], ResultWrapper[EmailObfuscation]), ) async def get( @@ -188,7 +189,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingEmailObfuscation]: + ) -> Optional[EmailObfuscation]: """ Encrypt email adresses on your web page from bots, while keeping them visible to humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). @@ -213,14 +214,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[EmailObfuscation]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingEmailObfuscation]], ResultWrapper[ZoneSettingEmailObfuscation]), + cast_to=cast(Type[Optional[EmailObfuscation]], ResultWrapper[EmailObfuscation]), ) -class EmailObfuscationWithRawResponse: - def __init__(self, email_obfuscation: EmailObfuscation) -> None: +class EmailObfuscationResourceWithRawResponse: + def __init__(self, email_obfuscation: EmailObfuscationResource) -> None: self._email_obfuscation = email_obfuscation self.edit = to_raw_response_wrapper( @@ -231,8 +232,8 @@ def __init__(self, email_obfuscation: EmailObfuscation) -> None: ) -class AsyncEmailObfuscationWithRawResponse: - def __init__(self, email_obfuscation: AsyncEmailObfuscation) -> None: +class AsyncEmailObfuscationResourceWithRawResponse: + def __init__(self, email_obfuscation: AsyncEmailObfuscationResource) -> None: self._email_obfuscation = email_obfuscation self.edit = async_to_raw_response_wrapper( @@ -243,8 +244,8 @@ def __init__(self, email_obfuscation: AsyncEmailObfuscation) -> None: ) -class EmailObfuscationWithStreamingResponse: - def __init__(self, email_obfuscation: EmailObfuscation) -> None: +class EmailObfuscationResourceWithStreamingResponse: + def __init__(self, email_obfuscation: EmailObfuscationResource) -> None: self._email_obfuscation = email_obfuscation self.edit = to_streamed_response_wrapper( @@ -255,8 +256,8 @@ def __init__(self, email_obfuscation: EmailObfuscation) -> None: ) -class AsyncEmailObfuscationWithStreamingResponse: - def __init__(self, email_obfuscation: AsyncEmailObfuscation) -> None: +class AsyncEmailObfuscationResourceWithStreamingResponse: + def __init__(self, email_obfuscation: AsyncEmailObfuscationResource) -> None: self._email_obfuscation = email_obfuscation self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/font_settings.py b/src/cloudflare/resources/zones/settings/font_settings.py index 301bb27d686..6749ed07faa 100644 --- a/src/cloudflare/resources/zones/settings/font_settings.py +++ b/src/cloudflare/resources/zones/settings/font_settings.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingFonts, font_setting_edit_params +from ....types.zones.settings import font_setting_edit_params +from ....types.zones.settings.font_settings import FontSettings -__all__ = ["FontSettings", "AsyncFontSettings"] +__all__ = ["FontSettingsResource", "AsyncFontSettingsResource"] -class FontSettings(SyncAPIResource): +class FontSettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FontSettingsWithRawResponse: - return FontSettingsWithRawResponse(self) + def with_raw_response(self) -> FontSettingsResourceWithRawResponse: + return FontSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FontSettingsWithStreamingResponse: - return FontSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> FontSettingsResourceWithStreamingResponse: + return FontSettingsResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingFonts]: + ) -> Optional[FontSettings]: """Enhance your website's font delivery with Cloudflare Fonts. Deliver Google @@ -79,9 +80,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FontSettings]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingFonts]], ResultWrapper[ZoneSettingFonts]), + cast_to=cast(Type[Optional[FontSettings]], ResultWrapper[FontSettings]), ) def get( @@ -94,7 +95,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingFonts]: + ) -> Optional[FontSettings]: """Enhance your website's font delivery with Cloudflare Fonts. Deliver Google @@ -121,20 +122,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FontSettings]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingFonts]], ResultWrapper[ZoneSettingFonts]), + cast_to=cast(Type[Optional[FontSettings]], ResultWrapper[FontSettings]), ) -class AsyncFontSettings(AsyncAPIResource): +class AsyncFontSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFontSettingsWithRawResponse: - return AsyncFontSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncFontSettingsResourceWithRawResponse: + return AsyncFontSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFontSettingsWithStreamingResponse: - return AsyncFontSettingsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFontSettingsResourceWithStreamingResponse: + return AsyncFontSettingsResourceWithStreamingResponse(self) async def edit( self, @@ -147,7 +148,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingFonts]: + ) -> Optional[FontSettings]: """Enhance your website's font delivery with Cloudflare Fonts. Deliver Google @@ -177,9 +178,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FontSettings]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingFonts]], ResultWrapper[ZoneSettingFonts]), + cast_to=cast(Type[Optional[FontSettings]], ResultWrapper[FontSettings]), ) async def get( @@ -192,7 +193,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingFonts]: + ) -> Optional[FontSettings]: """Enhance your website's font delivery with Cloudflare Fonts. Deliver Google @@ -219,14 +220,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[FontSettings]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingFonts]], ResultWrapper[ZoneSettingFonts]), + cast_to=cast(Type[Optional[FontSettings]], ResultWrapper[FontSettings]), ) -class FontSettingsWithRawResponse: - def __init__(self, font_settings: FontSettings) -> None: +class FontSettingsResourceWithRawResponse: + def __init__(self, font_settings: FontSettingsResource) -> None: self._font_settings = font_settings self.edit = to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, font_settings: FontSettings) -> None: ) -class AsyncFontSettingsWithRawResponse: - def __init__(self, font_settings: AsyncFontSettings) -> None: +class AsyncFontSettingsResourceWithRawResponse: + def __init__(self, font_settings: AsyncFontSettingsResource) -> None: self._font_settings = font_settings self.edit = async_to_raw_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, font_settings: AsyncFontSettings) -> None: ) -class FontSettingsWithStreamingResponse: - def __init__(self, font_settings: FontSettings) -> None: +class FontSettingsResourceWithStreamingResponse: + def __init__(self, font_settings: FontSettingsResource) -> None: self._font_settings = font_settings self.edit = to_streamed_response_wrapper( @@ -261,8 +262,8 @@ def __init__(self, font_settings: FontSettings) -> None: ) -class AsyncFontSettingsWithStreamingResponse: - def __init__(self, font_settings: AsyncFontSettings) -> None: +class AsyncFontSettingsResourceWithStreamingResponse: + def __init__(self, font_settings: AsyncFontSettingsResource) -> None: self._font_settings = font_settings self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/h2_prioritization.py b/src/cloudflare/resources/zones/settings/h2_prioritization.py index 6b571b0dcd1..51c445962bc 100644 --- a/src/cloudflare/resources/zones/settings/h2_prioritization.py +++ b/src/cloudflare/resources/zones/settings/h2_prioritization.py @@ -23,36 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ( - ZoneSettingH2Prioritization, - ZoneSettingH2PrioritizationParam, - h2_prioritization_edit_params, -) +from ....types.zones.settings import H2Prioritization, h2_prioritization_edit_params +from ....types.zones.settings.h2_prioritization import H2Prioritization +from ....types.zones.settings.h2_prioritization_param import H2PrioritizationParam -__all__ = ["H2Prioritization", "AsyncH2Prioritization"] +__all__ = ["H2PrioritizationResource", "AsyncH2PrioritizationResource"] -class H2Prioritization(SyncAPIResource): +class H2PrioritizationResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> H2PrioritizationWithRawResponse: - return H2PrioritizationWithRawResponse(self) + def with_raw_response(self) -> H2PrioritizationResourceWithRawResponse: + return H2PrioritizationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> H2PrioritizationWithStreamingResponse: - return H2PrioritizationWithStreamingResponse(self) + def with_streaming_response(self) -> H2PrioritizationResourceWithStreamingResponse: + return H2PrioritizationResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingH2PrioritizationParam, + value: H2PrioritizationParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingH2Prioritization]: + ) -> Optional[H2Prioritization]: """ Gets HTTP/2 Edge Prioritization setting. @@ -81,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[H2Prioritization]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingH2Prioritization]], ResultWrapper[ZoneSettingH2Prioritization]), + cast_to=cast(Type[Optional[H2Prioritization]], ResultWrapper[H2Prioritization]), ) def get( @@ -96,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingH2Prioritization]: + ) -> Optional[H2Prioritization]: """ Gets HTTP/2 Edge Prioritization setting. @@ -120,33 +118,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[H2Prioritization]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingH2Prioritization]], ResultWrapper[ZoneSettingH2Prioritization]), + cast_to=cast(Type[Optional[H2Prioritization]], ResultWrapper[H2Prioritization]), ) -class AsyncH2Prioritization(AsyncAPIResource): +class AsyncH2PrioritizationResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncH2PrioritizationWithRawResponse: - return AsyncH2PrioritizationWithRawResponse(self) + def with_raw_response(self) -> AsyncH2PrioritizationResourceWithRawResponse: + return AsyncH2PrioritizationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncH2PrioritizationWithStreamingResponse: - return AsyncH2PrioritizationWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncH2PrioritizationResourceWithStreamingResponse: + return AsyncH2PrioritizationResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingH2PrioritizationParam, + value: H2PrioritizationParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingH2Prioritization]: + ) -> Optional[H2Prioritization]: """ Gets HTTP/2 Edge Prioritization setting. @@ -177,9 +175,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[H2Prioritization]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingH2Prioritization]], ResultWrapper[ZoneSettingH2Prioritization]), + cast_to=cast(Type[Optional[H2Prioritization]], ResultWrapper[H2Prioritization]), ) async def get( @@ -192,7 +190,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingH2Prioritization]: + ) -> Optional[H2Prioritization]: """ Gets HTTP/2 Edge Prioritization setting. @@ -216,14 +214,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[H2Prioritization]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingH2Prioritization]], ResultWrapper[ZoneSettingH2Prioritization]), + cast_to=cast(Type[Optional[H2Prioritization]], ResultWrapper[H2Prioritization]), ) -class H2PrioritizationWithRawResponse: - def __init__(self, h2_prioritization: H2Prioritization) -> None: +class H2PrioritizationResourceWithRawResponse: + def __init__(self, h2_prioritization: H2PrioritizationResource) -> None: self._h2_prioritization = h2_prioritization self.edit = to_raw_response_wrapper( @@ -234,8 +232,8 @@ def __init__(self, h2_prioritization: H2Prioritization) -> None: ) -class AsyncH2PrioritizationWithRawResponse: - def __init__(self, h2_prioritization: AsyncH2Prioritization) -> None: +class AsyncH2PrioritizationResourceWithRawResponse: + def __init__(self, h2_prioritization: AsyncH2PrioritizationResource) -> None: self._h2_prioritization = h2_prioritization self.edit = async_to_raw_response_wrapper( @@ -246,8 +244,8 @@ def __init__(self, h2_prioritization: AsyncH2Prioritization) -> None: ) -class H2PrioritizationWithStreamingResponse: - def __init__(self, h2_prioritization: H2Prioritization) -> None: +class H2PrioritizationResourceWithStreamingResponse: + def __init__(self, h2_prioritization: H2PrioritizationResource) -> None: self._h2_prioritization = h2_prioritization self.edit = to_streamed_response_wrapper( @@ -258,8 +256,8 @@ def __init__(self, h2_prioritization: H2Prioritization) -> None: ) -class AsyncH2PrioritizationWithStreamingResponse: - def __init__(self, h2_prioritization: AsyncH2Prioritization) -> None: +class AsyncH2PrioritizationResourceWithStreamingResponse: + def __init__(self, h2_prioritization: AsyncH2PrioritizationResource) -> None: self._h2_prioritization = h2_prioritization self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/hotlink_protection.py b/src/cloudflare/resources/zones/settings/hotlink_protection.py index aa71c4eb57b..0b42ae6747d 100644 --- a/src/cloudflare/resources/zones/settings/hotlink_protection.py +++ b/src/cloudflare/resources/zones/settings/hotlink_protection.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingHotlinkProtection, hotlink_protection_edit_params +from ....types.zones.settings import hotlink_protection_edit_params +from ....types.zones.settings.hotlink_protection import HotlinkProtection -__all__ = ["HotlinkProtection", "AsyncHotlinkProtection"] +__all__ = ["HotlinkProtectionResource", "AsyncHotlinkProtectionResource"] -class HotlinkProtection(SyncAPIResource): +class HotlinkProtectionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HotlinkProtectionWithRawResponse: - return HotlinkProtectionWithRawResponse(self) + def with_raw_response(self) -> HotlinkProtectionResourceWithRawResponse: + return HotlinkProtectionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HotlinkProtectionWithStreamingResponse: - return HotlinkProtectionWithStreamingResponse(self) + def with_streaming_response(self) -> HotlinkProtectionResourceWithStreamingResponse: + return HotlinkProtectionResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHotlinkProtection]: + ) -> Optional[HotlinkProtection]: """ When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site. Anytime @@ -82,9 +83,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HotlinkProtection]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHotlinkProtection]], ResultWrapper[ZoneSettingHotlinkProtection]), + cast_to=cast(Type[Optional[HotlinkProtection]], ResultWrapper[HotlinkProtection]), ) def get( @@ -97,7 +98,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHotlinkProtection]: + ) -> Optional[HotlinkProtection]: """ When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site. Anytime @@ -127,20 +128,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HotlinkProtection]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHotlinkProtection]], ResultWrapper[ZoneSettingHotlinkProtection]), + cast_to=cast(Type[Optional[HotlinkProtection]], ResultWrapper[HotlinkProtection]), ) -class AsyncHotlinkProtection(AsyncAPIResource): +class AsyncHotlinkProtectionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHotlinkProtectionWithRawResponse: - return AsyncHotlinkProtectionWithRawResponse(self) + def with_raw_response(self) -> AsyncHotlinkProtectionResourceWithRawResponse: + return AsyncHotlinkProtectionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHotlinkProtectionWithStreamingResponse: - return AsyncHotlinkProtectionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHotlinkProtectionResourceWithStreamingResponse: + return AsyncHotlinkProtectionResourceWithStreamingResponse(self) async def edit( self, @@ -153,7 +154,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHotlinkProtection]: + ) -> Optional[HotlinkProtection]: """ When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site. Anytime @@ -188,9 +189,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HotlinkProtection]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHotlinkProtection]], ResultWrapper[ZoneSettingHotlinkProtection]), + cast_to=cast(Type[Optional[HotlinkProtection]], ResultWrapper[HotlinkProtection]), ) async def get( @@ -203,7 +204,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHotlinkProtection]: + ) -> Optional[HotlinkProtection]: """ When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site. Anytime @@ -233,14 +234,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HotlinkProtection]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHotlinkProtection]], ResultWrapper[ZoneSettingHotlinkProtection]), + cast_to=cast(Type[Optional[HotlinkProtection]], ResultWrapper[HotlinkProtection]), ) -class HotlinkProtectionWithRawResponse: - def __init__(self, hotlink_protection: HotlinkProtection) -> None: +class HotlinkProtectionResourceWithRawResponse: + def __init__(self, hotlink_protection: HotlinkProtectionResource) -> None: self._hotlink_protection = hotlink_protection self.edit = to_raw_response_wrapper( @@ -251,8 +252,8 @@ def __init__(self, hotlink_protection: HotlinkProtection) -> None: ) -class AsyncHotlinkProtectionWithRawResponse: - def __init__(self, hotlink_protection: AsyncHotlinkProtection) -> None: +class AsyncHotlinkProtectionResourceWithRawResponse: + def __init__(self, hotlink_protection: AsyncHotlinkProtectionResource) -> None: self._hotlink_protection = hotlink_protection self.edit = async_to_raw_response_wrapper( @@ -263,8 +264,8 @@ def __init__(self, hotlink_protection: AsyncHotlinkProtection) -> None: ) -class HotlinkProtectionWithStreamingResponse: - def __init__(self, hotlink_protection: HotlinkProtection) -> None: +class HotlinkProtectionResourceWithStreamingResponse: + def __init__(self, hotlink_protection: HotlinkProtectionResource) -> None: self._hotlink_protection = hotlink_protection self.edit = to_streamed_response_wrapper( @@ -275,8 +276,8 @@ def __init__(self, hotlink_protection: HotlinkProtection) -> None: ) -class AsyncHotlinkProtectionWithStreamingResponse: - def __init__(self, hotlink_protection: AsyncHotlinkProtection) -> None: +class AsyncHotlinkProtectionResourceWithStreamingResponse: + def __init__(self, hotlink_protection: AsyncHotlinkProtectionResource) -> None: self._hotlink_protection = hotlink_protection self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/http2.py b/src/cloudflare/resources/zones/settings/http2.py index 0fd5bd4100d..8b545d2e20d 100644 --- a/src/cloudflare/resources/zones/settings/http2.py +++ b/src/cloudflare/resources/zones/settings/http2.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingHTTP2, http2_edit_params +from ....types.zones.settings import http2_edit_params +from ....types.zones.settings.http2 import HTTP2 -__all__ = ["HTTP2", "AsyncHTTP2"] +__all__ = ["HTTP2Resource", "AsyncHTTP2Resource"] -class HTTP2(SyncAPIResource): +class HTTP2Resource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HTTP2WithRawResponse: - return HTTP2WithRawResponse(self) + def with_raw_response(self) -> HTTP2ResourceWithRawResponse: + return HTTP2ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HTTP2WithStreamingResponse: - return HTTP2WithStreamingResponse(self) + def with_streaming_response(self) -> HTTP2ResourceWithStreamingResponse: + return HTTP2ResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHTTP2]: + ) -> Optional[HTTP2]: """ Value of the HTTP2 setting. @@ -76,9 +77,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HTTP2]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHTTP2]], ResultWrapper[ZoneSettingHTTP2]), + cast_to=cast(Type[Optional[HTTP2]], ResultWrapper[HTTP2]), ) def get( @@ -91,7 +92,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHTTP2]: + ) -> Optional[HTTP2]: """ Value of the HTTP2 setting. @@ -115,20 +116,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HTTP2]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHTTP2]], ResultWrapper[ZoneSettingHTTP2]), + cast_to=cast(Type[Optional[HTTP2]], ResultWrapper[HTTP2]), ) -class AsyncHTTP2(AsyncAPIResource): +class AsyncHTTP2Resource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHTTP2WithRawResponse: - return AsyncHTTP2WithRawResponse(self) + def with_raw_response(self) -> AsyncHTTP2ResourceWithRawResponse: + return AsyncHTTP2ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHTTP2WithStreamingResponse: - return AsyncHTTP2WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHTTP2ResourceWithStreamingResponse: + return AsyncHTTP2ResourceWithStreamingResponse(self) async def edit( self, @@ -141,7 +142,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHTTP2]: + ) -> Optional[HTTP2]: """ Value of the HTTP2 setting. @@ -168,9 +169,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HTTP2]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHTTP2]], ResultWrapper[ZoneSettingHTTP2]), + cast_to=cast(Type[Optional[HTTP2]], ResultWrapper[HTTP2]), ) async def get( @@ -183,7 +184,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHTTP2]: + ) -> Optional[HTTP2]: """ Value of the HTTP2 setting. @@ -207,14 +208,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HTTP2]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHTTP2]], ResultWrapper[ZoneSettingHTTP2]), + cast_to=cast(Type[Optional[HTTP2]], ResultWrapper[HTTP2]), ) -class HTTP2WithRawResponse: - def __init__(self, http2: HTTP2) -> None: +class HTTP2ResourceWithRawResponse: + def __init__(self, http2: HTTP2Resource) -> None: self._http2 = http2 self.edit = to_raw_response_wrapper( @@ -225,8 +226,8 @@ def __init__(self, http2: HTTP2) -> None: ) -class AsyncHTTP2WithRawResponse: - def __init__(self, http2: AsyncHTTP2) -> None: +class AsyncHTTP2ResourceWithRawResponse: + def __init__(self, http2: AsyncHTTP2Resource) -> None: self._http2 = http2 self.edit = async_to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, http2: AsyncHTTP2) -> None: ) -class HTTP2WithStreamingResponse: - def __init__(self, http2: HTTP2) -> None: +class HTTP2ResourceWithStreamingResponse: + def __init__(self, http2: HTTP2Resource) -> None: self._http2 = http2 self.edit = to_streamed_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, http2: HTTP2) -> None: ) -class AsyncHTTP2WithStreamingResponse: - def __init__(self, http2: AsyncHTTP2) -> None: +class AsyncHTTP2ResourceWithStreamingResponse: + def __init__(self, http2: AsyncHTTP2Resource) -> None: self._http2 = http2 self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/http3.py b/src/cloudflare/resources/zones/settings/http3.py index 3ce7c57c1eb..cd32293b83a 100644 --- a/src/cloudflare/resources/zones/settings/http3.py +++ b/src/cloudflare/resources/zones/settings/http3.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingHTTP3, http3_edit_params +from ....types.zones.settings import http3_edit_params +from ....types.zones.settings.http3 import HTTP3 -__all__ = ["HTTP3", "AsyncHTTP3"] +__all__ = ["HTTP3Resource", "AsyncHTTP3Resource"] -class HTTP3(SyncAPIResource): +class HTTP3Resource(SyncAPIResource): @cached_property - def with_raw_response(self) -> HTTP3WithRawResponse: - return HTTP3WithRawResponse(self) + def with_raw_response(self) -> HTTP3ResourceWithRawResponse: + return HTTP3ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HTTP3WithStreamingResponse: - return HTTP3WithStreamingResponse(self) + def with_streaming_response(self) -> HTTP3ResourceWithStreamingResponse: + return HTTP3ResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHTTP3]: + ) -> Optional[HTTP3]: """ Value of the HTTP3 setting. @@ -76,9 +77,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HTTP3]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHTTP3]], ResultWrapper[ZoneSettingHTTP3]), + cast_to=cast(Type[Optional[HTTP3]], ResultWrapper[HTTP3]), ) def get( @@ -91,7 +92,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHTTP3]: + ) -> Optional[HTTP3]: """ Value of the HTTP3 setting. @@ -115,20 +116,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HTTP3]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHTTP3]], ResultWrapper[ZoneSettingHTTP3]), + cast_to=cast(Type[Optional[HTTP3]], ResultWrapper[HTTP3]), ) -class AsyncHTTP3(AsyncAPIResource): +class AsyncHTTP3Resource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHTTP3WithRawResponse: - return AsyncHTTP3WithRawResponse(self) + def with_raw_response(self) -> AsyncHTTP3ResourceWithRawResponse: + return AsyncHTTP3ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHTTP3WithStreamingResponse: - return AsyncHTTP3WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncHTTP3ResourceWithStreamingResponse: + return AsyncHTTP3ResourceWithStreamingResponse(self) async def edit( self, @@ -141,7 +142,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHTTP3]: + ) -> Optional[HTTP3]: """ Value of the HTTP3 setting. @@ -168,9 +169,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HTTP3]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHTTP3]], ResultWrapper[ZoneSettingHTTP3]), + cast_to=cast(Type[Optional[HTTP3]], ResultWrapper[HTTP3]), ) async def get( @@ -183,7 +184,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingHTTP3]: + ) -> Optional[HTTP3]: """ Value of the HTTP3 setting. @@ -207,14 +208,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[HTTP3]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingHTTP3]], ResultWrapper[ZoneSettingHTTP3]), + cast_to=cast(Type[Optional[HTTP3]], ResultWrapper[HTTP3]), ) -class HTTP3WithRawResponse: - def __init__(self, http3: HTTP3) -> None: +class HTTP3ResourceWithRawResponse: + def __init__(self, http3: HTTP3Resource) -> None: self._http3 = http3 self.edit = to_raw_response_wrapper( @@ -225,8 +226,8 @@ def __init__(self, http3: HTTP3) -> None: ) -class AsyncHTTP3WithRawResponse: - def __init__(self, http3: AsyncHTTP3) -> None: +class AsyncHTTP3ResourceWithRawResponse: + def __init__(self, http3: AsyncHTTP3Resource) -> None: self._http3 = http3 self.edit = async_to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, http3: AsyncHTTP3) -> None: ) -class HTTP3WithStreamingResponse: - def __init__(self, http3: HTTP3) -> None: +class HTTP3ResourceWithStreamingResponse: + def __init__(self, http3: HTTP3Resource) -> None: self._http3 = http3 self.edit = to_streamed_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, http3: HTTP3) -> None: ) -class AsyncHTTP3WithStreamingResponse: - def __init__(self, http3: AsyncHTTP3) -> None: +class AsyncHTTP3ResourceWithStreamingResponse: + def __init__(self, http3: AsyncHTTP3Resource) -> None: self._http3 = http3 self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/image_resizing.py b/src/cloudflare/resources/zones/settings/image_resizing.py index 3b3a9f888c3..417638b4d67 100644 --- a/src/cloudflare/resources/zones/settings/image_resizing.py +++ b/src/cloudflare/resources/zones/settings/image_resizing.py @@ -23,32 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingImageResizing, ZoneSettingImageResizingParam, image_resizing_edit_params +from ....types.zones.settings import ImageResizing, image_resizing_edit_params +from ....types.zones.settings.image_resizing import ImageResizing +from ....types.zones.settings.image_resizing_param import ImageResizingParam -__all__ = ["ImageResizing", "AsyncImageResizing"] +__all__ = ["ImageResizingResource", "AsyncImageResizingResource"] -class ImageResizing(SyncAPIResource): +class ImageResizingResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ImageResizingWithRawResponse: - return ImageResizingWithRawResponse(self) + def with_raw_response(self) -> ImageResizingResourceWithRawResponse: + return ImageResizingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ImageResizingWithStreamingResponse: - return ImageResizingWithStreamingResponse(self) + def with_streaming_response(self) -> ImageResizingResourceWithStreamingResponse: + return ImageResizingResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingImageResizingParam, + value: ImageResizingParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingImageResizing]: + ) -> Optional[ImageResizing]: """ Image Resizing provides on-demand resizing, conversion and optimisation for images served through Cloudflare's network. Refer to the @@ -81,9 +83,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ImageResizing]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingImageResizing]], ResultWrapper[ZoneSettingImageResizing]), + cast_to=cast(Type[Optional[ImageResizing]], ResultWrapper[ImageResizing]), ) def get( @@ -96,7 +98,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingImageResizing]: + ) -> Optional[ImageResizing]: """ Image Resizing provides on-demand resizing, conversion and optimisation for images served through Cloudflare's network. Refer to the @@ -123,33 +125,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ImageResizing]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingImageResizing]], ResultWrapper[ZoneSettingImageResizing]), + cast_to=cast(Type[Optional[ImageResizing]], ResultWrapper[ImageResizing]), ) -class AsyncImageResizing(AsyncAPIResource): +class AsyncImageResizingResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncImageResizingWithRawResponse: - return AsyncImageResizingWithRawResponse(self) + def with_raw_response(self) -> AsyncImageResizingResourceWithRawResponse: + return AsyncImageResizingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncImageResizingWithStreamingResponse: - return AsyncImageResizingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncImageResizingResourceWithStreamingResponse: + return AsyncImageResizingResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingImageResizingParam, + value: ImageResizingParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingImageResizing]: + ) -> Optional[ImageResizing]: """ Image Resizing provides on-demand resizing, conversion and optimisation for images served through Cloudflare's network. Refer to the @@ -182,9 +184,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ImageResizing]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingImageResizing]], ResultWrapper[ZoneSettingImageResizing]), + cast_to=cast(Type[Optional[ImageResizing]], ResultWrapper[ImageResizing]), ) async def get( @@ -197,7 +199,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingImageResizing]: + ) -> Optional[ImageResizing]: """ Image Resizing provides on-demand resizing, conversion and optimisation for images served through Cloudflare's network. Refer to the @@ -224,14 +226,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ImageResizing]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingImageResizing]], ResultWrapper[ZoneSettingImageResizing]), + cast_to=cast(Type[Optional[ImageResizing]], ResultWrapper[ImageResizing]), ) -class ImageResizingWithRawResponse: - def __init__(self, image_resizing: ImageResizing) -> None: +class ImageResizingResourceWithRawResponse: + def __init__(self, image_resizing: ImageResizingResource) -> None: self._image_resizing = image_resizing self.edit = to_raw_response_wrapper( @@ -242,8 +244,8 @@ def __init__(self, image_resizing: ImageResizing) -> None: ) -class AsyncImageResizingWithRawResponse: - def __init__(self, image_resizing: AsyncImageResizing) -> None: +class AsyncImageResizingResourceWithRawResponse: + def __init__(self, image_resizing: AsyncImageResizingResource) -> None: self._image_resizing = image_resizing self.edit = async_to_raw_response_wrapper( @@ -254,8 +256,8 @@ def __init__(self, image_resizing: AsyncImageResizing) -> None: ) -class ImageResizingWithStreamingResponse: - def __init__(self, image_resizing: ImageResizing) -> None: +class ImageResizingResourceWithStreamingResponse: + def __init__(self, image_resizing: ImageResizingResource) -> None: self._image_resizing = image_resizing self.edit = to_streamed_response_wrapper( @@ -266,8 +268,8 @@ def __init__(self, image_resizing: ImageResizing) -> None: ) -class AsyncImageResizingWithStreamingResponse: - def __init__(self, image_resizing: AsyncImageResizing) -> None: +class AsyncImageResizingResourceWithStreamingResponse: + def __init__(self, image_resizing: AsyncImageResizingResource) -> None: self._image_resizing = image_resizing self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/ip_geolocation.py b/src/cloudflare/resources/zones/settings/ip_geolocation.py index 8a14a19702a..e46ca0373be 100644 --- a/src/cloudflare/resources/zones/settings/ip_geolocation.py +++ b/src/cloudflare/resources/zones/settings/ip_geolocation.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingIPGeolocation, ip_geolocation_edit_params +from ....types.zones.settings import ip_geolocation_edit_params +from ....types.zones.settings.ip_geolocation import IPGeolocation -__all__ = ["IPGeolocation", "AsyncIPGeolocation"] +__all__ = ["IPGeolocationResource", "AsyncIPGeolocationResource"] -class IPGeolocation(SyncAPIResource): +class IPGeolocationResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPGeolocationWithRawResponse: - return IPGeolocationWithRawResponse(self) + def with_raw_response(self) -> IPGeolocationResourceWithRawResponse: + return IPGeolocationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPGeolocationWithStreamingResponse: - return IPGeolocationWithStreamingResponse(self) + def with_streaming_response(self) -> IPGeolocationResourceWithStreamingResponse: + return IPGeolocationResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingIPGeolocation]: + ) -> Optional[IPGeolocation]: """ Enable IP Geolocation to have Cloudflare geolocate visitors to your website and pass the country code to you. @@ -78,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPGeolocation]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingIPGeolocation]], ResultWrapper[ZoneSettingIPGeolocation]), + cast_to=cast(Type[Optional[IPGeolocation]], ResultWrapper[IPGeolocation]), ) def get( @@ -93,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingIPGeolocation]: + ) -> Optional[IPGeolocation]: """ Enable IP Geolocation to have Cloudflare geolocate visitors to your website and pass the country code to you. @@ -119,20 +120,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPGeolocation]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingIPGeolocation]], ResultWrapper[ZoneSettingIPGeolocation]), + cast_to=cast(Type[Optional[IPGeolocation]], ResultWrapper[IPGeolocation]), ) -class AsyncIPGeolocation(AsyncAPIResource): +class AsyncIPGeolocationResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPGeolocationWithRawResponse: - return AsyncIPGeolocationWithRawResponse(self) + def with_raw_response(self) -> AsyncIPGeolocationResourceWithRawResponse: + return AsyncIPGeolocationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPGeolocationWithStreamingResponse: - return AsyncIPGeolocationWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPGeolocationResourceWithStreamingResponse: + return AsyncIPGeolocationResourceWithStreamingResponse(self) async def edit( self, @@ -145,7 +146,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingIPGeolocation]: + ) -> Optional[IPGeolocation]: """ Enable IP Geolocation to have Cloudflare geolocate visitors to your website and pass the country code to you. @@ -174,9 +175,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPGeolocation]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingIPGeolocation]], ResultWrapper[ZoneSettingIPGeolocation]), + cast_to=cast(Type[Optional[IPGeolocation]], ResultWrapper[IPGeolocation]), ) async def get( @@ -189,7 +190,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingIPGeolocation]: + ) -> Optional[IPGeolocation]: """ Enable IP Geolocation to have Cloudflare geolocate visitors to your website and pass the country code to you. @@ -215,14 +216,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPGeolocation]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingIPGeolocation]], ResultWrapper[ZoneSettingIPGeolocation]), + cast_to=cast(Type[Optional[IPGeolocation]], ResultWrapper[IPGeolocation]), ) -class IPGeolocationWithRawResponse: - def __init__(self, ip_geolocation: IPGeolocation) -> None: +class IPGeolocationResourceWithRawResponse: + def __init__(self, ip_geolocation: IPGeolocationResource) -> None: self._ip_geolocation = ip_geolocation self.edit = to_raw_response_wrapper( @@ -233,8 +234,8 @@ def __init__(self, ip_geolocation: IPGeolocation) -> None: ) -class AsyncIPGeolocationWithRawResponse: - def __init__(self, ip_geolocation: AsyncIPGeolocation) -> None: +class AsyncIPGeolocationResourceWithRawResponse: + def __init__(self, ip_geolocation: AsyncIPGeolocationResource) -> None: self._ip_geolocation = ip_geolocation self.edit = async_to_raw_response_wrapper( @@ -245,8 +246,8 @@ def __init__(self, ip_geolocation: AsyncIPGeolocation) -> None: ) -class IPGeolocationWithStreamingResponse: - def __init__(self, ip_geolocation: IPGeolocation) -> None: +class IPGeolocationResourceWithStreamingResponse: + def __init__(self, ip_geolocation: IPGeolocationResource) -> None: self._ip_geolocation = ip_geolocation self.edit = to_streamed_response_wrapper( @@ -257,8 +258,8 @@ def __init__(self, ip_geolocation: IPGeolocation) -> None: ) -class AsyncIPGeolocationWithStreamingResponse: - def __init__(self, ip_geolocation: AsyncIPGeolocation) -> None: +class AsyncIPGeolocationResourceWithStreamingResponse: + def __init__(self, ip_geolocation: AsyncIPGeolocationResource) -> None: self._ip_geolocation = ip_geolocation self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/ipv6.py b/src/cloudflare/resources/zones/settings/ipv6.py index f9284b5731d..5427997cfb8 100644 --- a/src/cloudflare/resources/zones/settings/ipv6.py +++ b/src/cloudflare/resources/zones/settings/ipv6.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingIPV6, ipv6_edit_params +from ....types.zones.settings import ipv6_edit_params +from ....types.zones.settings.ipv6 import IPV6 -__all__ = ["IPV6", "AsyncIPV6"] +__all__ = ["IPV6Resource", "AsyncIPV6Resource"] -class IPV6(SyncAPIResource): +class IPV6Resource(SyncAPIResource): @cached_property - def with_raw_response(self) -> IPV6WithRawResponse: - return IPV6WithRawResponse(self) + def with_raw_response(self) -> IPV6ResourceWithRawResponse: + return IPV6ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> IPV6WithStreamingResponse: - return IPV6WithStreamingResponse(self) + def with_streaming_response(self) -> IPV6ResourceWithStreamingResponse: + return IPV6ResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingIPV6]: + ) -> Optional[IPV6]: """ Enable IPv6 on all subdomains that are Cloudflare enabled. (https://support.cloudflare.com/hc/en-us/articles/200168586). @@ -77,9 +78,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPV6]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingIPV6]], ResultWrapper[ZoneSettingIPV6]), + cast_to=cast(Type[Optional[IPV6]], ResultWrapper[IPV6]), ) def get( @@ -92,7 +93,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingIPV6]: + ) -> Optional[IPV6]: """ Enable IPv6 on all subdomains that are Cloudflare enabled. (https://support.cloudflare.com/hc/en-us/articles/200168586). @@ -117,20 +118,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPV6]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingIPV6]], ResultWrapper[ZoneSettingIPV6]), + cast_to=cast(Type[Optional[IPV6]], ResultWrapper[IPV6]), ) -class AsyncIPV6(AsyncAPIResource): +class AsyncIPV6Resource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncIPV6WithRawResponse: - return AsyncIPV6WithRawResponse(self) + def with_raw_response(self) -> AsyncIPV6ResourceWithRawResponse: + return AsyncIPV6ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncIPV6WithStreamingResponse: - return AsyncIPV6WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIPV6ResourceWithStreamingResponse: + return AsyncIPV6ResourceWithStreamingResponse(self) async def edit( self, @@ -143,7 +144,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingIPV6]: + ) -> Optional[IPV6]: """ Enable IPv6 on all subdomains that are Cloudflare enabled. (https://support.cloudflare.com/hc/en-us/articles/200168586). @@ -171,9 +172,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPV6]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingIPV6]], ResultWrapper[ZoneSettingIPV6]), + cast_to=cast(Type[Optional[IPV6]], ResultWrapper[IPV6]), ) async def get( @@ -186,7 +187,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingIPV6]: + ) -> Optional[IPV6]: """ Enable IPv6 on all subdomains that are Cloudflare enabled. (https://support.cloudflare.com/hc/en-us/articles/200168586). @@ -211,14 +212,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[IPV6]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingIPV6]], ResultWrapper[ZoneSettingIPV6]), + cast_to=cast(Type[Optional[IPV6]], ResultWrapper[IPV6]), ) -class IPV6WithRawResponse: - def __init__(self, ipv6: IPV6) -> None: +class IPV6ResourceWithRawResponse: + def __init__(self, ipv6: IPV6Resource) -> None: self._ipv6 = ipv6 self.edit = to_raw_response_wrapper( @@ -229,8 +230,8 @@ def __init__(self, ipv6: IPV6) -> None: ) -class AsyncIPV6WithRawResponse: - def __init__(self, ipv6: AsyncIPV6) -> None: +class AsyncIPV6ResourceWithRawResponse: + def __init__(self, ipv6: AsyncIPV6Resource) -> None: self._ipv6 = ipv6 self.edit = async_to_raw_response_wrapper( @@ -241,8 +242,8 @@ def __init__(self, ipv6: AsyncIPV6) -> None: ) -class IPV6WithStreamingResponse: - def __init__(self, ipv6: IPV6) -> None: +class IPV6ResourceWithStreamingResponse: + def __init__(self, ipv6: IPV6Resource) -> None: self._ipv6 = ipv6 self.edit = to_streamed_response_wrapper( @@ -253,8 +254,8 @@ def __init__(self, ipv6: IPV6) -> None: ) -class AsyncIPV6WithStreamingResponse: - def __init__(self, ipv6: AsyncIPV6) -> None: +class AsyncIPV6ResourceWithStreamingResponse: + def __init__(self, ipv6: AsyncIPV6Resource) -> None: self._ipv6 = ipv6 self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/min_tls_version.py b/src/cloudflare/resources/zones/settings/min_tls_version.py index bbddcecee43..e497eb57709 100644 --- a/src/cloudflare/resources/zones/settings/min_tls_version.py +++ b/src/cloudflare/resources/zones/settings/min_tls_version.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingMinTLSVersion, min_tls_version_edit_params +from ....types.zones.settings import min_tls_version_edit_params +from ....types.zones.settings.min_tls_version import MinTLSVersion -__all__ = ["MinTLSVersion", "AsyncMinTLSVersion"] +__all__ = ["MinTLSVersionResource", "AsyncMinTLSVersionResource"] -class MinTLSVersion(SyncAPIResource): +class MinTLSVersionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MinTLSVersionWithRawResponse: - return MinTLSVersionWithRawResponse(self) + def with_raw_response(self) -> MinTLSVersionResourceWithRawResponse: + return MinTLSVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MinTLSVersionWithStreamingResponse: - return MinTLSVersionWithStreamingResponse(self) + def with_streaming_response(self) -> MinTLSVersionResourceWithStreamingResponse: + return MinTLSVersionResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMinTLSVersion]: + ) -> Optional[MinTLSVersion]: """ Changes Minimum TLS Version setting. @@ -76,9 +77,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MinTLSVersion]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMinTLSVersion]], ResultWrapper[ZoneSettingMinTLSVersion]), + cast_to=cast(Type[Optional[MinTLSVersion]], ResultWrapper[MinTLSVersion]), ) def get( @@ -91,7 +92,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMinTLSVersion]: + ) -> Optional[MinTLSVersion]: """ Gets Minimum TLS Version setting. @@ -115,20 +116,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MinTLSVersion]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMinTLSVersion]], ResultWrapper[ZoneSettingMinTLSVersion]), + cast_to=cast(Type[Optional[MinTLSVersion]], ResultWrapper[MinTLSVersion]), ) -class AsyncMinTLSVersion(AsyncAPIResource): +class AsyncMinTLSVersionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMinTLSVersionWithRawResponse: - return AsyncMinTLSVersionWithRawResponse(self) + def with_raw_response(self) -> AsyncMinTLSVersionResourceWithRawResponse: + return AsyncMinTLSVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMinTLSVersionWithStreamingResponse: - return AsyncMinTLSVersionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMinTLSVersionResourceWithStreamingResponse: + return AsyncMinTLSVersionResourceWithStreamingResponse(self) async def edit( self, @@ -141,7 +142,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMinTLSVersion]: + ) -> Optional[MinTLSVersion]: """ Changes Minimum TLS Version setting. @@ -168,9 +169,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MinTLSVersion]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMinTLSVersion]], ResultWrapper[ZoneSettingMinTLSVersion]), + cast_to=cast(Type[Optional[MinTLSVersion]], ResultWrapper[MinTLSVersion]), ) async def get( @@ -183,7 +184,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMinTLSVersion]: + ) -> Optional[MinTLSVersion]: """ Gets Minimum TLS Version setting. @@ -207,14 +208,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MinTLSVersion]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMinTLSVersion]], ResultWrapper[ZoneSettingMinTLSVersion]), + cast_to=cast(Type[Optional[MinTLSVersion]], ResultWrapper[MinTLSVersion]), ) -class MinTLSVersionWithRawResponse: - def __init__(self, min_tls_version: MinTLSVersion) -> None: +class MinTLSVersionResourceWithRawResponse: + def __init__(self, min_tls_version: MinTLSVersionResource) -> None: self._min_tls_version = min_tls_version self.edit = to_raw_response_wrapper( @@ -225,8 +226,8 @@ def __init__(self, min_tls_version: MinTLSVersion) -> None: ) -class AsyncMinTLSVersionWithRawResponse: - def __init__(self, min_tls_version: AsyncMinTLSVersion) -> None: +class AsyncMinTLSVersionResourceWithRawResponse: + def __init__(self, min_tls_version: AsyncMinTLSVersionResource) -> None: self._min_tls_version = min_tls_version self.edit = async_to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, min_tls_version: AsyncMinTLSVersion) -> None: ) -class MinTLSVersionWithStreamingResponse: - def __init__(self, min_tls_version: MinTLSVersion) -> None: +class MinTLSVersionResourceWithStreamingResponse: + def __init__(self, min_tls_version: MinTLSVersionResource) -> None: self._min_tls_version = min_tls_version self.edit = to_streamed_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, min_tls_version: MinTLSVersion) -> None: ) -class AsyncMinTLSVersionWithStreamingResponse: - def __init__(self, min_tls_version: AsyncMinTLSVersion) -> None: +class AsyncMinTLSVersionResourceWithStreamingResponse: + def __init__(self, min_tls_version: AsyncMinTLSVersionResource) -> None: self._min_tls_version = min_tls_version self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/minify.py b/src/cloudflare/resources/zones/settings/minify.py index c6c627305e3..695214c16ce 100644 --- a/src/cloudflare/resources/zones/settings/minify.py +++ b/src/cloudflare/resources/zones/settings/minify.py @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingMinify, minify_edit_params +from ....types.zones.settings import minify_edit_params +from ....types.zones.settings.minify import Minify -__all__ = ["Minify", "AsyncMinify"] +__all__ = ["MinifyResource", "AsyncMinifyResource"] -class Minify(SyncAPIResource): +class MinifyResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MinifyWithRawResponse: - return MinifyWithRawResponse(self) + def with_raw_response(self) -> MinifyResourceWithRawResponse: + return MinifyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MinifyWithStreamingResponse: - return MinifyWithStreamingResponse(self) + def with_streaming_response(self) -> MinifyResourceWithStreamingResponse: + return MinifyResourceWithStreamingResponse(self) def edit( self, @@ -48,7 +49,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMinify]: + ) -> Optional[Minify]: """Automatically minify certain assets for your website. Refer to @@ -78,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Minify]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMinify]], ResultWrapper[ZoneSettingMinify]), + cast_to=cast(Type[Optional[Minify]], ResultWrapper[Minify]), ) def get( @@ -93,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMinify]: + ) -> Optional[Minify]: """Automatically minify certain assets for your website. Refer to @@ -120,20 +121,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Minify]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMinify]], ResultWrapper[ZoneSettingMinify]), + cast_to=cast(Type[Optional[Minify]], ResultWrapper[Minify]), ) -class AsyncMinify(AsyncAPIResource): +class AsyncMinifyResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMinifyWithRawResponse: - return AsyncMinifyWithRawResponse(self) + def with_raw_response(self) -> AsyncMinifyResourceWithRawResponse: + return AsyncMinifyResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMinifyWithStreamingResponse: - return AsyncMinifyWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMinifyResourceWithStreamingResponse: + return AsyncMinifyResourceWithStreamingResponse(self) async def edit( self, @@ -146,7 +147,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMinify]: + ) -> Optional[Minify]: """Automatically minify certain assets for your website. Refer to @@ -176,9 +177,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Minify]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMinify]], ResultWrapper[ZoneSettingMinify]), + cast_to=cast(Type[Optional[Minify]], ResultWrapper[Minify]), ) async def get( @@ -191,7 +192,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMinify]: + ) -> Optional[Minify]: """Automatically minify certain assets for your website. Refer to @@ -218,14 +219,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Minify]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMinify]], ResultWrapper[ZoneSettingMinify]), + cast_to=cast(Type[Optional[Minify]], ResultWrapper[Minify]), ) -class MinifyWithRawResponse: - def __init__(self, minify: Minify) -> None: +class MinifyResourceWithRawResponse: + def __init__(self, minify: MinifyResource) -> None: self._minify = minify self.edit = to_raw_response_wrapper( @@ -236,8 +237,8 @@ def __init__(self, minify: Minify) -> None: ) -class AsyncMinifyWithRawResponse: - def __init__(self, minify: AsyncMinify) -> None: +class AsyncMinifyResourceWithRawResponse: + def __init__(self, minify: AsyncMinifyResource) -> None: self._minify = minify self.edit = async_to_raw_response_wrapper( @@ -248,8 +249,8 @@ def __init__(self, minify: AsyncMinify) -> None: ) -class MinifyWithStreamingResponse: - def __init__(self, minify: Minify) -> None: +class MinifyResourceWithStreamingResponse: + def __init__(self, minify: MinifyResource) -> None: self._minify = minify self.edit = to_streamed_response_wrapper( @@ -260,8 +261,8 @@ def __init__(self, minify: Minify) -> None: ) -class AsyncMinifyWithStreamingResponse: - def __init__(self, minify: AsyncMinify) -> None: +class AsyncMinifyResourceWithStreamingResponse: + def __init__(self, minify: AsyncMinifyResource) -> None: self._minify = minify self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/mirage.py b/src/cloudflare/resources/zones/settings/mirage.py index adb93b4163a..3116f40060c 100644 --- a/src/cloudflare/resources/zones/settings/mirage.py +++ b/src/cloudflare/resources/zones/settings/mirage.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingMirage, mirage_edit_params +from ....types.zones.settings import mirage_edit_params +from ....types.zones.settings.mirage import Mirage -__all__ = ["Mirage", "AsyncMirage"] +__all__ = ["MirageResource", "AsyncMirageResource"] -class Mirage(SyncAPIResource): +class MirageResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MirageWithRawResponse: - return MirageWithRawResponse(self) + def with_raw_response(self) -> MirageResourceWithRawResponse: + return MirageResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MirageWithStreamingResponse: - return MirageWithStreamingResponse(self) + def with_streaming_response(self) -> MirageResourceWithStreamingResponse: + return MirageResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMirage]: + ) -> Optional[Mirage]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our @@ -79,9 +80,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Mirage]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMirage]], ResultWrapper[ZoneSettingMirage]), + cast_to=cast(Type[Optional[Mirage]], ResultWrapper[Mirage]), ) def get( @@ -94,7 +95,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMirage]: + ) -> Optional[Mirage]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our @@ -121,20 +122,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Mirage]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMirage]], ResultWrapper[ZoneSettingMirage]), + cast_to=cast(Type[Optional[Mirage]], ResultWrapper[Mirage]), ) -class AsyncMirage(AsyncAPIResource): +class AsyncMirageResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMirageWithRawResponse: - return AsyncMirageWithRawResponse(self) + def with_raw_response(self) -> AsyncMirageResourceWithRawResponse: + return AsyncMirageResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMirageWithStreamingResponse: - return AsyncMirageWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMirageResourceWithStreamingResponse: + return AsyncMirageResourceWithStreamingResponse(self) async def edit( self, @@ -147,7 +148,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMirage]: + ) -> Optional[Mirage]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our @@ -177,9 +178,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Mirage]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMirage]], ResultWrapper[ZoneSettingMirage]), + cast_to=cast(Type[Optional[Mirage]], ResultWrapper[Mirage]), ) async def get( @@ -192,7 +193,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMirage]: + ) -> Optional[Mirage]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our @@ -219,14 +220,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Mirage]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMirage]], ResultWrapper[ZoneSettingMirage]), + cast_to=cast(Type[Optional[Mirage]], ResultWrapper[Mirage]), ) -class MirageWithRawResponse: - def __init__(self, mirage: Mirage) -> None: +class MirageResourceWithRawResponse: + def __init__(self, mirage: MirageResource) -> None: self._mirage = mirage self.edit = to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, mirage: Mirage) -> None: ) -class AsyncMirageWithRawResponse: - def __init__(self, mirage: AsyncMirage) -> None: +class AsyncMirageResourceWithRawResponse: + def __init__(self, mirage: AsyncMirageResource) -> None: self._mirage = mirage self.edit = async_to_raw_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, mirage: AsyncMirage) -> None: ) -class MirageWithStreamingResponse: - def __init__(self, mirage: Mirage) -> None: +class MirageResourceWithStreamingResponse: + def __init__(self, mirage: MirageResource) -> None: self._mirage = mirage self.edit = to_streamed_response_wrapper( @@ -261,8 +262,8 @@ def __init__(self, mirage: Mirage) -> None: ) -class AsyncMirageWithStreamingResponse: - def __init__(self, mirage: AsyncMirage) -> None: +class AsyncMirageResourceWithStreamingResponse: + def __init__(self, mirage: AsyncMirageResource) -> None: self._mirage = mirage self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/mobile_redirect.py b/src/cloudflare/resources/zones/settings/mobile_redirect.py index f02b392efff..8774da3fb24 100644 --- a/src/cloudflare/resources/zones/settings/mobile_redirect.py +++ b/src/cloudflare/resources/zones/settings/mobile_redirect.py @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingMobileRedirect, mobile_redirect_edit_params +from ....types.zones.settings import mobile_redirect_edit_params +from ....types.zones.settings.mobile_redirect import MobileRedirect -__all__ = ["MobileRedirect", "AsyncMobileRedirect"] +__all__ = ["MobileRedirectResource", "AsyncMobileRedirectResource"] -class MobileRedirect(SyncAPIResource): +class MobileRedirectResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> MobileRedirectWithRawResponse: - return MobileRedirectWithRawResponse(self) + def with_raw_response(self) -> MobileRedirectResourceWithRawResponse: + return MobileRedirectResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> MobileRedirectWithStreamingResponse: - return MobileRedirectWithStreamingResponse(self) + def with_streaming_response(self) -> MobileRedirectResourceWithStreamingResponse: + return MobileRedirectResourceWithStreamingResponse(self) def edit( self, @@ -48,7 +49,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMobileRedirect]: + ) -> Optional[MobileRedirect]: """ Automatically redirect visitors on mobile devices to a mobile-optimized subdomain. Refer to @@ -78,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MobileRedirect]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMobileRedirect]], ResultWrapper[ZoneSettingMobileRedirect]), + cast_to=cast(Type[Optional[MobileRedirect]], ResultWrapper[MobileRedirect]), ) def get( @@ -93,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMobileRedirect]: + ) -> Optional[MobileRedirect]: """ Automatically redirect visitors on mobile devices to a mobile-optimized subdomain. Refer to @@ -120,20 +121,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MobileRedirect]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMobileRedirect]], ResultWrapper[ZoneSettingMobileRedirect]), + cast_to=cast(Type[Optional[MobileRedirect]], ResultWrapper[MobileRedirect]), ) -class AsyncMobileRedirect(AsyncAPIResource): +class AsyncMobileRedirectResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncMobileRedirectWithRawResponse: - return AsyncMobileRedirectWithRawResponse(self) + def with_raw_response(self) -> AsyncMobileRedirectResourceWithRawResponse: + return AsyncMobileRedirectResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncMobileRedirectWithStreamingResponse: - return AsyncMobileRedirectWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncMobileRedirectResourceWithStreamingResponse: + return AsyncMobileRedirectResourceWithStreamingResponse(self) async def edit( self, @@ -146,7 +147,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMobileRedirect]: + ) -> Optional[MobileRedirect]: """ Automatically redirect visitors on mobile devices to a mobile-optimized subdomain. Refer to @@ -176,9 +177,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MobileRedirect]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMobileRedirect]], ResultWrapper[ZoneSettingMobileRedirect]), + cast_to=cast(Type[Optional[MobileRedirect]], ResultWrapper[MobileRedirect]), ) async def get( @@ -191,7 +192,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingMobileRedirect]: + ) -> Optional[MobileRedirect]: """ Automatically redirect visitors on mobile devices to a mobile-optimized subdomain. Refer to @@ -218,14 +219,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[MobileRedirect]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingMobileRedirect]], ResultWrapper[ZoneSettingMobileRedirect]), + cast_to=cast(Type[Optional[MobileRedirect]], ResultWrapper[MobileRedirect]), ) -class MobileRedirectWithRawResponse: - def __init__(self, mobile_redirect: MobileRedirect) -> None: +class MobileRedirectResourceWithRawResponse: + def __init__(self, mobile_redirect: MobileRedirectResource) -> None: self._mobile_redirect = mobile_redirect self.edit = to_raw_response_wrapper( @@ -236,8 +237,8 @@ def __init__(self, mobile_redirect: MobileRedirect) -> None: ) -class AsyncMobileRedirectWithRawResponse: - def __init__(self, mobile_redirect: AsyncMobileRedirect) -> None: +class AsyncMobileRedirectResourceWithRawResponse: + def __init__(self, mobile_redirect: AsyncMobileRedirectResource) -> None: self._mobile_redirect = mobile_redirect self.edit = async_to_raw_response_wrapper( @@ -248,8 +249,8 @@ def __init__(self, mobile_redirect: AsyncMobileRedirect) -> None: ) -class MobileRedirectWithStreamingResponse: - def __init__(self, mobile_redirect: MobileRedirect) -> None: +class MobileRedirectResourceWithStreamingResponse: + def __init__(self, mobile_redirect: MobileRedirectResource) -> None: self._mobile_redirect = mobile_redirect self.edit = to_streamed_response_wrapper( @@ -260,8 +261,8 @@ def __init__(self, mobile_redirect: MobileRedirect) -> None: ) -class AsyncMobileRedirectWithStreamingResponse: - def __init__(self, mobile_redirect: AsyncMobileRedirect) -> None: +class AsyncMobileRedirectResourceWithStreamingResponse: + def __init__(self, mobile_redirect: AsyncMobileRedirectResource) -> None: self._mobile_redirect = mobile_redirect self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/nel.py b/src/cloudflare/resources/zones/settings/nel.py index a258ecdf639..325792ab4f1 100644 --- a/src/cloudflare/resources/zones/settings/nel.py +++ b/src/cloudflare/resources/zones/settings/nel.py @@ -23,32 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingNEL, ZoneSettingNELParam, nel_edit_params +from ....types.zones.settings import NEL, nel_edit_params +from ....types.zones.settings.nel import NEL +from ....types.zones.settings.nel_param import NELParam -__all__ = ["NEL", "AsyncNEL"] +__all__ = ["NELResource", "AsyncNELResource"] -class NEL(SyncAPIResource): +class NELResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> NELWithRawResponse: - return NELWithRawResponse(self) + def with_raw_response(self) -> NELResourceWithRawResponse: + return NELResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> NELWithStreamingResponse: - return NELWithStreamingResponse(self) + def with_streaming_response(self) -> NELResourceWithStreamingResponse: + return NELResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingNELParam, + value: NELParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingNEL]: + ) -> Optional[NEL]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our [blog post](http://blog.cloudflare.com/nel-solving-mobile-speed) @@ -77,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NEL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingNEL]], ResultWrapper[ZoneSettingNEL]), + cast_to=cast(Type[Optional[NEL]], ResultWrapper[NEL]), ) def get( @@ -92,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingNEL]: + ) -> Optional[NEL]: """Enable Network Error Logging reporting on your zone. (Beta) @@ -117,33 +119,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NEL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingNEL]], ResultWrapper[ZoneSettingNEL]), + cast_to=cast(Type[Optional[NEL]], ResultWrapper[NEL]), ) -class AsyncNEL(AsyncAPIResource): +class AsyncNELResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncNELWithRawResponse: - return AsyncNELWithRawResponse(self) + def with_raw_response(self) -> AsyncNELResourceWithRawResponse: + return AsyncNELResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncNELWithStreamingResponse: - return AsyncNELWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncNELResourceWithStreamingResponse: + return AsyncNELResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingNELParam, + value: NELParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingNEL]: + ) -> Optional[NEL]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our [blog post](http://blog.cloudflare.com/nel-solving-mobile-speed) @@ -172,9 +174,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NEL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingNEL]], ResultWrapper[ZoneSettingNEL]), + cast_to=cast(Type[Optional[NEL]], ResultWrapper[NEL]), ) async def get( @@ -187,7 +189,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingNEL]: + ) -> Optional[NEL]: """Enable Network Error Logging reporting on your zone. (Beta) @@ -212,14 +214,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[NEL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingNEL]], ResultWrapper[ZoneSettingNEL]), + cast_to=cast(Type[Optional[NEL]], ResultWrapper[NEL]), ) -class NELWithRawResponse: - def __init__(self, nel: NEL) -> None: +class NELResourceWithRawResponse: + def __init__(self, nel: NELResource) -> None: self._nel = nel self.edit = to_raw_response_wrapper( @@ -230,8 +232,8 @@ def __init__(self, nel: NEL) -> None: ) -class AsyncNELWithRawResponse: - def __init__(self, nel: AsyncNEL) -> None: +class AsyncNELResourceWithRawResponse: + def __init__(self, nel: AsyncNELResource) -> None: self._nel = nel self.edit = async_to_raw_response_wrapper( @@ -242,8 +244,8 @@ def __init__(self, nel: AsyncNEL) -> None: ) -class NELWithStreamingResponse: - def __init__(self, nel: NEL) -> None: +class NELResourceWithStreamingResponse: + def __init__(self, nel: NELResource) -> None: self._nel = nel self.edit = to_streamed_response_wrapper( @@ -254,8 +256,8 @@ def __init__(self, nel: NEL) -> None: ) -class AsyncNELWithStreamingResponse: - def __init__(self, nel: AsyncNEL) -> None: +class AsyncNELResourceWithStreamingResponse: + def __init__(self, nel: AsyncNELResource) -> None: self._nel = nel self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/opportunistic_encryption.py b/src/cloudflare/resources/zones/settings/opportunistic_encryption.py index bccb494ce3c..dc2d9cb1ff1 100644 --- a/src/cloudflare/resources/zones/settings/opportunistic_encryption.py +++ b/src/cloudflare/resources/zones/settings/opportunistic_encryption.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingOpportunisticEncryption, opportunistic_encryption_edit_params +from ....types.zones.settings import opportunistic_encryption_edit_params +from ....types.zones.settings.opportunistic_encryption import OpportunisticEncryption -__all__ = ["OpportunisticEncryption", "AsyncOpportunisticEncryption"] +__all__ = ["OpportunisticEncryptionResource", "AsyncOpportunisticEncryptionResource"] -class OpportunisticEncryption(SyncAPIResource): +class OpportunisticEncryptionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OpportunisticEncryptionWithRawResponse: - return OpportunisticEncryptionWithRawResponse(self) + def with_raw_response(self) -> OpportunisticEncryptionResourceWithRawResponse: + return OpportunisticEncryptionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OpportunisticEncryptionWithStreamingResponse: - return OpportunisticEncryptionWithStreamingResponse(self) + def with_streaming_response(self) -> OpportunisticEncryptionResourceWithStreamingResponse: + return OpportunisticEncryptionResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOpportunisticEncryption]: + ) -> Optional[OpportunisticEncryption]: """ Changes Opportunistic Encryption setting. @@ -79,11 +80,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingOpportunisticEncryption]], ResultWrapper[ZoneSettingOpportunisticEncryption] + post_parser=ResultWrapper[Optional[OpportunisticEncryption]]._unwrapper, ), + cast_to=cast(Type[Optional[OpportunisticEncryption]], ResultWrapper[OpportunisticEncryption]), ) def get( @@ -96,7 +95,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOpportunisticEncryption]: + ) -> Optional[OpportunisticEncryption]: """ Gets Opportunistic Encryption setting. @@ -120,22 +119,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingOpportunisticEncryption]], ResultWrapper[ZoneSettingOpportunisticEncryption] + post_parser=ResultWrapper[Optional[OpportunisticEncryption]]._unwrapper, ), + cast_to=cast(Type[Optional[OpportunisticEncryption]], ResultWrapper[OpportunisticEncryption]), ) -class AsyncOpportunisticEncryption(AsyncAPIResource): +class AsyncOpportunisticEncryptionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOpportunisticEncryptionWithRawResponse: - return AsyncOpportunisticEncryptionWithRawResponse(self) + def with_raw_response(self) -> AsyncOpportunisticEncryptionResourceWithRawResponse: + return AsyncOpportunisticEncryptionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOpportunisticEncryptionWithStreamingResponse: - return AsyncOpportunisticEncryptionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOpportunisticEncryptionResourceWithStreamingResponse: + return AsyncOpportunisticEncryptionResourceWithStreamingResponse(self) async def edit( self, @@ -148,7 +145,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOpportunisticEncryption]: + ) -> Optional[OpportunisticEncryption]: """ Changes Opportunistic Encryption setting. @@ -178,11 +175,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingOpportunisticEncryption]], ResultWrapper[ZoneSettingOpportunisticEncryption] + post_parser=ResultWrapper[Optional[OpportunisticEncryption]]._unwrapper, ), + cast_to=cast(Type[Optional[OpportunisticEncryption]], ResultWrapper[OpportunisticEncryption]), ) async def get( @@ -195,7 +190,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOpportunisticEncryption]: + ) -> Optional[OpportunisticEncryption]: """ Gets Opportunistic Encryption setting. @@ -219,16 +214,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingOpportunisticEncryption]], ResultWrapper[ZoneSettingOpportunisticEncryption] + post_parser=ResultWrapper[Optional[OpportunisticEncryption]]._unwrapper, ), + cast_to=cast(Type[Optional[OpportunisticEncryption]], ResultWrapper[OpportunisticEncryption]), ) -class OpportunisticEncryptionWithRawResponse: - def __init__(self, opportunistic_encryption: OpportunisticEncryption) -> None: +class OpportunisticEncryptionResourceWithRawResponse: + def __init__(self, opportunistic_encryption: OpportunisticEncryptionResource) -> None: self._opportunistic_encryption = opportunistic_encryption self.edit = to_raw_response_wrapper( @@ -239,8 +232,8 @@ def __init__(self, opportunistic_encryption: OpportunisticEncryption) -> None: ) -class AsyncOpportunisticEncryptionWithRawResponse: - def __init__(self, opportunistic_encryption: AsyncOpportunisticEncryption) -> None: +class AsyncOpportunisticEncryptionResourceWithRawResponse: + def __init__(self, opportunistic_encryption: AsyncOpportunisticEncryptionResource) -> None: self._opportunistic_encryption = opportunistic_encryption self.edit = async_to_raw_response_wrapper( @@ -251,8 +244,8 @@ def __init__(self, opportunistic_encryption: AsyncOpportunisticEncryption) -> No ) -class OpportunisticEncryptionWithStreamingResponse: - def __init__(self, opportunistic_encryption: OpportunisticEncryption) -> None: +class OpportunisticEncryptionResourceWithStreamingResponse: + def __init__(self, opportunistic_encryption: OpportunisticEncryptionResource) -> None: self._opportunistic_encryption = opportunistic_encryption self.edit = to_streamed_response_wrapper( @@ -263,8 +256,8 @@ def __init__(self, opportunistic_encryption: OpportunisticEncryption) -> None: ) -class AsyncOpportunisticEncryptionWithStreamingResponse: - def __init__(self, opportunistic_encryption: AsyncOpportunisticEncryption) -> None: +class AsyncOpportunisticEncryptionResourceWithStreamingResponse: + def __init__(self, opportunistic_encryption: AsyncOpportunisticEncryptionResource) -> None: self._opportunistic_encryption = opportunistic_encryption self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/opportunistic_onion.py b/src/cloudflare/resources/zones/settings/opportunistic_onion.py index b7aac17aec4..50f3e225e33 100644 --- a/src/cloudflare/resources/zones/settings/opportunistic_onion.py +++ b/src/cloudflare/resources/zones/settings/opportunistic_onion.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingOpportunisticOnion, opportunistic_onion_edit_params +from ....types.zones.settings import opportunistic_onion_edit_params +from ....types.zones.settings.opportunistic_onion import OpportunisticOnion -__all__ = ["OpportunisticOnion", "AsyncOpportunisticOnion"] +__all__ = ["OpportunisticOnionResource", "AsyncOpportunisticOnionResource"] -class OpportunisticOnion(SyncAPIResource): +class OpportunisticOnionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OpportunisticOnionWithRawResponse: - return OpportunisticOnionWithRawResponse(self) + def with_raw_response(self) -> OpportunisticOnionResourceWithRawResponse: + return OpportunisticOnionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OpportunisticOnionWithStreamingResponse: - return OpportunisticOnionWithStreamingResponse(self) + def with_streaming_response(self) -> OpportunisticOnionResourceWithStreamingResponse: + return OpportunisticOnionResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOpportunisticOnion]: + ) -> Optional[OpportunisticOnion]: """ Add an Alt-Svc header to all legitimate requests from Tor, allowing the connection to use our onion services instead of exit nodes. @@ -78,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OpportunisticOnion]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingOpportunisticOnion]], ResultWrapper[ZoneSettingOpportunisticOnion]), + cast_to=cast(Type[Optional[OpportunisticOnion]], ResultWrapper[OpportunisticOnion]), ) def get( @@ -93,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOpportunisticOnion]: + ) -> Optional[OpportunisticOnion]: """ Add an Alt-Svc header to all legitimate requests from Tor, allowing the connection to use our onion services instead of exit nodes. @@ -118,20 +119,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OpportunisticOnion]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingOpportunisticOnion]], ResultWrapper[ZoneSettingOpportunisticOnion]), + cast_to=cast(Type[Optional[OpportunisticOnion]], ResultWrapper[OpportunisticOnion]), ) -class AsyncOpportunisticOnion(AsyncAPIResource): +class AsyncOpportunisticOnionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOpportunisticOnionWithRawResponse: - return AsyncOpportunisticOnionWithRawResponse(self) + def with_raw_response(self) -> AsyncOpportunisticOnionResourceWithRawResponse: + return AsyncOpportunisticOnionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOpportunisticOnionWithStreamingResponse: - return AsyncOpportunisticOnionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOpportunisticOnionResourceWithStreamingResponse: + return AsyncOpportunisticOnionResourceWithStreamingResponse(self) async def edit( self, @@ -144,7 +145,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOpportunisticOnion]: + ) -> Optional[OpportunisticOnion]: """ Add an Alt-Svc header to all legitimate requests from Tor, allowing the connection to use our onion services instead of exit nodes. @@ -175,9 +176,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OpportunisticOnion]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingOpportunisticOnion]], ResultWrapper[ZoneSettingOpportunisticOnion]), + cast_to=cast(Type[Optional[OpportunisticOnion]], ResultWrapper[OpportunisticOnion]), ) async def get( @@ -190,7 +191,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOpportunisticOnion]: + ) -> Optional[OpportunisticOnion]: """ Add an Alt-Svc header to all legitimate requests from Tor, allowing the connection to use our onion services instead of exit nodes. @@ -215,14 +216,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OpportunisticOnion]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingOpportunisticOnion]], ResultWrapper[ZoneSettingOpportunisticOnion]), + cast_to=cast(Type[Optional[OpportunisticOnion]], ResultWrapper[OpportunisticOnion]), ) -class OpportunisticOnionWithRawResponse: - def __init__(self, opportunistic_onion: OpportunisticOnion) -> None: +class OpportunisticOnionResourceWithRawResponse: + def __init__(self, opportunistic_onion: OpportunisticOnionResource) -> None: self._opportunistic_onion = opportunistic_onion self.edit = to_raw_response_wrapper( @@ -233,8 +234,8 @@ def __init__(self, opportunistic_onion: OpportunisticOnion) -> None: ) -class AsyncOpportunisticOnionWithRawResponse: - def __init__(self, opportunistic_onion: AsyncOpportunisticOnion) -> None: +class AsyncOpportunisticOnionResourceWithRawResponse: + def __init__(self, opportunistic_onion: AsyncOpportunisticOnionResource) -> None: self._opportunistic_onion = opportunistic_onion self.edit = async_to_raw_response_wrapper( @@ -245,8 +246,8 @@ def __init__(self, opportunistic_onion: AsyncOpportunisticOnion) -> None: ) -class OpportunisticOnionWithStreamingResponse: - def __init__(self, opportunistic_onion: OpportunisticOnion) -> None: +class OpportunisticOnionResourceWithStreamingResponse: + def __init__(self, opportunistic_onion: OpportunisticOnionResource) -> None: self._opportunistic_onion = opportunistic_onion self.edit = to_streamed_response_wrapper( @@ -257,8 +258,8 @@ def __init__(self, opportunistic_onion: OpportunisticOnion) -> None: ) -class AsyncOpportunisticOnionWithStreamingResponse: - def __init__(self, opportunistic_onion: AsyncOpportunisticOnion) -> None: +class AsyncOpportunisticOnionResourceWithStreamingResponse: + def __init__(self, opportunistic_onion: AsyncOpportunisticOnionResource) -> None: self._opportunistic_onion = opportunistic_onion self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/orange_to_orange.py b/src/cloudflare/resources/zones/settings/orange_to_orange.py index 305f070cad6..c302303ee37 100644 --- a/src/cloudflare/resources/zones/settings/orange_to_orange.py +++ b/src/cloudflare/resources/zones/settings/orange_to_orange.py @@ -23,36 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ( - ZoneSettingOrangeToOrange, - ZoneSettingOrangeToOrangeParam, - orange_to_orange_edit_params, -) +from ....types.zones.settings import OrangeToOrange, orange_to_orange_edit_params +from ....types.zones.settings.orange_to_orange import OrangeToOrange +from ....types.zones.settings.orange_to_orange_param import OrangeToOrangeParam -__all__ = ["OrangeToOrange", "AsyncOrangeToOrange"] +__all__ = ["OrangeToOrangeResource", "AsyncOrangeToOrangeResource"] -class OrangeToOrange(SyncAPIResource): +class OrangeToOrangeResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OrangeToOrangeWithRawResponse: - return OrangeToOrangeWithRawResponse(self) + def with_raw_response(self) -> OrangeToOrangeResourceWithRawResponse: + return OrangeToOrangeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OrangeToOrangeWithStreamingResponse: - return OrangeToOrangeWithStreamingResponse(self) + def with_streaming_response(self) -> OrangeToOrangeResourceWithStreamingResponse: + return OrangeToOrangeResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingOrangeToOrangeParam, + value: OrangeToOrangeParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingOrangeToOrange]: + ) -> Optional[OrangeToOrange]: """ Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also on Cloudflare. @@ -81,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OrangeToOrange]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingOrangeToOrange]], ResultWrapper[ZoneSettingOrangeToOrange]), + cast_to=cast(Type[Optional[OrangeToOrange]], ResultWrapper[OrangeToOrange]), ) def get( @@ -96,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOrangeToOrange]: + ) -> Optional[OrangeToOrange]: """ Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also on Cloudflare. @@ -121,33 +119,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OrangeToOrange]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingOrangeToOrange]], ResultWrapper[ZoneSettingOrangeToOrange]), + cast_to=cast(Type[Optional[OrangeToOrange]], ResultWrapper[OrangeToOrange]), ) -class AsyncOrangeToOrange(AsyncAPIResource): +class AsyncOrangeToOrangeResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOrangeToOrangeWithRawResponse: - return AsyncOrangeToOrangeWithRawResponse(self) + def with_raw_response(self) -> AsyncOrangeToOrangeResourceWithRawResponse: + return AsyncOrangeToOrangeResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOrangeToOrangeWithStreamingResponse: - return AsyncOrangeToOrangeWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOrangeToOrangeResourceWithStreamingResponse: + return AsyncOrangeToOrangeResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingOrangeToOrangeParam, + value: OrangeToOrangeParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingOrangeToOrange]: + ) -> Optional[OrangeToOrange]: """ Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also on Cloudflare. @@ -176,9 +174,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OrangeToOrange]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingOrangeToOrange]], ResultWrapper[ZoneSettingOrangeToOrange]), + cast_to=cast(Type[Optional[OrangeToOrange]], ResultWrapper[OrangeToOrange]), ) async def get( @@ -191,7 +189,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOrangeToOrange]: + ) -> Optional[OrangeToOrange]: """ Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also on Cloudflare. @@ -216,14 +214,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[OrangeToOrange]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingOrangeToOrange]], ResultWrapper[ZoneSettingOrangeToOrange]), + cast_to=cast(Type[Optional[OrangeToOrange]], ResultWrapper[OrangeToOrange]), ) -class OrangeToOrangeWithRawResponse: - def __init__(self, orange_to_orange: OrangeToOrange) -> None: +class OrangeToOrangeResourceWithRawResponse: + def __init__(self, orange_to_orange: OrangeToOrangeResource) -> None: self._orange_to_orange = orange_to_orange self.edit = to_raw_response_wrapper( @@ -234,8 +232,8 @@ def __init__(self, orange_to_orange: OrangeToOrange) -> None: ) -class AsyncOrangeToOrangeWithRawResponse: - def __init__(self, orange_to_orange: AsyncOrangeToOrange) -> None: +class AsyncOrangeToOrangeResourceWithRawResponse: + def __init__(self, orange_to_orange: AsyncOrangeToOrangeResource) -> None: self._orange_to_orange = orange_to_orange self.edit = async_to_raw_response_wrapper( @@ -246,8 +244,8 @@ def __init__(self, orange_to_orange: AsyncOrangeToOrange) -> None: ) -class OrangeToOrangeWithStreamingResponse: - def __init__(self, orange_to_orange: OrangeToOrange) -> None: +class OrangeToOrangeResourceWithStreamingResponse: + def __init__(self, orange_to_orange: OrangeToOrangeResource) -> None: self._orange_to_orange = orange_to_orange self.edit = to_streamed_response_wrapper( @@ -258,8 +256,8 @@ def __init__(self, orange_to_orange: OrangeToOrange) -> None: ) -class AsyncOrangeToOrangeWithStreamingResponse: - def __init__(self, orange_to_orange: AsyncOrangeToOrange) -> None: +class AsyncOrangeToOrangeResourceWithStreamingResponse: + def __init__(self, orange_to_orange: AsyncOrangeToOrangeResource) -> None: self._orange_to_orange = orange_to_orange self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/origin_error_page_pass_thru.py b/src/cloudflare/resources/zones/settings/origin_error_page_pass_thru.py index 3253bc91a55..37a1bae6963 100644 --- a/src/cloudflare/resources/zones/settings/origin_error_page_pass_thru.py +++ b/src/cloudflare/resources/zones/settings/origin_error_page_pass_thru.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingOriginErrorPagePassThru, origin_error_page_pass_thru_edit_params +from ....types.zones.settings import origin_error_page_pass_thru_edit_params +from ....types.zones.settings.origin_error_page_pass_thru import OriginErrorPagePassThru -__all__ = ["OriginErrorPagePassThru", "AsyncOriginErrorPagePassThru"] +__all__ = ["OriginErrorPagePassThruResource", "AsyncOriginErrorPagePassThruResource"] -class OriginErrorPagePassThru(SyncAPIResource): +class OriginErrorPagePassThruResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OriginErrorPagePassThruWithRawResponse: - return OriginErrorPagePassThruWithRawResponse(self) + def with_raw_response(self) -> OriginErrorPagePassThruResourceWithRawResponse: + return OriginErrorPagePassThruResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OriginErrorPagePassThruWithStreamingResponse: - return OriginErrorPagePassThruWithStreamingResponse(self) + def with_streaming_response(self) -> OriginErrorPagePassThruResourceWithStreamingResponse: + return OriginErrorPagePassThruResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOriginErrorPagePassThru]: + ) -> Optional[OriginErrorPagePassThru]: """ Cloudflare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default Cloudflare error page. This does not apply @@ -80,11 +81,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingOriginErrorPagePassThru]], ResultWrapper[ZoneSettingOriginErrorPagePassThru] + post_parser=ResultWrapper[Optional[OriginErrorPagePassThru]]._unwrapper, ), + cast_to=cast(Type[Optional[OriginErrorPagePassThru]], ResultWrapper[OriginErrorPagePassThru]), ) def get( @@ -97,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOriginErrorPagePassThru]: + ) -> Optional[OriginErrorPagePassThru]: """ Cloudflare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default Cloudflare error page. This does not apply @@ -123,22 +122,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingOriginErrorPagePassThru]], ResultWrapper[ZoneSettingOriginErrorPagePassThru] + post_parser=ResultWrapper[Optional[OriginErrorPagePassThru]]._unwrapper, ), + cast_to=cast(Type[Optional[OriginErrorPagePassThru]], ResultWrapper[OriginErrorPagePassThru]), ) -class AsyncOriginErrorPagePassThru(AsyncAPIResource): +class AsyncOriginErrorPagePassThruResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOriginErrorPagePassThruWithRawResponse: - return AsyncOriginErrorPagePassThruWithRawResponse(self) + def with_raw_response(self) -> AsyncOriginErrorPagePassThruResourceWithRawResponse: + return AsyncOriginErrorPagePassThruResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOriginErrorPagePassThruWithStreamingResponse: - return AsyncOriginErrorPagePassThruWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOriginErrorPagePassThruResourceWithStreamingResponse: + return AsyncOriginErrorPagePassThruResourceWithStreamingResponse(self) async def edit( self, @@ -151,7 +148,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOriginErrorPagePassThru]: + ) -> Optional[OriginErrorPagePassThru]: """ Cloudflare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default Cloudflare error page. This does not apply @@ -182,11 +179,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingOriginErrorPagePassThru]], ResultWrapper[ZoneSettingOriginErrorPagePassThru] + post_parser=ResultWrapper[Optional[OriginErrorPagePassThru]]._unwrapper, ), + cast_to=cast(Type[Optional[OriginErrorPagePassThru]], ResultWrapper[OriginErrorPagePassThru]), ) async def get( @@ -199,7 +194,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingOriginErrorPagePassThru]: + ) -> Optional[OriginErrorPagePassThru]: """ Cloudflare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default Cloudflare error page. This does not apply @@ -225,16 +220,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingOriginErrorPagePassThru]], ResultWrapper[ZoneSettingOriginErrorPagePassThru] + post_parser=ResultWrapper[Optional[OriginErrorPagePassThru]]._unwrapper, ), + cast_to=cast(Type[Optional[OriginErrorPagePassThru]], ResultWrapper[OriginErrorPagePassThru]), ) -class OriginErrorPagePassThruWithRawResponse: - def __init__(self, origin_error_page_pass_thru: OriginErrorPagePassThru) -> None: +class OriginErrorPagePassThruResourceWithRawResponse: + def __init__(self, origin_error_page_pass_thru: OriginErrorPagePassThruResource) -> None: self._origin_error_page_pass_thru = origin_error_page_pass_thru self.edit = to_raw_response_wrapper( @@ -245,8 +238,8 @@ def __init__(self, origin_error_page_pass_thru: OriginErrorPagePassThru) -> None ) -class AsyncOriginErrorPagePassThruWithRawResponse: - def __init__(self, origin_error_page_pass_thru: AsyncOriginErrorPagePassThru) -> None: +class AsyncOriginErrorPagePassThruResourceWithRawResponse: + def __init__(self, origin_error_page_pass_thru: AsyncOriginErrorPagePassThruResource) -> None: self._origin_error_page_pass_thru = origin_error_page_pass_thru self.edit = async_to_raw_response_wrapper( @@ -257,8 +250,8 @@ def __init__(self, origin_error_page_pass_thru: AsyncOriginErrorPagePassThru) -> ) -class OriginErrorPagePassThruWithStreamingResponse: - def __init__(self, origin_error_page_pass_thru: OriginErrorPagePassThru) -> None: +class OriginErrorPagePassThruResourceWithStreamingResponse: + def __init__(self, origin_error_page_pass_thru: OriginErrorPagePassThruResource) -> None: self._origin_error_page_pass_thru = origin_error_page_pass_thru self.edit = to_streamed_response_wrapper( @@ -269,8 +262,8 @@ def __init__(self, origin_error_page_pass_thru: OriginErrorPagePassThru) -> None ) -class AsyncOriginErrorPagePassThruWithStreamingResponse: - def __init__(self, origin_error_page_pass_thru: AsyncOriginErrorPagePassThru) -> None: +class AsyncOriginErrorPagePassThruResourceWithStreamingResponse: + def __init__(self, origin_error_page_pass_thru: AsyncOriginErrorPagePassThruResource) -> None: self._origin_error_page_pass_thru = origin_error_page_pass_thru self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/origin_max_http_version.py b/src/cloudflare/resources/zones/settings/origin_max_http_version.py index 4613cf3aa73..29a7f3fff2a 100644 --- a/src/cloudflare/resources/zones/settings/origin_max_http_version.py +++ b/src/cloudflare/resources/zones/settings/origin_max_http_version.py @@ -24,23 +24,21 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ( - OriginMaxHTTPVersionGetResponse, - OriginMaxHTTPVersionEditResponse, - origin_max_http_version_edit_params, -) +from ....types.zones.settings import origin_max_http_version_edit_params +from ....types.zones.settings.origin_max_http_version_get_response import OriginMaxHTTPVersionGetResponse +from ....types.zones.settings.origin_max_http_version_edit_response import OriginMaxHTTPVersionEditResponse -__all__ = ["OriginMaxHTTPVersion", "AsyncOriginMaxHTTPVersion"] +__all__ = ["OriginMaxHTTPVersionResource", "AsyncOriginMaxHTTPVersionResource"] -class OriginMaxHTTPVersion(SyncAPIResource): +class OriginMaxHTTPVersionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OriginMaxHTTPVersionWithRawResponse: - return OriginMaxHTTPVersionWithRawResponse(self) + def with_raw_response(self) -> OriginMaxHTTPVersionResourceWithRawResponse: + return OriginMaxHTTPVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OriginMaxHTTPVersionWithStreamingResponse: - return OriginMaxHTTPVersionWithStreamingResponse(self) + def with_streaming_response(self) -> OriginMaxHTTPVersionResourceWithStreamingResponse: + return OriginMaxHTTPVersionResourceWithStreamingResponse(self) def edit( self, @@ -85,7 +83,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginMaxHTTPVersionEditResponse]._unwrapper, ), cast_to=cast(Type[OriginMaxHTTPVersionEditResponse], ResultWrapper[OriginMaxHTTPVersionEditResponse]), ) @@ -129,20 +127,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginMaxHTTPVersionGetResponse]._unwrapper, ), cast_to=cast(Type[OriginMaxHTTPVersionGetResponse], ResultWrapper[OriginMaxHTTPVersionGetResponse]), ) -class AsyncOriginMaxHTTPVersion(AsyncAPIResource): +class AsyncOriginMaxHTTPVersionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOriginMaxHTTPVersionWithRawResponse: - return AsyncOriginMaxHTTPVersionWithRawResponse(self) + def with_raw_response(self) -> AsyncOriginMaxHTTPVersionResourceWithRawResponse: + return AsyncOriginMaxHTTPVersionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOriginMaxHTTPVersionWithStreamingResponse: - return AsyncOriginMaxHTTPVersionWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOriginMaxHTTPVersionResourceWithStreamingResponse: + return AsyncOriginMaxHTTPVersionResourceWithStreamingResponse(self) async def edit( self, @@ -189,7 +187,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginMaxHTTPVersionEditResponse]._unwrapper, ), cast_to=cast(Type[OriginMaxHTTPVersionEditResponse], ResultWrapper[OriginMaxHTTPVersionEditResponse]), ) @@ -233,14 +231,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[OriginMaxHTTPVersionGetResponse]._unwrapper, ), cast_to=cast(Type[OriginMaxHTTPVersionGetResponse], ResultWrapper[OriginMaxHTTPVersionGetResponse]), ) -class OriginMaxHTTPVersionWithRawResponse: - def __init__(self, origin_max_http_version: OriginMaxHTTPVersion) -> None: +class OriginMaxHTTPVersionResourceWithRawResponse: + def __init__(self, origin_max_http_version: OriginMaxHTTPVersionResource) -> None: self._origin_max_http_version = origin_max_http_version self.edit = to_raw_response_wrapper( @@ -251,8 +249,8 @@ def __init__(self, origin_max_http_version: OriginMaxHTTPVersion) -> None: ) -class AsyncOriginMaxHTTPVersionWithRawResponse: - def __init__(self, origin_max_http_version: AsyncOriginMaxHTTPVersion) -> None: +class AsyncOriginMaxHTTPVersionResourceWithRawResponse: + def __init__(self, origin_max_http_version: AsyncOriginMaxHTTPVersionResource) -> None: self._origin_max_http_version = origin_max_http_version self.edit = async_to_raw_response_wrapper( @@ -263,8 +261,8 @@ def __init__(self, origin_max_http_version: AsyncOriginMaxHTTPVersion) -> None: ) -class OriginMaxHTTPVersionWithStreamingResponse: - def __init__(self, origin_max_http_version: OriginMaxHTTPVersion) -> None: +class OriginMaxHTTPVersionResourceWithStreamingResponse: + def __init__(self, origin_max_http_version: OriginMaxHTTPVersionResource) -> None: self._origin_max_http_version = origin_max_http_version self.edit = to_streamed_response_wrapper( @@ -275,8 +273,8 @@ def __init__(self, origin_max_http_version: OriginMaxHTTPVersion) -> None: ) -class AsyncOriginMaxHTTPVersionWithStreamingResponse: - def __init__(self, origin_max_http_version: AsyncOriginMaxHTTPVersion) -> None: +class AsyncOriginMaxHTTPVersionResourceWithStreamingResponse: + def __init__(self, origin_max_http_version: AsyncOriginMaxHTTPVersionResource) -> None: self._origin_max_http_version = origin_max_http_version self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/polish.py b/src/cloudflare/resources/zones/settings/polish.py index 90d2b75fd7a..9479d26bade 100644 --- a/src/cloudflare/resources/zones/settings/polish.py +++ b/src/cloudflare/resources/zones/settings/polish.py @@ -23,32 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingPolish, ZoneSettingPolishParam, polish_edit_params +from ....types.zones.settings import Polish, polish_edit_params +from ....types.zones.settings.polish import Polish +from ....types.zones.settings.polish_param import PolishParam -__all__ = ["Polish", "AsyncPolish"] +__all__ = ["PolishResource", "AsyncPolishResource"] -class Polish(SyncAPIResource): +class PolishResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PolishWithRawResponse: - return PolishWithRawResponse(self) + def with_raw_response(self) -> PolishResourceWithRawResponse: + return PolishResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PolishWithStreamingResponse: - return PolishWithStreamingResponse(self) + def with_streaming_response(self) -> PolishResourceWithStreamingResponse: + return PolishResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingPolishParam, + value: PolishParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingPolish]: + ) -> Optional[Polish]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) @@ -82,9 +84,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Polish]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPolish]], ResultWrapper[ZoneSettingPolish]), + cast_to=cast(Type[Optional[Polish]], ResultWrapper[Polish]), ) def get( @@ -97,7 +99,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPolish]: + ) -> Optional[Polish]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) @@ -123,33 +125,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Polish]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPolish]], ResultWrapper[ZoneSettingPolish]), + cast_to=cast(Type[Optional[Polish]], ResultWrapper[Polish]), ) -class AsyncPolish(AsyncAPIResource): +class AsyncPolishResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPolishWithRawResponse: - return AsyncPolishWithRawResponse(self) + def with_raw_response(self) -> AsyncPolishResourceWithRawResponse: + return AsyncPolishResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPolishWithStreamingResponse: - return AsyncPolishWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPolishResourceWithStreamingResponse: + return AsyncPolishResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingPolishParam, + value: PolishParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingPolish]: + ) -> Optional[Polish]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) @@ -183,9 +185,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Polish]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPolish]], ResultWrapper[ZoneSettingPolish]), + cast_to=cast(Type[Optional[Polish]], ResultWrapper[Polish]), ) async def get( @@ -198,7 +200,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPolish]: + ) -> Optional[Polish]: """ Automatically optimize image loading for website visitors on mobile devices. Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) @@ -224,14 +226,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Polish]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPolish]], ResultWrapper[ZoneSettingPolish]), + cast_to=cast(Type[Optional[Polish]], ResultWrapper[Polish]), ) -class PolishWithRawResponse: - def __init__(self, polish: Polish) -> None: +class PolishResourceWithRawResponse: + def __init__(self, polish: PolishResource) -> None: self._polish = polish self.edit = to_raw_response_wrapper( @@ -242,8 +244,8 @@ def __init__(self, polish: Polish) -> None: ) -class AsyncPolishWithRawResponse: - def __init__(self, polish: AsyncPolish) -> None: +class AsyncPolishResourceWithRawResponse: + def __init__(self, polish: AsyncPolishResource) -> None: self._polish = polish self.edit = async_to_raw_response_wrapper( @@ -254,8 +256,8 @@ def __init__(self, polish: AsyncPolish) -> None: ) -class PolishWithStreamingResponse: - def __init__(self, polish: Polish) -> None: +class PolishResourceWithStreamingResponse: + def __init__(self, polish: PolishResource) -> None: self._polish = polish self.edit = to_streamed_response_wrapper( @@ -266,8 +268,8 @@ def __init__(self, polish: Polish) -> None: ) -class AsyncPolishWithStreamingResponse: - def __init__(self, polish: AsyncPolish) -> None: +class AsyncPolishResourceWithStreamingResponse: + def __init__(self, polish: AsyncPolishResource) -> None: self._polish = polish self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/prefetch_preload.py b/src/cloudflare/resources/zones/settings/prefetch_preload.py index bff8a11f510..39e208ff405 100644 --- a/src/cloudflare/resources/zones/settings/prefetch_preload.py +++ b/src/cloudflare/resources/zones/settings/prefetch_preload.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingPrefetchPreload, prefetch_preload_edit_params +from ....types.zones.settings import prefetch_preload_edit_params +from ....types.zones.settings.prefetch_preload import PrefetchPreload -__all__ = ["PrefetchPreload", "AsyncPrefetchPreload"] +__all__ = ["PrefetchPreloadResource", "AsyncPrefetchPreloadResource"] -class PrefetchPreload(SyncAPIResource): +class PrefetchPreloadResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PrefetchPreloadWithRawResponse: - return PrefetchPreloadWithRawResponse(self) + def with_raw_response(self) -> PrefetchPreloadResourceWithRawResponse: + return PrefetchPreloadResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PrefetchPreloadWithStreamingResponse: - return PrefetchPreloadWithStreamingResponse(self) + def with_streaming_response(self) -> PrefetchPreloadResourceWithStreamingResponse: + return PrefetchPreloadResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPrefetchPreload]: + ) -> Optional[PrefetchPreload]: """ Cloudflare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones. @@ -77,9 +78,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PrefetchPreload]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPrefetchPreload]], ResultWrapper[ZoneSettingPrefetchPreload]), + cast_to=cast(Type[Optional[PrefetchPreload]], ResultWrapper[PrefetchPreload]), ) def get( @@ -92,7 +93,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPrefetchPreload]: + ) -> Optional[PrefetchPreload]: """ Cloudflare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones. @@ -117,20 +118,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PrefetchPreload]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPrefetchPreload]], ResultWrapper[ZoneSettingPrefetchPreload]), + cast_to=cast(Type[Optional[PrefetchPreload]], ResultWrapper[PrefetchPreload]), ) -class AsyncPrefetchPreload(AsyncAPIResource): +class AsyncPrefetchPreloadResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPrefetchPreloadWithRawResponse: - return AsyncPrefetchPreloadWithRawResponse(self) + def with_raw_response(self) -> AsyncPrefetchPreloadResourceWithRawResponse: + return AsyncPrefetchPreloadResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPrefetchPreloadWithStreamingResponse: - return AsyncPrefetchPreloadWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPrefetchPreloadResourceWithStreamingResponse: + return AsyncPrefetchPreloadResourceWithStreamingResponse(self) async def edit( self, @@ -143,7 +144,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPrefetchPreload]: + ) -> Optional[PrefetchPreload]: """ Cloudflare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones. @@ -171,9 +172,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PrefetchPreload]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPrefetchPreload]], ResultWrapper[ZoneSettingPrefetchPreload]), + cast_to=cast(Type[Optional[PrefetchPreload]], ResultWrapper[PrefetchPreload]), ) async def get( @@ -186,7 +187,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPrefetchPreload]: + ) -> Optional[PrefetchPreload]: """ Cloudflare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones. @@ -211,14 +212,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PrefetchPreload]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPrefetchPreload]], ResultWrapper[ZoneSettingPrefetchPreload]), + cast_to=cast(Type[Optional[PrefetchPreload]], ResultWrapper[PrefetchPreload]), ) -class PrefetchPreloadWithRawResponse: - def __init__(self, prefetch_preload: PrefetchPreload) -> None: +class PrefetchPreloadResourceWithRawResponse: + def __init__(self, prefetch_preload: PrefetchPreloadResource) -> None: self._prefetch_preload = prefetch_preload self.edit = to_raw_response_wrapper( @@ -229,8 +230,8 @@ def __init__(self, prefetch_preload: PrefetchPreload) -> None: ) -class AsyncPrefetchPreloadWithRawResponse: - def __init__(self, prefetch_preload: AsyncPrefetchPreload) -> None: +class AsyncPrefetchPreloadResourceWithRawResponse: + def __init__(self, prefetch_preload: AsyncPrefetchPreloadResource) -> None: self._prefetch_preload = prefetch_preload self.edit = async_to_raw_response_wrapper( @@ -241,8 +242,8 @@ def __init__(self, prefetch_preload: AsyncPrefetchPreload) -> None: ) -class PrefetchPreloadWithStreamingResponse: - def __init__(self, prefetch_preload: PrefetchPreload) -> None: +class PrefetchPreloadResourceWithStreamingResponse: + def __init__(self, prefetch_preload: PrefetchPreloadResource) -> None: self._prefetch_preload = prefetch_preload self.edit = to_streamed_response_wrapper( @@ -253,8 +254,8 @@ def __init__(self, prefetch_preload: PrefetchPreload) -> None: ) -class AsyncPrefetchPreloadWithStreamingResponse: - def __init__(self, prefetch_preload: AsyncPrefetchPreload) -> None: +class AsyncPrefetchPreloadResourceWithStreamingResponse: + def __init__(self, prefetch_preload: AsyncPrefetchPreloadResource) -> None: self._prefetch_preload = prefetch_preload self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/proxy_read_timeout.py b/src/cloudflare/resources/zones/settings/proxy_read_timeout.py index 4fd41b55eca..1fd18b0cf77 100644 --- a/src/cloudflare/resources/zones/settings/proxy_read_timeout.py +++ b/src/cloudflare/resources/zones/settings/proxy_read_timeout.py @@ -23,36 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ( - ZoneSettingProxyReadTimeout, - ZoneSettingProxyReadTimeoutParam, - proxy_read_timeout_edit_params, -) +from ....types.zones.settings import ProxyReadTimeout, proxy_read_timeout_edit_params +from ....types.zones.settings.proxy_read_timeout import ProxyReadTimeout +from ....types.zones.settings.proxy_read_timeout_param import ProxyReadTimeoutParam -__all__ = ["ProxyReadTimeout", "AsyncProxyReadTimeout"] +__all__ = ["ProxyReadTimeoutResource", "AsyncProxyReadTimeoutResource"] -class ProxyReadTimeout(SyncAPIResource): +class ProxyReadTimeoutResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ProxyReadTimeoutWithRawResponse: - return ProxyReadTimeoutWithRawResponse(self) + def with_raw_response(self) -> ProxyReadTimeoutResourceWithRawResponse: + return ProxyReadTimeoutResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ProxyReadTimeoutWithStreamingResponse: - return ProxyReadTimeoutWithStreamingResponse(self) + def with_streaming_response(self) -> ProxyReadTimeoutResourceWithStreamingResponse: + return ProxyReadTimeoutResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingProxyReadTimeoutParam, + value: ProxyReadTimeoutParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingProxyReadTimeout]: + ) -> Optional[ProxyReadTimeout]: """ Maximum time between two read operations from origin. @@ -79,9 +77,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyReadTimeout]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingProxyReadTimeout]], ResultWrapper[ZoneSettingProxyReadTimeout]), + cast_to=cast(Type[Optional[ProxyReadTimeout]], ResultWrapper[ProxyReadTimeout]), ) def get( @@ -94,7 +92,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingProxyReadTimeout]: + ) -> Optional[ProxyReadTimeout]: """ Maximum time between two read operations from origin. @@ -118,33 +116,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyReadTimeout]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingProxyReadTimeout]], ResultWrapper[ZoneSettingProxyReadTimeout]), + cast_to=cast(Type[Optional[ProxyReadTimeout]], ResultWrapper[ProxyReadTimeout]), ) -class AsyncProxyReadTimeout(AsyncAPIResource): +class AsyncProxyReadTimeoutResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncProxyReadTimeoutWithRawResponse: - return AsyncProxyReadTimeoutWithRawResponse(self) + def with_raw_response(self) -> AsyncProxyReadTimeoutResourceWithRawResponse: + return AsyncProxyReadTimeoutResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncProxyReadTimeoutWithStreamingResponse: - return AsyncProxyReadTimeoutWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncProxyReadTimeoutResourceWithStreamingResponse: + return AsyncProxyReadTimeoutResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingProxyReadTimeoutParam, + value: ProxyReadTimeoutParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingProxyReadTimeout]: + ) -> Optional[ProxyReadTimeout]: """ Maximum time between two read operations from origin. @@ -173,9 +171,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyReadTimeout]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingProxyReadTimeout]], ResultWrapper[ZoneSettingProxyReadTimeout]), + cast_to=cast(Type[Optional[ProxyReadTimeout]], ResultWrapper[ProxyReadTimeout]), ) async def get( @@ -188,7 +186,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingProxyReadTimeout]: + ) -> Optional[ProxyReadTimeout]: """ Maximum time between two read operations from origin. @@ -212,14 +210,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ProxyReadTimeout]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingProxyReadTimeout]], ResultWrapper[ZoneSettingProxyReadTimeout]), + cast_to=cast(Type[Optional[ProxyReadTimeout]], ResultWrapper[ProxyReadTimeout]), ) -class ProxyReadTimeoutWithRawResponse: - def __init__(self, proxy_read_timeout: ProxyReadTimeout) -> None: +class ProxyReadTimeoutResourceWithRawResponse: + def __init__(self, proxy_read_timeout: ProxyReadTimeoutResource) -> None: self._proxy_read_timeout = proxy_read_timeout self.edit = to_raw_response_wrapper( @@ -230,8 +228,8 @@ def __init__(self, proxy_read_timeout: ProxyReadTimeout) -> None: ) -class AsyncProxyReadTimeoutWithRawResponse: - def __init__(self, proxy_read_timeout: AsyncProxyReadTimeout) -> None: +class AsyncProxyReadTimeoutResourceWithRawResponse: + def __init__(self, proxy_read_timeout: AsyncProxyReadTimeoutResource) -> None: self._proxy_read_timeout = proxy_read_timeout self.edit = async_to_raw_response_wrapper( @@ -242,8 +240,8 @@ def __init__(self, proxy_read_timeout: AsyncProxyReadTimeout) -> None: ) -class ProxyReadTimeoutWithStreamingResponse: - def __init__(self, proxy_read_timeout: ProxyReadTimeout) -> None: +class ProxyReadTimeoutResourceWithStreamingResponse: + def __init__(self, proxy_read_timeout: ProxyReadTimeoutResource) -> None: self._proxy_read_timeout = proxy_read_timeout self.edit = to_streamed_response_wrapper( @@ -254,8 +252,8 @@ def __init__(self, proxy_read_timeout: ProxyReadTimeout) -> None: ) -class AsyncProxyReadTimeoutWithStreamingResponse: - def __init__(self, proxy_read_timeout: AsyncProxyReadTimeout) -> None: +class AsyncProxyReadTimeoutResourceWithStreamingResponse: + def __init__(self, proxy_read_timeout: AsyncProxyReadTimeoutResource) -> None: self._proxy_read_timeout = proxy_read_timeout self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/pseudo_ipv4.py b/src/cloudflare/resources/zones/settings/pseudo_ipv4.py index ab49ee30256..c30371d3e58 100644 --- a/src/cloudflare/resources/zones/settings/pseudo_ipv4.py +++ b/src/cloudflare/resources/zones/settings/pseudo_ipv4.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingPseudoIPV4, pseudo_ipv4_edit_params +from ....types.zones.settings import pseudo_ipv4_edit_params +from ....types.zones.settings.pseudo_ipv4 import PseudoIPV4 -__all__ = ["PseudoIPV4", "AsyncPseudoIPV4"] +__all__ = ["PseudoIPV4Resource", "AsyncPseudoIPV4Resource"] -class PseudoIPV4(SyncAPIResource): +class PseudoIPV4Resource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PseudoIPV4WithRawResponse: - return PseudoIPV4WithRawResponse(self) + def with_raw_response(self) -> PseudoIPV4ResourceWithRawResponse: + return PseudoIPV4ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PseudoIPV4WithStreamingResponse: - return PseudoIPV4WithStreamingResponse(self) + def with_streaming_response(self) -> PseudoIPV4ResourceWithStreamingResponse: + return PseudoIPV4ResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPseudoIPV4]: + ) -> Optional[PseudoIPV4]: """ Value of the Pseudo IPv4 setting. @@ -76,9 +77,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PseudoIPV4]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPseudoIPV4]], ResultWrapper[ZoneSettingPseudoIPV4]), + cast_to=cast(Type[Optional[PseudoIPV4]], ResultWrapper[PseudoIPV4]), ) def get( @@ -91,7 +92,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPseudoIPV4]: + ) -> Optional[PseudoIPV4]: """ Value of the Pseudo IPv4 setting. @@ -115,20 +116,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PseudoIPV4]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPseudoIPV4]], ResultWrapper[ZoneSettingPseudoIPV4]), + cast_to=cast(Type[Optional[PseudoIPV4]], ResultWrapper[PseudoIPV4]), ) -class AsyncPseudoIPV4(AsyncAPIResource): +class AsyncPseudoIPV4Resource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPseudoIPV4WithRawResponse: - return AsyncPseudoIPV4WithRawResponse(self) + def with_raw_response(self) -> AsyncPseudoIPV4ResourceWithRawResponse: + return AsyncPseudoIPV4ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPseudoIPV4WithStreamingResponse: - return AsyncPseudoIPV4WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPseudoIPV4ResourceWithStreamingResponse: + return AsyncPseudoIPV4ResourceWithStreamingResponse(self) async def edit( self, @@ -141,7 +142,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPseudoIPV4]: + ) -> Optional[PseudoIPV4]: """ Value of the Pseudo IPv4 setting. @@ -168,9 +169,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PseudoIPV4]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPseudoIPV4]], ResultWrapper[ZoneSettingPseudoIPV4]), + cast_to=cast(Type[Optional[PseudoIPV4]], ResultWrapper[PseudoIPV4]), ) async def get( @@ -183,7 +184,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingPseudoIPV4]: + ) -> Optional[PseudoIPV4]: """ Value of the Pseudo IPv4 setting. @@ -207,14 +208,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[PseudoIPV4]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingPseudoIPV4]], ResultWrapper[ZoneSettingPseudoIPV4]), + cast_to=cast(Type[Optional[PseudoIPV4]], ResultWrapper[PseudoIPV4]), ) -class PseudoIPV4WithRawResponse: - def __init__(self, pseudo_ipv4: PseudoIPV4) -> None: +class PseudoIPV4ResourceWithRawResponse: + def __init__(self, pseudo_ipv4: PseudoIPV4Resource) -> None: self._pseudo_ipv4 = pseudo_ipv4 self.edit = to_raw_response_wrapper( @@ -225,8 +226,8 @@ def __init__(self, pseudo_ipv4: PseudoIPV4) -> None: ) -class AsyncPseudoIPV4WithRawResponse: - def __init__(self, pseudo_ipv4: AsyncPseudoIPV4) -> None: +class AsyncPseudoIPV4ResourceWithRawResponse: + def __init__(self, pseudo_ipv4: AsyncPseudoIPV4Resource) -> None: self._pseudo_ipv4 = pseudo_ipv4 self.edit = async_to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, pseudo_ipv4: AsyncPseudoIPV4) -> None: ) -class PseudoIPV4WithStreamingResponse: - def __init__(self, pseudo_ipv4: PseudoIPV4) -> None: +class PseudoIPV4ResourceWithStreamingResponse: + def __init__(self, pseudo_ipv4: PseudoIPV4Resource) -> None: self._pseudo_ipv4 = pseudo_ipv4 self.edit = to_streamed_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, pseudo_ipv4: PseudoIPV4) -> None: ) -class AsyncPseudoIPV4WithStreamingResponse: - def __init__(self, pseudo_ipv4: AsyncPseudoIPV4) -> None: +class AsyncPseudoIPV4ResourceWithStreamingResponse: + def __init__(self, pseudo_ipv4: AsyncPseudoIPV4Resource) -> None: self._pseudo_ipv4 = pseudo_ipv4 self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/response_buffering.py b/src/cloudflare/resources/zones/settings/response_buffering.py index 041eb425af5..d00093ba87a 100644 --- a/src/cloudflare/resources/zones/settings/response_buffering.py +++ b/src/cloudflare/resources/zones/settings/response_buffering.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingBuffering, response_buffering_edit_params +from ....types.zones.settings import response_buffering_edit_params +from ....types.zones.settings.response_buffering import ResponseBuffering -__all__ = ["ResponseBuffering", "AsyncResponseBuffering"] +__all__ = ["ResponseBufferingResource", "AsyncResponseBufferingResource"] -class ResponseBuffering(SyncAPIResource): +class ResponseBufferingResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ResponseBufferingWithRawResponse: - return ResponseBufferingWithRawResponse(self) + def with_raw_response(self) -> ResponseBufferingResourceWithRawResponse: + return ResponseBufferingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ResponseBufferingWithStreamingResponse: - return ResponseBufferingWithStreamingResponse(self) + def with_streaming_response(self) -> ResponseBufferingResourceWithStreamingResponse: + return ResponseBufferingResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBuffering]: + ) -> Optional[ResponseBuffering]: """Enables or disables buffering of responses from the proxied server. Cloudflare @@ -80,9 +81,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ResponseBuffering]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBuffering]], ResultWrapper[ZoneSettingBuffering]), + cast_to=cast(Type[Optional[ResponseBuffering]], ResultWrapper[ResponseBuffering]), ) def get( @@ -95,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBuffering]: + ) -> Optional[ResponseBuffering]: """Enables or disables buffering of responses from the proxied server. Cloudflare @@ -123,20 +124,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ResponseBuffering]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBuffering]], ResultWrapper[ZoneSettingBuffering]), + cast_to=cast(Type[Optional[ResponseBuffering]], ResultWrapper[ResponseBuffering]), ) -class AsyncResponseBuffering(AsyncAPIResource): +class AsyncResponseBufferingResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncResponseBufferingWithRawResponse: - return AsyncResponseBufferingWithRawResponse(self) + def with_raw_response(self) -> AsyncResponseBufferingResourceWithRawResponse: + return AsyncResponseBufferingResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncResponseBufferingWithStreamingResponse: - return AsyncResponseBufferingWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncResponseBufferingResourceWithStreamingResponse: + return AsyncResponseBufferingResourceWithStreamingResponse(self) async def edit( self, @@ -149,7 +150,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBuffering]: + ) -> Optional[ResponseBuffering]: """Enables or disables buffering of responses from the proxied server. Cloudflare @@ -182,9 +183,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ResponseBuffering]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBuffering]], ResultWrapper[ZoneSettingBuffering]), + cast_to=cast(Type[Optional[ResponseBuffering]], ResultWrapper[ResponseBuffering]), ) async def get( @@ -197,7 +198,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingBuffering]: + ) -> Optional[ResponseBuffering]: """Enables or disables buffering of responses from the proxied server. Cloudflare @@ -225,14 +226,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ResponseBuffering]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingBuffering]], ResultWrapper[ZoneSettingBuffering]), + cast_to=cast(Type[Optional[ResponseBuffering]], ResultWrapper[ResponseBuffering]), ) -class ResponseBufferingWithRawResponse: - def __init__(self, response_buffering: ResponseBuffering) -> None: +class ResponseBufferingResourceWithRawResponse: + def __init__(self, response_buffering: ResponseBufferingResource) -> None: self._response_buffering = response_buffering self.edit = to_raw_response_wrapper( @@ -243,8 +244,8 @@ def __init__(self, response_buffering: ResponseBuffering) -> None: ) -class AsyncResponseBufferingWithRawResponse: - def __init__(self, response_buffering: AsyncResponseBuffering) -> None: +class AsyncResponseBufferingResourceWithRawResponse: + def __init__(self, response_buffering: AsyncResponseBufferingResource) -> None: self._response_buffering = response_buffering self.edit = async_to_raw_response_wrapper( @@ -255,8 +256,8 @@ def __init__(self, response_buffering: AsyncResponseBuffering) -> None: ) -class ResponseBufferingWithStreamingResponse: - def __init__(self, response_buffering: ResponseBuffering) -> None: +class ResponseBufferingResourceWithStreamingResponse: + def __init__(self, response_buffering: ResponseBufferingResource) -> None: self._response_buffering = response_buffering self.edit = to_streamed_response_wrapper( @@ -267,8 +268,8 @@ def __init__(self, response_buffering: ResponseBuffering) -> None: ) -class AsyncResponseBufferingWithStreamingResponse: - def __init__(self, response_buffering: AsyncResponseBuffering) -> None: +class AsyncResponseBufferingResourceWithStreamingResponse: + def __init__(self, response_buffering: AsyncResponseBufferingResource) -> None: self._response_buffering = response_buffering self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/rocket_loader.py b/src/cloudflare/resources/zones/settings/rocket_loader.py index 73b5ddadd6c..0fbe364370d 100644 --- a/src/cloudflare/resources/zones/settings/rocket_loader.py +++ b/src/cloudflare/resources/zones/settings/rocket_loader.py @@ -23,32 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingRocketLoader, ZoneSettingRocketLoaderParam, rocket_loader_edit_params +from ....types.zones.settings import RocketLoader, rocket_loader_edit_params +from ....types.zones.settings.rocket_loader import RocketLoader +from ....types.zones.settings.rocket_loader_param import RocketLoaderParam -__all__ = ["RocketLoader", "AsyncRocketLoader"] +__all__ = ["RocketLoaderResource", "AsyncRocketLoaderResource"] -class RocketLoader(SyncAPIResource): +class RocketLoaderResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RocketLoaderWithRawResponse: - return RocketLoaderWithRawResponse(self) + def with_raw_response(self) -> RocketLoaderResourceWithRawResponse: + return RocketLoaderResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RocketLoaderWithStreamingResponse: - return RocketLoaderWithStreamingResponse(self) + def with_streaming_response(self) -> RocketLoaderResourceWithStreamingResponse: + return RocketLoaderResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingRocketLoaderParam, + value: RocketLoaderParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingRocketLoader]: + ) -> Optional[RocketLoader]: """ Rocket Loader is a general-purpose asynchronous JavaScript optimisation that prioritises rendering your content while loading your site's Javascript @@ -93,9 +95,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RocketLoader]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingRocketLoader]], ResultWrapper[ZoneSettingRocketLoader]), + cast_to=cast(Type[Optional[RocketLoader]], ResultWrapper[RocketLoader]), ) def get( @@ -108,7 +110,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingRocketLoader]: + ) -> Optional[RocketLoader]: """ Rocket Loader is a general-purpose asynchronous JavaScript optimisation that prioritises rendering your content while loading your site's Javascript @@ -141,33 +143,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RocketLoader]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingRocketLoader]], ResultWrapper[ZoneSettingRocketLoader]), + cast_to=cast(Type[Optional[RocketLoader]], ResultWrapper[RocketLoader]), ) -class AsyncRocketLoader(AsyncAPIResource): +class AsyncRocketLoaderResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRocketLoaderWithRawResponse: - return AsyncRocketLoaderWithRawResponse(self) + def with_raw_response(self) -> AsyncRocketLoaderResourceWithRawResponse: + return AsyncRocketLoaderResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRocketLoaderWithStreamingResponse: - return AsyncRocketLoaderWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRocketLoaderResourceWithStreamingResponse: + return AsyncRocketLoaderResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingRocketLoaderParam, + value: RocketLoaderParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingRocketLoader]: + ) -> Optional[RocketLoader]: """ Rocket Loader is a general-purpose asynchronous JavaScript optimisation that prioritises rendering your content while loading your site's Javascript @@ -212,9 +214,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RocketLoader]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingRocketLoader]], ResultWrapper[ZoneSettingRocketLoader]), + cast_to=cast(Type[Optional[RocketLoader]], ResultWrapper[RocketLoader]), ) async def get( @@ -227,7 +229,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingRocketLoader]: + ) -> Optional[RocketLoader]: """ Rocket Loader is a general-purpose asynchronous JavaScript optimisation that prioritises rendering your content while loading your site's Javascript @@ -260,14 +262,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[RocketLoader]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingRocketLoader]], ResultWrapper[ZoneSettingRocketLoader]), + cast_to=cast(Type[Optional[RocketLoader]], ResultWrapper[RocketLoader]), ) -class RocketLoaderWithRawResponse: - def __init__(self, rocket_loader: RocketLoader) -> None: +class RocketLoaderResourceWithRawResponse: + def __init__(self, rocket_loader: RocketLoaderResource) -> None: self._rocket_loader = rocket_loader self.edit = to_raw_response_wrapper( @@ -278,8 +280,8 @@ def __init__(self, rocket_loader: RocketLoader) -> None: ) -class AsyncRocketLoaderWithRawResponse: - def __init__(self, rocket_loader: AsyncRocketLoader) -> None: +class AsyncRocketLoaderResourceWithRawResponse: + def __init__(self, rocket_loader: AsyncRocketLoaderResource) -> None: self._rocket_loader = rocket_loader self.edit = async_to_raw_response_wrapper( @@ -290,8 +292,8 @@ def __init__(self, rocket_loader: AsyncRocketLoader) -> None: ) -class RocketLoaderWithStreamingResponse: - def __init__(self, rocket_loader: RocketLoader) -> None: +class RocketLoaderResourceWithStreamingResponse: + def __init__(self, rocket_loader: RocketLoaderResource) -> None: self._rocket_loader = rocket_loader self.edit = to_streamed_response_wrapper( @@ -302,8 +304,8 @@ def __init__(self, rocket_loader: RocketLoader) -> None: ) -class AsyncRocketLoaderWithStreamingResponse: - def __init__(self, rocket_loader: AsyncRocketLoader) -> None: +class AsyncRocketLoaderResourceWithStreamingResponse: + def __init__(self, rocket_loader: AsyncRocketLoaderResource) -> None: self._rocket_loader = rocket_loader self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/security_headers.py b/src/cloudflare/resources/zones/settings/security_headers.py index 88fcd7d0bab..5c97da0cea2 100644 --- a/src/cloudflare/resources/zones/settings/security_headers.py +++ b/src/cloudflare/resources/zones/settings/security_headers.py @@ -23,19 +23,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingSecurityHeader, security_header_edit_params +from ....types.zones.settings import security_header_edit_params +from ....types.zones.settings.security_headers import SecurityHeaders -__all__ = ["SecurityHeaders", "AsyncSecurityHeaders"] +__all__ = ["SecurityHeadersResource", "AsyncSecurityHeadersResource"] -class SecurityHeaders(SyncAPIResource): +class SecurityHeadersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SecurityHeadersWithRawResponse: - return SecurityHeadersWithRawResponse(self) + def with_raw_response(self) -> SecurityHeadersResourceWithRawResponse: + return SecurityHeadersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SecurityHeadersWithStreamingResponse: - return SecurityHeadersWithStreamingResponse(self) + def with_streaming_response(self) -> SecurityHeadersResourceWithStreamingResponse: + return SecurityHeadersResourceWithStreamingResponse(self) def edit( self, @@ -48,7 +49,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSecurityHeader]: + ) -> Optional[SecurityHeaders]: """ Cloudflare security header for a zone. @@ -73,9 +74,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SecurityHeaders]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSecurityHeader]], ResultWrapper[ZoneSettingSecurityHeader]), + cast_to=cast(Type[Optional[SecurityHeaders]], ResultWrapper[SecurityHeaders]), ) def get( @@ -88,7 +89,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSecurityHeader]: + ) -> Optional[SecurityHeaders]: """ Cloudflare security header for a zone. @@ -112,20 +113,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SecurityHeaders]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSecurityHeader]], ResultWrapper[ZoneSettingSecurityHeader]), + cast_to=cast(Type[Optional[SecurityHeaders]], ResultWrapper[SecurityHeaders]), ) -class AsyncSecurityHeaders(AsyncAPIResource): +class AsyncSecurityHeadersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSecurityHeadersWithRawResponse: - return AsyncSecurityHeadersWithRawResponse(self) + def with_raw_response(self) -> AsyncSecurityHeadersResourceWithRawResponse: + return AsyncSecurityHeadersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSecurityHeadersWithStreamingResponse: - return AsyncSecurityHeadersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSecurityHeadersResourceWithStreamingResponse: + return AsyncSecurityHeadersResourceWithStreamingResponse(self) async def edit( self, @@ -138,7 +139,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSecurityHeader]: + ) -> Optional[SecurityHeaders]: """ Cloudflare security header for a zone. @@ -163,9 +164,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SecurityHeaders]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSecurityHeader]], ResultWrapper[ZoneSettingSecurityHeader]), + cast_to=cast(Type[Optional[SecurityHeaders]], ResultWrapper[SecurityHeaders]), ) async def get( @@ -178,7 +179,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSecurityHeader]: + ) -> Optional[SecurityHeaders]: """ Cloudflare security header for a zone. @@ -202,14 +203,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SecurityHeaders]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSecurityHeader]], ResultWrapper[ZoneSettingSecurityHeader]), + cast_to=cast(Type[Optional[SecurityHeaders]], ResultWrapper[SecurityHeaders]), ) -class SecurityHeadersWithRawResponse: - def __init__(self, security_headers: SecurityHeaders) -> None: +class SecurityHeadersResourceWithRawResponse: + def __init__(self, security_headers: SecurityHeadersResource) -> None: self._security_headers = security_headers self.edit = to_raw_response_wrapper( @@ -220,8 +221,8 @@ def __init__(self, security_headers: SecurityHeaders) -> None: ) -class AsyncSecurityHeadersWithRawResponse: - def __init__(self, security_headers: AsyncSecurityHeaders) -> None: +class AsyncSecurityHeadersResourceWithRawResponse: + def __init__(self, security_headers: AsyncSecurityHeadersResource) -> None: self._security_headers = security_headers self.edit = async_to_raw_response_wrapper( @@ -232,8 +233,8 @@ def __init__(self, security_headers: AsyncSecurityHeaders) -> None: ) -class SecurityHeadersWithStreamingResponse: - def __init__(self, security_headers: SecurityHeaders) -> None: +class SecurityHeadersResourceWithStreamingResponse: + def __init__(self, security_headers: SecurityHeadersResource) -> None: self._security_headers = security_headers self.edit = to_streamed_response_wrapper( @@ -244,8 +245,8 @@ def __init__(self, security_headers: SecurityHeaders) -> None: ) -class AsyncSecurityHeadersWithStreamingResponse: - def __init__(self, security_headers: AsyncSecurityHeaders) -> None: +class AsyncSecurityHeadersResourceWithStreamingResponse: + def __init__(self, security_headers: AsyncSecurityHeadersResource) -> None: self._security_headers = security_headers self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/security_level.py b/src/cloudflare/resources/zones/settings/security_level.py index a5d0c78ed39..af9040125a5 100644 --- a/src/cloudflare/resources/zones/settings/security_level.py +++ b/src/cloudflare/resources/zones/settings/security_level.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingSecurityLevel, security_level_edit_params +from ....types.zones.settings import security_level_edit_params +from ....types.zones.settings.security_level import SecurityLevel -__all__ = ["SecurityLevel", "AsyncSecurityLevel"] +__all__ = ["SecurityLevelResource", "AsyncSecurityLevelResource"] -class SecurityLevel(SyncAPIResource): +class SecurityLevelResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SecurityLevelWithRawResponse: - return SecurityLevelWithRawResponse(self) + def with_raw_response(self) -> SecurityLevelResourceWithRawResponse: + return SecurityLevelResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SecurityLevelWithStreamingResponse: - return SecurityLevelWithStreamingResponse(self) + def with_streaming_response(self) -> SecurityLevelResourceWithStreamingResponse: + return SecurityLevelResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSecurityLevel]: + ) -> Optional[SecurityLevel]: """ Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. If you choose to customize @@ -79,9 +80,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SecurityLevel]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSecurityLevel]], ResultWrapper[ZoneSettingSecurityLevel]), + cast_to=cast(Type[Optional[SecurityLevel]], ResultWrapper[SecurityLevel]), ) def get( @@ -94,7 +95,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSecurityLevel]: + ) -> Optional[SecurityLevel]: """ Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. If you choose to customize @@ -121,20 +122,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SecurityLevel]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSecurityLevel]], ResultWrapper[ZoneSettingSecurityLevel]), + cast_to=cast(Type[Optional[SecurityLevel]], ResultWrapper[SecurityLevel]), ) -class AsyncSecurityLevel(AsyncAPIResource): +class AsyncSecurityLevelResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSecurityLevelWithRawResponse: - return AsyncSecurityLevelWithRawResponse(self) + def with_raw_response(self) -> AsyncSecurityLevelResourceWithRawResponse: + return AsyncSecurityLevelResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSecurityLevelWithStreamingResponse: - return AsyncSecurityLevelWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSecurityLevelResourceWithStreamingResponse: + return AsyncSecurityLevelResourceWithStreamingResponse(self) async def edit( self, @@ -147,7 +148,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSecurityLevel]: + ) -> Optional[SecurityLevel]: """ Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. If you choose to customize @@ -177,9 +178,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SecurityLevel]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSecurityLevel]], ResultWrapper[ZoneSettingSecurityLevel]), + cast_to=cast(Type[Optional[SecurityLevel]], ResultWrapper[SecurityLevel]), ) async def get( @@ -192,7 +193,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSecurityLevel]: + ) -> Optional[SecurityLevel]: """ Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. If you choose to customize @@ -219,14 +220,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SecurityLevel]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSecurityLevel]], ResultWrapper[ZoneSettingSecurityLevel]), + cast_to=cast(Type[Optional[SecurityLevel]], ResultWrapper[SecurityLevel]), ) -class SecurityLevelWithRawResponse: - def __init__(self, security_level: SecurityLevel) -> None: +class SecurityLevelResourceWithRawResponse: + def __init__(self, security_level: SecurityLevelResource) -> None: self._security_level = security_level self.edit = to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, security_level: SecurityLevel) -> None: ) -class AsyncSecurityLevelWithRawResponse: - def __init__(self, security_level: AsyncSecurityLevel) -> None: +class AsyncSecurityLevelResourceWithRawResponse: + def __init__(self, security_level: AsyncSecurityLevelResource) -> None: self._security_level = security_level self.edit = async_to_raw_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, security_level: AsyncSecurityLevel) -> None: ) -class SecurityLevelWithStreamingResponse: - def __init__(self, security_level: SecurityLevel) -> None: +class SecurityLevelResourceWithStreamingResponse: + def __init__(self, security_level: SecurityLevelResource) -> None: self._security_level = security_level self.edit = to_streamed_response_wrapper( @@ -261,8 +262,8 @@ def __init__(self, security_level: SecurityLevel) -> None: ) -class AsyncSecurityLevelWithStreamingResponse: - def __init__(self, security_level: AsyncSecurityLevel) -> None: +class AsyncSecurityLevelResourceWithStreamingResponse: + def __init__(self, security_level: AsyncSecurityLevelResource) -> None: self._security_level = security_level self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/server_side_excludes.py b/src/cloudflare/resources/zones/settings/server_side_excludes.py index 27502785358..b84f8e70b19 100644 --- a/src/cloudflare/resources/zones/settings/server_side_excludes.py +++ b/src/cloudflare/resources/zones/settings/server_side_excludes.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingServerSideExclude, server_side_exclude_edit_params +from ....types.zones.settings import server_side_exclude_edit_params +from ....types.zones.settings.server_side_excludes import ServerSideExcludes -__all__ = ["ServerSideExcludes", "AsyncServerSideExcludes"] +__all__ = ["ServerSideExcludesResource", "AsyncServerSideExcludesResource"] -class ServerSideExcludes(SyncAPIResource): +class ServerSideExcludesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ServerSideExcludesWithRawResponse: - return ServerSideExcludesWithRawResponse(self) + def with_raw_response(self) -> ServerSideExcludesResourceWithRawResponse: + return ServerSideExcludesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ServerSideExcludesWithStreamingResponse: - return ServerSideExcludesWithStreamingResponse(self) + def with_streaming_response(self) -> ServerSideExcludesResourceWithStreamingResponse: + return ServerSideExcludesResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingServerSideExclude]: + ) -> Optional[ServerSideExcludes]: """ If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do @@ -86,9 +87,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServerSideExcludes]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingServerSideExclude]], ResultWrapper[ZoneSettingServerSideExclude]), + cast_to=cast(Type[Optional[ServerSideExcludes]], ResultWrapper[ServerSideExcludes]), ) def get( @@ -101,7 +102,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingServerSideExclude]: + ) -> Optional[ServerSideExcludes]: """ If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do @@ -135,20 +136,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServerSideExcludes]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingServerSideExclude]], ResultWrapper[ZoneSettingServerSideExclude]), + cast_to=cast(Type[Optional[ServerSideExcludes]], ResultWrapper[ServerSideExcludes]), ) -class AsyncServerSideExcludes(AsyncAPIResource): +class AsyncServerSideExcludesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncServerSideExcludesWithRawResponse: - return AsyncServerSideExcludesWithRawResponse(self) + def with_raw_response(self) -> AsyncServerSideExcludesResourceWithRawResponse: + return AsyncServerSideExcludesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncServerSideExcludesWithStreamingResponse: - return AsyncServerSideExcludesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncServerSideExcludesResourceWithStreamingResponse: + return AsyncServerSideExcludesResourceWithStreamingResponse(self) async def edit( self, @@ -161,7 +162,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingServerSideExclude]: + ) -> Optional[ServerSideExcludes]: """ If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do @@ -200,9 +201,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServerSideExcludes]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingServerSideExclude]], ResultWrapper[ZoneSettingServerSideExclude]), + cast_to=cast(Type[Optional[ServerSideExcludes]], ResultWrapper[ServerSideExcludes]), ) async def get( @@ -215,7 +216,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingServerSideExclude]: + ) -> Optional[ServerSideExcludes]: """ If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do @@ -249,14 +250,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ServerSideExcludes]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingServerSideExclude]], ResultWrapper[ZoneSettingServerSideExclude]), + cast_to=cast(Type[Optional[ServerSideExcludes]], ResultWrapper[ServerSideExcludes]), ) -class ServerSideExcludesWithRawResponse: - def __init__(self, server_side_excludes: ServerSideExcludes) -> None: +class ServerSideExcludesResourceWithRawResponse: + def __init__(self, server_side_excludes: ServerSideExcludesResource) -> None: self._server_side_excludes = server_side_excludes self.edit = to_raw_response_wrapper( @@ -267,8 +268,8 @@ def __init__(self, server_side_excludes: ServerSideExcludes) -> None: ) -class AsyncServerSideExcludesWithRawResponse: - def __init__(self, server_side_excludes: AsyncServerSideExcludes) -> None: +class AsyncServerSideExcludesResourceWithRawResponse: + def __init__(self, server_side_excludes: AsyncServerSideExcludesResource) -> None: self._server_side_excludes = server_side_excludes self.edit = async_to_raw_response_wrapper( @@ -279,8 +280,8 @@ def __init__(self, server_side_excludes: AsyncServerSideExcludes) -> None: ) -class ServerSideExcludesWithStreamingResponse: - def __init__(self, server_side_excludes: ServerSideExcludes) -> None: +class ServerSideExcludesResourceWithStreamingResponse: + def __init__(self, server_side_excludes: ServerSideExcludesResource) -> None: self._server_side_excludes = server_side_excludes self.edit = to_streamed_response_wrapper( @@ -291,8 +292,8 @@ def __init__(self, server_side_excludes: ServerSideExcludes) -> None: ) -class AsyncServerSideExcludesWithStreamingResponse: - def __init__(self, server_side_excludes: AsyncServerSideExcludes) -> None: +class AsyncServerSideExcludesResourceWithStreamingResponse: + def __init__(self, server_side_excludes: AsyncServerSideExcludesResource) -> None: self._server_side_excludes = server_side_excludes self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/settings.py b/src/cloudflare/resources/zones/settings/settings.py index 10df9fed82b..5202b805f12 100644 --- a/src/cloudflare/resources/zones/settings/settings.py +++ b/src/cloudflare/resources/zones/settings/settings.py @@ -2,1891 +2,1683 @@ from __future__ import annotations -from typing import Type, Iterable, Optional, cast - -import httpx - from .nel import ( - NEL, - AsyncNEL, - NELWithRawResponse, - AsyncNELWithRawResponse, - NELWithStreamingResponse, - AsyncNELWithStreamingResponse, + NELResource, + AsyncNELResource, + NELResourceWithRawResponse, + AsyncNELResourceWithRawResponse, + NELResourceWithStreamingResponse, + AsyncNELResourceWithStreamingResponse, ) from .ssl import ( - SSL, - AsyncSSL, - SSLWithRawResponse, - AsyncSSLWithRawResponse, - SSLWithStreamingResponse, - AsyncSSLWithStreamingResponse, + SSLResource, + AsyncSSLResource, + SSLResourceWithRawResponse, + AsyncSSLResourceWithRawResponse, + SSLResourceWithStreamingResponse, + AsyncSSLResourceWithStreamingResponse, ) from .waf import ( - WAF, - AsyncWAF, - WAFWithRawResponse, - AsyncWAFWithRawResponse, - WAFWithStreamingResponse, - AsyncWAFWithStreamingResponse, + WAFResource, + AsyncWAFResource, + WAFResourceWithRawResponse, + AsyncWAFResourceWithRawResponse, + WAFResourceWithStreamingResponse, + AsyncWAFResourceWithStreamingResponse, ) from .ipv6 import ( - IPV6, - AsyncIPV6, - IPV6WithRawResponse, - AsyncIPV6WithRawResponse, - IPV6WithStreamingResponse, - AsyncIPV6WithStreamingResponse, + IPV6Resource, + AsyncIPV6Resource, + IPV6ResourceWithRawResponse, + AsyncIPV6ResourceWithRawResponse, + IPV6ResourceWithStreamingResponse, + AsyncIPV6ResourceWithStreamingResponse, ) from .webp import ( - WebP, - AsyncWebP, - WebPWithRawResponse, - AsyncWebPWithRawResponse, - WebPWithStreamingResponse, - AsyncWebPWithStreamingResponse, + WebPResource, + AsyncWebPResource, + WebPResourceWithRawResponse, + AsyncWebPResourceWithRawResponse, + WebPResourceWithStreamingResponse, + AsyncWebPResourceWithStreamingResponse, ) from .http2 import ( - HTTP2, - AsyncHTTP2, - HTTP2WithRawResponse, - AsyncHTTP2WithRawResponse, - HTTP2WithStreamingResponse, - AsyncHTTP2WithStreamingResponse, + HTTP2Resource, + AsyncHTTP2Resource, + HTTP2ResourceWithRawResponse, + AsyncHTTP2ResourceWithRawResponse, + HTTP2ResourceWithStreamingResponse, + AsyncHTTP2ResourceWithStreamingResponse, ) from .http3 import ( - HTTP3, - AsyncHTTP3, - HTTP3WithRawResponse, - AsyncHTTP3WithRawResponse, - HTTP3WithStreamingResponse, - AsyncHTTP3WithStreamingResponse, + HTTP3Resource, + AsyncHTTP3Resource, + HTTP3ResourceWithRawResponse, + AsyncHTTP3ResourceWithRawResponse, + HTTP3ResourceWithStreamingResponse, + AsyncHTTP3ResourceWithStreamingResponse, ) from .brotli import ( - Brotli, - AsyncBrotli, - BrotliWithRawResponse, - AsyncBrotliWithRawResponse, - BrotliWithStreamingResponse, - AsyncBrotliWithStreamingResponse, + BrotliResource, + AsyncBrotliResource, + BrotliResourceWithRawResponse, + AsyncBrotliResourceWithRawResponse, + BrotliResourceWithStreamingResponse, + AsyncBrotliResourceWithStreamingResponse, ) from .minify import ( - Minify, - AsyncMinify, - MinifyWithRawResponse, - AsyncMinifyWithRawResponse, - MinifyWithStreamingResponse, - AsyncMinifyWithStreamingResponse, + MinifyResource, + AsyncMinifyResource, + MinifyResourceWithRawResponse, + AsyncMinifyResourceWithRawResponse, + MinifyResourceWithStreamingResponse, + AsyncMinifyResourceWithStreamingResponse, ) from .mirage import ( - Mirage, - AsyncMirage, - MirageWithRawResponse, - AsyncMirageWithRawResponse, - MirageWithStreamingResponse, - AsyncMirageWithStreamingResponse, + MirageResource, + AsyncMirageResource, + MirageResourceWithRawResponse, + AsyncMirageResourceWithRawResponse, + MirageResourceWithStreamingResponse, + AsyncMirageResourceWithStreamingResponse, ) from .polish import ( - Polish, - AsyncPolish, - PolishWithRawResponse, - AsyncPolishWithRawResponse, - PolishWithStreamingResponse, - AsyncPolishWithStreamingResponse, + PolishResource, + AsyncPolishResource, + PolishResourceWithRawResponse, + AsyncPolishResourceWithRawResponse, + PolishResourceWithStreamingResponse, + AsyncPolishResourceWithStreamingResponse, ) from .ciphers import ( - Ciphers, - AsyncCiphers, - CiphersWithRawResponse, - AsyncCiphersWithRawResponse, - CiphersWithStreamingResponse, - AsyncCiphersWithStreamingResponse, + CiphersResource, + AsyncCiphersResource, + CiphersResourceWithRawResponse, + AsyncCiphersResourceWithRawResponse, + CiphersResourceWithStreamingResponse, + AsyncCiphersResourceWithStreamingResponse, ) from .tls_1_3 import ( - TLS1_3, - AsyncTLS1_3, - TLS1_3WithRawResponse, - AsyncTLS1_3WithRawResponse, - TLS1_3WithStreamingResponse, - AsyncTLS1_3WithStreamingResponse, + TLS1_3Resource, + AsyncTLS1_3Resource, + TLS1_3ResourceWithRawResponse, + AsyncTLS1_3ResourceWithRawResponse, + TLS1_3ResourceWithStreamingResponse, + AsyncTLS1_3ResourceWithStreamingResponse, ) from .zero_rtt import ( - ZeroRTT, - AsyncZeroRTT, - ZeroRTTWithRawResponse, - AsyncZeroRTTWithRawResponse, - ZeroRTTWithStreamingResponse, - AsyncZeroRTTWithStreamingResponse, -) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, + ZeroRTTResource, + AsyncZeroRTTResource, + ZeroRTTResourceWithRawResponse, + AsyncZeroRTTResourceWithRawResponse, + ZeroRTTResourceWithStreamingResponse, + AsyncZeroRTTResourceWithStreamingResponse, ) from .websocket import ( - Websocket, - AsyncWebsocket, - WebsocketWithRawResponse, - AsyncWebsocketWithRawResponse, - WebsocketWithStreamingResponse, - AsyncWebsocketWithStreamingResponse, + WebsocketResource, + AsyncWebsocketResource, + WebsocketResourceWithRawResponse, + AsyncWebsocketResourceWithRawResponse, + WebsocketResourceWithStreamingResponse, + AsyncWebsocketResourceWithStreamingResponse, ) from ...._compat import cached_property from .cache_level import ( - CacheLevel, - AsyncCacheLevel, - CacheLevelWithRawResponse, - AsyncCacheLevelWithRawResponse, - CacheLevelWithStreamingResponse, - AsyncCacheLevelWithStreamingResponse, + CacheLevelResource, + AsyncCacheLevelResource, + CacheLevelResourceWithRawResponse, + AsyncCacheLevelResourceWithRawResponse, + CacheLevelResourceWithStreamingResponse, + AsyncCacheLevelResourceWithStreamingResponse, ) from .early_hints import ( - EarlyHints, - AsyncEarlyHints, - EarlyHintsWithRawResponse, - AsyncEarlyHintsWithRawResponse, - EarlyHintsWithStreamingResponse, - AsyncEarlyHintsWithStreamingResponse, + EarlyHintsResource, + AsyncEarlyHintsResource, + EarlyHintsResourceWithRawResponse, + AsyncEarlyHintsResourceWithRawResponse, + EarlyHintsResourceWithStreamingResponse, + AsyncEarlyHintsResourceWithStreamingResponse, ) from .pseudo_ipv4 import ( - PseudoIPV4, - AsyncPseudoIPV4, - PseudoIPV4WithRawResponse, - AsyncPseudoIPV4WithRawResponse, - PseudoIPV4WithStreamingResponse, - AsyncPseudoIPV4WithStreamingResponse, + PseudoIPV4Resource, + AsyncPseudoIPV4Resource, + PseudoIPV4ResourceWithRawResponse, + AsyncPseudoIPV4ResourceWithRawResponse, + PseudoIPV4ResourceWithStreamingResponse, + AsyncPseudoIPV4ResourceWithStreamingResponse, ) 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 .advanced_ddos import ( - AdvancedDDoS, - AsyncAdvancedDDoS, - AdvancedDDoSWithRawResponse, - AsyncAdvancedDDoSWithRawResponse, - AdvancedDDoSWithStreamingResponse, - AsyncAdvancedDDoSWithStreamingResponse, + AdvancedDDoSResource, + AsyncAdvancedDDoSResource, + AdvancedDDoSResourceWithRawResponse, + AsyncAdvancedDDoSResourceWithRawResponse, + AdvancedDDoSResourceWithStreamingResponse, + AsyncAdvancedDDoSResourceWithStreamingResponse, ) from .always_online import ( - AlwaysOnline, - AsyncAlwaysOnline, - AlwaysOnlineWithRawResponse, - AsyncAlwaysOnlineWithRawResponse, - AlwaysOnlineWithStreamingResponse, - AsyncAlwaysOnlineWithStreamingResponse, + AlwaysOnlineResource, + AsyncAlwaysOnlineResource, + AlwaysOnlineResourceWithRawResponse, + AsyncAlwaysOnlineResourceWithRawResponse, + AlwaysOnlineResourceWithStreamingResponse, + AsyncAlwaysOnlineResourceWithStreamingResponse, ) from .browser_check import ( - BrowserCheck, - AsyncBrowserCheck, - BrowserCheckWithRawResponse, - AsyncBrowserCheckWithRawResponse, - BrowserCheckWithStreamingResponse, - AsyncBrowserCheckWithStreamingResponse, + BrowserCheckResource, + AsyncBrowserCheckResource, + BrowserCheckResourceWithRawResponse, + AsyncBrowserCheckResourceWithRawResponse, + BrowserCheckResourceWithStreamingResponse, + AsyncBrowserCheckResourceWithStreamingResponse, ) from .challenge_ttl import ( - ChallengeTTL, - AsyncChallengeTTL, - ChallengeTTLWithRawResponse, - AsyncChallengeTTLWithRawResponse, - ChallengeTTLWithStreamingResponse, - AsyncChallengeTTLWithStreamingResponse, + ChallengeTTLResource, + AsyncChallengeTTLResource, + ChallengeTTLResourceWithRawResponse, + AsyncChallengeTTLResourceWithRawResponse, + ChallengeTTLResourceWithStreamingResponse, + AsyncChallengeTTLResourceWithStreamingResponse, ) from .font_settings import ( - FontSettings, - AsyncFontSettings, - FontSettingsWithRawResponse, - AsyncFontSettingsWithRawResponse, - FontSettingsWithStreamingResponse, - AsyncFontSettingsWithStreamingResponse, + FontSettingsResource, + AsyncFontSettingsResource, + FontSettingsResourceWithRawResponse, + AsyncFontSettingsResourceWithRawResponse, + FontSettingsResourceWithStreamingResponse, + AsyncFontSettingsResourceWithStreamingResponse, ) from .rocket_loader import ( - RocketLoader, - AsyncRocketLoader, - RocketLoaderWithRawResponse, - AsyncRocketLoaderWithRawResponse, - RocketLoaderWithStreamingResponse, - AsyncRocketLoaderWithStreamingResponse, + RocketLoaderResource, + AsyncRocketLoaderResource, + RocketLoaderResourceWithRawResponse, + AsyncRocketLoaderResourceWithRawResponse, + RocketLoaderResourceWithStreamingResponse, + AsyncRocketLoaderResourceWithStreamingResponse, ) -from ....types.zones import SettingGetResponse, SettingEditResponse, setting_edit_params from .image_resizing import ( - ImageResizing, - AsyncImageResizing, - ImageResizingWithRawResponse, - AsyncImageResizingWithRawResponse, - ImageResizingWithStreamingResponse, - AsyncImageResizingWithStreamingResponse, + ImageResizingResource, + AsyncImageResizingResource, + ImageResizingResourceWithRawResponse, + AsyncImageResizingResourceWithRawResponse, + ImageResizingResourceWithStreamingResponse, + AsyncImageResizingResourceWithStreamingResponse, ) from .ip_geolocation import ( - IPGeolocation, - AsyncIPGeolocation, - IPGeolocationWithRawResponse, - AsyncIPGeolocationWithRawResponse, - IPGeolocationWithStreamingResponse, - AsyncIPGeolocationWithStreamingResponse, + IPGeolocationResource, + AsyncIPGeolocationResource, + IPGeolocationResourceWithRawResponse, + AsyncIPGeolocationResourceWithRawResponse, + IPGeolocationResourceWithStreamingResponse, + AsyncIPGeolocationResourceWithStreamingResponse, ) from .security_level import ( - SecurityLevel, - AsyncSecurityLevel, - SecurityLevelWithRawResponse, - AsyncSecurityLevelWithRawResponse, - SecurityLevelWithStreamingResponse, - AsyncSecurityLevelWithStreamingResponse, -) -from ...._base_client import ( - make_request_options, + SecurityLevelResource, + AsyncSecurityLevelResource, + SecurityLevelResourceWithRawResponse, + AsyncSecurityLevelResourceWithRawResponse, + SecurityLevelResourceWithStreamingResponse, + AsyncSecurityLevelResourceWithStreamingResponse, ) from .min_tls_version import ( - MinTLSVersion, - AsyncMinTLSVersion, - MinTLSVersionWithRawResponse, - AsyncMinTLSVersionWithRawResponse, - MinTLSVersionWithStreamingResponse, - AsyncMinTLSVersionWithStreamingResponse, + MinTLSVersionResource, + AsyncMinTLSVersionResource, + MinTLSVersionResourceWithRawResponse, + AsyncMinTLSVersionResourceWithRawResponse, + MinTLSVersionResourceWithStreamingResponse, + AsyncMinTLSVersionResourceWithStreamingResponse, ) from .mobile_redirect import ( - MobileRedirect, - AsyncMobileRedirect, - MobileRedirectWithRawResponse, - AsyncMobileRedirectWithRawResponse, - MobileRedirectWithStreamingResponse, - AsyncMobileRedirectWithStreamingResponse, + MobileRedirectResource, + AsyncMobileRedirectResource, + MobileRedirectResourceWithRawResponse, + AsyncMobileRedirectResourceWithRawResponse, + MobileRedirectResourceWithStreamingResponse, + AsyncMobileRedirectResourceWithStreamingResponse, ) from .ssl_recommender import ( - SSLRecommender, - AsyncSSLRecommender, - SSLRecommenderWithRawResponse, - AsyncSSLRecommenderWithRawResponse, - SSLRecommenderWithStreamingResponse, - AsyncSSLRecommenderWithStreamingResponse, + SSLRecommenderResource, + AsyncSSLRecommenderResource, + SSLRecommenderResourceWithRawResponse, + AsyncSSLRecommenderResourceWithRawResponse, + SSLRecommenderResourceWithStreamingResponse, + AsyncSSLRecommenderResourceWithStreamingResponse, ) from .tls_client_auth import ( - TLSClientAuth, - AsyncTLSClientAuth, - TLSClientAuthWithRawResponse, - AsyncTLSClientAuthWithRawResponse, - TLSClientAuthWithStreamingResponse, - AsyncTLSClientAuthWithStreamingResponse, + TLSClientAuthResource, + AsyncTLSClientAuthResource, + TLSClientAuthResourceWithRawResponse, + AsyncTLSClientAuthResourceWithRawResponse, + TLSClientAuthResourceWithStreamingResponse, + AsyncTLSClientAuthResourceWithStreamingResponse, ) from .always_use_https import ( - AlwaysUseHTTPS, - AsyncAlwaysUseHTTPS, - AlwaysUseHTTPSWithRawResponse, - AsyncAlwaysUseHTTPSWithRawResponse, - AlwaysUseHTTPSWithStreamingResponse, - AsyncAlwaysUseHTTPSWithStreamingResponse, + AlwaysUseHTTPSResource, + AsyncAlwaysUseHTTPSResource, + AlwaysUseHTTPSResourceWithRawResponse, + AsyncAlwaysUseHTTPSResourceWithRawResponse, + AlwaysUseHTTPSResourceWithStreamingResponse, + AsyncAlwaysUseHTTPSResourceWithStreamingResponse, ) from .development_mode import ( - DevelopmentMode, - AsyncDevelopmentMode, - DevelopmentModeWithRawResponse, - AsyncDevelopmentModeWithRawResponse, - DevelopmentModeWithStreamingResponse, - AsyncDevelopmentModeWithStreamingResponse, + DevelopmentModeResource, + AsyncDevelopmentModeResource, + DevelopmentModeResourceWithRawResponse, + AsyncDevelopmentModeResourceWithRawResponse, + DevelopmentModeResourceWithStreamingResponse, + AsyncDevelopmentModeResourceWithStreamingResponse, ) from .orange_to_orange import ( - OrangeToOrange, - AsyncOrangeToOrange, - OrangeToOrangeWithRawResponse, - AsyncOrangeToOrangeWithRawResponse, - OrangeToOrangeWithStreamingResponse, - AsyncOrangeToOrangeWithStreamingResponse, + OrangeToOrangeResource, + AsyncOrangeToOrangeResource, + OrangeToOrangeResourceWithRawResponse, + AsyncOrangeToOrangeResourceWithRawResponse, + OrangeToOrangeResourceWithStreamingResponse, + AsyncOrangeToOrangeResourceWithStreamingResponse, ) from .prefetch_preload import ( - PrefetchPreload, - AsyncPrefetchPreload, - PrefetchPreloadWithRawResponse, - AsyncPrefetchPreloadWithRawResponse, - PrefetchPreloadWithStreamingResponse, - AsyncPrefetchPreloadWithStreamingResponse, + PrefetchPreloadResource, + AsyncPrefetchPreloadResource, + PrefetchPreloadResourceWithRawResponse, + AsyncPrefetchPreloadResourceWithRawResponse, + PrefetchPreloadResourceWithStreamingResponse, + AsyncPrefetchPreloadResourceWithStreamingResponse, ) from .security_headers import ( - SecurityHeaders, - AsyncSecurityHeaders, - SecurityHeadersWithRawResponse, - AsyncSecurityHeadersWithRawResponse, - SecurityHeadersWithStreamingResponse, - AsyncSecurityHeadersWithStreamingResponse, + SecurityHeadersResource, + AsyncSecurityHeadersResource, + SecurityHeadersResourceWithRawResponse, + AsyncSecurityHeadersResourceWithRawResponse, + SecurityHeadersResourceWithStreamingResponse, + AsyncSecurityHeadersResourceWithStreamingResponse, ) from .browser_cache_ttl import ( - BrowserCacheTTL, - AsyncBrowserCacheTTL, - BrowserCacheTTLWithRawResponse, - AsyncBrowserCacheTTLWithRawResponse, - BrowserCacheTTLWithStreamingResponse, - AsyncBrowserCacheTTLWithStreamingResponse, + BrowserCacheTTLResource, + AsyncBrowserCacheTTLResource, + BrowserCacheTTLResourceWithRawResponse, + AsyncBrowserCacheTTLResourceWithRawResponse, + BrowserCacheTTLResourceWithStreamingResponse, + AsyncBrowserCacheTTLResourceWithStreamingResponse, ) from .email_obfuscation import ( - EmailObfuscation, - AsyncEmailObfuscation, - EmailObfuscationWithRawResponse, - AsyncEmailObfuscationWithRawResponse, - EmailObfuscationWithStreamingResponse, - AsyncEmailObfuscationWithStreamingResponse, + EmailObfuscationResource, + AsyncEmailObfuscationResource, + EmailObfuscationResourceWithRawResponse, + AsyncEmailObfuscationResourceWithRawResponse, + EmailObfuscationResourceWithStreamingResponse, + AsyncEmailObfuscationResourceWithStreamingResponse, ) from .h2_prioritization import ( - H2Prioritization, - AsyncH2Prioritization, - H2PrioritizationWithRawResponse, - AsyncH2PrioritizationWithRawResponse, - H2PrioritizationWithStreamingResponse, - AsyncH2PrioritizationWithStreamingResponse, + H2PrioritizationResource, + AsyncH2PrioritizationResource, + H2PrioritizationResourceWithRawResponse, + AsyncH2PrioritizationResourceWithRawResponse, + H2PrioritizationResourceWithStreamingResponse, + AsyncH2PrioritizationResourceWithStreamingResponse, ) from .hotlink_protection import ( - HotlinkProtection, - AsyncHotlinkProtection, - HotlinkProtectionWithRawResponse, - AsyncHotlinkProtectionWithRawResponse, - HotlinkProtectionWithStreamingResponse, - AsyncHotlinkProtectionWithStreamingResponse, + HotlinkProtectionResource, + AsyncHotlinkProtectionResource, + HotlinkProtectionResourceWithRawResponse, + AsyncHotlinkProtectionResourceWithRawResponse, + HotlinkProtectionResourceWithStreamingResponse, + AsyncHotlinkProtectionResourceWithStreamingResponse, ) from .proxy_read_timeout import ( - ProxyReadTimeout, - AsyncProxyReadTimeout, - ProxyReadTimeoutWithRawResponse, - AsyncProxyReadTimeoutWithRawResponse, - ProxyReadTimeoutWithStreamingResponse, - AsyncProxyReadTimeoutWithStreamingResponse, + ProxyReadTimeoutResource, + AsyncProxyReadTimeoutResource, + ProxyReadTimeoutResourceWithRawResponse, + AsyncProxyReadTimeoutResourceWithRawResponse, + ProxyReadTimeoutResourceWithStreamingResponse, + AsyncProxyReadTimeoutResourceWithStreamingResponse, ) from .response_buffering import ( - ResponseBuffering, - AsyncResponseBuffering, - ResponseBufferingWithRawResponse, - AsyncResponseBufferingWithRawResponse, - ResponseBufferingWithStreamingResponse, - AsyncResponseBufferingWithStreamingResponse, + ResponseBufferingResource, + AsyncResponseBufferingResource, + ResponseBufferingResourceWithRawResponse, + AsyncResponseBufferingResourceWithRawResponse, + ResponseBufferingResourceWithStreamingResponse, + AsyncResponseBufferingResourceWithStreamingResponse, ) from .opportunistic_onion import ( - OpportunisticOnion, - AsyncOpportunisticOnion, - OpportunisticOnionWithRawResponse, - AsyncOpportunisticOnionWithRawResponse, - OpportunisticOnionWithStreamingResponse, - AsyncOpportunisticOnionWithStreamingResponse, + OpportunisticOnionResource, + AsyncOpportunisticOnionResource, + OpportunisticOnionResourceWithRawResponse, + AsyncOpportunisticOnionResourceWithRawResponse, + OpportunisticOnionResourceWithStreamingResponse, + AsyncOpportunisticOnionResourceWithStreamingResponse, ) from .server_side_excludes import ( - ServerSideExcludes, - AsyncServerSideExcludes, - ServerSideExcludesWithRawResponse, - AsyncServerSideExcludesWithRawResponse, - ServerSideExcludesWithStreamingResponse, - AsyncServerSideExcludesWithStreamingResponse, + ServerSideExcludesResource, + AsyncServerSideExcludesResource, + ServerSideExcludesResourceWithRawResponse, + AsyncServerSideExcludesResourceWithRawResponse, + ServerSideExcludesResourceWithStreamingResponse, + AsyncServerSideExcludesResourceWithStreamingResponse, ) from .true_client_ip_header import ( - TrueClientIPHeader, - AsyncTrueClientIPHeader, - TrueClientIPHeaderWithRawResponse, - AsyncTrueClientIPHeaderWithRawResponse, - TrueClientIPHeaderWithStreamingResponse, - AsyncTrueClientIPHeaderWithStreamingResponse, + TrueClientIPHeaderResource, + AsyncTrueClientIPHeaderResource, + TrueClientIPHeaderResourceWithRawResponse, + AsyncTrueClientIPHeaderResourceWithRawResponse, + TrueClientIPHeaderResourceWithStreamingResponse, + AsyncTrueClientIPHeaderResourceWithStreamingResponse, ) from .origin_max_http_version import ( - OriginMaxHTTPVersion, - AsyncOriginMaxHTTPVersion, - OriginMaxHTTPVersionWithRawResponse, - AsyncOriginMaxHTTPVersionWithRawResponse, - OriginMaxHTTPVersionWithStreamingResponse, - AsyncOriginMaxHTTPVersionWithStreamingResponse, + OriginMaxHTTPVersionResource, + AsyncOriginMaxHTTPVersionResource, + OriginMaxHTTPVersionResourceWithRawResponse, + AsyncOriginMaxHTTPVersionResourceWithRawResponse, + OriginMaxHTTPVersionResourceWithStreamingResponse, + AsyncOriginMaxHTTPVersionResourceWithStreamingResponse, ) from .automatic_https_rewrites import ( - AutomaticHTTPSRewrites, - AsyncAutomaticHTTPSRewrites, - AutomaticHTTPSRewritesWithRawResponse, - AsyncAutomaticHTTPSRewritesWithRawResponse, - AutomaticHTTPSRewritesWithStreamingResponse, - AsyncAutomaticHTTPSRewritesWithStreamingResponse, + AutomaticHTTPSRewritesResource, + AsyncAutomaticHTTPSRewritesResource, + AutomaticHTTPSRewritesResourceWithRawResponse, + AsyncAutomaticHTTPSRewritesResourceWithRawResponse, + AutomaticHTTPSRewritesResourceWithStreamingResponse, + AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse, ) from .opportunistic_encryption import ( - OpportunisticEncryption, - AsyncOpportunisticEncryption, - OpportunisticEncryptionWithRawResponse, - AsyncOpportunisticEncryptionWithRawResponse, - OpportunisticEncryptionWithStreamingResponse, - AsyncOpportunisticEncryptionWithStreamingResponse, + OpportunisticEncryptionResource, + AsyncOpportunisticEncryptionResource, + OpportunisticEncryptionResourceWithRawResponse, + AsyncOpportunisticEncryptionResourceWithRawResponse, + OpportunisticEncryptionResourceWithStreamingResponse, + AsyncOpportunisticEncryptionResourceWithStreamingResponse, ) from .origin_error_page_pass_thru import ( - OriginErrorPagePassThru, - AsyncOriginErrorPagePassThru, - OriginErrorPagePassThruWithRawResponse, - AsyncOriginErrorPagePassThruWithRawResponse, - OriginErrorPagePassThruWithStreamingResponse, - AsyncOriginErrorPagePassThruWithStreamingResponse, + OriginErrorPagePassThruResource, + AsyncOriginErrorPagePassThruResource, + OriginErrorPagePassThruResourceWithRawResponse, + AsyncOriginErrorPagePassThruResourceWithRawResponse, + OriginErrorPagePassThruResourceWithStreamingResponse, + AsyncOriginErrorPagePassThruResourceWithStreamingResponse, ) from .sort_query_string_for_cache import ( - SortQueryStringForCache, - AsyncSortQueryStringForCache, - SortQueryStringForCacheWithRawResponse, - AsyncSortQueryStringForCacheWithRawResponse, - SortQueryStringForCacheWithStreamingResponse, - AsyncSortQueryStringForCacheWithStreamingResponse, + SortQueryStringForCacheResource, + AsyncSortQueryStringForCacheResource, + SortQueryStringForCacheResourceWithRawResponse, + AsyncSortQueryStringForCacheResourceWithRawResponse, + SortQueryStringForCacheResourceWithStreamingResponse, + AsyncSortQueryStringForCacheResourceWithStreamingResponse, ) from .automatic_platform_optimization import ( - AutomaticPlatformOptimization, - AsyncAutomaticPlatformOptimization, - AutomaticPlatformOptimizationWithRawResponse, - AsyncAutomaticPlatformOptimizationWithRawResponse, - AutomaticPlatformOptimizationWithStreamingResponse, - AsyncAutomaticPlatformOptimizationWithStreamingResponse, + AutomaticPlatformOptimizationResource, + AsyncAutomaticPlatformOptimizationResource, + AutomaticPlatformOptimizationResourceWithRawResponse, + AsyncAutomaticPlatformOptimizationResourceWithRawResponse, + AutomaticPlatformOptimizationResourceWithStreamingResponse, + AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse, ) -__all__ = ["Settings", "AsyncSettings"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class Settings(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def zero_rtt(self) -> ZeroRTT: - return ZeroRTT(self._client) + def zero_rtt(self) -> ZeroRTTResource: + return ZeroRTTResource(self._client) @cached_property - def advanced_ddos(self) -> AdvancedDDoS: - return AdvancedDDoS(self._client) + def advanced_ddos(self) -> AdvancedDDoSResource: + return AdvancedDDoSResource(self._client) @cached_property - def always_online(self) -> AlwaysOnline: - return AlwaysOnline(self._client) + def always_online(self) -> AlwaysOnlineResource: + return AlwaysOnlineResource(self._client) @cached_property - def always_use_https(self) -> AlwaysUseHTTPS: - return AlwaysUseHTTPS(self._client) + def always_use_https(self) -> AlwaysUseHTTPSResource: + return AlwaysUseHTTPSResource(self._client) @cached_property - def automatic_https_rewrites(self) -> AutomaticHTTPSRewrites: - return AutomaticHTTPSRewrites(self._client) + def automatic_https_rewrites(self) -> AutomaticHTTPSRewritesResource: + return AutomaticHTTPSRewritesResource(self._client) @cached_property - def automatic_platform_optimization(self) -> AutomaticPlatformOptimization: - return AutomaticPlatformOptimization(self._client) + def automatic_platform_optimization(self) -> AutomaticPlatformOptimizationResource: + return AutomaticPlatformOptimizationResource(self._client) @cached_property - def brotli(self) -> Brotli: - return Brotli(self._client) + def brotli(self) -> BrotliResource: + return BrotliResource(self._client) @cached_property - def browser_cache_ttl(self) -> BrowserCacheTTL: - return BrowserCacheTTL(self._client) + def browser_cache_ttl(self) -> BrowserCacheTTLResource: + return BrowserCacheTTLResource(self._client) @cached_property - def browser_check(self) -> BrowserCheck: - return BrowserCheck(self._client) + def browser_check(self) -> BrowserCheckResource: + return BrowserCheckResource(self._client) @cached_property - def cache_level(self) -> CacheLevel: - return CacheLevel(self._client) + def cache_level(self) -> CacheLevelResource: + return CacheLevelResource(self._client) @cached_property - def challenge_ttl(self) -> ChallengeTTL: - return ChallengeTTL(self._client) + def challenge_ttl(self) -> ChallengeTTLResource: + return ChallengeTTLResource(self._client) @cached_property - def ciphers(self) -> Ciphers: - return Ciphers(self._client) + def ciphers(self) -> CiphersResource: + return CiphersResource(self._client) @cached_property - def development_mode(self) -> DevelopmentMode: - return DevelopmentMode(self._client) + def development_mode(self) -> DevelopmentModeResource: + return DevelopmentModeResource(self._client) @cached_property - def early_hints(self) -> EarlyHints: - return EarlyHints(self._client) + def early_hints(self) -> EarlyHintsResource: + return EarlyHintsResource(self._client) @cached_property - def email_obfuscation(self) -> EmailObfuscation: - return EmailObfuscation(self._client) + def email_obfuscation(self) -> EmailObfuscationResource: + return EmailObfuscationResource(self._client) @cached_property - def h2_prioritization(self) -> H2Prioritization: - return H2Prioritization(self._client) + def h2_prioritization(self) -> H2PrioritizationResource: + return H2PrioritizationResource(self._client) @cached_property - def hotlink_protection(self) -> HotlinkProtection: - return HotlinkProtection(self._client) + def hotlink_protection(self) -> HotlinkProtectionResource: + return HotlinkProtectionResource(self._client) @cached_property - def http2(self) -> HTTP2: - return HTTP2(self._client) + def http2(self) -> HTTP2Resource: + return HTTP2Resource(self._client) @cached_property - def http3(self) -> HTTP3: - return HTTP3(self._client) + def http3(self) -> HTTP3Resource: + return HTTP3Resource(self._client) @cached_property - def image_resizing(self) -> ImageResizing: - return ImageResizing(self._client) + def image_resizing(self) -> ImageResizingResource: + return ImageResizingResource(self._client) @cached_property - def ip_geolocation(self) -> IPGeolocation: - return IPGeolocation(self._client) + def ip_geolocation(self) -> IPGeolocationResource: + return IPGeolocationResource(self._client) @cached_property - def ipv6(self) -> IPV6: - return IPV6(self._client) + def ipv6(self) -> IPV6Resource: + return IPV6Resource(self._client) @cached_property - def min_tls_version(self) -> MinTLSVersion: - return MinTLSVersion(self._client) + def min_tls_version(self) -> MinTLSVersionResource: + return MinTLSVersionResource(self._client) @cached_property - def minify(self) -> Minify: - return Minify(self._client) + def minify(self) -> MinifyResource: + return MinifyResource(self._client) @cached_property - def mirage(self) -> Mirage: - return Mirage(self._client) + def mirage(self) -> MirageResource: + return MirageResource(self._client) @cached_property - def mobile_redirect(self) -> MobileRedirect: - return MobileRedirect(self._client) + def mobile_redirect(self) -> MobileRedirectResource: + return MobileRedirectResource(self._client) @cached_property - def nel(self) -> NEL: - return NEL(self._client) + def nel(self) -> NELResource: + return NELResource(self._client) @cached_property - def opportunistic_encryption(self) -> OpportunisticEncryption: - return OpportunisticEncryption(self._client) + def opportunistic_encryption(self) -> OpportunisticEncryptionResource: + return OpportunisticEncryptionResource(self._client) @cached_property - def opportunistic_onion(self) -> OpportunisticOnion: - return OpportunisticOnion(self._client) + def opportunistic_onion(self) -> OpportunisticOnionResource: + return OpportunisticOnionResource(self._client) @cached_property - def orange_to_orange(self) -> OrangeToOrange: - return OrangeToOrange(self._client) + def orange_to_orange(self) -> OrangeToOrangeResource: + return OrangeToOrangeResource(self._client) @cached_property - def origin_error_page_pass_thru(self) -> OriginErrorPagePassThru: - return OriginErrorPagePassThru(self._client) + def origin_error_page_pass_thru(self) -> OriginErrorPagePassThruResource: + return OriginErrorPagePassThruResource(self._client) @cached_property - def origin_max_http_version(self) -> OriginMaxHTTPVersion: - return OriginMaxHTTPVersion(self._client) + def origin_max_http_version(self) -> OriginMaxHTTPVersionResource: + return OriginMaxHTTPVersionResource(self._client) @cached_property - def polish(self) -> Polish: - return Polish(self._client) + def polish(self) -> PolishResource: + return PolishResource(self._client) @cached_property - def prefetch_preload(self) -> PrefetchPreload: - return PrefetchPreload(self._client) + def prefetch_preload(self) -> PrefetchPreloadResource: + return PrefetchPreloadResource(self._client) @cached_property - def proxy_read_timeout(self) -> ProxyReadTimeout: - return ProxyReadTimeout(self._client) + def proxy_read_timeout(self) -> ProxyReadTimeoutResource: + return ProxyReadTimeoutResource(self._client) @cached_property - def pseudo_ipv4(self) -> PseudoIPV4: - return PseudoIPV4(self._client) + def pseudo_ipv4(self) -> PseudoIPV4Resource: + return PseudoIPV4Resource(self._client) @cached_property - def response_buffering(self) -> ResponseBuffering: - return ResponseBuffering(self._client) + def response_buffering(self) -> ResponseBufferingResource: + return ResponseBufferingResource(self._client) @cached_property - def rocket_loader(self) -> RocketLoader: - return RocketLoader(self._client) + def rocket_loader(self) -> RocketLoaderResource: + return RocketLoaderResource(self._client) @cached_property - def security_headers(self) -> SecurityHeaders: - return SecurityHeaders(self._client) + def security_headers(self) -> SecurityHeadersResource: + return SecurityHeadersResource(self._client) @cached_property - def security_level(self) -> SecurityLevel: - return SecurityLevel(self._client) + def security_level(self) -> SecurityLevelResource: + return SecurityLevelResource(self._client) @cached_property - def server_side_excludes(self) -> ServerSideExcludes: - return ServerSideExcludes(self._client) + def server_side_excludes(self) -> ServerSideExcludesResource: + return ServerSideExcludesResource(self._client) @cached_property - def sort_query_string_for_cache(self) -> SortQueryStringForCache: - return SortQueryStringForCache(self._client) + def sort_query_string_for_cache(self) -> SortQueryStringForCacheResource: + return SortQueryStringForCacheResource(self._client) @cached_property - def ssl(self) -> SSL: - return SSL(self._client) + def ssl(self) -> SSLResource: + return SSLResource(self._client) @cached_property - def ssl_recommender(self) -> SSLRecommender: - return SSLRecommender(self._client) + def ssl_recommender(self) -> SSLRecommenderResource: + return SSLRecommenderResource(self._client) @cached_property - def tls_1_3(self) -> TLS1_3: - return TLS1_3(self._client) + def tls_1_3(self) -> TLS1_3Resource: + return TLS1_3Resource(self._client) @cached_property - def tls_client_auth(self) -> TLSClientAuth: - return TLSClientAuth(self._client) + def tls_client_auth(self) -> TLSClientAuthResource: + return TLSClientAuthResource(self._client) @cached_property - def true_client_ip_header(self) -> TrueClientIPHeader: - return TrueClientIPHeader(self._client) + def true_client_ip_header(self) -> TrueClientIPHeaderResource: + return TrueClientIPHeaderResource(self._client) @cached_property - def waf(self) -> WAF: - return WAF(self._client) + def waf(self) -> WAFResource: + return WAFResource(self._client) @cached_property - def webp(self) -> WebP: - return WebP(self._client) + def webp(self) -> WebPResource: + return WebPResource(self._client) @cached_property - def websocket(self) -> Websocket: - return Websocket(self._client) + def websocket(self) -> WebsocketResource: + return WebsocketResource(self._client) @cached_property - def font_settings(self) -> FontSettings: - return FontSettings(self._client) + def font_settings(self) -> FontSettingsResource: + return FontSettingsResource(self._client) @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - items: Iterable[setting_edit_params.Item], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[SettingEditResponse]: - """ - Edit settings for a zone. - - Args: - zone_id: Identifier - - items: One or more zone setting objects. Must contain an ID and a value. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) - 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}/settings", - body=maybe_transform({"items": items}, setting_edit_params.SettingEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), - ) - - def get( - 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, - ) -> Optional[SettingGetResponse]: - """ - Available settings for your user in relation to 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( - f"/zones/{zone_id}/settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), - ) - - -class AsyncSettings(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def zero_rtt(self) -> AsyncZeroRTT: - return AsyncZeroRTT(self._client) + def zero_rtt(self) -> AsyncZeroRTTResource: + return AsyncZeroRTTResource(self._client) @cached_property - def advanced_ddos(self) -> AsyncAdvancedDDoS: - return AsyncAdvancedDDoS(self._client) + def advanced_ddos(self) -> AsyncAdvancedDDoSResource: + return AsyncAdvancedDDoSResource(self._client) @cached_property - def always_online(self) -> AsyncAlwaysOnline: - return AsyncAlwaysOnline(self._client) + def always_online(self) -> AsyncAlwaysOnlineResource: + return AsyncAlwaysOnlineResource(self._client) @cached_property - def always_use_https(self) -> AsyncAlwaysUseHTTPS: - return AsyncAlwaysUseHTTPS(self._client) + def always_use_https(self) -> AsyncAlwaysUseHTTPSResource: + return AsyncAlwaysUseHTTPSResource(self._client) @cached_property - def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewrites: - return AsyncAutomaticHTTPSRewrites(self._client) + def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewritesResource: + return AsyncAutomaticHTTPSRewritesResource(self._client) @cached_property - def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimization: - return AsyncAutomaticPlatformOptimization(self._client) + def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimizationResource: + return AsyncAutomaticPlatformOptimizationResource(self._client) @cached_property - def brotli(self) -> AsyncBrotli: - return AsyncBrotli(self._client) + def brotli(self) -> AsyncBrotliResource: + return AsyncBrotliResource(self._client) @cached_property - def browser_cache_ttl(self) -> AsyncBrowserCacheTTL: - return AsyncBrowserCacheTTL(self._client) + def browser_cache_ttl(self) -> AsyncBrowserCacheTTLResource: + return AsyncBrowserCacheTTLResource(self._client) @cached_property - def browser_check(self) -> AsyncBrowserCheck: - return AsyncBrowserCheck(self._client) + def browser_check(self) -> AsyncBrowserCheckResource: + return AsyncBrowserCheckResource(self._client) @cached_property - def cache_level(self) -> AsyncCacheLevel: - return AsyncCacheLevel(self._client) + def cache_level(self) -> AsyncCacheLevelResource: + return AsyncCacheLevelResource(self._client) @cached_property - def challenge_ttl(self) -> AsyncChallengeTTL: - return AsyncChallengeTTL(self._client) + def challenge_ttl(self) -> AsyncChallengeTTLResource: + return AsyncChallengeTTLResource(self._client) @cached_property - def ciphers(self) -> AsyncCiphers: - return AsyncCiphers(self._client) + def ciphers(self) -> AsyncCiphersResource: + return AsyncCiphersResource(self._client) @cached_property - def development_mode(self) -> AsyncDevelopmentMode: - return AsyncDevelopmentMode(self._client) + def development_mode(self) -> AsyncDevelopmentModeResource: + return AsyncDevelopmentModeResource(self._client) @cached_property - def early_hints(self) -> AsyncEarlyHints: - return AsyncEarlyHints(self._client) + def early_hints(self) -> AsyncEarlyHintsResource: + return AsyncEarlyHintsResource(self._client) @cached_property - def email_obfuscation(self) -> AsyncEmailObfuscation: - return AsyncEmailObfuscation(self._client) + def email_obfuscation(self) -> AsyncEmailObfuscationResource: + return AsyncEmailObfuscationResource(self._client) @cached_property - def h2_prioritization(self) -> AsyncH2Prioritization: - return AsyncH2Prioritization(self._client) + def h2_prioritization(self) -> AsyncH2PrioritizationResource: + return AsyncH2PrioritizationResource(self._client) @cached_property - def hotlink_protection(self) -> AsyncHotlinkProtection: - return AsyncHotlinkProtection(self._client) + def hotlink_protection(self) -> AsyncHotlinkProtectionResource: + return AsyncHotlinkProtectionResource(self._client) @cached_property - def http2(self) -> AsyncHTTP2: - return AsyncHTTP2(self._client) + def http2(self) -> AsyncHTTP2Resource: + return AsyncHTTP2Resource(self._client) @cached_property - def http3(self) -> AsyncHTTP3: - return AsyncHTTP3(self._client) + def http3(self) -> AsyncHTTP3Resource: + return AsyncHTTP3Resource(self._client) @cached_property - def image_resizing(self) -> AsyncImageResizing: - return AsyncImageResizing(self._client) + def image_resizing(self) -> AsyncImageResizingResource: + return AsyncImageResizingResource(self._client) @cached_property - def ip_geolocation(self) -> AsyncIPGeolocation: - return AsyncIPGeolocation(self._client) + def ip_geolocation(self) -> AsyncIPGeolocationResource: + return AsyncIPGeolocationResource(self._client) @cached_property - def ipv6(self) -> AsyncIPV6: - return AsyncIPV6(self._client) + def ipv6(self) -> AsyncIPV6Resource: + return AsyncIPV6Resource(self._client) @cached_property - def min_tls_version(self) -> AsyncMinTLSVersion: - return AsyncMinTLSVersion(self._client) + def min_tls_version(self) -> AsyncMinTLSVersionResource: + return AsyncMinTLSVersionResource(self._client) @cached_property - def minify(self) -> AsyncMinify: - return AsyncMinify(self._client) + def minify(self) -> AsyncMinifyResource: + return AsyncMinifyResource(self._client) @cached_property - def mirage(self) -> AsyncMirage: - return AsyncMirage(self._client) + def mirage(self) -> AsyncMirageResource: + return AsyncMirageResource(self._client) @cached_property - def mobile_redirect(self) -> AsyncMobileRedirect: - return AsyncMobileRedirect(self._client) + def mobile_redirect(self) -> AsyncMobileRedirectResource: + return AsyncMobileRedirectResource(self._client) @cached_property - def nel(self) -> AsyncNEL: - return AsyncNEL(self._client) + def nel(self) -> AsyncNELResource: + return AsyncNELResource(self._client) @cached_property - def opportunistic_encryption(self) -> AsyncOpportunisticEncryption: - return AsyncOpportunisticEncryption(self._client) + def opportunistic_encryption(self) -> AsyncOpportunisticEncryptionResource: + return AsyncOpportunisticEncryptionResource(self._client) @cached_property - def opportunistic_onion(self) -> AsyncOpportunisticOnion: - return AsyncOpportunisticOnion(self._client) + def opportunistic_onion(self) -> AsyncOpportunisticOnionResource: + return AsyncOpportunisticOnionResource(self._client) @cached_property - def orange_to_orange(self) -> AsyncOrangeToOrange: - return AsyncOrangeToOrange(self._client) + def orange_to_orange(self) -> AsyncOrangeToOrangeResource: + return AsyncOrangeToOrangeResource(self._client) @cached_property - def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThru: - return AsyncOriginErrorPagePassThru(self._client) + def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThruResource: + return AsyncOriginErrorPagePassThruResource(self._client) @cached_property - def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersion: - return AsyncOriginMaxHTTPVersion(self._client) + def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResource: + return AsyncOriginMaxHTTPVersionResource(self._client) @cached_property - def polish(self) -> AsyncPolish: - return AsyncPolish(self._client) + def polish(self) -> AsyncPolishResource: + return AsyncPolishResource(self._client) @cached_property - def prefetch_preload(self) -> AsyncPrefetchPreload: - return AsyncPrefetchPreload(self._client) + def prefetch_preload(self) -> AsyncPrefetchPreloadResource: + return AsyncPrefetchPreloadResource(self._client) @cached_property - def proxy_read_timeout(self) -> AsyncProxyReadTimeout: - return AsyncProxyReadTimeout(self._client) + def proxy_read_timeout(self) -> AsyncProxyReadTimeoutResource: + return AsyncProxyReadTimeoutResource(self._client) @cached_property - def pseudo_ipv4(self) -> AsyncPseudoIPV4: - return AsyncPseudoIPV4(self._client) + def pseudo_ipv4(self) -> AsyncPseudoIPV4Resource: + return AsyncPseudoIPV4Resource(self._client) @cached_property - def response_buffering(self) -> AsyncResponseBuffering: - return AsyncResponseBuffering(self._client) + def response_buffering(self) -> AsyncResponseBufferingResource: + return AsyncResponseBufferingResource(self._client) @cached_property - def rocket_loader(self) -> AsyncRocketLoader: - return AsyncRocketLoader(self._client) + def rocket_loader(self) -> AsyncRocketLoaderResource: + return AsyncRocketLoaderResource(self._client) @cached_property - def security_headers(self) -> AsyncSecurityHeaders: - return AsyncSecurityHeaders(self._client) + def security_headers(self) -> AsyncSecurityHeadersResource: + return AsyncSecurityHeadersResource(self._client) @cached_property - def security_level(self) -> AsyncSecurityLevel: - return AsyncSecurityLevel(self._client) + def security_level(self) -> AsyncSecurityLevelResource: + return AsyncSecurityLevelResource(self._client) @cached_property - def server_side_excludes(self) -> AsyncServerSideExcludes: - return AsyncServerSideExcludes(self._client) + def server_side_excludes(self) -> AsyncServerSideExcludesResource: + return AsyncServerSideExcludesResource(self._client) @cached_property - def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCache: - return AsyncSortQueryStringForCache(self._client) + def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCacheResource: + return AsyncSortQueryStringForCacheResource(self._client) @cached_property - def ssl(self) -> AsyncSSL: - return AsyncSSL(self._client) + def ssl(self) -> AsyncSSLResource: + return AsyncSSLResource(self._client) @cached_property - def ssl_recommender(self) -> AsyncSSLRecommender: - return AsyncSSLRecommender(self._client) + def ssl_recommender(self) -> AsyncSSLRecommenderResource: + return AsyncSSLRecommenderResource(self._client) @cached_property - def tls_1_3(self) -> AsyncTLS1_3: - return AsyncTLS1_3(self._client) + def tls_1_3(self) -> AsyncTLS1_3Resource: + return AsyncTLS1_3Resource(self._client) @cached_property - def tls_client_auth(self) -> AsyncTLSClientAuth: - return AsyncTLSClientAuth(self._client) + def tls_client_auth(self) -> AsyncTLSClientAuthResource: + return AsyncTLSClientAuthResource(self._client) @cached_property - def true_client_ip_header(self) -> AsyncTrueClientIPHeader: - return AsyncTrueClientIPHeader(self._client) + def true_client_ip_header(self) -> AsyncTrueClientIPHeaderResource: + return AsyncTrueClientIPHeaderResource(self._client) @cached_property - def waf(self) -> AsyncWAF: - return AsyncWAF(self._client) + def waf(self) -> AsyncWAFResource: + return AsyncWAFResource(self._client) @cached_property - def webp(self) -> AsyncWebP: - return AsyncWebP(self._client) + def webp(self) -> AsyncWebPResource: + return AsyncWebPResource(self._client) @cached_property - def websocket(self) -> AsyncWebsocket: - return AsyncWebsocket(self._client) + def websocket(self) -> AsyncWebsocketResource: + return AsyncWebsocketResource(self._client) @cached_property - def font_settings(self) -> AsyncFontSettings: - return AsyncFontSettings(self._client) + def font_settings(self) -> AsyncFontSettingsResource: + return AsyncFontSettingsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - items: Iterable[setting_edit_params.Item], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[SettingEditResponse]: - """ - Edit settings for a zone. - - Args: - zone_id: Identifier - - items: One or more zone setting objects. Must contain an ID and a value. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) - 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}/settings", - body=await async_maybe_transform({"items": items}, setting_edit_params.SettingEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), - ) - - async def get( - 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, - ) -> Optional[SettingGetResponse]: - """ - Available settings for your user in relation to 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 await self._get( - f"/zones/{zone_id}/settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), - ) - - -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings - self.edit = to_raw_response_wrapper( - settings.edit, - ) - self.get = to_raw_response_wrapper( - settings.get, - ) - @cached_property - def zero_rtt(self) -> ZeroRTTWithRawResponse: - return ZeroRTTWithRawResponse(self._settings.zero_rtt) + def zero_rtt(self) -> ZeroRTTResourceWithRawResponse: + return ZeroRTTResourceWithRawResponse(self._settings.zero_rtt) @cached_property - def advanced_ddos(self) -> AdvancedDDoSWithRawResponse: - return AdvancedDDoSWithRawResponse(self._settings.advanced_ddos) + def advanced_ddos(self) -> AdvancedDDoSResourceWithRawResponse: + return AdvancedDDoSResourceWithRawResponse(self._settings.advanced_ddos) @cached_property - def always_online(self) -> AlwaysOnlineWithRawResponse: - return AlwaysOnlineWithRawResponse(self._settings.always_online) + def always_online(self) -> AlwaysOnlineResourceWithRawResponse: + return AlwaysOnlineResourceWithRawResponse(self._settings.always_online) @cached_property - def always_use_https(self) -> AlwaysUseHTTPSWithRawResponse: - return AlwaysUseHTTPSWithRawResponse(self._settings.always_use_https) + def always_use_https(self) -> AlwaysUseHTTPSResourceWithRawResponse: + return AlwaysUseHTTPSResourceWithRawResponse(self._settings.always_use_https) @cached_property - def automatic_https_rewrites(self) -> AutomaticHTTPSRewritesWithRawResponse: - return AutomaticHTTPSRewritesWithRawResponse(self._settings.automatic_https_rewrites) + def automatic_https_rewrites(self) -> AutomaticHTTPSRewritesResourceWithRawResponse: + return AutomaticHTTPSRewritesResourceWithRawResponse(self._settings.automatic_https_rewrites) @cached_property - def automatic_platform_optimization(self) -> AutomaticPlatformOptimizationWithRawResponse: - return AutomaticPlatformOptimizationWithRawResponse(self._settings.automatic_platform_optimization) + def automatic_platform_optimization(self) -> AutomaticPlatformOptimizationResourceWithRawResponse: + return AutomaticPlatformOptimizationResourceWithRawResponse(self._settings.automatic_platform_optimization) @cached_property - def brotli(self) -> BrotliWithRawResponse: - return BrotliWithRawResponse(self._settings.brotli) + def brotli(self) -> BrotliResourceWithRawResponse: + return BrotliResourceWithRawResponse(self._settings.brotli) @cached_property - def browser_cache_ttl(self) -> BrowserCacheTTLWithRawResponse: - return BrowserCacheTTLWithRawResponse(self._settings.browser_cache_ttl) + def browser_cache_ttl(self) -> BrowserCacheTTLResourceWithRawResponse: + return BrowserCacheTTLResourceWithRawResponse(self._settings.browser_cache_ttl) @cached_property - def browser_check(self) -> BrowserCheckWithRawResponse: - return BrowserCheckWithRawResponse(self._settings.browser_check) + def browser_check(self) -> BrowserCheckResourceWithRawResponse: + return BrowserCheckResourceWithRawResponse(self._settings.browser_check) @cached_property - def cache_level(self) -> CacheLevelWithRawResponse: - return CacheLevelWithRawResponse(self._settings.cache_level) + def cache_level(self) -> CacheLevelResourceWithRawResponse: + return CacheLevelResourceWithRawResponse(self._settings.cache_level) @cached_property - def challenge_ttl(self) -> ChallengeTTLWithRawResponse: - return ChallengeTTLWithRawResponse(self._settings.challenge_ttl) + def challenge_ttl(self) -> ChallengeTTLResourceWithRawResponse: + return ChallengeTTLResourceWithRawResponse(self._settings.challenge_ttl) @cached_property - def ciphers(self) -> CiphersWithRawResponse: - return CiphersWithRawResponse(self._settings.ciphers) + def ciphers(self) -> CiphersResourceWithRawResponse: + return CiphersResourceWithRawResponse(self._settings.ciphers) @cached_property - def development_mode(self) -> DevelopmentModeWithRawResponse: - return DevelopmentModeWithRawResponse(self._settings.development_mode) + def development_mode(self) -> DevelopmentModeResourceWithRawResponse: + return DevelopmentModeResourceWithRawResponse(self._settings.development_mode) @cached_property - def early_hints(self) -> EarlyHintsWithRawResponse: - return EarlyHintsWithRawResponse(self._settings.early_hints) + def early_hints(self) -> EarlyHintsResourceWithRawResponse: + return EarlyHintsResourceWithRawResponse(self._settings.early_hints) @cached_property - def email_obfuscation(self) -> EmailObfuscationWithRawResponse: - return EmailObfuscationWithRawResponse(self._settings.email_obfuscation) + def email_obfuscation(self) -> EmailObfuscationResourceWithRawResponse: + return EmailObfuscationResourceWithRawResponse(self._settings.email_obfuscation) @cached_property - def h2_prioritization(self) -> H2PrioritizationWithRawResponse: - return H2PrioritizationWithRawResponse(self._settings.h2_prioritization) + def h2_prioritization(self) -> H2PrioritizationResourceWithRawResponse: + return H2PrioritizationResourceWithRawResponse(self._settings.h2_prioritization) @cached_property - def hotlink_protection(self) -> HotlinkProtectionWithRawResponse: - return HotlinkProtectionWithRawResponse(self._settings.hotlink_protection) + def hotlink_protection(self) -> HotlinkProtectionResourceWithRawResponse: + return HotlinkProtectionResourceWithRawResponse(self._settings.hotlink_protection) @cached_property - def http2(self) -> HTTP2WithRawResponse: - return HTTP2WithRawResponse(self._settings.http2) + def http2(self) -> HTTP2ResourceWithRawResponse: + return HTTP2ResourceWithRawResponse(self._settings.http2) @cached_property - def http3(self) -> HTTP3WithRawResponse: - return HTTP3WithRawResponse(self._settings.http3) + def http3(self) -> HTTP3ResourceWithRawResponse: + return HTTP3ResourceWithRawResponse(self._settings.http3) @cached_property - def image_resizing(self) -> ImageResizingWithRawResponse: - return ImageResizingWithRawResponse(self._settings.image_resizing) + def image_resizing(self) -> ImageResizingResourceWithRawResponse: + return ImageResizingResourceWithRawResponse(self._settings.image_resizing) @cached_property - def ip_geolocation(self) -> IPGeolocationWithRawResponse: - return IPGeolocationWithRawResponse(self._settings.ip_geolocation) + def ip_geolocation(self) -> IPGeolocationResourceWithRawResponse: + return IPGeolocationResourceWithRawResponse(self._settings.ip_geolocation) @cached_property - def ipv6(self) -> IPV6WithRawResponse: - return IPV6WithRawResponse(self._settings.ipv6) + def ipv6(self) -> IPV6ResourceWithRawResponse: + return IPV6ResourceWithRawResponse(self._settings.ipv6) @cached_property - def min_tls_version(self) -> MinTLSVersionWithRawResponse: - return MinTLSVersionWithRawResponse(self._settings.min_tls_version) + def min_tls_version(self) -> MinTLSVersionResourceWithRawResponse: + return MinTLSVersionResourceWithRawResponse(self._settings.min_tls_version) @cached_property - def minify(self) -> MinifyWithRawResponse: - return MinifyWithRawResponse(self._settings.minify) + def minify(self) -> MinifyResourceWithRawResponse: + return MinifyResourceWithRawResponse(self._settings.minify) @cached_property - def mirage(self) -> MirageWithRawResponse: - return MirageWithRawResponse(self._settings.mirage) + def mirage(self) -> MirageResourceWithRawResponse: + return MirageResourceWithRawResponse(self._settings.mirage) @cached_property - def mobile_redirect(self) -> MobileRedirectWithRawResponse: - return MobileRedirectWithRawResponse(self._settings.mobile_redirect) + def mobile_redirect(self) -> MobileRedirectResourceWithRawResponse: + return MobileRedirectResourceWithRawResponse(self._settings.mobile_redirect) @cached_property - def nel(self) -> NELWithRawResponse: - return NELWithRawResponse(self._settings.nel) + def nel(self) -> NELResourceWithRawResponse: + return NELResourceWithRawResponse(self._settings.nel) @cached_property - def opportunistic_encryption(self) -> OpportunisticEncryptionWithRawResponse: - return OpportunisticEncryptionWithRawResponse(self._settings.opportunistic_encryption) + def opportunistic_encryption(self) -> OpportunisticEncryptionResourceWithRawResponse: + return OpportunisticEncryptionResourceWithRawResponse(self._settings.opportunistic_encryption) @cached_property - def opportunistic_onion(self) -> OpportunisticOnionWithRawResponse: - return OpportunisticOnionWithRawResponse(self._settings.opportunistic_onion) + def opportunistic_onion(self) -> OpportunisticOnionResourceWithRawResponse: + return OpportunisticOnionResourceWithRawResponse(self._settings.opportunistic_onion) @cached_property - def orange_to_orange(self) -> OrangeToOrangeWithRawResponse: - return OrangeToOrangeWithRawResponse(self._settings.orange_to_orange) + def orange_to_orange(self) -> OrangeToOrangeResourceWithRawResponse: + return OrangeToOrangeResourceWithRawResponse(self._settings.orange_to_orange) @cached_property - def origin_error_page_pass_thru(self) -> OriginErrorPagePassThruWithRawResponse: - return OriginErrorPagePassThruWithRawResponse(self._settings.origin_error_page_pass_thru) + def origin_error_page_pass_thru(self) -> OriginErrorPagePassThruResourceWithRawResponse: + return OriginErrorPagePassThruResourceWithRawResponse(self._settings.origin_error_page_pass_thru) @cached_property - def origin_max_http_version(self) -> OriginMaxHTTPVersionWithRawResponse: - return OriginMaxHTTPVersionWithRawResponse(self._settings.origin_max_http_version) + def origin_max_http_version(self) -> OriginMaxHTTPVersionResourceWithRawResponse: + return OriginMaxHTTPVersionResourceWithRawResponse(self._settings.origin_max_http_version) @cached_property - def polish(self) -> PolishWithRawResponse: - return PolishWithRawResponse(self._settings.polish) + def polish(self) -> PolishResourceWithRawResponse: + return PolishResourceWithRawResponse(self._settings.polish) @cached_property - def prefetch_preload(self) -> PrefetchPreloadWithRawResponse: - return PrefetchPreloadWithRawResponse(self._settings.prefetch_preload) + def prefetch_preload(self) -> PrefetchPreloadResourceWithRawResponse: + return PrefetchPreloadResourceWithRawResponse(self._settings.prefetch_preload) @cached_property - def proxy_read_timeout(self) -> ProxyReadTimeoutWithRawResponse: - return ProxyReadTimeoutWithRawResponse(self._settings.proxy_read_timeout) + def proxy_read_timeout(self) -> ProxyReadTimeoutResourceWithRawResponse: + return ProxyReadTimeoutResourceWithRawResponse(self._settings.proxy_read_timeout) @cached_property - def pseudo_ipv4(self) -> PseudoIPV4WithRawResponse: - return PseudoIPV4WithRawResponse(self._settings.pseudo_ipv4) + def pseudo_ipv4(self) -> PseudoIPV4ResourceWithRawResponse: + return PseudoIPV4ResourceWithRawResponse(self._settings.pseudo_ipv4) @cached_property - def response_buffering(self) -> ResponseBufferingWithRawResponse: - return ResponseBufferingWithRawResponse(self._settings.response_buffering) + def response_buffering(self) -> ResponseBufferingResourceWithRawResponse: + return ResponseBufferingResourceWithRawResponse(self._settings.response_buffering) @cached_property - def rocket_loader(self) -> RocketLoaderWithRawResponse: - return RocketLoaderWithRawResponse(self._settings.rocket_loader) + def rocket_loader(self) -> RocketLoaderResourceWithRawResponse: + return RocketLoaderResourceWithRawResponse(self._settings.rocket_loader) @cached_property - def security_headers(self) -> SecurityHeadersWithRawResponse: - return SecurityHeadersWithRawResponse(self._settings.security_headers) + def security_headers(self) -> SecurityHeadersResourceWithRawResponse: + return SecurityHeadersResourceWithRawResponse(self._settings.security_headers) @cached_property - def security_level(self) -> SecurityLevelWithRawResponse: - return SecurityLevelWithRawResponse(self._settings.security_level) + def security_level(self) -> SecurityLevelResourceWithRawResponse: + return SecurityLevelResourceWithRawResponse(self._settings.security_level) @cached_property - def server_side_excludes(self) -> ServerSideExcludesWithRawResponse: - return ServerSideExcludesWithRawResponse(self._settings.server_side_excludes) + def server_side_excludes(self) -> ServerSideExcludesResourceWithRawResponse: + return ServerSideExcludesResourceWithRawResponse(self._settings.server_side_excludes) @cached_property - def sort_query_string_for_cache(self) -> SortQueryStringForCacheWithRawResponse: - return SortQueryStringForCacheWithRawResponse(self._settings.sort_query_string_for_cache) + def sort_query_string_for_cache(self) -> SortQueryStringForCacheResourceWithRawResponse: + return SortQueryStringForCacheResourceWithRawResponse(self._settings.sort_query_string_for_cache) @cached_property - def ssl(self) -> SSLWithRawResponse: - return SSLWithRawResponse(self._settings.ssl) + def ssl(self) -> SSLResourceWithRawResponse: + return SSLResourceWithRawResponse(self._settings.ssl) @cached_property - def ssl_recommender(self) -> SSLRecommenderWithRawResponse: - return SSLRecommenderWithRawResponse(self._settings.ssl_recommender) + def ssl_recommender(self) -> SSLRecommenderResourceWithRawResponse: + return SSLRecommenderResourceWithRawResponse(self._settings.ssl_recommender) @cached_property - def tls_1_3(self) -> TLS1_3WithRawResponse: - return TLS1_3WithRawResponse(self._settings.tls_1_3) + def tls_1_3(self) -> TLS1_3ResourceWithRawResponse: + return TLS1_3ResourceWithRawResponse(self._settings.tls_1_3) @cached_property - def tls_client_auth(self) -> TLSClientAuthWithRawResponse: - return TLSClientAuthWithRawResponse(self._settings.tls_client_auth) + def tls_client_auth(self) -> TLSClientAuthResourceWithRawResponse: + return TLSClientAuthResourceWithRawResponse(self._settings.tls_client_auth) @cached_property - def true_client_ip_header(self) -> TrueClientIPHeaderWithRawResponse: - return TrueClientIPHeaderWithRawResponse(self._settings.true_client_ip_header) + def true_client_ip_header(self) -> TrueClientIPHeaderResourceWithRawResponse: + return TrueClientIPHeaderResourceWithRawResponse(self._settings.true_client_ip_header) @cached_property - def waf(self) -> WAFWithRawResponse: - return WAFWithRawResponse(self._settings.waf) + def waf(self) -> WAFResourceWithRawResponse: + return WAFResourceWithRawResponse(self._settings.waf) @cached_property - def webp(self) -> WebPWithRawResponse: - return WebPWithRawResponse(self._settings.webp) + def webp(self) -> WebPResourceWithRawResponse: + return WebPResourceWithRawResponse(self._settings.webp) @cached_property - def websocket(self) -> WebsocketWithRawResponse: - return WebsocketWithRawResponse(self._settings.websocket) + def websocket(self) -> WebsocketResourceWithRawResponse: + return WebsocketResourceWithRawResponse(self._settings.websocket) @cached_property - def font_settings(self) -> FontSettingsWithRawResponse: - return FontSettingsWithRawResponse(self._settings.font_settings) + def font_settings(self) -> FontSettingsResourceWithRawResponse: + return FontSettingsResourceWithRawResponse(self._settings.font_settings) -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings - self.edit = async_to_raw_response_wrapper( - settings.edit, - ) - self.get = async_to_raw_response_wrapper( - settings.get, - ) - @cached_property - def zero_rtt(self) -> AsyncZeroRTTWithRawResponse: - return AsyncZeroRTTWithRawResponse(self._settings.zero_rtt) + def zero_rtt(self) -> AsyncZeroRTTResourceWithRawResponse: + return AsyncZeroRTTResourceWithRawResponse(self._settings.zero_rtt) @cached_property - def advanced_ddos(self) -> AsyncAdvancedDDoSWithRawResponse: - return AsyncAdvancedDDoSWithRawResponse(self._settings.advanced_ddos) + def advanced_ddos(self) -> AsyncAdvancedDDoSResourceWithRawResponse: + return AsyncAdvancedDDoSResourceWithRawResponse(self._settings.advanced_ddos) @cached_property - def always_online(self) -> AsyncAlwaysOnlineWithRawResponse: - return AsyncAlwaysOnlineWithRawResponse(self._settings.always_online) + def always_online(self) -> AsyncAlwaysOnlineResourceWithRawResponse: + return AsyncAlwaysOnlineResourceWithRawResponse(self._settings.always_online) @cached_property - def always_use_https(self) -> AsyncAlwaysUseHTTPSWithRawResponse: - return AsyncAlwaysUseHTTPSWithRawResponse(self._settings.always_use_https) + def always_use_https(self) -> AsyncAlwaysUseHTTPSResourceWithRawResponse: + return AsyncAlwaysUseHTTPSResourceWithRawResponse(self._settings.always_use_https) @cached_property - def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewritesWithRawResponse: - return AsyncAutomaticHTTPSRewritesWithRawResponse(self._settings.automatic_https_rewrites) + def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewritesResourceWithRawResponse: + return AsyncAutomaticHTTPSRewritesResourceWithRawResponse(self._settings.automatic_https_rewrites) @cached_property - def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimizationWithRawResponse: - return AsyncAutomaticPlatformOptimizationWithRawResponse(self._settings.automatic_platform_optimization) + def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimizationResourceWithRawResponse: + return AsyncAutomaticPlatformOptimizationResourceWithRawResponse(self._settings.automatic_platform_optimization) @cached_property - def brotli(self) -> AsyncBrotliWithRawResponse: - return AsyncBrotliWithRawResponse(self._settings.brotli) + def brotli(self) -> AsyncBrotliResourceWithRawResponse: + return AsyncBrotliResourceWithRawResponse(self._settings.brotli) @cached_property - def browser_cache_ttl(self) -> AsyncBrowserCacheTTLWithRawResponse: - return AsyncBrowserCacheTTLWithRawResponse(self._settings.browser_cache_ttl) + def browser_cache_ttl(self) -> AsyncBrowserCacheTTLResourceWithRawResponse: + return AsyncBrowserCacheTTLResourceWithRawResponse(self._settings.browser_cache_ttl) @cached_property - def browser_check(self) -> AsyncBrowserCheckWithRawResponse: - return AsyncBrowserCheckWithRawResponse(self._settings.browser_check) + def browser_check(self) -> AsyncBrowserCheckResourceWithRawResponse: + return AsyncBrowserCheckResourceWithRawResponse(self._settings.browser_check) @cached_property - def cache_level(self) -> AsyncCacheLevelWithRawResponse: - return AsyncCacheLevelWithRawResponse(self._settings.cache_level) + def cache_level(self) -> AsyncCacheLevelResourceWithRawResponse: + return AsyncCacheLevelResourceWithRawResponse(self._settings.cache_level) @cached_property - def challenge_ttl(self) -> AsyncChallengeTTLWithRawResponse: - return AsyncChallengeTTLWithRawResponse(self._settings.challenge_ttl) + def challenge_ttl(self) -> AsyncChallengeTTLResourceWithRawResponse: + return AsyncChallengeTTLResourceWithRawResponse(self._settings.challenge_ttl) @cached_property - def ciphers(self) -> AsyncCiphersWithRawResponse: - return AsyncCiphersWithRawResponse(self._settings.ciphers) + def ciphers(self) -> AsyncCiphersResourceWithRawResponse: + return AsyncCiphersResourceWithRawResponse(self._settings.ciphers) @cached_property - def development_mode(self) -> AsyncDevelopmentModeWithRawResponse: - return AsyncDevelopmentModeWithRawResponse(self._settings.development_mode) + def development_mode(self) -> AsyncDevelopmentModeResourceWithRawResponse: + return AsyncDevelopmentModeResourceWithRawResponse(self._settings.development_mode) @cached_property - def early_hints(self) -> AsyncEarlyHintsWithRawResponse: - return AsyncEarlyHintsWithRawResponse(self._settings.early_hints) + def early_hints(self) -> AsyncEarlyHintsResourceWithRawResponse: + return AsyncEarlyHintsResourceWithRawResponse(self._settings.early_hints) @cached_property - def email_obfuscation(self) -> AsyncEmailObfuscationWithRawResponse: - return AsyncEmailObfuscationWithRawResponse(self._settings.email_obfuscation) + def email_obfuscation(self) -> AsyncEmailObfuscationResourceWithRawResponse: + return AsyncEmailObfuscationResourceWithRawResponse(self._settings.email_obfuscation) @cached_property - def h2_prioritization(self) -> AsyncH2PrioritizationWithRawResponse: - return AsyncH2PrioritizationWithRawResponse(self._settings.h2_prioritization) + def h2_prioritization(self) -> AsyncH2PrioritizationResourceWithRawResponse: + return AsyncH2PrioritizationResourceWithRawResponse(self._settings.h2_prioritization) @cached_property - def hotlink_protection(self) -> AsyncHotlinkProtectionWithRawResponse: - return AsyncHotlinkProtectionWithRawResponse(self._settings.hotlink_protection) + def hotlink_protection(self) -> AsyncHotlinkProtectionResourceWithRawResponse: + return AsyncHotlinkProtectionResourceWithRawResponse(self._settings.hotlink_protection) @cached_property - def http2(self) -> AsyncHTTP2WithRawResponse: - return AsyncHTTP2WithRawResponse(self._settings.http2) + def http2(self) -> AsyncHTTP2ResourceWithRawResponse: + return AsyncHTTP2ResourceWithRawResponse(self._settings.http2) @cached_property - def http3(self) -> AsyncHTTP3WithRawResponse: - return AsyncHTTP3WithRawResponse(self._settings.http3) + def http3(self) -> AsyncHTTP3ResourceWithRawResponse: + return AsyncHTTP3ResourceWithRawResponse(self._settings.http3) @cached_property - def image_resizing(self) -> AsyncImageResizingWithRawResponse: - return AsyncImageResizingWithRawResponse(self._settings.image_resizing) + def image_resizing(self) -> AsyncImageResizingResourceWithRawResponse: + return AsyncImageResizingResourceWithRawResponse(self._settings.image_resizing) @cached_property - def ip_geolocation(self) -> AsyncIPGeolocationWithRawResponse: - return AsyncIPGeolocationWithRawResponse(self._settings.ip_geolocation) + def ip_geolocation(self) -> AsyncIPGeolocationResourceWithRawResponse: + return AsyncIPGeolocationResourceWithRawResponse(self._settings.ip_geolocation) @cached_property - def ipv6(self) -> AsyncIPV6WithRawResponse: - return AsyncIPV6WithRawResponse(self._settings.ipv6) + def ipv6(self) -> AsyncIPV6ResourceWithRawResponse: + return AsyncIPV6ResourceWithRawResponse(self._settings.ipv6) @cached_property - def min_tls_version(self) -> AsyncMinTLSVersionWithRawResponse: - return AsyncMinTLSVersionWithRawResponse(self._settings.min_tls_version) + def min_tls_version(self) -> AsyncMinTLSVersionResourceWithRawResponse: + return AsyncMinTLSVersionResourceWithRawResponse(self._settings.min_tls_version) @cached_property - def minify(self) -> AsyncMinifyWithRawResponse: - return AsyncMinifyWithRawResponse(self._settings.minify) + def minify(self) -> AsyncMinifyResourceWithRawResponse: + return AsyncMinifyResourceWithRawResponse(self._settings.minify) @cached_property - def mirage(self) -> AsyncMirageWithRawResponse: - return AsyncMirageWithRawResponse(self._settings.mirage) + def mirage(self) -> AsyncMirageResourceWithRawResponse: + return AsyncMirageResourceWithRawResponse(self._settings.mirage) @cached_property - def mobile_redirect(self) -> AsyncMobileRedirectWithRawResponse: - return AsyncMobileRedirectWithRawResponse(self._settings.mobile_redirect) + def mobile_redirect(self) -> AsyncMobileRedirectResourceWithRawResponse: + return AsyncMobileRedirectResourceWithRawResponse(self._settings.mobile_redirect) @cached_property - def nel(self) -> AsyncNELWithRawResponse: - return AsyncNELWithRawResponse(self._settings.nel) + def nel(self) -> AsyncNELResourceWithRawResponse: + return AsyncNELResourceWithRawResponse(self._settings.nel) @cached_property - def opportunistic_encryption(self) -> AsyncOpportunisticEncryptionWithRawResponse: - return AsyncOpportunisticEncryptionWithRawResponse(self._settings.opportunistic_encryption) + def opportunistic_encryption(self) -> AsyncOpportunisticEncryptionResourceWithRawResponse: + return AsyncOpportunisticEncryptionResourceWithRawResponse(self._settings.opportunistic_encryption) @cached_property - def opportunistic_onion(self) -> AsyncOpportunisticOnionWithRawResponse: - return AsyncOpportunisticOnionWithRawResponse(self._settings.opportunistic_onion) + def opportunistic_onion(self) -> AsyncOpportunisticOnionResourceWithRawResponse: + return AsyncOpportunisticOnionResourceWithRawResponse(self._settings.opportunistic_onion) @cached_property - def orange_to_orange(self) -> AsyncOrangeToOrangeWithRawResponse: - return AsyncOrangeToOrangeWithRawResponse(self._settings.orange_to_orange) + def orange_to_orange(self) -> AsyncOrangeToOrangeResourceWithRawResponse: + return AsyncOrangeToOrangeResourceWithRawResponse(self._settings.orange_to_orange) @cached_property - def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThruWithRawResponse: - return AsyncOriginErrorPagePassThruWithRawResponse(self._settings.origin_error_page_pass_thru) + def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThruResourceWithRawResponse: + return AsyncOriginErrorPagePassThruResourceWithRawResponse(self._settings.origin_error_page_pass_thru) @cached_property - def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionWithRawResponse: - return AsyncOriginMaxHTTPVersionWithRawResponse(self._settings.origin_max_http_version) + def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResourceWithRawResponse: + return AsyncOriginMaxHTTPVersionResourceWithRawResponse(self._settings.origin_max_http_version) @cached_property - def polish(self) -> AsyncPolishWithRawResponse: - return AsyncPolishWithRawResponse(self._settings.polish) + def polish(self) -> AsyncPolishResourceWithRawResponse: + return AsyncPolishResourceWithRawResponse(self._settings.polish) @cached_property - def prefetch_preload(self) -> AsyncPrefetchPreloadWithRawResponse: - return AsyncPrefetchPreloadWithRawResponse(self._settings.prefetch_preload) + def prefetch_preload(self) -> AsyncPrefetchPreloadResourceWithRawResponse: + return AsyncPrefetchPreloadResourceWithRawResponse(self._settings.prefetch_preload) @cached_property - def proxy_read_timeout(self) -> AsyncProxyReadTimeoutWithRawResponse: - return AsyncProxyReadTimeoutWithRawResponse(self._settings.proxy_read_timeout) + def proxy_read_timeout(self) -> AsyncProxyReadTimeoutResourceWithRawResponse: + return AsyncProxyReadTimeoutResourceWithRawResponse(self._settings.proxy_read_timeout) @cached_property - def pseudo_ipv4(self) -> AsyncPseudoIPV4WithRawResponse: - return AsyncPseudoIPV4WithRawResponse(self._settings.pseudo_ipv4) + def pseudo_ipv4(self) -> AsyncPseudoIPV4ResourceWithRawResponse: + return AsyncPseudoIPV4ResourceWithRawResponse(self._settings.pseudo_ipv4) @cached_property - def response_buffering(self) -> AsyncResponseBufferingWithRawResponse: - return AsyncResponseBufferingWithRawResponse(self._settings.response_buffering) + def response_buffering(self) -> AsyncResponseBufferingResourceWithRawResponse: + return AsyncResponseBufferingResourceWithRawResponse(self._settings.response_buffering) @cached_property - def rocket_loader(self) -> AsyncRocketLoaderWithRawResponse: - return AsyncRocketLoaderWithRawResponse(self._settings.rocket_loader) + def rocket_loader(self) -> AsyncRocketLoaderResourceWithRawResponse: + return AsyncRocketLoaderResourceWithRawResponse(self._settings.rocket_loader) @cached_property - def security_headers(self) -> AsyncSecurityHeadersWithRawResponse: - return AsyncSecurityHeadersWithRawResponse(self._settings.security_headers) + def security_headers(self) -> AsyncSecurityHeadersResourceWithRawResponse: + return AsyncSecurityHeadersResourceWithRawResponse(self._settings.security_headers) @cached_property - def security_level(self) -> AsyncSecurityLevelWithRawResponse: - return AsyncSecurityLevelWithRawResponse(self._settings.security_level) + def security_level(self) -> AsyncSecurityLevelResourceWithRawResponse: + return AsyncSecurityLevelResourceWithRawResponse(self._settings.security_level) @cached_property - def server_side_excludes(self) -> AsyncServerSideExcludesWithRawResponse: - return AsyncServerSideExcludesWithRawResponse(self._settings.server_side_excludes) + def server_side_excludes(self) -> AsyncServerSideExcludesResourceWithRawResponse: + return AsyncServerSideExcludesResourceWithRawResponse(self._settings.server_side_excludes) @cached_property - def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCacheWithRawResponse: - return AsyncSortQueryStringForCacheWithRawResponse(self._settings.sort_query_string_for_cache) + def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCacheResourceWithRawResponse: + return AsyncSortQueryStringForCacheResourceWithRawResponse(self._settings.sort_query_string_for_cache) @cached_property - def ssl(self) -> AsyncSSLWithRawResponse: - return AsyncSSLWithRawResponse(self._settings.ssl) + def ssl(self) -> AsyncSSLResourceWithRawResponse: + return AsyncSSLResourceWithRawResponse(self._settings.ssl) @cached_property - def ssl_recommender(self) -> AsyncSSLRecommenderWithRawResponse: - return AsyncSSLRecommenderWithRawResponse(self._settings.ssl_recommender) + def ssl_recommender(self) -> AsyncSSLRecommenderResourceWithRawResponse: + return AsyncSSLRecommenderResourceWithRawResponse(self._settings.ssl_recommender) @cached_property - def tls_1_3(self) -> AsyncTLS1_3WithRawResponse: - return AsyncTLS1_3WithRawResponse(self._settings.tls_1_3) + def tls_1_3(self) -> AsyncTLS1_3ResourceWithRawResponse: + return AsyncTLS1_3ResourceWithRawResponse(self._settings.tls_1_3) @cached_property - def tls_client_auth(self) -> AsyncTLSClientAuthWithRawResponse: - return AsyncTLSClientAuthWithRawResponse(self._settings.tls_client_auth) + def tls_client_auth(self) -> AsyncTLSClientAuthResourceWithRawResponse: + return AsyncTLSClientAuthResourceWithRawResponse(self._settings.tls_client_auth) @cached_property - def true_client_ip_header(self) -> AsyncTrueClientIPHeaderWithRawResponse: - return AsyncTrueClientIPHeaderWithRawResponse(self._settings.true_client_ip_header) + def true_client_ip_header(self) -> AsyncTrueClientIPHeaderResourceWithRawResponse: + return AsyncTrueClientIPHeaderResourceWithRawResponse(self._settings.true_client_ip_header) @cached_property - def waf(self) -> AsyncWAFWithRawResponse: - return AsyncWAFWithRawResponse(self._settings.waf) + def waf(self) -> AsyncWAFResourceWithRawResponse: + return AsyncWAFResourceWithRawResponse(self._settings.waf) @cached_property - def webp(self) -> AsyncWebPWithRawResponse: - return AsyncWebPWithRawResponse(self._settings.webp) + def webp(self) -> AsyncWebPResourceWithRawResponse: + return AsyncWebPResourceWithRawResponse(self._settings.webp) @cached_property - def websocket(self) -> AsyncWebsocketWithRawResponse: - return AsyncWebsocketWithRawResponse(self._settings.websocket) + def websocket(self) -> AsyncWebsocketResourceWithRawResponse: + return AsyncWebsocketResourceWithRawResponse(self._settings.websocket) @cached_property - def font_settings(self) -> AsyncFontSettingsWithRawResponse: - return AsyncFontSettingsWithRawResponse(self._settings.font_settings) + def font_settings(self) -> AsyncFontSettingsResourceWithRawResponse: + return AsyncFontSettingsResourceWithRawResponse(self._settings.font_settings) -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: self._settings = settings - self.edit = to_streamed_response_wrapper( - settings.edit, - ) - self.get = to_streamed_response_wrapper( - settings.get, - ) - @cached_property - def zero_rtt(self) -> ZeroRTTWithStreamingResponse: - return ZeroRTTWithStreamingResponse(self._settings.zero_rtt) + def zero_rtt(self) -> ZeroRTTResourceWithStreamingResponse: + return ZeroRTTResourceWithStreamingResponse(self._settings.zero_rtt) @cached_property - def advanced_ddos(self) -> AdvancedDDoSWithStreamingResponse: - return AdvancedDDoSWithStreamingResponse(self._settings.advanced_ddos) + def advanced_ddos(self) -> AdvancedDDoSResourceWithStreamingResponse: + return AdvancedDDoSResourceWithStreamingResponse(self._settings.advanced_ddos) @cached_property - def always_online(self) -> AlwaysOnlineWithStreamingResponse: - return AlwaysOnlineWithStreamingResponse(self._settings.always_online) + def always_online(self) -> AlwaysOnlineResourceWithStreamingResponse: + return AlwaysOnlineResourceWithStreamingResponse(self._settings.always_online) @cached_property - def always_use_https(self) -> AlwaysUseHTTPSWithStreamingResponse: - return AlwaysUseHTTPSWithStreamingResponse(self._settings.always_use_https) + def always_use_https(self) -> AlwaysUseHTTPSResourceWithStreamingResponse: + return AlwaysUseHTTPSResourceWithStreamingResponse(self._settings.always_use_https) @cached_property - def automatic_https_rewrites(self) -> AutomaticHTTPSRewritesWithStreamingResponse: - return AutomaticHTTPSRewritesWithStreamingResponse(self._settings.automatic_https_rewrites) + def automatic_https_rewrites(self) -> AutomaticHTTPSRewritesResourceWithStreamingResponse: + return AutomaticHTTPSRewritesResourceWithStreamingResponse(self._settings.automatic_https_rewrites) @cached_property - def automatic_platform_optimization(self) -> AutomaticPlatformOptimizationWithStreamingResponse: - return AutomaticPlatformOptimizationWithStreamingResponse(self._settings.automatic_platform_optimization) + def automatic_platform_optimization(self) -> AutomaticPlatformOptimizationResourceWithStreamingResponse: + return AutomaticPlatformOptimizationResourceWithStreamingResponse( + self._settings.automatic_platform_optimization + ) @cached_property - def brotli(self) -> BrotliWithStreamingResponse: - return BrotliWithStreamingResponse(self._settings.brotli) + def brotli(self) -> BrotliResourceWithStreamingResponse: + return BrotliResourceWithStreamingResponse(self._settings.brotli) @cached_property - def browser_cache_ttl(self) -> BrowserCacheTTLWithStreamingResponse: - return BrowserCacheTTLWithStreamingResponse(self._settings.browser_cache_ttl) + def browser_cache_ttl(self) -> BrowserCacheTTLResourceWithStreamingResponse: + return BrowserCacheTTLResourceWithStreamingResponse(self._settings.browser_cache_ttl) @cached_property - def browser_check(self) -> BrowserCheckWithStreamingResponse: - return BrowserCheckWithStreamingResponse(self._settings.browser_check) + def browser_check(self) -> BrowserCheckResourceWithStreamingResponse: + return BrowserCheckResourceWithStreamingResponse(self._settings.browser_check) @cached_property - def cache_level(self) -> CacheLevelWithStreamingResponse: - return CacheLevelWithStreamingResponse(self._settings.cache_level) + def cache_level(self) -> CacheLevelResourceWithStreamingResponse: + return CacheLevelResourceWithStreamingResponse(self._settings.cache_level) @cached_property - def challenge_ttl(self) -> ChallengeTTLWithStreamingResponse: - return ChallengeTTLWithStreamingResponse(self._settings.challenge_ttl) + def challenge_ttl(self) -> ChallengeTTLResourceWithStreamingResponse: + return ChallengeTTLResourceWithStreamingResponse(self._settings.challenge_ttl) @cached_property - def ciphers(self) -> CiphersWithStreamingResponse: - return CiphersWithStreamingResponse(self._settings.ciphers) + def ciphers(self) -> CiphersResourceWithStreamingResponse: + return CiphersResourceWithStreamingResponse(self._settings.ciphers) @cached_property - def development_mode(self) -> DevelopmentModeWithStreamingResponse: - return DevelopmentModeWithStreamingResponse(self._settings.development_mode) + def development_mode(self) -> DevelopmentModeResourceWithStreamingResponse: + return DevelopmentModeResourceWithStreamingResponse(self._settings.development_mode) @cached_property - def early_hints(self) -> EarlyHintsWithStreamingResponse: - return EarlyHintsWithStreamingResponse(self._settings.early_hints) + def early_hints(self) -> EarlyHintsResourceWithStreamingResponse: + return EarlyHintsResourceWithStreamingResponse(self._settings.early_hints) @cached_property - def email_obfuscation(self) -> EmailObfuscationWithStreamingResponse: - return EmailObfuscationWithStreamingResponse(self._settings.email_obfuscation) + def email_obfuscation(self) -> EmailObfuscationResourceWithStreamingResponse: + return EmailObfuscationResourceWithStreamingResponse(self._settings.email_obfuscation) @cached_property - def h2_prioritization(self) -> H2PrioritizationWithStreamingResponse: - return H2PrioritizationWithStreamingResponse(self._settings.h2_prioritization) + def h2_prioritization(self) -> H2PrioritizationResourceWithStreamingResponse: + return H2PrioritizationResourceWithStreamingResponse(self._settings.h2_prioritization) @cached_property - def hotlink_protection(self) -> HotlinkProtectionWithStreamingResponse: - return HotlinkProtectionWithStreamingResponse(self._settings.hotlink_protection) + def hotlink_protection(self) -> HotlinkProtectionResourceWithStreamingResponse: + return HotlinkProtectionResourceWithStreamingResponse(self._settings.hotlink_protection) @cached_property - def http2(self) -> HTTP2WithStreamingResponse: - return HTTP2WithStreamingResponse(self._settings.http2) + def http2(self) -> HTTP2ResourceWithStreamingResponse: + return HTTP2ResourceWithStreamingResponse(self._settings.http2) @cached_property - def http3(self) -> HTTP3WithStreamingResponse: - return HTTP3WithStreamingResponse(self._settings.http3) + def http3(self) -> HTTP3ResourceWithStreamingResponse: + return HTTP3ResourceWithStreamingResponse(self._settings.http3) @cached_property - def image_resizing(self) -> ImageResizingWithStreamingResponse: - return ImageResizingWithStreamingResponse(self._settings.image_resizing) + def image_resizing(self) -> ImageResizingResourceWithStreamingResponse: + return ImageResizingResourceWithStreamingResponse(self._settings.image_resizing) @cached_property - def ip_geolocation(self) -> IPGeolocationWithStreamingResponse: - return IPGeolocationWithStreamingResponse(self._settings.ip_geolocation) + def ip_geolocation(self) -> IPGeolocationResourceWithStreamingResponse: + return IPGeolocationResourceWithStreamingResponse(self._settings.ip_geolocation) @cached_property - def ipv6(self) -> IPV6WithStreamingResponse: - return IPV6WithStreamingResponse(self._settings.ipv6) + def ipv6(self) -> IPV6ResourceWithStreamingResponse: + return IPV6ResourceWithStreamingResponse(self._settings.ipv6) @cached_property - def min_tls_version(self) -> MinTLSVersionWithStreamingResponse: - return MinTLSVersionWithStreamingResponse(self._settings.min_tls_version) + def min_tls_version(self) -> MinTLSVersionResourceWithStreamingResponse: + return MinTLSVersionResourceWithStreamingResponse(self._settings.min_tls_version) @cached_property - def minify(self) -> MinifyWithStreamingResponse: - return MinifyWithStreamingResponse(self._settings.minify) + def minify(self) -> MinifyResourceWithStreamingResponse: + return MinifyResourceWithStreamingResponse(self._settings.minify) @cached_property - def mirage(self) -> MirageWithStreamingResponse: - return MirageWithStreamingResponse(self._settings.mirage) + def mirage(self) -> MirageResourceWithStreamingResponse: + return MirageResourceWithStreamingResponse(self._settings.mirage) @cached_property - def mobile_redirect(self) -> MobileRedirectWithStreamingResponse: - return MobileRedirectWithStreamingResponse(self._settings.mobile_redirect) + def mobile_redirect(self) -> MobileRedirectResourceWithStreamingResponse: + return MobileRedirectResourceWithStreamingResponse(self._settings.mobile_redirect) @cached_property - def nel(self) -> NELWithStreamingResponse: - return NELWithStreamingResponse(self._settings.nel) + def nel(self) -> NELResourceWithStreamingResponse: + return NELResourceWithStreamingResponse(self._settings.nel) @cached_property - def opportunistic_encryption(self) -> OpportunisticEncryptionWithStreamingResponse: - return OpportunisticEncryptionWithStreamingResponse(self._settings.opportunistic_encryption) + def opportunistic_encryption(self) -> OpportunisticEncryptionResourceWithStreamingResponse: + return OpportunisticEncryptionResourceWithStreamingResponse(self._settings.opportunistic_encryption) @cached_property - def opportunistic_onion(self) -> OpportunisticOnionWithStreamingResponse: - return OpportunisticOnionWithStreamingResponse(self._settings.opportunistic_onion) + def opportunistic_onion(self) -> OpportunisticOnionResourceWithStreamingResponse: + return OpportunisticOnionResourceWithStreamingResponse(self._settings.opportunistic_onion) @cached_property - def orange_to_orange(self) -> OrangeToOrangeWithStreamingResponse: - return OrangeToOrangeWithStreamingResponse(self._settings.orange_to_orange) + def orange_to_orange(self) -> OrangeToOrangeResourceWithStreamingResponse: + return OrangeToOrangeResourceWithStreamingResponse(self._settings.orange_to_orange) @cached_property - def origin_error_page_pass_thru(self) -> OriginErrorPagePassThruWithStreamingResponse: - return OriginErrorPagePassThruWithStreamingResponse(self._settings.origin_error_page_pass_thru) + def origin_error_page_pass_thru(self) -> OriginErrorPagePassThruResourceWithStreamingResponse: + return OriginErrorPagePassThruResourceWithStreamingResponse(self._settings.origin_error_page_pass_thru) @cached_property - def origin_max_http_version(self) -> OriginMaxHTTPVersionWithStreamingResponse: - return OriginMaxHTTPVersionWithStreamingResponse(self._settings.origin_max_http_version) + def origin_max_http_version(self) -> OriginMaxHTTPVersionResourceWithStreamingResponse: + return OriginMaxHTTPVersionResourceWithStreamingResponse(self._settings.origin_max_http_version) @cached_property - def polish(self) -> PolishWithStreamingResponse: - return PolishWithStreamingResponse(self._settings.polish) + def polish(self) -> PolishResourceWithStreamingResponse: + return PolishResourceWithStreamingResponse(self._settings.polish) @cached_property - def prefetch_preload(self) -> PrefetchPreloadWithStreamingResponse: - return PrefetchPreloadWithStreamingResponse(self._settings.prefetch_preload) + def prefetch_preload(self) -> PrefetchPreloadResourceWithStreamingResponse: + return PrefetchPreloadResourceWithStreamingResponse(self._settings.prefetch_preload) @cached_property - def proxy_read_timeout(self) -> ProxyReadTimeoutWithStreamingResponse: - return ProxyReadTimeoutWithStreamingResponse(self._settings.proxy_read_timeout) + def proxy_read_timeout(self) -> ProxyReadTimeoutResourceWithStreamingResponse: + return ProxyReadTimeoutResourceWithStreamingResponse(self._settings.proxy_read_timeout) @cached_property - def pseudo_ipv4(self) -> PseudoIPV4WithStreamingResponse: - return PseudoIPV4WithStreamingResponse(self._settings.pseudo_ipv4) + def pseudo_ipv4(self) -> PseudoIPV4ResourceWithStreamingResponse: + return PseudoIPV4ResourceWithStreamingResponse(self._settings.pseudo_ipv4) @cached_property - def response_buffering(self) -> ResponseBufferingWithStreamingResponse: - return ResponseBufferingWithStreamingResponse(self._settings.response_buffering) + def response_buffering(self) -> ResponseBufferingResourceWithStreamingResponse: + return ResponseBufferingResourceWithStreamingResponse(self._settings.response_buffering) @cached_property - def rocket_loader(self) -> RocketLoaderWithStreamingResponse: - return RocketLoaderWithStreamingResponse(self._settings.rocket_loader) + def rocket_loader(self) -> RocketLoaderResourceWithStreamingResponse: + return RocketLoaderResourceWithStreamingResponse(self._settings.rocket_loader) @cached_property - def security_headers(self) -> SecurityHeadersWithStreamingResponse: - return SecurityHeadersWithStreamingResponse(self._settings.security_headers) + def security_headers(self) -> SecurityHeadersResourceWithStreamingResponse: + return SecurityHeadersResourceWithStreamingResponse(self._settings.security_headers) @cached_property - def security_level(self) -> SecurityLevelWithStreamingResponse: - return SecurityLevelWithStreamingResponse(self._settings.security_level) + def security_level(self) -> SecurityLevelResourceWithStreamingResponse: + return SecurityLevelResourceWithStreamingResponse(self._settings.security_level) @cached_property - def server_side_excludes(self) -> ServerSideExcludesWithStreamingResponse: - return ServerSideExcludesWithStreamingResponse(self._settings.server_side_excludes) + def server_side_excludes(self) -> ServerSideExcludesResourceWithStreamingResponse: + return ServerSideExcludesResourceWithStreamingResponse(self._settings.server_side_excludes) @cached_property - def sort_query_string_for_cache(self) -> SortQueryStringForCacheWithStreamingResponse: - return SortQueryStringForCacheWithStreamingResponse(self._settings.sort_query_string_for_cache) + def sort_query_string_for_cache(self) -> SortQueryStringForCacheResourceWithStreamingResponse: + return SortQueryStringForCacheResourceWithStreamingResponse(self._settings.sort_query_string_for_cache) @cached_property - def ssl(self) -> SSLWithStreamingResponse: - return SSLWithStreamingResponse(self._settings.ssl) + def ssl(self) -> SSLResourceWithStreamingResponse: + return SSLResourceWithStreamingResponse(self._settings.ssl) @cached_property - def ssl_recommender(self) -> SSLRecommenderWithStreamingResponse: - return SSLRecommenderWithStreamingResponse(self._settings.ssl_recommender) + def ssl_recommender(self) -> SSLRecommenderResourceWithStreamingResponse: + return SSLRecommenderResourceWithStreamingResponse(self._settings.ssl_recommender) @cached_property - def tls_1_3(self) -> TLS1_3WithStreamingResponse: - return TLS1_3WithStreamingResponse(self._settings.tls_1_3) + def tls_1_3(self) -> TLS1_3ResourceWithStreamingResponse: + return TLS1_3ResourceWithStreamingResponse(self._settings.tls_1_3) @cached_property - def tls_client_auth(self) -> TLSClientAuthWithStreamingResponse: - return TLSClientAuthWithStreamingResponse(self._settings.tls_client_auth) + def tls_client_auth(self) -> TLSClientAuthResourceWithStreamingResponse: + return TLSClientAuthResourceWithStreamingResponse(self._settings.tls_client_auth) @cached_property - def true_client_ip_header(self) -> TrueClientIPHeaderWithStreamingResponse: - return TrueClientIPHeaderWithStreamingResponse(self._settings.true_client_ip_header) + def true_client_ip_header(self) -> TrueClientIPHeaderResourceWithStreamingResponse: + return TrueClientIPHeaderResourceWithStreamingResponse(self._settings.true_client_ip_header) @cached_property - def waf(self) -> WAFWithStreamingResponse: - return WAFWithStreamingResponse(self._settings.waf) + def waf(self) -> WAFResourceWithStreamingResponse: + return WAFResourceWithStreamingResponse(self._settings.waf) @cached_property - def webp(self) -> WebPWithStreamingResponse: - return WebPWithStreamingResponse(self._settings.webp) + def webp(self) -> WebPResourceWithStreamingResponse: + return WebPResourceWithStreamingResponse(self._settings.webp) @cached_property - def websocket(self) -> WebsocketWithStreamingResponse: - return WebsocketWithStreamingResponse(self._settings.websocket) + def websocket(self) -> WebsocketResourceWithStreamingResponse: + return WebsocketResourceWithStreamingResponse(self._settings.websocket) @cached_property - def font_settings(self) -> FontSettingsWithStreamingResponse: - return FontSettingsWithStreamingResponse(self._settings.font_settings) + def font_settings(self) -> FontSettingsResourceWithStreamingResponse: + return FontSettingsResourceWithStreamingResponse(self._settings.font_settings) -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: self._settings = settings - self.edit = async_to_streamed_response_wrapper( - settings.edit, - ) - self.get = async_to_streamed_response_wrapper( - settings.get, - ) - @cached_property - def zero_rtt(self) -> AsyncZeroRTTWithStreamingResponse: - return AsyncZeroRTTWithStreamingResponse(self._settings.zero_rtt) + def zero_rtt(self) -> AsyncZeroRTTResourceWithStreamingResponse: + return AsyncZeroRTTResourceWithStreamingResponse(self._settings.zero_rtt) @cached_property - def advanced_ddos(self) -> AsyncAdvancedDDoSWithStreamingResponse: - return AsyncAdvancedDDoSWithStreamingResponse(self._settings.advanced_ddos) + def advanced_ddos(self) -> AsyncAdvancedDDoSResourceWithStreamingResponse: + return AsyncAdvancedDDoSResourceWithStreamingResponse(self._settings.advanced_ddos) @cached_property - def always_online(self) -> AsyncAlwaysOnlineWithStreamingResponse: - return AsyncAlwaysOnlineWithStreamingResponse(self._settings.always_online) + def always_online(self) -> AsyncAlwaysOnlineResourceWithStreamingResponse: + return AsyncAlwaysOnlineResourceWithStreamingResponse(self._settings.always_online) @cached_property - def always_use_https(self) -> AsyncAlwaysUseHTTPSWithStreamingResponse: - return AsyncAlwaysUseHTTPSWithStreamingResponse(self._settings.always_use_https) + def always_use_https(self) -> AsyncAlwaysUseHTTPSResourceWithStreamingResponse: + return AsyncAlwaysUseHTTPSResourceWithStreamingResponse(self._settings.always_use_https) @cached_property - def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewritesWithStreamingResponse: - return AsyncAutomaticHTTPSRewritesWithStreamingResponse(self._settings.automatic_https_rewrites) + def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse: + return AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse(self._settings.automatic_https_rewrites) @cached_property - def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimizationWithStreamingResponse: - return AsyncAutomaticPlatformOptimizationWithStreamingResponse(self._settings.automatic_platform_optimization) + def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse: + return AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse( + self._settings.automatic_platform_optimization + ) @cached_property - def brotli(self) -> AsyncBrotliWithStreamingResponse: - return AsyncBrotliWithStreamingResponse(self._settings.brotli) + def brotli(self) -> AsyncBrotliResourceWithStreamingResponse: + return AsyncBrotliResourceWithStreamingResponse(self._settings.brotli) @cached_property - def browser_cache_ttl(self) -> AsyncBrowserCacheTTLWithStreamingResponse: - return AsyncBrowserCacheTTLWithStreamingResponse(self._settings.browser_cache_ttl) + def browser_cache_ttl(self) -> AsyncBrowserCacheTTLResourceWithStreamingResponse: + return AsyncBrowserCacheTTLResourceWithStreamingResponse(self._settings.browser_cache_ttl) @cached_property - def browser_check(self) -> AsyncBrowserCheckWithStreamingResponse: - return AsyncBrowserCheckWithStreamingResponse(self._settings.browser_check) + def browser_check(self) -> AsyncBrowserCheckResourceWithStreamingResponse: + return AsyncBrowserCheckResourceWithStreamingResponse(self._settings.browser_check) @cached_property - def cache_level(self) -> AsyncCacheLevelWithStreamingResponse: - return AsyncCacheLevelWithStreamingResponse(self._settings.cache_level) + def cache_level(self) -> AsyncCacheLevelResourceWithStreamingResponse: + return AsyncCacheLevelResourceWithStreamingResponse(self._settings.cache_level) @cached_property - def challenge_ttl(self) -> AsyncChallengeTTLWithStreamingResponse: - return AsyncChallengeTTLWithStreamingResponse(self._settings.challenge_ttl) + def challenge_ttl(self) -> AsyncChallengeTTLResourceWithStreamingResponse: + return AsyncChallengeTTLResourceWithStreamingResponse(self._settings.challenge_ttl) @cached_property - def ciphers(self) -> AsyncCiphersWithStreamingResponse: - return AsyncCiphersWithStreamingResponse(self._settings.ciphers) + def ciphers(self) -> AsyncCiphersResourceWithStreamingResponse: + return AsyncCiphersResourceWithStreamingResponse(self._settings.ciphers) @cached_property - def development_mode(self) -> AsyncDevelopmentModeWithStreamingResponse: - return AsyncDevelopmentModeWithStreamingResponse(self._settings.development_mode) + def development_mode(self) -> AsyncDevelopmentModeResourceWithStreamingResponse: + return AsyncDevelopmentModeResourceWithStreamingResponse(self._settings.development_mode) @cached_property - def early_hints(self) -> AsyncEarlyHintsWithStreamingResponse: - return AsyncEarlyHintsWithStreamingResponse(self._settings.early_hints) + def early_hints(self) -> AsyncEarlyHintsResourceWithStreamingResponse: + return AsyncEarlyHintsResourceWithStreamingResponse(self._settings.early_hints) @cached_property - def email_obfuscation(self) -> AsyncEmailObfuscationWithStreamingResponse: - return AsyncEmailObfuscationWithStreamingResponse(self._settings.email_obfuscation) + def email_obfuscation(self) -> AsyncEmailObfuscationResourceWithStreamingResponse: + return AsyncEmailObfuscationResourceWithStreamingResponse(self._settings.email_obfuscation) @cached_property - def h2_prioritization(self) -> AsyncH2PrioritizationWithStreamingResponse: - return AsyncH2PrioritizationWithStreamingResponse(self._settings.h2_prioritization) + def h2_prioritization(self) -> AsyncH2PrioritizationResourceWithStreamingResponse: + return AsyncH2PrioritizationResourceWithStreamingResponse(self._settings.h2_prioritization) @cached_property - def hotlink_protection(self) -> AsyncHotlinkProtectionWithStreamingResponse: - return AsyncHotlinkProtectionWithStreamingResponse(self._settings.hotlink_protection) + def hotlink_protection(self) -> AsyncHotlinkProtectionResourceWithStreamingResponse: + return AsyncHotlinkProtectionResourceWithStreamingResponse(self._settings.hotlink_protection) @cached_property - def http2(self) -> AsyncHTTP2WithStreamingResponse: - return AsyncHTTP2WithStreamingResponse(self._settings.http2) + def http2(self) -> AsyncHTTP2ResourceWithStreamingResponse: + return AsyncHTTP2ResourceWithStreamingResponse(self._settings.http2) @cached_property - def http3(self) -> AsyncHTTP3WithStreamingResponse: - return AsyncHTTP3WithStreamingResponse(self._settings.http3) + def http3(self) -> AsyncHTTP3ResourceWithStreamingResponse: + return AsyncHTTP3ResourceWithStreamingResponse(self._settings.http3) @cached_property - def image_resizing(self) -> AsyncImageResizingWithStreamingResponse: - return AsyncImageResizingWithStreamingResponse(self._settings.image_resizing) + def image_resizing(self) -> AsyncImageResizingResourceWithStreamingResponse: + return AsyncImageResizingResourceWithStreamingResponse(self._settings.image_resizing) @cached_property - def ip_geolocation(self) -> AsyncIPGeolocationWithStreamingResponse: - return AsyncIPGeolocationWithStreamingResponse(self._settings.ip_geolocation) + def ip_geolocation(self) -> AsyncIPGeolocationResourceWithStreamingResponse: + return AsyncIPGeolocationResourceWithStreamingResponse(self._settings.ip_geolocation) @cached_property - def ipv6(self) -> AsyncIPV6WithStreamingResponse: - return AsyncIPV6WithStreamingResponse(self._settings.ipv6) + def ipv6(self) -> AsyncIPV6ResourceWithStreamingResponse: + return AsyncIPV6ResourceWithStreamingResponse(self._settings.ipv6) @cached_property - def min_tls_version(self) -> AsyncMinTLSVersionWithStreamingResponse: - return AsyncMinTLSVersionWithStreamingResponse(self._settings.min_tls_version) + def min_tls_version(self) -> AsyncMinTLSVersionResourceWithStreamingResponse: + return AsyncMinTLSVersionResourceWithStreamingResponse(self._settings.min_tls_version) @cached_property - def minify(self) -> AsyncMinifyWithStreamingResponse: - return AsyncMinifyWithStreamingResponse(self._settings.minify) + def minify(self) -> AsyncMinifyResourceWithStreamingResponse: + return AsyncMinifyResourceWithStreamingResponse(self._settings.minify) @cached_property - def mirage(self) -> AsyncMirageWithStreamingResponse: - return AsyncMirageWithStreamingResponse(self._settings.mirage) + def mirage(self) -> AsyncMirageResourceWithStreamingResponse: + return AsyncMirageResourceWithStreamingResponse(self._settings.mirage) @cached_property - def mobile_redirect(self) -> AsyncMobileRedirectWithStreamingResponse: - return AsyncMobileRedirectWithStreamingResponse(self._settings.mobile_redirect) + def mobile_redirect(self) -> AsyncMobileRedirectResourceWithStreamingResponse: + return AsyncMobileRedirectResourceWithStreamingResponse(self._settings.mobile_redirect) @cached_property - def nel(self) -> AsyncNELWithStreamingResponse: - return AsyncNELWithStreamingResponse(self._settings.nel) + def nel(self) -> AsyncNELResourceWithStreamingResponse: + return AsyncNELResourceWithStreamingResponse(self._settings.nel) @cached_property - def opportunistic_encryption(self) -> AsyncOpportunisticEncryptionWithStreamingResponse: - return AsyncOpportunisticEncryptionWithStreamingResponse(self._settings.opportunistic_encryption) + def opportunistic_encryption(self) -> AsyncOpportunisticEncryptionResourceWithStreamingResponse: + return AsyncOpportunisticEncryptionResourceWithStreamingResponse(self._settings.opportunistic_encryption) @cached_property - def opportunistic_onion(self) -> AsyncOpportunisticOnionWithStreamingResponse: - return AsyncOpportunisticOnionWithStreamingResponse(self._settings.opportunistic_onion) + def opportunistic_onion(self) -> AsyncOpportunisticOnionResourceWithStreamingResponse: + return AsyncOpportunisticOnionResourceWithStreamingResponse(self._settings.opportunistic_onion) @cached_property - def orange_to_orange(self) -> AsyncOrangeToOrangeWithStreamingResponse: - return AsyncOrangeToOrangeWithStreamingResponse(self._settings.orange_to_orange) + def orange_to_orange(self) -> AsyncOrangeToOrangeResourceWithStreamingResponse: + return AsyncOrangeToOrangeResourceWithStreamingResponse(self._settings.orange_to_orange) @cached_property - def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThruWithStreamingResponse: - return AsyncOriginErrorPagePassThruWithStreamingResponse(self._settings.origin_error_page_pass_thru) + def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThruResourceWithStreamingResponse: + return AsyncOriginErrorPagePassThruResourceWithStreamingResponse(self._settings.origin_error_page_pass_thru) @cached_property - def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionWithStreamingResponse: - return AsyncOriginMaxHTTPVersionWithStreamingResponse(self._settings.origin_max_http_version) + def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResourceWithStreamingResponse: + return AsyncOriginMaxHTTPVersionResourceWithStreamingResponse(self._settings.origin_max_http_version) @cached_property - def polish(self) -> AsyncPolishWithStreamingResponse: - return AsyncPolishWithStreamingResponse(self._settings.polish) + def polish(self) -> AsyncPolishResourceWithStreamingResponse: + return AsyncPolishResourceWithStreamingResponse(self._settings.polish) @cached_property - def prefetch_preload(self) -> AsyncPrefetchPreloadWithStreamingResponse: - return AsyncPrefetchPreloadWithStreamingResponse(self._settings.prefetch_preload) + def prefetch_preload(self) -> AsyncPrefetchPreloadResourceWithStreamingResponse: + return AsyncPrefetchPreloadResourceWithStreamingResponse(self._settings.prefetch_preload) @cached_property - def proxy_read_timeout(self) -> AsyncProxyReadTimeoutWithStreamingResponse: - return AsyncProxyReadTimeoutWithStreamingResponse(self._settings.proxy_read_timeout) + def proxy_read_timeout(self) -> AsyncProxyReadTimeoutResourceWithStreamingResponse: + return AsyncProxyReadTimeoutResourceWithStreamingResponse(self._settings.proxy_read_timeout) @cached_property - def pseudo_ipv4(self) -> AsyncPseudoIPV4WithStreamingResponse: - return AsyncPseudoIPV4WithStreamingResponse(self._settings.pseudo_ipv4) + def pseudo_ipv4(self) -> AsyncPseudoIPV4ResourceWithStreamingResponse: + return AsyncPseudoIPV4ResourceWithStreamingResponse(self._settings.pseudo_ipv4) @cached_property - def response_buffering(self) -> AsyncResponseBufferingWithStreamingResponse: - return AsyncResponseBufferingWithStreamingResponse(self._settings.response_buffering) + def response_buffering(self) -> AsyncResponseBufferingResourceWithStreamingResponse: + return AsyncResponseBufferingResourceWithStreamingResponse(self._settings.response_buffering) @cached_property - def rocket_loader(self) -> AsyncRocketLoaderWithStreamingResponse: - return AsyncRocketLoaderWithStreamingResponse(self._settings.rocket_loader) + def rocket_loader(self) -> AsyncRocketLoaderResourceWithStreamingResponse: + return AsyncRocketLoaderResourceWithStreamingResponse(self._settings.rocket_loader) @cached_property - def security_headers(self) -> AsyncSecurityHeadersWithStreamingResponse: - return AsyncSecurityHeadersWithStreamingResponse(self._settings.security_headers) + def security_headers(self) -> AsyncSecurityHeadersResourceWithStreamingResponse: + return AsyncSecurityHeadersResourceWithStreamingResponse(self._settings.security_headers) @cached_property - def security_level(self) -> AsyncSecurityLevelWithStreamingResponse: - return AsyncSecurityLevelWithStreamingResponse(self._settings.security_level) + def security_level(self) -> AsyncSecurityLevelResourceWithStreamingResponse: + return AsyncSecurityLevelResourceWithStreamingResponse(self._settings.security_level) @cached_property - def server_side_excludes(self) -> AsyncServerSideExcludesWithStreamingResponse: - return AsyncServerSideExcludesWithStreamingResponse(self._settings.server_side_excludes) + def server_side_excludes(self) -> AsyncServerSideExcludesResourceWithStreamingResponse: + return AsyncServerSideExcludesResourceWithStreamingResponse(self._settings.server_side_excludes) @cached_property - def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCacheWithStreamingResponse: - return AsyncSortQueryStringForCacheWithStreamingResponse(self._settings.sort_query_string_for_cache) + def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCacheResourceWithStreamingResponse: + return AsyncSortQueryStringForCacheResourceWithStreamingResponse(self._settings.sort_query_string_for_cache) @cached_property - def ssl(self) -> AsyncSSLWithStreamingResponse: - return AsyncSSLWithStreamingResponse(self._settings.ssl) + def ssl(self) -> AsyncSSLResourceWithStreamingResponse: + return AsyncSSLResourceWithStreamingResponse(self._settings.ssl) @cached_property - def ssl_recommender(self) -> AsyncSSLRecommenderWithStreamingResponse: - return AsyncSSLRecommenderWithStreamingResponse(self._settings.ssl_recommender) + def ssl_recommender(self) -> AsyncSSLRecommenderResourceWithStreamingResponse: + return AsyncSSLRecommenderResourceWithStreamingResponse(self._settings.ssl_recommender) @cached_property - def tls_1_3(self) -> AsyncTLS1_3WithStreamingResponse: - return AsyncTLS1_3WithStreamingResponse(self._settings.tls_1_3) + def tls_1_3(self) -> AsyncTLS1_3ResourceWithStreamingResponse: + return AsyncTLS1_3ResourceWithStreamingResponse(self._settings.tls_1_3) @cached_property - def tls_client_auth(self) -> AsyncTLSClientAuthWithStreamingResponse: - return AsyncTLSClientAuthWithStreamingResponse(self._settings.tls_client_auth) + def tls_client_auth(self) -> AsyncTLSClientAuthResourceWithStreamingResponse: + return AsyncTLSClientAuthResourceWithStreamingResponse(self._settings.tls_client_auth) @cached_property - def true_client_ip_header(self) -> AsyncTrueClientIPHeaderWithStreamingResponse: - return AsyncTrueClientIPHeaderWithStreamingResponse(self._settings.true_client_ip_header) + def true_client_ip_header(self) -> AsyncTrueClientIPHeaderResourceWithStreamingResponse: + return AsyncTrueClientIPHeaderResourceWithStreamingResponse(self._settings.true_client_ip_header) @cached_property - def waf(self) -> AsyncWAFWithStreamingResponse: - return AsyncWAFWithStreamingResponse(self._settings.waf) + def waf(self) -> AsyncWAFResourceWithStreamingResponse: + return AsyncWAFResourceWithStreamingResponse(self._settings.waf) @cached_property - def webp(self) -> AsyncWebPWithStreamingResponse: - return AsyncWebPWithStreamingResponse(self._settings.webp) + def webp(self) -> AsyncWebPResourceWithStreamingResponse: + return AsyncWebPResourceWithStreamingResponse(self._settings.webp) @cached_property - def websocket(self) -> AsyncWebsocketWithStreamingResponse: - return AsyncWebsocketWithStreamingResponse(self._settings.websocket) + def websocket(self) -> AsyncWebsocketResourceWithStreamingResponse: + return AsyncWebsocketResourceWithStreamingResponse(self._settings.websocket) @cached_property - def font_settings(self) -> AsyncFontSettingsWithStreamingResponse: - return AsyncFontSettingsWithStreamingResponse(self._settings.font_settings) + def font_settings(self) -> AsyncFontSettingsResourceWithStreamingResponse: + return AsyncFontSettingsResourceWithStreamingResponse(self._settings.font_settings) diff --git a/src/cloudflare/resources/zones/settings/sort_query_string_for_cache.py b/src/cloudflare/resources/zones/settings/sort_query_string_for_cache.py index cfb80498265..8ac6a3306fa 100644 --- a/src/cloudflare/resources/zones/settings/sort_query_string_for_cache.py +++ b/src/cloudflare/resources/zones/settings/sort_query_string_for_cache.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingSortQueryStringForCache, sort_query_string_for_cache_edit_params +from ....types.zones.settings import sort_query_string_for_cache_edit_params +from ....types.zones.settings.sort_query_string_for_cache import SortQueryStringForCache -__all__ = ["SortQueryStringForCache", "AsyncSortQueryStringForCache"] +__all__ = ["SortQueryStringForCacheResource", "AsyncSortQueryStringForCacheResource"] -class SortQueryStringForCache(SyncAPIResource): +class SortQueryStringForCacheResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SortQueryStringForCacheWithRawResponse: - return SortQueryStringForCacheWithRawResponse(self) + def with_raw_response(self) -> SortQueryStringForCacheResourceWithRawResponse: + return SortQueryStringForCacheResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SortQueryStringForCacheWithStreamingResponse: - return SortQueryStringForCacheWithStreamingResponse(self) + def with_streaming_response(self) -> SortQueryStringForCacheResourceWithStreamingResponse: + return SortQueryStringForCacheResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSortQueryStringForCache]: + ) -> Optional[SortQueryStringForCache]: """ Cloudflare will treat files with the same query strings as the same file in cache, regardless of the order of the query strings. This is limited to @@ -80,11 +81,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingSortQueryStringForCache]], ResultWrapper[ZoneSettingSortQueryStringForCache] + post_parser=ResultWrapper[Optional[SortQueryStringForCache]]._unwrapper, ), + cast_to=cast(Type[Optional[SortQueryStringForCache]], ResultWrapper[SortQueryStringForCache]), ) def get( @@ -97,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSortQueryStringForCache]: + ) -> Optional[SortQueryStringForCache]: """ Cloudflare will treat files with the same query strings as the same file in cache, regardless of the order of the query strings. This is limited to @@ -123,22 +122,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingSortQueryStringForCache]], ResultWrapper[ZoneSettingSortQueryStringForCache] + post_parser=ResultWrapper[Optional[SortQueryStringForCache]]._unwrapper, ), + cast_to=cast(Type[Optional[SortQueryStringForCache]], ResultWrapper[SortQueryStringForCache]), ) -class AsyncSortQueryStringForCache(AsyncAPIResource): +class AsyncSortQueryStringForCacheResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSortQueryStringForCacheWithRawResponse: - return AsyncSortQueryStringForCacheWithRawResponse(self) + def with_raw_response(self) -> AsyncSortQueryStringForCacheResourceWithRawResponse: + return AsyncSortQueryStringForCacheResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSortQueryStringForCacheWithStreamingResponse: - return AsyncSortQueryStringForCacheWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSortQueryStringForCacheResourceWithStreamingResponse: + return AsyncSortQueryStringForCacheResourceWithStreamingResponse(self) async def edit( self, @@ -151,7 +148,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSortQueryStringForCache]: + ) -> Optional[SortQueryStringForCache]: """ Cloudflare will treat files with the same query strings as the same file in cache, regardless of the order of the query strings. This is limited to @@ -182,11 +179,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingSortQueryStringForCache]], ResultWrapper[ZoneSettingSortQueryStringForCache] + post_parser=ResultWrapper[Optional[SortQueryStringForCache]]._unwrapper, ), + cast_to=cast(Type[Optional[SortQueryStringForCache]], ResultWrapper[SortQueryStringForCache]), ) async def get( @@ -199,7 +194,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSortQueryStringForCache]: + ) -> Optional[SortQueryStringForCache]: """ Cloudflare will treat files with the same query strings as the same file in cache, regardless of the order of the query strings. This is limited to @@ -225,16 +220,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[ZoneSettingSortQueryStringForCache]], ResultWrapper[ZoneSettingSortQueryStringForCache] + post_parser=ResultWrapper[Optional[SortQueryStringForCache]]._unwrapper, ), + cast_to=cast(Type[Optional[SortQueryStringForCache]], ResultWrapper[SortQueryStringForCache]), ) -class SortQueryStringForCacheWithRawResponse: - def __init__(self, sort_query_string_for_cache: SortQueryStringForCache) -> None: +class SortQueryStringForCacheResourceWithRawResponse: + def __init__(self, sort_query_string_for_cache: SortQueryStringForCacheResource) -> None: self._sort_query_string_for_cache = sort_query_string_for_cache self.edit = to_raw_response_wrapper( @@ -245,8 +238,8 @@ def __init__(self, sort_query_string_for_cache: SortQueryStringForCache) -> None ) -class AsyncSortQueryStringForCacheWithRawResponse: - def __init__(self, sort_query_string_for_cache: AsyncSortQueryStringForCache) -> None: +class AsyncSortQueryStringForCacheResourceWithRawResponse: + def __init__(self, sort_query_string_for_cache: AsyncSortQueryStringForCacheResource) -> None: self._sort_query_string_for_cache = sort_query_string_for_cache self.edit = async_to_raw_response_wrapper( @@ -257,8 +250,8 @@ def __init__(self, sort_query_string_for_cache: AsyncSortQueryStringForCache) -> ) -class SortQueryStringForCacheWithStreamingResponse: - def __init__(self, sort_query_string_for_cache: SortQueryStringForCache) -> None: +class SortQueryStringForCacheResourceWithStreamingResponse: + def __init__(self, sort_query_string_for_cache: SortQueryStringForCacheResource) -> None: self._sort_query_string_for_cache = sort_query_string_for_cache self.edit = to_streamed_response_wrapper( @@ -269,8 +262,8 @@ def __init__(self, sort_query_string_for_cache: SortQueryStringForCache) -> None ) -class AsyncSortQueryStringForCacheWithStreamingResponse: - def __init__(self, sort_query_string_for_cache: AsyncSortQueryStringForCache) -> None: +class AsyncSortQueryStringForCacheResourceWithStreamingResponse: + def __init__(self, sort_query_string_for_cache: AsyncSortQueryStringForCacheResource) -> None: self._sort_query_string_for_cache = sort_query_string_for_cache self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/ssl.py b/src/cloudflare/resources/zones/settings/ssl.py index 56c95e74fea..c04dd0ce79a 100644 --- a/src/cloudflare/resources/zones/settings/ssl.py +++ b/src/cloudflare/resources/zones/settings/ssl.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingSSL, ssl_edit_params +from ....types.zones.settings import ssl_edit_params +from ....types.zones.settings.ssl import SSL -__all__ = ["SSL", "AsyncSSL"] +__all__ = ["SSLResource", "AsyncSSLResource"] -class SSL(SyncAPIResource): +class SSLResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SSLWithRawResponse: - return SSLWithRawResponse(self) + def with_raw_response(self) -> SSLResourceWithRawResponse: + return SSLResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SSLWithStreamingResponse: - return SSLWithStreamingResponse(self) + def with_streaming_response(self) -> SSLResourceWithStreamingResponse: + return SSLResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSSL]: + ) -> Optional[SSL]: """ SSL encrypts your visitor's connection and safeguards credit card numbers and other personal data to and from your website. SSL can take up to 5 minutes to @@ -91,9 +92,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SSL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSSL]], ResultWrapper[ZoneSettingSSL]), + cast_to=cast(Type[Optional[SSL]], ResultWrapper[SSL]), ) def get( @@ -106,7 +107,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSSL]: + ) -> Optional[SSL]: """ SSL encrypts your visitor's connection and safeguards credit card numbers and other personal data to and from your website. SSL can take up to 5 minutes to @@ -145,20 +146,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SSL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSSL]], ResultWrapper[ZoneSettingSSL]), + cast_to=cast(Type[Optional[SSL]], ResultWrapper[SSL]), ) -class AsyncSSL(AsyncAPIResource): +class AsyncSSLResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSSLWithRawResponse: - return AsyncSSLWithRawResponse(self) + def with_raw_response(self) -> AsyncSSLResourceWithRawResponse: + return AsyncSSLResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSSLWithStreamingResponse: - return AsyncSSLWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSSLResourceWithStreamingResponse: + return AsyncSSLResourceWithStreamingResponse(self) async def edit( self, @@ -171,7 +172,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSSL]: + ) -> Optional[SSL]: """ SSL encrypts your visitor's connection and safeguards credit card numbers and other personal data to and from your website. SSL can take up to 5 minutes to @@ -213,9 +214,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SSL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSSL]], ResultWrapper[ZoneSettingSSL]), + cast_to=cast(Type[Optional[SSL]], ResultWrapper[SSL]), ) async def get( @@ -228,7 +229,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSSL]: + ) -> Optional[SSL]: """ SSL encrypts your visitor's connection and safeguards credit card numbers and other personal data to and from your website. SSL can take up to 5 minutes to @@ -267,14 +268,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SSL]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSSL]], ResultWrapper[ZoneSettingSSL]), + cast_to=cast(Type[Optional[SSL]], ResultWrapper[SSL]), ) -class SSLWithRawResponse: - def __init__(self, ssl: SSL) -> None: +class SSLResourceWithRawResponse: + def __init__(self, ssl: SSLResource) -> None: self._ssl = ssl self.edit = to_raw_response_wrapper( @@ -285,8 +286,8 @@ def __init__(self, ssl: SSL) -> None: ) -class AsyncSSLWithRawResponse: - def __init__(self, ssl: AsyncSSL) -> None: +class AsyncSSLResourceWithRawResponse: + def __init__(self, ssl: AsyncSSLResource) -> None: self._ssl = ssl self.edit = async_to_raw_response_wrapper( @@ -297,8 +298,8 @@ def __init__(self, ssl: AsyncSSL) -> None: ) -class SSLWithStreamingResponse: - def __init__(self, ssl: SSL) -> None: +class SSLResourceWithStreamingResponse: + def __init__(self, ssl: SSLResource) -> None: self._ssl = ssl self.edit = to_streamed_response_wrapper( @@ -309,8 +310,8 @@ def __init__(self, ssl: SSL) -> None: ) -class AsyncSSLWithStreamingResponse: - def __init__(self, ssl: AsyncSSL) -> None: +class AsyncSSLResourceWithStreamingResponse: + def __init__(self, ssl: AsyncSSLResource) -> None: self._ssl = ssl self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/ssl_recommender.py b/src/cloudflare/resources/zones/settings/ssl_recommender.py index 8ec9470c556..816dd22ade6 100644 --- a/src/cloudflare/resources/zones/settings/ssl_recommender.py +++ b/src/cloudflare/resources/zones/settings/ssl_recommender.py @@ -23,36 +23,34 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ( - ZoneSettingSSLRecommender, - ZoneSettingSSLRecommenderParam, - ssl_recommender_edit_params, -) +from ....types.zones.settings import SSLRecommender, ssl_recommender_edit_params +from ....types.zones.settings.ssl_recommender import SSLRecommender +from ....types.zones.settings.ssl_recommender_param import SSLRecommenderParam -__all__ = ["SSLRecommender", "AsyncSSLRecommender"] +__all__ = ["SSLRecommenderResource", "AsyncSSLRecommenderResource"] -class SSLRecommender(SyncAPIResource): +class SSLRecommenderResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SSLRecommenderWithRawResponse: - return SSLRecommenderWithRawResponse(self) + def with_raw_response(self) -> SSLRecommenderResourceWithRawResponse: + return SSLRecommenderResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SSLRecommenderWithStreamingResponse: - return SSLRecommenderWithStreamingResponse(self) + def with_streaming_response(self) -> SSLRecommenderResourceWithStreamingResponse: + return SSLRecommenderResourceWithStreamingResponse(self) def edit( self, *, zone_id: str, - value: ZoneSettingSSLRecommenderParam, + value: SSLRecommenderParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingSSLRecommender]: + ) -> Optional[SSLRecommender]: """ Enrollment in the SSL/TLS Recommender service which tries to detect and recommend (by sending periodic emails) the most secure SSL/TLS setting your @@ -83,9 +81,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SSLRecommender]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSSLRecommender]], ResultWrapper[ZoneSettingSSLRecommender]), + cast_to=cast(Type[Optional[SSLRecommender]], ResultWrapper[SSLRecommender]), ) def get( @@ -98,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSSLRecommender]: + ) -> Optional[SSLRecommender]: """ Enrollment in the SSL/TLS Recommender service which tries to detect and recommend (by sending periodic emails) the most secure SSL/TLS setting your @@ -124,33 +122,33 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SSLRecommender]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSSLRecommender]], ResultWrapper[ZoneSettingSSLRecommender]), + cast_to=cast(Type[Optional[SSLRecommender]], ResultWrapper[SSLRecommender]), ) -class AsyncSSLRecommender(AsyncAPIResource): +class AsyncSSLRecommenderResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSSLRecommenderWithRawResponse: - return AsyncSSLRecommenderWithRawResponse(self) + def with_raw_response(self) -> AsyncSSLRecommenderResourceWithRawResponse: + return AsyncSSLRecommenderResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSSLRecommenderWithStreamingResponse: - return AsyncSSLRecommenderWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSSLRecommenderResourceWithStreamingResponse: + return AsyncSSLRecommenderResourceWithStreamingResponse(self) async def edit( self, *, zone_id: str, - value: ZoneSettingSSLRecommenderParam, + value: SSLRecommenderParam, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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[ZoneSettingSSLRecommender]: + ) -> Optional[SSLRecommender]: """ Enrollment in the SSL/TLS Recommender service which tries to detect and recommend (by sending periodic emails) the most secure SSL/TLS setting your @@ -181,9 +179,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SSLRecommender]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSSLRecommender]], ResultWrapper[ZoneSettingSSLRecommender]), + cast_to=cast(Type[Optional[SSLRecommender]], ResultWrapper[SSLRecommender]), ) async def get( @@ -196,7 +194,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingSSLRecommender]: + ) -> Optional[SSLRecommender]: """ Enrollment in the SSL/TLS Recommender service which tries to detect and recommend (by sending periodic emails) the most secure SSL/TLS setting your @@ -222,14 +220,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[SSLRecommender]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingSSLRecommender]], ResultWrapper[ZoneSettingSSLRecommender]), + cast_to=cast(Type[Optional[SSLRecommender]], ResultWrapper[SSLRecommender]), ) -class SSLRecommenderWithRawResponse: - def __init__(self, ssl_recommender: SSLRecommender) -> None: +class SSLRecommenderResourceWithRawResponse: + def __init__(self, ssl_recommender: SSLRecommenderResource) -> None: self._ssl_recommender = ssl_recommender self.edit = to_raw_response_wrapper( @@ -240,8 +238,8 @@ def __init__(self, ssl_recommender: SSLRecommender) -> None: ) -class AsyncSSLRecommenderWithRawResponse: - def __init__(self, ssl_recommender: AsyncSSLRecommender) -> None: +class AsyncSSLRecommenderResourceWithRawResponse: + def __init__(self, ssl_recommender: AsyncSSLRecommenderResource) -> None: self._ssl_recommender = ssl_recommender self.edit = async_to_raw_response_wrapper( @@ -252,8 +250,8 @@ def __init__(self, ssl_recommender: AsyncSSLRecommender) -> None: ) -class SSLRecommenderWithStreamingResponse: - def __init__(self, ssl_recommender: SSLRecommender) -> None: +class SSLRecommenderResourceWithStreamingResponse: + def __init__(self, ssl_recommender: SSLRecommenderResource) -> None: self._ssl_recommender = ssl_recommender self.edit = to_streamed_response_wrapper( @@ -264,8 +262,8 @@ def __init__(self, ssl_recommender: SSLRecommender) -> None: ) -class AsyncSSLRecommenderWithStreamingResponse: - def __init__(self, ssl_recommender: AsyncSSLRecommender) -> None: +class AsyncSSLRecommenderResourceWithStreamingResponse: + def __init__(self, ssl_recommender: AsyncSSLRecommenderResource) -> None: self._ssl_recommender = ssl_recommender self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/tls_1_3.py b/src/cloudflare/resources/zones/settings/tls_1_3.py index c928cb1581a..77eb21c1c48 100644 --- a/src/cloudflare/resources/zones/settings/tls_1_3.py +++ b/src/cloudflare/resources/zones/settings/tls_1_3.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingTLS1_3, tls_1_3_edit_params +from ....types.zones.settings import tls_1_3_edit_params +from ....types.zones.settings.tls_1_3 import TLS1_3 -__all__ = ["TLS1_3", "AsyncTLS1_3"] +__all__ = ["TLS1_3Resource", "AsyncTLS1_3Resource"] -class TLS1_3(SyncAPIResource): +class TLS1_3Resource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TLS1_3WithRawResponse: - return TLS1_3WithRawResponse(self) + def with_raw_response(self) -> TLS1_3ResourceWithRawResponse: + return TLS1_3ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TLS1_3WithStreamingResponse: - return TLS1_3WithStreamingResponse(self) + def with_streaming_response(self) -> TLS1_3ResourceWithStreamingResponse: + return TLS1_3ResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTLS1_3]: + ) -> Optional[TLS1_3]: """ Changes TLS 1.3 setting. @@ -77,9 +78,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLS1_3]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTLS1_3]], ResultWrapper[ZoneSettingTLS1_3]), + cast_to=cast(Type[Optional[TLS1_3]], ResultWrapper[TLS1_3]), ) def get( @@ -92,7 +93,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTLS1_3]: + ) -> Optional[TLS1_3]: """ Gets TLS 1.3 setting enabled for a zone. @@ -116,20 +117,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLS1_3]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTLS1_3]], ResultWrapper[ZoneSettingTLS1_3]), + cast_to=cast(Type[Optional[TLS1_3]], ResultWrapper[TLS1_3]), ) -class AsyncTLS1_3(AsyncAPIResource): +class AsyncTLS1_3Resource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTLS1_3WithRawResponse: - return AsyncTLS1_3WithRawResponse(self) + def with_raw_response(self) -> AsyncTLS1_3ResourceWithRawResponse: + return AsyncTLS1_3ResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTLS1_3WithStreamingResponse: - return AsyncTLS1_3WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTLS1_3ResourceWithStreamingResponse: + return AsyncTLS1_3ResourceWithStreamingResponse(self) async def edit( self, @@ -142,7 +143,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTLS1_3]: + ) -> Optional[TLS1_3]: """ Changes TLS 1.3 setting. @@ -170,9 +171,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLS1_3]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTLS1_3]], ResultWrapper[ZoneSettingTLS1_3]), + cast_to=cast(Type[Optional[TLS1_3]], ResultWrapper[TLS1_3]), ) async def get( @@ -185,7 +186,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTLS1_3]: + ) -> Optional[TLS1_3]: """ Gets TLS 1.3 setting enabled for a zone. @@ -209,14 +210,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLS1_3]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTLS1_3]], ResultWrapper[ZoneSettingTLS1_3]), + cast_to=cast(Type[Optional[TLS1_3]], ResultWrapper[TLS1_3]), ) -class TLS1_3WithRawResponse: - def __init__(self, tls_1_3: TLS1_3) -> None: +class TLS1_3ResourceWithRawResponse: + def __init__(self, tls_1_3: TLS1_3Resource) -> None: self._tls_1_3 = tls_1_3 self.edit = to_raw_response_wrapper( @@ -227,8 +228,8 @@ def __init__(self, tls_1_3: TLS1_3) -> None: ) -class AsyncTLS1_3WithRawResponse: - def __init__(self, tls_1_3: AsyncTLS1_3) -> None: +class AsyncTLS1_3ResourceWithRawResponse: + def __init__(self, tls_1_3: AsyncTLS1_3Resource) -> None: self._tls_1_3 = tls_1_3 self.edit = async_to_raw_response_wrapper( @@ -239,8 +240,8 @@ def __init__(self, tls_1_3: AsyncTLS1_3) -> None: ) -class TLS1_3WithStreamingResponse: - def __init__(self, tls_1_3: TLS1_3) -> None: +class TLS1_3ResourceWithStreamingResponse: + def __init__(self, tls_1_3: TLS1_3Resource) -> None: self._tls_1_3 = tls_1_3 self.edit = to_streamed_response_wrapper( @@ -251,8 +252,8 @@ def __init__(self, tls_1_3: TLS1_3) -> None: ) -class AsyncTLS1_3WithStreamingResponse: - def __init__(self, tls_1_3: AsyncTLS1_3) -> None: +class AsyncTLS1_3ResourceWithStreamingResponse: + def __init__(self, tls_1_3: AsyncTLS1_3Resource) -> None: self._tls_1_3 = tls_1_3 self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/tls_client_auth.py b/src/cloudflare/resources/zones/settings/tls_client_auth.py index e54e66bebe8..f1f2646104e 100644 --- a/src/cloudflare/resources/zones/settings/tls_client_auth.py +++ b/src/cloudflare/resources/zones/settings/tls_client_auth.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingTLSClientAuth, tls_client_auth_edit_params +from ....types.zones.settings import tls_client_auth_edit_params +from ....types.zones.settings.tls_client_auth import TLSClientAuth -__all__ = ["TLSClientAuth", "AsyncTLSClientAuth"] +__all__ = ["TLSClientAuthResource", "AsyncTLSClientAuthResource"] -class TLSClientAuth(SyncAPIResource): +class TLSClientAuthResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TLSClientAuthWithRawResponse: - return TLSClientAuthWithRawResponse(self) + def with_raw_response(self) -> TLSClientAuthResourceWithRawResponse: + return TLSClientAuthResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TLSClientAuthWithStreamingResponse: - return TLSClientAuthWithStreamingResponse(self) + def with_streaming_response(self) -> TLSClientAuthResourceWithStreamingResponse: + return TLSClientAuthResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTLSClientAuth]: + ) -> Optional[TLSClientAuth]: """ TLS Client Auth requires Cloudflare to connect to your origin server using a client certificate (Enterprise Only). @@ -77,9 +78,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLSClientAuth]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTLSClientAuth]], ResultWrapper[ZoneSettingTLSClientAuth]), + cast_to=cast(Type[Optional[TLSClientAuth]], ResultWrapper[TLSClientAuth]), ) def get( @@ -92,7 +93,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTLSClientAuth]: + ) -> Optional[TLSClientAuth]: """ TLS Client Auth requires Cloudflare to connect to your origin server using a client certificate (Enterprise Only). @@ -117,20 +118,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLSClientAuth]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTLSClientAuth]], ResultWrapper[ZoneSettingTLSClientAuth]), + cast_to=cast(Type[Optional[TLSClientAuth]], ResultWrapper[TLSClientAuth]), ) -class AsyncTLSClientAuth(AsyncAPIResource): +class AsyncTLSClientAuthResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTLSClientAuthWithRawResponse: - return AsyncTLSClientAuthWithRawResponse(self) + def with_raw_response(self) -> AsyncTLSClientAuthResourceWithRawResponse: + return AsyncTLSClientAuthResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTLSClientAuthWithStreamingResponse: - return AsyncTLSClientAuthWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTLSClientAuthResourceWithStreamingResponse: + return AsyncTLSClientAuthResourceWithStreamingResponse(self) async def edit( self, @@ -143,7 +144,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTLSClientAuth]: + ) -> Optional[TLSClientAuth]: """ TLS Client Auth requires Cloudflare to connect to your origin server using a client certificate (Enterprise Only). @@ -171,9 +172,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLSClientAuth]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTLSClientAuth]], ResultWrapper[ZoneSettingTLSClientAuth]), + cast_to=cast(Type[Optional[TLSClientAuth]], ResultWrapper[TLSClientAuth]), ) async def get( @@ -186,7 +187,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTLSClientAuth]: + ) -> Optional[TLSClientAuth]: """ TLS Client Auth requires Cloudflare to connect to your origin server using a client certificate (Enterprise Only). @@ -211,14 +212,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TLSClientAuth]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTLSClientAuth]], ResultWrapper[ZoneSettingTLSClientAuth]), + cast_to=cast(Type[Optional[TLSClientAuth]], ResultWrapper[TLSClientAuth]), ) -class TLSClientAuthWithRawResponse: - def __init__(self, tls_client_auth: TLSClientAuth) -> None: +class TLSClientAuthResourceWithRawResponse: + def __init__(self, tls_client_auth: TLSClientAuthResource) -> None: self._tls_client_auth = tls_client_auth self.edit = to_raw_response_wrapper( @@ -229,8 +230,8 @@ def __init__(self, tls_client_auth: TLSClientAuth) -> None: ) -class AsyncTLSClientAuthWithRawResponse: - def __init__(self, tls_client_auth: AsyncTLSClientAuth) -> None: +class AsyncTLSClientAuthResourceWithRawResponse: + def __init__(self, tls_client_auth: AsyncTLSClientAuthResource) -> None: self._tls_client_auth = tls_client_auth self.edit = async_to_raw_response_wrapper( @@ -241,8 +242,8 @@ def __init__(self, tls_client_auth: AsyncTLSClientAuth) -> None: ) -class TLSClientAuthWithStreamingResponse: - def __init__(self, tls_client_auth: TLSClientAuth) -> None: +class TLSClientAuthResourceWithStreamingResponse: + def __init__(self, tls_client_auth: TLSClientAuthResource) -> None: self._tls_client_auth = tls_client_auth self.edit = to_streamed_response_wrapper( @@ -253,8 +254,8 @@ def __init__(self, tls_client_auth: TLSClientAuth) -> None: ) -class AsyncTLSClientAuthWithStreamingResponse: - def __init__(self, tls_client_auth: AsyncTLSClientAuth) -> None: +class AsyncTLSClientAuthResourceWithStreamingResponse: + def __init__(self, tls_client_auth: AsyncTLSClientAuthResource) -> None: self._tls_client_auth = tls_client_auth self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/true_client_ip_header.py b/src/cloudflare/resources/zones/settings/true_client_ip_header.py index 20b9b22963d..ebe9635793b 100644 --- a/src/cloudflare/resources/zones/settings/true_client_ip_header.py +++ b/src/cloudflare/resources/zones/settings/true_client_ip_header.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingTrueClientIPHeader, true_client_ip_header_edit_params +from ....types.zones.settings import true_client_ip_header_edit_params +from ....types.zones.settings.true_client_ip_header import TrueClientIPHeader -__all__ = ["TrueClientIPHeader", "AsyncTrueClientIPHeader"] +__all__ = ["TrueClientIPHeaderResource", "AsyncTrueClientIPHeaderResource"] -class TrueClientIPHeader(SyncAPIResource): +class TrueClientIPHeaderResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TrueClientIPHeaderWithRawResponse: - return TrueClientIPHeaderWithRawResponse(self) + def with_raw_response(self) -> TrueClientIPHeaderResourceWithRawResponse: + return TrueClientIPHeaderResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TrueClientIPHeaderWithStreamingResponse: - return TrueClientIPHeaderWithStreamingResponse(self) + def with_streaming_response(self) -> TrueClientIPHeaderResourceWithStreamingResponse: + return TrueClientIPHeaderResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTrueClientIPHeader]: + ) -> Optional[TrueClientIPHeader]: """ Allows customer to continue to use True Client IP (Akamai feature) in the headers we send to the origin. This is limited to Enterprise Zones. @@ -77,9 +78,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TrueClientIPHeader]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTrueClientIPHeader]], ResultWrapper[ZoneSettingTrueClientIPHeader]), + cast_to=cast(Type[Optional[TrueClientIPHeader]], ResultWrapper[TrueClientIPHeader]), ) def get( @@ -92,7 +93,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTrueClientIPHeader]: + ) -> Optional[TrueClientIPHeader]: """ Allows customer to continue to use True Client IP (Akamai feature) in the headers we send to the origin. This is limited to Enterprise Zones. @@ -117,20 +118,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TrueClientIPHeader]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTrueClientIPHeader]], ResultWrapper[ZoneSettingTrueClientIPHeader]), + cast_to=cast(Type[Optional[TrueClientIPHeader]], ResultWrapper[TrueClientIPHeader]), ) -class AsyncTrueClientIPHeader(AsyncAPIResource): +class AsyncTrueClientIPHeaderResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTrueClientIPHeaderWithRawResponse: - return AsyncTrueClientIPHeaderWithRawResponse(self) + def with_raw_response(self) -> AsyncTrueClientIPHeaderResourceWithRawResponse: + return AsyncTrueClientIPHeaderResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTrueClientIPHeaderWithStreamingResponse: - return AsyncTrueClientIPHeaderWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTrueClientIPHeaderResourceWithStreamingResponse: + return AsyncTrueClientIPHeaderResourceWithStreamingResponse(self) async def edit( self, @@ -143,7 +144,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTrueClientIPHeader]: + ) -> Optional[TrueClientIPHeader]: """ Allows customer to continue to use True Client IP (Akamai feature) in the headers we send to the origin. This is limited to Enterprise Zones. @@ -173,9 +174,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TrueClientIPHeader]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTrueClientIPHeader]], ResultWrapper[ZoneSettingTrueClientIPHeader]), + cast_to=cast(Type[Optional[TrueClientIPHeader]], ResultWrapper[TrueClientIPHeader]), ) async def get( @@ -188,7 +189,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingTrueClientIPHeader]: + ) -> Optional[TrueClientIPHeader]: """ Allows customer to continue to use True Client IP (Akamai feature) in the headers we send to the origin. This is limited to Enterprise Zones. @@ -213,14 +214,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[TrueClientIPHeader]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingTrueClientIPHeader]], ResultWrapper[ZoneSettingTrueClientIPHeader]), + cast_to=cast(Type[Optional[TrueClientIPHeader]], ResultWrapper[TrueClientIPHeader]), ) -class TrueClientIPHeaderWithRawResponse: - def __init__(self, true_client_ip_header: TrueClientIPHeader) -> None: +class TrueClientIPHeaderResourceWithRawResponse: + def __init__(self, true_client_ip_header: TrueClientIPHeaderResource) -> None: self._true_client_ip_header = true_client_ip_header self.edit = to_raw_response_wrapper( @@ -231,8 +232,8 @@ def __init__(self, true_client_ip_header: TrueClientIPHeader) -> None: ) -class AsyncTrueClientIPHeaderWithRawResponse: - def __init__(self, true_client_ip_header: AsyncTrueClientIPHeader) -> None: +class AsyncTrueClientIPHeaderResourceWithRawResponse: + def __init__(self, true_client_ip_header: AsyncTrueClientIPHeaderResource) -> None: self._true_client_ip_header = true_client_ip_header self.edit = async_to_raw_response_wrapper( @@ -243,8 +244,8 @@ def __init__(self, true_client_ip_header: AsyncTrueClientIPHeader) -> None: ) -class TrueClientIPHeaderWithStreamingResponse: - def __init__(self, true_client_ip_header: TrueClientIPHeader) -> None: +class TrueClientIPHeaderResourceWithStreamingResponse: + def __init__(self, true_client_ip_header: TrueClientIPHeaderResource) -> None: self._true_client_ip_header = true_client_ip_header self.edit = to_streamed_response_wrapper( @@ -255,8 +256,8 @@ def __init__(self, true_client_ip_header: TrueClientIPHeader) -> None: ) -class AsyncTrueClientIPHeaderWithStreamingResponse: - def __init__(self, true_client_ip_header: AsyncTrueClientIPHeader) -> None: +class AsyncTrueClientIPHeaderResourceWithStreamingResponse: + def __init__(self, true_client_ip_header: AsyncTrueClientIPHeaderResource) -> None: self._true_client_ip_header = true_client_ip_header self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/waf.py b/src/cloudflare/resources/zones/settings/waf.py index 542ffe9f82e..42ce04861e0 100644 --- a/src/cloudflare/resources/zones/settings/waf.py +++ b/src/cloudflare/resources/zones/settings/waf.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingWAF, waf_edit_params +from ....types.zones.settings import waf_edit_params +from ....types.zones.settings.waf import WAF -__all__ = ["WAF", "AsyncWAF"] +__all__ = ["WAFResource", "AsyncWAFResource"] -class WAF(SyncAPIResource): +class WAFResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WAFWithRawResponse: - return WAFWithRawResponse(self) + def with_raw_response(self) -> WAFResourceWithRawResponse: + return WAFResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WAFWithStreamingResponse: - return WAFWithStreamingResponse(self) + def with_streaming_response(self) -> WAFResourceWithStreamingResponse: + return WAFResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWAF]: + ) -> Optional[WAF]: """The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -86,9 +87,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WAF]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWAF]], ResultWrapper[ZoneSettingWAF]), + cast_to=cast(Type[Optional[WAF]], ResultWrapper[WAF]), ) def get( @@ -101,7 +102,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWAF]: + ) -> Optional[WAF]: """The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -135,20 +136,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WAF]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWAF]], ResultWrapper[ZoneSettingWAF]), + cast_to=cast(Type[Optional[WAF]], ResultWrapper[WAF]), ) -class AsyncWAF(AsyncAPIResource): +class AsyncWAFResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWAFWithRawResponse: - return AsyncWAFWithRawResponse(self) + def with_raw_response(self) -> AsyncWAFResourceWithRawResponse: + return AsyncWAFResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWAFWithStreamingResponse: - return AsyncWAFWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWAFResourceWithStreamingResponse: + return AsyncWAFResourceWithStreamingResponse(self) async def edit( self, @@ -161,7 +162,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWAF]: + ) -> Optional[WAF]: """The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -198,9 +199,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WAF]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWAF]], ResultWrapper[ZoneSettingWAF]), + cast_to=cast(Type[Optional[WAF]], ResultWrapper[WAF]), ) async def get( @@ -213,7 +214,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWAF]: + ) -> Optional[WAF]: """The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -247,14 +248,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WAF]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWAF]], ResultWrapper[ZoneSettingWAF]), + cast_to=cast(Type[Optional[WAF]], ResultWrapper[WAF]), ) -class WAFWithRawResponse: - def __init__(self, waf: WAF) -> None: +class WAFResourceWithRawResponse: + def __init__(self, waf: WAFResource) -> None: self._waf = waf self.edit = to_raw_response_wrapper( @@ -265,8 +266,8 @@ def __init__(self, waf: WAF) -> None: ) -class AsyncWAFWithRawResponse: - def __init__(self, waf: AsyncWAF) -> None: +class AsyncWAFResourceWithRawResponse: + def __init__(self, waf: AsyncWAFResource) -> None: self._waf = waf self.edit = async_to_raw_response_wrapper( @@ -277,8 +278,8 @@ def __init__(self, waf: AsyncWAF) -> None: ) -class WAFWithStreamingResponse: - def __init__(self, waf: WAF) -> None: +class WAFResourceWithStreamingResponse: + def __init__(self, waf: WAFResource) -> None: self._waf = waf self.edit = to_streamed_response_wrapper( @@ -289,8 +290,8 @@ def __init__(self, waf: WAF) -> None: ) -class AsyncWAFWithStreamingResponse: - def __init__(self, waf: AsyncWAF) -> None: +class AsyncWAFResourceWithStreamingResponse: + def __init__(self, waf: AsyncWAFResource) -> None: self._waf = waf self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/webp.py b/src/cloudflare/resources/zones/settings/webp.py index 78ec7612555..e6fc0ac0ab4 100644 --- a/src/cloudflare/resources/zones/settings/webp.py +++ b/src/cloudflare/resources/zones/settings/webp.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingWebP, webp_edit_params +from ....types.zones.settings import webp_edit_params +from ....types.zones.settings.webp import WebP -__all__ = ["WebP", "AsyncWebP"] +__all__ = ["WebPResource", "AsyncWebPResource"] -class WebP(SyncAPIResource): +class WebPResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WebPWithRawResponse: - return WebPWithRawResponse(self) + def with_raw_response(self) -> WebPResourceWithRawResponse: + return WebPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WebPWithStreamingResponse: - return WebPWithStreamingResponse(self) + def with_streaming_response(self) -> WebPResourceWithStreamingResponse: + return WebPResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWebP]: + ) -> Optional[WebP]: """ When the client requesting the image supports the WebP image codec, and WebP offers a performance advantage over the original image format, Cloudflare will @@ -78,9 +79,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebP]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWebP]], ResultWrapper[ZoneSettingWebP]), + cast_to=cast(Type[Optional[WebP]], ResultWrapper[WebP]), ) def get( @@ -93,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWebP]: + ) -> Optional[WebP]: """ When the client requesting the image supports the WebP image codec, and WebP offers a performance advantage over the original image format, Cloudflare will @@ -119,20 +120,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebP]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWebP]], ResultWrapper[ZoneSettingWebP]), + cast_to=cast(Type[Optional[WebP]], ResultWrapper[WebP]), ) -class AsyncWebP(AsyncAPIResource): +class AsyncWebPResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWebPWithRawResponse: - return AsyncWebPWithRawResponse(self) + def with_raw_response(self) -> AsyncWebPResourceWithRawResponse: + return AsyncWebPResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWebPWithStreamingResponse: - return AsyncWebPWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWebPResourceWithStreamingResponse: + return AsyncWebPResourceWithStreamingResponse(self) async def edit( self, @@ -145,7 +146,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWebP]: + ) -> Optional[WebP]: """ When the client requesting the image supports the WebP image codec, and WebP offers a performance advantage over the original image format, Cloudflare will @@ -174,9 +175,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebP]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWebP]], ResultWrapper[ZoneSettingWebP]), + cast_to=cast(Type[Optional[WebP]], ResultWrapper[WebP]), ) async def get( @@ -189,7 +190,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWebP]: + ) -> Optional[WebP]: """ When the client requesting the image supports the WebP image codec, and WebP offers a performance advantage over the original image format, Cloudflare will @@ -215,14 +216,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[WebP]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWebP]], ResultWrapper[ZoneSettingWebP]), + cast_to=cast(Type[Optional[WebP]], ResultWrapper[WebP]), ) -class WebPWithRawResponse: - def __init__(self, webp: WebP) -> None: +class WebPResourceWithRawResponse: + def __init__(self, webp: WebPResource) -> None: self._webp = webp self.edit = to_raw_response_wrapper( @@ -233,8 +234,8 @@ def __init__(self, webp: WebP) -> None: ) -class AsyncWebPWithRawResponse: - def __init__(self, webp: AsyncWebP) -> None: +class AsyncWebPResourceWithRawResponse: + def __init__(self, webp: AsyncWebPResource) -> None: self._webp = webp self.edit = async_to_raw_response_wrapper( @@ -245,8 +246,8 @@ def __init__(self, webp: AsyncWebP) -> None: ) -class WebPWithStreamingResponse: - def __init__(self, webp: WebP) -> None: +class WebPResourceWithStreamingResponse: + def __init__(self, webp: WebPResource) -> None: self._webp = webp self.edit = to_streamed_response_wrapper( @@ -257,8 +258,8 @@ def __init__(self, webp: WebP) -> None: ) -class AsyncWebPWithStreamingResponse: - def __init__(self, webp: AsyncWebP) -> None: +class AsyncWebPResourceWithStreamingResponse: + def __init__(self, webp: AsyncWebPResource) -> None: self._webp = webp self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/websocket.py b/src/cloudflare/resources/zones/settings/websocket.py index 68b4940c9fd..9caba287e7d 100644 --- a/src/cloudflare/resources/zones/settings/websocket.py +++ b/src/cloudflare/resources/zones/settings/websocket.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSettingWebsockets, websocket_edit_params +from ....types.zones.settings import websocket_edit_params +from ....types.zones.settings.websocket import Websocket -__all__ = ["Websocket", "AsyncWebsocket"] +__all__ = ["WebsocketResource", "AsyncWebsocketResource"] -class Websocket(SyncAPIResource): +class WebsocketResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WebsocketWithRawResponse: - return WebsocketWithRawResponse(self) + def with_raw_response(self) -> WebsocketResourceWithRawResponse: + return WebsocketResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WebsocketWithStreamingResponse: - return WebsocketWithStreamingResponse(self) + def with_streaming_response(self) -> WebsocketResourceWithStreamingResponse: + return WebsocketResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWebsockets]: + ) -> Optional[Websocket]: """Changes Websockets setting. For more information about Websockets, please refer @@ -79,9 +80,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Websocket]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWebsockets]], ResultWrapper[ZoneSettingWebsockets]), + cast_to=cast(Type[Optional[Websocket]], ResultWrapper[Websocket]), ) def get( @@ -94,7 +95,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWebsockets]: + ) -> Optional[Websocket]: """Gets Websockets setting. For more information about Websockets, please refer to @@ -120,20 +121,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Websocket]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWebsockets]], ResultWrapper[ZoneSettingWebsockets]), + cast_to=cast(Type[Optional[Websocket]], ResultWrapper[Websocket]), ) -class AsyncWebsocket(AsyncAPIResource): +class AsyncWebsocketResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWebsocketWithRawResponse: - return AsyncWebsocketWithRawResponse(self) + def with_raw_response(self) -> AsyncWebsocketResourceWithRawResponse: + return AsyncWebsocketResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWebsocketWithStreamingResponse: - return AsyncWebsocketWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWebsocketResourceWithStreamingResponse: + return AsyncWebsocketResourceWithStreamingResponse(self) async def edit( self, @@ -146,7 +147,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWebsockets]: + ) -> Optional[Websocket]: """Changes Websockets setting. For more information about Websockets, please refer @@ -176,9 +177,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Websocket]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWebsockets]], ResultWrapper[ZoneSettingWebsockets]), + cast_to=cast(Type[Optional[Websocket]], ResultWrapper[Websocket]), ) async def get( @@ -191,7 +192,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSettingWebsockets]: + ) -> Optional[Websocket]: """Gets Websockets setting. For more information about Websockets, please refer to @@ -217,14 +218,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Websocket]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSettingWebsockets]], ResultWrapper[ZoneSettingWebsockets]), + cast_to=cast(Type[Optional[Websocket]], ResultWrapper[Websocket]), ) -class WebsocketWithRawResponse: - def __init__(self, websocket: Websocket) -> None: +class WebsocketResourceWithRawResponse: + def __init__(self, websocket: WebsocketResource) -> None: self._websocket = websocket self.edit = to_raw_response_wrapper( @@ -235,8 +236,8 @@ def __init__(self, websocket: Websocket) -> None: ) -class AsyncWebsocketWithRawResponse: - def __init__(self, websocket: AsyncWebsocket) -> None: +class AsyncWebsocketResourceWithRawResponse: + def __init__(self, websocket: AsyncWebsocketResource) -> None: self._websocket = websocket self.edit = async_to_raw_response_wrapper( @@ -247,8 +248,8 @@ def __init__(self, websocket: AsyncWebsocket) -> None: ) -class WebsocketWithStreamingResponse: - def __init__(self, websocket: Websocket) -> None: +class WebsocketResourceWithStreamingResponse: + def __init__(self, websocket: WebsocketResource) -> None: self._websocket = websocket self.edit = to_streamed_response_wrapper( @@ -259,8 +260,8 @@ def __init__(self, websocket: Websocket) -> None: ) -class AsyncWebsocketWithStreamingResponse: - def __init__(self, websocket: AsyncWebsocket) -> None: +class AsyncWebsocketResourceWithStreamingResponse: + def __init__(self, websocket: AsyncWebsocketResource) -> None: self._websocket = websocket self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/settings/zero_rtt.py b/src/cloudflare/resources/zones/settings/zero_rtt.py index 9f47865ed16..fafd4dea55d 100644 --- a/src/cloudflare/resources/zones/settings/zero_rtt.py +++ b/src/cloudflare/resources/zones/settings/zero_rtt.py @@ -24,19 +24,20 @@ from ...._base_client import ( make_request_options, ) -from ....types.zones.settings import ZoneSetting0rtt, zero_rtt_edit_params +from ....types.zones.settings import zero_rtt_edit_params +from ....types.zones.settings.zero_rtt import ZeroRTT -__all__ = ["ZeroRTT", "AsyncZeroRTT"] +__all__ = ["ZeroRTTResource", "AsyncZeroRTTResource"] -class ZeroRTT(SyncAPIResource): +class ZeroRTTResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ZeroRTTWithRawResponse: - return ZeroRTTWithRawResponse(self) + def with_raw_response(self) -> ZeroRTTResourceWithRawResponse: + return ZeroRTTResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ZeroRTTWithStreamingResponse: - return ZeroRTTWithStreamingResponse(self) + def with_streaming_response(self) -> ZeroRTTResourceWithStreamingResponse: + return ZeroRTTResourceWithStreamingResponse(self) def edit( self, @@ -49,7 +50,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSetting0rtt]: + ) -> Optional[ZeroRTT]: """ Changes the 0-RTT session resumption setting. @@ -76,9 +77,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroRTT]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSetting0rtt]], ResultWrapper[ZoneSetting0rtt]), + cast_to=cast(Type[Optional[ZeroRTT]], ResultWrapper[ZeroRTT]), ) def get( @@ -91,7 +92,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSetting0rtt]: + ) -> Optional[ZeroRTT]: """ Gets 0-RTT session resumption setting. @@ -115,20 +116,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroRTT]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSetting0rtt]], ResultWrapper[ZoneSetting0rtt]), + cast_to=cast(Type[Optional[ZeroRTT]], ResultWrapper[ZeroRTT]), ) -class AsyncZeroRTT(AsyncAPIResource): +class AsyncZeroRTTResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncZeroRTTWithRawResponse: - return AsyncZeroRTTWithRawResponse(self) + def with_raw_response(self) -> AsyncZeroRTTResourceWithRawResponse: + return AsyncZeroRTTResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncZeroRTTWithStreamingResponse: - return AsyncZeroRTTWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncZeroRTTResourceWithStreamingResponse: + return AsyncZeroRTTResourceWithStreamingResponse(self) async def edit( self, @@ -141,7 +142,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSetting0rtt]: + ) -> Optional[ZeroRTT]: """ Changes the 0-RTT session resumption setting. @@ -168,9 +169,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroRTT]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSetting0rtt]], ResultWrapper[ZoneSetting0rtt]), + cast_to=cast(Type[Optional[ZeroRTT]], ResultWrapper[ZeroRTT]), ) async def get( @@ -183,7 +184,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZoneSetting0rtt]: + ) -> Optional[ZeroRTT]: """ Gets 0-RTT session resumption setting. @@ -207,14 +208,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZeroRTT]]._unwrapper, ), - cast_to=cast(Type[Optional[ZoneSetting0rtt]], ResultWrapper[ZoneSetting0rtt]), + cast_to=cast(Type[Optional[ZeroRTT]], ResultWrapper[ZeroRTT]), ) -class ZeroRTTWithRawResponse: - def __init__(self, zero_rtt: ZeroRTT) -> None: +class ZeroRTTResourceWithRawResponse: + def __init__(self, zero_rtt: ZeroRTTResource) -> None: self._zero_rtt = zero_rtt self.edit = to_raw_response_wrapper( @@ -225,8 +226,8 @@ def __init__(self, zero_rtt: ZeroRTT) -> None: ) -class AsyncZeroRTTWithRawResponse: - def __init__(self, zero_rtt: AsyncZeroRTT) -> None: +class AsyncZeroRTTResourceWithRawResponse: + def __init__(self, zero_rtt: AsyncZeroRTTResource) -> None: self._zero_rtt = zero_rtt self.edit = async_to_raw_response_wrapper( @@ -237,8 +238,8 @@ def __init__(self, zero_rtt: AsyncZeroRTT) -> None: ) -class ZeroRTTWithStreamingResponse: - def __init__(self, zero_rtt: ZeroRTT) -> None: +class ZeroRTTResourceWithStreamingResponse: + def __init__(self, zero_rtt: ZeroRTTResource) -> None: self._zero_rtt = zero_rtt self.edit = to_streamed_response_wrapper( @@ -249,8 +250,8 @@ def __init__(self, zero_rtt: ZeroRTT) -> None: ) -class AsyncZeroRTTWithStreamingResponse: - def __init__(self, zero_rtt: AsyncZeroRTT) -> None: +class AsyncZeroRTTResourceWithStreamingResponse: + def __init__(self, zero_rtt: AsyncZeroRTTResource) -> None: self._zero_rtt = zero_rtt self.edit = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/subscriptions.py b/src/cloudflare/resources/zones/subscriptions.py index 8eb96a52ed6..bf49382c3a0 100644 --- a/src/cloudflare/resources/zones/subscriptions.py +++ b/src/cloudflare/resources/zones/subscriptions.py @@ -22,38 +22,39 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage -from ...types.zones import ( - SubscriptionGetResponse, - SubscriptionListResponse, - SubscriptionCreateResponse, - subscription_create_params, -) +from ...types.zones import subscription_create_params from ..._base_client import ( AsyncPaginator, make_request_options, ) +from ...types.user.subscription import Subscription +from ...types.user.rate_plan_param import RatePlanParam +from ...types.user.subscription_zone_param import SubscriptionZoneParam +from ...types.zones.subscription_get_response import SubscriptionGetResponse +from ...types.user.subscription_component_param import SubscriptionComponentParam +from ...types.zones.subscription_create_response import SubscriptionCreateResponse -__all__ = ["Subscriptions", "AsyncSubscriptions"] +__all__ = ["SubscriptionsResource", "AsyncSubscriptionsResource"] -class Subscriptions(SyncAPIResource): +class SubscriptionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SubscriptionsWithRawResponse: - return SubscriptionsWithRawResponse(self) + def with_raw_response(self) -> SubscriptionsResourceWithRawResponse: + return SubscriptionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SubscriptionsWithStreamingResponse: - return SubscriptionsWithStreamingResponse(self) + def with_streaming_response(self) -> SubscriptionsResourceWithStreamingResponse: + return SubscriptionsResourceWithStreamingResponse(self) def create( self, identifier: str, *, app: subscription_create_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -104,7 +105,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionCreateResponse] @@ -122,7 +123,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[SubscriptionListResponse]: + ) -> SyncSinglePage[Subscription]: """ Lists all of an account's subscriptions. @@ -141,11 +142,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/subscriptions", - page=SyncSinglePage[SubscriptionListResponse], + page=SyncSinglePage[Subscription], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SubscriptionListResponse, + model=Subscription, ) def get( @@ -184,7 +185,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionGetResponse] @@ -193,24 +194,24 @@ def get( ) -class AsyncSubscriptions(AsyncAPIResource): +class AsyncSubscriptionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSubscriptionsWithRawResponse: - return AsyncSubscriptionsWithRawResponse(self) + def with_raw_response(self) -> AsyncSubscriptionsResourceWithRawResponse: + return AsyncSubscriptionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSubscriptionsWithStreamingResponse: - return AsyncSubscriptionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSubscriptionsResourceWithStreamingResponse: + return AsyncSubscriptionsResourceWithStreamingResponse(self) async def create( self, identifier: str, *, app: subscription_create_params.App | NotGiven = NOT_GIVEN, - component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN, frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, - rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, - zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN, + rate_plan: RatePlanParam | NotGiven = NOT_GIVEN, + zone: SubscriptionZoneParam | 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, @@ -261,7 +262,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionCreateResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionCreateResponse] @@ -279,7 +280,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[SubscriptionListResponse, AsyncSinglePage[SubscriptionListResponse]]: + ) -> AsyncPaginator[Subscription, AsyncSinglePage[Subscription]]: """ Lists all of an account's subscriptions. @@ -298,11 +299,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/subscriptions", - page=AsyncSinglePage[SubscriptionListResponse], + page=AsyncSinglePage[Subscription], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=SubscriptionListResponse, + model=Subscription, ) async def get( @@ -341,7 +342,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[SubscriptionGetResponse]._unwrapper, ), cast_to=cast( Any, ResultWrapper[SubscriptionGetResponse] @@ -350,8 +351,8 @@ async def get( ) -class SubscriptionsWithRawResponse: - def __init__(self, subscriptions: Subscriptions) -> None: +class SubscriptionsResourceWithRawResponse: + def __init__(self, subscriptions: SubscriptionsResource) -> None: self._subscriptions = subscriptions self.create = to_raw_response_wrapper( @@ -365,8 +366,8 @@ def __init__(self, subscriptions: Subscriptions) -> None: ) -class AsyncSubscriptionsWithRawResponse: - def __init__(self, subscriptions: AsyncSubscriptions) -> None: +class AsyncSubscriptionsResourceWithRawResponse: + def __init__(self, subscriptions: AsyncSubscriptionsResource) -> None: self._subscriptions = subscriptions self.create = async_to_raw_response_wrapper( @@ -380,8 +381,8 @@ def __init__(self, subscriptions: AsyncSubscriptions) -> None: ) -class SubscriptionsWithStreamingResponse: - def __init__(self, subscriptions: Subscriptions) -> None: +class SubscriptionsResourceWithStreamingResponse: + def __init__(self, subscriptions: SubscriptionsResource) -> None: self._subscriptions = subscriptions self.create = to_streamed_response_wrapper( @@ -395,8 +396,8 @@ def __init__(self, subscriptions: Subscriptions) -> None: ) -class AsyncSubscriptionsWithStreamingResponse: - def __init__(self, subscriptions: AsyncSubscriptions) -> None: +class AsyncSubscriptionsResourceWithStreamingResponse: + def __init__(self, subscriptions: AsyncSubscriptionsResource) -> None: self._subscriptions = subscriptions self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zones/workers/__init__.py b/src/cloudflare/resources/zones/workers/__init__.py deleted file mode 100644 index 41dfe9b587e..00000000000 --- a/src/cloudflare/resources/zones/workers/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .script import ( - Script, - AsyncScript, - ScriptWithRawResponse, - AsyncScriptWithRawResponse, - ScriptWithStreamingResponse, - AsyncScriptWithStreamingResponse, -) -from .workers import ( - Workers, - AsyncWorkers, - WorkersWithRawResponse, - AsyncWorkersWithRawResponse, - WorkersWithStreamingResponse, - AsyncWorkersWithStreamingResponse, -) - -__all__ = [ - "Script", - "AsyncScript", - "ScriptWithRawResponse", - "AsyncScriptWithRawResponse", - "ScriptWithStreamingResponse", - "AsyncScriptWithStreamingResponse", - "Workers", - "AsyncWorkers", - "WorkersWithRawResponse", - "AsyncWorkersWithRawResponse", - "WorkersWithStreamingResponse", - "AsyncWorkersWithStreamingResponse", -] diff --git a/src/cloudflare/resources/zones/workers/script.py b/src/cloudflare/resources/zones/workers/script.py deleted file mode 100644 index f69f668ea48..00000000000 --- a/src/cloudflare/resources/zones/workers/script.py +++ /dev/null @@ -1,354 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, cast - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven -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.zones.workers import ScriptUpdateResponse - -__all__ = ["Script", "AsyncScript"] - - -class Script(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ScriptWithRawResponse: - return ScriptWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ScriptWithStreamingResponse: - return ScriptWithStreamingResponse(self) - - def update( - 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, - ) -> ScriptUpdateResponse: - """ - Upload a worker, or a new version of a worker. - - 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 cast( - ScriptUpdateResponse, - self._put( - f"/zones/{zone_id}/workers/script", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ScriptUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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: - """Delete your Worker. - - This call has no response body on a successful delete. - - 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}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/zones/{zone_id}/workers/script", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def get( - 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, - ) -> BinaryAPIResponse: - """Fetch raw script content for your worker. - - Note this is the original script - content, not JSON encoded. - - 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}") - extra_headers = {"Accept": "undefined", **(extra_headers or {})} - return self._get( - f"/zones/{zone_id}/workers/script", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BinaryAPIResponse, - ) - - -class AsyncScript(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncScriptWithRawResponse: - return AsyncScriptWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncScriptWithStreamingResponse: - return AsyncScriptWithStreamingResponse(self) - - async def update( - 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, - ) -> ScriptUpdateResponse: - """ - Upload a worker, or a new version of a worker. - - 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 cast( - ScriptUpdateResponse, - await self._put( - f"/zones/{zone_id}/workers/script", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ScriptUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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: - """Delete your Worker. - - This call has no response body on a successful delete. - - 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}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/zones/{zone_id}/workers/script", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def get( - 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, - ) -> AsyncBinaryAPIResponse: - """Fetch raw script content for your worker. - - Note this is the original script - content, not JSON encoded. - - 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}") - extra_headers = {"Accept": "undefined", **(extra_headers or {})} - return await self._get( - f"/zones/{zone_id}/workers/script", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AsyncBinaryAPIResponse, - ) - - -class ScriptWithRawResponse: - def __init__(self, script: Script) -> None: - self._script = script - - self.update = to_raw_response_wrapper( - script.update, - ) - self.delete = to_raw_response_wrapper( - script.delete, - ) - self.get = to_custom_raw_response_wrapper( - script.get, - BinaryAPIResponse, - ) - - -class AsyncScriptWithRawResponse: - def __init__(self, script: AsyncScript) -> None: - self._script = script - - self.update = async_to_raw_response_wrapper( - script.update, - ) - self.delete = async_to_raw_response_wrapper( - script.delete, - ) - self.get = async_to_custom_raw_response_wrapper( - script.get, - AsyncBinaryAPIResponse, - ) - - -class ScriptWithStreamingResponse: - def __init__(self, script: Script) -> None: - self._script = script - - self.update = to_streamed_response_wrapper( - script.update, - ) - self.delete = to_streamed_response_wrapper( - script.delete, - ) - self.get = to_custom_streamed_response_wrapper( - script.get, - StreamedBinaryAPIResponse, - ) - - -class AsyncScriptWithStreamingResponse: - def __init__(self, script: AsyncScript) -> None: - self._script = script - - self.update = async_to_streamed_response_wrapper( - script.update, - ) - self.delete = async_to_streamed_response_wrapper( - script.delete, - ) - self.get = async_to_custom_streamed_response_wrapper( - script.get, - AsyncStreamedBinaryAPIResponse, - ) diff --git a/src/cloudflare/resources/zones/workers/workers.py b/src/cloudflare/resources/zones/workers/workers.py deleted file mode 100644 index 7a9895653a8..00000000000 --- a/src/cloudflare/resources/zones/workers/workers.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .script import ( - Script, - AsyncScript, - ScriptWithRawResponse, - AsyncScriptWithRawResponse, - ScriptWithStreamingResponse, - AsyncScriptWithStreamingResponse, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["Workers", "AsyncWorkers"] - - -class Workers(SyncAPIResource): - @cached_property - def script(self) -> Script: - return Script(self._client) - - @cached_property - def with_raw_response(self) -> WorkersWithRawResponse: - return WorkersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WorkersWithStreamingResponse: - return WorkersWithStreamingResponse(self) - - -class AsyncWorkers(AsyncAPIResource): - @cached_property - def script(self) -> AsyncScript: - return AsyncScript(self._client) - - @cached_property - def with_raw_response(self) -> AsyncWorkersWithRawResponse: - return AsyncWorkersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWorkersWithStreamingResponse: - return AsyncWorkersWithStreamingResponse(self) - - -class WorkersWithRawResponse: - def __init__(self, workers: Workers) -> None: - self._workers = workers - - @cached_property - def script(self) -> ScriptWithRawResponse: - return ScriptWithRawResponse(self._workers.script) - - -class AsyncWorkersWithRawResponse: - def __init__(self, workers: AsyncWorkers) -> None: - self._workers = workers - - @cached_property - def script(self) -> AsyncScriptWithRawResponse: - return AsyncScriptWithRawResponse(self._workers.script) - - -class WorkersWithStreamingResponse: - def __init__(self, workers: Workers) -> None: - self._workers = workers - - @cached_property - def script(self) -> ScriptWithStreamingResponse: - return ScriptWithStreamingResponse(self._workers.script) - - -class AsyncWorkersWithStreamingResponse: - def __init__(self, workers: AsyncWorkers) -> None: - self._workers = workers - - @cached_property - def script(self) -> AsyncScriptWithStreamingResponse: - return AsyncScriptWithStreamingResponse(self._workers.script) diff --git a/src/cloudflare/resources/zones/zones.py b/src/cloudflare/resources/zones/zones.py index cdfddc1a21f..2f44b6f7014 100644 --- a/src/cloudflare/resources/zones/zones.py +++ b/src/cloudflare/resources/zones/zones.py @@ -8,21 +8,12 @@ import httpx from .holds import ( - Holds, - AsyncHolds, - HoldsWithRawResponse, - AsyncHoldsWithRawResponse, - HoldsWithStreamingResponse, - AsyncHoldsWithStreamingResponse, -) -from ...types import Zone, ZoneDeleteResponse, zone_edit_params, zone_list_params, zone_create_params -from .workers import ( - Workers, - AsyncWorkers, - WorkersWithRawResponse, - AsyncWorkersWithRawResponse, - WorkersWithStreamingResponse, - AsyncWorkersWithStreamingResponse, + HoldsResource, + AsyncHoldsResource, + HoldsResourceWithRawResponse, + AsyncHoldsResourceWithRawResponse, + HoldsResourceWithStreamingResponse, + AsyncHoldsResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( @@ -30,12 +21,12 @@ async_maybe_transform, ) from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -48,83 +39,81 @@ from ..._wrappers import ResultWrapper from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from .dns_settings import ( - DNSSettings, - AsyncDNSSettings, - DNSSettingsWithRawResponse, - AsyncDNSSettingsWithRawResponse, - DNSSettingsWithStreamingResponse, - AsyncDNSSettingsWithStreamingResponse, + DNSSettingsResource, + AsyncDNSSettingsResource, + DNSSettingsResourceWithRawResponse, + AsyncDNSSettingsResourceWithRawResponse, + DNSSettingsResourceWithStreamingResponse, + AsyncDNSSettingsResourceWithStreamingResponse, ) +from ...types.zones import zone_edit_params, zone_list_params, zone_create_params from .subscriptions import ( - Subscriptions, - AsyncSubscriptions, - SubscriptionsWithRawResponse, - AsyncSubscriptionsWithRawResponse, - SubscriptionsWithStreamingResponse, - AsyncSubscriptionsWithStreamingResponse, + SubscriptionsResource, + AsyncSubscriptionsResource, + SubscriptionsResourceWithRawResponse, + AsyncSubscriptionsResourceWithRawResponse, + SubscriptionsResourceWithStreamingResponse, + AsyncSubscriptionsResourceWithStreamingResponse, ) from ..._base_client import ( AsyncPaginator, make_request_options, ) -from .workers.workers import Workers, AsyncWorkers from .activation_check import ( - ActivationCheck, - AsyncActivationCheck, - ActivationCheckWithRawResponse, - AsyncActivationCheckWithRawResponse, - ActivationCheckWithStreamingResponse, - AsyncActivationCheckWithStreamingResponse, + ActivationCheckResource, + AsyncActivationCheckResource, + ActivationCheckResourceWithRawResponse, + AsyncActivationCheckResourceWithRawResponse, + ActivationCheckResourceWithStreamingResponse, + AsyncActivationCheckResourceWithStreamingResponse, ) -from .settings.settings import Settings, AsyncSettings +from .settings.settings import SettingsResource, AsyncSettingsResource +from ...types.zones.zone import Zone from .custom_nameservers import ( - CustomNameservers, - AsyncCustomNameservers, - CustomNameserversWithRawResponse, - AsyncCustomNameserversWithRawResponse, - CustomNameserversWithStreamingResponse, - AsyncCustomNameserversWithStreamingResponse, + CustomNameserversResource, + AsyncCustomNameserversResource, + CustomNameserversResourceWithRawResponse, + AsyncCustomNameserversResourceWithRawResponse, + CustomNameserversResourceWithStreamingResponse, + AsyncCustomNameserversResourceWithStreamingResponse, ) +from ...types.zones.zone_delete_response import ZoneDeleteResponse -__all__ = ["Zones", "AsyncZones"] - +__all__ = ["ZonesResource", "AsyncZonesResource"] -class Zones(SyncAPIResource): - @cached_property - def activation_check(self) -> ActivationCheck: - return ActivationCheck(self._client) +class ZonesResource(SyncAPIResource): @cached_property - def dns_settings(self) -> DNSSettings: - return DNSSettings(self._client) + def activation_check(self) -> ActivationCheckResource: + return ActivationCheckResource(self._client) @cached_property - def settings(self) -> Settings: - return Settings(self._client) + def dns_settings(self) -> DNSSettingsResource: + return DNSSettingsResource(self._client) @cached_property - def custom_nameservers(self) -> CustomNameservers: - return CustomNameservers(self._client) + def settings(self) -> SettingsResource: + return SettingsResource(self._client) @cached_property - def holds(self) -> Holds: - return Holds(self._client) + def custom_nameservers(self) -> CustomNameserversResource: + return CustomNameserversResource(self._client) @cached_property - def workers(self) -> Workers: - return Workers(self._client) + def holds(self) -> HoldsResource: + return HoldsResource(self._client) @cached_property - def subscriptions(self) -> Subscriptions: - return Subscriptions(self._client) + def subscriptions(self) -> SubscriptionsResource: + return SubscriptionsResource(self._client) @cached_property - def with_raw_response(self) -> ZonesWithRawResponse: - return ZonesWithRawResponse(self) + def with_raw_response(self) -> ZonesResourceWithRawResponse: + return ZonesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ZonesWithStreamingResponse: - return ZonesWithStreamingResponse(self) + def with_streaming_response(self) -> ZonesResourceWithStreamingResponse: + return ZonesResourceWithStreamingResponse(self) def create( self, @@ -171,7 +160,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Zone]]._unwrapper, ), cast_to=cast(Type[Optional[Zone]], ResultWrapper[Zone]), ) @@ -289,7 +278,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ZoneDeleteResponse]], ResultWrapper[ZoneDeleteResponse]), ) @@ -352,7 +341,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Zone]]._unwrapper, ), cast_to=cast(Type[Optional[Zone]], ResultWrapper[Zone]), ) @@ -391,48 +380,44 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Zone]]._unwrapper, ), cast_to=cast(Type[Optional[Zone]], ResultWrapper[Zone]), ) -class AsyncZones(AsyncAPIResource): +class AsyncZonesResource(AsyncAPIResource): @cached_property - def activation_check(self) -> AsyncActivationCheck: - return AsyncActivationCheck(self._client) + def activation_check(self) -> AsyncActivationCheckResource: + return AsyncActivationCheckResource(self._client) @cached_property - def dns_settings(self) -> AsyncDNSSettings: - return AsyncDNSSettings(self._client) + def dns_settings(self) -> AsyncDNSSettingsResource: + return AsyncDNSSettingsResource(self._client) @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) @cached_property - def custom_nameservers(self) -> AsyncCustomNameservers: - return AsyncCustomNameservers(self._client) + def custom_nameservers(self) -> AsyncCustomNameserversResource: + return AsyncCustomNameserversResource(self._client) @cached_property - def holds(self) -> AsyncHolds: - return AsyncHolds(self._client) + def holds(self) -> AsyncHoldsResource: + return AsyncHoldsResource(self._client) @cached_property - def workers(self) -> AsyncWorkers: - return AsyncWorkers(self._client) + def subscriptions(self) -> AsyncSubscriptionsResource: + return AsyncSubscriptionsResource(self._client) @cached_property - def subscriptions(self) -> AsyncSubscriptions: - return AsyncSubscriptions(self._client) + def with_raw_response(self) -> AsyncZonesResourceWithRawResponse: + return AsyncZonesResourceWithRawResponse(self) @cached_property - def with_raw_response(self) -> AsyncZonesWithRawResponse: - return AsyncZonesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncZonesWithStreamingResponse: - return AsyncZonesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncZonesResourceWithStreamingResponse: + return AsyncZonesResourceWithStreamingResponse(self) async def create( self, @@ -479,7 +464,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Zone]]._unwrapper, ), cast_to=cast(Type[Optional[Zone]], ResultWrapper[Zone]), ) @@ -597,7 +582,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper, ), cast_to=cast(Type[Optional[ZoneDeleteResponse]], ResultWrapper[ZoneDeleteResponse]), ) @@ -660,7 +645,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Zone]]._unwrapper, ), cast_to=cast(Type[Optional[Zone]], ResultWrapper[Zone]), ) @@ -699,14 +684,14 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper._unwrapper, + post_parser=ResultWrapper[Optional[Zone]]._unwrapper, ), cast_to=cast(Type[Optional[Zone]], ResultWrapper[Zone]), ) -class ZonesWithRawResponse: - def __init__(self, zones: Zones) -> None: +class ZonesResourceWithRawResponse: + def __init__(self, zones: ZonesResource) -> None: self._zones = zones self.create = to_raw_response_wrapper( @@ -726,36 +711,32 @@ def __init__(self, zones: Zones) -> None: ) @cached_property - def activation_check(self) -> ActivationCheckWithRawResponse: - return ActivationCheckWithRawResponse(self._zones.activation_check) - - @cached_property - def dns_settings(self) -> DNSSettingsWithRawResponse: - return DNSSettingsWithRawResponse(self._zones.dns_settings) + def activation_check(self) -> ActivationCheckResourceWithRawResponse: + return ActivationCheckResourceWithRawResponse(self._zones.activation_check) @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._zones.settings) + def dns_settings(self) -> DNSSettingsResourceWithRawResponse: + return DNSSettingsResourceWithRawResponse(self._zones.dns_settings) @cached_property - def custom_nameservers(self) -> CustomNameserversWithRawResponse: - return CustomNameserversWithRawResponse(self._zones.custom_nameservers) + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._zones.settings) @cached_property - def holds(self) -> HoldsWithRawResponse: - return HoldsWithRawResponse(self._zones.holds) + def custom_nameservers(self) -> CustomNameserversResourceWithRawResponse: + return CustomNameserversResourceWithRawResponse(self._zones.custom_nameservers) @cached_property - def workers(self) -> WorkersWithRawResponse: - return WorkersWithRawResponse(self._zones.workers) + def holds(self) -> HoldsResourceWithRawResponse: + return HoldsResourceWithRawResponse(self._zones.holds) @cached_property - def subscriptions(self) -> SubscriptionsWithRawResponse: - return SubscriptionsWithRawResponse(self._zones.subscriptions) + def subscriptions(self) -> SubscriptionsResourceWithRawResponse: + return SubscriptionsResourceWithRawResponse(self._zones.subscriptions) -class AsyncZonesWithRawResponse: - def __init__(self, zones: AsyncZones) -> None: +class AsyncZonesResourceWithRawResponse: + def __init__(self, zones: AsyncZonesResource) -> None: self._zones = zones self.create = async_to_raw_response_wrapper( @@ -775,36 +756,32 @@ def __init__(self, zones: AsyncZones) -> None: ) @cached_property - def activation_check(self) -> AsyncActivationCheckWithRawResponse: - return AsyncActivationCheckWithRawResponse(self._zones.activation_check) + def activation_check(self) -> AsyncActivationCheckResourceWithRawResponse: + return AsyncActivationCheckResourceWithRawResponse(self._zones.activation_check) @cached_property - def dns_settings(self) -> AsyncDNSSettingsWithRawResponse: - return AsyncDNSSettingsWithRawResponse(self._zones.dns_settings) + def dns_settings(self) -> AsyncDNSSettingsResourceWithRawResponse: + return AsyncDNSSettingsResourceWithRawResponse(self._zones.dns_settings) @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._zones.settings) + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._zones.settings) @cached_property - def custom_nameservers(self) -> AsyncCustomNameserversWithRawResponse: - return AsyncCustomNameserversWithRawResponse(self._zones.custom_nameservers) + def custom_nameservers(self) -> AsyncCustomNameserversResourceWithRawResponse: + return AsyncCustomNameserversResourceWithRawResponse(self._zones.custom_nameservers) @cached_property - def holds(self) -> AsyncHoldsWithRawResponse: - return AsyncHoldsWithRawResponse(self._zones.holds) + def holds(self) -> AsyncHoldsResourceWithRawResponse: + return AsyncHoldsResourceWithRawResponse(self._zones.holds) @cached_property - def workers(self) -> AsyncWorkersWithRawResponse: - return AsyncWorkersWithRawResponse(self._zones.workers) - - @cached_property - def subscriptions(self) -> AsyncSubscriptionsWithRawResponse: - return AsyncSubscriptionsWithRawResponse(self._zones.subscriptions) + def subscriptions(self) -> AsyncSubscriptionsResourceWithRawResponse: + return AsyncSubscriptionsResourceWithRawResponse(self._zones.subscriptions) -class ZonesWithStreamingResponse: - def __init__(self, zones: Zones) -> None: +class ZonesResourceWithStreamingResponse: + def __init__(self, zones: ZonesResource) -> None: self._zones = zones self.create = to_streamed_response_wrapper( @@ -824,36 +801,32 @@ def __init__(self, zones: Zones) -> None: ) @cached_property - def activation_check(self) -> ActivationCheckWithStreamingResponse: - return ActivationCheckWithStreamingResponse(self._zones.activation_check) - - @cached_property - def dns_settings(self) -> DNSSettingsWithStreamingResponse: - return DNSSettingsWithStreamingResponse(self._zones.dns_settings) + def activation_check(self) -> ActivationCheckResourceWithStreamingResponse: + return ActivationCheckResourceWithStreamingResponse(self._zones.activation_check) @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._zones.settings) + def dns_settings(self) -> DNSSettingsResourceWithStreamingResponse: + return DNSSettingsResourceWithStreamingResponse(self._zones.dns_settings) @cached_property - def custom_nameservers(self) -> CustomNameserversWithStreamingResponse: - return CustomNameserversWithStreamingResponse(self._zones.custom_nameservers) + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._zones.settings) @cached_property - def holds(self) -> HoldsWithStreamingResponse: - return HoldsWithStreamingResponse(self._zones.holds) + def custom_nameservers(self) -> CustomNameserversResourceWithStreamingResponse: + return CustomNameserversResourceWithStreamingResponse(self._zones.custom_nameservers) @cached_property - def workers(self) -> WorkersWithStreamingResponse: - return WorkersWithStreamingResponse(self._zones.workers) + def holds(self) -> HoldsResourceWithStreamingResponse: + return HoldsResourceWithStreamingResponse(self._zones.holds) @cached_property - def subscriptions(self) -> SubscriptionsWithStreamingResponse: - return SubscriptionsWithStreamingResponse(self._zones.subscriptions) + def subscriptions(self) -> SubscriptionsResourceWithStreamingResponse: + return SubscriptionsResourceWithStreamingResponse(self._zones.subscriptions) -class AsyncZonesWithStreamingResponse: - def __init__(self, zones: AsyncZones) -> None: +class AsyncZonesResourceWithStreamingResponse: + def __init__(self, zones: AsyncZonesResource) -> None: self._zones = zones self.create = async_to_streamed_response_wrapper( @@ -873,29 +846,25 @@ def __init__(self, zones: AsyncZones) -> None: ) @cached_property - def activation_check(self) -> AsyncActivationCheckWithStreamingResponse: - return AsyncActivationCheckWithStreamingResponse(self._zones.activation_check) - - @cached_property - def dns_settings(self) -> AsyncDNSSettingsWithStreamingResponse: - return AsyncDNSSettingsWithStreamingResponse(self._zones.dns_settings) + def activation_check(self) -> AsyncActivationCheckResourceWithStreamingResponse: + return AsyncActivationCheckResourceWithStreamingResponse(self._zones.activation_check) @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._zones.settings) + def dns_settings(self) -> AsyncDNSSettingsResourceWithStreamingResponse: + return AsyncDNSSettingsResourceWithStreamingResponse(self._zones.dns_settings) @cached_property - def custom_nameservers(self) -> AsyncCustomNameserversWithStreamingResponse: - return AsyncCustomNameserversWithStreamingResponse(self._zones.custom_nameservers) + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._zones.settings) @cached_property - def holds(self) -> AsyncHoldsWithStreamingResponse: - return AsyncHoldsWithStreamingResponse(self._zones.holds) + def custom_nameservers(self) -> AsyncCustomNameserversResourceWithStreamingResponse: + return AsyncCustomNameserversResourceWithStreamingResponse(self._zones.custom_nameservers) @cached_property - def workers(self) -> AsyncWorkersWithStreamingResponse: - return AsyncWorkersWithStreamingResponse(self._zones.workers) + def holds(self) -> AsyncHoldsResourceWithStreamingResponse: + return AsyncHoldsResourceWithStreamingResponse(self._zones.holds) @cached_property - def subscriptions(self) -> AsyncSubscriptionsWithStreamingResponse: - return AsyncSubscriptionsWithStreamingResponse(self._zones.subscriptions) + def subscriptions(self) -> AsyncSubscriptionsResourceWithStreamingResponse: + return AsyncSubscriptionsResourceWithStreamingResponse(self._zones.subscriptions) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index 9d99cc14a2a..c61c5c1b5e3 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -2,204 +2,18 @@ from __future__ import annotations -from .ips import IPs as IPs -from .zone import Zone as Zone -from .dnssec import DNSSEC as DNSSEC -from .shared import ErrorData as ErrorData -from .account import Account as Account -from .ruleset import Ruleset as Ruleset -from .snippet import Snippet as Snippet -from .calls_app import CallsApp as CallsApp -from .membership import Membership as Membership -from .healthcheck import Healthcheck as Healthcheck -from .jdcloud_ips import JDCloudIPs as JDCloudIPs -from .waiting_room import WaitingRoom as WaitingRoom -from .load_balancer import LoadBalancer as LoadBalancer -from .stream_videos import StreamVideos as StreamVideos -from .ip_list_params import IPListParams as IPListParams -from .zones_pagerule import ZonesPagerule as ZonesPagerule -from .firewall_filter import FirewallFilter as FirewallFilter -from .ip_list_response import IPListResponse as IPListResponse -from .mtls_certificate import MTLSCertificate as MTLSCertificate -from .user_edit_params import UserEditParams as UserEditParams -from .zone_edit_params import ZoneEditParams as ZoneEditParams -from .zone_list_params import ZoneListParams as ZoneListParams -from .custom_nameserver import CustomNameserver as CustomNameserver -from .observatory_trend import ObservatoryTrend as ObservatoryTrend -from .pcap_get_response import PCAPGetResponse as PCAPGetResponse -from .user_get_response import UserGetResponse as UserGetResponse -from .cache_purge_params import CachePurgeParams as CachePurgeParams -from .call_create_params import CallCreateParams as CallCreateParams -from .call_update_params import CallUpdateParams as CallUpdateParams -from .client_certificate import ClientCertificate as ClientCertificate -from .custom_certificate import CustomCertificate as CustomCertificate -from .dnssec_edit_params import DNSSECEditParams as DNSSECEditParams -from .filter_list_params import FilterListParams as FilterListParams -from .pcap_create_params import PCAPCreateParams as PCAPCreateParams -from .pcap_list_response import PCAPListResponse as PCAPListResponse -from .queue_get_response import QueueGetResponse as QueueGetResponse -from .stream_list_params import StreamListParams as StreamListParams -from .user_edit_response import UserEditResponse as UserEditResponse -from .zone_create_params import ZoneCreateParams as ZoneCreateParams -from .account_list_params import AccountListParams as AccountListParams -from .available_rate_plan import AvailableRatePlan as AvailableRatePlan -from .page_shield_setting import PageShieldSetting as PageShieldSetting -from .queue_create_params import QueueCreateParams as QueueCreateParams -from .queue_list_response import QueueListResponse as QueueListResponse -from .queue_update_params import QueueUpdateParams as QueueUpdateParams -from .speed_delete_params import SpeedDeleteParams as SpeedDeleteParams -from .account_get_response import AccountGetResponse as AccountGetResponse -from .cache_purge_response import CachePurgeResponse as CachePurgeResponse -from .filter_create_params import FilterCreateParams as FilterCreateParams -from .filter_update_params import FilterUpdateParams as FilterUpdateParams -from .observatory_schedule import ObservatorySchedule as ObservatorySchedule -from .pagerule_edit_params import PageruleEditParams as PageruleEditParams -from .pagerule_list_params import PageruleListParams as PageruleListParams -from .pcap_create_response import PCAPCreateResponse as PCAPCreateResponse -from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse -from .account_update_params import AccountUpdateParams as AccountUpdateParams -from .audit_log_list_params import AuditLogListParams as AuditLogListParams -from .calls_app_with_secret import CallsAppWithSecret as CallsAppWithSecret -from .origin_ca_certificate import OriginCACertificate as OriginCACertificate -from .pagerule_get_response import PageruleGetResponse as PageruleGetResponse -from .queue_create_response import QueueCreateResponse as QueueCreateResponse -from .queue_delete_response import QueueDeleteResponse as QueueDeleteResponse -from .queue_update_response import QueueUpdateResponse as QueueUpdateResponse -from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams -from .ruleset_list_response import RulesetListResponse as RulesetListResponse -from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams -from .snippet_update_params import SnippetUpdateParams as SnippetUpdateParams -from .speed_delete_response import SpeedDeleteResponse as SpeedDeleteResponse -from .dnssec_delete_response import DNSSECDeleteResponse as DNSSECDeleteResponse -from .filter_create_response import FilterCreateResponse as FilterCreateResponse -from .membership_list_params import MembershipListParams as MembershipListParams -from .pagerule_create_params import PageruleCreateParams as PageruleCreateParams -from .pagerule_edit_response import PageruleEditResponse as PageruleEditResponse -from .pagerule_list_response import PageruleListResponse as PageruleListResponse -from .pagerule_update_params import PageruleUpdateParams as PageruleUpdateParams -from .rate_limit_edit_params import RateLimitEditParams as RateLimitEditParams -from .rate_limit_list_params import RateLimitListParams as RateLimitListParams -from .rate_plan_get_response import RatePlanGetResponse as RatePlanGetResponse -from .account_update_response import AccountUpdateResponse as AccountUpdateResponse -from .audit_log_list_response import AuditLogListResponse as AuditLogListResponse -from .healthcheck_edit_params import HealthcheckEditParams as HealthcheckEditParams -from .intel_phishing_url_info import IntelPhishingURLInfo as IntelPhishingURLInfo -from .membership_get_response import MembershipGetResponse as MembershipGetResponse -from .mtls_certificate_update import MTLSCertificateUpdate as MTLSCertificateUpdate -from .rate_limit_get_response import RateLimitGetResponse as RateLimitGetResponse -from .snippet_delete_response import SnippetDeleteResponse as SnippetDeleteResponse -from .url_scanner_scan_params import URLScannerScanParams as URLScannerScanParams -from .membership_update_params import MembershipUpdateParams as MembershipUpdateParams -from .pagerule_create_response import PageruleCreateResponse as PageruleCreateResponse -from .pagerule_delete_response import PageruleDeleteResponse as PageruleDeleteResponse -from .pagerule_update_response import PageruleUpdateResponse as PageruleUpdateResponse -from .rate_limit_create_params import RateLimitCreateParams as RateLimitCreateParams -from .rate_limit_edit_response import RateLimitEditResponse as RateLimitEditResponse -from .rate_limit_list_response import RateLimitListResponse as RateLimitListResponse -from .speed_trends_list_params import SpeedTrendsListParams as SpeedTrendsListParams -from .waiting_room_edit_params import WaitingRoomEditParams as WaitingRoomEditParams -from .healthcheck_create_params import HealthcheckCreateParams as HealthcheckCreateParams -from .healthcheck_update_params import HealthcheckUpdateParams as HealthcheckUpdateParams -from .intel_phishing_url_submit import IntelPhishingURLSubmit as IntelPhishingURLSubmit -from .load_balancer_edit_params import LoadBalancerEditParams as LoadBalancerEditParams -from .page_shield_update_params import PageShieldUpdateParams as PageShieldUpdateParams -from .speed_schedule_get_params import SpeedScheduleGetParams as SpeedScheduleGetParams -from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse -from .url_scanner_scan_response import URLScannerScanResponse as URLScannerScanResponse -from .email_routing_get_response import EmailRoutingGetResponse as EmailRoutingGetResponse -from .managed_header_edit_params import ManagedHeaderEditParams as ManagedHeaderEditParams -from .membership_delete_response import MembershipDeleteResponse as MembershipDeleteResponse -from .membership_update_response import MembershipUpdateResponse as MembershipUpdateResponse -from .rate_limit_create_response import RateLimitCreateResponse as RateLimitCreateResponse -from .rate_limit_delete_response import RateLimitDeleteResponse as RateLimitDeleteResponse -from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams -from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse -from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams -from .waiting_room_create_params import WaitingRoomCreateParams as WaitingRoomCreateParams -from .waiting_room_update_params import WaitingRoomUpdateParams as WaitingRoomUpdateParams -from .warp_connector_edit_params import WARPConnectorEditParams as WARPConnectorEditParams -from .warp_connector_list_params import WARPConnectorListParams as WARPConnectorListParams -from .bot_management_get_response import BotManagementGetResponse as BotManagementGetResponse -from .custom_hostname_edit_params import CustomHostnameEditParams as CustomHostnameEditParams -from .custom_hostname_list_params import CustomHostnameListParams as CustomHostnameListParams -from .healthcheck_delete_response import HealthcheckDeleteResponse as HealthcheckDeleteResponse -from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams -from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams -from .page_shield_update_response import PageShieldUpdateResponse as PageShieldUpdateResponse -from .warp_connector_get_response import WARPConnectorGetResponse as WARPConnectorGetResponse -from .bot_management_update_params import BotManagementUpdateParams as BotManagementUpdateParams -from .custom_hostname_get_response import CustomHostnameGetResponse as CustomHostnameGetResponse -from .keyless_certificate_hostname import KeylessCertificateHostname as KeylessCertificateHostname -from .managed_header_edit_response import ManagedHeaderEditResponse as ManagedHeaderEditResponse -from .managed_header_list_response import ManagedHeaderListResponse as ManagedHeaderListResponse -from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse -from .subscription_delete_response import SubscriptionDeleteResponse as SubscriptionDeleteResponse -from .subscription_update_response import SubscriptionUpdateResponse as SubscriptionUpdateResponse -from .waiting_room_delete_response import WaitingRoomDeleteResponse as WaitingRoomDeleteResponse -from .warp_connector_create_params import WARPConnectorCreateParams as WARPConnectorCreateParams -from .warp_connector_delete_params import WARPConnectorDeleteParams as WARPConnectorDeleteParams -from .warp_connector_edit_response import WARPConnectorEditResponse as WARPConnectorEditResponse -from .warp_connector_list_response import WARPConnectorListResponse as WARPConnectorListResponse -from .custom_hostname_create_params import CustomHostnameCreateParams as CustomHostnameCreateParams -from .custom_hostname_edit_response import CustomHostnameEditResponse as CustomHostnameEditResponse -from .custom_hostname_list_response import CustomHostnameListResponse as CustomHostnameListResponse -from .email_routing_enable_response import EmailRoutingEnableResponse as EmailRoutingEnableResponse -from .load_balancer_delete_response import LoadBalancerDeleteResponse as LoadBalancerDeleteResponse -from .warp_connector_token_response import WARPConnectorTokenResponse as WARPConnectorTokenResponse -from .bot_management_update_response import BotManagementUpdateResponse as BotManagementUpdateResponse -from .brand_protection_submit_params import BrandProtectionSubmitParams as BrandProtectionSubmitParams -from .client_certificate_list_params import ClientCertificateListParams as ClientCertificateListParams -from .custom_certificate_edit_params import CustomCertificateEditParams as CustomCertificateEditParams -from .custom_certificate_list_params import CustomCertificateListParams as CustomCertificateListParams -from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse -from .email_routing_disable_response import EmailRoutingDisableResponse as EmailRoutingDisableResponse -from .mtls_certificate_create_params import MTLSCertificateCreateParams as MTLSCertificateCreateParams -from .url_normalization_get_response import URLNormalizationGetResponse as URLNormalizationGetResponse -from .warp_connector_create_response import WARPConnectorCreateResponse as WARPConnectorCreateResponse -from .warp_connector_delete_response import WARPConnectorDeleteResponse as WARPConnectorDeleteResponse -from .custom_certificate_get_response import CustomCertificateGetResponse as CustomCertificateGetResponse -from .custom_hostname_create_response import CustomHostnameCreateResponse as CustomHostnameCreateResponse -from .custom_hostname_delete_response import CustomHostnameDeleteResponse as CustomHostnameDeleteResponse -from .custom_nameserver_create_params import CustomNameserverCreateParams as CustomNameserverCreateParams -from .keyless_certificate_edit_params import KeylessCertificateEditParams as KeylessCertificateEditParams -from .url_normalization_update_params import URLNormalizationUpdateParams as URLNormalizationUpdateParams -from .brand_protection_url_info_params import BrandProtectionURLInfoParams as BrandProtectionURLInfoParams -from .client_certificate_create_params import ClientCertificateCreateParams as ClientCertificateCreateParams -from .custom_certificate_create_params import CustomCertificateCreateParams as CustomCertificateCreateParams -from .custom_certificate_edit_response import CustomCertificateEditResponse as CustomCertificateEditResponse -from .custom_nameserver_delete_response import CustomNameserverDeleteResponse as CustomNameserverDeleteResponse -from .custom_nameserver_verify_response import CustomNameserverVerifyResponse as CustomNameserverVerifyResponse -from .keyless_certificate_create_params import KeylessCertificateCreateParams as KeylessCertificateCreateParams -from .url_normalization_update_response import URLNormalizationUpdateResponse as URLNormalizationUpdateResponse -from .custom_certificate_create_response import CustomCertificateCreateResponse as CustomCertificateCreateResponse -from .custom_certificate_delete_response import CustomCertificateDeleteResponse as CustomCertificateDeleteResponse -from .origin_ca_certificate_get_response import OriginCACertificateGetResponse as OriginCACertificateGetResponse -from .keyless_certificate_delete_response import KeylessCertificateDeleteResponse as KeylessCertificateDeleteResponse -from .origin_ca_certificate_create_params import OriginCACertificateCreateParams as OriginCACertificateCreateParams -from .origin_tls_client_auth_get_response import OriginTLSClientAuthGetResponse as OriginTLSClientAuthGetResponse -from .origin_tls_client_auth_create_params import OriginTLSClientAuthCreateParams as OriginTLSClientAuthCreateParams -from .origin_tls_client_auth_list_response import OriginTLSClientAuthListResponse as OriginTLSClientAuthListResponse -from .origin_ca_certificate_create_response import ( - OriginCACertificateCreateResponse as OriginCACertificateCreateResponse, -) -from .origin_ca_certificate_delete_response import ( - OriginCACertificateDeleteResponse as OriginCACertificateDeleteResponse, -) -from .custom_nameserver_availabilty_response import ( - CustomNameserverAvailabiltyResponse as CustomNameserverAvailabiltyResponse, -) -from .origin_tls_client_auth_create_response import ( - OriginTLSClientAuthCreateResponse as OriginTLSClientAuthCreateResponse, -) -from .origin_tls_client_auth_delete_response import ( - OriginTLSClientAuthDeleteResponse as OriginTLSClientAuthDeleteResponse, -) -from .origin_post_quantum_encryption_get_response import ( - OriginPostQuantumEncryptionGetResponse as OriginPostQuantumEncryptionGetResponse, -) -from .origin_post_quantum_encryption_update_params import ( - OriginPostQuantumEncryptionUpdateParams as OriginPostQuantumEncryptionUpdateParams, -) -from .origin_post_quantum_encryption_update_response import ( - OriginPostQuantumEncryptionUpdateResponse as OriginPostQuantumEncryptionUpdateResponse, +from .shared import ( + ASN as ASN, + Role as Role, + Member as Member, + Result as Result, + AuditLog as AuditLog, + ErrorData as ErrorData, + Identifier as Identifier, + Permission as Permission, + ResponseInfo as ResponseInfo, + PaginationInfo as PaginationInfo, + PermissionGrant as PermissionGrant, + CloudflareTunnel as CloudflareTunnel, + LoadBalancerPreview as LoadBalancerPreview, ) diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py index c004560aa23..4df03ede50b 100644 --- a/src/cloudflare/types/accounts/__init__.py +++ b/src/cloudflare/types/accounts/__init__.py @@ -2,12 +2,16 @@ from __future__ import annotations -from .role import Role as Role -from .account_member import AccountMember as AccountMember +from .account import Account as Account from .role_get_response import RoleGetResponse as RoleGetResponse from .member_list_params import MemberListParams as MemberListParams +from .account_list_params import AccountListParams as AccountListParams +from .account_get_response import AccountGetResponse as AccountGetResponse from .member_create_params import MemberCreateParams as MemberCreateParams +from .member_delete_params import MemberDeleteParams as MemberDeleteParams from .member_list_response import MemberListResponse as MemberListResponse from .member_update_params import MemberUpdateParams as MemberUpdateParams -from .account_member_with_id import AccountMemberWithID as AccountMemberWithID +from .account_update_params import AccountUpdateParams as AccountUpdateParams +from .user_with_invite_code import UserWithInviteCode as UserWithInviteCode from .member_delete_response import MemberDeleteResponse as MemberDeleteResponse +from .account_update_response import AccountUpdateResponse as AccountUpdateResponse diff --git a/src/cloudflare/types/account.py b/src/cloudflare/types/accounts/account.py similarity index 97% rename from src/cloudflare/types/account.py rename to src/cloudflare/types/accounts/account.py index 50f42137319..8c402e4bac9 100644 --- a/src/cloudflare/types/account.py +++ b/src/cloudflare/types/accounts/account.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["Account", "Settings"] diff --git a/src/cloudflare/types/account_get_response.py b/src/cloudflare/types/accounts/account_get_response.py similarity index 100% rename from src/cloudflare/types/account_get_response.py rename to src/cloudflare/types/accounts/account_get_response.py diff --git a/src/cloudflare/types/account_list_params.py b/src/cloudflare/types/accounts/account_list_params.py similarity index 90% rename from src/cloudflare/types/account_list_params.py rename to src/cloudflare/types/accounts/account_list_params.py index 31a40e5cc1d..427c758c083 100644 --- a/src/cloudflare/types/account_list_params.py +++ b/src/cloudflare/types/accounts/account_list_params.py @@ -11,6 +11,9 @@ class AccountListParams(TypedDict, total=False): direction: Literal["asc", "desc"] """Direction to order results.""" + name: str + """Name of the account.""" + page: float """Page number of paginated results.""" diff --git a/src/cloudflare/types/accounts/account_member.py b/src/cloudflare/types/accounts/account_member.py deleted file mode 100644 index b81ba646d84..00000000000 --- a/src/cloudflare/types/accounts/account_member.py +++ /dev/null @@ -1,167 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = [ - "AccountMember", - "Role", - "RolePermissions", - "RolePermissionsAnalytics", - "RolePermissionsBilling", - "RolePermissionsCachePurge", - "RolePermissionsDNS", - "RolePermissionsDNSRecords", - "RolePermissionsLb", - "RolePermissionsLogs", - "RolePermissionsOrganization", - "RolePermissionsSSL", - "RolePermissionsWAF", - "RolePermissionsZoneSettings", - "RolePermissionsZones", - "User", -] - - -class RolePermissionsAnalytics(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsBilling(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsCachePurge(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsDNS(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsDNSRecords(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsLb(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsLogs(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsOrganization(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsSSL(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsWAF(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsZoneSettings(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsZones(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissions(BaseModel): - analytics: Optional[RolePermissionsAnalytics] = None - - billing: Optional[RolePermissionsBilling] = None - - cache_purge: Optional[RolePermissionsCachePurge] = None - - dns: Optional[RolePermissionsDNS] = None - - dns_records: Optional[RolePermissionsDNSRecords] = None - - lb: Optional[RolePermissionsLb] = None - - logs: Optional[RolePermissionsLogs] = None - - organization: Optional[RolePermissionsOrganization] = None - - ssl: Optional[RolePermissionsSSL] = None - - waf: Optional[RolePermissionsWAF] = None - - zone_settings: Optional[RolePermissionsZoneSettings] = None - - zones: Optional[RolePermissionsZones] = None - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role name.""" - - permissions: RolePermissions - - -class User(BaseModel): - email: str - """The contact email address of the user.""" - - id: Optional[str] = None - """Identifier""" - - first_name: Optional[str] = None - """User's first name""" - - last_name: Optional[str] = None - """User's last name""" - - two_factor_authentication_enabled: Optional[bool] = None - """Indicates whether two-factor authentication is enabled for the user account. - - Does not apply to API authentication. - """ - - -class AccountMember(BaseModel): - id: str - """Membership identifier tag.""" - - roles: List[Role] - """Roles assigned to this member.""" - - status: object - - user: User diff --git a/src/cloudflare/types/accounts/account_member_with_id.py b/src/cloudflare/types/accounts/account_member_with_id.py deleted file mode 100644 index 6064ba5ab3a..00000000000 --- a/src/cloudflare/types/accounts/account_member_with_id.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = [ - "AccountMemberWithID", - "Role", - "RolePermissions", - "RolePermissionsAnalytics", - "RolePermissionsBilling", - "RolePermissionsCachePurge", - "RolePermissionsDNS", - "RolePermissionsDNSRecords", - "RolePermissionsLb", - "RolePermissionsLogs", - "RolePermissionsOrganization", - "RolePermissionsSSL", - "RolePermissionsWAF", - "RolePermissionsZoneSettings", - "RolePermissionsZones", - "User", -] - - -class RolePermissionsAnalytics(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsBilling(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsCachePurge(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsDNS(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsDNSRecords(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsLb(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsLogs(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsOrganization(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsSSL(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsWAF(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsZoneSettings(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissionsZones(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class RolePermissions(BaseModel): - analytics: Optional[RolePermissionsAnalytics] = None - - billing: Optional[RolePermissionsBilling] = None - - cache_purge: Optional[RolePermissionsCachePurge] = None - - dns: Optional[RolePermissionsDNS] = None - - dns_records: Optional[RolePermissionsDNSRecords] = None - - lb: Optional[RolePermissionsLb] = None - - logs: Optional[RolePermissionsLogs] = None - - organization: Optional[RolePermissionsOrganization] = None - - ssl: Optional[RolePermissionsSSL] = None - - waf: Optional[RolePermissionsWAF] = None - - zone_settings: Optional[RolePermissionsZoneSettings] = None - - zones: Optional[RolePermissionsZones] = None - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role name.""" - - permissions: RolePermissions - - -class User(BaseModel): - email: str - """The contact email address of the user.""" - - id: Optional[str] = None - """Identifier""" - - first_name: Optional[str] = None - """User's first name""" - - last_name: Optional[str] = None - """User's last name""" - - two_factor_authentication_enabled: Optional[bool] = None - """Indicates whether two-factor authentication is enabled for the user account. - - Does not apply to API authentication. - """ - - -class AccountMemberWithID(BaseModel): - id: str - """Membership identifier tag.""" - - roles: List[Role] - """Roles assigned to this member.""" - - status: object - - user: User - - code: Optional[str] = None - """The unique activation code for the account membership.""" diff --git a/src/cloudflare/types/account_update_params.py b/src/cloudflare/types/accounts/account_update_params.py similarity index 100% rename from src/cloudflare/types/account_update_params.py rename to src/cloudflare/types/accounts/account_update_params.py diff --git a/src/cloudflare/types/account_update_response.py b/src/cloudflare/types/accounts/account_update_response.py similarity index 100% rename from src/cloudflare/types/account_update_response.py rename to src/cloudflare/types/accounts/account_update_response.py diff --git a/src/cloudflare/types/accounts/member_delete_params.py b/src/cloudflare/types/accounts/member_delete_params.py new file mode 100644 index 00000000000..c71acd55512 --- /dev/null +++ b/src/cloudflare/types/accounts/member_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["MemberDeleteParams"] + + +class MemberDeleteParams(TypedDict, total=False): + account_id: Required[object] + + body: Required[object] diff --git a/src/cloudflare/types/accounts/member_list_response.py b/src/cloudflare/types/accounts/member_list_response.py index 26182b74f97..ca5c995cf44 100644 --- a/src/cloudflare/types/accounts/member_list_response.py +++ b/src/cloudflare/types/accounts/member_list_response.py @@ -3,8 +3,8 @@ from typing import List, Optional from typing_extensions import Literal -from .role import Role from ..._models import BaseModel +from ..shared.role import Role __all__ = ["MemberListResponse"] diff --git a/src/cloudflare/types/accounts/user_with_invite_code.py b/src/cloudflare/types/accounts/user_with_invite_code.py new file mode 100644 index 00000000000..ab928845355 --- /dev/null +++ b/src/cloudflare/types/accounts/user_with_invite_code.py @@ -0,0 +1,82 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from ..shared.permission_grant import PermissionGrant + +__all__ = ["UserWithInviteCode", "Role", "RolePermissions", "User"] + + +class RolePermissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class Role(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: RolePermissions + + +class User(BaseModel): + email: str + """The contact email address of the user.""" + + id: Optional[str] = None + """Identifier""" + + first_name: Optional[str] = None + """User's first name""" + + last_name: Optional[str] = None + """User's last name""" + + two_factor_authentication_enabled: Optional[bool] = None + """Indicates whether two-factor authentication is enabled for the user account. + + Does not apply to API authentication. + """ + + +class UserWithInviteCode(BaseModel): + id: str + """Membership identifier tag.""" + + roles: List[Role] + """Roles assigned to this member.""" + + status: object + + user: User + + code: Optional[str] = None + """The unique activation code for the account membership.""" diff --git a/src/cloudflare/types/addressing/__init__.py b/src/cloudflare/types/addressing/__init__.py index ede0ad000f2..09699f91e4e 100644 --- a/src/cloudflare/types/addressing/__init__.py +++ b/src/cloudflare/types/addressing/__init__.py @@ -2,15 +2,17 @@ from __future__ import annotations +from .prefix import Prefix as Prefix +from .address_map import AddressMap as AddressMap from .prefix_edit_params import PrefixEditParams as PrefixEditParams from .prefix_create_params import PrefixCreateParams as PrefixCreateParams +from .prefix_delete_params import PrefixDeleteParams as PrefixDeleteParams from .service_list_response import ServiceListResponse as ServiceListResponse from .prefix_delete_response import PrefixDeleteResponse as PrefixDeleteResponse from .address_map_edit_params import AddressMapEditParams as AddressMapEditParams -from .addressing_address_maps import AddressingAddressMaps as AddressingAddressMaps from .address_map_get_response import AddressMapGetResponse as AddressMapGetResponse -from .addressing_ipam_prefixes import AddressingIpamPrefixes as AddressingIpamPrefixes from .address_map_create_params import AddressMapCreateParams as AddressMapCreateParams +from .address_map_delete_params import AddressMapDeleteParams as AddressMapDeleteParams from .loa_document_create_params import LOADocumentCreateParams as LOADocumentCreateParams from .address_map_create_response import AddressMapCreateResponse as AddressMapCreateResponse from .address_map_delete_response import AddressMapDeleteResponse as AddressMapDeleteResponse diff --git a/src/cloudflare/types/addressing/address_map.py b/src/cloudflare/types/addressing/address_map.py new file mode 100644 index 00000000000..dff7660e50c --- /dev/null +++ b/src/cloudflare/types/addressing/address_map.py @@ -0,0 +1,51 @@ +# 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__ = ["AddressMap"] + + +class AddressMap(BaseModel): + id: Optional[str] = None + """Identifier""" + + can_delete: Optional[bool] = None + """If set to false, then the Address Map cannot be deleted via API. + + This is true for Cloudflare-managed maps. + """ + + can_modify_ips: Optional[bool] = None + """If set to false, then the IPs on the Address Map cannot be modified via the API. + + This is true for Cloudflare-managed maps. + """ + + created_at: Optional[datetime] = None + + default_sni: Optional[str] = None + """ + 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 + handshake from a client without an SNI, it will respond with the default SNI on + those IPs. The default SNI can be any valid zone or subdomain owned by the + account. + """ + + description: Optional[str] = None + """ + An optional description field which may be used to describe the types of IPs or + zones on the map. + """ + + enabled: Optional[bool] = None + """Whether the Address Map is enabled or not. + + Cloudflare's DNS will not respond with IP addresses on an Address Map until the + map is enabled. + """ + + modified_at: Optional[datetime] = None diff --git a/src/cloudflare/types/addressing/address_map_delete_params.py b/src/cloudflare/types/addressing/address_map_delete_params.py new file mode 100644 index 00000000000..1e7b18b03ec --- /dev/null +++ b/src/cloudflare/types/addressing/address_map_delete_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__ = ["AddressMapDeleteParams"] + + +class AddressMapDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/address_map_delete_response.py b/src/cloudflare/types/addressing/address_map_delete_response.py index 57b879481e2..f9c7d73ddf8 100644 --- a/src/cloudflare/types/addressing/address_map_delete_response.py +++ b/src/cloudflare/types/addressing/address_map_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["AddressMapDeleteResponse"] -AddressMapDeleteResponse = Union[List[object], str, object, None] +AddressMapDeleteResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/__init__.py b/src/cloudflare/types/addressing/address_maps/__init__.py index ad44bc05d93..3ec4e9eda25 100644 --- a/src/cloudflare/types/addressing/address_maps/__init__.py +++ b/src/cloudflare/types/addressing/address_maps/__init__.py @@ -2,9 +2,15 @@ from __future__ import annotations +from .ip_delete_params import IPDeleteParams as IPDeleteParams +from .ip_update_params import IPUpdateParams as IPUpdateParams from .ip_delete_response import IPDeleteResponse as IPDeleteResponse from .ip_update_response import IPUpdateResponse as IPUpdateResponse +from .zone_delete_params import ZoneDeleteParams as ZoneDeleteParams +from .zone_update_params import ZoneUpdateParams as ZoneUpdateParams from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse from .zone_update_response import ZoneUpdateResponse as ZoneUpdateResponse +from .account_delete_params import AccountDeleteParams as AccountDeleteParams +from .account_update_params import AccountUpdateParams as AccountUpdateParams from .account_delete_response import AccountDeleteResponse as AccountDeleteResponse from .account_update_response import AccountUpdateResponse as AccountUpdateResponse diff --git a/src/cloudflare/types/addressing/address_maps/account_delete_params.py b/src/cloudflare/types/addressing/address_maps/account_delete_params.py new file mode 100644 index 00000000000..7b03287d63c --- /dev/null +++ b/src/cloudflare/types/addressing/address_maps/account_delete_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__ = ["AccountDeleteParams"] + + +class AccountDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/address_maps/account_delete_response.py b/src/cloudflare/types/addressing/address_maps/account_delete_response.py index 3ddf76cafe9..30142d8d8e1 100644 --- a/src/cloudflare/types/addressing/address_maps/account_delete_response.py +++ b/src/cloudflare/types/addressing/address_maps/account_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["AccountDeleteResponse"] -AccountDeleteResponse = Union[List[object], str, object, None] +AccountDeleteResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/account_update_params.py b/src/cloudflare/types/addressing/address_maps/account_update_params.py new file mode 100644 index 00000000000..f06483675c1 --- /dev/null +++ b/src/cloudflare/types/addressing/address_maps/account_update_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__ = ["AccountUpdateParams"] + + +class AccountUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/address_maps/account_update_response.py b/src/cloudflare/types/addressing/address_maps/account_update_response.py index 53831e97698..946503210f5 100644 --- a/src/cloudflare/types/addressing/address_maps/account_update_response.py +++ b/src/cloudflare/types/addressing/address_maps/account_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["AccountUpdateResponse"] -AccountUpdateResponse = Union[List[object], str, object, None] +AccountUpdateResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/ip_delete_params.py b/src/cloudflare/types/addressing/address_maps/ip_delete_params.py new file mode 100644 index 00000000000..ee8bd8d2752 --- /dev/null +++ b/src/cloudflare/types/addressing/address_maps/ip_delete_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__ = ["IPDeleteParams"] + + +class IPDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + address_map_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/address_maps/ip_delete_response.py b/src/cloudflare/types/addressing/address_maps/ip_delete_response.py index 9cb4b12b353..1559d31d584 100644 --- a/src/cloudflare/types/addressing/address_maps/ip_delete_response.py +++ b/src/cloudflare/types/addressing/address_maps/ip_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["IPDeleteResponse"] -IPDeleteResponse = Union[List[object], str, object, None] +IPDeleteResponse = List[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 new file mode 100644 index 00000000000..41cd04d50b1 --- /dev/null +++ b/src/cloudflare/types/addressing/address_maps/ip_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__ = ["IPUpdateParams"] + + +class IPUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + address_map_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/address_maps/ip_update_response.py b/src/cloudflare/types/addressing/address_maps/ip_update_response.py index d4b874c9522..6db8b575a14 100644 --- a/src/cloudflare/types/addressing/address_maps/ip_update_response.py +++ b/src/cloudflare/types/addressing/address_maps/ip_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["IPUpdateResponse"] -IPUpdateResponse = Union[List[object], str, object, None] +IPUpdateResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/zone_delete_params.py b/src/cloudflare/types/addressing/address_maps/zone_delete_params.py new file mode 100644 index 00000000000..36219801986 --- /dev/null +++ b/src/cloudflare/types/addressing/address_maps/zone_delete_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__ = ["ZoneDeleteParams"] + + +class ZoneDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/address_maps/zone_delete_response.py b/src/cloudflare/types/addressing/address_maps/zone_delete_response.py index 6fdbcc03fa7..c03361c6def 100644 --- a/src/cloudflare/types/addressing/address_maps/zone_delete_response.py +++ b/src/cloudflare/types/addressing/address_maps/zone_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["ZoneDeleteResponse"] -ZoneDeleteResponse = Union[List[object], str, object, None] +ZoneDeleteResponse = List[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 new file mode 100644 index 00000000000..3cd7060a7ed --- /dev/null +++ b/src/cloudflare/types/addressing/address_maps/zone_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__ = ["ZoneUpdateParams"] + + +class ZoneUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/address_maps/zone_update_response.py b/src/cloudflare/types/addressing/address_maps/zone_update_response.py index 1f488961e0d..40c1da23a29 100644 --- a/src/cloudflare/types/addressing/address_maps/zone_update_response.py +++ b/src/cloudflare/types/addressing/address_maps/zone_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["ZoneUpdateResponse"] -ZoneUpdateResponse = Union[List[object], str, object, None] +ZoneUpdateResponse = List[object] diff --git a/src/cloudflare/types/addressing/addressing_address_maps.py b/src/cloudflare/types/addressing/addressing_address_maps.py deleted file mode 100644 index e7e702be5a0..00000000000 --- a/src/cloudflare/types/addressing/addressing_address_maps.py +++ /dev/null @@ -1,51 +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__ = ["AddressingAddressMaps"] - - -class AddressingAddressMaps(BaseModel): - id: Optional[str] = None - """Identifier""" - - can_delete: Optional[bool] = None - """If set to false, then the Address Map cannot be deleted via API. - - This is true for Cloudflare-managed maps. - """ - - can_modify_ips: Optional[bool] = None - """If set to false, then the IPs on the Address Map cannot be modified via the API. - - This is true for Cloudflare-managed maps. - """ - - created_at: Optional[datetime] = None - - default_sni: Optional[str] = None - """ - 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 - handshake from a client without an SNI, it will respond with the default SNI on - those IPs. The default SNI can be any valid zone or subdomain owned by the - account. - """ - - description: Optional[str] = None - """ - An optional description field which may be used to describe the types of IPs or - zones on the map. - """ - - enabled: Optional[bool] = None - """Whether the Address Map is enabled or not. - - Cloudflare's DNS will not respond with IP addresses on an Address Map until the - map is enabled. - """ - - modified_at: Optional[datetime] = None diff --git a/src/cloudflare/types/addressing/addressing_ipam_prefixes.py b/src/cloudflare/types/addressing/addressing_ipam_prefixes.py deleted file mode 100644 index c9d6c5c31df..00000000000 --- a/src/cloudflare/types/addressing/addressing_ipam_prefixes.py +++ /dev/null @@ -1,59 +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__ = ["AddressingIpamPrefixes"] - - -class AddressingIpamPrefixes(BaseModel): - id: Optional[str] = None - """Identifier""" - - account_id: Optional[str] = None - """Identifier""" - - advertised: Optional[bool] = None - """Prefix advertisement status to the Internet. - - This field is only not 'null' if on demand is enabled. - """ - - advertised_modified_at: Optional[datetime] = None - """Last time the advertisement status was changed. - - This field is only not 'null' if on demand is enabled. - """ - - approved: Optional[str] = None - """Approval state of the prefix (P = pending, V = active).""" - - asn: Optional[int] = None - """Autonomous System Number (ASN) the prefix will be advertised under.""" - - cidr: Optional[str] = None - """IP Prefix in Classless Inter-Domain Routing format.""" - - created_at: Optional[datetime] = None - - description: Optional[str] = None - """Description of the prefix.""" - - loa_document_id: Optional[str] = None - """Identifier for the uploaded LOA document.""" - - modified_at: Optional[datetime] = None - - on_demand_enabled: Optional[bool] = None - """ - Whether advertisement of the prefix to the Internet may be dynamically enabled - or disabled. - """ - - on_demand_locked: Optional[bool] = None - """ - Whether advertisement status of the prefix is locked, meaning it cannot be - changed. - """ diff --git a/src/cloudflare/types/addressing/prefix.py b/src/cloudflare/types/addressing/prefix.py new file mode 100644 index 00000000000..9dd12947704 --- /dev/null +++ b/src/cloudflare/types/addressing/prefix.py @@ -0,0 +1,59 @@ +# 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__ = ["Prefix"] + + +class Prefix(BaseModel): + id: Optional[str] = None + """Identifier""" + + account_id: Optional[str] = None + """Identifier""" + + advertised: Optional[bool] = None + """Prefix advertisement status to the Internet. + + This field is only not 'null' if on demand is enabled. + """ + + advertised_modified_at: Optional[datetime] = None + """Last time the advertisement status was changed. + + This field is only not 'null' if on demand is enabled. + """ + + approved: Optional[str] = None + """Approval state of the prefix (P = pending, V = active).""" + + asn: Optional[int] = None + """Autonomous System Number (ASN) the prefix will be advertised under.""" + + cidr: Optional[str] = None + """IP Prefix in Classless Inter-Domain Routing format.""" + + created_at: Optional[datetime] = None + + description: Optional[str] = None + """Description of the prefix.""" + + loa_document_id: Optional[str] = None + """Identifier for the uploaded LOA document.""" + + modified_at: Optional[datetime] = None + + on_demand_enabled: Optional[bool] = None + """ + Whether advertisement of the prefix to the Internet may be dynamically enabled + or disabled. + """ + + on_demand_locked: Optional[bool] = None + """ + Whether advertisement status of the prefix is locked, meaning it cannot be + changed. + """ diff --git a/src/cloudflare/types/addressing/prefix_delete_params.py b/src/cloudflare/types/addressing/prefix_delete_params.py new file mode 100644 index 00000000000..b8f426f6d43 --- /dev/null +++ b/src/cloudflare/types/addressing/prefix_delete_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__ = ["PrefixDeleteParams"] + + +class PrefixDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/prefix_delete_response.py b/src/cloudflare/types/addressing/prefix_delete_response.py index cf2acba9231..333f820274b 100644 --- a/src/cloudflare/types/addressing/prefix_delete_response.py +++ b/src/cloudflare/types/addressing/prefix_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["PrefixDeleteResponse"] -PrefixDeleteResponse = Union[List[object], str, object, None] +PrefixDeleteResponse = List[object] diff --git a/src/cloudflare/types/addressing/prefixes/__init__.py b/src/cloudflare/types/addressing/prefixes/__init__.py index 9239415391d..220f1b64757 100644 --- a/src/cloudflare/types/addressing/prefixes/__init__.py +++ b/src/cloudflare/types/addressing/prefixes/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from .delegations import Delegations as Delegations from .delegation_create_params import DelegationCreateParams as DelegationCreateParams +from .delegation_delete_params import DelegationDeleteParams as DelegationDeleteParams from .delegation_delete_response import DelegationDeleteResponse as DelegationDeleteResponse -from .addressing_ipam_delegations import AddressingIpamDelegations as AddressingIpamDelegations diff --git a/src/cloudflare/types/addressing/prefixes/addressing_ipam_delegations.py b/src/cloudflare/types/addressing/prefixes/addressing_ipam_delegations.py deleted file mode 100644 index a60c2ff07a3..00000000000 --- a/src/cloudflare/types/addressing/prefixes/addressing_ipam_delegations.py +++ /dev/null @@ -1,26 +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__ = ["AddressingIpamDelegations"] - - -class AddressingIpamDelegations(BaseModel): - id: Optional[str] = None - """Delegation identifier tag.""" - - cidr: Optional[str] = None - """IP Prefix in Classless Inter-Domain Routing format.""" - - created_at: Optional[datetime] = None - - delegated_account_id: Optional[str] = None - """Account identifier for the account to which prefix is being delegated.""" - - modified_at: Optional[datetime] = None - - parent_prefix_id: Optional[str] = None - """Identifier""" diff --git a/src/cloudflare/types/addressing/prefixes/bgp/__init__.py b/src/cloudflare/types/addressing/prefixes/bgp/__init__.py index 6e1aa204e26..6406cdc7c26 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/__init__.py +++ b/src/cloudflare/types/addressing/prefixes/bgp/__init__.py @@ -2,11 +2,12 @@ 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 .service_binding_param import ServiceBindingParam as ServiceBindingParam from .binding_delete_response import BindingDeleteResponse as BindingDeleteResponse -from .addressing_service_binding import AddressingServiceBinding as AddressingServiceBinding -from .addressing_ipam_bgp_prefixes import AddressingIpamBGPPrefixes as AddressingIpamBGPPrefixes diff --git a/src/cloudflare/types/addressing/prefixes/bgp/addressing_ipam_bgp_prefixes.py b/src/cloudflare/types/addressing/prefixes/bgp/addressing_ipam_bgp_prefixes.py deleted file mode 100644 index a934a70a4c8..00000000000 --- a/src/cloudflare/types/addressing/prefixes/bgp/addressing_ipam_bgp_prefixes.py +++ /dev/null @@ -1,67 +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__ = ["AddressingIpamBGPPrefixes", "BGPSignalOpts", "OnDemand"] - - -class BGPSignalOpts(BaseModel): - enabled: Optional[bool] = None - """ - Whether control of advertisement of the prefix to the Internet is enabled to be - performed via BGP signal - """ - - modified_at: Optional[datetime] = None - """Last time BGP signaling control was toggled. - - This field is null if BGP signaling has never been enabled. - """ - - -class OnDemand(BaseModel): - advertised: Optional[bool] = None - """Prefix advertisement status to the Internet. - - This field is only not 'null' if on demand is enabled. - """ - - advertised_modified_at: Optional[datetime] = None - """Last time the advertisement status was changed. - - This field is only not 'null' if on demand is enabled. - """ - - on_demand_enabled: Optional[bool] = None - """ - Whether advertisement of the prefix to the Internet may be dynamically enabled - or disabled. - """ - - on_demand_locked: Optional[bool] = None - """ - Whether advertisement status of the prefix is locked, meaning it cannot be - changed. - """ - - -class AddressingIpamBGPPrefixes(BaseModel): - id: Optional[str] = None - """Identifier""" - - asn: Optional[int] = None - """Autonomous System Number (ASN) the prefix will be advertised under.""" - - bgp_signal_opts: Optional[BGPSignalOpts] = None - - cidr: Optional[str] = None - """IP Prefix in Classless Inter-Domain Routing format.""" - - created_at: Optional[datetime] = None - - modified_at: Optional[datetime] = None - - on_demand: Optional[OnDemand] = None diff --git a/src/cloudflare/types/addressing/prefixes/bgp/addressing_service_binding.py b/src/cloudflare/types/addressing/prefixes/bgp/addressing_service_binding.py deleted file mode 100644 index 9b1317efb32..00000000000 --- a/src/cloudflare/types/addressing/prefixes/bgp/addressing_service_binding.py +++ /dev/null @@ -1,33 +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__ = ["AddressingServiceBinding", "Provisioning"] - - -class Provisioning(BaseModel): - state: Optional[Literal["provisioning", "active"]] = None - """ - When a binding has been deployed to a majority of Cloudflare datacenters, the - binding will become active and can be used with its associated service. - """ - - -class AddressingServiceBinding(BaseModel): - id: Optional[str] = None - """Identifier""" - - cidr: Optional[str] = None - """IP Prefix in Classless Inter-Domain Routing format.""" - - provisioning: Optional[Provisioning] = None - """Status of a Service Binding's deployment to the Cloudflare network""" - - service_id: Optional[str] = None - """Identifier""" - - service_name: Optional[str] = None - """Name of a service running on the Cloudflare network""" diff --git a/src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py b/src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py new file mode 100644 index 00000000000..d9eecdf9d89 --- /dev/null +++ b/src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py @@ -0,0 +1,67 @@ +# 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__ = ["BGPPrefix", "BGPSignalOpts", "OnDemand"] + + +class BGPSignalOpts(BaseModel): + enabled: Optional[bool] = None + """ + Whether control of advertisement of the prefix to the Internet is enabled to be + performed via BGP signal + """ + + modified_at: Optional[datetime] = None + """Last time BGP signaling control was toggled. + + This field is null if BGP signaling has never been enabled. + """ + + +class OnDemand(BaseModel): + advertised: Optional[bool] = None + """Prefix advertisement status to the Internet. + + This field is only not 'null' if on demand is enabled. + """ + + advertised_modified_at: Optional[datetime] = None + """Last time the advertisement status was changed. + + This field is only not 'null' if on demand is enabled. + """ + + on_demand_enabled: Optional[bool] = None + """ + Whether advertisement of the prefix to the Internet may be dynamically enabled + or disabled. + """ + + on_demand_locked: Optional[bool] = None + """ + Whether advertisement status of the prefix is locked, meaning it cannot be + changed. + """ + + +class BGPPrefix(BaseModel): + id: Optional[str] = None + """Identifier""" + + asn: Optional[int] = None + """Autonomous System Number (ASN) the prefix will be advertised under.""" + + bgp_signal_opts: Optional[BGPSignalOpts] = None + + cidr: Optional[str] = None + """IP Prefix in Classless Inter-Domain Routing format.""" + + created_at: Optional[datetime] = None + + modified_at: Optional[datetime] = None + + on_demand: Optional[OnDemand] = None diff --git a/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py b/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py index e2afa483e21..9746074b34a 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py +++ b/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ....._models import BaseModel +from ....shared.response_info import ResponseInfo __all__ = ["BindingDeleteResponse"] -BindingDeleteResponse = Union[List[object], str, object] + +class BindingDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/addressing/prefixes/bgp/service_binding.py b/src/cloudflare/types/addressing/prefixes/bgp/service_binding.py new file mode 100644 index 00000000000..505f89b7c2e --- /dev/null +++ b/src/cloudflare/types/addressing/prefixes/bgp/service_binding.py @@ -0,0 +1,33 @@ +# 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__ = ["ServiceBinding", "Provisioning"] + + +class Provisioning(BaseModel): + state: Optional[Literal["provisioning", "active"]] = None + """ + When a binding has been deployed to a majority of Cloudflare datacenters, the + binding will become active and can be used with its associated service. + """ + + +class ServiceBinding(BaseModel): + id: Optional[str] = None + """Identifier""" + + cidr: Optional[str] = None + """IP Prefix in Classless Inter-Domain Routing format.""" + + provisioning: Optional[Provisioning] = None + """Status of a Service Binding's deployment to the Cloudflare network""" + + service_id: Optional[str] = None + """Identifier""" + + service_name: Optional[str] = None + """Name of a service running on the Cloudflare network""" diff --git a/src/cloudflare/types/addressing/prefixes/bgp/service_binding_param.py b/src/cloudflare/types/addressing/prefixes/bgp/service_binding_param.py new file mode 100644 index 00000000000..3dd61ede1cb --- /dev/null +++ b/src/cloudflare/types/addressing/prefixes/bgp/service_binding_param.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 Literal, TypedDict + +__all__ = ["ServiceBindingParam", "Provisioning"] + + +class Provisioning(TypedDict, total=False): + state: Literal["provisioning", "active"] + """ + When a binding has been deployed to a majority of Cloudflare datacenters, the + binding will become active and can be used with its associated service. + """ + + +class ServiceBindingParam(TypedDict, total=False): + cidr: str + """IP Prefix in Classless Inter-Domain Routing format.""" + + provisioning: Provisioning + """Status of a Service Binding's deployment to the Cloudflare network""" + + service_id: str + """Identifier""" + + service_name: str + """Name of a service running on the Cloudflare network""" diff --git a/src/cloudflare/types/addressing/prefixes/delegation_delete_params.py b/src/cloudflare/types/addressing/prefixes/delegation_delete_params.py new file mode 100644 index 00000000000..f55e7392304 --- /dev/null +++ b/src/cloudflare/types/addressing/prefixes/delegation_delete_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__ = ["DelegationDeleteParams"] + + +class DelegationDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + prefix_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/addressing/prefixes/delegations.py b/src/cloudflare/types/addressing/prefixes/delegations.py new file mode 100644 index 00000000000..8a2d2d8fea8 --- /dev/null +++ b/src/cloudflare/types/addressing/prefixes/delegations.py @@ -0,0 +1,26 @@ +# 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__ = ["Delegations"] + + +class Delegations(BaseModel): + id: Optional[str] = None + """Delegation identifier tag.""" + + cidr: Optional[str] = None + """IP Prefix in Classless Inter-Domain Routing format.""" + + created_at: Optional[datetime] = None + + delegated_account_id: Optional[str] = None + """Account identifier for the account to which prefix is being delegated.""" + + modified_at: Optional[datetime] = None + + parent_prefix_id: Optional[str] = None + """Identifier""" diff --git a/src/cloudflare/types/alerting/__init__.py b/src/cloudflare/types/alerting/__init__.py index 50de6d3c5e7..72f0b44455d 100644 --- a/src/cloudflare/types/alerting/__init__.py +++ b/src/cloudflare/types/alerting/__init__.py @@ -2,9 +2,14 @@ from __future__ import annotations -from .alerting_history import AlertingHistory as AlertingHistory -from .alerting_policies import AlertingPolicies as AlertingPolicies +from .policy import Policy as Policy +from .history import History as History +from .mechanism import Mechanism as Mechanism +from .policy_param import PolicyParam as PolicyParam +from .policy_filter import PolicyFilter as PolicyFilter +from .mechanism_param import MechanismParam as MechanismParam from .history_list_params import HistoryListParams as HistoryListParams +from .policy_filter_param import PolicyFilterParam as PolicyFilterParam from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse diff --git a/src/cloudflare/types/alerting/alerting_history.py b/src/cloudflare/types/alerting/alerting_history.py deleted file mode 100644 index ad3d675fe48..00000000000 --- a/src/cloudflare/types/alerting/alerting_history.py +++ /dev/null @@ -1,41 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["AlertingHistory"] - - -class AlertingHistory(BaseModel): - id: Optional[str] = None - """UUID""" - - alert_body: Optional[str] = None - """Message body included in the notification sent.""" - - alert_type: Optional[str] = None - """Type of notification that has been dispatched.""" - - description: Optional[str] = None - """Description of the notification policy (if present).""" - - mechanism: Optional[str] = None - """The mechanism to which the notification has been dispatched.""" - - mechanism_type: Optional[Literal["email", "pagerduty", "webhook"]] = None - """The type of mechanism to which the notification has been dispatched. - - This can be email/pagerduty/webhook based on the mechanism configured. - """ - - name: Optional[str] = None - """Name of the policy.""" - - policy_id: Optional[str] = None - """The unique identifier of a notification policy""" - - sent: Optional[datetime] = None - """Timestamp of when the notification was dispatched in ISO 8601 format.""" diff --git a/src/cloudflare/types/alerting/alerting_policies.py b/src/cloudflare/types/alerting/alerting_policies.py deleted file mode 100644 index 8c2ed617e3b..00000000000 --- a/src/cloudflare/types/alerting/alerting_policies.py +++ /dev/null @@ -1,241 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["AlertingPolicies", "Filters", "Mechanisms"] - - -class Filters(BaseModel): - actions: Optional[List[str]] = None - """Usage depends on specific alert type""" - - affected_asns: Optional[List[str]] = None - """Used for configuring radar_notification""" - - affected_components: Optional[List[str]] = None - """Used for configuring incident_alert. - - A list of identifiers for each component to monitor. - """ - - affected_locations: Optional[List[str]] = None - """Used for configuring radar_notification""" - - airport_code: Optional[List[str]] = None - """Used for configuring maintenance_event_notification""" - - alert_trigger_preferences: Optional[List[str]] = None - """Usage depends on specific alert type""" - - alert_trigger_preferences_value: Optional[List[Literal["99.0", "98.0", "97.0"]]] = None - """Used for configuring magic_tunnel_health_check_event""" - - enabled: Optional[List[str]] = None - """Used for configuring load_balancing_pool_enablement_alert""" - - environment: Optional[List[str]] = None - """Used for configuring pages_event_alert""" - - event: Optional[List[str]] = None - """Used for configuring pages_event_alert""" - - event_source: Optional[List[str]] = None - """Used for configuring load_balancing_health_alert""" - - event_type: Optional[List[str]] = None - """Usage depends on specific alert type""" - - group_by: Optional[List[str]] = None - """Usage depends on specific alert type""" - - health_check_id: Optional[List[str]] = None - """Used for configuring health_check_status_notification""" - - incident_impact: Optional[ - List[ - Literal[ - "INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL" - ] - ] - ] = None - """Used for configuring incident_alert""" - - input_id: Optional[List[str]] = None - """Used for configuring stream_live_notifications""" - - limit: Optional[List[str]] = None - """Used for configuring billing_usage_alert""" - - logo_tag: Optional[List[str]] = None - """Used for configuring logo_match_alert""" - - megabits_per_second: Optional[List[str]] = None - """Used for configuring advanced_ddos_attack_l4_alert""" - - new_health: Optional[List[str]] = None - """Used for configuring load_balancing_health_alert""" - - new_status: Optional[List[str]] = None - """Used for configuring tunnel_health_event""" - - packets_per_second: Optional[List[str]] = None - """Used for configuring advanced_ddos_attack_l4_alert""" - - pool_id: Optional[List[str]] = None - """Usage depends on specific alert type""" - - product: Optional[List[str]] = None - """Used for configuring billing_usage_alert""" - - project_id: Optional[List[str]] = None - """Used for configuring pages_event_alert""" - - protocol: Optional[List[str]] = None - """Used for configuring advanced_ddos_attack_l4_alert""" - - query_tag: Optional[List[str]] = None - """Usage depends on specific alert type""" - - requests_per_second: Optional[List[str]] = None - """Used for configuring advanced_ddos_attack_l7_alert""" - - selectors: Optional[List[str]] = None - """Usage depends on specific alert type""" - - services: Optional[List[str]] = None - """Used for configuring clickhouse_alert_fw_ent_anomaly""" - - slo: Optional[List[str]] = None - """Usage depends on specific alert type""" - - status: Optional[List[str]] = None - """Used for configuring health_check_status_notification""" - - target_hostname: Optional[List[str]] = None - """Used for configuring advanced_ddos_attack_l7_alert""" - - target_ip: Optional[List[str]] = None - """Used for configuring advanced_ddos_attack_l4_alert""" - - target_zone_name: Optional[List[str]] = None - """Used for configuring advanced_ddos_attack_l7_alert""" - - traffic_exclusions: Optional[List[Literal["security_events"]]] = None - """Used for configuring traffic_anomalies_alert""" - - tunnel_id: Optional[List[str]] = None - """Used for configuring tunnel_health_event""" - - tunnel_name: Optional[List[str]] = None - """Used for configuring magic_tunnel_health_check_event""" - - where: Optional[List[str]] = None - """Usage depends on specific alert type""" - - zones: Optional[List[str]] = None - """Usage depends on specific alert type""" - - -class Mechanisms(BaseModel): - id: Union[str, str, None] = None - """UUID""" - - -class AlertingPolicies(BaseModel): - id: Optional[str] = None - """The unique identifier of a notification policy""" - - alert_type: Optional[ - Literal[ - "access_custom_certificate_expiration_type", - "advanced_ddos_attack_l4_alert", - "advanced_ddos_attack_l7_alert", - "advanced_http_alert_error", - "bgp_hijack_notification", - "billing_usage_alert", - "block_notification_block_removed", - "block_notification_new_block", - "block_notification_review_rejected", - "brand_protection_alert", - "brand_protection_digest", - "clickhouse_alert_fw_anomaly", - "clickhouse_alert_fw_ent_anomaly", - "custom_ssl_certificate_event_type", - "dedicated_ssl_certificate_event_type", - "dos_attack_l4", - "dos_attack_l7", - "expiring_service_token_alert", - "failing_logpush_job_disabled_alert", - "fbm_auto_advertisement", - "fbm_dosd_attack", - "fbm_volumetric_attack", - "health_check_status_notification", - "hostname_aop_custom_certificate_expiration_type", - "http_alert_edge_error", - "http_alert_origin_error", - "incident_alert", - "load_balancing_health_alert", - "load_balancing_pool_enablement_alert", - "logo_match_alert", - "magic_tunnel_health_check_event", - "maintenance_event_notification", - "mtls_certificate_store_certificate_expiration_type", - "pages_event_alert", - "radar_notification", - "real_origin_monitoring", - "scriptmonitor_alert_new_code_change_detections", - "scriptmonitor_alert_new_hosts", - "scriptmonitor_alert_new_malicious_hosts", - "scriptmonitor_alert_new_malicious_scripts", - "scriptmonitor_alert_new_malicious_url", - "scriptmonitor_alert_new_max_length_resource_url", - "scriptmonitor_alert_new_resources", - "secondary_dns_all_primaries_failing", - "secondary_dns_primaries_failing", - "secondary_dns_zone_successfully_updated", - "secondary_dns_zone_validation_warning", - "sentinel_alert", - "stream_live_notifications", - "traffic_anomalies_alert", - "tunnel_health_event", - "tunnel_update_event", - "universal_ssl_event_type", - "web_analytics_metrics_update", - "zone_aop_custom_certificate_expiration_type", - ] - ] = None - """Refers to which event will trigger a Notification dispatch. - - You can use the endpoint to get available alert types which then will give you a - list of possible values. - """ - - created: Optional[datetime] = None - - description: Optional[str] = None - """Optional description for the Notification policy.""" - - enabled: Optional[bool] = None - """Whether or not the Notification policy is enabled.""" - - filters: Optional[Filters] = None - """ - Optional filters that allow you to be alerted only on a subset of events for - that alert type based on some criteria. This is only available for select alert - types. See alert type documentation for more details. - """ - - mechanisms: Optional[Dict[str, List[Mechanisms]]] = None - """List of IDs that will be used when dispatching a notification. - - IDs for email type will be the email address. - """ - - modified: Optional[datetime] = None - - name: Optional[str] = None - """Name of the policy.""" diff --git a/src/cloudflare/types/alerting/destinations/__init__.py b/src/cloudflare/types/alerting/destinations/__init__.py index 720b22c588e..fd61e30e290 100644 --- a/src/cloudflare/types/alerting/destinations/__init__.py +++ b/src/cloudflare/types/alerting/destinations/__init__.py @@ -2,8 +2,8 @@ from __future__ import annotations -from .alerting_webhooks import AlertingWebhooks as AlertingWebhooks -from .alerting_pagerduty import AlertingPagerduty as AlertingPagerduty +from .webhooks import Webhooks as Webhooks +from .pagerduty import Pagerduty as Pagerduty from .eligible_get_response import EligibleGetResponse as EligibleGetResponse from .webhook_create_params import WebhookCreateParams as WebhookCreateParams from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams diff --git a/src/cloudflare/types/alerting/destinations/alerting_pagerduty.py b/src/cloudflare/types/alerting/destinations/alerting_pagerduty.py deleted file mode 100644 index bf3e2bed281..00000000000 --- a/src/cloudflare/types/alerting/destinations/alerting_pagerduty.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__ = ["AlertingPagerduty"] - - -class AlertingPagerduty(BaseModel): - id: Optional[str] = None - """UUID""" - - name: Optional[str] = None - """The name of the pagerduty service.""" diff --git a/src/cloudflare/types/alerting/destinations/alerting_webhooks.py b/src/cloudflare/types/alerting/destinations/alerting_webhooks.py deleted file mode 100644 index a2dc5b27d59..00000000000 --- a/src/cloudflare/types/alerting/destinations/alerting_webhooks.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["AlertingWebhooks"] - - -class AlertingWebhooks(BaseModel): - id: Optional[str] = None - """The unique identifier of a webhook""" - - created_at: Optional[datetime] = None - """Timestamp of when the webhook destination was created.""" - - last_failure: Optional[datetime] = None - """ - Timestamp of the last time an attempt to dispatch a notification to this webhook - failed. - """ - - last_success: Optional[datetime] = None - """ - Timestamp of the last time Cloudflare was able to successfully dispatch a - notification using this webhook. - """ - - name: Optional[str] = None - """The name of the webhook destination. - - This will be included in the request body when you receive a webhook - notification. - """ - - secret: Optional[str] = None - """ - Optional secret that will be passed in the `cf-webhook-auth` header when - dispatching generic webhook notifications or formatted for supported - destinations. Secrets are not returned in any API response body. - """ - - type: Optional[Literal["slack", "generic", "gchat"]] = None - """Type of webhook endpoint.""" - - url: Optional[str] = None - """The POST endpoint to call when dispatching a notification.""" diff --git a/src/cloudflare/types/alerting/destinations/pagerduty.py b/src/cloudflare/types/alerting/destinations/pagerduty.py new file mode 100644 index 00000000000..4996c44d9bc --- /dev/null +++ b/src/cloudflare/types/alerting/destinations/pagerduty.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__ = ["Pagerduty"] + + +class Pagerduty(BaseModel): + id: Optional[str] = None + """UUID""" + + name: Optional[str] = None + """The name of the pagerduty service.""" diff --git a/src/cloudflare/types/alerting/destinations/pagerduty_get_response.py b/src/cloudflare/types/alerting/destinations/pagerduty_get_response.py index 8069af80584..655283d7dbd 100644 --- a/src/cloudflare/types/alerting/destinations/pagerduty_get_response.py +++ b/src/cloudflare/types/alerting/destinations/pagerduty_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .alerting_pagerduty import AlertingPagerduty +from .pagerduty import Pagerduty __all__ = ["PagerdutyGetResponse"] -PagerdutyGetResponse = List[AlertingPagerduty] +PagerdutyGetResponse = List[Pagerduty] diff --git a/src/cloudflare/types/alerting/destinations/webhooks.py b/src/cloudflare/types/alerting/destinations/webhooks.py new file mode 100644 index 00000000000..36fb89342c0 --- /dev/null +++ b/src/cloudflare/types/alerting/destinations/webhooks.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Webhooks"] + + +class Webhooks(BaseModel): + id: Optional[str] = None + """The unique identifier of a webhook""" + + created_at: Optional[datetime] = None + """Timestamp of when the webhook destination was created.""" + + last_failure: Optional[datetime] = None + """ + Timestamp of the last time an attempt to dispatch a notification to this webhook + failed. + """ + + last_success: Optional[datetime] = None + """ + Timestamp of the last time Cloudflare was able to successfully dispatch a + notification using this webhook. + """ + + name: Optional[str] = None + """The name of the webhook destination. + + This will be included in the request body when you receive a webhook + notification. + """ + + secret: Optional[str] = None + """ + Optional secret that will be passed in the `cf-webhook-auth` header when + dispatching generic webhook notifications or formatted for supported + destinations. Secrets are not returned in any API response body. + """ + + type: Optional[Literal["slack", "generic", "gchat"]] = None + """Type of webhook endpoint.""" + + url: Optional[str] = None + """The POST endpoint to call when dispatching a notification.""" diff --git a/src/cloudflare/types/alerting/history.py b/src/cloudflare/types/alerting/history.py new file mode 100644 index 00000000000..15b1b63b5ec --- /dev/null +++ b/src/cloudflare/types/alerting/history.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["History"] + + +class History(BaseModel): + id: Optional[str] = None + """UUID""" + + alert_body: Optional[str] = None + """Message body included in the notification sent.""" + + alert_type: Optional[str] = None + """Type of notification that has been dispatched.""" + + description: Optional[str] = None + """Description of the notification policy (if present).""" + + mechanism: Optional[str] = None + """The mechanism to which the notification has been dispatched.""" + + mechanism_type: Optional[Literal["email", "pagerduty", "webhook"]] = None + """The type of mechanism to which the notification has been dispatched. + + This can be email/pagerduty/webhook based on the mechanism configured. + """ + + name: Optional[str] = None + """Name of the policy.""" + + policy_id: Optional[str] = None + """The unique identifier of a notification policy""" + + sent: Optional[datetime] = None + """Timestamp of when the notification was dispatched in ISO 8601 format.""" diff --git a/src/cloudflare/types/alerting/mechanism.py b/src/cloudflare/types/alerting/mechanism.py new file mode 100644 index 00000000000..583c4b38651 --- /dev/null +++ b/src/cloudflare/types/alerting/mechanism.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union + +from ..._models import BaseModel + +__all__ = ["Mechanism", "MechanismItem"] + + +class MechanismItem(BaseModel): + id: Union[str, str, None] = None + """UUID""" + + +Mechanism = Dict[str, List[MechanismItem]] diff --git a/src/cloudflare/types/alerting/mechanism_param.py b/src/cloudflare/types/alerting/mechanism_param.py new file mode 100644 index 00000000000..7124a33e3b7 --- /dev/null +++ b/src/cloudflare/types/alerting/mechanism_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable +from typing_extensions import TypedDict + +__all__ = ["MechanismParam", "MechanismParamItem"] + + +class MechanismParamItem(TypedDict, total=False): + id: Union[str, str] + """UUID""" + + +MechanismParam = Dict[str, Iterable[MechanismParamItem]] diff --git a/src/cloudflare/types/alerting/policy.py b/src/cloudflare/types/alerting/policy.py new file mode 100644 index 00000000000..6fd5915e74e --- /dev/null +++ b/src/cloudflare/types/alerting/policy.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel +from .mechanism import Mechanism +from .policy_filter import PolicyFilter + +__all__ = ["Policy"] + + +class Policy(BaseModel): + id: Optional[str] = None + """The unique identifier of a notification policy""" + + alert_type: Optional[ + Literal[ + "access_custom_certificate_expiration_type", + "advanced_ddos_attack_l4_alert", + "advanced_ddos_attack_l7_alert", + "advanced_http_alert_error", + "bgp_hijack_notification", + "billing_usage_alert", + "block_notification_block_removed", + "block_notification_new_block", + "block_notification_review_rejected", + "brand_protection_alert", + "brand_protection_digest", + "clickhouse_alert_fw_anomaly", + "clickhouse_alert_fw_ent_anomaly", + "custom_ssl_certificate_event_type", + "dedicated_ssl_certificate_event_type", + "dos_attack_l4", + "dos_attack_l7", + "expiring_service_token_alert", + "failing_logpush_job_disabled_alert", + "fbm_auto_advertisement", + "fbm_dosd_attack", + "fbm_volumetric_attack", + "health_check_status_notification", + "hostname_aop_custom_certificate_expiration_type", + "http_alert_edge_error", + "http_alert_origin_error", + "incident_alert", + "load_balancing_health_alert", + "load_balancing_pool_enablement_alert", + "logo_match_alert", + "magic_tunnel_health_check_event", + "maintenance_event_notification", + "mtls_certificate_store_certificate_expiration_type", + "pages_event_alert", + "radar_notification", + "real_origin_monitoring", + "scriptmonitor_alert_new_code_change_detections", + "scriptmonitor_alert_new_hosts", + "scriptmonitor_alert_new_malicious_hosts", + "scriptmonitor_alert_new_malicious_scripts", + "scriptmonitor_alert_new_malicious_url", + "scriptmonitor_alert_new_max_length_resource_url", + "scriptmonitor_alert_new_resources", + "secondary_dns_all_primaries_failing", + "secondary_dns_primaries_failing", + "secondary_dns_zone_successfully_updated", + "secondary_dns_zone_validation_warning", + "sentinel_alert", + "stream_live_notifications", + "traffic_anomalies_alert", + "tunnel_health_event", + "tunnel_update_event", + "universal_ssl_event_type", + "web_analytics_metrics_update", + "zone_aop_custom_certificate_expiration_type", + ] + ] = None + """Refers to which event will trigger a Notification dispatch. + + You can use the endpoint to get available alert types which then will give you a + list of possible values. + """ + + created: Optional[datetime] = None + + description: Optional[str] = None + """Optional description for the Notification policy.""" + + enabled: Optional[bool] = None + """Whether or not the Notification policy is enabled.""" + + filters: Optional[PolicyFilter] = None + """ + Optional filters that allow you to be alerted only on a subset of events for + that alert type based on some criteria. This is only available for select alert + types. See alert type documentation for more details. + """ + + mechanisms: Optional[Mechanism] = None + """List of IDs that will be used when dispatching a notification. + + IDs for email type will be the email address. + """ + + modified: Optional[datetime] = None + + name: Optional[str] = None + """Name of the policy.""" diff --git a/src/cloudflare/types/alerting/policy_create_params.py b/src/cloudflare/types/alerting/policy_create_params.py index 375514ca5ed..6f366cbf980 100644 --- a/src/cloudflare/types/alerting/policy_create_params.py +++ b/src/cloudflare/types/alerting/policy_create_params.py @@ -2,10 +2,12 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["PolicyCreateParams", "Mechanisms", "Filters"] +from .mechanism_param import MechanismParam +from .policy_filter_param import PolicyFilterParam + +__all__ = ["PolicyCreateParams"] class PolicyCreateParams(TypedDict, total=False): @@ -80,7 +82,7 @@ class PolicyCreateParams(TypedDict, total=False): enabled: Required[bool] """Whether or not the Notification policy is enabled.""" - mechanisms: Required[Dict[str, Iterable[Mechanisms]]] + mechanisms: Required[MechanismParam] """List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. @@ -92,141 +94,9 @@ class PolicyCreateParams(TypedDict, total=False): description: str """Optional description for the Notification policy.""" - filters: Filters + filters: PolicyFilterParam """ Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. """ - - -class Mechanisms(TypedDict, total=False): - id: Union[str, str] - """UUID""" - - -class Filters(TypedDict, total=False): - actions: List[str] - """Usage depends on specific alert type""" - - affected_asns: List[str] - """Used for configuring radar_notification""" - - affected_components: List[str] - """Used for configuring incident_alert. - - A list of identifiers for each component to monitor. - """ - - affected_locations: List[str] - """Used for configuring radar_notification""" - - airport_code: List[str] - """Used for configuring maintenance_event_notification""" - - alert_trigger_preferences: List[str] - """Usage depends on specific alert type""" - - alert_trigger_preferences_value: List[Literal["99.0", "98.0", "97.0"]] - """Used for configuring magic_tunnel_health_check_event""" - - enabled: List[str] - """Used for configuring load_balancing_pool_enablement_alert""" - - environment: List[str] - """Used for configuring pages_event_alert""" - - event: List[str] - """Used for configuring pages_event_alert""" - - event_source: List[str] - """Used for configuring load_balancing_health_alert""" - - event_type: List[str] - """Usage depends on specific alert type""" - - group_by: List[str] - """Usage depends on specific alert type""" - - health_check_id: List[str] - """Used for configuring health_check_status_notification""" - - incident_impact: List[ - Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"] - ] - """Used for configuring incident_alert""" - - input_id: List[str] - """Used for configuring stream_live_notifications""" - - limit: List[str] - """Used for configuring billing_usage_alert""" - - logo_tag: List[str] - """Used for configuring logo_match_alert""" - - megabits_per_second: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - new_health: List[str] - """Used for configuring load_balancing_health_alert""" - - new_status: List[str] - """Used for configuring tunnel_health_event""" - - packets_per_second: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - pool_id: List[str] - """Usage depends on specific alert type""" - - product: List[str] - """Used for configuring billing_usage_alert""" - - project_id: List[str] - """Used for configuring pages_event_alert""" - - protocol: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - query_tag: List[str] - """Usage depends on specific alert type""" - - requests_per_second: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - selectors: List[str] - """Usage depends on specific alert type""" - - services: List[str] - """Used for configuring clickhouse_alert_fw_ent_anomaly""" - - slo: List[str] - """Usage depends on specific alert type""" - - status: List[str] - """Used for configuring health_check_status_notification""" - - target_hostname: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - target_ip: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - target_zone_name: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - traffic_exclusions: List[Literal["security_events"]] - """Used for configuring traffic_anomalies_alert""" - - tunnel_id: List[str] - """Used for configuring tunnel_health_event""" - - tunnel_name: List[str] - """Used for configuring magic_tunnel_health_check_event""" - - where: List[str] - """Usage depends on specific alert type""" - - zones: List[str] - """Usage depends on specific alert type""" diff --git a/src/cloudflare/types/alerting/policy_filter.py b/src/cloudflare/types/alerting/policy_filter.py new file mode 100644 index 00000000000..1206dbd5725 --- /dev/null +++ b/src/cloudflare/types/alerting/policy_filter.py @@ -0,0 +1,139 @@ +# 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__ = ["PolicyFilter"] + + +class PolicyFilter(BaseModel): + actions: Optional[List[str]] = None + """Usage depends on specific alert type""" + + affected_asns: Optional[List[str]] = None + """Used for configuring radar_notification""" + + affected_components: Optional[List[str]] = None + """Used for configuring incident_alert. + + A list of identifiers for each component to monitor. + """ + + affected_locations: Optional[List[str]] = None + """Used for configuring radar_notification""" + + airport_code: Optional[List[str]] = None + """Used for configuring maintenance_event_notification""" + + alert_trigger_preferences: Optional[List[str]] = None + """Usage depends on specific alert type""" + + alert_trigger_preferences_value: Optional[List[Literal["99.0", "98.0", "97.0"]]] = None + """Used for configuring magic_tunnel_health_check_event""" + + enabled: Optional[List[str]] = None + """Used for configuring load_balancing_pool_enablement_alert""" + + environment: Optional[List[str]] = None + """Used for configuring pages_event_alert""" + + event: Optional[List[str]] = None + """Used for configuring pages_event_alert""" + + event_source: Optional[List[str]] = None + """Used for configuring load_balancing_health_alert""" + + event_type: Optional[List[str]] = None + """Usage depends on specific alert type""" + + group_by: Optional[List[str]] = None + """Usage depends on specific alert type""" + + health_check_id: Optional[List[str]] = None + """Used for configuring health_check_status_notification""" + + incident_impact: Optional[ + List[ + Literal[ + "INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL" + ] + ] + ] = None + """Used for configuring incident_alert""" + + input_id: Optional[List[str]] = None + """Used for configuring stream_live_notifications""" + + limit: Optional[List[str]] = None + """Used for configuring billing_usage_alert""" + + logo_tag: Optional[List[str]] = None + """Used for configuring logo_match_alert""" + + megabits_per_second: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l4_alert""" + + new_health: Optional[List[str]] = None + """Used for configuring load_balancing_health_alert""" + + new_status: Optional[List[str]] = None + """Used for configuring tunnel_health_event""" + + packets_per_second: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l4_alert""" + + pool_id: Optional[List[str]] = None + """Usage depends on specific alert type""" + + product: Optional[List[str]] = None + """Used for configuring billing_usage_alert""" + + project_id: Optional[List[str]] = None + """Used for configuring pages_event_alert""" + + protocol: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l4_alert""" + + query_tag: Optional[List[str]] = None + """Usage depends on specific alert type""" + + requests_per_second: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l7_alert""" + + selectors: Optional[List[str]] = None + """Usage depends on specific alert type""" + + services: Optional[List[str]] = None + """Used for configuring clickhouse_alert_fw_ent_anomaly""" + + slo: Optional[List[str]] = None + """Usage depends on specific alert type""" + + status: Optional[List[str]] = None + """Used for configuring health_check_status_notification""" + + target_hostname: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l7_alert""" + + target_ip: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l4_alert""" + + target_zone_name: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l7_alert""" + + traffic_exclusions: Optional[List[Literal["security_events"]]] = None + """Used for configuring traffic_anomalies_alert""" + + tunnel_id: Optional[List[str]] = None + """Used for configuring tunnel_health_event""" + + tunnel_name: Optional[List[str]] = None + """Used for configuring magic_tunnel_health_check_event""" + + where: Optional[List[str]] = None + """Usage depends on specific alert type""" + + zones: Optional[List[str]] = None + """Usage depends on specific alert type""" diff --git a/src/cloudflare/types/alerting/policy_filter_param.py b/src/cloudflare/types/alerting/policy_filter_param.py new file mode 100644 index 00000000000..bf852b4099d --- /dev/null +++ b/src/cloudflare/types/alerting/policy_filter_param.py @@ -0,0 +1,135 @@ +# 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, TypedDict + +__all__ = ["PolicyFilterParam"] + + +class PolicyFilterParam(TypedDict, total=False): + actions: List[str] + """Usage depends on specific alert type""" + + affected_asns: List[str] + """Used for configuring radar_notification""" + + affected_components: List[str] + """Used for configuring incident_alert. + + A list of identifiers for each component to monitor. + """ + + affected_locations: List[str] + """Used for configuring radar_notification""" + + airport_code: List[str] + """Used for configuring maintenance_event_notification""" + + alert_trigger_preferences: List[str] + """Usage depends on specific alert type""" + + alert_trigger_preferences_value: List[Literal["99.0", "98.0", "97.0"]] + """Used for configuring magic_tunnel_health_check_event""" + + enabled: List[str] + """Used for configuring load_balancing_pool_enablement_alert""" + + environment: List[str] + """Used for configuring pages_event_alert""" + + event: List[str] + """Used for configuring pages_event_alert""" + + event_source: List[str] + """Used for configuring load_balancing_health_alert""" + + event_type: List[str] + """Usage depends on specific alert type""" + + group_by: List[str] + """Usage depends on specific alert type""" + + health_check_id: List[str] + """Used for configuring health_check_status_notification""" + + incident_impact: List[ + Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"] + ] + """Used for configuring incident_alert""" + + input_id: List[str] + """Used for configuring stream_live_notifications""" + + limit: List[str] + """Used for configuring billing_usage_alert""" + + logo_tag: List[str] + """Used for configuring logo_match_alert""" + + megabits_per_second: List[str] + """Used for configuring advanced_ddos_attack_l4_alert""" + + new_health: List[str] + """Used for configuring load_balancing_health_alert""" + + new_status: List[str] + """Used for configuring tunnel_health_event""" + + packets_per_second: List[str] + """Used for configuring advanced_ddos_attack_l4_alert""" + + pool_id: List[str] + """Usage depends on specific alert type""" + + product: List[str] + """Used for configuring billing_usage_alert""" + + project_id: List[str] + """Used for configuring pages_event_alert""" + + protocol: List[str] + """Used for configuring advanced_ddos_attack_l4_alert""" + + query_tag: List[str] + """Usage depends on specific alert type""" + + requests_per_second: List[str] + """Used for configuring advanced_ddos_attack_l7_alert""" + + selectors: List[str] + """Usage depends on specific alert type""" + + services: List[str] + """Used for configuring clickhouse_alert_fw_ent_anomaly""" + + slo: List[str] + """Usage depends on specific alert type""" + + status: List[str] + """Used for configuring health_check_status_notification""" + + target_hostname: List[str] + """Used for configuring advanced_ddos_attack_l7_alert""" + + target_ip: List[str] + """Used for configuring advanced_ddos_attack_l4_alert""" + + target_zone_name: List[str] + """Used for configuring advanced_ddos_attack_l7_alert""" + + traffic_exclusions: List[Literal["security_events"]] + """Used for configuring traffic_anomalies_alert""" + + tunnel_id: List[str] + """Used for configuring tunnel_health_event""" + + tunnel_name: List[str] + """Used for configuring magic_tunnel_health_check_event""" + + where: List[str] + """Usage depends on specific alert type""" + + zones: List[str] + """Usage depends on specific alert type""" diff --git a/src/cloudflare/types/alerting/policy_param.py b/src/cloudflare/types/alerting/policy_param.py new file mode 100644 index 00000000000..fc24717f614 --- /dev/null +++ b/src/cloudflare/types/alerting/policy_param.py @@ -0,0 +1,97 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .mechanism_param import MechanismParam +from .policy_filter_param import PolicyFilterParam + +__all__ = ["PolicyParam"] + + +class PolicyParam(TypedDict, total=False): + alert_type: Literal[ + "access_custom_certificate_expiration_type", + "advanced_ddos_attack_l4_alert", + "advanced_ddos_attack_l7_alert", + "advanced_http_alert_error", + "bgp_hijack_notification", + "billing_usage_alert", + "block_notification_block_removed", + "block_notification_new_block", + "block_notification_review_rejected", + "brand_protection_alert", + "brand_protection_digest", + "clickhouse_alert_fw_anomaly", + "clickhouse_alert_fw_ent_anomaly", + "custom_ssl_certificate_event_type", + "dedicated_ssl_certificate_event_type", + "dos_attack_l4", + "dos_attack_l7", + "expiring_service_token_alert", + "failing_logpush_job_disabled_alert", + "fbm_auto_advertisement", + "fbm_dosd_attack", + "fbm_volumetric_attack", + "health_check_status_notification", + "hostname_aop_custom_certificate_expiration_type", + "http_alert_edge_error", + "http_alert_origin_error", + "incident_alert", + "load_balancing_health_alert", + "load_balancing_pool_enablement_alert", + "logo_match_alert", + "magic_tunnel_health_check_event", + "maintenance_event_notification", + "mtls_certificate_store_certificate_expiration_type", + "pages_event_alert", + "radar_notification", + "real_origin_monitoring", + "scriptmonitor_alert_new_code_change_detections", + "scriptmonitor_alert_new_hosts", + "scriptmonitor_alert_new_malicious_hosts", + "scriptmonitor_alert_new_malicious_scripts", + "scriptmonitor_alert_new_malicious_url", + "scriptmonitor_alert_new_max_length_resource_url", + "scriptmonitor_alert_new_resources", + "secondary_dns_all_primaries_failing", + "secondary_dns_primaries_failing", + "secondary_dns_zone_successfully_updated", + "secondary_dns_zone_validation_warning", + "sentinel_alert", + "stream_live_notifications", + "traffic_anomalies_alert", + "tunnel_health_event", + "tunnel_update_event", + "universal_ssl_event_type", + "web_analytics_metrics_update", + "zone_aop_custom_certificate_expiration_type", + ] + """Refers to which event will trigger a Notification dispatch. + + You can use the endpoint to get available alert types which then will give you a + list of possible values. + """ + + description: str + """Optional description for the Notification policy.""" + + enabled: bool + """Whether or not the Notification policy is enabled.""" + + filters: PolicyFilterParam + """ + Optional filters that allow you to be alerted only on a subset of events for + that alert type based on some criteria. This is only available for select alert + types. See alert type documentation for more details. + """ + + mechanisms: MechanismParam + """List of IDs that will be used when dispatching a notification. + + IDs for email type will be the email address. + """ + + name: str + """Name of the policy.""" diff --git a/src/cloudflare/types/alerting/policy_update_params.py b/src/cloudflare/types/alerting/policy_update_params.py index 13e1d774ea4..ff4d371d9f3 100644 --- a/src/cloudflare/types/alerting/policy_update_params.py +++ b/src/cloudflare/types/alerting/policy_update_params.py @@ -2,10 +2,12 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["PolicyUpdateParams", "Filters", "Mechanisms"] +from .mechanism_param import MechanismParam +from .policy_filter_param import PolicyFilterParam + +__all__ = ["PolicyUpdateParams"] class PolicyUpdateParams(TypedDict, total=False): @@ -81,14 +83,14 @@ class PolicyUpdateParams(TypedDict, total=False): enabled: bool """Whether or not the Notification policy is enabled.""" - filters: Filters + filters: PolicyFilterParam """ Optional filters that allow you to be alerted only on a subset of events for that alert type based on some criteria. This is only available for select alert types. See alert type documentation for more details. """ - mechanisms: Dict[str, Iterable[Mechanisms]] + mechanisms: MechanismParam """List of IDs that will be used when dispatching a notification. IDs for email type will be the email address. @@ -96,135 +98,3 @@ class PolicyUpdateParams(TypedDict, total=False): name: str """Name of the policy.""" - - -class Filters(TypedDict, total=False): - actions: List[str] - """Usage depends on specific alert type""" - - affected_asns: List[str] - """Used for configuring radar_notification""" - - affected_components: List[str] - """Used for configuring incident_alert. - - A list of identifiers for each component to monitor. - """ - - affected_locations: List[str] - """Used for configuring radar_notification""" - - airport_code: List[str] - """Used for configuring maintenance_event_notification""" - - alert_trigger_preferences: List[str] - """Usage depends on specific alert type""" - - alert_trigger_preferences_value: List[Literal["99.0", "98.0", "97.0"]] - """Used for configuring magic_tunnel_health_check_event""" - - enabled: List[str] - """Used for configuring load_balancing_pool_enablement_alert""" - - environment: List[str] - """Used for configuring pages_event_alert""" - - event: List[str] - """Used for configuring pages_event_alert""" - - event_source: List[str] - """Used for configuring load_balancing_health_alert""" - - event_type: List[str] - """Usage depends on specific alert type""" - - group_by: List[str] - """Usage depends on specific alert type""" - - health_check_id: List[str] - """Used for configuring health_check_status_notification""" - - incident_impact: List[ - Literal["INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL"] - ] - """Used for configuring incident_alert""" - - input_id: List[str] - """Used for configuring stream_live_notifications""" - - limit: List[str] - """Used for configuring billing_usage_alert""" - - logo_tag: List[str] - """Used for configuring logo_match_alert""" - - megabits_per_second: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - new_health: List[str] - """Used for configuring load_balancing_health_alert""" - - new_status: List[str] - """Used for configuring tunnel_health_event""" - - packets_per_second: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - pool_id: List[str] - """Usage depends on specific alert type""" - - product: List[str] - """Used for configuring billing_usage_alert""" - - project_id: List[str] - """Used for configuring pages_event_alert""" - - protocol: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - query_tag: List[str] - """Usage depends on specific alert type""" - - requests_per_second: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - selectors: List[str] - """Usage depends on specific alert type""" - - services: List[str] - """Used for configuring clickhouse_alert_fw_ent_anomaly""" - - slo: List[str] - """Usage depends on specific alert type""" - - status: List[str] - """Used for configuring health_check_status_notification""" - - target_hostname: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - target_ip: List[str] - """Used for configuring advanced_ddos_attack_l4_alert""" - - target_zone_name: List[str] - """Used for configuring advanced_ddos_attack_l7_alert""" - - traffic_exclusions: List[Literal["security_events"]] - """Used for configuring traffic_anomalies_alert""" - - tunnel_id: List[str] - """Used for configuring tunnel_health_event""" - - tunnel_name: List[str] - """Used for configuring magic_tunnel_health_check_event""" - - where: List[str] - """Usage depends on specific alert type""" - - zones: List[str] - """Usage depends on specific alert type""" - - -class Mechanisms(TypedDict, total=False): - id: Union[str, str] - """UUID""" diff --git a/src/cloudflare/types/audit_log_list_response.py b/src/cloudflare/types/audit_log_list_response.py deleted file mode 100644 index 7383de914a3..00000000000 --- a/src/cloudflare/types/audit_log_list_response.py +++ /dev/null @@ -1,80 +0,0 @@ -# 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__ = ["AuditLogListResponse", "Action", "Actor", "Owner", "Resource"] - - -class Action(BaseModel): - result: Optional[bool] = None - """A boolean that indicates if the action attempted was successful.""" - - type: Optional[str] = None - """A short string that describes the action that was performed.""" - - -class Actor(BaseModel): - id: Optional[str] = None - """The ID of the actor that performed the action. - - If a user performed the action, this will be their User ID. - """ - - email: Optional[str] = None - """The email of the user that performed the action.""" - - ip: Optional[str] = None - """The IP address of the request that performed the action.""" - - type: Optional[Literal["user", "admin", "Cloudflare"]] = None - """The type of actor, whether a User, Cloudflare Admin, or an Automated System.""" - - -class Owner(BaseModel): - id: Optional[str] = None - """Identifier""" - - -class Resource(BaseModel): - id: Optional[str] = None - """An identifier for the resource that was affected by the action.""" - - type: Optional[str] = None - """A short string that describes the resource that was affected by the action.""" - - -class AuditLogListResponse(BaseModel): - id: Optional[str] = None - """A string that uniquely identifies the audit log.""" - - action: Optional[Action] = None - - actor: Optional[Actor] = None - - interface: Optional[str] = None - """The source of the event.""" - - metadata: Optional[object] = None - """An object which can lend more context to the action being logged. - - This is a flexible value and varies between different actions. - """ - - new_value: Optional[str] = FieldInfo(alias="newValue", default=None) - """The new value of the resource that was modified.""" - - old_value: Optional[str] = FieldInfo(alias="oldValue", default=None) - """The value of the resource before it was modified.""" - - owner: Optional[Owner] = None - - resource: Optional[Resource] = None - - when: Optional[datetime] = None - """A UTC RFC3339 timestamp that specifies when the action being logged occured.""" diff --git a/src/cloudflare/types/audit_logs/__init__.py b/src/cloudflare/types/audit_logs/__init__.py new file mode 100644 index 00000000000..15fc240320d --- /dev/null +++ b/src/cloudflare/types/audit_logs/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .audit_log_list_params import AuditLogListParams as AuditLogListParams diff --git a/src/cloudflare/types/audit_log_list_params.py b/src/cloudflare/types/audit_logs/audit_log_list_params.py similarity index 98% rename from src/cloudflare/types/audit_log_list_params.py rename to src/cloudflare/types/audit_logs/audit_log_list_params.py index 135c9fa0f2f..3ad70b082c0 100644 --- a/src/cloudflare/types/audit_log_list_params.py +++ b/src/cloudflare/types/audit_logs/audit_log_list_params.py @@ -6,7 +6,7 @@ from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypedDict -from .._utils import PropertyInfo +from ..._utils import PropertyInfo __all__ = ["AuditLogListParams", "Action", "Actor", "Zone"] diff --git a/src/cloudflare/types/bot_management/__init__.py b/src/cloudflare/types/bot_management/__init__.py new file mode 100644 index 00000000000..f7225855fc6 --- /dev/null +++ b/src/cloudflare/types/bot_management/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .subscription_configuration import SubscriptionConfiguration as SubscriptionConfiguration +from .bot_management_get_response import BotManagementGetResponse as BotManagementGetResponse +from .bot_fight_mode_configuration import BotFightModeConfiguration as BotFightModeConfiguration +from .bot_management_update_params import BotManagementUpdateParams as BotManagementUpdateParams +from .bot_management_update_response import BotManagementUpdateResponse as BotManagementUpdateResponse +from .super_bot_fight_mode_likely_configuration import ( + SuperBotFightModeLikelyConfiguration as SuperBotFightModeLikelyConfiguration, +) +from .super_bot_fight_mode_definitely_configuration import ( + SuperBotFightModeDefinitelyConfiguration as SuperBotFightModeDefinitelyConfiguration, +) diff --git a/src/cloudflare/types/bot_management/bot_fight_mode_configuration.py b/src/cloudflare/types/bot_management/bot_fight_mode_configuration.py new file mode 100644 index 00000000000..ca47e2d1a71 --- /dev/null +++ b/src/cloudflare/types/bot_management/bot_fight_mode_configuration.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["BotFightModeConfiguration"] + + +class BotFightModeConfiguration(BaseModel): + enable_js: Optional[bool] = None + """Use lightweight, invisible JavaScript detections to improve Bot Management. + + [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + """ + + fight_mode: Optional[bool] = None + """Whether to enable Bot Fight Mode.""" + + using_latest_model: Optional[bool] = None + """ + A read-only field that indicates whether the zone currently is running the + latest ML model. + """ diff --git a/src/cloudflare/types/bot_management/bot_management_get_response.py b/src/cloudflare/types/bot_management/bot_management_get_response.py new file mode 100644 index 00000000000..2153b087213 --- /dev/null +++ b/src/cloudflare/types/bot_management/bot_management_get_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +from .subscription_configuration import SubscriptionConfiguration +from .bot_fight_mode_configuration import BotFightModeConfiguration +from .super_bot_fight_mode_likely_configuration import SuperBotFightModeLikelyConfiguration +from .super_bot_fight_mode_definitely_configuration import SuperBotFightModeDefinitelyConfiguration + +__all__ = ["BotManagementGetResponse"] + +BotManagementGetResponse = Union[ + BotFightModeConfiguration, + SuperBotFightModeDefinitelyConfiguration, + SuperBotFightModeLikelyConfiguration, + SubscriptionConfiguration, +] diff --git a/src/cloudflare/types/bot_management_update_params.py b/src/cloudflare/types/bot_management/bot_management_update_params.py similarity index 86% rename from src/cloudflare/types/bot_management_update_params.py rename to src/cloudflare/types/bot_management/bot_management_update_params.py index 107db4627ef..199be0ab054 100644 --- a/src/cloudflare/types/bot_management_update_params.py +++ b/src/cloudflare/types/bot_management/bot_management_update_params.py @@ -7,14 +7,14 @@ __all__ = [ "BotManagementUpdateParams", - "BotManagementBotFightModeConfig", - "BotManagementSbfmDefinitelyConfig", - "BotManagementSbfmLikelyConfig", - "BotManagementBmSubscriptionConfig", + "BotFightModeConfiguration", + "SuperBotFightModeDefinitelyConfiguration", + "SuperBotFightModeLikelyConfiguration", + "SubscriptionConfiguration", ] -class BotManagementBotFightModeConfig(TypedDict, total=False): +class BotFightModeConfiguration(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -28,7 +28,7 @@ class BotManagementBotFightModeConfig(TypedDict, total=False): """Whether to enable Bot Fight Mode.""" -class BotManagementSbfmDefinitelyConfig(TypedDict, total=False): +class SuperBotFightModeDefinitelyConfiguration(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -55,7 +55,7 @@ class BotManagementSbfmDefinitelyConfig(TypedDict, total=False): """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" -class BotManagementSbfmLikelyConfig(TypedDict, total=False): +class SuperBotFightModeLikelyConfiguration(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -85,7 +85,7 @@ class BotManagementSbfmLikelyConfig(TypedDict, total=False): """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" -class BotManagementBmSubscriptionConfig(TypedDict, total=False): +class SubscriptionConfiguration(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -110,8 +110,8 @@ class BotManagementBmSubscriptionConfig(TypedDict, total=False): BotManagementUpdateParams = Union[ - BotManagementBotFightModeConfig, - BotManagementSbfmDefinitelyConfig, - BotManagementSbfmLikelyConfig, - BotManagementBmSubscriptionConfig, + BotFightModeConfiguration, + SuperBotFightModeDefinitelyConfiguration, + SuperBotFightModeLikelyConfiguration, + SubscriptionConfiguration, ] diff --git a/src/cloudflare/types/bot_management/bot_management_update_response.py b/src/cloudflare/types/bot_management/bot_management_update_response.py new file mode 100644 index 00000000000..6880ad7a3ef --- /dev/null +++ b/src/cloudflare/types/bot_management/bot_management_update_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +from .subscription_configuration import SubscriptionConfiguration +from .bot_fight_mode_configuration import BotFightModeConfiguration +from .super_bot_fight_mode_likely_configuration import SuperBotFightModeLikelyConfiguration +from .super_bot_fight_mode_definitely_configuration import SuperBotFightModeDefinitelyConfiguration + +__all__ = ["BotManagementUpdateResponse"] + +BotManagementUpdateResponse = Union[ + BotFightModeConfiguration, + SuperBotFightModeDefinitelyConfiguration, + SuperBotFightModeLikelyConfiguration, + SubscriptionConfiguration, +] diff --git a/src/cloudflare/types/bot_management/subscription_configuration.py b/src/cloudflare/types/bot_management/subscription_configuration.py new file mode 100644 index 00000000000..b9734638ceb --- /dev/null +++ b/src/cloudflare/types/bot_management/subscription_configuration.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["SubscriptionConfiguration"] + + +class SubscriptionConfiguration(BaseModel): + auto_update_model: Optional[bool] = None + """ + Automatically update to the newest bot detection models created by Cloudflare as + they are released. + [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) + """ + + enable_js: Optional[bool] = None + """Use lightweight, invisible JavaScript detections to improve Bot Management. + + [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + """ + + suppress_session_score: Optional[bool] = None + """ + Whether to disable tracking the highest bot score for a session in the Bot + Management cookie. + """ + + using_latest_model: Optional[bool] = None + """ + A read-only field that indicates whether the zone currently is running the + latest ML model. + """ diff --git a/src/cloudflare/types/bot_management/super_bot_fight_mode_definitely_configuration.py b/src/cloudflare/types/bot_management/super_bot_fight_mode_definitely_configuration.py new file mode 100644 index 00000000000..64d6bf32f27 --- /dev/null +++ b/src/cloudflare/types/bot_management/super_bot_fight_mode_definitely_configuration.py @@ -0,0 +1,38 @@ +# 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__ = ["SuperBotFightModeDefinitelyConfiguration"] + + +class SuperBotFightModeDefinitelyConfiguration(BaseModel): + enable_js: Optional[bool] = None + """Use lightweight, invisible JavaScript detections to improve Bot Management. + + [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + """ + + optimize_wordpress: Optional[bool] = None + """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" + + sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None + """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" + + sbfm_static_resource_protection: Optional[bool] = None + """ + Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + static resources on your application need bot protection. Note: Static resource + protection can also result in legitimate traffic being blocked. + """ + + sbfm_verified_bots: Optional[Literal["allow", "block"]] = None + """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" + + using_latest_model: Optional[bool] = None + """ + A read-only field that indicates whether the zone currently is running the + latest ML model. + """ diff --git a/src/cloudflare/types/bot_management/super_bot_fight_mode_likely_configuration.py b/src/cloudflare/types/bot_management/super_bot_fight_mode_likely_configuration.py new file mode 100644 index 00000000000..c0878cfdf0a --- /dev/null +++ b/src/cloudflare/types/bot_management/super_bot_fight_mode_likely_configuration.py @@ -0,0 +1,41 @@ +# 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__ = ["SuperBotFightModeLikelyConfiguration"] + + +class SuperBotFightModeLikelyConfiguration(BaseModel): + enable_js: Optional[bool] = None + """Use lightweight, invisible JavaScript detections to improve Bot Management. + + [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + """ + + optimize_wordpress: Optional[bool] = None + """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" + + sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None + """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" + + sbfm_likely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None + """Super Bot Fight Mode (SBFM) action to take on likely automated requests.""" + + sbfm_static_resource_protection: Optional[bool] = None + """ + Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + static resources on your application need bot protection. Note: Static resource + protection can also result in legitimate traffic being blocked. + """ + + sbfm_verified_bots: Optional[Literal["allow", "block"]] = None + """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" + + using_latest_model: Optional[bool] = None + """ + A read-only field that indicates whether the zone currently is running the + latest ML model. + """ diff --git a/src/cloudflare/types/bot_management_get_response.py b/src/cloudflare/types/bot_management_get_response.py deleted file mode 100644 index 2e45674d755..00000000000 --- a/src/cloudflare/types/bot_management_get_response.py +++ /dev/null @@ -1,129 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = [ - "BotManagementGetResponse", - "BotManagementBotFightModeConfig", - "BotManagementSbfmDefinitelyConfig", - "BotManagementSbfmLikelyConfig", - "BotManagementBmSubscriptionConfig", -] - - -class BotManagementBotFightModeConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - fight_mode: Optional[bool] = None - """Whether to enable Bot Fight Mode.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementSbfmDefinitelyConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - optimize_wordpress: Optional[bool] = None - """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" - - sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" - - sbfm_static_resource_protection: Optional[bool] = None - """ - Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if - static resources on your application need bot protection. Note: Static resource - protection can also result in legitimate traffic being blocked. - """ - - sbfm_verified_bots: Optional[Literal["allow", "block"]] = None - """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementSbfmLikelyConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - optimize_wordpress: Optional[bool] = None - """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" - - sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" - - sbfm_likely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on likely automated requests.""" - - sbfm_static_resource_protection: Optional[bool] = None - """ - Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if - static resources on your application need bot protection. Note: Static resource - protection can also result in legitimate traffic being blocked. - """ - - sbfm_verified_bots: Optional[Literal["allow", "block"]] = None - """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementBmSubscriptionConfig(BaseModel): - auto_update_model: Optional[bool] = None - """ - Automatically update to the newest bot detection models created by Cloudflare as - they are released. - [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) - """ - - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - suppress_session_score: Optional[bool] = None - """ - Whether to disable tracking the highest bot score for a session in the Bot - Management cookie. - """ - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -BotManagementGetResponse = Union[ - BotManagementBotFightModeConfig, - BotManagementSbfmDefinitelyConfig, - BotManagementSbfmLikelyConfig, - BotManagementBmSubscriptionConfig, -] diff --git a/src/cloudflare/types/bot_management_update_response.py b/src/cloudflare/types/bot_management_update_response.py deleted file mode 100644 index 239f1f5583c..00000000000 --- a/src/cloudflare/types/bot_management_update_response.py +++ /dev/null @@ -1,129 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = [ - "BotManagementUpdateResponse", - "BotManagementBotFightModeConfig", - "BotManagementSbfmDefinitelyConfig", - "BotManagementSbfmLikelyConfig", - "BotManagementBmSubscriptionConfig", -] - - -class BotManagementBotFightModeConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - fight_mode: Optional[bool] = None - """Whether to enable Bot Fight Mode.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementSbfmDefinitelyConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - optimize_wordpress: Optional[bool] = None - """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" - - sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" - - sbfm_static_resource_protection: Optional[bool] = None - """ - Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if - static resources on your application need bot protection. Note: Static resource - protection can also result in legitimate traffic being blocked. - """ - - sbfm_verified_bots: Optional[Literal["allow", "block"]] = None - """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementSbfmLikelyConfig(BaseModel): - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - optimize_wordpress: Optional[bool] = None - """Whether to optimize Super Bot Fight Mode protections for Wordpress.""" - - sbfm_definitely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on definitely automated requests.""" - - sbfm_likely_automated: Optional[Literal["allow", "block", "managed_challenge"]] = None - """Super Bot Fight Mode (SBFM) action to take on likely automated requests.""" - - sbfm_static_resource_protection: Optional[bool] = None - """ - Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if - static resources on your application need bot protection. Note: Static resource - protection can also result in legitimate traffic being blocked. - """ - - sbfm_verified_bots: Optional[Literal["allow", "block"]] = None - """Super Bot Fight Mode (SBFM) action to take on verified bots requests.""" - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -class BotManagementBmSubscriptionConfig(BaseModel): - auto_update_model: Optional[bool] = None - """ - Automatically update to the newest bot detection models created by Cloudflare as - they are released. - [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) - """ - - enable_js: Optional[bool] = None - """Use lightweight, invisible JavaScript detections to improve Bot Management. - - [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). - """ - - suppress_session_score: Optional[bool] = None - """ - Whether to disable tracking the highest bot score for a session in the Bot - Management cookie. - """ - - using_latest_model: Optional[bool] = None - """ - A read-only field that indicates whether the zone currently is running the - latest ML model. - """ - - -BotManagementUpdateResponse = Union[ - BotManagementBotFightModeConfig, - BotManagementSbfmDefinitelyConfig, - BotManagementSbfmLikelyConfig, - BotManagementBmSubscriptionConfig, -] diff --git a/src/cloudflare/types/brand_protection/__init__.py b/src/cloudflare/types/brand_protection/__init__.py new file mode 100644 index 00000000000..3fa7ed724bd --- /dev/null +++ b/src/cloudflare/types/brand_protection/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .info import Info as Info +from .submit import Submit as Submit +from .rule_match import RuleMatch as RuleMatch +from .scan_status import ScanStatus as ScanStatus +from .url_info_model_results import URLInfoModelResults as URLInfoModelResults +from .brand_protection_submit_params import BrandProtectionSubmitParams as BrandProtectionSubmitParams +from .brand_protection_url_info_params import BrandProtectionURLInfoParams as BrandProtectionURLInfoParams diff --git a/src/cloudflare/types/brand_protection_submit_params.py b/src/cloudflare/types/brand_protection/brand_protection_submit_params.py similarity index 100% rename from src/cloudflare/types/brand_protection_submit_params.py rename to src/cloudflare/types/brand_protection/brand_protection_submit_params.py diff --git a/src/cloudflare/types/brand_protection_url_info_params.py b/src/cloudflare/types/brand_protection/brand_protection_url_info_params.py similarity index 100% rename from src/cloudflare/types/brand_protection_url_info_params.py rename to src/cloudflare/types/brand_protection/brand_protection_url_info_params.py diff --git a/src/cloudflare/types/brand_protection/info.py b/src/cloudflare/types/brand_protection/info.py new file mode 100644 index 00000000000..ecc27c62f00 --- /dev/null +++ b/src/cloudflare/types/brand_protection/info.py @@ -0,0 +1,46 @@ +# 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 +from .rule_match import RuleMatch +from .scan_status import ScanStatus +from .url_info_model_results import URLInfoModelResults + +__all__ = ["Info", "Categorization"] + + +class Categorization(BaseModel): + category: Optional[str] = None + """Name of the category applied.""" + + verification_status: Optional[str] = None + """Result of human review for this categorization.""" + + +class Info(BaseModel): + categorizations: Optional[List[Categorization]] = None + """List of categorizations applied to this submission.""" + + ai_model_results: Optional[List[URLInfoModelResults]] = FieldInfo(alias="model_results", default=None) + """List of model results for completed scans.""" + + rule_matches: Optional[List[RuleMatch]] = None + """ + List of signatures that matched against site content found when crawling the + URL. + """ + + scan_status: Optional[ScanStatus] = None + """Status of the most recent scan found.""" + + screenshot_download_signature: Optional[str] = None + """For internal use.""" + + screenshot_path: Optional[str] = None + """For internal use.""" + + url: Optional[str] = None + """URL that was submitted.""" diff --git a/src/cloudflare/types/brand_protection/rule_match.py b/src/cloudflare/types/brand_protection/rule_match.py new file mode 100644 index 00000000000..00452de5674 --- /dev/null +++ b/src/cloudflare/types/brand_protection/rule_match.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["RuleMatch"] + + +class RuleMatch(BaseModel): + banning: Optional[bool] = None + """For internal use.""" + + blocking: Optional[bool] = None + """For internal use.""" + + description: Optional[str] = None + """Description of the signature that matched.""" + + name: Optional[str] = None + """Name of the signature that matched.""" diff --git a/src/cloudflare/types/brand_protection/scan_status.py b/src/cloudflare/types/brand_protection/scan_status.py new file mode 100644 index 00000000000..711de0b5ed6 --- /dev/null +++ b/src/cloudflare/types/brand_protection/scan_status.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ScanStatus"] + + +class ScanStatus(BaseModel): + last_processed: Optional[str] = None + """Timestamp of when the submission was processed.""" + + scan_complete: Optional[bool] = None + """For internal use.""" + + status_code: Optional[int] = None + """Status code that the crawler received when loading the submitted URL.""" + + submission_id: Optional[int] = None + """ID of the most recent submission.""" diff --git a/src/cloudflare/types/brand_protection/submit.py b/src/cloudflare/types/brand_protection/submit.py new file mode 100644 index 00000000000..766580137d5 --- /dev/null +++ b/src/cloudflare/types/brand_protection/submit.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Submit", "ExcludedURL", "SkippedURL", "SubmittedURL"] + + +class ExcludedURL(BaseModel): + url: Optional[str] = None + """URL that was excluded.""" + + +class SkippedURL(BaseModel): + url: Optional[str] = None + """URL that was skipped.""" + + url_id: Optional[int] = None + """ID of the submission of that URL that is currently scanning.""" + + +class SubmittedURL(BaseModel): + url: Optional[str] = None + """URL that was submitted.""" + + url_id: Optional[int] = None + """ID assigned to this URL submission. Used to retrieve scanning results.""" + + +class Submit(BaseModel): + excluded_urls: Optional[List[ExcludedURL]] = None + """ + URLs that were excluded from scanning because their domain is in our no-scan + list. + """ + + skipped_urls: Optional[List[SkippedURL]] = None + """URLs that were skipped because the same URL is currently being scanned""" + + submitted_urls: Optional[List[SubmittedURL]] = None + """URLs that were successfully submitted for scanning.""" diff --git a/src/cloudflare/types/brand_protection/url_info_model_results.py b/src/cloudflare/types/brand_protection/url_info_model_results.py new file mode 100644 index 00000000000..cd2086aba49 --- /dev/null +++ b/src/cloudflare/types/brand_protection/url_info_model_results.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["URLInfoModelResults"] + + +class URLInfoModelResults(BaseModel): + ai_model_name: Optional[str] = FieldInfo(alias="model_name", default=None) + """Name of the model.""" + + ai_model_score: Optional[float] = FieldInfo(alias="model_score", default=None) + """Score output by the model for this submission.""" diff --git a/src/cloudflare/types/cache/__init__.py b/src/cloudflare/types/cache/__init__.py index c5a4aa5c6ae..203e43955f7 100644 --- a/src/cloudflare/types/cache/__init__.py +++ b/src/cloudflare/types/cache/__init__.py @@ -2,17 +2,26 @@ from __future__ import annotations -from .cache_variants import CacheVariants as CacheVariants +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 +from .cache_purge_response import CachePurgeResponse as CachePurgeResponse from .variant_get_response import VariantGetResponse as VariantGetResponse +from .regional_tiered_cache import RegionalTieredCache as RegionalTieredCache +from .variant_delete_params import VariantDeleteParams as VariantDeleteParams from .variant_edit_response import VariantEditResponse as VariantEditResponse +from .cache_variant_identifier import CacheVariantIdentifier as CacheVariantIdentifier 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 from .cache_reserve_edit_response import CacheReserveEditResponse as CacheReserveEditResponse from .cache_reserve_clear_response import CacheReserveClearResponse as CacheReserveClearResponse from .cache_reserve_status_response import CacheReserveStatusResponse as CacheReserveStatusResponse from .smart_tiered_cache_edit_params import SmartTieredCacheEditParams as SmartTieredCacheEditParams from .smart_tiered_cache_get_response import SmartTieredCacheGetResponse as SmartTieredCacheGetResponse +from .smart_tiered_cache_delete_params import SmartTieredCacheDeleteParams as SmartTieredCacheDeleteParams from .smart_tiered_cache_edit_response import SmartTieredCacheEditResponse as SmartTieredCacheEditResponse from .regional_tiered_cache_edit_params import RegionalTieredCacheEditParams as RegionalTieredCacheEditParams from .regional_tiered_cache_get_response import RegionalTieredCacheGetResponse as RegionalTieredCacheGetResponse diff --git a/src/cloudflare/types/cache_purge_params.py b/src/cloudflare/types/cache/cache_purge_params.py similarity index 100% rename from src/cloudflare/types/cache_purge_params.py rename to src/cloudflare/types/cache/cache_purge_params.py diff --git a/src/cloudflare/types/cache_purge_response.py b/src/cloudflare/types/cache/cache_purge_response.py similarity index 85% rename from src/cloudflare/types/cache_purge_response.py rename to src/cloudflare/types/cache/cache_purge_response.py index c95b2e9864c..08e7ee41a89 100644 --- a/src/cloudflare/types/cache_purge_response.py +++ b/src/cloudflare/types/cache/cache_purge_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["CachePurgeResponse"] diff --git a/src/cloudflare/types/cache/cache_reserve.py b/src/cloudflare/types/cache/cache_reserve.py new file mode 100644 index 00000000000..2113d16a9fc --- /dev/null +++ b/src/cloudflare/types/cache/cache_reserve.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["CacheReserve"] + +CacheReserve = Literal["cache_reserve"] diff --git a/src/cloudflare/types/cache/cache_reserve_clear.py b/src/cloudflare/types/cache/cache_reserve_clear.py new file mode 100644 index 00000000000..4f92b373231 --- /dev/null +++ b/src/cloudflare/types/cache/cache_reserve_clear.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["CacheReserveClear"] + +CacheReserveClear = Literal["cache_reserve_clear"] diff --git a/src/cloudflare/types/cache/cache_reserve_clear_params.py b/src/cloudflare/types/cache/cache_reserve_clear_params.py new file mode 100644 index 00000000000..72908b2031f --- /dev/null +++ b/src/cloudflare/types/cache/cache_reserve_clear_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__ = ["CacheReserveClearParams"] + + +class CacheReserveClearParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/cache/cache_reserve_clear_response.py b/src/cloudflare/types/cache/cache_reserve_clear_response.py index 2673a64ba06..b65b18ed8c3 100644 --- a/src/cloudflare/types/cache/cache_reserve_clear_response.py +++ b/src/cloudflare/types/cache/cache_reserve_clear_response.py @@ -5,12 +5,13 @@ from typing_extensions import Literal from ..._models import BaseModel +from .cache_reserve_clear import CacheReserveClear __all__ = ["CacheReserveClearResponse"] class CacheReserveClearResponse(BaseModel): - id: Literal["cache_reserve_clear"] + id: CacheReserveClear """ID of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/cache/cache_reserve_edit_response.py b/src/cloudflare/types/cache/cache_reserve_edit_response.py index ac16cac20ce..cf94dab2551 100644 --- a/src/cloudflare/types/cache/cache_reserve_edit_response.py +++ b/src/cloudflare/types/cache/cache_reserve_edit_response.py @@ -5,12 +5,13 @@ from typing_extensions import Literal from ..._models import BaseModel +from .cache_reserve import CacheReserve __all__ = ["CacheReserveEditResponse"] class CacheReserveEditResponse(BaseModel): - id: Literal["cache_reserve"] + id: CacheReserve """ID of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/cache/cache_reserve_get_response.py b/src/cloudflare/types/cache/cache_reserve_get_response.py index e438bd1ba63..78ddefe3883 100644 --- a/src/cloudflare/types/cache/cache_reserve_get_response.py +++ b/src/cloudflare/types/cache/cache_reserve_get_response.py @@ -5,12 +5,13 @@ from typing_extensions import Literal from ..._models import BaseModel +from .cache_reserve import CacheReserve __all__ = ["CacheReserveGetResponse"] class CacheReserveGetResponse(BaseModel): - id: Literal["cache_reserve"] + id: CacheReserve """ID of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/cache/cache_reserve_status_response.py b/src/cloudflare/types/cache/cache_reserve_status_response.py index 9aceb6d15fc..46d79cbf06b 100644 --- a/src/cloudflare/types/cache/cache_reserve_status_response.py +++ b/src/cloudflare/types/cache/cache_reserve_status_response.py @@ -5,12 +5,13 @@ from typing_extensions import Literal from ..._models import BaseModel +from .cache_reserve_clear import CacheReserveClear __all__ = ["CacheReserveStatusResponse"] class CacheReserveStatusResponse(BaseModel): - id: Literal["cache_reserve_clear"] + id: CacheReserveClear """ID of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/cache/cache_variant.py b/src/cloudflare/types/cache/cache_variant.py new file mode 100644 index 00000000000..6f442feaf26 --- /dev/null +++ b/src/cloudflare/types/cache/cache_variant.py @@ -0,0 +1,17 @@ +# 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 +from .cache_variant_identifier import CacheVariantIdentifier + +__all__ = ["CacheVariant"] + + +class CacheVariant(BaseModel): + id: CacheVariantIdentifier + """ID of the zone setting.""" + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_variant_identifier.py b/src/cloudflare/types/cache/cache_variant_identifier.py new file mode 100644 index 00000000000..064a574bdac --- /dev/null +++ b/src/cloudflare/types/cache/cache_variant_identifier.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["CacheVariantIdentifier"] + +CacheVariantIdentifier = Literal["variants"] diff --git a/src/cloudflare/types/cache/cache_variants.py b/src/cloudflare/types/cache/cache_variants.py deleted file mode 100644 index 0d23989e611..00000000000 --- a/src/cloudflare/types/cache/cache_variants.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 datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["CacheVariants"] - - -class CacheVariants(BaseModel): - id: Literal["variants"] - """ID of the zone setting.""" - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/regional_tiered_cache.py b/src/cloudflare/types/cache/regional_tiered_cache.py new file mode 100644 index 00000000000..1f78beeb784 --- /dev/null +++ b/src/cloudflare/types/cache/regional_tiered_cache.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["RegionalTieredCache"] + +RegionalTieredCache = Literal["tc_regional"] 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 0de0911995c..8350d75dc86 100644 --- a/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py +++ b/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py @@ -2,15 +2,15 @@ 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"] class Value(BaseModel): - id: Literal["tc_regional"] + id: RegionalTieredCache """ID of the zone setting.""" modified_on: Optional[datetime] = None @@ -18,7 +18,7 @@ class Value(BaseModel): class RegionalTieredCacheEditResponse(BaseModel): - id: Literal["tc_regional"] + id: RegionalTieredCache """ID of the zone setting.""" modified_on: Optional[datetime] = None 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 28123c3537f..ac3f6c4e6e3 100644 --- a/src/cloudflare/types/cache/regional_tiered_cache_get_response.py +++ b/src/cloudflare/types/cache/regional_tiered_cache_get_response.py @@ -2,15 +2,15 @@ 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"] class Value(BaseModel): - id: Literal["tc_regional"] + id: RegionalTieredCache """ID of the zone setting.""" modified_on: Optional[datetime] = None @@ -18,7 +18,7 @@ class Value(BaseModel): class RegionalTieredCacheGetResponse(BaseModel): - id: Literal["tc_regional"] + id: RegionalTieredCache """ID of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/cache/smart_tiered_cache_delete_params.py b/src/cloudflare/types/cache/smart_tiered_cache_delete_params.py new file mode 100644 index 00000000000..abf76298b5f --- /dev/null +++ b/src/cloudflare/types/cache/smart_tiered_cache_delete_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__ = ["SmartTieredCacheDeleteParams"] + + +class SmartTieredCacheDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/cache/variant_delete_params.py b/src/cloudflare/types/cache/variant_delete_params.py new file mode 100644 index 00000000000..86f4783d716 --- /dev/null +++ b/src/cloudflare/types/cache/variant_delete_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__ = ["VariantDeleteParams"] + + +class VariantDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/cache/variant_edit_params.py b/src/cloudflare/types/cache/variant_edit_params.py index 28efe2b4e46..2c7c09d1991 100644 --- a/src/cloudflare/types/cache/variant_edit_params.py +++ b/src/cloudflare/types/cache/variant_edit_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable +from typing import List from typing_extensions import Required, TypedDict __all__ = ["VariantEditParams", "Value"] @@ -17,67 +17,67 @@ class VariantEditParams(TypedDict, total=False): class Value(TypedDict, total=False): - avif: Iterable[object] + avif: List[str] """ List of strings with the MIME types of all the variants that should be served for avif. """ - bmp: Iterable[object] + bmp: List[str] """ List of strings with the MIME types of all the variants that should be served for bmp. """ - gif: Iterable[object] + gif: List[str] """ List of strings with the MIME types of all the variants that should be served for gif. """ - jp2: Iterable[object] + jp2: List[str] """ List of strings with the MIME types of all the variants that should be served for jp2. """ - jpeg: Iterable[object] + jpeg: List[str] """ List of strings with the MIME types of all the variants that should be served for jpeg. """ - jpg: Iterable[object] + jpg: List[str] """ List of strings with the MIME types of all the variants that should be served for jpg. """ - jpg2: Iterable[object] + jpg2: List[str] """ List of strings with the MIME types of all the variants that should be served for jpg2. """ - png: Iterable[object] + png: List[str] """ List of strings with the MIME types of all the variants that should be served for png. """ - tif: Iterable[object] + tif: List[str] """ List of strings with the MIME types of all the variants that should be served for tif. """ - tiff: Iterable[object] + tiff: List[str] """ List of strings with the MIME types of all the variants that should be served for tiff. """ - webp: Iterable[object] + webp: List[str] """ List of strings with the MIME types of all the variants that should be served for webp. diff --git a/src/cloudflare/types/cache/variant_edit_response.py b/src/cloudflare/types/cache/variant_edit_response.py index a6e58fbc52c..636afadd456 100644 --- a/src/cloudflare/types/cache/variant_edit_response.py +++ b/src/cloudflare/types/cache/variant_edit_response.py @@ -2,75 +2,75 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from ..._models import BaseModel +from .cache_variant_identifier import CacheVariantIdentifier __all__ = ["VariantEditResponse", "Value"] class Value(BaseModel): - avif: Optional[List[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + webp: Optional[List[str]] = None """ List of strings with the MIME types of all the variants that should be served for webp. @@ -78,7 +78,7 @@ class Value(BaseModel): class VariantEditResponse(BaseModel): - id: Literal["variants"] + id: CacheVariantIdentifier """ID of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/cache/variant_get_response.py b/src/cloudflare/types/cache/variant_get_response.py index faedee52e1c..c646004adaa 100644 --- a/src/cloudflare/types/cache/variant_get_response.py +++ b/src/cloudflare/types/cache/variant_get_response.py @@ -2,75 +2,75 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from ..._models import BaseModel +from .cache_variant_identifier import CacheVariantIdentifier __all__ = ["VariantGetResponse", "Value"] class Value(BaseModel): - avif: Optional[List[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + 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[object]] = None + webp: Optional[List[str]] = None """ List of strings with the MIME types of all the variants that should be served for webp. @@ -78,7 +78,7 @@ class Value(BaseModel): class VariantGetResponse(BaseModel): - id: Literal["variants"] + id: CacheVariantIdentifier """ID of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/calls/__init__.py b/src/cloudflare/types/calls/__init__.py new file mode 100644 index 00000000000..b3889df1cbc --- /dev/null +++ b/src/cloudflare/types/calls/__init__.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .calls_app import CallsApp as CallsApp +from .call_create_params import CallCreateParams as CallCreateParams +from .call_update_params import CallUpdateParams as CallUpdateParams +from .calls_app_with_secret import CallsAppWithSecret as CallsAppWithSecret diff --git a/src/cloudflare/types/call_create_params.py b/src/cloudflare/types/calls/call_create_params.py similarity index 100% rename from src/cloudflare/types/call_create_params.py rename to src/cloudflare/types/calls/call_create_params.py diff --git a/src/cloudflare/types/call_update_params.py b/src/cloudflare/types/calls/call_update_params.py similarity index 100% rename from src/cloudflare/types/call_update_params.py rename to src/cloudflare/types/calls/call_update_params.py diff --git a/src/cloudflare/types/calls_app.py b/src/cloudflare/types/calls/calls_app.py similarity index 94% rename from src/cloudflare/types/calls_app.py rename to src/cloudflare/types/calls/calls_app.py index 4adb2b4172a..e29517063f6 100644 --- a/src/cloudflare/types/calls_app.py +++ b/src/cloudflare/types/calls/calls_app.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["CallsApp"] diff --git a/src/cloudflare/types/calls_app_with_secret.py b/src/cloudflare/types/calls/calls_app_with_secret.py similarity index 95% rename from src/cloudflare/types/calls_app_with_secret.py rename to src/cloudflare/types/calls/calls_app_with_secret.py index e3bab36d3d3..820a8080f27 100644 --- a/src/cloudflare/types/calls_app_with_secret.py +++ b/src/cloudflare/types/calls/calls_app_with_secret.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["CallsAppWithSecret"] diff --git a/src/cloudflare/types/certificate_authorities/__init__.py b/src/cloudflare/types/certificate_authorities/__init__.py index 9f248f2ad9b..d16d318f276 100644 --- a/src/cloudflare/types/certificate_authorities/__init__.py +++ b/src/cloudflare/types/certificate_authorities/__init__.py @@ -2,6 +2,8 @@ from __future__ import annotations -from .tls_hostname_association import TLSHostnameAssociation as TLSHostnameAssociation +from .hostname_association import HostnameAssociation as HostnameAssociation from .hostname_association_get_params import HostnameAssociationGetParams as HostnameAssociationGetParams +from .hostname_association_get_response import HostnameAssociationGetResponse as HostnameAssociationGetResponse from .hostname_association_update_params import HostnameAssociationUpdateParams as HostnameAssociationUpdateParams +from .hostname_association_update_response import HostnameAssociationUpdateResponse as HostnameAssociationUpdateResponse diff --git a/src/cloudflare/types/certificate_authorities/hostname_association.py b/src/cloudflare/types/certificate_authorities/hostname_association.py new file mode 100644 index 00000000000..971951cd3e0 --- /dev/null +++ b/src/cloudflare/types/certificate_authorities/hostname_association.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["HostnameAssociation"] + +HostnameAssociation = str diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py b/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py new file mode 100644 index 00000000000..1a034b6e5d6 --- /dev/null +++ b/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .hostname_association import HostnameAssociation + +__all__ = ["HostnameAssociationGetResponse"] + + +class HostnameAssociationGetResponse(BaseModel): + hostnames: Optional[List[HostnameAssociation]] = None diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_update_params.py b/src/cloudflare/types/certificate_authorities/hostname_association_update_params.py index 7912fa39b88..cc9377d392a 100644 --- a/src/cloudflare/types/certificate_authorities/hostname_association_update_params.py +++ b/src/cloudflare/types/certificate_authorities/hostname_association_update_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Required, TypedDict +from .hostname_association import HostnameAssociation + __all__ = ["HostnameAssociationUpdateParams"] @@ -12,7 +14,7 @@ class HostnameAssociationUpdateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - hostnames: List[str] + hostnames: List[HostnameAssociation] mtls_certificate_id: str """ diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py b/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py new file mode 100644 index 00000000000..cb9dad7daf5 --- /dev/null +++ b/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .hostname_association import HostnameAssociation + +__all__ = ["HostnameAssociationUpdateResponse"] + + +class HostnameAssociationUpdateResponse(BaseModel): + hostnames: Optional[List[HostnameAssociation]] = None diff --git a/src/cloudflare/types/certificate_authorities/tls_hostname_association.py b/src/cloudflare/types/certificate_authorities/tls_hostname_association.py deleted file mode 100644 index ab1a832cb65..00000000000 --- a/src/cloudflare/types/certificate_authorities/tls_hostname_association.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["TLSHostnameAssociation"] - - -class TLSHostnameAssociation(BaseModel): - hostnames: Optional[List[str]] = None - - mtls_certificate_id: Optional[str] = None - """ - The UUID for a certificate that was uploaded to the mTLS Certificate Management - endpoint. If no mtls_certificate_id is given, the hostnames will be associated - to your active Cloudflare Managed CA. - """ diff --git a/src/cloudflare/types/challenges/__init__.py b/src/cloudflare/types/challenges/__init__.py index 21538f16a7a..1fcf6a7582b 100644 --- a/src/cloudflare/types/challenges/__init__.py +++ b/src/cloudflare/types/challenges/__init__.py @@ -2,9 +2,10 @@ from __future__ import annotations -from .challenges_widget import ChallengesWidget as ChallengesWidget +from .widget import Widget as Widget +from .widget_domain import WidgetDomain as WidgetDomain from .widget_list_params import WidgetListParams as WidgetListParams from .widget_create_params import WidgetCreateParams as WidgetCreateParams +from .widget_list_response import WidgetListResponse as WidgetListResponse from .widget_update_params import WidgetUpdateParams as WidgetUpdateParams -from .challenges_widget_list import ChallengesWidgetList as ChallengesWidgetList from .widget_rotate_secret_params import WidgetRotateSecretParams as WidgetRotateSecretParams diff --git a/src/cloudflare/types/challenges/challenges_widget.py b/src/cloudflare/types/challenges/challenges_widget.py deleted file mode 100644 index 25dd3a000ad..00000000000 --- a/src/cloudflare/types/challenges/challenges_widget.py +++ /dev/null @@ -1,53 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ChallengesWidget"] - - -class ChallengesWidget(BaseModel): - bot_fight_mode: bool - """ - If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive - challenges in response to malicious bots (ENT only). - """ - - clearance_level: Literal["no_clearance", "jschallenge", "managed", "interactive"] - """ - If Turnstile is embedded on a Cloudflare site and the widget should grant - challenge clearance, this setting can determine the clearance level to be set - """ - - created_on: datetime - """When the widget was created.""" - - domains: List[str] - - mode: Literal["non-interactive", "invisible", "managed"] - """Widget Mode""" - - modified_on: datetime - """When the widget was modified.""" - - name: str - """Human readable widget name. - - Not unique. Cloudflare suggests that you set this to a meaningful string to make - it easier to identify your widget, and where it is used. - """ - - offlabel: bool - """Do not show any Cloudflare branding on the widget (ENT only).""" - - region: Literal["world"] - """Region where this widget can be used.""" - - secret: str - """Secret key for this widget.""" - - sitekey: str - """Widget item identifier tag.""" diff --git a/src/cloudflare/types/challenges/challenges_widget_list.py b/src/cloudflare/types/challenges/challenges_widget_list.py deleted file mode 100644 index c7b05f2f592..00000000000 --- a/src/cloudflare/types/challenges/challenges_widget_list.py +++ /dev/null @@ -1,50 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ChallengesWidgetList"] - - -class ChallengesWidgetList(BaseModel): - bot_fight_mode: bool - """ - If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive - challenges in response to malicious bots (ENT only). - """ - - clearance_level: Literal["no_clearance", "jschallenge", "managed", "interactive"] - """ - If Turnstile is embedded on a Cloudflare site and the widget should grant - challenge clearance, this setting can determine the clearance level to be set - """ - - created_on: datetime - """When the widget was created.""" - - domains: List[str] - - mode: Literal["non-interactive", "invisible", "managed"] - """Widget Mode""" - - modified_on: datetime - """When the widget was modified.""" - - name: str - """Human readable widget name. - - Not unique. Cloudflare suggests that you set this to a meaningful string to make - it easier to identify your widget, and where it is used. - """ - - offlabel: bool - """Do not show any Cloudflare branding on the widget (ENT only).""" - - region: Literal["world"] - """Region where this widget can be used.""" - - sitekey: str - """Widget item identifier tag.""" diff --git a/src/cloudflare/types/challenges/widget.py b/src/cloudflare/types/challenges/widget.py new file mode 100644 index 00000000000..2666b31af83 --- /dev/null +++ b/src/cloudflare/types/challenges/widget.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel +from .widget_domain import WidgetDomain + +__all__ = ["Widget"] + + +class Widget(BaseModel): + bot_fight_mode: bool + """ + If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + challenges in response to malicious bots (ENT only). + """ + + clearance_level: Literal["no_clearance", "jschallenge", "managed", "interactive"] + """ + If Turnstile is embedded on a Cloudflare site and the widget should grant + challenge clearance, this setting can determine the clearance level to be set + """ + + created_on: datetime + """When the widget was created.""" + + domains: List[WidgetDomain] + + mode: Literal["non-interactive", "invisible", "managed"] + """Widget Mode""" + + modified_on: datetime + """When the widget was modified.""" + + name: str + """Human readable widget name. + + Not unique. Cloudflare suggests that you set this to a meaningful string to make + it easier to identify your widget, and where it is used. + """ + + offlabel: bool + """Do not show any Cloudflare branding on the widget (ENT only).""" + + region: Literal["world"] + """Region where this widget can be used.""" + + secret: str + """Secret key for this widget.""" + + sitekey: str + """Widget item identifier tag.""" diff --git a/src/cloudflare/types/challenges/widget_create_params.py b/src/cloudflare/types/challenges/widget_create_params.py index c12b864c2f9..12d0b058c19 100644 --- a/src/cloudflare/types/challenges/widget_create_params.py +++ b/src/cloudflare/types/challenges/widget_create_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from .widget_domain import WidgetDomain + __all__ = ["WidgetCreateParams"] @@ -12,7 +14,7 @@ class WidgetCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - domains: Required[List[str]] + domains: Required[List[WidgetDomain]] mode: Required[Literal["non-interactive", "invisible", "managed"]] """Widget Mode""" diff --git a/src/cloudflare/types/challenges/widget_domain.py b/src/cloudflare/types/challenges/widget_domain.py new file mode 100644 index 00000000000..20d73b3d548 --- /dev/null +++ b/src/cloudflare/types/challenges/widget_domain.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["WidgetDomain"] + +WidgetDomain = str diff --git a/src/cloudflare/types/challenges/widget_list_response.py b/src/cloudflare/types/challenges/widget_list_response.py new file mode 100644 index 00000000000..0dabcb0bc91 --- /dev/null +++ b/src/cloudflare/types/challenges/widget_list_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel +from .widget_domain import WidgetDomain + +__all__ = ["WidgetListResponse"] + + +class WidgetListResponse(BaseModel): + bot_fight_mode: bool + """ + If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + challenges in response to malicious bots (ENT only). + """ + + clearance_level: Literal["no_clearance", "jschallenge", "managed", "interactive"] + """ + If Turnstile is embedded on a Cloudflare site and the widget should grant + challenge clearance, this setting can determine the clearance level to be set + """ + + created_on: datetime + """When the widget was created.""" + + domains: List[WidgetDomain] + + mode: Literal["non-interactive", "invisible", "managed"] + """Widget Mode""" + + modified_on: datetime + """When the widget was modified.""" + + name: str + """Human readable widget name. + + Not unique. Cloudflare suggests that you set this to a meaningful string to make + it easier to identify your widget, and where it is used. + """ + + offlabel: bool + """Do not show any Cloudflare branding on the widget (ENT only).""" + + region: Literal["world"] + """Region where this widget can be used.""" + + sitekey: str + """Widget item identifier tag.""" diff --git a/src/cloudflare/types/challenges/widget_update_params.py b/src/cloudflare/types/challenges/widget_update_params.py index c3b9786d726..748121528bf 100644 --- a/src/cloudflare/types/challenges/widget_update_params.py +++ b/src/cloudflare/types/challenges/widget_update_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from .widget_domain import WidgetDomain + __all__ = ["WidgetUpdateParams"] @@ -12,7 +14,7 @@ class WidgetUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - domains: Required[List[str]] + domains: Required[List[WidgetDomain]] mode: Required[Literal["non-interactive", "invisible", "managed"]] """Widget Mode""" diff --git a/src/cloudflare/types/client_certificates/__init__.py b/src/cloudflare/types/client_certificates/__init__.py new file mode 100644 index 00000000000..a7c9d42fe40 --- /dev/null +++ b/src/cloudflare/types/client_certificates/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .client_certificate import ClientCertificate as ClientCertificate +from .client_certificate_list_params import ClientCertificateListParams as ClientCertificateListParams +from .client_certificate_create_params import ClientCertificateCreateParams as ClientCertificateCreateParams diff --git a/src/cloudflare/types/client_certificate.py b/src/cloudflare/types/client_certificates/client_certificate.py similarity index 98% rename from src/cloudflare/types/client_certificate.py rename to src/cloudflare/types/client_certificates/client_certificate.py index 3bdc1070a2e..426e5838446 100644 --- a/src/cloudflare/types/client_certificate.py +++ b/src/cloudflare/types/client_certificates/client_certificate.py @@ -3,7 +3,7 @@ from typing import Optional from typing_extensions import Literal -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["ClientCertificate", "CertificateAuthority"] diff --git a/src/cloudflare/types/client_certificate_create_params.py b/src/cloudflare/types/client_certificates/client_certificate_create_params.py similarity index 100% rename from src/cloudflare/types/client_certificate_create_params.py rename to src/cloudflare/types/client_certificates/client_certificate_create_params.py diff --git a/src/cloudflare/types/client_certificate_list_params.py b/src/cloudflare/types/client_certificates/client_certificate_list_params.py similarity index 100% rename from src/cloudflare/types/client_certificate_list_params.py rename to src/cloudflare/types/client_certificates/client_certificate_list_params.py diff --git a/src/cloudflare/types/cloudforce_one/__init__.py b/src/cloudflare/types/cloudforce_one/__init__.py index 0c910734870..f069202d49b 100644 --- a/src/cloudflare/types/cloudforce_one/__init__.py +++ b/src/cloudflare/types/cloudforce_one/__init__.py @@ -2,12 +2,12 @@ from __future__ import annotations +from .item import Item as Item +from .quota import Quota as Quota +from .list_item import ListItem as ListItem +from .request_types import RequestTypes as RequestTypes +from .request_constants import RequestConstants as RequestConstants from .request_list_params import RequestListParams as RequestListParams -from .cloudforce_one_quota import CloudforceOneQuota as CloudforceOneQuota from .request_create_params import RequestCreateParams as RequestCreateParams from .request_update_params import RequestUpdateParams as RequestUpdateParams from .request_delete_response import RequestDeleteResponse as RequestDeleteResponse -from .cloudforce_one_request_item import CloudforceOneRequestItem as CloudforceOneRequestItem -from .cloudforce_one_request_types import CloudforceOneRequestTypes as CloudforceOneRequestTypes -from .cloudforce_one_request_constants import CloudforceOneRequestConstants as CloudforceOneRequestConstants -from .cloudforce_one_request_list_item import CloudforceOneRequestListItem as CloudforceOneRequestListItem diff --git a/src/cloudflare/types/cloudforce_one/cloudforce_one_quota.py b/src/cloudflare/types/cloudforce_one/cloudforce_one_quota.py deleted file mode 100644 index 10e6d58bab8..00000000000 --- a/src/cloudflare/types/cloudforce_one/cloudforce_one_quota.py +++ /dev/null @@ -1,22 +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__ = ["CloudforceOneQuota"] - - -class CloudforceOneQuota(BaseModel): - anniversary_date: Optional[datetime] = None - """Anniversary date is when annual quota limit is refresh""" - - quarter_anniversary_date: Optional[datetime] = None - """Quater anniversary date is when quota limit is refreshed each quarter""" - - quota: Optional[int] = None - """Tokens for the quarter""" - - remaining: Optional[int] = None - """Tokens remaining for the quarter""" diff --git a/src/cloudflare/types/cloudforce_one/cloudforce_one_request_constants.py b/src/cloudflare/types/cloudforce_one/cloudforce_one_request_constants.py deleted file mode 100644 index ccdf718a635..00000000000 --- a/src/cloudflare/types/cloudforce_one/cloudforce_one_request_constants.py +++ /dev/null @@ -1,16 +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__ = ["CloudforceOneRequestConstants"] - - -class CloudforceOneRequestConstants(BaseModel): - priority: Optional[List[Literal["routine", "high", "urgent"]]] = None - - status: Optional[List[Literal["open", "accepted", "reported", "approved", "completed", "declined"]]] = None - - tlp: Optional[List[Literal["clear", "amber", "amber-strict", "green", "red"]]] = None diff --git a/src/cloudflare/types/cloudforce_one/cloudforce_one_request_item.py b/src/cloudflare/types/cloudforce_one/cloudforce_one_request_item.py deleted file mode 100644 index 4734f68a35e..00000000000 --- a/src/cloudflare/types/cloudforce_one/cloudforce_one_request_item.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["CloudforceOneRequestItem"] - - -class CloudforceOneRequestItem(BaseModel): - id: str - """UUID""" - - content: str - """Request content""" - - created: datetime - - priority: datetime - - request: str - """Requested information from request""" - - summary: str - """Brief description of the request""" - - tlp: Literal["clear", "amber", "amber-strict", "green", "red"] - """The CISA defined Traffic Light Protocol (TLP)""" - - updated: datetime - - completed: Optional[datetime] = None - - message_tokens: Optional[int] = None - """Tokens for the request messages""" - - readable_id: Optional[str] = None - """Readable Request ID""" - - status: Optional[Literal["open", "accepted", "reported", "approved", "completed", "declined"]] = None - """Request Status""" - - tokens: Optional[int] = None - """Tokens for the request""" diff --git a/src/cloudflare/types/cloudforce_one/cloudforce_one_request_list_item.py b/src/cloudflare/types/cloudforce_one/cloudforce_one_request_list_item.py deleted file mode 100644 index 6cbd9f40e6b..00000000000 --- a/src/cloudflare/types/cloudforce_one/cloudforce_one_request_list_item.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["CloudforceOneRequestListItem"] - - -class CloudforceOneRequestListItem(BaseModel): - id: str - """UUID""" - - created: datetime - """Request creation time""" - - priority: Literal["routine", "high", "urgent"] - - request: str - """Requested information from request""" - - summary: str - """Brief description of the request""" - - tlp: Literal["clear", "amber", "amber-strict", "green", "red"] - """The CISA defined Traffic Light Protocol (TLP)""" - - updated: datetime - """Request last updated time""" - - completed: Optional[datetime] = None - """Request completion time""" - - message_tokens: Optional[int] = None - """Tokens for the request messages""" - - readable_id: Optional[str] = None - """Readable Request ID""" - - status: Optional[Literal["open", "accepted", "reported", "approved", "completed", "declined"]] = None - """Request Status""" - - tokens: Optional[int] = None - """Tokens for the request""" diff --git a/src/cloudflare/types/cloudforce_one/cloudforce_one_request_types.py b/src/cloudflare/types/cloudforce_one/cloudforce_one_request_types.py deleted file mode 100644 index b419fd21be8..00000000000 --- a/src/cloudflare/types/cloudforce_one/cloudforce_one_request_types.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -__all__ = ["CloudforceOneRequestTypes"] - -CloudforceOneRequestTypes = List[str] diff --git a/src/cloudflare/types/cloudforce_one/item.py b/src/cloudflare/types/cloudforce_one/item.py new file mode 100644 index 00000000000..fc01fe5c174 --- /dev/null +++ b/src/cloudflare/types/cloudforce_one/item.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Item"] + + +class Item(BaseModel): + id: str + """UUID""" + + content: str + """Request content""" + + created: datetime + + priority: datetime + + request: str + """Requested information from request""" + + summary: str + """Brief description of the request""" + + tlp: Literal["clear", "amber", "amber-strict", "green", "red"] + """The CISA defined Traffic Light Protocol (TLP)""" + + updated: datetime + + completed: Optional[datetime] = None + + message_tokens: Optional[int] = None + """Tokens for the request messages""" + + readable_id: Optional[str] = None + """Readable Request ID""" + + status: Optional[Literal["open", "accepted", "reported", "approved", "completed", "declined"]] = None + """Request Status""" + + tokens: Optional[int] = None + """Tokens for the request""" diff --git a/src/cloudflare/types/cloudforce_one/list_item.py b/src/cloudflare/types/cloudforce_one/list_item.py new file mode 100644 index 00000000000..99703584af8 --- /dev/null +++ b/src/cloudflare/types/cloudforce_one/list_item.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ListItem"] + + +class ListItem(BaseModel): + id: str + """UUID""" + + created: datetime + """Request creation time""" + + priority: Literal["routine", "high", "urgent"] + + request: str + """Requested information from request""" + + summary: str + """Brief description of the request""" + + tlp: Literal["clear", "amber", "amber-strict", "green", "red"] + """The CISA defined Traffic Light Protocol (TLP)""" + + updated: datetime + """Request last updated time""" + + completed: Optional[datetime] = None + """Request completion time""" + + message_tokens: Optional[int] = None + """Tokens for the request messages""" + + readable_id: Optional[str] = None + """Readable Request ID""" + + status: Optional[Literal["open", "accepted", "reported", "approved", "completed", "declined"]] = None + """Request Status""" + + tokens: Optional[int] = None + """Tokens for the request""" diff --git a/src/cloudflare/types/cloudforce_one/quota.py b/src/cloudflare/types/cloudforce_one/quota.py new file mode 100644 index 00000000000..8eff78bfcc5 --- /dev/null +++ b/src/cloudflare/types/cloudforce_one/quota.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__ = ["Quota"] + + +class Quota(BaseModel): + anniversary_date: Optional[datetime] = None + """Anniversary date is when annual quota limit is refresh""" + + quarter_anniversary_date: Optional[datetime] = None + """Quater anniversary date is when quota limit is refreshed each quarter""" + + quota: Optional[int] = None + """Tokens for the quarter""" + + remaining: Optional[int] = None + """Tokens remaining for the quarter""" diff --git a/src/cloudflare/types/cloudforce_one/request_constants.py b/src/cloudflare/types/cloudforce_one/request_constants.py new file mode 100644 index 00000000000..d3679f51cdd --- /dev/null +++ b/src/cloudflare/types/cloudforce_one/request_constants.py @@ -0,0 +1,16 @@ +# 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__ = ["RequestConstants"] + + +class RequestConstants(BaseModel): + priority: Optional[List[Literal["routine", "high", "urgent"]]] = None + + status: Optional[List[Literal["open", "accepted", "reported", "approved", "completed", "declined"]]] = None + + tlp: Optional[List[Literal["clear", "amber", "amber-strict", "green", "red"]]] = None diff --git a/src/cloudflare/types/cloudforce_one/request_types.py b/src/cloudflare/types/cloudforce_one/request_types.py new file mode 100644 index 00000000000..829b4ebe664 --- /dev/null +++ b/src/cloudflare/types/cloudforce_one/request_types.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +__all__ = ["RequestTypes"] + +RequestTypes = List[str] diff --git a/src/cloudflare/types/cloudforce_one/requests/__init__.py b/src/cloudflare/types/cloudforce_one/requests/__init__.py index 84181ca8d9e..29b61ceae98 100644 --- a/src/cloudflare/types/cloudforce_one/requests/__init__.py +++ b/src/cloudflare/types/cloudforce_one/requests/__init__.py @@ -2,6 +2,9 @@ from __future__ import annotations +from .label import Label as Label +from .message import Message as Message +from .priority import Priority as Priority from .message_get_params import MessageGetParams as MessageGetParams from .message_get_response import MessageGetResponse as MessageGetResponse from .message_create_params import MessageCreateParams as MessageCreateParams @@ -10,5 +13,3 @@ from .priority_update_params import PriorityUpdateParams as PriorityUpdateParams from .message_delete_response import MessageDeleteResponse as MessageDeleteResponse from .priority_delete_response import PriorityDeleteResponse as PriorityDeleteResponse -from .cloudforce_one_priority_item import CloudforceOnePriorityItem as CloudforceOnePriorityItem -from .cloudforce_one_request_message_item import CloudforceOneRequestMessageItem as CloudforceOneRequestMessageItem diff --git a/src/cloudflare/types/cloudforce_one/requests/cloudforce_one_priority_item.py b/src/cloudflare/types/cloudforce_one/requests/cloudforce_one_priority_item.py deleted file mode 100644 index 3d57a3099e1..00000000000 --- a/src/cloudflare/types/cloudforce_one/requests/cloudforce_one_priority_item.py +++ /dev/null @@ -1,32 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["CloudforceOnePriorityItem"] - - -class CloudforceOnePriorityItem(BaseModel): - id: str - """UUID""" - - created: datetime - """Priority creation time""" - - labels: List[str] - """List of labels""" - - priority: int - """Priority""" - - requirement: str - """Requirement""" - - tlp: Literal["clear", "amber", "amber-strict", "green", "red"] - """The CISA defined Traffic Light Protocol (TLP)""" - - updated: datetime - """Priority last updated time""" diff --git a/src/cloudflare/types/cloudforce_one/requests/cloudforce_one_request_message_item.py b/src/cloudflare/types/cloudforce_one/requests/cloudforce_one_request_message_item.py deleted file mode 100644 index 0b5b47381ee..00000000000 --- a/src/cloudflare/types/cloudforce_one/requests/cloudforce_one_request_message_item.py +++ /dev/null @@ -1,28 +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__ = ["CloudforceOneRequestMessageItem"] - - -class CloudforceOneRequestMessageItem(BaseModel): - id: int - """Message ID""" - - author: str - """Author of message""" - - content: str - """Content of message""" - - is_follow_on_request: bool - """Message is a follow-on request""" - - updated: datetime - """Message last updated time""" - - created: Optional[datetime] = None - """Message creation time""" diff --git a/src/cloudflare/types/cloudforce_one/requests/label.py b/src/cloudflare/types/cloudforce_one/requests/label.py new file mode 100644 index 00000000000..589cb02b053 --- /dev/null +++ b/src/cloudflare/types/cloudforce_one/requests/label.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["Label"] + +Label = str diff --git a/src/cloudflare/types/cloudforce_one/requests/message.py b/src/cloudflare/types/cloudforce_one/requests/message.py new file mode 100644 index 00000000000..b36882e68c4 --- /dev/null +++ b/src/cloudflare/types/cloudforce_one/requests/message.py @@ -0,0 +1,28 @@ +# 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__ = ["Message"] + + +class Message(BaseModel): + id: int + """Message ID""" + + author: str + """Author of message""" + + content: str + """Content of message""" + + is_follow_on_request: bool + """Message is a follow-on request""" + + updated: datetime + """Message last updated time""" + + created: Optional[datetime] = None + """Message creation time""" diff --git a/src/cloudflare/types/cloudforce_one/requests/message_get_response.py b/src/cloudflare/types/cloudforce_one/requests/message_get_response.py index e793f236d52..52f2c5cf762 100644 --- a/src/cloudflare/types/cloudforce_one/requests/message_get_response.py +++ b/src/cloudflare/types/cloudforce_one/requests/message_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .cloudforce_one_request_message_item import CloudforceOneRequestMessageItem +from .message import Message __all__ = ["MessageGetResponse"] -MessageGetResponse = List[CloudforceOneRequestMessageItem] +MessageGetResponse = List[Message] diff --git a/src/cloudflare/types/cloudforce_one/requests/priority.py b/src/cloudflare/types/cloudforce_one/requests/priority.py new file mode 100644 index 00000000000..a374ce96aa1 --- /dev/null +++ b/src/cloudflare/types/cloudforce_one/requests/priority.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from .label import Label +from ...._models import BaseModel + +__all__ = ["Priority"] + + +class Priority(BaseModel): + id: str + """UUID""" + + created: datetime + """Priority creation time""" + + labels: List[Label] + """List of labels""" + + priority: int + """Priority""" + + requirement: str + """Requirement""" + + tlp: Literal["clear", "amber", "amber-strict", "green", "red"] + """The CISA defined Traffic Light Protocol (TLP)""" + + updated: datetime + """Priority last updated time""" diff --git a/src/cloudflare/types/cloudforce_one/requests/priority_create_params.py b/src/cloudflare/types/cloudforce_one/requests/priority_create_params.py index 15f32c8e6e4..155ad36b0c4 100644 --- a/src/cloudflare/types/cloudforce_one/requests/priority_create_params.py +++ b/src/cloudflare/types/cloudforce_one/requests/priority_create_params.py @@ -5,11 +5,13 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from .label import Label + __all__ = ["PriorityCreateParams"] class PriorityCreateParams(TypedDict, total=False): - labels: Required[List[str]] + labels: Required[List[Label]] """List of labels""" priority: Required[int] diff --git a/src/cloudflare/types/cloudforce_one/requests/priority_update_params.py b/src/cloudflare/types/cloudforce_one/requests/priority_update_params.py index 9b6663753ac..248b24319ce 100644 --- a/src/cloudflare/types/cloudforce_one/requests/priority_update_params.py +++ b/src/cloudflare/types/cloudforce_one/requests/priority_update_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from .label import Label + __all__ = ["PriorityUpdateParams"] @@ -12,7 +14,7 @@ class PriorityUpdateParams(TypedDict, total=False): account_identifier: Required[str] """Identifier""" - labels: Required[List[str]] + labels: Required[List[Label]] """List of labels""" priority: Required[int] diff --git a/src/cloudflare/types/custom_certificate_create_response.py b/src/cloudflare/types/custom_certificate_create_response.py deleted file mode 100644 index 2d47fd21628..00000000000 --- a/src/cloudflare/types/custom_certificate_create_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["CustomCertificateCreateResponse"] - -CustomCertificateCreateResponse = Union[str, object] diff --git a/src/cloudflare/types/custom_certificate_edit_response.py b/src/cloudflare/types/custom_certificate_edit_response.py deleted file mode 100644 index cd73fcedc37..00000000000 --- a/src/cloudflare/types/custom_certificate_edit_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["CustomCertificateEditResponse"] - -CustomCertificateEditResponse = Union[str, object] diff --git a/src/cloudflare/types/custom_certificate_get_response.py b/src/cloudflare/types/custom_certificate_get_response.py deleted file mode 100644 index 81ac453d05d..00000000000 --- a/src/cloudflare/types/custom_certificate_get_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["CustomCertificateGetResponse"] - -CustomCertificateGetResponse = Union[str, object] diff --git a/src/cloudflare/types/custom_certificates/__init__.py b/src/cloudflare/types/custom_certificates/__init__.py index 34164d05981..d6d56312339 100644 --- a/src/cloudflare/types/custom_certificates/__init__.py +++ b/src/cloudflare/types/custom_certificates/__init__.py @@ -2,5 +2,16 @@ from __future__ import annotations +from .geo_restrictions import GeoRestrictions as GeoRestrictions +from .custom_certificate import CustomCertificate as CustomCertificate +from .geo_restrictions_param import GeoRestrictionsParam as GeoRestrictionsParam from .prioritize_update_params import PrioritizeUpdateParams as PrioritizeUpdateParams from .prioritize_update_response import PrioritizeUpdateResponse as PrioritizeUpdateResponse +from .custom_certificate_edit_params import CustomCertificateEditParams as CustomCertificateEditParams +from .custom_certificate_list_params import CustomCertificateListParams as CustomCertificateListParams +from .custom_certificate_get_response import CustomCertificateGetResponse as CustomCertificateGetResponse +from .custom_certificate_create_params import CustomCertificateCreateParams as CustomCertificateCreateParams +from .custom_certificate_delete_params import CustomCertificateDeleteParams as CustomCertificateDeleteParams +from .custom_certificate_edit_response import CustomCertificateEditResponse as CustomCertificateEditResponse +from .custom_certificate_create_response import CustomCertificateCreateResponse as CustomCertificateCreateResponse +from .custom_certificate_delete_response import CustomCertificateDeleteResponse as CustomCertificateDeleteResponse diff --git a/src/cloudflare/types/custom_certificate.py b/src/cloudflare/types/custom_certificates/custom_certificate.py similarity index 87% rename from src/cloudflare/types/custom_certificate.py rename to src/cloudflare/types/custom_certificates/custom_certificate.py index ec5edeb63a9..b5579f8a95f 100644 --- a/src/cloudflare/types/custom_certificate.py +++ b/src/cloudflare/types/custom_certificates/custom_certificate.py @@ -4,21 +4,19 @@ from datetime import datetime from typing_extensions import Literal -from .._models import BaseModel -from .keyless_certificate_hostname import KeylessCertificateHostname +from ..._models import BaseModel +from .geo_restrictions import GeoRestrictions +from ..custom_hostnames.bundle_method import BundleMethod +from ..keyless_certificates.keyless_certificate import KeylessCertificate -__all__ = ["CustomCertificate", "GeoRestrictions"] - - -class GeoRestrictions(BaseModel): - label: Optional[Literal["us", "eu", "highest_security"]] = None +__all__ = ["CustomCertificate"] class CustomCertificate(BaseModel): id: str """Identifier""" - bundle_method: Literal["ubiquitous", "optimal", "force"] + bundle_method: BundleMethod """ A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses @@ -68,7 +66,7 @@ class CustomCertificate(BaseModel): for optimal performance. """ - keyless_server: Optional[KeylessCertificateHostname] = None + keyless_server: Optional[KeylessCertificate] = None policy: Optional[str] = None """ diff --git a/src/cloudflare/types/custom_certificate_create_params.py b/src/cloudflare/types/custom_certificates/custom_certificate_create_params.py similarity index 89% rename from src/cloudflare/types/custom_certificate_create_params.py rename to src/cloudflare/types/custom_certificates/custom_certificate_create_params.py index f517fc05ae5..015cc848ee0 100644 --- a/src/cloudflare/types/custom_certificate_create_params.py +++ b/src/cloudflare/types/custom_certificates/custom_certificate_create_params.py @@ -4,7 +4,10 @@ from typing_extensions import Literal, Required, TypedDict -__all__ = ["CustomCertificateCreateParams", "GeoRestrictions"] +from .geo_restrictions_param import GeoRestrictionsParam +from ..custom_hostnames.bundle_method import BundleMethod + +__all__ = ["CustomCertificateCreateParams"] class CustomCertificateCreateParams(TypedDict, total=False): @@ -17,7 +20,7 @@ class CustomCertificateCreateParams(TypedDict, total=False): private_key: Required[str] """The zone's private key.""" - bundle_method: Literal["ubiquitous", "optimal", "force"] + bundle_method: BundleMethod """ A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses @@ -25,7 +28,7 @@ class CustomCertificateCreateParams(TypedDict, total=False): chain, but does not otherwise modify it. """ - geo_restrictions: GeoRestrictions + geo_restrictions: GeoRestrictionsParam """ Specify the region where your private key can be held locally for optimal TLS performance. HTTPS connections to any excluded data center will still be fully @@ -54,7 +57,3 @@ class CustomCertificateCreateParams(TypedDict, total=False): The type 'legacy_custom' enables support for legacy clients which do not include SNI in the TLS handshake. """ - - -class GeoRestrictions(TypedDict, total=False): - label: Literal["us", "eu", "highest_security"] diff --git a/src/cloudflare/types/custom_certificates/custom_certificate_create_response.py b/src/cloudflare/types/custom_certificates/custom_certificate_create_response.py new file mode 100644 index 00000000000..051cffb09f8 --- /dev/null +++ b/src/cloudflare/types/custom_certificates/custom_certificate_create_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["CustomCertificateCreateResponse"] + +CustomCertificateCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/custom_certificates/custom_certificate_delete_params.py b/src/cloudflare/types/custom_certificates/custom_certificate_delete_params.py new file mode 100644 index 00000000000..2b9a145d0c7 --- /dev/null +++ b/src/cloudflare/types/custom_certificates/custom_certificate_delete_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__ = ["CustomCertificateDeleteParams"] + + +class CustomCertificateDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/custom_certificate_delete_response.py b/src/cloudflare/types/custom_certificates/custom_certificate_delete_response.py similarity index 88% rename from src/cloudflare/types/custom_certificate_delete_response.py rename to src/cloudflare/types/custom_certificates/custom_certificate_delete_response.py index 5c1e68f5ba8..0f730c57cbc 100644 --- a/src/cloudflare/types/custom_certificate_delete_response.py +++ b/src/cloudflare/types/custom_certificates/custom_certificate_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["CustomCertificateDeleteResponse"] diff --git a/src/cloudflare/types/custom_certificate_edit_params.py b/src/cloudflare/types/custom_certificates/custom_certificate_edit_params.py similarity index 85% rename from src/cloudflare/types/custom_certificate_edit_params.py rename to src/cloudflare/types/custom_certificates/custom_certificate_edit_params.py index e6a3d9ab525..3fc3b9281b0 100644 --- a/src/cloudflare/types/custom_certificate_edit_params.py +++ b/src/cloudflare/types/custom_certificates/custom_certificate_edit_params.py @@ -2,16 +2,19 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["CustomCertificateEditParams", "GeoRestrictions"] +from .geo_restrictions_param import GeoRestrictionsParam +from ..custom_hostnames.bundle_method import BundleMethod + +__all__ = ["CustomCertificateEditParams"] class CustomCertificateEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - bundle_method: Literal["ubiquitous", "optimal", "force"] + bundle_method: BundleMethod """ A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses @@ -22,7 +25,7 @@ class CustomCertificateEditParams(TypedDict, total=False): certificate: str """The zone's SSL certificate or certificate and the intermediate(s).""" - geo_restrictions: GeoRestrictions + geo_restrictions: GeoRestrictionsParam """ Specify the region where your private key can be held locally for optimal TLS performance. HTTPS connections to any excluded data center will still be fully @@ -48,7 +51,3 @@ class CustomCertificateEditParams(TypedDict, total=False): private_key: str """The zone's private key.""" - - -class GeoRestrictions(TypedDict, total=False): - label: Literal["us", "eu", "highest_security"] diff --git a/src/cloudflare/types/custom_certificates/custom_certificate_edit_response.py b/src/cloudflare/types/custom_certificates/custom_certificate_edit_response.py new file mode 100644 index 00000000000..eefb2807119 --- /dev/null +++ b/src/cloudflare/types/custom_certificates/custom_certificate_edit_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["CustomCertificateEditResponse"] + +CustomCertificateEditResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/custom_certificates/custom_certificate_get_response.py b/src/cloudflare/types/custom_certificates/custom_certificate_get_response.py new file mode 100644 index 00000000000..f49aed30a8c --- /dev/null +++ b/src/cloudflare/types/custom_certificates/custom_certificate_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["CustomCertificateGetResponse"] + +CustomCertificateGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/custom_certificate_list_params.py b/src/cloudflare/types/custom_certificates/custom_certificate_list_params.py similarity index 81% rename from src/cloudflare/types/custom_certificate_list_params.py rename to src/cloudflare/types/custom_certificates/custom_certificate_list_params.py index c375dcb5295..07d747ed472 100644 --- a/src/cloudflare/types/custom_certificate_list_params.py +++ b/src/cloudflare/types/custom_certificates/custom_certificate_list_params.py @@ -19,3 +19,6 @@ class CustomCertificateListParams(TypedDict, total=False): per_page: float """Number of zones per page.""" + + status: Literal["active", "expired", "deleted", "pending", "initializing"] + """Status of the zone's custom SSL.""" diff --git a/src/cloudflare/types/custom_certificates/geo_restrictions.py b/src/cloudflare/types/custom_certificates/geo_restrictions.py new file mode 100644 index 00000000000..05462d8d2f8 --- /dev/null +++ b/src/cloudflare/types/custom_certificates/geo_restrictions.py @@ -0,0 +1,12 @@ +# 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__ = ["GeoRestrictions"] + + +class GeoRestrictions(BaseModel): + label: Optional[Literal["us", "eu", "highest_security"]] = None diff --git a/src/cloudflare/types/custom_certificates/geo_restrictions_param.py b/src/cloudflare/types/custom_certificates/geo_restrictions_param.py new file mode 100644 index 00000000000..18590e2f34d --- /dev/null +++ b/src/cloudflare/types/custom_certificates/geo_restrictions_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["GeoRestrictionsParam"] + + +class GeoRestrictionsParam(TypedDict, total=False): + label: Literal["us", "eu", "highest_security"] diff --git a/src/cloudflare/types/custom_certificates/prioritize_update_response.py b/src/cloudflare/types/custom_certificates/prioritize_update_response.py index e2c917ce3ee..c61eef0af1a 100644 --- a/src/cloudflare/types/custom_certificates/prioritize_update_response.py +++ b/src/cloudflare/types/custom_certificates/prioritize_update_response.py @@ -2,7 +2,7 @@ from typing import List -from ..custom_certificate import CustomCertificate +from .custom_certificate import CustomCertificate __all__ = ["PrioritizeUpdateResponse"] diff --git a/src/cloudflare/types/custom_hostname_create_response.py b/src/cloudflare/types/custom_hostname_create_response.py deleted file mode 100644 index 73608df0ee5..00000000000 --- a/src/cloudflare/types/custom_hostname_create_response.py +++ /dev/null @@ -1,167 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["CustomHostnameCreateResponse", "SSL", "SSLSettings", "SSLValidationError", "SSLValidationRecord"] - - -class SSLSettings(BaseModel): - ciphers: Optional[List[str]] = None - """An allowlist of ciphers for TLS termination. - - These ciphers must be in the BoringSSL format. - """ - - early_hints: Optional[Literal["on", "off"]] = None - """Whether or not Early Hints is enabled.""" - - http2: Optional[Literal["on", "off"]] = None - """Whether or not HTTP2 is enabled.""" - - min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None - """The minimum TLS version supported.""" - - tls_1_3: Optional[Literal["on", "off"]] = None - """Whether or not TLS 1.3 is enabled.""" - - -class SSLValidationError(BaseModel): - message: Optional[str] = None - """A domain validation error.""" - - -class SSLValidationRecord(BaseModel): - emails: Optional[List[object]] = None - """ - The set of email addresses that the certificate authority (CA) will use to - complete domain validation. - """ - - http_body: Optional[str] = None - """ - The content that the certificate authority (CA) will expect to find at the - http_url during the domain validation. - """ - - http_url: Optional[str] = None - """The url that will be checked during domain validation.""" - - txt_name: Optional[str] = None - """ - The hostname that the certificate authority (CA) will check for a TXT record - during domain validation . - """ - - txt_value: Optional[str] = None - """ - The TXT record that the certificate authority (CA) will check during domain - validation. - """ - - -class SSL(BaseModel): - id: Optional[str] = None - """Custom hostname SSL identifier tag.""" - - bundle_method: Optional[Literal["ubiquitous", "optimal", "force"]] = None - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None - """The Certificate Authority that will issue the certificate""" - - custom_certificate: Optional[str] = None - """If a custom uploaded certificate is used.""" - - custom_csr_id: Optional[str] = None - """The identifier for the Custom CSR that was used.""" - - custom_key: Optional[str] = None - """The key for a custom uploaded certificate.""" - - expires_on: Optional[datetime] = None - """The time the custom certificate expires on.""" - - hosts: Optional[List[object]] = None - """A list of Hostnames on a custom uploaded certificate.""" - - issuer: Optional[str] = None - """The issuer on a custom uploaded certificate.""" - - method: Optional[Literal["http", "txt", "email"]] = None - """Domain control validation (DCV) method used for this hostname.""" - - serial_number: Optional[str] = None - """The serial number on a custom uploaded certificate.""" - - settings: Optional[SSLSettings] = None - """SSL specific settings.""" - - signature: Optional[str] = None - """The signature on a custom uploaded certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_validation", - "deleted", - "pending_issuance", - "pending_deployment", - "pending_deletion", - "pending_expiration", - "expired", - "active", - "initializing_timed_out", - "validation_timed_out", - "issuance_timed_out", - "deployment_timed_out", - "deletion_timed_out", - "pending_cleanup", - "staging_deployment", - "staging_active", - "deactivating", - "inactive", - "backup_issued", - "holding_deployment", - ] - ] = None - """Status of the hostname's SSL certificates.""" - - type: Optional[Literal["dv"]] = None - """Level of validation to be used for this hostname. - - Domain validation (dv) must be used. - """ - - uploaded_on: Optional[datetime] = None - """The time the custom certificate was uploaded.""" - - validation_errors: Optional[List[SSLValidationError]] = None - """ - Domain validation errors that have been received by the certificate authority - (CA). - """ - - validation_records: Optional[List[SSLValidationRecord]] = None - - wildcard: Optional[bool] = None - """Indicates whether the certificate covers a wildcard.""" - - -class CustomHostnameCreateResponse(BaseModel): - id: str - """Identifier""" - - hostname: str - """The custom hostname that will point to your hostname via CNAME.""" - - ssl: SSL - """SSL properties for the custom hostname.""" diff --git a/src/cloudflare/types/custom_hostname_edit_response.py b/src/cloudflare/types/custom_hostname_edit_response.py deleted file mode 100644 index 5d7176fbdcf..00000000000 --- a/src/cloudflare/types/custom_hostname_edit_response.py +++ /dev/null @@ -1,167 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["CustomHostnameEditResponse", "SSL", "SSLSettings", "SSLValidationError", "SSLValidationRecord"] - - -class SSLSettings(BaseModel): - ciphers: Optional[List[str]] = None - """An allowlist of ciphers for TLS termination. - - These ciphers must be in the BoringSSL format. - """ - - early_hints: Optional[Literal["on", "off"]] = None - """Whether or not Early Hints is enabled.""" - - http2: Optional[Literal["on", "off"]] = None - """Whether or not HTTP2 is enabled.""" - - min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None - """The minimum TLS version supported.""" - - tls_1_3: Optional[Literal["on", "off"]] = None - """Whether or not TLS 1.3 is enabled.""" - - -class SSLValidationError(BaseModel): - message: Optional[str] = None - """A domain validation error.""" - - -class SSLValidationRecord(BaseModel): - emails: Optional[List[object]] = None - """ - The set of email addresses that the certificate authority (CA) will use to - complete domain validation. - """ - - http_body: Optional[str] = None - """ - The content that the certificate authority (CA) will expect to find at the - http_url during the domain validation. - """ - - http_url: Optional[str] = None - """The url that will be checked during domain validation.""" - - txt_name: Optional[str] = None - """ - The hostname that the certificate authority (CA) will check for a TXT record - during domain validation . - """ - - txt_value: Optional[str] = None - """ - The TXT record that the certificate authority (CA) will check during domain - validation. - """ - - -class SSL(BaseModel): - id: Optional[str] = None - """Custom hostname SSL identifier tag.""" - - bundle_method: Optional[Literal["ubiquitous", "optimal", "force"]] = None - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None - """The Certificate Authority that will issue the certificate""" - - custom_certificate: Optional[str] = None - """If a custom uploaded certificate is used.""" - - custom_csr_id: Optional[str] = None - """The identifier for the Custom CSR that was used.""" - - custom_key: Optional[str] = None - """The key for a custom uploaded certificate.""" - - expires_on: Optional[datetime] = None - """The time the custom certificate expires on.""" - - hosts: Optional[List[object]] = None - """A list of Hostnames on a custom uploaded certificate.""" - - issuer: Optional[str] = None - """The issuer on a custom uploaded certificate.""" - - method: Optional[Literal["http", "txt", "email"]] = None - """Domain control validation (DCV) method used for this hostname.""" - - serial_number: Optional[str] = None - """The serial number on a custom uploaded certificate.""" - - settings: Optional[SSLSettings] = None - """SSL specific settings.""" - - signature: Optional[str] = None - """The signature on a custom uploaded certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_validation", - "deleted", - "pending_issuance", - "pending_deployment", - "pending_deletion", - "pending_expiration", - "expired", - "active", - "initializing_timed_out", - "validation_timed_out", - "issuance_timed_out", - "deployment_timed_out", - "deletion_timed_out", - "pending_cleanup", - "staging_deployment", - "staging_active", - "deactivating", - "inactive", - "backup_issued", - "holding_deployment", - ] - ] = None - """Status of the hostname's SSL certificates.""" - - type: Optional[Literal["dv"]] = None - """Level of validation to be used for this hostname. - - Domain validation (dv) must be used. - """ - - uploaded_on: Optional[datetime] = None - """The time the custom certificate was uploaded.""" - - validation_errors: Optional[List[SSLValidationError]] = None - """ - Domain validation errors that have been received by the certificate authority - (CA). - """ - - validation_records: Optional[List[SSLValidationRecord]] = None - - wildcard: Optional[bool] = None - """Indicates whether the certificate covers a wildcard.""" - - -class CustomHostnameEditResponse(BaseModel): - id: str - """Identifier""" - - hostname: str - """The custom hostname that will point to your hostname via CNAME.""" - - ssl: SSL - """SSL properties for the custom hostname.""" diff --git a/src/cloudflare/types/custom_hostname_get_response.py b/src/cloudflare/types/custom_hostname_get_response.py deleted file mode 100644 index 8ab02d4ba45..00000000000 --- a/src/cloudflare/types/custom_hostname_get_response.py +++ /dev/null @@ -1,167 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["CustomHostnameGetResponse", "SSL", "SSLSettings", "SSLValidationError", "SSLValidationRecord"] - - -class SSLSettings(BaseModel): - ciphers: Optional[List[str]] = None - """An allowlist of ciphers for TLS termination. - - These ciphers must be in the BoringSSL format. - """ - - early_hints: Optional[Literal["on", "off"]] = None - """Whether or not Early Hints is enabled.""" - - http2: Optional[Literal["on", "off"]] = None - """Whether or not HTTP2 is enabled.""" - - min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None - """The minimum TLS version supported.""" - - tls_1_3: Optional[Literal["on", "off"]] = None - """Whether or not TLS 1.3 is enabled.""" - - -class SSLValidationError(BaseModel): - message: Optional[str] = None - """A domain validation error.""" - - -class SSLValidationRecord(BaseModel): - emails: Optional[List[object]] = None - """ - The set of email addresses that the certificate authority (CA) will use to - complete domain validation. - """ - - http_body: Optional[str] = None - """ - The content that the certificate authority (CA) will expect to find at the - http_url during the domain validation. - """ - - http_url: Optional[str] = None - """The url that will be checked during domain validation.""" - - txt_name: Optional[str] = None - """ - The hostname that the certificate authority (CA) will check for a TXT record - during domain validation . - """ - - txt_value: Optional[str] = None - """ - The TXT record that the certificate authority (CA) will check during domain - validation. - """ - - -class SSL(BaseModel): - id: Optional[str] = None - """Custom hostname SSL identifier tag.""" - - bundle_method: Optional[Literal["ubiquitous", "optimal", "force"]] = None - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None - """The Certificate Authority that will issue the certificate""" - - custom_certificate: Optional[str] = None - """If a custom uploaded certificate is used.""" - - custom_csr_id: Optional[str] = None - """The identifier for the Custom CSR that was used.""" - - custom_key: Optional[str] = None - """The key for a custom uploaded certificate.""" - - expires_on: Optional[datetime] = None - """The time the custom certificate expires on.""" - - hosts: Optional[List[object]] = None - """A list of Hostnames on a custom uploaded certificate.""" - - issuer: Optional[str] = None - """The issuer on a custom uploaded certificate.""" - - method: Optional[Literal["http", "txt", "email"]] = None - """Domain control validation (DCV) method used for this hostname.""" - - serial_number: Optional[str] = None - """The serial number on a custom uploaded certificate.""" - - settings: Optional[SSLSettings] = None - """SSL specific settings.""" - - signature: Optional[str] = None - """The signature on a custom uploaded certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_validation", - "deleted", - "pending_issuance", - "pending_deployment", - "pending_deletion", - "pending_expiration", - "expired", - "active", - "initializing_timed_out", - "validation_timed_out", - "issuance_timed_out", - "deployment_timed_out", - "deletion_timed_out", - "pending_cleanup", - "staging_deployment", - "staging_active", - "deactivating", - "inactive", - "backup_issued", - "holding_deployment", - ] - ] = None - """Status of the hostname's SSL certificates.""" - - type: Optional[Literal["dv"]] = None - """Level of validation to be used for this hostname. - - Domain validation (dv) must be used. - """ - - uploaded_on: Optional[datetime] = None - """The time the custom certificate was uploaded.""" - - validation_errors: Optional[List[SSLValidationError]] = None - """ - Domain validation errors that have been received by the certificate authority - (CA). - """ - - validation_records: Optional[List[SSLValidationRecord]] = None - - wildcard: Optional[bool] = None - """Indicates whether the certificate covers a wildcard.""" - - -class CustomHostnameGetResponse(BaseModel): - id: str - """Identifier""" - - hostname: str - """The custom hostname that will point to your hostname via CNAME.""" - - ssl: SSL - """SSL properties for the custom hostname.""" diff --git a/src/cloudflare/types/custom_hostname_list_response.py b/src/cloudflare/types/custom_hostname_list_response.py deleted file mode 100644 index a010884bd61..00000000000 --- a/src/cloudflare/types/custom_hostname_list_response.py +++ /dev/null @@ -1,167 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["CustomHostnameListResponse", "SSL", "SSLSettings", "SSLValidationError", "SSLValidationRecord"] - - -class SSLSettings(BaseModel): - ciphers: Optional[List[str]] = None - """An allowlist of ciphers for TLS termination. - - These ciphers must be in the BoringSSL format. - """ - - early_hints: Optional[Literal["on", "off"]] = None - """Whether or not Early Hints is enabled.""" - - http2: Optional[Literal["on", "off"]] = None - """Whether or not HTTP2 is enabled.""" - - min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None - """The minimum TLS version supported.""" - - tls_1_3: Optional[Literal["on", "off"]] = None - """Whether or not TLS 1.3 is enabled.""" - - -class SSLValidationError(BaseModel): - message: Optional[str] = None - """A domain validation error.""" - - -class SSLValidationRecord(BaseModel): - emails: Optional[List[object]] = None - """ - The set of email addresses that the certificate authority (CA) will use to - complete domain validation. - """ - - http_body: Optional[str] = None - """ - The content that the certificate authority (CA) will expect to find at the - http_url during the domain validation. - """ - - http_url: Optional[str] = None - """The url that will be checked during domain validation.""" - - txt_name: Optional[str] = None - """ - The hostname that the certificate authority (CA) will check for a TXT record - during domain validation . - """ - - txt_value: Optional[str] = None - """ - The TXT record that the certificate authority (CA) will check during domain - validation. - """ - - -class SSL(BaseModel): - id: Optional[str] = None - """Custom hostname SSL identifier tag.""" - - bundle_method: Optional[Literal["ubiquitous", "optimal", "force"]] = None - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None - """The Certificate Authority that will issue the certificate""" - - custom_certificate: Optional[str] = None - """If a custom uploaded certificate is used.""" - - custom_csr_id: Optional[str] = None - """The identifier for the Custom CSR that was used.""" - - custom_key: Optional[str] = None - """The key for a custom uploaded certificate.""" - - expires_on: Optional[datetime] = None - """The time the custom certificate expires on.""" - - hosts: Optional[List[object]] = None - """A list of Hostnames on a custom uploaded certificate.""" - - issuer: Optional[str] = None - """The issuer on a custom uploaded certificate.""" - - method: Optional[Literal["http", "txt", "email"]] = None - """Domain control validation (DCV) method used for this hostname.""" - - serial_number: Optional[str] = None - """The serial number on a custom uploaded certificate.""" - - settings: Optional[SSLSettings] = None - """SSL specific settings.""" - - signature: Optional[str] = None - """The signature on a custom uploaded certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_validation", - "deleted", - "pending_issuance", - "pending_deployment", - "pending_deletion", - "pending_expiration", - "expired", - "active", - "initializing_timed_out", - "validation_timed_out", - "issuance_timed_out", - "deployment_timed_out", - "deletion_timed_out", - "pending_cleanup", - "staging_deployment", - "staging_active", - "deactivating", - "inactive", - "backup_issued", - "holding_deployment", - ] - ] = None - """Status of the hostname's SSL certificates.""" - - type: Optional[Literal["dv"]] = None - """Level of validation to be used for this hostname. - - Domain validation (dv) must be used. - """ - - uploaded_on: Optional[datetime] = None - """The time the custom certificate was uploaded.""" - - validation_errors: Optional[List[SSLValidationError]] = None - """ - Domain validation errors that have been received by the certificate authority - (CA). - """ - - validation_records: Optional[List[SSLValidationRecord]] = None - - wildcard: Optional[bool] = None - """Indicates whether the certificate covers a wildcard.""" - - -class CustomHostnameListResponse(BaseModel): - id: str - """Identifier""" - - hostname: str - """The custom hostname that will point to your hostname via CNAME.""" - - ssl: SSL - """SSL properties for the custom hostname.""" diff --git a/src/cloudflare/types/custom_hostnames/__init__.py b/src/cloudflare/types/custom_hostnames/__init__.py index 2de61f1dc9e..ba95ee9a287 100644 --- a/src/cloudflare/types/custom_hostnames/__init__.py +++ b/src/cloudflare/types/custom_hostnames/__init__.py @@ -2,7 +2,20 @@ from __future__ import annotations +from .dcv_method import DCVMethod as DCVMethod +from .bundle_method import BundleMethod as BundleMethod +from .domain_validation_type import DomainValidationType as DomainValidationType +from .custom_hostname_edit_params import CustomHostnameEditParams as CustomHostnameEditParams +from .custom_hostname_list_params import CustomHostnameListParams as CustomHostnameListParams +from .custom_hostname_get_response import CustomHostnameGetResponse as CustomHostnameGetResponse from .fallback_origin_get_response import FallbackOriginGetResponse as FallbackOriginGetResponse +from .custom_hostname_create_params import CustomHostnameCreateParams as CustomHostnameCreateParams +from .custom_hostname_delete_params import CustomHostnameDeleteParams as CustomHostnameDeleteParams +from .custom_hostname_edit_response import CustomHostnameEditResponse as CustomHostnameEditResponse +from .custom_hostname_list_response import CustomHostnameListResponse as CustomHostnameListResponse +from .fallback_origin_delete_params import FallbackOriginDeleteParams as FallbackOriginDeleteParams from .fallback_origin_update_params import FallbackOriginUpdateParams as FallbackOriginUpdateParams +from .custom_hostname_create_response import CustomHostnameCreateResponse as CustomHostnameCreateResponse +from .custom_hostname_delete_response import CustomHostnameDeleteResponse as CustomHostnameDeleteResponse from .fallback_origin_delete_response import FallbackOriginDeleteResponse as FallbackOriginDeleteResponse from .fallback_origin_update_response import FallbackOriginUpdateResponse as FallbackOriginUpdateResponse diff --git a/src/cloudflare/types/custom_hostnames/bundle_method.py b/src/cloudflare/types/custom_hostnames/bundle_method.py new file mode 100644 index 00000000000..eb7600c9e10 --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/bundle_method.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["BundleMethod"] + +BundleMethod = Literal["ubiquitous", "optimal", "force"] diff --git a/src/cloudflare/types/custom_hostname_create_params.py b/src/cloudflare/types/custom_hostnames/custom_hostname_create_params.py similarity index 91% rename from src/cloudflare/types/custom_hostname_create_params.py rename to src/cloudflare/types/custom_hostnames/custom_hostname_create_params.py index 31262f87b56..ef1ec55d60b 100644 --- a/src/cloudflare/types/custom_hostname_create_params.py +++ b/src/cloudflare/types/custom_hostnames/custom_hostname_create_params.py @@ -5,6 +5,10 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from .dcv_method import DCVMethod +from .bundle_method import BundleMethod +from .domain_validation_type import DomainValidationType + __all__ = ["CustomHostnameCreateParams", "SSL", "SSLSettings", "CustomMetadata"] @@ -43,7 +47,7 @@ class SSLSettings(TypedDict, total=False): class SSL(TypedDict, total=False): - bundle_method: Literal["ubiquitous", "optimal", "force"] + bundle_method: BundleMethod """ A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses @@ -60,13 +64,13 @@ class SSL(TypedDict, total=False): custom_key: str """The key for a custom uploaded certificate.""" - method: Literal["http", "txt", "email"] + method: DCVMethod """Domain control validation (DCV) method used for this hostname.""" settings: SSLSettings """SSL specific settings.""" - type: Literal["dv"] + type: DomainValidationType """Level of validation to be used for this hostname. Domain validation (dv) must be used. diff --git a/src/cloudflare/types/custom_hostnames/custom_hostname_create_response.py b/src/cloudflare/types/custom_hostnames/custom_hostname_create_response.py new file mode 100644 index 00000000000..236e82ae631 --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/custom_hostname_create_response.py @@ -0,0 +1,261 @@ +# 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 +from .dcv_method import DCVMethod +from .bundle_method import BundleMethod +from .domain_validation_type import DomainValidationType + +__all__ = [ + "CustomHostnameCreateResponse", + "SSL", + "SSLSettings", + "SSLValidationError", + "SSLValidationRecord", + "CustomMetadata", + "OwnershipVerification", + "OwnershipVerificationHTTP", +] + + +class SSLSettings(BaseModel): + ciphers: Optional[List[str]] = None + """An allowlist of ciphers for TLS termination. + + These ciphers must be in the BoringSSL format. + """ + + early_hints: Optional[Literal["on", "off"]] = None + """Whether or not Early Hints is enabled.""" + + http2: Optional[Literal["on", "off"]] = None + """Whether or not HTTP2 is enabled.""" + + min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None + """The minimum TLS version supported.""" + + tls_1_3: Optional[Literal["on", "off"]] = None + """Whether or not TLS 1.3 is enabled.""" + + +class SSLValidationError(BaseModel): + message: Optional[str] = None + """A domain validation error.""" + + +class SSLValidationRecord(BaseModel): + emails: Optional[List[object]] = None + """ + The set of email addresses that the certificate authority (CA) will use to + complete domain validation. + """ + + http_body: Optional[str] = None + """ + The content that the certificate authority (CA) will expect to find at the + http_url during the domain validation. + """ + + http_url: Optional[str] = None + """The url that will be checked during domain validation.""" + + txt_name: Optional[str] = None + """ + The hostname that the certificate authority (CA) will check for a TXT record + during domain validation . + """ + + txt_value: Optional[str] = None + """ + The TXT record that the certificate authority (CA) will check during domain + validation. + """ + + +class SSL(BaseModel): + id: Optional[str] = None + """Custom hostname SSL identifier tag.""" + + bundle_method: Optional[BundleMethod] = None + """ + A ubiquitous bundle has the highest probability of being verified everywhere, + even by clients using outdated or unusual trust stores. An optimal bundle uses + the shortest chain and newest intermediates. And the force bundle verifies the + chain, but does not otherwise modify it. + """ + + certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None + """The Certificate Authority that will issue the certificate""" + + custom_certificate: Optional[str] = None + """If a custom uploaded certificate is used.""" + + custom_csr_id: Optional[str] = None + """The identifier for the Custom CSR that was used.""" + + custom_key: Optional[str] = None + """The key for a custom uploaded certificate.""" + + expires_on: Optional[datetime] = None + """The time the custom certificate expires on.""" + + hosts: Optional[List[object]] = None + """A list of Hostnames on a custom uploaded certificate.""" + + issuer: Optional[str] = None + """The issuer on a custom uploaded certificate.""" + + method: Optional[DCVMethod] = None + """Domain control validation (DCV) method used for this hostname.""" + + serial_number: Optional[str] = None + """The serial number on a custom uploaded certificate.""" + + settings: Optional[SSLSettings] = None + """SSL specific settings.""" + + signature: Optional[str] = None + """The signature on a custom uploaded certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_validation", + "deleted", + "pending_issuance", + "pending_deployment", + "pending_deletion", + "pending_expiration", + "expired", + "active", + "initializing_timed_out", + "validation_timed_out", + "issuance_timed_out", + "deployment_timed_out", + "deletion_timed_out", + "pending_cleanup", + "staging_deployment", + "staging_active", + "deactivating", + "inactive", + "backup_issued", + "holding_deployment", + ] + ] = None + """Status of the hostname's SSL certificates.""" + + type: Optional[DomainValidationType] = None + """Level of validation to be used for this hostname. + + Domain validation (dv) must be used. + """ + + uploaded_on: Optional[datetime] = None + """The time the custom certificate was uploaded.""" + + validation_errors: Optional[List[SSLValidationError]] = None + """ + Domain validation errors that have been received by the certificate authority + (CA). + """ + + validation_records: Optional[List[SSLValidationRecord]] = None + + wildcard: Optional[bool] = None + """Indicates whether the certificate covers a wildcard.""" + + +class CustomMetadata(BaseModel): + key: Optional[str] = None + """Unique metadata for this hostname.""" + + +class OwnershipVerification(BaseModel): + name: Optional[str] = None + """DNS Name for record.""" + + type: Optional[Literal["txt"]] = None + """DNS Record type.""" + + value: Optional[str] = None + """Content for the record.""" + + +class OwnershipVerificationHTTP(BaseModel): + http_body: Optional[str] = None + """Token to be served.""" + + http_url: Optional[str] = None + """ + The HTTP URL that will be checked during custom hostname verification and where + the customer should host the token. + """ + + +class CustomHostnameCreateResponse(BaseModel): + id: str + """Identifier""" + + hostname: str + """The custom hostname that will point to your hostname via CNAME.""" + + ssl: SSL + """SSL properties for the custom hostname.""" + + created_at: Optional[datetime] = None + """This is the time the hostname was created.""" + + custom_metadata: Optional[CustomMetadata] = None + """These are per-hostname (customer) settings.""" + + custom_origin_server: Optional[str] = None + """ + a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + record. + """ + + custom_origin_sni: Optional[str] = None + """ + A hostname that will be sent to your custom origin server as SNI for TLS + handshake. This can be a valid subdomain of the zone or custom origin server + name or the string ':request_host_header:' which will cause the host header in + the request to be used as SNI. Not configurable with default/fallback origin + server. + """ + + ownership_verification: Optional[OwnershipVerification] = None + """This is a record which can be placed to activate a hostname.""" + + ownership_verification_http: Optional[OwnershipVerificationHTTP] = None + """ + This presents the token to be served by the given http url to activate a + hostname. + """ + + status: Optional[ + Literal[ + "active", + "pending", + "active_redeploying", + "moved", + "pending_deletion", + "deleted", + "pending_blocked", + "pending_migration", + "pending_provisioned", + "test_pending", + "test_active", + "test_active_apex", + "test_blocked", + "test_failed", + "provisioned", + "blocked", + ] + ] = None + """Status of the hostname's activation.""" + + verification_errors: Optional[List[object]] = None + """These are errors that were encountered while trying to activate a hostname.""" diff --git a/src/cloudflare/types/custom_hostnames/custom_hostname_delete_params.py b/src/cloudflare/types/custom_hostnames/custom_hostname_delete_params.py new file mode 100644 index 00000000000..3c96f695143 --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/custom_hostname_delete_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__ = ["CustomHostnameDeleteParams"] + + +class CustomHostnameDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/custom_hostname_delete_response.py b/src/cloudflare/types/custom_hostnames/custom_hostname_delete_response.py similarity index 88% rename from src/cloudflare/types/custom_hostname_delete_response.py rename to src/cloudflare/types/custom_hostnames/custom_hostname_delete_response.py index f4a736fa8ce..138a18a96ed 100644 --- a/src/cloudflare/types/custom_hostname_delete_response.py +++ b/src/cloudflare/types/custom_hostnames/custom_hostname_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["CustomHostnameDeleteResponse"] diff --git a/src/cloudflare/types/custom_hostname_edit_params.py b/src/cloudflare/types/custom_hostnames/custom_hostname_edit_params.py similarity index 92% rename from src/cloudflare/types/custom_hostname_edit_params.py rename to src/cloudflare/types/custom_hostnames/custom_hostname_edit_params.py index e2218a1d971..a1c237659da 100644 --- a/src/cloudflare/types/custom_hostname_edit_params.py +++ b/src/cloudflare/types/custom_hostnames/custom_hostname_edit_params.py @@ -5,6 +5,10 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from .dcv_method import DCVMethod +from .bundle_method import BundleMethod +from .domain_validation_type import DomainValidationType + __all__ = ["CustomHostnameEditParams", "CustomMetadata", "SSL", "SSLSettings"] @@ -60,7 +64,7 @@ class SSLSettings(TypedDict, total=False): class SSL(TypedDict, total=False): - bundle_method: Literal["ubiquitous", "optimal", "force"] + bundle_method: BundleMethod """ A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses @@ -77,13 +81,13 @@ class SSL(TypedDict, total=False): custom_key: str """The key for a custom uploaded certificate.""" - method: Literal["http", "txt", "email"] + method: DCVMethod """Domain control validation (DCV) method used for this hostname.""" settings: SSLSettings """SSL specific settings.""" - type: Literal["dv"] + type: DomainValidationType """Level of validation to be used for this hostname. Domain validation (dv) must be used. diff --git a/src/cloudflare/types/custom_hostnames/custom_hostname_edit_response.py b/src/cloudflare/types/custom_hostnames/custom_hostname_edit_response.py new file mode 100644 index 00000000000..8697979d1a7 --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/custom_hostname_edit_response.py @@ -0,0 +1,261 @@ +# 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 +from .dcv_method import DCVMethod +from .bundle_method import BundleMethod +from .domain_validation_type import DomainValidationType + +__all__ = [ + "CustomHostnameEditResponse", + "SSL", + "SSLSettings", + "SSLValidationError", + "SSLValidationRecord", + "CustomMetadata", + "OwnershipVerification", + "OwnershipVerificationHTTP", +] + + +class SSLSettings(BaseModel): + ciphers: Optional[List[str]] = None + """An allowlist of ciphers for TLS termination. + + These ciphers must be in the BoringSSL format. + """ + + early_hints: Optional[Literal["on", "off"]] = None + """Whether or not Early Hints is enabled.""" + + http2: Optional[Literal["on", "off"]] = None + """Whether or not HTTP2 is enabled.""" + + min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None + """The minimum TLS version supported.""" + + tls_1_3: Optional[Literal["on", "off"]] = None + """Whether or not TLS 1.3 is enabled.""" + + +class SSLValidationError(BaseModel): + message: Optional[str] = None + """A domain validation error.""" + + +class SSLValidationRecord(BaseModel): + emails: Optional[List[object]] = None + """ + The set of email addresses that the certificate authority (CA) will use to + complete domain validation. + """ + + http_body: Optional[str] = None + """ + The content that the certificate authority (CA) will expect to find at the + http_url during the domain validation. + """ + + http_url: Optional[str] = None + """The url that will be checked during domain validation.""" + + txt_name: Optional[str] = None + """ + The hostname that the certificate authority (CA) will check for a TXT record + during domain validation . + """ + + txt_value: Optional[str] = None + """ + The TXT record that the certificate authority (CA) will check during domain + validation. + """ + + +class SSL(BaseModel): + id: Optional[str] = None + """Custom hostname SSL identifier tag.""" + + bundle_method: Optional[BundleMethod] = None + """ + A ubiquitous bundle has the highest probability of being verified everywhere, + even by clients using outdated or unusual trust stores. An optimal bundle uses + the shortest chain and newest intermediates. And the force bundle verifies the + chain, but does not otherwise modify it. + """ + + certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None + """The Certificate Authority that will issue the certificate""" + + custom_certificate: Optional[str] = None + """If a custom uploaded certificate is used.""" + + custom_csr_id: Optional[str] = None + """The identifier for the Custom CSR that was used.""" + + custom_key: Optional[str] = None + """The key for a custom uploaded certificate.""" + + expires_on: Optional[datetime] = None + """The time the custom certificate expires on.""" + + hosts: Optional[List[object]] = None + """A list of Hostnames on a custom uploaded certificate.""" + + issuer: Optional[str] = None + """The issuer on a custom uploaded certificate.""" + + method: Optional[DCVMethod] = None + """Domain control validation (DCV) method used for this hostname.""" + + serial_number: Optional[str] = None + """The serial number on a custom uploaded certificate.""" + + settings: Optional[SSLSettings] = None + """SSL specific settings.""" + + signature: Optional[str] = None + """The signature on a custom uploaded certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_validation", + "deleted", + "pending_issuance", + "pending_deployment", + "pending_deletion", + "pending_expiration", + "expired", + "active", + "initializing_timed_out", + "validation_timed_out", + "issuance_timed_out", + "deployment_timed_out", + "deletion_timed_out", + "pending_cleanup", + "staging_deployment", + "staging_active", + "deactivating", + "inactive", + "backup_issued", + "holding_deployment", + ] + ] = None + """Status of the hostname's SSL certificates.""" + + type: Optional[DomainValidationType] = None + """Level of validation to be used for this hostname. + + Domain validation (dv) must be used. + """ + + uploaded_on: Optional[datetime] = None + """The time the custom certificate was uploaded.""" + + validation_errors: Optional[List[SSLValidationError]] = None + """ + Domain validation errors that have been received by the certificate authority + (CA). + """ + + validation_records: Optional[List[SSLValidationRecord]] = None + + wildcard: Optional[bool] = None + """Indicates whether the certificate covers a wildcard.""" + + +class CustomMetadata(BaseModel): + key: Optional[str] = None + """Unique metadata for this hostname.""" + + +class OwnershipVerification(BaseModel): + name: Optional[str] = None + """DNS Name for record.""" + + type: Optional[Literal["txt"]] = None + """DNS Record type.""" + + value: Optional[str] = None + """Content for the record.""" + + +class OwnershipVerificationHTTP(BaseModel): + http_body: Optional[str] = None + """Token to be served.""" + + http_url: Optional[str] = None + """ + The HTTP URL that will be checked during custom hostname verification and where + the customer should host the token. + """ + + +class CustomHostnameEditResponse(BaseModel): + id: str + """Identifier""" + + hostname: str + """The custom hostname that will point to your hostname via CNAME.""" + + ssl: SSL + """SSL properties for the custom hostname.""" + + created_at: Optional[datetime] = None + """This is the time the hostname was created.""" + + custom_metadata: Optional[CustomMetadata] = None + """These are per-hostname (customer) settings.""" + + custom_origin_server: Optional[str] = None + """ + a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + record. + """ + + custom_origin_sni: Optional[str] = None + """ + A hostname that will be sent to your custom origin server as SNI for TLS + handshake. This can be a valid subdomain of the zone or custom origin server + name or the string ':request_host_header:' which will cause the host header in + the request to be used as SNI. Not configurable with default/fallback origin + server. + """ + + ownership_verification: Optional[OwnershipVerification] = None + """This is a record which can be placed to activate a hostname.""" + + ownership_verification_http: Optional[OwnershipVerificationHTTP] = None + """ + This presents the token to be served by the given http url to activate a + hostname. + """ + + status: Optional[ + Literal[ + "active", + "pending", + "active_redeploying", + "moved", + "pending_deletion", + "deleted", + "pending_blocked", + "pending_migration", + "pending_provisioned", + "test_pending", + "test_active", + "test_active_apex", + "test_blocked", + "test_failed", + "provisioned", + "blocked", + ] + ] = None + """Status of the hostname's activation.""" + + verification_errors: Optional[List[object]] = None + """These are errors that were encountered while trying to activate a hostname.""" diff --git a/src/cloudflare/types/custom_hostnames/custom_hostname_get_response.py b/src/cloudflare/types/custom_hostnames/custom_hostname_get_response.py new file mode 100644 index 00000000000..1b539d1df8e --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/custom_hostname_get_response.py @@ -0,0 +1,261 @@ +# 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 +from .dcv_method import DCVMethod +from .bundle_method import BundleMethod +from .domain_validation_type import DomainValidationType + +__all__ = [ + "CustomHostnameGetResponse", + "SSL", + "SSLSettings", + "SSLValidationError", + "SSLValidationRecord", + "CustomMetadata", + "OwnershipVerification", + "OwnershipVerificationHTTP", +] + + +class SSLSettings(BaseModel): + ciphers: Optional[List[str]] = None + """An allowlist of ciphers for TLS termination. + + These ciphers must be in the BoringSSL format. + """ + + early_hints: Optional[Literal["on", "off"]] = None + """Whether or not Early Hints is enabled.""" + + http2: Optional[Literal["on", "off"]] = None + """Whether or not HTTP2 is enabled.""" + + min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None + """The minimum TLS version supported.""" + + tls_1_3: Optional[Literal["on", "off"]] = None + """Whether or not TLS 1.3 is enabled.""" + + +class SSLValidationError(BaseModel): + message: Optional[str] = None + """A domain validation error.""" + + +class SSLValidationRecord(BaseModel): + emails: Optional[List[object]] = None + """ + The set of email addresses that the certificate authority (CA) will use to + complete domain validation. + """ + + http_body: Optional[str] = None + """ + The content that the certificate authority (CA) will expect to find at the + http_url during the domain validation. + """ + + http_url: Optional[str] = None + """The url that will be checked during domain validation.""" + + txt_name: Optional[str] = None + """ + The hostname that the certificate authority (CA) will check for a TXT record + during domain validation . + """ + + txt_value: Optional[str] = None + """ + The TXT record that the certificate authority (CA) will check during domain + validation. + """ + + +class SSL(BaseModel): + id: Optional[str] = None + """Custom hostname SSL identifier tag.""" + + bundle_method: Optional[BundleMethod] = None + """ + A ubiquitous bundle has the highest probability of being verified everywhere, + even by clients using outdated or unusual trust stores. An optimal bundle uses + the shortest chain and newest intermediates. And the force bundle verifies the + chain, but does not otherwise modify it. + """ + + certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None + """The Certificate Authority that will issue the certificate""" + + custom_certificate: Optional[str] = None + """If a custom uploaded certificate is used.""" + + custom_csr_id: Optional[str] = None + """The identifier for the Custom CSR that was used.""" + + custom_key: Optional[str] = None + """The key for a custom uploaded certificate.""" + + expires_on: Optional[datetime] = None + """The time the custom certificate expires on.""" + + hosts: Optional[List[object]] = None + """A list of Hostnames on a custom uploaded certificate.""" + + issuer: Optional[str] = None + """The issuer on a custom uploaded certificate.""" + + method: Optional[DCVMethod] = None + """Domain control validation (DCV) method used for this hostname.""" + + serial_number: Optional[str] = None + """The serial number on a custom uploaded certificate.""" + + settings: Optional[SSLSettings] = None + """SSL specific settings.""" + + signature: Optional[str] = None + """The signature on a custom uploaded certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_validation", + "deleted", + "pending_issuance", + "pending_deployment", + "pending_deletion", + "pending_expiration", + "expired", + "active", + "initializing_timed_out", + "validation_timed_out", + "issuance_timed_out", + "deployment_timed_out", + "deletion_timed_out", + "pending_cleanup", + "staging_deployment", + "staging_active", + "deactivating", + "inactive", + "backup_issued", + "holding_deployment", + ] + ] = None + """Status of the hostname's SSL certificates.""" + + type: Optional[DomainValidationType] = None + """Level of validation to be used for this hostname. + + Domain validation (dv) must be used. + """ + + uploaded_on: Optional[datetime] = None + """The time the custom certificate was uploaded.""" + + validation_errors: Optional[List[SSLValidationError]] = None + """ + Domain validation errors that have been received by the certificate authority + (CA). + """ + + validation_records: Optional[List[SSLValidationRecord]] = None + + wildcard: Optional[bool] = None + """Indicates whether the certificate covers a wildcard.""" + + +class CustomMetadata(BaseModel): + key: Optional[str] = None + """Unique metadata for this hostname.""" + + +class OwnershipVerification(BaseModel): + name: Optional[str] = None + """DNS Name for record.""" + + type: Optional[Literal["txt"]] = None + """DNS Record type.""" + + value: Optional[str] = None + """Content for the record.""" + + +class OwnershipVerificationHTTP(BaseModel): + http_body: Optional[str] = None + """Token to be served.""" + + http_url: Optional[str] = None + """ + The HTTP URL that will be checked during custom hostname verification and where + the customer should host the token. + """ + + +class CustomHostnameGetResponse(BaseModel): + id: str + """Identifier""" + + hostname: str + """The custom hostname that will point to your hostname via CNAME.""" + + ssl: SSL + """SSL properties for the custom hostname.""" + + created_at: Optional[datetime] = None + """This is the time the hostname was created.""" + + custom_metadata: Optional[CustomMetadata] = None + """These are per-hostname (customer) settings.""" + + custom_origin_server: Optional[str] = None + """ + a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + record. + """ + + custom_origin_sni: Optional[str] = None + """ + A hostname that will be sent to your custom origin server as SNI for TLS + handshake. This can be a valid subdomain of the zone or custom origin server + name or the string ':request_host_header:' which will cause the host header in + the request to be used as SNI. Not configurable with default/fallback origin + server. + """ + + ownership_verification: Optional[OwnershipVerification] = None + """This is a record which can be placed to activate a hostname.""" + + ownership_verification_http: Optional[OwnershipVerificationHTTP] = None + """ + This presents the token to be served by the given http url to activate a + hostname. + """ + + status: Optional[ + Literal[ + "active", + "pending", + "active_redeploying", + "moved", + "pending_deletion", + "deleted", + "pending_blocked", + "pending_migration", + "pending_provisioned", + "test_pending", + "test_active", + "test_active_apex", + "test_blocked", + "test_failed", + "provisioned", + "blocked", + ] + ] = None + """Status of the hostname's activation.""" + + verification_errors: Optional[List[object]] = None + """These are errors that were encountered while trying to activate a hostname.""" diff --git a/src/cloudflare/types/custom_hostname_list_params.py b/src/cloudflare/types/custom_hostnames/custom_hostname_list_params.py similarity index 100% rename from src/cloudflare/types/custom_hostname_list_params.py rename to src/cloudflare/types/custom_hostnames/custom_hostname_list_params.py diff --git a/src/cloudflare/types/custom_hostnames/custom_hostname_list_response.py b/src/cloudflare/types/custom_hostnames/custom_hostname_list_response.py new file mode 100644 index 00000000000..de8909d348a --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/custom_hostname_list_response.py @@ -0,0 +1,261 @@ +# 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 +from .dcv_method import DCVMethod +from .bundle_method import BundleMethod +from .domain_validation_type import DomainValidationType + +__all__ = [ + "CustomHostnameListResponse", + "SSL", + "SSLSettings", + "SSLValidationError", + "SSLValidationRecord", + "CustomMetadata", + "OwnershipVerification", + "OwnershipVerificationHTTP", +] + + +class SSLSettings(BaseModel): + ciphers: Optional[List[str]] = None + """An allowlist of ciphers for TLS termination. + + These ciphers must be in the BoringSSL format. + """ + + early_hints: Optional[Literal["on", "off"]] = None + """Whether or not Early Hints is enabled.""" + + http2: Optional[Literal["on", "off"]] = None + """Whether or not HTTP2 is enabled.""" + + min_tls_version: Optional[Literal["1.0", "1.1", "1.2", "1.3"]] = None + """The minimum TLS version supported.""" + + tls_1_3: Optional[Literal["on", "off"]] = None + """Whether or not TLS 1.3 is enabled.""" + + +class SSLValidationError(BaseModel): + message: Optional[str] = None + """A domain validation error.""" + + +class SSLValidationRecord(BaseModel): + emails: Optional[List[object]] = None + """ + The set of email addresses that the certificate authority (CA) will use to + complete domain validation. + """ + + http_body: Optional[str] = None + """ + The content that the certificate authority (CA) will expect to find at the + http_url during the domain validation. + """ + + http_url: Optional[str] = None + """The url that will be checked during domain validation.""" + + txt_name: Optional[str] = None + """ + The hostname that the certificate authority (CA) will check for a TXT record + during domain validation . + """ + + txt_value: Optional[str] = None + """ + The TXT record that the certificate authority (CA) will check during domain + validation. + """ + + +class SSL(BaseModel): + id: Optional[str] = None + """Custom hostname SSL identifier tag.""" + + bundle_method: Optional[BundleMethod] = None + """ + A ubiquitous bundle has the highest probability of being verified everywhere, + even by clients using outdated or unusual trust stores. An optimal bundle uses + the shortest chain and newest intermediates. And the force bundle verifies the + chain, but does not otherwise modify it. + """ + + certificate_authority: Optional[Literal["digicert", "google", "lets_encrypt"]] = None + """The Certificate Authority that will issue the certificate""" + + custom_certificate: Optional[str] = None + """If a custom uploaded certificate is used.""" + + custom_csr_id: Optional[str] = None + """The identifier for the Custom CSR that was used.""" + + custom_key: Optional[str] = None + """The key for a custom uploaded certificate.""" + + expires_on: Optional[datetime] = None + """The time the custom certificate expires on.""" + + hosts: Optional[List[object]] = None + """A list of Hostnames on a custom uploaded certificate.""" + + issuer: Optional[str] = None + """The issuer on a custom uploaded certificate.""" + + method: Optional[DCVMethod] = None + """Domain control validation (DCV) method used for this hostname.""" + + serial_number: Optional[str] = None + """The serial number on a custom uploaded certificate.""" + + settings: Optional[SSLSettings] = None + """SSL specific settings.""" + + signature: Optional[str] = None + """The signature on a custom uploaded certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_validation", + "deleted", + "pending_issuance", + "pending_deployment", + "pending_deletion", + "pending_expiration", + "expired", + "active", + "initializing_timed_out", + "validation_timed_out", + "issuance_timed_out", + "deployment_timed_out", + "deletion_timed_out", + "pending_cleanup", + "staging_deployment", + "staging_active", + "deactivating", + "inactive", + "backup_issued", + "holding_deployment", + ] + ] = None + """Status of the hostname's SSL certificates.""" + + type: Optional[DomainValidationType] = None + """Level of validation to be used for this hostname. + + Domain validation (dv) must be used. + """ + + uploaded_on: Optional[datetime] = None + """The time the custom certificate was uploaded.""" + + validation_errors: Optional[List[SSLValidationError]] = None + """ + Domain validation errors that have been received by the certificate authority + (CA). + """ + + validation_records: Optional[List[SSLValidationRecord]] = None + + wildcard: Optional[bool] = None + """Indicates whether the certificate covers a wildcard.""" + + +class CustomMetadata(BaseModel): + key: Optional[str] = None + """Unique metadata for this hostname.""" + + +class OwnershipVerification(BaseModel): + name: Optional[str] = None + """DNS Name for record.""" + + type: Optional[Literal["txt"]] = None + """DNS Record type.""" + + value: Optional[str] = None + """Content for the record.""" + + +class OwnershipVerificationHTTP(BaseModel): + http_body: Optional[str] = None + """Token to be served.""" + + http_url: Optional[str] = None + """ + The HTTP URL that will be checked during custom hostname verification and where + the customer should host the token. + """ + + +class CustomHostnameListResponse(BaseModel): + id: str + """Identifier""" + + hostname: str + """The custom hostname that will point to your hostname via CNAME.""" + + ssl: SSL + """SSL properties for the custom hostname.""" + + created_at: Optional[datetime] = None + """This is the time the hostname was created.""" + + custom_metadata: Optional[CustomMetadata] = None + """These are per-hostname (customer) settings.""" + + custom_origin_server: Optional[str] = None + """ + a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + record. + """ + + custom_origin_sni: Optional[str] = None + """ + A hostname that will be sent to your custom origin server as SNI for TLS + handshake. This can be a valid subdomain of the zone or custom origin server + name or the string ':request_host_header:' which will cause the host header in + the request to be used as SNI. Not configurable with default/fallback origin + server. + """ + + ownership_verification: Optional[OwnershipVerification] = None + """This is a record which can be placed to activate a hostname.""" + + ownership_verification_http: Optional[OwnershipVerificationHTTP] = None + """ + This presents the token to be served by the given http url to activate a + hostname. + """ + + status: Optional[ + Literal[ + "active", + "pending", + "active_redeploying", + "moved", + "pending_deletion", + "deleted", + "pending_blocked", + "pending_migration", + "pending_provisioned", + "test_pending", + "test_active", + "test_active_apex", + "test_blocked", + "test_failed", + "provisioned", + "blocked", + ] + ] = None + """Status of the hostname's activation.""" + + verification_errors: Optional[List[object]] = None + """These are errors that were encountered while trying to activate a hostname.""" diff --git a/src/cloudflare/types/custom_hostnames/dcv_method.py b/src/cloudflare/types/custom_hostnames/dcv_method.py new file mode 100644 index 00000000000..0a87ee2154f --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/dcv_method.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["DCVMethod"] + +DCVMethod = Literal["http", "txt", "email"] diff --git a/src/cloudflare/types/custom_hostnames/domain_validation_type.py b/src/cloudflare/types/custom_hostnames/domain_validation_type.py new file mode 100644 index 00000000000..1d079af9828 --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/domain_validation_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["DomainValidationType"] + +DomainValidationType = Literal["dv"] diff --git a/src/cloudflare/types/custom_hostnames/fallback_origin_delete_params.py b/src/cloudflare/types/custom_hostnames/fallback_origin_delete_params.py new file mode 100644 index 00000000000..4b3fd914a43 --- /dev/null +++ b/src/cloudflare/types/custom_hostnames/fallback_origin_delete_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__ = ["FallbackOriginDeleteParams"] + + +class FallbackOriginDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/custom_hostnames/fallback_origin_delete_response.py b/src/cloudflare/types/custom_hostnames/fallback_origin_delete_response.py index 25c13dba3c1..3b4c1ef2f97 100644 --- a/src/cloudflare/types/custom_hostnames/fallback_origin_delete_response.py +++ b/src/cloudflare/types/custom_hostnames/fallback_origin_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["FallbackOriginDeleteResponse"] -FallbackOriginDeleteResponse = Union[str, object] +FallbackOriginDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/custom_hostnames/fallback_origin_get_response.py b/src/cloudflare/types/custom_hostnames/fallback_origin_get_response.py index 6259d8e36f1..2a43cf04e81 100644 --- a/src/cloudflare/types/custom_hostnames/fallback_origin_get_response.py +++ b/src/cloudflare/types/custom_hostnames/fallback_origin_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["FallbackOriginGetResponse"] -FallbackOriginGetResponse = Union[str, object] +FallbackOriginGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/custom_hostnames/fallback_origin_update_response.py b/src/cloudflare/types/custom_hostnames/fallback_origin_update_response.py index 6668392d9f5..0902ecd4e58 100644 --- a/src/cloudflare/types/custom_hostnames/fallback_origin_update_response.py +++ b/src/cloudflare/types/custom_hostnames/fallback_origin_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["FallbackOriginUpdateResponse"] -FallbackOriginUpdateResponse = Union[str, object] +FallbackOriginUpdateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/custom_nameservers/__init__.py b/src/cloudflare/types/custom_nameservers/__init__.py new file mode 100644 index 00000000000..50319977db9 --- /dev/null +++ b/src/cloudflare/types/custom_nameservers/__init__.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .custom_nameserver import CustomNameserver as CustomNameserver +from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse +from .custom_nameserver_create_params import CustomNameserverCreateParams as CustomNameserverCreateParams +from .custom_nameserver_delete_params import CustomNameserverDeleteParams as CustomNameserverDeleteParams +from .custom_nameserver_verify_params import CustomNameserverVerifyParams as CustomNameserverVerifyParams +from .custom_nameserver_delete_response import CustomNameserverDeleteResponse as CustomNameserverDeleteResponse +from .custom_nameserver_verify_response import CustomNameserverVerifyResponse as CustomNameserverVerifyResponse +from .custom_nameserver_availabilty_response import ( + CustomNameserverAvailabiltyResponse as CustomNameserverAvailabiltyResponse, +) diff --git a/src/cloudflare/types/custom_nameserver.py b/src/cloudflare/types/custom_nameservers/custom_nameserver.py similarity index 96% rename from src/cloudflare/types/custom_nameserver.py rename to src/cloudflare/types/custom_nameservers/custom_nameserver.py index 9f2a309d04d..9b56d6d5495 100644 --- a/src/cloudflare/types/custom_nameserver.py +++ b/src/cloudflare/types/custom_nameservers/custom_nameserver.py @@ -3,7 +3,7 @@ from typing import List, Optional from typing_extensions import Literal -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["CustomNameserver", "DNSRecord"] diff --git a/src/cloudflare/types/custom_nameserver_availabilty_response.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_availabilty_response.py similarity index 100% rename from src/cloudflare/types/custom_nameserver_availabilty_response.py rename to src/cloudflare/types/custom_nameservers/custom_nameserver_availabilty_response.py diff --git a/src/cloudflare/types/custom_nameserver_create_params.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_create_params.py similarity index 100% rename from src/cloudflare/types/custom_nameserver_create_params.py rename to src/cloudflare/types/custom_nameservers/custom_nameserver_create_params.py diff --git a/src/cloudflare/types/custom_nameservers/custom_nameserver_delete_params.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_delete_params.py new file mode 100644 index 00000000000..119813a19f7 --- /dev/null +++ b/src/cloudflare/types/custom_nameservers/custom_nameserver_delete_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__ = ["CustomNameserverDeleteParams"] + + +class CustomNameserverDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/custom_nameserver_delete_response.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_delete_response.py similarity index 100% rename from src/cloudflare/types/custom_nameserver_delete_response.py rename to src/cloudflare/types/custom_nameservers/custom_nameserver_delete_response.py diff --git a/src/cloudflare/types/custom_nameserver_get_response.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_get_response.py similarity index 100% rename from src/cloudflare/types/custom_nameserver_get_response.py rename to src/cloudflare/types/custom_nameservers/custom_nameserver_get_response.py diff --git a/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_params.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_params.py new file mode 100644 index 00000000000..037e56c8880 --- /dev/null +++ b/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_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__ = ["CustomNameserverVerifyParams"] + + +class CustomNameserverVerifyParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/custom_nameserver_verify_response.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_response.py similarity index 100% rename from src/cloudflare/types/custom_nameserver_verify_response.py rename to src/cloudflare/types/custom_nameservers/custom_nameserver_verify_response.py diff --git a/src/cloudflare/types/d1/__init__.py b/src/cloudflare/types/d1/__init__.py index 6331e16c24f..2c77c7a96e5 100644 --- a/src/cloudflare/types/d1/__init__.py +++ b/src/cloudflare/types/d1/__init__.py @@ -2,11 +2,12 @@ from __future__ import annotations -from .d1_query_result import D1QueryResult as D1QueryResult -from .d1_create_database import D1CreateDatabase as D1CreateDatabase -from .d1_database_details import D1DatabaseDetails as D1DatabaseDetails +from .d1 import D1 as D1 +from .query_result import QueryResult as QueryResult from .database_list_params import DatabaseListParams as DatabaseListParams from .database_query_params import DatabaseQueryParams as DatabaseQueryParams from .database_create_params import DatabaseCreateParams as DatabaseCreateParams +from .database_list_response import DatabaseListResponse as DatabaseListResponse from .database_query_response import DatabaseQueryResponse as DatabaseQueryResponse +from .database_create_response import DatabaseCreateResponse as DatabaseCreateResponse from .database_delete_response import DatabaseDeleteResponse as DatabaseDeleteResponse diff --git a/src/cloudflare/types/d1/d1.py b/src/cloudflare/types/d1/d1.py new file mode 100644 index 00000000000..8db6a1dcb3f --- /dev/null +++ b/src/cloudflare/types/d1/d1.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["D1"] + + +class D1(BaseModel): + created_at: Optional[str] = None + """Specifies the timestamp the resource was created as an ISO8601 string.""" + + file_size: Optional[float] = None + """The D1 database's size, in bytes.""" + + name: Optional[str] = None + + num_tables: Optional[float] = None + + uuid: Optional[str] = None + + version: Optional[str] = None diff --git a/src/cloudflare/types/d1/d1_create_database.py b/src/cloudflare/types/d1/d1_create_database.py deleted file mode 100644 index 7d947edf15a..00000000000 --- a/src/cloudflare/types/d1/d1_create_database.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["D1CreateDatabase"] - - -class D1CreateDatabase(BaseModel): - created_at: Optional[str] = None - """Specifies the timestamp the resource was created as an ISO8601 string.""" - - name: Optional[str] = None - - uuid: Optional[str] = None - - version: Optional[str] = None diff --git a/src/cloudflare/types/d1/d1_database_details.py b/src/cloudflare/types/d1/d1_database_details.py deleted file mode 100644 index e467c17dd8a..00000000000 --- a/src/cloudflare/types/d1/d1_database_details.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["D1DatabaseDetails"] - - -class D1DatabaseDetails(BaseModel): - created_at: Optional[str] = None - """Specifies the timestamp the resource was created as an ISO8601 string.""" - - file_size: Optional[float] = None - """The D1 database's size, in bytes.""" - - name: Optional[str] = None - - num_tables: Optional[float] = None - - uuid: Optional[str] = None - - version: Optional[str] = None diff --git a/src/cloudflare/types/d1/d1_query_result.py b/src/cloudflare/types/d1/d1_query_result.py deleted file mode 100644 index 1e70eade791..00000000000 --- a/src/cloudflare/types/d1/d1_query_result.py +++ /dev/null @@ -1,31 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["D1QueryResult", "Meta"] - - -class Meta(BaseModel): - changed_db: Optional[bool] = None - - changes: Optional[float] = None - - duration: Optional[float] = None - - last_row_id: Optional[float] = None - - rows_read: Optional[float] = None - - rows_written: Optional[float] = None - - size_after: Optional[float] = None - - -class D1QueryResult(BaseModel): - meta: Optional[Meta] = None - - results: Optional[List[object]] = None - - success: Optional[bool] = None diff --git a/src/cloudflare/types/d1/database_create_response.py b/src/cloudflare/types/d1/database_create_response.py new file mode 100644 index 00000000000..5f5715433e1 --- /dev/null +++ b/src/cloudflare/types/d1/database_create_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["DatabaseCreateResponse"] + + +class DatabaseCreateResponse(BaseModel): + created_at: Optional[str] = None + """Specifies the timestamp the resource was created as an ISO8601 string.""" + + name: Optional[str] = None + + uuid: Optional[str] = None + + version: Optional[str] = None diff --git a/src/cloudflare/types/d1/database_delete_response.py b/src/cloudflare/types/d1/database_delete_response.py index 0d3afb4e896..53e10cdd237 100644 --- a/src/cloudflare/types/d1/database_delete_response.py +++ b/src/cloudflare/types/d1/database_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["DatabaseDeleteResponse"] -DatabaseDeleteResponse = Union[str, object, None] +DatabaseDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/d1/database_list_response.py b/src/cloudflare/types/d1/database_list_response.py new file mode 100644 index 00000000000..5ecb1b94674 --- /dev/null +++ b/src/cloudflare/types/d1/database_list_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["DatabaseListResponse"] + + +class DatabaseListResponse(BaseModel): + created_at: Optional[str] = None + """Specifies the timestamp the resource was created as an ISO8601 string.""" + + name: Optional[str] = None + + uuid: Optional[str] = None + + version: Optional[str] = None diff --git a/src/cloudflare/types/d1/database_query_response.py b/src/cloudflare/types/d1/database_query_response.py index a0d2bd0a256..4e2d7a949cd 100644 --- a/src/cloudflare/types/d1/database_query_response.py +++ b/src/cloudflare/types/d1/database_query_response.py @@ -2,8 +2,8 @@ from typing import List -from .d1_query_result import D1QueryResult +from .query_result import QueryResult __all__ = ["DatabaseQueryResponse"] -DatabaseQueryResponse = List[D1QueryResult] +DatabaseQueryResponse = List[QueryResult] diff --git a/src/cloudflare/types/d1/query_result.py b/src/cloudflare/types/d1/query_result.py new file mode 100644 index 00000000000..7b6447cd084 --- /dev/null +++ b/src/cloudflare/types/d1/query_result.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["QueryResult", "Meta"] + + +class Meta(BaseModel): + changed_db: Optional[bool] = None + + changes: Optional[float] = None + + duration: Optional[float] = None + + last_row_id: Optional[float] = None + + rows_read: Optional[float] = None + + rows_written: Optional[float] = None + + size_after: Optional[float] = None + + +class QueryResult(BaseModel): + meta: Optional[Meta] = None + + results: Optional[List[object]] = None + + success: Optional[bool] = None diff --git a/src/cloudflare/types/diagnostics/__init__.py b/src/cloudflare/types/diagnostics/__init__.py index 9e8661dc088..94d7a66c1ee 100644 --- a/src/cloudflare/types/diagnostics/__init__.py +++ b/src/cloudflare/types/diagnostics/__init__.py @@ -2,6 +2,6 @@ from __future__ import annotations +from .traceroute import Traceroute as Traceroute from .traceroute_create_params import TracerouteCreateParams as TracerouteCreateParams from .traceroute_create_response import TracerouteCreateResponse as TracerouteCreateResponse -from .magic_transit_target_result import MagicTransitTargetResult as MagicTransitTargetResult diff --git a/src/cloudflare/types/diagnostics/magic_transit_target_result.py b/src/cloudflare/types/diagnostics/magic_transit_target_result.py deleted file mode 100644 index 668dce7698b..00000000000 --- a/src/cloudflare/types/diagnostics/magic_transit_target_result.py +++ /dev/null @@ -1,93 +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__ = ["MagicTransitTargetResult", "Colo", "ColoColo", "ColoHop", "ColoHopNode"] - - -class ColoColo(BaseModel): - city: Optional[str] = None - """Source colo city.""" - - name: Optional[str] = None - """Source colo name.""" - - -class ColoHopNode(BaseModel): - asn: Optional[str] = None - """AS number associated with the node object.""" - - ip: Optional[str] = None - """IP address of the node.""" - - labels: Optional[List[str]] = None - """ - Field appears if there is an additional annotation printed when the probe - returns. Field also appears when running a GRE+ICMP traceroute to denote which - traceroute a node comes from. - """ - - max_rtt_ms: Optional[float] = None - """Maximum RTT in ms.""" - - mean_rtt_ms: Optional[float] = None - """Mean RTT in ms.""" - - min_rtt_ms: Optional[float] = None - """Minimum RTT in ms.""" - - name: Optional[str] = None - """Host name of the address, this may be the same as the IP address.""" - - packet_count: Optional[int] = None - """Number of packets with a response from this node.""" - - std_dev_rtt_ms: Optional[float] = None - """Standard deviation of the RTTs in ms.""" - - -class ColoHop(BaseModel): - nodes: Optional[List[ColoHopNode]] = None - """An array of node objects.""" - - packets_lost: Optional[int] = None - """Number of packets where no response was received.""" - - packets_sent: Optional[int] = None - """Number of packets sent with specified TTL.""" - - packets_ttl: Optional[int] = None - """The time to live (TTL).""" - - -class Colo(BaseModel): - colo: Optional[ColoColo] = None - - error: Optional[ - Literal[ - "", - "Could not gather traceroute data: Code 1", - "Could not gather traceroute data: Code 2", - "Could not gather traceroute data: Code 3", - "Could not gather traceroute data: Code 4", - ] - ] = None - """Errors resulting from collecting traceroute from colo to target.""" - - hops: Optional[List[ColoHop]] = None - - target_summary: Optional[object] = None - """Aggregated statistics from all hops about the target.""" - - traceroute_time_ms: Optional[int] = None - """Total time of traceroute in ms.""" - - -class MagicTransitTargetResult(BaseModel): - colos: Optional[List[Colo]] = None - - target: Optional[str] = None - """The target hostname, IPv6, or IPv6 address.""" diff --git a/src/cloudflare/types/diagnostics/traceroute.py b/src/cloudflare/types/diagnostics/traceroute.py new file mode 100644 index 00000000000..d8af2e15cbc --- /dev/null +++ b/src/cloudflare/types/diagnostics/traceroute.py @@ -0,0 +1,93 @@ +# 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__ = ["Traceroute", "Colo", "ColoColo", "ColoHop", "ColoHopNode"] + + +class ColoColo(BaseModel): + city: Optional[str] = None + """Source colo city.""" + + name: Optional[str] = None + """Source colo name.""" + + +class ColoHopNode(BaseModel): + asn: Optional[str] = None + """AS number associated with the node object.""" + + ip: Optional[str] = None + """IP address of the node.""" + + labels: Optional[List[str]] = None + """ + Field appears if there is an additional annotation printed when the probe + returns. Field also appears when running a GRE+ICMP traceroute to denote which + traceroute a node comes from. + """ + + max_rtt_ms: Optional[float] = None + """Maximum RTT in ms.""" + + mean_rtt_ms: Optional[float] = None + """Mean RTT in ms.""" + + min_rtt_ms: Optional[float] = None + """Minimum RTT in ms.""" + + name: Optional[str] = None + """Host name of the address, this may be the same as the IP address.""" + + packet_count: Optional[int] = None + """Number of packets with a response from this node.""" + + std_dev_rtt_ms: Optional[float] = None + """Standard deviation of the RTTs in ms.""" + + +class ColoHop(BaseModel): + nodes: Optional[List[ColoHopNode]] = None + """An array of node objects.""" + + packets_lost: Optional[int] = None + """Number of packets where no response was received.""" + + packets_sent: Optional[int] = None + """Number of packets sent with specified TTL.""" + + packets_ttl: Optional[int] = None + """The time to live (TTL).""" + + +class Colo(BaseModel): + colo: Optional[ColoColo] = None + + error: Optional[ + Literal[ + "", + "Could not gather traceroute data: Code 1", + "Could not gather traceroute data: Code 2", + "Could not gather traceroute data: Code 3", + "Could not gather traceroute data: Code 4", + ] + ] = None + """Errors resulting from collecting traceroute from colo to target.""" + + hops: Optional[List[ColoHop]] = None + + target_summary: Optional[object] = None + """Aggregated statistics from all hops about the target.""" + + traceroute_time_ms: Optional[int] = None + """Total time of traceroute in ms.""" + + +class Traceroute(BaseModel): + colos: Optional[List[Colo]] = None + + target: Optional[str] = None + """The target hostname, IPv6, or IPv6 address.""" diff --git a/src/cloudflare/types/diagnostics/traceroute_create_response.py b/src/cloudflare/types/diagnostics/traceroute_create_response.py index 790033096aa..388d43add11 100644 --- a/src/cloudflare/types/diagnostics/traceroute_create_response.py +++ b/src/cloudflare/types/diagnostics/traceroute_create_response.py @@ -2,8 +2,8 @@ from typing import List -from .magic_transit_target_result import MagicTransitTargetResult +from .traceroute import Traceroute __all__ = ["TracerouteCreateResponse"] -TracerouteCreateResponse = List[MagicTransitTargetResult] +TracerouteCreateResponse = List[Traceroute] diff --git a/src/cloudflare/types/dns/__init__.py b/src/cloudflare/types/dns/__init__.py index a73c010f685..8f291b22a54 100644 --- a/src/cloudflare/types/dns/__init__.py +++ b/src/cloudflare/types/dns/__init__.py @@ -2,18 +2,54 @@ from __future__ import annotations -from .dns_record import DNSRecord as DNSRecord -from .dns_firewall import DNSFirewall as DNSFirewall +from .ttl import TTL as TTL +from .record import Record as Record +from .a_record import ARecord as ARecord +from .firewall import Firewall as Firewall +from .ds_record import DSRecord as DSRecord +from .mx_record import MXRecord as MXRecord +from .ns_record import NSRecord as NSRecord +from .ttl_param import TTLParam as TTLParam +from .caa_record import CAARecord as CAARecord +from .loc_record import LOCRecord as LOCRecord +from .ptr_record import PTRRecord as PTRRecord +from .srv_record import SRVRecord as SRVRecord +from .txt_record import TXTRecord as TXTRecord +from .uri_record import URIRecord as URIRecord +from .aaaa_record import AAAARecord as AAAARecord +from .cert_record import CERTRecord as CERTRecord +from .record_tags import RecordTags as RecordTags +from .svcb_record import SVCBRecord as SVCBRecord +from .tlsa_record import TLSARecord as TLSARecord +from .cname_record import CNAMERecord as CNAMERecord +from .firewall_ips import FirewallIPs as FirewallIPs +from .https_record import HTTPSRecord as HTTPSRecord +from .naptr_record import NAPTRRecord as NAPTRRecord +from .sshfp_record import SSHFPRecord as SSHFPRecord +from .upstream_ips import UpstreamIPs as UpstreamIPs +from .dnskey_record import DNSKEYRecord as DNSKEYRecord +from .smimea_record import SMIMEARecord as SMIMEARecord +from .record_metadata import RecordMetadata as RecordMetadata +from .attack_mitigation import AttackMitigation as AttackMitigation +from .firewall_ips_param import FirewallIPsParam as FirewallIPsParam from .record_edit_params import RecordEditParams as RecordEditParams from .record_list_params import RecordListParams as RecordListParams +from .record_scan_params import RecordScanParams as RecordScanParams +from .upstream_ips_param import UpstreamIPsParam as UpstreamIPsParam +from .dns_analytics_query import DNSAnalyticsQuery as DNSAnalyticsQuery from .firewall_edit_params import FirewallEditParams as FirewallEditParams from .firewall_list_params import FirewallListParams as FirewallListParams from .record_create_params import RecordCreateParams as RecordCreateParams +from .record_delete_params import RecordDeleteParams as RecordDeleteParams from .record_import_params import RecordImportParams as RecordImportParams from .record_scan_response import RecordScanResponse as RecordScanResponse from .record_update_params import RecordUpdateParams as RecordUpdateParams +from .record_process_timing import RecordProcessTiming as RecordProcessTiming from .firewall_create_params import FirewallCreateParams as FirewallCreateParams +from .firewall_delete_params import FirewallDeleteParams as FirewallDeleteParams 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 .attack_mitigation_param import AttackMitigationParam as AttackMitigationParam from .firewall_delete_response import FirewallDeleteResponse as FirewallDeleteResponse +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 new file mode 100644 index 00000000000..dc064cf7d8a --- /dev/null +++ b/src/cloudflare/types/dns/a_record.py @@ -0,0 +1,72 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["ARecord"] + + +class ARecord(BaseModel): + content: str + """A valid IPv4 address.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["A"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + proxied: Optional[bool] = None + """ + Whether the record is receiving the performance and security benefits of + Cloudflare. + """ + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/aaaa_record.py b/src/cloudflare/types/dns/aaaa_record.py new file mode 100644 index 00000000000..75f77f1ab61 --- /dev/null +++ b/src/cloudflare/types/dns/aaaa_record.py @@ -0,0 +1,72 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["AAAARecord"] + + +class AAAARecord(BaseModel): + content: str + """A valid IPv6 address.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["AAAA"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + proxied: Optional[bool] = None + """ + Whether the record is receiving the performance and security benefits of + Cloudflare. + """ + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/analytics/__init__.py b/src/cloudflare/types/dns/analytics/__init__.py index c738816d7fd..e80651539e2 100644 --- a/src/cloudflare/types/dns/analytics/__init__.py +++ b/src/cloudflare/types/dns/analytics/__init__.py @@ -2,5 +2,5 @@ from __future__ import annotations +from .report import Report as Report from .report_get_params import ReportGetParams as ReportGetParams -from .dns_analytics_report import DNSAnalyticsReport as DNSAnalyticsReport diff --git a/src/cloudflare/types/dns/analytics/dns_analytics_report.py b/src/cloudflare/types/dns/analytics/dns_analytics_report.py deleted file mode 100644 index 2dfde2775d2..00000000000 --- a/src/cloudflare/types/dns/analytics/dns_analytics_report.py +++ /dev/null @@ -1,79 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["DNSAnalyticsReport", "Data", "Query"] - - -class Data(BaseModel): - dimensions: List[str] - """ - Array of dimension values, representing the combination of dimension values - corresponding to this row. - """ - - metrics: List[float] - """Array with one item per requested metric. Each item is a single value.""" - - -class Query(BaseModel): - dimensions: List[str] - """Array of dimension names.""" - - limit: int - """Limit number of returned metrics.""" - - metrics: List[str] - """Array of metric names.""" - - since: datetime - """Start date and time of requesting data period in ISO 8601 format.""" - - until: datetime - """End date and time of requesting data period in ISO 8601 format.""" - - filters: Optional[str] = None - """Segmentation filter in 'attribute operator value' format.""" - - sort: Optional[List[str]] = None - """ - Array of dimensions to sort by, where each dimension may be prefixed by - - (descending) or + (ascending). - """ - - -class DNSAnalyticsReport(BaseModel): - data: List[Data] - """Array with one row per combination of dimension values.""" - - data_lag: float - """ - Number of seconds between current time and last processed event, in another - words how many seconds of data could be missing. - """ - - max: object - """Maximum results for each metric (object mapping metric names to values). - - Currently always an empty object. - """ - - min: object - """Minimum results for each metric (object mapping metric names to values). - - Currently always an empty object. - """ - - query: Query - - rows: float - """Total number of rows in the result.""" - - totals: object - """ - Total results for metrics across all data (object mapping metric names to - values). - """ diff --git a/src/cloudflare/types/dns/analytics/report.py b/src/cloudflare/types/dns/analytics/report.py new file mode 100644 index 00000000000..00314a88ec3 --- /dev/null +++ b/src/cloudflare/types/dns/analytics/report.py @@ -0,0 +1,79 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["Report", "Data", "Query"] + + +class Data(BaseModel): + dimensions: List[str] + """ + Array of dimension values, representing the combination of dimension values + corresponding to this row. + """ + + metrics: List[float] + """Array with one item per requested metric. Each item is a single value.""" + + +class Query(BaseModel): + dimensions: List[str] + """Array of dimension names.""" + + limit: int + """Limit number of returned metrics.""" + + metrics: List[str] + """Array of metric names.""" + + since: datetime + """Start date and time of requesting data period in ISO 8601 format.""" + + until: datetime + """End date and time of requesting data period in ISO 8601 format.""" + + filters: Optional[str] = None + """Segmentation filter in 'attribute operator value' format.""" + + sort: Optional[List[str]] = None + """ + Array of dimensions to sort by, where each dimension may be prefixed by - + (descending) or + (ascending). + """ + + +class Report(BaseModel): + data: List[Data] + """Array with one row per combination of dimension values.""" + + data_lag: float + """ + Number of seconds between current time and last processed event, in another + words how many seconds of data could be missing. + """ + + max: object + """Maximum results for each metric (object mapping metric names to values). + + Currently always an empty object. + """ + + min: object + """Minimum results for each metric (object mapping metric names to values). + + Currently always an empty object. + """ + + query: Query + + rows: float + """Total number of rows in the result.""" + + totals: object + """ + Total results for metrics across all data (object mapping metric names to + values). + """ diff --git a/src/cloudflare/types/dns/analytics/reports/__init__.py b/src/cloudflare/types/dns/analytics/reports/__init__.py index 96ec042fabd..61b971c4642 100644 --- a/src/cloudflare/types/dns/analytics/reports/__init__.py +++ b/src/cloudflare/types/dns/analytics/reports/__init__.py @@ -2,5 +2,5 @@ from __future__ import annotations +from .by_time import ByTime as ByTime from .bytime_get_params import BytimeGetParams as BytimeGetParams -from .dns_analytics_report_by_time import DNSAnalyticsReportByTime as DNSAnalyticsReportByTime diff --git a/src/cloudflare/types/dns/analytics/reports/by_time.py b/src/cloudflare/types/dns/analytics/reports/by_time.py new file mode 100644 index 00000000000..54d6c796c02 --- /dev/null +++ b/src/cloudflare/types/dns/analytics/reports/by_time.py @@ -0,0 +1,65 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime + +from ....._models import BaseModel +from ...dns_analytics_query import DNSAnalyticsQuery +from ...dns_analytics_nominal_metric import DNSAnalyticsNominalMetric + +__all__ = ["ByTime", "Data"] + + +class Data(BaseModel): + dimensions: List[str] + """ + Array of dimension values, representing the combination of dimension values + corresponding to this row. + """ + + metrics: List[DNSAnalyticsNominalMetric] + """Array with one item per requested metric. + + Each item is an array of values, broken down by time interval. + """ + + +class ByTime(BaseModel): + data: List[Data] + """Array with one row per combination of dimension values.""" + + data_lag: float + """ + Number of seconds between current time and last processed event, in another + words how many seconds of data could be missing. + """ + + max: object + """Maximum results for each metric (object mapping metric names to values). + + Currently always an empty object. + """ + + min: object + """Minimum results for each metric (object mapping metric names to values). + + Currently always an empty object. + """ + + query: DNSAnalyticsQuery + + rows: float + """Total number of rows in the result.""" + + time_intervals: List[List[datetime]] + """Array of time intervals in the response data. + + Each interval is represented as an array containing two values: the start time, + and the end time. + """ + + totals: object + """ + Total results for metrics across all data (object mapping metric names to + values). + """ diff --git a/src/cloudflare/types/dns/analytics/reports/dns_analytics_report_by_time.py b/src/cloudflare/types/dns/analytics/reports/dns_analytics_report_by_time.py deleted file mode 100644 index 460a19f5ffe..00000000000 --- a/src/cloudflare/types/dns/analytics/reports/dns_analytics_report_by_time.py +++ /dev/null @@ -1,93 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ....._models import BaseModel - -__all__ = ["DNSAnalyticsReportByTime", "Data", "Query"] - - -class Data(BaseModel): - dimensions: List[str] - """ - Array of dimension values, representing the combination of dimension values - corresponding to this row. - """ - - metrics: List[List[object]] - """Array with one item per requested metric. - - Each item is an array of values, broken down by time interval. - """ - - -class Query(BaseModel): - dimensions: List[str] - """Array of dimension names.""" - - limit: int - """Limit number of returned metrics.""" - - metrics: List[str] - """Array of metric names.""" - - since: datetime - """Start date and time of requesting data period in ISO 8601 format.""" - - time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] - """Unit of time to group data by.""" - - until: datetime - """End date and time of requesting data period in ISO 8601 format.""" - - filters: Optional[str] = None - """Segmentation filter in 'attribute operator value' format.""" - - sort: Optional[List[str]] = None - """ - Array of dimensions to sort by, where each dimension may be prefixed by - - (descending) or + (ascending). - """ - - -class DNSAnalyticsReportByTime(BaseModel): - data: List[Data] - """Array with one row per combination of dimension values.""" - - data_lag: float - """ - Number of seconds between current time and last processed event, in another - words how many seconds of data could be missing. - """ - - max: object - """Maximum results for each metric (object mapping metric names to values). - - Currently always an empty object. - """ - - min: object - """Minimum results for each metric (object mapping metric names to values). - - Currently always an empty object. - """ - - query: Query - - rows: float - """Total number of rows in the result.""" - - time_intervals: List[List[datetime]] - """Array of time intervals in the response data. - - Each interval is represented as an array containing two values: the start time, - and the end time. - """ - - totals: object - """ - Total results for metrics across all data (object mapping metric names to - values). - """ diff --git a/src/cloudflare/types/dns/attack_mitigation.py b/src/cloudflare/types/dns/attack_mitigation.py new file mode 100644 index 00000000000..cfbe6224fc6 --- /dev/null +++ b/src/cloudflare/types/dns/attack_mitigation.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["AttackMitigation"] + + +class AttackMitigation(BaseModel): + enabled: Optional[bool] = None + """ + When enabled, random-prefix attacks are automatically mitigated and the upstream + DNS servers protected. + """ + + only_when_upstream_unhealthy: Optional[bool] = None + """Only mitigate attacks when upstream servers seem unhealthy.""" diff --git a/src/cloudflare/types/dns/attack_mitigation_param.py b/src/cloudflare/types/dns/attack_mitigation_param.py new file mode 100644 index 00000000000..66a854ef67e --- /dev/null +++ b/src/cloudflare/types/dns/attack_mitigation_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["AttackMitigationParam"] + + +class AttackMitigationParam(TypedDict, total=False): + enabled: bool + """ + When enabled, random-prefix attacks are automatically mitigated and the upstream + DNS servers protected. + """ + + only_when_upstream_unhealthy: bool + """Only mitigate attacks when upstream servers seem unhealthy.""" diff --git a/src/cloudflare/types/dns/caa_record.py b/src/cloudflare/types/dns/caa_record.py new file mode 100644 index 00000000000..298495fc040 --- /dev/null +++ b/src/cloudflare/types/dns/caa_record.py @@ -0,0 +1,80 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["CAARecord", "Data"] + + +class Data(BaseModel): + flags: Optional[float] = None + """Flags for the CAA record.""" + + tag: Optional[str] = None + """Name of the property controlled by this record (e.g.: issue, issuewild, iodef).""" + + value: Optional[str] = None + """Value of the record. This field's semantics depend on the chosen tag.""" + + +class CAARecord(BaseModel): + data: Data + """Components of a CAA record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["CAA"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted CAA content. See 'data' to set CAA properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/cert_record.py b/src/cloudflare/types/dns/cert_record.py new file mode 100644 index 00000000000..d9a7a6ba9b3 --- /dev/null +++ b/src/cloudflare/types/dns/cert_record.py @@ -0,0 +1,83 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["CERTRecord", "Data"] + + +class Data(BaseModel): + algorithm: Optional[float] = None + """Algorithm.""" + + certificate: Optional[str] = None + """Certificate.""" + + key_tag: Optional[float] = None + """Key Tag.""" + + type: Optional[float] = None + """Type.""" + + +class CERTRecord(BaseModel): + data: Data + """Components of a CERT record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["CERT"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted CERT content. See 'data' to set CERT properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/cname_record.py b/src/cloudflare/types/dns/cname_record.py new file mode 100644 index 00000000000..39e42f0f7d4 --- /dev/null +++ b/src/cloudflare/types/dns/cname_record.py @@ -0,0 +1,72 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["CNAMERecord"] + + +class CNAMERecord(BaseModel): + content: object + """A valid hostname. Must not match the record's name.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["CNAME"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + proxied: Optional[bool] = None + """ + Whether the record is receiving the performance and security benefits of + Cloudflare. + """ + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/dns_analytics_nominal_metric.py b/src/cloudflare/types/dns/dns_analytics_nominal_metric.py new file mode 100644 index 00000000000..c8805568346 --- /dev/null +++ b/src/cloudflare/types/dns/dns_analytics_nominal_metric.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +__all__ = ["DNSAnalyticsNominalMetric"] + +DNSAnalyticsNominalMetric = List[object] diff --git a/src/cloudflare/types/dns/dns_analytics_query.py b/src/cloudflare/types/dns/dns_analytics_query.py new file mode 100644 index 00000000000..b1d886168e6 --- /dev/null +++ b/src/cloudflare/types/dns/dns_analytics_query.py @@ -0,0 +1,38 @@ +# 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__ = ["DNSAnalyticsQuery"] + + +class DNSAnalyticsQuery(BaseModel): + dimensions: List[str] + """Array of dimension names.""" + + limit: int + """Limit number of returned metrics.""" + + metrics: List[str] + """Array of metric names.""" + + since: datetime + """Start date and time of requesting data period in ISO 8601 format.""" + + time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] + """Unit of time to group data by.""" + + until: datetime + """End date and time of requesting data period in ISO 8601 format.""" + + filters: Optional[str] = None + """Segmentation filter in 'attribute operator value' format.""" + + sort: Optional[List[str]] = None + """ + Array of dimensions to sort by, where each dimension may be prefixed by - + (descending) or + (ascending). + """ diff --git a/src/cloudflare/types/dns/dns_firewall.py b/src/cloudflare/types/dns/dns_firewall.py deleted file mode 100644 index 6b01c523358..00000000000 --- a/src/cloudflare/types/dns/dns_firewall.py +++ /dev/null @@ -1,64 +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 ..._models import BaseModel - -__all__ = ["DNSFirewall", "AttackMitigation"] - - -class AttackMitigation(BaseModel): - enabled: Optional[bool] = None - """ - When enabled, random-prefix attacks are automatically mitigated and the upstream - DNS servers protected. - """ - - only_when_upstream_unhealthy: Optional[bool] = None - """Only mitigate attacks when upstream servers seem unhealthy.""" - - -class DNSFirewall(BaseModel): - id: str - """Identifier""" - - deprecate_any_requests: bool - """Deprecate the response to ANY requests.""" - - dns_firewall_ips: List[Union[str, str]] - - ecs_fallback: bool - """Forward client IP (resolver) subnet if no EDNS Client Subnet is sent.""" - - maximum_cache_ttl: float - """Maximum DNS Cache TTL.""" - - minimum_cache_ttl: float - """Minimum DNS Cache TTL.""" - - modified_on: datetime - """Last modification of DNS Firewall cluster.""" - - name: str - """DNS Firewall Cluster Name.""" - - upstream_ips: List[Union[str, str]] - - attack_mitigation: Optional[AttackMitigation] = None - """Attack mitigation settings.""" - - negative_cache_ttl: Optional[float] = None - """Negative DNS Cache TTL.""" - - ratelimit: Optional[float] = None - """ - Ratelimit in queries per second per datacenter (applies to DNS queries sent to - the upstream nameservers configured on the cluster). - """ - - retries: Optional[float] = None - """ - Number of retries for fetching DNS responses from upstream nameservers (not - counting the initial attempt). - """ diff --git a/src/cloudflare/types/dns/dns_record.py b/src/cloudflare/types/dns/dns_record.py deleted file mode 100644 index d2717cee112..00000000000 --- a/src/cloudflare/types/dns/dns_record.py +++ /dev/null @@ -1,1668 +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, Annotated - -from ..._utils import PropertyInfo -from ..._models import BaseModel - -__all__ = [ - "DNSRecord", - "A", - "AMeta", - "AAAA", - "AAAAMeta", - "CAA", - "CAAData", - "CAAMeta", - "CERT", - "CERTData", - "CERTMeta", - "CNAME", - "CNAMEMeta", - "DNSKEY", - "DNSKEYData", - "DNSKEYMeta", - "DS", - "DSData", - "DSMeta", - "HTTPS", - "HTTPSData", - "HTTPSMeta", - "LOC", - "LOCData", - "LOCMeta", - "MX", - "MXMeta", - "NAPTR", - "NAPTRData", - "NAPTRMeta", - "NS", - "NSMeta", - "PTR", - "PTRMeta", - "SMIMEA", - "SMIMEAData", - "SMIMEAMeta", - "SRV", - "SRVData", - "SRVMeta", - "SSHFP", - "SSHFPData", - "SSHFPMeta", - "SVCB", - "SVCBData", - "SVCBMeta", - "TLSA", - "TLSAData", - "TLSAMeta", - "TXT", - "TXTMeta", - "URI", - "URIData", - "URIMeta", -] - - -class AMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class A(BaseModel): - content: str - """A valid IPv4 address.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["A"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[AMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: Optional[bool] = None - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class AAAAMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class AAAA(BaseModel): - content: str - """A valid IPv6 address.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["AAAA"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[AAAAMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: Optional[bool] = None - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class CAAData(BaseModel): - flags: Optional[float] = None - """Flags for the CAA record.""" - - tag: Optional[str] = None - """Name of the property controlled by this record (e.g.: issue, issuewild, iodef).""" - - value: Optional[str] = None - """Value of the record. This field's semantics depend on the chosen tag.""" - - -class CAAMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class CAA(BaseModel): - data: CAAData - """Components of a CAA record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["CAA"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted CAA content. See 'data' to set CAA properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[CAAMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class CERTData(BaseModel): - algorithm: Optional[float] = None - """Algorithm.""" - - certificate: Optional[str] = None - """Certificate.""" - - key_tag: Optional[float] = None - """Key Tag.""" - - type: Optional[float] = None - """Type.""" - - -class CERTMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class CERT(BaseModel): - data: CERTData - """Components of a CERT record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["CERT"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted CERT content. See 'data' to set CERT properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[CERTMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class CNAMEMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class CNAME(BaseModel): - content: object - """A valid hostname. Must not match the record's name.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["CNAME"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[CNAMEMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - proxied: Optional[bool] = None - """ - Whether the record is receiving the performance and security benefits of - Cloudflare. - """ - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class DNSKEYData(BaseModel): - algorithm: Optional[float] = None - """Algorithm.""" - - flags: Optional[float] = None - """Flags.""" - - protocol: Optional[float] = None - """Protocol.""" - - public_key: Optional[str] = None - """Public Key.""" - - -class DNSKEYMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class DNSKEY(BaseModel): - data: DNSKEYData - """Components of a DNSKEY record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["DNSKEY"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted DNSKEY content. See 'data' to set DNSKEY properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[DNSKEYMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class DSData(BaseModel): - algorithm: Optional[float] = None - """Algorithm.""" - - digest: Optional[str] = None - """Digest.""" - - digest_type: Optional[float] = None - """Digest Type.""" - - key_tag: Optional[float] = None - """Key Tag.""" - - -class DSMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class DS(BaseModel): - data: DSData - """Components of a DS record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["DS"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted DS content. See 'data' to set DS properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[DSMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class HTTPSData(BaseModel): - priority: Optional[float] = None - """priority.""" - - target: Optional[str] = None - """target.""" - - value: Optional[str] = None - """value.""" - - -class HTTPSMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class HTTPS(BaseModel): - data: HTTPSData - """Components of a HTTPS record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["HTTPS"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted HTTPS content. See 'data' to set HTTPS properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[HTTPSMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class LOCData(BaseModel): - altitude: Optional[float] = None - """Altitude of location in meters.""" - - lat_degrees: Optional[float] = None - """Degrees of latitude.""" - - lat_direction: Optional[Literal["N", "S"]] = None - """Latitude direction.""" - - lat_minutes: Optional[float] = None - """Minutes of latitude.""" - - lat_seconds: Optional[float] = None - """Seconds of latitude.""" - - long_degrees: Optional[float] = None - """Degrees of longitude.""" - - long_direction: Optional[Literal["E", "W"]] = None - """Longitude direction.""" - - long_minutes: Optional[float] = None - """Minutes of longitude.""" - - long_seconds: Optional[float] = None - """Seconds of longitude.""" - - precision_horz: Optional[float] = None - """Horizontal precision of location.""" - - precision_vert: Optional[float] = None - """Vertical precision of location.""" - - size: Optional[float] = None - """Size of location in meters.""" - - -class LOCMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class LOC(BaseModel): - data: LOCData - """Components of a LOC record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["LOC"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted LOC content. See 'data' to set LOC properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[LOCMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class MXMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class MX(BaseModel): - content: str - """A valid mail server hostname.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - priority: float - """Required for MX, SRV and URI records; unused by other record types. - - Records with lower priorities are preferred. - """ - - type: Literal["MX"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[MXMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class NAPTRData(BaseModel): - flags: Optional[str] = None - """Flags.""" - - order: Optional[float] = None - """Order.""" - - preference: Optional[float] = None - """Preference.""" - - regex: Optional[str] = None - """Regex.""" - - replacement: Optional[str] = None - """Replacement.""" - - service: Optional[str] = None - """Service.""" - - -class NAPTRMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class NAPTR(BaseModel): - data: NAPTRData - """Components of a NAPTR record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["NAPTR"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted NAPTR content. See 'data' to set NAPTR properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[NAPTRMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class NSMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class NS(BaseModel): - content: str - """A valid name server host name.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["NS"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[NSMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class PTRMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class PTR(BaseModel): - content: str - """Domain name pointing to the address.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["PTR"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[PTRMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class SMIMEAData(BaseModel): - certificate: Optional[str] = None - """Certificate.""" - - matching_type: Optional[float] = None - """Matching Type.""" - - selector: Optional[float] = None - """Selector.""" - - usage: Optional[float] = None - """Usage.""" - - -class SMIMEAMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class SMIMEA(BaseModel): - data: SMIMEAData - """Components of a SMIMEA record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["SMIMEA"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted SMIMEA content. See 'data' to set SMIMEA properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[SMIMEAMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class SRVData(BaseModel): - name: Optional[str] = None - """A valid hostname. - - Deprecated in favor of the regular 'name' outside the data map. This data map - field represents the remainder of the full 'name' after the service and - protocol. - """ - - port: Optional[float] = None - """The port of the service.""" - - priority: Optional[float] = None - """Required for MX, SRV and URI records; unused by other record types. - - Records with lower priorities are preferred. - """ - - proto: Optional[str] = None - """A valid protocol, prefixed with an underscore. - - Deprecated in favor of the regular 'name' outside the data map. This data map - field normally represents the second label of that 'name'. - """ - - service: Optional[str] = None - """A service type, prefixed with an underscore. - - Deprecated in favor of the regular 'name' outside the data map. This data map - field normally represents the first label of that 'name'. - """ - - target: Optional[str] = None - """A valid hostname.""" - - weight: Optional[float] = None - """The record weight.""" - - -class SRVMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class SRV(BaseModel): - data: SRVData - """Components of a SRV record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode. - - For SRV records, the first label is normally a service and the second a protocol - name, each starting with an underscore. - """ - - type: Literal["SRV"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Priority, weight, port, and SRV target. - - See 'data' for setting the individual component values. - """ - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[SRVMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class SSHFPData(BaseModel): - algorithm: Optional[float] = None - """algorithm.""" - - fingerprint: Optional[str] = None - """fingerprint.""" - - type: Optional[float] = None - """type.""" - - -class SSHFPMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class SSHFP(BaseModel): - data: SSHFPData - """Components of a SSHFP record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["SSHFP"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted SSHFP content. See 'data' to set SSHFP properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[SSHFPMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class SVCBData(BaseModel): - priority: Optional[float] = None - """priority.""" - - target: Optional[str] = None - """target.""" - - value: Optional[str] = None - """value.""" - - -class SVCBMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class SVCB(BaseModel): - data: SVCBData - """Components of a SVCB record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["SVCB"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted SVCB content. See 'data' to set SVCB properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[SVCBMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class TLSAData(BaseModel): - certificate: Optional[str] = None - """certificate.""" - - matching_type: Optional[float] = None - """Matching Type.""" - - selector: Optional[float] = None - """Selector.""" - - usage: Optional[float] = None - """Usage.""" - - -class TLSAMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class TLSA(BaseModel): - data: TLSAData - """Components of a TLSA record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["TLSA"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted TLSA content. See 'data' to set TLSA properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[TLSAMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class TXTMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class TXT(BaseModel): - content: str - """Text content for the record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - type: Literal["TXT"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[TXTMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -class URIData(BaseModel): - content: Optional[str] = None - """The record content.""" - - weight: Optional[float] = None - """The record weight.""" - - -class URIMeta(BaseModel): - auto_added: Optional[bool] = None - """ - Will exist if Cloudflare automatically added this DNS record during initial - setup. - """ - - source: Optional[str] = None - """Where the record originated from.""" - - -class URI(BaseModel): - data: URIData - """Components of a URI record.""" - - name: str - """DNS record name (or @ for the zone apex) in Punycode.""" - - priority: float - """Required for MX, SRV and URI records; unused by other record types. - - Records with lower priorities are preferred. - """ - - type: Literal["URI"] - """Record type.""" - - id: Optional[str] = None - """Identifier""" - - comment: Optional[str] = None - """Comments or notes about the DNS record. - - This field has no effect on DNS responses. - """ - - content: Optional[str] = None - """Formatted URI content. See 'data' to set URI properties.""" - - created_on: Optional[datetime] = None - """When the record was created.""" - - locked: Optional[bool] = None - """ - Whether this record can be modified/deleted (true means it's managed by - Cloudflare). - """ - - meta: Optional[URIMeta] = None - """Extra Cloudflare-specific information about the record.""" - - modified_on: Optional[datetime] = None - """When the record was last modified.""" - - proxiable: Optional[bool] = None - """Whether the record can be proxied by Cloudflare or not.""" - - tags: Optional[List[str]] = None - """Custom tags for the DNS record. This field has no effect on DNS responses.""" - - ttl: Union[float, Literal[1], None] = None - """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. - """ - - zone_id: Optional[str] = None - """Identifier""" - - zone_name: Optional[str] = None - """The domain of the record.""" - - -DNSRecord = Annotated[ - Union[ - A, AAAA, CAA, CERT, CNAME, DNSKEY, DS, HTTPS, LOC, MX, NAPTR, NS, PTR, SMIMEA, SRV, SSHFP, SVCB, TLSA, TXT, URI - ], - PropertyInfo(discriminator="type"), -] diff --git a/src/cloudflare/types/dns/dnskey_record.py b/src/cloudflare/types/dns/dnskey_record.py new file mode 100644 index 00000000000..e2f6284d7ca --- /dev/null +++ b/src/cloudflare/types/dns/dnskey_record.py @@ -0,0 +1,83 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["DNSKEYRecord", "Data"] + + +class Data(BaseModel): + algorithm: Optional[float] = None + """Algorithm.""" + + flags: Optional[float] = None + """Flags.""" + + protocol: Optional[float] = None + """Protocol.""" + + public_key: Optional[str] = None + """Public Key.""" + + +class DNSKEYRecord(BaseModel): + data: Data + """Components of a DNSKEY record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["DNSKEY"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted DNSKEY content. See 'data' to set DNSKEY properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/ds_record.py b/src/cloudflare/types/dns/ds_record.py new file mode 100644 index 00000000000..cc6e93c8ab7 --- /dev/null +++ b/src/cloudflare/types/dns/ds_record.py @@ -0,0 +1,83 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["DSRecord", "Data"] + + +class Data(BaseModel): + algorithm: Optional[float] = None + """Algorithm.""" + + digest: Optional[str] = None + """Digest.""" + + digest_type: Optional[float] = None + """Digest Type.""" + + key_tag: Optional[float] = None + """Key Tag.""" + + +class DSRecord(BaseModel): + data: Data + """Components of a DS record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["DS"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted DS content. See 'data' to set DS properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/firewall/__init__.py b/src/cloudflare/types/dns/firewall/__init__.py index f8ee8b14b1c..1e446ac36d1 100644 --- a/src/cloudflare/types/dns/firewall/__init__.py +++ b/src/cloudflare/types/dns/firewall/__init__.py @@ -1,3 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .firewall import Firewall as Firewall diff --git a/src/cloudflare/types/dns/firewall/firewall.py b/src/cloudflare/types/dns/firewall/firewall.py new file mode 100644 index 00000000000..8e35b4399da --- /dev/null +++ b/src/cloudflare/types/dns/firewall/firewall.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel +from ..firewall_ips import FirewallIPs +from ..upstream_ips import UpstreamIPs +from ..attack_mitigation import AttackMitigation + +__all__ = ["Firewall"] + + +class Firewall(BaseModel): + id: str + """Identifier""" + + deprecate_any_requests: bool + """Deprecate the response to ANY requests.""" + + dns_firewall_ips: List[FirewallIPs] + + ecs_fallback: bool + """Forward client IP (resolver) subnet if no EDNS Client Subnet is sent.""" + + maximum_cache_ttl: float + """Maximum DNS Cache TTL.""" + + minimum_cache_ttl: float + """Minimum DNS Cache TTL.""" + + modified_on: datetime + """Last modification of DNS Firewall cluster.""" + + name: str + """DNS Firewall Cluster Name.""" + + upstream_ips: List[UpstreamIPs] + + attack_mitigation: Optional[AttackMitigation] = None + """Attack mitigation settings.""" + + negative_cache_ttl: Optional[float] = None + """Negative DNS Cache TTL.""" + + ratelimit: Optional[float] = None + """ + Ratelimit in queries per second per datacenter (applies to DNS queries sent to + the upstream nameservers configured on the cluster). + """ + + retries: Optional[float] = None + """ + Number of retries for fetching DNS responses from upstream nameservers (not + counting the initial attempt). + """ diff --git a/src/cloudflare/types/dns/firewall_create_params.py b/src/cloudflare/types/dns/firewall_create_params.py index 7562374f23c..d88aa2d120c 100644 --- a/src/cloudflare/types/dns/firewall_create_params.py +++ b/src/cloudflare/types/dns/firewall_create_params.py @@ -2,10 +2,13 @@ from __future__ import annotations -from typing import List, Union, Optional +from typing import List, Optional from typing_extensions import Required, TypedDict -__all__ = ["FirewallCreateParams", "AttackMitigation"] +from .upstream_ips_param import UpstreamIPsParam +from .attack_mitigation_param import AttackMitigationParam + +__all__ = ["FirewallCreateParams"] class FirewallCreateParams(TypedDict, total=False): @@ -15,9 +18,9 @@ class FirewallCreateParams(TypedDict, total=False): name: Required[str] """DNS Firewall Cluster Name.""" - upstream_ips: Required[List[Union[str, str]]] + upstream_ips: Required[List[UpstreamIPsParam]] - attack_mitigation: Optional[AttackMitigation] + attack_mitigation: Optional[AttackMitigationParam] """Attack mitigation settings.""" deprecate_any_requests: bool @@ -46,14 +49,3 @@ class FirewallCreateParams(TypedDict, total=False): Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt). """ - - -class AttackMitigation(TypedDict, total=False): - enabled: bool - """ - When enabled, random-prefix attacks are automatically mitigated and the upstream - DNS servers protected. - """ - - only_when_upstream_unhealthy: bool - """Only mitigate attacks when upstream servers seem unhealthy.""" diff --git a/src/cloudflare/types/dns/firewall_delete_params.py b/src/cloudflare/types/dns/firewall_delete_params.py new file mode 100644 index 00000000000..e0fc1fb1cf2 --- /dev/null +++ b/src/cloudflare/types/dns/firewall_delete_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__ = ["FirewallDeleteParams"] + + +class FirewallDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/dns/firewall_edit_params.py b/src/cloudflare/types/dns/firewall_edit_params.py index b3e117eb015..723e2c19cfe 100644 --- a/src/cloudflare/types/dns/firewall_edit_params.py +++ b/src/cloudflare/types/dns/firewall_edit_params.py @@ -2,10 +2,14 @@ from __future__ import annotations -from typing import List, Union, Optional +from typing import List, Optional from typing_extensions import Required, TypedDict -__all__ = ["FirewallEditParams", "AttackMitigation"] +from .firewall_ips_param import FirewallIPsParam +from .upstream_ips_param import UpstreamIPsParam +from .attack_mitigation_param import AttackMitigationParam + +__all__ = ["FirewallEditParams"] class FirewallEditParams(TypedDict, total=False): @@ -15,7 +19,7 @@ class FirewallEditParams(TypedDict, total=False): deprecate_any_requests: Required[bool] """Deprecate the response to ANY requests.""" - dns_firewall_ips: Required[List[Union[str, str]]] + dns_firewall_ips: Required[List[FirewallIPsParam]] ecs_fallback: Required[bool] """Forward client IP (resolver) subnet if no EDNS Client Subnet is sent.""" @@ -29,9 +33,9 @@ class FirewallEditParams(TypedDict, total=False): name: Required[str] """DNS Firewall Cluster Name.""" - upstream_ips: Required[List[Union[str, str]]] + upstream_ips: Required[List[UpstreamIPsParam]] - attack_mitigation: Optional[AttackMitigation] + attack_mitigation: Optional[AttackMitigationParam] """Attack mitigation settings.""" negative_cache_ttl: Optional[float] @@ -48,14 +52,3 @@ class FirewallEditParams(TypedDict, total=False): Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt). """ - - -class AttackMitigation(TypedDict, total=False): - enabled: bool - """ - When enabled, random-prefix attacks are automatically mitigated and the upstream - DNS servers protected. - """ - - only_when_upstream_unhealthy: bool - """Only mitigate attacks when upstream servers seem unhealthy.""" diff --git a/src/cloudflare/types/dns/firewall_ips.py b/src/cloudflare/types/dns/firewall_ips.py new file mode 100644 index 00000000000..ec1ec7a1fc3 --- /dev/null +++ b/src/cloudflare/types/dns/firewall_ips.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +__all__ = ["FirewallIPs"] + +FirewallIPs = Union[str, str] diff --git a/src/cloudflare/types/dns/firewall_ips_param.py b/src/cloudflare/types/dns/firewall_ips_param.py new file mode 100644 index 00000000000..9a199cf8505 --- /dev/null +++ b/src/cloudflare/types/dns/firewall_ips_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +__all__ = ["FirewallIPsParam"] + +FirewallIPsParam = Union[str, str] diff --git a/src/cloudflare/types/dns/https_record.py b/src/cloudflare/types/dns/https_record.py new file mode 100644 index 00000000000..f3a412966f5 --- /dev/null +++ b/src/cloudflare/types/dns/https_record.py @@ -0,0 +1,80 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["HTTPSRecord", "Data"] + + +class Data(BaseModel): + priority: Optional[float] = None + """priority.""" + + target: Optional[str] = None + """target.""" + + value: Optional[str] = None + """value.""" + + +class HTTPSRecord(BaseModel): + data: Data + """Components of a HTTPS record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["HTTPS"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted HTTPS content. See 'data' to set HTTPS properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/loc_record.py b/src/cloudflare/types/dns/loc_record.py new file mode 100644 index 00000000000..66b3e2d9eaf --- /dev/null +++ b/src/cloudflare/types/dns/loc_record.py @@ -0,0 +1,107 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["LOCRecord", "Data"] + + +class Data(BaseModel): + altitude: Optional[float] = None + """Altitude of location in meters.""" + + lat_degrees: Optional[float] = None + """Degrees of latitude.""" + + lat_direction: Optional[Literal["N", "S"]] = None + """Latitude direction.""" + + lat_minutes: Optional[float] = None + """Minutes of latitude.""" + + lat_seconds: Optional[float] = None + """Seconds of latitude.""" + + long_degrees: Optional[float] = None + """Degrees of longitude.""" + + long_direction: Optional[Literal["E", "W"]] = None + """Longitude direction.""" + + long_minutes: Optional[float] = None + """Minutes of longitude.""" + + long_seconds: Optional[float] = None + """Seconds of longitude.""" + + precision_horz: Optional[float] = None + """Horizontal precision of location.""" + + precision_vert: Optional[float] = None + """Vertical precision of location.""" + + size: Optional[float] = None + """Size of location in meters.""" + + +class LOCRecord(BaseModel): + data: Data + """Components of a LOC record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["LOC"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted LOC content. See 'data' to set LOC properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/mx_record.py b/src/cloudflare/types/dns/mx_record.py new file mode 100644 index 00000000000..dd2aa333e2a --- /dev/null +++ b/src/cloudflare/types/dns/mx_record.py @@ -0,0 +1,72 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["MXRecord"] + + +class MXRecord(BaseModel): + content: str + """A valid mail server hostname.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + priority: float + """Required for MX, SRV and URI records; unused by other record types. + + Records with lower priorities are preferred. + """ + + type: Literal["MX"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/naptr_record.py b/src/cloudflare/types/dns/naptr_record.py new file mode 100644 index 00000000000..77dc8f3539a --- /dev/null +++ b/src/cloudflare/types/dns/naptr_record.py @@ -0,0 +1,89 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["NAPTRRecord", "Data"] + + +class Data(BaseModel): + flags: Optional[str] = None + """Flags.""" + + order: Optional[float] = None + """Order.""" + + preference: Optional[float] = None + """Preference.""" + + regex: Optional[str] = None + """Regex.""" + + replacement: Optional[str] = None + """Replacement.""" + + service: Optional[str] = None + """Service.""" + + +class NAPTRRecord(BaseModel): + data: Data + """Components of a NAPTR record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["NAPTR"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted NAPTR content. See 'data' to set NAPTR properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/ns_record.py b/src/cloudflare/types/dns/ns_record.py new file mode 100644 index 00000000000..d71fd5437fa --- /dev/null +++ b/src/cloudflare/types/dns/ns_record.py @@ -0,0 +1,66 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["NSRecord"] + + +class NSRecord(BaseModel): + content: str + """A valid name server host name.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["NS"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/ptr_record.py b/src/cloudflare/types/dns/ptr_record.py new file mode 100644 index 00000000000..46d91d3a4eb --- /dev/null +++ b/src/cloudflare/types/dns/ptr_record.py @@ -0,0 +1,66 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["PTRRecord"] + + +class PTRRecord(BaseModel): + content: str + """Domain name pointing to the address.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["PTR"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/record.py b/src/cloudflare/types/dns/record.py new file mode 100644 index 00000000000..6dcc3a1a15c --- /dev/null +++ b/src/cloudflare/types/dns/record.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated + +from ..._utils import PropertyInfo +from .a_record import ARecord +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 .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 + +__all__ = ["Record"] + +Record = Annotated[ + Union[ + ARecord, + AAAARecord, + CAARecord, + CERTRecord, + CNAMERecord, + DNSKEYRecord, + DSRecord, + HTTPSRecord, + LOCRecord, + MXRecord, + NAPTRRecord, + NSRecord, + PTRRecord, + SMIMEARecord, + SRVRecord, + SSHFPRecord, + SVCBRecord, + TLSARecord, + TXTRecord, + URIRecord, + ], + PropertyInfo(discriminator="type"), +] diff --git a/src/cloudflare/types/dns/record_create_params.py b/src/cloudflare/types/dns/record_create_params.py index d5e32477ca0..f348ac97659 100644 --- a/src/cloudflare/types/dns/record_create_params.py +++ b/src/cloudflare/types/dns/record_create_params.py @@ -5,45 +5,48 @@ from typing import List, Union from typing_extensions import Literal, Required, TypedDict +from .ttl_param import TTLParam +from .record_tags import RecordTags + __all__ = [ "RecordCreateParams", - "DNSRecordsARecord", - "DNSRecordsAAAARecord", - "DNSRecordsCAARecord", - "DNSRecordsCAARecordData", - "DNSRecordsCERTRecord", - "DNSRecordsCERTRecordData", - "DNSRecordsCNAMERecord", - "DNSRecordsDNSKEYRecord", - "DNSRecordsDNSKEYRecordData", - "DNSRecordsDSRecord", - "DNSRecordsDSRecordData", - "DNSRecordsHTTPSRecord", - "DNSRecordsHTTPSRecordData", - "DNSRecordsLOCRecord", - "DNSRecordsLOCRecordData", - "DNSRecordsMXRecord", - "DNSRecordsNAPTRRecord", - "DNSRecordsNAPTRRecordData", - "DNSRecordsNSRecord", - "DNSRecordsPTRRecord", - "DNSRecordsSMIMEARecord", - "DNSRecordsSMIMEARecordData", - "DNSRecordsSRVRecord", - "DNSRecordsSRVRecordData", - "DNSRecordsSSHFPRecord", - "DNSRecordsSSHFPRecordData", - "DNSRecordsSVCBRecord", - "DNSRecordsSVCBRecordData", - "DNSRecordsTLSARecord", - "DNSRecordsTLSARecordData", - "DNSRecordsTXTRecord", - "DNSRecordsURIRecord", - "DNSRecordsURIRecordData", + "ARecord", + "AAAARecord", + "CAARecord", + "CAARecordData", + "CERTRecord", + "CERTRecordData", + "CNAMERecord", + "DNSKEYRecord", + "DNSKEYRecordData", + "DSRecord", + "DSRecordData", + "HTTPSRecord", + "HTTPSRecordData", + "LOCRecord", + "LOCRecordData", + "MXRecord", + "NAPTRRecord", + "NAPTRRecordData", + "NSRecord", + "PTRRecord", + "SMIMEARecord", + "SMIMEARecordData", + "SRVRecord", + "SRVRecordData", + "SSHFPRecord", + "SSHFPRecordData", + "SVCBRecord", + "SVCBRecordData", + "TLSARecord", + "TLSARecordData", + "TXTRecord", + "URIRecord", + "URIRecordData", ] -class DNSRecordsARecord(TypedDict, total=False): +class ARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -68,10 +71,10 @@ class DNSRecordsARecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -79,7 +82,7 @@ class DNSRecordsARecord(TypedDict, total=False): """ -class DNSRecordsAAAARecord(TypedDict, total=False): +class AAAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -104,10 +107,10 @@ class DNSRecordsAAAARecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -115,11 +118,11 @@ class DNSRecordsAAAARecord(TypedDict, total=False): """ -class DNSRecordsCAARecord(TypedDict, total=False): +class CAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsCAARecordData] + data: Required[CAARecordData] """Components of a CAA record.""" name: Required[str] @@ -134,10 +137,10 @@ class DNSRecordsCAARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -145,7 +148,7 @@ class DNSRecordsCAARecord(TypedDict, total=False): """ -class DNSRecordsCAARecordData(TypedDict, total=False): +class CAARecordData(TypedDict, total=False): flags: float """Flags for the CAA record.""" @@ -156,11 +159,11 @@ class DNSRecordsCAARecordData(TypedDict, total=False): """Value of the record. This field's semantics depend on the chosen tag.""" -class DNSRecordsCERTRecord(TypedDict, total=False): +class CERTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsCERTRecordData] + data: Required[CERTRecordData] """Components of a CERT record.""" name: Required[str] @@ -175,10 +178,10 @@ class DNSRecordsCERTRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -186,7 +189,7 @@ class DNSRecordsCERTRecord(TypedDict, total=False): """ -class DNSRecordsCERTRecordData(TypedDict, total=False): +class CERTRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -200,7 +203,7 @@ class DNSRecordsCERTRecordData(TypedDict, total=False): """Type.""" -class DNSRecordsCNAMERecord(TypedDict, total=False): +class CNAMERecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -225,10 +228,10 @@ class DNSRecordsCNAMERecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -236,11 +239,11 @@ class DNSRecordsCNAMERecord(TypedDict, total=False): """ -class DNSRecordsDNSKEYRecord(TypedDict, total=False): +class DNSKEYRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsDNSKEYRecordData] + data: Required[DNSKEYRecordData] """Components of a DNSKEY record.""" name: Required[str] @@ -255,10 +258,10 @@ class DNSRecordsDNSKEYRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -266,7 +269,7 @@ class DNSRecordsDNSKEYRecord(TypedDict, total=False): """ -class DNSRecordsDNSKEYRecordData(TypedDict, total=False): +class DNSKEYRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -280,11 +283,11 @@ class DNSRecordsDNSKEYRecordData(TypedDict, total=False): """Public Key.""" -class DNSRecordsDSRecord(TypedDict, total=False): +class DSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsDSRecordData] + data: Required[DSRecordData] """Components of a DS record.""" name: Required[str] @@ -299,10 +302,10 @@ class DNSRecordsDSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -310,7 +313,7 @@ class DNSRecordsDSRecord(TypedDict, total=False): """ -class DNSRecordsDSRecordData(TypedDict, total=False): +class DSRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -324,11 +327,11 @@ class DNSRecordsDSRecordData(TypedDict, total=False): """Key Tag.""" -class DNSRecordsHTTPSRecord(TypedDict, total=False): +class HTTPSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsHTTPSRecordData] + data: Required[HTTPSRecordData] """Components of a HTTPS record.""" name: Required[str] @@ -343,10 +346,10 @@ class DNSRecordsHTTPSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -354,7 +357,7 @@ class DNSRecordsHTTPSRecord(TypedDict, total=False): """ -class DNSRecordsHTTPSRecordData(TypedDict, total=False): +class HTTPSRecordData(TypedDict, total=False): priority: float """priority.""" @@ -365,11 +368,11 @@ class DNSRecordsHTTPSRecordData(TypedDict, total=False): """value.""" -class DNSRecordsLOCRecord(TypedDict, total=False): +class LOCRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsLOCRecordData] + data: Required[LOCRecordData] """Components of a LOC record.""" name: Required[str] @@ -384,10 +387,10 @@ class DNSRecordsLOCRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -395,7 +398,7 @@ class DNSRecordsLOCRecord(TypedDict, total=False): """ -class DNSRecordsLOCRecordData(TypedDict, total=False): +class LOCRecordData(TypedDict, total=False): altitude: float """Altitude of location in meters.""" @@ -433,7 +436,7 @@ class DNSRecordsLOCRecordData(TypedDict, total=False): """Size of location in meters.""" -class DNSRecordsMXRecord(TypedDict, total=False): +class MXRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -458,10 +461,10 @@ class DNSRecordsMXRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -469,11 +472,11 @@ class DNSRecordsMXRecord(TypedDict, total=False): """ -class DNSRecordsNAPTRRecord(TypedDict, total=False): +class NAPTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsNAPTRRecordData] + data: Required[NAPTRRecordData] """Components of a NAPTR record.""" name: Required[str] @@ -488,10 +491,10 @@ class DNSRecordsNAPTRRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -499,7 +502,7 @@ class DNSRecordsNAPTRRecord(TypedDict, total=False): """ -class DNSRecordsNAPTRRecordData(TypedDict, total=False): +class NAPTRRecordData(TypedDict, total=False): flags: str """Flags.""" @@ -519,7 +522,7 @@ class DNSRecordsNAPTRRecordData(TypedDict, total=False): """Service.""" -class DNSRecordsNSRecord(TypedDict, total=False): +class NSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -538,10 +541,10 @@ class DNSRecordsNSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -549,7 +552,7 @@ class DNSRecordsNSRecord(TypedDict, total=False): """ -class DNSRecordsPTRRecord(TypedDict, total=False): +class PTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -568,10 +571,10 @@ class DNSRecordsPTRRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -579,11 +582,11 @@ class DNSRecordsPTRRecord(TypedDict, total=False): """ -class DNSRecordsSMIMEARecord(TypedDict, total=False): +class SMIMEARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSMIMEARecordData] + data: Required[SMIMEARecordData] """Components of a SMIMEA record.""" name: Required[str] @@ -598,10 +601,10 @@ class DNSRecordsSMIMEARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -609,7 +612,7 @@ class DNSRecordsSMIMEARecord(TypedDict, total=False): """ -class DNSRecordsSMIMEARecordData(TypedDict, total=False): +class SMIMEARecordData(TypedDict, total=False): certificate: str """Certificate.""" @@ -623,11 +626,11 @@ class DNSRecordsSMIMEARecordData(TypedDict, total=False): """Usage.""" -class DNSRecordsSRVRecord(TypedDict, total=False): +class SRVRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSRVRecordData] + data: Required[SRVRecordData] """Components of a SRV record.""" name: Required[str] @@ -646,10 +649,10 @@ class DNSRecordsSRVRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -657,7 +660,7 @@ class DNSRecordsSRVRecord(TypedDict, total=False): """ -class DNSRecordsSRVRecordData(TypedDict, total=False): +class SRVRecordData(TypedDict, total=False): name: str """A valid hostname. @@ -696,11 +699,11 @@ class DNSRecordsSRVRecordData(TypedDict, total=False): """The record weight.""" -class DNSRecordsSSHFPRecord(TypedDict, total=False): +class SSHFPRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSSHFPRecordData] + data: Required[SSHFPRecordData] """Components of a SSHFP record.""" name: Required[str] @@ -715,10 +718,10 @@ class DNSRecordsSSHFPRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -726,7 +729,7 @@ class DNSRecordsSSHFPRecord(TypedDict, total=False): """ -class DNSRecordsSSHFPRecordData(TypedDict, total=False): +class SSHFPRecordData(TypedDict, total=False): algorithm: float """algorithm.""" @@ -737,11 +740,11 @@ class DNSRecordsSSHFPRecordData(TypedDict, total=False): """type.""" -class DNSRecordsSVCBRecord(TypedDict, total=False): +class SVCBRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSVCBRecordData] + data: Required[SVCBRecordData] """Components of a SVCB record.""" name: Required[str] @@ -756,10 +759,10 @@ class DNSRecordsSVCBRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -767,7 +770,7 @@ class DNSRecordsSVCBRecord(TypedDict, total=False): """ -class DNSRecordsSVCBRecordData(TypedDict, total=False): +class SVCBRecordData(TypedDict, total=False): priority: float """priority.""" @@ -778,11 +781,11 @@ class DNSRecordsSVCBRecordData(TypedDict, total=False): """value.""" -class DNSRecordsTLSARecord(TypedDict, total=False): +class TLSARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsTLSARecordData] + data: Required[TLSARecordData] """Components of a TLSA record.""" name: Required[str] @@ -797,10 +800,10 @@ class DNSRecordsTLSARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -808,7 +811,7 @@ class DNSRecordsTLSARecord(TypedDict, total=False): """ -class DNSRecordsTLSARecordData(TypedDict, total=False): +class TLSARecordData(TypedDict, total=False): certificate: str """certificate.""" @@ -822,7 +825,7 @@ class DNSRecordsTLSARecordData(TypedDict, total=False): """Usage.""" -class DNSRecordsTXTRecord(TypedDict, total=False): +class TXTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -841,10 +844,10 @@ class DNSRecordsTXTRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -852,11 +855,11 @@ class DNSRecordsTXTRecord(TypedDict, total=False): """ -class DNSRecordsURIRecord(TypedDict, total=False): +class URIRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsURIRecordData] + data: Required[URIRecordData] """Components of a URI record.""" name: Required[str] @@ -877,10 +880,10 @@ class DNSRecordsURIRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -888,7 +891,7 @@ class DNSRecordsURIRecord(TypedDict, total=False): """ -class DNSRecordsURIRecordData(TypedDict, total=False): +class URIRecordData(TypedDict, total=False): content: str """The record content.""" @@ -897,24 +900,24 @@ class DNSRecordsURIRecordData(TypedDict, total=False): RecordCreateParams = Union[ - DNSRecordsARecord, - DNSRecordsAAAARecord, - DNSRecordsCAARecord, - DNSRecordsCERTRecord, - DNSRecordsCNAMERecord, - DNSRecordsDNSKEYRecord, - DNSRecordsDSRecord, - DNSRecordsHTTPSRecord, - DNSRecordsLOCRecord, - DNSRecordsMXRecord, - DNSRecordsNAPTRRecord, - DNSRecordsNSRecord, - DNSRecordsPTRRecord, - DNSRecordsSMIMEARecord, - DNSRecordsSRVRecord, - DNSRecordsSSHFPRecord, - DNSRecordsSVCBRecord, - DNSRecordsTLSARecord, - DNSRecordsTXTRecord, - DNSRecordsURIRecord, + ARecord, + AAAARecord, + CAARecord, + CERTRecord, + CNAMERecord, + DNSKEYRecord, + DSRecord, + HTTPSRecord, + LOCRecord, + MXRecord, + NAPTRRecord, + NSRecord, + PTRRecord, + SMIMEARecord, + SRVRecord, + SSHFPRecord, + SVCBRecord, + TLSARecord, + TXTRecord, + URIRecord, ] diff --git a/src/cloudflare/types/dns/record_delete_params.py b/src/cloudflare/types/dns/record_delete_params.py new file mode 100644 index 00000000000..2c6bdd46f11 --- /dev/null +++ b/src/cloudflare/types/dns/record_delete_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__ = ["RecordDeleteParams"] + + +class RecordDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/dns/record_edit_params.py b/src/cloudflare/types/dns/record_edit_params.py index bcbb04b48df..709779e9ce1 100644 --- a/src/cloudflare/types/dns/record_edit_params.py +++ b/src/cloudflare/types/dns/record_edit_params.py @@ -5,45 +5,48 @@ from typing import List, Union from typing_extensions import Literal, Required, TypedDict +from .ttl_param import TTLParam +from .record_tags import RecordTags + __all__ = [ "RecordEditParams", - "DNSRecordsARecord", - "DNSRecordsAAAARecord", - "DNSRecordsCAARecord", - "DNSRecordsCAARecordData", - "DNSRecordsCERTRecord", - "DNSRecordsCERTRecordData", - "DNSRecordsCNAMERecord", - "DNSRecordsDNSKEYRecord", - "DNSRecordsDNSKEYRecordData", - "DNSRecordsDSRecord", - "DNSRecordsDSRecordData", - "DNSRecordsHTTPSRecord", - "DNSRecordsHTTPSRecordData", - "DNSRecordsLOCRecord", - "DNSRecordsLOCRecordData", - "DNSRecordsMXRecord", - "DNSRecordsNAPTRRecord", - "DNSRecordsNAPTRRecordData", - "DNSRecordsNSRecord", - "DNSRecordsPTRRecord", - "DNSRecordsSMIMEARecord", - "DNSRecordsSMIMEARecordData", - "DNSRecordsSRVRecord", - "DNSRecordsSRVRecordData", - "DNSRecordsSSHFPRecord", - "DNSRecordsSSHFPRecordData", - "DNSRecordsSVCBRecord", - "DNSRecordsSVCBRecordData", - "DNSRecordsTLSARecord", - "DNSRecordsTLSARecordData", - "DNSRecordsTXTRecord", - "DNSRecordsURIRecord", - "DNSRecordsURIRecordData", + "ARecord", + "AAAARecord", + "CAARecord", + "CAARecordData", + "CERTRecord", + "CERTRecordData", + "CNAMERecord", + "DNSKEYRecord", + "DNSKEYRecordData", + "DSRecord", + "DSRecordData", + "HTTPSRecord", + "HTTPSRecordData", + "LOCRecord", + "LOCRecordData", + "MXRecord", + "NAPTRRecord", + "NAPTRRecordData", + "NSRecord", + "PTRRecord", + "SMIMEARecord", + "SMIMEARecordData", + "SRVRecord", + "SRVRecordData", + "SSHFPRecord", + "SSHFPRecordData", + "SVCBRecord", + "SVCBRecordData", + "TLSARecord", + "TLSARecordData", + "TXTRecord", + "URIRecord", + "URIRecordData", ] -class DNSRecordsARecord(TypedDict, total=False): +class ARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -68,10 +71,10 @@ class DNSRecordsARecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -79,7 +82,7 @@ class DNSRecordsARecord(TypedDict, total=False): """ -class DNSRecordsAAAARecord(TypedDict, total=False): +class AAAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -104,10 +107,10 @@ class DNSRecordsAAAARecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -115,11 +118,11 @@ class DNSRecordsAAAARecord(TypedDict, total=False): """ -class DNSRecordsCAARecord(TypedDict, total=False): +class CAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsCAARecordData] + data: Required[CAARecordData] """Components of a CAA record.""" name: Required[str] @@ -134,10 +137,10 @@ class DNSRecordsCAARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -145,7 +148,7 @@ class DNSRecordsCAARecord(TypedDict, total=False): """ -class DNSRecordsCAARecordData(TypedDict, total=False): +class CAARecordData(TypedDict, total=False): flags: float """Flags for the CAA record.""" @@ -156,11 +159,11 @@ class DNSRecordsCAARecordData(TypedDict, total=False): """Value of the record. This field's semantics depend on the chosen tag.""" -class DNSRecordsCERTRecord(TypedDict, total=False): +class CERTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsCERTRecordData] + data: Required[CERTRecordData] """Components of a CERT record.""" name: Required[str] @@ -175,10 +178,10 @@ class DNSRecordsCERTRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -186,7 +189,7 @@ class DNSRecordsCERTRecord(TypedDict, total=False): """ -class DNSRecordsCERTRecordData(TypedDict, total=False): +class CERTRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -200,7 +203,7 @@ class DNSRecordsCERTRecordData(TypedDict, total=False): """Type.""" -class DNSRecordsCNAMERecord(TypedDict, total=False): +class CNAMERecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -225,10 +228,10 @@ class DNSRecordsCNAMERecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -236,11 +239,11 @@ class DNSRecordsCNAMERecord(TypedDict, total=False): """ -class DNSRecordsDNSKEYRecord(TypedDict, total=False): +class DNSKEYRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsDNSKEYRecordData] + data: Required[DNSKEYRecordData] """Components of a DNSKEY record.""" name: Required[str] @@ -255,10 +258,10 @@ class DNSRecordsDNSKEYRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -266,7 +269,7 @@ class DNSRecordsDNSKEYRecord(TypedDict, total=False): """ -class DNSRecordsDNSKEYRecordData(TypedDict, total=False): +class DNSKEYRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -280,11 +283,11 @@ class DNSRecordsDNSKEYRecordData(TypedDict, total=False): """Public Key.""" -class DNSRecordsDSRecord(TypedDict, total=False): +class DSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsDSRecordData] + data: Required[DSRecordData] """Components of a DS record.""" name: Required[str] @@ -299,10 +302,10 @@ class DNSRecordsDSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -310,7 +313,7 @@ class DNSRecordsDSRecord(TypedDict, total=False): """ -class DNSRecordsDSRecordData(TypedDict, total=False): +class DSRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -324,11 +327,11 @@ class DNSRecordsDSRecordData(TypedDict, total=False): """Key Tag.""" -class DNSRecordsHTTPSRecord(TypedDict, total=False): +class HTTPSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsHTTPSRecordData] + data: Required[HTTPSRecordData] """Components of a HTTPS record.""" name: Required[str] @@ -343,10 +346,10 @@ class DNSRecordsHTTPSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -354,7 +357,7 @@ class DNSRecordsHTTPSRecord(TypedDict, total=False): """ -class DNSRecordsHTTPSRecordData(TypedDict, total=False): +class HTTPSRecordData(TypedDict, total=False): priority: float """priority.""" @@ -365,11 +368,11 @@ class DNSRecordsHTTPSRecordData(TypedDict, total=False): """value.""" -class DNSRecordsLOCRecord(TypedDict, total=False): +class LOCRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsLOCRecordData] + data: Required[LOCRecordData] """Components of a LOC record.""" name: Required[str] @@ -384,10 +387,10 @@ class DNSRecordsLOCRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -395,7 +398,7 @@ class DNSRecordsLOCRecord(TypedDict, total=False): """ -class DNSRecordsLOCRecordData(TypedDict, total=False): +class LOCRecordData(TypedDict, total=False): altitude: float """Altitude of location in meters.""" @@ -433,7 +436,7 @@ class DNSRecordsLOCRecordData(TypedDict, total=False): """Size of location in meters.""" -class DNSRecordsMXRecord(TypedDict, total=False): +class MXRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -458,10 +461,10 @@ class DNSRecordsMXRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -469,11 +472,11 @@ class DNSRecordsMXRecord(TypedDict, total=False): """ -class DNSRecordsNAPTRRecord(TypedDict, total=False): +class NAPTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsNAPTRRecordData] + data: Required[NAPTRRecordData] """Components of a NAPTR record.""" name: Required[str] @@ -488,10 +491,10 @@ class DNSRecordsNAPTRRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -499,7 +502,7 @@ class DNSRecordsNAPTRRecord(TypedDict, total=False): """ -class DNSRecordsNAPTRRecordData(TypedDict, total=False): +class NAPTRRecordData(TypedDict, total=False): flags: str """Flags.""" @@ -519,7 +522,7 @@ class DNSRecordsNAPTRRecordData(TypedDict, total=False): """Service.""" -class DNSRecordsNSRecord(TypedDict, total=False): +class NSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -538,10 +541,10 @@ class DNSRecordsNSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -549,7 +552,7 @@ class DNSRecordsNSRecord(TypedDict, total=False): """ -class DNSRecordsPTRRecord(TypedDict, total=False): +class PTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -568,10 +571,10 @@ class DNSRecordsPTRRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -579,11 +582,11 @@ class DNSRecordsPTRRecord(TypedDict, total=False): """ -class DNSRecordsSMIMEARecord(TypedDict, total=False): +class SMIMEARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSMIMEARecordData] + data: Required[SMIMEARecordData] """Components of a SMIMEA record.""" name: Required[str] @@ -598,10 +601,10 @@ class DNSRecordsSMIMEARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -609,7 +612,7 @@ class DNSRecordsSMIMEARecord(TypedDict, total=False): """ -class DNSRecordsSMIMEARecordData(TypedDict, total=False): +class SMIMEARecordData(TypedDict, total=False): certificate: str """Certificate.""" @@ -623,11 +626,11 @@ class DNSRecordsSMIMEARecordData(TypedDict, total=False): """Usage.""" -class DNSRecordsSRVRecord(TypedDict, total=False): +class SRVRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSRVRecordData] + data: Required[SRVRecordData] """Components of a SRV record.""" name: Required[str] @@ -646,10 +649,10 @@ class DNSRecordsSRVRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -657,7 +660,7 @@ class DNSRecordsSRVRecord(TypedDict, total=False): """ -class DNSRecordsSRVRecordData(TypedDict, total=False): +class SRVRecordData(TypedDict, total=False): name: str """A valid hostname. @@ -696,11 +699,11 @@ class DNSRecordsSRVRecordData(TypedDict, total=False): """The record weight.""" -class DNSRecordsSSHFPRecord(TypedDict, total=False): +class SSHFPRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSSHFPRecordData] + data: Required[SSHFPRecordData] """Components of a SSHFP record.""" name: Required[str] @@ -715,10 +718,10 @@ class DNSRecordsSSHFPRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -726,7 +729,7 @@ class DNSRecordsSSHFPRecord(TypedDict, total=False): """ -class DNSRecordsSSHFPRecordData(TypedDict, total=False): +class SSHFPRecordData(TypedDict, total=False): algorithm: float """algorithm.""" @@ -737,11 +740,11 @@ class DNSRecordsSSHFPRecordData(TypedDict, total=False): """type.""" -class DNSRecordsSVCBRecord(TypedDict, total=False): +class SVCBRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSVCBRecordData] + data: Required[SVCBRecordData] """Components of a SVCB record.""" name: Required[str] @@ -756,10 +759,10 @@ class DNSRecordsSVCBRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -767,7 +770,7 @@ class DNSRecordsSVCBRecord(TypedDict, total=False): """ -class DNSRecordsSVCBRecordData(TypedDict, total=False): +class SVCBRecordData(TypedDict, total=False): priority: float """priority.""" @@ -778,11 +781,11 @@ class DNSRecordsSVCBRecordData(TypedDict, total=False): """value.""" -class DNSRecordsTLSARecord(TypedDict, total=False): +class TLSARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsTLSARecordData] + data: Required[TLSARecordData] """Components of a TLSA record.""" name: Required[str] @@ -797,10 +800,10 @@ class DNSRecordsTLSARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -808,7 +811,7 @@ class DNSRecordsTLSARecord(TypedDict, total=False): """ -class DNSRecordsTLSARecordData(TypedDict, total=False): +class TLSARecordData(TypedDict, total=False): certificate: str """certificate.""" @@ -822,7 +825,7 @@ class DNSRecordsTLSARecordData(TypedDict, total=False): """Usage.""" -class DNSRecordsTXTRecord(TypedDict, total=False): +class TXTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -841,10 +844,10 @@ class DNSRecordsTXTRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -852,11 +855,11 @@ class DNSRecordsTXTRecord(TypedDict, total=False): """ -class DNSRecordsURIRecord(TypedDict, total=False): +class URIRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsURIRecordData] + data: Required[URIRecordData] """Components of a URI record.""" name: Required[str] @@ -877,10 +880,10 @@ class DNSRecordsURIRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -888,7 +891,7 @@ class DNSRecordsURIRecord(TypedDict, total=False): """ -class DNSRecordsURIRecordData(TypedDict, total=False): +class URIRecordData(TypedDict, total=False): content: str """The record content.""" @@ -897,24 +900,24 @@ class DNSRecordsURIRecordData(TypedDict, total=False): RecordEditParams = Union[ - DNSRecordsARecord, - DNSRecordsAAAARecord, - DNSRecordsCAARecord, - DNSRecordsCERTRecord, - DNSRecordsCNAMERecord, - DNSRecordsDNSKEYRecord, - DNSRecordsDSRecord, - DNSRecordsHTTPSRecord, - DNSRecordsLOCRecord, - DNSRecordsMXRecord, - DNSRecordsNAPTRRecord, - DNSRecordsNSRecord, - DNSRecordsPTRRecord, - DNSRecordsSMIMEARecord, - DNSRecordsSRVRecord, - DNSRecordsSSHFPRecord, - DNSRecordsSVCBRecord, - DNSRecordsTLSARecord, - DNSRecordsTXTRecord, - DNSRecordsURIRecord, + ARecord, + AAAARecord, + CAARecord, + CERTRecord, + CNAMERecord, + DNSKEYRecord, + DSRecord, + HTTPSRecord, + LOCRecord, + MXRecord, + NAPTRRecord, + NSRecord, + PTRRecord, + SMIMEARecord, + SRVRecord, + SSHFPRecord, + SVCBRecord, + TLSARecord, + TXTRecord, + URIRecord, ] diff --git a/src/cloudflare/types/dns/record_metadata.py b/src/cloudflare/types/dns/record_metadata.py new file mode 100644 index 00000000000..f2e67cdb214 --- /dev/null +++ b/src/cloudflare/types/dns/record_metadata.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["RecordMetadata"] + + +class RecordMetadata(BaseModel): + auto_added: Optional[bool] = None + """ + Will exist if Cloudflare automatically added this DNS record during initial + setup. + """ + + source: Optional[str] = None + """Where the record originated from.""" diff --git a/src/cloudflare/types/dns/record_process_timing.py b/src/cloudflare/types/dns/record_process_timing.py new file mode 100644 index 00000000000..1fc4d7db12a --- /dev/null +++ b/src/cloudflare/types/dns/record_process_timing.py @@ -0,0 +1,19 @@ +# 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_scan_params.py b/src/cloudflare/types/dns/record_scan_params.py new file mode 100644 index 00000000000..070a021300f --- /dev/null +++ b/src/cloudflare/types/dns/record_scan_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__ = ["RecordScanParams"] + + +class RecordScanParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/dns/record_tags.py b/src/cloudflare/types/dns/record_tags.py new file mode 100644 index 00000000000..202ad9b305e --- /dev/null +++ b/src/cloudflare/types/dns/record_tags.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["RecordTags"] + +RecordTags = str diff --git a/src/cloudflare/types/dns/record_update_params.py b/src/cloudflare/types/dns/record_update_params.py index e1130ce0ace..9cb23c89af2 100644 --- a/src/cloudflare/types/dns/record_update_params.py +++ b/src/cloudflare/types/dns/record_update_params.py @@ -5,45 +5,48 @@ from typing import List, Union from typing_extensions import Literal, Required, TypedDict +from .ttl_param import TTLParam +from .record_tags import RecordTags + __all__ = [ "RecordUpdateParams", - "DNSRecordsARecord", - "DNSRecordsAAAARecord", - "DNSRecordsCAARecord", - "DNSRecordsCAARecordData", - "DNSRecordsCERTRecord", - "DNSRecordsCERTRecordData", - "DNSRecordsCNAMERecord", - "DNSRecordsDNSKEYRecord", - "DNSRecordsDNSKEYRecordData", - "DNSRecordsDSRecord", - "DNSRecordsDSRecordData", - "DNSRecordsHTTPSRecord", - "DNSRecordsHTTPSRecordData", - "DNSRecordsLOCRecord", - "DNSRecordsLOCRecordData", - "DNSRecordsMXRecord", - "DNSRecordsNAPTRRecord", - "DNSRecordsNAPTRRecordData", - "DNSRecordsNSRecord", - "DNSRecordsPTRRecord", - "DNSRecordsSMIMEARecord", - "DNSRecordsSMIMEARecordData", - "DNSRecordsSRVRecord", - "DNSRecordsSRVRecordData", - "DNSRecordsSSHFPRecord", - "DNSRecordsSSHFPRecordData", - "DNSRecordsSVCBRecord", - "DNSRecordsSVCBRecordData", - "DNSRecordsTLSARecord", - "DNSRecordsTLSARecordData", - "DNSRecordsTXTRecord", - "DNSRecordsURIRecord", - "DNSRecordsURIRecordData", + "ARecord", + "AAAARecord", + "CAARecord", + "CAARecordData", + "CERTRecord", + "CERTRecordData", + "CNAMERecord", + "DNSKEYRecord", + "DNSKEYRecordData", + "DSRecord", + "DSRecordData", + "HTTPSRecord", + "HTTPSRecordData", + "LOCRecord", + "LOCRecordData", + "MXRecord", + "NAPTRRecord", + "NAPTRRecordData", + "NSRecord", + "PTRRecord", + "SMIMEARecord", + "SMIMEARecordData", + "SRVRecord", + "SRVRecordData", + "SSHFPRecord", + "SSHFPRecordData", + "SVCBRecord", + "SVCBRecordData", + "TLSARecord", + "TLSARecordData", + "TXTRecord", + "URIRecord", + "URIRecordData", ] -class DNSRecordsARecord(TypedDict, total=False): +class ARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -68,10 +71,10 @@ class DNSRecordsARecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -79,7 +82,7 @@ class DNSRecordsARecord(TypedDict, total=False): """ -class DNSRecordsAAAARecord(TypedDict, total=False): +class AAAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -104,10 +107,10 @@ class DNSRecordsAAAARecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -115,11 +118,11 @@ class DNSRecordsAAAARecord(TypedDict, total=False): """ -class DNSRecordsCAARecord(TypedDict, total=False): +class CAARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsCAARecordData] + data: Required[CAARecordData] """Components of a CAA record.""" name: Required[str] @@ -134,10 +137,10 @@ class DNSRecordsCAARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -145,7 +148,7 @@ class DNSRecordsCAARecord(TypedDict, total=False): """ -class DNSRecordsCAARecordData(TypedDict, total=False): +class CAARecordData(TypedDict, total=False): flags: float """Flags for the CAA record.""" @@ -156,11 +159,11 @@ class DNSRecordsCAARecordData(TypedDict, total=False): """Value of the record. This field's semantics depend on the chosen tag.""" -class DNSRecordsCERTRecord(TypedDict, total=False): +class CERTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsCERTRecordData] + data: Required[CERTRecordData] """Components of a CERT record.""" name: Required[str] @@ -175,10 +178,10 @@ class DNSRecordsCERTRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -186,7 +189,7 @@ class DNSRecordsCERTRecord(TypedDict, total=False): """ -class DNSRecordsCERTRecordData(TypedDict, total=False): +class CERTRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -200,7 +203,7 @@ class DNSRecordsCERTRecordData(TypedDict, total=False): """Type.""" -class DNSRecordsCNAMERecord(TypedDict, total=False): +class CNAMERecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -225,10 +228,10 @@ class DNSRecordsCNAMERecord(TypedDict, total=False): Cloudflare. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -236,11 +239,11 @@ class DNSRecordsCNAMERecord(TypedDict, total=False): """ -class DNSRecordsDNSKEYRecord(TypedDict, total=False): +class DNSKEYRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsDNSKEYRecordData] + data: Required[DNSKEYRecordData] """Components of a DNSKEY record.""" name: Required[str] @@ -255,10 +258,10 @@ class DNSRecordsDNSKEYRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -266,7 +269,7 @@ class DNSRecordsDNSKEYRecord(TypedDict, total=False): """ -class DNSRecordsDNSKEYRecordData(TypedDict, total=False): +class DNSKEYRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -280,11 +283,11 @@ class DNSRecordsDNSKEYRecordData(TypedDict, total=False): """Public Key.""" -class DNSRecordsDSRecord(TypedDict, total=False): +class DSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsDSRecordData] + data: Required[DSRecordData] """Components of a DS record.""" name: Required[str] @@ -299,10 +302,10 @@ class DNSRecordsDSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -310,7 +313,7 @@ class DNSRecordsDSRecord(TypedDict, total=False): """ -class DNSRecordsDSRecordData(TypedDict, total=False): +class DSRecordData(TypedDict, total=False): algorithm: float """Algorithm.""" @@ -324,11 +327,11 @@ class DNSRecordsDSRecordData(TypedDict, total=False): """Key Tag.""" -class DNSRecordsHTTPSRecord(TypedDict, total=False): +class HTTPSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsHTTPSRecordData] + data: Required[HTTPSRecordData] """Components of a HTTPS record.""" name: Required[str] @@ -343,10 +346,10 @@ class DNSRecordsHTTPSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -354,7 +357,7 @@ class DNSRecordsHTTPSRecord(TypedDict, total=False): """ -class DNSRecordsHTTPSRecordData(TypedDict, total=False): +class HTTPSRecordData(TypedDict, total=False): priority: float """priority.""" @@ -365,11 +368,11 @@ class DNSRecordsHTTPSRecordData(TypedDict, total=False): """value.""" -class DNSRecordsLOCRecord(TypedDict, total=False): +class LOCRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsLOCRecordData] + data: Required[LOCRecordData] """Components of a LOC record.""" name: Required[str] @@ -384,10 +387,10 @@ class DNSRecordsLOCRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -395,7 +398,7 @@ class DNSRecordsLOCRecord(TypedDict, total=False): """ -class DNSRecordsLOCRecordData(TypedDict, total=False): +class LOCRecordData(TypedDict, total=False): altitude: float """Altitude of location in meters.""" @@ -433,7 +436,7 @@ class DNSRecordsLOCRecordData(TypedDict, total=False): """Size of location in meters.""" -class DNSRecordsMXRecord(TypedDict, total=False): +class MXRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -458,10 +461,10 @@ class DNSRecordsMXRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -469,11 +472,11 @@ class DNSRecordsMXRecord(TypedDict, total=False): """ -class DNSRecordsNAPTRRecord(TypedDict, total=False): +class NAPTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsNAPTRRecordData] + data: Required[NAPTRRecordData] """Components of a NAPTR record.""" name: Required[str] @@ -488,10 +491,10 @@ class DNSRecordsNAPTRRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -499,7 +502,7 @@ class DNSRecordsNAPTRRecord(TypedDict, total=False): """ -class DNSRecordsNAPTRRecordData(TypedDict, total=False): +class NAPTRRecordData(TypedDict, total=False): flags: str """Flags.""" @@ -519,7 +522,7 @@ class DNSRecordsNAPTRRecordData(TypedDict, total=False): """Service.""" -class DNSRecordsNSRecord(TypedDict, total=False): +class NSRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -538,10 +541,10 @@ class DNSRecordsNSRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -549,7 +552,7 @@ class DNSRecordsNSRecord(TypedDict, total=False): """ -class DNSRecordsPTRRecord(TypedDict, total=False): +class PTRRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -568,10 +571,10 @@ class DNSRecordsPTRRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -579,11 +582,11 @@ class DNSRecordsPTRRecord(TypedDict, total=False): """ -class DNSRecordsSMIMEARecord(TypedDict, total=False): +class SMIMEARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSMIMEARecordData] + data: Required[SMIMEARecordData] """Components of a SMIMEA record.""" name: Required[str] @@ -598,10 +601,10 @@ class DNSRecordsSMIMEARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -609,7 +612,7 @@ class DNSRecordsSMIMEARecord(TypedDict, total=False): """ -class DNSRecordsSMIMEARecordData(TypedDict, total=False): +class SMIMEARecordData(TypedDict, total=False): certificate: str """Certificate.""" @@ -623,11 +626,11 @@ class DNSRecordsSMIMEARecordData(TypedDict, total=False): """Usage.""" -class DNSRecordsSRVRecord(TypedDict, total=False): +class SRVRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSRVRecordData] + data: Required[SRVRecordData] """Components of a SRV record.""" name: Required[str] @@ -646,10 +649,10 @@ class DNSRecordsSRVRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -657,7 +660,7 @@ class DNSRecordsSRVRecord(TypedDict, total=False): """ -class DNSRecordsSRVRecordData(TypedDict, total=False): +class SRVRecordData(TypedDict, total=False): name: str """A valid hostname. @@ -696,11 +699,11 @@ class DNSRecordsSRVRecordData(TypedDict, total=False): """The record weight.""" -class DNSRecordsSSHFPRecord(TypedDict, total=False): +class SSHFPRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSSHFPRecordData] + data: Required[SSHFPRecordData] """Components of a SSHFP record.""" name: Required[str] @@ -715,10 +718,10 @@ class DNSRecordsSSHFPRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -726,7 +729,7 @@ class DNSRecordsSSHFPRecord(TypedDict, total=False): """ -class DNSRecordsSSHFPRecordData(TypedDict, total=False): +class SSHFPRecordData(TypedDict, total=False): algorithm: float """algorithm.""" @@ -737,11 +740,11 @@ class DNSRecordsSSHFPRecordData(TypedDict, total=False): """type.""" -class DNSRecordsSVCBRecord(TypedDict, total=False): +class SVCBRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsSVCBRecordData] + data: Required[SVCBRecordData] """Components of a SVCB record.""" name: Required[str] @@ -756,10 +759,10 @@ class DNSRecordsSVCBRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -767,7 +770,7 @@ class DNSRecordsSVCBRecord(TypedDict, total=False): """ -class DNSRecordsSVCBRecordData(TypedDict, total=False): +class SVCBRecordData(TypedDict, total=False): priority: float """priority.""" @@ -778,11 +781,11 @@ class DNSRecordsSVCBRecordData(TypedDict, total=False): """value.""" -class DNSRecordsTLSARecord(TypedDict, total=False): +class TLSARecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsTLSARecordData] + data: Required[TLSARecordData] """Components of a TLSA record.""" name: Required[str] @@ -797,10 +800,10 @@ class DNSRecordsTLSARecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -808,7 +811,7 @@ class DNSRecordsTLSARecord(TypedDict, total=False): """ -class DNSRecordsTLSARecordData(TypedDict, total=False): +class TLSARecordData(TypedDict, total=False): certificate: str """certificate.""" @@ -822,7 +825,7 @@ class DNSRecordsTLSARecordData(TypedDict, total=False): """Usage.""" -class DNSRecordsTXTRecord(TypedDict, total=False): +class TXTRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -841,10 +844,10 @@ class DNSRecordsTXTRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -852,11 +855,11 @@ class DNSRecordsTXTRecord(TypedDict, total=False): """ -class DNSRecordsURIRecord(TypedDict, total=False): +class URIRecord(TypedDict, total=False): zone_id: Required[str] """Identifier""" - data: Required[DNSRecordsURIRecordData] + data: Required[URIRecordData] """Components of a URI record.""" name: Required[str] @@ -877,10 +880,10 @@ class DNSRecordsURIRecord(TypedDict, total=False): This field has no effect on DNS responses. """ - tags: List[str] + tags: List[RecordTags] """Custom tags for the DNS record. This field has no effect on DNS responses.""" - ttl: Union[float, Literal[1]] + 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 @@ -888,7 +891,7 @@ class DNSRecordsURIRecord(TypedDict, total=False): """ -class DNSRecordsURIRecordData(TypedDict, total=False): +class URIRecordData(TypedDict, total=False): content: str """The record content.""" @@ -897,24 +900,24 @@ class DNSRecordsURIRecordData(TypedDict, total=False): RecordUpdateParams = Union[ - DNSRecordsARecord, - DNSRecordsAAAARecord, - DNSRecordsCAARecord, - DNSRecordsCERTRecord, - DNSRecordsCNAMERecord, - DNSRecordsDNSKEYRecord, - DNSRecordsDSRecord, - DNSRecordsHTTPSRecord, - DNSRecordsLOCRecord, - DNSRecordsMXRecord, - DNSRecordsNAPTRRecord, - DNSRecordsNSRecord, - DNSRecordsPTRRecord, - DNSRecordsSMIMEARecord, - DNSRecordsSRVRecord, - DNSRecordsSSHFPRecord, - DNSRecordsSVCBRecord, - DNSRecordsTLSARecord, - DNSRecordsTXTRecord, - DNSRecordsURIRecord, + ARecord, + AAAARecord, + CAARecord, + CERTRecord, + CNAMERecord, + DNSKEYRecord, + DSRecord, + HTTPSRecord, + LOCRecord, + MXRecord, + NAPTRRecord, + NSRecord, + 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 new file mode 100644 index 00000000000..34ce2908956 --- /dev/null +++ b/src/cloudflare/types/dns/smimea_record.py @@ -0,0 +1,83 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["SMIMEARecord", "Data"] + + +class Data(BaseModel): + certificate: Optional[str] = None + """Certificate.""" + + matching_type: Optional[float] = None + """Matching Type.""" + + selector: Optional[float] = None + """Selector.""" + + usage: Optional[float] = None + """Usage.""" + + +class SMIMEARecord(BaseModel): + data: Data + """Components of a SMIMEA record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["SMIMEA"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted SMIMEA content. See 'data' to set SMIMEA properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/srv_record.py b/src/cloudflare/types/dns/srv_record.py new file mode 100644 index 00000000000..5bb285beee5 --- /dev/null +++ b/src/cloudflare/types/dns/srv_record.py @@ -0,0 +1,115 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["SRVRecord", "Data"] + + +class Data(BaseModel): + name: Optional[str] = None + """A valid hostname. + + Deprecated in favor of the regular 'name' outside the data map. This data map + field represents the remainder of the full 'name' after the service and + protocol. + """ + + port: Optional[float] = None + """The port of the service.""" + + priority: Optional[float] = None + """Required for MX, SRV and URI records; unused by other record types. + + Records with lower priorities are preferred. + """ + + proto: Optional[str] = None + """A valid protocol, prefixed with an underscore. + + Deprecated in favor of the regular 'name' outside the data map. This data map + field normally represents the second label of that 'name'. + """ + + service: Optional[str] = None + """A service type, prefixed with an underscore. + + Deprecated in favor of the regular 'name' outside the data map. This data map + field normally represents the first label of that 'name'. + """ + + target: Optional[str] = None + """A valid hostname.""" + + weight: Optional[float] = None + """The record weight.""" + + +class SRVRecord(BaseModel): + data: Data + """Components of a SRV record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode. + + For SRV records, the first label is normally a service and the second a protocol + name, each starting with an underscore. + """ + + type: Literal["SRV"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Priority, weight, port, and SRV target. + + See 'data' for setting the individual component values. + """ + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/sshfp_record.py b/src/cloudflare/types/dns/sshfp_record.py new file mode 100644 index 00000000000..7be08b2031e --- /dev/null +++ b/src/cloudflare/types/dns/sshfp_record.py @@ -0,0 +1,80 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["SSHFPRecord", "Data"] + + +class Data(BaseModel): + algorithm: Optional[float] = None + """algorithm.""" + + fingerprint: Optional[str] = None + """fingerprint.""" + + type: Optional[float] = None + """type.""" + + +class SSHFPRecord(BaseModel): + data: Data + """Components of a SSHFP record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["SSHFP"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted SSHFP content. See 'data' to set SSHFP properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/svcb_record.py b/src/cloudflare/types/dns/svcb_record.py new file mode 100644 index 00000000000..5b5fcad2b98 --- /dev/null +++ b/src/cloudflare/types/dns/svcb_record.py @@ -0,0 +1,80 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["SVCBRecord", "Data"] + + +class Data(BaseModel): + priority: Optional[float] = None + """priority.""" + + target: Optional[str] = None + """target.""" + + value: Optional[str] = None + """value.""" + + +class SVCBRecord(BaseModel): + data: Data + """Components of a SVCB record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["SVCB"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted SVCB content. See 'data' to set SVCB properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/tlsa_record.py b/src/cloudflare/types/dns/tlsa_record.py new file mode 100644 index 00000000000..a398ee626ec --- /dev/null +++ b/src/cloudflare/types/dns/tlsa_record.py @@ -0,0 +1,83 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["TLSARecord", "Data"] + + +class Data(BaseModel): + certificate: Optional[str] = None + """certificate.""" + + matching_type: Optional[float] = None + """Matching Type.""" + + selector: Optional[float] = None + """Selector.""" + + usage: Optional[float] = None + """Usage.""" + + +class TLSARecord(BaseModel): + data: Data + """Components of a TLSA record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["TLSA"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted TLSA content. See 'data' to set TLSA properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/ttl.py b/src/cloudflare/types/dns/ttl.py new file mode 100644 index 00000000000..0fdce1c28c8 --- /dev/null +++ b/src/cloudflare/types/dns/ttl.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal + +__all__ = ["TTL"] + +TTL = Union[float, Literal[1]] diff --git a/src/cloudflare/types/dns/ttl_param.py b/src/cloudflare/types/dns/ttl_param.py new file mode 100644 index 00000000000..aab7e93732e --- /dev/null +++ b/src/cloudflare/types/dns/ttl_param.py @@ -0,0 +1,10 @@ +# 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 + +__all__ = ["TTLParam"] + +TTLParam = Union[float, Literal[1]] diff --git a/src/cloudflare/types/dns/txt_record.py b/src/cloudflare/types/dns/txt_record.py new file mode 100644 index 00000000000..f2e0404df9a --- /dev/null +++ b/src/cloudflare/types/dns/txt_record.py @@ -0,0 +1,66 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["TXTRecord"] + + +class TXTRecord(BaseModel): + content: str + """Text content for the record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + type: Literal["TXT"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dns/upstream_ips.py b/src/cloudflare/types/dns/upstream_ips.py new file mode 100644 index 00000000000..4c1aa1b226a --- /dev/null +++ b/src/cloudflare/types/dns/upstream_ips.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +__all__ = ["UpstreamIPs"] + +UpstreamIPs = Union[str, str] diff --git a/src/cloudflare/types/dns/upstream_ips_param.py b/src/cloudflare/types/dns/upstream_ips_param.py new file mode 100644 index 00000000000..88e14503b2a --- /dev/null +++ b/src/cloudflare/types/dns/upstream_ips_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +__all__ = ["UpstreamIPsParam"] + +UpstreamIPsParam = Union[str, str] diff --git a/src/cloudflare/types/dns/uri_record.py b/src/cloudflare/types/dns/uri_record.py new file mode 100644 index 00000000000..508c3941b5f --- /dev/null +++ b/src/cloudflare/types/dns/uri_record.py @@ -0,0 +1,83 @@ +# 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 .ttl import TTL +from ..._models import BaseModel +from .record_tags import RecordTags +from .record_metadata import RecordMetadata + +__all__ = ["URIRecord", "Data"] + + +class Data(BaseModel): + content: Optional[str] = None + """The record content.""" + + weight: Optional[float] = None + """The record weight.""" + + +class URIRecord(BaseModel): + data: Data + """Components of a URI record.""" + + name: str + """DNS record name (or @ for the zone apex) in Punycode.""" + + priority: float + """Required for MX, SRV and URI records; unused by other record types. + + Records with lower priorities are preferred. + """ + + type: Literal["URI"] + """Record type.""" + + id: Optional[str] = None + """Identifier""" + + comment: Optional[str] = None + """Comments or notes about the DNS record. + + This field has no effect on DNS responses. + """ + + content: Optional[str] = None + """Formatted URI content. See 'data' to set URI properties.""" + + created_on: Optional[datetime] = None + """When the record was created.""" + + locked: Optional[bool] = None + """ + Whether this record can be modified/deleted (true means it's managed by + Cloudflare). + """ + + meta: Optional[RecordMetadata] = None + """Extra Cloudflare-specific information about the record.""" + + modified_on: Optional[datetime] = None + """When the record was last modified.""" + + proxiable: Optional[bool] = None + """Whether the record can be proxied by Cloudflare or not.""" + + tags: Optional[List[RecordTags]] = None + """Custom tags for the DNS record. This field has no effect on DNS responses.""" + + ttl: Optional[TTL] = None + """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. + """ + + zone_id: Optional[str] = None + """Identifier""" + + zone_name: Optional[str] = None + """The domain of the record.""" diff --git a/src/cloudflare/types/dnssec/__init__.py b/src/cloudflare/types/dnssec/__init__.py new file mode 100644 index 00000000000..ee2cb757f84 --- /dev/null +++ b/src/cloudflare/types/dnssec/__init__.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .dnssec import DNSSEC as DNSSEC +from .dnssec_edit_params import DNSSECEditParams as DNSSECEditParams +from .dnssec_delete_params import DNSSECDeleteParams as DNSSECDeleteParams +from .dnssec_delete_response import DNSSECDeleteResponse as DNSSECDeleteResponse diff --git a/src/cloudflare/types/dnssec.py b/src/cloudflare/types/dnssec/dnssec.py similarity index 98% rename from src/cloudflare/types/dnssec.py rename to src/cloudflare/types/dnssec/dnssec.py index ae9788e6527..0b18c1f6d2d 100644 --- a/src/cloudflare/types/dnssec.py +++ b/src/cloudflare/types/dnssec/dnssec.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["DNSSEC"] diff --git a/src/cloudflare/types/dnssec/dnssec_delete_params.py b/src/cloudflare/types/dnssec/dnssec_delete_params.py new file mode 100644 index 00000000000..a162028cb6a --- /dev/null +++ b/src/cloudflare/types/dnssec/dnssec_delete_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__ = ["DNSSECDeleteParams"] + + +class DNSSECDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/dnssec_delete_response.py b/src/cloudflare/types/dnssec/dnssec_delete_response.py similarity index 100% rename from src/cloudflare/types/dnssec_delete_response.py rename to src/cloudflare/types/dnssec/dnssec_delete_response.py diff --git a/src/cloudflare/types/dnssec_edit_params.py b/src/cloudflare/types/dnssec/dnssec_edit_params.py similarity index 100% rename from src/cloudflare/types/dnssec_edit_params.py rename to src/cloudflare/types/dnssec/dnssec_edit_params.py diff --git a/src/cloudflare/types/durable_objects/__init__.py b/src/cloudflare/types/durable_objects/__init__.py index 6688d0304a5..c2e170ca3ca 100644 --- a/src/cloudflare/types/durable_objects/__init__.py +++ b/src/cloudflare/types/durable_objects/__init__.py @@ -2,4 +2,4 @@ from __future__ import annotations -from .durable_object_namespace import DurableObjectNamespace as DurableObjectNamespace +from .namespace import Namespace as Namespace diff --git a/src/cloudflare/types/durable_objects/durable_object_namespace.py b/src/cloudflare/types/durable_objects/durable_object_namespace.py deleted file mode 100644 index 689a67b66f6..00000000000 --- a/src/cloudflare/types/durable_objects/durable_object_namespace.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 pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["DurableObjectNamespace"] - - -class DurableObjectNamespace(BaseModel): - id: Optional[object] = None - - class_: Optional[object] = FieldInfo(alias="class", default=None) - - name: Optional[object] = None - - script: Optional[object] = None diff --git a/src/cloudflare/types/durable_objects/namespace.py b/src/cloudflare/types/durable_objects/namespace.py new file mode 100644 index 00000000000..930c338d76a --- /dev/null +++ b/src/cloudflare/types/durable_objects/namespace.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["Namespace"] + + +class Namespace(BaseModel): + id: Optional[object] = None + + class_: Optional[object] = FieldInfo(alias="class", default=None) + + name: Optional[object] = None + + script: Optional[object] = None diff --git a/src/cloudflare/types/email_routing/__init__.py b/src/cloudflare/types/email_routing/__init__.py index fc53ea2ebb0..8d2246d0cf8 100644 --- a/src/cloudflare/types/email_routing/__init__.py +++ b/src/cloudflare/types/email_routing/__init__.py @@ -2,19 +2,19 @@ from __future__ import annotations +from .action import Action as Action +from .address import Address as Address +from .matcher import Matcher as Matcher +from .settings import Settings as Settings +from .dns_record import DNSRecord as DNSRecord +from .action_param import ActionParam as ActionParam +from .matcher_param import MatcherParam as MatcherParam from .dns_get_response import DNSGetResponse as DNSGetResponse -from .email_dns_record import EmailDNSRecord as EmailDNSRecord from .rule_list_params import RuleListParams as RuleListParams -from .rule_get_response import RuleGetResponse as RuleGetResponse +from .email_routing_rule import EmailRoutingRule as EmailRoutingRule 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 .address_list_params import AddressListParams as AddressListParams -from .address_get_response import AddressGetResponse as AddressGetResponse -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 .address_create_params import AddressCreateParams as AddressCreateParams -from .address_list_response import AddressListResponse as AddressListResponse -from .address_create_response import AddressCreateResponse as AddressCreateResponse -from .address_delete_response import AddressDeleteResponse as AddressDeleteResponse +from .email_routing_enable_params import EmailRoutingEnableParams as EmailRoutingEnableParams +from .email_routing_disable_params import EmailRoutingDisableParams as EmailRoutingDisableParams diff --git a/src/cloudflare/types/email_routing/action.py b/src/cloudflare/types/email_routing/action.py new file mode 100644 index 00000000000..b27c3f1a41b --- /dev/null +++ b/src/cloudflare/types/email_routing/action.py @@ -0,0 +1,15 @@ +# 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 + +__all__ = ["Action"] + + +class Action(BaseModel): + type: Literal["drop", "forward", "worker"] + """Type of supported action.""" + + value: List[str] diff --git a/src/cloudflare/types/email_routing/action_param.py b/src/cloudflare/types/email_routing/action_param.py new file mode 100644 index 00000000000..20411ce329e --- /dev/null +++ b/src/cloudflare/types/email_routing/action_param.py @@ -0,0 +1,15 @@ +# 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__ = ["ActionParam"] + + +class ActionParam(TypedDict, total=False): + type: Required[Literal["drop", "forward", "worker"]] + """Type of supported action.""" + + value: Required[List[str]] diff --git a/src/cloudflare/types/email_routing/address.py b/src/cloudflare/types/email_routing/address.py new file mode 100644 index 00000000000..7e7a82d980a --- /dev/null +++ b/src/cloudflare/types/email_routing/address.py @@ -0,0 +1,34 @@ +# 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__ = ["Address"] + + +class Address(BaseModel): + id: Optional[str] = None + """Destination address identifier.""" + + created: Optional[datetime] = None + """The date and time the destination address has been created.""" + + email: Optional[str] = None + """The contact email address of the user.""" + + modified: Optional[datetime] = None + """The date and time the destination address was last modified.""" + + tag: Optional[str] = None + """Destination address tag. + + (Deprecated, replaced by destination address identifier) + """ + + verified: Optional[datetime] = None + """The date and time the destination address has been verified. + + Null means not verified yet. + """ diff --git a/src/cloudflare/types/email_routing/address_create_response.py b/src/cloudflare/types/email_routing/address_create_response.py deleted file mode 100644 index 075fe7f744d..00000000000 --- a/src/cloudflare/types/email_routing/address_create_response.py +++ /dev/null @@ -1,34 +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__ = ["AddressCreateResponse"] - - -class AddressCreateResponse(BaseModel): - id: Optional[str] = None - """Destination address identifier.""" - - created: Optional[datetime] = None - """The date and time the destination address has been created.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - modified: Optional[datetime] = None - """The date and time the destination address was last modified.""" - - tag: Optional[str] = None - """Destination address tag. - - (Deprecated, replaced by destination address identifier) - """ - - verified: Optional[datetime] = None - """The date and time the destination address has been verified. - - Null means not verified yet. - """ diff --git a/src/cloudflare/types/email_routing/address_delete_response.py b/src/cloudflare/types/email_routing/address_delete_response.py deleted file mode 100644 index a1d5c68e46f..00000000000 --- a/src/cloudflare/types/email_routing/address_delete_response.py +++ /dev/null @@ -1,34 +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__ = ["AddressDeleteResponse"] - - -class AddressDeleteResponse(BaseModel): - id: Optional[str] = None - """Destination address identifier.""" - - created: Optional[datetime] = None - """The date and time the destination address has been created.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - modified: Optional[datetime] = None - """The date and time the destination address was last modified.""" - - tag: Optional[str] = None - """Destination address tag. - - (Deprecated, replaced by destination address identifier) - """ - - verified: Optional[datetime] = None - """The date and time the destination address has been verified. - - Null means not verified yet. - """ diff --git a/src/cloudflare/types/email_routing/address_get_response.py b/src/cloudflare/types/email_routing/address_get_response.py deleted file mode 100644 index 1accf84a580..00000000000 --- a/src/cloudflare/types/email_routing/address_get_response.py +++ /dev/null @@ -1,34 +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__ = ["AddressGetResponse"] - - -class AddressGetResponse(BaseModel): - id: Optional[str] = None - """Destination address identifier.""" - - created: Optional[datetime] = None - """The date and time the destination address has been created.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - modified: Optional[datetime] = None - """The date and time the destination address was last modified.""" - - tag: Optional[str] = None - """Destination address tag. - - (Deprecated, replaced by destination address identifier) - """ - - verified: Optional[datetime] = None - """The date and time the destination address has been verified. - - Null means not verified yet. - """ diff --git a/src/cloudflare/types/email_routing/address_list_response.py b/src/cloudflare/types/email_routing/address_list_response.py deleted file mode 100644 index fe8f867b4c2..00000000000 --- a/src/cloudflare/types/email_routing/address_list_response.py +++ /dev/null @@ -1,34 +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__ = ["AddressListResponse"] - - -class AddressListResponse(BaseModel): - id: Optional[str] = None - """Destination address identifier.""" - - created: Optional[datetime] = None - """The date and time the destination address has been created.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - modified: Optional[datetime] = None - """The date and time the destination address was last modified.""" - - tag: Optional[str] = None - """Destination address tag. - - (Deprecated, replaced by destination address identifier) - """ - - verified: Optional[datetime] = None - """The date and time the destination address has been verified. - - Null means not verified yet. - """ diff --git a/src/cloudflare/types/email_routing/dns_get_response.py b/src/cloudflare/types/email_routing/dns_get_response.py index 8ddb372052b..9f15c755fa3 100644 --- a/src/cloudflare/types/email_routing/dns_get_response.py +++ b/src/cloudflare/types/email_routing/dns_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .email_dns_record import EmailDNSRecord +from .dns_record import DNSRecord __all__ = ["DNSGetResponse"] -DNSGetResponse = List[EmailDNSRecord] +DNSGetResponse = List[DNSRecord] diff --git a/src/cloudflare/types/email_routing/dns_record.py b/src/cloudflare/types/email_routing/dns_record.py new file mode 100644 index 00000000000..92b600ce404 --- /dev/null +++ b/src/cloudflare/types/email_routing/dns_record.py @@ -0,0 +1,52 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["DNSRecord"] + + +class DNSRecord(BaseModel): + content: Optional[str] = None + """DNS record content.""" + + name: Optional[str] = None + """DNS record name (or @ for the zone apex).""" + + priority: Optional[float] = None + """Required for MX, SRV and URI records. + + Unused by other record types. Records with lower priorities are preferred. + """ + + ttl: Union[float, Literal[1], None] = None + """Time to live, in seconds, of the DNS record. + + Must be between 60 and 86400, or 1 for 'automatic'. + """ + + type: Optional[ + Literal[ + "A", + "AAAA", + "CNAME", + "HTTPS", + "TXT", + "SRV", + "LOC", + "MX", + "NS", + "CERT", + "DNSKEY", + "DS", + "NAPTR", + "SMIMEA", + "SSHFP", + "SVCB", + "TLSA", + "URI", + ] + ] = None + """DNS record type.""" diff --git a/src/cloudflare/types/email_routing/email_dns_record.py b/src/cloudflare/types/email_routing/email_dns_record.py deleted file mode 100644 index c997907012b..00000000000 --- a/src/cloudflare/types/email_routing/email_dns_record.py +++ /dev/null @@ -1,52 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["EmailDNSRecord"] - - -class EmailDNSRecord(BaseModel): - content: Optional[str] = None - """DNS record content.""" - - name: Optional[str] = None - """DNS record name (or @ for the zone apex).""" - - priority: Optional[float] = None - """Required for MX, SRV and URI records. - - Unused by other record types. Records with lower priorities are preferred. - """ - - ttl: Union[float, Literal[1], None] = None - """Time to live, in seconds, of the DNS record. - - Must be between 60 and 86400, or 1 for 'automatic'. - """ - - type: Optional[ - Literal[ - "A", - "AAAA", - "CNAME", - "HTTPS", - "TXT", - "SRV", - "LOC", - "MX", - "NS", - "CERT", - "DNSKEY", - "DS", - "NAPTR", - "SMIMEA", - "SSHFP", - "SVCB", - "TLSA", - "URI", - ] - ] = None - """DNS record type.""" diff --git a/src/cloudflare/types/email_routing/email_routing_disable_params.py b/src/cloudflare/types/email_routing/email_routing_disable_params.py new file mode 100644 index 00000000000..e6fb98c600d --- /dev/null +++ b/src/cloudflare/types/email_routing/email_routing_disable_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["EmailRoutingDisableParams"] + + +class EmailRoutingDisableParams(TypedDict, total=False): + body: Required[object] diff --git a/src/cloudflare/types/email_routing/email_routing_enable_params.py b/src/cloudflare/types/email_routing/email_routing_enable_params.py new file mode 100644 index 00000000000..5dfc90d2384 --- /dev/null +++ b/src/cloudflare/types/email_routing/email_routing_enable_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["EmailRoutingEnableParams"] + + +class EmailRoutingEnableParams(TypedDict, total=False): + body: Required[object] diff --git a/src/cloudflare/types/email_routing/email_routing_rule.py b/src/cloudflare/types/email_routing/email_routing_rule.py new file mode 100644 index 00000000000..1e90e61213f --- /dev/null +++ b/src/cloudflare/types/email_routing/email_routing_rule.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .action import Action +from .matcher import Matcher +from ..._models import BaseModel + +__all__ = ["EmailRoutingRule"] + + +class EmailRoutingRule(BaseModel): + id: Optional[str] = None + """Routing rule identifier.""" + + actions: Optional[List[Action]] = None + """List actions patterns.""" + + enabled: Optional[Literal[True, False]] = None + """Routing rule status.""" + + matchers: Optional[List[Matcher]] = None + """Matching patterns to forward to your actions.""" + + name: Optional[str] = None + """Routing rule name.""" + + priority: Optional[float] = None + """Priority of the routing rule.""" + + tag: Optional[str] = None + """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/matcher.py b/src/cloudflare/types/email_routing/matcher.py new file mode 100644 index 00000000000..d63819b6a3c --- /dev/null +++ b/src/cloudflare/types/email_routing/matcher.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Matcher"] + + +class Matcher(BaseModel): + field: Literal["to"] + """Field for type matcher.""" + + type: Literal["literal"] + """Type of matcher.""" + + value: str + """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/matcher_param.py b/src/cloudflare/types/email_routing/matcher_param.py new file mode 100644 index 00000000000..cae8d7e45dd --- /dev/null +++ b/src/cloudflare/types/email_routing/matcher_param.py @@ -0,0 +1,18 @@ +# 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__ = ["MatcherParam"] + + +class MatcherParam(TypedDict, total=False): + field: Required[Literal["to"]] + """Field for type matcher.""" + + type: Required[Literal["literal"]] + """Type of matcher.""" + + value: Required[str] + """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/rule_create_params.py b/src/cloudflare/types/email_routing/rule_create_params.py index 923ca342fe2..2dca15de5ec 100644 --- a/src/cloudflare/types/email_routing/rule_create_params.py +++ b/src/cloudflare/types/email_routing/rule_create_params.py @@ -2,17 +2,20 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["RuleCreateParams", "Action", "Matcher"] +from .action_param import ActionParam +from .matcher_param import MatcherParam + +__all__ = ["RuleCreateParams"] class RuleCreateParams(TypedDict, total=False): - actions: Required[Iterable[Action]] + actions: Required[Iterable[ActionParam]] """List actions patterns.""" - matchers: Required[Iterable[Matcher]] + matchers: Required[Iterable[MatcherParam]] """Matching patterns to forward to your actions.""" enabled: Literal[True, False] @@ -23,21 +26,3 @@ class RuleCreateParams(TypedDict, total=False): priority: float """Priority of the routing rule.""" - - -class Action(TypedDict, total=False): - type: Required[Literal["drop", "forward", "worker"]] - """Type of supported action.""" - - value: Required[List[str]] - - -class Matcher(TypedDict, total=False): - field: Required[Literal["to"]] - """Field for type matcher.""" - - type: Required[Literal["literal"]] - """Type of matcher.""" - - value: Required[str] - """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/rule_create_response.py b/src/cloudflare/types/email_routing/rule_create_response.py deleted file mode 100644 index 2fe7e7eb776..00000000000 --- a/src/cloudflare/types/email_routing/rule_create_response.py +++ /dev/null @@ -1,49 +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__ = ["RuleCreateResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleCreateResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rule_delete_response.py b/src/cloudflare/types/email_routing/rule_delete_response.py deleted file mode 100644 index e0e35a7443c..00000000000 --- a/src/cloudflare/types/email_routing/rule_delete_response.py +++ /dev/null @@ -1,49 +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__ = ["RuleDeleteResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleDeleteResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rule_get_response.py b/src/cloudflare/types/email_routing/rule_get_response.py deleted file mode 100644 index fc0333c3094..00000000000 --- a/src/cloudflare/types/email_routing/rule_get_response.py +++ /dev/null @@ -1,49 +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__ = ["RuleGetResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleGetResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rule_list_response.py b/src/cloudflare/types/email_routing/rule_list_response.py deleted file mode 100644 index fabb9650223..00000000000 --- a/src/cloudflare/types/email_routing/rule_list_response.py +++ /dev/null @@ -1,49 +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__ = ["RuleListResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleListResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rule_update_params.py b/src/cloudflare/types/email_routing/rule_update_params.py index 97d9e200490..3ed26c999ab 100644 --- a/src/cloudflare/types/email_routing/rule_update_params.py +++ b/src/cloudflare/types/email_routing/rule_update_params.py @@ -2,20 +2,23 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["RuleUpdateParams", "Action", "Matcher"] +from .action_param import ActionParam +from .matcher_param import MatcherParam + +__all__ = ["RuleUpdateParams"] class RuleUpdateParams(TypedDict, total=False): zone_identifier: Required[str] """Identifier""" - actions: Required[Iterable[Action]] + actions: Required[Iterable[ActionParam]] """List actions patterns.""" - matchers: Required[Iterable[Matcher]] + matchers: Required[Iterable[MatcherParam]] """Matching patterns to forward to your actions.""" enabled: Literal[True, False] @@ -26,21 +29,3 @@ class RuleUpdateParams(TypedDict, total=False): priority: float """Priority of the routing rule.""" - - -class Action(TypedDict, total=False): - type: Required[Literal["drop", "forward", "worker"]] - """Type of supported action.""" - - value: Required[List[str]] - - -class Matcher(TypedDict, total=False): - field: Required[Literal["to"]] - """Field for type matcher.""" - - type: Required[Literal["literal"]] - """Type of matcher.""" - - value: Required[str] - """Value for matcher.""" diff --git a/src/cloudflare/types/email_routing/rule_update_response.py b/src/cloudflare/types/email_routing/rule_update_response.py deleted file mode 100644 index e7124176eaf..00000000000 --- a/src/cloudflare/types/email_routing/rule_update_response.py +++ /dev/null @@ -1,49 +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__ = ["RuleUpdateResponse", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of supported action.""" - - value: List[str] - - -class Matcher(BaseModel): - field: Literal["to"] - """Field for type matcher.""" - - type: Literal["literal"] - """Type of matcher.""" - - value: str - """Value for matcher.""" - - -class RuleUpdateResponse(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions patterns.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """Matching patterns to forward to your actions.""" - - name: Optional[str] = None - """Routing rule name.""" - - priority: Optional[float] = None - """Priority of the routing rule.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rules/__init__.py b/src/cloudflare/types/email_routing/rules/__init__.py index 660e7d26c5f..82fb04b4ffb 100644 --- a/src/cloudflare/types/email_routing/rules/__init__.py +++ b/src/cloudflare/types/email_routing/rules/__init__.py @@ -2,5 +2,10 @@ from __future__ import annotations -from .email_catch_all_rule import EmailCatchAllRule as EmailCatchAllRule +from .catch_all_action import CatchAllAction as CatchAllAction +from .catch_all_matcher import CatchAllMatcher as CatchAllMatcher +from .catch_all_action_param import CatchAllActionParam as CatchAllActionParam +from .catch_all_get_response import CatchAllGetResponse as CatchAllGetResponse +from .catch_all_matcher_param import CatchAllMatcherParam as CatchAllMatcherParam from .catch_all_update_params import CatchAllUpdateParams as CatchAllUpdateParams +from .catch_all_update_response import CatchAllUpdateResponse as CatchAllUpdateResponse diff --git a/src/cloudflare/types/email_routing/rules/catch_all_action.py b/src/cloudflare/types/email_routing/rules/catch_all_action.py new file mode 100644 index 00000000000..bfd4485f68d --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/catch_all_action.py @@ -0,0 +1,15 @@ +# 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__ = ["CatchAllAction"] + + +class CatchAllAction(BaseModel): + type: Literal["drop", "forward", "worker"] + """Type of action for catch-all rule.""" + + value: Optional[List[str]] = None diff --git a/src/cloudflare/types/email_routing/rules/catch_all_action_param.py b/src/cloudflare/types/email_routing/rules/catch_all_action_param.py new file mode 100644 index 00000000000..832c3457bcb --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/catch_all_action_param.py @@ -0,0 +1,15 @@ +# 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__ = ["CatchAllActionParam"] + + +class CatchAllActionParam(TypedDict, total=False): + type: Required[Literal["drop", "forward", "worker"]] + """Type of action for catch-all rule.""" + + value: List[str] diff --git a/src/cloudflare/types/email_routing/rules/catch_all_get_response.py b/src/cloudflare/types/email_routing/rules/catch_all_get_response.py new file mode 100644 index 00000000000..4f25a25dbac --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/catch_all_get_response.py @@ -0,0 +1,30 @@ +# 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 +from .catch_all_action import CatchAllAction +from .catch_all_matcher import CatchAllMatcher + +__all__ = ["CatchAllGetResponse"] + + +class CatchAllGetResponse(BaseModel): + id: Optional[str] = None + """Routing rule identifier.""" + + actions: Optional[List[CatchAllAction]] = None + """List actions for the catch-all routing rule.""" + + enabled: Optional[Literal[True, False]] = None + """Routing rule status.""" + + matchers: Optional[List[CatchAllMatcher]] = None + """List of matchers for the catch-all routing rule.""" + + name: Optional[str] = None + """Routing rule name.""" + + tag: Optional[str] = None + """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rules/catch_all_matcher.py b/src/cloudflare/types/email_routing/rules/catch_all_matcher.py new file mode 100644 index 00000000000..982ed202d06 --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/catch_all_matcher.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["CatchAllMatcher"] + + +class CatchAllMatcher(BaseModel): + type: Literal["all"] + """Type of matcher. Default is 'all'.""" diff --git a/src/cloudflare/types/email_routing/rules/catch_all_matcher_param.py b/src/cloudflare/types/email_routing/rules/catch_all_matcher_param.py new file mode 100644 index 00000000000..d22950c2d68 --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/catch_all_matcher_param.py @@ -0,0 +1,12 @@ +# 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__ = ["CatchAllMatcherParam"] + + +class CatchAllMatcherParam(TypedDict, total=False): + type: Required[Literal["all"]] + """Type of matcher. Default is 'all'.""" diff --git a/src/cloudflare/types/email_routing/rules/catch_all_update_params.py b/src/cloudflare/types/email_routing/rules/catch_all_update_params.py index 1dd7d8c9616..a4841b1995d 100644 --- a/src/cloudflare/types/email_routing/rules/catch_all_update_params.py +++ b/src/cloudflare/types/email_routing/rules/catch_all_update_params.py @@ -2,17 +2,20 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["CatchAllUpdateParams", "Action", "Matcher"] +from .catch_all_action_param import CatchAllActionParam +from .catch_all_matcher_param import CatchAllMatcherParam + +__all__ = ["CatchAllUpdateParams"] class CatchAllUpdateParams(TypedDict, total=False): - actions: Required[Iterable[Action]] + actions: Required[Iterable[CatchAllActionParam]] """List actions for the catch-all routing rule.""" - matchers: Required[Iterable[Matcher]] + matchers: Required[Iterable[CatchAllMatcherParam]] """List of matchers for the catch-all routing rule.""" enabled: Literal[True, False] @@ -20,15 +23,3 @@ class CatchAllUpdateParams(TypedDict, total=False): name: str """Routing rule name.""" - - -class Action(TypedDict, total=False): - type: Required[Literal["drop", "forward", "worker"]] - """Type of action for catch-all rule.""" - - value: List[str] - - -class Matcher(TypedDict, total=False): - type: Required[Literal["all"]] - """Type of matcher. Default is 'all'.""" diff --git a/src/cloudflare/types/email_routing/rules/catch_all_update_response.py b/src/cloudflare/types/email_routing/rules/catch_all_update_response.py new file mode 100644 index 00000000000..8380ed3b15f --- /dev/null +++ b/src/cloudflare/types/email_routing/rules/catch_all_update_response.py @@ -0,0 +1,30 @@ +# 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 +from .catch_all_action import CatchAllAction +from .catch_all_matcher import CatchAllMatcher + +__all__ = ["CatchAllUpdateResponse"] + + +class CatchAllUpdateResponse(BaseModel): + id: Optional[str] = None + """Routing rule identifier.""" + + actions: Optional[List[CatchAllAction]] = None + """List actions for the catch-all routing rule.""" + + enabled: Optional[Literal[True, False]] = None + """Routing rule status.""" + + matchers: Optional[List[CatchAllMatcher]] = None + """List of matchers for the catch-all routing rule.""" + + name: Optional[str] = None + """Routing rule name.""" + + tag: Optional[str] = None + """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/rules/email_catch_all_rule.py b/src/cloudflare/types/email_routing/rules/email_catch_all_rule.py deleted file mode 100644 index ac226e6b084..00000000000 --- a/src/cloudflare/types/email_routing/rules/email_catch_all_rule.py +++ /dev/null @@ -1,40 +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__ = ["EmailCatchAllRule", "Action", "Matcher"] - - -class Action(BaseModel): - type: Literal["drop", "forward", "worker"] - """Type of action for catch-all rule.""" - - value: Optional[List[str]] = None - - -class Matcher(BaseModel): - type: Literal["all"] - """Type of matcher. Default is 'all'.""" - - -class EmailCatchAllRule(BaseModel): - id: Optional[str] = None - """Routing rule identifier.""" - - actions: Optional[List[Action]] = None - """List actions for the catch-all routing rule.""" - - enabled: Optional[Literal[True, False]] = None - """Routing rule status.""" - - matchers: Optional[List[Matcher]] = None - """List of matchers for the catch-all routing rule.""" - - name: Optional[str] = None - """Routing rule name.""" - - tag: Optional[str] = None - """Routing rule tag. (Deprecated, replaced by routing rule identifier)""" diff --git a/src/cloudflare/types/email_routing/settings.py b/src/cloudflare/types/email_routing/settings.py new file mode 100644 index 00000000000..7db6e4a5f0b --- /dev/null +++ b/src/cloudflare/types/email_routing/settings.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Settings"] + + +class Settings(BaseModel): + id: Optional[str] = None + """Email Routing settings identifier.""" + + created: Optional[datetime] = None + """The date and time the settings have been created.""" + + enabled: Optional[Literal[True, False]] = None + """State of the zone settings for Email Routing.""" + + modified: Optional[datetime] = None + """The date and time the settings have been modified.""" + + name: Optional[str] = None + """Domain of your zone.""" + + skip_wizard: Optional[Literal[True, False]] = None + """Flag to check if the user skipped the configuration wizard.""" + + status: Optional[Literal["ready", "unconfigured", "misconfigured", "misconfigured/locked", "unlocked"]] = None + """Show the state of your account, and the type or configuration error.""" + + tag: Optional[str] = None + """Email Routing settings tag. + + (Deprecated, replaced by Email Routing settings identifier) + """ diff --git a/src/cloudflare/types/email_routing_disable_response.py b/src/cloudflare/types/email_routing_disable_response.py deleted file mode 100644 index e1a79c469ae..00000000000 --- a/src/cloudflare/types/email_routing_disable_response.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["EmailRoutingDisableResponse"] - - -class EmailRoutingDisableResponse(BaseModel): - id: Optional[str] = None - """Email Routing settings identifier.""" - - created: Optional[datetime] = None - """The date and time the settings have been created.""" - - enabled: Optional[Literal[True, False]] = None - """State of the zone settings for Email Routing.""" - - modified: Optional[datetime] = None - """The date and time the settings have been modified.""" - - name: Optional[str] = None - """Domain of your zone.""" - - skip_wizard: Optional[Literal[True, False]] = None - """Flag to check if the user skipped the configuration wizard.""" - - status: Optional[Literal["ready", "unconfigured", "misconfigured", "misconfigured/locked", "unlocked"]] = None - """Show the state of your account, and the type or configuration error.""" - - tag: Optional[str] = None - """Email Routing settings tag. - - (Deprecated, replaced by Email Routing settings identifier) - """ diff --git a/src/cloudflare/types/email_routing_enable_response.py b/src/cloudflare/types/email_routing_enable_response.py deleted file mode 100644 index 26769d760c9..00000000000 --- a/src/cloudflare/types/email_routing_enable_response.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["EmailRoutingEnableResponse"] - - -class EmailRoutingEnableResponse(BaseModel): - id: Optional[str] = None - """Email Routing settings identifier.""" - - created: Optional[datetime] = None - """The date and time the settings have been created.""" - - enabled: Optional[Literal[True, False]] = None - """State of the zone settings for Email Routing.""" - - modified: Optional[datetime] = None - """The date and time the settings have been modified.""" - - name: Optional[str] = None - """Domain of your zone.""" - - skip_wizard: Optional[Literal[True, False]] = None - """Flag to check if the user skipped the configuration wizard.""" - - status: Optional[Literal["ready", "unconfigured", "misconfigured", "misconfigured/locked", "unlocked"]] = None - """Show the state of your account, and the type or configuration error.""" - - tag: Optional[str] = None - """Email Routing settings tag. - - (Deprecated, replaced by Email Routing settings identifier) - """ diff --git a/src/cloudflare/types/email_routing_get_response.py b/src/cloudflare/types/email_routing_get_response.py deleted file mode 100644 index 8475a143605..00000000000 --- a/src/cloudflare/types/email_routing_get_response.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["EmailRoutingGetResponse"] - - -class EmailRoutingGetResponse(BaseModel): - id: Optional[str] = None - """Email Routing settings identifier.""" - - created: Optional[datetime] = None - """The date and time the settings have been created.""" - - enabled: Optional[Literal[True, False]] = None - """State of the zone settings for Email Routing.""" - - modified: Optional[datetime] = None - """The date and time the settings have been modified.""" - - name: Optional[str] = None - """Domain of your zone.""" - - skip_wizard: Optional[Literal[True, False]] = None - """Flag to check if the user skipped the configuration wizard.""" - - status: Optional[Literal["ready", "unconfigured", "misconfigured", "misconfigured/locked", "unlocked"]] = None - """Show the state of your account, and the type or configuration error.""" - - tag: Optional[str] = None - """Email Routing settings tag. - - (Deprecated, replaced by Email Routing settings identifier) - """ diff --git a/src/cloudflare/types/workers/services/__init__.py b/src/cloudflare/types/event_notifications/__init__.py similarity index 100% rename from src/cloudflare/types/workers/services/__init__.py rename to src/cloudflare/types/event_notifications/__init__.py diff --git a/src/cloudflare/types/event_notifications/r2/__init__.py b/src/cloudflare/types/event_notifications/r2/__init__.py new file mode 100644 index 00000000000..b1fcfe993b2 --- /dev/null +++ b/src/cloudflare/types/event_notifications/r2/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .configuration_get_response import ConfigurationGetResponse as ConfigurationGetResponse diff --git a/src/cloudflare/types/event_notifications/r2/configuration/__init__.py b/src/cloudflare/types/event_notifications/r2/configuration/__init__.py new file mode 100644 index 00000000000..9b08b16f6f8 --- /dev/null +++ b/src/cloudflare/types/event_notifications/r2/configuration/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .queue_update_params import QueueUpdateParams as QueueUpdateParams +from .queue_delete_response import QueueDeleteResponse as QueueDeleteResponse +from .queue_update_response import QueueUpdateResponse as QueueUpdateResponse diff --git a/src/cloudflare/types/event_notifications/r2/configuration/queue_delete_response.py b/src/cloudflare/types/event_notifications/r2/configuration/queue_delete_response.py new file mode 100644 index 00000000000..578c4867074 --- /dev/null +++ b/src/cloudflare/types/event_notifications/r2/configuration/queue_delete_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union + +__all__ = ["QueueDeleteResponse"] + +QueueDeleteResponse = Union[List[object], str, object] diff --git a/src/cloudflare/types/event_notifications/r2/configuration/queue_update_params.py b/src/cloudflare/types/event_notifications/r2/configuration/queue_update_params.py new file mode 100644 index 00000000000..08718f376d4 --- /dev/null +++ b/src/cloudflare/types/event_notifications/r2/configuration/queue_update_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["QueueUpdateParams", "Rule"] + + +class QueueUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + bucket_name: Required[str] + """Identifier""" + + rules: Iterable[Rule] + """Array of rules to drive notifications""" + + +class Rule(TypedDict, total=False): + actions: Required[ + List[Literal["PutObject", "CopyObject", "DeleteObject", "CompleteMultipartUpload", "AbortMultipartUpload"]] + ] + """Array of R2 object actions that will trigger notifications""" + + prefix: str + """Notifications will be sent only for objects with this prefix""" + + suffix: str + """Notifications will be sent only for objects with this suffix""" diff --git a/src/cloudflare/types/event_notifications/r2/configuration/queue_update_response.py b/src/cloudflare/types/event_notifications/r2/configuration/queue_update_response.py new file mode 100644 index 00000000000..2d2f608f91f --- /dev/null +++ b/src/cloudflare/types/event_notifications/r2/configuration/queue_update_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__ = ["QueueUpdateResponse"] + + +class QueueUpdateResponse(BaseModel): + event_notification_detail_id: Optional[str] = None diff --git a/src/cloudflare/types/event_notifications/r2/configuration_get_response.py b/src/cloudflare/types/event_notifications/r2/configuration_get_response.py new file mode 100644 index 00000000000..ae1ed76ea41 --- /dev/null +++ b/src/cloudflare/types/event_notifications/r2/configuration_get_response.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = [ + "ConfigurationGetResponse", + "ConfigurationGetResponseItemConfigurationGetResponseItemItem", + "ConfigurationGetResponseItemConfigurationGetResponseItemItemRule", +] + + +class ConfigurationGetResponseItemConfigurationGetResponseItemItemRule(BaseModel): + actions: List[Literal["PutObject", "CopyObject", "DeleteObject", "CompleteMultipartUpload", "AbortMultipartUpload"]] + """Array of R2 object actions that will trigger notifications""" + + prefix: Optional[str] = None + """Notifications will be sent only for objects with this prefix""" + + suffix: Optional[str] = None + """Notifications will be sent only for objects with this suffix""" + + +class ConfigurationGetResponseItemConfigurationGetResponseItemItem(BaseModel): + queue: str + """Queue ID that will receive notifications based on the configured rules""" + + rules: List[ConfigurationGetResponseItemConfigurationGetResponseItemItemRule] + """Array of rules to drive notifications""" + + +ConfigurationGetResponse = Dict[str, Dict[str, ConfigurationGetResponseItemConfigurationGetResponseItemItem]] diff --git a/src/cloudflare/types/filters/__init__.py b/src/cloudflare/types/filters/__init__.py new file mode 100644 index 00000000000..0be276f7d5c --- /dev/null +++ b/src/cloudflare/types/filters/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .firewall_filter import FirewallFilter as FirewallFilter +from .filter_list_params import FilterListParams as FilterListParams +from .filter_create_params import FilterCreateParams as FilterCreateParams +from .filter_delete_params import FilterDeleteParams as FilterDeleteParams +from .filter_update_params import FilterUpdateParams as FilterUpdateParams +from .filter_create_response import FilterCreateResponse as FilterCreateResponse diff --git a/src/cloudflare/types/filter_create_params.py b/src/cloudflare/types/filters/filter_create_params.py similarity index 100% rename from src/cloudflare/types/filter_create_params.py rename to src/cloudflare/types/filters/filter_create_params.py diff --git a/src/cloudflare/types/filter_create_response.py b/src/cloudflare/types/filters/filter_create_response.py similarity index 100% rename from src/cloudflare/types/filter_create_response.py rename to src/cloudflare/types/filters/filter_create_response.py diff --git a/src/cloudflare/types/filters/filter_delete_params.py b/src/cloudflare/types/filters/filter_delete_params.py new file mode 100644 index 00000000000..92e7b099d7d --- /dev/null +++ b/src/cloudflare/types/filters/filter_delete_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__ = ["FilterDeleteParams"] + + +class FilterDeleteParams(TypedDict, total=False): + zone_identifier: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/filter_list_params.py b/src/cloudflare/types/filters/filter_list_params.py similarity index 92% rename from src/cloudflare/types/filter_list_params.py rename to src/cloudflare/types/filters/filter_list_params.py index d3cc75d3780..0b4f189cd22 100644 --- a/src/cloudflare/types/filter_list_params.py +++ b/src/cloudflare/types/filters/filter_list_params.py @@ -8,6 +8,9 @@ class FilterListParams(TypedDict, total=False): + id: str + """The unique identifier of the filter.""" + description: str """A case-insensitive string to find in the description.""" diff --git a/src/cloudflare/types/filter_update_params.py b/src/cloudflare/types/filters/filter_update_params.py similarity index 100% rename from src/cloudflare/types/filter_update_params.py rename to src/cloudflare/types/filters/filter_update_params.py diff --git a/src/cloudflare/types/firewall_filter.py b/src/cloudflare/types/filters/firewall_filter.py similarity index 95% rename from src/cloudflare/types/firewall_filter.py rename to src/cloudflare/types/filters/firewall_filter.py index 5114c5f9346..03fdc13a222 100644 --- a/src/cloudflare/types/firewall_filter.py +++ b/src/cloudflare/types/filters/firewall_filter.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["FirewallFilter"] diff --git a/src/cloudflare/types/firewall/__init__.py b/src/cloudflare/types/firewall/__init__.py index 59a280461ab..463e992a863 100644 --- a/src/cloudflare/types/firewall/__init__.py +++ b/src/cloudflare/types/firewall/__init__.py @@ -2,31 +2,47 @@ from __future__ import annotations +from .lockdown import Lockdown as Lockdown +from .products import Products as Products +from .lockdown_url import LockdownURL as LockdownURL +from .configuration import Configuration as Configuration +from .firewall_rule import FirewallRule as FirewallRule +from .deleted_filter import DeletedFilter as DeletedFilter +from .rule_get_params import RuleGetParams as RuleGetParams from .rule_edit_params import RuleEditParams as RuleEditParams from .rule_list_params import RuleListParams as RuleListParams from .rule_create_params import RuleCreateParams as RuleCreateParams from .rule_delete_params import RuleDeleteParams as RuleDeleteParams from .rule_edit_response import RuleEditResponse as RuleEditResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .configuration_param import ConfigurationParam as ConfigurationParam from .ua_rule_list_params import UARuleListParams as UARuleListParams -from .firewall_filter_rule import FirewallFilterRule as FirewallFilterRule from .lockdown_list_params import LockdownListParams as LockdownListParams from .rule_create_response import RuleCreateResponse as RuleCreateResponse from .ua_rule_get_response import UARuleGetResponse as UARuleGetResponse from .ua_rule_create_params import UARuleCreateParams as UARuleCreateParams +from .ua_rule_delete_params import UARuleDeleteParams as UARuleDeleteParams from .ua_rule_list_response import UARuleListResponse as UARuleListResponse from .ua_rule_update_params import UARuleUpdateParams as UARuleUpdateParams -from .firewall_zone_lockdown import FirewallZoneLockdown as FirewallZoneLockdown from .lockdown_create_params import LockdownCreateParams as LockdownCreateParams +from .lockdown_delete_params import LockdownDeleteParams as LockdownDeleteParams from .lockdown_update_params import LockdownUpdateParams as LockdownUpdateParams from .access_rule_edit_params import AccessRuleEditParams as AccessRuleEditParams from .access_rule_list_params import AccessRuleListParams as AccessRuleListParams +from .asn_configuration_param import ASNConfigurationParam as ASNConfigurationParam from .ua_rule_create_response import UARuleCreateResponse as UARuleCreateResponse from .ua_rule_delete_response import UARuleDeleteResponse as UARuleDeleteResponse from .ua_rule_update_response import UARuleUpdateResponse as UARuleUpdateResponse from .access_rule_get_response import AccessRuleGetResponse as AccessRuleGetResponse +from .ipv6_configuration_param import IPV6ConfigurationParam as IPV6ConfigurationParam from .lockdown_delete_response import LockdownDeleteResponse as LockdownDeleteResponse from .access_rule_create_params import AccessRuleCreateParams as AccessRuleCreateParams +from .access_rule_delete_params import AccessRuleDeleteParams as AccessRuleDeleteParams from .access_rule_edit_response import AccessRuleEditResponse as AccessRuleEditResponse +from .lockdown_ip_configuration import LockdownIPConfiguration as LockdownIPConfiguration from .access_rule_create_response import AccessRuleCreateResponse as AccessRuleCreateResponse from .access_rule_delete_response import AccessRuleDeleteResponse as AccessRuleDeleteResponse +from .country_configuration_param import CountryConfigurationParam as CountryConfigurationParam +from .lockdown_cidr_configuration import LockdownCIDRConfiguration as LockdownCIDRConfiguration +from .access_rule_ip_configuration_param import AccessRuleIPConfigurationParam as AccessRuleIPConfigurationParam +from .access_rule_cidr_configuration_param import AccessRuleCIDRConfigurationParam as AccessRuleCIDRConfigurationParam diff --git a/src/cloudflare/types/firewall/access_rule_cidr_configuration_param.py b/src/cloudflare/types/firewall/access_rule_cidr_configuration_param.py new file mode 100644 index 00000000000..963ff0df81b --- /dev/null +++ b/src/cloudflare/types/firewall/access_rule_cidr_configuration_param.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["AccessRuleCIDRConfigurationParam"] + + +class AccessRuleCIDRConfigurationParam(TypedDict, total=False): + target: Literal["ip_range"] + """The configuration target. + + You must set the target to `ip_range` when specifying an IP address range in the + rule. + """ + + value: str + """The IP address range to match. + + You can only use prefix lengths `/16` and `/24` for IPv4 ranges, and prefix + lengths `/32`, `/48`, and `/64` for IPv6 ranges. + """ diff --git a/src/cloudflare/types/firewall/access_rule_create_params.py b/src/cloudflare/types/firewall/access_rule_create_params.py index 966be8e8632..b33d495b8b1 100644 --- a/src/cloudflare/types/firewall/access_rule_create_params.py +++ b/src/cloudflare/types/firewall/access_rule_create_params.py @@ -5,15 +5,13 @@ from typing import Union from typing_extensions import Literal, Required, TypedDict -__all__ = [ - "AccessRuleCreateParams", - "Configuration", - "ConfigurationLegacyJhsIPConfiguration", - "ConfigurationLegacyJhsIPV6Configuration", - "ConfigurationLegacyJhsCIDRConfiguration", - "ConfigurationLegacyJhsASNConfiguration", - "ConfigurationLegacyJhsCountryConfiguration", -] +from .asn_configuration_param import ASNConfigurationParam +from .ipv6_configuration_param import IPV6ConfigurationParam +from .country_configuration_param import CountryConfigurationParam +from .access_rule_ip_configuration_param import AccessRuleIPConfigurationParam +from .access_rule_cidr_configuration_param import AccessRuleCIDRConfigurationParam + +__all__ = ["AccessRuleCreateParams", "Configuration"] class AccessRuleCreateParams(TypedDict, total=False): @@ -35,78 +33,10 @@ class AccessRuleCreateParams(TypedDict, total=False): """ -class ConfigurationLegacyJhsIPConfiguration(TypedDict, total=False): - target: Literal["ip"] - """The configuration target. - - You must set the target to `ip` when specifying an IP address in the rule. - """ - - value: str - """The IP address to match. - - This address will be compared to the IP address of incoming requests. - """ - - -class ConfigurationLegacyJhsIPV6Configuration(TypedDict, total=False): - target: Literal["ip6"] - """The configuration target. - - You must set the target to `ip6` when specifying an IPv6 address in the rule. - """ - - value: str - """The IPv6 address to match.""" - - -class ConfigurationLegacyJhsCIDRConfiguration(TypedDict, total=False): - target: Literal["ip_range"] - """The configuration target. - - You must set the target to `ip_range` when specifying an IP address range in the - rule. - """ - - value: str - """The IP address range to match. - - You can only use prefix lengths `/16` and `/24` for IPv4 ranges, and prefix - lengths `/32`, `/48`, and `/64` for IPv6 ranges. - """ - - -class ConfigurationLegacyJhsASNConfiguration(TypedDict, total=False): - target: Literal["asn"] - """The configuration target. - - You must set the target to `asn` when specifying an Autonomous System Number - (ASN) in the rule. - """ - - value: str - """The AS number to match.""" - - -class ConfigurationLegacyJhsCountryConfiguration(TypedDict, total=False): - target: Literal["country"] - """The configuration target. - - You must set the target to `country` when specifying a country code in the rule. - """ - - value: str - """The two-letter ISO-3166-1 alpha-2 code to match. - - For more information, refer to - [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). - """ - - Configuration = Union[ - ConfigurationLegacyJhsIPConfiguration, - ConfigurationLegacyJhsIPV6Configuration, - ConfigurationLegacyJhsCIDRConfiguration, - ConfigurationLegacyJhsASNConfiguration, - ConfigurationLegacyJhsCountryConfiguration, + AccessRuleIPConfigurationParam, + IPV6ConfigurationParam, + AccessRuleCIDRConfigurationParam, + ASNConfigurationParam, + CountryConfigurationParam, ] diff --git a/src/cloudflare/types/firewall/access_rule_create_response.py b/src/cloudflare/types/firewall/access_rule_create_response.py index d68421c6413..0a4df8a881b 100644 --- a/src/cloudflare/types/firewall/access_rule_create_response.py +++ b/src/cloudflare/types/firewall/access_rule_create_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["AccessRuleCreateResponse"] -AccessRuleCreateResponse = Union[str, object, None] +AccessRuleCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/access_rule_delete_params.py b/src/cloudflare/types/firewall/access_rule_delete_params.py new file mode 100644 index 00000000000..e3452b077eb --- /dev/null +++ b/src/cloudflare/types/firewall/access_rule_delete_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__ = ["AccessRuleDeleteParams"] + + +class AccessRuleDeleteParams(TypedDict, total=False): + body: Required[object] + + 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/firewall/access_rule_edit_params.py b/src/cloudflare/types/firewall/access_rule_edit_params.py index dc3b0726194..8a7d69b38ea 100644 --- a/src/cloudflare/types/firewall/access_rule_edit_params.py +++ b/src/cloudflare/types/firewall/access_rule_edit_params.py @@ -5,15 +5,13 @@ from typing import Union from typing_extensions import Literal, Required, TypedDict -__all__ = [ - "AccessRuleEditParams", - "Configuration", - "ConfigurationLegacyJhsIPConfiguration", - "ConfigurationLegacyJhsIPV6Configuration", - "ConfigurationLegacyJhsCIDRConfiguration", - "ConfigurationLegacyJhsASNConfiguration", - "ConfigurationLegacyJhsCountryConfiguration", -] +from .asn_configuration_param import ASNConfigurationParam +from .ipv6_configuration_param import IPV6ConfigurationParam +from .country_configuration_param import CountryConfigurationParam +from .access_rule_ip_configuration_param import AccessRuleIPConfigurationParam +from .access_rule_cidr_configuration_param import AccessRuleCIDRConfigurationParam + +__all__ = ["AccessRuleEditParams", "Configuration"] class AccessRuleEditParams(TypedDict, total=False): @@ -35,78 +33,10 @@ class AccessRuleEditParams(TypedDict, total=False): """ -class ConfigurationLegacyJhsIPConfiguration(TypedDict, total=False): - target: Literal["ip"] - """The configuration target. - - You must set the target to `ip` when specifying an IP address in the rule. - """ - - value: str - """The IP address to match. - - This address will be compared to the IP address of incoming requests. - """ - - -class ConfigurationLegacyJhsIPV6Configuration(TypedDict, total=False): - target: Literal["ip6"] - """The configuration target. - - You must set the target to `ip6` when specifying an IPv6 address in the rule. - """ - - value: str - """The IPv6 address to match.""" - - -class ConfigurationLegacyJhsCIDRConfiguration(TypedDict, total=False): - target: Literal["ip_range"] - """The configuration target. - - You must set the target to `ip_range` when specifying an IP address range in the - rule. - """ - - value: str - """The IP address range to match. - - You can only use prefix lengths `/16` and `/24` for IPv4 ranges, and prefix - lengths `/32`, `/48`, and `/64` for IPv6 ranges. - """ - - -class ConfigurationLegacyJhsASNConfiguration(TypedDict, total=False): - target: Literal["asn"] - """The configuration target. - - You must set the target to `asn` when specifying an Autonomous System Number - (ASN) in the rule. - """ - - value: str - """The AS number to match.""" - - -class ConfigurationLegacyJhsCountryConfiguration(TypedDict, total=False): - target: Literal["country"] - """The configuration target. - - You must set the target to `country` when specifying a country code in the rule. - """ - - value: str - """The two-letter ISO-3166-1 alpha-2 code to match. - - For more information, refer to - [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). - """ - - Configuration = Union[ - ConfigurationLegacyJhsIPConfiguration, - ConfigurationLegacyJhsIPV6Configuration, - ConfigurationLegacyJhsCIDRConfiguration, - ConfigurationLegacyJhsASNConfiguration, - ConfigurationLegacyJhsCountryConfiguration, + AccessRuleIPConfigurationParam, + IPV6ConfigurationParam, + AccessRuleCIDRConfigurationParam, + ASNConfigurationParam, + CountryConfigurationParam, ] diff --git a/src/cloudflare/types/firewall/access_rule_edit_response.py b/src/cloudflare/types/firewall/access_rule_edit_response.py index ca5ae10863a..a27b308d2ab 100644 --- a/src/cloudflare/types/firewall/access_rule_edit_response.py +++ b/src/cloudflare/types/firewall/access_rule_edit_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["AccessRuleEditResponse"] -AccessRuleEditResponse = Union[str, object, None] +AccessRuleEditResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/access_rule_get_response.py b/src/cloudflare/types/firewall/access_rule_get_response.py index a81cdbb8fa3..a824c545bc9 100644 --- a/src/cloudflare/types/firewall/access_rule_get_response.py +++ b/src/cloudflare/types/firewall/access_rule_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["AccessRuleGetResponse"] -AccessRuleGetResponse = Union[str, object, None] +AccessRuleGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/access_rule_ip_configuration_param.py b/src/cloudflare/types/firewall/access_rule_ip_configuration_param.py new file mode 100644 index 00000000000..fecf55cc1a1 --- /dev/null +++ b/src/cloudflare/types/firewall/access_rule_ip_configuration_param.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 Literal, TypedDict + +__all__ = ["AccessRuleIPConfigurationParam"] + + +class AccessRuleIPConfigurationParam(TypedDict, total=False): + target: Literal["ip"] + """The configuration target. + + You must set the target to `ip` when specifying an IP address in the rule. + """ + + value: str + """The IP address to match. + + This address will be compared to the IP address of incoming requests. + """ diff --git a/src/cloudflare/types/firewall/asn_configuration_param.py b/src/cloudflare/types/firewall/asn_configuration_param.py new file mode 100644 index 00000000000..dc0246e5d48 --- /dev/null +++ b/src/cloudflare/types/firewall/asn_configuration_param.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 Literal, TypedDict + +__all__ = ["ASNConfigurationParam"] + + +class ASNConfigurationParam(TypedDict, total=False): + target: Literal["asn"] + """The configuration target. + + You must set the target to `asn` when specifying an Autonomous System Number + (ASN) in the rule. + """ + + value: str + """The AS number to match.""" diff --git a/src/cloudflare/types/firewall/configuration.py b/src/cloudflare/types/firewall/configuration.py new file mode 100644 index 00000000000..c795db49b4f --- /dev/null +++ b/src/cloudflare/types/firewall/configuration.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +from .lockdown_ip_configuration import LockdownIPConfiguration +from .lockdown_cidr_configuration import LockdownCIDRConfiguration + +__all__ = ["Configuration"] + +Configuration = Union[LockdownIPConfiguration, LockdownCIDRConfiguration] diff --git a/src/cloudflare/types/firewall/configuration_param.py b/src/cloudflare/types/firewall/configuration_param.py new file mode 100644 index 00000000000..ffedb3978c2 --- /dev/null +++ b/src/cloudflare/types/firewall/configuration_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +from .lockdown_ip_configuration import LockdownIPConfiguration +from .lockdown_cidr_configuration import LockdownCIDRConfiguration + +__all__ = ["ConfigurationParam"] + +ConfigurationParam = Union[LockdownIPConfiguration, LockdownCIDRConfiguration] diff --git a/src/cloudflare/types/firewall/country_configuration_param.py b/src/cloudflare/types/firewall/country_configuration_param.py new file mode 100644 index 00000000000..1cb87a87ec5 --- /dev/null +++ b/src/cloudflare/types/firewall/country_configuration_param.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 Literal, TypedDict + +__all__ = ["CountryConfigurationParam"] + + +class CountryConfigurationParam(TypedDict, total=False): + target: Literal["country"] + """The configuration target. + + You must set the target to `country` when specifying a country code in the rule. + """ + + value: str + """The two-letter ISO-3166-1 alpha-2 code to match. + + For more information, refer to + [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + """ diff --git a/src/cloudflare/types/firewall/deleted_filter.py b/src/cloudflare/types/firewall/deleted_filter.py new file mode 100644 index 00000000000..2172524a4be --- /dev/null +++ b/src/cloudflare/types/firewall/deleted_filter.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["DeletedFilter"] + + +class DeletedFilter(BaseModel): + id: str + """The unique identifier of the filter.""" + + deleted: bool + """When true, indicates that the firewall rule was deleted.""" diff --git a/src/cloudflare/types/firewall/firewall_filter_rule.py b/src/cloudflare/types/firewall/firewall_filter_rule.py deleted file mode 100644 index 6c08cb85929..00000000000 --- a/src/cloudflare/types/firewall/firewall_filter_rule.py +++ /dev/null @@ -1,56 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from ..firewall_filter import FirewallFilter - -__all__ = ["FirewallFilterRule", "Filter", "FilterLegacyJhsDeletedFilter"] - - -class FilterLegacyJhsDeletedFilter(BaseModel): - id: str - """The unique identifier of the filter.""" - - deleted: bool - """When true, indicates that the firewall rule was deleted.""" - - -Filter = Union[FirewallFilter, FilterLegacyJhsDeletedFilter] - - -class FirewallFilterRule(BaseModel): - id: Optional[str] = None - """The unique identifier of the firewall rule.""" - - action: Optional[ - Literal["block", "challenge", "js_challenge", "managed_challenge", "allow", "log", "bypass"] - ] = None - """The action to apply to a matched request. - - The `log` action is only available on an Enterprise plan. - """ - - description: Optional[str] = None - """An informative summary of the firewall rule.""" - - filter: Optional[Filter] = None - - paused: Optional[bool] = None - """When true, indicates that the firewall rule is currently paused.""" - - priority: Optional[float] = None - """The priority of the rule. - - Optional value used to define the processing order. A lower number indicates a - higher priority. If not provided, rules with a defined priority will be - processed before rules without a priority. - """ - - products: Optional[ - List[Literal["zoneLockdown", "uaBlock", "bic", "hot", "securityLevel", "rateLimit", "waf"]] - ] = None - - ref: Optional[str] = None - """A short reference tag. Allows you to select related firewall rules.""" diff --git a/src/cloudflare/types/firewall/firewall_rule.py b/src/cloudflare/types/firewall/firewall_rule.py new file mode 100644 index 00000000000..8c3a20fffad --- /dev/null +++ b/src/cloudflare/types/firewall/firewall_rule.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional + +from .products import Products +from ..._models import BaseModel +from .deleted_filter import DeletedFilter +from ..rate_limits.action import Action +from ..filters.firewall_filter import FirewallFilter + +__all__ = ["FirewallRule", "Filter"] + +Filter = Union[FirewallFilter, DeletedFilter] + + +class FirewallRule(BaseModel): + id: Optional[str] = None + """The unique identifier of the firewall rule.""" + + action: Optional[Action] = None + """The action to apply to a matched request. + + The `log` action is only available on an Enterprise plan. + """ + + description: Optional[str] = None + """An informative summary of the firewall rule.""" + + filter: Optional[Filter] = None + + paused: Optional[bool] = None + """When true, indicates that the firewall rule is currently paused.""" + + priority: Optional[float] = None + """The priority of the rule. + + Optional value used to define the processing order. A lower number indicates a + higher priority. If not provided, rules with a defined priority will be + processed before rules without a priority. + """ + + products: Optional[List[Products]] = None + + ref: Optional[str] = None + """A short reference tag. Allows you to select related firewall rules.""" diff --git a/src/cloudflare/types/firewall/firewall_zone_lockdown.py b/src/cloudflare/types/firewall/firewall_zone_lockdown.py deleted file mode 100644 index 0beb83e03fa..00000000000 --- a/src/cloudflare/types/firewall/firewall_zone_lockdown.py +++ /dev/null @@ -1,75 +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 - -from ..._models import BaseModel - -__all__ = [ - "FirewallZoneLockdown", - "Configurations", - "ConfigurationsLegacyJhsSchemasIPConfiguration", - "ConfigurationsLegacyJhsSchemasCIDRConfiguration", -] - - -class ConfigurationsLegacyJhsSchemasIPConfiguration(BaseModel): - target: Optional[Literal["ip"]] = None - """The configuration target. - - You must set the target to `ip` when specifying an IP address in the Zone - Lockdown rule. - """ - - value: Optional[str] = None - """The IP address to match. - - This address will be compared to the IP address of incoming requests. - """ - - -class ConfigurationsLegacyJhsSchemasCIDRConfiguration(BaseModel): - target: Optional[Literal["ip_range"]] = None - """The configuration target. - - You must set the target to `ip_range` when specifying an IP address range in the - Zone Lockdown rule. - """ - - value: Optional[str] = None - """The IP address range to match. You can only use prefix lengths `/16` and `/24`.""" - - -Configurations = Union[ConfigurationsLegacyJhsSchemasIPConfiguration, ConfigurationsLegacyJhsSchemasCIDRConfiguration] - - -class FirewallZoneLockdown(BaseModel): - id: str - """The unique identifier of the Zone Lockdown rule.""" - - configurations: Configurations - """ - A list of IP addresses or CIDR ranges that will be allowed to access the URLs - specified in the Zone Lockdown rule. You can include any number of `ip` or - `ip_range` configurations. - """ - - created_on: datetime - """The timestamp of when the rule was created.""" - - description: str - """An informative summary of the rule.""" - - modified_on: datetime - """The timestamp of when the rule was last modified.""" - - paused: bool - """When true, indicates that the rule is currently paused.""" - - urls: List[str] - """The URLs to include in the rule definition. - - You can use wildcards. Each entered URL will be escaped before use, which means - you can only use simple wildcard patterns. - """ diff --git a/src/cloudflare/types/firewall/ipv6_configuration_param.py b/src/cloudflare/types/firewall/ipv6_configuration_param.py new file mode 100644 index 00000000000..917f9dd9d76 --- /dev/null +++ b/src/cloudflare/types/firewall/ipv6_configuration_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["IPV6ConfigurationParam"] + + +class IPV6ConfigurationParam(TypedDict, total=False): + target: Literal["ip6"] + """The configuration target. + + You must set the target to `ip6` when specifying an IPv6 address in the rule. + """ + + value: str + """The IPv6 address to match.""" diff --git a/src/cloudflare/types/firewall/lockdown.py b/src/cloudflare/types/firewall/lockdown.py new file mode 100644 index 00000000000..7a1ea7038b5 --- /dev/null +++ b/src/cloudflare/types/firewall/lockdown.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime + +from ..._models import BaseModel +from .lockdown_url import LockdownURL +from .configuration import Configuration + +__all__ = ["Lockdown"] + + +class Lockdown(BaseModel): + id: str + """The unique identifier of the Zone Lockdown rule.""" + + configurations: Configuration + """ + A list of IP addresses or CIDR ranges that will be allowed to access the URLs + specified in the Zone Lockdown rule. You can include any number of `ip` or + `ip_range` configurations. + """ + + created_on: datetime + """The timestamp of when the rule was created.""" + + description: str + """An informative summary of the rule.""" + + modified_on: datetime + """The timestamp of when the rule was last modified.""" + + paused: bool + """When true, indicates that the rule is currently paused.""" + + urls: List[LockdownURL] + """The URLs to include in the rule definition. + + You can use wildcards. Each entered URL will be escaped before use, which means + you can only use simple wildcard patterns. + """ diff --git a/src/cloudflare/types/firewall/lockdown_cidr_configuration.py b/src/cloudflare/types/firewall/lockdown_cidr_configuration.py new file mode 100644 index 00000000000..0380319616c --- /dev/null +++ b/src/cloudflare/types/firewall/lockdown_cidr_configuration.py @@ -0,0 +1,20 @@ +# 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__ = ["LockdownCIDRConfiguration"] + + +class LockdownCIDRConfiguration(BaseModel): + target: Optional[Literal["ip_range"]] = None + """The configuration target. + + You must set the target to `ip_range` when specifying an IP address range in the + Zone Lockdown rule. + """ + + value: Optional[str] = None + """The IP address range to match. You can only use prefix lengths `/16` and `/24`.""" diff --git a/src/cloudflare/types/firewall/lockdown_delete_params.py b/src/cloudflare/types/firewall/lockdown_delete_params.py new file mode 100644 index 00000000000..c56000f1e92 --- /dev/null +++ b/src/cloudflare/types/firewall/lockdown_delete_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__ = ["LockdownDeleteParams"] + + +class LockdownDeleteParams(TypedDict, total=False): + zone_identifier: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/firewall/lockdown_ip_configuration.py b/src/cloudflare/types/firewall/lockdown_ip_configuration.py new file mode 100644 index 00000000000..5961692c88f --- /dev/null +++ b/src/cloudflare/types/firewall/lockdown_ip_configuration.py @@ -0,0 +1,23 @@ +# 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__ = ["LockdownIPConfiguration"] + + +class LockdownIPConfiguration(BaseModel): + target: Optional[Literal["ip"]] = None + """The configuration target. + + You must set the target to `ip` when specifying an IP address in the Zone + Lockdown rule. + """ + + value: Optional[str] = None + """The IP address to match. + + This address will be compared to the IP address of incoming requests. + """ diff --git a/src/cloudflare/types/firewall/lockdown_list_params.py b/src/cloudflare/types/firewall/lockdown_list_params.py index 696de046357..bf2c8abb5c2 100644 --- a/src/cloudflare/types/firewall/lockdown_list_params.py +++ b/src/cloudflare/types/firewall/lockdown_list_params.py @@ -2,12 +2,19 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo __all__ = ["LockdownListParams"] class LockdownListParams(TypedDict, total=False): + created_on: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """The timestamp of when the rule was created.""" + description: str """A string to search for in the description of existing rules.""" @@ -23,6 +30,9 @@ class LockdownListParams(TypedDict, total=False): ip_search: str """A single IP address to search for in existing rules.""" + modified_on: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """The timestamp of when the rule was last modified.""" + page: float """Page number of paginated results.""" diff --git a/src/cloudflare/types/firewall/lockdown_url.py b/src/cloudflare/types/firewall/lockdown_url.py new file mode 100644 index 00000000000..0a1b07bf3a3 --- /dev/null +++ b/src/cloudflare/types/firewall/lockdown_url.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["LockdownURL"] + +LockdownURL = str diff --git a/src/cloudflare/types/firewall/products.py b/src/cloudflare/types/firewall/products.py new file mode 100644 index 00000000000..0dc537616f5 --- /dev/null +++ b/src/cloudflare/types/firewall/products.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["Products"] + +Products = Literal["zoneLockdown", "uaBlock", "bic", "hot", "securityLevel", "rateLimit", "waf"] diff --git a/src/cloudflare/types/firewall/rule_create_response.py b/src/cloudflare/types/firewall/rule_create_response.py index 78a21420c26..9e9e460a11f 100644 --- a/src/cloudflare/types/firewall/rule_create_response.py +++ b/src/cloudflare/types/firewall/rule_create_response.py @@ -2,8 +2,8 @@ from typing import List -from .firewall_filter_rule import FirewallFilterRule +from .firewall_rule import FirewallRule __all__ = ["RuleCreateResponse"] -RuleCreateResponse = List[FirewallFilterRule] +RuleCreateResponse = List[FirewallRule] diff --git a/src/cloudflare/types/firewall/rule_edit_response.py b/src/cloudflare/types/firewall/rule_edit_response.py index 7fbd5ba92a9..7c461c4190f 100644 --- a/src/cloudflare/types/firewall/rule_edit_response.py +++ b/src/cloudflare/types/firewall/rule_edit_response.py @@ -2,8 +2,8 @@ from typing import List -from .firewall_filter_rule import FirewallFilterRule +from .firewall_rule import FirewallRule __all__ = ["RuleEditResponse"] -RuleEditResponse = List[FirewallFilterRule] +RuleEditResponse = List[FirewallRule] diff --git a/src/cloudflare/types/firewall/rule_get_params.py b/src/cloudflare/types/firewall/rule_get_params.py new file mode 100644 index 00000000000..79bd6c28748 --- /dev/null +++ b/src/cloudflare/types/firewall/rule_get_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, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["RuleGetParams"] + + +class RuleGetParams(TypedDict, total=False): + path_id: Required[Annotated[str, PropertyInfo(alias="id")]] + """The unique identifier of the firewall rule.""" + + query_id: Annotated[str, PropertyInfo(alias="id")] + """The unique identifier of the firewall rule.""" diff --git a/src/cloudflare/types/firewall/rule_list_params.py b/src/cloudflare/types/firewall/rule_list_params.py index eb6080d0d13..d46c0f938ef 100644 --- a/src/cloudflare/types/firewall/rule_list_params.py +++ b/src/cloudflare/types/firewall/rule_list_params.py @@ -8,6 +8,9 @@ class RuleListParams(TypedDict, total=False): + id: str + """The unique identifier of the firewall rule.""" + action: str """The action to search for. Must be an exact match.""" diff --git a/src/cloudflare/types/firewall/ua_rule_create_response.py b/src/cloudflare/types/firewall/ua_rule_create_response.py index dd128577d6f..9f5213baa44 100644 --- a/src/cloudflare/types/firewall/ua_rule_create_response.py +++ b/src/cloudflare/types/firewall/ua_rule_create_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["UARuleCreateResponse"] -UARuleCreateResponse = Union[str, object, None] +UARuleCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/ua_rule_delete_params.py b/src/cloudflare/types/firewall/ua_rule_delete_params.py new file mode 100644 index 00000000000..ff1566c3eb5 --- /dev/null +++ b/src/cloudflare/types/firewall/ua_rule_delete_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__ = ["UARuleDeleteParams"] + + +class UARuleDeleteParams(TypedDict, total=False): + zone_identifier: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/firewall/ua_rule_get_response.py b/src/cloudflare/types/firewall/ua_rule_get_response.py index c1fbd966332..135eee2fdca 100644 --- a/src/cloudflare/types/firewall/ua_rule_get_response.py +++ b/src/cloudflare/types/firewall/ua_rule_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["UARuleGetResponse"] -UARuleGetResponse = Union[str, object, None] +UARuleGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/ua_rule_update_response.py b/src/cloudflare/types/firewall/ua_rule_update_response.py index fde2e2d7b60..4d88bc66b96 100644 --- a/src/cloudflare/types/firewall/ua_rule_update_response.py +++ b/src/cloudflare/types/firewall/ua_rule_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["UARuleUpdateResponse"] -UARuleUpdateResponse = Union[str, object, None] +UARuleUpdateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/waf/__init__.py b/src/cloudflare/types/firewall/waf/__init__.py index 7e819835b14..a6f42971f3e 100644 --- a/src/cloudflare/types/firewall/waf/__init__.py +++ b/src/cloudflare/types/firewall/waf/__init__.py @@ -2,11 +2,15 @@ from __future__ import annotations -from .waf_override import WAFOverride as WAFOverride +from .override import Override as Override +from .waf_rule import WAFRule as WAFRule +from .override_url import OverrideURL as OverrideURL +from .rewrite_action import RewriteAction as RewriteAction from .package_list_params import PackageListParams as PackageListParams from .override_list_params import OverrideListParams as OverrideListParams from .package_get_response import PackageGetResponse as PackageGetResponse from .package_list_response import PackageListResponse as PackageListResponse from .override_create_params import OverrideCreateParams as OverrideCreateParams +from .override_delete_params import OverrideDeleteParams as OverrideDeleteParams from .override_update_params import OverrideUpdateParams as OverrideUpdateParams from .override_delete_response import OverrideDeleteResponse as OverrideDeleteResponse diff --git a/src/cloudflare/types/firewall/waf/override.py b/src/cloudflare/types/firewall/waf/override.py new file mode 100644 index 00000000000..a758b89d18b --- /dev/null +++ b/src/cloudflare/types/firewall/waf/override.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from .waf_rule import WAFRule +from ...._models import BaseModel +from .override_url import OverrideURL +from .rewrite_action import RewriteAction + +__all__ = ["Override"] + + +class Override(BaseModel): + id: Optional[str] = None + """The unique identifier of the WAF override.""" + + description: Optional[str] = None + """An informative summary of the current URI-based WAF override.""" + + groups: Optional[Dict[str, object]] = None + """ + An object that allows you to enable or disable WAF rule groups for the current + WAF override. Each key of this object must be the ID of a WAF rule group, and + each value must be a valid WAF action (usually `default` or `disable`). When + creating a new URI-based WAF override, you must provide a `groups` object or a + `rules` object. + """ + + paused: Optional[bool] = None + """When true, indicates that the WAF package is currently paused.""" + + priority: Optional[float] = None + """ + The relative priority of the current URI-based WAF override when multiple + overrides match a single URL. A lower number indicates higher priority. Higher + priority overrides may overwrite values set by lower priority overrides. + """ + + rewrite_action: Optional[RewriteAction] = None + """ + Specifies that, when a WAF rule matches, its configured action will be replaced + by the action configured in this object. + """ + + rules: Optional[WAFRule] = None + """An object that allows you to override the action of specific WAF rules. + + Each key of this object must be the ID of a WAF rule, and each value must be a + valid WAF action. Unless you are disabling a rule, ensure that you also enable + the rule group that this WAF rule belongs to. When creating a new URI-based WAF + override, you must provide a `groups` object or a `rules` object. + """ + + urls: Optional[List[OverrideURL]] = None + """The URLs to include in the current WAF override. + + You can use wildcards. Each entered URL will be escaped before use, which means + you can only use simple wildcard patterns. + """ diff --git a/src/cloudflare/types/firewall/waf/override_delete_params.py b/src/cloudflare/types/firewall/waf/override_delete_params.py new file mode 100644 index 00000000000..9a4c0e0fa57 --- /dev/null +++ b/src/cloudflare/types/firewall/waf/override_delete_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__ = ["OverrideDeleteParams"] + + +class OverrideDeleteParams(TypedDict, total=False): + zone_identifier: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/firewall/waf/override_url.py b/src/cloudflare/types/firewall/waf/override_url.py new file mode 100644 index 00000000000..f18aa215408 --- /dev/null +++ b/src/cloudflare/types/firewall/waf/override_url.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["OverrideURL"] + +OverrideURL = str diff --git a/src/cloudflare/types/firewall/waf/package_get_response.py b/src/cloudflare/types/firewall/waf/package_get_response.py index bfd6ecb7e43..989c04aa3a5 100644 --- a/src/cloudflare/types/firewall/waf/package_get_response.py +++ b/src/cloudflare/types/firewall/waf/package_get_response.py @@ -4,34 +4,17 @@ from typing_extensions import Literal from ...._models import BaseModel +from ...shared.response_info import ResponseInfo -__all__ = [ - "PackageGetResponse", - "LegacyJhsAPIResponseSingle", - "LegacyJhsAPIResponseSingleError", - "LegacyJhsAPIResponseSingleMessage", - "Result", -] +__all__ = ["PackageGetResponse", "FirewallAPIResponseSingle", "Result"] -class LegacyJhsAPIResponseSingleError(BaseModel): - code: int +class FirewallAPIResponseSingle(BaseModel): + errors: List[ResponseInfo] - message: str + messages: List[ResponseInfo] - -class LegacyJhsAPIResponseSingleMessage(BaseModel): - code: int - - message: str - - -class LegacyJhsAPIResponseSingle(BaseModel): - errors: List[LegacyJhsAPIResponseSingleError] - - messages: List[LegacyJhsAPIResponseSingleMessage] - - result: Union[str, object, None] = None + result: Union[Optional[str], Optional[object]] success: Literal[True] """Whether the API call was successful""" @@ -41,4 +24,4 @@ class Result(BaseModel): result: Optional[object] = None -PackageGetResponse = Union[LegacyJhsAPIResponseSingle, Result] +PackageGetResponse = Union[FirewallAPIResponseSingle, Result] diff --git a/src/cloudflare/types/firewall/waf/package_list_params.py b/src/cloudflare/types/firewall/waf/package_list_params.py index 6cb03200c94..63d46fc6f7f 100644 --- a/src/cloudflare/types/firewall/waf/package_list_params.py +++ b/src/cloudflare/types/firewall/waf/package_list_params.py @@ -17,6 +17,9 @@ class PackageListParams(TypedDict, total=False): When set to `any`, only one of the search requirements has to match. """ + name: str + """The name of the WAF package.""" + order: Literal["name"] """The field used to sort returned packages.""" diff --git a/src/cloudflare/types/firewall/waf/package_list_response.py b/src/cloudflare/types/firewall/waf/package_list_response.py index 407cdf602c0..f42e59fd524 100644 --- a/src/cloudflare/types/firewall/waf/package_list_response.py +++ b/src/cloudflare/types/firewall/waf/package_list_response.py @@ -4,33 +4,20 @@ from typing_extensions import Literal from ...._models import BaseModel +from ...shared.response_info import ResponseInfo __all__ = [ "PackageListResponse", - "LegacyJhsAPIResponseCollection", - "LegacyJhsAPIResponseCollectionError", - "LegacyJhsAPIResponseCollectionMessage", - "LegacyJhsAPIResponseCollectionResultInfo", + "FirewallAPIResponseCollection", + "FirewallAPIResponseCollectionResultInfo", "Result", "ResultResult", - "ResultResultLegacyJhsPackageDefinition", - "ResultResultLegacyJhsAnomalyPackage", + "ResultResultFirewallPackageDefinition", + "ResultResultFirewallAnomalyPackage", ] -class LegacyJhsAPIResponseCollectionError(BaseModel): - code: int - - message: str - - -class LegacyJhsAPIResponseCollectionMessage(BaseModel): - code: int - - message: str - - -class LegacyJhsAPIResponseCollectionResultInfo(BaseModel): +class FirewallAPIResponseCollectionResultInfo(BaseModel): count: Optional[float] = None """Total number of results for the requested service""" @@ -44,22 +31,22 @@ class LegacyJhsAPIResponseCollectionResultInfo(BaseModel): """Total results available without any search parameters""" -class LegacyJhsAPIResponseCollection(BaseModel): - errors: List[LegacyJhsAPIResponseCollectionError] +class FirewallAPIResponseCollection(BaseModel): + errors: List[ResponseInfo] - messages: List[LegacyJhsAPIResponseCollectionMessage] + messages: List[ResponseInfo] result: Union[List[object], str, object, None] = None success: Literal[True] """Whether the API call was successful""" - result_info: Optional[LegacyJhsAPIResponseCollectionResultInfo] = None + result_info: Optional[FirewallAPIResponseCollectionResultInfo] = None -class ResultResultLegacyJhsPackageDefinition(BaseModel): +class ResultResultFirewallPackageDefinition(BaseModel): id: str - """The unique identifier of a WAF package.""" + """Identifier""" description: str """A summary of the purpose/function of the WAF package.""" @@ -90,9 +77,9 @@ class ResultResultLegacyJhsPackageDefinition(BaseModel): """ -class ResultResultLegacyJhsAnomalyPackage(BaseModel): +class ResultResultFirewallAnomalyPackage(BaseModel): id: str - """The unique identifier of a WAF package.""" + """Identifier""" description: str """A summary of the purpose/function of the WAF package.""" @@ -123,11 +110,11 @@ class ResultResultLegacyJhsAnomalyPackage(BaseModel): """ -ResultResult = Union[ResultResultLegacyJhsPackageDefinition, ResultResultLegacyJhsAnomalyPackage] +ResultResult = Union[ResultResultFirewallPackageDefinition, ResultResultFirewallAnomalyPackage] class Result(BaseModel): result: Optional[List[ResultResult]] = None -PackageListResponse = Union[LegacyJhsAPIResponseCollection, Result] +PackageListResponse = Union[FirewallAPIResponseCollection, Result] diff --git a/src/cloudflare/types/firewall/waf/packages/__init__.py b/src/cloudflare/types/firewall/waf/packages/__init__.py index 91cbd984b75..27d9c57807f 100644 --- a/src/cloudflare/types/firewall/waf/packages/__init__.py +++ b/src/cloudflare/types/firewall/waf/packages/__init__.py @@ -2,6 +2,8 @@ from __future__ import annotations +from .group import Group as Group +from .waf_rule_group import WAFRuleGroup as WAFRuleGroup from .rule_edit_params import RuleEditParams as RuleEditParams from .rule_list_params import RuleListParams as RuleListParams from .group_edit_params import GroupEditParams as GroupEditParams @@ -9,6 +11,6 @@ from .rule_get_response import RuleGetResponse as RuleGetResponse from .group_get_response import GroupGetResponse as GroupGetResponse from .rule_edit_response import RuleEditResponse as RuleEditResponse +from .rule_list_response import RuleListResponse as RuleListResponse from .group_edit_response import GroupEditResponse as GroupEditResponse -from .waf_managed_rules_rule import WAFManagedRulesRule as WAFManagedRulesRule -from .waf_managed_rules_group import WAFManagedRulesGroup as WAFManagedRulesGroup +from .allowed_modes_anomaly import AllowedModesAnomaly as AllowedModesAnomaly diff --git a/src/cloudflare/types/firewall/waf/packages/allowed_modes_anomaly.py b/src/cloudflare/types/firewall/waf/packages/allowed_modes_anomaly.py new file mode 100644 index 00000000000..51509474ee5 --- /dev/null +++ b/src/cloudflare/types/firewall/waf/packages/allowed_modes_anomaly.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["AllowedModesAnomaly"] + +AllowedModesAnomaly = Literal["on", "off"] diff --git a/src/cloudflare/types/firewall/waf/packages/group.py b/src/cloudflare/types/firewall/waf/packages/group.py new file mode 100644 index 00000000000..56484bdd5b8 --- /dev/null +++ b/src/cloudflare/types/firewall/waf/packages/group.py @@ -0,0 +1,40 @@ +# 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__ = ["Group"] + + +class Group(BaseModel): + id: str + """The unique identifier of the rule group.""" + + description: Optional[str] = None + """An informative summary of what the rule group does.""" + + mode: Literal["on", "off"] + """The state of the rules contained in the rule group. + + When `on`, the rules in the group are configurable/usable. + """ + + name: str + """The name of the rule group.""" + + rules_count: float + """The number of rules in the current rule group.""" + + allowed_modes: Optional[List[Literal["on", "off"]]] = None + """The available states for the rule group.""" + + modified_rules_count: Optional[float] = None + """ + The number of rules within the group that have been modified from their default + configuration. + """ + + package_id: Optional[str] = None + """The unique identifier of a WAF package.""" diff --git a/src/cloudflare/types/firewall/waf/packages/group_edit_response.py b/src/cloudflare/types/firewall/waf/packages/group_edit_response.py index ea365c5ebe4..8e8ef5a3f20 100644 --- a/src/cloudflare/types/firewall/waf/packages/group_edit_response.py +++ b/src/cloudflare/types/firewall/waf/packages/group_edit_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import Union, Optional __all__ = ["GroupEditResponse"] -GroupEditResponse = Union[List[object], str, object] +GroupEditResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/waf/packages/group_get_response.py b/src/cloudflare/types/firewall/waf/packages/group_get_response.py index 303cdb3dfa0..3d8278e8487 100644 --- a/src/cloudflare/types/firewall/waf/packages/group_get_response.py +++ b/src/cloudflare/types/firewall/waf/packages/group_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import Union, Optional __all__ = ["GroupGetResponse"] -GroupGetResponse = Union[List[object], str, object] +GroupGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/waf/packages/group_list_params.py b/src/cloudflare/types/firewall/waf/packages/group_list_params.py index e2923881d3e..5a2e79068a4 100644 --- a/src/cloudflare/types/firewall/waf/packages/group_list_params.py +++ b/src/cloudflare/types/firewall/waf/packages/group_list_params.py @@ -26,6 +26,9 @@ class GroupListParams(TypedDict, total=False): When `on`, the rules in the group are configurable/usable. """ + name: str + """The name of the rule group.""" + order: Literal["mode", "rules_count"] """The field used to sort returned rule groups.""" @@ -34,3 +37,6 @@ class GroupListParams(TypedDict, total=False): per_page: float """The number of rule groups per page.""" + + rules_count: float + """The number of rules in the current rule group.""" diff --git a/src/cloudflare/types/firewall/waf/packages/rule_edit_response.py b/src/cloudflare/types/firewall/waf/packages/rule_edit_response.py index 1ff90bc7e68..ee9d690caa2 100644 --- a/src/cloudflare/types/firewall/waf/packages/rule_edit_response.py +++ b/src/cloudflare/types/firewall/waf/packages/rule_edit_response.py @@ -1,34 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Union from typing_extensions import Literal from ....._models import BaseModel +from .waf_rule_group import WAFRuleGroup +from .allowed_modes_anomaly import AllowedModesAnomaly __all__ = [ "RuleEditResponse", "WAFManagedRulesAnomalyRule", - "WAFManagedRulesAnomalyRuleGroup", "WAFManagedRulesTraditionalDenyRule", - "WAFManagedRulesTraditionalDenyRuleGroup", "WAFManagedRulesTraditionalAllowRule", - "WAFManagedRulesTraditionalAllowRuleGroup", ] -class WAFManagedRulesAnomalyRuleGroup(BaseModel): - id: Optional[str] = None - """The unique identifier of the rule group.""" - - name: Optional[str] = None - """The name of the rule group.""" - - class WAFManagedRulesAnomalyRule(BaseModel): id: str """The unique identifier of the WAF rule.""" - allowed_modes: List[Literal["on", "off"]] + allowed_modes: List[AllowedModesAnomaly] """Defines the available modes for the current WAF rule. Applies to anomaly detection WAF rules. @@ -37,10 +28,10 @@ class WAFManagedRulesAnomalyRule(BaseModel): description: str """The public description of the WAF rule.""" - group: WAFManagedRulesAnomalyRuleGroup + group: WAFRuleGroup """The rule group to which the current WAF rule belongs.""" - mode: Literal["on", "off"] + mode: AllowedModesAnomaly """When set to `on`, the current WAF rule will be used when evaluating the request. Applies to anomaly detection WAF rules. @@ -53,14 +44,6 @@ class WAFManagedRulesAnomalyRule(BaseModel): """The order in which the individual WAF rule is executed within its rule group.""" -class WAFManagedRulesTraditionalDenyRuleGroup(BaseModel): - id: Optional[str] = None - """The unique identifier of the rule group.""" - - name: Optional[str] = None - """The name of the rule group.""" - - class WAFManagedRulesTraditionalDenyRule(BaseModel): id: str """The unique identifier of the WAF rule.""" @@ -74,7 +57,7 @@ class WAFManagedRulesTraditionalDenyRule(BaseModel): description: str """The public description of the WAF rule.""" - group: WAFManagedRulesTraditionalDenyRuleGroup + group: WAFRuleGroup """The rule group to which the current WAF rule belongs.""" mode: Literal["default", "disable", "simulate", "block", "challenge"] @@ -90,14 +73,6 @@ class WAFManagedRulesTraditionalDenyRule(BaseModel): """The order in which the individual WAF rule is executed within its rule group.""" -class WAFManagedRulesTraditionalAllowRuleGroup(BaseModel): - id: Optional[str] = None - """The unique identifier of the rule group.""" - - name: Optional[str] = None - """The name of the rule group.""" - - class WAFManagedRulesTraditionalAllowRule(BaseModel): id: str """The unique identifier of the WAF rule.""" @@ -105,10 +80,12 @@ class WAFManagedRulesTraditionalAllowRule(BaseModel): allowed_modes: List[Literal["on", "off"]] """Defines the available modes for the current WAF rule.""" + default_mode: object + description: str """The public description of the WAF rule.""" - group: WAFManagedRulesTraditionalAllowRuleGroup + group: WAFRuleGroup """The rule group to which the current WAF rule belongs.""" mode: Literal["on", "off"] diff --git a/src/cloudflare/types/firewall/waf/packages/rule_get_response.py b/src/cloudflare/types/firewall/waf/packages/rule_get_response.py index 88ca79a655e..b17274e52fe 100644 --- a/src/cloudflare/types/firewall/waf/packages/rule_get_response.py +++ b/src/cloudflare/types/firewall/waf/packages/rule_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import Union, Optional __all__ = ["RuleGetResponse"] -RuleGetResponse = Union[List[object], str, object] +RuleGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/firewall/waf/packages/rule_list_params.py b/src/cloudflare/types/firewall/waf/packages/rule_list_params.py index 5c74c03f081..9de33e821a6 100644 --- a/src/cloudflare/types/firewall/waf/packages/rule_list_params.py +++ b/src/cloudflare/types/firewall/waf/packages/rule_list_params.py @@ -11,9 +11,15 @@ class RuleListParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" + description: str + """The public description of the WAF rule.""" + direction: Literal["asc", "desc"] """The direction used to sort returned rules.""" + group_id: str + """The unique identifier of the rule group.""" + match: Literal["any", "all"] """When set to `all`, all the search requirements must match. @@ -31,3 +37,6 @@ class RuleListParams(TypedDict, total=False): per_page: float """The number of rules per page.""" + + priority: str + """The order in which the individual WAF rule is executed within its rule group.""" diff --git a/src/cloudflare/types/firewall/waf/packages/rule_list_response.py b/src/cloudflare/types/firewall/waf/packages/rule_list_response.py new file mode 100644 index 00000000000..29a688b1a13 --- /dev/null +++ b/src/cloudflare/types/firewall/waf/packages/rule_list_response.py @@ -0,0 +1,106 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union +from typing_extensions import Literal + +from ....._models import BaseModel +from .waf_rule_group import WAFRuleGroup +from .allowed_modes_anomaly import AllowedModesAnomaly + +__all__ = [ + "RuleListResponse", + "WAFManagedRulesAnomalyRule", + "WAFManagedRulesTraditionalDenyRule", + "WAFManagedRulesTraditionalAllowRule", +] + + +class WAFManagedRulesAnomalyRule(BaseModel): + id: str + """The unique identifier of the WAF rule.""" + + allowed_modes: List[AllowedModesAnomaly] + """Defines the available modes for the current WAF rule. + + Applies to anomaly detection WAF rules. + """ + + description: str + """The public description of the WAF rule.""" + + group: WAFRuleGroup + """The rule group to which the current WAF rule belongs.""" + + mode: AllowedModesAnomaly + """When set to `on`, the current WAF rule will be used when evaluating the request. + + Applies to anomaly detection WAF rules. + """ + + package_id: str + """The unique identifier of a WAF package.""" + + priority: str + """The order in which the individual WAF rule is executed within its rule group.""" + + +class WAFManagedRulesTraditionalDenyRule(BaseModel): + id: str + """The unique identifier of the WAF rule.""" + + allowed_modes: List[Literal["default", "disable", "simulate", "block", "challenge"]] + """The list of possible actions of the WAF rule when it is triggered.""" + + default_mode: Literal["disable", "simulate", "block", "challenge"] + """The default action/mode of a rule.""" + + description: str + """The public description of the WAF rule.""" + + group: WAFRuleGroup + """The rule group to which the current WAF rule belongs.""" + + mode: Literal["default", "disable", "simulate", "block", "challenge"] + """The action that the current WAF rule will perform when triggered. + + Applies to traditional (deny) WAF rules. + """ + + package_id: str + """The unique identifier of a WAF package.""" + + priority: str + """The order in which the individual WAF rule is executed within its rule group.""" + + +class WAFManagedRulesTraditionalAllowRule(BaseModel): + id: str + """The unique identifier of the WAF rule.""" + + allowed_modes: List[Literal["on", "off"]] + """Defines the available modes for the current WAF rule.""" + + default_mode: object + + description: str + """The public description of the WAF rule.""" + + group: WAFRuleGroup + """The rule group to which the current WAF rule belongs.""" + + mode: Literal["on", "off"] + """When set to `on`, the current rule will be used when evaluating the request. + + Applies to traditional (allow) WAF rules. + """ + + package_id: str + """The unique identifier of a WAF package.""" + + priority: str + """The order in which the individual WAF rule is executed within its rule group.""" + + +RuleListResponse = Union[ + WAFManagedRulesAnomalyRule, WAFManagedRulesTraditionalDenyRule, WAFManagedRulesTraditionalAllowRule +] diff --git a/src/cloudflare/types/firewall/waf/packages/waf_managed_rules_group.py b/src/cloudflare/types/firewall/waf/packages/waf_managed_rules_group.py deleted file mode 100644 index 66b01dffd10..00000000000 --- a/src/cloudflare/types/firewall/waf/packages/waf_managed_rules_group.py +++ /dev/null @@ -1,40 +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__ = ["WAFManagedRulesGroup"] - - -class WAFManagedRulesGroup(BaseModel): - id: str - """The unique identifier of the rule group.""" - - description: Optional[str] = None - """An informative summary of what the rule group does.""" - - mode: Literal["on", "off"] - """The state of the rules contained in the rule group. - - When `on`, the rules in the group are configurable/usable. - """ - - name: str - """The name of the rule group.""" - - rules_count: float - """The number of rules in the current rule group.""" - - allowed_modes: Optional[List[Literal["on", "off"]]] = None - """The available states for the rule group.""" - - modified_rules_count: Optional[float] = None - """ - The number of rules within the group that have been modified from their default - configuration. - """ - - package_id: Optional[str] = None - """The unique identifier of a WAF package.""" diff --git a/src/cloudflare/types/firewall/waf/packages/waf_managed_rules_rule.py b/src/cloudflare/types/firewall/waf/packages/waf_managed_rules_rule.py deleted file mode 100644 index e6adbf571ef..00000000000 --- a/src/cloudflare/types/firewall/waf/packages/waf_managed_rules_rule.py +++ /dev/null @@ -1,129 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ....._models import BaseModel - -__all__ = [ - "WAFManagedRulesRule", - "WAFManagedRulesAnomalyRule", - "WAFManagedRulesAnomalyRuleGroup", - "WAFManagedRulesTraditionalDenyRule", - "WAFManagedRulesTraditionalDenyRuleGroup", - "WAFManagedRulesTraditionalAllowRule", - "WAFManagedRulesTraditionalAllowRuleGroup", -] - - -class WAFManagedRulesAnomalyRuleGroup(BaseModel): - id: Optional[str] = None - """The unique identifier of the rule group.""" - - name: Optional[str] = None - """The name of the rule group.""" - - -class WAFManagedRulesAnomalyRule(BaseModel): - id: str - """The unique identifier of the WAF rule.""" - - allowed_modes: List[Literal["on", "off"]] - """Defines the available modes for the current WAF rule. - - Applies to anomaly detection WAF rules. - """ - - description: str - """The public description of the WAF rule.""" - - group: WAFManagedRulesAnomalyRuleGroup - """The rule group to which the current WAF rule belongs.""" - - mode: Literal["on", "off"] - """When set to `on`, the current WAF rule will be used when evaluating the request. - - Applies to anomaly detection WAF rules. - """ - - package_id: str - """The unique identifier of a WAF package.""" - - priority: str - """The order in which the individual WAF rule is executed within its rule group.""" - - -class WAFManagedRulesTraditionalDenyRuleGroup(BaseModel): - id: Optional[str] = None - """The unique identifier of the rule group.""" - - name: Optional[str] = None - """The name of the rule group.""" - - -class WAFManagedRulesTraditionalDenyRule(BaseModel): - id: str - """The unique identifier of the WAF rule.""" - - allowed_modes: List[Literal["default", "disable", "simulate", "block", "challenge"]] - """The list of possible actions of the WAF rule when it is triggered.""" - - default_mode: Literal["disable", "simulate", "block", "challenge"] - """The default action/mode of a rule.""" - - description: str - """The public description of the WAF rule.""" - - group: WAFManagedRulesTraditionalDenyRuleGroup - """The rule group to which the current WAF rule belongs.""" - - mode: Literal["default", "disable", "simulate", "block", "challenge"] - """The action that the current WAF rule will perform when triggered. - - Applies to traditional (deny) WAF rules. - """ - - package_id: str - """The unique identifier of a WAF package.""" - - priority: str - """The order in which the individual WAF rule is executed within its rule group.""" - - -class WAFManagedRulesTraditionalAllowRuleGroup(BaseModel): - id: Optional[str] = None - """The unique identifier of the rule group.""" - - name: Optional[str] = None - """The name of the rule group.""" - - -class WAFManagedRulesTraditionalAllowRule(BaseModel): - id: str - """The unique identifier of the WAF rule.""" - - allowed_modes: List[Literal["on", "off"]] - """Defines the available modes for the current WAF rule.""" - - description: str - """The public description of the WAF rule.""" - - group: WAFManagedRulesTraditionalAllowRuleGroup - """The rule group to which the current WAF rule belongs.""" - - mode: Literal["on", "off"] - """When set to `on`, the current rule will be used when evaluating the request. - - Applies to traditional (allow) WAF rules. - """ - - package_id: str - """The unique identifier of a WAF package.""" - - priority: str - """The order in which the individual WAF rule is executed within its rule group.""" - - -WAFManagedRulesRule = Union[ - WAFManagedRulesAnomalyRule, WAFManagedRulesTraditionalDenyRule, WAFManagedRulesTraditionalAllowRule -] diff --git a/src/cloudflare/types/firewall/waf/packages/waf_rule_group.py b/src/cloudflare/types/firewall/waf/packages/waf_rule_group.py new file mode 100644 index 00000000000..2ce0dcabcad --- /dev/null +++ b/src/cloudflare/types/firewall/waf/packages/waf_rule_group.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__ = ["WAFRuleGroup"] + + +class WAFRuleGroup(BaseModel): + id: Optional[str] = None + """The unique identifier of the rule group.""" + + name: Optional[str] = None + """The name of the rule group.""" diff --git a/src/cloudflare/types/firewall/waf/rewrite_action.py b/src/cloudflare/types/firewall/waf/rewrite_action.py new file mode 100644 index 00000000000..489bc26641a --- /dev/null +++ b/src/cloudflare/types/firewall/waf/rewrite_action.py @@ -0,0 +1,22 @@ +# 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__ = ["RewriteAction"] + + +class RewriteAction(BaseModel): + block: Optional[Literal["challenge", "block", "simulate", "disable", "default"]] = None + """The WAF rule action to apply.""" + + challenge: Optional[str] = None + + default: Optional[str] = None + + disable: Optional[Literal["challenge", "block", "simulate", "disable", "default"]] = None + """The WAF rule action to apply.""" + + simulate: Optional[str] = None diff --git a/src/cloudflare/types/firewall/waf/waf_override.py b/src/cloudflare/types/firewall/waf/waf_override.py deleted file mode 100644 index 528ee51f3b4..00000000000 --- a/src/cloudflare/types/firewall/waf/waf_override.py +++ /dev/null @@ -1,71 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["WAFOverride", "RewriteAction"] - - -class RewriteAction(BaseModel): - block: Optional[Literal["challenge", "block", "simulate", "disable", "default"]] = None - """The WAF rule action to apply.""" - - challenge: Optional[str] = None - - default: Optional[str] = None - - disable: Optional[Literal["challenge", "block", "simulate", "disable", "default"]] = None - """The WAF rule action to apply.""" - - simulate: Optional[str] = None - - -class WAFOverride(BaseModel): - id: Optional[str] = None - """The unique identifier of the WAF override.""" - - description: Optional[str] = None - """An informative summary of the current URI-based WAF override.""" - - groups: Optional[Dict[str, object]] = None - """ - An object that allows you to enable or disable WAF rule groups for the current - WAF override. Each key of this object must be the ID of a WAF rule group, and - each value must be a valid WAF action (usually `default` or `disable`). When - creating a new URI-based WAF override, you must provide a `groups` object or a - `rules` object. - """ - - paused: Optional[bool] = None - """When true, indicates that the WAF package is currently paused.""" - - priority: Optional[float] = None - """ - The relative priority of the current URI-based WAF override when multiple - overrides match a single URL. A lower number indicates higher priority. Higher - priority overrides may overwrite values set by lower priority overrides. - """ - - rewrite_action: Optional[RewriteAction] = None - """ - Specifies that, when a WAF rule matches, its configured action will be replaced - by the action configured in this object. - """ - - rules: Optional[Dict[str, Literal["challenge", "block", "simulate", "disable", "default"]]] = None - """An object that allows you to override the action of specific WAF rules. - - Each key of this object must be the ID of a WAF rule, and each value must be a - valid WAF action. Unless you are disabling a rule, ensure that you also enable - the rule group that this WAF rule belongs to. When creating a new URI-based WAF - override, you must provide a `groups` object or a `rules` object. - """ - - urls: Optional[List[str]] = None - """The URLs to include in the current WAF override. - - You can use wildcards. Each entered URL will be escaped before use, which means - you can only use simple wildcard patterns. - """ diff --git a/src/cloudflare/types/firewall/waf/waf_rule.py b/src/cloudflare/types/firewall/waf/waf_rule.py new file mode 100644 index 00000000000..d6fea426df4 --- /dev/null +++ b/src/cloudflare/types/firewall/waf/waf_rule.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import Literal + +__all__ = ["WAFRule"] + +WAFRule = Dict[str, Literal["challenge", "block", "simulate", "disable", "default"]] diff --git a/src/cloudflare/types/healthcheck.py b/src/cloudflare/types/healthcheck.py deleted file mode 100644 index 6ababd4f7c4..00000000000 --- a/src/cloudflare/types/healthcheck.py +++ /dev/null @@ -1,152 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["Healthcheck", "HTTPConfig", "TcpConfig"] - - -class HTTPConfig(BaseModel): - allow_insecure: Optional[bool] = None - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: Optional[str] = None - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. - """ - - expected_codes: Optional[List[str]] = None - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: Optional[bool] = None - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] = None - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. - """ - - method: Optional[Literal["GET", "HEAD"]] = None - """The HTTP method to use for the health check.""" - - path: Optional[str] = None - """The endpoint path to health check against.""" - - port: Optional[int] = None - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(BaseModel): - method: Optional[Literal["connection_established"]] = None - """The TCP connection method to use for the health check.""" - - port: Optional[int] = None - """Port number to connect to for the health check. Defaults to 80.""" - - -class Healthcheck(BaseModel): - id: Optional[str] = None - """Identifier""" - - address: Optional[str] = None - """The hostname or IP address of the origin server to run health checks on.""" - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] = None - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: Optional[int] = None - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: Optional[int] = None - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - created_on: Optional[datetime] = None - - description: Optional[str] = None - """A human-readable description of the health check.""" - - failure_reason: Optional[str] = None - """The current failure reason if status is unhealthy.""" - - http_config: Optional[HTTPConfig] = None - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: Optional[int] = None - """The interval between each health check. - - Shorter intervals may give quicker notifications if the origin status changes, - but will increase load on the origin as we check from multiple locations. - """ - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - retries: Optional[int] = None - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - status: Optional[Literal["unknown", "healthy", "unhealthy", "suspended"]] = None - """The current status of the origin server according to the health check.""" - - suspended: Optional[bool] = None - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] = None - """Parameters specific to TCP health check.""" - - timeout: Optional[int] = None - """The timeout (in seconds) before marking the health check as failed.""" - - type: Optional[str] = None - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ diff --git a/src/cloudflare/types/healthcheck_create_params.py b/src/cloudflare/types/healthcheck_create_params.py deleted file mode 100644 index 1c96c204d9f..00000000000 --- a/src/cloudflare/types/healthcheck_create_params.py +++ /dev/null @@ -1,143 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["HealthcheckCreateParams", "HTTPConfig", "TcpConfig"] - - -class HealthcheckCreateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - address: Required[str] - """The hostname or IP address of the origin server to run health checks on.""" - - name: Required[str] - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: int - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: int - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - description: str - """A human-readable description of the health check.""" - - http_config: Optional[HTTPConfig] - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: int - """The interval between each health check. - - Shorter intervals may give quicker notifications if the origin status changes, - but will increase load on the origin as we check from multiple locations. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - suspended: bool - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] - """Parameters specific to TCP health check.""" - - healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: str - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ - - -class HTTPConfig(TypedDict, total=False): - allow_insecure: bool - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. - """ - - expected_codes: Optional[List[str]] - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: bool - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. - """ - - method: Literal["GET", "HEAD"] - """The HTTP method to use for the health check.""" - - path: str - """The endpoint path to health check against.""" - - port: int - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(TypedDict, total=False): - method: Literal["connection_established"] - """The TCP connection method to use for the health check.""" - - port: int - """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthcheck_edit_params.py b/src/cloudflare/types/healthcheck_edit_params.py deleted file mode 100644 index f633b951f2b..00000000000 --- a/src/cloudflare/types/healthcheck_edit_params.py +++ /dev/null @@ -1,143 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["HealthcheckEditParams", "HTTPConfig", "TcpConfig"] - - -class HealthcheckEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - address: Required[str] - """The hostname or IP address of the origin server to run health checks on.""" - - name: Required[str] - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: int - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: int - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - description: str - """A human-readable description of the health check.""" - - http_config: Optional[HTTPConfig] - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: int - """The interval between each health check. - - Shorter intervals may give quicker notifications if the origin status changes, - but will increase load on the origin as we check from multiple locations. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - suspended: bool - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] - """Parameters specific to TCP health check.""" - - healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: str - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ - - -class HTTPConfig(TypedDict, total=False): - allow_insecure: bool - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. - """ - - expected_codes: Optional[List[str]] - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: bool - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. - """ - - method: Literal["GET", "HEAD"] - """The HTTP method to use for the health check.""" - - path: str - """The endpoint path to health check against.""" - - port: int - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(TypedDict, total=False): - method: Literal["connection_established"] - """The TCP connection method to use for the health check.""" - - port: int - """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthcheck_update_params.py b/src/cloudflare/types/healthcheck_update_params.py deleted file mode 100644 index e0f6b276d0a..00000000000 --- a/src/cloudflare/types/healthcheck_update_params.py +++ /dev/null @@ -1,143 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["HealthcheckUpdateParams", "HTTPConfig", "TcpConfig"] - - -class HealthcheckUpdateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - address: Required[str] - """The hostname or IP address of the origin server to run health checks on.""" - - name: Required[str] - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: int - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: int - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - description: str - """A human-readable description of the health check.""" - - http_config: Optional[HTTPConfig] - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: int - """The interval between each health check. - - Shorter intervals may give quicker notifications if the origin status changes, - but will increase load on the origin as we check from multiple locations. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - suspended: bool - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] - """Parameters specific to TCP health check.""" - - healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: str - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ - - -class HTTPConfig(TypedDict, total=False): - allow_insecure: bool - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. - """ - - expected_codes: Optional[List[str]] - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: bool - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. - """ - - method: Literal["GET", "HEAD"] - """The HTTP method to use for the health check.""" - - path: str - """The endpoint path to health check against.""" - - port: int - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(TypedDict, total=False): - method: Literal["connection_established"] - """The TCP connection method to use for the health check.""" - - port: int - """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthchecks/__init__.py b/src/cloudflare/types/healthchecks/__init__.py index 176d1de0dd3..c40061ff8bb 100644 --- a/src/cloudflare/types/healthchecks/__init__.py +++ b/src/cloudflare/types/healthchecks/__init__.py @@ -2,5 +2,18 @@ from __future__ import annotations +from .healthcheck import Healthcheck as Healthcheck +from .check_region import CheckRegion as CheckRegion +from .tcp_configuration import TCPConfiguration as TCPConfiguration +from .http_configuration import HTTPConfiguration as HTTPConfiguration from .preview_create_params import PreviewCreateParams as PreviewCreateParams +from .preview_delete_params import PreviewDeleteParams as PreviewDeleteParams +from .healthcheck_edit_params import HealthcheckEditParams as HealthcheckEditParams +from .healthcheck_list_params import HealthcheckListParams as HealthcheckListParams from .preview_delete_response import PreviewDeleteResponse as PreviewDeleteResponse +from .tcp_configuration_param import TCPConfigurationParam as TCPConfigurationParam +from .http_configuration_param import HTTPConfigurationParam as HTTPConfigurationParam +from .healthcheck_create_params import HealthcheckCreateParams as HealthcheckCreateParams +from .healthcheck_delete_params import HealthcheckDeleteParams as HealthcheckDeleteParams +from .healthcheck_update_params import HealthcheckUpdateParams as HealthcheckUpdateParams +from .healthcheck_delete_response import HealthcheckDeleteResponse as HealthcheckDeleteResponse diff --git a/src/cloudflare/types/healthchecks/check_region.py b/src/cloudflare/types/healthchecks/check_region.py new file mode 100644 index 00000000000..46b58dd4b75 --- /dev/null +++ b/src/cloudflare/types/healthchecks/check_region.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["CheckRegion"] + +CheckRegion = Literal[ + "WNAM", "ENAM", "WEU", "EEU", "NSAM", "SSAM", "OC", "ME", "NAF", "SAF", "IN", "SEAS", "NEAS", "ALL_REGIONS" +] diff --git a/src/cloudflare/types/healthchecks/healthcheck.py b/src/cloudflare/types/healthchecks/healthcheck.py new file mode 100644 index 00000000000..07d6bb0c505 --- /dev/null +++ b/src/cloudflare/types/healthchecks/healthcheck.py @@ -0,0 +1,88 @@ +# 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 +from .check_region import CheckRegion +from .tcp_configuration import TCPConfiguration +from .http_configuration import HTTPConfiguration + +__all__ = ["Healthcheck"] + + +class Healthcheck(BaseModel): + id: Optional[str] = None + """Identifier""" + + address: Optional[str] = None + """The hostname or IP address of the origin server to run health checks on.""" + + check_regions: Optional[List[CheckRegion]] = None + """A list of regions from which to run health checks. + + Null means Cloudflare will pick a default region. + """ + + consecutive_fails: Optional[int] = None + """ + The number of consecutive fails required from a health check before changing the + health to unhealthy. + """ + + consecutive_successes: Optional[int] = None + """ + The number of consecutive successes required from a health check before changing + the health to healthy. + """ + + created_on: Optional[datetime] = None + + description: Optional[str] = None + """A human-readable description of the health check.""" + + failure_reason: Optional[str] = None + """The current failure reason if status is unhealthy.""" + + http_config: Optional[HTTPConfiguration] = None + """Parameters specific to an HTTP or HTTPS health check.""" + + interval: Optional[int] = None + """The interval between each health check. + + Shorter intervals may give quicker notifications if the origin status changes, + but will increase load on the origin as we check from multiple locations. + """ + + modified_on: Optional[datetime] = None + + name: Optional[str] = None + """A short name to identify the health check. + + Only alphanumeric characters, hyphens and underscores are allowed. + """ + + retries: Optional[int] = None + """ + The number of retries to attempt in case of a timeout before marking the origin + as unhealthy. Retries are attempted immediately. + """ + + status: Optional[Literal["unknown", "healthy", "unhealthy", "suspended"]] = None + """The current status of the origin server according to the health check.""" + + suspended: Optional[bool] = None + """If suspended, no health checks are sent to the origin.""" + + tcp_config: Optional[TCPConfiguration] = None + """Parameters specific to TCP health check.""" + + timeout: Optional[int] = None + """The timeout (in seconds) before marking the health check as failed.""" + + type: Optional[str] = None + """The protocol to use for the health check. + + Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. + """ diff --git a/src/cloudflare/types/healthchecks/healthcheck_create_params.py b/src/cloudflare/types/healthchecks/healthcheck_create_params.py new file mode 100644 index 00000000000..90a2b01f73f --- /dev/null +++ b/src/cloudflare/types/healthchecks/healthcheck_create_params.py @@ -0,0 +1,79 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from .check_region import CheckRegion +from .tcp_configuration_param import TCPConfigurationParam +from .http_configuration_param import HTTPConfigurationParam + +__all__ = ["HealthcheckCreateParams"] + + +class HealthcheckCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + address: Required[str] + """The hostname or IP address of the origin server to run health checks on.""" + + name: Required[str] + """A short name to identify the health check. + + Only alphanumeric characters, hyphens and underscores are allowed. + """ + + check_regions: Optional[List[CheckRegion]] + """A list of regions from which to run health checks. + + Null means Cloudflare will pick a default region. + """ + + consecutive_fails: int + """ + The number of consecutive fails required from a health check before changing the + health to unhealthy. + """ + + consecutive_successes: int + """ + The number of consecutive successes required from a health check before changing + the health to healthy. + """ + + description: str + """A human-readable description of the health check.""" + + http_config: Optional[HTTPConfigurationParam] + """Parameters specific to an HTTP or HTTPS health check.""" + + interval: int + """The interval between each health check. + + Shorter intervals may give quicker notifications if the origin status changes, + but will increase load on the origin as we check from multiple locations. + """ + + retries: int + """ + The number of retries to attempt in case of a timeout before marking the origin + as unhealthy. Retries are attempted immediately. + """ + + suspended: bool + """If suspended, no health checks are sent to the origin.""" + + tcp_config: Optional[TCPConfigurationParam] + """Parameters specific to TCP health check.""" + + healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] + """The timeout (in seconds) before marking the health check as failed.""" + + type: str + """The protocol to use for the health check. + + Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. + """ diff --git a/src/cloudflare/types/healthchecks/healthcheck_delete_params.py b/src/cloudflare/types/healthchecks/healthcheck_delete_params.py new file mode 100644 index 00000000000..f5e2b2d458f --- /dev/null +++ b/src/cloudflare/types/healthchecks/healthcheck_delete_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__ = ["HealthcheckDeleteParams"] + + +class HealthcheckDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/healthcheck_delete_response.py b/src/cloudflare/types/healthchecks/healthcheck_delete_response.py similarity index 88% rename from src/cloudflare/types/healthcheck_delete_response.py rename to src/cloudflare/types/healthchecks/healthcheck_delete_response.py index 6bbe40c8819..adcd26dd9dc 100644 --- a/src/cloudflare/types/healthcheck_delete_response.py +++ b/src/cloudflare/types/healthchecks/healthcheck_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["HealthcheckDeleteResponse"] diff --git a/src/cloudflare/types/healthchecks/healthcheck_edit_params.py b/src/cloudflare/types/healthchecks/healthcheck_edit_params.py new file mode 100644 index 00000000000..605ca984c32 --- /dev/null +++ b/src/cloudflare/types/healthchecks/healthcheck_edit_params.py @@ -0,0 +1,79 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from .check_region import CheckRegion +from .tcp_configuration_param import TCPConfigurationParam +from .http_configuration_param import HTTPConfigurationParam + +__all__ = ["HealthcheckEditParams"] + + +class HealthcheckEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + address: Required[str] + """The hostname or IP address of the origin server to run health checks on.""" + + name: Required[str] + """A short name to identify the health check. + + Only alphanumeric characters, hyphens and underscores are allowed. + """ + + check_regions: Optional[List[CheckRegion]] + """A list of regions from which to run health checks. + + Null means Cloudflare will pick a default region. + """ + + consecutive_fails: int + """ + The number of consecutive fails required from a health check before changing the + health to unhealthy. + """ + + consecutive_successes: int + """ + The number of consecutive successes required from a health check before changing + the health to healthy. + """ + + description: str + """A human-readable description of the health check.""" + + http_config: Optional[HTTPConfigurationParam] + """Parameters specific to an HTTP or HTTPS health check.""" + + interval: int + """The interval between each health check. + + Shorter intervals may give quicker notifications if the origin status changes, + but will increase load on the origin as we check from multiple locations. + """ + + retries: int + """ + The number of retries to attempt in case of a timeout before marking the origin + as unhealthy. Retries are attempted immediately. + """ + + suspended: bool + """If suspended, no health checks are sent to the origin.""" + + tcp_config: Optional[TCPConfigurationParam] + """Parameters specific to TCP health check.""" + + healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] + """The timeout (in seconds) before marking the health check as failed.""" + + type: str + """The protocol to use for the health check. + + Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. + """ diff --git a/src/cloudflare/types/healthchecks/healthcheck_list_params.py b/src/cloudflare/types/healthchecks/healthcheck_list_params.py new file mode 100644 index 00000000000..a2d33808065 --- /dev/null +++ b/src/cloudflare/types/healthchecks/healthcheck_list_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["HealthcheckListParams"] + + +class HealthcheckListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + page: object + """Page number of paginated results.""" + + per_page: object + """Maximum number of results per page. Must be a multiple of 5.""" diff --git a/src/cloudflare/types/healthchecks/healthcheck_update_params.py b/src/cloudflare/types/healthchecks/healthcheck_update_params.py new file mode 100644 index 00000000000..834571fde52 --- /dev/null +++ b/src/cloudflare/types/healthchecks/healthcheck_update_params.py @@ -0,0 +1,79 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from .check_region import CheckRegion +from .tcp_configuration_param import TCPConfigurationParam +from .http_configuration_param import HTTPConfigurationParam + +__all__ = ["HealthcheckUpdateParams"] + + +class HealthcheckUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + address: Required[str] + """The hostname or IP address of the origin server to run health checks on.""" + + name: Required[str] + """A short name to identify the health check. + + Only alphanumeric characters, hyphens and underscores are allowed. + """ + + check_regions: Optional[List[CheckRegion]] + """A list of regions from which to run health checks. + + Null means Cloudflare will pick a default region. + """ + + consecutive_fails: int + """ + The number of consecutive fails required from a health check before changing the + health to unhealthy. + """ + + consecutive_successes: int + """ + The number of consecutive successes required from a health check before changing + the health to healthy. + """ + + description: str + """A human-readable description of the health check.""" + + http_config: Optional[HTTPConfigurationParam] + """Parameters specific to an HTTP or HTTPS health check.""" + + interval: int + """The interval between each health check. + + Shorter intervals may give quicker notifications if the origin status changes, + but will increase load on the origin as we check from multiple locations. + """ + + retries: int + """ + The number of retries to attempt in case of a timeout before marking the origin + as unhealthy. Retries are attempted immediately. + """ + + suspended: bool + """If suspended, no health checks are sent to the origin.""" + + tcp_config: Optional[TCPConfigurationParam] + """Parameters specific to TCP health check.""" + + healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] + """The timeout (in seconds) before marking the health check as failed.""" + + type: str + """The protocol to use for the health check. + + Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. + """ diff --git a/src/cloudflare/types/healthchecks/http_configuration.py b/src/cloudflare/types/healthchecks/http_configuration.py new file mode 100644 index 00000000000..e7816f99ec0 --- /dev/null +++ b/src/cloudflare/types/healthchecks/http_configuration.py @@ -0,0 +1,48 @@ +# 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__ = ["HTTPConfiguration"] + + +class HTTPConfiguration(BaseModel): + allow_insecure: Optional[bool] = None + """Do not validate the certificate when the health check uses HTTPS.""" + + expected_body: Optional[str] = None + """A case-insensitive sub-string to look for in the response body. + + If this string is not found, the origin will be marked as unhealthy. + """ + + expected_codes: Optional[List[str]] = None + """The expected HTTP response codes (e.g. + + "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health + check. + """ + + follow_redirects: Optional[bool] = None + """Follow redirects if the origin returns a 3xx status code.""" + + header: Optional[object] = None + """The HTTP request headers to send in the health check. + + It is recommended you set a Host header by default. The User-Agent header cannot + be overridden. + """ + + method: Optional[Literal["GET", "HEAD"]] = None + """The HTTP method to use for the health check.""" + + path: Optional[str] = None + """The endpoint path to health check against.""" + + port: Optional[int] = None + """Port number to connect to for the health check. + + Defaults to 80 if type is HTTP or 443 if type is HTTPS. + """ diff --git a/src/cloudflare/types/healthchecks/http_configuration_param.py b/src/cloudflare/types/healthchecks/http_configuration_param.py new file mode 100644 index 00000000000..1b97f2f53c5 --- /dev/null +++ b/src/cloudflare/types/healthchecks/http_configuration_param.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["HTTPConfigurationParam"] + + +class HTTPConfigurationParam(TypedDict, total=False): + allow_insecure: bool + """Do not validate the certificate when the health check uses HTTPS.""" + + expected_body: str + """A case-insensitive sub-string to look for in the response body. + + If this string is not found, the origin will be marked as unhealthy. + """ + + expected_codes: Optional[List[str]] + """The expected HTTP response codes (e.g. + + "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health + check. + """ + + follow_redirects: bool + """Follow redirects if the origin returns a 3xx status code.""" + + header: Optional[object] + """The HTTP request headers to send in the health check. + + It is recommended you set a Host header by default. The User-Agent header cannot + be overridden. + """ + + method: Literal["GET", "HEAD"] + """The HTTP method to use for the health check.""" + + path: str + """The endpoint path to health check against.""" + + port: int + """Port number to connect to for the health check. + + Defaults to 80 if type is HTTP or 443 if type is HTTPS. + """ diff --git a/src/cloudflare/types/healthchecks/preview_create_params.py b/src/cloudflare/types/healthchecks/preview_create_params.py index a37fce3f2a0..8020a44e035 100644 --- a/src/cloudflare/types/healthchecks/preview_create_params.py +++ b/src/cloudflare/types/healthchecks/preview_create_params.py @@ -3,11 +3,14 @@ from __future__ import annotations from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo +from .check_region import CheckRegion +from .tcp_configuration_param import TCPConfigurationParam +from .http_configuration_param import HTTPConfigurationParam -__all__ = ["PreviewCreateParams", "HTTPConfig", "TcpConfig"] +__all__ = ["PreviewCreateParams"] class PreviewCreateParams(TypedDict, total=False): @@ -23,26 +26,7 @@ class PreviewCreateParams(TypedDict, total=False): Only alphanumeric characters, hyphens and underscores are allowed. """ - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] + check_regions: Optional[List[CheckRegion]] """A list of regions from which to run health checks. Null means Cloudflare will pick a default region. @@ -63,7 +47,7 @@ class PreviewCreateParams(TypedDict, total=False): description: str """A human-readable description of the health check.""" - http_config: Optional[HTTPConfig] + http_config: Optional[HTTPConfigurationParam] """Parameters specific to an HTTP or HTTPS health check.""" interval: int @@ -82,7 +66,7 @@ class PreviewCreateParams(TypedDict, total=False): suspended: bool """If suspended, no health checks are sent to the origin.""" - tcp_config: Optional[TcpConfig] + tcp_config: Optional[TCPConfigurationParam] """Parameters specific to TCP health check.""" healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] @@ -93,51 +77,3 @@ class PreviewCreateParams(TypedDict, total=False): Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. """ - - -class HTTPConfig(TypedDict, total=False): - allow_insecure: bool - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. - """ - - expected_codes: Optional[List[str]] - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: bool - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. - """ - - method: Literal["GET", "HEAD"] - """The HTTP method to use for the health check.""" - - path: str - """The endpoint path to health check against.""" - - port: int - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(TypedDict, total=False): - method: Literal["connection_established"] - """The TCP connection method to use for the health check.""" - - port: int - """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthchecks/preview_delete_params.py b/src/cloudflare/types/healthchecks/preview_delete_params.py new file mode 100644 index 00000000000..0c0c7c54e29 --- /dev/null +++ b/src/cloudflare/types/healthchecks/preview_delete_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__ = ["PreviewDeleteParams"] + + +class PreviewDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/healthchecks/tcp_configuration.py b/src/cloudflare/types/healthchecks/tcp_configuration.py new file mode 100644 index 00000000000..f654cccf8f9 --- /dev/null +++ b/src/cloudflare/types/healthchecks/tcp_configuration.py @@ -0,0 +1,16 @@ +# 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__ = ["TCPConfiguration"] + + +class TCPConfiguration(BaseModel): + method: Optional[Literal["connection_established"]] = None + """The TCP connection method to use for the health check.""" + + port: Optional[int] = None + """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthchecks/tcp_configuration_param.py b/src/cloudflare/types/healthchecks/tcp_configuration_param.py new file mode 100644 index 00000000000..edbb9a4cf5d --- /dev/null +++ b/src/cloudflare/types/healthchecks/tcp_configuration_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["TCPConfigurationParam"] + + +class TCPConfigurationParam(TypedDict, total=False): + method: Literal["connection_established"] + """The TCP connection method to use for the health check.""" + + port: int + """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/hostnames/settings/__init__.py b/src/cloudflare/types/hostnames/settings/__init__.py index d4d13ab9044..4c89b63f5be 100644 --- a/src/cloudflare/types/hostnames/settings/__init__.py +++ b/src/cloudflare/types/hostnames/settings/__init__.py @@ -2,7 +2,9 @@ from __future__ import annotations -from .hostname_stting import HostnameStting as HostnameStting +from .setting import Setting as Setting +from .setting_value import SettingValue as SettingValue from .tls_get_response import TLSGetResponse as TLSGetResponse from .tls_update_params import TLSUpdateParams as TLSUpdateParams -from .hostname_setting_delete import HostnameSettingDelete as HostnameSettingDelete +from .setting_value_param import SettingValueParam as SettingValueParam +from .tls_delete_response import TLSDeleteResponse as TLSDeleteResponse diff --git a/src/cloudflare/types/hostnames/settings/hostname_setting_delete.py b/src/cloudflare/types/hostnames/settings/hostname_setting_delete.py deleted file mode 100644 index 5991fe4d96f..00000000000 --- a/src/cloudflare/types/hostnames/settings/hostname_setting_delete.py +++ /dev/null @@ -1,23 +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__ = ["HostnameSettingDelete"] - - -class HostnameSettingDelete(BaseModel): - created_at: Optional[datetime] = None - """This is the time the tls setting was originally created for this hostname.""" - - hostname: Optional[str] = None - """The hostname for which the tls settings are set.""" - - status: Optional[str] = None - - updated_at: Optional[datetime] = None - """This is the time the tls setting was updated.""" - - value: Optional[str] = None diff --git a/src/cloudflare/types/hostnames/settings/hostname_stting.py b/src/cloudflare/types/hostnames/settings/hostname_stting.py deleted file mode 100644 index 31d6932795e..00000000000 --- a/src/cloudflare/types/hostnames/settings/hostname_stting.py +++ /dev/null @@ -1,25 +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 ...._models import BaseModel - -__all__ = ["HostnameStting"] - - -class HostnameStting(BaseModel): - created_at: Optional[datetime] = None - """This is the time the tls setting was originally created for this hostname.""" - - hostname: Optional[str] = None - """The hostname for which the tls settings are set.""" - - status: Optional[str] = None - """Deployment status for the given tls setting.""" - - updated_at: Optional[datetime] = None - """This is the time the tls setting was updated.""" - - value: Union[float, str, List[str], None] = None - """The tls setting value.""" diff --git a/src/cloudflare/types/hostnames/settings/setting.py b/src/cloudflare/types/hostnames/settings/setting.py new file mode 100644 index 00000000000..78d63b0d6b4 --- /dev/null +++ b/src/cloudflare/types/hostnames/settings/setting.py @@ -0,0 +1,26 @@ +# 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 +from .setting_value import SettingValue + +__all__ = ["Setting"] + + +class Setting(BaseModel): + created_at: Optional[datetime] = None + """This is the time the tls setting was originally created for this hostname.""" + + hostname: Optional[str] = None + """The hostname for which the tls settings are set.""" + + status: Optional[str] = None + """Deployment status for the given tls setting.""" + + updated_at: Optional[datetime] = None + """This is the time the tls setting was updated.""" + + value: Optional[SettingValue] = None + """The tls setting value.""" diff --git a/src/cloudflare/types/hostnames/settings/setting_value.py b/src/cloudflare/types/hostnames/settings/setting_value.py new file mode 100644 index 00000000000..89a5a79dc56 --- /dev/null +++ b/src/cloudflare/types/hostnames/settings/setting_value.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union + +__all__ = ["SettingValue"] + +SettingValue = Union[float, str, List[str]] diff --git a/src/cloudflare/types/hostnames/settings/setting_value_param.py b/src/cloudflare/types/hostnames/settings/setting_value_param.py new file mode 100644 index 00000000000..cebf4d70d9b --- /dev/null +++ b/src/cloudflare/types/hostnames/settings/setting_value_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union + +__all__ = ["SettingValueParam"] + +SettingValueParam = Union[float, str, List[str]] diff --git a/src/cloudflare/types/hostnames/settings/tls_delete_response.py b/src/cloudflare/types/hostnames/settings/tls_delete_response.py new file mode 100644 index 00000000000..b59537ed954 --- /dev/null +++ b/src/cloudflare/types/hostnames/settings/tls_delete_response.py @@ -0,0 +1,23 @@ +# 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__ = ["TLSDeleteResponse"] + + +class TLSDeleteResponse(BaseModel): + created_at: Optional[datetime] = None + """This is the time the tls setting was originally created for this hostname.""" + + hostname: Optional[str] = None + """The hostname for which the tls settings are set.""" + + status: Optional[str] = None + + updated_at: Optional[datetime] = None + """This is the time the tls setting was updated.""" + + value: Optional[str] = None diff --git a/src/cloudflare/types/hostnames/settings/tls_get_response.py b/src/cloudflare/types/hostnames/settings/tls_get_response.py index 69e61d6d8ac..3a8e780e9d0 100644 --- a/src/cloudflare/types/hostnames/settings/tls_get_response.py +++ b/src/cloudflare/types/hostnames/settings/tls_get_response.py @@ -1,9 +1,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime from ...._models import BaseModel +from .setting_value import SettingValue __all__ = ["TLSGetResponse", "TLSGetResponseItem"] @@ -21,7 +22,7 @@ class TLSGetResponseItem(BaseModel): updated_at: Optional[datetime] = None """This is the time the tls setting was updated.""" - value: Union[float, str, List[str], None] = None + value: Optional[SettingValue] = None """The tls setting value.""" diff --git a/src/cloudflare/types/hostnames/settings/tls_update_params.py b/src/cloudflare/types/hostnames/settings/tls_update_params.py index c3c7563a3a9..d24e3bea217 100644 --- a/src/cloudflare/types/hostnames/settings/tls_update_params.py +++ b/src/cloudflare/types/hostnames/settings/tls_update_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List, Union from typing_extensions import Literal, Required, TypedDict +from .setting_value_param import SettingValueParam + __all__ = ["TLSUpdateParams"] @@ -15,5 +16,5 @@ class TLSUpdateParams(TypedDict, total=False): setting_id: Required[Literal["ciphers", "min_tls_version", "http2"]] """The TLS Setting name.""" - value: Required[Union[float, str, List[str]]] + value: Required[SettingValueParam] """The tls setting value.""" diff --git a/src/cloudflare/types/hyperdrive/__init__.py b/src/cloudflare/types/hyperdrive/__init__.py index 0891cd295ba..db97c2c8547 100644 --- a/src/cloudflare/types/hyperdrive/__init__.py +++ b/src/cloudflare/types/hyperdrive/__init__.py @@ -3,12 +3,9 @@ from __future__ import annotations from .hyperdrive import Hyperdrive as Hyperdrive +from .configuration import Configuration as Configuration from .config_edit_params import ConfigEditParams as ConfigEditParams -from .config_get_response import ConfigGetResponse as ConfigGetResponse +from .configuration_param import ConfigurationParam as ConfigurationParam from .config_create_params import ConfigCreateParams as ConfigCreateParams -from .config_edit_response import ConfigEditResponse as ConfigEditResponse -from .config_list_response import ConfigListResponse as ConfigListResponse from .config_update_params import ConfigUpdateParams as ConfigUpdateParams -from .config_create_response import ConfigCreateResponse as ConfigCreateResponse from .config_delete_response import ConfigDeleteResponse as ConfigDeleteResponse -from .config_update_response import ConfigUpdateResponse as ConfigUpdateResponse diff --git a/src/cloudflare/types/hyperdrive/config_create_params.py b/src/cloudflare/types/hyperdrive/config_create_params.py index 2f76e489961..f75ec02aafd 100644 --- a/src/cloudflare/types/hyperdrive/config_create_params.py +++ b/src/cloudflare/types/hyperdrive/config_create_params.py @@ -4,19 +4,35 @@ from typing_extensions import Required, TypedDict -__all__ = ["ConfigCreateParams", "Origin"] +from .configuration_param import ConfigurationParam + +__all__ = ["ConfigCreateParams", "Caching"] class ConfigCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - origin: Required[Origin] + name: Required[str] + + origin: Required[ConfigurationParam] + + caching: Caching + +class Caching(TypedDict, total=False): + disabled: bool + """When set to true, disables the caching of SQL responses. (Default: false)""" -class Origin(TypedDict, total=False): - password: Required[str] - """The password required to access your origin database. + max_age: int + """When present, specifies max duration for which items should persist in the + cache. - This value is write-only and never returned by the API. + (Default: 60) + """ + + stale_while_revalidate: int + """ + When present, indicates the number of seconds cache may serve the response after + it becomes stale. (Default: 15) """ diff --git a/src/cloudflare/types/hyperdrive/config_create_response.py b/src/cloudflare/types/hyperdrive/config_create_response.py deleted file mode 100644 index 8409b436a8b..00000000000 --- a/src/cloudflare/types/hyperdrive/config_create_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["ConfigCreateResponse"] - - -class ConfigCreateResponse(BaseModel): - id: Optional[str] = None - """Identifier""" diff --git a/src/cloudflare/types/hyperdrive/config_delete_response.py b/src/cloudflare/types/hyperdrive/config_delete_response.py index e0da387119b..be480da8945 100644 --- a/src/cloudflare/types/hyperdrive/config_delete_response.py +++ b/src/cloudflare/types/hyperdrive/config_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["ConfigDeleteResponse"] -ConfigDeleteResponse = Union[str, object, None] +ConfigDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/hyperdrive/config_edit_params.py b/src/cloudflare/types/hyperdrive/config_edit_params.py index 1fb0ab38a87..6e63828615c 100644 --- a/src/cloudflare/types/hyperdrive/config_edit_params.py +++ b/src/cloudflare/types/hyperdrive/config_edit_params.py @@ -4,19 +4,35 @@ from typing_extensions import Required, TypedDict -__all__ = ["ConfigEditParams", "Origin"] +from .configuration_param import ConfigurationParam + +__all__ = ["ConfigEditParams", "Caching"] class ConfigEditParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - origin: Origin + caching: Caching + + name: str + + origin: ConfigurationParam + +class Caching(TypedDict, total=False): + disabled: bool + """When set to true, disables the caching of SQL responses. (Default: false)""" -class Origin(TypedDict, total=False): - password: Required[str] - """The password required to access your origin database. + max_age: int + """When present, specifies max duration for which items should persist in the + cache. - This value is write-only and never returned by the API. + (Default: 60) + """ + + stale_while_revalidate: int + """ + When present, indicates the number of seconds cache may serve the response after + it becomes stale. (Default: 15) """ diff --git a/src/cloudflare/types/hyperdrive/config_edit_response.py b/src/cloudflare/types/hyperdrive/config_edit_response.py deleted file mode 100644 index 7a226e1c000..00000000000 --- a/src/cloudflare/types/hyperdrive/config_edit_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["ConfigEditResponse"] - - -class ConfigEditResponse(BaseModel): - id: Optional[str] = None - """Identifier""" diff --git a/src/cloudflare/types/hyperdrive/config_get_response.py b/src/cloudflare/types/hyperdrive/config_get_response.py deleted file mode 100644 index 1710b571915..00000000000 --- a/src/cloudflare/types/hyperdrive/config_get_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["ConfigGetResponse"] - - -class ConfigGetResponse(BaseModel): - id: Optional[str] = None - """Identifier""" diff --git a/src/cloudflare/types/hyperdrive/config_list_response.py b/src/cloudflare/types/hyperdrive/config_list_response.py deleted file mode 100644 index 7721424cc22..00000000000 --- a/src/cloudflare/types/hyperdrive/config_list_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["ConfigListResponse"] - - -class ConfigListResponse(BaseModel): - id: Optional[str] = None - """Identifier""" diff --git a/src/cloudflare/types/hyperdrive/config_update_params.py b/src/cloudflare/types/hyperdrive/config_update_params.py index 9e419b56540..451436b383d 100644 --- a/src/cloudflare/types/hyperdrive/config_update_params.py +++ b/src/cloudflare/types/hyperdrive/config_update_params.py @@ -4,19 +4,35 @@ from typing_extensions import Required, TypedDict -__all__ = ["ConfigUpdateParams", "Origin"] +from .configuration_param import ConfigurationParam + +__all__ = ["ConfigUpdateParams", "Caching"] class ConfigUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - origin: Required[Origin] + name: Required[str] + + origin: Required[ConfigurationParam] + + caching: Caching + +class Caching(TypedDict, total=False): + disabled: bool + """When set to true, disables the caching of SQL responses. (Default: false)""" -class Origin(TypedDict, total=False): - password: Required[str] - """The password required to access your origin database. + max_age: int + """When present, specifies max duration for which items should persist in the + cache. - This value is write-only and never returned by the API. + (Default: 60) + """ + + stale_while_revalidate: int + """ + When present, indicates the number of seconds cache may serve the response after + it becomes stale. (Default: 15) """ diff --git a/src/cloudflare/types/hyperdrive/config_update_response.py b/src/cloudflare/types/hyperdrive/config_update_response.py deleted file mode 100644 index 9d542f87178..00000000000 --- a/src/cloudflare/types/hyperdrive/config_update_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["ConfigUpdateResponse"] - - -class ConfigUpdateResponse(BaseModel): - id: Optional[str] = None - """Identifier""" diff --git a/src/cloudflare/types/hyperdrive/configuration.py b/src/cloudflare/types/hyperdrive/configuration.py new file mode 100644 index 00000000000..68c745a34de --- /dev/null +++ b/src/cloudflare/types/hyperdrive/configuration.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Configuration"] + + +class Configuration(BaseModel): + database: str + """The name of your origin database.""" + + host: str + """The host (hostname or IP) of your origin database.""" + + port: int + """The port (default: 5432 for Postgres) of your origin database.""" + + scheme: Literal["postgres", "postgresql", "mysql"] + """Specifies the URL scheme used to connect to your origin database.""" + + user: str + """The user of your origin database.""" diff --git a/src/cloudflare/types/hyperdrive/configuration_param.py b/src/cloudflare/types/hyperdrive/configuration_param.py new file mode 100644 index 00000000000..02bca1d6527 --- /dev/null +++ b/src/cloudflare/types/hyperdrive/configuration_param.py @@ -0,0 +1,24 @@ +# 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__ = ["ConfigurationParam"] + + +class ConfigurationParam(TypedDict, total=False): + database: Required[str] + """The name of your origin database.""" + + host: Required[str] + """The host (hostname or IP) of your origin database.""" + + port: Required[int] + """The port (default: 5432 for Postgres) of your origin database.""" + + scheme: Required[Literal["postgres", "postgresql", "mysql"]] + """Specifies the URL scheme used to connect to your origin database.""" + + user: Required[str] + """The user of your origin database.""" diff --git a/src/cloudflare/types/hyperdrive/hyperdrive.py b/src/cloudflare/types/hyperdrive/hyperdrive.py index 320e9948ce3..70822832c29 100644 --- a/src/cloudflare/types/hyperdrive/hyperdrive.py +++ b/src/cloudflare/types/hyperdrive/hyperdrive.py @@ -3,10 +3,32 @@ from typing import Optional from ..._models import BaseModel +from .configuration import Configuration -__all__ = ["Hyperdrive"] +__all__ = ["Hyperdrive", "Caching"] + + +class Caching(BaseModel): + disabled: Optional[bool] = None + """When set to true, disables the caching of SQL responses. (Default: false)""" + + max_age: Optional[int] = None + """When present, specifies max duration for which items should persist in the + cache. + + (Default: 60) + """ + + stale_while_revalidate: Optional[int] = None + """ + When present, indicates the number of seconds cache may serve the response after + it becomes stale. (Default: 15) + """ class Hyperdrive(BaseModel): - id: Optional[str] = None - """Identifier""" + caching: Optional[Caching] = None + + name: Optional[str] = None + + origin: Optional[Configuration] = None diff --git a/src/cloudflare/types/images/__init__.py b/src/cloudflare/types/images/__init__.py index 82bb5061aac..30dfb30e782 100644 --- a/src/cloudflare/types/images/__init__.py +++ b/src/cloudflare/types/images/__init__.py @@ -7,6 +7,7 @@ from .v1_list_params import V1ListParams as V1ListParams from .v2_list_params import V2ListParams as V2ListParams from .v1_create_params import V1CreateParams as V1CreateParams +from .v1_delete_params import V1DeleteParams as V1DeleteParams from .v1_list_response import V1ListResponse as V1ListResponse from .v2_list_response import V2ListResponse as V2ListResponse from .v1_delete_response import V1DeleteResponse as V1DeleteResponse diff --git a/src/cloudflare/types/images/v1/__init__.py b/src/cloudflare/types/images/v1/__init__.py index 88b88af4175..9728296b698 100644 --- a/src/cloudflare/types/images/v1/__init__.py +++ b/src/cloudflare/types/images/v1/__init__.py @@ -2,10 +2,16 @@ from __future__ import annotations -from .v1_image_variant import V1ImageVariant as V1ImageVariant -from .images_image_keys import ImagesImageKeys as ImagesImageKeys -from .v1_image_variants import V1ImageVariants as V1ImageVariants -from .images_images_stats import ImagesImagesStats as ImagesImagesStats +from .key import Key as Key +from .stat import Stat as Stat +from .variant import Variant as Variant +from .key_list_response import KeyListResponse as KeyListResponse +from .key_delete_response import KeyDeleteResponse as KeyDeleteResponse +from .key_update_response import KeyUpdateResponse as KeyUpdateResponse from .variant_edit_params import VariantEditParams as VariantEditParams +from .variant_get_response import VariantGetResponse as VariantGetResponse from .variant_create_params import VariantCreateParams as VariantCreateParams +from .variant_delete_params import VariantDeleteParams as VariantDeleteParams +from .variant_edit_response import VariantEditResponse as VariantEditResponse +from .variant_create_response import VariantCreateResponse as VariantCreateResponse from .variant_delete_response import VariantDeleteResponse as VariantDeleteResponse diff --git a/src/cloudflare/types/images/v1/images_image_keys.py b/src/cloudflare/types/images/v1/images_image_keys.py deleted file mode 100644 index 835cab41a42..00000000000 --- a/src/cloudflare/types/images/v1/images_image_keys.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["ImagesImageKeys", "Key"] - - -class Key(BaseModel): - name: Optional[str] = None - """Key name.""" - - value: Optional[str] = None - """Key value.""" - - -class ImagesImageKeys(BaseModel): - keys: Optional[List[Key]] = None diff --git a/src/cloudflare/types/images/v1/images_images_stats.py b/src/cloudflare/types/images/v1/images_images_stats.py deleted file mode 100644 index f6733a931cd..00000000000 --- a/src/cloudflare/types/images/v1/images_images_stats.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 ...._models import BaseModel - -__all__ = ["ImagesImagesStats", "Count"] - - -class Count(BaseModel): - allowed: Optional[float] = None - """Cloudflare Images allowed usage.""" - - current: Optional[float] = None - """Cloudflare Images current usage.""" - - -class ImagesImagesStats(BaseModel): - count: Optional[Count] = None diff --git a/src/cloudflare/types/images/v1/key.py b/src/cloudflare/types/images/v1/key.py new file mode 100644 index 00000000000..a0f292f8f0d --- /dev/null +++ b/src/cloudflare/types/images/v1/key.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__ = ["Key"] + + +class Key(BaseModel): + name: Optional[str] = None + """Key name.""" + + value: Optional[str] = None + """Key value.""" diff --git a/src/cloudflare/types/images/v1/key_delete_response.py b/src/cloudflare/types/images/v1/key_delete_response.py new file mode 100644 index 00000000000..c66b99b21c6 --- /dev/null +++ b/src/cloudflare/types/images/v1/key_delete_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .key import Key +from ...._models import BaseModel + +__all__ = ["KeyDeleteResponse"] + + +class KeyDeleteResponse(BaseModel): + keys: Optional[List[Key]] = None diff --git a/src/cloudflare/types/images/v1/key_list_response.py b/src/cloudflare/types/images/v1/key_list_response.py new file mode 100644 index 00000000000..c8a01832b0c --- /dev/null +++ b/src/cloudflare/types/images/v1/key_list_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .key import Key +from ...._models import BaseModel + +__all__ = ["KeyListResponse"] + + +class KeyListResponse(BaseModel): + keys: Optional[List[Key]] = None diff --git a/src/cloudflare/types/images/v1/key_update_response.py b/src/cloudflare/types/images/v1/key_update_response.py new file mode 100644 index 00000000000..afca97ac7e2 --- /dev/null +++ b/src/cloudflare/types/images/v1/key_update_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .key import Key +from ...._models import BaseModel + +__all__ = ["KeyUpdateResponse"] + + +class KeyUpdateResponse(BaseModel): + keys: Optional[List[Key]] = None diff --git a/src/cloudflare/types/images/v1/stat.py b/src/cloudflare/types/images/v1/stat.py new file mode 100644 index 00000000000..71ae800bb98 --- /dev/null +++ b/src/cloudflare/types/images/v1/stat.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["Stat", "Count"] + + +class Count(BaseModel): + allowed: Optional[float] = None + """Cloudflare Images allowed usage.""" + + current: Optional[float] = None + """Cloudflare Images current usage.""" + + +class Stat(BaseModel): + count: Optional[Count] = None diff --git a/src/cloudflare/types/images/v1/v1_image_variant.py b/src/cloudflare/types/images/v1/v1_image_variant.py deleted file mode 100644 index adcbc3dd87d..00000000000 --- a/src/cloudflare/types/images/v1/v1_image_variant.py +++ /dev/null @@ -1,44 +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 pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["V1ImageVariant", "Variant", "VariantOptions"] - - -class VariantOptions(BaseModel): - fit: Literal["scale-down", "contain", "cover", "crop", "pad"] - """ - The fit property describes how the width and height dimensions should be - interpreted. - """ - - height: float - """Maximum height in image pixels.""" - - metadata: Literal["keep", "copyright", "none"] - """What EXIF data should be preserved in the output image.""" - - width: float - """Maximum width in image pixels.""" - - -class Variant(BaseModel): - id: str - - options: VariantOptions - """Allows you to define image resizing sizes for different use cases.""" - - never_require_signed_urls: Optional[bool] = FieldInfo(alias="neverRequireSignedURLs", default=None) - """ - Indicates whether the variant can access an image without a signature, - regardless of image access control. - """ - - -class V1ImageVariant(BaseModel): - variant: Optional[Variant] = None diff --git a/src/cloudflare/types/images/v1/v1_image_variants.py b/src/cloudflare/types/images/v1/v1_image_variants.py deleted file mode 100644 index 6d19fc03cf9..00000000000 --- a/src/cloudflare/types/images/v1/v1_image_variants.py +++ /dev/null @@ -1,48 +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 pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["V1ImageVariants", "Variants", "VariantsHero", "VariantsHeroOptions"] - - -class VariantsHeroOptions(BaseModel): - fit: Literal["scale-down", "contain", "cover", "crop", "pad"] - """ - The fit property describes how the width and height dimensions should be - interpreted. - """ - - height: float - """Maximum height in image pixels.""" - - metadata: Literal["keep", "copyright", "none"] - """What EXIF data should be preserved in the output image.""" - - width: float - """Maximum width in image pixels.""" - - -class VariantsHero(BaseModel): - id: str - - options: VariantsHeroOptions - """Allows you to define image resizing sizes for different use cases.""" - - never_require_signed_urls: Optional[bool] = FieldInfo(alias="neverRequireSignedURLs", default=None) - """ - Indicates whether the variant can access an image without a signature, - regardless of image access control. - """ - - -class Variants(BaseModel): - hero: Optional[VariantsHero] = None - - -class V1ImageVariants(BaseModel): - variants: Optional[Variants] = None diff --git a/src/cloudflare/types/images/v1/variant.py b/src/cloudflare/types/images/v1/variant.py new file mode 100644 index 00000000000..c2796655888 --- /dev/null +++ b/src/cloudflare/types/images/v1/variant.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["Variant", "Variants", "VariantsHero", "VariantsHeroOptions"] + + +class VariantsHeroOptions(BaseModel): + fit: Literal["scale-down", "contain", "cover", "crop", "pad"] + """ + The fit property describes how the width and height dimensions should be + interpreted. + """ + + height: float + """Maximum height in image pixels.""" + + metadata: Literal["keep", "copyright", "none"] + """What EXIF data should be preserved in the output image.""" + + width: float + """Maximum width in image pixels.""" + + +class VariantsHero(BaseModel): + id: str + + options: VariantsHeroOptions + """Allows you to define image resizing sizes for different use cases.""" + + never_require_signed_urls: Optional[bool] = FieldInfo(alias="neverRequireSignedURLs", default=None) + """ + Indicates whether the variant can access an image without a signature, + regardless of image access control. + """ + + +class Variants(BaseModel): + hero: Optional[VariantsHero] = None + + +class Variant(BaseModel): + variants: Optional[Variants] = None diff --git a/src/cloudflare/types/images/v1/variant_create_response.py b/src/cloudflare/types/images/v1/variant_create_response.py new file mode 100644 index 00000000000..723ef2b90f6 --- /dev/null +++ b/src/cloudflare/types/images/v1/variant_create_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["VariantCreateResponse", "Variant", "VariantOptions"] + + +class VariantOptions(BaseModel): + fit: Literal["scale-down", "contain", "cover", "crop", "pad"] + """ + The fit property describes how the width and height dimensions should be + interpreted. + """ + + height: float + """Maximum height in image pixels.""" + + metadata: Literal["keep", "copyright", "none"] + """What EXIF data should be preserved in the output image.""" + + width: float + """Maximum width in image pixels.""" + + +class Variant(BaseModel): + id: str + + options: VariantOptions + """Allows you to define image resizing sizes for different use cases.""" + + never_require_signed_urls: Optional[bool] = FieldInfo(alias="neverRequireSignedURLs", default=None) + """ + Indicates whether the variant can access an image without a signature, + regardless of image access control. + """ + + +class VariantCreateResponse(BaseModel): + variant: Optional[Variant] = None diff --git a/src/cloudflare/types/images/v1/variant_delete_params.py b/src/cloudflare/types/images/v1/variant_delete_params.py new file mode 100644 index 00000000000..08386e60a21 --- /dev/null +++ b/src/cloudflare/types/images/v1/variant_delete_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__ = ["VariantDeleteParams"] + + +class VariantDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/images/v1/variant_delete_response.py b/src/cloudflare/types/images/v1/variant_delete_response.py index dc91f59162b..76df3ba49a2 100644 --- a/src/cloudflare/types/images/v1/variant_delete_response.py +++ b/src/cloudflare/types/images/v1/variant_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["VariantDeleteResponse"] -VariantDeleteResponse = Union[str, object] +VariantDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/images/v1/variant_edit_response.py b/src/cloudflare/types/images/v1/variant_edit_response.py new file mode 100644 index 00000000000..64d25e4b9ee --- /dev/null +++ b/src/cloudflare/types/images/v1/variant_edit_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["VariantEditResponse", "Variant", "VariantOptions"] + + +class VariantOptions(BaseModel): + fit: Literal["scale-down", "contain", "cover", "crop", "pad"] + """ + The fit property describes how the width and height dimensions should be + interpreted. + """ + + height: float + """Maximum height in image pixels.""" + + metadata: Literal["keep", "copyright", "none"] + """What EXIF data should be preserved in the output image.""" + + width: float + """Maximum width in image pixels.""" + + +class Variant(BaseModel): + id: str + + options: VariantOptions + """Allows you to define image resizing sizes for different use cases.""" + + never_require_signed_urls: Optional[bool] = FieldInfo(alias="neverRequireSignedURLs", default=None) + """ + Indicates whether the variant can access an image without a signature, + regardless of image access control. + """ + + +class VariantEditResponse(BaseModel): + variant: Optional[Variant] = None diff --git a/src/cloudflare/types/images/v1/variant_get_response.py b/src/cloudflare/types/images/v1/variant_get_response.py new file mode 100644 index 00000000000..add794835e3 --- /dev/null +++ b/src/cloudflare/types/images/v1/variant_get_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["VariantGetResponse", "Variant", "VariantOptions"] + + +class VariantOptions(BaseModel): + fit: Literal["scale-down", "contain", "cover", "crop", "pad"] + """ + The fit property describes how the width and height dimensions should be + interpreted. + """ + + height: float + """Maximum height in image pixels.""" + + metadata: Literal["keep", "copyright", "none"] + """What EXIF data should be preserved in the output image.""" + + width: float + """Maximum width in image pixels.""" + + +class Variant(BaseModel): + id: str + + options: VariantOptions + """Allows you to define image resizing sizes for different use cases.""" + + never_require_signed_urls: Optional[bool] = FieldInfo(alias="neverRequireSignedURLs", default=None) + """ + Indicates whether the variant can access an image without a signature, + regardless of image access control. + """ + + +class VariantGetResponse(BaseModel): + variant: Optional[Variant] = None diff --git a/src/cloudflare/types/images/v1_create_params.py b/src/cloudflare/types/images/v1_create_params.py index a093cf419e5..ede7cddf3e8 100644 --- a/src/cloudflare/types/images/v1_create_params.py +++ b/src/cloudflare/types/images/v1_create_params.py @@ -2,26 +2,32 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Required, TypedDict +from typing_extensions import Required, Annotated, TypedDict -__all__ = ["V1CreateParams", "ImagesImageUploadViaFile", "ImagesImageUploadViaURL"] +from ..._utils import PropertyInfo +__all__ = ["V1CreateParams"] -class ImagesImageUploadViaFile(TypedDict, total=False): + +class V1CreateParams(TypedDict, total=False): account_id: Required[str] """Account identifier tag.""" - file: Required[object] - """An image binary data.""" + file: object + """An image binary data. Only needed when type is uploading a file.""" + metadata: object + """User modifiable key-value store. -class ImagesImageUploadViaURL(TypedDict, total=False): - account_id: Required[str] - """Account identifier tag.""" + Can use used for keeping references to another system of record for managing + images. + """ - url: Required[str] - """A URL to fetch an image from origin.""" + require_signed_urls: Annotated[bool, PropertyInfo(alias="requireSignedURLs")] + """Indicates whether the image requires a signature token for the access.""" + url: str + """A URL to fetch an image from origin. -V1CreateParams = Union[ImagesImageUploadViaFile, ImagesImageUploadViaURL] + Only needed when type is uploading from a URL. + """ diff --git a/src/cloudflare/types/images/v1_delete_params.py b/src/cloudflare/types/images/v1_delete_params.py new file mode 100644 index 00000000000..dd7e4372beb --- /dev/null +++ b/src/cloudflare/types/images/v1_delete_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__ = ["V1DeleteParams"] + + +class V1DeleteParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/images/v1_delete_response.py b/src/cloudflare/types/images/v1_delete_response.py index 809e17c92e4..1cd4c8aec50 100644 --- a/src/cloudflare/types/images/v1_delete_response.py +++ b/src/cloudflare/types/images/v1_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["V1DeleteResponse"] -V1DeleteResponse = Union[str, object] +V1DeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/images/v1_list_response.py b/src/cloudflare/types/images/v1_list_response.py index 249b4c9523d..44974f29c14 100644 --- a/src/cloudflare/types/images/v1_list_response.py +++ b/src/cloudflare/types/images/v1_list_response.py @@ -5,20 +5,9 @@ from .image import Image from ..._models import BaseModel +from ..shared.response_info import ResponseInfo -__all__ = ["V1ListResponse", "Error", "Message", "Result"] - - -class Error(BaseModel): - code: int - - message: str - - -class Message(BaseModel): - code: int - - message: str +__all__ = ["V1ListResponse", "Result"] class Result(BaseModel): @@ -26,9 +15,9 @@ class Result(BaseModel): class V1ListResponse(BaseModel): - errors: List[Error] + errors: List[ResponseInfo] - messages: List[Message] + messages: List[ResponseInfo] result: Result diff --git a/src/cloudflare/types/images/v2/direct_upload_create_params.py b/src/cloudflare/types/images/v2/direct_upload_create_params.py index 80e7b17b65b..477b46c0e38 100644 --- a/src/cloudflare/types/images/v2/direct_upload_create_params.py +++ b/src/cloudflare/types/images/v2/direct_upload_create_params.py @@ -15,6 +15,13 @@ class DirectUploadCreateParams(TypedDict, total=False): account_id: Required[str] """Account identifier tag.""" + id: str + """Optional Image Custom ID. + + Up to 1024 chars. Can include any number of subpaths, and utf8 characters. + Cannot start nor end with a / (forward slash). Cannot be a UUID. + """ + expiry: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """The date after which the upload will not be accepted. diff --git a/src/cloudflare/types/intel/__init__.py b/src/cloudflare/types/intel/__init__.py index 4797f1df51d..4ad7dbe24f6 100644 --- a/src/cloudflare/types/intel/__init__.py +++ b/src/cloudflare/types/intel/__init__.py @@ -2,20 +2,21 @@ from __future__ import annotations -from .intel_asn import IntelASN as IntelASN -from .intel_whois import IntelWhois as IntelWhois -from .intel_domain import IntelDomain as IntelDomain -from .intel_ip_list import IntelIPList as IntelIPList +from .ip import IP as IP +from .dns import DNS as DNS +from .whois import Whois as Whois +from .domain import Domain as Domain +from .ip_list import IPList as IPList +from .sinkhole import Sinkhole as Sinkhole +from .dns_param import DNSParam as DNSParam from .ip_get_params import IPGetParams as IPGetParams -from .dns_get_params import DNSGetParams as DNSGetParams +from .domain_history import DomainHistory as DomainHistory +from .dns_list_params import DNSListParams as DNSListParams from .ip_get_response import IPGetResponse as IPGetResponse -from .intel_schemas_ip import IntelSchemasIP as IntelSchemasIP from .whois_get_params import WhoisGetParams as WhoisGetParams +from .dns_list_response import DNSListResponse as DNSListResponse from .domain_get_params import DomainGetParams as DomainGetParams -from .intel_sinkhole_item import IntelSinkholeItem as IntelSinkholeItem -from .intel_domain_history import IntelDomainHistory as IntelDomainHistory from .ip_list_get_response import IPListGetResponse as IPListGetResponse -from .intel_passive_dns_by_ip import IntelPassiveDNSByIP as IntelPassiveDNSByIP from .domain_history_get_params import DomainHistoryGetParams as DomainHistoryGetParams from .domain_history_get_response import DomainHistoryGetResponse as DomainHistoryGetResponse from .indicator_feed_get_response import IndicatorFeedGetResponse as IndicatorFeedGetResponse diff --git a/src/cloudflare/types/intel/asn/subnet_get_response.py b/src/cloudflare/types/intel/asn/subnet_get_response.py index cb54964edf4..fc4c5d0cc30 100644 --- a/src/cloudflare/types/intel/asn/subnet_get_response.py +++ b/src/cloudflare/types/intel/asn/subnet_get_response.py @@ -3,13 +3,13 @@ from typing import List, Optional from ...._models import BaseModel -from ..intel_asn import IntelASN +from ...shared.asn import ASN __all__ = ["SubnetGetResponse"] class SubnetGetResponse(BaseModel): - asn: Optional[IntelASN] = None + asn: Optional[ASN] = None count: Optional[float] = None """Total results returned based on your search parameters.""" diff --git a/src/cloudflare/types/intel/attack_surface_report/__init__.py b/src/cloudflare/types/intel/attack_surface_report/__init__.py index ca09c677e83..65bb5364128 100644 --- a/src/cloudflare/types/intel/attack_surface_report/__init__.py +++ b/src/cloudflare/types/intel/attack_surface_report/__init__.py @@ -2,6 +2,10 @@ from __future__ import annotations +from .issue_type import IssueType as IssueType +from .product_param import ProductParam as ProductParam +from .subject_param import SubjectParam as SubjectParam +from .issue_class_param import IssueClassParam as IssueClassParam from .issue_list_params import IssueListParams as IssueListParams from .issue_type_params import IssueTypeParams as IssueTypeParams from .issue_class_params import IssueClassParams as IssueClassParams @@ -9,6 +13,7 @@ from .issue_type_response import IssueTypeResponse as IssueTypeResponse from .issue_class_response import IssueClassResponse as IssueClassResponse from .issue_dismiss_params import IssueDismissParams as IssueDismissParams +from .severity_query_param import SeverityQueryParam as SeverityQueryParam from .issue_severity_params import IssueSeverityParams as IssueSeverityParams from .issue_dismiss_response import IssueDismissResponse as IssueDismissResponse from .issue_severity_response import IssueSeverityResponse as IssueSeverityResponse diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_class_param.py b/src/cloudflare/types/intel/attack_surface_report/issue_class_param.py new file mode 100644 index 00000000000..2f14613c861 --- /dev/null +++ b/src/cloudflare/types/intel/attack_surface_report/issue_class_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List + +__all__ = ["IssueClassParamItem"] + +IssueClassParamItem = str + +IssueClassParam = List[str] diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_class_params.py b/src/cloudflare/types/intel/attack_surface_report/issue_class_params.py index 8d958c86f63..dba6dbee763 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_class_params.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_class_params.py @@ -3,9 +3,14 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo +from .issue_type import IssueType +from .product_param import ProductParam +from .subject_param import SubjectParam +from .issue_class_param import IssueClassParam +from .severity_query_param import SeverityQueryParam __all__ = ["IssueClassParams"] @@ -16,41 +21,22 @@ class IssueClassParams(TypedDict, total=False): dismissed: bool - issue_class: List[str] + issue_class: IssueClassParam - issue_class_neq: Annotated[List[str], PropertyInfo(alias="issue_class~neq")] + issue_class_neq: Annotated[IssueClassParam, PropertyInfo(alias="issue_class~neq")] - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] + issue_type: List[IssueType] - issue_type_neq: Annotated[ - List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ], - PropertyInfo(alias="issue_type~neq"), - ] + issue_type_neq: Annotated[List[IssueType], PropertyInfo(alias="issue_type~neq")] - product: List[str] + product: ProductParam - product_neq: Annotated[List[str], PropertyInfo(alias="product~neq")] + product_neq: Annotated[ProductParam, PropertyInfo(alias="product~neq")] - severity: List[Literal["low", "moderate", "critical"]] + severity: List[SeverityQueryParam] - severity_neq: Annotated[List[Literal["low", "moderate", "critical"]], PropertyInfo(alias="severity~neq")] + severity_neq: Annotated[List[SeverityQueryParam], PropertyInfo(alias="severity~neq")] - subject: List[str] + subject: SubjectParam - subject_neq: Annotated[List[str], PropertyInfo(alias="subject~neq")] + subject_neq: Annotated[SubjectParam, PropertyInfo(alias="subject~neq")] diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_list_params.py b/src/cloudflare/types/intel/attack_surface_report/issue_list_params.py index e458be134b1..8a29f8fb941 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_list_params.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_list_params.py @@ -3,9 +3,14 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo +from .issue_type import IssueType +from .product_param import ProductParam +from .subject_param import SubjectParam +from .issue_class_param import IssueClassParam +from .severity_query_param import SeverityQueryParam __all__ = ["IssueListParams"] @@ -16,32 +21,13 @@ class IssueListParams(TypedDict, total=False): dismissed: bool - issue_class: List[str] - - issue_class_neq: Annotated[List[str], PropertyInfo(alias="issue_class~neq")] - - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - - issue_type_neq: Annotated[ - List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ], - PropertyInfo(alias="issue_type~neq"), - ] + issue_class: IssueClassParam + + issue_class_neq: Annotated[IssueClassParam, PropertyInfo(alias="issue_class~neq")] + + issue_type: List[IssueType] + + issue_type_neq: Annotated[List[IssueType], PropertyInfo(alias="issue_type~neq")] page: int """Current page within paginated list of results""" @@ -49,14 +35,14 @@ class IssueListParams(TypedDict, total=False): per_page: int """Number of results per page of results""" - product: List[str] + product: ProductParam - product_neq: Annotated[List[str], PropertyInfo(alias="product~neq")] + product_neq: Annotated[ProductParam, PropertyInfo(alias="product~neq")] - severity: List[Literal["low", "moderate", "critical"]] + severity: List[SeverityQueryParam] - severity_neq: Annotated[List[Literal["low", "moderate", "critical"]], PropertyInfo(alias="severity~neq")] + severity_neq: Annotated[List[SeverityQueryParam], PropertyInfo(alias="severity~neq")] - subject: List[str] + subject: SubjectParam - subject_neq: Annotated[List[str], PropertyInfo(alias="subject~neq")] + subject_neq: Annotated[SubjectParam, PropertyInfo(alias="subject~neq")] diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_list_response.py b/src/cloudflare/types/intel/attack_surface_report/issue_list_response.py index 8f068cd640a..da16535dc2b 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_list_response.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_list_response.py @@ -5,20 +5,9 @@ from typing_extensions import Literal from ...._models import BaseModel +from ...shared.response_info import ResponseInfo -__all__ = ["IssueListResponse", "Error", "Message", "Result", "ResultIssue"] - - -class Error(BaseModel): - code: int - - message: str - - -class Message(BaseModel): - code: int - - message: str +__all__ = ["IssueListResponse", "Result", "ResultIssue"] class ResultIssue(BaseModel): @@ -67,9 +56,9 @@ class Result(BaseModel): class IssueListResponse(BaseModel): - errors: List[Error] + errors: List[ResponseInfo] - messages: List[Message] + messages: List[ResponseInfo] result: Result diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py b/src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py index db21c03c8af..7eab3a44454 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py @@ -3,9 +3,14 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo +from .issue_type import IssueType +from .product_param import ProductParam +from .subject_param import SubjectParam +from .issue_class_param import IssueClassParam +from .severity_query_param import SeverityQueryParam __all__ = ["IssueSeverityParams"] @@ -16,41 +21,22 @@ class IssueSeverityParams(TypedDict, total=False): dismissed: bool - issue_class: List[str] + issue_class: IssueClassParam - issue_class_neq: Annotated[List[str], PropertyInfo(alias="issue_class~neq")] + issue_class_neq: Annotated[IssueClassParam, PropertyInfo(alias="issue_class~neq")] - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] + issue_type: List[IssueType] - issue_type_neq: Annotated[ - List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ], - PropertyInfo(alias="issue_type~neq"), - ] + issue_type_neq: Annotated[List[IssueType], PropertyInfo(alias="issue_type~neq")] - product: List[str] + product: ProductParam - product_neq: Annotated[List[str], PropertyInfo(alias="product~neq")] + product_neq: Annotated[ProductParam, PropertyInfo(alias="product~neq")] - severity: List[Literal["low", "moderate", "critical"]] + severity: List[SeverityQueryParam] - severity_neq: Annotated[List[Literal["low", "moderate", "critical"]], PropertyInfo(alias="severity~neq")] + severity_neq: Annotated[List[SeverityQueryParam], PropertyInfo(alias="severity~neq")] - subject: List[str] + subject: SubjectParam - subject_neq: Annotated[List[str], PropertyInfo(alias="subject~neq")] + subject_neq: Annotated[SubjectParam, PropertyInfo(alias="subject~neq")] diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_type.py b/src/cloudflare/types/intel/attack_surface_report/issue_type.py new file mode 100644 index 00000000000..72d55104624 --- /dev/null +++ b/src/cloudflare/types/intel/attack_surface_report/issue_type.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["IssueType"] + +IssueType = Literal[ + "compliance_violation", "email_security", "exposed_infrastructure", "insecure_configuration", "weak_authentication" +] diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_type_params.py b/src/cloudflare/types/intel/attack_surface_report/issue_type_params.py index 93c67ac4fc7..6f7e7d888d7 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_type_params.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_type_params.py @@ -3,9 +3,14 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo +from .issue_type import IssueType +from .product_param import ProductParam +from .subject_param import SubjectParam +from .issue_class_param import IssueClassParam +from .severity_query_param import SeverityQueryParam __all__ = ["IssueTypeParams"] @@ -16,41 +21,22 @@ class IssueTypeParams(TypedDict, total=False): dismissed: bool - issue_class: List[str] + issue_class: IssueClassParam - issue_class_neq: Annotated[List[str], PropertyInfo(alias="issue_class~neq")] + issue_class_neq: Annotated[IssueClassParam, PropertyInfo(alias="issue_class~neq")] - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] + issue_type: List[IssueType] - issue_type_neq: Annotated[ - List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ], - PropertyInfo(alias="issue_type~neq"), - ] + issue_type_neq: Annotated[List[IssueType], PropertyInfo(alias="issue_type~neq")] - product: List[str] + product: ProductParam - product_neq: Annotated[List[str], PropertyInfo(alias="product~neq")] + product_neq: Annotated[ProductParam, PropertyInfo(alias="product~neq")] - severity: List[Literal["low", "moderate", "critical"]] + severity: List[SeverityQueryParam] - severity_neq: Annotated[List[Literal["low", "moderate", "critical"]], PropertyInfo(alias="severity~neq")] + severity_neq: Annotated[List[SeverityQueryParam], PropertyInfo(alias="severity~neq")] - subject: List[str] + subject: SubjectParam - subject_neq: Annotated[List[str], PropertyInfo(alias="subject~neq")] + subject_neq: Annotated[SubjectParam, PropertyInfo(alias="subject~neq")] diff --git a/src/cloudflare/types/intel/attack_surface_report/product_param.py b/src/cloudflare/types/intel/attack_surface_report/product_param.py new file mode 100644 index 00000000000..430d17c2f52 --- /dev/null +++ b/src/cloudflare/types/intel/attack_surface_report/product_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List + +__all__ = ["ProductParamItem"] + +ProductParamItem = str + +ProductParam = List[str] diff --git a/src/cloudflare/types/intel/attack_surface_report/severity_query_param.py b/src/cloudflare/types/intel/attack_surface_report/severity_query_param.py new file mode 100644 index 00000000000..cd208c07b4b --- /dev/null +++ b/src/cloudflare/types/intel/attack_surface_report/severity_query_param.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["SeverityQueryParam"] + +SeverityQueryParam = Literal["low", "moderate", "critical"] diff --git a/src/cloudflare/types/intel/attack_surface_report/subject_param.py b/src/cloudflare/types/intel/attack_surface_report/subject_param.py new file mode 100644 index 00000000000..f360f7d73b0 --- /dev/null +++ b/src/cloudflare/types/intel/attack_surface_report/subject_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List + +__all__ = ["SubjectParamItem"] + +SubjectParamItem = str + +SubjectParam = List[str] diff --git a/src/cloudflare/types/intel/dns.py b/src/cloudflare/types/intel/dns.py new file mode 100644 index 00000000000..66f00d109dd --- /dev/null +++ b/src/cloudflare/types/intel/dns.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import date + +from ..._models import BaseModel + +__all__ = ["DNS", "ReverseRecord"] + + +class ReverseRecord(BaseModel): + first_seen: Optional[date] = None + """First seen date of the DNS record during the time period.""" + + hostname: Optional[object] = None + """Hostname that the IP was observed resolving to.""" + + last_seen: Optional[date] = None + """Last seen date of the DNS record during the time period.""" + + +class DNS(BaseModel): + count: Optional[float] = None + """Total results returned based on your search parameters.""" + + page: Optional[float] = None + """Current page within paginated list of results.""" + + per_page: Optional[float] = None + """Number of results per page of results.""" + + reverse_records: Optional[List[ReverseRecord]] = None + """Reverse DNS look-ups observed during the time period.""" diff --git a/src/cloudflare/types/intel/dns_get_params.py b/src/cloudflare/types/intel/dns_get_params.py deleted file mode 100644 index 3bc9fc3bdc7..00000000000 --- a/src/cloudflare/types/intel/dns_get_params.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import date -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["DNSGetParams", "StartEndParams"] - - -class DNSGetParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - ipv4: str - - page: float - """Requested page within paginated list of results.""" - - per_page: float - """Maximum number of results requested.""" - - start_end_params: StartEndParams - - -class StartEndParams(TypedDict, total=False): - end: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """Defaults to the current date.""" - - start: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """Defaults to 30 days before the end parameter value.""" diff --git a/src/cloudflare/types/intel/dns_list_params.py b/src/cloudflare/types/intel/dns_list_params.py new file mode 100644 index 00000000000..1937591d655 --- /dev/null +++ b/src/cloudflare/types/intel/dns_list_params.py @@ -0,0 +1,34 @@ +# 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 Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["DNSListParams", "StartEndParams"] + + +class DNSListParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + ipv4: str + + page: float + """Requested page within paginated list of results.""" + + per_page: float + """Maximum number of results requested.""" + + start_end_params: StartEndParams + + +class StartEndParams(TypedDict, total=False): + end: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Defaults to the current date.""" + + start: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Defaults to 30 days before the end parameter value.""" diff --git a/src/cloudflare/types/intel/dns_list_response.py b/src/cloudflare/types/intel/dns_list_response.py new file mode 100644 index 00000000000..ed0cea0cfcf --- /dev/null +++ b/src/cloudflare/types/intel/dns_list_response.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from .dns import DNS +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo + +__all__ = ["DNSListResponse"] + + +class DNSListResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + result: DNS + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/intel/dns_param.py b/src/cloudflare/types/intel/dns_param.py new file mode 100644 index 00000000000..dcca6358a0b --- /dev/null +++ b/src/cloudflare/types/intel/dns_param.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["DNSParam", "ReverseRecord"] + + +class ReverseRecord(TypedDict, total=False): + first_seen: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """First seen date of the DNS record during the time period.""" + + hostname: object + """Hostname that the IP was observed resolving to.""" + + last_seen: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Last seen date of the DNS record during the time period.""" + + +class DNSParam(TypedDict, total=False): + count: float + """Total results returned based on your search parameters.""" + + page: float + """Current page within paginated list of results.""" + + per_page: float + """Number of results per page of results.""" + + reverse_records: Iterable[ReverseRecord] + """Reverse DNS look-ups observed during the time period.""" diff --git a/src/cloudflare/types/intel/domain.py b/src/cloudflare/types/intel/domain.py new file mode 100644 index 00000000000..843c1adf8f9 --- /dev/null +++ b/src/cloudflare/types/intel/domain.py @@ -0,0 +1,95 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = [ + "Domain", + "AdditionalInformation", + "Application", + "InheritedContentCategory", + "InheritedRiskType", + "ResolvesToRef", +] + + +class AdditionalInformation(BaseModel): + suspected_malware_family: Optional[str] = None + """Suspected DGA malware family.""" + + +class Application(BaseModel): + id: Optional[int] = None + + name: Optional[str] = None + + +class InheritedContentCategory(BaseModel): + id: Optional[int] = None + + name: Optional[str] = None + + super_category_id: Optional[int] = None + + +class InheritedRiskType(BaseModel): + id: Optional[int] = None + + name: Optional[str] = None + + super_category_id: Optional[int] = None + + +class ResolvesToRef(BaseModel): + id: Optional[str] = None + """ + STIX 2.1 identifier: + https://docs.oasis-open.org/cti/stix/v2.1/cs02/stix-v2.1-cs02.html#_64yvzeku5a5c + """ + + value: Optional[str] = None + """IP address or domain name.""" + + +class Domain(BaseModel): + additional_information: Optional[AdditionalInformation] = None + """Additional information related to the host name.""" + + application: Optional[Application] = None + """Application that the hostname belongs to.""" + + content_categories: Optional[List[object]] = None + """Current content categories.""" + + domain: Optional[str] = None + + inherited_content_categories: Optional[List[InheritedContentCategory]] = None + + inherited_from: Optional[str] = None + """ + Domain from which `inherited_content_categories` and `inherited_risk_types` are + inherited, if applicable. + """ + + inherited_risk_types: Optional[List[InheritedRiskType]] = None + + popularity_rank: Optional[int] = None + """ + Global Cloudflare 100k ranking for the last 30 days, if available for the + hostname. The top ranked domain is 1, the lowest ranked domain is 100,000. + """ + + resolves_to_refs: Optional[List[ResolvesToRef]] = None + """ + Specifies a list of references to one or more IP addresses or domain names that + the domain name currently resolves to. + """ + + risk_score: Optional[float] = None + """ + Hostname risk score, which is a value between 0 (lowest risk) to 1 (highest + risk). + """ + + risk_types: Optional[List[object]] = None diff --git a/src/cloudflare/types/intel/domain_history.py b/src/cloudflare/types/intel/domain_history.py new file mode 100644 index 00000000000..a490b4770ff --- /dev/null +++ b/src/cloudflare/types/intel/domain_history.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import date + +from ..._models import BaseModel + +__all__ = ["DomainHistory", "Categorization"] + + +class Categorization(BaseModel): + categories: Optional[List[object]] = None + + end: Optional[date] = None + + start: Optional[date] = None + + +class DomainHistory(BaseModel): + categorizations: Optional[List[Categorization]] = None + + domain: Optional[str] = None diff --git a/src/cloudflare/types/intel/domain_history_get_response.py b/src/cloudflare/types/intel/domain_history_get_response.py index 6e2c2c8e216..e3b3c3bd1b3 100644 --- a/src/cloudflare/types/intel/domain_history_get_response.py +++ b/src/cloudflare/types/intel/domain_history_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .intel_domain_history import IntelDomainHistory +from .domain_history import DomainHistory __all__ = ["DomainHistoryGetResponse"] -DomainHistoryGetResponse = List[IntelDomainHistory] +DomainHistoryGetResponse = List[DomainHistory] diff --git a/src/cloudflare/types/intel/intel_asn.py b/src/cloudflare/types/intel/intel_asn.py deleted file mode 100644 index dece910c602..00000000000 --- a/src/cloudflare/types/intel/intel_asn.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -__all__ = ["IntelASN"] - -IntelASN = int diff --git a/src/cloudflare/types/intel/intel_domain.py b/src/cloudflare/types/intel/intel_domain.py deleted file mode 100644 index ab9536fd001..00000000000 --- a/src/cloudflare/types/intel/intel_domain.py +++ /dev/null @@ -1,95 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = [ - "IntelDomain", - "AdditionalInformation", - "Application", - "InheritedContentCategory", - "InheritedRiskType", - "ResolvesToRef", -] - - -class AdditionalInformation(BaseModel): - suspected_malware_family: Optional[str] = None - """Suspected DGA malware family.""" - - -class Application(BaseModel): - id: Optional[int] = None - - name: Optional[str] = None - - -class InheritedContentCategory(BaseModel): - id: Optional[int] = None - - name: Optional[str] = None - - super_category_id: Optional[int] = None - - -class InheritedRiskType(BaseModel): - id: Optional[int] = None - - name: Optional[str] = None - - super_category_id: Optional[int] = None - - -class ResolvesToRef(BaseModel): - id: Optional[str] = None - """ - STIX 2.1 identifier: - https://docs.oasis-open.org/cti/stix/v2.1/cs02/stix-v2.1-cs02.html#_64yvzeku5a5c - """ - - value: Optional[str] = None - """IP address or domain name.""" - - -class IntelDomain(BaseModel): - additional_information: Optional[AdditionalInformation] = None - """Additional information related to the host name.""" - - application: Optional[Application] = None - """Application that the hostname belongs to.""" - - content_categories: Optional[List[object]] = None - """Current content categories.""" - - domain: Optional[str] = None - - inherited_content_categories: Optional[List[InheritedContentCategory]] = None - - inherited_from: Optional[str] = None - """ - Domain from which `inherited_content_categories` and `inherited_risk_types` are - inherited, if applicable. - """ - - inherited_risk_types: Optional[List[InheritedRiskType]] = None - - popularity_rank: Optional[int] = None - """ - Global Cloudflare 100k ranking for the last 30 days, if available for the - hostname. The top ranked domain is 1, the lowest ranked domain is 100,000. - """ - - resolves_to_refs: Optional[List[ResolvesToRef]] = None - """ - Specifies a list of references to one or more IP addresses or domain names that - the domain name currently resolves to. - """ - - risk_score: Optional[float] = None - """ - Hostname risk score, which is a value between 0 (lowest risk) to 1 (highest - risk). - """ - - risk_types: Optional[List[object]] = None diff --git a/src/cloudflare/types/intel/intel_domain_history.py b/src/cloudflare/types/intel/intel_domain_history.py deleted file mode 100644 index abba234fee9..00000000000 --- a/src/cloudflare/types/intel/intel_domain_history.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 datetime import date - -from ..._models import BaseModel - -__all__ = ["IntelDomainHistory", "Categorization"] - - -class Categorization(BaseModel): - categories: Optional[List[object]] = None - - end: Optional[date] = None - - start: Optional[date] = None - - -class IntelDomainHistory(BaseModel): - categorizations: Optional[List[Categorization]] = None - - domain: Optional[str] = None diff --git a/src/cloudflare/types/intel/intel_ip_list.py b/src/cloudflare/types/intel/intel_ip_list.py deleted file mode 100644 index f8c905d374f..00000000000 --- a/src/cloudflare/types/intel/intel_ip_list.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__ = ["IntelIPList"] - - -class IntelIPList(BaseModel): - id: Optional[int] = None - - description: Optional[str] = None - - name: Optional[str] = None diff --git a/src/cloudflare/types/intel/intel_passive_dns_by_ip.py b/src/cloudflare/types/intel/intel_passive_dns_by_ip.py deleted file mode 100644 index 7fc207eb380..00000000000 --- a/src/cloudflare/types/intel/intel_passive_dns_by_ip.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import date - -from ..._models import BaseModel - -__all__ = ["IntelPassiveDNSByIP", "ReverseRecord"] - - -class ReverseRecord(BaseModel): - first_seen: Optional[date] = None - """First seen date of the DNS record during the time period.""" - - hostname: Optional[object] = None - """Hostname that the IP was observed resolving to.""" - - last_seen: Optional[date] = None - """Last seen date of the DNS record during the time period.""" - - -class IntelPassiveDNSByIP(BaseModel): - count: Optional[float] = None - """Total results returned based on your search parameters.""" - - page: Optional[float] = None - """Current page within paginated list of results.""" - - per_page: Optional[float] = None - """Number of results per page of results.""" - - reverse_records: Optional[List[ReverseRecord]] = None - """Reverse DNS look-ups observed during the time period.""" diff --git a/src/cloudflare/types/intel/intel_schemas_ip.py b/src/cloudflare/types/intel/intel_schemas_ip.py deleted file mode 100644 index 188cb5e7d4a..00000000000 --- a/src/cloudflare/types/intel/intel_schemas_ip.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["IntelSchemasIP", "BelongsToRef"] - - -class BelongsToRef(BaseModel): - id: Optional[str] = None - - country: Optional[str] = None - - description: Optional[str] = None - - type: Optional[Literal["hosting_provider", "isp", "organization"]] = None - """Infrastructure type of this ASN.""" - - value: Optional[str] = None - - -class IntelSchemasIP(BaseModel): - belongs_to_ref: Optional[BelongsToRef] = None - """ - Specifies a reference to the autonomous systems (AS) that the IP address belongs - to. - """ - - ip: Union[str, str, None] = None - - risk_types: Optional[List[object]] = None diff --git a/src/cloudflare/types/intel/intel_sinkhole_item.py b/src/cloudflare/types/intel/intel_sinkhole_item.py deleted file mode 100644 index 98ddc704596..00000000000 --- a/src/cloudflare/types/intel/intel_sinkhole_item.py +++ /dev/null @@ -1,31 +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__ = ["IntelSinkholeItem"] - - -class IntelSinkholeItem(BaseModel): - id: Optional[int] = None - """The unique identifier for the sinkhole""" - - account_tag: Optional[str] = None - """The account tag that owns this sinkhole""" - - created_on: Optional[datetime] = None - """The date and time when the sinkhole was created""" - - modified_on: Optional[datetime] = None - """The date and time when the sinkhole was last modified""" - - name: Optional[str] = None - """The name of the sinkhole""" - - r2_bucket: Optional[str] = None - """The name of the R2 bucket to store results""" - - r2_id: Optional[str] = None - """The id of the R2 instance""" diff --git a/src/cloudflare/types/intel/intel_whois.py b/src/cloudflare/types/intel/intel_whois.py deleted file mode 100644 index 6348407623d..00000000000 --- a/src/cloudflare/types/intel/intel_whois.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import date - -from ..._models import BaseModel - -__all__ = ["IntelWhois"] - - -class IntelWhois(BaseModel): - created_date: Optional[date] = None - - domain: Optional[str] = None - - nameservers: Optional[List[str]] = None - - registrant: Optional[str] = None - - registrant_country: Optional[str] = None - - registrant_email: Optional[str] = None - - registrant_org: Optional[str] = None - - registrar: Optional[str] = None - - updated_date: Optional[date] = None diff --git a/src/cloudflare/types/intel/ip.py b/src/cloudflare/types/intel/ip.py new file mode 100644 index 00000000000..ae1ebd501ab --- /dev/null +++ b/src/cloudflare/types/intel/ip.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["IP", "BelongsToRef"] + + +class BelongsToRef(BaseModel): + id: Optional[str] = None + + country: Optional[str] = None + + description: Optional[str] = None + + type: Optional[Literal["hosting_provider", "isp", "organization"]] = None + """Infrastructure type of this ASN.""" + + value: Optional[str] = None + + +class IP(BaseModel): + belongs_to_ref: Optional[BelongsToRef] = None + """ + Specifies a reference to the autonomous systems (AS) that the IP address belongs + to. + """ + + ip: Union[str, str, None] = None + + risk_types: Optional[List[object]] = None diff --git a/src/cloudflare/types/intel/ip_get_response.py b/src/cloudflare/types/intel/ip_get_response.py index 0eef2333efe..74a42e28125 100644 --- a/src/cloudflare/types/intel/ip_get_response.py +++ b/src/cloudflare/types/intel/ip_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .intel_schemas_ip import IntelSchemasIP +from .ip import IP __all__ = ["IPGetResponse"] -IPGetResponse = List[IntelSchemasIP] +IPGetResponse = List[IP] diff --git a/src/cloudflare/types/intel/ip_list.py b/src/cloudflare/types/intel/ip_list.py new file mode 100644 index 00000000000..2eccd1107b0 --- /dev/null +++ b/src/cloudflare/types/intel/ip_list.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__ = ["IPList"] + + +class IPList(BaseModel): + id: Optional[int] = None + + description: Optional[str] = None + + name: Optional[str] = None diff --git a/src/cloudflare/types/intel/ip_list_get_response.py b/src/cloudflare/types/intel/ip_list_get_response.py index 415cb89e45d..f87a5210833 100644 --- a/src/cloudflare/types/intel/ip_list_get_response.py +++ b/src/cloudflare/types/intel/ip_list_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .intel_ip_list import IntelIPList +from .ip_list import IPList __all__ = ["IPListGetResponse"] -IPListGetResponse = List[IntelIPList] +IPListGetResponse = List[IPList] diff --git a/src/cloudflare/types/intel/sinkhole.py b/src/cloudflare/types/intel/sinkhole.py new file mode 100644 index 00000000000..fe3d459e780 --- /dev/null +++ b/src/cloudflare/types/intel/sinkhole.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["Sinkhole"] + + +class Sinkhole(BaseModel): + id: Optional[int] = None + """The unique identifier for the sinkhole""" + + account_tag: Optional[str] = None + """The account tag that owns this sinkhole""" + + created_on: Optional[datetime] = None + """The date and time when the sinkhole was created""" + + modified_on: Optional[datetime] = None + """The date and time when the sinkhole was last modified""" + + name: Optional[str] = None + """The name of the sinkhole""" + + r2_bucket: Optional[str] = None + """The name of the R2 bucket to store results""" + + r2_id: Optional[str] = None + """The id of the R2 instance""" diff --git a/src/cloudflare/types/intel/whois.py b/src/cloudflare/types/intel/whois.py new file mode 100644 index 00000000000..f852e72a745 --- /dev/null +++ b/src/cloudflare/types/intel/whois.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import date + +from ..._models import BaseModel + +__all__ = ["Whois"] + + +class Whois(BaseModel): + created_date: Optional[date] = None + + domain: Optional[str] = None + + nameservers: Optional[List[str]] = None + + registrant: Optional[str] = None + + registrant_country: Optional[str] = None + + registrant_email: Optional[str] = None + + registrant_org: Optional[str] = None + + registrar: Optional[str] = None + + updated_date: Optional[date] = None diff --git a/src/cloudflare/types/intel_phishing_url_info.py b/src/cloudflare/types/intel_phishing_url_info.py deleted file mode 100644 index 81ee8a8ece7..00000000000 --- a/src/cloudflare/types/intel_phishing_url_info.py +++ /dev/null @@ -1,79 +0,0 @@ -# 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__ = ["IntelPhishingURLInfo", "Categorization", "ModelResult", "RuleMatch", "ScanStatus"] - - -class Categorization(BaseModel): - category: Optional[str] = None - """Name of the category applied.""" - - verification_status: Optional[str] = None - """Result of human review for this categorization.""" - - -class ModelResult(BaseModel): - ai_model_name: Optional[str] = FieldInfo(alias="model_name", default=None) - """Name of the model.""" - - ai_model_score: Optional[float] = FieldInfo(alias="model_score", default=None) - """Score output by the model for this submission.""" - - -class RuleMatch(BaseModel): - banning: Optional[bool] = None - """For internal use.""" - - blocking: Optional[bool] = None - """For internal use.""" - - description: Optional[str] = None - """Description of the signature that matched.""" - - name: Optional[str] = None - """Name of the signature that matched.""" - - -class ScanStatus(BaseModel): - last_processed: Optional[str] = None - """Timestamp of when the submission was processed.""" - - scan_complete: Optional[bool] = None - """For internal use.""" - - status_code: Optional[int] = None - """Status code that the crawler received when loading the submitted URL.""" - - submission_id: Optional[int] = None - """ID of the most recent submission.""" - - -class IntelPhishingURLInfo(BaseModel): - categorizations: Optional[List[Categorization]] = None - """List of categorizations applied to this submission.""" - - ai_model_results: Optional[List[ModelResult]] = FieldInfo(alias="model_results", default=None) - """List of model results for completed scans.""" - - rule_matches: Optional[List[RuleMatch]] = None - """ - List of signatures that matched against site content found when crawling the - URL. - """ - - scan_status: Optional[ScanStatus] = None - """Status of the most recent scan found.""" - - screenshot_download_signature: Optional[str] = None - """For internal use.""" - - screenshot_path: Optional[str] = None - """For internal use.""" - - url: Optional[str] = None - """URL that was submitted.""" diff --git a/src/cloudflare/types/intel_phishing_url_submit.py b/src/cloudflare/types/intel_phishing_url_submit.py deleted file mode 100644 index 70d8c27e5db..00000000000 --- a/src/cloudflare/types/intel_phishing_url_submit.py +++ /dev/null @@ -1,42 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .._models import BaseModel - -__all__ = ["IntelPhishingURLSubmit", "ExcludedURL", "SkippedURL", "SubmittedURL"] - - -class ExcludedURL(BaseModel): - url: Optional[str] = None - """URL that was excluded.""" - - -class SkippedURL(BaseModel): - url: Optional[str] = None - """URL that was skipped.""" - - url_id: Optional[int] = None - """ID of the submission of that URL that is currently scanning.""" - - -class SubmittedURL(BaseModel): - url: Optional[str] = None - """URL that was submitted.""" - - url_id: Optional[int] = None - """ID assigned to this URL submission. Used to retrieve scanning results.""" - - -class IntelPhishingURLSubmit(BaseModel): - excluded_urls: Optional[List[ExcludedURL]] = None - """ - URLs that were excluded from scanning because their domain is in our no-scan - list. - """ - - skipped_urls: Optional[List[SkippedURL]] = None - """URLs that were skipped because the same URL is currently being scanned""" - - submitted_urls: Optional[List[SubmittedURL]] = None - """URLs that were successfully submitted for scanning.""" diff --git a/src/cloudflare/types/ips/__init__.py b/src/cloudflare/types/ips/__init__.py new file mode 100644 index 00000000000..4b563930dab --- /dev/null +++ b/src/cloudflare/types/ips/__init__.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .ips import IPs as IPs +from .jdcloud_ips import JDCloudIPs as JDCloudIPs +from .ip_list_params import IPListParams as IPListParams +from .ip_list_response import IPListResponse as IPListResponse diff --git a/src/cloudflare/types/ip_list_params.py b/src/cloudflare/types/ips/ip_list_params.py similarity index 100% rename from src/cloudflare/types/ip_list_params.py rename to src/cloudflare/types/ips/ip_list_params.py diff --git a/src/cloudflare/types/ip_list_response.py b/src/cloudflare/types/ips/ip_list_response.py similarity index 100% rename from src/cloudflare/types/ip_list_response.py rename to src/cloudflare/types/ips/ip_list_response.py diff --git a/src/cloudflare/types/ips.py b/src/cloudflare/types/ips/ips.py similarity index 93% rename from src/cloudflare/types/ips.py rename to src/cloudflare/types/ips/ips.py index a7a326e6179..176e4c0db8a 100644 --- a/src/cloudflare/types/ips.py +++ b/src/cloudflare/types/ips/ips.py @@ -2,7 +2,7 @@ from typing import List, Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["IPs"] diff --git a/src/cloudflare/types/jdcloud_ips.py b/src/cloudflare/types/ips/jdcloud_ips.py similarity index 94% rename from src/cloudflare/types/jdcloud_ips.py rename to src/cloudflare/types/ips/jdcloud_ips.py index 5d9c8d80dd8..d09b6d10a60 100644 --- a/src/cloudflare/types/jdcloud_ips.py +++ b/src/cloudflare/types/ips/jdcloud_ips.py @@ -2,7 +2,7 @@ from typing import List, Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["JDCloudIPs"] diff --git a/src/cloudflare/types/keyless_certificate_create_params.py b/src/cloudflare/types/keyless_certificate_create_params.py deleted file mode 100644 index 4a5c45381c9..00000000000 --- a/src/cloudflare/types/keyless_certificate_create_params.py +++ /dev/null @@ -1,46 +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__ = ["KeylessCertificateCreateParams", "Tunnel"] - - -class KeylessCertificateCreateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - certificate: Required[str] - """The zone's SSL certificate or SSL certificate and intermediate(s).""" - - host: Required[str] - """The keyless SSL name.""" - - port: Required[float] - """ - The keyless SSL port used to communicate between Cloudflare and the client's - Keyless SSL server. - """ - - bundle_method: Literal["ubiquitous", "optimal", "force"] - """ - A ubiquitous bundle has the highest probability of being verified everywhere, - even by clients using outdated or unusual trust stores. An optimal bundle uses - the shortest chain and newest intermediates. And the force bundle verifies the - chain, but does not otherwise modify it. - """ - - name: str - """The keyless SSL name.""" - - tunnel: Tunnel - """Configuration for using Keyless SSL through a Cloudflare Tunnel""" - - -class Tunnel(TypedDict, total=False): - private_ip: Required[str] - """Private IP of the Key Server Host""" - - vnet_id: Required[str] - """Cloudflare Tunnel Virtual Network ID""" diff --git a/src/cloudflare/types/keyless_certificate_edit_params.py b/src/cloudflare/types/keyless_certificate_edit_params.py deleted file mode 100644 index e32432a5b55..00000000000 --- a/src/cloudflare/types/keyless_certificate_edit_params.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_extensions import Required, TypedDict - -__all__ = ["KeylessCertificateEditParams", "Tunnel"] - - -class KeylessCertificateEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - enabled: bool - """Whether or not the Keyless SSL is on or off.""" - - host: str - """The keyless SSL name.""" - - name: str - """The keyless SSL name.""" - - port: float - """ - The keyless SSL port used to communicate between Cloudflare and the client's - Keyless SSL server. - """ - - tunnel: Tunnel - """Configuration for using Keyless SSL through a Cloudflare Tunnel""" - - -class Tunnel(TypedDict, total=False): - private_ip: Required[str] - """Private IP of the Key Server Host""" - - vnet_id: Required[str] - """Cloudflare Tunnel Virtual Network ID""" diff --git a/src/cloudflare/types/keyless_certificate_hostname.py b/src/cloudflare/types/keyless_certificate_hostname.py deleted file mode 100644 index 588c0e76e5a..00000000000 --- a/src/cloudflare/types/keyless_certificate_hostname.py +++ /dev/null @@ -1,55 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["KeylessCertificateHostname", "Tunnel"] - - -class Tunnel(BaseModel): - private_ip: str - """Private IP of the Key Server Host""" - - vnet_id: str - """Cloudflare Tunnel Virtual Network ID""" - - -class KeylessCertificateHostname(BaseModel): - id: str - """Keyless certificate identifier tag.""" - - created_on: datetime - """When the Keyless SSL was created.""" - - enabled: bool - """Whether or not the Keyless SSL is on or off.""" - - host: str - """The keyless SSL name.""" - - modified_on: datetime - """When the Keyless SSL was last modified.""" - - name: str - """The keyless SSL name.""" - - permissions: List[object] - """ - Available permissions for the Keyless SSL for the current user requesting the - item. - """ - - port: float - """ - The keyless SSL port used to communicate between Cloudflare and the client's - Keyless SSL server. - """ - - status: Literal["active", "deleted"] - """Status of the Keyless SSL.""" - - tunnel: Optional[Tunnel] = None - """Configuration for using Keyless SSL through a Cloudflare Tunnel""" diff --git a/src/cloudflare/types/keyless_certificates/__init__.py b/src/cloudflare/types/keyless_certificates/__init__.py new file mode 100644 index 00000000000..426c1485f9b --- /dev/null +++ b/src/cloudflare/types/keyless_certificates/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .tunnel import Tunnel as Tunnel +from .tunnel_param import TunnelParam as TunnelParam +from .keyless_certificate import KeylessCertificate as KeylessCertificate +from .keyless_certificate_edit_params import KeylessCertificateEditParams as KeylessCertificateEditParams +from .keyless_certificate_create_params import KeylessCertificateCreateParams as KeylessCertificateCreateParams +from .keyless_certificate_delete_params import KeylessCertificateDeleteParams as KeylessCertificateDeleteParams +from .keyless_certificate_delete_response import KeylessCertificateDeleteResponse as KeylessCertificateDeleteResponse diff --git a/src/cloudflare/types/keyless_certificates/keyless_certificate.py b/src/cloudflare/types/keyless_certificates/keyless_certificate.py new file mode 100644 index 00000000000..12075f47715 --- /dev/null +++ b/src/cloudflare/types/keyless_certificates/keyless_certificate.py @@ -0,0 +1,48 @@ +# 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 .tunnel import Tunnel +from ..._models import BaseModel + +__all__ = ["KeylessCertificate"] + + +class KeylessCertificate(BaseModel): + id: str + """Keyless certificate identifier tag.""" + + created_on: datetime + """When the Keyless SSL was created.""" + + enabled: bool + """Whether or not the Keyless SSL is on or off.""" + + host: str + """The keyless SSL name.""" + + modified_on: datetime + """When the Keyless SSL was last modified.""" + + name: str + """The keyless SSL name.""" + + permissions: List[object] + """ + Available permissions for the Keyless SSL for the current user requesting the + item. + """ + + port: float + """ + The keyless SSL port used to communicate between Cloudflare and the client's + Keyless SSL server. + """ + + status: Literal["active", "deleted"] + """Status of the Keyless SSL.""" + + tunnel: Optional[Tunnel] = None + """Configuration for using Keyless SSL through a Cloudflare Tunnel""" diff --git a/src/cloudflare/types/keyless_certificates/keyless_certificate_create_params.py b/src/cloudflare/types/keyless_certificates/keyless_certificate_create_params.py new file mode 100644 index 00000000000..eb5ac3a6285 --- /dev/null +++ b/src/cloudflare/types/keyless_certificates/keyless_certificate_create_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .tunnel_param import TunnelParam +from ..custom_hostnames.bundle_method import BundleMethod + +__all__ = ["KeylessCertificateCreateParams"] + + +class KeylessCertificateCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + certificate: Required[str] + """The zone's SSL certificate or SSL certificate and intermediate(s).""" + + host: Required[str] + """The keyless SSL name.""" + + port: Required[float] + """ + The keyless SSL port used to communicate between Cloudflare and the client's + Keyless SSL server. + """ + + bundle_method: BundleMethod + """ + A ubiquitous bundle has the highest probability of being verified everywhere, + even by clients using outdated or unusual trust stores. An optimal bundle uses + the shortest chain and newest intermediates. And the force bundle verifies the + chain, but does not otherwise modify it. + """ + + name: str + """The keyless SSL name.""" + + tunnel: TunnelParam + """Configuration for using Keyless SSL through a Cloudflare Tunnel""" diff --git a/src/cloudflare/types/keyless_certificates/keyless_certificate_delete_params.py b/src/cloudflare/types/keyless_certificates/keyless_certificate_delete_params.py new file mode 100644 index 00000000000..0c01222a189 --- /dev/null +++ b/src/cloudflare/types/keyless_certificates/keyless_certificate_delete_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__ = ["KeylessCertificateDeleteParams"] + + +class KeylessCertificateDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/keyless_certificate_delete_response.py b/src/cloudflare/types/keyless_certificates/keyless_certificate_delete_response.py similarity index 89% rename from src/cloudflare/types/keyless_certificate_delete_response.py rename to src/cloudflare/types/keyless_certificates/keyless_certificate_delete_response.py index f21484a947b..9544ffc0d28 100644 --- a/src/cloudflare/types/keyless_certificate_delete_response.py +++ b/src/cloudflare/types/keyless_certificates/keyless_certificate_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["KeylessCertificateDeleteResponse"] diff --git a/src/cloudflare/types/keyless_certificates/keyless_certificate_edit_params.py b/src/cloudflare/types/keyless_certificates/keyless_certificate_edit_params.py new file mode 100644 index 00000000000..1aba961af6a --- /dev/null +++ b/src/cloudflare/types/keyless_certificates/keyless_certificate_edit_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .tunnel_param import TunnelParam + +__all__ = ["KeylessCertificateEditParams"] + + +class KeylessCertificateEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + enabled: bool + """Whether or not the Keyless SSL is on or off.""" + + host: str + """The keyless SSL name.""" + + name: str + """The keyless SSL name.""" + + port: float + """ + The keyless SSL port used to communicate between Cloudflare and the client's + Keyless SSL server. + """ + + tunnel: TunnelParam + """Configuration for using Keyless SSL through a Cloudflare Tunnel""" diff --git a/src/cloudflare/types/keyless_certificates/tunnel.py b/src/cloudflare/types/keyless_certificates/tunnel.py new file mode 100644 index 00000000000..825ea03f94e --- /dev/null +++ b/src/cloudflare/types/keyless_certificates/tunnel.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Tunnel"] + + +class Tunnel(BaseModel): + private_ip: str + """Private IP of the Key Server Host""" + + vnet_id: str + """Cloudflare Tunnel Virtual Network ID""" diff --git a/src/cloudflare/types/keyless_certificates/tunnel_param.py b/src/cloudflare/types/keyless_certificates/tunnel_param.py new file mode 100644 index 00000000000..c6ebab906b6 --- /dev/null +++ b/src/cloudflare/types/keyless_certificates/tunnel_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["TunnelParam"] + + +class TunnelParam(TypedDict, total=False): + private_ip: Required[str] + """Private IP of the Key Server Host""" + + vnet_id: Required[str] + """Cloudflare Tunnel Virtual Network ID""" diff --git a/src/cloudflare/types/kv/__init__.py b/src/cloudflare/types/kv/__init__.py index a68fce2e67a..266c496fe4f 100644 --- a/src/cloudflare/types/kv/__init__.py +++ b/src/cloudflare/types/kv/__init__.py @@ -2,9 +2,10 @@ from __future__ import annotations -from .workers_kv_namespace import WorkersKVNamespace as WorkersKVNamespace +from .namespace import Namespace as Namespace from .namespace_list_params import NamespaceListParams as NamespaceListParams from .namespace_create_params import NamespaceCreateParams as NamespaceCreateParams +from .namespace_delete_params import NamespaceDeleteParams as NamespaceDeleteParams from .namespace_update_params import NamespaceUpdateParams as NamespaceUpdateParams from .namespace_delete_response import NamespaceDeleteResponse as NamespaceDeleteResponse from .namespace_update_response import NamespaceUpdateResponse as NamespaceUpdateResponse diff --git a/src/cloudflare/types/kv/namespace.py b/src/cloudflare/types/kv/namespace.py new file mode 100644 index 00000000000..cac0817cd75 --- /dev/null +++ b/src/cloudflare/types/kv/namespace.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Namespace"] + + +class Namespace(BaseModel): + id: str + """Namespace identifier tag.""" + + title: str + """A human-readable string name for a Namespace.""" + + supports_url_encoding: Optional[bool] = None + """True if keys written on the URL will be URL-decoded before storing. + + For example, if set to "true", a key written on the URL as "%3F" will be stored + as "?". + """ diff --git a/src/cloudflare/types/kv/namespace_delete_params.py b/src/cloudflare/types/kv/namespace_delete_params.py new file mode 100644 index 00000000000..6746fa4e15b --- /dev/null +++ b/src/cloudflare/types/kv/namespace_delete_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__ = ["NamespaceDeleteParams"] + + +class NamespaceDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/kv/namespaces/__init__.py b/src/cloudflare/types/kv/namespaces/__init__.py index 7683fb68790..4d7671ae206 100644 --- a/src/cloudflare/types/kv/namespaces/__init__.py +++ b/src/cloudflare/types/kv/namespaces/__init__.py @@ -2,11 +2,12 @@ from __future__ import annotations -from .workers_kv_key import WorkersKVKey as WorkersKVKey +from .key import Key as Key from .key_list_params import KeyListParams as KeyListParams from .bulk_delete_params import BulkDeleteParams as BulkDeleteParams from .bulk_update_params import BulkUpdateParams as BulkUpdateParams from .value_get_response import ValueGetResponse as ValueGetResponse +from .value_delete_params import ValueDeleteParams as ValueDeleteParams from .value_update_params import ValueUpdateParams as ValueUpdateParams from .bulk_delete_response import BulkDeleteResponse as BulkDeleteResponse from .bulk_update_response import BulkUpdateResponse as BulkUpdateResponse diff --git a/src/cloudflare/types/kv/namespaces/key.py b/src/cloudflare/types/kv/namespaces/key.py new file mode 100644 index 00000000000..604b5d06192 --- /dev/null +++ b/src/cloudflare/types/kv/namespaces/key.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["Key"] + + +class Key(BaseModel): + name: str + """A key's name. + + The name may be at most 512 bytes. All printable, non-whitespace characters are + valid. Use percent-encoding to define key names as part of a URL. + """ + + expiration: Optional[float] = None + """ + The time, measured in number of seconds since the UNIX epoch, at which the key + will expire. This property is omitted for keys that will not expire. + """ + + metadata: Optional[object] = None + """Arbitrary JSON that is associated with a key.""" diff --git a/src/cloudflare/types/kv/namespaces/value_delete_params.py b/src/cloudflare/types/kv/namespaces/value_delete_params.py new file mode 100644 index 00000000000..fa7adc789f1 --- /dev/null +++ b/src/cloudflare/types/kv/namespaces/value_delete_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__ = ["ValueDeleteParams"] + + +class ValueDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + namespace_id: Required[str] + """Namespace identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/kv/namespaces/workers_kv_key.py b/src/cloudflare/types/kv/namespaces/workers_kv_key.py deleted file mode 100644 index ff696e08b12..00000000000 --- a/src/cloudflare/types/kv/namespaces/workers_kv_key.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["WorkersKVKey"] - - -class WorkersKVKey(BaseModel): - name: str - """A key's name. - - The name may be at most 512 bytes. All printable, non-whitespace characters are - valid. Use percent-encoding to define key names as part of a URL. - """ - - expiration: Optional[float] = None - """ - The time, measured in number of seconds since the UNIX epoch, at which the key - will expire. This property is omitted for keys that will not expire. - """ - - metadata: Optional[object] = None - """Arbitrary JSON that is associated with a key.""" diff --git a/src/cloudflare/types/kv/workers_kv_namespace.py b/src/cloudflare/types/kv/workers_kv_namespace.py deleted file mode 100644 index 1b98e28f558..00000000000 --- a/src/cloudflare/types/kv/workers_kv_namespace.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["WorkersKVNamespace"] - - -class WorkersKVNamespace(BaseModel): - id: str - """Namespace identifier tag.""" - - title: str - """A human-readable string name for a Namespace.""" - - supports_url_encoding: Optional[bool] = None - """True if keys written on the URL will be URL-decoded before storing. - - For example, if set to "true", a key written on the URL as "%3F" will be stored - as "?". - """ diff --git a/src/cloudflare/types/load_balancer.py b/src/cloudflare/types/load_balancer.py deleted file mode 100644 index 45befbeb8a2..00000000000 --- a/src/cloudflare/types/load_balancer.py +++ /dev/null @@ -1,635 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = [ - "LoadBalancer", - "AdaptiveRouting", - "LocationStrategy", - "RandomSteering", - "Rule", - "RuleFixedResponse", - "RuleOverrides", - "RuleOverridesAdaptiveRouting", - "RuleOverridesLocationStrategy", - "RuleOverridesRandomSteering", - "RuleOverridesSessionAffinityAttributes", - "SessionAffinityAttributes", -] - - -class AdaptiveRouting(BaseModel): - failover_across_pools: Optional[bool] = None - """ - Extends zero-downtime failover of requests to healthy origins from alternate - pools, when no healthy alternate exists in the same pool, according to the - failover order defined by traffic and origin steering. When set false (the - default) zero-downtime failover will only occur between origins within the same - pool. See `session_affinity_attributes` for control over when sessions are - broken or reassigned. - """ - - -class LocationStrategy(BaseModel): - mode: Optional[Literal["pop", "resolver_ip"]] = None - """ - Determines the authoritative location when ECS is not preferred, does not exist - in the request, or its GeoIP lookup is unsuccessful. - - - `"pop"`: Use the Cloudflare PoP location. - - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is - unsuccessful, use the Cloudflare PoP location. - """ - - prefer_ecs: Optional[Literal["always", "never", "proximity", "geo"]] = None - """ - Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the - authoritative location. - - - `"always"`: Always prefer ECS. - - `"never"`: Never prefer ECS. - - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. - - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - """ - - -class RandomSteering(BaseModel): - default_weight: Optional[float] = None - """ - The default weight for pools in the load balancer that are not specified in the - pool_weights map. - """ - - pool_weights: Optional[object] = None - """A mapping of pool IDs to custom weights. - - The weight is relative to other pools in the load balancer. - """ - - -class RuleFixedResponse(BaseModel): - content_type: Optional[str] = None - """The http 'Content-Type' header to include in the response.""" - - location: Optional[str] = None - """The http 'Location' header to include in the response.""" - - message_body: Optional[str] = None - """Text to include as the http body.""" - - status_code: Optional[int] = None - """The http status code to respond with.""" - - -class RuleOverridesAdaptiveRouting(BaseModel): - failover_across_pools: Optional[bool] = None - """ - Extends zero-downtime failover of requests to healthy origins from alternate - pools, when no healthy alternate exists in the same pool, according to the - failover order defined by traffic and origin steering. When set false (the - default) zero-downtime failover will only occur between origins within the same - pool. See `session_affinity_attributes` for control over when sessions are - broken or reassigned. - """ - - -class RuleOverridesLocationStrategy(BaseModel): - mode: Optional[Literal["pop", "resolver_ip"]] = None - """ - Determines the authoritative location when ECS is not preferred, does not exist - in the request, or its GeoIP lookup is unsuccessful. - - - `"pop"`: Use the Cloudflare PoP location. - - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is - unsuccessful, use the Cloudflare PoP location. - """ - - prefer_ecs: Optional[Literal["always", "never", "proximity", "geo"]] = None - """ - Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the - authoritative location. - - - `"always"`: Always prefer ECS. - - `"never"`: Never prefer ECS. - - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. - - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - """ - - -class RuleOverridesRandomSteering(BaseModel): - default_weight: Optional[float] = None - """ - The default weight for pools in the load balancer that are not specified in the - pool_weights map. - """ - - pool_weights: Optional[object] = None - """A mapping of pool IDs to custom weights. - - The weight is relative to other pools in the load balancer. - """ - - -class RuleOverridesSessionAffinityAttributes(BaseModel): - drain_duration: Optional[float] = None - """Configures the drain duration in seconds. - - This field is only used when session affinity is enabled on the load balancer. - """ - - headers: Optional[List[str]] = None - """ - Configures the names of HTTP headers to base session affinity on when header - `session_affinity` is enabled. At least one HTTP header name must be provided. - To specify the exact cookies to be used, include an item in the following - format: `"cookie:,"` (example) where everything - after the colon is a comma-separated list of cookie names. Providing only - `"cookie"` will result in all cookies being used. The default max number of HTTP - header names that can be provided depends on your plan: 5 for Enterprise, 1 for - all other plans. - """ - - require_all_headers: Optional[bool] = None - """ - When header `session_affinity` is enabled, this option can be used to specify - how HTTP headers on load balancing requests will be used. The supported values - are: - - - `"true"`: Load balancing requests must contain _all_ of the HTTP headers - specified by the `headers` session affinity attribute, otherwise sessions - aren't created. - - `"false"`: Load balancing requests must contain _at least one_ of the HTTP - headers specified by the `headers` session affinity attribute, otherwise - sessions aren't created. - """ - - samesite: Optional[Literal["Auto", "Lax", "None", "Strict"]] = None - """Configures the SameSite attribute on session affinity cookie. - - Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS - is enabled. Note: when using value "None", the secure attribute can not be set - to "Never". - """ - - secure: Optional[Literal["Auto", "Always", "Never"]] = None - """Configures the Secure attribute on session affinity cookie. - - Value "Always" indicates the Secure attribute will be set in the Set-Cookie - header, "Never" indicates the Secure attribute will not be set, and "Auto" will - set the Secure attribute depending if Always Use HTTPS is enabled. - """ - - zero_downtime_failover: Optional[Literal["none", "temporary", "sticky"]] = None - """ - Configures the zero-downtime failover between origins within a pool when session - affinity is enabled. This feature is currently incompatible with Argo, Tiered - Cache, and Bandwidth Alliance. The supported values are: - - - `"none"`: No failover takes place for sessions pinned to the origin (default). - - `"temporary"`: Traffic will be sent to another other healthy origin until the - originally pinned origin is available; note that this can potentially result - in heavy origin flapping. - - `"sticky"`: The session affinity cookie is updated and subsequent requests are - sent to the new origin. Note: Zero-downtime failover with sticky sessions is - currently not supported for session affinity by header. - """ - - -class RuleOverrides(BaseModel): - adaptive_routing: Optional[RuleOverridesAdaptiveRouting] = None - """ - Controls features that modify the routing of requests to pools and origins in - response to dynamic conditions, such as during the interval between active - health monitoring requests. For example, zero-downtime failover occurs - immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 - response codes. If there is another healthy origin in the same pool, the request - is retried once against this alternate origin. - """ - - country_pools: Optional[object] = None - """ - A mapping of country codes to a list of pool IDs (ordered by their failover - priority) for the given country. Any country not explicitly defined will fall - back to using the corresponding region_pool mapping if it exists else to - default_pools. - """ - - default_pools: Optional[List[str]] = None - """A list of pool IDs ordered by their failover priority. - - Pools defined here are used by default, or when region_pools are not configured - for a given region. - """ - - fallback_pool: Optional[object] = None - """The pool ID to use when all other pools are detected as unhealthy.""" - - location_strategy: Optional[RuleOverridesLocationStrategy] = None - """Controls location-based steering for non-proxied requests. - - See `steering_policy` to learn how steering is affected. - """ - - pop_pools: Optional[object] = None - """ - (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs - (ordered by their failover priority) for the PoP (datacenter). Any PoPs not - explicitly defined will fall back to using the corresponding country_pool, then - region_pool mapping if it exists else to default_pools. - """ - - random_steering: Optional[RuleOverridesRandomSteering] = None - """Configures pool weights. - - - `steering_policy="random"`: A random pool is selected with probability - proportional to pool weights. - - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each - pool's outstanding requests. - - `steering_policy="least_connections"`: Use pool weights to scale each pool's - open connections. - """ - - region_pools: Optional[object] = None - """ - A mapping of region codes to a list of pool IDs (ordered by their failover - priority) for the given region. Any regions not explicitly defined will fall - back to using default_pools. - """ - - session_affinity: Optional[Literal["none", "cookie", "ip_cookie", "header", '""']] = None - """ - Specifies the type of session affinity the load balancer should use unless - specified as `"none"` or "" (default). The supported types are: - - - `"cookie"`: On the first request to a proxied load balancer, a cookie is - generated, encoding information of which origin the request will be forwarded - to. Subsequent requests, by the same client to the same load balancer, will be - sent to the origin server the cookie encodes, for the duration of the cookie - and as long as the origin server remains healthy. If the cookie has expired or - the origin server is unhealthy, then a new origin server is calculated and - used. - - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin - selection is stable and based on the client's ip address. - - `"header"`: On the first request to a proxied load balancer, a session key - based on the configured HTTP headers (see - `session_affinity_attributes.headers`) is generated, encoding the request - headers used for storing in the load balancer session state which origin the - request will be forwarded to. Subsequent requests to the load balancer with - the same headers will be sent to the same origin server, for the duration of - the session and as long as the origin server remains healthy. If the session - has been idle for the duration of `session_affinity_ttl` seconds or the origin - server is unhealthy, then a new origin server is calculated and used. See - `headers` in `session_affinity_attributes` for additional required - configuration. - """ - - session_affinity_attributes: Optional[RuleOverridesSessionAffinityAttributes] = None - """Configures attributes for session affinity.""" - - session_affinity_ttl: Optional[float] = None - """Time, in seconds, until a client's session expires after being created. - - Once the expiry time has been reached, subsequent requests may get sent to a - different origin server. The accepted ranges per `session_affinity` policy are: - - - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used - unless explicitly set. The accepted range of values is between [1800, 604800]. - - `"header"`: The current default of 1800 seconds will be used unless explicitly - set. The accepted range of values is between [30, 3600]. Note: With session - affinity by header, sessions only expire after they haven't been used for the - number of seconds specified. - """ - - steering_policy: Optional[ - Literal[ - "off", - "geo", - "random", - "dynamic_latency", - "proximity", - "least_outstanding_requests", - "least_connections", - '""', - ] - ] = None - """Steering Policy for this load balancer. - - - `"off"`: Use `default_pools`. - - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied - requests, the country for `country_pools` is determined by - `location_strategy`. - - `"random"`: Select a pool randomly. - - `"dynamic_latency"`: Use round trip time to select the closest pool in - default_pools (requires pool health checks). - - `"proximity"`: Use the pools' latitude and longitude to select the closest - pool using the Cloudflare PoP location for proxied requests or the location - determined by `location_strategy` for non-proxied requests. - - `"least_outstanding_requests"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of outstanding - requests. Pools with more pending requests are weighted proportionately less - relative to others. - - `"least_connections"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of open connections. - Pools with more open connections are weighted proportionately less relative to - others. Supported for HTTP/1 and HTTP/2 connections. - - `""`: Will map to `"geo"` if you use - `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - """ - - ttl: Optional[float] = None - """ - Time to live (TTL) of the DNS entry for the IP address returned by this load - balancer. This only applies to gray-clouded (unproxied) load balancers. - """ - - -class Rule(BaseModel): - condition: Optional[str] = None - """The condition expressions to evaluate. - - If the condition evaluates to true, the overrides or fixed_response in this rule - will be applied. An empty condition is always true. For more details on - condition expressions, please see - https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions. - """ - - disabled: Optional[bool] = None - """Disable this specific rule. - - It will no longer be evaluated by this load balancer. - """ - - fixed_response: Optional[RuleFixedResponse] = None - """ - A collection of fields used to directly respond to the eyeball instead of - routing to a pool. If a fixed_response is supplied the rule will be marked as - terminates. - """ - - name: Optional[str] = None - """Name of this rule. Only used for human readability.""" - - overrides: Optional[RuleOverrides] = None - """ - A collection of overrides to apply to the load balancer when this rule's - condition is true. All fields are optional. - """ - - priority: Optional[int] = None - """The order in which rules should be executed in relation to each other. - - Lower values are executed first. Values do not need to be sequential. If no - value is provided for any rule the array order of the rules field will be used - to assign a priority. - """ - - terminates: Optional[bool] = None - """ - If this rule's condition is true, this causes rule evaluation to stop after - processing this rule. - """ - - -class SessionAffinityAttributes(BaseModel): - drain_duration: Optional[float] = None - """Configures the drain duration in seconds. - - This field is only used when session affinity is enabled on the load balancer. - """ - - headers: Optional[List[str]] = None - """ - Configures the names of HTTP headers to base session affinity on when header - `session_affinity` is enabled. At least one HTTP header name must be provided. - To specify the exact cookies to be used, include an item in the following - format: `"cookie:,"` (example) where everything - after the colon is a comma-separated list of cookie names. Providing only - `"cookie"` will result in all cookies being used. The default max number of HTTP - header names that can be provided depends on your plan: 5 for Enterprise, 1 for - all other plans. - """ - - require_all_headers: Optional[bool] = None - """ - When header `session_affinity` is enabled, this option can be used to specify - how HTTP headers on load balancing requests will be used. The supported values - are: - - - `"true"`: Load balancing requests must contain _all_ of the HTTP headers - specified by the `headers` session affinity attribute, otherwise sessions - aren't created. - - `"false"`: Load balancing requests must contain _at least one_ of the HTTP - headers specified by the `headers` session affinity attribute, otherwise - sessions aren't created. - """ - - samesite: Optional[Literal["Auto", "Lax", "None", "Strict"]] = None - """Configures the SameSite attribute on session affinity cookie. - - Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS - is enabled. Note: when using value "None", the secure attribute can not be set - to "Never". - """ - - secure: Optional[Literal["Auto", "Always", "Never"]] = None - """Configures the Secure attribute on session affinity cookie. - - Value "Always" indicates the Secure attribute will be set in the Set-Cookie - header, "Never" indicates the Secure attribute will not be set, and "Auto" will - set the Secure attribute depending if Always Use HTTPS is enabled. - """ - - zero_downtime_failover: Optional[Literal["none", "temporary", "sticky"]] = None - """ - Configures the zero-downtime failover between origins within a pool when session - affinity is enabled. This feature is currently incompatible with Argo, Tiered - Cache, and Bandwidth Alliance. The supported values are: - - - `"none"`: No failover takes place for sessions pinned to the origin (default). - - `"temporary"`: Traffic will be sent to another other healthy origin until the - originally pinned origin is available; note that this can potentially result - in heavy origin flapping. - - `"sticky"`: The session affinity cookie is updated and subsequent requests are - sent to the new origin. Note: Zero-downtime failover with sticky sessions is - currently not supported for session affinity by header. - """ - - -class LoadBalancer(BaseModel): - id: Optional[str] = None - - adaptive_routing: Optional[AdaptiveRouting] = None - """ - Controls features that modify the routing of requests to pools and origins in - response to dynamic conditions, such as during the interval between active - health monitoring requests. For example, zero-downtime failover occurs - immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 - response codes. If there is another healthy origin in the same pool, the request - is retried once against this alternate origin. - """ - - country_pools: Optional[object] = None - """ - A mapping of country codes to a list of pool IDs (ordered by their failover - priority) for the given country. Any country not explicitly defined will fall - back to using the corresponding region_pool mapping if it exists else to - default_pools. - """ - - created_on: Optional[datetime] = None - - default_pools: Optional[List[str]] = None - """A list of pool IDs ordered by their failover priority. - - Pools defined here are used by default, or when region_pools are not configured - for a given region. - """ - - description: Optional[str] = None - """Object description.""" - - enabled: Optional[bool] = None - """Whether to enable (the default) this load balancer.""" - - fallback_pool: Optional[object] = None - """The pool ID to use when all other pools are detected as unhealthy.""" - - location_strategy: Optional[LocationStrategy] = None - """Controls location-based steering for non-proxied requests. - - See `steering_policy` to learn how steering is affected. - """ - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """The DNS hostname to associate with your Load Balancer. - - If this hostname already exists as a DNS record in Cloudflare's DNS, the Load - Balancer will take precedence and the DNS record will not be used. - """ - - pop_pools: Optional[object] = None - """ - (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs - (ordered by their failover priority) for the PoP (datacenter). Any PoPs not - explicitly defined will fall back to using the corresponding country_pool, then - region_pool mapping if it exists else to default_pools. - """ - - proxied: Optional[bool] = None - """Whether the hostname should be gray clouded (false) or orange clouded (true).""" - - random_steering: Optional[RandomSteering] = None - """Configures pool weights. - - - `steering_policy="random"`: A random pool is selected with probability - proportional to pool weights. - - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each - pool's outstanding requests. - - `steering_policy="least_connections"`: Use pool weights to scale each pool's - open connections. - """ - - region_pools: Optional[object] = None - """ - A mapping of region codes to a list of pool IDs (ordered by their failover - priority) for the given region. Any regions not explicitly defined will fall - back to using default_pools. - """ - - rules: Optional[List[Rule]] = None - """ - BETA Field Not General Access: A list of rules for this load balancer to - execute. - """ - - session_affinity: Optional[Literal["none", "cookie", "ip_cookie", "header", '""']] = None - """ - Specifies the type of session affinity the load balancer should use unless - specified as `"none"` or "" (default). The supported types are: - - - `"cookie"`: On the first request to a proxied load balancer, a cookie is - generated, encoding information of which origin the request will be forwarded - to. Subsequent requests, by the same client to the same load balancer, will be - sent to the origin server the cookie encodes, for the duration of the cookie - and as long as the origin server remains healthy. If the cookie has expired or - the origin server is unhealthy, then a new origin server is calculated and - used. - - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin - selection is stable and based on the client's ip address. - - `"header"`: On the first request to a proxied load balancer, a session key - based on the configured HTTP headers (see - `session_affinity_attributes.headers`) is generated, encoding the request - headers used for storing in the load balancer session state which origin the - request will be forwarded to. Subsequent requests to the load balancer with - the same headers will be sent to the same origin server, for the duration of - the session and as long as the origin server remains healthy. If the session - has been idle for the duration of `session_affinity_ttl` seconds or the origin - server is unhealthy, then a new origin server is calculated and used. See - `headers` in `session_affinity_attributes` for additional required - configuration. - """ - - session_affinity_attributes: Optional[SessionAffinityAttributes] = None - """Configures attributes for session affinity.""" - - session_affinity_ttl: Optional[float] = None - """Time, in seconds, until a client's session expires after being created. - - Once the expiry time has been reached, subsequent requests may get sent to a - different origin server. The accepted ranges per `session_affinity` policy are: - - - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used - unless explicitly set. The accepted range of values is between [1800, 604800]. - - `"header"`: The current default of 1800 seconds will be used unless explicitly - set. The accepted range of values is between [30, 3600]. Note: With session - affinity by header, sessions only expire after they haven't been used for the - number of seconds specified. - """ - - steering_policy: Optional[ - Literal[ - "off", - "geo", - "random", - "dynamic_latency", - "proximity", - "least_outstanding_requests", - "least_connections", - '""', - ] - ] = None - """Steering Policy for this load balancer. - - - `"off"`: Use `default_pools`. - - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied - requests, the country for `country_pools` is determined by - `location_strategy`. - - `"random"`: Select a pool randomly. - - `"dynamic_latency"`: Use round trip time to select the closest pool in - default_pools (requires pool health checks). - - `"proximity"`: Use the pools' latitude and longitude to select the closest - pool using the Cloudflare PoP location for proxied requests or the location - determined by `location_strategy` for non-proxied requests. - - `"least_outstanding_requests"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of outstanding - requests. Pools with more pending requests are weighted proportionately less - relative to others. - - `"least_connections"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of open connections. - Pools with more open connections are weighted proportionately less relative to - others. Supported for HTTP/1 and HTTP/2 connections. - - `""`: Will map to `"geo"` if you use - `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - """ - - ttl: Optional[float] = None - """ - Time to live (TTL) of the DNS entry for the IP address returned by this load - balancer. This only applies to gray-clouded (unproxied) load balancers. - """ diff --git a/src/cloudflare/types/load_balancer_create_params.py b/src/cloudflare/types/load_balancer_create_params.py deleted file mode 100644 index 36749b01b03..00000000000 --- a/src/cloudflare/types/load_balancer_create_params.py +++ /dev/null @@ -1,609 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = [ - "LoadBalancerCreateParams", - "AdaptiveRouting", - "LocationStrategy", - "RandomSteering", - "Rule", - "RuleFixedResponse", - "RuleOverrides", - "RuleOverridesAdaptiveRouting", - "RuleOverridesLocationStrategy", - "RuleOverridesRandomSteering", - "RuleOverridesSessionAffinityAttributes", - "SessionAffinityAttributes", -] - - -class LoadBalancerCreateParams(TypedDict, total=False): - zone_id: Required[str] - - default_pools: Required[List[str]] - """A list of pool IDs ordered by their failover priority. - - Pools defined here are used by default, or when region_pools are not configured - for a given region. - """ - - fallback_pool: Required[object] - """The pool ID to use when all other pools are detected as unhealthy.""" - - name: Required[str] - """The DNS hostname to associate with your Load Balancer. - - If this hostname already exists as a DNS record in Cloudflare's DNS, the Load - Balancer will take precedence and the DNS record will not be used. - """ - - adaptive_routing: AdaptiveRouting - """ - Controls features that modify the routing of requests to pools and origins in - response to dynamic conditions, such as during the interval between active - health monitoring requests. For example, zero-downtime failover occurs - immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 - response codes. If there is another healthy origin in the same pool, the request - is retried once against this alternate origin. - """ - - country_pools: object - """ - A mapping of country codes to a list of pool IDs (ordered by their failover - priority) for the given country. Any country not explicitly defined will fall - back to using the corresponding region_pool mapping if it exists else to - default_pools. - """ - - description: str - """Object description.""" - - location_strategy: LocationStrategy - """Controls location-based steering for non-proxied requests. - - See `steering_policy` to learn how steering is affected. - """ - - pop_pools: object - """ - (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs - (ordered by their failover priority) for the PoP (datacenter). Any PoPs not - explicitly defined will fall back to using the corresponding country_pool, then - region_pool mapping if it exists else to default_pools. - """ - - proxied: bool - """Whether the hostname should be gray clouded (false) or orange clouded (true).""" - - random_steering: RandomSteering - """Configures pool weights. - - - `steering_policy="random"`: A random pool is selected with probability - proportional to pool weights. - - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each - pool's outstanding requests. - - `steering_policy="least_connections"`: Use pool weights to scale each pool's - open connections. - """ - - region_pools: object - """ - A mapping of region codes to a list of pool IDs (ordered by their failover - priority) for the given region. Any regions not explicitly defined will fall - back to using default_pools. - """ - - rules: Iterable[Rule] - """ - BETA Field Not General Access: A list of rules for this load balancer to - execute. - """ - - session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] - """ - Specifies the type of session affinity the load balancer should use unless - specified as `"none"` or "" (default). The supported types are: - - - `"cookie"`: On the first request to a proxied load balancer, a cookie is - generated, encoding information of which origin the request will be forwarded - to. Subsequent requests, by the same client to the same load balancer, will be - sent to the origin server the cookie encodes, for the duration of the cookie - and as long as the origin server remains healthy. If the cookie has expired or - the origin server is unhealthy, then a new origin server is calculated and - used. - - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin - selection is stable and based on the client's ip address. - - `"header"`: On the first request to a proxied load balancer, a session key - based on the configured HTTP headers (see - `session_affinity_attributes.headers`) is generated, encoding the request - headers used for storing in the load balancer session state which origin the - request will be forwarded to. Subsequent requests to the load balancer with - the same headers will be sent to the same origin server, for the duration of - the session and as long as the origin server remains healthy. If the session - has been idle for the duration of `session_affinity_ttl` seconds or the origin - server is unhealthy, then a new origin server is calculated and used. See - `headers` in `session_affinity_attributes` for additional required - configuration. - """ - - session_affinity_attributes: SessionAffinityAttributes - """Configures attributes for session affinity.""" - - session_affinity_ttl: float - """Time, in seconds, until a client's session expires after being created. - - Once the expiry time has been reached, subsequent requests may get sent to a - different origin server. The accepted ranges per `session_affinity` policy are: - - - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used - unless explicitly set. The accepted range of values is between [1800, 604800]. - - `"header"`: The current default of 1800 seconds will be used unless explicitly - set. The accepted range of values is between [30, 3600]. Note: With session - affinity by header, sessions only expire after they haven't been used for the - number of seconds specified. - """ - - steering_policy: Literal[ - "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' - ] - """Steering Policy for this load balancer. - - - `"off"`: Use `default_pools`. - - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied - requests, the country for `country_pools` is determined by - `location_strategy`. - - `"random"`: Select a pool randomly. - - `"dynamic_latency"`: Use round trip time to select the closest pool in - default_pools (requires pool health checks). - - `"proximity"`: Use the pools' latitude and longitude to select the closest - pool using the Cloudflare PoP location for proxied requests or the location - determined by `location_strategy` for non-proxied requests. - - `"least_outstanding_requests"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of outstanding - requests. Pools with more pending requests are weighted proportionately less - relative to others. - - `"least_connections"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of open connections. - Pools with more open connections are weighted proportionately less relative to - others. Supported for HTTP/1 and HTTP/2 connections. - - `""`: Will map to `"geo"` if you use - `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - """ - - ttl: float - """ - Time to live (TTL) of the DNS entry for the IP address returned by this load - balancer. This only applies to gray-clouded (unproxied) load balancers. - """ - - -class AdaptiveRouting(TypedDict, total=False): - failover_across_pools: bool - """ - Extends zero-downtime failover of requests to healthy origins from alternate - pools, when no healthy alternate exists in the same pool, according to the - failover order defined by traffic and origin steering. When set false (the - default) zero-downtime failover will only occur between origins within the same - pool. See `session_affinity_attributes` for control over when sessions are - broken or reassigned. - """ - - -class LocationStrategy(TypedDict, total=False): - mode: Literal["pop", "resolver_ip"] - """ - Determines the authoritative location when ECS is not preferred, does not exist - in the request, or its GeoIP lookup is unsuccessful. - - - `"pop"`: Use the Cloudflare PoP location. - - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is - unsuccessful, use the Cloudflare PoP location. - """ - - prefer_ecs: Literal["always", "never", "proximity", "geo"] - """ - Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the - authoritative location. - - - `"always"`: Always prefer ECS. - - `"never"`: Never prefer ECS. - - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. - - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - """ - - -class RandomSteering(TypedDict, total=False): - default_weight: float - """ - The default weight for pools in the load balancer that are not specified in the - pool_weights map. - """ - - pool_weights: object - """A mapping of pool IDs to custom weights. - - The weight is relative to other pools in the load balancer. - """ - - -class RuleFixedResponse(TypedDict, total=False): - content_type: str - """The http 'Content-Type' header to include in the response.""" - - location: str - """The http 'Location' header to include in the response.""" - - message_body: str - """Text to include as the http body.""" - - status_code: int - """The http status code to respond with.""" - - -class RuleOverridesAdaptiveRouting(TypedDict, total=False): - failover_across_pools: bool - """ - Extends zero-downtime failover of requests to healthy origins from alternate - pools, when no healthy alternate exists in the same pool, according to the - failover order defined by traffic and origin steering. When set false (the - default) zero-downtime failover will only occur between origins within the same - pool. See `session_affinity_attributes` for control over when sessions are - broken or reassigned. - """ - - -class RuleOverridesLocationStrategy(TypedDict, total=False): - mode: Literal["pop", "resolver_ip"] - """ - Determines the authoritative location when ECS is not preferred, does not exist - in the request, or its GeoIP lookup is unsuccessful. - - - `"pop"`: Use the Cloudflare PoP location. - - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is - unsuccessful, use the Cloudflare PoP location. - """ - - prefer_ecs: Literal["always", "never", "proximity", "geo"] - """ - Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the - authoritative location. - - - `"always"`: Always prefer ECS. - - `"never"`: Never prefer ECS. - - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. - - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - """ - - -class RuleOverridesRandomSteering(TypedDict, total=False): - default_weight: float - """ - The default weight for pools in the load balancer that are not specified in the - pool_weights map. - """ - - pool_weights: object - """A mapping of pool IDs to custom weights. - - The weight is relative to other pools in the load balancer. - """ - - -class RuleOverridesSessionAffinityAttributes(TypedDict, total=False): - drain_duration: float - """Configures the drain duration in seconds. - - This field is only used when session affinity is enabled on the load balancer. - """ - - headers: List[str] - """ - Configures the names of HTTP headers to base session affinity on when header - `session_affinity` is enabled. At least one HTTP header name must be provided. - To specify the exact cookies to be used, include an item in the following - format: `"cookie:,"` (example) where everything - after the colon is a comma-separated list of cookie names. Providing only - `"cookie"` will result in all cookies being used. The default max number of HTTP - header names that can be provided depends on your plan: 5 for Enterprise, 1 for - all other plans. - """ - - require_all_headers: bool - """ - When header `session_affinity` is enabled, this option can be used to specify - how HTTP headers on load balancing requests will be used. The supported values - are: - - - `"true"`: Load balancing requests must contain _all_ of the HTTP headers - specified by the `headers` session affinity attribute, otherwise sessions - aren't created. - - `"false"`: Load balancing requests must contain _at least one_ of the HTTP - headers specified by the `headers` session affinity attribute, otherwise - sessions aren't created. - """ - - samesite: Literal["Auto", "Lax", "None", "Strict"] - """Configures the SameSite attribute on session affinity cookie. - - Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS - is enabled. Note: when using value "None", the secure attribute can not be set - to "Never". - """ - - secure: Literal["Auto", "Always", "Never"] - """Configures the Secure attribute on session affinity cookie. - - Value "Always" indicates the Secure attribute will be set in the Set-Cookie - header, "Never" indicates the Secure attribute will not be set, and "Auto" will - set the Secure attribute depending if Always Use HTTPS is enabled. - """ - - zero_downtime_failover: Literal["none", "temporary", "sticky"] - """ - Configures the zero-downtime failover between origins within a pool when session - affinity is enabled. This feature is currently incompatible with Argo, Tiered - Cache, and Bandwidth Alliance. The supported values are: - - - `"none"`: No failover takes place for sessions pinned to the origin (default). - - `"temporary"`: Traffic will be sent to another other healthy origin until the - originally pinned origin is available; note that this can potentially result - in heavy origin flapping. - - `"sticky"`: The session affinity cookie is updated and subsequent requests are - sent to the new origin. Note: Zero-downtime failover with sticky sessions is - currently not supported for session affinity by header. - """ - - -class RuleOverrides(TypedDict, total=False): - adaptive_routing: RuleOverridesAdaptiveRouting - """ - Controls features that modify the routing of requests to pools and origins in - response to dynamic conditions, such as during the interval between active - health monitoring requests. For example, zero-downtime failover occurs - immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 - response codes. If there is another healthy origin in the same pool, the request - is retried once against this alternate origin. - """ - - country_pools: object - """ - A mapping of country codes to a list of pool IDs (ordered by their failover - priority) for the given country. Any country not explicitly defined will fall - back to using the corresponding region_pool mapping if it exists else to - default_pools. - """ - - default_pools: List[str] - """A list of pool IDs ordered by their failover priority. - - Pools defined here are used by default, or when region_pools are not configured - for a given region. - """ - - fallback_pool: object - """The pool ID to use when all other pools are detected as unhealthy.""" - - location_strategy: RuleOverridesLocationStrategy - """Controls location-based steering for non-proxied requests. - - See `steering_policy` to learn how steering is affected. - """ - - pop_pools: object - """ - (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs - (ordered by their failover priority) for the PoP (datacenter). Any PoPs not - explicitly defined will fall back to using the corresponding country_pool, then - region_pool mapping if it exists else to default_pools. - """ - - random_steering: RuleOverridesRandomSteering - """Configures pool weights. - - - `steering_policy="random"`: A random pool is selected with probability - proportional to pool weights. - - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each - pool's outstanding requests. - - `steering_policy="least_connections"`: Use pool weights to scale each pool's - open connections. - """ - - region_pools: object - """ - A mapping of region codes to a list of pool IDs (ordered by their failover - priority) for the given region. Any regions not explicitly defined will fall - back to using default_pools. - """ - - session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] - """ - Specifies the type of session affinity the load balancer should use unless - specified as `"none"` or "" (default). The supported types are: - - - `"cookie"`: On the first request to a proxied load balancer, a cookie is - generated, encoding information of which origin the request will be forwarded - to. Subsequent requests, by the same client to the same load balancer, will be - sent to the origin server the cookie encodes, for the duration of the cookie - and as long as the origin server remains healthy. If the cookie has expired or - the origin server is unhealthy, then a new origin server is calculated and - used. - - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin - selection is stable and based on the client's ip address. - - `"header"`: On the first request to a proxied load balancer, a session key - based on the configured HTTP headers (see - `session_affinity_attributes.headers`) is generated, encoding the request - headers used for storing in the load balancer session state which origin the - request will be forwarded to. Subsequent requests to the load balancer with - the same headers will be sent to the same origin server, for the duration of - the session and as long as the origin server remains healthy. If the session - has been idle for the duration of `session_affinity_ttl` seconds or the origin - server is unhealthy, then a new origin server is calculated and used. See - `headers` in `session_affinity_attributes` for additional required - configuration. - """ - - session_affinity_attributes: RuleOverridesSessionAffinityAttributes - """Configures attributes for session affinity.""" - - session_affinity_ttl: float - """Time, in seconds, until a client's session expires after being created. - - Once the expiry time has been reached, subsequent requests may get sent to a - different origin server. The accepted ranges per `session_affinity` policy are: - - - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used - unless explicitly set. The accepted range of values is between [1800, 604800]. - - `"header"`: The current default of 1800 seconds will be used unless explicitly - set. The accepted range of values is between [30, 3600]. Note: With session - affinity by header, sessions only expire after they haven't been used for the - number of seconds specified. - """ - - steering_policy: Literal[ - "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' - ] - """Steering Policy for this load balancer. - - - `"off"`: Use `default_pools`. - - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied - requests, the country for `country_pools` is determined by - `location_strategy`. - - `"random"`: Select a pool randomly. - - `"dynamic_latency"`: Use round trip time to select the closest pool in - default_pools (requires pool health checks). - - `"proximity"`: Use the pools' latitude and longitude to select the closest - pool using the Cloudflare PoP location for proxied requests or the location - determined by `location_strategy` for non-proxied requests. - - `"least_outstanding_requests"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of outstanding - requests. Pools with more pending requests are weighted proportionately less - relative to others. - - `"least_connections"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of open connections. - Pools with more open connections are weighted proportionately less relative to - others. Supported for HTTP/1 and HTTP/2 connections. - - `""`: Will map to `"geo"` if you use - `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - """ - - ttl: float - """ - Time to live (TTL) of the DNS entry for the IP address returned by this load - balancer. This only applies to gray-clouded (unproxied) load balancers. - """ - - -class Rule(TypedDict, total=False): - condition: str - """The condition expressions to evaluate. - - If the condition evaluates to true, the overrides or fixed_response in this rule - will be applied. An empty condition is always true. For more details on - condition expressions, please see - https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions. - """ - - disabled: bool - """Disable this specific rule. - - It will no longer be evaluated by this load balancer. - """ - - fixed_response: RuleFixedResponse - """ - A collection of fields used to directly respond to the eyeball instead of - routing to a pool. If a fixed_response is supplied the rule will be marked as - terminates. - """ - - name: str - """Name of this rule. Only used for human readability.""" - - overrides: RuleOverrides - """ - A collection of overrides to apply to the load balancer when this rule's - condition is true. All fields are optional. - """ - - priority: int - """The order in which rules should be executed in relation to each other. - - Lower values are executed first. Values do not need to be sequential. If no - value is provided for any rule the array order of the rules field will be used - to assign a priority. - """ - - terminates: bool - """ - If this rule's condition is true, this causes rule evaluation to stop after - processing this rule. - """ - - -class SessionAffinityAttributes(TypedDict, total=False): - drain_duration: float - """Configures the drain duration in seconds. - - This field is only used when session affinity is enabled on the load balancer. - """ - - headers: List[str] - """ - Configures the names of HTTP headers to base session affinity on when header - `session_affinity` is enabled. At least one HTTP header name must be provided. - To specify the exact cookies to be used, include an item in the following - format: `"cookie:,"` (example) where everything - after the colon is a comma-separated list of cookie names. Providing only - `"cookie"` will result in all cookies being used. The default max number of HTTP - header names that can be provided depends on your plan: 5 for Enterprise, 1 for - all other plans. - """ - - require_all_headers: bool - """ - When header `session_affinity` is enabled, this option can be used to specify - how HTTP headers on load balancing requests will be used. The supported values - are: - - - `"true"`: Load balancing requests must contain _all_ of the HTTP headers - specified by the `headers` session affinity attribute, otherwise sessions - aren't created. - - `"false"`: Load balancing requests must contain _at least one_ of the HTTP - headers specified by the `headers` session affinity attribute, otherwise - sessions aren't created. - """ - - samesite: Literal["Auto", "Lax", "None", "Strict"] - """Configures the SameSite attribute on session affinity cookie. - - Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS - is enabled. Note: when using value "None", the secure attribute can not be set - to "Never". - """ - - secure: Literal["Auto", "Always", "Never"] - """Configures the Secure attribute on session affinity cookie. - - Value "Always" indicates the Secure attribute will be set in the Set-Cookie - header, "Never" indicates the Secure attribute will not be set, and "Auto" will - set the Secure attribute depending if Always Use HTTPS is enabled. - """ - - zero_downtime_failover: Literal["none", "temporary", "sticky"] - """ - Configures the zero-downtime failover between origins within a pool when session - affinity is enabled. This feature is currently incompatible with Argo, Tiered - Cache, and Bandwidth Alliance. The supported values are: - - - `"none"`: No failover takes place for sessions pinned to the origin (default). - - `"temporary"`: Traffic will be sent to another other healthy origin until the - originally pinned origin is available; note that this can potentially result - in heavy origin flapping. - - `"sticky"`: The session affinity cookie is updated and subsequent requests are - sent to the new origin. Note: Zero-downtime failover with sticky sessions is - currently not supported for session affinity by header. - """ diff --git a/src/cloudflare/types/load_balancer_edit_params.py b/src/cloudflare/types/load_balancer_edit_params.py deleted file mode 100644 index cc8d0ebb2be..00000000000 --- a/src/cloudflare/types/load_balancer_edit_params.py +++ /dev/null @@ -1,612 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = [ - "LoadBalancerEditParams", - "AdaptiveRouting", - "LocationStrategy", - "RandomSteering", - "Rule", - "RuleFixedResponse", - "RuleOverrides", - "RuleOverridesAdaptiveRouting", - "RuleOverridesLocationStrategy", - "RuleOverridesRandomSteering", - "RuleOverridesSessionAffinityAttributes", - "SessionAffinityAttributes", -] - - -class LoadBalancerEditParams(TypedDict, total=False): - zone_id: Required[str] - - adaptive_routing: AdaptiveRouting - """ - Controls features that modify the routing of requests to pools and origins in - response to dynamic conditions, such as during the interval between active - health monitoring requests. For example, zero-downtime failover occurs - immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 - response codes. If there is another healthy origin in the same pool, the request - is retried once against this alternate origin. - """ - - country_pools: object - """ - A mapping of country codes to a list of pool IDs (ordered by their failover - priority) for the given country. Any country not explicitly defined will fall - back to using the corresponding region_pool mapping if it exists else to - default_pools. - """ - - default_pools: List[str] - """A list of pool IDs ordered by their failover priority. - - Pools defined here are used by default, or when region_pools are not configured - for a given region. - """ - - description: str - """Object description.""" - - enabled: bool - """Whether to enable (the default) this load balancer.""" - - fallback_pool: object - """The pool ID to use when all other pools are detected as unhealthy.""" - - location_strategy: LocationStrategy - """Controls location-based steering for non-proxied requests. - - See `steering_policy` to learn how steering is affected. - """ - - name: str - """The DNS hostname to associate with your Load Balancer. - - If this hostname already exists as a DNS record in Cloudflare's DNS, the Load - Balancer will take precedence and the DNS record will not be used. - """ - - pop_pools: object - """ - (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs - (ordered by their failover priority) for the PoP (datacenter). Any PoPs not - explicitly defined will fall back to using the corresponding country_pool, then - region_pool mapping if it exists else to default_pools. - """ - - proxied: bool - """Whether the hostname should be gray clouded (false) or orange clouded (true).""" - - random_steering: RandomSteering - """Configures pool weights. - - - `steering_policy="random"`: A random pool is selected with probability - proportional to pool weights. - - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each - pool's outstanding requests. - - `steering_policy="least_connections"`: Use pool weights to scale each pool's - open connections. - """ - - region_pools: object - """ - A mapping of region codes to a list of pool IDs (ordered by their failover - priority) for the given region. Any regions not explicitly defined will fall - back to using default_pools. - """ - - rules: Iterable[Rule] - """ - BETA Field Not General Access: A list of rules for this load balancer to - execute. - """ - - session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] - """ - Specifies the type of session affinity the load balancer should use unless - specified as `"none"` or "" (default). The supported types are: - - - `"cookie"`: On the first request to a proxied load balancer, a cookie is - generated, encoding information of which origin the request will be forwarded - to. Subsequent requests, by the same client to the same load balancer, will be - sent to the origin server the cookie encodes, for the duration of the cookie - and as long as the origin server remains healthy. If the cookie has expired or - the origin server is unhealthy, then a new origin server is calculated and - used. - - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin - selection is stable and based on the client's ip address. - - `"header"`: On the first request to a proxied load balancer, a session key - based on the configured HTTP headers (see - `session_affinity_attributes.headers`) is generated, encoding the request - headers used for storing in the load balancer session state which origin the - request will be forwarded to. Subsequent requests to the load balancer with - the same headers will be sent to the same origin server, for the duration of - the session and as long as the origin server remains healthy. If the session - has been idle for the duration of `session_affinity_ttl` seconds or the origin - server is unhealthy, then a new origin server is calculated and used. See - `headers` in `session_affinity_attributes` for additional required - configuration. - """ - - session_affinity_attributes: SessionAffinityAttributes - """Configures attributes for session affinity.""" - - session_affinity_ttl: float - """Time, in seconds, until a client's session expires after being created. - - Once the expiry time has been reached, subsequent requests may get sent to a - different origin server. The accepted ranges per `session_affinity` policy are: - - - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used - unless explicitly set. The accepted range of values is between [1800, 604800]. - - `"header"`: The current default of 1800 seconds will be used unless explicitly - set. The accepted range of values is between [30, 3600]. Note: With session - affinity by header, sessions only expire after they haven't been used for the - number of seconds specified. - """ - - steering_policy: Literal[ - "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' - ] - """Steering Policy for this load balancer. - - - `"off"`: Use `default_pools`. - - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied - requests, the country for `country_pools` is determined by - `location_strategy`. - - `"random"`: Select a pool randomly. - - `"dynamic_latency"`: Use round trip time to select the closest pool in - default_pools (requires pool health checks). - - `"proximity"`: Use the pools' latitude and longitude to select the closest - pool using the Cloudflare PoP location for proxied requests or the location - determined by `location_strategy` for non-proxied requests. - - `"least_outstanding_requests"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of outstanding - requests. Pools with more pending requests are weighted proportionately less - relative to others. - - `"least_connections"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of open connections. - Pools with more open connections are weighted proportionately less relative to - others. Supported for HTTP/1 and HTTP/2 connections. - - `""`: Will map to `"geo"` if you use - `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - """ - - ttl: float - """ - Time to live (TTL) of the DNS entry for the IP address returned by this load - balancer. This only applies to gray-clouded (unproxied) load balancers. - """ - - -class AdaptiveRouting(TypedDict, total=False): - failover_across_pools: bool - """ - Extends zero-downtime failover of requests to healthy origins from alternate - pools, when no healthy alternate exists in the same pool, according to the - failover order defined by traffic and origin steering. When set false (the - default) zero-downtime failover will only occur between origins within the same - pool. See `session_affinity_attributes` for control over when sessions are - broken or reassigned. - """ - - -class LocationStrategy(TypedDict, total=False): - mode: Literal["pop", "resolver_ip"] - """ - Determines the authoritative location when ECS is not preferred, does not exist - in the request, or its GeoIP lookup is unsuccessful. - - - `"pop"`: Use the Cloudflare PoP location. - - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is - unsuccessful, use the Cloudflare PoP location. - """ - - prefer_ecs: Literal["always", "never", "proximity", "geo"] - """ - Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the - authoritative location. - - - `"always"`: Always prefer ECS. - - `"never"`: Never prefer ECS. - - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. - - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - """ - - -class RandomSteering(TypedDict, total=False): - default_weight: float - """ - The default weight for pools in the load balancer that are not specified in the - pool_weights map. - """ - - pool_weights: object - """A mapping of pool IDs to custom weights. - - The weight is relative to other pools in the load balancer. - """ - - -class RuleFixedResponse(TypedDict, total=False): - content_type: str - """The http 'Content-Type' header to include in the response.""" - - location: str - """The http 'Location' header to include in the response.""" - - message_body: str - """Text to include as the http body.""" - - status_code: int - """The http status code to respond with.""" - - -class RuleOverridesAdaptiveRouting(TypedDict, total=False): - failover_across_pools: bool - """ - Extends zero-downtime failover of requests to healthy origins from alternate - pools, when no healthy alternate exists in the same pool, according to the - failover order defined by traffic and origin steering. When set false (the - default) zero-downtime failover will only occur between origins within the same - pool. See `session_affinity_attributes` for control over when sessions are - broken or reassigned. - """ - - -class RuleOverridesLocationStrategy(TypedDict, total=False): - mode: Literal["pop", "resolver_ip"] - """ - Determines the authoritative location when ECS is not preferred, does not exist - in the request, or its GeoIP lookup is unsuccessful. - - - `"pop"`: Use the Cloudflare PoP location. - - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is - unsuccessful, use the Cloudflare PoP location. - """ - - prefer_ecs: Literal["always", "never", "proximity", "geo"] - """ - Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the - authoritative location. - - - `"always"`: Always prefer ECS. - - `"never"`: Never prefer ECS. - - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. - - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - """ - - -class RuleOverridesRandomSteering(TypedDict, total=False): - default_weight: float - """ - The default weight for pools in the load balancer that are not specified in the - pool_weights map. - """ - - pool_weights: object - """A mapping of pool IDs to custom weights. - - The weight is relative to other pools in the load balancer. - """ - - -class RuleOverridesSessionAffinityAttributes(TypedDict, total=False): - drain_duration: float - """Configures the drain duration in seconds. - - This field is only used when session affinity is enabled on the load balancer. - """ - - headers: List[str] - """ - Configures the names of HTTP headers to base session affinity on when header - `session_affinity` is enabled. At least one HTTP header name must be provided. - To specify the exact cookies to be used, include an item in the following - format: `"cookie:,"` (example) where everything - after the colon is a comma-separated list of cookie names. Providing only - `"cookie"` will result in all cookies being used. The default max number of HTTP - header names that can be provided depends on your plan: 5 for Enterprise, 1 for - all other plans. - """ - - require_all_headers: bool - """ - When header `session_affinity` is enabled, this option can be used to specify - how HTTP headers on load balancing requests will be used. The supported values - are: - - - `"true"`: Load balancing requests must contain _all_ of the HTTP headers - specified by the `headers` session affinity attribute, otherwise sessions - aren't created. - - `"false"`: Load balancing requests must contain _at least one_ of the HTTP - headers specified by the `headers` session affinity attribute, otherwise - sessions aren't created. - """ - - samesite: Literal["Auto", "Lax", "None", "Strict"] - """Configures the SameSite attribute on session affinity cookie. - - Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS - is enabled. Note: when using value "None", the secure attribute can not be set - to "Never". - """ - - secure: Literal["Auto", "Always", "Never"] - """Configures the Secure attribute on session affinity cookie. - - Value "Always" indicates the Secure attribute will be set in the Set-Cookie - header, "Never" indicates the Secure attribute will not be set, and "Auto" will - set the Secure attribute depending if Always Use HTTPS is enabled. - """ - - zero_downtime_failover: Literal["none", "temporary", "sticky"] - """ - Configures the zero-downtime failover between origins within a pool when session - affinity is enabled. This feature is currently incompatible with Argo, Tiered - Cache, and Bandwidth Alliance. The supported values are: - - - `"none"`: No failover takes place for sessions pinned to the origin (default). - - `"temporary"`: Traffic will be sent to another other healthy origin until the - originally pinned origin is available; note that this can potentially result - in heavy origin flapping. - - `"sticky"`: The session affinity cookie is updated and subsequent requests are - sent to the new origin. Note: Zero-downtime failover with sticky sessions is - currently not supported for session affinity by header. - """ - - -class RuleOverrides(TypedDict, total=False): - adaptive_routing: RuleOverridesAdaptiveRouting - """ - Controls features that modify the routing of requests to pools and origins in - response to dynamic conditions, such as during the interval between active - health monitoring requests. For example, zero-downtime failover occurs - immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 - response codes. If there is another healthy origin in the same pool, the request - is retried once against this alternate origin. - """ - - country_pools: object - """ - A mapping of country codes to a list of pool IDs (ordered by their failover - priority) for the given country. Any country not explicitly defined will fall - back to using the corresponding region_pool mapping if it exists else to - default_pools. - """ - - default_pools: List[str] - """A list of pool IDs ordered by their failover priority. - - Pools defined here are used by default, or when region_pools are not configured - for a given region. - """ - - fallback_pool: object - """The pool ID to use when all other pools are detected as unhealthy.""" - - location_strategy: RuleOverridesLocationStrategy - """Controls location-based steering for non-proxied requests. - - See `steering_policy` to learn how steering is affected. - """ - - pop_pools: object - """ - (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs - (ordered by their failover priority) for the PoP (datacenter). Any PoPs not - explicitly defined will fall back to using the corresponding country_pool, then - region_pool mapping if it exists else to default_pools. - """ - - random_steering: RuleOverridesRandomSteering - """Configures pool weights. - - - `steering_policy="random"`: A random pool is selected with probability - proportional to pool weights. - - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each - pool's outstanding requests. - - `steering_policy="least_connections"`: Use pool weights to scale each pool's - open connections. - """ - - region_pools: object - """ - A mapping of region codes to a list of pool IDs (ordered by their failover - priority) for the given region. Any regions not explicitly defined will fall - back to using default_pools. - """ - - session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] - """ - Specifies the type of session affinity the load balancer should use unless - specified as `"none"` or "" (default). The supported types are: - - - `"cookie"`: On the first request to a proxied load balancer, a cookie is - generated, encoding information of which origin the request will be forwarded - to. Subsequent requests, by the same client to the same load balancer, will be - sent to the origin server the cookie encodes, for the duration of the cookie - and as long as the origin server remains healthy. If the cookie has expired or - the origin server is unhealthy, then a new origin server is calculated and - used. - - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin - selection is stable and based on the client's ip address. - - `"header"`: On the first request to a proxied load balancer, a session key - based on the configured HTTP headers (see - `session_affinity_attributes.headers`) is generated, encoding the request - headers used for storing in the load balancer session state which origin the - request will be forwarded to. Subsequent requests to the load balancer with - the same headers will be sent to the same origin server, for the duration of - the session and as long as the origin server remains healthy. If the session - has been idle for the duration of `session_affinity_ttl` seconds or the origin - server is unhealthy, then a new origin server is calculated and used. See - `headers` in `session_affinity_attributes` for additional required - configuration. - """ - - session_affinity_attributes: RuleOverridesSessionAffinityAttributes - """Configures attributes for session affinity.""" - - session_affinity_ttl: float - """Time, in seconds, until a client's session expires after being created. - - Once the expiry time has been reached, subsequent requests may get sent to a - different origin server. The accepted ranges per `session_affinity` policy are: - - - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used - unless explicitly set. The accepted range of values is between [1800, 604800]. - - `"header"`: The current default of 1800 seconds will be used unless explicitly - set. The accepted range of values is between [30, 3600]. Note: With session - affinity by header, sessions only expire after they haven't been used for the - number of seconds specified. - """ - - steering_policy: Literal[ - "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' - ] - """Steering Policy for this load balancer. - - - `"off"`: Use `default_pools`. - - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied - requests, the country for `country_pools` is determined by - `location_strategy`. - - `"random"`: Select a pool randomly. - - `"dynamic_latency"`: Use round trip time to select the closest pool in - default_pools (requires pool health checks). - - `"proximity"`: Use the pools' latitude and longitude to select the closest - pool using the Cloudflare PoP location for proxied requests or the location - determined by `location_strategy` for non-proxied requests. - - `"least_outstanding_requests"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of outstanding - requests. Pools with more pending requests are weighted proportionately less - relative to others. - - `"least_connections"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of open connections. - Pools with more open connections are weighted proportionately less relative to - others. Supported for HTTP/1 and HTTP/2 connections. - - `""`: Will map to `"geo"` if you use - `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - """ - - ttl: float - """ - Time to live (TTL) of the DNS entry for the IP address returned by this load - balancer. This only applies to gray-clouded (unproxied) load balancers. - """ - - -class Rule(TypedDict, total=False): - condition: str - """The condition expressions to evaluate. - - If the condition evaluates to true, the overrides or fixed_response in this rule - will be applied. An empty condition is always true. For more details on - condition expressions, please see - https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions. - """ - - disabled: bool - """Disable this specific rule. - - It will no longer be evaluated by this load balancer. - """ - - fixed_response: RuleFixedResponse - """ - A collection of fields used to directly respond to the eyeball instead of - routing to a pool. If a fixed_response is supplied the rule will be marked as - terminates. - """ - - name: str - """Name of this rule. Only used for human readability.""" - - overrides: RuleOverrides - """ - A collection of overrides to apply to the load balancer when this rule's - condition is true. All fields are optional. - """ - - priority: int - """The order in which rules should be executed in relation to each other. - - Lower values are executed first. Values do not need to be sequential. If no - value is provided for any rule the array order of the rules field will be used - to assign a priority. - """ - - terminates: bool - """ - If this rule's condition is true, this causes rule evaluation to stop after - processing this rule. - """ - - -class SessionAffinityAttributes(TypedDict, total=False): - drain_duration: float - """Configures the drain duration in seconds. - - This field is only used when session affinity is enabled on the load balancer. - """ - - headers: List[str] - """ - Configures the names of HTTP headers to base session affinity on when header - `session_affinity` is enabled. At least one HTTP header name must be provided. - To specify the exact cookies to be used, include an item in the following - format: `"cookie:,"` (example) where everything - after the colon is a comma-separated list of cookie names. Providing only - `"cookie"` will result in all cookies being used. The default max number of HTTP - header names that can be provided depends on your plan: 5 for Enterprise, 1 for - all other plans. - """ - - require_all_headers: bool - """ - When header `session_affinity` is enabled, this option can be used to specify - how HTTP headers on load balancing requests will be used. The supported values - are: - - - `"true"`: Load balancing requests must contain _all_ of the HTTP headers - specified by the `headers` session affinity attribute, otherwise sessions - aren't created. - - `"false"`: Load balancing requests must contain _at least one_ of the HTTP - headers specified by the `headers` session affinity attribute, otherwise - sessions aren't created. - """ - - samesite: Literal["Auto", "Lax", "None", "Strict"] - """Configures the SameSite attribute on session affinity cookie. - - Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS - is enabled. Note: when using value "None", the secure attribute can not be set - to "Never". - """ - - secure: Literal["Auto", "Always", "Never"] - """Configures the Secure attribute on session affinity cookie. - - Value "Always" indicates the Secure attribute will be set in the Set-Cookie - header, "Never" indicates the Secure attribute will not be set, and "Auto" will - set the Secure attribute depending if Always Use HTTPS is enabled. - """ - - zero_downtime_failover: Literal["none", "temporary", "sticky"] - """ - Configures the zero-downtime failover between origins within a pool when session - affinity is enabled. This feature is currently incompatible with Argo, Tiered - Cache, and Bandwidth Alliance. The supported values are: - - - `"none"`: No failover takes place for sessions pinned to the origin (default). - - `"temporary"`: Traffic will be sent to another other healthy origin until the - originally pinned origin is available; note that this can potentially result - in heavy origin flapping. - - `"sticky"`: The session affinity cookie is updated and subsequent requests are - sent to the new origin. Note: Zero-downtime failover with sticky sessions is - currently not supported for session affinity by header. - """ diff --git a/src/cloudflare/types/load_balancer_update_params.py b/src/cloudflare/types/load_balancer_update_params.py deleted file mode 100644 index 3972613f048..00000000000 --- a/src/cloudflare/types/load_balancer_update_params.py +++ /dev/null @@ -1,612 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = [ - "LoadBalancerUpdateParams", - "AdaptiveRouting", - "LocationStrategy", - "RandomSteering", - "Rule", - "RuleFixedResponse", - "RuleOverrides", - "RuleOverridesAdaptiveRouting", - "RuleOverridesLocationStrategy", - "RuleOverridesRandomSteering", - "RuleOverridesSessionAffinityAttributes", - "SessionAffinityAttributes", -] - - -class LoadBalancerUpdateParams(TypedDict, total=False): - zone_id: Required[str] - - default_pools: Required[List[str]] - """A list of pool IDs ordered by their failover priority. - - Pools defined here are used by default, or when region_pools are not configured - for a given region. - """ - - fallback_pool: Required[object] - """The pool ID to use when all other pools are detected as unhealthy.""" - - name: Required[str] - """The DNS hostname to associate with your Load Balancer. - - If this hostname already exists as a DNS record in Cloudflare's DNS, the Load - Balancer will take precedence and the DNS record will not be used. - """ - - adaptive_routing: AdaptiveRouting - """ - Controls features that modify the routing of requests to pools and origins in - response to dynamic conditions, such as during the interval between active - health monitoring requests. For example, zero-downtime failover occurs - immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 - response codes. If there is another healthy origin in the same pool, the request - is retried once against this alternate origin. - """ - - country_pools: object - """ - A mapping of country codes to a list of pool IDs (ordered by their failover - priority) for the given country. Any country not explicitly defined will fall - back to using the corresponding region_pool mapping if it exists else to - default_pools. - """ - - description: str - """Object description.""" - - enabled: bool - """Whether to enable (the default) this load balancer.""" - - location_strategy: LocationStrategy - """Controls location-based steering for non-proxied requests. - - See `steering_policy` to learn how steering is affected. - """ - - pop_pools: object - """ - (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs - (ordered by their failover priority) for the PoP (datacenter). Any PoPs not - explicitly defined will fall back to using the corresponding country_pool, then - region_pool mapping if it exists else to default_pools. - """ - - proxied: bool - """Whether the hostname should be gray clouded (false) or orange clouded (true).""" - - random_steering: RandomSteering - """Configures pool weights. - - - `steering_policy="random"`: A random pool is selected with probability - proportional to pool weights. - - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each - pool's outstanding requests. - - `steering_policy="least_connections"`: Use pool weights to scale each pool's - open connections. - """ - - region_pools: object - """ - A mapping of region codes to a list of pool IDs (ordered by their failover - priority) for the given region. Any regions not explicitly defined will fall - back to using default_pools. - """ - - rules: Iterable[Rule] - """ - BETA Field Not General Access: A list of rules for this load balancer to - execute. - """ - - session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] - """ - Specifies the type of session affinity the load balancer should use unless - specified as `"none"` or "" (default). The supported types are: - - - `"cookie"`: On the first request to a proxied load balancer, a cookie is - generated, encoding information of which origin the request will be forwarded - to. Subsequent requests, by the same client to the same load balancer, will be - sent to the origin server the cookie encodes, for the duration of the cookie - and as long as the origin server remains healthy. If the cookie has expired or - the origin server is unhealthy, then a new origin server is calculated and - used. - - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin - selection is stable and based on the client's ip address. - - `"header"`: On the first request to a proxied load balancer, a session key - based on the configured HTTP headers (see - `session_affinity_attributes.headers`) is generated, encoding the request - headers used for storing in the load balancer session state which origin the - request will be forwarded to. Subsequent requests to the load balancer with - the same headers will be sent to the same origin server, for the duration of - the session and as long as the origin server remains healthy. If the session - has been idle for the duration of `session_affinity_ttl` seconds or the origin - server is unhealthy, then a new origin server is calculated and used. See - `headers` in `session_affinity_attributes` for additional required - configuration. - """ - - session_affinity_attributes: SessionAffinityAttributes - """Configures attributes for session affinity.""" - - session_affinity_ttl: float - """Time, in seconds, until a client's session expires after being created. - - Once the expiry time has been reached, subsequent requests may get sent to a - different origin server. The accepted ranges per `session_affinity` policy are: - - - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used - unless explicitly set. The accepted range of values is between [1800, 604800]. - - `"header"`: The current default of 1800 seconds will be used unless explicitly - set. The accepted range of values is between [30, 3600]. Note: With session - affinity by header, sessions only expire after they haven't been used for the - number of seconds specified. - """ - - steering_policy: Literal[ - "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' - ] - """Steering Policy for this load balancer. - - - `"off"`: Use `default_pools`. - - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied - requests, the country for `country_pools` is determined by - `location_strategy`. - - `"random"`: Select a pool randomly. - - `"dynamic_latency"`: Use round trip time to select the closest pool in - default_pools (requires pool health checks). - - `"proximity"`: Use the pools' latitude and longitude to select the closest - pool using the Cloudflare PoP location for proxied requests or the location - determined by `location_strategy` for non-proxied requests. - - `"least_outstanding_requests"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of outstanding - requests. Pools with more pending requests are weighted proportionately less - relative to others. - - `"least_connections"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of open connections. - Pools with more open connections are weighted proportionately less relative to - others. Supported for HTTP/1 and HTTP/2 connections. - - `""`: Will map to `"geo"` if you use - `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - """ - - ttl: float - """ - Time to live (TTL) of the DNS entry for the IP address returned by this load - balancer. This only applies to gray-clouded (unproxied) load balancers. - """ - - -class AdaptiveRouting(TypedDict, total=False): - failover_across_pools: bool - """ - Extends zero-downtime failover of requests to healthy origins from alternate - pools, when no healthy alternate exists in the same pool, according to the - failover order defined by traffic and origin steering. When set false (the - default) zero-downtime failover will only occur between origins within the same - pool. See `session_affinity_attributes` for control over when sessions are - broken or reassigned. - """ - - -class LocationStrategy(TypedDict, total=False): - mode: Literal["pop", "resolver_ip"] - """ - Determines the authoritative location when ECS is not preferred, does not exist - in the request, or its GeoIP lookup is unsuccessful. - - - `"pop"`: Use the Cloudflare PoP location. - - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is - unsuccessful, use the Cloudflare PoP location. - """ - - prefer_ecs: Literal["always", "never", "proximity", "geo"] - """ - Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the - authoritative location. - - - `"always"`: Always prefer ECS. - - `"never"`: Never prefer ECS. - - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. - - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - """ - - -class RandomSteering(TypedDict, total=False): - default_weight: float - """ - The default weight for pools in the load balancer that are not specified in the - pool_weights map. - """ - - pool_weights: object - """A mapping of pool IDs to custom weights. - - The weight is relative to other pools in the load balancer. - """ - - -class RuleFixedResponse(TypedDict, total=False): - content_type: str - """The http 'Content-Type' header to include in the response.""" - - location: str - """The http 'Location' header to include in the response.""" - - message_body: str - """Text to include as the http body.""" - - status_code: int - """The http status code to respond with.""" - - -class RuleOverridesAdaptiveRouting(TypedDict, total=False): - failover_across_pools: bool - """ - Extends zero-downtime failover of requests to healthy origins from alternate - pools, when no healthy alternate exists in the same pool, according to the - failover order defined by traffic and origin steering. When set false (the - default) zero-downtime failover will only occur between origins within the same - pool. See `session_affinity_attributes` for control over when sessions are - broken or reassigned. - """ - - -class RuleOverridesLocationStrategy(TypedDict, total=False): - mode: Literal["pop", "resolver_ip"] - """ - Determines the authoritative location when ECS is not preferred, does not exist - in the request, or its GeoIP lookup is unsuccessful. - - - `"pop"`: Use the Cloudflare PoP location. - - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is - unsuccessful, use the Cloudflare PoP location. - """ - - prefer_ecs: Literal["always", "never", "proximity", "geo"] - """ - Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the - authoritative location. - - - `"always"`: Always prefer ECS. - - `"never"`: Never prefer ECS. - - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. - - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - """ - - -class RuleOverridesRandomSteering(TypedDict, total=False): - default_weight: float - """ - The default weight for pools in the load balancer that are not specified in the - pool_weights map. - """ - - pool_weights: object - """A mapping of pool IDs to custom weights. - - The weight is relative to other pools in the load balancer. - """ - - -class RuleOverridesSessionAffinityAttributes(TypedDict, total=False): - drain_duration: float - """Configures the drain duration in seconds. - - This field is only used when session affinity is enabled on the load balancer. - """ - - headers: List[str] - """ - Configures the names of HTTP headers to base session affinity on when header - `session_affinity` is enabled. At least one HTTP header name must be provided. - To specify the exact cookies to be used, include an item in the following - format: `"cookie:,"` (example) where everything - after the colon is a comma-separated list of cookie names. Providing only - `"cookie"` will result in all cookies being used. The default max number of HTTP - header names that can be provided depends on your plan: 5 for Enterprise, 1 for - all other plans. - """ - - require_all_headers: bool - """ - When header `session_affinity` is enabled, this option can be used to specify - how HTTP headers on load balancing requests will be used. The supported values - are: - - - `"true"`: Load balancing requests must contain _all_ of the HTTP headers - specified by the `headers` session affinity attribute, otherwise sessions - aren't created. - - `"false"`: Load balancing requests must contain _at least one_ of the HTTP - headers specified by the `headers` session affinity attribute, otherwise - sessions aren't created. - """ - - samesite: Literal["Auto", "Lax", "None", "Strict"] - """Configures the SameSite attribute on session affinity cookie. - - Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS - is enabled. Note: when using value "None", the secure attribute can not be set - to "Never". - """ - - secure: Literal["Auto", "Always", "Never"] - """Configures the Secure attribute on session affinity cookie. - - Value "Always" indicates the Secure attribute will be set in the Set-Cookie - header, "Never" indicates the Secure attribute will not be set, and "Auto" will - set the Secure attribute depending if Always Use HTTPS is enabled. - """ - - zero_downtime_failover: Literal["none", "temporary", "sticky"] - """ - Configures the zero-downtime failover between origins within a pool when session - affinity is enabled. This feature is currently incompatible with Argo, Tiered - Cache, and Bandwidth Alliance. The supported values are: - - - `"none"`: No failover takes place for sessions pinned to the origin (default). - - `"temporary"`: Traffic will be sent to another other healthy origin until the - originally pinned origin is available; note that this can potentially result - in heavy origin flapping. - - `"sticky"`: The session affinity cookie is updated and subsequent requests are - sent to the new origin. Note: Zero-downtime failover with sticky sessions is - currently not supported for session affinity by header. - """ - - -class RuleOverrides(TypedDict, total=False): - adaptive_routing: RuleOverridesAdaptiveRouting - """ - Controls features that modify the routing of requests to pools and origins in - response to dynamic conditions, such as during the interval between active - health monitoring requests. For example, zero-downtime failover occurs - immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 - response codes. If there is another healthy origin in the same pool, the request - is retried once against this alternate origin. - """ - - country_pools: object - """ - A mapping of country codes to a list of pool IDs (ordered by their failover - priority) for the given country. Any country not explicitly defined will fall - back to using the corresponding region_pool mapping if it exists else to - default_pools. - """ - - default_pools: List[str] - """A list of pool IDs ordered by their failover priority. - - Pools defined here are used by default, or when region_pools are not configured - for a given region. - """ - - fallback_pool: object - """The pool ID to use when all other pools are detected as unhealthy.""" - - location_strategy: RuleOverridesLocationStrategy - """Controls location-based steering for non-proxied requests. - - See `steering_policy` to learn how steering is affected. - """ - - pop_pools: object - """ - (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs - (ordered by their failover priority) for the PoP (datacenter). Any PoPs not - explicitly defined will fall back to using the corresponding country_pool, then - region_pool mapping if it exists else to default_pools. - """ - - random_steering: RuleOverridesRandomSteering - """Configures pool weights. - - - `steering_policy="random"`: A random pool is selected with probability - proportional to pool weights. - - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each - pool's outstanding requests. - - `steering_policy="least_connections"`: Use pool weights to scale each pool's - open connections. - """ - - region_pools: object - """ - A mapping of region codes to a list of pool IDs (ordered by their failover - priority) for the given region. Any regions not explicitly defined will fall - back to using default_pools. - """ - - session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] - """ - Specifies the type of session affinity the load balancer should use unless - specified as `"none"` or "" (default). The supported types are: - - - `"cookie"`: On the first request to a proxied load balancer, a cookie is - generated, encoding information of which origin the request will be forwarded - to. Subsequent requests, by the same client to the same load balancer, will be - sent to the origin server the cookie encodes, for the duration of the cookie - and as long as the origin server remains healthy. If the cookie has expired or - the origin server is unhealthy, then a new origin server is calculated and - used. - - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin - selection is stable and based on the client's ip address. - - `"header"`: On the first request to a proxied load balancer, a session key - based on the configured HTTP headers (see - `session_affinity_attributes.headers`) is generated, encoding the request - headers used for storing in the load balancer session state which origin the - request will be forwarded to. Subsequent requests to the load balancer with - the same headers will be sent to the same origin server, for the duration of - the session and as long as the origin server remains healthy. If the session - has been idle for the duration of `session_affinity_ttl` seconds or the origin - server is unhealthy, then a new origin server is calculated and used. See - `headers` in `session_affinity_attributes` for additional required - configuration. - """ - - session_affinity_attributes: RuleOverridesSessionAffinityAttributes - """Configures attributes for session affinity.""" - - session_affinity_ttl: float - """Time, in seconds, until a client's session expires after being created. - - Once the expiry time has been reached, subsequent requests may get sent to a - different origin server. The accepted ranges per `session_affinity` policy are: - - - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used - unless explicitly set. The accepted range of values is between [1800, 604800]. - - `"header"`: The current default of 1800 seconds will be used unless explicitly - set. The accepted range of values is between [30, 3600]. Note: With session - affinity by header, sessions only expire after they haven't been used for the - number of seconds specified. - """ - - steering_policy: Literal[ - "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' - ] - """Steering Policy for this load balancer. - - - `"off"`: Use `default_pools`. - - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied - requests, the country for `country_pools` is determined by - `location_strategy`. - - `"random"`: Select a pool randomly. - - `"dynamic_latency"`: Use round trip time to select the closest pool in - default_pools (requires pool health checks). - - `"proximity"`: Use the pools' latitude and longitude to select the closest - pool using the Cloudflare PoP location for proxied requests or the location - determined by `location_strategy` for non-proxied requests. - - `"least_outstanding_requests"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of outstanding - requests. Pools with more pending requests are weighted proportionately less - relative to others. - - `"least_connections"`: Select a pool by taking into consideration - `random_steering` weights, as well as each pool's number of open connections. - Pools with more open connections are weighted proportionately less relative to - others. Supported for HTTP/1 and HTTP/2 connections. - - `""`: Will map to `"geo"` if you use - `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - """ - - ttl: float - """ - Time to live (TTL) of the DNS entry for the IP address returned by this load - balancer. This only applies to gray-clouded (unproxied) load balancers. - """ - - -class Rule(TypedDict, total=False): - condition: str - """The condition expressions to evaluate. - - If the condition evaluates to true, the overrides or fixed_response in this rule - will be applied. An empty condition is always true. For more details on - condition expressions, please see - https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions. - """ - - disabled: bool - """Disable this specific rule. - - It will no longer be evaluated by this load balancer. - """ - - fixed_response: RuleFixedResponse - """ - A collection of fields used to directly respond to the eyeball instead of - routing to a pool. If a fixed_response is supplied the rule will be marked as - terminates. - """ - - name: str - """Name of this rule. Only used for human readability.""" - - overrides: RuleOverrides - """ - A collection of overrides to apply to the load balancer when this rule's - condition is true. All fields are optional. - """ - - priority: int - """The order in which rules should be executed in relation to each other. - - Lower values are executed first. Values do not need to be sequential. If no - value is provided for any rule the array order of the rules field will be used - to assign a priority. - """ - - terminates: bool - """ - If this rule's condition is true, this causes rule evaluation to stop after - processing this rule. - """ - - -class SessionAffinityAttributes(TypedDict, total=False): - drain_duration: float - """Configures the drain duration in seconds. - - This field is only used when session affinity is enabled on the load balancer. - """ - - headers: List[str] - """ - Configures the names of HTTP headers to base session affinity on when header - `session_affinity` is enabled. At least one HTTP header name must be provided. - To specify the exact cookies to be used, include an item in the following - format: `"cookie:,"` (example) where everything - after the colon is a comma-separated list of cookie names. Providing only - `"cookie"` will result in all cookies being used. The default max number of HTTP - header names that can be provided depends on your plan: 5 for Enterprise, 1 for - all other plans. - """ - - require_all_headers: bool - """ - When header `session_affinity` is enabled, this option can be used to specify - how HTTP headers on load balancing requests will be used. The supported values - are: - - - `"true"`: Load balancing requests must contain _all_ of the HTTP headers - specified by the `headers` session affinity attribute, otherwise sessions - aren't created. - - `"false"`: Load balancing requests must contain _at least one_ of the HTTP - headers specified by the `headers` session affinity attribute, otherwise - sessions aren't created. - """ - - samesite: Literal["Auto", "Lax", "None", "Strict"] - """Configures the SameSite attribute on session affinity cookie. - - Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS - is enabled. Note: when using value "None", the secure attribute can not be set - to "Never". - """ - - secure: Literal["Auto", "Always", "Never"] - """Configures the Secure attribute on session affinity cookie. - - Value "Always" indicates the Secure attribute will be set in the Set-Cookie - header, "Never" indicates the Secure attribute will not be set, and "Auto" will - set the Secure attribute depending if Always Use HTTPS is enabled. - """ - - zero_downtime_failover: Literal["none", "temporary", "sticky"] - """ - Configures the zero-downtime failover between origins within a pool when session - affinity is enabled. This feature is currently incompatible with Argo, Tiered - Cache, and Bandwidth Alliance. The supported values are: - - - `"none"`: No failover takes place for sessions pinned to the origin (default). - - `"temporary"`: Traffic will be sent to another other healthy origin until the - originally pinned origin is available; note that this can potentially result - in heavy origin flapping. - - `"sticky"`: The session affinity cookie is updated and subsequent requests are - sent to the new origin. Note: Zero-downtime failover with sticky sessions is - currently not supported for session affinity by header. - """ diff --git a/src/cloudflare/types/load_balancers/__init__.py b/src/cloudflare/types/load_balancers/__init__.py index ec053f79213..22ae0e993e9 100644 --- a/src/cloudflare/types/load_balancers/__init__.py +++ b/src/cloudflare/types/load_balancers/__init__.py @@ -2,17 +2,53 @@ from __future__ import annotations +from .host import Host as Host +from .pool import Pool as Pool +from .rules import Rules as Rules +from .header import Header as Header +from .origin import Origin as Origin +from .monitor import Monitor as Monitor +from .rules_param import RulesParam as RulesParam +from .check_region import CheckRegion as CheckRegion +from .header_param import HeaderParam as HeaderParam +from .origin_param import OriginParam as OriginParam +from .default_pools import DefaultPools as DefaultPools +from .load_balancer import LoadBalancer as LoadBalancer +from .load_shedding import LoadShedding as LoadShedding +from .filter_options import FilterOptions as FilterOptions +from .origin_steering import OriginSteering as OriginSteering +from .random_steering import RandomSteering as RandomSteering +from .adaptive_routing import AdaptiveRouting as AdaptiveRouting from .pool_edit_params import PoolEditParams as PoolEditParams from .pool_list_params import PoolListParams as PoolListParams +from .location_strategy import LocationStrategy as LocationStrategy from .search_get_params import SearchGetParams as SearchGetParams from .pool_create_params import PoolCreateParams as PoolCreateParams +from .pool_delete_params import PoolDeleteParams as PoolDeleteParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .region_list_params import RegionListParams as RegionListParams +from .load_shedding_param import LoadSheddingParam as LoadSheddingParam from .monitor_edit_params import MonitorEditParams as MonitorEditParams +from .notification_filter import NotificationFilter as NotificationFilter from .region_get_response import RegionGetResponse as RegionGetResponse from .search_get_response import SearchGetResponse as SearchGetResponse +from .filter_options_param import FilterOptionsParam as FilterOptionsParam from .pool_delete_response import PoolDeleteResponse as PoolDeleteResponse +from .preview_get_response import PreviewGetResponse as PreviewGetResponse from .region_list_response import RegionListResponse as RegionListResponse from .monitor_create_params import MonitorCreateParams as MonitorCreateParams +from .monitor_delete_params import MonitorDeleteParams as MonitorDeleteParams from .monitor_update_params import MonitorUpdateParams as MonitorUpdateParams +from .origin_steering_param import OriginSteeringParam as OriginSteeringParam +from .random_steering_param import RandomSteeringParam as RandomSteeringParam +from .adaptive_routing_param import AdaptiveRoutingParam as AdaptiveRoutingParam +from .location_strategy_param import LocationStrategyParam as LocationStrategyParam from .monitor_delete_response import MonitorDeleteResponse as MonitorDeleteResponse +from .load_balancer_edit_params import LoadBalancerEditParams as LoadBalancerEditParams +from .notification_filter_param import NotificationFilterParam as NotificationFilterParam +from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams +from .load_balancer_delete_params import LoadBalancerDeleteParams as LoadBalancerDeleteParams +from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams +from .session_affinity_attributes import SessionAffinityAttributes as SessionAffinityAttributes +from .load_balancer_delete_response import LoadBalancerDeleteResponse as LoadBalancerDeleteResponse +from .session_affinity_attributes_param import SessionAffinityAttributesParam as SessionAffinityAttributesParam diff --git a/src/cloudflare/types/load_balancers/adaptive_routing.py b/src/cloudflare/types/load_balancers/adaptive_routing.py new file mode 100644 index 00000000000..b4d03c48652 --- /dev/null +++ b/src/cloudflare/types/load_balancers/adaptive_routing.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["AdaptiveRouting"] + + +class AdaptiveRouting(BaseModel): + failover_across_pools: Optional[bool] = None + """ + Extends zero-downtime failover of requests to healthy origins from alternate + pools, when no healthy alternate exists in the same pool, according to the + failover order defined by traffic and origin steering. When set false (the + default) zero-downtime failover will only occur between origins within the same + pool. See `session_affinity_attributes` for control over when sessions are + broken or reassigned. + """ diff --git a/src/cloudflare/types/load_balancers/adaptive_routing_param.py b/src/cloudflare/types/load_balancers/adaptive_routing_param.py new file mode 100644 index 00000000000..1cb5eb09c3a --- /dev/null +++ b/src/cloudflare/types/load_balancers/adaptive_routing_param.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 TypedDict + +__all__ = ["AdaptiveRoutingParam"] + + +class AdaptiveRoutingParam(TypedDict, total=False): + failover_across_pools: bool + """ + Extends zero-downtime failover of requests to healthy origins from alternate + pools, when no healthy alternate exists in the same pool, according to the + failover order defined by traffic and origin steering. When set false (the + default) zero-downtime failover will only occur between origins within the same + pool. See `session_affinity_attributes` for control over when sessions are + broken or reassigned. + """ diff --git a/src/cloudflare/types/load_balancers/check_region.py b/src/cloudflare/types/load_balancers/check_region.py new file mode 100644 index 00000000000..195c879900e --- /dev/null +++ b/src/cloudflare/types/load_balancers/check_region.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["CheckRegion"] + +CheckRegion = Literal[ + "WNAM", "ENAM", "WEU", "EEU", "NSAM", "SSAM", "OC", "ME", "NAF", "SAF", "SAS", "SEAS", "NEAS", "ALL_REGIONS" +] diff --git a/src/cloudflare/types/load_balancers/default_pools.py b/src/cloudflare/types/load_balancers/default_pools.py new file mode 100644 index 00000000000..80afa57bd13 --- /dev/null +++ b/src/cloudflare/types/load_balancers/default_pools.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["DefaultPools"] + +DefaultPools = str diff --git a/src/cloudflare/types/load_balancers/filter_options.py b/src/cloudflare/types/load_balancers/filter_options.py new file mode 100644 index 00000000000..a1b4b46c17d --- /dev/null +++ b/src/cloudflare/types/load_balancers/filter_options.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["FilterOptions"] + + +class FilterOptions(BaseModel): + disable: Optional[bool] = None + """If set true, disable notifications for this type of resource (pool or origin).""" + + healthy: Optional[bool] = None + """If present, send notifications only for this health status (e.g. + + false for only DOWN events). Use null to reset (all events). + """ diff --git a/src/cloudflare/types/load_balancers/filter_options_param.py b/src/cloudflare/types/load_balancers/filter_options_param.py new file mode 100644 index 00000000000..5fa6ff70390 --- /dev/null +++ b/src/cloudflare/types/load_balancers/filter_options_param.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["FilterOptionsParam"] + + +class FilterOptionsParam(TypedDict, total=False): + disable: bool + """If set true, disable notifications for this type of resource (pool or origin).""" + + healthy: Optional[bool] + """If present, send notifications only for this health status (e.g. + + false for only DOWN events). Use null to reset (all events). + """ diff --git a/src/cloudflare/types/load_balancers/header.py b/src/cloudflare/types/load_balancers/header.py new file mode 100644 index 00000000000..b6bd2830a64 --- /dev/null +++ b/src/cloudflare/types/load_balancers/header.py @@ -0,0 +1,18 @@ +# 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 .host import Host +from ..._models import BaseModel + +__all__ = ["Header"] + + +class Header(BaseModel): + host: Optional[List[Host]] = FieldInfo(alias="Host", default=None) + """The 'Host' header allows to override the hostname set in the HTTP request. + + Current support is 1 'Host' header override per origin. + """ diff --git a/src/cloudflare/types/load_balancers/header_param.py b/src/cloudflare/types/load_balancers/header_param.py new file mode 100644 index 00000000000..b3e837d92f9 --- /dev/null +++ b/src/cloudflare/types/load_balancers/header_param.py @@ -0,0 +1,19 @@ +# 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 Annotated, TypedDict + +from .host import Host +from ..._utils import PropertyInfo + +__all__ = ["HeaderParam"] + + +class HeaderParam(TypedDict, total=False): + host: Annotated[List[Host], PropertyInfo(alias="Host")] + """The 'Host' header allows to override the hostname set in the HTTP request. + + Current support is 1 'Host' header override per origin. + """ diff --git a/src/cloudflare/types/load_balancers/host.py b/src/cloudflare/types/load_balancers/host.py new file mode 100644 index 00000000000..f5b05acf1c6 --- /dev/null +++ b/src/cloudflare/types/load_balancers/host.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["Host"] + +Host = str diff --git a/src/cloudflare/types/load_balancers/load_balancer.py b/src/cloudflare/types/load_balancers/load_balancer.py new file mode 100644 index 00000000000..242171cacb2 --- /dev/null +++ b/src/cloudflare/types/load_balancers/load_balancer.py @@ -0,0 +1,191 @@ +# 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 .rules import Rules +from ..._models import BaseModel +from .default_pools import DefaultPools +from .random_steering import RandomSteering +from .adaptive_routing import AdaptiveRouting +from .location_strategy import LocationStrategy +from .session_affinity_attributes import SessionAffinityAttributes + +__all__ = ["LoadBalancer"] + + +class LoadBalancer(BaseModel): + id: Optional[str] = None + + adaptive_routing: Optional[AdaptiveRouting] = None + """ + Controls features that modify the routing of requests to pools and origins in + response to dynamic conditions, such as during the interval between active + health monitoring requests. For example, zero-downtime failover occurs + immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 + response codes. If there is another healthy origin in the same pool, the request + is retried once against this alternate origin. + """ + + country_pools: Optional[object] = None + """ + A mapping of country codes to a list of pool IDs (ordered by their failover + priority) for the given country. Any country not explicitly defined will fall + back to using the corresponding region_pool mapping if it exists else to + default_pools. + """ + + created_on: Optional[datetime] = None + + default_pools: Optional[List[DefaultPools]] = None + """A list of pool IDs ordered by their failover priority. + + Pools defined here are used by default, or when region_pools are not configured + for a given region. + """ + + description: Optional[str] = None + """Object description.""" + + enabled: Optional[bool] = None + """Whether to enable (the default) this load balancer.""" + + fallback_pool: Optional[object] = None + """The pool ID to use when all other pools are detected as unhealthy.""" + + location_strategy: Optional[LocationStrategy] = None + """Controls location-based steering for non-proxied requests. + + See `steering_policy` to learn how steering is affected. + """ + + modified_on: Optional[datetime] = None + + name: Optional[str] = None + """The DNS hostname to associate with your Load Balancer. + + If this hostname already exists as a DNS record in Cloudflare's DNS, the Load + Balancer will take precedence and the DNS record will not be used. + """ + + pop_pools: Optional[object] = None + """ + (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs + (ordered by their failover priority) for the PoP (datacenter). Any PoPs not + explicitly defined will fall back to using the corresponding country_pool, then + region_pool mapping if it exists else to default_pools. + """ + + proxied: Optional[bool] = None + """Whether the hostname should be gray clouded (false) or orange clouded (true).""" + + random_steering: Optional[RandomSteering] = None + """Configures pool weights. + + - `steering_policy="random"`: A random pool is selected with probability + proportional to pool weights. + - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + pool's outstanding requests. + - `steering_policy="least_connections"`: Use pool weights to scale each pool's + open connections. + """ + + region_pools: Optional[object] = None + """ + A mapping of region codes to a list of pool IDs (ordered by their failover + priority) for the given region. Any regions not explicitly defined will fall + back to using default_pools. + """ + + rules: Optional[List[Rules]] = None + """ + BETA Field Not General Access: A list of rules for this load balancer to + execute. + """ + + session_affinity: Optional[Literal["none", "cookie", "ip_cookie", "header", '""']] = None + """ + Specifies the type of session affinity the load balancer should use unless + specified as `"none"` or "" (default). The supported types are: + + - `"cookie"`: On the first request to a proxied load balancer, a cookie is + generated, encoding information of which origin the request will be forwarded + to. Subsequent requests, by the same client to the same load balancer, will be + sent to the origin server the cookie encodes, for the duration of the cookie + and as long as the origin server remains healthy. If the cookie has expired or + the origin server is unhealthy, then a new origin server is calculated and + used. + - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin + selection is stable and based on the client's ip address. + - `"header"`: On the first request to a proxied load balancer, a session key + based on the configured HTTP headers (see + `session_affinity_attributes.headers`) is generated, encoding the request + headers used for storing in the load balancer session state which origin the + request will be forwarded to. Subsequent requests to the load balancer with + the same headers will be sent to the same origin server, for the duration of + the session and as long as the origin server remains healthy. If the session + has been idle for the duration of `session_affinity_ttl` seconds or the origin + server is unhealthy, then a new origin server is calculated and used. See + `headers` in `session_affinity_attributes` for additional required + configuration. + """ + + session_affinity_attributes: Optional[SessionAffinityAttributes] = None + """Configures attributes for session affinity.""" + + session_affinity_ttl: Optional[float] = None + """Time, in seconds, until a client's session expires after being created. + + Once the expiry time has been reached, subsequent requests may get sent to a + different origin server. The accepted ranges per `session_affinity` policy are: + + - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + unless explicitly set. The accepted range of values is between [1800, 604800]. + - `"header"`: The current default of 1800 seconds will be used unless explicitly + set. The accepted range of values is between [30, 3600]. Note: With session + affinity by header, sessions only expire after they haven't been used for the + number of seconds specified. + """ + + steering_policy: Optional[ + Literal[ + "off", + "geo", + "random", + "dynamic_latency", + "proximity", + "least_outstanding_requests", + "least_connections", + '""', + ] + ] = None + """Steering Policy for this load balancer. + + - `"off"`: Use `default_pools`. + - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied + requests, the country for `country_pools` is determined by + `location_strategy`. + - `"random"`: Select a pool randomly. + - `"dynamic_latency"`: Use round trip time to select the closest pool in + default_pools (requires pool health checks). + - `"proximity"`: Use the pools' latitude and longitude to select the closest + pool using the Cloudflare PoP location for proxied requests or the location + determined by `location_strategy` for non-proxied requests. + - `"least_outstanding_requests"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of outstanding + requests. Pools with more pending requests are weighted proportionately less + relative to others. + - `"least_connections"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of open connections. + Pools with more open connections are weighted proportionately less relative to + others. Supported for HTTP/1 and HTTP/2 connections. + - `""`: Will map to `"geo"` if you use + `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. + """ + + ttl: Optional[float] = None + """ + Time to live (TTL) of the DNS entry for the IP address returned by this load + balancer. This only applies to gray-clouded (unproxied) load balancers. + """ diff --git a/src/cloudflare/types/load_balancers/load_balancer_create_params.py b/src/cloudflare/types/load_balancers/load_balancer_create_params.py new file mode 100644 index 00000000000..173adfbeb31 --- /dev/null +++ b/src/cloudflare/types/load_balancers/load_balancer_create_params.py @@ -0,0 +1,175 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .rules_param import RulesParam +from .default_pools import DefaultPools +from .random_steering_param import RandomSteeringParam +from .adaptive_routing_param import AdaptiveRoutingParam +from .location_strategy_param import LocationStrategyParam +from .session_affinity_attributes_param import SessionAffinityAttributesParam + +__all__ = ["LoadBalancerCreateParams"] + + +class LoadBalancerCreateParams(TypedDict, total=False): + zone_id: Required[str] + + default_pools: Required[List[DefaultPools]] + """A list of pool IDs ordered by their failover priority. + + Pools defined here are used by default, or when region_pools are not configured + for a given region. + """ + + fallback_pool: Required[object] + """The pool ID to use when all other pools are detected as unhealthy.""" + + name: Required[str] + """The DNS hostname to associate with your Load Balancer. + + If this hostname already exists as a DNS record in Cloudflare's DNS, the Load + Balancer will take precedence and the DNS record will not be used. + """ + + adaptive_routing: AdaptiveRoutingParam + """ + Controls features that modify the routing of requests to pools and origins in + response to dynamic conditions, such as during the interval between active + health monitoring requests. For example, zero-downtime failover occurs + immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 + response codes. If there is another healthy origin in the same pool, the request + is retried once against this alternate origin. + """ + + country_pools: object + """ + A mapping of country codes to a list of pool IDs (ordered by their failover + priority) for the given country. Any country not explicitly defined will fall + back to using the corresponding region_pool mapping if it exists else to + default_pools. + """ + + description: str + """Object description.""" + + location_strategy: LocationStrategyParam + """Controls location-based steering for non-proxied requests. + + See `steering_policy` to learn how steering is affected. + """ + + pop_pools: object + """ + (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs + (ordered by their failover priority) for the PoP (datacenter). Any PoPs not + explicitly defined will fall back to using the corresponding country_pool, then + region_pool mapping if it exists else to default_pools. + """ + + proxied: bool + """Whether the hostname should be gray clouded (false) or orange clouded (true).""" + + random_steering: RandomSteeringParam + """Configures pool weights. + + - `steering_policy="random"`: A random pool is selected with probability + proportional to pool weights. + - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + pool's outstanding requests. + - `steering_policy="least_connections"`: Use pool weights to scale each pool's + open connections. + """ + + region_pools: object + """ + A mapping of region codes to a list of pool IDs (ordered by their failover + priority) for the given region. Any regions not explicitly defined will fall + back to using default_pools. + """ + + rules: Iterable[RulesParam] + """ + BETA Field Not General Access: A list of rules for this load balancer to + execute. + """ + + session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] + """ + Specifies the type of session affinity the load balancer should use unless + specified as `"none"` or "" (default). The supported types are: + + - `"cookie"`: On the first request to a proxied load balancer, a cookie is + generated, encoding information of which origin the request will be forwarded + to. Subsequent requests, by the same client to the same load balancer, will be + sent to the origin server the cookie encodes, for the duration of the cookie + and as long as the origin server remains healthy. If the cookie has expired or + the origin server is unhealthy, then a new origin server is calculated and + used. + - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin + selection is stable and based on the client's ip address. + - `"header"`: On the first request to a proxied load balancer, a session key + based on the configured HTTP headers (see + `session_affinity_attributes.headers`) is generated, encoding the request + headers used for storing in the load balancer session state which origin the + request will be forwarded to. Subsequent requests to the load balancer with + the same headers will be sent to the same origin server, for the duration of + the session and as long as the origin server remains healthy. If the session + has been idle for the duration of `session_affinity_ttl` seconds or the origin + server is unhealthy, then a new origin server is calculated and used. See + `headers` in `session_affinity_attributes` for additional required + configuration. + """ + + session_affinity_attributes: SessionAffinityAttributesParam + """Configures attributes for session affinity.""" + + session_affinity_ttl: float + """Time, in seconds, until a client's session expires after being created. + + Once the expiry time has been reached, subsequent requests may get sent to a + different origin server. The accepted ranges per `session_affinity` policy are: + + - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + unless explicitly set. The accepted range of values is between [1800, 604800]. + - `"header"`: The current default of 1800 seconds will be used unless explicitly + set. The accepted range of values is between [30, 3600]. Note: With session + affinity by header, sessions only expire after they haven't been used for the + number of seconds specified. + """ + + steering_policy: Literal[ + "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' + ] + """Steering Policy for this load balancer. + + - `"off"`: Use `default_pools`. + - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied + requests, the country for `country_pools` is determined by + `location_strategy`. + - `"random"`: Select a pool randomly. + - `"dynamic_latency"`: Use round trip time to select the closest pool in + default_pools (requires pool health checks). + - `"proximity"`: Use the pools' latitude and longitude to select the closest + pool using the Cloudflare PoP location for proxied requests or the location + determined by `location_strategy` for non-proxied requests. + - `"least_outstanding_requests"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of outstanding + requests. Pools with more pending requests are weighted proportionately less + relative to others. + - `"least_connections"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of open connections. + Pools with more open connections are weighted proportionately less relative to + others. Supported for HTTP/1 and HTTP/2 connections. + - `""`: Will map to `"geo"` if you use + `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. + """ + + ttl: float + """ + Time to live (TTL) of the DNS entry for the IP address returned by this load + balancer. This only applies to gray-clouded (unproxied) load balancers. + """ diff --git a/src/cloudflare/types/load_balancers/load_balancer_delete_params.py b/src/cloudflare/types/load_balancers/load_balancer_delete_params.py new file mode 100644 index 00000000000..0a984d696bb --- /dev/null +++ b/src/cloudflare/types/load_balancers/load_balancer_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LoadBalancerDeleteParams"] + + +class LoadBalancerDeleteParams(TypedDict, total=False): + zone_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/load_balancer_delete_response.py b/src/cloudflare/types/load_balancers/load_balancer_delete_response.py similarity index 87% rename from src/cloudflare/types/load_balancer_delete_response.py rename to src/cloudflare/types/load_balancers/load_balancer_delete_response.py index 3e1b9e93ee2..d7c7046d701 100644 --- a/src/cloudflare/types/load_balancer_delete_response.py +++ b/src/cloudflare/types/load_balancers/load_balancer_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["LoadBalancerDeleteResponse"] diff --git a/src/cloudflare/types/load_balancers/load_balancer_edit_params.py b/src/cloudflare/types/load_balancers/load_balancer_edit_params.py new file mode 100644 index 00000000000..5848c3bf5ea --- /dev/null +++ b/src/cloudflare/types/load_balancers/load_balancer_edit_params.py @@ -0,0 +1,178 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .rules_param import RulesParam +from .default_pools import DefaultPools +from .random_steering_param import RandomSteeringParam +from .adaptive_routing_param import AdaptiveRoutingParam +from .location_strategy_param import LocationStrategyParam +from .session_affinity_attributes_param import SessionAffinityAttributesParam + +__all__ = ["LoadBalancerEditParams"] + + +class LoadBalancerEditParams(TypedDict, total=False): + zone_id: Required[str] + + adaptive_routing: AdaptiveRoutingParam + """ + Controls features that modify the routing of requests to pools and origins in + response to dynamic conditions, such as during the interval between active + health monitoring requests. For example, zero-downtime failover occurs + immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 + response codes. If there is another healthy origin in the same pool, the request + is retried once against this alternate origin. + """ + + country_pools: object + """ + A mapping of country codes to a list of pool IDs (ordered by their failover + priority) for the given country. Any country not explicitly defined will fall + back to using the corresponding region_pool mapping if it exists else to + default_pools. + """ + + default_pools: List[DefaultPools] + """A list of pool IDs ordered by their failover priority. + + Pools defined here are used by default, or when region_pools are not configured + for a given region. + """ + + description: str + """Object description.""" + + enabled: bool + """Whether to enable (the default) this load balancer.""" + + fallback_pool: object + """The pool ID to use when all other pools are detected as unhealthy.""" + + location_strategy: LocationStrategyParam + """Controls location-based steering for non-proxied requests. + + See `steering_policy` to learn how steering is affected. + """ + + name: str + """The DNS hostname to associate with your Load Balancer. + + If this hostname already exists as a DNS record in Cloudflare's DNS, the Load + Balancer will take precedence and the DNS record will not be used. + """ + + pop_pools: object + """ + (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs + (ordered by their failover priority) for the PoP (datacenter). Any PoPs not + explicitly defined will fall back to using the corresponding country_pool, then + region_pool mapping if it exists else to default_pools. + """ + + proxied: bool + """Whether the hostname should be gray clouded (false) or orange clouded (true).""" + + random_steering: RandomSteeringParam + """Configures pool weights. + + - `steering_policy="random"`: A random pool is selected with probability + proportional to pool weights. + - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + pool's outstanding requests. + - `steering_policy="least_connections"`: Use pool weights to scale each pool's + open connections. + """ + + region_pools: object + """ + A mapping of region codes to a list of pool IDs (ordered by their failover + priority) for the given region. Any regions not explicitly defined will fall + back to using default_pools. + """ + + rules: Iterable[RulesParam] + """ + BETA Field Not General Access: A list of rules for this load balancer to + execute. + """ + + session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] + """ + Specifies the type of session affinity the load balancer should use unless + specified as `"none"` or "" (default). The supported types are: + + - `"cookie"`: On the first request to a proxied load balancer, a cookie is + generated, encoding information of which origin the request will be forwarded + to. Subsequent requests, by the same client to the same load balancer, will be + sent to the origin server the cookie encodes, for the duration of the cookie + and as long as the origin server remains healthy. If the cookie has expired or + the origin server is unhealthy, then a new origin server is calculated and + used. + - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin + selection is stable and based on the client's ip address. + - `"header"`: On the first request to a proxied load balancer, a session key + based on the configured HTTP headers (see + `session_affinity_attributes.headers`) is generated, encoding the request + headers used for storing in the load balancer session state which origin the + request will be forwarded to. Subsequent requests to the load balancer with + the same headers will be sent to the same origin server, for the duration of + the session and as long as the origin server remains healthy. If the session + has been idle for the duration of `session_affinity_ttl` seconds or the origin + server is unhealthy, then a new origin server is calculated and used. See + `headers` in `session_affinity_attributes` for additional required + configuration. + """ + + session_affinity_attributes: SessionAffinityAttributesParam + """Configures attributes for session affinity.""" + + session_affinity_ttl: float + """Time, in seconds, until a client's session expires after being created. + + Once the expiry time has been reached, subsequent requests may get sent to a + different origin server. The accepted ranges per `session_affinity` policy are: + + - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + unless explicitly set. The accepted range of values is between [1800, 604800]. + - `"header"`: The current default of 1800 seconds will be used unless explicitly + set. The accepted range of values is between [30, 3600]. Note: With session + affinity by header, sessions only expire after they haven't been used for the + number of seconds specified. + """ + + steering_policy: Literal[ + "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' + ] + """Steering Policy for this load balancer. + + - `"off"`: Use `default_pools`. + - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied + requests, the country for `country_pools` is determined by + `location_strategy`. + - `"random"`: Select a pool randomly. + - `"dynamic_latency"`: Use round trip time to select the closest pool in + default_pools (requires pool health checks). + - `"proximity"`: Use the pools' latitude and longitude to select the closest + pool using the Cloudflare PoP location for proxied requests or the location + determined by `location_strategy` for non-proxied requests. + - `"least_outstanding_requests"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of outstanding + requests. Pools with more pending requests are weighted proportionately less + relative to others. + - `"least_connections"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of open connections. + Pools with more open connections are weighted proportionately less relative to + others. Supported for HTTP/1 and HTTP/2 connections. + - `""`: Will map to `"geo"` if you use + `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. + """ + + ttl: float + """ + Time to live (TTL) of the DNS entry for the IP address returned by this load + balancer. This only applies to gray-clouded (unproxied) load balancers. + """ diff --git a/src/cloudflare/types/load_balancers/load_balancer_update_params.py b/src/cloudflare/types/load_balancers/load_balancer_update_params.py new file mode 100644 index 00000000000..1c8db91d1c4 --- /dev/null +++ b/src/cloudflare/types/load_balancers/load_balancer_update_params.py @@ -0,0 +1,178 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .rules_param import RulesParam +from .default_pools import DefaultPools +from .random_steering_param import RandomSteeringParam +from .adaptive_routing_param import AdaptiveRoutingParam +from .location_strategy_param import LocationStrategyParam +from .session_affinity_attributes_param import SessionAffinityAttributesParam + +__all__ = ["LoadBalancerUpdateParams"] + + +class LoadBalancerUpdateParams(TypedDict, total=False): + zone_id: Required[str] + + default_pools: Required[List[DefaultPools]] + """A list of pool IDs ordered by their failover priority. + + Pools defined here are used by default, or when region_pools are not configured + for a given region. + """ + + fallback_pool: Required[object] + """The pool ID to use when all other pools are detected as unhealthy.""" + + name: Required[str] + """The DNS hostname to associate with your Load Balancer. + + If this hostname already exists as a DNS record in Cloudflare's DNS, the Load + Balancer will take precedence and the DNS record will not be used. + """ + + adaptive_routing: AdaptiveRoutingParam + """ + Controls features that modify the routing of requests to pools and origins in + response to dynamic conditions, such as during the interval between active + health monitoring requests. For example, zero-downtime failover occurs + immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 + response codes. If there is another healthy origin in the same pool, the request + is retried once against this alternate origin. + """ + + country_pools: object + """ + A mapping of country codes to a list of pool IDs (ordered by their failover + priority) for the given country. Any country not explicitly defined will fall + back to using the corresponding region_pool mapping if it exists else to + default_pools. + """ + + description: str + """Object description.""" + + enabled: bool + """Whether to enable (the default) this load balancer.""" + + location_strategy: LocationStrategyParam + """Controls location-based steering for non-proxied requests. + + See `steering_policy` to learn how steering is affected. + """ + + pop_pools: object + """ + (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs + (ordered by their failover priority) for the PoP (datacenter). Any PoPs not + explicitly defined will fall back to using the corresponding country_pool, then + region_pool mapping if it exists else to default_pools. + """ + + proxied: bool + """Whether the hostname should be gray clouded (false) or orange clouded (true).""" + + random_steering: RandomSteeringParam + """Configures pool weights. + + - `steering_policy="random"`: A random pool is selected with probability + proportional to pool weights. + - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + pool's outstanding requests. + - `steering_policy="least_connections"`: Use pool weights to scale each pool's + open connections. + """ + + region_pools: object + """ + A mapping of region codes to a list of pool IDs (ordered by their failover + priority) for the given region. Any regions not explicitly defined will fall + back to using default_pools. + """ + + rules: Iterable[RulesParam] + """ + BETA Field Not General Access: A list of rules for this load balancer to + execute. + """ + + session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] + """ + Specifies the type of session affinity the load balancer should use unless + specified as `"none"` or "" (default). The supported types are: + + - `"cookie"`: On the first request to a proxied load balancer, a cookie is + generated, encoding information of which origin the request will be forwarded + to. Subsequent requests, by the same client to the same load balancer, will be + sent to the origin server the cookie encodes, for the duration of the cookie + and as long as the origin server remains healthy. If the cookie has expired or + the origin server is unhealthy, then a new origin server is calculated and + used. + - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin + selection is stable and based on the client's ip address. + - `"header"`: On the first request to a proxied load balancer, a session key + based on the configured HTTP headers (see + `session_affinity_attributes.headers`) is generated, encoding the request + headers used for storing in the load balancer session state which origin the + request will be forwarded to. Subsequent requests to the load balancer with + the same headers will be sent to the same origin server, for the duration of + the session and as long as the origin server remains healthy. If the session + has been idle for the duration of `session_affinity_ttl` seconds or the origin + server is unhealthy, then a new origin server is calculated and used. See + `headers` in `session_affinity_attributes` for additional required + configuration. + """ + + session_affinity_attributes: SessionAffinityAttributesParam + """Configures attributes for session affinity.""" + + session_affinity_ttl: float + """Time, in seconds, until a client's session expires after being created. + + Once the expiry time has been reached, subsequent requests may get sent to a + different origin server. The accepted ranges per `session_affinity` policy are: + + - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + unless explicitly set. The accepted range of values is between [1800, 604800]. + - `"header"`: The current default of 1800 seconds will be used unless explicitly + set. The accepted range of values is between [30, 3600]. Note: With session + affinity by header, sessions only expire after they haven't been used for the + number of seconds specified. + """ + + steering_policy: Literal[ + "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' + ] + """Steering Policy for this load balancer. + + - `"off"`: Use `default_pools`. + - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied + requests, the country for `country_pools` is determined by + `location_strategy`. + - `"random"`: Select a pool randomly. + - `"dynamic_latency"`: Use round trip time to select the closest pool in + default_pools (requires pool health checks). + - `"proximity"`: Use the pools' latitude and longitude to select the closest + pool using the Cloudflare PoP location for proxied requests or the location + determined by `location_strategy` for non-proxied requests. + - `"least_outstanding_requests"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of outstanding + requests. Pools with more pending requests are weighted proportionately less + relative to others. + - `"least_connections"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of open connections. + Pools with more open connections are weighted proportionately less relative to + others. Supported for HTTP/1 and HTTP/2 connections. + - `""`: Will map to `"geo"` if you use + `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. + """ + + ttl: float + """ + Time to live (TTL) of the DNS entry for the IP address returned by this load + balancer. This only applies to gray-clouded (unproxied) load balancers. + """ diff --git a/src/cloudflare/types/load_balancers/load_shedding.py b/src/cloudflare/types/load_balancers/load_shedding.py new file mode 100644 index 00000000000..882b6787d30 --- /dev/null +++ b/src/cloudflare/types/load_balancers/load_shedding.py @@ -0,0 +1,36 @@ +# 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__ = ["LoadShedding"] + + +class LoadShedding(BaseModel): + default_percent: Optional[float] = None + """The percent of traffic to shed from the pool, according to the default policy. + + Applies to new sessions and traffic without session affinity. + """ + + default_policy: Optional[Literal["random", "hash"]] = None + """The default policy to use when load shedding. + + A random policy randomly sheds a given percent of requests. A hash policy + computes a hash over the CF-Connecting-IP address and sheds all requests + originating from a percent of IPs. + """ + + session_percent: Optional[float] = None + """ + The percent of existing sessions to shed from the pool, according to the session + policy. + """ + + session_policy: Optional[Literal["hash"]] = None + """ + Only the hash policy is supported for existing sessions (to avoid exponential + decay). + """ diff --git a/src/cloudflare/types/load_balancers/load_shedding_param.py b/src/cloudflare/types/load_balancers/load_shedding_param.py new file mode 100644 index 00000000000..96a271c86a7 --- /dev/null +++ b/src/cloudflare/types/load_balancers/load_shedding_param.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["LoadSheddingParam"] + + +class LoadSheddingParam(TypedDict, total=False): + default_percent: float + """The percent of traffic to shed from the pool, according to the default policy. + + Applies to new sessions and traffic without session affinity. + """ + + default_policy: Literal["random", "hash"] + """The default policy to use when load shedding. + + A random policy randomly sheds a given percent of requests. A hash policy + computes a hash over the CF-Connecting-IP address and sheds all requests + originating from a percent of IPs. + """ + + session_percent: float + """ + The percent of existing sessions to shed from the pool, according to the session + policy. + """ + + session_policy: Literal["hash"] + """ + Only the hash policy is supported for existing sessions (to avoid exponential + decay). + """ diff --git a/src/cloudflare/types/load_balancers/location_strategy.py b/src/cloudflare/types/load_balancers/location_strategy.py new file mode 100644 index 00000000000..87853e3b5d6 --- /dev/null +++ b/src/cloudflare/types/load_balancers/location_strategy.py @@ -0,0 +1,31 @@ +# 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__ = ["LocationStrategy"] + + +class LocationStrategy(BaseModel): + mode: Optional[Literal["pop", "resolver_ip"]] = None + """ + Determines the authoritative location when ECS is not preferred, does not exist + in the request, or its GeoIP lookup is unsuccessful. + + - `"pop"`: Use the Cloudflare PoP location. + - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is + unsuccessful, use the Cloudflare PoP location. + """ + + prefer_ecs: Optional[Literal["always", "never", "proximity", "geo"]] = None + """ + Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the + authoritative location. + + - `"always"`: Always prefer ECS. + - `"never"`: Never prefer ECS. + - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. + - `"geo"`: Prefer ECS only when `steering_policy="geo"`. + """ diff --git a/src/cloudflare/types/load_balancers/location_strategy_param.py b/src/cloudflare/types/load_balancers/location_strategy_param.py new file mode 100644 index 00000000000..232138b3c5d --- /dev/null +++ b/src/cloudflare/types/load_balancers/location_strategy_param.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 Literal, TypedDict + +__all__ = ["LocationStrategyParam"] + + +class LocationStrategyParam(TypedDict, total=False): + mode: Literal["pop", "resolver_ip"] + """ + Determines the authoritative location when ECS is not preferred, does not exist + in the request, or its GeoIP lookup is unsuccessful. + + - `"pop"`: Use the Cloudflare PoP location. + - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is + unsuccessful, use the Cloudflare PoP location. + """ + + prefer_ecs: Literal["always", "never", "proximity", "geo"] + """ + Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the + authoritative location. + + - `"always"`: Always prefer ECS. + - `"never"`: Never prefer ECS. + - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. + - `"geo"`: Prefer ECS only when `steering_policy="geo"`. + """ diff --git a/src/cloudflare/types/load_balancers/monitor.py b/src/cloudflare/types/load_balancers/monitor.py new file mode 100644 index 00000000000..5ab61feed08 --- /dev/null +++ b/src/cloudflare/types/load_balancers/monitor.py @@ -0,0 +1,113 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Monitor"] + + +class Monitor(BaseModel): + id: Optional[str] = None + + allow_insecure: Optional[bool] = None + """Do not validate the certificate when monitor use HTTPS. + + This parameter is currently only valid for HTTP and HTTPS monitors. + """ + + consecutive_down: Optional[int] = None + """ + To be marked unhealthy the monitored origin must fail this healthcheck N + consecutive times. + """ + + consecutive_up: Optional[int] = None + """ + To be marked healthy the monitored origin must pass this healthcheck N + consecutive times. + """ + + created_on: Optional[datetime] = None + + description: Optional[str] = None + """Object description.""" + + expected_body: Optional[str] = None + """A case-insensitive sub-string to look for in the response body. + + If this string is not found, the origin will be marked as unhealthy. This + parameter is only valid for HTTP and HTTPS monitors. + """ + + expected_codes: Optional[str] = None + """The expected HTTP response code or code range of the health check. + + This parameter is only valid for HTTP and HTTPS monitors. + """ + + follow_redirects: Optional[bool] = None + """Follow redirects if returned by the origin. + + This parameter is only valid for HTTP and HTTPS monitors. + """ + + header: Optional[object] = None + """The HTTP request headers to send in the health check. + + It is recommended you set a Host header by default. The User-Agent header cannot + be overridden. This parameter is only valid for HTTP and HTTPS monitors. + """ + + interval: Optional[int] = None + """The interval between each health check. + + Shorter intervals may improve failover time, but will increase load on the + origins as we check from multiple locations. + """ + + method: Optional[str] = None + """The method to use for the health check. + + This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' + for TCP based health checks. + """ + + modified_on: Optional[datetime] = None + + path: Optional[str] = None + """The endpoint path you want to conduct a health check against. + + This parameter is only valid for HTTP and HTTPS monitors. + """ + + port: Optional[int] = None + """The port number to connect to for the health check. + + Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define + the port when using a non-standard port (HTTP: default 80, HTTPS: default 443). + """ + + probe_zone: Optional[str] = None + """Assign this monitor to emulate the specified zone while probing. + + This parameter is only valid for HTTP and HTTPS monitors. + """ + + retries: Optional[int] = None + """ + The number of retries to attempt in case of a timeout before marking the origin + as unhealthy. Retries are attempted immediately. + """ + + timeout: Optional[int] = None + """The timeout (in seconds) before marking the health check as failed.""" + + type: Optional[Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"]] = None + """The protocol to use for the health check. + + Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', + 'UDP-ICMP', and 'SMTP'. + """ diff --git a/src/cloudflare/types/load_balancers/monitor_delete_params.py b/src/cloudflare/types/load_balancers/monitor_delete_params.py new file mode 100644 index 00000000000..3b797bbce86 --- /dev/null +++ b/src/cloudflare/types/load_balancers/monitor_delete_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__ = ["MonitorDeleteParams"] + + +class MonitorDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/load_balancers/notification_filter.py b/src/cloudflare/types/load_balancers/notification_filter.py new file mode 100644 index 00000000000..de6857dea4d --- /dev/null +++ b/src/cloudflare/types/load_balancers/notification_filter.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .filter_options import FilterOptions + +__all__ = ["NotificationFilter"] + + +class NotificationFilter(BaseModel): + origin: Optional[FilterOptions] = None + """Filter options for a particular resource type (pool or origin). + + Use null to reset. + """ + + pool: Optional[FilterOptions] = None + """Filter options for a particular resource type (pool or origin). + + Use null to reset. + """ diff --git a/src/cloudflare/types/load_balancers/notification_filter_param.py b/src/cloudflare/types/load_balancers/notification_filter_param.py new file mode 100644 index 00000000000..ac4daaabaf3 --- /dev/null +++ b/src/cloudflare/types/load_balancers/notification_filter_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +from .filter_options_param import FilterOptionsParam + +__all__ = ["NotificationFilterParam"] + + +class NotificationFilterParam(TypedDict, total=False): + origin: Optional[FilterOptionsParam] + """Filter options for a particular resource type (pool or origin). + + Use null to reset. + """ + + pool: Optional[FilterOptionsParam] + """Filter options for a particular resource type (pool or origin). + + Use null to reset. + """ diff --git a/src/cloudflare/types/load_balancers/origin.py b/src/cloudflare/types/load_balancers/origin.py new file mode 100644 index 00000000000..dda86860147 --- /dev/null +++ b/src/cloudflare/types/load_balancers/origin.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from .header import Header +from ..._models import BaseModel + +__all__ = ["Origin"] + + +class Origin(BaseModel): + address: Optional[str] = None + """ + The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + hostname. Hostnames entered here should resolve directly to the origin, and not + be a hostname proxied by Cloudflare. To set an internal/reserved address, + virtual_network_id must also be set. + """ + + disabled_at: Optional[datetime] = None + """This field shows up only if the origin is disabled. + + This field is set with the time the origin was disabled. + """ + + enabled: Optional[bool] = None + """Whether to enable (the default) this origin within the pool. + + Disabled origins will not receive traffic and are excluded from health checks. + The origin will only be disabled for the current pool. + """ + + header: Optional[Header] = None + """The request header is used to pass additional information with an HTTP request. + + Currently supported header is 'Host'. + """ + + name: Optional[str] = None + """A human-identifiable name for the origin.""" + + virtual_network_id: Optional[str] = None + """The virtual network subnet ID the origin belongs in. + + Virtual network must also belong to the account. + """ + + weight: Optional[float] = None + """The weight of this origin relative to other origins in the pool. + + Based on the configured weight the total traffic is distributed among origins + within the pool. + + - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + origin's outstanding requests. + - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + open connections. + """ diff --git a/src/cloudflare/types/load_balancers/origin_param.py b/src/cloudflare/types/load_balancers/origin_param.py new file mode 100644 index 00000000000..0b35856a9b5 --- /dev/null +++ b/src/cloudflare/types/load_balancers/origin_param.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .header_param import HeaderParam + +__all__ = ["OriginParam"] + + +class OriginParam(TypedDict, total=False): + address: str + """ + The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + hostname. Hostnames entered here should resolve directly to the origin, and not + be a hostname proxied by Cloudflare. To set an internal/reserved address, + virtual_network_id must also be set. + """ + + enabled: bool + """Whether to enable (the default) this origin within the pool. + + Disabled origins will not receive traffic and are excluded from health checks. + The origin will only be disabled for the current pool. + """ + + header: HeaderParam + """The request header is used to pass additional information with an HTTP request. + + Currently supported header is 'Host'. + """ + + name: str + """A human-identifiable name for the origin.""" + + virtual_network_id: str + """The virtual network subnet ID the origin belongs in. + + Virtual network must also belong to the account. + """ + + weight: float + """The weight of this origin relative to other origins in the pool. + + Based on the configured weight the total traffic is distributed among origins + within the pool. + + - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + origin's outstanding requests. + - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + open connections. + """ diff --git a/src/cloudflare/types/load_balancers/origin_steering.py b/src/cloudflare/types/load_balancers/origin_steering.py new file mode 100644 index 00000000000..e7983ceea0b --- /dev/null +++ b/src/cloudflare/types/load_balancers/origin_steering.py @@ -0,0 +1,26 @@ +# 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__ = ["OriginSteering"] + + +class OriginSteering(BaseModel): + policy: Optional[Literal["random", "hash", "least_outstanding_requests", "least_connections"]] = None + """The type of origin steering policy to use. + + - `"random"`: Select an origin randomly. + - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + address. + - `"least_outstanding_requests"`: Select an origin by taking into consideration + origin weights, as well as each origin's number of outstanding requests. + Origins with more pending requests are weighted proportionately less relative + to others. + - `"least_connections"`: Select an origin by taking into consideration origin + weights, as well as each origin's number of open connections. Origins with + more open connections are weighted proportionately less relative to others. + Supported for HTTP/1 and HTTP/2 connections. + """ diff --git a/src/cloudflare/types/load_balancers/origin_steering_param.py b/src/cloudflare/types/load_balancers/origin_steering_param.py new file mode 100644 index 00000000000..82bfee85f69 --- /dev/null +++ b/src/cloudflare/types/load_balancers/origin_steering_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["OriginSteeringParam"] + + +class OriginSteeringParam(TypedDict, total=False): + policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] + """The type of origin steering policy to use. + + - `"random"`: Select an origin randomly. + - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + address. + - `"least_outstanding_requests"`: Select an origin by taking into consideration + origin weights, as well as each origin's number of outstanding requests. + Origins with more pending requests are weighted proportionately less relative + to others. + - `"least_connections"`: Select an origin by taking into consideration origin + weights, as well as each origin's number of open connections. Origins with + more open connections are weighted proportionately less relative to others. + Supported for HTTP/1 and HTTP/2 connections. + """ diff --git a/src/cloudflare/types/load_balancers/pool.py b/src/cloudflare/types/load_balancers/pool.py new file mode 100644 index 00000000000..beb27193b3d --- /dev/null +++ b/src/cloudflare/types/load_balancers/pool.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .origin import Origin +from ..._models import BaseModel +from .check_region import CheckRegion +from .load_shedding import LoadShedding +from .origin_steering import OriginSteering +from .notification_filter import NotificationFilter + +__all__ = ["Pool"] + + +class Pool(BaseModel): + id: Optional[str] = None + + check_regions: Optional[List[CheckRegion]] = None + """A list of regions from which to run health checks. + + Null means every Cloudflare data center. + """ + + created_on: Optional[datetime] = None + + description: Optional[str] = None + """A human-readable description of the pool.""" + + disabled_at: Optional[datetime] = None + """This field shows up only if the pool is disabled. + + This field is set with the time the pool was disabled at. + """ + + enabled: Optional[bool] = None + """Whether to enable (the default) or disable this pool. + + Disabled pools will not receive traffic and are excluded from health checks. + Disabling a pool will cause any load balancers using it to failover to the next + pool (if any). + """ + + latitude: Optional[float] = None + """ + The latitude of the data center containing the origins used in this pool in + decimal degrees. If this is set, longitude must also be set. + """ + + load_shedding: Optional[LoadShedding] = None + """Configures load shedding policies and percentages for the pool.""" + + longitude: Optional[float] = None + """ + The longitude of the data center containing the origins used in this pool in + decimal degrees. If this is set, latitude must also be set. + """ + + minimum_origins: Optional[int] = None + """ + The minimum number of origins that must be healthy for this pool to serve + traffic. If the number of healthy origins falls below this number, the pool will + be marked unhealthy and will failover to the next available pool. + """ + + modified_on: Optional[datetime] = None + + monitor: Optional[object] = None + """ + The ID of the Monitor to use for checking the health of origins within this + pool. + """ + + name: Optional[str] = None + """A short name (tag) for the pool. + + Only alphanumeric characters, hyphens, and underscores are allowed. + """ + + notification_email: Optional[str] = None + """This field is now deprecated. + + It has been moved to Cloudflare's Centralized Notification service + https://developers.cloudflare.com/fundamentals/notifications/. The email address + to send health status notifications to. This can be an individual mailbox or a + mailing list. Multiple emails can be supplied as a comma delimited list. + """ + + notification_filter: Optional[NotificationFilter] = None + """Filter pool and origin health notifications by resource type or health status. + + Use null to reset. + """ + + origin_steering: Optional[OriginSteering] = None + """Configures origin steering for the pool. + + Controls how origins are selected for new sessions and traffic without session + affinity. + """ + + origins: Optional[List[Origin]] = None + """The list of origins within this pool. + + Traffic directed at this pool is balanced across all currently healthy origins, + provided the pool itself is healthy. + """ diff --git a/src/cloudflare/types/load_balancers/pool_create_params.py b/src/cloudflare/types/load_balancers/pool_create_params.py index d2237f3da2e..49c54c78fc0 100644 --- a/src/cloudflare/types/load_balancers/pool_create_params.py +++ b/src/cloudflare/types/load_balancers/pool_create_params.py @@ -2,21 +2,15 @@ from __future__ import annotations -from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict -from ..._utils import PropertyInfo +from .origin_param import OriginParam +from .load_shedding_param import LoadSheddingParam +from .origin_steering_param import OriginSteeringParam +from .notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolCreateParams", - "Origin", - "OriginHeader", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", -] +__all__ = ["PoolCreateParams"] class PoolCreateParams(TypedDict, total=False): @@ -29,7 +23,7 @@ class PoolCreateParams(TypedDict, total=False): Only alphanumeric characters, hyphens, and underscores are allowed. """ - origins: Required[Iterable[Origin]] + origins: Required[Iterable[OriginParam]] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, @@ -53,7 +47,7 @@ class PoolCreateParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -84,149 +78,15 @@ class PoolCreateParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ diff --git a/src/cloudflare/types/load_balancers/pool_delete_params.py b/src/cloudflare/types/load_balancers/pool_delete_params.py new file mode 100644 index 00000000000..72fd555490c --- /dev/null +++ b/src/cloudflare/types/load_balancers/pool_delete_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__ = ["PoolDeleteParams"] + + +class PoolDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/load_balancers/pool_edit_params.py b/src/cloudflare/types/load_balancers/pool_edit_params.py index a3ea2be6131..222e8ab9357 100644 --- a/src/cloudflare/types/load_balancers/pool_edit_params.py +++ b/src/cloudflare/types/load_balancers/pool_edit_params.py @@ -3,46 +3,22 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, TypedDict -from ..._utils import PropertyInfo +from .check_region import CheckRegion +from .origin_param import OriginParam +from .load_shedding_param import LoadSheddingParam +from .origin_steering_param import OriginSteeringParam +from .notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolEditParams", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", - "Origin", - "OriginHeader", -] +__all__ = ["PoolEditParams"] class PoolEditParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] + check_regions: Optional[List[CheckRegion]] """A list of regions from which to run health checks. Null means every Cloudflare data center. @@ -65,7 +41,7 @@ class PoolEditParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -102,156 +78,22 @@ class PoolEditParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - origins: Iterable[Origin] + origins: Iterable[OriginParam] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy. """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ diff --git a/src/cloudflare/types/load_balancers/pool_update_params.py b/src/cloudflare/types/load_balancers/pool_update_params.py index 585c2d2d175..834c3ec1b70 100644 --- a/src/cloudflare/types/load_balancers/pool_update_params.py +++ b/src/cloudflare/types/load_balancers/pool_update_params.py @@ -3,20 +3,15 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, TypedDict -from ..._utils import PropertyInfo +from .check_region import CheckRegion +from .origin_param import OriginParam +from .load_shedding_param import LoadSheddingParam +from .origin_steering_param import OriginSteeringParam +from .notification_filter_param import NotificationFilterParam -__all__ = [ - "PoolUpdateParams", - "Origin", - "OriginHeader", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", -] +__all__ = ["PoolUpdateParams"] class PoolUpdateParams(TypedDict, total=False): @@ -29,33 +24,14 @@ class PoolUpdateParams(TypedDict, total=False): Only alphanumeric characters, hyphens, and underscores are allowed. """ - origins: Required[Iterable[Origin]] + origins: Required[Iterable[OriginParam]] """The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy. """ - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] + check_regions: Optional[List[CheckRegion]] """A list of regions from which to run health checks. Null means every Cloudflare data center. @@ -78,7 +54,7 @@ class PoolUpdateParams(TypedDict, total=False): decimal degrees. If this is set, longitude must also be set. """ - load_shedding: LoadShedding + load_shedding: LoadSheddingParam """Configures load shedding policies and percentages for the pool.""" longitude: float @@ -109,149 +85,15 @@ class PoolUpdateParams(TypedDict, total=False): mailing list. Multiple emails can be supplied as a comma delimited list. """ - notification_filter: Optional[NotificationFilter] + notification_filter: Optional[NotificationFilterParam] """Filter pool and origin health notifications by resource type or health status. Use null to reset. """ - origin_steering: OriginSteering + origin_steering: OriginSteeringParam """Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity. """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ diff --git a/src/cloudflare/types/load_balancers/preview_get_response.py b/src/cloudflare/types/load_balancers/preview_get_response.py new file mode 100644 index 00000000000..60d5ed36be9 --- /dev/null +++ b/src/cloudflare/types/load_balancers/preview_get_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from ..._models import BaseModel + +__all__ = [ + "PreviewGetResponse", + "PreviewGetResponseItem", + "PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem", +] + + +class PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem(BaseModel): + failure_reason: Optional[str] = None + + healthy: Optional[bool] = None + + response_code: Optional[float] = None + + rtt: Optional[str] = None + + +class PreviewGetResponseItem(BaseModel): + healthy: Optional[bool] = None + + origins: Optional[List[Dict[str, PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem]]] = None + + +PreviewGetResponse = Dict[str, PreviewGetResponseItem] diff --git a/src/cloudflare/types/load_balancers/random_steering.py b/src/cloudflare/types/load_balancers/random_steering.py new file mode 100644 index 00000000000..0eaa15fd484 --- /dev/null +++ b/src/cloudflare/types/load_balancers/random_steering.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["RandomSteering"] + + +class RandomSteering(BaseModel): + default_weight: Optional[float] = None + """ + The default weight for pools in the load balancer that are not specified in the + pool_weights map. + """ + + pool_weights: Optional[object] = None + """A mapping of pool IDs to custom weights. + + The weight is relative to other pools in the load balancer. + """ diff --git a/src/cloudflare/types/load_balancers/random_steering_param.py b/src/cloudflare/types/load_balancers/random_steering_param.py new file mode 100644 index 00000000000..bd064e0a834 --- /dev/null +++ b/src/cloudflare/types/load_balancers/random_steering_param.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 TypedDict + +__all__ = ["RandomSteeringParam"] + + +class RandomSteeringParam(TypedDict, total=False): + default_weight: float + """ + The default weight for pools in the load balancer that are not specified in the + pool_weights map. + """ + + pool_weights: object + """A mapping of pool IDs to custom weights. + + The weight is relative to other pools in the load balancer. + """ diff --git a/src/cloudflare/types/load_balancers/rules.py b/src/cloudflare/types/load_balancers/rules.py new file mode 100644 index 00000000000..3c0887f61c9 --- /dev/null +++ b/src/cloudflare/types/load_balancers/rules.py @@ -0,0 +1,222 @@ +# 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 +from .default_pools import DefaultPools +from .random_steering import RandomSteering +from .adaptive_routing import AdaptiveRouting +from .location_strategy import LocationStrategy +from .session_affinity_attributes import SessionAffinityAttributes + +__all__ = ["Rules", "FixedResponse", "Overrides"] + + +class FixedResponse(BaseModel): + content_type: Optional[str] = None + """The http 'Content-Type' header to include in the response.""" + + location: Optional[str] = None + """The http 'Location' header to include in the response.""" + + message_body: Optional[str] = None + """Text to include as the http body.""" + + status_code: Optional[int] = None + """The http status code to respond with.""" + + +class Overrides(BaseModel): + adaptive_routing: Optional[AdaptiveRouting] = None + """ + Controls features that modify the routing of requests to pools and origins in + response to dynamic conditions, such as during the interval between active + health monitoring requests. For example, zero-downtime failover occurs + immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 + response codes. If there is another healthy origin in the same pool, the request + is retried once against this alternate origin. + """ + + country_pools: Optional[object] = None + """ + A mapping of country codes to a list of pool IDs (ordered by their failover + priority) for the given country. Any country not explicitly defined will fall + back to using the corresponding region_pool mapping if it exists else to + default_pools. + """ + + default_pools: Optional[List[DefaultPools]] = None + """A list of pool IDs ordered by their failover priority. + + Pools defined here are used by default, or when region_pools are not configured + for a given region. + """ + + fallback_pool: Optional[object] = None + """The pool ID to use when all other pools are detected as unhealthy.""" + + location_strategy: Optional[LocationStrategy] = None + """Controls location-based steering for non-proxied requests. + + See `steering_policy` to learn how steering is affected. + """ + + pop_pools: Optional[object] = None + """ + (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs + (ordered by their failover priority) for the PoP (datacenter). Any PoPs not + explicitly defined will fall back to using the corresponding country_pool, then + region_pool mapping if it exists else to default_pools. + """ + + random_steering: Optional[RandomSteering] = None + """Configures pool weights. + + - `steering_policy="random"`: A random pool is selected with probability + proportional to pool weights. + - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + pool's outstanding requests. + - `steering_policy="least_connections"`: Use pool weights to scale each pool's + open connections. + """ + + region_pools: Optional[object] = None + """ + A mapping of region codes to a list of pool IDs (ordered by their failover + priority) for the given region. Any regions not explicitly defined will fall + back to using default_pools. + """ + + session_affinity: Optional[Literal["none", "cookie", "ip_cookie", "header", '""']] = None + """ + Specifies the type of session affinity the load balancer should use unless + specified as `"none"` or "" (default). The supported types are: + + - `"cookie"`: On the first request to a proxied load balancer, a cookie is + generated, encoding information of which origin the request will be forwarded + to. Subsequent requests, by the same client to the same load balancer, will be + sent to the origin server the cookie encodes, for the duration of the cookie + and as long as the origin server remains healthy. If the cookie has expired or + the origin server is unhealthy, then a new origin server is calculated and + used. + - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin + selection is stable and based on the client's ip address. + - `"header"`: On the first request to a proxied load balancer, a session key + based on the configured HTTP headers (see + `session_affinity_attributes.headers`) is generated, encoding the request + headers used for storing in the load balancer session state which origin the + request will be forwarded to. Subsequent requests to the load balancer with + the same headers will be sent to the same origin server, for the duration of + the session and as long as the origin server remains healthy. If the session + has been idle for the duration of `session_affinity_ttl` seconds or the origin + server is unhealthy, then a new origin server is calculated and used. See + `headers` in `session_affinity_attributes` for additional required + configuration. + """ + + session_affinity_attributes: Optional[SessionAffinityAttributes] = None + """Configures attributes for session affinity.""" + + session_affinity_ttl: Optional[float] = None + """Time, in seconds, until a client's session expires after being created. + + Once the expiry time has been reached, subsequent requests may get sent to a + different origin server. The accepted ranges per `session_affinity` policy are: + + - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + unless explicitly set. The accepted range of values is between [1800, 604800]. + - `"header"`: The current default of 1800 seconds will be used unless explicitly + set. The accepted range of values is between [30, 3600]. Note: With session + affinity by header, sessions only expire after they haven't been used for the + number of seconds specified. + """ + + steering_policy: Optional[ + Literal[ + "off", + "geo", + "random", + "dynamic_latency", + "proximity", + "least_outstanding_requests", + "least_connections", + '""', + ] + ] = None + """Steering Policy for this load balancer. + + - `"off"`: Use `default_pools`. + - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied + requests, the country for `country_pools` is determined by + `location_strategy`. + - `"random"`: Select a pool randomly. + - `"dynamic_latency"`: Use round trip time to select the closest pool in + default_pools (requires pool health checks). + - `"proximity"`: Use the pools' latitude and longitude to select the closest + pool using the Cloudflare PoP location for proxied requests or the location + determined by `location_strategy` for non-proxied requests. + - `"least_outstanding_requests"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of outstanding + requests. Pools with more pending requests are weighted proportionately less + relative to others. + - `"least_connections"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of open connections. + Pools with more open connections are weighted proportionately less relative to + others. Supported for HTTP/1 and HTTP/2 connections. + - `""`: Will map to `"geo"` if you use + `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. + """ + + ttl: Optional[float] = None + """ + Time to live (TTL) of the DNS entry for the IP address returned by this load + balancer. This only applies to gray-clouded (unproxied) load balancers. + """ + + +class Rules(BaseModel): + condition: Optional[str] = None + """The condition expressions to evaluate. + + If the condition evaluates to true, the overrides or fixed_response in this rule + will be applied. An empty condition is always true. For more details on + condition expressions, please see + https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions. + """ + + disabled: Optional[bool] = None + """Disable this specific rule. + + It will no longer be evaluated by this load balancer. + """ + + fixed_response: Optional[FixedResponse] = None + """ + A collection of fields used to directly respond to the eyeball instead of + routing to a pool. If a fixed_response is supplied the rule will be marked as + terminates. + """ + + name: Optional[str] = None + """Name of this rule. Only used for human readability.""" + + overrides: Optional[Overrides] = None + """ + A collection of overrides to apply to the load balancer when this rule's + condition is true. All fields are optional. + """ + + priority: Optional[int] = None + """The order in which rules should be executed in relation to each other. + + Lower values are executed first. Values do not need to be sequential. If no + value is provided for any rule the array order of the rules field will be used + to assign a priority. + """ + + terminates: Optional[bool] = None + """ + If this rule's condition is true, this causes rule evaluation to stop after + processing this rule. + """ diff --git a/src/cloudflare/types/load_balancers/rules_param.py b/src/cloudflare/types/load_balancers/rules_param.py new file mode 100644 index 00000000000..f74b2e39bcc --- /dev/null +++ b/src/cloudflare/types/load_balancers/rules_param.py @@ -0,0 +1,214 @@ +# 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, TypedDict + +from .default_pools import DefaultPools +from .random_steering_param import RandomSteeringParam +from .adaptive_routing_param import AdaptiveRoutingParam +from .location_strategy_param import LocationStrategyParam +from .session_affinity_attributes_param import SessionAffinityAttributesParam + +__all__ = ["RulesParam", "FixedResponse", "Overrides"] + + +class FixedResponse(TypedDict, total=False): + content_type: str + """The http 'Content-Type' header to include in the response.""" + + location: str + """The http 'Location' header to include in the response.""" + + message_body: str + """Text to include as the http body.""" + + status_code: int + """The http status code to respond with.""" + + +class Overrides(TypedDict, total=False): + adaptive_routing: AdaptiveRoutingParam + """ + Controls features that modify the routing of requests to pools and origins in + response to dynamic conditions, such as during the interval between active + health monitoring requests. For example, zero-downtime failover occurs + immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 + response codes. If there is another healthy origin in the same pool, the request + is retried once against this alternate origin. + """ + + country_pools: object + """ + A mapping of country codes to a list of pool IDs (ordered by their failover + priority) for the given country. Any country not explicitly defined will fall + back to using the corresponding region_pool mapping if it exists else to + default_pools. + """ + + default_pools: List[DefaultPools] + """A list of pool IDs ordered by their failover priority. + + Pools defined here are used by default, or when region_pools are not configured + for a given region. + """ + + fallback_pool: object + """The pool ID to use when all other pools are detected as unhealthy.""" + + location_strategy: LocationStrategyParam + """Controls location-based steering for non-proxied requests. + + See `steering_policy` to learn how steering is affected. + """ + + pop_pools: object + """ + (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs + (ordered by their failover priority) for the PoP (datacenter). Any PoPs not + explicitly defined will fall back to using the corresponding country_pool, then + region_pool mapping if it exists else to default_pools. + """ + + random_steering: RandomSteeringParam + """Configures pool weights. + + - `steering_policy="random"`: A random pool is selected with probability + proportional to pool weights. + - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + pool's outstanding requests. + - `steering_policy="least_connections"`: Use pool weights to scale each pool's + open connections. + """ + + region_pools: object + """ + A mapping of region codes to a list of pool IDs (ordered by their failover + priority) for the given region. Any regions not explicitly defined will fall + back to using default_pools. + """ + + session_affinity: Literal["none", "cookie", "ip_cookie", "header", '""'] + """ + Specifies the type of session affinity the load balancer should use unless + specified as `"none"` or "" (default). The supported types are: + + - `"cookie"`: On the first request to a proxied load balancer, a cookie is + generated, encoding information of which origin the request will be forwarded + to. Subsequent requests, by the same client to the same load balancer, will be + sent to the origin server the cookie encodes, for the duration of the cookie + and as long as the origin server remains healthy. If the cookie has expired or + the origin server is unhealthy, then a new origin server is calculated and + used. + - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin + selection is stable and based on the client's ip address. + - `"header"`: On the first request to a proxied load balancer, a session key + based on the configured HTTP headers (see + `session_affinity_attributes.headers`) is generated, encoding the request + headers used for storing in the load balancer session state which origin the + request will be forwarded to. Subsequent requests to the load balancer with + the same headers will be sent to the same origin server, for the duration of + the session and as long as the origin server remains healthy. If the session + has been idle for the duration of `session_affinity_ttl` seconds or the origin + server is unhealthy, then a new origin server is calculated and used. See + `headers` in `session_affinity_attributes` for additional required + configuration. + """ + + session_affinity_attributes: SessionAffinityAttributesParam + """Configures attributes for session affinity.""" + + session_affinity_ttl: float + """Time, in seconds, until a client's session expires after being created. + + Once the expiry time has been reached, subsequent requests may get sent to a + different origin server. The accepted ranges per `session_affinity` policy are: + + - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + unless explicitly set. The accepted range of values is between [1800, 604800]. + - `"header"`: The current default of 1800 seconds will be used unless explicitly + set. The accepted range of values is between [30, 3600]. Note: With session + affinity by header, sessions only expire after they haven't been used for the + number of seconds specified. + """ + + steering_policy: Literal[ + "off", "geo", "random", "dynamic_latency", "proximity", "least_outstanding_requests", "least_connections", '""' + ] + """Steering Policy for this load balancer. + + - `"off"`: Use `default_pools`. + - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied + requests, the country for `country_pools` is determined by + `location_strategy`. + - `"random"`: Select a pool randomly. + - `"dynamic_latency"`: Use round trip time to select the closest pool in + default_pools (requires pool health checks). + - `"proximity"`: Use the pools' latitude and longitude to select the closest + pool using the Cloudflare PoP location for proxied requests or the location + determined by `location_strategy` for non-proxied requests. + - `"least_outstanding_requests"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of outstanding + requests. Pools with more pending requests are weighted proportionately less + relative to others. + - `"least_connections"`: Select a pool by taking into consideration + `random_steering` weights, as well as each pool's number of open connections. + Pools with more open connections are weighted proportionately less relative to + others. Supported for HTTP/1 and HTTP/2 connections. + - `""`: Will map to `"geo"` if you use + `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. + """ + + ttl: float + """ + Time to live (TTL) of the DNS entry for the IP address returned by this load + balancer. This only applies to gray-clouded (unproxied) load balancers. + """ + + +class RulesParam(TypedDict, total=False): + condition: str + """The condition expressions to evaluate. + + If the condition evaluates to true, the overrides or fixed_response in this rule + will be applied. An empty condition is always true. For more details on + condition expressions, please see + https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions. + """ + + disabled: bool + """Disable this specific rule. + + It will no longer be evaluated by this load balancer. + """ + + fixed_response: FixedResponse + """ + A collection of fields used to directly respond to the eyeball instead of + routing to a pool. If a fixed_response is supplied the rule will be marked as + terminates. + """ + + name: str + """Name of this rule. Only used for human readability.""" + + overrides: Overrides + """ + A collection of overrides to apply to the load balancer when this rule's + condition is true. All fields are optional. + """ + + priority: int + """The order in which rules should be executed in relation to each other. + + Lower values are executed first. Values do not need to be sequential. If no + value is provided for any rule the array order of the rules field will be used + to assign a priority. + """ + + terminates: bool + """ + If this rule's condition is true, this causes rule evaluation to stop after + processing this rule. + """ diff --git a/src/cloudflare/types/load_balancers/session_affinity_attributes.py b/src/cloudflare/types/load_balancers/session_affinity_attributes.py new file mode 100644 index 00000000000..10b0de12222 --- /dev/null +++ b/src/cloudflare/types/load_balancers/session_affinity_attributes.py @@ -0,0 +1,73 @@ +# 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__ = ["SessionAffinityAttributes"] + + +class SessionAffinityAttributes(BaseModel): + drain_duration: Optional[float] = None + """Configures the drain duration in seconds. + + This field is only used when session affinity is enabled on the load balancer. + """ + + headers: Optional[List[str]] = None + """ + Configures the names of HTTP headers to base session affinity on when header + `session_affinity` is enabled. At least one HTTP header name must be provided. + To specify the exact cookies to be used, include an item in the following + format: `"cookie:,"` (example) where everything + after the colon is a comma-separated list of cookie names. Providing only + `"cookie"` will result in all cookies being used. The default max number of HTTP + header names that can be provided depends on your plan: 5 for Enterprise, 1 for + all other plans. + """ + + require_all_headers: Optional[bool] = None + """ + When header `session_affinity` is enabled, this option can be used to specify + how HTTP headers on load balancing requests will be used. The supported values + are: + + - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + specified by the `headers` session affinity attribute, otherwise sessions + aren't created. + - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + headers specified by the `headers` session affinity attribute, otherwise + sessions aren't created. + """ + + samesite: Optional[Literal["Auto", "Lax", "None", "Strict"]] = None + """Configures the SameSite attribute on session affinity cookie. + + Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS + is enabled. Note: when using value "None", the secure attribute can not be set + to "Never". + """ + + secure: Optional[Literal["Auto", "Always", "Never"]] = None + """Configures the Secure attribute on session affinity cookie. + + Value "Always" indicates the Secure attribute will be set in the Set-Cookie + header, "Never" indicates the Secure attribute will not be set, and "Auto" will + set the Secure attribute depending if Always Use HTTPS is enabled. + """ + + zero_downtime_failover: Optional[Literal["none", "temporary", "sticky"]] = None + """ + Configures the zero-downtime failover between origins within a pool when session + affinity is enabled. This feature is currently incompatible with Argo, Tiered + Cache, and Bandwidth Alliance. The supported values are: + + - `"none"`: No failover takes place for sessions pinned to the origin (default). + - `"temporary"`: Traffic will be sent to another other healthy origin until the + originally pinned origin is available; note that this can potentially result + in heavy origin flapping. + - `"sticky"`: The session affinity cookie is updated and subsequent requests are + sent to the new origin. Note: Zero-downtime failover with sticky sessions is + currently not supported for session affinity by header. + """ diff --git a/src/cloudflare/types/load_balancers/session_affinity_attributes_param.py b/src/cloudflare/types/load_balancers/session_affinity_attributes_param.py new file mode 100644 index 00000000000..559881fa95f --- /dev/null +++ b/src/cloudflare/types/load_balancers/session_affinity_attributes_param.py @@ -0,0 +1,73 @@ +# 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, TypedDict + +__all__ = ["SessionAffinityAttributesParam"] + + +class SessionAffinityAttributesParam(TypedDict, total=False): + drain_duration: float + """Configures the drain duration in seconds. + + This field is only used when session affinity is enabled on the load balancer. + """ + + headers: List[str] + """ + Configures the names of HTTP headers to base session affinity on when header + `session_affinity` is enabled. At least one HTTP header name must be provided. + To specify the exact cookies to be used, include an item in the following + format: `"cookie:,"` (example) where everything + after the colon is a comma-separated list of cookie names. Providing only + `"cookie"` will result in all cookies being used. The default max number of HTTP + header names that can be provided depends on your plan: 5 for Enterprise, 1 for + all other plans. + """ + + require_all_headers: bool + """ + When header `session_affinity` is enabled, this option can be used to specify + how HTTP headers on load balancing requests will be used. The supported values + are: + + - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + specified by the `headers` session affinity attribute, otherwise sessions + aren't created. + - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + headers specified by the `headers` session affinity attribute, otherwise + sessions aren't created. + """ + + samesite: Literal["Auto", "Lax", "None", "Strict"] + """Configures the SameSite attribute on session affinity cookie. + + Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS + is enabled. Note: when using value "None", the secure attribute can not be set + to "Never". + """ + + secure: Literal["Auto", "Always", "Never"] + """Configures the Secure attribute on session affinity cookie. + + Value "Always" indicates the Secure attribute will be set in the Set-Cookie + header, "Never" indicates the Secure attribute will not be set, and "Auto" will + set the Secure attribute depending if Always Use HTTPS is enabled. + """ + + zero_downtime_failover: Literal["none", "temporary", "sticky"] + """ + Configures the zero-downtime failover between origins within a pool when session + affinity is enabled. This feature is currently incompatible with Argo, Tiered + Cache, and Bandwidth Alliance. The supported values are: + + - `"none"`: No failover takes place for sessions pinned to the origin (default). + - `"temporary"`: Traffic will be sent to another other healthy origin until the + originally pinned origin is available; note that this can potentially result + in heavy origin flapping. + - `"sticky"`: The session affinity cookie is updated and subsequent requests are + sent to the new origin. Note: Zero-downtime failover with sticky sessions is + currently not supported for session affinity by header. + """ diff --git a/src/cloudflare/types/logpush/__init__.py b/src/cloudflare/types/logpush/__init__.py index 37d5d84f48c..e3eaa13d9d2 100644 --- a/src/cloudflare/types/logpush/__init__.py +++ b/src/cloudflare/types/logpush/__init__.py @@ -2,17 +2,20 @@ from __future__ import annotations +from .logpush_job import LogpushJob as LogpushJob +from .output_options import OutputOptions as OutputOptions from .edge_get_response import EdgeGetResponse as EdgeGetResponse from .job_create_params import JobCreateParams as JobCreateParams +from .job_delete_params import JobDeleteParams as JobDeleteParams from .job_update_params import JobUpdateParams as JobUpdateParams from .edge_create_params import EdgeCreateParams as EdgeCreateParams from .instant_logpush_job import InstantLogpushJob as InstantLogpushJob -from .job_delete_response import JobDeleteResponse as JobDeleteResponse +from .output_options_param import OutputOptionsParam as OutputOptionsParam +from .ownership_validation import OwnershipValidation as OwnershipValidation from .validate_origin_params import ValidateOriginParams as ValidateOriginParams from .ownership_create_params import OwnershipCreateParams as OwnershipCreateParams from .validate_origin_response import ValidateOriginResponse as ValidateOriginResponse from .ownership_create_response import OwnershipCreateResponse as OwnershipCreateResponse from .ownership_validate_params import OwnershipValidateParams as OwnershipValidateParams -from .ownership_validate_response import OwnershipValidateResponse as OwnershipValidateResponse from .validate_destination_params import ValidateDestinationParams as ValidateDestinationParams from .validate_destination_response import ValidateDestinationResponse as ValidateDestinationResponse diff --git a/src/cloudflare/types/logpush/datasets/__init__.py b/src/cloudflare/types/logpush/datasets/__init__.py index 10c20406e0b..8c60dd28797 100644 --- a/src/cloudflare/types/logpush/datasets/__init__.py +++ b/src/cloudflare/types/logpush/datasets/__init__.py @@ -2,5 +2,4 @@ from __future__ import annotations -from .logpush_job import LogpushJob as LogpushJob from .job_get_response import JobGetResponse as JobGetResponse diff --git a/src/cloudflare/types/logpush/datasets/job_get_response.py b/src/cloudflare/types/logpush/datasets/job_get_response.py index c95c7edd4a7..18a04965c99 100644 --- a/src/cloudflare/types/logpush/datasets/job_get_response.py +++ b/src/cloudflare/types/logpush/datasets/job_get_response.py @@ -2,7 +2,7 @@ from typing import List, Optional -from .logpush_job import LogpushJob +from ..logpush_job import LogpushJob __all__ = ["JobGetResponse"] diff --git a/src/cloudflare/types/logpush/datasets/logpush_job.py b/src/cloudflare/types/logpush/datasets/logpush_job.py deleted file mode 100644 index 4693a27c56d..00000000000 --- a/src/cloudflare/types/logpush/datasets/logpush_job.py +++ /dev/null @@ -1,145 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["LogpushJob", "OutputOptions"] - - -class OutputOptions(BaseModel): - batch_prefix: Optional[str] = None - """String to be prepended before each batch.""" - - batch_suffix: Optional[str] = None - """String to be appended after each batch.""" - - cve_2021_4428: Optional[bool] = FieldInfo(alias="CVE-2021-4428", default=None) - """ - If set to true, will cause all occurrences of `${` in the generated files to be - replaced with `x{`. - """ - - field_delimiter: Optional[str] = None - """String to join fields. This field be ignored when `record_template` is set.""" - - field_names: Optional[List[str]] = None - """List of field names to be included in the Logpush output. - - For the moment, there is no option to add all fields at once, so you must - specify all the fields names you are interested in. - """ - - output_type: Optional[Literal["ndjson", "csv"]] = None - """Specifies the output type, such as `ndjson` or `csv`. - - This sets default values for the rest of the settings, depending on the chosen - output type. Some formatting rules, like string quoting, are different between - output types. - """ - - record_delimiter: Optional[str] = None - """String to be inserted in-between the records as separator.""" - - record_prefix: Optional[str] = None - """String to be prepended before each record.""" - - record_suffix: Optional[str] = None - """String to be appended after each record.""" - - record_template: Optional[str] = None - """ - String to use as template for each record instead of the default comma-separated - list. All fields used in the template must be present in `field_names` as well, - otherwise they will end up as null. Format as a Go `text/template` without any - standard functions, like conditionals, loops, sub-templates, etc. - """ - - sample_rate: Optional[float] = None - """Floating number to specify sampling rate. - - Sampling is applied on top of filtering, and regardless of the current - `sample_interval` of the data. - """ - - timestamp_format: Optional[Literal["unixnano", "unix", "rfc3339"]] = None - """ - String to specify the format for timestamps, such as `unixnano`, `unix`, or - `rfc3339`. - """ - - -class LogpushJob(BaseModel): - id: Optional[int] = None - """Unique id of the job.""" - - dataset: Optional[str] = None - """Name of the dataset.""" - - destination_conf: Optional[str] = None - """Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. - - Additional configuration parameters supported by the destination may be - included. - """ - - enabled: Optional[bool] = None - """Flag that indicates if the job is enabled.""" - - error_message: Optional[datetime] = None - """If not null, the job is currently failing. - - Failures are usually repetitive (example: no permissions to write to destination - bucket). Only the last failure is recorded. On successful execution of a job the - error_message and last_error are set to null. - """ - - frequency: Optional[Literal["high", "low"]] = None - """The frequency at which Cloudflare sends batches of logs to your destination. - - Setting frequency to high sends your logs in larger quantities of smaller files. - Setting frequency to low sends logs in smaller quantities of larger files. - """ - - last_complete: Optional[datetime] = None - """Records the last time for which logs have been successfully pushed. - - If the last successful push was for logs range 2018-07-23T10:00:00Z to - 2018-07-23T10:01:00Z then the value of this field will be 2018-07-23T10:01:00Z. - If the job has never run or has just been enabled and hasn't run yet then the - field will be empty. - """ - - last_error: Optional[datetime] = None - """Records the last time the job failed. - - If not null, the job is currently failing. If null, the job has either never - failed or has run successfully at least once since last failure. See also the - error_message field. - """ - - logpull_options: Optional[str] = None - """This field is deprecated. - - Use `output_options` instead. Configuration string. It specifies things like - requested fields and timestamp formats. If migrating from the logpull api, copy - the url (full url or just the query string) of your call here, and logpush will - keep on making this call for you, setting start and end times appropriately. - """ - - name: Optional[str] = None - """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[OutputOptions] = None - """The structured replacement for `logpull_options`. - - When including this field, the `logpull_option` field will be ignored. - """ diff --git a/src/cloudflare/types/logpush/job_create_params.py b/src/cloudflare/types/logpush/job_create_params.py index f0fc7f2c5ce..39f9ecca17d 100644 --- a/src/cloudflare/types/logpush/job_create_params.py +++ b/src/cloudflare/types/logpush/job_create_params.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import Optional +from typing_extensions import Literal, Required, TypedDict -from ..._utils import PropertyInfo +from .output_options_param import OutputOptionsParam -__all__ = ["JobCreateParams", "OutputOptions"] +__all__ = ["JobCreateParams"] class JobCreateParams(TypedDict, total=False): @@ -53,7 +53,7 @@ class JobCreateParams(TypedDict, total=False): the domain name, to make it easier to identify your job. """ - output_options: Optional[OutputOptions] + output_options: Optional[OutputOptionsParam] """The structured replacement for `logpull_options`. When including this field, the `logpull_option` field will be ignored. @@ -61,65 +61,3 @@ class JobCreateParams(TypedDict, total=False): ownership_challenge: str """Ownership challenge token to prove destination ownership.""" - - -class OutputOptions(TypedDict, total=False): - batch_prefix: Optional[str] - """String to be prepended before each batch.""" - - batch_suffix: Optional[str] - """String to be appended after each batch.""" - - cve_2021_4428: Annotated[Optional[bool], PropertyInfo(alias="CVE-2021-4428")] - """ - If set to true, will cause all occurrences of `${` in the generated files to be - replaced with `x{`. - """ - - field_delimiter: Optional[str] - """String to join fields. This field be ignored when `record_template` is set.""" - - field_names: List[str] - """List of field names to be included in the Logpush output. - - For the moment, there is no option to add all fields at once, so you must - specify all the fields names you are interested in. - """ - - output_type: Literal["ndjson", "csv"] - """Specifies the output type, such as `ndjson` or `csv`. - - This sets default values for the rest of the settings, depending on the chosen - output type. Some formatting rules, like string quoting, are different between - output types. - """ - - record_delimiter: Optional[str] - """String to be inserted in-between the records as separator.""" - - record_prefix: Optional[str] - """String to be prepended before each record.""" - - record_suffix: Optional[str] - """String to be appended after each record.""" - - record_template: Optional[str] - """ - String to use as template for each record instead of the default comma-separated - list. All fields used in the template must be present in `field_names` as well, - otherwise they will end up as null. Format as a Go `text/template` without any - standard functions, like conditionals, loops, sub-templates, etc. - """ - - sample_rate: Optional[float] - """Floating number to specify sampling rate. - - Sampling is applied on top of filtering, and regardless of the current - `sample_interval` of the data. - """ - - timestamp_format: Literal["unixnano", "unix", "rfc3339"] - """ - String to specify the format for timestamps, such as `unixnano`, `unix`, or - `rfc3339`. - """ diff --git a/src/cloudflare/types/logpush/job_delete_params.py b/src/cloudflare/types/logpush/job_delete_params.py new file mode 100644 index 00000000000..d6acbb0d4cf --- /dev/null +++ b/src/cloudflare/types/logpush/job_delete_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__ = ["JobDeleteParams"] + + +class JobDeleteParams(TypedDict, total=False): + body: Required[object] + + 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/job_delete_response.py b/src/cloudflare/types/logpush/job_delete_response.py deleted file mode 100644 index fef20041b3f..00000000000 --- a/src/cloudflare/types/logpush/job_delete_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union - -__all__ = ["JobDeleteResponse"] - -JobDeleteResponse = Union[List[object], str, object, None] diff --git a/src/cloudflare/types/logpush/job_update_params.py b/src/cloudflare/types/logpush/job_update_params.py index 962e49043f4..4246f9d3521 100644 --- a/src/cloudflare/types/logpush/job_update_params.py +++ b/src/cloudflare/types/logpush/job_update_params.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import List, Optional -from typing_extensions import Literal, Annotated, TypedDict +from typing import Optional +from typing_extensions import Literal, TypedDict -from ..._utils import PropertyInfo +from .output_options_param import OutputOptionsParam -__all__ = ["JobUpdateParams", "OutputOptions"] +__all__ = ["JobUpdateParams"] class JobUpdateParams(TypedDict, total=False): @@ -43,7 +43,7 @@ class JobUpdateParams(TypedDict, total=False): keep on making this call for you, setting start and end times appropriately. """ - output_options: Optional[OutputOptions] + output_options: Optional[OutputOptionsParam] """The structured replacement for `logpull_options`. When including this field, the `logpull_option` field will be ignored. @@ -51,65 +51,3 @@ class JobUpdateParams(TypedDict, total=False): ownership_challenge: str """Ownership challenge token to prove destination ownership.""" - - -class OutputOptions(TypedDict, total=False): - batch_prefix: Optional[str] - """String to be prepended before each batch.""" - - batch_suffix: Optional[str] - """String to be appended after each batch.""" - - cve_2021_4428: Annotated[Optional[bool], PropertyInfo(alias="CVE-2021-4428")] - """ - If set to true, will cause all occurrences of `${` in the generated files to be - replaced with `x{`. - """ - - field_delimiter: Optional[str] - """String to join fields. This field be ignored when `record_template` is set.""" - - field_names: List[str] - """List of field names to be included in the Logpush output. - - For the moment, there is no option to add all fields at once, so you must - specify all the fields names you are interested in. - """ - - output_type: Literal["ndjson", "csv"] - """Specifies the output type, such as `ndjson` or `csv`. - - This sets default values for the rest of the settings, depending on the chosen - output type. Some formatting rules, like string quoting, are different between - output types. - """ - - record_delimiter: Optional[str] - """String to be inserted in-between the records as separator.""" - - record_prefix: Optional[str] - """String to be prepended before each record.""" - - record_suffix: Optional[str] - """String to be appended after each record.""" - - record_template: Optional[str] - """ - String to use as template for each record instead of the default comma-separated - list. All fields used in the template must be present in `field_names` as well, - otherwise they will end up as null. Format as a Go `text/template` without any - standard functions, like conditionals, loops, sub-templates, etc. - """ - - sample_rate: Optional[float] - """Floating number to specify sampling rate. - - Sampling is applied on top of filtering, and regardless of the current - `sample_interval` of the data. - """ - - timestamp_format: Literal["unixnano", "unix", "rfc3339"] - """ - String to specify the format for timestamps, such as `unixnano`, `unix`, or - `rfc3339`. - """ diff --git a/src/cloudflare/types/logpush/logpush_job.py b/src/cloudflare/types/logpush/logpush_job.py new file mode 100644 index 00000000000..0abab1cd0b8 --- /dev/null +++ b/src/cloudflare/types/logpush/logpush_job.py @@ -0,0 +1,82 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel +from .output_options import OutputOptions + +__all__ = ["LogpushJob"] + + +class LogpushJob(BaseModel): + id: Optional[int] = None + """Unique id of the job.""" + + dataset: Optional[str] = None + """Name of the dataset.""" + + destination_conf: Optional[str] = None + """Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + + Additional configuration parameters supported by the destination may be + included. + """ + + enabled: Optional[bool] = None + """Flag that indicates if the job is enabled.""" + + error_message: Optional[datetime] = None + """If not null, the job is currently failing. + + Failures are usually repetitive (example: no permissions to write to destination + bucket). Only the last failure is recorded. On successful execution of a job the + error_message and last_error are set to null. + """ + + frequency: Optional[Literal["high", "low"]] = None + """The frequency at which Cloudflare sends batches of logs to your destination. + + Setting frequency to high sends your logs in larger quantities of smaller files. + Setting frequency to low sends logs in smaller quantities of larger files. + """ + + last_complete: Optional[datetime] = None + """Records the last time for which logs have been successfully pushed. + + If the last successful push was for logs range 2018-07-23T10:00:00Z to + 2018-07-23T10:01:00Z then the value of this field will be 2018-07-23T10:01:00Z. + If the job has never run or has just been enabled and hasn't run yet then the + field will be empty. + """ + + last_error: Optional[datetime] = None + """Records the last time the job failed. + + If not null, the job is currently failing. If null, the job has either never + failed or has run successfully at least once since last failure. See also the + error_message field. + """ + + logpull_options: Optional[str] = None + """This field is deprecated. + + Use `output_options` instead. Configuration string. It specifies things like + requested fields and timestamp formats. If migrating from the logpull api, copy + the url (full url or just the query string) of your call here, and logpush will + keep on making this call for you, setting start and end times appropriately. + """ + + name: Optional[str] = None + """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[OutputOptions] = None + """The structured replacement for `logpull_options`. + + When including this field, the `logpull_option` field will be ignored. + """ diff --git a/src/cloudflare/types/logpush/output_options.py b/src/cloudflare/types/logpush/output_options.py new file mode 100644 index 00000000000..6cd72a01e72 --- /dev/null +++ b/src/cloudflare/types/logpush/output_options.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["OutputOptions"] + + +class OutputOptions(BaseModel): + batch_prefix: Optional[str] = None + """String to be prepended before each batch.""" + + batch_suffix: Optional[str] = None + """String to be appended after each batch.""" + + cve_2021_4428: Optional[bool] = FieldInfo(alias="CVE-2021-4428", default=None) + """ + If set to true, will cause all occurrences of `${` in the generated files to be + replaced with `x{`. + """ + + field_delimiter: Optional[str] = None + """String to join fields. This field be ignored when `record_template` is set.""" + + field_names: Optional[List[str]] = None + """List of field names to be included in the Logpush output. + + For the moment, there is no option to add all fields at once, so you must + specify all the fields names you are interested in. + """ + + output_type: Optional[Literal["ndjson", "csv"]] = None + """Specifies the output type, such as `ndjson` or `csv`. + + This sets default values for the rest of the settings, depending on the chosen + output type. Some formatting rules, like string quoting, are different between + output types. + """ + + record_delimiter: Optional[str] = None + """String to be inserted in-between the records as separator.""" + + record_prefix: Optional[str] = None + """String to be prepended before each record.""" + + record_suffix: Optional[str] = None + """String to be appended after each record.""" + + record_template: Optional[str] = None + """ + String to use as template for each record instead of the default comma-separated + list. All fields used in the template must be present in `field_names` as well, + otherwise they will end up as null. Format as a Go `text/template` without any + standard functions, like conditionals, loops, sub-templates, etc. + """ + + sample_rate: Optional[float] = None + """Floating number to specify sampling rate. + + Sampling is applied on top of filtering, and regardless of the current + `sample_interval` of the data. + """ + + timestamp_format: Optional[Literal["unixnano", "unix", "rfc3339"]] = None + """ + String to specify the format for timestamps, such as `unixnano`, `unix`, or + `rfc3339`. + """ diff --git a/src/cloudflare/types/logpush/output_options_param.py b/src/cloudflare/types/logpush/output_options_param.py new file mode 100644 index 00000000000..78e97b57a74 --- /dev/null +++ b/src/cloudflare/types/logpush/output_options_param.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["OutputOptionsParam"] + + +class OutputOptionsParam(TypedDict, total=False): + batch_prefix: Optional[str] + """String to be prepended before each batch.""" + + batch_suffix: Optional[str] + """String to be appended after each batch.""" + + cve_2021_4428: Annotated[Optional[bool], PropertyInfo(alias="CVE-2021-4428")] + """ + If set to true, will cause all occurrences of `${` in the generated files to be + replaced with `x{`. + """ + + field_delimiter: Optional[str] + """String to join fields. This field be ignored when `record_template` is set.""" + + field_names: List[str] + """List of field names to be included in the Logpush output. + + For the moment, there is no option to add all fields at once, so you must + specify all the fields names you are interested in. + """ + + output_type: Literal["ndjson", "csv"] + """Specifies the output type, such as `ndjson` or `csv`. + + This sets default values for the rest of the settings, depending on the chosen + output type. Some formatting rules, like string quoting, are different between + output types. + """ + + record_delimiter: Optional[str] + """String to be inserted in-between the records as separator.""" + + record_prefix: Optional[str] + """String to be prepended before each record.""" + + record_suffix: Optional[str] + """String to be appended after each record.""" + + record_template: Optional[str] + """ + String to use as template for each record instead of the default comma-separated + list. All fields used in the template must be present in `field_names` as well, + otherwise they will end up as null. Format as a Go `text/template` without any + standard functions, like conditionals, loops, sub-templates, etc. + """ + + sample_rate: Optional[float] + """Floating number to specify sampling rate. + + Sampling is applied on top of filtering, and regardless of the current + `sample_interval` of the data. + """ + + timestamp_format: Literal["unixnano", "unix", "rfc3339"] + """ + String to specify the format for timestamps, such as `unixnano`, `unix`, or + `rfc3339`. + """ diff --git a/src/cloudflare/types/logpush/ownership_validate_response.py b/src/cloudflare/types/logpush/ownership_validate_response.py deleted file mode 100644 index 22c95e70695..00000000000 --- a/src/cloudflare/types/logpush/ownership_validate_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["OwnershipValidateResponse"] - - -class OwnershipValidateResponse(BaseModel): - valid: Optional[bool] = None diff --git a/src/cloudflare/types/logpush/ownership_validation.py b/src/cloudflare/types/logpush/ownership_validation.py new file mode 100644 index 00000000000..7cd567a2f45 --- /dev/null +++ b/src/cloudflare/types/logpush/ownership_validation.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__ = ["OwnershipValidation"] + + +class OwnershipValidation(BaseModel): + valid: Optional[bool] = None diff --git a/src/cloudflare/types/logs/control/cmb/__init__.py b/src/cloudflare/types/logs/control/cmb/__init__.py index 1cfbc76cf33..d96a935ea5d 100644 --- a/src/cloudflare/types/logs/control/cmb/__init__.py +++ b/src/cloudflare/types/logs/control/cmb/__init__.py @@ -4,4 +4,4 @@ from .cmb_config import CmbConfig as CmbConfig from .config_create_params import ConfigCreateParams as ConfigCreateParams -from .config_delete_response import ConfigDeleteResponse as ConfigDeleteResponse +from .config_delete_params import ConfigDeleteParams as ConfigDeleteParams diff --git a/src/cloudflare/types/logs/control/cmb/config_delete_params.py b/src/cloudflare/types/logs/control/cmb/config_delete_params.py new file mode 100644 index 00000000000..18c5f56fe91 --- /dev/null +++ b/src/cloudflare/types/logs/control/cmb/config_delete_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__ = ["ConfigDeleteParams"] + + +class ConfigDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/logs/control/cmb/config_delete_response.py b/src/cloudflare/types/logs/control/cmb/config_delete_response.py deleted file mode 100644 index 4407776e27b..00000000000 --- a/src/cloudflare/types/logs/control/cmb/config_delete_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union - -__all__ = ["ConfigDeleteResponse"] - -ConfigDeleteResponse = Union[List[object], str, object, None] diff --git a/src/cloudflare/types/magic_network_monitoring/__init__.py b/src/cloudflare/types/magic_network_monitoring/__init__.py index 5bfc950aadb..91b7d5f38cc 100644 --- a/src/cloudflare/types/magic_network_monitoring/__init__.py +++ b/src/cloudflare/types/magic_network_monitoring/__init__.py @@ -2,5 +2,14 @@ from __future__ import annotations +from .configuration import Configuration as Configuration +from .rule_edit_params import RuleEditParams as RuleEditParams +from .config_edit_params import ConfigEditParams as ConfigEditParams +from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_delete_params import RuleDeleteParams as RuleDeleteParams +from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .configuration_param import ConfigurationParam as ConfigurationParam +from .config_create_params import ConfigCreateParams as ConfigCreateParams +from .config_delete_params import ConfigDeleteParams as ConfigDeleteParams +from .config_update_params import ConfigUpdateParams as ConfigUpdateParams from .magic_network_monitoring_rule import MagicNetworkMonitoringRule as MagicNetworkMonitoringRule -from .magic_network_monitoring_config import MagicNetworkMonitoringConfig as MagicNetworkMonitoringConfig diff --git a/src/cloudflare/types/magic_network_monitoring/config_create_params.py b/src/cloudflare/types/magic_network_monitoring/config_create_params.py new file mode 100644 index 00000000000..3bb01f0cb07 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/config_create_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ConfigCreateParams"] + + +class ConfigCreateParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/config_delete_params.py b/src/cloudflare/types/magic_network_monitoring/config_delete_params.py new file mode 100644 index 00000000000..10abc8efd59 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/config_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ConfigDeleteParams"] + + +class ConfigDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/config_edit_params.py b/src/cloudflare/types/magic_network_monitoring/config_edit_params.py new file mode 100644 index 00000000000..f02fba5f3d2 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/config_edit_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ConfigEditParams"] + + +class ConfigEditParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/config_update_params.py b/src/cloudflare/types/magic_network_monitoring/config_update_params.py new file mode 100644 index 00000000000..acfef585f57 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/config_update_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ConfigUpdateParams"] + + +class ConfigUpdateParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/configuration.py b/src/cloudflare/types/magic_network_monitoring/configuration.py new file mode 100644 index 00000000000..46f5e0a2d83 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/configuration.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["Configuration"] + + +class Configuration(BaseModel): + default_sampling: float + """Fallback sampling rate of flow messages being sent in packets per second. + + This should match the packet sampling rate configured on the router. + """ + + name: str + """The account name.""" + + router_ips: List[str] diff --git a/src/cloudflare/types/magic_network_monitoring/configuration_param.py b/src/cloudflare/types/magic_network_monitoring/configuration_param.py new file mode 100644 index 00000000000..d44a0fc3d86 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/configuration_param.py @@ -0,0 +1,21 @@ +# 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 Required, TypedDict + +__all__ = ["ConfigurationParam"] + + +class ConfigurationParam(TypedDict, total=False): + default_sampling: Required[float] + """Fallback sampling rate of flow messages being sent in packets per second. + + This should match the packet sampling rate configured on the router. + """ + + name: Required[str] + """The account name.""" + + router_ips: Required[List[str]] diff --git a/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_config.py b/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_config.py deleted file mode 100644 index a4ca28cadd3..00000000000 --- a/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_config.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel - -__all__ = ["MagicNetworkMonitoringConfig"] - - -class MagicNetworkMonitoringConfig(BaseModel): - default_sampling: float - """Fallback sampling rate of flow messages being sent in packets per second. - - This should match the packet sampling rate configured on the router. - """ - - name: str - """The account name.""" - - router_ips: List[str] diff --git a/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py b/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py index 8421ef7df0d..3dbb9d85afa 100644 --- a/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py +++ b/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py @@ -35,6 +35,7 @@ class MagicNetworkMonitoringRule(BaseModel): prefixes: List[str] id: Optional[str] = None + """The id of the rule. Must be unique.""" bandwidth_threshold: Optional[float] = None """The number of bits per second for the rule. diff --git a/src/cloudflare/types/magic_network_monitoring/rule_create_params.py b/src/cloudflare/types/magic_network_monitoring/rule_create_params.py new file mode 100644 index 00000000000..dd4c5f4092f --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/rule_create_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RuleCreateParams"] + + +class RuleCreateParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/rule_delete_params.py b/src/cloudflare/types/magic_network_monitoring/rule_delete_params.py new file mode 100644 index 00000000000..f729aaf685c --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/rule_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RuleDeleteParams"] + + +class RuleDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/rule_edit_params.py b/src/cloudflare/types/magic_network_monitoring/rule_edit_params.py new file mode 100644 index 00000000000..005bdbb0ad5 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/rule_edit_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RuleEditParams"] + + +class RuleEditParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/rule_update_params.py b/src/cloudflare/types/magic_network_monitoring/rule_update_params.py new file mode 100644 index 00000000000..d9ae09df664 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/rule_update_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RuleUpdateParams"] + + +class RuleUpdateParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/rules/__init__.py b/src/cloudflare/types/magic_network_monitoring/rules/__init__.py index 32939a9af6e..776662f22d8 100644 --- a/src/cloudflare/types/magic_network_monitoring/rules/__init__.py +++ b/src/cloudflare/types/magic_network_monitoring/rules/__init__.py @@ -2,6 +2,5 @@ from __future__ import annotations -from .magic_network_monitoring_rule_advertisable import ( - MagicNetworkMonitoringRuleAdvertisable as MagicNetworkMonitoringRuleAdvertisable, -) +from .advertisement import Advertisement as Advertisement +from .advertisement_edit_params import AdvertisementEditParams as AdvertisementEditParams diff --git a/src/cloudflare/types/magic_network_monitoring/rules/advertisement.py b/src/cloudflare/types/magic_network_monitoring/rules/advertisement.py new file mode 100644 index 00000000000..145c988ae89 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/rules/advertisement.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["Advertisement"] + + +class Advertisement(BaseModel): + automatic_advertisement: Optional[bool] = None + """ + Toggle on if you would like Cloudflare to automatically advertise the IP + Prefixes within the rule via Magic Transit when the rule is triggered. Only + available for users of Magic Transit. + """ diff --git a/src/cloudflare/types/magic_network_monitoring/rules/advertisement_edit_params.py b/src/cloudflare/types/magic_network_monitoring/rules/advertisement_edit_params.py new file mode 100644 index 00000000000..ece6f001327 --- /dev/null +++ b/src/cloudflare/types/magic_network_monitoring/rules/advertisement_edit_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["AdvertisementEditParams"] + + +class AdvertisementEditParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/magic_network_monitoring/rules/magic_network_monitoring_rule_advertisable.py b/src/cloudflare/types/magic_network_monitoring/rules/magic_network_monitoring_rule_advertisable.py deleted file mode 100644 index c672e0dbe6d..00000000000 --- a/src/cloudflare/types/magic_network_monitoring/rules/magic_network_monitoring_rule_advertisable.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["MagicNetworkMonitoringRuleAdvertisable"] - - -class MagicNetworkMonitoringRuleAdvertisable(BaseModel): - automatic_advertisement: Optional[bool] = None - """ - Toggle on if you would like Cloudflare to automatically advertise the IP - Prefixes within the rule via Magic Transit when the rule is triggered. Only - available for users of Magic Transit. - """ diff --git a/src/cloudflare/types/magic_transit/__init__.py b/src/cloudflare/types/magic_transit/__init__.py index 4cef5611947..ab997685622 100644 --- a/src/cloudflare/types/magic_transit/__init__.py +++ b/src/cloudflare/types/magic_transit/__init__.py @@ -2,24 +2,37 @@ from __future__ import annotations -from .site_get_response import SiteGetResponse as SiteGetResponse +from .site import Site as Site +from .scope import Scope as Scope +from .colo_name import ColoName as ColoName +from .colo_region import ColoRegion as ColoRegion +from .scope_param import ScopeParam as ScopeParam +from .health_check import HealthCheck as HealthCheck +from .psk_metadata import PSKMetadata as PSKMetadata +from .site_location import SiteLocation as SiteLocation +from .colo_name_param import ColoNameParam as ColoNameParam +from .site_list_params import SiteListParams as SiteListParams +from .colo_region_param import ColoRegionParam as ColoRegionParam +from .health_check_rate import HealthCheckRate as HealthCheckRate +from .health_check_type import HealthCheckType as HealthCheckType +from .health_check_param import HealthCheckParam as HealthCheckParam from .route_empty_params import RouteEmptyParams as RouteEmptyParams from .route_get_response import RouteGetResponse as RouteGetResponse from .site_create_params import SiteCreateParams as SiteCreateParams -from .site_list_response import SiteListResponse as SiteListResponse +from .site_delete_params import SiteDeleteParams as SiteDeleteParams from .site_update_params import SiteUpdateParams as SiteUpdateParams from .route_create_params import RouteCreateParams as RouteCreateParams +from .route_delete_params import RouteDeleteParams as RouteDeleteParams from .route_list_response import RouteListResponse as RouteListResponse from .route_update_params import RouteUpdateParams as RouteUpdateParams +from .site_location_param import SiteLocationParam as SiteLocationParam from .route_empty_response import RouteEmptyResponse as RouteEmptyResponse -from .site_create_response import SiteCreateResponse as SiteCreateResponse -from .site_delete_response import SiteDeleteResponse as SiteDeleteResponse -from .site_update_response import SiteUpdateResponse as SiteUpdateResponse from .route_create_response import RouteCreateResponse as RouteCreateResponse from .route_delete_response import RouteDeleteResponse as RouteDeleteResponse from .route_update_response import RouteUpdateResponse as RouteUpdateResponse from .gre_tunnel_get_response import GRETunnelGetResponse as GRETunnelGetResponse from .gre_tunnel_create_params import GRETunnelCreateParams as GRETunnelCreateParams +from .gre_tunnel_delete_params import GRETunnelDeleteParams as GRETunnelDeleteParams from .gre_tunnel_list_response import GRETunnelListResponse as GRETunnelListResponse from .gre_tunnel_update_params import GRETunnelUpdateParams as GRETunnelUpdateParams from .ipsec_tunnel_get_response import IPSECTunnelGetResponse as IPSECTunnelGetResponse @@ -27,6 +40,7 @@ from .gre_tunnel_delete_response import GRETunnelDeleteResponse as GRETunnelDeleteResponse from .gre_tunnel_update_response import GRETunnelUpdateResponse as GRETunnelUpdateResponse from .ipsec_tunnel_create_params import IPSECTunnelCreateParams as IPSECTunnelCreateParams +from .ipsec_tunnel_delete_params import IPSECTunnelDeleteParams as IPSECTunnelDeleteParams from .ipsec_tunnel_list_response import IPSECTunnelListResponse as IPSECTunnelListResponse from .ipsec_tunnel_update_params import IPSECTunnelUpdateParams as IPSECTunnelUpdateParams from .cf_interconnect_get_response import CfInterconnectGetResponse as CfInterconnectGetResponse @@ -36,4 +50,5 @@ from .cf_interconnect_list_response import CfInterconnectListResponse as CfInterconnectListResponse from .cf_interconnect_update_params import CfInterconnectUpdateParams as CfInterconnectUpdateParams from .cf_interconnect_update_response import CfInterconnectUpdateResponse as CfInterconnectUpdateResponse +from .ipsec_tunnel_psk_generate_params import IPSECTunnelPSKGenerateParams as IPSECTunnelPSKGenerateParams from .ipsec_tunnel_psk_generate_response import IPSECTunnelPSKGenerateResponse as IPSECTunnelPSKGenerateResponse diff --git a/src/cloudflare/types/magic_transit/cf_interconnect_list_response.py b/src/cloudflare/types/magic_transit/cf_interconnect_list_response.py index 4fe4b3e4947..38c321caba8 100644 --- a/src/cloudflare/types/magic_transit/cf_interconnect_list_response.py +++ b/src/cloudflare/types/magic_transit/cf_interconnect_list_response.py @@ -2,9 +2,10 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from ..._models import BaseModel +from .health_check_rate import HealthCheckRate +from .health_check_type import HealthCheckType __all__ = ["CfInterconnectListResponse", "Interconnect", "InterconnectGRE", "InterconnectHealthCheck"] @@ -21,7 +22,7 @@ class InterconnectHealthCheck(BaseModel): enabled: Optional[bool] = None """Determines whether to run healthchecks for a tunnel.""" - rate: Optional[Literal["low", "mid", "high"]] = None + rate: Optional[HealthCheckRate] = None """How frequent the health check is run. The default value is `mid`.""" target: Optional[str] = None @@ -32,7 +33,7 @@ class InterconnectHealthCheck(BaseModel): `customer_gre_endpoint address`. """ - type: Optional[Literal["reply", "request"]] = None + type: Optional[HealthCheckType] = None """The type of healthcheck to run, reply or request. The default value is `reply`.""" diff --git a/src/cloudflare/types/magic_transit/cf_interconnect_update_params.py b/src/cloudflare/types/magic_transit/cf_interconnect_update_params.py index 647a50b30ab..00fca27a8f2 100644 --- a/src/cloudflare/types/magic_transit/cf_interconnect_update_params.py +++ b/src/cloudflare/types/magic_transit/cf_interconnect_update_params.py @@ -2,7 +2,10 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict + +from .health_check_rate import HealthCheckRate +from .health_check_type import HealthCheckType __all__ = ["CfInterconnectUpdateParams", "GRE", "HealthCheck"] @@ -45,7 +48,7 @@ class HealthCheck(TypedDict, total=False): enabled: bool """Determines whether to run healthchecks for a tunnel.""" - rate: Literal["low", "mid", "high"] + rate: HealthCheckRate """How frequent the health check is run. The default value is `mid`.""" target: str @@ -56,5 +59,5 @@ class HealthCheck(TypedDict, total=False): `customer_gre_endpoint address`. """ - type: Literal["reply", "request"] + type: HealthCheckType """The type of healthcheck to run, reply or request. The default value is `reply`.""" diff --git a/src/cloudflare/types/magic_transit/colo_name.py b/src/cloudflare/types/magic_transit/colo_name.py new file mode 100644 index 00000000000..00c58aa3340 --- /dev/null +++ b/src/cloudflare/types/magic_transit/colo_name.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +__all__ = ["ColoName"] + +ColoName = List[str] diff --git a/src/cloudflare/types/magic_transit/colo_name_param.py b/src/cloudflare/types/magic_transit/colo_name_param.py new file mode 100644 index 00000000000..bb4fd54d9bb --- /dev/null +++ b/src/cloudflare/types/magic_transit/colo_name_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List + +__all__ = ["ColoNameParamItem"] + +ColoNameParamItem = str + +ColoNameParam = List[str] diff --git a/src/cloudflare/types/magic_transit/colo_region.py b/src/cloudflare/types/magic_transit/colo_region.py new file mode 100644 index 00000000000..579dfbf7884 --- /dev/null +++ b/src/cloudflare/types/magic_transit/colo_region.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +__all__ = ["ColoRegion"] + +ColoRegion = List[str] diff --git a/src/cloudflare/types/magic_transit/colo_region_param.py b/src/cloudflare/types/magic_transit/colo_region_param.py new file mode 100644 index 00000000000..f5ea451dcbd --- /dev/null +++ b/src/cloudflare/types/magic_transit/colo_region_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List + +__all__ = ["ColoRegionParamItem"] + +ColoRegionParamItem = str + +ColoRegionParam = List[str] diff --git a/src/cloudflare/types/magic_transit/gre_tunnel_create_response.py b/src/cloudflare/types/magic_transit/gre_tunnel_create_response.py index c6cb68e2b20..cb4d4c1b6ab 100644 --- a/src/cloudflare/types/magic_transit/gre_tunnel_create_response.py +++ b/src/cloudflare/types/magic_transit/gre_tunnel_create_response.py @@ -2,42 +2,11 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from ..._models import BaseModel +from .health_check import HealthCheck -__all__ = ["GRETunnelCreateResponse", "GRETunnel", "GRETunnelHealthCheck"] - - -class GRETunnelHealthCheck(BaseModel): - direction: Optional[Literal["unidirectional", "bidirectional"]] = None - """The direction of the flow of the healthcheck. - - Either unidirectional, where the probe comes to you via the tunnel and the - result comes back to Cloudflare via the open Internet, or bidirectional where - both the probe and result come and go via the tunnel. Note in the case of - bidirecitonal healthchecks, the target field in health_check is ignored as the - interface_address is used to send traffic into the tunnel. - """ - - enabled: Optional[bool] = None - """Determines whether to run healthchecks for a tunnel.""" - - rate: Optional[Literal["low", "mid", "high"]] = None - """How frequent the health check is run. The default value is `mid`.""" - - target: Optional[str] = None - """The destination address in a request type health check. - - After the healthcheck is decapsulated at the customer end of the tunnel, the - ICMP echo will be forwarded to this address. This field defaults to - `customer_gre_endpoint address`. This field is ignored for bidirectional - healthchecks as the interface_address (not assigned to the Cloudflare side of - the tunnel) is used as the target. - """ - - type: Optional[Literal["reply", "request"]] = None - """The type of healthcheck to run, reply or request. The default value is `reply`.""" +__all__ = ["GRETunnelCreateResponse", "GRETunnel"] class GRETunnel(BaseModel): @@ -70,7 +39,7 @@ class GRETunnel(BaseModel): description: Optional[str] = None """An optional description of the GRE tunnel.""" - health_check: Optional[GRETunnelHealthCheck] = None + health_check: Optional[HealthCheck] = None modified_on: Optional[datetime] = None """The date and time the tunnel was last modified.""" diff --git a/src/cloudflare/types/magic_transit/gre_tunnel_delete_params.py b/src/cloudflare/types/magic_transit/gre_tunnel_delete_params.py new file mode 100644 index 00000000000..c19713f18e3 --- /dev/null +++ b/src/cloudflare/types/magic_transit/gre_tunnel_delete_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__ = ["GRETunnelDeleteParams"] + + +class GRETunnelDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/magic_transit/gre_tunnel_list_response.py b/src/cloudflare/types/magic_transit/gre_tunnel_list_response.py index 017d9f3608d..54f3538e769 100644 --- a/src/cloudflare/types/magic_transit/gre_tunnel_list_response.py +++ b/src/cloudflare/types/magic_transit/gre_tunnel_list_response.py @@ -2,42 +2,11 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from ..._models import BaseModel +from .health_check import HealthCheck -__all__ = ["GRETunnelListResponse", "GRETunnel", "GRETunnelHealthCheck"] - - -class GRETunnelHealthCheck(BaseModel): - direction: Optional[Literal["unidirectional", "bidirectional"]] = None - """The direction of the flow of the healthcheck. - - Either unidirectional, where the probe comes to you via the tunnel and the - result comes back to Cloudflare via the open Internet, or bidirectional where - both the probe and result come and go via the tunnel. Note in the case of - bidirecitonal healthchecks, the target field in health_check is ignored as the - interface_address is used to send traffic into the tunnel. - """ - - enabled: Optional[bool] = None - """Determines whether to run healthchecks for a tunnel.""" - - rate: Optional[Literal["low", "mid", "high"]] = None - """How frequent the health check is run. The default value is `mid`.""" - - target: Optional[str] = None - """The destination address in a request type health check. - - After the healthcheck is decapsulated at the customer end of the tunnel, the - ICMP echo will be forwarded to this address. This field defaults to - `customer_gre_endpoint address`. This field is ignored for bidirectional - healthchecks as the interface_address (not assigned to the Cloudflare side of - the tunnel) is used as the target. - """ - - type: Optional[Literal["reply", "request"]] = None - """The type of healthcheck to run, reply or request. The default value is `reply`.""" +__all__ = ["GRETunnelListResponse", "GRETunnel"] class GRETunnel(BaseModel): @@ -70,7 +39,7 @@ class GRETunnel(BaseModel): description: Optional[str] = None """An optional description of the GRE tunnel.""" - health_check: Optional[GRETunnelHealthCheck] = None + health_check: Optional[HealthCheck] = None modified_on: Optional[datetime] = None """The date and time the tunnel was last modified.""" diff --git a/src/cloudflare/types/magic_transit/gre_tunnel_update_params.py b/src/cloudflare/types/magic_transit/gre_tunnel_update_params.py index d47de7a4dd0..6d891bbe546 100644 --- a/src/cloudflare/types/magic_transit/gre_tunnel_update_params.py +++ b/src/cloudflare/types/magic_transit/gre_tunnel_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["GRETunnelUpdateParams", "HealthCheck"] +from .health_check_param import HealthCheckParam + +__all__ = ["GRETunnelUpdateParams"] class GRETunnelUpdateParams(TypedDict, total=False): @@ -34,7 +36,7 @@ class GRETunnelUpdateParams(TypedDict, total=False): description: str """An optional description of the GRE tunnel.""" - health_check: HealthCheck + health_check: HealthCheckParam mtu: int """Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. @@ -44,34 +46,3 @@ class GRETunnelUpdateParams(TypedDict, total=False): ttl: int """Time To Live (TTL) in number of hops of the GRE tunnel.""" - - -class HealthCheck(TypedDict, total=False): - direction: Literal["unidirectional", "bidirectional"] - """The direction of the flow of the healthcheck. - - Either unidirectional, where the probe comes to you via the tunnel and the - result comes back to Cloudflare via the open Internet, or bidirectional where - both the probe and result come and go via the tunnel. Note in the case of - bidirecitonal healthchecks, the target field in health_check is ignored as the - interface_address is used to send traffic into the tunnel. - """ - - enabled: bool - """Determines whether to run healthchecks for a tunnel.""" - - rate: Literal["low", "mid", "high"] - """How frequent the health check is run. The default value is `mid`.""" - - target: str - """The destination address in a request type health check. - - After the healthcheck is decapsulated at the customer end of the tunnel, the - ICMP echo will be forwarded to this address. This field defaults to - `customer_gre_endpoint address`. This field is ignored for bidirectional - healthchecks as the interface_address (not assigned to the Cloudflare side of - the tunnel) is used as the target. - """ - - type: Literal["reply", "request"] - """The type of healthcheck to run, reply or request. The default value is `reply`.""" diff --git a/src/cloudflare/types/magic_transit/health_check.py b/src/cloudflare/types/magic_transit/health_check.py new file mode 100644 index 00000000000..ae4874cb9ee --- /dev/null +++ b/src/cloudflare/types/magic_transit/health_check.py @@ -0,0 +1,41 @@ +# 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 .health_check_rate import HealthCheckRate +from .health_check_type import HealthCheckType + +__all__ = ["HealthCheck"] + + +class HealthCheck(BaseModel): + direction: Optional[Literal["unidirectional", "bidirectional"]] = None + """The direction of the flow of the healthcheck. + + Either unidirectional, where the probe comes to you via the tunnel and the + result comes back to Cloudflare via the open Internet, or bidirectional where + both the probe and result come and go via the tunnel. Note in the case of + bidirecitonal healthchecks, the target field in health_check is ignored as the + interface_address is used to send traffic into the tunnel. + """ + + enabled: Optional[bool] = None + """Determines whether to run healthchecks for a tunnel.""" + + rate: Optional[HealthCheckRate] = None + """How frequent the health check is run. The default value is `mid`.""" + + target: Optional[str] = None + """The destination address in a request type health check. + + After the healthcheck is decapsulated at the customer end of the tunnel, the + ICMP echo will be forwarded to this address. This field defaults to + `customer_gre_endpoint address`. This field is ignored for bidirectional + healthchecks as the interface_address (not assigned to the Cloudflare side of + the tunnel) is used as the target. + """ + + type: Optional[HealthCheckType] = None + """The type of healthcheck to run, reply or request. The default value is `reply`.""" diff --git a/src/cloudflare/types/magic_transit/health_check_param.py b/src/cloudflare/types/magic_transit/health_check_param.py new file mode 100644 index 00000000000..10d28c17f4a --- /dev/null +++ b/src/cloudflare/types/magic_transit/health_check_param.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .health_check_rate import HealthCheckRate +from .health_check_type import HealthCheckType + +__all__ = ["HealthCheckParam"] + + +class HealthCheckParam(TypedDict, total=False): + direction: Literal["unidirectional", "bidirectional"] + """The direction of the flow of the healthcheck. + + Either unidirectional, where the probe comes to you via the tunnel and the + result comes back to Cloudflare via the open Internet, or bidirectional where + both the probe and result come and go via the tunnel. Note in the case of + bidirecitonal healthchecks, the target field in health_check is ignored as the + interface_address is used to send traffic into the tunnel. + """ + + enabled: bool + """Determines whether to run healthchecks for a tunnel.""" + + rate: HealthCheckRate + """How frequent the health check is run. The default value is `mid`.""" + + target: str + """The destination address in a request type health check. + + After the healthcheck is decapsulated at the customer end of the tunnel, the + ICMP echo will be forwarded to this address. This field defaults to + `customer_gre_endpoint address`. This field is ignored for bidirectional + healthchecks as the interface_address (not assigned to the Cloudflare side of + the tunnel) is used as the target. + """ + + type: HealthCheckType + """The type of healthcheck to run, reply or request. The default value is `reply`.""" diff --git a/src/cloudflare/types/magic_transit/health_check_rate.py b/src/cloudflare/types/magic_transit/health_check_rate.py new file mode 100644 index 00000000000..f0c649d64d7 --- /dev/null +++ b/src/cloudflare/types/magic_transit/health_check_rate.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["HealthCheckRate"] + +HealthCheckRate = Literal["low", "mid", "high"] diff --git a/src/cloudflare/types/magic_transit/health_check_type.py b/src/cloudflare/types/magic_transit/health_check_type.py new file mode 100644 index 00000000000..a1d16204e08 --- /dev/null +++ b/src/cloudflare/types/magic_transit/health_check_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["HealthCheckType"] + +HealthCheckType = Literal["reply", "request"] diff --git a/src/cloudflare/types/magic_transit/ipsec_tunnel_create_params.py b/src/cloudflare/types/magic_transit/ipsec_tunnel_create_params.py index 38abef0649d..1b59178828f 100644 --- a/src/cloudflare/types/magic_transit/ipsec_tunnel_create_params.py +++ b/src/cloudflare/types/magic_transit/ipsec_tunnel_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["IPSECTunnelCreateParams", "HealthCheck"] +from .health_check_param import HealthCheckParam + +__all__ = ["IPSECTunnelCreateParams"] class IPSECTunnelCreateParams(TypedDict, total=False): @@ -25,12 +27,15 @@ class IPSECTunnelCreateParams(TypedDict, total=False): """The name of the IPsec tunnel. The name cannot share a name with other tunnels.""" customer_endpoint: str - """The IP address assigned to the customer side of the IPsec tunnel.""" + """The IP address assigned to the customer side of the IPsec tunnel. + + Not required, but must be set for proactive traceroutes to work. + """ description: str """An optional description forthe IPsec tunnel.""" - health_check: HealthCheck + health_check: HealthCheckParam psk: str """A randomly generated or provided string for use in the IPsec tunnel.""" @@ -40,34 +45,3 @@ class IPSECTunnelCreateParams(TypedDict, total=False): If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. """ - - -class HealthCheck(TypedDict, total=False): - direction: Literal["unidirectional", "bidirectional"] - """The direction of the flow of the healthcheck. - - Either unidirectional, where the probe comes to you via the tunnel and the - result comes back to Cloudflare via the open Internet, or bidirectional where - both the probe and result come and go via the tunnel. Note in the case of - bidirecitonal healthchecks, the target field in health_check is ignored as the - interface_address is used to send traffic into the tunnel. - """ - - enabled: bool - """Determines whether to run healthchecks for a tunnel.""" - - rate: Literal["low", "mid", "high"] - """How frequent the health check is run. The default value is `mid`.""" - - target: str - """The destination address in a request type health check. - - After the healthcheck is decapsulated at the customer end of the tunnel, the - ICMP echo will be forwarded to this address. This field defaults to - `customer_gre_endpoint address`. This field is ignored for bidirectional - healthchecks as the interface_address (not assigned to the Cloudflare side of - the tunnel) is used as the target. - """ - - type: Literal["reply", "request"] - """The type of healthcheck to run, reply or request. The default value is `reply`.""" diff --git a/src/cloudflare/types/magic_transit/ipsec_tunnel_create_response.py b/src/cloudflare/types/magic_transit/ipsec_tunnel_create_response.py index 19870c524ab..21de60ecfcb 100644 --- a/src/cloudflare/types/magic_transit/ipsec_tunnel_create_response.py +++ b/src/cloudflare/types/magic_transit/ipsec_tunnel_create_response.py @@ -2,23 +2,20 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from ..._models import BaseModel +from .psk_metadata import PSKMetadata +from .health_check_rate import HealthCheckRate +from .health_check_type import HealthCheckType -__all__ = ["IPSECTunnelCreateResponse", "IPSECTunnel", "IPSECTunnelPSKMetadata", "IPSECTunnelTunnelHealthCheck"] - - -class IPSECTunnelPSKMetadata(BaseModel): - last_generated_on: Optional[datetime] = None - """The date and time the tunnel was last modified.""" +__all__ = ["IPSECTunnelCreateResponse", "IPSECTunnel", "IPSECTunnelTunnelHealthCheck"] class IPSECTunnelTunnelHealthCheck(BaseModel): enabled: Optional[bool] = None """Determines whether to run healthchecks for a tunnel.""" - rate: Optional[Literal["low", "mid", "high"]] = None + rate: Optional[HealthCheckRate] = None """How frequent the health check is run. The default value is `mid`.""" target: Optional[str] = None @@ -29,7 +26,7 @@ class IPSECTunnelTunnelHealthCheck(BaseModel): `customer_gre_endpoint address`. """ - type: Optional[Literal["reply", "request"]] = None + type: Optional[HealthCheckType] = None """The type of healthcheck to run, reply or request. The default value is `reply`.""" @@ -60,7 +57,10 @@ class IPSECTunnel(BaseModel): """The date and time the tunnel was created.""" customer_endpoint: Optional[str] = None - """The IP address assigned to the customer side of the IPsec tunnel.""" + """The IP address assigned to the customer side of the IPsec tunnel. + + Not required, but must be set for proactive traceroutes to work. + """ description: Optional[str] = None """An optional description forthe IPsec tunnel.""" @@ -68,7 +68,7 @@ class IPSECTunnel(BaseModel): modified_on: Optional[datetime] = None """The date and time the tunnel was last modified.""" - psk_metadata: Optional[IPSECTunnelPSKMetadata] = None + psk_metadata: Optional[PSKMetadata] = None """The PSK metadata that includes when the PSK was generated.""" replay_protection: Optional[bool] = None diff --git a/src/cloudflare/types/magic_transit/ipsec_tunnel_delete_params.py b/src/cloudflare/types/magic_transit/ipsec_tunnel_delete_params.py new file mode 100644 index 00000000000..4cf64bced31 --- /dev/null +++ b/src/cloudflare/types/magic_transit/ipsec_tunnel_delete_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__ = ["IPSECTunnelDeleteParams"] + + +class IPSECTunnelDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/magic_transit/ipsec_tunnel_list_response.py b/src/cloudflare/types/magic_transit/ipsec_tunnel_list_response.py index 93f47391a93..7001f0e4eaa 100644 --- a/src/cloudflare/types/magic_transit/ipsec_tunnel_list_response.py +++ b/src/cloudflare/types/magic_transit/ipsec_tunnel_list_response.py @@ -2,23 +2,20 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from ..._models import BaseModel +from .psk_metadata import PSKMetadata +from .health_check_rate import HealthCheckRate +from .health_check_type import HealthCheckType -__all__ = ["IPSECTunnelListResponse", "IPSECTunnel", "IPSECTunnelPSKMetadata", "IPSECTunnelTunnelHealthCheck"] - - -class IPSECTunnelPSKMetadata(BaseModel): - last_generated_on: Optional[datetime] = None - """The date and time the tunnel was last modified.""" +__all__ = ["IPSECTunnelListResponse", "IPSECTunnel", "IPSECTunnelTunnelHealthCheck"] class IPSECTunnelTunnelHealthCheck(BaseModel): enabled: Optional[bool] = None """Determines whether to run healthchecks for a tunnel.""" - rate: Optional[Literal["low", "mid", "high"]] = None + rate: Optional[HealthCheckRate] = None """How frequent the health check is run. The default value is `mid`.""" target: Optional[str] = None @@ -29,7 +26,7 @@ class IPSECTunnelTunnelHealthCheck(BaseModel): `customer_gre_endpoint address`. """ - type: Optional[Literal["reply", "request"]] = None + type: Optional[HealthCheckType] = None """The type of healthcheck to run, reply or request. The default value is `reply`.""" @@ -60,7 +57,10 @@ class IPSECTunnel(BaseModel): """The date and time the tunnel was created.""" customer_endpoint: Optional[str] = None - """The IP address assigned to the customer side of the IPsec tunnel.""" + """The IP address assigned to the customer side of the IPsec tunnel. + + Not required, but must be set for proactive traceroutes to work. + """ description: Optional[str] = None """An optional description forthe IPsec tunnel.""" @@ -68,7 +68,7 @@ class IPSECTunnel(BaseModel): modified_on: Optional[datetime] = None """The date and time the tunnel was last modified.""" - psk_metadata: Optional[IPSECTunnelPSKMetadata] = None + psk_metadata: Optional[PSKMetadata] = None """The PSK metadata that includes when the PSK was generated.""" replay_protection: Optional[bool] = None diff --git a/src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_params.py b/src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_params.py new file mode 100644 index 00000000000..1066fa603d1 --- /dev/null +++ b/src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_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__ = ["IPSECTunnelPSKGenerateParams"] + + +class IPSECTunnelPSKGenerateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_response.py b/src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_response.py index 260b879fecc..9c4438b1456 100644 --- a/src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_response.py +++ b/src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_response.py @@ -1,16 +1,11 @@ # 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 +from .psk_metadata import PSKMetadata -__all__ = ["IPSECTunnelPSKGenerateResponse", "PSKMetadata"] - - -class PSKMetadata(BaseModel): - last_generated_on: Optional[datetime] = None - """The date and time the tunnel was last modified.""" +__all__ = ["IPSECTunnelPSKGenerateResponse"] class IPSECTunnelPSKGenerateResponse(BaseModel): diff --git a/src/cloudflare/types/magic_transit/ipsec_tunnel_update_params.py b/src/cloudflare/types/magic_transit/ipsec_tunnel_update_params.py index d1f1730d3dc..8a0170e0345 100644 --- a/src/cloudflare/types/magic_transit/ipsec_tunnel_update_params.py +++ b/src/cloudflare/types/magic_transit/ipsec_tunnel_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["IPSECTunnelUpdateParams", "HealthCheck"] +from .health_check_param import HealthCheckParam + +__all__ = ["IPSECTunnelUpdateParams"] class IPSECTunnelUpdateParams(TypedDict, total=False): @@ -25,12 +27,15 @@ class IPSECTunnelUpdateParams(TypedDict, total=False): """The name of the IPsec tunnel. The name cannot share a name with other tunnels.""" customer_endpoint: str - """The IP address assigned to the customer side of the IPsec tunnel.""" + """The IP address assigned to the customer side of the IPsec tunnel. + + Not required, but must be set for proactive traceroutes to work. + """ description: str """An optional description forthe IPsec tunnel.""" - health_check: HealthCheck + health_check: HealthCheckParam psk: str """A randomly generated or provided string for use in the IPsec tunnel.""" @@ -40,34 +45,3 @@ class IPSECTunnelUpdateParams(TypedDict, total=False): If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. """ - - -class HealthCheck(TypedDict, total=False): - direction: Literal["unidirectional", "bidirectional"] - """The direction of the flow of the healthcheck. - - Either unidirectional, where the probe comes to you via the tunnel and the - result comes back to Cloudflare via the open Internet, or bidirectional where - both the probe and result come and go via the tunnel. Note in the case of - bidirecitonal healthchecks, the target field in health_check is ignored as the - interface_address is used to send traffic into the tunnel. - """ - - enabled: bool - """Determines whether to run healthchecks for a tunnel.""" - - rate: Literal["low", "mid", "high"] - """How frequent the health check is run. The default value is `mid`.""" - - target: str - """The destination address in a request type health check. - - After the healthcheck is decapsulated at the customer end of the tunnel, the - ICMP echo will be forwarded to this address. This field defaults to - `customer_gre_endpoint address`. This field is ignored for bidirectional - healthchecks as the interface_address (not assigned to the Cloudflare side of - the tunnel) is used as the target. - """ - - type: Literal["reply", "request"] - """The type of healthcheck to run, reply or request. The default value is `reply`.""" diff --git a/src/cloudflare/types/magic_transit/psk_metadata.py b/src/cloudflare/types/magic_transit/psk_metadata.py new file mode 100644 index 00000000000..db1b57d2b5d --- /dev/null +++ b/src/cloudflare/types/magic_transit/psk_metadata.py @@ -0,0 +1,13 @@ +# 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__ = ["PSKMetadata"] + + +class PSKMetadata(BaseModel): + last_generated_on: Optional[datetime] = None + """The date and time the tunnel was last modified.""" diff --git a/src/cloudflare/types/magic_transit/route_create_response.py b/src/cloudflare/types/magic_transit/route_create_response.py index 2d511d6402a..c8b0dd58904 100644 --- a/src/cloudflare/types/magic_transit/route_create_response.py +++ b/src/cloudflare/types/magic_transit/route_create_response.py @@ -3,17 +3,10 @@ from typing import List, Optional from datetime import datetime +from .scope import Scope from ..._models import BaseModel -__all__ = ["RouteCreateResponse", "Route", "RouteScope"] - - -class RouteScope(BaseModel): - colo_names: Optional[List[str]] = None - """List of colo names for the ECMP scope.""" - - colo_regions: Optional[List[str]] = None - """List of colo regions for the ECMP scope.""" +__all__ = ["RouteCreateResponse", "Route"] class Route(BaseModel): @@ -38,7 +31,7 @@ class Route(BaseModel): modified_on: Optional[datetime] = None """When the route was last modified.""" - scope: Optional[RouteScope] = None + scope: Optional[Scope] = None """Used only for ECMP routes.""" weight: Optional[int] = None diff --git a/src/cloudflare/types/magic_transit/route_delete_params.py b/src/cloudflare/types/magic_transit/route_delete_params.py new file mode 100644 index 00000000000..ae1f7e998a5 --- /dev/null +++ b/src/cloudflare/types/magic_transit/route_delete_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__ = ["RouteDeleteParams"] + + +class RouteDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/magic_transit/route_list_response.py b/src/cloudflare/types/magic_transit/route_list_response.py index 339f0fb5194..5e19e5ba48a 100644 --- a/src/cloudflare/types/magic_transit/route_list_response.py +++ b/src/cloudflare/types/magic_transit/route_list_response.py @@ -3,17 +3,10 @@ from typing import List, Optional from datetime import datetime +from .scope import Scope from ..._models import BaseModel -__all__ = ["RouteListResponse", "Route", "RouteScope"] - - -class RouteScope(BaseModel): - colo_names: Optional[List[str]] = None - """List of colo names for the ECMP scope.""" - - colo_regions: Optional[List[str]] = None - """List of colo regions for the ECMP scope.""" +__all__ = ["RouteListResponse", "Route"] class Route(BaseModel): @@ -38,7 +31,7 @@ class Route(BaseModel): modified_on: Optional[datetime] = None """When the route was last modified.""" - scope: Optional[RouteScope] = None + scope: Optional[Scope] = None """Used only for ECMP routes.""" weight: Optional[int] = None diff --git a/src/cloudflare/types/magic_transit/route_update_params.py b/src/cloudflare/types/magic_transit/route_update_params.py index 8c608ddbe47..14d10ad42c0 100644 --- a/src/cloudflare/types/magic_transit/route_update_params.py +++ b/src/cloudflare/types/magic_transit/route_update_params.py @@ -2,10 +2,11 @@ from __future__ import annotations -from typing import List from typing_extensions import Required, TypedDict -__all__ = ["RouteUpdateParams", "Scope"] +from .scope_param import ScopeParam + +__all__ = ["RouteUpdateParams"] class RouteUpdateParams(TypedDict, total=False): @@ -24,16 +25,8 @@ class RouteUpdateParams(TypedDict, total=False): description: str """An optional human provided description of the static route.""" - scope: Scope + scope: ScopeParam """Used only for ECMP routes.""" weight: int """Optional weight of the ECMP scope - if provided.""" - - -class Scope(TypedDict, total=False): - colo_names: List[str] - """List of colo names for the ECMP scope.""" - - colo_regions: List[str] - """List of colo regions for the ECMP scope.""" diff --git a/src/cloudflare/types/magic_transit/scope.py b/src/cloudflare/types/magic_transit/scope.py new file mode 100644 index 00000000000..a5077ec70e5 --- /dev/null +++ b/src/cloudflare/types/magic_transit/scope.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .colo_name import ColoName +from .colo_region import ColoRegion + +__all__ = ["Scope"] + + +class Scope(BaseModel): + colo_names: Optional[ColoName] = None + """List of colo names for the ECMP scope.""" + + colo_regions: Optional[ColoRegion] = None + """List of colo regions for the ECMP scope.""" diff --git a/src/cloudflare/types/magic_transit/scope_param.py b/src/cloudflare/types/magic_transit/scope_param.py new file mode 100644 index 00000000000..f65fb559de4 --- /dev/null +++ b/src/cloudflare/types/magic_transit/scope_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .colo_name_param import ColoNameParam +from .colo_region_param import ColoRegionParam + +__all__ = ["ScopeParam"] + + +class ScopeParam(TypedDict, total=False): + colo_names: ColoNameParam + """List of colo names for the ECMP scope.""" + + colo_regions: ColoRegionParam + """List of colo regions for the ECMP scope.""" diff --git a/src/cloudflare/types/magic_transit/site.py b/src/cloudflare/types/magic_transit/site.py new file mode 100644 index 00000000000..41ffe01ee98 --- /dev/null +++ b/src/cloudflare/types/magic_transit/site.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .site_location import SiteLocation + +__all__ = ["Site"] + + +class Site(BaseModel): + id: Optional[str] = None + """Identifier""" + + connector_id: Optional[str] = None + """Magic WAN Connector identifier tag.""" + + description: Optional[str] = None + + ha_mode: Optional[bool] = None + """Site high availability mode. + + If set to true, the site can have two connectors and runs in high availability + mode. + """ + + location: Optional[SiteLocation] = None + """Location of site in latitude and longitude.""" + + name: Optional[str] = None + """The name of the site.""" + + secondary_connector_id: Optional[str] = None + """Magic WAN Connector identifier tag. Used when high availability mode is on.""" diff --git a/src/cloudflare/types/magic_transit/site_create_params.py b/src/cloudflare/types/magic_transit/site_create_params.py index 1e17d1bf467..410981caead 100644 --- a/src/cloudflare/types/magic_transit/site_create_params.py +++ b/src/cloudflare/types/magic_transit/site_create_params.py @@ -4,25 +4,15 @@ from typing_extensions import Required, TypedDict -__all__ = ["SiteCreateParams", "Site", "SiteLocation"] +from .site_location_param import SiteLocationParam + +__all__ = ["SiteCreateParams"] class SiteCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - site: Site - - -class SiteLocation(TypedDict, total=False): - lat: str - """Latitude""" - - lon: str - """Longitude""" - - -class Site(TypedDict, total=False): name: Required[str] """The name of the site.""" @@ -38,7 +28,7 @@ class Site(TypedDict, total=False): mode. """ - location: SiteLocation + location: SiteLocationParam """Location of site in latitude and longitude.""" secondary_connector_id: str diff --git a/src/cloudflare/types/magic_transit/site_create_response.py b/src/cloudflare/types/magic_transit/site_create_response.py deleted file mode 100644 index 7c275f45d48..00000000000 --- a/src/cloudflare/types/magic_transit/site_create_response.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["SiteCreateResponse", "Site", "SiteLocation"] - - -class SiteLocation(BaseModel): - lat: Optional[str] = None - """Latitude""" - - lon: Optional[str] = None - """Longitude""" - - -class Site(BaseModel): - id: Optional[str] = None - """Identifier""" - - connector_id: Optional[str] = None - """Magic WAN Connector identifier tag.""" - - description: Optional[str] = None - - ha_mode: Optional[bool] = None - """Site high availability mode. - - If set to true, the site can have two connectors and runs in high availability - mode. - """ - - location: Optional[SiteLocation] = None - """Location of site in latitude and longitude.""" - - name: Optional[str] = None - """The name of the site.""" - - secondary_connector_id: Optional[str] = None - """Magic WAN Connector identifier tag. Used when high availability mode is on.""" - - -class SiteCreateResponse(BaseModel): - site: Optional[Site] = None diff --git a/src/cloudflare/types/magic_transit/site_delete_params.py b/src/cloudflare/types/magic_transit/site_delete_params.py new file mode 100644 index 00000000000..fdd180f40b4 --- /dev/null +++ b/src/cloudflare/types/magic_transit/site_delete_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__ = ["SiteDeleteParams"] + + +class SiteDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/magic_transit/site_delete_response.py b/src/cloudflare/types/magic_transit/site_delete_response.py deleted file mode 100644 index 3cbaf98bbd8..00000000000 --- a/src/cloudflare/types/magic_transit/site_delete_response.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["SiteDeleteResponse", "DeletedSite", "DeletedSiteLocation"] - - -class DeletedSiteLocation(BaseModel): - lat: Optional[str] = None - """Latitude""" - - lon: Optional[str] = None - """Longitude""" - - -class DeletedSite(BaseModel): - id: Optional[str] = None - """Identifier""" - - connector_id: Optional[str] = None - """Magic WAN Connector identifier tag.""" - - description: Optional[str] = None - - ha_mode: Optional[bool] = None - """Site high availability mode. - - If set to true, the site can have two connectors and runs in high availability - mode. - """ - - location: Optional[DeletedSiteLocation] = None - """Location of site in latitude and longitude.""" - - name: Optional[str] = None - """The name of the site.""" - - secondary_connector_id: Optional[str] = None - """Magic WAN Connector identifier tag. Used when high availability mode is on.""" - - -class SiteDeleteResponse(BaseModel): - deleted: Optional[bool] = None - - deleted_site: Optional[DeletedSite] = None diff --git a/src/cloudflare/types/magic_transit/site_get_response.py b/src/cloudflare/types/magic_transit/site_get_response.py deleted file mode 100644 index 561ac051c3e..00000000000 --- a/src/cloudflare/types/magic_transit/site_get_response.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["SiteGetResponse", "Site", "SiteLocation"] - - -class SiteLocation(BaseModel): - lat: Optional[str] = None - """Latitude""" - - lon: Optional[str] = None - """Longitude""" - - -class Site(BaseModel): - id: Optional[str] = None - """Identifier""" - - connector_id: Optional[str] = None - """Magic WAN Connector identifier tag.""" - - description: Optional[str] = None - - ha_mode: Optional[bool] = None - """Site high availability mode. - - If set to true, the site can have two connectors and runs in high availability - mode. - """ - - location: Optional[SiteLocation] = None - """Location of site in latitude and longitude.""" - - name: Optional[str] = None - """The name of the site.""" - - secondary_connector_id: Optional[str] = None - """Magic WAN Connector identifier tag. Used when high availability mode is on.""" - - -class SiteGetResponse(BaseModel): - site: Optional[Site] = None diff --git a/src/cloudflare/types/magic_transit/site_list_params.py b/src/cloudflare/types/magic_transit/site_list_params.py new file mode 100644 index 00000000000..8f74157c2de --- /dev/null +++ b/src/cloudflare/types/magic_transit/site_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SiteListParams"] + + +class SiteListParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + connector_identifier: str + """Identifier""" diff --git a/src/cloudflare/types/magic_transit/site_list_response.py b/src/cloudflare/types/magic_transit/site_list_response.py deleted file mode 100644 index 35c166fbe06..00000000000 --- a/src/cloudflare/types/magic_transit/site_list_response.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["SiteListResponse", "Site", "SiteLocation"] - - -class SiteLocation(BaseModel): - lat: Optional[str] = None - """Latitude""" - - lon: Optional[str] = None - """Longitude""" - - -class Site(BaseModel): - id: Optional[str] = None - """Identifier""" - - connector_id: Optional[str] = None - """Magic WAN Connector identifier tag.""" - - description: Optional[str] = None - - ha_mode: Optional[bool] = None - """Site high availability mode. - - If set to true, the site can have two connectors and runs in high availability - mode. - """ - - location: Optional[SiteLocation] = None - """Location of site in latitude and longitude.""" - - name: Optional[str] = None - """The name of the site.""" - - secondary_connector_id: Optional[str] = None - """Magic WAN Connector identifier tag. Used when high availability mode is on.""" - - -class SiteListResponse(BaseModel): - sites: Optional[List[Site]] = None diff --git a/src/cloudflare/types/magic_transit/site_location.py b/src/cloudflare/types/magic_transit/site_location.py new file mode 100644 index 00000000000..6cf9417b1d5 --- /dev/null +++ b/src/cloudflare/types/magic_transit/site_location.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__ = ["SiteLocation"] + + +class SiteLocation(BaseModel): + lat: Optional[str] = None + """Latitude""" + + lon: Optional[str] = None + """Longitude""" diff --git a/src/cloudflare/types/magic_transit/site_location_param.py b/src/cloudflare/types/magic_transit/site_location_param.py new file mode 100644 index 00000000000..ee126d180a6 --- /dev/null +++ b/src/cloudflare/types/magic_transit/site_location_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SiteLocationParam"] + + +class SiteLocationParam(TypedDict, total=False): + lat: str + """Latitude""" + + lon: str + """Longitude""" diff --git a/src/cloudflare/types/magic_transit/site_update_params.py b/src/cloudflare/types/magic_transit/site_update_params.py index 74c96c227de..1843cba18ff 100644 --- a/src/cloudflare/types/magic_transit/site_update_params.py +++ b/src/cloudflare/types/magic_transit/site_update_params.py @@ -4,31 +4,21 @@ from typing_extensions import Required, TypedDict -__all__ = ["SiteUpdateParams", "Site", "SiteLocation"] +from .site_location_param import SiteLocationParam + +__all__ = ["SiteUpdateParams"] class SiteUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - site: Site - - -class SiteLocation(TypedDict, total=False): - lat: str - """Latitude""" - - lon: str - """Longitude""" - - -class Site(TypedDict, total=False): connector_id: str """Magic WAN Connector identifier tag.""" description: str - location: SiteLocation + location: SiteLocationParam """Location of site in latitude and longitude.""" name: str diff --git a/src/cloudflare/types/magic_transit/site_update_response.py b/src/cloudflare/types/magic_transit/site_update_response.py deleted file mode 100644 index 421808a4a06..00000000000 --- a/src/cloudflare/types/magic_transit/site_update_response.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["SiteUpdateResponse", "Site", "SiteLocation"] - - -class SiteLocation(BaseModel): - lat: Optional[str] = None - """Latitude""" - - lon: Optional[str] = None - """Longitude""" - - -class Site(BaseModel): - id: Optional[str] = None - """Identifier""" - - connector_id: Optional[str] = None - """Magic WAN Connector identifier tag.""" - - description: Optional[str] = None - - ha_mode: Optional[bool] = None - """Site high availability mode. - - If set to true, the site can have two connectors and runs in high availability - mode. - """ - - location: Optional[SiteLocation] = None - """Location of site in latitude and longitude.""" - - name: Optional[str] = None - """The name of the site.""" - - secondary_connector_id: Optional[str] = None - """Magic WAN Connector identifier tag. Used when high availability mode is on.""" - - -class SiteUpdateResponse(BaseModel): - site: Optional[Site] = None diff --git a/src/cloudflare/types/magic_transit/sites/__init__.py b/src/cloudflare/types/magic_transit/sites/__init__.py index 3bda645ac5d..1b2ed37966f 100644 --- a/src/cloudflare/types/magic_transit/sites/__init__.py +++ b/src/cloudflare/types/magic_transit/sites/__init__.py @@ -2,24 +2,34 @@ from __future__ import annotations -from .acl_get_response import ACLGetResponse as ACLGetResponse -from .lan_get_response import LANGetResponse as LANGetResponse -from .wan_get_response import WANGetResponse as WANGetResponse +from .acl import ACL as ACL +from .lan import LAN as LAN +from .nat import Nat as Nat +from .wan import WAN as WAN +from .subnet import Subnet as Subnet +from .nat_param import NatParam as NatParam +from .dhcp_relay import DHCPRelay as DHCPRelay +from .dhcp_server import DHCPServer as DHCPServer +from .subnet_param import SubnetParam as SubnetParam +from .routed_subnet import RoutedSubnet as RoutedSubnet +from .allowed_protocol import AllowedProtocol as AllowedProtocol +from .dhcp_relay_param import DHCPRelayParam as DHCPRelayParam +from .acl_configuration import ACLConfiguration as ACLConfiguration from .acl_create_params import ACLCreateParams as ACLCreateParams -from .acl_list_response import ACLListResponse as ACLListResponse +from .acl_delete_params import ACLDeleteParams as ACLDeleteParams from .acl_update_params import ACLUpdateParams as ACLUpdateParams +from .dhcp_server_param import DHCPServerParam as DHCPServerParam from .lan_create_params import LANCreateParams as LANCreateParams -from .lan_list_response import LANListResponse as LANListResponse +from .lan_delete_params import LANDeleteParams as LANDeleteParams from .lan_update_params import LANUpdateParams as LANUpdateParams from .wan_create_params import WANCreateParams as WANCreateParams -from .wan_list_response import WANListResponse as WANListResponse +from .wan_delete_params import WANDeleteParams as WANDeleteParams from .wan_update_params import WANUpdateParams as WANUpdateParams -from .acl_create_response import ACLCreateResponse as ACLCreateResponse -from .acl_delete_response import ACLDeleteResponse as ACLDeleteResponse -from .acl_update_response import ACLUpdateResponse as ACLUpdateResponse from .lan_create_response import LANCreateResponse as LANCreateResponse -from .lan_delete_response import LANDeleteResponse as LANDeleteResponse -from .lan_update_response import LANUpdateResponse as LANUpdateResponse +from .routed_subnet_param import RoutedSubnetParam as RoutedSubnetParam from .wan_create_response import WANCreateResponse as WANCreateResponse -from .wan_delete_response import WANDeleteResponse as WANDeleteResponse -from .wan_update_response import WANUpdateResponse as WANUpdateResponse +from .lan_static_addressing import LANStaticAddressing as LANStaticAddressing +from .wan_static_addressing import WANStaticAddressing as WANStaticAddressing +from .acl_configuration_param import ACLConfigurationParam as ACLConfigurationParam +from .lan_static_addressing_param import LANStaticAddressingParam as LANStaticAddressingParam +from .wan_static_addressing_param import WANStaticAddressingParam as WANStaticAddressingParam diff --git a/src/cloudflare/types/magic_transit/sites/acl.py b/src/cloudflare/types/magic_transit/sites/acl.py new file mode 100644 index 00000000000..01bcf9e4b55 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/acl.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel +from .allowed_protocol import AllowedProtocol +from .acl_configuration import ACLConfiguration + +__all__ = ["ACL"] + + +class ACL(BaseModel): + id: Optional[str] = None + """Identifier""" + + description: Optional[str] = None + """Description for the ACL.""" + + forward_locally: Optional[bool] = None + """The desired forwarding action for this ACL policy. + + If set to "false", the policy will forward traffic to Cloudflare. If set to + "true", the policy will forward traffic locally on the Magic WAN Connector. If + not included in request, will default to false. + """ + + lan_1: Optional[ACLConfiguration] = None + + lan_2: Optional[ACLConfiguration] = None + + name: Optional[str] = None + """The name of the ACL.""" + + protocols: Optional[List[AllowedProtocol]] = None diff --git a/src/cloudflare/types/magic_transit/sites/acl_configuration.py b/src/cloudflare/types/magic_transit/sites/acl_configuration.py new file mode 100644 index 00000000000..6c934b500b5 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/acl_configuration.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .subnet import Subnet +from ...._models import BaseModel + +__all__ = ["ACLConfiguration"] + + +class ACLConfiguration(BaseModel): + lan_id: str + """The identifier for the LAN you want to create an ACL policy with.""" + + lan_name: Optional[str] = None + """The name of the LAN based on the provided lan_id.""" + + ports: Optional[List[int]] = None + """Array of ports on the provided LAN that will be included in the ACL. + + If no ports are provided, communication on any port on this LAN is allowed. + """ + + subnets: Optional[List[Subnet]] = None + """Array of subnet IPs within the LAN that will be included in the ACL. + + If no subnets are provided, communication on any subnets on this LAN are + allowed. + """ diff --git a/src/cloudflare/types/magic_transit/sites/acl_configuration_param.py b/src/cloudflare/types/magic_transit/sites/acl_configuration_param.py new file mode 100644 index 00000000000..918fe9e2628 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/acl_configuration_param.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 List, Iterable +from typing_extensions import Required, TypedDict + +from .subnet_param import SubnetParam + +__all__ = ["ACLConfigurationParam"] + + +class ACLConfigurationParam(TypedDict, total=False): + lan_id: Required[str] + """The identifier for the LAN you want to create an ACL policy with.""" + + lan_name: str + """The name of the LAN based on the provided lan_id.""" + + ports: Iterable[int] + """Array of ports on the provided LAN that will be included in the ACL. + + If no ports are provided, communication on any port on this LAN is allowed. + """ + + subnets: List[SubnetParam] + """Array of subnet IPs within the LAN that will be included in the ACL. + + If no subnets are provided, communication on any subnets on this LAN are + allowed. + """ 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 019dd8be216..67a21900fa4 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_create_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_create_params.py @@ -2,65 +2,22 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict +from typing import List +from typing_extensions import Required, TypedDict -__all__ = ["ACLCreateParams", "ACL", "ACLLAN1", "ACLLAN2"] +from .allowed_protocol import AllowedProtocol +from .acl_configuration_param import ACLConfigurationParam + +__all__ = ["ACLCreateParams"] class ACLCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - acl: ACL - - -class ACLLAN1(TypedDict, total=False): - lan_id: Required[str] - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: str - """The name of the LAN based on the provided lan_id.""" - - ports: Iterable[int] - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: List[Union[str, str]] - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACLLAN2(TypedDict, total=False): - lan_id: Required[str] - """The identifier for the LAN you want to create an ACL policy with.""" + lan_1: Required[ACLConfigurationParam] - lan_name: str - """The name of the LAN based on the provided lan_id.""" - - ports: Iterable[int] - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: List[Union[str, str]] - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACL(TypedDict, total=False): - lan_1: Required[ACLLAN1] - - lan_2: Required[ACLLAN2] + lan_2: Required[ACLConfigurationParam] name: Required[str] """The name of the ACL.""" @@ -68,4 +25,12 @@ class ACL(TypedDict, total=False): description: str """Description for the ACL.""" - protocols: List[Literal["tcp", "udp", "icmp"]] + forward_locally: bool + """The desired forwarding action for this ACL policy. + + If set to "false", the policy will forward traffic to Cloudflare. If set to + "true", the policy will forward traffic locally on the Magic WAN Connector. If + not included in request, will default to false. + """ + + protocols: List[AllowedProtocol] diff --git a/src/cloudflare/types/magic_transit/sites/acl_create_response.py b/src/cloudflare/types/magic_transit/sites/acl_create_response.py deleted file mode 100644 index 8c4d2d61f0e..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_create_response.py +++ /dev/null @@ -1,71 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ACLCreateResponse", "ACL", "ACLLAN1", "ACLLAN2"] - - -class ACLLAN1(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACLLAN2(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACL(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - """Description for the ACL.""" - - lan_1: Optional[ACLLAN1] = None - - lan_2: Optional[ACLLAN2] = None - - name: Optional[str] = None - """The name of the ACL.""" - - protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None - - -class ACLCreateResponse(BaseModel): - acls: Optional[List[ACL]] = None diff --git a/src/cloudflare/types/magic_transit/sites/acl_delete_params.py b/src/cloudflare/types/magic_transit/sites/acl_delete_params.py new file mode 100644 index 00000000000..12a1368d560 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/acl_delete_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__ = ["ACLDeleteParams"] + + +class ACLDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + site_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/magic_transit/sites/acl_delete_response.py b/src/cloudflare/types/magic_transit/sites/acl_delete_response.py deleted file mode 100644 index b2c42b0af5d..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_delete_response.py +++ /dev/null @@ -1,74 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ACLDeleteResponse", "DeletedACL", "DeletedACLLAN1", "DeletedACLLAN2"] - - -class DeletedACLLAN1(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class DeletedACLLAN2(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class DeletedACL(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - """Description for the ACL.""" - - lan_1: Optional[DeletedACLLAN1] = None - - lan_2: Optional[DeletedACLLAN2] = None - - name: Optional[str] = None - """The name of the ACL.""" - - protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None - - -class ACLDeleteResponse(BaseModel): - deleted: Optional[bool] = None - - deleted_acl: Optional[DeletedACL] = None - """Bidirectional ACL policy for local network traffic within a site.""" diff --git a/src/cloudflare/types/magic_transit/sites/acl_get_response.py b/src/cloudflare/types/magic_transit/sites/acl_get_response.py deleted file mode 100644 index 0bcde798dfb..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_get_response.py +++ /dev/null @@ -1,72 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ACLGetResponse", "ACL", "ACLLAN1", "ACLLAN2"] - - -class ACLLAN1(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACLLAN2(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACL(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - """Description for the ACL.""" - - lan_1: Optional[ACLLAN1] = None - - lan_2: Optional[ACLLAN2] = None - - name: Optional[str] = None - """The name of the ACL.""" - - protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None - - -class ACLGetResponse(BaseModel): - acl: Optional[ACL] = None - """Bidirectional ACL policy for local network traffic within a site.""" diff --git a/src/cloudflare/types/magic_transit/sites/acl_list_response.py b/src/cloudflare/types/magic_transit/sites/acl_list_response.py deleted file mode 100644 index e13a92a1fd8..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_list_response.py +++ /dev/null @@ -1,71 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ACLListResponse", "ACL", "ACLLAN1", "ACLLAN2"] - - -class ACLLAN1(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACLLAN2(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACL(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - """Description for the ACL.""" - - lan_1: Optional[ACLLAN1] = None - - lan_2: Optional[ACLLAN2] = None - - name: Optional[str] = None - """The name of the ACL.""" - - protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None - - -class ACLListResponse(BaseModel): - acls: Optional[List[ACL]] = None 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 9ba0e5a1476..72165d3c2a2 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_update_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_update_params.py @@ -2,10 +2,13 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict +from typing import List +from typing_extensions import Required, TypedDict -__all__ = ["ACLUpdateParams", "ACL", "ACLLAN1", "ACLLAN2"] +from .allowed_protocol import AllowedProtocol +from .acl_configuration_param import ACLConfigurationParam + +__all__ = ["ACLUpdateParams"] class ACLUpdateParams(TypedDict, total=False): @@ -15,60 +18,22 @@ class ACLUpdateParams(TypedDict, total=False): site_id: Required[str] """Identifier""" - acl: ACL - - -class ACLLAN1(TypedDict, total=False): - lan_id: Required[str] - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: str - """The name of the LAN based on the provided lan_id.""" - - ports: Iterable[int] - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: List[Union[str, str]] - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACLLAN2(TypedDict, total=False): - lan_id: Required[str] - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: str - """The name of the LAN based on the provided lan_id.""" - - ports: Iterable[int] - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ + description: str + """Description for the ACL.""" - subnets: List[Union[str, str]] - """Array of subnet IPs within the LAN that will be included in the ACL. + forward_locally: bool + """The desired forwarding action for this ACL policy. - If no subnets are provided, communication on any subnets on this LAN are - allowed. + If set to "false", the policy will forward traffic to Cloudflare. If set to + "true", the policy will forward traffic locally on the Magic WAN Connector. If + not included in request, will default to false. """ + lan_1: ACLConfigurationParam -class ACL(TypedDict, total=False): - description: str - """Description for the ACL.""" - - lan_1: ACLLAN1 - - lan_2: ACLLAN2 + lan_2: ACLConfigurationParam name: str """The name of the ACL.""" - protocols: List[Literal["tcp", "udp", "icmp"]] + protocols: List[AllowedProtocol] diff --git a/src/cloudflare/types/magic_transit/sites/acl_update_response.py b/src/cloudflare/types/magic_transit/sites/acl_update_response.py deleted file mode 100644 index 6759f9a921b..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_update_response.py +++ /dev/null @@ -1,72 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ACLUpdateResponse", "ACL", "ACLLAN1", "ACLLAN2"] - - -class ACLLAN1(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACLLAN2(BaseModel): - lan_id: str - """The identifier for the LAN you want to create an ACL policy with.""" - - lan_name: Optional[str] = None - """The name of the LAN based on the provided lan_id.""" - - ports: Optional[List[int]] = None - """Array of ports on the provided LAN that will be included in the ACL. - - If no ports are provided, communication on any port on this LAN is allowed. - """ - - subnets: Optional[List[Union[str, str]]] = None - """Array of subnet IPs within the LAN that will be included in the ACL. - - If no subnets are provided, communication on any subnets on this LAN are - allowed. - """ - - -class ACL(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - """Description for the ACL.""" - - lan_1: Optional[ACLLAN1] = None - - lan_2: Optional[ACLLAN2] = None - - name: Optional[str] = None - """The name of the ACL.""" - - protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None - - -class ACLUpdateResponse(BaseModel): - acl: Optional[ACL] = None - """Bidirectional ACL policy for local network traffic within a site.""" diff --git a/src/cloudflare/types/magic_transit/sites/allowed_protocol.py b/src/cloudflare/types/magic_transit/sites/allowed_protocol.py new file mode 100644 index 00000000000..cce3a21021e --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/allowed_protocol.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["AllowedProtocol"] + +AllowedProtocol = Literal["tcp", "udp", "icmp"] diff --git a/src/cloudflare/types/magic_transit/sites/dhcp_relay.py b/src/cloudflare/types/magic_transit/sites/dhcp_relay.py new file mode 100644 index 00000000000..573ae4e9a64 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/dhcp_relay.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["DHCPRelay"] + + +class DHCPRelay(BaseModel): + server_addresses: Optional[List[str]] = None + """List of DHCP server IPs.""" diff --git a/src/cloudflare/types/magic_transit/sites/dhcp_relay_param.py b/src/cloudflare/types/magic_transit/sites/dhcp_relay_param.py new file mode 100644 index 00000000000..d683a321028 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/dhcp_relay_param.py @@ -0,0 +1,13 @@ +# 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 TypedDict + +__all__ = ["DHCPRelayParam"] + + +class DHCPRelayParam(TypedDict, total=False): + server_addresses: List[str] + """List of DHCP server IPs.""" diff --git a/src/cloudflare/types/magic_transit/sites/dhcp_server.py b/src/cloudflare/types/magic_transit/sites/dhcp_server.py new file mode 100644 index 00000000000..2afdcdc65dd --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/dhcp_server.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ...._models import BaseModel + +__all__ = ["DHCPServer"] + + +class DHCPServer(BaseModel): + dhcp_pool_end: Optional[str] = None + """A valid IPv4 address.""" + + dhcp_pool_start: Optional[str] = None + """A valid IPv4 address.""" + + dns_server: Optional[str] = None + """A valid IPv4 address.""" + + reservations: Optional[Dict[str, str]] = None + """Mapping of MAC addresses to IP addresses""" diff --git a/src/cloudflare/types/magic_transit/sites/dhcp_server_param.py b/src/cloudflare/types/magic_transit/sites/dhcp_server_param.py new file mode 100644 index 00000000000..85bfb2f7745 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/dhcp_server_param.py @@ -0,0 +1,22 @@ +# 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 TypedDict + +__all__ = ["DHCPServerParam"] + + +class DHCPServerParam(TypedDict, total=False): + dhcp_pool_end: str + """A valid IPv4 address.""" + + dhcp_pool_start: str + """A valid IPv4 address.""" + + dns_server: str + """A valid IPv4 address.""" + + reservations: Dict[str, str] + """Mapping of MAC addresses to IP addresses""" diff --git a/src/cloudflare/types/magic_transit/sites/lan.py b/src/cloudflare/types/magic_transit/sites/lan.py new file mode 100644 index 00000000000..6df37634b0d --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/lan.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .nat import Nat +from ...._models import BaseModel +from .routed_subnet import RoutedSubnet +from .lan_static_addressing import LANStaticAddressing + +__all__ = ["LAN"] + + +class LAN(BaseModel): + id: Optional[str] = None + """Identifier""" + + ha_link: Optional[bool] = None + """mark true to use this LAN for HA probing. + + only works for site with HA turned on. only one LAN can be set as the ha_link. + """ + + name: Optional[str] = None + + nat: Optional[Nat] = None + + physport: Optional[int] = None + + routed_subnets: Optional[List[RoutedSubnet]] = None + + site_id: Optional[str] = None + """Identifier""" + + static_addressing: Optional[LANStaticAddressing] = None + """ + If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + """ + + vlan_tag: Optional[int] = None + """VLAN port number.""" diff --git a/src/cloudflare/types/magic_transit/sites/lan_create_params.py b/src/cloudflare/types/magic_transit/sites/lan_create_params.py index f9edf052625..16ca5e81832 100644 --- a/src/cloudflare/types/magic_transit/sites/lan_create_params.py +++ b/src/cloudflare/types/magic_transit/sites/lan_create_params.py @@ -2,101 +2,38 @@ from __future__ import annotations -from typing import Dict, List, Iterable +from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = [ - "LANCreateParams", - "LAN", - "LANNat", - "LANRoutedSubnet", - "LANRoutedSubnetNat", - "LANStaticAddressing", - "LANStaticAddressingDhcpRelay", - "LANStaticAddressingDhcpServer", -] +from .nat_param import NatParam +from .routed_subnet_param import RoutedSubnetParam +from .lan_static_addressing_param import LANStaticAddressingParam + +__all__ = ["LANCreateParams"] class LANCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - lan: LAN - - -class LANNat(TypedDict, total=False): - static_prefix: str - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnetNat(TypedDict, total=False): - static_prefix: str - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnet(TypedDict, total=False): - next_hop: Required[str] - """A valid IPv4 address.""" - - prefix: Required[str] - """A valid CIDR notation representing an IP range.""" - - nat: LANRoutedSubnetNat - - -class LANStaticAddressingDhcpRelay(TypedDict, total=False): - server_addresses: List[str] - """List of DHCP server IPs.""" - - -class LANStaticAddressingDhcpServer(TypedDict, total=False): - dhcp_pool_end: str - """A valid IPv4 address.""" - - dhcp_pool_start: str - """A valid IPv4 address.""" - - dns_server: str - """A valid IPv4 address.""" - - reservations: Dict[str, str] - """Mapping of MAC addresses to IP addresses""" - - -class LANStaticAddressing(TypedDict, total=False): - address: Required[str] - """A valid CIDR notation representing an IP range.""" - - dhcp_relay: LANStaticAddressingDhcpRelay - - dhcp_server: LANStaticAddressingDhcpServer - - secondary_address: str - """A valid CIDR notation representing an IP range.""" - - virtual_address: str - """A valid CIDR notation representing an IP range.""" - - -class LAN(TypedDict, total=False): physport: Required[int] vlan_tag: Required[int] """VLAN port number.""" - description: str - ha_link: bool """mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. """ - nat: LANNat + name: str + + nat: NatParam - routed_subnets: Iterable[LANRoutedSubnet] + routed_subnets: Iterable[RoutedSubnetParam] - static_addressing: LANStaticAddressing + static_addressing: LANStaticAddressingParam """ If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, diff --git a/src/cloudflare/types/magic_transit/sites/lan_create_response.py b/src/cloudflare/types/magic_transit/sites/lan_create_response.py index 7ca8698b400..87939756ba3 100644 --- a/src/cloudflare/types/magic_transit/sites/lan_create_response.py +++ b/src/cloudflare/types/magic_transit/sites/lan_create_response.py @@ -1,106 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import List -from ...._models import BaseModel +from .lan import LAN -__all__ = [ - "LANCreateResponse", - "LAN", - "LANNat", - "LANRoutedSubnet", - "LANRoutedSubnetNat", - "LANStaticAddressing", - "LANStaticAddressingDhcpRelay", - "LANStaticAddressingDhcpServer", -] +__all__ = ["LANCreateResponse"] - -class LANNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnetNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnet(BaseModel): - next_hop: str - """A valid IPv4 address.""" - - prefix: str - """A valid CIDR notation representing an IP range.""" - - nat: Optional[LANRoutedSubnetNat] = None - - -class LANStaticAddressingDhcpRelay(BaseModel): - server_addresses: Optional[List[str]] = None - """List of DHCP server IPs.""" - - -class LANStaticAddressingDhcpServer(BaseModel): - dhcp_pool_end: Optional[str] = None - """A valid IPv4 address.""" - - dhcp_pool_start: Optional[str] = None - """A valid IPv4 address.""" - - dns_server: Optional[str] = None - """A valid IPv4 address.""" - - reservations: Optional[Dict[str, str]] = None - """Mapping of MAC addresses to IP addresses""" - - -class LANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - dhcp_relay: Optional[LANStaticAddressingDhcpRelay] = None - - dhcp_server: Optional[LANStaticAddressingDhcpServer] = None - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - virtual_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - ha_link: Optional[bool] = None - """mark true to use this LAN for HA probing. - - only works for site with HA turned on. only one LAN can be set as the ha_link. - """ - - nat: Optional[LANNat] = None - - physport: Optional[int] = None - - routed_subnets: Optional[List[LANRoutedSubnet]] = None - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[LANStaticAddressing] = None - """ - If the site is not configured in high availability mode, this configuration is - optional (if omitted, use DHCP). However, if in high availability mode, - static_address is required along with secondary and virtual address. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class LANCreateResponse(BaseModel): - lans: Optional[List[LAN]] = None +LANCreateResponse = List[LAN] diff --git a/src/cloudflare/types/magic_transit/sites/lan_delete_params.py b/src/cloudflare/types/magic_transit/sites/lan_delete_params.py new file mode 100644 index 00000000000..4e9d6b5c1e4 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/lan_delete_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__ = ["LANDeleteParams"] + + +class LANDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + site_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/magic_transit/sites/lan_delete_response.py b/src/cloudflare/types/magic_transit/sites/lan_delete_response.py deleted file mode 100644 index 30c31874a9a..00000000000 --- a/src/cloudflare/types/magic_transit/sites/lan_delete_response.py +++ /dev/null @@ -1,108 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional - -from ...._models import BaseModel - -__all__ = [ - "LANDeleteResponse", - "DeletedLAN", - "DeletedLANNat", - "DeletedLANRoutedSubnet", - "DeletedLANRoutedSubnetNat", - "DeletedLANStaticAddressing", - "DeletedLANStaticAddressingDhcpRelay", - "DeletedLANStaticAddressingDhcpServer", -] - - -class DeletedLANNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class DeletedLANRoutedSubnetNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class DeletedLANRoutedSubnet(BaseModel): - next_hop: str - """A valid IPv4 address.""" - - prefix: str - """A valid CIDR notation representing an IP range.""" - - nat: Optional[DeletedLANRoutedSubnetNat] = None - - -class DeletedLANStaticAddressingDhcpRelay(BaseModel): - server_addresses: Optional[List[str]] = None - """List of DHCP server IPs.""" - - -class DeletedLANStaticAddressingDhcpServer(BaseModel): - dhcp_pool_end: Optional[str] = None - """A valid IPv4 address.""" - - dhcp_pool_start: Optional[str] = None - """A valid IPv4 address.""" - - dns_server: Optional[str] = None - """A valid IPv4 address.""" - - reservations: Optional[Dict[str, str]] = None - """Mapping of MAC addresses to IP addresses""" - - -class DeletedLANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - dhcp_relay: Optional[DeletedLANStaticAddressingDhcpRelay] = None - - dhcp_server: Optional[DeletedLANStaticAddressingDhcpServer] = None - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - virtual_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class DeletedLAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - ha_link: Optional[bool] = None - """mark true to use this LAN for HA probing. - - only works for site with HA turned on. only one LAN can be set as the ha_link. - """ - - nat: Optional[DeletedLANNat] = None - - physport: Optional[int] = None - - routed_subnets: Optional[List[DeletedLANRoutedSubnet]] = None - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[DeletedLANStaticAddressing] = None - """ - If the site is not configured in high availability mode, this configuration is - optional (if omitted, use DHCP). However, if in high availability mode, - static_address is required along with secondary and virtual address. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class LANDeleteResponse(BaseModel): - deleted: Optional[bool] = None - - deleted_lan: Optional[DeletedLAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/lan_get_response.py b/src/cloudflare/types/magic_transit/sites/lan_get_response.py deleted file mode 100644 index 808252dd34d..00000000000 --- a/src/cloudflare/types/magic_transit/sites/lan_get_response.py +++ /dev/null @@ -1,106 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional - -from ...._models import BaseModel - -__all__ = [ - "LANGetResponse", - "LAN", - "LANNat", - "LANRoutedSubnet", - "LANRoutedSubnetNat", - "LANStaticAddressing", - "LANStaticAddressingDhcpRelay", - "LANStaticAddressingDhcpServer", -] - - -class LANNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnetNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnet(BaseModel): - next_hop: str - """A valid IPv4 address.""" - - prefix: str - """A valid CIDR notation representing an IP range.""" - - nat: Optional[LANRoutedSubnetNat] = None - - -class LANStaticAddressingDhcpRelay(BaseModel): - server_addresses: Optional[List[str]] = None - """List of DHCP server IPs.""" - - -class LANStaticAddressingDhcpServer(BaseModel): - dhcp_pool_end: Optional[str] = None - """A valid IPv4 address.""" - - dhcp_pool_start: Optional[str] = None - """A valid IPv4 address.""" - - dns_server: Optional[str] = None - """A valid IPv4 address.""" - - reservations: Optional[Dict[str, str]] = None - """Mapping of MAC addresses to IP addresses""" - - -class LANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - dhcp_relay: Optional[LANStaticAddressingDhcpRelay] = None - - dhcp_server: Optional[LANStaticAddressingDhcpServer] = None - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - virtual_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - ha_link: Optional[bool] = None - """mark true to use this LAN for HA probing. - - only works for site with HA turned on. only one LAN can be set as the ha_link. - """ - - nat: Optional[LANNat] = None - - physport: Optional[int] = None - - routed_subnets: Optional[List[LANRoutedSubnet]] = None - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[LANStaticAddressing] = None - """ - If the site is not configured in high availability mode, this configuration is - optional (if omitted, use DHCP). However, if in high availability mode, - static_address is required along with secondary and virtual address. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class LANGetResponse(BaseModel): - lan: Optional[LAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/lan_list_response.py b/src/cloudflare/types/magic_transit/sites/lan_list_response.py deleted file mode 100644 index fa043061f89..00000000000 --- a/src/cloudflare/types/magic_transit/sites/lan_list_response.py +++ /dev/null @@ -1,106 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional - -from ...._models import BaseModel - -__all__ = [ - "LANListResponse", - "LAN", - "LANNat", - "LANRoutedSubnet", - "LANRoutedSubnetNat", - "LANStaticAddressing", - "LANStaticAddressingDhcpRelay", - "LANStaticAddressingDhcpServer", -] - - -class LANNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnetNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnet(BaseModel): - next_hop: str - """A valid IPv4 address.""" - - prefix: str - """A valid CIDR notation representing an IP range.""" - - nat: Optional[LANRoutedSubnetNat] = None - - -class LANStaticAddressingDhcpRelay(BaseModel): - server_addresses: Optional[List[str]] = None - """List of DHCP server IPs.""" - - -class LANStaticAddressingDhcpServer(BaseModel): - dhcp_pool_end: Optional[str] = None - """A valid IPv4 address.""" - - dhcp_pool_start: Optional[str] = None - """A valid IPv4 address.""" - - dns_server: Optional[str] = None - """A valid IPv4 address.""" - - reservations: Optional[Dict[str, str]] = None - """Mapping of MAC addresses to IP addresses""" - - -class LANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - dhcp_relay: Optional[LANStaticAddressingDhcpRelay] = None - - dhcp_server: Optional[LANStaticAddressingDhcpServer] = None - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - virtual_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - ha_link: Optional[bool] = None - """mark true to use this LAN for HA probing. - - only works for site with HA turned on. only one LAN can be set as the ha_link. - """ - - nat: Optional[LANNat] = None - - physport: Optional[int] = None - - routed_subnets: Optional[List[LANRoutedSubnet]] = None - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[LANStaticAddressing] = None - """ - If the site is not configured in high availability mode, this configuration is - optional (if omitted, use DHCP). However, if in high availability mode, - static_address is required along with secondary and virtual address. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class LANListResponse(BaseModel): - lans: Optional[List[LAN]] = None diff --git a/src/cloudflare/types/magic_transit/sites/lan_static_addressing.py b/src/cloudflare/types/magic_transit/sites/lan_static_addressing.py new file mode 100644 index 00000000000..31801ab8533 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/lan_static_addressing.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel +from .dhcp_relay import DHCPRelay +from .dhcp_server import DHCPServer + +__all__ = ["LANStaticAddressing"] + + +class LANStaticAddressing(BaseModel): + address: str + """A valid CIDR notation representing an IP range.""" + + dhcp_relay: Optional[DHCPRelay] = None + + dhcp_server: Optional[DHCPServer] = None + + secondary_address: Optional[str] = None + """A valid CIDR notation representing an IP range.""" + + virtual_address: Optional[str] = None + """A valid CIDR notation representing an IP range.""" diff --git a/src/cloudflare/types/magic_transit/sites/lan_static_addressing_param.py b/src/cloudflare/types/magic_transit/sites/lan_static_addressing_param.py new file mode 100644 index 00000000000..779724c0fcb --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/lan_static_addressing_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .dhcp_relay_param import DHCPRelayParam +from .dhcp_server_param import DHCPServerParam + +__all__ = ["LANStaticAddressingParam"] + + +class LANStaticAddressingParam(TypedDict, total=False): + address: Required[str] + """A valid CIDR notation representing an IP range.""" + + dhcp_relay: DHCPRelayParam + + dhcp_server: DHCPServerParam + + secondary_address: str + """A valid CIDR notation representing an IP range.""" + + virtual_address: str + """A valid CIDR notation representing an IP range.""" diff --git a/src/cloudflare/types/magic_transit/sites/lan_update_params.py b/src/cloudflare/types/magic_transit/sites/lan_update_params.py index 115bd51ddf8..0dea4f2b81c 100644 --- a/src/cloudflare/types/magic_transit/sites/lan_update_params.py +++ b/src/cloudflare/types/magic_transit/sites/lan_update_params.py @@ -2,19 +2,14 @@ from __future__ import annotations -from typing import Dict, List, Iterable +from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = [ - "LANUpdateParams", - "LAN", - "LANNat", - "LANRoutedSubnet", - "LANRoutedSubnetNat", - "LANStaticAddressing", - "LANStaticAddressingDhcpRelay", - "LANStaticAddressingDhcpServer", -] +from .nat_param import NatParam +from .routed_subnet_param import RoutedSubnetParam +from .lan_static_addressing_param import LANStaticAddressingParam + +__all__ = ["LANUpdateParams"] class LANUpdateParams(TypedDict, total=False): @@ -24,73 +19,15 @@ class LANUpdateParams(TypedDict, total=False): site_id: Required[str] """Identifier""" - lan: LAN - - -class LANNat(TypedDict, total=False): - static_prefix: str - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnetNat(TypedDict, total=False): - static_prefix: str - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnet(TypedDict, total=False): - next_hop: Required[str] - """A valid IPv4 address.""" - - prefix: Required[str] - """A valid CIDR notation representing an IP range.""" - - nat: LANRoutedSubnetNat - - -class LANStaticAddressingDhcpRelay(TypedDict, total=False): - server_addresses: List[str] - """List of DHCP server IPs.""" - - -class LANStaticAddressingDhcpServer(TypedDict, total=False): - dhcp_pool_end: str - """A valid IPv4 address.""" - - dhcp_pool_start: str - """A valid IPv4 address.""" - - dns_server: str - """A valid IPv4 address.""" - - reservations: Dict[str, str] - """Mapping of MAC addresses to IP addresses""" - - -class LANStaticAddressing(TypedDict, total=False): - address: Required[str] - """A valid CIDR notation representing an IP range.""" - - dhcp_relay: LANStaticAddressingDhcpRelay - - dhcp_server: LANStaticAddressingDhcpServer - - secondary_address: str - """A valid CIDR notation representing an IP range.""" - - virtual_address: str - """A valid CIDR notation representing an IP range.""" - - -class LAN(TypedDict, total=False): - description: str + name: str - nat: LANNat + nat: NatParam physport: int - routed_subnets: Iterable[LANRoutedSubnet] + routed_subnets: Iterable[RoutedSubnetParam] - static_addressing: LANStaticAddressing + static_addressing: LANStaticAddressingParam """ If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, diff --git a/src/cloudflare/types/magic_transit/sites/lan_update_response.py b/src/cloudflare/types/magic_transit/sites/lan_update_response.py deleted file mode 100644 index 516f18d2b88..00000000000 --- a/src/cloudflare/types/magic_transit/sites/lan_update_response.py +++ /dev/null @@ -1,106 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional - -from ...._models import BaseModel - -__all__ = [ - "LANUpdateResponse", - "LAN", - "LANNat", - "LANRoutedSubnet", - "LANRoutedSubnetNat", - "LANStaticAddressing", - "LANStaticAddressingDhcpRelay", - "LANStaticAddressingDhcpServer", -] - - -class LANNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnetNat(BaseModel): - static_prefix: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LANRoutedSubnet(BaseModel): - next_hop: str - """A valid IPv4 address.""" - - prefix: str - """A valid CIDR notation representing an IP range.""" - - nat: Optional[LANRoutedSubnetNat] = None - - -class LANStaticAddressingDhcpRelay(BaseModel): - server_addresses: Optional[List[str]] = None - """List of DHCP server IPs.""" - - -class LANStaticAddressingDhcpServer(BaseModel): - dhcp_pool_end: Optional[str] = None - """A valid IPv4 address.""" - - dhcp_pool_start: Optional[str] = None - """A valid IPv4 address.""" - - dns_server: Optional[str] = None - """A valid IPv4 address.""" - - reservations: Optional[Dict[str, str]] = None - """Mapping of MAC addresses to IP addresses""" - - -class LANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - dhcp_relay: Optional[LANStaticAddressingDhcpRelay] = None - - dhcp_server: Optional[LANStaticAddressingDhcpServer] = None - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - virtual_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class LAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - ha_link: Optional[bool] = None - """mark true to use this LAN for HA probing. - - only works for site with HA turned on. only one LAN can be set as the ha_link. - """ - - nat: Optional[LANNat] = None - - physport: Optional[int] = None - - routed_subnets: Optional[List[LANRoutedSubnet]] = None - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[LANStaticAddressing] = None - """ - If the site is not configured in high availability mode, this configuration is - optional (if omitted, use DHCP). However, if in high availability mode, - static_address is required along with secondary and virtual address. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class LANUpdateResponse(BaseModel): - lan: Optional[LAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/nat.py b/src/cloudflare/types/magic_transit/sites/nat.py new file mode 100644 index 00000000000..740ebff9f75 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/nat.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__ = ["Nat"] + + +class Nat(BaseModel): + static_prefix: Optional[str] = None + """A valid CIDR notation representing an IP range.""" diff --git a/src/cloudflare/types/magic_transit/sites/nat_param.py b/src/cloudflare/types/magic_transit/sites/nat_param.py new file mode 100644 index 00000000000..91087923480 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/nat_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["NatParam"] + + +class NatParam(TypedDict, total=False): + static_prefix: str + """A valid CIDR notation representing an IP range.""" diff --git a/src/cloudflare/types/magic_transit/sites/routed_subnet.py b/src/cloudflare/types/magic_transit/sites/routed_subnet.py new file mode 100644 index 00000000000..65d73d05199 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/routed_subnet.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .nat import Nat +from ...._models import BaseModel + +__all__ = ["RoutedSubnet"] + + +class RoutedSubnet(BaseModel): + next_hop: str + """A valid IPv4 address.""" + + prefix: str + """A valid CIDR notation representing an IP range.""" + + nat: Optional[Nat] = None diff --git a/src/cloudflare/types/magic_transit/sites/routed_subnet_param.py b/src/cloudflare/types/magic_transit/sites/routed_subnet_param.py new file mode 100644 index 00000000000..b5c00117564 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/routed_subnet_param.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 + +from .nat_param import NatParam + +__all__ = ["RoutedSubnetParam"] + + +class RoutedSubnetParam(TypedDict, total=False): + next_hop: Required[str] + """A valid IPv4 address.""" + + prefix: Required[str] + """A valid CIDR notation representing an IP range.""" + + nat: NatParam diff --git a/src/cloudflare/types/magic_transit/sites/subnet.py b/src/cloudflare/types/magic_transit/sites/subnet.py new file mode 100644 index 00000000000..4644c7a7ea3 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/subnet.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +__all__ = ["Subnet"] + +Subnet = Union[str, str] diff --git a/src/cloudflare/types/magic_transit/sites/subnet_param.py b/src/cloudflare/types/magic_transit/sites/subnet_param.py new file mode 100644 index 00000000000..4e27c261a8b --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/subnet_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +__all__ = ["SubnetParam"] + +SubnetParam = Union[str, str] diff --git a/src/cloudflare/types/magic_transit/sites/wan.py b/src/cloudflare/types/magic_transit/sites/wan.py new file mode 100644 index 00000000000..1148e9f087f --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/wan.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel +from .wan_static_addressing import WANStaticAddressing + +__all__ = ["WAN"] + + +class WAN(BaseModel): + id: Optional[str] = None + """Identifier""" + + name: Optional[str] = None + + physport: Optional[int] = None + + priority: Optional[int] = None + """Priority of WAN for traffic loadbalancing.""" + + site_id: Optional[str] = None + """Identifier""" + + static_addressing: Optional[WANStaticAddressing] = None + """(optional) if omitted, use DHCP. + + Submit secondary_address when site is in high availability mode. + """ + + vlan_tag: Optional[int] = None + """VLAN port number.""" diff --git a/src/cloudflare/types/magic_transit/sites/wan_create_params.py b/src/cloudflare/types/magic_transit/sites/wan_create_params.py index c5da185af64..f8bcb240d5f 100644 --- a/src/cloudflare/types/magic_transit/sites/wan_create_params.py +++ b/src/cloudflare/types/magic_transit/sites/wan_create_params.py @@ -4,38 +4,25 @@ from typing_extensions import Required, TypedDict -__all__ = ["WANCreateParams", "WAN", "WANStaticAddressing"] +from .wan_static_addressing_param import WANStaticAddressingParam + +__all__ = ["WANCreateParams"] class WANCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - wan: WAN - - -class WANStaticAddressing(TypedDict, total=False): - address: Required[str] - """A valid CIDR notation representing an IP range.""" - - gateway_address: Required[str] - """A valid IPv4 address.""" - - secondary_address: str - """A valid CIDR notation representing an IP range.""" - - -class WAN(TypedDict, total=False): physport: Required[int] vlan_tag: Required[int] """VLAN port number.""" - description: str + name: str priority: int - static_addressing: WANStaticAddressing + static_addressing: WANStaticAddressingParam """(optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. diff --git a/src/cloudflare/types/magic_transit/sites/wan_create_response.py b/src/cloudflare/types/magic_transit/sites/wan_create_response.py index 926aad321d1..40806aa462e 100644 --- a/src/cloudflare/types/magic_transit/sites/wan_create_response.py +++ b/src/cloudflare/types/magic_transit/sites/wan_create_response.py @@ -1,46 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List -from ...._models import BaseModel +from .wan import WAN -__all__ = ["WANCreateResponse", "WAN", "WANStaticAddressing"] +__all__ = ["WANCreateResponse"] - -class WANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - gateway_address: str - """A valid IPv4 address.""" - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class WAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - physport: Optional[int] = None - - priority: Optional[int] = None - """Priority of WAN for traffic loadbalancing.""" - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[WANStaticAddressing] = None - """(optional) if omitted, use DHCP. - - Submit secondary_address when site is in high availability mode. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class WANCreateResponse(BaseModel): - wans: Optional[List[WAN]] = None +WANCreateResponse = List[WAN] diff --git a/src/cloudflare/types/magic_transit/sites/wan_delete_params.py b/src/cloudflare/types/magic_transit/sites/wan_delete_params.py new file mode 100644 index 00000000000..7e72aa27593 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/wan_delete_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__ = ["WANDeleteParams"] + + +class WANDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + site_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/magic_transit/sites/wan_delete_response.py b/src/cloudflare/types/magic_transit/sites/wan_delete_response.py deleted file mode 100644 index 09cecd3e64c..00000000000 --- a/src/cloudflare/types/magic_transit/sites/wan_delete_response.py +++ /dev/null @@ -1,48 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["WANDeleteResponse", "DeletedWAN", "DeletedWANStaticAddressing"] - - -class DeletedWANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - gateway_address: str - """A valid IPv4 address.""" - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class DeletedWAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - physport: Optional[int] = None - - priority: Optional[int] = None - """Priority of WAN for traffic loadbalancing.""" - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[DeletedWANStaticAddressing] = None - """(optional) if omitted, use DHCP. - - Submit secondary_address when site is in high availability mode. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class WANDeleteResponse(BaseModel): - deleted: Optional[bool] = None - - deleted_wan: Optional[DeletedWAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/wan_get_response.py b/src/cloudflare/types/magic_transit/sites/wan_get_response.py deleted file mode 100644 index a7910b039fb..00000000000 --- a/src/cloudflare/types/magic_transit/sites/wan_get_response.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["WANGetResponse", "WAN", "WANStaticAddressing"] - - -class WANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - gateway_address: str - """A valid IPv4 address.""" - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class WAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - physport: Optional[int] = None - - priority: Optional[int] = None - """Priority of WAN for traffic loadbalancing.""" - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[WANStaticAddressing] = None - """(optional) if omitted, use DHCP. - - Submit secondary_address when site is in high availability mode. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class WANGetResponse(BaseModel): - wan: Optional[WAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/wan_list_response.py b/src/cloudflare/types/magic_transit/sites/wan_list_response.py deleted file mode 100644 index 943c52cf24d..00000000000 --- a/src/cloudflare/types/magic_transit/sites/wan_list_response.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["WANListResponse", "WAN", "WANStaticAddressing"] - - -class WANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - gateway_address: str - """A valid IPv4 address.""" - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class WAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - physport: Optional[int] = None - - priority: Optional[int] = None - """Priority of WAN for traffic loadbalancing.""" - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[WANStaticAddressing] = None - """(optional) if omitted, use DHCP. - - Submit secondary_address when site is in high availability mode. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class WANListResponse(BaseModel): - wans: Optional[List[WAN]] = None diff --git a/src/cloudflare/types/magic_transit/sites/wan_static_addressing.py b/src/cloudflare/types/magic_transit/sites/wan_static_addressing.py new file mode 100644 index 00000000000..ffa5b4c1235 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/wan_static_addressing.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["WANStaticAddressing"] + + +class WANStaticAddressing(BaseModel): + address: str + """A valid CIDR notation representing an IP range.""" + + gateway_address: str + """A valid IPv4 address.""" + + secondary_address: Optional[str] = None + """A valid CIDR notation representing an IP range.""" diff --git a/src/cloudflare/types/magic_transit/sites/wan_static_addressing_param.py b/src/cloudflare/types/magic_transit/sites/wan_static_addressing_param.py new file mode 100644 index 00000000000..273de37cf61 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/wan_static_addressing_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["WANStaticAddressingParam"] + + +class WANStaticAddressingParam(TypedDict, total=False): + address: Required[str] + """A valid CIDR notation representing an IP range.""" + + gateway_address: Required[str] + """A valid IPv4 address.""" + + secondary_address: str + """A valid CIDR notation representing an IP range.""" diff --git a/src/cloudflare/types/magic_transit/sites/wan_update_params.py b/src/cloudflare/types/magic_transit/sites/wan_update_params.py index 9bf85565d65..6b1a92759d5 100644 --- a/src/cloudflare/types/magic_transit/sites/wan_update_params.py +++ b/src/cloudflare/types/magic_transit/sites/wan_update_params.py @@ -4,7 +4,9 @@ from typing_extensions import Required, TypedDict -__all__ = ["WANUpdateParams", "WAN", "WANStaticAddressing"] +from .wan_static_addressing_param import WANStaticAddressingParam + +__all__ = ["WANUpdateParams"] class WANUpdateParams(TypedDict, total=False): @@ -14,28 +16,13 @@ class WANUpdateParams(TypedDict, total=False): site_id: Required[str] """Identifier""" - wan: WAN - - -class WANStaticAddressing(TypedDict, total=False): - address: Required[str] - """A valid CIDR notation representing an IP range.""" - - gateway_address: Required[str] - """A valid IPv4 address.""" - - secondary_address: str - """A valid CIDR notation representing an IP range.""" - - -class WAN(TypedDict, total=False): - description: str + name: str physport: int priority: int - static_addressing: WANStaticAddressing + static_addressing: WANStaticAddressingParam """(optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. diff --git a/src/cloudflare/types/magic_transit/sites/wan_update_response.py b/src/cloudflare/types/magic_transit/sites/wan_update_response.py deleted file mode 100644 index 958bc745108..00000000000 --- a/src/cloudflare/types/magic_transit/sites/wan_update_response.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["WANUpdateResponse", "WAN", "WANStaticAddressing"] - - -class WANStaticAddressing(BaseModel): - address: str - """A valid CIDR notation representing an IP range.""" - - gateway_address: str - """A valid IPv4 address.""" - - secondary_address: Optional[str] = None - """A valid CIDR notation representing an IP range.""" - - -class WAN(BaseModel): - id: Optional[str] = None - """Identifier""" - - description: Optional[str] = None - - physport: Optional[int] = None - - priority: Optional[int] = None - """Priority of WAN for traffic loadbalancing.""" - - site_id: Optional[str] = None - """Identifier""" - - static_addressing: Optional[WANStaticAddressing] = None - """(optional) if omitted, use DHCP. - - Submit secondary_address when site is in high availability mode. - """ - - vlan_tag: Optional[int] = None - """VLAN port number.""" - - -class WANUpdateResponse(BaseModel): - wan: Optional[WAN] = None diff --git a/src/cloudflare/types/managed_header_edit_params.py b/src/cloudflare/types/managed_header_edit_params.py deleted file mode 100644 index ae6d8747bdd..00000000000 --- a/src/cloudflare/types/managed_header_edit_params.py +++ /dev/null @@ -1,33 +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 Required, TypedDict - -__all__ = ["ManagedHeaderEditParams", "ManagedRequestHeader", "ManagedResponseHeader"] - - -class ManagedHeaderEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - managed_request_headers: Required[Iterable[ManagedRequestHeader]] - - managed_response_headers: Required[Iterable[ManagedResponseHeader]] - - -class ManagedRequestHeader(TypedDict, total=False): - id: str - """Human-readable identifier of the Managed Transform.""" - - enabled: bool - """When true, the Managed Transform is enabled.""" - - -class ManagedResponseHeader(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/managed_header_list_response.py b/src/cloudflare/types/managed_header_list_response.py deleted file mode 100644 index 5db5cb8a28e..00000000000 --- a/src/cloudflare/types/managed_header_list_response.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .._models import BaseModel - -__all__ = ["ManagedHeaderListResponse", "ManagedRequestHeader", "ManagedResponseHeader"] - - -class ManagedRequestHeader(BaseModel): - id: Optional[str] = None - """Human-readable identifier of the Managed Transform.""" - - enabled: Optional[bool] = None - """When true, the Managed Transform is enabled.""" - - -class ManagedResponseHeader(BaseModel): - id: Optional[str] = None - """Human-readable identifier of the Managed Transform.""" - - enabled: Optional[bool] = None - """When true, the Managed Transform is enabled.""" - - -class ManagedHeaderListResponse(BaseModel): - managed_request_headers: Optional[List[ManagedRequestHeader]] = None - - managed_response_headers: Optional[List[ManagedResponseHeader]] = None diff --git a/src/cloudflare/types/managed_headers/__init__.py b/src/cloudflare/types/managed_headers/__init__.py new file mode 100644 index 00000000000..4398e317107 --- /dev/null +++ b/src/cloudflare/types/managed_headers/__init__.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .request_model import RequestModel as RequestModel +from .request_model_param import RequestModelParam as RequestModelParam +from .managed_header_edit_params import ManagedHeaderEditParams as ManagedHeaderEditParams +from .managed_header_edit_response import ManagedHeaderEditResponse as ManagedHeaderEditResponse +from .managed_header_list_response import ManagedHeaderListResponse as ManagedHeaderListResponse diff --git a/src/cloudflare/types/managed_headers/managed_header_edit_params.py b/src/cloudflare/types/managed_headers/managed_header_edit_params.py new file mode 100644 index 00000000000..a9bf71d9c3c --- /dev/null +++ b/src/cloudflare/types/managed_headers/managed_header_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 import Iterable +from typing_extensions import Required, TypedDict + +from .request_model_param import RequestModelParam + +__all__ = ["ManagedHeaderEditParams"] + + +class ManagedHeaderEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + managed_request_headers: Required[Iterable[RequestModelParam]] + + managed_response_headers: Required[Iterable[RequestModelParam]] diff --git a/src/cloudflare/types/managed_header_edit_response.py b/src/cloudflare/types/managed_headers/managed_header_edit_response.py similarity index 97% rename from src/cloudflare/types/managed_header_edit_response.py rename to src/cloudflare/types/managed_headers/managed_header_edit_response.py index 451174ad3d2..d1b0f60e8a5 100644 --- a/src/cloudflare/types/managed_header_edit_response.py +++ b/src/cloudflare/types/managed_headers/managed_header_edit_response.py @@ -2,7 +2,7 @@ from typing import List, Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["ManagedHeaderEditResponse", "ManagedRequestHeader", "ManagedResponseHeader"] diff --git a/src/cloudflare/types/managed_headers/managed_header_list_response.py b/src/cloudflare/types/managed_headers/managed_header_list_response.py new file mode 100644 index 00000000000..c155ecb594f --- /dev/null +++ b/src/cloudflare/types/managed_headers/managed_header_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 ..._models import BaseModel +from .request_model import RequestModel + +__all__ = ["ManagedHeaderListResponse"] + + +class ManagedHeaderListResponse(BaseModel): + managed_request_headers: Optional[List[RequestModel]] = None + + managed_response_headers: Optional[List[RequestModel]] = None diff --git a/src/cloudflare/types/managed_headers/request_model.py b/src/cloudflare/types/managed_headers/request_model.py new file mode 100644 index 00000000000..281db0613d3 --- /dev/null +++ b/src/cloudflare/types/managed_headers/request_model.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__ = ["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_headers/request_model_param.py b/src/cloudflare/types/managed_headers/request_model_param.py new file mode 100644 index 00000000000..d207b5bf111 --- /dev/null +++ b/src/cloudflare/types/managed_headers/request_model_param.py @@ -0,0 +1,15 @@ +# 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/membership.py b/src/cloudflare/types/membership.py deleted file mode 100644 index 6f5957af979..00000000000 --- a/src/cloudflare/types/membership.py +++ /dev/null @@ -1,148 +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 .account import Account -from .._models import BaseModel - -__all__ = [ - "Membership", - "Permissions", - "PermissionsAnalytics", - "PermissionsBilling", - "PermissionsCachePurge", - "PermissionsDNS", - "PermissionsDNSRecords", - "PermissionsLb", - "PermissionsLogs", - "PermissionsOrganization", - "PermissionsSSL", - "PermissionsWAF", - "PermissionsZoneSettings", - "PermissionsZones", -] - - -class PermissionsAnalytics(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsBilling(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsCachePurge(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsDNS(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsDNSRecords(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsLb(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsLogs(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsOrganization(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsSSL(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsWAF(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsZoneSettings(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class PermissionsZones(BaseModel): - read: Optional[bool] = None - - write: Optional[bool] = None - - -class Permissions(BaseModel): - analytics: Optional[PermissionsAnalytics] = None - - billing: Optional[PermissionsBilling] = None - - cache_purge: Optional[PermissionsCachePurge] = None - - dns: Optional[PermissionsDNS] = None - - dns_records: Optional[PermissionsDNSRecords] = None - - lb: Optional[PermissionsLb] = None - - logs: Optional[PermissionsLogs] = None - - organization: Optional[PermissionsOrganization] = None - - ssl: Optional[PermissionsSSL] = None - - waf: Optional[PermissionsWAF] = None - - zone_settings: Optional[PermissionsZoneSettings] = None - - zones: Optional[PermissionsZones] = None - - -class Membership(BaseModel): - id: Optional[str] = None - """Membership identifier tag.""" - - account: Optional[Account] = None - - api_access_enabled: Optional[bool] = None - """Enterprise only. - - Indicates whether or not API access is enabled specifically for this user on a - given account. - """ - - code: Optional[str] = None - """The unique activation code for the account membership.""" - - permissions: Optional[Permissions] = None - """All access permissions for the user at the account.""" - - roles: Optional[List[str]] = None - """List of role names for the user at the account.""" - - status: Optional[Literal["accepted", "pending", "rejected"]] = None - """Status of this membership.""" diff --git a/src/cloudflare/types/memberships/__init__.py b/src/cloudflare/types/memberships/__init__.py new file mode 100644 index 00000000000..995d1aee7dd --- /dev/null +++ b/src/cloudflare/types/memberships/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .membership import Membership as Membership +from .membership_list_params import MembershipListParams as MembershipListParams +from .membership_get_response import MembershipGetResponse as MembershipGetResponse +from .membership_delete_params import MembershipDeleteParams as MembershipDeleteParams +from .membership_update_params import MembershipUpdateParams as MembershipUpdateParams +from .membership_delete_response import MembershipDeleteResponse as MembershipDeleteResponse +from .membership_update_response import MembershipUpdateResponse as MembershipUpdateResponse diff --git a/src/cloudflare/types/memberships/membership.py b/src/cloudflare/types/memberships/membership.py new file mode 100644 index 00000000000..a820bdcb233 --- /dev/null +++ b/src/cloudflare/types/memberships/membership.py @@ -0,0 +1,62 @@ +# 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 +from ..accounts.account import Account +from ..shared.permission_grant import PermissionGrant + +__all__ = ["Membership", "Permissions"] + + +class Permissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class Membership(BaseModel): + id: Optional[str] = None + """Membership identifier tag.""" + + account: Optional[Account] = None + + api_access_enabled: Optional[bool] = None + """Enterprise only. + + Indicates whether or not API access is enabled specifically for this user on a + given account. + """ + + code: Optional[str] = None + """The unique activation code for the account membership.""" + + permissions: Optional[Permissions] = None + """All access permissions for the user at the account.""" + + roles: Optional[List[str]] = None + """List of role names for the user at the account.""" + + status: Optional[Literal["accepted", "pending", "rejected"]] = None + """Status of this membership.""" diff --git a/src/cloudflare/types/memberships/membership_delete_params.py b/src/cloudflare/types/memberships/membership_delete_params.py new file mode 100644 index 00000000000..11cdd19dc14 --- /dev/null +++ b/src/cloudflare/types/memberships/membership_delete_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["MembershipDeleteParams"] + + +class MembershipDeleteParams(TypedDict, total=False): + body: Required[object] diff --git a/src/cloudflare/types/membership_delete_response.py b/src/cloudflare/types/memberships/membership_delete_response.py similarity index 89% rename from src/cloudflare/types/membership_delete_response.py rename to src/cloudflare/types/memberships/membership_delete_response.py index 9b050610501..8d11b2170ff 100644 --- a/src/cloudflare/types/membership_delete_response.py +++ b/src/cloudflare/types/memberships/membership_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["MembershipDeleteResponse"] diff --git a/src/cloudflare/types/membership_get_response.py b/src/cloudflare/types/memberships/membership_get_response.py similarity index 100% rename from src/cloudflare/types/membership_get_response.py rename to src/cloudflare/types/memberships/membership_get_response.py diff --git a/src/cloudflare/types/membership_list_params.py b/src/cloudflare/types/memberships/membership_list_params.py similarity index 100% rename from src/cloudflare/types/membership_list_params.py rename to src/cloudflare/types/memberships/membership_list_params.py diff --git a/src/cloudflare/types/membership_update_params.py b/src/cloudflare/types/memberships/membership_update_params.py similarity index 100% rename from src/cloudflare/types/membership_update_params.py rename to src/cloudflare/types/memberships/membership_update_params.py diff --git a/src/cloudflare/types/membership_update_response.py b/src/cloudflare/types/memberships/membership_update_response.py similarity index 100% rename from src/cloudflare/types/membership_update_response.py rename to src/cloudflare/types/memberships/membership_update_response.py diff --git a/src/cloudflare/types/mtls_certificate_update.py b/src/cloudflare/types/mtls_certificate_update.py deleted file mode 100644 index 47561988572..00000000000 --- a/src/cloudflare/types/mtls_certificate_update.py +++ /dev/null @@ -1,40 +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__ = ["MTLSCertificateUpdate"] - - -class MTLSCertificateUpdate(BaseModel): - id: Optional[str] = None - """Identifier""" - - ca: Optional[bool] = None - """Indicates whether the certificate is a CA or leaf certificate.""" - - certificates: Optional[str] = None - """The uploaded root CA certificate.""" - - expires_on: Optional[datetime] = None - """When the certificate expires.""" - - issuer: Optional[str] = None - """The certificate authority that issued the certificate.""" - - name: Optional[str] = None - """Optional unique name for the certificate. Only used for human readability.""" - - serial_number: Optional[str] = None - """The certificate serial number.""" - - signature: Optional[str] = None - """The type of hash used for the certificate.""" - - updated_at: Optional[datetime] = None - """This is the time the certificate was updated.""" - - uploaded_on: Optional[datetime] = None - """This is the time the certificate was uploaded.""" diff --git a/src/cloudflare/types/mtls_certificates/__init__.py b/src/cloudflare/types/mtls_certificates/__init__.py index 7ccb696e0db..b359b0145f6 100644 --- a/src/cloudflare/types/mtls_certificates/__init__.py +++ b/src/cloudflare/types/mtls_certificates/__init__.py @@ -2,5 +2,9 @@ from __future__ import annotations +from .mtls_certificate import MTLSCertificate as MTLSCertificate from .association_get_response import AssociationGetResponse as AssociationGetResponse -from .mtls_certificate_asssociation import MTLSCertificateAsssociation as MTLSCertificateAsssociation +from .certificate_asssociation import CertificateAsssociation as CertificateAsssociation +from .mtls_certificate_create_params import MTLSCertificateCreateParams as MTLSCertificateCreateParams +from .mtls_certificate_delete_params import MTLSCertificateDeleteParams as MTLSCertificateDeleteParams +from .mtls_certificate_create_response import MTLSCertificateCreateResponse as MTLSCertificateCreateResponse diff --git a/src/cloudflare/types/mtls_certificates/association_get_response.py b/src/cloudflare/types/mtls_certificates/association_get_response.py index c2b31a396fe..6775dff66cb 100644 --- a/src/cloudflare/types/mtls_certificates/association_get_response.py +++ b/src/cloudflare/types/mtls_certificates/association_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .mtls_certificate_asssociation import MTLSCertificateAsssociation +from .certificate_asssociation import CertificateAsssociation __all__ = ["AssociationGetResponse"] -AssociationGetResponse = List[MTLSCertificateAsssociation] +AssociationGetResponse = List[CertificateAsssociation] diff --git a/src/cloudflare/types/mtls_certificates/certificate_asssociation.py b/src/cloudflare/types/mtls_certificates/certificate_asssociation.py new file mode 100644 index 00000000000..e3c5c30a5dc --- /dev/null +++ b/src/cloudflare/types/mtls_certificates/certificate_asssociation.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__ = ["CertificateAsssociation"] + + +class CertificateAsssociation(BaseModel): + service: Optional[str] = None + """The service using the certificate.""" + + status: Optional[str] = None + """Certificate deployment status for the given service.""" diff --git a/src/cloudflare/types/mtls_certificate.py b/src/cloudflare/types/mtls_certificates/mtls_certificate.py similarity index 96% rename from src/cloudflare/types/mtls_certificate.py rename to src/cloudflare/types/mtls_certificates/mtls_certificate.py index c710efe811b..4b7a1e5f350 100644 --- a/src/cloudflare/types/mtls_certificate.py +++ b/src/cloudflare/types/mtls_certificates/mtls_certificate.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["MTLSCertificate"] diff --git a/src/cloudflare/types/mtls_certificates/mtls_certificate_asssociation.py b/src/cloudflare/types/mtls_certificates/mtls_certificate_asssociation.py deleted file mode 100644 index 80f6c8444a8..00000000000 --- a/src/cloudflare/types/mtls_certificates/mtls_certificate_asssociation.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__ = ["MTLSCertificateAsssociation"] - - -class MTLSCertificateAsssociation(BaseModel): - service: Optional[str] = None - """The service using the certificate.""" - - status: Optional[str] = None - """Certificate deployment status for the given service.""" diff --git a/src/cloudflare/types/mtls_certificate_create_params.py b/src/cloudflare/types/mtls_certificates/mtls_certificate_create_params.py similarity index 100% rename from src/cloudflare/types/mtls_certificate_create_params.py rename to src/cloudflare/types/mtls_certificates/mtls_certificate_create_params.py diff --git a/src/cloudflare/types/mtls_certificates/mtls_certificate_create_response.py b/src/cloudflare/types/mtls_certificates/mtls_certificate_create_response.py new file mode 100644 index 00000000000..4d1bd959fa6 --- /dev/null +++ b/src/cloudflare/types/mtls_certificates/mtls_certificate_create_response.py @@ -0,0 +1,40 @@ +# 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__ = ["MTLSCertificateCreateResponse"] + + +class MTLSCertificateCreateResponse(BaseModel): + id: Optional[str] = None + """Identifier""" + + ca: Optional[bool] = None + """Indicates whether the certificate is a CA or leaf certificate.""" + + certificates: Optional[str] = None + """The uploaded root CA certificate.""" + + expires_on: Optional[datetime] = None + """When the certificate expires.""" + + issuer: Optional[str] = None + """The certificate authority that issued the certificate.""" + + name: Optional[str] = None + """Optional unique name for the certificate. Only used for human readability.""" + + serial_number: Optional[str] = None + """The certificate serial number.""" + + signature: Optional[str] = None + """The type of hash used for the certificate.""" + + updated_at: Optional[datetime] = None + """This is the time the certificate was updated.""" + + uploaded_on: Optional[datetime] = None + """This is the time the certificate was uploaded.""" diff --git a/src/cloudflare/types/mtls_certificates/mtls_certificate_delete_params.py b/src/cloudflare/types/mtls_certificates/mtls_certificate_delete_params.py new file mode 100644 index 00000000000..78ad213cdfd --- /dev/null +++ b/src/cloudflare/types/mtls_certificates/mtls_certificate_delete_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__ = ["MTLSCertificateDeleteParams"] + + +class MTLSCertificateDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/observatory_schedule.py b/src/cloudflare/types/observatory_schedule.py deleted file mode 100644 index cfd5118c6aa..00000000000 --- a/src/cloudflare/types/observatory_schedule.py +++ /dev/null @@ -1,43 +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__ = ["ObservatorySchedule"] - - -class ObservatorySchedule(BaseModel): - frequency: Optional[Literal["DAILY", "WEEKLY"]] = None - """The frequency of the test.""" - - region: Optional[ - Literal[ - "asia-east1", - "asia-northeast1", - "asia-northeast2", - "asia-south1", - "asia-southeast1", - "australia-southeast1", - "europe-north1", - "europe-southwest1", - "europe-west1", - "europe-west2", - "europe-west3", - "europe-west4", - "europe-west8", - "europe-west9", - "me-west1", - "southamerica-east1", - "us-central1", - "us-east1", - "us-east4", - "us-south1", - "us-west1", - ] - ] = None - """A test region.""" - - url: Optional[str] = None - """A URL.""" diff --git a/src/cloudflare/types/observatory_trend.py b/src/cloudflare/types/observatory_trend.py deleted file mode 100644 index f8a7b2590bf..00000000000 --- a/src/cloudflare/types/observatory_trend.py +++ /dev/null @@ -1,35 +0,0 @@ -# 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__ = ["ObservatoryTrend"] - - -class ObservatoryTrend(BaseModel): - cls: Optional[List[Optional[float]]] = None - """Cumulative Layout Shift trend.""" - - fcp: Optional[List[Optional[float]]] = None - """First Contentful Paint trend.""" - - lcp: Optional[List[Optional[float]]] = None - """Largest Contentful Paint trend.""" - - performance_score: Optional[List[Optional[float]]] = FieldInfo(alias="performanceScore", default=None) - """The Lighthouse score trend.""" - - si: Optional[List[Optional[float]]] = None - """Speed Index trend.""" - - tbt: Optional[List[Optional[float]]] = None - """Total Blocking Time trend.""" - - ttfb: Optional[List[Optional[float]]] = None - """Time To First Byte trend.""" - - tti: Optional[List[Optional[float]]] = None - """Time To Interactive trend.""" diff --git a/src/cloudflare/types/origin_ca_certificate_create_response.py b/src/cloudflare/types/origin_ca_certificate_create_response.py deleted file mode 100644 index 5d75233e4f8..00000000000 --- a/src/cloudflare/types/origin_ca_certificate_create_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["OriginCACertificateCreateResponse"] - -OriginCACertificateCreateResponse = Union[str, object] diff --git a/src/cloudflare/types/origin_ca_certificate_get_response.py b/src/cloudflare/types/origin_ca_certificate_get_response.py deleted file mode 100644 index 58f66074e7b..00000000000 --- a/src/cloudflare/types/origin_ca_certificate_get_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["OriginCACertificateGetResponse"] - -OriginCACertificateGetResponse = Union[str, object] diff --git a/src/cloudflare/types/origin_ca_certificates/__init__.py b/src/cloudflare/types/origin_ca_certificates/__init__.py new file mode 100644 index 00000000000..32cf6287ee3 --- /dev/null +++ b/src/cloudflare/types/origin_ca_certificates/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .origin_ca_certificate import OriginCACertificate as OriginCACertificate +from .origin_ca_certificate_list_params import OriginCACertificateListParams as OriginCACertificateListParams +from .origin_ca_certificate_get_response import OriginCACertificateGetResponse as OriginCACertificateGetResponse +from .origin_ca_certificate_create_params import OriginCACertificateCreateParams as OriginCACertificateCreateParams +from .origin_ca_certificate_delete_params import OriginCACertificateDeleteParams as OriginCACertificateDeleteParams +from .origin_ca_certificate_create_response import ( + OriginCACertificateCreateResponse as OriginCACertificateCreateResponse, +) +from .origin_ca_certificate_delete_response import ( + OriginCACertificateDeleteResponse as OriginCACertificateDeleteResponse, +) diff --git a/src/cloudflare/types/origin_ca_certificate.py b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate.py similarity index 97% rename from src/cloudflare/types/origin_ca_certificate.py rename to src/cloudflare/types/origin_ca_certificates/origin_ca_certificate.py index ab907dbf02b..ad5a77af9d4 100644 --- a/src/cloudflare/types/origin_ca_certificate.py +++ b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["OriginCACertificate"] diff --git a/src/cloudflare/types/origin_ca_certificate_create_params.py b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_create_params.py similarity index 100% rename from src/cloudflare/types/origin_ca_certificate_create_params.py rename to src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_create_params.py diff --git a/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_create_response.py b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_create_response.py new file mode 100644 index 00000000000..dfa04eb256f --- /dev/null +++ b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_create_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["OriginCACertificateCreateResponse"] + +OriginCACertificateCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_delete_params.py b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_delete_params.py new file mode 100644 index 00000000000..c7e9bfc0425 --- /dev/null +++ b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_delete_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["OriginCACertificateDeleteParams"] + + +class OriginCACertificateDeleteParams(TypedDict, total=False): + body: Required[object] diff --git a/src/cloudflare/types/origin_ca_certificate_delete_response.py b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_delete_response.py similarity index 89% rename from src/cloudflare/types/origin_ca_certificate_delete_response.py rename to src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_delete_response.py index ac83d7b288e..0077aa46b31 100644 --- a/src/cloudflare/types/origin_ca_certificate_delete_response.py +++ b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["OriginCACertificateDeleteResponse"] diff --git a/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_get_response.py b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_get_response.py new file mode 100644 index 00000000000..7b2a5a6f147 --- /dev/null +++ b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["OriginCACertificateGetResponse"] + +OriginCACertificateGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_list_params.py b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_list_params.py new file mode 100644 index 00000000000..7efecba1814 --- /dev/null +++ b/src/cloudflare/types/origin_ca_certificates/origin_ca_certificate_list_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["OriginCACertificateListParams"] + + +class OriginCACertificateListParams(TypedDict, total=False): + identifier: str + """Identifier""" diff --git a/src/cloudflare/types/origin_post_quantum_encryption/__init__.py b/src/cloudflare/types/origin_post_quantum_encryption/__init__.py new file mode 100644 index 00000000000..31525d2b891 --- /dev/null +++ b/src/cloudflare/types/origin_post_quantum_encryption/__init__.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .origin_post_quantum_encryption_get_response import ( + OriginPostQuantumEncryptionGetResponse as OriginPostQuantumEncryptionGetResponse, +) +from .origin_post_quantum_encryption_update_params import ( + OriginPostQuantumEncryptionUpdateParams as OriginPostQuantumEncryptionUpdateParams, +) +from .origin_post_quantum_encryption_update_response import ( + OriginPostQuantumEncryptionUpdateResponse as OriginPostQuantumEncryptionUpdateResponse, +) diff --git a/src/cloudflare/types/origin_post_quantum_encryption_get_response.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py similarity index 100% rename from src/cloudflare/types/origin_post_quantum_encryption_get_response.py rename to src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py diff --git a/src/cloudflare/types/origin_post_quantum_encryption_update_params.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_params.py similarity index 100% rename from src/cloudflare/types/origin_post_quantum_encryption_update_params.py rename to src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_params.py diff --git a/src/cloudflare/types/origin_post_quantum_encryption_update_response.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py similarity index 100% rename from src/cloudflare/types/origin_post_quantum_encryption_update_response.py rename to src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py diff --git a/src/cloudflare/types/origin_tls_client_auth/__init__.py b/src/cloudflare/types/origin_tls_client_auth/__init__.py index 18468c84971..eba7c27e23a 100644 --- a/src/cloudflare/types/origin_tls_client_auth/__init__.py +++ b/src/cloudflare/types/origin_tls_client_auth/__init__.py @@ -7,4 +7,14 @@ from .hostname_update_params import HostnameUpdateParams as HostnameUpdateParams from .setting_update_response import SettingUpdateResponse as SettingUpdateResponse from .hostname_update_response import HostnameUpdateResponse as HostnameUpdateResponse -from .origin_tls_client_certificate_id import OriginTLSClientCertificateID as OriginTLSClientCertificateID +from .authenticated_origin_pull import AuthenticatedOriginPull as AuthenticatedOriginPull +from .zone_authenticated_origin_pull import ZoneAuthenticatedOriginPull as ZoneAuthenticatedOriginPull +from .origin_tls_client_auth_get_response import OriginTLSClientAuthGetResponse as OriginTLSClientAuthGetResponse +from .origin_tls_client_auth_create_params import OriginTLSClientAuthCreateParams as OriginTLSClientAuthCreateParams +from .origin_tls_client_auth_delete_params import OriginTLSClientAuthDeleteParams as OriginTLSClientAuthDeleteParams +from .origin_tls_client_auth_create_response import ( + OriginTLSClientAuthCreateResponse as OriginTLSClientAuthCreateResponse, +) +from .origin_tls_client_auth_delete_response import ( + OriginTLSClientAuthDeleteResponse as OriginTLSClientAuthDeleteResponse, +) diff --git a/src/cloudflare/types/origin_tls_client_auth/authenticated_origin_pull.py b/src/cloudflare/types/origin_tls_client_auth/authenticated_origin_pull.py new file mode 100644 index 00000000000..4f996546dc2 --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/authenticated_origin_pull.py @@ -0,0 +1,79 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AuthenticatedOriginPull"] + + +class AuthenticatedOriginPull(BaseModel): + cert_id: Optional[str] = None + """Identifier""" + + cert_status: Optional[ + Literal[ + "initializing", + "pending_deployment", + "pending_deletion", + "active", + "deleted", + "deployment_timed_out", + "deletion_timed_out", + ] + ] = None + """Status of the certificate or the association.""" + + cert_updated_at: Optional[datetime] = None + """The time when the certificate was updated.""" + + cert_uploaded_on: Optional[datetime] = None + """The time when the certificate was uploaded.""" + + certificate: Optional[str] = None + """The hostname certificate.""" + + created_at: Optional[datetime] = None + """The time when the certificate was created.""" + + enabled: Optional[bool] = None + """Indicates whether hostname-level authenticated origin pulls is enabled. + + A null value voids the association. + """ + + expires_on: Optional[datetime] = None + """The date when the certificate expires.""" + + hostname: Optional[str] = None + """ + The hostname on the origin for which the client certificate uploaded will be + used. + """ + + issuer: Optional[str] = None + """The certificate authority that issued the certificate.""" + + serial_number: Optional[str] = None + """The serial number on the uploaded certificate.""" + + signature: Optional[str] = None + """The type of hash used for the certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_deployment", + "pending_deletion", + "active", + "deleted", + "deployment_timed_out", + "deletion_timed_out", + ] + ] = None + """Status of the certificate or the association.""" + + updated_at: Optional[datetime] = None + """The time when the certificate was updated.""" diff --git a/src/cloudflare/types/origin_tls_client_auth/hostname_update_response.py b/src/cloudflare/types/origin_tls_client_auth/hostname_update_response.py index f2bcb7c8e29..912106c9ff3 100644 --- a/src/cloudflare/types/origin_tls_client_auth/hostname_update_response.py +++ b/src/cloudflare/types/origin_tls_client_auth/hostname_update_response.py @@ -2,8 +2,8 @@ from typing import List -from .origin_tls_client_certificate_id import OriginTLSClientCertificateID +from .authenticated_origin_pull import AuthenticatedOriginPull __all__ = ["HostnameUpdateResponse"] -HostnameUpdateResponse = List[OriginTLSClientCertificateID] +HostnameUpdateResponse = List[AuthenticatedOriginPull] diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/__init__.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/__init__.py index 4db93e9c1fe..e8930167334 100644 --- a/src/cloudflare/types/origin_tls_client_auth/hostnames/__init__.py +++ b/src/cloudflare/types/origin_tls_client_auth/hostnames/__init__.py @@ -2,5 +2,9 @@ from __future__ import annotations +from .certificate import Certificate as Certificate +from .certificate_get_response import CertificateGetResponse as CertificateGetResponse from .certificate_create_params import CertificateCreateParams as CertificateCreateParams -from .origin_tls_client_certificate import OriginTLSClientCertificate as OriginTLSClientCertificate +from .certificate_delete_params import CertificateDeleteParams as CertificateDeleteParams +from .certificate_create_response import CertificateCreateResponse as CertificateCreateResponse +from .certificate_delete_response import CertificateDeleteResponse as CertificateDeleteResponse diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate.py new file mode 100644 index 00000000000..0886c50caba --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Certificate"] + + +class Certificate(BaseModel): + id: Optional[str] = None + """Identifier""" + + certificate: Optional[str] = None + """The hostname certificate.""" + + expires_on: Optional[datetime] = None + """The date when the certificate expires.""" + + issuer: Optional[str] = None + """The certificate authority that issued the certificate.""" + + serial_number: Optional[str] = None + """The serial number on the uploaded certificate.""" + + signature: Optional[str] = None + """The type of hash used for the certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_deployment", + "pending_deletion", + "active", + "deleted", + "deployment_timed_out", + "deletion_timed_out", + ] + ] = None + """Status of the certificate or the association.""" + + uploaded_on: Optional[datetime] = None + """The time when the certificate was uploaded.""" diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_create_response.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_create_response.py new file mode 100644 index 00000000000..a841654f3c3 --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_create_response.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["CertificateCreateResponse"] + + +class CertificateCreateResponse(BaseModel): + id: Optional[str] = None + """Identifier""" + + certificate: Optional[str] = None + """The hostname certificate.""" + + expires_on: Optional[datetime] = None + """The date when the certificate expires.""" + + issuer: Optional[str] = None + """The certificate authority that issued the certificate.""" + + serial_number: Optional[str] = None + """The serial number on the uploaded certificate.""" + + signature: Optional[str] = None + """The type of hash used for the certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_deployment", + "pending_deletion", + "active", + "deleted", + "deployment_timed_out", + "deletion_timed_out", + ] + ] = None + """Status of the certificate or the association.""" + + uploaded_on: Optional[datetime] = None + """The time when the certificate was uploaded.""" diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_delete_params.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_delete_params.py new file mode 100644 index 00000000000..7d7163aa220 --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_delete_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__ = ["CertificateDeleteParams"] + + +class CertificateDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_delete_response.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_delete_response.py new file mode 100644 index 00000000000..2cd196b82e6 --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_delete_response.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["CertificateDeleteResponse"] + + +class CertificateDeleteResponse(BaseModel): + id: Optional[str] = None + """Identifier""" + + certificate: Optional[str] = None + """The hostname certificate.""" + + expires_on: Optional[datetime] = None + """The date when the certificate expires.""" + + issuer: Optional[str] = None + """The certificate authority that issued the certificate.""" + + serial_number: Optional[str] = None + """The serial number on the uploaded certificate.""" + + signature: Optional[str] = None + """The type of hash used for the certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_deployment", + "pending_deletion", + "active", + "deleted", + "deployment_timed_out", + "deletion_timed_out", + ] + ] = None + """Status of the certificate or the association.""" + + uploaded_on: Optional[datetime] = None + """The time when the certificate was uploaded.""" diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_get_response.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_get_response.py new file mode 100644 index 00000000000..3f5da2edf1f --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_get_response.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["CertificateGetResponse"] + + +class CertificateGetResponse(BaseModel): + id: Optional[str] = None + """Identifier""" + + certificate: Optional[str] = None + """The hostname certificate.""" + + expires_on: Optional[datetime] = None + """The date when the certificate expires.""" + + issuer: Optional[str] = None + """The certificate authority that issued the certificate.""" + + serial_number: Optional[str] = None + """The serial number on the uploaded certificate.""" + + signature: Optional[str] = None + """The type of hash used for the certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_deployment", + "pending_deletion", + "active", + "deleted", + "deployment_timed_out", + "deletion_timed_out", + ] + ] = None + """Status of the certificate or the association.""" + + uploaded_on: Optional[datetime] = None + """The time when the certificate was uploaded.""" diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/origin_tls_client_certificate.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/origin_tls_client_certificate.py deleted file mode 100644 index da2f2cdabd2..00000000000 --- a/src/cloudflare/types/origin_tls_client_auth/hostnames/origin_tls_client_certificate.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["OriginTLSClientCertificate"] - - -class OriginTLSClientCertificate(BaseModel): - id: Optional[str] = None - """Identifier""" - - certificate: Optional[str] = None - """The hostname certificate.""" - - expires_on: Optional[datetime] = None - """The date when the certificate expires.""" - - issuer: Optional[str] = None - """The certificate authority that issued the certificate.""" - - serial_number: Optional[str] = None - """The serial number on the uploaded certificate.""" - - signature: Optional[str] = None - """The type of hash used for the certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_deployment", - "pending_deletion", - "active", - "deleted", - "deployment_timed_out", - "deletion_timed_out", - ] - ] = None - """Status of the certificate or the association.""" - - uploaded_on: Optional[datetime] = None - """The time when the certificate was uploaded.""" diff --git a/src/cloudflare/types/origin_tls_client_auth_create_params.py b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_create_params.py similarity index 100% rename from src/cloudflare/types/origin_tls_client_auth_create_params.py rename to src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_create_params.py diff --git a/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_create_response.py b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_create_response.py new file mode 100644 index 00000000000..8342a97f7eb --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_create_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["OriginTLSClientAuthCreateResponse"] + +OriginTLSClientAuthCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_delete_params.py b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_delete_params.py new file mode 100644 index 00000000000..6e0ad357ff5 --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_delete_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__ = ["OriginTLSClientAuthDeleteParams"] + + +class OriginTLSClientAuthDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_delete_response.py b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_delete_response.py new file mode 100644 index 00000000000..930afb0c8f4 --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_delete_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["OriginTLSClientAuthDeleteResponse"] + +OriginTLSClientAuthDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_get_response.py b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_get_response.py new file mode 100644 index 00000000000..d75e3ab651d --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_auth_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["OriginTLSClientAuthGetResponse"] + +OriginTLSClientAuthGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_certificate_id.py b/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_certificate_id.py deleted file mode 100644 index 192cccdcc2c..00000000000 --- a/src/cloudflare/types/origin_tls_client_auth/origin_tls_client_certificate_id.py +++ /dev/null @@ -1,79 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["OriginTLSClientCertificateID"] - - -class OriginTLSClientCertificateID(BaseModel): - cert_id: Optional[str] = None - """Identifier""" - - cert_status: Optional[ - Literal[ - "initializing", - "pending_deployment", - "pending_deletion", - "active", - "deleted", - "deployment_timed_out", - "deletion_timed_out", - ] - ] = None - """Status of the certificate or the association.""" - - cert_updated_at: Optional[datetime] = None - """The time when the certificate was updated.""" - - cert_uploaded_on: Optional[datetime] = None - """The time when the certificate was uploaded.""" - - certificate: Optional[str] = None - """The hostname certificate.""" - - created_at: Optional[datetime] = None - """The time when the certificate was created.""" - - enabled: Optional[bool] = None - """Indicates whether hostname-level authenticated origin pulls is enabled. - - A null value voids the association. - """ - - expires_on: Optional[datetime] = None - """The date when the certificate expires.""" - - hostname: Optional[str] = None - """ - The hostname on the origin for which the client certificate uploaded will be - used. - """ - - issuer: Optional[str] = None - """The certificate authority that issued the certificate.""" - - serial_number: Optional[str] = None - """The serial number on the uploaded certificate.""" - - signature: Optional[str] = None - """The type of hash used for the certificate.""" - - status: Optional[ - Literal[ - "initializing", - "pending_deployment", - "pending_deletion", - "active", - "deleted", - "deployment_timed_out", - "deletion_timed_out", - ] - ] = None - """Status of the certificate or the association.""" - - updated_at: Optional[datetime] = None - """The time when the certificate was updated.""" diff --git a/src/cloudflare/types/origin_tls_client_auth/zone_authenticated_origin_pull.py b/src/cloudflare/types/origin_tls_client_auth/zone_authenticated_origin_pull.py new file mode 100644 index 00000000000..77c12a377eb --- /dev/null +++ b/src/cloudflare/types/origin_tls_client_auth/zone_authenticated_origin_pull.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ZoneAuthenticatedOriginPull"] + + +class ZoneAuthenticatedOriginPull(BaseModel): + id: Optional[str] = None + """Identifier""" + + certificate: Optional[str] = None + """The zone's leaf certificate.""" + + expires_on: Optional[datetime] = None + """When the certificate from the authority expires.""" + + issuer: Optional[str] = None + """The certificate authority that issued the certificate.""" + + signature: Optional[str] = None + """The type of hash used for the certificate.""" + + status: Optional[ + Literal[ + "initializing", + "pending_deployment", + "pending_deletion", + "active", + "deleted", + "deployment_timed_out", + "deletion_timed_out", + ] + ] = None + """Status of the certificate activation.""" + + uploaded_on: Optional[datetime] = None + """This is the time the certificate was uploaded.""" diff --git a/src/cloudflare/types/origin_tls_client_auth_create_response.py b/src/cloudflare/types/origin_tls_client_auth_create_response.py deleted file mode 100644 index bc06aca4c10..00000000000 --- a/src/cloudflare/types/origin_tls_client_auth_create_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["OriginTLSClientAuthCreateResponse"] - -OriginTLSClientAuthCreateResponse = Union[str, object] diff --git a/src/cloudflare/types/origin_tls_client_auth_delete_response.py b/src/cloudflare/types/origin_tls_client_auth_delete_response.py deleted file mode 100644 index 557dde5710b..00000000000 --- a/src/cloudflare/types/origin_tls_client_auth_delete_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["OriginTLSClientAuthDeleteResponse"] - -OriginTLSClientAuthDeleteResponse = Union[str, object] diff --git a/src/cloudflare/types/origin_tls_client_auth_get_response.py b/src/cloudflare/types/origin_tls_client_auth_get_response.py deleted file mode 100644 index bf0bbe3e266..00000000000 --- a/src/cloudflare/types/origin_tls_client_auth_get_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["OriginTLSClientAuthGetResponse"] - -OriginTLSClientAuthGetResponse = Union[str, object] diff --git a/src/cloudflare/types/origin_tls_client_auth_list_response.py b/src/cloudflare/types/origin_tls_client_auth_list_response.py deleted file mode 100644 index c29eb8c17d1..00000000000 --- a/src/cloudflare/types/origin_tls_client_auth_list_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .._models import BaseModel - -__all__ = ["OriginTLSClientAuthListResponse"] - - -class OriginTLSClientAuthListResponse(BaseModel): - id: Optional[str] = None - """Identifier""" - - certificate: Optional[str] = None - """The zone's leaf certificate.""" - - enabled: Optional[bool] = None - """Indicates whether zone-level authenticated origin pulls is enabled.""" - - private_key: Optional[str] = None - """The zone's private key.""" diff --git a/src/cloudflare/types/page_shield/__init__.py b/src/cloudflare/types/page_shield/__init__.py index f9203122f82..39cbf2d6c29 100644 --- a/src/cloudflare/types/page_shield/__init__.py +++ b/src/cloudflare/types/page_shield/__init__.py @@ -2,11 +2,15 @@ from __future__ import annotations -from .page_shield_policy import PageShieldPolicy as PageShieldPolicy -from .page_shield_script import PageShieldScript as PageShieldScript +from .policy import Policy as Policy +from .script import Script as Script +from .setting import Setting as Setting +from .connection import Connection as Connection +from .policy_param import PolicyParam as PolicyParam from .script_list_params import ScriptListParams as ScriptListParams from .script_get_response import ScriptGetResponse as ScriptGetResponse from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .connection_list_params import ConnectionListParams as ConnectionListParams -from .page_shield_connection import PageShieldConnection as PageShieldConnection +from .page_shield_update_params import PageShieldUpdateParams as PageShieldUpdateParams +from .page_shield_update_response import PageShieldUpdateResponse as PageShieldUpdateResponse diff --git a/src/cloudflare/types/page_shield/connection.py b/src/cloudflare/types/page_shield/connection.py new file mode 100644 index 00000000000..e89e575b52a --- /dev/null +++ b/src/cloudflare/types/page_shield/connection.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Connection"] + + +class Connection(BaseModel): + id: Optional[str] = None + + added_at: Optional[str] = None + + domain_reported_malicious: Optional[bool] = None + + first_page_url: Optional[str] = None + + first_seen_at: Optional[str] = None + + host: Optional[str] = None + + last_seen_at: Optional[str] = None + + page_urls: Optional[List[str]] = None + + url: Optional[str] = None + + url_contains_cdn_cgi_path: Optional[bool] = None diff --git a/src/cloudflare/types/page_shield/page_shield_connection.py b/src/cloudflare/types/page_shield/page_shield_connection.py deleted file mode 100644 index 537e4ffbeeb..00000000000 --- a/src/cloudflare/types/page_shield/page_shield_connection.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["PageShieldConnection"] - - -class PageShieldConnection(BaseModel): - id: Optional[str] = None - - added_at: Optional[str] = None - - domain_reported_malicious: Optional[bool] = None - - first_page_url: Optional[str] = None - - first_seen_at: Optional[str] = None - - host: Optional[str] = None - - last_seen_at: Optional[str] = None - - page_urls: Optional[List[str]] = None - - url: Optional[str] = None - - url_contains_cdn_cgi_path: Optional[bool] = None diff --git a/src/cloudflare/types/page_shield/page_shield_policy.py b/src/cloudflare/types/page_shield/page_shield_policy.py deleted file mode 100644 index fccbaf01403..00000000000 --- a/src/cloudflare/types/page_shield/page_shield_policy.py +++ /dev/null @@ -1,31 +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__ = ["PageShieldPolicy"] - - -class PageShieldPolicy(BaseModel): - id: Optional[str] = None - """The ID of the policy""" - - action: Optional[Literal["allow", "log"]] = None - """The action to take if the expression matches""" - - description: Optional[str] = None - """A description for the policy""" - - enabled: Optional[bool] = None - """Whether the policy is enabled""" - - expression: Optional[str] = None - """ - The expression which must match for the policy to be applied, using the - Cloudflare Firewall rule expression syntax - """ - - value: Optional[str] = None - """The policy which will be applied""" diff --git a/src/cloudflare/types/page_shield/page_shield_script.py b/src/cloudflare/types/page_shield/page_shield_script.py deleted file mode 100644 index 57848e2af1d..00000000000 --- a/src/cloudflare/types/page_shield/page_shield_script.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["PageShieldScript"] - - -class PageShieldScript(BaseModel): - id: Optional[str] = None - - added_at: Optional[str] = None - - dataflow_score: Optional[float] = None - - domain_reported_malicious: Optional[bool] = None - - fetched_at: Optional[str] = None - - first_page_url: Optional[str] = None - - first_seen_at: Optional[str] = None - - hash: Optional[str] = None - - host: Optional[str] = None - - js_integrity_score: Optional[float] = None - - last_seen_at: Optional[str] = None - - obfuscation_score: Optional[float] = None - - page_urls: Optional[List[str]] = None - - url: Optional[str] = None - - url_contains_cdn_cgi_path: Optional[bool] = None diff --git a/src/cloudflare/types/page_shield_update_params.py b/src/cloudflare/types/page_shield/page_shield_update_params.py similarity index 100% rename from src/cloudflare/types/page_shield_update_params.py rename to src/cloudflare/types/page_shield/page_shield_update_params.py diff --git a/src/cloudflare/types/page_shield_update_response.py b/src/cloudflare/types/page_shield/page_shield_update_response.py similarity index 95% rename from src/cloudflare/types/page_shield_update_response.py rename to src/cloudflare/types/page_shield/page_shield_update_response.py index 02a8f02ce62..d0410913b2d 100644 --- a/src/cloudflare/types/page_shield_update_response.py +++ b/src/cloudflare/types/page_shield/page_shield_update_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["PageShieldUpdateResponse"] diff --git a/src/cloudflare/types/page_shield/policy.py b/src/cloudflare/types/page_shield/policy.py new file mode 100644 index 00000000000..3f838d934c7 --- /dev/null +++ b/src/cloudflare/types/page_shield/policy.py @@ -0,0 +1,31 @@ +# 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__ = ["Policy"] + + +class Policy(BaseModel): + id: Optional[str] = None + """The ID of the policy""" + + action: Optional[Literal["allow", "log"]] = None + """The action to take if the expression matches""" + + description: Optional[str] = None + """A description for the policy""" + + enabled: Optional[bool] = None + """Whether the policy is enabled""" + + expression: Optional[str] = None + """ + The expression which must match for the policy to be applied, using the + Cloudflare Firewall rule expression syntax + """ + + value: Optional[str] = None + """The policy which will be applied""" diff --git a/src/cloudflare/types/page_shield/policy_param.py b/src/cloudflare/types/page_shield/policy_param.py new file mode 100644 index 00000000000..5e2c5c140ae --- /dev/null +++ b/src/cloudflare/types/page_shield/policy_param.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 Literal, TypedDict + +__all__ = ["PolicyParam"] + + +class PolicyParam(TypedDict, total=False): + id: str + """The ID of the policy""" + + action: Literal["allow", "log"] + """The action to take if the expression matches""" + + description: str + """A description for the policy""" + + enabled: bool + """Whether the policy is enabled""" + + expression: str + """ + The expression which must match for the policy to be applied, using the + Cloudflare Firewall rule expression syntax + """ + + value: str + """The policy which will be applied""" diff --git a/src/cloudflare/types/page_shield/script.py b/src/cloudflare/types/page_shield/script.py new file mode 100644 index 00000000000..60d4a295f50 --- /dev/null +++ b/src/cloudflare/types/page_shield/script.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Script"] + + +class Script(BaseModel): + id: Optional[str] = None + + added_at: Optional[str] = None + + dataflow_score: Optional[float] = None + + domain_reported_malicious: Optional[bool] = None + + fetched_at: Optional[str] = None + + first_page_url: Optional[str] = None + + first_seen_at: Optional[str] = None + + hash: Optional[str] = None + + host: Optional[str] = None + + js_integrity_score: Optional[float] = None + + last_seen_at: Optional[str] = None + + obfuscation_score: Optional[float] = None + + page_urls: Optional[List[str]] = None + + url: Optional[str] = None + + url_contains_cdn_cgi_path: Optional[bool] = None diff --git a/src/cloudflare/types/page_shield/setting.py b/src/cloudflare/types/page_shield/setting.py new file mode 100644 index 00000000000..fee7e5dc567 --- /dev/null +++ b/src/cloudflare/types/page_shield/setting.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Setting"] + + +class Setting(BaseModel): + enabled: Optional[bool] = None + """When true, indicates that Page Shield is enabled.""" + + updated_at: Optional[str] = None + """The timestamp of when Page Shield was last updated.""" + + use_cloudflare_reporting_endpoint: Optional[bool] = None + """ + When true, CSP reports will be sent to + https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report + """ + + use_connection_url_path: Optional[bool] = None + """When true, the paths associated with connections URLs will also be analyzed.""" diff --git a/src/cloudflare/types/page_shield_setting.py b/src/cloudflare/types/page_shield_setting.py deleted file mode 100644 index 4fd8f319791..00000000000 --- a/src/cloudflare/types/page_shield_setting.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .._models import BaseModel - -__all__ = ["PageShieldSetting"] - - -class PageShieldSetting(BaseModel): - enabled: Optional[bool] = None - """When true, indicates that Page Shield is enabled.""" - - updated_at: Optional[str] = None - """The timestamp of when Page Shield was last updated.""" - - use_cloudflare_reporting_endpoint: Optional[bool] = None - """ - When true, CSP reports will be sent to - https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report - """ - - use_connection_url_path: Optional[bool] = None - """When true, the paths associated with connections URLs will also be analyzed.""" diff --git a/src/cloudflare/types/pagerule_create_params.py b/src/cloudflare/types/pagerule_create_params.py deleted file mode 100644 index 869df2ac2b6..00000000000 --- a/src/cloudflare/types/pagerule_create_params.py +++ /dev/null @@ -1,73 +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 Literal, Required, TypedDict - -__all__ = ["PageruleCreateParams", "Action", "ActionValue", "Target", "TargetConstraint"] - - -class PageruleCreateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - actions: Required[Iterable[Action]] - """The set of actions to perform if the targets of this rule match the request. - - Actions can redirect to another URL or override settings, but not both. - """ - - targets: Required[Iterable[Target]] - """The rule targets to evaluate on each request.""" - - priority: int - """ - The priority of the rule, used to define which Page Rule is processed over - another. A higher number indicates a higher priority. For example, if you have a - catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to - take precedence (rule B: `/images/special/*`), specify a higher priority for - rule B so it overrides rule A. - """ - - status: Literal["active", "disabled"] - """The status of the Page Rule.""" - - -class ActionValue(TypedDict, total=False): - type: Literal["temporary", "permanent"] - """The response type for the URL redirect.""" - - url: str - """ - The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' - in the constraint value. - """ - - -class Action(TypedDict, total=False): - name: Literal["forward_url"] - """The type of route.""" - - value: ActionValue - - -class TargetConstraint(TypedDict, total=False): - operator: Required[Literal["matches", "contains", "equals", "not_equal", "not_contain"]] - """ - The matches operator can use asterisks and pipes as wildcard and 'or' operators. - """ - - value: Required[str] - """The URL pattern to match against the current request. - - The pattern may contain up to four asterisks ('\\**') as placeholders. - """ - - -class Target(TypedDict, total=False): - constraint: Required[TargetConstraint] - """String constraint.""" - - target: Required[Literal["url"]] - """A target based on the URL of the request.""" diff --git a/src/cloudflare/types/pagerule_create_response.py b/src/cloudflare/types/pagerule_create_response.py deleted file mode 100644 index 452edcfe53d..00000000000 --- a/src/cloudflare/types/pagerule_create_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["PageruleCreateResponse"] - -PageruleCreateResponse = Union[str, object] diff --git a/src/cloudflare/types/pagerule_edit_params.py b/src/cloudflare/types/pagerule_edit_params.py deleted file mode 100644 index 94d7d4777aa..00000000000 --- a/src/cloudflare/types/pagerule_edit_params.py +++ /dev/null @@ -1,73 +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 Literal, Required, TypedDict - -__all__ = ["PageruleEditParams", "Action", "ActionValue", "Target", "TargetConstraint"] - - -class PageruleEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - actions: Iterable[Action] - """The set of actions to perform if the targets of this rule match the request. - - Actions can redirect to another URL or override settings, but not both. - """ - - priority: int - """ - The priority of the rule, used to define which Page Rule is processed over - another. A higher number indicates a higher priority. For example, if you have a - catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to - take precedence (rule B: `/images/special/*`), specify a higher priority for - rule B so it overrides rule A. - """ - - status: Literal["active", "disabled"] - """The status of the Page Rule.""" - - targets: Iterable[Target] - """The rule targets to evaluate on each request.""" - - -class ActionValue(TypedDict, total=False): - type: Literal["temporary", "permanent"] - """The response type for the URL redirect.""" - - url: str - """ - The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' - in the constraint value. - """ - - -class Action(TypedDict, total=False): - name: Literal["forward_url"] - """The type of route.""" - - value: ActionValue - - -class TargetConstraint(TypedDict, total=False): - operator: Required[Literal["matches", "contains", "equals", "not_equal", "not_contain"]] - """ - The matches operator can use asterisks and pipes as wildcard and 'or' operators. - """ - - value: Required[str] - """The URL pattern to match against the current request. - - The pattern may contain up to four asterisks ('\\**') as placeholders. - """ - - -class Target(TypedDict, total=False): - constraint: Required[TargetConstraint] - """String constraint.""" - - target: Required[Literal["url"]] - """A target based on the URL of the request.""" diff --git a/src/cloudflare/types/pagerule_edit_response.py b/src/cloudflare/types/pagerule_edit_response.py deleted file mode 100644 index f7f7cbe3634..00000000000 --- a/src/cloudflare/types/pagerule_edit_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["PageruleEditResponse"] - -PageruleEditResponse = Union[str, object] diff --git a/src/cloudflare/types/pagerule_get_response.py b/src/cloudflare/types/pagerule_get_response.py deleted file mode 100644 index b279ddf9a80..00000000000 --- a/src/cloudflare/types/pagerule_get_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["PageruleGetResponse"] - -PageruleGetResponse = Union[str, object] diff --git a/src/cloudflare/types/pagerule_list_response.py b/src/cloudflare/types/pagerule_list_response.py deleted file mode 100644 index f4d462fc10e..00000000000 --- a/src/cloudflare/types/pagerule_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zones_pagerule import ZonesPagerule - -__all__ = ["PageruleListResponse"] - -PageruleListResponse = List[ZonesPagerule] diff --git a/src/cloudflare/types/pagerule_update_params.py b/src/cloudflare/types/pagerule_update_params.py deleted file mode 100644 index 9572324f8ab..00000000000 --- a/src/cloudflare/types/pagerule_update_params.py +++ /dev/null @@ -1,73 +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 Literal, Required, TypedDict - -__all__ = ["PageruleUpdateParams", "Action", "ActionValue", "Target", "TargetConstraint"] - - -class PageruleUpdateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - actions: Required[Iterable[Action]] - """The set of actions to perform if the targets of this rule match the request. - - Actions can redirect to another URL or override settings, but not both. - """ - - targets: Required[Iterable[Target]] - """The rule targets to evaluate on each request.""" - - priority: int - """ - The priority of the rule, used to define which Page Rule is processed over - another. A higher number indicates a higher priority. For example, if you have a - catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to - take precedence (rule B: `/images/special/*`), specify a higher priority for - rule B so it overrides rule A. - """ - - status: Literal["active", "disabled"] - """The status of the Page Rule.""" - - -class ActionValue(TypedDict, total=False): - type: Literal["temporary", "permanent"] - """The response type for the URL redirect.""" - - url: str - """ - The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' - in the constraint value. - """ - - -class Action(TypedDict, total=False): - name: Literal["forward_url"] - """The type of route.""" - - value: ActionValue - - -class TargetConstraint(TypedDict, total=False): - operator: Required[Literal["matches", "contains", "equals", "not_equal", "not_contain"]] - """ - The matches operator can use asterisks and pipes as wildcard and 'or' operators. - """ - - value: Required[str] - """The URL pattern to match against the current request. - - The pattern may contain up to four asterisks ('\\**') as placeholders. - """ - - -class Target(TypedDict, total=False): - constraint: Required[TargetConstraint] - """String constraint.""" - - target: Required[Literal["url"]] - """A target based on the URL of the request.""" diff --git a/src/cloudflare/types/pagerule_update_response.py b/src/cloudflare/types/pagerule_update_response.py deleted file mode 100644 index 77c6804af27..00000000000 --- a/src/cloudflare/types/pagerule_update_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["PageruleUpdateResponse"] - -PageruleUpdateResponse = Union[str, object] diff --git a/src/cloudflare/types/pagerules/__init__.py b/src/cloudflare/types/pagerules/__init__.py index b6c34e2640a..50e8f79dd7e 100644 --- a/src/cloudflare/types/pagerules/__init__.py +++ b/src/cloudflare/types/pagerules/__init__.py @@ -2,4 +2,20 @@ from __future__ import annotations -from .zone_pagerule_settings import ZonePageruleSettings as ZonePageruleSettings +from .route import Route as Route +from .target import Target as Target +from .page_rule import PageRule as PageRule +from .route_param import RouteParam as RouteParam +from .target_param import TargetParam as TargetParam +from .pagerule_edit_params import PageruleEditParams as PageruleEditParams +from .pagerule_list_params import PageruleListParams as PageruleListParams +from .pagerule_get_response import PageruleGetResponse as PageruleGetResponse +from .setting_list_response import SettingListResponse as SettingListResponse +from .pagerule_create_params import PageruleCreateParams as PageruleCreateParams +from .pagerule_delete_params import PageruleDeleteParams as PageruleDeleteParams +from .pagerule_edit_response import PageruleEditResponse as PageruleEditResponse +from .pagerule_list_response import PageruleListResponse as PageruleListResponse +from .pagerule_update_params import PageruleUpdateParams as PageruleUpdateParams +from .pagerule_create_response import PageruleCreateResponse as PageruleCreateResponse +from .pagerule_delete_response import PageruleDeleteResponse as PageruleDeleteResponse +from .pagerule_update_response import PageruleUpdateResponse as PageruleUpdateResponse diff --git a/src/cloudflare/types/pagerules/page_rule.py b/src/cloudflare/types/pagerules/page_rule.py new file mode 100644 index 00000000000..d7a0d1b8117 --- /dev/null +++ b/src/cloudflare/types/pagerules/page_rule.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from .route import Route +from .target import Target +from ..._models import BaseModel + +__all__ = ["PageRule"] + + +class PageRule(BaseModel): + id: str + """Identifier""" + + actions: List[Route] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + created_on: datetime + """The timestamp of when the Page Rule was created.""" + + modified_on: datetime + """The timestamp of when the Page Rule was last modified.""" + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" + + targets: List[Target] + """The rule targets to evaluate on each request.""" diff --git a/src/cloudflare/types/pagerules/pagerule_create_params.py b/src/cloudflare/types/pagerules/pagerule_create_params.py new file mode 100644 index 00000000000..dfbfb883782 --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_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 +from typing_extensions import Literal, Required, TypedDict + +from .route_param import RouteParam +from .target_param import TargetParam + +__all__ = ["PageruleCreateParams"] + + +class PageruleCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + actions: Required[Iterable[RouteParam]] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + targets: Required[Iterable[TargetParam]] + """The rule targets to evaluate on each request.""" + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" diff --git a/src/cloudflare/types/pagerules/pagerule_create_response.py b/src/cloudflare/types/pagerules/pagerule_create_response.py new file mode 100644 index 00000000000..96a4e595341 --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_create_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["PageruleCreateResponse"] + +PageruleCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/pagerules/pagerule_delete_params.py b/src/cloudflare/types/pagerules/pagerule_delete_params.py new file mode 100644 index 00000000000..5b3e48c4f3e --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_delete_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__ = ["PageruleDeleteParams"] + + +class PageruleDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/pagerule_delete_response.py b/src/cloudflare/types/pagerules/pagerule_delete_response.py similarity index 85% rename from src/cloudflare/types/pagerule_delete_response.py rename to src/cloudflare/types/pagerules/pagerule_delete_response.py index fc24b77da16..c7ddf323320 100644 --- a/src/cloudflare/types/pagerule_delete_response.py +++ b/src/cloudflare/types/pagerules/pagerule_delete_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["PageruleDeleteResponse"] diff --git a/src/cloudflare/types/pagerules/pagerule_edit_params.py b/src/cloudflare/types/pagerules/pagerule_edit_params.py new file mode 100644 index 00000000000..5d2ed4636b2 --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_edit_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 +from typing_extensions import Literal, Required, TypedDict + +from .route_param import RouteParam +from .target_param import TargetParam + +__all__ = ["PageruleEditParams"] + + +class PageruleEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + actions: Iterable[RouteParam] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" + + targets: Iterable[TargetParam] + """The rule targets to evaluate on each request.""" diff --git a/src/cloudflare/types/pagerules/pagerule_edit_response.py b/src/cloudflare/types/pagerules/pagerule_edit_response.py new file mode 100644 index 00000000000..d57a5670779 --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_edit_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["PageruleEditResponse"] + +PageruleEditResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/pagerules/pagerule_get_response.py b/src/cloudflare/types/pagerules/pagerule_get_response.py new file mode 100644 index 00000000000..00aebec71a7 --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["PageruleGetResponse"] + +PageruleGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/pagerule_list_params.py b/src/cloudflare/types/pagerules/pagerule_list_params.py similarity index 100% rename from src/cloudflare/types/pagerule_list_params.py rename to src/cloudflare/types/pagerules/pagerule_list_params.py diff --git a/src/cloudflare/types/pagerules/pagerule_list_response.py b/src/cloudflare/types/pagerules/pagerule_list_response.py new file mode 100644 index 00000000000..1b111a722d6 --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_list_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .page_rule import PageRule + +__all__ = ["PageruleListResponse"] + +PageruleListResponse = List[PageRule] diff --git a/src/cloudflare/types/pagerules/pagerule_update_params.py b/src/cloudflare/types/pagerules/pagerule_update_params.py new file mode 100644 index 00000000000..4637d036a12 --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_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 +from typing_extensions import Literal, Required, TypedDict + +from .route_param import RouteParam +from .target_param import TargetParam + +__all__ = ["PageruleUpdateParams"] + + +class PageruleUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + actions: Required[Iterable[RouteParam]] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + targets: Required[Iterable[TargetParam]] + """The rule targets to evaluate on each request.""" + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" diff --git a/src/cloudflare/types/pagerules/pagerule_update_response.py b/src/cloudflare/types/pagerules/pagerule_update_response.py new file mode 100644 index 00000000000..7e101d4eace --- /dev/null +++ b/src/cloudflare/types/pagerules/pagerule_update_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["PageruleUpdateResponse"] + +PageruleUpdateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/pagerules/route.py b/src/cloudflare/types/pagerules/route.py new file mode 100644 index 00000000000..df4910ea5d4 --- /dev/null +++ b/src/cloudflare/types/pagerules/route.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Route", "Value"] + + +class Value(BaseModel): + type: Optional[Literal["temporary", "permanent"]] = None + """The response type for the URL redirect.""" + + url: Optional[str] = None + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class Route(BaseModel): + modified_on: Optional[datetime] = None + """The timestamp of when the override was last modified.""" + + name: Optional[Literal["forward_url"]] = None + """The type of route.""" + + value: Optional[Value] = None diff --git a/src/cloudflare/types/pagerules/route_param.py b/src/cloudflare/types/pagerules/route_param.py new file mode 100644 index 00000000000..3182d9be53a --- /dev/null +++ b/src/cloudflare/types/pagerules/route_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["RouteParam", "Value"] + + +class Value(TypedDict, total=False): + type: Literal["temporary", "permanent"] + """The response type for the URL redirect.""" + + url: str + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class RouteParam(TypedDict, total=False): + name: Literal["forward_url"] + """The type of route.""" + + value: Value diff --git a/src/cloudflare/types/pagerules/setting_list_response.py b/src/cloudflare/types/pagerules/setting_list_response.py new file mode 100644 index 00000000000..d186c559fe3 --- /dev/null +++ b/src/cloudflare/types/pagerules/setting_list_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +__all__ = ["SettingListResponse"] + +SettingListResponse = List[object] diff --git a/src/cloudflare/types/pagerules/target.py b/src/cloudflare/types/pagerules/target.py new file mode 100644 index 00000000000..f15c3acef68 --- /dev/null +++ b/src/cloudflare/types/pagerules/target.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Target", "Constraint"] + + +class Constraint(BaseModel): + operator: Literal["matches", "contains", "equals", "not_equal", "not_contain"] + """ + The matches operator can use asterisks and pipes as wildcard and 'or' operators. + """ + + value: str + """The URL pattern to match against the current request. + + The pattern may contain up to four asterisks ('\\**') as placeholders. + """ + + +class Target(BaseModel): + constraint: Constraint + """String constraint.""" + + target: Literal["url"] + """A target based on the URL of the request.""" diff --git a/src/cloudflare/types/pagerules/target_param.py b/src/cloudflare/types/pagerules/target_param.py new file mode 100644 index 00000000000..2977b64466f --- /dev/null +++ b/src/cloudflare/types/pagerules/target_param.py @@ -0,0 +1,28 @@ +# 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__ = ["TargetParam", "Constraint"] + + +class Constraint(TypedDict, total=False): + operator: Required[Literal["matches", "contains", "equals", "not_equal", "not_contain"]] + """ + The matches operator can use asterisks and pipes as wildcard and 'or' operators. + """ + + value: Required[str] + """The URL pattern to match against the current request. + + The pattern may contain up to four asterisks ('\\**') as placeholders. + """ + + +class TargetParam(TypedDict, total=False): + constraint: Required[Constraint] + """String constraint.""" + + target: Required[Literal["url"]] + """A target based on the URL of the request.""" diff --git a/src/cloudflare/types/pagerules/zone_pagerule_settings.py b/src/cloudflare/types/pagerules/zone_pagerule_settings.py deleted file mode 100644 index d7c22fbd6ed..00000000000 --- a/src/cloudflare/types/pagerules/zone_pagerule_settings.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -__all__ = ["ZonePageruleSettings"] - -ZonePageruleSettings = List[object] diff --git a/src/cloudflare/types/pages/__init__.py b/src/cloudflare/types/pages/__init__.py index 7619885558e..bff15c5407c 100644 --- a/src/cloudflare/types/pages/__init__.py +++ b/src/cloudflare/types/pages/__init__.py @@ -2,10 +2,13 @@ from __future__ import annotations -from .pages_projects import PagesProjects as PagesProjects -from .pages_deployments import PagesDeployments as PagesDeployments +from .stage import Stage as Stage +from .project import Project as Project +from .deployment import Deployment as Deployment +from .stage_param import StageParam as StageParam +from .deployment_param import DeploymentParam as DeploymentParam from .project_edit_params import ProjectEditParams as ProjectEditParams from .project_create_params import ProjectCreateParams as ProjectCreateParams +from .project_delete_params import ProjectDeleteParams as ProjectDeleteParams from .project_edit_response import ProjectEditResponse as ProjectEditResponse -from .pages_deployments_param import PagesDeploymentsParam as PagesDeploymentsParam from .project_create_response import ProjectCreateResponse as ProjectCreateResponse diff --git a/src/cloudflare/types/pages/deployment.py b/src/cloudflare/types/pages/deployment.py new file mode 100644 index 00000000000..fcd5acbf94e --- /dev/null +++ b/src/cloudflare/types/pages/deployment.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .stage import Stage +from ..._models import BaseModel + +__all__ = ["Deployment", "DeploymentTrigger", "DeploymentTriggerMetadata"] + + +class DeploymentTriggerMetadata(BaseModel): + branch: Optional[str] = None + """Where the trigger happened.""" + + commit_hash: Optional[str] = None + """Hash of the deployment trigger commit.""" + + commit_message: Optional[str] = None + """Message of the deployment trigger commit.""" + + +class DeploymentTrigger(BaseModel): + metadata: Optional[DeploymentTriggerMetadata] = None + """Additional info about the trigger.""" + + type: Optional[str] = None + """What caused the deployment.""" + + +class Deployment(BaseModel): + id: Optional[str] = None + """Id of the deployment.""" + + aliases: Optional[List[object]] = None + """A list of alias URLs pointing to this deployment.""" + + build_config: Optional[object] = None + + created_on: Optional[datetime] = None + """When the deployment was created.""" + + deployment_trigger: Optional[DeploymentTrigger] = None + """Info about what caused the deployment.""" + + env_vars: Optional[object] = None + """A dict of env variables to build this deploy.""" + + environment: Optional[str] = None + """Type of deploy.""" + + is_skipped: Optional[bool] = None + """If the deployment has been skipped.""" + + latest_stage: Optional[object] = None + + modified_on: Optional[datetime] = None + """When the deployment was last modified.""" + + project_id: Optional[str] = None + """Id of the project.""" + + project_name: Optional[str] = None + """Name of the project.""" + + short_id: Optional[str] = None + """Short Id (8 character) of the deployment.""" + + source: Optional[object] = None + + stages: Optional[List[Stage]] = None + """List of past stages.""" + + url: Optional[str] = None + """The live URL to view this deployment.""" diff --git a/src/cloudflare/types/pages/deployment_param.py b/src/cloudflare/types/pages/deployment_param.py new file mode 100644 index 00000000000..4d265602dc2 --- /dev/null +++ b/src/cloudflare/types/pages/deployment_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["DeploymentParam"] + + +class DeploymentParam(TypedDict, total=False): + pass diff --git a/src/cloudflare/types/pages/pages_deployments.py b/src/cloudflare/types/pages/pages_deployments.py deleted file mode 100644 index d96d48d7e81..00000000000 --- a/src/cloudflare/types/pages/pages_deployments.py +++ /dev/null @@ -1,88 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["PagesDeployments", "DeploymentTrigger", "DeploymentTriggerMetadata", "Stage"] - - -class DeploymentTriggerMetadata(BaseModel): - branch: Optional[str] = None - """Where the trigger happened.""" - - commit_hash: Optional[str] = None - """Hash of the deployment trigger commit.""" - - commit_message: Optional[str] = None - """Message of the deployment trigger commit.""" - - -class DeploymentTrigger(BaseModel): - metadata: Optional[DeploymentTriggerMetadata] = None - """Additional info about the trigger.""" - - type: Optional[str] = None - """What caused the deployment.""" - - -class Stage(BaseModel): - ended_on: Optional[datetime] = None - """When the stage ended.""" - - name: Optional[str] = None - """The current build stage.""" - - started_on: Optional[datetime] = None - """When the stage started.""" - - status: Optional[str] = None - """State of the current stage.""" - - -class PagesDeployments(BaseModel): - id: Optional[str] = None - """Id of the deployment.""" - - aliases: Optional[List[object]] = None - """A list of alias URLs pointing to this deployment.""" - - build_config: Optional[object] = None - - created_on: Optional[datetime] = None - """When the deployment was created.""" - - deployment_trigger: Optional[DeploymentTrigger] = None - """Info about what caused the deployment.""" - - env_vars: Optional[object] = None - """A dict of env variables to build this deploy.""" - - environment: Optional[str] = None - """Type of deploy.""" - - is_skipped: Optional[bool] = None - """If the deployment has been skipped.""" - - latest_stage: Optional[object] = None - - modified_on: Optional[datetime] = None - """When the deployment was last modified.""" - - project_id: Optional[str] = None - """Id of the project.""" - - project_name: Optional[str] = None - """Name of the project.""" - - short_id: Optional[str] = None - """Short Id (8 character) of the deployment.""" - - source: Optional[object] = None - - stages: Optional[List[Stage]] = None - """List of past stages.""" - - url: Optional[str] = None - """The live URL to view this deployment.""" diff --git a/src/cloudflare/types/pages/pages_deployments_param.py b/src/cloudflare/types/pages/pages_deployments_param.py deleted file mode 100644 index 1a57dd71abd..00000000000 --- a/src/cloudflare/types/pages/pages_deployments_param.py +++ /dev/null @@ -1,11 +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__ = ["PagesDeploymentsParam"] - - -class PagesDeploymentsParam(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/pages/pages_projects.py b/src/cloudflare/types/pages/pages_projects.py deleted file mode 100644 index bbdeb24b7e7..00000000000 --- a/src/cloudflare/types/pages/pages_projects.py +++ /dev/null @@ -1,526 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel -from .pages_deployments import PagesDeployments - -__all__ = [ - "PagesProjects", - "BuildConfig", - "DeploymentConfigs", - "DeploymentConfigsPreview", - "DeploymentConfigsPreviewAIBindings", - "DeploymentConfigsPreviewAIBindingsAIBinding", - "DeploymentConfigsPreviewAnalyticsEngineDatasets", - "DeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding", - "DeploymentConfigsPreviewBrowsers", - "DeploymentConfigsPreviewD1Databases", - "DeploymentConfigsPreviewD1DatabasesD1Binding", - "DeploymentConfigsPreviewDurableObjectNamespaces", - "DeploymentConfigsPreviewDurableObjectNamespacesDoBinding", - "DeploymentConfigsPreviewEnvVars", - "DeploymentConfigsPreviewEnvVarsEnvironmentVariable", - "DeploymentConfigsPreviewHyperdriveBindings", - "DeploymentConfigsPreviewHyperdriveBindingsHyperdrive", - "DeploymentConfigsPreviewKVNamespaces", - "DeploymentConfigsPreviewKVNamespacesKVBinding", - "DeploymentConfigsPreviewMTLSCertificates", - "DeploymentConfigsPreviewMTLSCertificatesMTLS", - "DeploymentConfigsPreviewPlacement", - "DeploymentConfigsPreviewQueueProducers", - "DeploymentConfigsPreviewQueueProducersQueueProducerBinding", - "DeploymentConfigsPreviewR2Buckets", - "DeploymentConfigsPreviewR2BucketsR2Binding", - "DeploymentConfigsPreviewServices", - "DeploymentConfigsPreviewServicesServiceBinding", - "DeploymentConfigsPreviewVectorizeBindings", - "DeploymentConfigsPreviewVectorizeBindingsVectorize", - "DeploymentConfigsProduction", - "DeploymentConfigsProductionAIBindings", - "DeploymentConfigsProductionAIBindingsAIBinding", - "DeploymentConfigsProductionAnalyticsEngineDatasets", - "DeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding", - "DeploymentConfigsProductionBrowsers", - "DeploymentConfigsProductionD1Databases", - "DeploymentConfigsProductionD1DatabasesD1Binding", - "DeploymentConfigsProductionDurableObjectNamespaces", - "DeploymentConfigsProductionDurableObjectNamespacesDoBinding", - "DeploymentConfigsProductionEnvVars", - "DeploymentConfigsProductionEnvVarsEnvironmentVariable", - "DeploymentConfigsProductionHyperdriveBindings", - "DeploymentConfigsProductionHyperdriveBindingsHyperdrive", - "DeploymentConfigsProductionKVNamespaces", - "DeploymentConfigsProductionKVNamespacesKVBinding", - "DeploymentConfigsProductionMTLSCertificates", - "DeploymentConfigsProductionMTLSCertificatesMTLS", - "DeploymentConfigsProductionPlacement", - "DeploymentConfigsProductionQueueProducers", - "DeploymentConfigsProductionQueueProducersQueueProducerBinding", - "DeploymentConfigsProductionR2Buckets", - "DeploymentConfigsProductionR2BucketsR2Binding", - "DeploymentConfigsProductionServices", - "DeploymentConfigsProductionServicesServiceBinding", - "DeploymentConfigsProductionVectorizeBindings", - "DeploymentConfigsProductionVectorizeBindingsVectorize", -] - - -class BuildConfig(BaseModel): - build_caching: Optional[bool] = None - """Enable build caching for the project.""" - - build_command: Optional[str] = None - """Command used to build project.""" - - destination_dir: Optional[str] = None - """Output directory of the build.""" - - root_dir: Optional[str] = None - """Directory to run the command.""" - - web_analytics_tag: Optional[str] = None - """The classifying tag for analytics.""" - - web_analytics_token: Optional[str] = None - """The auth token for analytics.""" - - -class DeploymentConfigsPreviewAIBindingsAIBinding(BaseModel): - project_id: Optional[object] = None - - -class DeploymentConfigsPreviewAIBindings(BaseModel): - ai_binding: Optional[DeploymentConfigsPreviewAIBindingsAIBinding] = FieldInfo(alias="AI_BINDING", default=None) - """AI binding.""" - - -class DeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding(BaseModel): - dataset: Optional[str] = None - """Name of the dataset.""" - - -class DeploymentConfigsPreviewAnalyticsEngineDatasets(BaseModel): - analytics_engine_binding: Optional[ - DeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding - ] = FieldInfo(alias="ANALYTICS_ENGINE_BINDING", default=None) - """Analytics Engine binding.""" - - -class DeploymentConfigsPreviewBrowsers(BaseModel): - browser: Optional[object] = FieldInfo(alias="BROWSER", default=None) - """Browser binding.""" - - -class DeploymentConfigsPreviewD1DatabasesD1Binding(BaseModel): - id: Optional[str] = None - """UUID of the D1 database.""" - - -class DeploymentConfigsPreviewD1Databases(BaseModel): - d1_binding: Optional[DeploymentConfigsPreviewD1DatabasesD1Binding] = FieldInfo(alias="D1_BINDING", default=None) - """D1 binding.""" - - -class DeploymentConfigsPreviewDurableObjectNamespacesDoBinding(BaseModel): - namespace_id: Optional[str] = None - """ID of the Durabble Object namespace.""" - - -class DeploymentConfigsPreviewDurableObjectNamespaces(BaseModel): - do_binding: Optional[DeploymentConfigsPreviewDurableObjectNamespacesDoBinding] = FieldInfo( - alias="DO_BINDING", default=None - ) - """Durabble Object binding.""" - - -class DeploymentConfigsPreviewEnvVarsEnvironmentVariable(BaseModel): - type: Optional[Literal["plain_text", "secret_text"]] = None - """The type of environment variable (plain text or secret)""" - - value: Optional[str] = None - """Environment variable value.""" - - -class DeploymentConfigsPreviewEnvVars(BaseModel): - environment_variable: Optional[DeploymentConfigsPreviewEnvVarsEnvironmentVariable] = FieldInfo( - alias="ENVIRONMENT_VARIABLE", default=None - ) - """Environment variable.""" - - -class DeploymentConfigsPreviewHyperdriveBindingsHyperdrive(BaseModel): - id: Optional[str] = None - - -class DeploymentConfigsPreviewHyperdriveBindings(BaseModel): - hyperdrive: Optional[DeploymentConfigsPreviewHyperdriveBindingsHyperdrive] = FieldInfo( - alias="HYPERDRIVE", default=None - ) - """Hyperdrive binding.""" - - -class DeploymentConfigsPreviewKVNamespacesKVBinding(BaseModel): - namespace_id: Optional[str] = None - """ID of the KV namespace.""" - - -class DeploymentConfigsPreviewKVNamespaces(BaseModel): - kv_binding: Optional[DeploymentConfigsPreviewKVNamespacesKVBinding] = FieldInfo(alias="KV_BINDING", default=None) - """KV binding.""" - - -class DeploymentConfigsPreviewMTLSCertificatesMTLS(BaseModel): - certificate_id: Optional[str] = None - - -class DeploymentConfigsPreviewMTLSCertificates(BaseModel): - mtls: Optional[DeploymentConfigsPreviewMTLSCertificatesMTLS] = FieldInfo(alias="MTLS", default=None) - """mTLS binding.""" - - -class DeploymentConfigsPreviewPlacement(BaseModel): - mode: Optional[str] = None - """Placement mode.""" - - -class DeploymentConfigsPreviewQueueProducersQueueProducerBinding(BaseModel): - name: Optional[str] = None - """Name of the Queue.""" - - -class DeploymentConfigsPreviewQueueProducers(BaseModel): - queue_producer_binding: Optional[DeploymentConfigsPreviewQueueProducersQueueProducerBinding] = FieldInfo( - alias="QUEUE_PRODUCER_BINDING", default=None - ) - """Queue Producer binding.""" - - -class DeploymentConfigsPreviewR2BucketsR2Binding(BaseModel): - name: Optional[str] = None - """Name of the R2 bucket.""" - - -class DeploymentConfigsPreviewR2Buckets(BaseModel): - r2_binding: Optional[DeploymentConfigsPreviewR2BucketsR2Binding] = FieldInfo(alias="R2_BINDING", default=None) - """R2 binding.""" - - -class DeploymentConfigsPreviewServicesServiceBinding(BaseModel): - entrypoint: Optional[str] = None - """The entrypoint to bind to.""" - - environment: Optional[str] = None - """The Service environment.""" - - service: Optional[str] = None - """The Service name.""" - - -class DeploymentConfigsPreviewServices(BaseModel): - service_binding: Optional[DeploymentConfigsPreviewServicesServiceBinding] = FieldInfo( - alias="SERVICE_BINDING", default=None - ) - """Service binding.""" - - -class DeploymentConfigsPreviewVectorizeBindingsVectorize(BaseModel): - index_name: Optional[str] = None - - -class DeploymentConfigsPreviewVectorizeBindings(BaseModel): - vectorize: Optional[DeploymentConfigsPreviewVectorizeBindingsVectorize] = FieldInfo(alias="VECTORIZE", default=None) - """Vectorize binding.""" - - -class DeploymentConfigsPreview(BaseModel): - ai_bindings: Optional[DeploymentConfigsPreviewAIBindings] = None - """Constellation bindings used for Pages Functions.""" - - analytics_engine_datasets: Optional[DeploymentConfigsPreviewAnalyticsEngineDatasets] = None - """Analytics Engine bindings used for Pages Functions.""" - - browsers: Optional[DeploymentConfigsPreviewBrowsers] = None - """Browser bindings used for Pages Functions.""" - - compatibility_date: Optional[str] = None - """Compatibility date used for Pages Functions.""" - - compatibility_flags: Optional[List[object]] = None - """Compatibility flags used for Pages Functions.""" - - d1_databases: Optional[DeploymentConfigsPreviewD1Databases] = None - """D1 databases used for Pages Functions.""" - - durable_object_namespaces: Optional[DeploymentConfigsPreviewDurableObjectNamespaces] = None - """Durabble Object namespaces used for Pages Functions.""" - - env_vars: Optional[DeploymentConfigsPreviewEnvVars] = None - """Environment variables for build configs.""" - - hyperdrive_bindings: Optional[DeploymentConfigsPreviewHyperdriveBindings] = None - """Hyperdrive bindings used for Pages Functions.""" - - kv_namespaces: Optional[DeploymentConfigsPreviewKVNamespaces] = None - """KV namespaces used for Pages Functions.""" - - mtls_certificates: Optional[DeploymentConfigsPreviewMTLSCertificates] = None - """mTLS bindings used for Pages Functions.""" - - placement: Optional[DeploymentConfigsPreviewPlacement] = None - """Placement setting used for Pages Functions.""" - - queue_producers: Optional[DeploymentConfigsPreviewQueueProducers] = None - """Queue Producer bindings used for Pages Functions.""" - - r2_buckets: Optional[DeploymentConfigsPreviewR2Buckets] = None - """R2 buckets used for Pages Functions.""" - - services: Optional[DeploymentConfigsPreviewServices] = None - """Services used for Pages Functions.""" - - vectorize_bindings: Optional[DeploymentConfigsPreviewVectorizeBindings] = None - """Vectorize bindings used for Pages Functions.""" - - -class DeploymentConfigsProductionAIBindingsAIBinding(BaseModel): - project_id: Optional[object] = None - - -class DeploymentConfigsProductionAIBindings(BaseModel): - ai_binding: Optional[DeploymentConfigsProductionAIBindingsAIBinding] = FieldInfo(alias="AI_BINDING", default=None) - """AI binding.""" - - -class DeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding(BaseModel): - dataset: Optional[str] = None - """Name of the dataset.""" - - -class DeploymentConfigsProductionAnalyticsEngineDatasets(BaseModel): - analytics_engine_binding: Optional[ - DeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding - ] = FieldInfo(alias="ANALYTICS_ENGINE_BINDING", default=None) - """Analytics Engine binding.""" - - -class DeploymentConfigsProductionBrowsers(BaseModel): - browser: Optional[object] = FieldInfo(alias="BROWSER", default=None) - """Browser binding.""" - - -class DeploymentConfigsProductionD1DatabasesD1Binding(BaseModel): - id: Optional[str] = None - """UUID of the D1 database.""" - - -class DeploymentConfigsProductionD1Databases(BaseModel): - d1_binding: Optional[DeploymentConfigsProductionD1DatabasesD1Binding] = FieldInfo(alias="D1_BINDING", default=None) - """D1 binding.""" - - -class DeploymentConfigsProductionDurableObjectNamespacesDoBinding(BaseModel): - namespace_id: Optional[str] = None - """ID of the Durabble Object namespace.""" - - -class DeploymentConfigsProductionDurableObjectNamespaces(BaseModel): - do_binding: Optional[DeploymentConfigsProductionDurableObjectNamespacesDoBinding] = FieldInfo( - alias="DO_BINDING", default=None - ) - """Durabble Object binding.""" - - -class DeploymentConfigsProductionEnvVarsEnvironmentVariable(BaseModel): - type: Optional[Literal["plain_text", "secret_text"]] = None - """The type of environment variable (plain text or secret)""" - - value: Optional[str] = None - """Environment variable value.""" - - -class DeploymentConfigsProductionEnvVars(BaseModel): - environment_variable: Optional[DeploymentConfigsProductionEnvVarsEnvironmentVariable] = FieldInfo( - alias="ENVIRONMENT_VARIABLE", default=None - ) - """Environment variable.""" - - -class DeploymentConfigsProductionHyperdriveBindingsHyperdrive(BaseModel): - id: Optional[str] = None - - -class DeploymentConfigsProductionHyperdriveBindings(BaseModel): - hyperdrive: Optional[DeploymentConfigsProductionHyperdriveBindingsHyperdrive] = FieldInfo( - alias="HYPERDRIVE", default=None - ) - """Hyperdrive binding.""" - - -class DeploymentConfigsProductionKVNamespacesKVBinding(BaseModel): - namespace_id: Optional[str] = None - """ID of the KV namespace.""" - - -class DeploymentConfigsProductionKVNamespaces(BaseModel): - kv_binding: Optional[DeploymentConfigsProductionKVNamespacesKVBinding] = FieldInfo(alias="KV_BINDING", default=None) - """KV binding.""" - - -class DeploymentConfigsProductionMTLSCertificatesMTLS(BaseModel): - certificate_id: Optional[str] = None - - -class DeploymentConfigsProductionMTLSCertificates(BaseModel): - mtls: Optional[DeploymentConfigsProductionMTLSCertificatesMTLS] = FieldInfo(alias="MTLS", default=None) - """mTLS binding.""" - - -class DeploymentConfigsProductionPlacement(BaseModel): - mode: Optional[str] = None - """Placement mode.""" - - -class DeploymentConfigsProductionQueueProducersQueueProducerBinding(BaseModel): - name: Optional[str] = None - """Name of the Queue.""" - - -class DeploymentConfigsProductionQueueProducers(BaseModel): - queue_producer_binding: Optional[DeploymentConfigsProductionQueueProducersQueueProducerBinding] = FieldInfo( - alias="QUEUE_PRODUCER_BINDING", default=None - ) - """Queue Producer binding.""" - - -class DeploymentConfigsProductionR2BucketsR2Binding(BaseModel): - name: Optional[str] = None - """Name of the R2 bucket.""" - - -class DeploymentConfigsProductionR2Buckets(BaseModel): - r2_binding: Optional[DeploymentConfigsProductionR2BucketsR2Binding] = FieldInfo(alias="R2_BINDING", default=None) - """R2 binding.""" - - -class DeploymentConfigsProductionServicesServiceBinding(BaseModel): - entrypoint: Optional[str] = None - """The entrypoint to bind to.""" - - environment: Optional[str] = None - """The Service environment.""" - - service: Optional[str] = None - """The Service name.""" - - -class DeploymentConfigsProductionServices(BaseModel): - service_binding: Optional[DeploymentConfigsProductionServicesServiceBinding] = FieldInfo( - alias="SERVICE_BINDING", default=None - ) - """Service binding.""" - - -class DeploymentConfigsProductionVectorizeBindingsVectorize(BaseModel): - index_name: Optional[str] = None - - -class DeploymentConfigsProductionVectorizeBindings(BaseModel): - vectorize: Optional[DeploymentConfigsProductionVectorizeBindingsVectorize] = FieldInfo( - alias="VECTORIZE", default=None - ) - """Vectorize binding.""" - - -class DeploymentConfigsProduction(BaseModel): - ai_bindings: Optional[DeploymentConfigsProductionAIBindings] = None - """Constellation bindings used for Pages Functions.""" - - analytics_engine_datasets: Optional[DeploymentConfigsProductionAnalyticsEngineDatasets] = None - """Analytics Engine bindings used for Pages Functions.""" - - browsers: Optional[DeploymentConfigsProductionBrowsers] = None - """Browser bindings used for Pages Functions.""" - - compatibility_date: Optional[str] = None - """Compatibility date used for Pages Functions.""" - - compatibility_flags: Optional[List[object]] = None - """Compatibility flags used for Pages Functions.""" - - d1_databases: Optional[DeploymentConfigsProductionD1Databases] = None - """D1 databases used for Pages Functions.""" - - durable_object_namespaces: Optional[DeploymentConfigsProductionDurableObjectNamespaces] = None - """Durabble Object namespaces used for Pages Functions.""" - - env_vars: Optional[DeploymentConfigsProductionEnvVars] = None - """Environment variables for build configs.""" - - hyperdrive_bindings: Optional[DeploymentConfigsProductionHyperdriveBindings] = None - """Hyperdrive bindings used for Pages Functions.""" - - kv_namespaces: Optional[DeploymentConfigsProductionKVNamespaces] = None - """KV namespaces used for Pages Functions.""" - - mtls_certificates: Optional[DeploymentConfigsProductionMTLSCertificates] = None - """mTLS bindings used for Pages Functions.""" - - placement: Optional[DeploymentConfigsProductionPlacement] = None - """Placement setting used for Pages Functions.""" - - queue_producers: Optional[DeploymentConfigsProductionQueueProducers] = None - """Queue Producer bindings used for Pages Functions.""" - - r2_buckets: Optional[DeploymentConfigsProductionR2Buckets] = None - """R2 buckets used for Pages Functions.""" - - services: Optional[DeploymentConfigsProductionServices] = None - """Services used for Pages Functions.""" - - vectorize_bindings: Optional[DeploymentConfigsProductionVectorizeBindings] = None - """Vectorize bindings used for Pages Functions.""" - - -class DeploymentConfigs(BaseModel): - preview: Optional[DeploymentConfigsPreview] = None - """Configs for preview deploys.""" - - production: Optional[DeploymentConfigsProduction] = None - """Configs for production deploys.""" - - -class PagesProjects(BaseModel): - id: Optional[str] = None - """Id of the project.""" - - build_config: Optional[BuildConfig] = None - """Configs for the project build process.""" - - canonical_deployment: Optional[PagesDeployments] = None - - created_on: Optional[datetime] = None - """When the project was created.""" - - deployment_configs: Optional[DeploymentConfigs] = None - """Configs for deployments in a project.""" - - domains: Optional[List[object]] = None - """A list of associated custom domains for the project.""" - - latest_deployment: Optional[PagesDeployments] = None - - name: Optional[str] = None - """Name of the project.""" - - production_branch: Optional[str] = None - """Production branch of the project. Used to identify production deployments.""" - - source: Optional[object] = None - - subdomain: Optional[str] = None - """The Cloudflare subdomain associated with the project.""" diff --git a/src/cloudflare/types/pages/project.py b/src/cloudflare/types/pages/project.py new file mode 100644 index 00000000000..b4bd6af5396 --- /dev/null +++ b/src/cloudflare/types/pages/project.py @@ -0,0 +1,526 @@ +# 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 pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .deployment import Deployment + +__all__ = [ + "Project", + "BuildConfig", + "DeploymentConfigs", + "DeploymentConfigsPreview", + "DeploymentConfigsPreviewAIBindings", + "DeploymentConfigsPreviewAIBindingsAIBinding", + "DeploymentConfigsPreviewAnalyticsEngineDatasets", + "DeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding", + "DeploymentConfigsPreviewBrowsers", + "DeploymentConfigsPreviewD1Databases", + "DeploymentConfigsPreviewD1DatabasesD1Binding", + "DeploymentConfigsPreviewDurableObjectNamespaces", + "DeploymentConfigsPreviewDurableObjectNamespacesDoBinding", + "DeploymentConfigsPreviewEnvVars", + "DeploymentConfigsPreviewEnvVarsEnvironmentVariable", + "DeploymentConfigsPreviewHyperdriveBindings", + "DeploymentConfigsPreviewHyperdriveBindingsHyperdrive", + "DeploymentConfigsPreviewKVNamespaces", + "DeploymentConfigsPreviewKVNamespacesKVBinding", + "DeploymentConfigsPreviewMTLSCertificates", + "DeploymentConfigsPreviewMTLSCertificatesMTLS", + "DeploymentConfigsPreviewPlacement", + "DeploymentConfigsPreviewQueueProducers", + "DeploymentConfigsPreviewQueueProducersQueueProducerBinding", + "DeploymentConfigsPreviewR2Buckets", + "DeploymentConfigsPreviewR2BucketsR2Binding", + "DeploymentConfigsPreviewServices", + "DeploymentConfigsPreviewServicesServiceBinding", + "DeploymentConfigsPreviewVectorizeBindings", + "DeploymentConfigsPreviewVectorizeBindingsVectorize", + "DeploymentConfigsProduction", + "DeploymentConfigsProductionAIBindings", + "DeploymentConfigsProductionAIBindingsAIBinding", + "DeploymentConfigsProductionAnalyticsEngineDatasets", + "DeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding", + "DeploymentConfigsProductionBrowsers", + "DeploymentConfigsProductionD1Databases", + "DeploymentConfigsProductionD1DatabasesD1Binding", + "DeploymentConfigsProductionDurableObjectNamespaces", + "DeploymentConfigsProductionDurableObjectNamespacesDoBinding", + "DeploymentConfigsProductionEnvVars", + "DeploymentConfigsProductionEnvVarsEnvironmentVariable", + "DeploymentConfigsProductionHyperdriveBindings", + "DeploymentConfigsProductionHyperdriveBindingsHyperdrive", + "DeploymentConfigsProductionKVNamespaces", + "DeploymentConfigsProductionKVNamespacesKVBinding", + "DeploymentConfigsProductionMTLSCertificates", + "DeploymentConfigsProductionMTLSCertificatesMTLS", + "DeploymentConfigsProductionPlacement", + "DeploymentConfigsProductionQueueProducers", + "DeploymentConfigsProductionQueueProducersQueueProducerBinding", + "DeploymentConfigsProductionR2Buckets", + "DeploymentConfigsProductionR2BucketsR2Binding", + "DeploymentConfigsProductionServices", + "DeploymentConfigsProductionServicesServiceBinding", + "DeploymentConfigsProductionVectorizeBindings", + "DeploymentConfigsProductionVectorizeBindingsVectorize", +] + + +class BuildConfig(BaseModel): + build_caching: Optional[bool] = None + """Enable build caching for the project.""" + + build_command: Optional[str] = None + """Command used to build project.""" + + destination_dir: Optional[str] = None + """Output directory of the build.""" + + root_dir: Optional[str] = None + """Directory to run the command.""" + + web_analytics_tag: Optional[str] = None + """The classifying tag for analytics.""" + + web_analytics_token: Optional[str] = None + """The auth token for analytics.""" + + +class DeploymentConfigsPreviewAIBindingsAIBinding(BaseModel): + project_id: Optional[object] = None + + +class DeploymentConfigsPreviewAIBindings(BaseModel): + ai_binding: Optional[DeploymentConfigsPreviewAIBindingsAIBinding] = FieldInfo(alias="AI_BINDING", default=None) + """AI binding.""" + + +class DeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding(BaseModel): + dataset: Optional[str] = None + """Name of the dataset.""" + + +class DeploymentConfigsPreviewAnalyticsEngineDatasets(BaseModel): + analytics_engine_binding: Optional[ + DeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding + ] = FieldInfo(alias="ANALYTICS_ENGINE_BINDING", default=None) + """Analytics Engine binding.""" + + +class DeploymentConfigsPreviewBrowsers(BaseModel): + browser: Optional[object] = FieldInfo(alias="BROWSER", default=None) + """Browser binding.""" + + +class DeploymentConfigsPreviewD1DatabasesD1Binding(BaseModel): + id: Optional[str] = None + """UUID of the D1 database.""" + + +class DeploymentConfigsPreviewD1Databases(BaseModel): + d1_binding: Optional[DeploymentConfigsPreviewD1DatabasesD1Binding] = FieldInfo(alias="D1_BINDING", default=None) + """D1 binding.""" + + +class DeploymentConfigsPreviewDurableObjectNamespacesDoBinding(BaseModel): + namespace_id: Optional[str] = None + """ID of the Durabble Object namespace.""" + + +class DeploymentConfigsPreviewDurableObjectNamespaces(BaseModel): + do_binding: Optional[DeploymentConfigsPreviewDurableObjectNamespacesDoBinding] = FieldInfo( + alias="DO_BINDING", default=None + ) + """Durabble Object binding.""" + + +class DeploymentConfigsPreviewEnvVarsEnvironmentVariable(BaseModel): + type: Optional[Literal["plain_text", "secret_text"]] = None + """The type of environment variable (plain text or secret)""" + + value: Optional[str] = None + """Environment variable value.""" + + +class DeploymentConfigsPreviewEnvVars(BaseModel): + environment_variable: Optional[DeploymentConfigsPreviewEnvVarsEnvironmentVariable] = FieldInfo( + alias="ENVIRONMENT_VARIABLE", default=None + ) + """Environment variable.""" + + +class DeploymentConfigsPreviewHyperdriveBindingsHyperdrive(BaseModel): + id: Optional[str] = None + + +class DeploymentConfigsPreviewHyperdriveBindings(BaseModel): + hyperdrive: Optional[DeploymentConfigsPreviewHyperdriveBindingsHyperdrive] = FieldInfo( + alias="HYPERDRIVE", default=None + ) + """Hyperdrive binding.""" + + +class DeploymentConfigsPreviewKVNamespacesKVBinding(BaseModel): + namespace_id: Optional[str] = None + """ID of the KV namespace.""" + + +class DeploymentConfigsPreviewKVNamespaces(BaseModel): + kv_binding: Optional[DeploymentConfigsPreviewKVNamespacesKVBinding] = FieldInfo(alias="KV_BINDING", default=None) + """KV binding.""" + + +class DeploymentConfigsPreviewMTLSCertificatesMTLS(BaseModel): + certificate_id: Optional[str] = None + + +class DeploymentConfigsPreviewMTLSCertificates(BaseModel): + mtls: Optional[DeploymentConfigsPreviewMTLSCertificatesMTLS] = FieldInfo(alias="MTLS", default=None) + """mTLS binding.""" + + +class DeploymentConfigsPreviewPlacement(BaseModel): + mode: Optional[str] = None + """Placement mode.""" + + +class DeploymentConfigsPreviewQueueProducersQueueProducerBinding(BaseModel): + name: Optional[str] = None + """Name of the Queue.""" + + +class DeploymentConfigsPreviewQueueProducers(BaseModel): + queue_producer_binding: Optional[DeploymentConfigsPreviewQueueProducersQueueProducerBinding] = FieldInfo( + alias="QUEUE_PRODUCER_BINDING", default=None + ) + """Queue Producer binding.""" + + +class DeploymentConfigsPreviewR2BucketsR2Binding(BaseModel): + name: Optional[str] = None + """Name of the R2 bucket.""" + + +class DeploymentConfigsPreviewR2Buckets(BaseModel): + r2_binding: Optional[DeploymentConfigsPreviewR2BucketsR2Binding] = FieldInfo(alias="R2_BINDING", default=None) + """R2 binding.""" + + +class DeploymentConfigsPreviewServicesServiceBinding(BaseModel): + entrypoint: Optional[str] = None + """The entrypoint to bind to.""" + + environment: Optional[str] = None + """The Service environment.""" + + service: Optional[str] = None + """The Service name.""" + + +class DeploymentConfigsPreviewServices(BaseModel): + service_binding: Optional[DeploymentConfigsPreviewServicesServiceBinding] = FieldInfo( + alias="SERVICE_BINDING", default=None + ) + """Service binding.""" + + +class DeploymentConfigsPreviewVectorizeBindingsVectorize(BaseModel): + index_name: Optional[str] = None + + +class DeploymentConfigsPreviewVectorizeBindings(BaseModel): + vectorize: Optional[DeploymentConfigsPreviewVectorizeBindingsVectorize] = FieldInfo(alias="VECTORIZE", default=None) + """Vectorize binding.""" + + +class DeploymentConfigsPreview(BaseModel): + ai_bindings: Optional[DeploymentConfigsPreviewAIBindings] = None + """Constellation bindings used for Pages Functions.""" + + analytics_engine_datasets: Optional[DeploymentConfigsPreviewAnalyticsEngineDatasets] = None + """Analytics Engine bindings used for Pages Functions.""" + + browsers: Optional[DeploymentConfigsPreviewBrowsers] = None + """Browser bindings used for Pages Functions.""" + + compatibility_date: Optional[str] = None + """Compatibility date used for Pages Functions.""" + + compatibility_flags: Optional[List[object]] = None + """Compatibility flags used for Pages Functions.""" + + d1_databases: Optional[DeploymentConfigsPreviewD1Databases] = None + """D1 databases used for Pages Functions.""" + + durable_object_namespaces: Optional[DeploymentConfigsPreviewDurableObjectNamespaces] = None + """Durabble Object namespaces used for Pages Functions.""" + + env_vars: Optional[DeploymentConfigsPreviewEnvVars] = None + """Environment variables for build configs.""" + + hyperdrive_bindings: Optional[DeploymentConfigsPreviewHyperdriveBindings] = None + """Hyperdrive bindings used for Pages Functions.""" + + kv_namespaces: Optional[DeploymentConfigsPreviewKVNamespaces] = None + """KV namespaces used for Pages Functions.""" + + mtls_certificates: Optional[DeploymentConfigsPreviewMTLSCertificates] = None + """mTLS bindings used for Pages Functions.""" + + placement: Optional[DeploymentConfigsPreviewPlacement] = None + """Placement setting used for Pages Functions.""" + + queue_producers: Optional[DeploymentConfigsPreviewQueueProducers] = None + """Queue Producer bindings used for Pages Functions.""" + + r2_buckets: Optional[DeploymentConfigsPreviewR2Buckets] = None + """R2 buckets used for Pages Functions.""" + + services: Optional[DeploymentConfigsPreviewServices] = None + """Services used for Pages Functions.""" + + vectorize_bindings: Optional[DeploymentConfigsPreviewVectorizeBindings] = None + """Vectorize bindings used for Pages Functions.""" + + +class DeploymentConfigsProductionAIBindingsAIBinding(BaseModel): + project_id: Optional[object] = None + + +class DeploymentConfigsProductionAIBindings(BaseModel): + ai_binding: Optional[DeploymentConfigsProductionAIBindingsAIBinding] = FieldInfo(alias="AI_BINDING", default=None) + """AI binding.""" + + +class DeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding(BaseModel): + dataset: Optional[str] = None + """Name of the dataset.""" + + +class DeploymentConfigsProductionAnalyticsEngineDatasets(BaseModel): + analytics_engine_binding: Optional[ + DeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding + ] = FieldInfo(alias="ANALYTICS_ENGINE_BINDING", default=None) + """Analytics Engine binding.""" + + +class DeploymentConfigsProductionBrowsers(BaseModel): + browser: Optional[object] = FieldInfo(alias="BROWSER", default=None) + """Browser binding.""" + + +class DeploymentConfigsProductionD1DatabasesD1Binding(BaseModel): + id: Optional[str] = None + """UUID of the D1 database.""" + + +class DeploymentConfigsProductionD1Databases(BaseModel): + d1_binding: Optional[DeploymentConfigsProductionD1DatabasesD1Binding] = FieldInfo(alias="D1_BINDING", default=None) + """D1 binding.""" + + +class DeploymentConfigsProductionDurableObjectNamespacesDoBinding(BaseModel): + namespace_id: Optional[str] = None + """ID of the Durabble Object namespace.""" + + +class DeploymentConfigsProductionDurableObjectNamespaces(BaseModel): + do_binding: Optional[DeploymentConfigsProductionDurableObjectNamespacesDoBinding] = FieldInfo( + alias="DO_BINDING", default=None + ) + """Durabble Object binding.""" + + +class DeploymentConfigsProductionEnvVarsEnvironmentVariable(BaseModel): + type: Optional[Literal["plain_text", "secret_text"]] = None + """The type of environment variable (plain text or secret)""" + + value: Optional[str] = None + """Environment variable value.""" + + +class DeploymentConfigsProductionEnvVars(BaseModel): + environment_variable: Optional[DeploymentConfigsProductionEnvVarsEnvironmentVariable] = FieldInfo( + alias="ENVIRONMENT_VARIABLE", default=None + ) + """Environment variable.""" + + +class DeploymentConfigsProductionHyperdriveBindingsHyperdrive(BaseModel): + id: Optional[str] = None + + +class DeploymentConfigsProductionHyperdriveBindings(BaseModel): + hyperdrive: Optional[DeploymentConfigsProductionHyperdriveBindingsHyperdrive] = FieldInfo( + alias="HYPERDRIVE", default=None + ) + """Hyperdrive binding.""" + + +class DeploymentConfigsProductionKVNamespacesKVBinding(BaseModel): + namespace_id: Optional[str] = None + """ID of the KV namespace.""" + + +class DeploymentConfigsProductionKVNamespaces(BaseModel): + kv_binding: Optional[DeploymentConfigsProductionKVNamespacesKVBinding] = FieldInfo(alias="KV_BINDING", default=None) + """KV binding.""" + + +class DeploymentConfigsProductionMTLSCertificatesMTLS(BaseModel): + certificate_id: Optional[str] = None + + +class DeploymentConfigsProductionMTLSCertificates(BaseModel): + mtls: Optional[DeploymentConfigsProductionMTLSCertificatesMTLS] = FieldInfo(alias="MTLS", default=None) + """mTLS binding.""" + + +class DeploymentConfigsProductionPlacement(BaseModel): + mode: Optional[str] = None + """Placement mode.""" + + +class DeploymentConfigsProductionQueueProducersQueueProducerBinding(BaseModel): + name: Optional[str] = None + """Name of the Queue.""" + + +class DeploymentConfigsProductionQueueProducers(BaseModel): + queue_producer_binding: Optional[DeploymentConfigsProductionQueueProducersQueueProducerBinding] = FieldInfo( + alias="QUEUE_PRODUCER_BINDING", default=None + ) + """Queue Producer binding.""" + + +class DeploymentConfigsProductionR2BucketsR2Binding(BaseModel): + name: Optional[str] = None + """Name of the R2 bucket.""" + + +class DeploymentConfigsProductionR2Buckets(BaseModel): + r2_binding: Optional[DeploymentConfigsProductionR2BucketsR2Binding] = FieldInfo(alias="R2_BINDING", default=None) + """R2 binding.""" + + +class DeploymentConfigsProductionServicesServiceBinding(BaseModel): + entrypoint: Optional[str] = None + """The entrypoint to bind to.""" + + environment: Optional[str] = None + """The Service environment.""" + + service: Optional[str] = None + """The Service name.""" + + +class DeploymentConfigsProductionServices(BaseModel): + service_binding: Optional[DeploymentConfigsProductionServicesServiceBinding] = FieldInfo( + alias="SERVICE_BINDING", default=None + ) + """Service binding.""" + + +class DeploymentConfigsProductionVectorizeBindingsVectorize(BaseModel): + index_name: Optional[str] = None + + +class DeploymentConfigsProductionVectorizeBindings(BaseModel): + vectorize: Optional[DeploymentConfigsProductionVectorizeBindingsVectorize] = FieldInfo( + alias="VECTORIZE", default=None + ) + """Vectorize binding.""" + + +class DeploymentConfigsProduction(BaseModel): + ai_bindings: Optional[DeploymentConfigsProductionAIBindings] = None + """Constellation bindings used for Pages Functions.""" + + analytics_engine_datasets: Optional[DeploymentConfigsProductionAnalyticsEngineDatasets] = None + """Analytics Engine bindings used for Pages Functions.""" + + browsers: Optional[DeploymentConfigsProductionBrowsers] = None + """Browser bindings used for Pages Functions.""" + + compatibility_date: Optional[str] = None + """Compatibility date used for Pages Functions.""" + + compatibility_flags: Optional[List[object]] = None + """Compatibility flags used for Pages Functions.""" + + d1_databases: Optional[DeploymentConfigsProductionD1Databases] = None + """D1 databases used for Pages Functions.""" + + durable_object_namespaces: Optional[DeploymentConfigsProductionDurableObjectNamespaces] = None + """Durabble Object namespaces used for Pages Functions.""" + + env_vars: Optional[DeploymentConfigsProductionEnvVars] = None + """Environment variables for build configs.""" + + hyperdrive_bindings: Optional[DeploymentConfigsProductionHyperdriveBindings] = None + """Hyperdrive bindings used for Pages Functions.""" + + kv_namespaces: Optional[DeploymentConfigsProductionKVNamespaces] = None + """KV namespaces used for Pages Functions.""" + + mtls_certificates: Optional[DeploymentConfigsProductionMTLSCertificates] = None + """mTLS bindings used for Pages Functions.""" + + placement: Optional[DeploymentConfigsProductionPlacement] = None + """Placement setting used for Pages Functions.""" + + queue_producers: Optional[DeploymentConfigsProductionQueueProducers] = None + """Queue Producer bindings used for Pages Functions.""" + + r2_buckets: Optional[DeploymentConfigsProductionR2Buckets] = None + """R2 buckets used for Pages Functions.""" + + services: Optional[DeploymentConfigsProductionServices] = None + """Services used for Pages Functions.""" + + vectorize_bindings: Optional[DeploymentConfigsProductionVectorizeBindings] = None + """Vectorize bindings used for Pages Functions.""" + + +class DeploymentConfigs(BaseModel): + preview: Optional[DeploymentConfigsPreview] = None + """Configs for preview deploys.""" + + production: Optional[DeploymentConfigsProduction] = None + """Configs for production deploys.""" + + +class Project(BaseModel): + id: Optional[str] = None + """Id of the project.""" + + build_config: Optional[BuildConfig] = None + """Configs for the project build process.""" + + canonical_deployment: Optional[Deployment] = None + + created_on: Optional[datetime] = None + """When the project was created.""" + + deployment_configs: Optional[DeploymentConfigs] = None + """Configs for deployments in a project.""" + + domains: Optional[List[object]] = None + """A list of associated custom domains for the project.""" + + latest_deployment: Optional[Deployment] = None + + name: Optional[str] = None + """Name of the project.""" + + production_branch: Optional[str] = None + """Production branch of the project. Used to identify production deployments.""" + + source: Optional[object] = None + + subdomain: Optional[str] = None + """The Cloudflare subdomain associated with the project.""" diff --git a/src/cloudflare/types/pages/project_create_params.py b/src/cloudflare/types/pages/project_create_params.py index 2963483f662..8951be5327a 100644 --- a/src/cloudflare/types/pages/project_create_params.py +++ b/src/cloudflare/types/pages/project_create_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, Annotated, TypedDict from ..._utils import PropertyInfo -from .pages_deployments_param import PagesDeploymentsParam +from .deployment_param import DeploymentParam __all__ = [ "ProjectCreateParams", @@ -76,12 +76,12 @@ class ProjectCreateParams(TypedDict, total=False): build_config: BuildConfig """Configs for the project build process.""" - canonical_deployment: PagesDeploymentsParam + canonical_deployment: DeploymentParam deployment_configs: DeploymentConfigs """Configs for deployments in a project.""" - latest_deployment: PagesDeploymentsParam + latest_deployment: DeploymentParam name: str """Name of the project.""" diff --git a/src/cloudflare/types/pages/project_delete_params.py b/src/cloudflare/types/pages/project_delete_params.py new file mode 100644 index 00000000000..44dbbf9b81b --- /dev/null +++ b/src/cloudflare/types/pages/project_delete_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__ = ["ProjectDeleteParams"] + + +class ProjectDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/pages/projects/__init__.py b/src/cloudflare/types/pages/projects/__init__.py index 5a41f0031a9..366cfd847a0 100644 --- a/src/cloudflare/types/pages/projects/__init__.py +++ b/src/cloudflare/types/pages/projects/__init__.py @@ -2,9 +2,14 @@ from __future__ import annotations +from .domain_edit_params import DomainEditParams as DomainEditParams from .domain_get_response import DomainGetResponse as DomainGetResponse from .domain_create_params import DomainCreateParams as DomainCreateParams +from .domain_delete_params import DomainDeleteParams as DomainDeleteParams from .domain_edit_response import DomainEditResponse as DomainEditResponse from .deployment_list_params import DeploymentListParams as DeploymentListParams from .domain_create_response import DomainCreateResponse as DomainCreateResponse +from .deployment_retry_params import DeploymentRetryParams as DeploymentRetryParams from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams +from .deployment_delete_params import DeploymentDeleteParams as DeploymentDeleteParams +from .deployment_rollback_params import DeploymentRollbackParams as DeploymentRollbackParams diff --git a/src/cloudflare/types/pages/projects/deployment_delete_params.py b/src/cloudflare/types/pages/projects/deployment_delete_params.py new file mode 100644 index 00000000000..35a65c5a3c5 --- /dev/null +++ b/src/cloudflare/types/pages/projects/deployment_delete_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__ = ["DeploymentDeleteParams"] + + +class DeploymentDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + project_name: Required[str] + """Name of the project.""" + + body: Required[object] diff --git a/src/cloudflare/types/pages/projects/deployment_retry_params.py b/src/cloudflare/types/pages/projects/deployment_retry_params.py new file mode 100644 index 00000000000..298b72a3331 --- /dev/null +++ b/src/cloudflare/types/pages/projects/deployment_retry_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__ = ["DeploymentRetryParams"] + + +class DeploymentRetryParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + project_name: Required[str] + """Name of the project.""" + + body: Required[object] diff --git a/src/cloudflare/types/pages/projects/deployment_rollback_params.py b/src/cloudflare/types/pages/projects/deployment_rollback_params.py new file mode 100644 index 00000000000..078d237c493 --- /dev/null +++ b/src/cloudflare/types/pages/projects/deployment_rollback_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__ = ["DeploymentRollbackParams"] + + +class DeploymentRollbackParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + project_name: Required[str] + """Name of the project.""" + + body: Required[object] diff --git a/src/cloudflare/types/pages/projects/domain_delete_params.py b/src/cloudflare/types/pages/projects/domain_delete_params.py new file mode 100644 index 00000000000..efd44ea1f18 --- /dev/null +++ b/src/cloudflare/types/pages/projects/domain_delete_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__ = ["DomainDeleteParams"] + + +class DomainDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + project_name: Required[str] + """Name of the project.""" + + body: Required[object] diff --git a/src/cloudflare/types/pages/projects/domain_edit_params.py b/src/cloudflare/types/pages/projects/domain_edit_params.py new file mode 100644 index 00000000000..ff0dda3be6b --- /dev/null +++ b/src/cloudflare/types/pages/projects/domain_edit_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__ = ["DomainEditParams"] + + +class DomainEditParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + project_name: Required[str] + """Name of the project.""" + + body: Required[object] diff --git a/src/cloudflare/types/pages/stage.py b/src/cloudflare/types/pages/stage.py new file mode 100644 index 00000000000..cd33c72ebe5 --- /dev/null +++ b/src/cloudflare/types/pages/stage.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__ = ["Stage"] + + +class Stage(BaseModel): + ended_on: Optional[datetime] = None + """When the stage ended.""" + + name: Optional[str] = None + """The current build stage.""" + + started_on: Optional[datetime] = None + """When the stage started.""" + + status: Optional[str] = None + """State of the current stage.""" diff --git a/src/cloudflare/types/pages/stage_param.py b/src/cloudflare/types/pages/stage_param.py new file mode 100644 index 00000000000..c7fef7d063a --- /dev/null +++ b/src/cloudflare/types/pages/stage_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["StageParam"] + + +class StageParam(TypedDict, total=False): + name: str + """The current build stage.""" diff --git a/src/cloudflare/types/pcap_create_params.py b/src/cloudflare/types/pcap_create_params.py deleted file mode 100644 index cedbeb11578..00000000000 --- a/src/cloudflare/types/pcap_create_params.py +++ /dev/null @@ -1,115 +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, TypedDict - -__all__ = [ - "PCAPCreateParams", - "MagicVisibilityPCAPsRequestSimple", - "MagicVisibilityPCAPsRequestSimpleFilterV1", - "MagicVisibilityPCAPsRequestFull", - "MagicVisibilityPCAPsRequestFullFilterV1", -] - - -class MagicVisibilityPCAPsRequestSimple(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - packet_limit: Required[float] - """The limit of packets contained in a packet capture.""" - - system: Required[Literal["magic-transit"]] - """The system used to collect packet captures.""" - - time_limit: Required[float] - """The packet capture duration in seconds.""" - - type: Required[Literal["simple", "full"]] - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - filter_v1: MagicVisibilityPCAPsRequestSimpleFilterV1 - """The packet capture filter. When this field is empty, all packets are captured.""" - - -class MagicVisibilityPCAPsRequestSimpleFilterV1(TypedDict, total=False): - destination_address: str - """The destination IP address of the packet.""" - - destination_port: float - """The destination port of the packet.""" - - protocol: float - """The protocol number of the packet.""" - - source_address: str - """The source IP address of the packet.""" - - source_port: float - """The source port of the packet.""" - - -class MagicVisibilityPCAPsRequestFull(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - colo_name: Required[str] - """The name of the data center used for the packet capture. - - This can be a specific colo (ord02) or a multi-colo name (ORD). This field only - applies to `full` packet captures. - """ - - destination_conf: Required[str] - """The full URI for the bucket. This field only applies to `full` packet captures.""" - - system: Required[Literal["magic-transit"]] - """The system used to collect packet captures.""" - - time_limit: Required[float] - """The packet capture duration in seconds.""" - - type: Required[Literal["simple", "full"]] - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - byte_limit: float - """The maximum number of bytes to capture. - - This field only applies to `full` packet captures. - """ - - filter_v1: MagicVisibilityPCAPsRequestFullFilterV1 - """The packet capture filter. When this field is empty, all packets are captured.""" - - packet_limit: float - """The limit of packets contained in a packet capture.""" - - -class MagicVisibilityPCAPsRequestFullFilterV1(TypedDict, total=False): - destination_address: str - """The destination IP address of the packet.""" - - destination_port: float - """The destination port of the packet.""" - - protocol: float - """The protocol number of the packet.""" - - source_address: str - """The source IP address of the packet.""" - - source_port: float - """The source port of the packet.""" - - -PCAPCreateParams = Union[MagicVisibilityPCAPsRequestSimple, MagicVisibilityPCAPsRequestFull] diff --git a/src/cloudflare/types/pcap_create_response.py b/src/cloudflare/types/pcap_create_response.py deleted file mode 100644 index 4aa10aaf09e..00000000000 --- a/src/cloudflare/types/pcap_create_response.py +++ /dev/null @@ -1,135 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = [ - "PCAPCreateResponse", - "MagicVisibilityPCAPsResponseSimple", - "MagicVisibilityPCAPsResponseSimpleFilterV1", - "MagicVisibilityPCAPsResponseFull", - "MagicVisibilityPCAPsResponseFullFilterV1", -] - - -class MagicVisibilityPCAPsResponseSimpleFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsResponseSimple(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - filter_v1: Optional[MagicVisibilityPCAPsResponseSimpleFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -class MagicVisibilityPCAPsResponseFullFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsResponseFull(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - byte_limit: Optional[float] = None - """The maximum number of bytes to capture. - - This field only applies to `full` packet captures. - """ - - colo_name: Optional[str] = None - """The name of the data center used for the packet capture. - - This can be a specific colo (ord02) or a multi-colo name (ORD). This field only - applies to `full` packet captures. - """ - - destination_conf: Optional[str] = None - """The full URI for the bucket. This field only applies to `full` packet captures.""" - - error_message: Optional[str] = None - """An error message that describes why the packet capture failed. - - This field only applies to `full` packet captures. - """ - - filter_v1: Optional[MagicVisibilityPCAPsResponseFullFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -PCAPCreateResponse = Union[MagicVisibilityPCAPsResponseSimple, MagicVisibilityPCAPsResponseFull] diff --git a/src/cloudflare/types/pcap_get_response.py b/src/cloudflare/types/pcap_get_response.py deleted file mode 100644 index 1f663f6308e..00000000000 --- a/src/cloudflare/types/pcap_get_response.py +++ /dev/null @@ -1,135 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = [ - "PCAPGetResponse", - "MagicVisibilityPCAPsResponseSimple", - "MagicVisibilityPCAPsResponseSimpleFilterV1", - "MagicVisibilityPCAPsResponseFull", - "MagicVisibilityPCAPsResponseFullFilterV1", -] - - -class MagicVisibilityPCAPsResponseSimpleFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsResponseSimple(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - filter_v1: Optional[MagicVisibilityPCAPsResponseSimpleFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -class MagicVisibilityPCAPsResponseFullFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsResponseFull(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - byte_limit: Optional[float] = None - """The maximum number of bytes to capture. - - This field only applies to `full` packet captures. - """ - - colo_name: Optional[str] = None - """The name of the data center used for the packet capture. - - This can be a specific colo (ord02) or a multi-colo name (ORD). This field only - applies to `full` packet captures. - """ - - destination_conf: Optional[str] = None - """The full URI for the bucket. This field only applies to `full` packet captures.""" - - error_message: Optional[str] = None - """An error message that describes why the packet capture failed. - - This field only applies to `full` packet captures. - """ - - filter_v1: Optional[MagicVisibilityPCAPsResponseFullFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -PCAPGetResponse = Union[MagicVisibilityPCAPsResponseSimple, MagicVisibilityPCAPsResponseFull] diff --git a/src/cloudflare/types/pcap_list_response.py b/src/cloudflare/types/pcap_list_response.py deleted file mode 100644 index ef6ac672c55..00000000000 --- a/src/cloudflare/types/pcap_list_response.py +++ /dev/null @@ -1,135 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = [ - "PCAPListResponse", - "MagicVisibilityPCAPsResponseSimple", - "MagicVisibilityPCAPsResponseSimpleFilterV1", - "MagicVisibilityPCAPsResponseFull", - "MagicVisibilityPCAPsResponseFullFilterV1", -] - - -class MagicVisibilityPCAPsResponseSimpleFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsResponseSimple(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - filter_v1: Optional[MagicVisibilityPCAPsResponseSimpleFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -class MagicVisibilityPCAPsResponseFullFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsResponseFull(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - byte_limit: Optional[float] = None - """The maximum number of bytes to capture. - - This field only applies to `full` packet captures. - """ - - colo_name: Optional[str] = None - """The name of the data center used for the packet capture. - - This can be a specific colo (ord02) or a multi-colo name (ORD). This field only - applies to `full` packet captures. - """ - - destination_conf: Optional[str] = None - """The full URI for the bucket. This field only applies to `full` packet captures.""" - - error_message: Optional[str] = None - """An error message that describes why the packet capture failed. - - This field only applies to `full` packet captures. - """ - - filter_v1: Optional[MagicVisibilityPCAPsResponseFullFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -PCAPListResponse = Union[MagicVisibilityPCAPsResponseSimple, MagicVisibilityPCAPsResponseFull] diff --git a/src/cloudflare/types/pcaps/__init__.py b/src/cloudflare/types/pcaps/__init__.py index 5357e816d6f..771b78a0850 100644 --- a/src/cloudflare/types/pcaps/__init__.py +++ b/src/cloudflare/types/pcaps/__init__.py @@ -2,7 +2,14 @@ from __future__ import annotations +from .pcap import PCAP as PCAP +from .ownership import Ownership as Ownership +from .pcap_filter import PCAPFilter as PCAPFilter +from .pcap_filter_param import PCAPFilterParam as PCAPFilterParam +from .pcap_get_response import PCAPGetResponse as PCAPGetResponse +from .pcap_create_params import PCAPCreateParams as PCAPCreateParams +from .pcap_list_response import PCAPListResponse as PCAPListResponse +from .pcap_create_response import PCAPCreateResponse as PCAPCreateResponse from .ownership_get_response import OwnershipGetResponse as OwnershipGetResponse from .ownership_create_params import OwnershipCreateParams as OwnershipCreateParams from .ownership_validate_params import OwnershipValidateParams as OwnershipValidateParams -from .magic_visibility_pcaps_ownership import MagicVisibilityPCAPsOwnership as MagicVisibilityPCAPsOwnership diff --git a/src/cloudflare/types/pcaps/magic_visibility_pcaps_ownership.py b/src/cloudflare/types/pcaps/magic_visibility_pcaps_ownership.py deleted file mode 100644 index c5d731fba7a..00000000000 --- a/src/cloudflare/types/pcaps/magic_visibility_pcaps_ownership.py +++ /dev/null @@ -1,28 +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__ = ["MagicVisibilityPCAPsOwnership"] - - -class MagicVisibilityPCAPsOwnership(BaseModel): - id: str - """The bucket ID associated with the packet captures API.""" - - destination_conf: str - """The full URI for the bucket. This field only applies to `full` packet captures.""" - - filename: str - """The ownership challenge filename stored in the bucket.""" - - status: Literal["pending", "success", "failed"] - """The status of the ownership challenge. Can be pending, success or failed.""" - - submitted: str - """The RFC 3339 timestamp when the bucket was added to packet captures API.""" - - validated: Optional[str] = None - """The RFC 3339 timestamp when the bucket was validated.""" diff --git a/src/cloudflare/types/pcaps/ownership.py b/src/cloudflare/types/pcaps/ownership.py new file mode 100644 index 00000000000..2373d88a8dc --- /dev/null +++ b/src/cloudflare/types/pcaps/ownership.py @@ -0,0 +1,28 @@ +# 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__ = ["Ownership"] + + +class Ownership(BaseModel): + id: str + """The bucket ID associated with the packet captures API.""" + + destination_conf: str + """The full URI for the bucket. This field only applies to `full` packet captures.""" + + filename: str + """The ownership challenge filename stored in the bucket.""" + + status: Literal["pending", "success", "failed"] + """The status of the ownership challenge. Can be pending, success or failed.""" + + submitted: str + """The RFC 3339 timestamp when the bucket was added to packet captures API.""" + + validated: Optional[str] = None + """The RFC 3339 timestamp when the bucket was validated.""" diff --git a/src/cloudflare/types/pcaps/ownership_get_response.py b/src/cloudflare/types/pcaps/ownership_get_response.py index 20cef9bfb08..69cf682a9cf 100644 --- a/src/cloudflare/types/pcaps/ownership_get_response.py +++ b/src/cloudflare/types/pcaps/ownership_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .magic_visibility_pcaps_ownership import MagicVisibilityPCAPsOwnership +from .ownership import Ownership __all__ = ["OwnershipGetResponse"] -OwnershipGetResponse = List[MagicVisibilityPCAPsOwnership] +OwnershipGetResponse = List[Ownership] diff --git a/src/cloudflare/types/pcaps/pcap.py b/src/cloudflare/types/pcaps/pcap.py new file mode 100644 index 00000000000..849b466015c --- /dev/null +++ b/src/cloudflare/types/pcaps/pcap.py @@ -0,0 +1,40 @@ +# 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 .pcap_filter import PCAPFilter + +__all__ = ["PCAP"] + + +class PCAP(BaseModel): + id: Optional[str] = None + """The ID for the packet capture.""" + + filter_v1: Optional[PCAPFilter] = None + """The packet capture filter. When this field is empty, all packets are captured.""" + + status: Optional[ + Literal[ + "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" + ] + ] = None + """The status of the packet capture request.""" + + submitted: Optional[str] = None + """The RFC 3339 timestamp when the packet capture was created.""" + + system: Optional[Literal["magic-transit"]] = None + """The system used to collect packet captures.""" + + time_limit: Optional[float] = None + """The packet capture duration in seconds.""" + + type: Optional[Literal["simple", "full"]] = None + """The type of packet capture. + + `Simple` captures sampled packets, and `full` captures entire payloads and + non-sampled packets. + """ diff --git a/src/cloudflare/types/pcaps/pcap_create_params.py b/src/cloudflare/types/pcaps/pcap_create_params.py new file mode 100644 index 00000000000..b7d82a16252 --- /dev/null +++ b/src/cloudflare/types/pcaps/pcap_create_params.py @@ -0,0 +1,77 @@ +# 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, TypedDict + +from .pcap_filter_param import PCAPFilterParam + +__all__ = ["PCAPCreateParams", "MagicVisibilityPCAPsRequestSimple", "MagicVisibilityPCAPsRequestFull"] + + +class MagicVisibilityPCAPsRequestSimple(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + packet_limit: Required[float] + """The limit of packets contained in a packet capture.""" + + system: Required[Literal["magic-transit"]] + """The system used to collect packet captures.""" + + time_limit: Required[float] + """The packet capture duration in seconds.""" + + type: Required[Literal["simple", "full"]] + """The type of packet capture. + + `Simple` captures sampled packets, and `full` captures entire payloads and + non-sampled packets. + """ + + filter_v1: PCAPFilterParam + """The packet capture filter. When this field is empty, all packets are captured.""" + + +class MagicVisibilityPCAPsRequestFull(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + colo_name: Required[str] + """The name of the data center used for the packet capture. + + This can be a specific colo (ord02) or a multi-colo name (ORD). This field only + applies to `full` packet captures. + """ + + destination_conf: Required[str] + """The full URI for the bucket. This field only applies to `full` packet captures.""" + + system: Required[Literal["magic-transit"]] + """The system used to collect packet captures.""" + + time_limit: Required[float] + """The packet capture duration in seconds.""" + + type: Required[Literal["simple", "full"]] + """The type of packet capture. + + `Simple` captures sampled packets, and `full` captures entire payloads and + non-sampled packets. + """ + + byte_limit: float + """The maximum number of bytes to capture. + + This field only applies to `full` packet captures. + """ + + filter_v1: PCAPFilterParam + """The packet capture filter. When this field is empty, all packets are captured.""" + + packet_limit: float + """The limit of packets contained in a packet capture.""" + + +PCAPCreateParams = Union[MagicVisibilityPCAPsRequestSimple, MagicVisibilityPCAPsRequestFull] diff --git a/src/cloudflare/types/pcaps/pcap_create_response.py b/src/cloudflare/types/pcaps/pcap_create_response.py new file mode 100644 index 00000000000..8517c09d2dd --- /dev/null +++ b/src/cloudflare/types/pcaps/pcap_create_response.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from .pcap import PCAP +from ..._models import BaseModel +from .pcap_filter import PCAPFilter + +__all__ = ["PCAPCreateResponse", "MagicVisibilityPCAPsResponseFull"] + + +class MagicVisibilityPCAPsResponseFull(BaseModel): + id: Optional[str] = None + """The ID for the packet capture.""" + + byte_limit: Optional[float] = None + """The maximum number of bytes to capture. + + This field only applies to `full` packet captures. + """ + + colo_name: Optional[str] = None + """The name of the data center used for the packet capture. + + This can be a specific colo (ord02) or a multi-colo name (ORD). This field only + applies to `full` packet captures. + """ + + destination_conf: Optional[str] = None + """The full URI for the bucket. This field only applies to `full` packet captures.""" + + error_message: Optional[str] = None + """An error message that describes why the packet capture failed. + + This field only applies to `full` packet captures. + """ + + filter_v1: Optional[PCAPFilter] = None + """The packet capture filter. When this field is empty, all packets are captured.""" + + status: Optional[ + Literal[ + "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" + ] + ] = None + """The status of the packet capture request.""" + + submitted: Optional[str] = None + """The RFC 3339 timestamp when the packet capture was created.""" + + system: Optional[Literal["magic-transit"]] = None + """The system used to collect packet captures.""" + + time_limit: Optional[float] = None + """The packet capture duration in seconds.""" + + type: Optional[Literal["simple", "full"]] = None + """The type of packet capture. + + `Simple` captures sampled packets, and `full` captures entire payloads and + non-sampled packets. + """ + + +PCAPCreateResponse = Union[PCAP, MagicVisibilityPCAPsResponseFull] diff --git a/src/cloudflare/types/pcaps/pcap_filter.py b/src/cloudflare/types/pcaps/pcap_filter.py new file mode 100644 index 00000000000..edc1d8d3402 --- /dev/null +++ b/src/cloudflare/types/pcaps/pcap_filter.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["PCAPFilter"] + + +class PCAPFilter(BaseModel): + destination_address: Optional[str] = None + """The destination IP address of the packet.""" + + destination_port: Optional[float] = None + """The destination port of the packet.""" + + protocol: Optional[float] = None + """The protocol number of the packet.""" + + source_address: Optional[str] = None + """The source IP address of the packet.""" + + source_port: Optional[float] = None + """The source port of the packet.""" diff --git a/src/cloudflare/types/pcaps/pcap_filter_param.py b/src/cloudflare/types/pcaps/pcap_filter_param.py new file mode 100644 index 00000000000..5808477bfc9 --- /dev/null +++ b/src/cloudflare/types/pcaps/pcap_filter_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["PCAPFilterParam"] + + +class PCAPFilterParam(TypedDict, total=False): + destination_address: str + """The destination IP address of the packet.""" + + destination_port: float + """The destination port of the packet.""" + + protocol: float + """The protocol number of the packet.""" + + source_address: str + """The source IP address of the packet.""" + + source_port: float + """The source port of the packet.""" diff --git a/src/cloudflare/types/pcaps/pcap_get_response.py b/src/cloudflare/types/pcaps/pcap_get_response.py new file mode 100644 index 00000000000..4b4ad1e9783 --- /dev/null +++ b/src/cloudflare/types/pcaps/pcap_get_response.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from .pcap import PCAP +from ..._models import BaseModel +from .pcap_filter import PCAPFilter + +__all__ = ["PCAPGetResponse", "MagicVisibilityPCAPsResponseFull"] + + +class MagicVisibilityPCAPsResponseFull(BaseModel): + id: Optional[str] = None + """The ID for the packet capture.""" + + byte_limit: Optional[float] = None + """The maximum number of bytes to capture. + + This field only applies to `full` packet captures. + """ + + colo_name: Optional[str] = None + """The name of the data center used for the packet capture. + + This can be a specific colo (ord02) or a multi-colo name (ORD). This field only + applies to `full` packet captures. + """ + + destination_conf: Optional[str] = None + """The full URI for the bucket. This field only applies to `full` packet captures.""" + + error_message: Optional[str] = None + """An error message that describes why the packet capture failed. + + This field only applies to `full` packet captures. + """ + + filter_v1: Optional[PCAPFilter] = None + """The packet capture filter. When this field is empty, all packets are captured.""" + + status: Optional[ + Literal[ + "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" + ] + ] = None + """The status of the packet capture request.""" + + submitted: Optional[str] = None + """The RFC 3339 timestamp when the packet capture was created.""" + + system: Optional[Literal["magic-transit"]] = None + """The system used to collect packet captures.""" + + time_limit: Optional[float] = None + """The packet capture duration in seconds.""" + + type: Optional[Literal["simple", "full"]] = None + """The type of packet capture. + + `Simple` captures sampled packets, and `full` captures entire payloads and + non-sampled packets. + """ + + +PCAPGetResponse = Union[PCAP, MagicVisibilityPCAPsResponseFull] diff --git a/src/cloudflare/types/pcaps/pcap_list_response.py b/src/cloudflare/types/pcaps/pcap_list_response.py new file mode 100644 index 00000000000..ff1039713b4 --- /dev/null +++ b/src/cloudflare/types/pcaps/pcap_list_response.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from .pcap import PCAP +from ..._models import BaseModel +from .pcap_filter import PCAPFilter + +__all__ = ["PCAPListResponse", "MagicVisibilityPCAPsResponseFull"] + + +class MagicVisibilityPCAPsResponseFull(BaseModel): + id: Optional[str] = None + """The ID for the packet capture.""" + + byte_limit: Optional[float] = None + """The maximum number of bytes to capture. + + This field only applies to `full` packet captures. + """ + + colo_name: Optional[str] = None + """The name of the data center used for the packet capture. + + This can be a specific colo (ord02) or a multi-colo name (ORD). This field only + applies to `full` packet captures. + """ + + destination_conf: Optional[str] = None + """The full URI for the bucket. This field only applies to `full` packet captures.""" + + error_message: Optional[str] = None + """An error message that describes why the packet capture failed. + + This field only applies to `full` packet captures. + """ + + filter_v1: Optional[PCAPFilter] = None + """The packet capture filter. When this field is empty, all packets are captured.""" + + status: Optional[ + Literal[ + "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" + ] + ] = None + """The status of the packet capture request.""" + + submitted: Optional[str] = None + """The RFC 3339 timestamp when the packet capture was created.""" + + system: Optional[Literal["magic-transit"]] = None + """The system used to collect packet captures.""" + + time_limit: Optional[float] = None + """The packet capture duration in seconds.""" + + type: Optional[Literal["simple", "full"]] = None + """The type of packet capture. + + `Simple` captures sampled packets, and `full` captures entire payloads and + non-sampled packets. + """ + + +PCAPListResponse = Union[PCAP, MagicVisibilityPCAPsResponseFull] diff --git a/src/cloudflare/types/plans/__init__.py b/src/cloudflare/types/plans/__init__.py new file mode 100644 index 00000000000..372a262131e --- /dev/null +++ b/src/cloudflare/types/plans/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .available_rate_plan import AvailableRatePlan as AvailableRatePlan diff --git a/src/cloudflare/types/available_rate_plan.py b/src/cloudflare/types/plans/available_rate_plan.py similarity index 97% rename from src/cloudflare/types/available_rate_plan.py rename to src/cloudflare/types/plans/available_rate_plan.py index be2c65e3f7c..b898fa23ed7 100644 --- a/src/cloudflare/types/available_rate_plan.py +++ b/src/cloudflare/types/plans/available_rate_plan.py @@ -3,7 +3,7 @@ from typing import Optional from typing_extensions import Literal -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["AvailableRatePlan"] diff --git a/src/cloudflare/types/queue_create_response.py b/src/cloudflare/types/queue_create_response.py deleted file mode 100644 index 1a1c3b8d771..00000000000 --- a/src/cloudflare/types/queue_create_response.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 .._models import BaseModel - -__all__ = ["QueueCreateResponse"] - - -class QueueCreateResponse(BaseModel): - created_on: Optional[object] = None - - modified_on: Optional[object] = None - - queue_id: Optional[object] = None - - queue_name: Optional[str] = None diff --git a/src/cloudflare/types/queue_get_response.py b/src/cloudflare/types/queue_get_response.py deleted file mode 100644 index c7b3d43ad11..00000000000 --- a/src/cloudflare/types/queue_get_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .._models import BaseModel - -__all__ = ["QueueGetResponse"] - - -class QueueGetResponse(BaseModel): - consumers: Optional[object] = None - - consumers_total_count: Optional[object] = None - - created_on: Optional[object] = None - - modified_on: Optional[object] = None - - producers: Optional[object] = None - - producers_total_count: Optional[object] = None - - queue_id: Optional[str] = None - - queue_name: Optional[str] = None diff --git a/src/cloudflare/types/queue_list_response.py b/src/cloudflare/types/queue_list_response.py deleted file mode 100644 index 1ccfe1e6e71..00000000000 --- a/src/cloudflare/types/queue_list_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .._models import BaseModel - -__all__ = ["QueueListResponse"] - - -class QueueListResponse(BaseModel): - consumers: Optional[object] = None - - consumers_total_count: Optional[object] = None - - created_on: Optional[object] = None - - modified_on: Optional[object] = None - - producers: Optional[object] = None - - producers_total_count: Optional[object] = None - - queue_id: Optional[str] = None - - queue_name: Optional[str] = None diff --git a/src/cloudflare/types/queue_update_response.py b/src/cloudflare/types/queue_update_response.py deleted file mode 100644 index 032b4f22b2d..00000000000 --- a/src/cloudflare/types/queue_update_response.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 .._models import BaseModel - -__all__ = ["QueueUpdateResponse"] - - -class QueueUpdateResponse(BaseModel): - created_on: Optional[object] = None - - modified_on: Optional[object] = None - - queue_id: Optional[object] = None - - queue_name: Optional[str] = None diff --git a/src/cloudflare/types/queues/__init__.py b/src/cloudflare/types/queues/__init__.py index bd13e89010f..8546525267f 100644 --- a/src/cloudflare/types/queues/__init__.py +++ b/src/cloudflare/types/queues/__init__.py @@ -2,12 +2,21 @@ from __future__ import annotations +from .queue import Queue as Queue +from .consumer import Consumer as Consumer +from .queue_created import QueueCreated as QueueCreated +from .queue_updated import QueueUpdated as QueueUpdated from .message_ack_params import MessageAckParams as MessageAckParams from .message_pull_params import MessagePullParams as MessagePullParams +from .queue_create_params import QueueCreateParams as QueueCreateParams +from .queue_delete_params import QueueDeleteParams as QueueDeleteParams +from .queue_update_params import QueueUpdateParams as QueueUpdateParams from .message_ack_response import MessageAckResponse as MessageAckResponse from .consumer_get_response import ConsumerGetResponse as ConsumerGetResponse from .message_pull_response import MessagePullResponse as MessagePullResponse +from .queue_delete_response import QueueDeleteResponse as QueueDeleteResponse from .consumer_create_params import ConsumerCreateParams as ConsumerCreateParams +from .consumer_delete_params import ConsumerDeleteParams as ConsumerDeleteParams from .consumer_update_params import ConsumerUpdateParams as ConsumerUpdateParams from .consumer_create_response import ConsumerCreateResponse as ConsumerCreateResponse from .consumer_delete_response import ConsumerDeleteResponse as ConsumerDeleteResponse diff --git a/src/cloudflare/types/queues/consumer.py b/src/cloudflare/types/queues/consumer.py new file mode 100644 index 00000000000..86bd8eefd02 --- /dev/null +++ b/src/cloudflare/types/queues/consumer.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Consumer", "Settings"] + + +class Settings(BaseModel): + batch_size: Optional[float] = None + """The maximum number of messages to include in a batch""" + + max_retries: Optional[float] = None + + max_wait_time_ms: Optional[float] = None + + +class Consumer(BaseModel): + created_on: Optional[object] = None + + environment: Optional[object] = None + + queue_name: Optional[object] = None + + service: Optional[object] = None + + settings: Optional[Settings] = None diff --git a/src/cloudflare/types/queues/consumer_delete_params.py b/src/cloudflare/types/queues/consumer_delete_params.py new file mode 100644 index 00000000000..86cb9120b32 --- /dev/null +++ b/src/cloudflare/types/queues/consumer_delete_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__ = ["ConsumerDeleteParams"] + + +class ConsumerDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + queue_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/queues/consumer_get_response.py b/src/cloudflare/types/queues/consumer_get_response.py index 8a00b17a127..a812d05b30b 100644 --- a/src/cloudflare/types/queues/consumer_get_response.py +++ b/src/cloudflare/types/queues/consumer_get_response.py @@ -1,31 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List -from ..._models import BaseModel +from .consumer import Consumer -__all__ = ["ConsumerGetResponse", "ConsumerGetResponseItem", "ConsumerGetResponseItemSettings"] +__all__ = ["ConsumerGetResponse"] - -class ConsumerGetResponseItemSettings(BaseModel): - batch_size: Optional[float] = None - """The maximum number of messages to include in a batch""" - - max_retries: Optional[float] = None - - max_wait_time_ms: Optional[float] = None - - -class ConsumerGetResponseItem(BaseModel): - created_on: Optional[object] = None - - environment: Optional[object] = None - - queue_name: Optional[object] = None - - service: Optional[object] = None - - settings: Optional[ConsumerGetResponseItemSettings] = None - - -ConsumerGetResponse = List[ConsumerGetResponseItem] +ConsumerGetResponse = List[Consumer] diff --git a/src/cloudflare/types/queues/queue.py b/src/cloudflare/types/queues/queue.py new file mode 100644 index 00000000000..433e60db89c --- /dev/null +++ b/src/cloudflare/types/queues/queue.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Queue"] + + +class Queue(BaseModel): + consumers: Optional[object] = None + + consumers_total_count: Optional[object] = None + + created_on: Optional[object] = None + + modified_on: Optional[object] = None + + producers: Optional[object] = None + + producers_total_count: Optional[object] = None + + queue_id: Optional[str] = None + + queue_name: Optional[str] = None diff --git a/src/cloudflare/types/queue_create_params.py b/src/cloudflare/types/queues/queue_create_params.py similarity index 100% rename from src/cloudflare/types/queue_create_params.py rename to src/cloudflare/types/queues/queue_create_params.py diff --git a/src/cloudflare/types/queues/queue_created.py b/src/cloudflare/types/queues/queue_created.py new file mode 100644 index 00000000000..e2fe296ed31 --- /dev/null +++ b/src/cloudflare/types/queues/queue_created.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["QueueCreated"] + + +class QueueCreated(BaseModel): + created_on: Optional[object] = None + + modified_on: Optional[object] = None + + queue_id: Optional[object] = None + + queue_name: Optional[str] = None diff --git a/src/cloudflare/types/queues/queue_delete_params.py b/src/cloudflare/types/queues/queue_delete_params.py new file mode 100644 index 00000000000..0130ee1660d --- /dev/null +++ b/src/cloudflare/types/queues/queue_delete_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__ = ["QueueDeleteParams"] + + +class QueueDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/queue_delete_response.py b/src/cloudflare/types/queues/queue_delete_response.py similarity index 100% rename from src/cloudflare/types/queue_delete_response.py rename to src/cloudflare/types/queues/queue_delete_response.py diff --git a/src/cloudflare/types/queue_update_params.py b/src/cloudflare/types/queues/queue_update_params.py similarity index 100% rename from src/cloudflare/types/queue_update_params.py rename to src/cloudflare/types/queues/queue_update_params.py diff --git a/src/cloudflare/types/queues/queue_updated.py b/src/cloudflare/types/queues/queue_updated.py new file mode 100644 index 00000000000..a6cc5cde5e7 --- /dev/null +++ b/src/cloudflare/types/queues/queue_updated.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["QueueUpdated"] + + +class QueueUpdated(BaseModel): + created_on: Optional[object] = None + + modified_on: Optional[object] = None + + queue_id: Optional[object] = None + + queue_name: Optional[str] = None diff --git a/src/cloudflare/types/r2/__init__.py b/src/cloudflare/types/r2/__init__.py index b81647cdd68..9227a53be92 100644 --- a/src/cloudflare/types/r2/__init__.py +++ b/src/cloudflare/types/r2/__init__.py @@ -2,8 +2,9 @@ from __future__ import annotations -from .r2_sippy import R2Sippy as R2Sippy -from .r2_bucket import R2Bucket as R2Bucket +from .sippy import Sippy as Sippy +from .bucket import Bucket as Bucket +from .provider import Provider as Provider from .bucket_list_params import BucketListParams as BucketListParams from .sippy_update_params import SippyUpdateParams as SippyUpdateParams from .bucket_create_params import BucketCreateParams as BucketCreateParams diff --git a/src/cloudflare/types/r2/bucket.py b/src/cloudflare/types/r2/bucket.py new file mode 100644 index 00000000000..d473140b23d --- /dev/null +++ b/src/cloudflare/types/r2/bucket.py @@ -0,0 +1,19 @@ +# 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__ = ["Bucket"] + + +class Bucket(BaseModel): + creation_date: Optional[str] = None + """Creation timestamp""" + + location: Optional[Literal["apac", "eeur", "enam", "weur", "wnam"]] = None + """Location of the bucket""" + + name: Optional[str] = None + """Name of the bucket""" diff --git a/src/cloudflare/types/r2/provider.py b/src/cloudflare/types/r2/provider.py new file mode 100644 index 00000000000..a33e66d2fcc --- /dev/null +++ b/src/cloudflare/types/r2/provider.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["Provider"] + +Provider = Literal["r2"] diff --git a/src/cloudflare/types/r2/r2_bucket.py b/src/cloudflare/types/r2/r2_bucket.py deleted file mode 100644 index a85cfe4df01..00000000000 --- a/src/cloudflare/types/r2/r2_bucket.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 typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["R2Bucket"] - - -class R2Bucket(BaseModel): - creation_date: Optional[str] = None - """Creation timestamp""" - - location: Optional[Literal["apac", "eeur", "enam", "weur", "wnam"]] = None - """Location of the bucket""" - - name: Optional[str] = None - """Name of the bucket""" diff --git a/src/cloudflare/types/r2/r2_sippy.py b/src/cloudflare/types/r2/r2_sippy.py deleted file mode 100644 index ec7049bf536..00000000000 --- a/src/cloudflare/types/r2/r2_sippy.py +++ /dev/null @@ -1,43 +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 pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["R2Sippy", "Destination", "Source"] - - -class Destination(BaseModel): - access_key_id: Optional[str] = FieldInfo(alias="accessKeyId", default=None) - """ID of the Cloudflare API token used when writing objects to this bucket""" - - account: Optional[str] = None - - bucket: Optional[str] = None - """Name of the bucket on the provider""" - - provider: Optional[Literal["r2"]] = None - - -class Source(BaseModel): - bucket: Optional[str] = None - """Name of the bucket on the provider""" - - provider: Optional[Literal["aws", "gcs"]] = None - - region: Optional[str] = None - """Region where the bucket resides (AWS only)""" - - -class R2Sippy(BaseModel): - destination: Optional[Destination] = None - """Details about the configured destination bucket""" - - enabled: Optional[bool] = None - """State of Sippy for this bucket""" - - source: Optional[Source] = None - """Details about the configured source bucket""" diff --git a/src/cloudflare/types/r2/sippy.py b/src/cloudflare/types/r2/sippy.py new file mode 100644 index 00000000000..89d9935106f --- /dev/null +++ b/src/cloudflare/types/r2/sippy.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .provider import Provider +from ..._models import BaseModel + +__all__ = ["Sippy", "Destination", "Source"] + + +class Destination(BaseModel): + access_key_id: Optional[str] = FieldInfo(alias="accessKeyId", default=None) + """ID of the Cloudflare API token used when writing objects to this bucket""" + + account: Optional[str] = None + + bucket: Optional[str] = None + """Name of the bucket on the provider""" + + provider: Optional[Provider] = None + + +class Source(BaseModel): + bucket: Optional[str] = None + """Name of the bucket on the provider""" + + provider: Optional[Literal["aws", "gcs"]] = None + + region: Optional[str] = None + """Region where the bucket resides (AWS only)""" + + +class Sippy(BaseModel): + destination: Optional[Destination] = None + """Details about the configured destination bucket""" + + enabled: Optional[bool] = None + """State of Sippy for this bucket""" + + source: Optional[Source] = None + """Details about the configured source bucket""" diff --git a/src/cloudflare/types/r2/sippy_update_params.py b/src/cloudflare/types/r2/sippy_update_params.py index 7730cbef116..e51a01c0921 100644 --- a/src/cloudflare/types/r2/sippy_update_params.py +++ b/src/cloudflare/types/r2/sippy_update_params.py @@ -6,6 +6,7 @@ from typing_extensions import Literal, Required, Annotated, TypedDict from ..._utils import PropertyInfo +from .provider import Provider __all__ = [ "SippyUpdateParams", @@ -40,7 +41,7 @@ class R2EnableSippyAwsDestination(TypedDict, total=False): this token to the bucket you're enabling Sippy for. """ - provider: Literal["r2"] + provider: Provider secret_access_key: Annotated[str, PropertyInfo(alias="secretAccessKey")] """ @@ -91,7 +92,7 @@ class R2EnableSippyGcsDestination(TypedDict, total=False): this token to the bucket you're enabling Sippy for. """ - provider: Literal["r2"] + provider: Provider secret_access_key: Annotated[str, PropertyInfo(alias="secretAccessKey")] """ diff --git a/src/cloudflare/types/radar/__init__.py b/src/cloudflare/types/radar/__init__.py index 368692fe253..cacf1e11ece 100644 --- a/src/cloudflare/types/radar/__init__.py +++ b/src/cloudflare/types/radar/__init__.py @@ -4,9 +4,11 @@ from .entity_get_params import EntityGetParams as EntityGetParams from .dataset_get_params import DatasetGetParams as DatasetGetParams +from .radar_email_series import RadarEmailSeries as RadarEmailSeries from .ranking_top_params import RankingTopParams as RankingTopParams from .dataset_list_params import DatasetListParams as DatasetListParams from .entity_get_response import EntityGetResponse as EntityGetResponse +from .radar_email_summary import RadarEmailSummary as RadarEmailSummary from .dataset_get_response import DatasetGetResponse as DatasetGetResponse from .ranking_top_response import RankingTopResponse as RankingTopResponse from .search_global_params import SearchGlobalParams as SearchGlobalParams diff --git a/src/cloudflare/types/radar/attacks/layer3/top_industry_response.py b/src/cloudflare/types/radar/attacks/layer3/top_industry_response.py index c24a6c7ee84..26420c75ec6 100644 --- a/src/cloudflare/types/radar/attacks/layer3/top_industry_response.py +++ b/src/cloudflare/types/radar/attacks/layer3/top_industry_response.py @@ -6,8 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...http.browser import Browser -__all__ = ["TopIndustryResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", "Top0"] +__all__ = ["TopIndustryResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -48,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class TopIndustryResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/attacks/layer3/top_vertical_response.py b/src/cloudflare/types/radar/attacks/layer3/top_vertical_response.py index 1b9d9238ed2..5b236c7c4ae 100644 --- a/src/cloudflare/types/radar/attacks/layer3/top_vertical_response.py +++ b/src/cloudflare/types/radar/attacks/layer3/top_vertical_response.py @@ -6,8 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...http.browser import Browser -__all__ = ["TopVerticalResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", "Top0"] +__all__ = ["TopVerticalResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -48,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class TopVerticalResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/attacks/layer3_timeseries_response.py b/src/cloudflare/types/radar/attacks/layer3_timeseries_response.py index 5eabca1efe4..c83a6af9578 100644 --- a/src/cloudflare/types/radar/attacks/layer3_timeseries_response.py +++ b/src/cloudflare/types/radar/attacks/layer3_timeseries_response.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List +from datetime import datetime from ...._models import BaseModel @@ -8,7 +9,7 @@ class Serie0(BaseModel): - timestamps: List[str] + timestamps: List[datetime] values: List[str] diff --git a/src/cloudflare/types/radar/attacks/layer7/top_industry_response.py b/src/cloudflare/types/radar/attacks/layer7/top_industry_response.py index c24a6c7ee84..26420c75ec6 100644 --- a/src/cloudflare/types/radar/attacks/layer7/top_industry_response.py +++ b/src/cloudflare/types/radar/attacks/layer7/top_industry_response.py @@ -6,8 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...http.browser import Browser -__all__ = ["TopIndustryResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", "Top0"] +__all__ = ["TopIndustryResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -48,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class TopIndustryResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/attacks/layer7/top_vertical_response.py b/src/cloudflare/types/radar/attacks/layer7/top_vertical_response.py index 1b9d9238ed2..5b236c7c4ae 100644 --- a/src/cloudflare/types/radar/attacks/layer7/top_vertical_response.py +++ b/src/cloudflare/types/radar/attacks/layer7/top_vertical_response.py @@ -6,8 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...http.browser import Browser -__all__ = ["TopVerticalResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", "Top0"] +__all__ = ["TopVerticalResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -48,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class TopVerticalResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/bgp/__init__.py b/src/cloudflare/types/radar/bgp/__init__.py index 2a16e34dabb..d1bc53367b3 100644 --- a/src/cloudflare/types/radar/bgp/__init__.py +++ b/src/cloudflare/types/radar/bgp/__init__.py @@ -3,16 +3,12 @@ from __future__ import annotations from .route_moas_params import RouteMoasParams as RouteMoasParams -from .leak_events_params import LeakEventsParams as LeakEventsParams from .route_stats_params import RouteStatsParams as RouteStatsParams from .route_moas_response import RouteMoasResponse as RouteMoasResponse from .route_pfx2as_params import RoutePfx2asParams as RoutePfx2asParams from .top_prefixes_params import TopPrefixesParams as TopPrefixesParams -from .hijack_events_params import HijackEventsParams as HijackEventsParams -from .leak_events_response import LeakEventsResponse as LeakEventsResponse from .route_stats_response import RouteStatsResponse as RouteStatsResponse from .route_pfx2as_response import RoutePfx2asResponse as RoutePfx2asResponse from .top_prefixes_response import TopPrefixesResponse as TopPrefixesResponse -from .hijack_events_response import HijackEventsResponse as HijackEventsResponse from .route_timeseries_params import RouteTimeseriesParams as RouteTimeseriesParams from .route_timeseries_response import RouteTimeseriesResponse as RouteTimeseriesResponse diff --git a/src/cloudflare/types/radar/bgp/hijack_events_params.py b/src/cloudflare/types/radar/bgp/hijack_events_params.py deleted file mode 100644 index 8c22813f0bf..00000000000 --- a/src/cloudflare/types/radar/bgp/hijack_events_params.py +++ /dev/null @@ -1,83 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Literal, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["HijackEventsParams"] - - -class HijackEventsParams(TypedDict, total=False): - date_end: Annotated[Union[str, datetime], PropertyInfo(alias="dateEnd", format="iso8601")] - """End of the date range (inclusive).""" - - date_range: Annotated[ - Literal[ - "1d", - "2d", - "7d", - "14d", - "28d", - "12w", - "24w", - "52w", - "1dControl", - "2dControl", - "7dControl", - "14dControl", - "28dControl", - "12wControl", - "24wControl", - ], - PropertyInfo(alias="dateRange"), - ] - """ - Shorthand date ranges for the last X days - use when you don't need specific - start and end dates. - """ - - date_start: Annotated[Union[str, datetime], PropertyInfo(alias="dateStart", format="iso8601")] - """Start of the date range (inclusive).""" - - event_id: Annotated[int, PropertyInfo(alias="eventId")] - """The unique identifier of a event""" - - format: Literal["JSON", "CSV"] - """Format results are returned in.""" - - hijacker_asn: Annotated[int, PropertyInfo(alias="hijackerAsn")] - """The potential hijacker AS of a BGP hijack event""" - - involved_asn: Annotated[int, PropertyInfo(alias="involvedAsn")] - """The potential hijacker or victim AS of a BGP hijack event""" - - involved_country: Annotated[str, PropertyInfo(alias="involvedCountry")] - """The country code of the potential hijacker or victim AS of a BGP hijack event""" - - max_confidence: Annotated[int, PropertyInfo(alias="maxConfidence")] - """The maximum confidence score to filter events (1-4 low, 5-7 mid, 8+ high)""" - - min_confidence: Annotated[int, PropertyInfo(alias="minConfidence")] - """The minimum confidence score to filter events (1-4 low, 5-7 mid, 8+ high)""" - - page: int - """Current page number, starting from 1""" - - per_page: int - """Number of entries per page""" - - prefix: str - """The prefix hijacked during a BGP hijack event""" - - sort_by: Annotated[Literal["ID", "TIME", "CONFIDENCE"], PropertyInfo(alias="sortBy")] - """Sort events by field""" - - sort_order: Annotated[Literal["ASC", "DESC"], PropertyInfo(alias="sortOrder")] - """Sort order""" - - victim_asn: Annotated[int, PropertyInfo(alias="victimAsn")] - """The potential victim AS of a BGP hijack event""" diff --git a/src/cloudflare/types/radar/bgp/hijack_events_response.py b/src/cloudflare/types/radar/bgp/hijack_events_response.py deleted file mode 100644 index 2ef0458dd56..00000000000 --- a/src/cloudflare/types/radar/bgp/hijack_events_response.py +++ /dev/null @@ -1,67 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel - -__all__ = ["HijackEventsResponse", "ASNInfo", "Event", "EventTag"] - - -class ASNInfo(BaseModel): - asn: int - - country_code: str - - org_name: str - - -class EventTag(BaseModel): - name: str - - score: int - - -class Event(BaseModel): - id: int - - confidence_score: int - - duration: int - - event_type: int - - hijack_msgs_count: int - - hijacker_asn: int - - hijacker_country: str - - is_stale: bool - - max_hijack_ts: str - - max_msg_ts: str - - min_hijack_ts: str - - on_going_count: int - - peer_asns: List[int] - - peer_ip_count: int - - prefixes: List[str] - - tags: List[EventTag] - - victim_asns: List[int] - - victim_countries: List[str] - - -class HijackEventsResponse(BaseModel): - asn_info: List[ASNInfo] - - events: List[Event] - - total_monitors: int diff --git a/src/cloudflare/types/radar/bgp/hijacks/__init__.py b/src/cloudflare/types/radar/bgp/hijacks/__init__.py new file mode 100644 index 00000000000..c9d802c01db --- /dev/null +++ b/src/cloudflare/types/radar/bgp/hijacks/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .event_list_params import EventListParams as EventListParams +from .event_list_response import EventListResponse as EventListResponse diff --git a/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py b/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py new file mode 100644 index 00000000000..8bceb23cf4f --- /dev/null +++ b/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py @@ -0,0 +1,83 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ....._utils import PropertyInfo + +__all__ = ["EventListParams"] + + +class EventListParams(TypedDict, total=False): + date_end: Annotated[Union[str, datetime], PropertyInfo(alias="dateEnd", format="iso8601")] + """End of the date range (inclusive).""" + + date_range: Annotated[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ], + PropertyInfo(alias="dateRange"), + ] + """ + Shorthand date ranges for the last X days - use when you don't need specific + start and end dates. + """ + + date_start: Annotated[Union[str, datetime], PropertyInfo(alias="dateStart", format="iso8601")] + """Start of the date range (inclusive).""" + + event_id: Annotated[int, PropertyInfo(alias="eventId")] + """The unique identifier of a event""" + + format: Literal["JSON", "CSV"] + """Format results are returned in.""" + + hijacker_asn: Annotated[int, PropertyInfo(alias="hijackerAsn")] + """The potential hijacker AS of a BGP hijack event""" + + involved_asn: Annotated[int, PropertyInfo(alias="involvedAsn")] + """The potential hijacker or victim AS of a BGP hijack event""" + + involved_country: Annotated[str, PropertyInfo(alias="involvedCountry")] + """The country code of the potential hijacker or victim AS of a BGP hijack event""" + + max_confidence: Annotated[int, PropertyInfo(alias="maxConfidence")] + """The maximum confidence score to filter events (1-4 low, 5-7 mid, 8+ high)""" + + min_confidence: Annotated[int, PropertyInfo(alias="minConfidence")] + """The minimum confidence score to filter events (1-4 low, 5-7 mid, 8+ high)""" + + page: int + """Current page number, starting from 1""" + + per_page: int + """Number of entries per page""" + + prefix: str + """The prefix hijacked during a BGP hijack event""" + + sort_by: Annotated[Literal["ID", "TIME", "CONFIDENCE"], PropertyInfo(alias="sortBy")] + """Sort events by field""" + + sort_order: Annotated[Literal["ASC", "DESC"], PropertyInfo(alias="sortOrder")] + """Sort order""" + + victim_asn: Annotated[int, PropertyInfo(alias="victimAsn")] + """The potential victim AS of a BGP hijack event""" diff --git a/src/cloudflare/types/radar/bgp/hijacks/event_list_response.py b/src/cloudflare/types/radar/bgp/hijacks/event_list_response.py new file mode 100644 index 00000000000..1d28e50b2f5 --- /dev/null +++ b/src/cloudflare/types/radar/bgp/hijacks/event_list_response.py @@ -0,0 +1,85 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel + +__all__ = ["EventListResponse", "Result", "ResultASNInfo", "ResultEvent", "ResultEventTag", "ResultInfo"] + + +class ResultASNInfo(BaseModel): + asn: int + + country_code: str + + org_name: str + + +class ResultEventTag(BaseModel): + name: str + + score: int + + +class ResultEvent(BaseModel): + id: int + + confidence_score: int + + duration: int + + event_type: int + + hijack_msgs_count: int + + hijacker_asn: int + + hijacker_country: str + + is_stale: bool + + max_hijack_ts: str + + max_msg_ts: str + + min_hijack_ts: str + + on_going_count: int + + peer_asns: List[int] + + peer_ip_count: int + + prefixes: List[str] + + tags: List[ResultEventTag] + + victim_asns: List[int] + + victim_countries: List[str] + + +class Result(BaseModel): + asn_info: List[ResultASNInfo] + + events: List[ResultEvent] + + total_monitors: int + + +class ResultInfo(BaseModel): + count: int + + page: int + + per_page: int + + total_count: int + + +class EventListResponse(BaseModel): + result: Result + + result_info: ResultInfo + + success: bool diff --git a/src/cloudflare/types/radar/bgp/leak_events_params.py b/src/cloudflare/types/radar/bgp/leak_events_params.py deleted file mode 100644 index 17d0e4a0e09..00000000000 --- a/src/cloudflare/types/radar/bgp/leak_events_params.py +++ /dev/null @@ -1,71 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Literal, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["LeakEventsParams"] - - -class LeakEventsParams(TypedDict, total=False): - date_end: Annotated[Union[str, datetime], PropertyInfo(alias="dateEnd", format="iso8601")] - """End of the date range (inclusive).""" - - date_range: Annotated[ - Literal[ - "1d", - "2d", - "7d", - "14d", - "28d", - "12w", - "24w", - "52w", - "1dControl", - "2dControl", - "7dControl", - "14dControl", - "28dControl", - "12wControl", - "24wControl", - ], - PropertyInfo(alias="dateRange"), - ] - """ - Shorthand date ranges for the last X days - use when you don't need specific - start and end dates. - """ - - date_start: Annotated[Union[str, datetime], PropertyInfo(alias="dateStart", format="iso8601")] - """Start of the date range (inclusive).""" - - event_id: Annotated[int, PropertyInfo(alias="eventId")] - """The unique identifier of a event""" - - format: Literal["JSON", "CSV"] - """Format results are returned in.""" - - involved_asn: Annotated[int, PropertyInfo(alias="involvedAsn")] - """ASN that is causing or affected by a route leak event""" - - involved_country: Annotated[str, PropertyInfo(alias="involvedCountry")] - """Country code of a involved ASN in a route leak event""" - - leak_asn: Annotated[int, PropertyInfo(alias="leakAsn")] - """The leaking AS of a route leak event""" - - page: int - """Current page number, starting from 1""" - - per_page: int - """Number of entries per page""" - - sort_by: Annotated[Literal["ID", "LEAKS", "PEERS", "PREFIXES", "ORIGINS", "TIME"], PropertyInfo(alias="sortBy")] - """Sort events by field""" - - sort_order: Annotated[Literal["ASC", "DESC"], PropertyInfo(alias="sortOrder")] - """Sort order""" diff --git a/src/cloudflare/types/radar/bgp/leak_events_response.py b/src/cloudflare/types/radar/bgp/leak_events_response.py deleted file mode 100644 index 664756ba64e..00000000000 --- a/src/cloudflare/types/radar/bgp/leak_events_response.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel - -__all__ = ["LeakEventsResponse", "ASNInfo", "Event"] - - -class ASNInfo(BaseModel): - asn: int - - country_code: str - - org_name: str - - -class Event(BaseModel): - id: int - - countries: List[str] - - detected_ts: str - - finished: bool - - leak_asn: int - - leak_count: int - - leak_seg: List[int] - - leak_type: int - - max_ts: str - - min_ts: str - - origin_count: int - - peer_count: int - - prefix_count: int - - -class LeakEventsResponse(BaseModel): - asn_info: List[ASNInfo] - - events: List[Event] diff --git a/src/cloudflare/types/radar/bgp/leaks/__init__.py b/src/cloudflare/types/radar/bgp/leaks/__init__.py new file mode 100644 index 00000000000..c9d802c01db --- /dev/null +++ b/src/cloudflare/types/radar/bgp/leaks/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .event_list_params import EventListParams as EventListParams +from .event_list_response import EventListResponse as EventListResponse diff --git a/src/cloudflare/types/radar/bgp/leaks/event_list_params.py b/src/cloudflare/types/radar/bgp/leaks/event_list_params.py new file mode 100644 index 00000000000..c67ff410944 --- /dev/null +++ b/src/cloudflare/types/radar/bgp/leaks/event_list_params.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ....._utils import PropertyInfo + +__all__ = ["EventListParams"] + + +class EventListParams(TypedDict, total=False): + date_end: Annotated[Union[str, datetime], PropertyInfo(alias="dateEnd", format="iso8601")] + """End of the date range (inclusive).""" + + date_range: Annotated[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ], + PropertyInfo(alias="dateRange"), + ] + """ + Shorthand date ranges for the last X days - use when you don't need specific + start and end dates. + """ + + date_start: Annotated[Union[str, datetime], PropertyInfo(alias="dateStart", format="iso8601")] + """Start of the date range (inclusive).""" + + event_id: Annotated[int, PropertyInfo(alias="eventId")] + """The unique identifier of a event""" + + format: Literal["JSON", "CSV"] + """Format results are returned in.""" + + involved_asn: Annotated[int, PropertyInfo(alias="involvedAsn")] + """ASN that is causing or affected by a route leak event""" + + involved_country: Annotated[str, PropertyInfo(alias="involvedCountry")] + """Country code of a involved ASN in a route leak event""" + + leak_asn: Annotated[int, PropertyInfo(alias="leakAsn")] + """The leaking AS of a route leak event""" + + page: int + """Current page number, starting from 1""" + + per_page: int + """Number of entries per page""" + + sort_by: Annotated[Literal["ID", "LEAKS", "PEERS", "PREFIXES", "ORIGINS", "TIME"], PropertyInfo(alias="sortBy")] + """Sort events by field""" + + sort_order: Annotated[Literal["ASC", "DESC"], PropertyInfo(alias="sortOrder")] + """Sort order""" diff --git a/src/cloudflare/types/radar/bgp/leaks/event_list_response.py b/src/cloudflare/types/radar/bgp/leaks/event_list_response.py new file mode 100644 index 00000000000..2a5447b0399 --- /dev/null +++ b/src/cloudflare/types/radar/bgp/leaks/event_list_response.py @@ -0,0 +1,67 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel + +__all__ = ["EventListResponse", "Result", "ResultASNInfo", "ResultEvent", "ResultInfo"] + + +class ResultASNInfo(BaseModel): + asn: int + + country_code: str + + org_name: str + + +class ResultEvent(BaseModel): + id: int + + countries: List[str] + + detected_ts: str + + finished: bool + + leak_asn: int + + leak_count: int + + leak_seg: List[int] + + leak_type: int + + max_ts: str + + min_ts: str + + origin_count: int + + peer_count: int + + prefix_count: int + + +class Result(BaseModel): + asn_info: List[ResultASNInfo] + + events: List[ResultEvent] + + +class ResultInfo(BaseModel): + count: int + + page: int + + per_page: int + + total_count: int + + +class EventListResponse(BaseModel): + result: Result + + result_info: ResultInfo + + success: bool diff --git a/src/cloudflare/types/radar/bgp/route_timeseries_params.py b/src/cloudflare/types/radar/bgp/route_timeseries_params.py index 6bdf01690de..55d51e97031 100644 --- a/src/cloudflare/types/radar/bgp/route_timeseries_params.py +++ b/src/cloudflare/types/radar/bgp/route_timeseries_params.py @@ -49,5 +49,8 @@ class RouteTimeseriesParams(TypedDict, total=False): format: Literal["JSON", "CSV"] """Format results are returned in.""" + include_delay: Annotated[bool, PropertyInfo(alias="includeDelay")] + """Include data delay meta information""" + location: str """Location Alpha2 code.""" diff --git a/src/cloudflare/types/radar/email/routing/summary_arc_response.py b/src/cloudflare/types/radar/email/routing/summary_arc_response.py index 4060b61777b..7b709e6be09 100644 --- a/src/cloudflare/types/radar/email/routing/summary_arc_response.py +++ b/src/cloudflare/types/radar/email/routing/summary_arc_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_summary import RadarEmailSummary -__all__ = [ - "SummaryARCResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummaryARCResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,15 +51,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - fail: str = FieldInfo(alias="FAIL") - - none: str = FieldInfo(alias="NONE") - - pass_: str = FieldInfo(alias="PASS") - - class SummaryARCResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: RadarEmailSummary diff --git a/src/cloudflare/types/radar/email/routing/summary_dkim_response.py b/src/cloudflare/types/radar/email/routing/summary_dkim_response.py index 703c34db85d..3baed82617a 100644 --- a/src/cloudflare/types/radar/email/routing/summary_dkim_response.py +++ b/src/cloudflare/types/radar/email/routing/summary_dkim_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_summary import RadarEmailSummary -__all__ = [ - "SummaryDKIMResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummaryDKIMResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,15 +51,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - fail: str = FieldInfo(alias="FAIL") - - none: str = FieldInfo(alias="NONE") - - pass_: str = FieldInfo(alias="PASS") - - class SummaryDKIMResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: RadarEmailSummary diff --git a/src/cloudflare/types/radar/email/routing/summary_dmarc_response.py b/src/cloudflare/types/radar/email/routing/summary_dmarc_response.py index 05b679b110d..311673b6b74 100644 --- a/src/cloudflare/types/radar/email/routing/summary_dmarc_response.py +++ b/src/cloudflare/types/radar/email/routing/summary_dmarc_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_summary import RadarEmailSummary -__all__ = [ - "SummaryDMARCResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummaryDMARCResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,15 +51,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - fail: str = FieldInfo(alias="FAIL") - - none: str = FieldInfo(alias="NONE") - - pass_: str = FieldInfo(alias="PASS") - - class SummaryDMARCResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: RadarEmailSummary diff --git a/src/cloudflare/types/radar/email/routing/summary_spf_response.py b/src/cloudflare/types/radar/email/routing/summary_spf_response.py index b379f447301..0c62ac60f1f 100644 --- a/src/cloudflare/types/radar/email/routing/summary_spf_response.py +++ b/src/cloudflare/types/radar/email/routing/summary_spf_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_summary import RadarEmailSummary -__all__ = [ - "SummarySPFResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummarySPFResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,15 +51,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - fail: str = FieldInfo(alias="FAIL") - - none: str = FieldInfo(alias="NONE") - - pass_: str = FieldInfo(alias="PASS") - - class SummarySPFResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: RadarEmailSummary diff --git a/src/cloudflare/types/radar/email/routing/timeseries_group_arc_response.py b/src/cloudflare/types/radar/email/routing/timeseries_group_arc_response.py index a719097fa78..68e15b2ca03 100644 --- a/src/cloudflare/types/radar/email/routing/timeseries_group_arc_response.py +++ b/src/cloudflare/types/radar/email/routing/timeseries_group_arc_response.py @@ -1,23 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_series import RadarEmailSeries -__all__ = ["TimeseriesGroupARCResponse", "Serie0"] - - -class Serie0(BaseModel): - fail: List[str] = FieldInfo(alias="FAIL") - - none: List[str] = FieldInfo(alias="NONE") - - pass_: List[str] = FieldInfo(alias="PASS") +__all__ = ["TimeseriesGroupARCResponse"] class TimeseriesGroupARCResponse(BaseModel): meta: object - serie_0: Serie0 + serie_0: RadarEmailSeries diff --git a/src/cloudflare/types/radar/email/routing/timeseries_group_dkim_response.py b/src/cloudflare/types/radar/email/routing/timeseries_group_dkim_response.py index 2431244bb4c..0495c34b231 100644 --- a/src/cloudflare/types/radar/email/routing/timeseries_group_dkim_response.py +++ b/src/cloudflare/types/radar/email/routing/timeseries_group_dkim_response.py @@ -1,23 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_series import RadarEmailSeries -__all__ = ["TimeseriesGroupDKIMResponse", "Serie0"] - - -class Serie0(BaseModel): - fail: List[str] = FieldInfo(alias="FAIL") - - none: List[str] = FieldInfo(alias="NONE") - - pass_: List[str] = FieldInfo(alias="PASS") +__all__ = ["TimeseriesGroupDKIMResponse"] class TimeseriesGroupDKIMResponse(BaseModel): meta: object - serie_0: Serie0 + serie_0: RadarEmailSeries diff --git a/src/cloudflare/types/radar/email/routing/timeseries_group_dmarc_response.py b/src/cloudflare/types/radar/email/routing/timeseries_group_dmarc_response.py index f00574e15d6..2221b842e79 100644 --- a/src/cloudflare/types/radar/email/routing/timeseries_group_dmarc_response.py +++ b/src/cloudflare/types/radar/email/routing/timeseries_group_dmarc_response.py @@ -1,23 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_series import RadarEmailSeries -__all__ = ["TimeseriesGroupDMARCResponse", "Serie0"] - - -class Serie0(BaseModel): - fail: List[str] = FieldInfo(alias="FAIL") - - none: List[str] = FieldInfo(alias="NONE") - - pass_: List[str] = FieldInfo(alias="PASS") +__all__ = ["TimeseriesGroupDMARCResponse"] class TimeseriesGroupDMARCResponse(BaseModel): meta: object - serie_0: Serie0 + serie_0: RadarEmailSeries diff --git a/src/cloudflare/types/radar/email/routing/timeseries_group_spf_response.py b/src/cloudflare/types/radar/email/routing/timeseries_group_spf_response.py index 772609a5048..fbca7a77baf 100644 --- a/src/cloudflare/types/radar/email/routing/timeseries_group_spf_response.py +++ b/src/cloudflare/types/radar/email/routing/timeseries_group_spf_response.py @@ -1,23 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_series import RadarEmailSeries -__all__ = ["TimeseriesGroupSPFResponse", "Serie0"] - - -class Serie0(BaseModel): - fail: List[str] = FieldInfo(alias="FAIL") - - none: List[str] = FieldInfo(alias="NONE") - - pass_: List[str] = FieldInfo(alias="PASS") +__all__ = ["TimeseriesGroupSPFResponse"] class TimeseriesGroupSPFResponse(BaseModel): meta: object - serie_0: Serie0 + serie_0: RadarEmailSeries diff --git a/src/cloudflare/types/radar/email/security/summary_arc_response.py b/src/cloudflare/types/radar/email/security/summary_arc_response.py index 4060b61777b..7b709e6be09 100644 --- a/src/cloudflare/types/radar/email/security/summary_arc_response.py +++ b/src/cloudflare/types/radar/email/security/summary_arc_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_summary import RadarEmailSummary -__all__ = [ - "SummaryARCResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummaryARCResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,15 +51,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - fail: str = FieldInfo(alias="FAIL") - - none: str = FieldInfo(alias="NONE") - - pass_: str = FieldInfo(alias="PASS") - - class SummaryARCResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: RadarEmailSummary diff --git a/src/cloudflare/types/radar/email/security/summary_dkim_response.py b/src/cloudflare/types/radar/email/security/summary_dkim_response.py index 703c34db85d..3baed82617a 100644 --- a/src/cloudflare/types/radar/email/security/summary_dkim_response.py +++ b/src/cloudflare/types/radar/email/security/summary_dkim_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_summary import RadarEmailSummary -__all__ = [ - "SummaryDKIMResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummaryDKIMResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,15 +51,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - fail: str = FieldInfo(alias="FAIL") - - none: str = FieldInfo(alias="NONE") - - pass_: str = FieldInfo(alias="PASS") - - class SummaryDKIMResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: RadarEmailSummary diff --git a/src/cloudflare/types/radar/email/security/summary_dmarc_response.py b/src/cloudflare/types/radar/email/security/summary_dmarc_response.py index 05b679b110d..311673b6b74 100644 --- a/src/cloudflare/types/radar/email/security/summary_dmarc_response.py +++ b/src/cloudflare/types/radar/email/security/summary_dmarc_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_summary import RadarEmailSummary -__all__ = [ - "SummaryDMARCResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummaryDMARCResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,15 +51,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - fail: str = FieldInfo(alias="FAIL") - - none: str = FieldInfo(alias="NONE") - - pass_: str = FieldInfo(alias="PASS") - - class SummaryDMARCResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: RadarEmailSummary diff --git a/src/cloudflare/types/radar/email/security/summary_spf_response.py b/src/cloudflare/types/radar/email/security/summary_spf_response.py index b379f447301..0c62ac60f1f 100644 --- a/src/cloudflare/types/radar/email/security/summary_spf_response.py +++ b/src/cloudflare/types/radar/email/security/summary_spf_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_summary import RadarEmailSummary -__all__ = [ - "SummarySPFResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Summary0", -] +__all__ = ["SummarySPFResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -57,15 +51,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Summary0(BaseModel): - fail: str = FieldInfo(alias="FAIL") - - none: str = FieldInfo(alias="NONE") - - pass_: str = FieldInfo(alias="PASS") - - class SummarySPFResponse(BaseModel): meta: Meta - summary_0: Summary0 + summary_0: RadarEmailSummary diff --git a/src/cloudflare/types/radar/email/security/timeseries_group_arc_response.py b/src/cloudflare/types/radar/email/security/timeseries_group_arc_response.py index a719097fa78..68e15b2ca03 100644 --- a/src/cloudflare/types/radar/email/security/timeseries_group_arc_response.py +++ b/src/cloudflare/types/radar/email/security/timeseries_group_arc_response.py @@ -1,23 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_series import RadarEmailSeries -__all__ = ["TimeseriesGroupARCResponse", "Serie0"] - - -class Serie0(BaseModel): - fail: List[str] = FieldInfo(alias="FAIL") - - none: List[str] = FieldInfo(alias="NONE") - - pass_: List[str] = FieldInfo(alias="PASS") +__all__ = ["TimeseriesGroupARCResponse"] class TimeseriesGroupARCResponse(BaseModel): meta: object - serie_0: Serie0 + serie_0: RadarEmailSeries diff --git a/src/cloudflare/types/radar/email/security/timeseries_group_dkim_response.py b/src/cloudflare/types/radar/email/security/timeseries_group_dkim_response.py index 2431244bb4c..0495c34b231 100644 --- a/src/cloudflare/types/radar/email/security/timeseries_group_dkim_response.py +++ b/src/cloudflare/types/radar/email/security/timeseries_group_dkim_response.py @@ -1,23 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_series import RadarEmailSeries -__all__ = ["TimeseriesGroupDKIMResponse", "Serie0"] - - -class Serie0(BaseModel): - fail: List[str] = FieldInfo(alias="FAIL") - - none: List[str] = FieldInfo(alias="NONE") - - pass_: List[str] = FieldInfo(alias="PASS") +__all__ = ["TimeseriesGroupDKIMResponse"] class TimeseriesGroupDKIMResponse(BaseModel): meta: object - serie_0: Serie0 + serie_0: RadarEmailSeries diff --git a/src/cloudflare/types/radar/email/security/timeseries_group_dmarc_response.py b/src/cloudflare/types/radar/email/security/timeseries_group_dmarc_response.py index f00574e15d6..2221b842e79 100644 --- a/src/cloudflare/types/radar/email/security/timeseries_group_dmarc_response.py +++ b/src/cloudflare/types/radar/email/security/timeseries_group_dmarc_response.py @@ -1,23 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_series import RadarEmailSeries -__all__ = ["TimeseriesGroupDMARCResponse", "Serie0"] - - -class Serie0(BaseModel): - fail: List[str] = FieldInfo(alias="FAIL") - - none: List[str] = FieldInfo(alias="NONE") - - pass_: List[str] = FieldInfo(alias="PASS") +__all__ = ["TimeseriesGroupDMARCResponse"] class TimeseriesGroupDMARCResponse(BaseModel): meta: object - serie_0: Serie0 + serie_0: RadarEmailSeries diff --git a/src/cloudflare/types/radar/email/security/timeseries_group_spf_response.py b/src/cloudflare/types/radar/email/security/timeseries_group_spf_response.py index 772609a5048..fbca7a77baf 100644 --- a/src/cloudflare/types/radar/email/security/timeseries_group_spf_response.py +++ b/src/cloudflare/types/radar/email/security/timeseries_group_spf_response.py @@ -1,23 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from pydantic import Field as FieldInfo from ....._models import BaseModel +from ...radar_email_series import RadarEmailSeries -__all__ = ["TimeseriesGroupSPFResponse", "Serie0"] - - -class Serie0(BaseModel): - fail: List[str] = FieldInfo(alias="FAIL") - - none: List[str] = FieldInfo(alias="NONE") - - pass_: List[str] = FieldInfo(alias="PASS") +__all__ = ["TimeseriesGroupSPFResponse"] class TimeseriesGroupSPFResponse(BaseModel): meta: object - serie_0: Serie0 + serie_0: RadarEmailSeries diff --git a/src/cloudflare/types/radar/email/security/top/tld_get_response.py b/src/cloudflare/types/radar/email/security/top/tld_get_response.py index 723c1abf50c..d52b588621e 100644 --- a/src/cloudflare/types/radar/email/security/top/tld_get_response.py +++ b/src/cloudflare/types/radar/email/security/top/tld_get_response.py @@ -6,8 +6,9 @@ from pydantic import Field as FieldInfo from ......_models import BaseModel +from ....http.browser import Browser -__all__ = ["TldGetResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", "Top0"] +__all__ = ["TldGetResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -48,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class TldGetResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/email/security/top/tlds/malicious_get_response.py b/src/cloudflare/types/radar/email/security/top/tlds/malicious_get_response.py index 70db6c049ff..715d0bc0f9c 100644 --- a/src/cloudflare/types/radar/email/security/top/tlds/malicious_get_response.py +++ b/src/cloudflare/types/radar/email/security/top/tlds/malicious_get_response.py @@ -6,15 +6,9 @@ from pydantic import Field as FieldInfo from ......._models import BaseModel +from .....http.browser import Browser -__all__ = [ - "MaliciousGetResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Top0", -] +__all__ = ["MaliciousGetResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -55,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class MaliciousGetResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/email/security/top/tlds/spam_get_response.py b/src/cloudflare/types/radar/email/security/top/tlds/spam_get_response.py index c82df6a2d66..52a8f700e53 100644 --- a/src/cloudflare/types/radar/email/security/top/tlds/spam_get_response.py +++ b/src/cloudflare/types/radar/email/security/top/tlds/spam_get_response.py @@ -6,8 +6,9 @@ from pydantic import Field as FieldInfo from ......._models import BaseModel +from .....http.browser import Browser -__all__ = ["SpamGetResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", "Top0"] +__all__ = ["SpamGetResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -48,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class SpamGetResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/email/security/top/tlds/spoof_get_response.py b/src/cloudflare/types/radar/email/security/top/tlds/spoof_get_response.py index 9cd4c157ef0..5c927efe84d 100644 --- a/src/cloudflare/types/radar/email/security/top/tlds/spoof_get_response.py +++ b/src/cloudflare/types/radar/email/security/top/tlds/spoof_get_response.py @@ -6,8 +6,9 @@ from pydantic import Field as FieldInfo from ......._models import BaseModel +from .....http.browser import Browser -__all__ = ["SpoofGetResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", "Top0"] +__all__ = ["SpoofGetResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -48,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class SpoofGetResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/http/__init__.py b/src/cloudflare/types/radar/http/__init__.py index e0fbe39c282..69bf6aa6074 100644 --- a/src/cloudflare/types/radar/http/__init__.py +++ b/src/cloudflare/types/radar/http/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from .browser import Browser as Browser from .ase_get_params import AseGetParams as AseGetParams from .ase_get_response import AseGetResponse as AseGetResponse from .summary_os_params import SummaryOSParams as SummaryOSParams diff --git a/src/cloudflare/types/radar/http/browser.py b/src/cloudflare/types/radar/http/browser.py new file mode 100644 index 00000000000..48c2187f1d4 --- /dev/null +++ b/src/cloudflare/types/radar/http/browser.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["Browser"] + + +class Browser(BaseModel): + name: str + + value: str diff --git a/src/cloudflare/types/radar/http/top_browser_families_response.py b/src/cloudflare/types/radar/http/top_browser_families_response.py index f2f6809d5d2..ca364af9b0a 100644 --- a/src/cloudflare/types/radar/http/top_browser_families_response.py +++ b/src/cloudflare/types/radar/http/top_browser_families_response.py @@ -5,16 +5,10 @@ from pydantic import Field as FieldInfo +from .browser import Browser from ...._models import BaseModel -__all__ = [ - "TopBrowserFamiliesResponse", - "Meta", - "MetaDateRange", - "MetaConfidenceInfo", - "MetaConfidenceInfoAnnotation", - "Top0", -] +__all__ = ["TopBrowserFamiliesResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -55,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class TopBrowserFamiliesResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/http/top_browsers_response.py b/src/cloudflare/types/radar/http/top_browsers_response.py index f5a101636bb..587df8db78f 100644 --- a/src/cloudflare/types/radar/http/top_browsers_response.py +++ b/src/cloudflare/types/radar/http/top_browsers_response.py @@ -5,9 +5,10 @@ from pydantic import Field as FieldInfo +from .browser import Browser from ...._models import BaseModel -__all__ = ["TopBrowsersResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation", "Top0"] +__all__ = ["TopBrowsersResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", "MetaConfidenceInfoAnnotation"] class MetaDateRange(BaseModel): @@ -48,13 +49,7 @@ class Meta(BaseModel): confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) -class Top0(BaseModel): - name: str - - value: str - - class TopBrowsersResponse(BaseModel): meta: Meta - top_0: List[Top0] + top_0: List[Browser] diff --git a/src/cloudflare/types/radar/radar_email_series.py b/src/cloudflare/types/radar/radar_email_series.py new file mode 100644 index 00000000000..dbe15ff3c54 --- /dev/null +++ b/src/cloudflare/types/radar/radar_email_series.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["RadarEmailSeries"] + + +class RadarEmailSeries(BaseModel): + fail: List[str] = FieldInfo(alias="FAIL") + + none: List[str] = FieldInfo(alias="NONE") + + pass_: List[str] = FieldInfo(alias="PASS") diff --git a/src/cloudflare/types/radar/radar_email_summary.py b/src/cloudflare/types/radar/radar_email_summary.py new file mode 100644 index 00000000000..19a29a852e2 --- /dev/null +++ b/src/cloudflare/types/radar/radar_email_summary.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["RadarEmailSummary"] + + +class RadarEmailSummary(BaseModel): + fail: str = FieldInfo(alias="FAIL") + + none: str = FieldInfo(alias="NONE") + + pass_: str = FieldInfo(alias="PASS") diff --git a/src/cloudflare/types/rate_limit_create_response.py b/src/cloudflare/types/rate_limit_create_response.py deleted file mode 100644 index 259d16d85ed..00000000000 --- a/src/cloudflare/types/rate_limit_create_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["RateLimitCreateResponse"] - -RateLimitCreateResponse = Union[str, object, None] diff --git a/src/cloudflare/types/rate_limit_edit_response.py b/src/cloudflare/types/rate_limit_edit_response.py deleted file mode 100644 index 8cbc4d42071..00000000000 --- a/src/cloudflare/types/rate_limit_edit_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["RateLimitEditResponse"] - -RateLimitEditResponse = Union[str, object, None] diff --git a/src/cloudflare/types/rate_limit_get_response.py b/src/cloudflare/types/rate_limit_get_response.py deleted file mode 100644 index a49c1c80fc6..00000000000 --- a/src/cloudflare/types/rate_limit_get_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["RateLimitGetResponse"] - -RateLimitGetResponse = Union[str, object, None] diff --git a/src/cloudflare/types/rate_limit_list_response.py b/src/cloudflare/types/rate_limit_list_response.py deleted file mode 100644 index c1a4bb3d143..00000000000 --- a/src/cloudflare/types/rate_limit_list_response.py +++ /dev/null @@ -1,158 +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__ = [ - "RateLimitListResponse", - "Action", - "ActionResponse", - "Bypass", - "Match", - "MatchHeader", - "MatchRequest", - "MatchResponse", -] - - -class ActionResponse(BaseModel): - body: Optional[str] = None - """The response body to return. - - The value must conform to the configured content type. - """ - - content_type: Optional[str] = None - """The content type of the body. - - Must be one of the following: `text/plain`, `text/xml`, or `application/json`. - """ - - -class Action(BaseModel): - mode: Optional[Literal["simulate", "ban", "challenge", "js_challenge", "managed_challenge"]] = None - """The action to perform.""" - - response: Optional[ActionResponse] = None - """A custom content type and reponse to return when the threshold is exceeded. - - The custom response configured in this object will override the custom error for - the zone. This object is optional. Notes: If you omit this object, Cloudflare - will use the default HTML error page. If "mode" is "challenge", - "managed_challenge", or "js_challenge", Cloudflare will use the zone challenge - pages and you should not provide the "response" object. - """ - - timeout: Optional[float] = None - """The time in seconds during which Cloudflare will perform the mitigation action. - - Must be an integer value greater than or equal to the period. Notes: If "mode" - is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the - zone's Challenge Passage time and you should not provide this value. - """ - - -class Bypass(BaseModel): - name: Optional[Literal["url"]] = None - - value: Optional[str] = None - """The URL to bypass.""" - - -class MatchHeader(BaseModel): - name: Optional[str] = None - """The name of the response header to match.""" - - op: Optional[Literal["eq", "ne"]] = None - """The operator used when matching: `eq` means "equal" and `ne` means "not equal".""" - - value: Optional[str] = None - """The value of the response header, which must match exactly.""" - - -class MatchRequest(BaseModel): - methods: Optional[List[Literal["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "_ALL_"]]] = None - """The HTTP methods to match. - - You can specify a subset (for example, `['POST','PUT']`) or all methods - (`['_ALL_']`). This field is optional when creating a rate limit. - """ - - schemes: Optional[List[str]] = None - """The HTTP schemes to match. - - You can specify one scheme (`['HTTPS']`), both schemes (`['HTTP','HTTPS']`), or - all schemes (`['_ALL_']`). This field is optional. - """ - - url: Optional[str] = None - """ - The URL pattern to match, composed of a host and a path such as - `example.org/path*`. Normalization is applied before the pattern is matched. `*` - wildcards are expanded to match applicable traffic. Query strings are not - matched. Set the value to `*` to match all traffic to your zone. - """ - - -class MatchResponse(BaseModel): - origin_traffic: Optional[bool] = None - """ - When true, only the uncached traffic served from your origin servers will count - towards rate limiting. In this case, any cached traffic served by Cloudflare - will not count towards rate limiting. This field is optional. Notes: This field - is deprecated. Instead, use response headers and set "origin_traffic" to "false" - to avoid legacy behaviour interacting with the "response_headers" property. - """ - - -class Match(BaseModel): - headers: Optional[List[MatchHeader]] = None - - request: Optional[MatchRequest] = None - - response: Optional[MatchResponse] = None - - -class RateLimitListResponse(BaseModel): - id: Optional[str] = None - """The unique identifier of the rate limit.""" - - action: Optional[Action] = None - """ - The action to perform when the threshold of matched traffic within the - configured period is exceeded. - """ - - bypass: Optional[List[Bypass]] = None - """Criteria specifying when the current rate limit should be bypassed. - - You can specify that the rate limit should not apply to one or more URLs. - """ - - description: Optional[str] = None - """An informative summary of the rate limit. - - This value is sanitized and any tags will be removed. - """ - - disabled: Optional[bool] = None - """When true, indicates that the rate limit is currently disabled.""" - - match: Optional[Match] = None - """Determines which traffic the rate limit counts towards the threshold.""" - - period: Optional[float] = None - """The time in seconds (an integer value) to count matching traffic. - - If the count exceeds the configured threshold within this period, Cloudflare - will perform the configured action. - """ - - threshold: Optional[float] = None - """The threshold that will trigger the configured mitigation action. - - Configure this value along with the `period` property to establish a threshold - per period. - """ diff --git a/src/cloudflare/types/rate_limits/__init__.py b/src/cloudflare/types/rate_limits/__init__.py new file mode 100644 index 00000000000..95fc15ad73e --- /dev/null +++ b/src/cloudflare/types/rate_limits/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .action import Action as Action +from .methods import Methods as Methods +from .rate_limit import RateLimit as RateLimit +from .rate_limit_edit_params import RateLimitEditParams as RateLimitEditParams +from .rate_limit_list_params import RateLimitListParams as RateLimitListParams +from .rate_limit_get_response import RateLimitGetResponse as RateLimitGetResponse +from .rate_limit_create_params import RateLimitCreateParams as RateLimitCreateParams +from .rate_limit_delete_params import RateLimitDeleteParams as RateLimitDeleteParams +from .rate_limit_edit_response import RateLimitEditResponse as RateLimitEditResponse +from .rate_limit_create_response import RateLimitCreateResponse as RateLimitCreateResponse +from .rate_limit_delete_response import RateLimitDeleteResponse as RateLimitDeleteResponse diff --git a/src/cloudflare/types/rate_limits/action.py b/src/cloudflare/types/rate_limits/action.py new file mode 100644 index 00000000000..ca936bce016 --- /dev/null +++ b/src/cloudflare/types/rate_limits/action.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["Action"] + +Action = Literal["block", "challenge", "js_challenge", "managed_challenge", "allow", "log", "bypass"] diff --git a/src/cloudflare/types/rate_limits/methods.py b/src/cloudflare/types/rate_limits/methods.py new file mode 100644 index 00000000000..a2ecc01f286 --- /dev/null +++ b/src/cloudflare/types/rate_limits/methods.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["Methods"] + +Methods = Literal["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "_ALL_"] diff --git a/src/cloudflare/types/rate_limits/rate_limit.py b/src/cloudflare/types/rate_limits/rate_limit.py new file mode 100644 index 00000000000..9fa5741af1a --- /dev/null +++ b/src/cloudflare/types/rate_limits/rate_limit.py @@ -0,0 +1,150 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .methods import Methods +from ..._models import BaseModel + +__all__ = ["RateLimit", "Action", "ActionResponse", "Bypass", "Match", "MatchHeader", "MatchRequest", "MatchResponse"] + + +class ActionResponse(BaseModel): + body: Optional[str] = None + """The response body to return. + + The value must conform to the configured content type. + """ + + content_type: Optional[str] = None + """The content type of the body. + + Must be one of the following: `text/plain`, `text/xml`, or `application/json`. + """ + + +class Action(BaseModel): + mode: Optional[Literal["simulate", "ban", "challenge", "js_challenge", "managed_challenge"]] = None + """The action to perform.""" + + response: Optional[ActionResponse] = None + """A custom content type and reponse to return when the threshold is exceeded. + + The custom response configured in this object will override the custom error for + the zone. This object is optional. Notes: If you omit this object, Cloudflare + will use the default HTML error page. If "mode" is "challenge", + "managed_challenge", or "js_challenge", Cloudflare will use the zone challenge + pages and you should not provide the "response" object. + """ + + timeout: Optional[float] = None + """The time in seconds during which Cloudflare will perform the mitigation action. + + Must be an integer value greater than or equal to the period. Notes: If "mode" + is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the + zone's Challenge Passage time and you should not provide this value. + """ + + +class Bypass(BaseModel): + name: Optional[Literal["url"]] = None + + value: Optional[str] = None + """The URL to bypass.""" + + +class MatchHeader(BaseModel): + name: Optional[str] = None + """The name of the response header to match.""" + + op: Optional[Literal["eq", "ne"]] = None + """The operator used when matching: `eq` means "equal" and `ne` means "not equal".""" + + value: Optional[str] = None + """The value of the response header, which must match exactly.""" + + +class MatchRequest(BaseModel): + methods: Optional[List[Methods]] = None + """The HTTP methods to match. + + You can specify a subset (for example, `['POST','PUT']`) or all methods + (`['_ALL_']`). This field is optional when creating a rate limit. + """ + + schemes: Optional[List[str]] = None + """The HTTP schemes to match. + + You can specify one scheme (`['HTTPS']`), both schemes (`['HTTP','HTTPS']`), or + all schemes (`['_ALL_']`). This field is optional. + """ + + url: Optional[str] = None + """ + The URL pattern to match, composed of a host and a path such as + `example.org/path*`. Normalization is applied before the pattern is matched. `*` + wildcards are expanded to match applicable traffic. Query strings are not + matched. Set the value to `*` to match all traffic to your zone. + """ + + +class MatchResponse(BaseModel): + origin_traffic: Optional[bool] = None + """ + When true, only the uncached traffic served from your origin servers will count + towards rate limiting. In this case, any cached traffic served by Cloudflare + will not count towards rate limiting. This field is optional. Notes: This field + is deprecated. Instead, use response headers and set "origin_traffic" to "false" + to avoid legacy behaviour interacting with the "response_headers" property. + """ + + +class Match(BaseModel): + headers: Optional[List[MatchHeader]] = None + + request: Optional[MatchRequest] = None + + response: Optional[MatchResponse] = None + + +class RateLimit(BaseModel): + id: Optional[str] = None + """The unique identifier of the rate limit.""" + + action: Optional[Action] = None + """ + The action to perform when the threshold of matched traffic within the + configured period is exceeded. + """ + + bypass: Optional[List[Bypass]] = None + """Criteria specifying when the current rate limit should be bypassed. + + You can specify that the rate limit should not apply to one or more URLs. + """ + + description: Optional[str] = None + """An informative summary of the rate limit. + + This value is sanitized and any tags will be removed. + """ + + disabled: Optional[bool] = None + """When true, indicates that the rate limit is currently disabled.""" + + match: Optional[Match] = None + """Determines which traffic the rate limit counts towards the threshold.""" + + period: Optional[float] = None + """The time in seconds (an integer value) to count matching traffic. + + If the count exceeds the configured threshold within this period, Cloudflare + will perform the configured action. + """ + + threshold: Optional[float] = None + """The threshold that will trigger the configured mitigation action. + + Configure this value along with the `period` property to establish a threshold + per period. + """ diff --git a/src/cloudflare/types/rate_limit_create_params.py b/src/cloudflare/types/rate_limits/rate_limit_create_params.py similarity index 100% rename from src/cloudflare/types/rate_limit_create_params.py rename to src/cloudflare/types/rate_limits/rate_limit_create_params.py diff --git a/src/cloudflare/types/rate_limits/rate_limit_create_response.py b/src/cloudflare/types/rate_limits/rate_limit_create_response.py new file mode 100644 index 00000000000..f5db0f69aaa --- /dev/null +++ b/src/cloudflare/types/rate_limits/rate_limit_create_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["RateLimitCreateResponse"] + +RateLimitCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/rate_limits/rate_limit_delete_params.py b/src/cloudflare/types/rate_limits/rate_limit_delete_params.py new file mode 100644 index 00000000000..90fbe783836 --- /dev/null +++ b/src/cloudflare/types/rate_limits/rate_limit_delete_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__ = ["RateLimitDeleteParams"] + + +class RateLimitDeleteParams(TypedDict, total=False): + zone_identifier: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/rate_limit_delete_response.py b/src/cloudflare/types/rate_limits/rate_limit_delete_response.py similarity index 89% rename from src/cloudflare/types/rate_limit_delete_response.py rename to src/cloudflare/types/rate_limits/rate_limit_delete_response.py index ba34e2cfcb0..779d2147231 100644 --- a/src/cloudflare/types/rate_limit_delete_response.py +++ b/src/cloudflare/types/rate_limits/rate_limit_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["RateLimitDeleteResponse"] diff --git a/src/cloudflare/types/rate_limit_edit_params.py b/src/cloudflare/types/rate_limits/rate_limit_edit_params.py similarity index 100% rename from src/cloudflare/types/rate_limit_edit_params.py rename to src/cloudflare/types/rate_limits/rate_limit_edit_params.py diff --git a/src/cloudflare/types/rate_limits/rate_limit_edit_response.py b/src/cloudflare/types/rate_limits/rate_limit_edit_response.py new file mode 100644 index 00000000000..0ab401c3f13 --- /dev/null +++ b/src/cloudflare/types/rate_limits/rate_limit_edit_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["RateLimitEditResponse"] + +RateLimitEditResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/rate_limits/rate_limit_get_response.py b/src/cloudflare/types/rate_limits/rate_limit_get_response.py new file mode 100644 index 00000000000..ea395191218 --- /dev/null +++ b/src/cloudflare/types/rate_limits/rate_limit_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["RateLimitGetResponse"] + +RateLimitGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/rate_limit_list_params.py b/src/cloudflare/types/rate_limits/rate_limit_list_params.py similarity index 100% rename from src/cloudflare/types/rate_limit_list_params.py rename to src/cloudflare/types/rate_limits/rate_limit_list_params.py diff --git a/src/cloudflare/types/rate_plan_get_response.py b/src/cloudflare/types/rate_plan_get_response.py deleted file mode 100644 index ff3291e8eeb..00000000000 --- a/src/cloudflare/types/rate_plan_get_response.py +++ /dev/null @@ -1,42 +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__ = ["RatePlanGetResponse", "RatePlanGetResponseItem", "RatePlanGetResponseItemComponent"] - - -class RatePlanGetResponseItemComponent(BaseModel): - default: Optional[float] = None - """The default amount allocated.""" - - name: Optional[Literal["zones", "page_rules", "dedicated_certificates", "dedicated_certificates_custom"]] = None - """The unique component.""" - - unit_price: Optional[float] = None - """The unit price of the addon.""" - - -class RatePlanGetResponseItem(BaseModel): - id: Optional[str] = None - """Plan identifier tag.""" - - components: Optional[List[RatePlanGetResponseItemComponent]] = None - """Array of available components values for the plan.""" - - currency: Optional[str] = None - """The monetary unit in which pricing information is displayed.""" - - duration: Optional[float] = None - """The duration of the plan subscription.""" - - frequency: Optional[Literal["weekly", "monthly", "quarterly", "yearly"]] = None - """The frequency at which you will be billed for this plan.""" - - name: Optional[str] = None - """The plan name.""" - - -RatePlanGetResponse = List[RatePlanGetResponseItem] diff --git a/src/cloudflare/types/rate_plans/__init__.py b/src/cloudflare/types/rate_plans/__init__.py new file mode 100644 index 00000000000..b11a69db3bb --- /dev/null +++ b/src/cloudflare/types/rate_plans/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .rate_plan import RatePlan as RatePlan +from .rate_plan_param import RatePlanParam as RatePlanParam +from .rate_plan_get_response import RatePlanGetResponse as RatePlanGetResponse diff --git a/src/cloudflare/types/rate_plans/rate_plan.py b/src/cloudflare/types/rate_plans/rate_plan.py new file mode 100644 index 00000000000..b903fed0ff6 --- /dev/null +++ b/src/cloudflare/types/rate_plans/rate_plan.py @@ -0,0 +1,39 @@ +# 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__ = ["RatePlan", "Component"] + + +class Component(BaseModel): + default: Optional[float] = None + """The default amount allocated.""" + + name: Optional[Literal["zones", "page_rules", "dedicated_certificates", "dedicated_certificates_custom"]] = None + """The unique component.""" + + unit_price: Optional[float] = None + """The unit price of the addon.""" + + +class RatePlan(BaseModel): + id: Optional[str] = None + """Plan identifier tag.""" + + components: Optional[List[Component]] = None + """Array of available components values for the plan.""" + + currency: Optional[str] = None + """The monetary unit in which pricing information is displayed.""" + + duration: Optional[float] = None + """The duration of the plan subscription.""" + + frequency: Optional[Literal["weekly", "monthly", "quarterly", "yearly"]] = None + """The frequency at which you will be billed for this plan.""" + + name: Optional[str] = None + """The plan name.""" diff --git a/src/cloudflare/types/rate_plans/rate_plan_get_response.py b/src/cloudflare/types/rate_plans/rate_plan_get_response.py new file mode 100644 index 00000000000..727b482778e --- /dev/null +++ b/src/cloudflare/types/rate_plans/rate_plan_get_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .rate_plan import RatePlan + +__all__ = ["RatePlanGetResponse"] + +RatePlanGetResponse = List[RatePlan] diff --git a/src/cloudflare/types/rate_plans/rate_plan_param.py b/src/cloudflare/types/rate_plans/rate_plan_param.py new file mode 100644 index 00000000000..7987224641d --- /dev/null +++ b/src/cloudflare/types/rate_plans/rate_plan_param.py @@ -0,0 +1,24 @@ +# 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, TypedDict + +__all__ = ["RatePlanParam", "Component"] + + +class Component(TypedDict, total=False): + default: float + """The default amount allocated.""" + + name: Literal["zones", "page_rules", "dedicated_certificates", "dedicated_certificates_custom"] + """The unique component.""" + + +class RatePlanParam(TypedDict, total=False): + components: Iterable[Component] + """Array of available components values for the plan.""" + + duration: float + """The duration of the plan subscription.""" diff --git a/src/cloudflare/types/registrar/__init__.py b/src/cloudflare/types/registrar/__init__.py index bde3ce2dac2..8d08ad33d41 100644 --- a/src/cloudflare/types/registrar/__init__.py +++ b/src/cloudflare/types/registrar/__init__.py @@ -2,7 +2,7 @@ from __future__ import annotations +from .domain import Domain as Domain from .domain_get_response import DomainGetResponse as DomainGetResponse -from .domain_list_response import DomainListResponse as DomainListResponse from .domain_update_params import DomainUpdateParams as DomainUpdateParams from .domain_update_response import DomainUpdateResponse as DomainUpdateResponse diff --git a/src/cloudflare/types/registrar/domain.py b/src/cloudflare/types/registrar/domain.py new file mode 100644 index 00000000000..90b0ed07a47 --- /dev/null +++ b/src/cloudflare/types/registrar/domain.py @@ -0,0 +1,115 @@ +# 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__ = ["Domain", "RegistrantContact", "TransferIn"] + + +class RegistrantContact(BaseModel): + address: str + """Address.""" + + city: str + """City.""" + + country: Optional[str] = None + """The country in which the user lives.""" + + first_name: Optional[str] = None + """User's first name""" + + last_name: Optional[str] = None + """User's last name""" + + organization: str + """Name of organization.""" + + phone: Optional[str] = None + """User's telephone number""" + + state: str + """State.""" + + zip: Optional[str] = None + """The zipcode or postal code where the user lives.""" + + id: Optional[str] = None + """Contact Identifier.""" + + address2: Optional[str] = None + """Optional address line for unit, floor, suite, etc.""" + + email: Optional[str] = None + """The contact email address of the user.""" + + fax: Optional[str] = None + """Contact fax number.""" + + +class TransferIn(BaseModel): + accept_foa: Optional[str] = None + """Form of authorization has been accepted by the registrant.""" + + approve_transfer: Optional[str] = None + """Shows transfer status with the registry.""" + + can_cancel_transfer: Optional[bool] = None + """Indicates if cancellation is still possible.""" + + disable_privacy: Optional[object] = None + """Privacy guards are disabled at the foreign registrar.""" + + enter_auth_code: Optional[str] = None + """Auth code has been entered and verified.""" + + unlock_domain: Optional[object] = None + """Domain is unlocked at the foreign registrar.""" + + +class Domain(BaseModel): + id: Optional[str] = None + """Domain identifier.""" + + available: Optional[bool] = None + """Shows if a domain is available for transferring into Cloudflare Registrar.""" + + can_register: Optional[bool] = None + """Indicates if the domain can be registered as a new domain.""" + + created_at: Optional[datetime] = None + """Shows time of creation.""" + + current_registrar: Optional[str] = None + """Shows name of current registrar.""" + + expires_at: Optional[datetime] = None + """Shows when domain name registration expires.""" + + locked: Optional[bool] = None + """Shows whether a registrar lock is in place for a domain.""" + + registrant_contact: Optional[RegistrantContact] = None + """Shows contact information for domain registrant.""" + + registry_statuses: Optional[str] = None + """A comma-separated list of registry status codes. + + A full list of status codes can be found at + [EPP Status Codes](https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en). + """ + + supported_tld: Optional[bool] = None + """Whether a particular TLD is currently supported by Cloudflare Registrar. + + Refer to [TLD Policies](https://www.cloudflare.com/tld-policies/) for a list of + supported TLDs. + """ + + transfer_in: Optional[TransferIn] = None + """Statuses for domain transfers into Cloudflare Registrar.""" + + updated_at: Optional[datetime] = None + """Last updated.""" diff --git a/src/cloudflare/types/registrar/domain_list_response.py b/src/cloudflare/types/registrar/domain_list_response.py deleted file mode 100644 index 7dbde7dd61a..00000000000 --- a/src/cloudflare/types/registrar/domain_list_response.py +++ /dev/null @@ -1,115 +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__ = ["DomainListResponse", "RegistrantContact", "TransferIn"] - - -class RegistrantContact(BaseModel): - address: str - """Address.""" - - city: str - """City.""" - - country: Optional[str] = None - """The country in which the user lives.""" - - first_name: Optional[str] = None - """User's first name""" - - last_name: Optional[str] = None - """User's last name""" - - organization: str - """Name of organization.""" - - phone: Optional[str] = None - """User's telephone number""" - - state: str - """State.""" - - zip: Optional[str] = None - """The zipcode or postal code where the user lives.""" - - id: Optional[str] = None - """Contact Identifier.""" - - address2: Optional[str] = None - """Optional address line for unit, floor, suite, etc.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - fax: Optional[str] = None - """Contact fax number.""" - - -class TransferIn(BaseModel): - accept_foa: Optional[str] = None - """Form of authorization has been accepted by the registrant.""" - - approve_transfer: Optional[str] = None - """Shows transfer status with the registry.""" - - can_cancel_transfer: Optional[bool] = None - """Indicates if cancellation is still possible.""" - - disable_privacy: Optional[object] = None - """Privacy guards are disabled at the foreign registrar.""" - - enter_auth_code: Optional[str] = None - """Auth code has been entered and verified.""" - - unlock_domain: Optional[object] = None - """Domain is unlocked at the foreign registrar.""" - - -class DomainListResponse(BaseModel): - id: Optional[str] = None - """Domain identifier.""" - - available: Optional[bool] = None - """Shows if a domain is available for transferring into Cloudflare Registrar.""" - - can_register: Optional[bool] = None - """Indicates if the domain can be registered as a new domain.""" - - created_at: Optional[datetime] = None - """Shows time of creation.""" - - current_registrar: Optional[str] = None - """Shows name of current registrar.""" - - expires_at: Optional[datetime] = None - """Shows when domain name registration expires.""" - - locked: Optional[bool] = None - """Shows whether a registrar lock is in place for a domain.""" - - registrant_contact: Optional[RegistrantContact] = None - """Shows contact information for domain registrant.""" - - registry_statuses: Optional[str] = None - """A comma-separated list of registry status codes. - - A full list of status codes can be found at - [EPP Status Codes](https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en). - """ - - supported_tld: Optional[bool] = None - """Whether a particular TLD is currently supported by Cloudflare Registrar. - - Refer to [TLD Policies](https://www.cloudflare.com/tld-policies/) for a list of - supported TLDs. - """ - - transfer_in: Optional[TransferIn] = None - """Statuses for domain transfers into Cloudflare Registrar.""" - - updated_at: Optional[datetime] = None - """Last updated.""" diff --git a/src/cloudflare/types/request_tracers/trace_create_params.py b/src/cloudflare/types/request_tracers/trace_create_params.py index d817af499b3..6acca264b84 100644 --- a/src/cloudflare/types/request_tracers/trace_create_params.py +++ b/src/cloudflare/types/request_tracers/trace_create_params.py @@ -9,6 +9,9 @@ class TraceCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + method: Required[str] """HTTP Method of tracing request""" diff --git a/src/cloudflare/types/rules/__init__.py b/src/cloudflare/types/rules/__init__.py index eac7c5e729f..24f42f87715 100644 --- a/src/cloudflare/types/rules/__init__.py +++ b/src/cloudflare/types/rules/__init__.py @@ -2,7 +2,12 @@ from __future__ import annotations +from .hostname import Hostname as Hostname +from .redirect import Redirect as Redirect from .lists_list import ListsList as ListsList +from .hostname_param import HostnameParam as HostnameParam +from .redirect_param import RedirectParam as RedirectParam from .list_create_params import ListCreateParams as ListCreateParams +from .list_delete_params import ListDeleteParams as ListDeleteParams from .list_update_params import ListUpdateParams as ListUpdateParams from .list_delete_response import ListDeleteResponse as ListDeleteResponse diff --git a/src/cloudflare/types/rules/hostname.py b/src/cloudflare/types/rules/hostname.py new file mode 100644 index 00000000000..32d7ce459a9 --- /dev/null +++ b/src/cloudflare/types/rules/hostname.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Hostname"] + + +class Hostname(BaseModel): + url_hostname: str diff --git a/src/cloudflare/types/rules/hostname_param.py b/src/cloudflare/types/rules/hostname_param.py new file mode 100644 index 00000000000..280651700b2 --- /dev/null +++ b/src/cloudflare/types/rules/hostname_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["HostnameParam"] + + +class HostnameParam(TypedDict, total=False): + url_hostname: Required[str] diff --git a/src/cloudflare/types/rules/list_delete_params.py b/src/cloudflare/types/rules/list_delete_params.py new file mode 100644 index 00000000000..dd3970f9614 --- /dev/null +++ b/src/cloudflare/types/rules/list_delete_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__ = ["ListDeleteParams"] + + +class ListDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/rules/lists/__init__.py b/src/cloudflare/types/rules/lists/__init__.py index 2ae6b35e88a..67f205f1c01 100644 --- a/src/cloudflare/types/rules/lists/__init__.py +++ b/src/cloudflare/types/rules/lists/__init__.py @@ -2,7 +2,10 @@ from __future__ import annotations +from .list_item import ListItem as ListItem +from .list_cursor import ListCursor as ListCursor from .item_list_params import ItemListParams as ItemListParams +from .operation_status import OperationStatus as OperationStatus from .item_get_response import ItemGetResponse as ItemGetResponse from .item_create_params import ItemCreateParams as ItemCreateParams from .item_delete_params import ItemDeleteParams as ItemDeleteParams diff --git a/src/cloudflare/types/rules/lists/item_create_params.py b/src/cloudflare/types/rules/lists/item_create_params.py index bf7e7e8f993..8db16c19fcf 100644 --- a/src/cloudflare/types/rules/lists/item_create_params.py +++ b/src/cloudflare/types/rules/lists/item_create_params.py @@ -3,9 +3,12 @@ from __future__ import annotations from typing import Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["ItemCreateParams", "Body", "BodyHostname", "BodyRedirect"] +from ..hostname_param import HostnameParam +from ..redirect_param import RedirectParam + +__all__ = ["ItemCreateParams", "Body"] class ItemCreateParams(TypedDict, total=False): @@ -15,26 +18,6 @@ class ItemCreateParams(TypedDict, total=False): body: Required[Iterable[Body]] -class BodyHostname(TypedDict, total=False): - url_hostname: Required[str] - - -class BodyRedirect(TypedDict, total=False): - source_url: Required[str] - - target_url: Required[str] - - include_subdomains: bool - - preserve_path_suffix: bool - - preserve_query_string: bool - - status_code: Literal[301, 302, 307, 308] - - subpath_matching: bool - - class Body(TypedDict, total=False): asn: int """A non-negative 32 bit integer""" @@ -42,7 +25,7 @@ class Body(TypedDict, total=False): comment: str """An informative summary of the list item.""" - hostname: BodyHostname + hostname: HostnameParam """ Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (\\**), and the hyphen (-). @@ -54,5 +37,5 @@ class Body(TypedDict, total=False): IPv6 CIDRs are limited to a maximum of /64. """ - redirect: BodyRedirect + redirect: RedirectParam """The definition of the redirect.""" diff --git a/src/cloudflare/types/rules/lists/item_get_response.py b/src/cloudflare/types/rules/lists/item_get_response.py index c977176959e..8d3a3426193 100644 --- a/src/cloudflare/types/rules/lists/item_get_response.py +++ b/src/cloudflare/types/rules/lists/item_get_response.py @@ -1,31 +1,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import Literal +from typing import Union -from ...._models import BaseModel +from ..hostname import Hostname +from ..redirect import Redirect -__all__ = ["ItemGetResponse", "ListsItemRedirect", "ListsItemHostname"] +__all__ = ["ItemGetResponse"] - -class ListsItemRedirect(BaseModel): - source_url: str - - target_url: str - - include_subdomains: Optional[bool] = None - - preserve_path_suffix: Optional[bool] = None - - preserve_query_string: Optional[bool] = None - - status_code: Optional[Literal[301, 302, 307, 308]] = None - - subpath_matching: Optional[bool] = None - - -class ListsItemHostname(BaseModel): - url_hostname: str - - -ItemGetResponse = Union[str, ListsItemRedirect, ListsItemHostname, int, None] +ItemGetResponse = Union[str, Redirect, Hostname, int, None] diff --git a/src/cloudflare/types/rules/lists/item_update_params.py b/src/cloudflare/types/rules/lists/item_update_params.py index dcf6f7fd954..eeec3b2a70d 100644 --- a/src/cloudflare/types/rules/lists/item_update_params.py +++ b/src/cloudflare/types/rules/lists/item_update_params.py @@ -3,9 +3,12 @@ from __future__ import annotations from typing import Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["ItemUpdateParams", "Body", "BodyHostname", "BodyRedirect"] +from ..hostname_param import HostnameParam +from ..redirect_param import RedirectParam + +__all__ = ["ItemUpdateParams", "Body"] class ItemUpdateParams(TypedDict, total=False): @@ -15,26 +18,6 @@ class ItemUpdateParams(TypedDict, total=False): body: Required[Iterable[Body]] -class BodyHostname(TypedDict, total=False): - url_hostname: Required[str] - - -class BodyRedirect(TypedDict, total=False): - source_url: Required[str] - - target_url: Required[str] - - include_subdomains: bool - - preserve_path_suffix: bool - - preserve_query_string: bool - - status_code: Literal[301, 302, 307, 308] - - subpath_matching: bool - - class Body(TypedDict, total=False): asn: int """A non-negative 32 bit integer""" @@ -42,7 +25,7 @@ class Body(TypedDict, total=False): comment: str """An informative summary of the list item.""" - hostname: BodyHostname + hostname: HostnameParam """ Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (\\**), and the hyphen (-). @@ -54,5 +37,5 @@ class Body(TypedDict, total=False): IPv6 CIDRs are limited to a maximum of /64. """ - redirect: BodyRedirect + redirect: RedirectParam """The definition of the redirect.""" diff --git a/src/cloudflare/types/rules/lists/list_cursor.py b/src/cloudflare/types/rules/lists/list_cursor.py new file mode 100644 index 00000000000..2757b8af132 --- /dev/null +++ b/src/cloudflare/types/rules/lists/list_cursor.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["ListCursor"] + + +class ListCursor(BaseModel): + after: Optional[str] = None + + before: Optional[str] = None diff --git a/src/cloudflare/types/rules/lists/list_item.py b/src/cloudflare/types/rules/lists/list_item.py new file mode 100644 index 00000000000..3f97e10948a --- /dev/null +++ b/src/cloudflare/types/rules/lists/list_item.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__ = ["ListItem"] + + +class ListItem(BaseModel): + operation_id: Optional[str] = None + """The unique operation ID of the asynchronous action.""" diff --git a/src/cloudflare/types/rules/lists/operation_status.py b/src/cloudflare/types/rules/lists/operation_status.py new file mode 100644 index 00000000000..bf394155fed --- /dev/null +++ b/src/cloudflare/types/rules/lists/operation_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["OperationStatus"] + +OperationStatus = Literal["pending", "running", "completed", "failed"] diff --git a/src/cloudflare/types/rules/redirect.py b/src/cloudflare/types/rules/redirect.py new file mode 100644 index 00000000000..e52def9115b --- /dev/null +++ b/src/cloudflare/types/rules/redirect.py @@ -0,0 +1,24 @@ +# 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__ = ["Redirect"] + + +class Redirect(BaseModel): + source_url: str + + target_url: str + + include_subdomains: Optional[bool] = None + + preserve_path_suffix: Optional[bool] = None + + preserve_query_string: Optional[bool] = None + + status_code: Optional[Literal[301, 302, 307, 308]] = None + + subpath_matching: Optional[bool] = None diff --git a/src/cloudflare/types/rules/redirect_param.py b/src/cloudflare/types/rules/redirect_param.py new file mode 100644 index 00000000000..570fd1d90f7 --- /dev/null +++ b/src/cloudflare/types/rules/redirect_param.py @@ -0,0 +1,23 @@ +# 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__ = ["RedirectParam"] + + +class RedirectParam(TypedDict, total=False): + source_url: Required[str] + + target_url: Required[str] + + include_subdomains: bool + + preserve_path_suffix: bool + + preserve_query_string: bool + + status_code: Literal[301, 302, 307, 308] + + subpath_matching: bool diff --git a/src/cloudflare/types/ruleset.py b/src/cloudflare/types/ruleset.py deleted file mode 100644 index 5bc71c6f377..00000000000 --- a/src/cloudflare/types/ruleset.py +++ /dev/null @@ -1,393 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = [ - "Ruleset", - "Rule", - "RuleRulesetsBlockRule", - "RuleRulesetsBlockRuleActionParameters", - "RuleRulesetsBlockRuleActionParametersResponse", - "RuleRulesetsBlockRuleLogging", - "RuleRulesetsExecuteRule", - "RuleRulesetsExecuteRuleActionParameters", - "RuleRulesetsExecuteRuleActionParametersMatchedData", - "RuleRulesetsExecuteRuleActionParametersOverrides", - "RuleRulesetsExecuteRuleActionParametersOverridesCategory", - "RuleRulesetsExecuteRuleActionParametersOverridesRule", - "RuleRulesetsExecuteRuleLogging", - "RuleRulesetsLogRule", - "RuleRulesetsLogRuleLogging", - "RuleRulesetsSkipRule", - "RuleRulesetsSkipRuleActionParameters", - "RuleRulesetsSkipRuleLogging", -] - - -class RuleRulesetsBlockRuleActionParametersResponse(BaseModel): - content: str - """The content to return.""" - - content_type: str - """The type of the content to return.""" - - status_code: int - """The status code to return.""" - - -class RuleRulesetsBlockRuleActionParameters(BaseModel): - response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None - """The response to show when the block is applied.""" - - -class RuleRulesetsBlockRuleLogging(BaseModel): - enabled: bool - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsBlockRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["block"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[RuleRulesetsBlockRuleLogging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel): - public_key: str - """The public key to encrypt matched data logs with.""" - - -class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel): - category: str - """The name of the category to override.""" - - action: Optional[str] = None - """The action to override rules in the category with.""" - - enabled: Optional[bool] = None - """Whether to enable execution of rules in the category.""" - - sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None - """The sensitivity level to use for rules in the category.""" - - -class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel): - id: str - """The ID of the rule to override.""" - - action: Optional[str] = None - """The action to override the rule with.""" - - enabled: Optional[bool] = None - """Whether to enable execution of the rule.""" - - score_threshold: Optional[int] = None - """The score threshold to use for the rule.""" - - sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None - """The sensitivity level to use for the rule.""" - - -class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel): - action: Optional[str] = None - """An action to override all rules with. - - This option has lower precedence than rule and category overrides. - """ - - categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None - """A list of category-level overrides. - - This option has the second-highest precedence after rule-level overrides. - """ - - enabled: Optional[bool] = None - """Whether to enable execution of all rules. - - This option has lower precedence than rule and category overrides. - """ - - rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None - """A list of rule-level overrides. This option has the highest precedence.""" - - sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None - """A sensitivity level to set for all rules. - - This option has lower precedence than rule and category overrides and is only - applicable for DDoS phases. - """ - - -class RuleRulesetsExecuteRuleActionParameters(BaseModel): - id: str - """The ID of the ruleset to execute.""" - - matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None - """The configuration to use for matched data logging.""" - - overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None - """A set of overrides to apply to the target ruleset.""" - - -class RuleRulesetsExecuteRuleLogging(BaseModel): - enabled: bool - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsExecuteRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["execute"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[RuleRulesetsExecuteRuleLogging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsLogRuleLogging(BaseModel): - enabled: bool - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsLogRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["log"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[object] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[RuleRulesetsLogRuleLogging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsSkipRuleActionParameters(BaseModel): - phases: Optional[ - List[ - Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - ] - ] = None - """A list of phases to skip the execution of. - - This option is incompatible with the ruleset and rulesets options. - """ - - products: Optional[ - List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]] - ] = None - """A list of legacy security products to skip the execution of.""" - - rules: Optional[Dict[str, List[str]]] = None - """ - A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the - execution of. This option is incompatible with the ruleset option. - """ - - ruleset: Optional[Literal["current"]] = None - """A ruleset to skip the execution of. - - This option is incompatible with the rulesets, rules and phases options. - """ - - rulesets: Optional[List[str]] = None - """A list of ruleset IDs to skip the execution of. - - This option is incompatible with the ruleset and phases options. - """ - - -class RuleRulesetsSkipRuleLogging(BaseModel): - enabled: bool - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsSkipRule(BaseModel): - last_updated: datetime - """The timestamp of when the rule was last modified.""" - - version: str - """The version of the rule.""" - - id: Optional[str] = None - """The unique ID of the rule.""" - - action: Optional[Literal["skip"]] = None - """The action to perform when the rule matches.""" - - action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = None - """The parameters configuring the rule's action.""" - - categories: Optional[List[str]] = None - """The categories of the rule.""" - - description: Optional[str] = None - """An informative description of the rule.""" - - enabled: Optional[bool] = None - """Whether the rule should be executed.""" - - expression: Optional[str] = None - """The expression defining which traffic will match the rule.""" - - logging: Optional[RuleRulesetsSkipRuleLogging] = None - """An object configuring the rule's logging behavior.""" - - ref: Optional[str] = None - """The reference of the rule (the rule ID by default).""" - - -Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule] - - -class Ruleset(BaseModel): - id: str - """The unique ID of the ruleset.""" - - kind: Literal["managed", "custom", "root", "zone"] - """The kind of the ruleset.""" - - last_updated: datetime - """The timestamp of when the ruleset was last modified.""" - - name: str - """The human-readable name of the ruleset.""" - - phase: Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - """The phase of the ruleset.""" - - rules: List[Rule] - """The list of rules in the ruleset.""" - - version: str - """The version of the ruleset.""" - - description: Optional[str] = None - """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/ruleset_create_params.py b/src/cloudflare/types/ruleset_create_params.py deleted file mode 100644 index 919e13429fa..00000000000 --- a/src/cloudflare/types/ruleset_create_params.py +++ /dev/null @@ -1,351 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = [ - "RulesetCreateParams", - "Rule", - "RuleRulesetsBlockRule", - "RuleRulesetsBlockRuleActionParameters", - "RuleRulesetsBlockRuleActionParametersResponse", - "RuleRulesetsBlockRuleLogging", - "RuleRulesetsExecuteRule", - "RuleRulesetsExecuteRuleActionParameters", - "RuleRulesetsExecuteRuleActionParametersMatchedData", - "RuleRulesetsExecuteRuleActionParametersOverrides", - "RuleRulesetsExecuteRuleActionParametersOverridesCategory", - "RuleRulesetsExecuteRuleActionParametersOverridesRule", - "RuleRulesetsExecuteRuleLogging", - "RuleRulesetsLogRule", - "RuleRulesetsLogRuleLogging", - "RuleRulesetsSkipRule", - "RuleRulesetsSkipRuleActionParameters", - "RuleRulesetsSkipRuleLogging", -] - - -class RulesetCreateParams(TypedDict, total=False): - kind: Required[Literal["managed", "custom", "root", "zone"]] - """The kind of the ruleset.""" - - name: Required[str] - """The human-readable name of the ruleset.""" - - phase: Required[ - Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - ] - """The phase of the ruleset.""" - - rules: Required[Iterable[Rule]] - """The list of rules in the ruleset.""" - - 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.""" - - description: str - """An informative description of the ruleset.""" - - -class RuleRulesetsBlockRuleActionParametersResponse(TypedDict, total=False): - content: Required[str] - """The content to return.""" - - content_type: Required[str] - """The type of the content to return.""" - - status_code: Required[int] - """The status code to return.""" - - -class RuleRulesetsBlockRuleActionParameters(TypedDict, total=False): - response: RuleRulesetsBlockRuleActionParametersResponse - """The response to show when the block is applied.""" - - -class RuleRulesetsBlockRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsBlockRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["block"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsBlockRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsBlockRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False): - public_key: Required[str] - """The public key to encrypt matched data logs with.""" - - -class RuleRulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False): - category: Required[str] - """The name of the category to override.""" - - action: str - """The action to override rules in the category with.""" - - enabled: bool - """Whether to enable execution of rules in the category.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """The sensitivity level to use for rules in the category.""" - - -class RuleRulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False): - id: Required[str] - """The ID of the rule to override.""" - - action: str - """The action to override the rule with.""" - - enabled: bool - """Whether to enable execution of the rule.""" - - score_threshold: int - """The score threshold to use for the rule.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """The sensitivity level to use for the rule.""" - - -class RuleRulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): - action: str - """An action to override all rules with. - - This option has lower precedence than rule and category overrides. - """ - - categories: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesCategory] - """A list of category-level overrides. - - This option has the second-highest precedence after rule-level overrides. - """ - - enabled: bool - """Whether to enable execution of all rules. - - This option has lower precedence than rule and category overrides. - """ - - rules: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesRule] - """A list of rule-level overrides. This option has the highest precedence.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """A sensitivity level to set for all rules. - - This option has lower precedence than rule and category overrides and is only - applicable for DDoS phases. - """ - - -class RuleRulesetsExecuteRuleActionParameters(TypedDict, total=False): - id: Required[str] - """The ID of the ruleset to execute.""" - - matched_data: RuleRulesetsExecuteRuleActionParametersMatchedData - """The configuration to use for matched data logging.""" - - overrides: RuleRulesetsExecuteRuleActionParametersOverrides - """A set of overrides to apply to the target ruleset.""" - - -class RuleRulesetsExecuteRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsExecuteRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["execute"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsExecuteRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsExecuteRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsLogRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsLogRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["log"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsLogRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsSkipRuleActionParameters(TypedDict, total=False): - phases: List[ - Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - ] - """A list of phases to skip the execution of. - - This option is incompatible with the ruleset and rulesets options. - """ - - products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]] - """A list of legacy security products to skip the execution of.""" - - rules: Dict[str, List[str]] - """ - A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the - execution of. This option is incompatible with the ruleset option. - """ - - ruleset: Literal["current"] - """A ruleset to skip the execution of. - - This option is incompatible with the rulesets, rules and phases options. - """ - - rulesets: List[str] - """A list of ruleset IDs to skip the execution of. - - This option is incompatible with the ruleset and phases options. - """ - - -class RuleRulesetsSkipRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsSkipRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["skip"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsSkipRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsSkipRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule] diff --git a/src/cloudflare/types/ruleset_list_response.py b/src/cloudflare/types/ruleset_list_response.py deleted file mode 100644 index ef7fb89731e..00000000000 --- a/src/cloudflare/types/ruleset_list_response.py +++ /dev/null @@ -1,56 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["RulesetListResponse"] - - -class RulesetListResponse(BaseModel): - kind: Literal["managed", "custom", "root", "zone"] - """The kind of the ruleset.""" - - name: str - """The human-readable name of the ruleset.""" - - phase: Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - """The phase of the ruleset.""" - - id: Optional[str] = None - """The unique ID of the ruleset.""" - - description: Optional[str] = None - """An informative description of the ruleset.""" - - last_updated: Optional[datetime] = None - """The timestamp of when the ruleset was last modified.""" - - version: Optional[str] = None - """The version of the ruleset.""" diff --git a/src/cloudflare/types/ruleset_update_params.py b/src/cloudflare/types/ruleset_update_params.py deleted file mode 100644 index e77ba1d1bca..00000000000 --- a/src/cloudflare/types/ruleset_update_params.py +++ /dev/null @@ -1,352 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = [ - "RulesetUpdateParams", - "Rule", - "RuleRulesetsBlockRule", - "RuleRulesetsBlockRuleActionParameters", - "RuleRulesetsBlockRuleActionParametersResponse", - "RuleRulesetsBlockRuleLogging", - "RuleRulesetsExecuteRule", - "RuleRulesetsExecuteRuleActionParameters", - "RuleRulesetsExecuteRuleActionParametersMatchedData", - "RuleRulesetsExecuteRuleActionParametersOverrides", - "RuleRulesetsExecuteRuleActionParametersOverridesCategory", - "RuleRulesetsExecuteRuleActionParametersOverridesRule", - "RuleRulesetsExecuteRuleLogging", - "RuleRulesetsLogRule", - "RuleRulesetsLogRuleLogging", - "RuleRulesetsSkipRule", - "RuleRulesetsSkipRuleActionParameters", - "RuleRulesetsSkipRuleLogging", -] - - -class RulesetUpdateParams(TypedDict, total=False): - id: Required[str] - """The unique ID of the ruleset.""" - - rules: Required[Iterable[Rule]] - """The list of rules in the ruleset.""" - - 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.""" - - description: str - """An informative description of the ruleset.""" - - kind: Literal["managed", "custom", "root", "zone"] - """The kind of the ruleset.""" - - name: str - """The human-readable name of the ruleset.""" - - phase: Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - """The phase of the ruleset.""" - - -class RuleRulesetsBlockRuleActionParametersResponse(TypedDict, total=False): - content: Required[str] - """The content to return.""" - - content_type: Required[str] - """The type of the content to return.""" - - status_code: Required[int] - """The status code to return.""" - - -class RuleRulesetsBlockRuleActionParameters(TypedDict, total=False): - response: RuleRulesetsBlockRuleActionParametersResponse - """The response to show when the block is applied.""" - - -class RuleRulesetsBlockRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsBlockRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["block"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsBlockRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsBlockRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False): - public_key: Required[str] - """The public key to encrypt matched data logs with.""" - - -class RuleRulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False): - category: Required[str] - """The name of the category to override.""" - - action: str - """The action to override rules in the category with.""" - - enabled: bool - """Whether to enable execution of rules in the category.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """The sensitivity level to use for rules in the category.""" - - -class RuleRulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False): - id: Required[str] - """The ID of the rule to override.""" - - action: str - """The action to override the rule with.""" - - enabled: bool - """Whether to enable execution of the rule.""" - - score_threshold: int - """The score threshold to use for the rule.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """The sensitivity level to use for the rule.""" - - -class RuleRulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): - action: str - """An action to override all rules with. - - This option has lower precedence than rule and category overrides. - """ - - categories: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesCategory] - """A list of category-level overrides. - - This option has the second-highest precedence after rule-level overrides. - """ - - enabled: bool - """Whether to enable execution of all rules. - - This option has lower precedence than rule and category overrides. - """ - - rules: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesRule] - """A list of rule-level overrides. This option has the highest precedence.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """A sensitivity level to set for all rules. - - This option has lower precedence than rule and category overrides and is only - applicable for DDoS phases. - """ - - -class RuleRulesetsExecuteRuleActionParameters(TypedDict, total=False): - id: Required[str] - """The ID of the ruleset to execute.""" - - matched_data: RuleRulesetsExecuteRuleActionParametersMatchedData - """The configuration to use for matched data logging.""" - - overrides: RuleRulesetsExecuteRuleActionParametersOverrides - """A set of overrides to apply to the target ruleset.""" - - -class RuleRulesetsExecuteRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsExecuteRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["execute"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsExecuteRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsExecuteRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsLogRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsLogRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["log"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsLogRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsSkipRuleActionParameters(TypedDict, total=False): - phases: List[ - Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - ] - """A list of phases to skip the execution of. - - This option is incompatible with the ruleset and rulesets options. - """ - - products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]] - """A list of legacy security products to skip the execution of.""" - - rules: Dict[str, List[str]] - """ - A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the - execution of. This option is incompatible with the ruleset option. - """ - - ruleset: Literal["current"] - """A ruleset to skip the execution of. - - This option is incompatible with the rulesets, rules and phases options. - """ - - rulesets: List[str] - """A list of ruleset IDs to skip the execution of. - - This option is incompatible with the ruleset and phases options. - """ - - -class RuleRulesetsSkipRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsSkipRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["skip"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsSkipRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsSkipRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule] diff --git a/src/cloudflare/types/rulesets/__init__.py b/src/cloudflare/types/rulesets/__init__.py index f493d78c72b..5ba52a2ca8b 100644 --- a/src/cloudflare/types/rulesets/__init__.py +++ b/src/cloudflare/types/rulesets/__init__.py @@ -2,7 +2,52 @@ from __future__ import annotations +from .logging import Logging as Logging +from .ruleset import Ruleset as Ruleset +from .log_rule import LogRule as LogRule +from .skip_rule import SkipRule as SkipRule +from .block_rule import BlockRule as BlockRule +from .route_rule import RouteRule as RouteRule +from .score_rule import ScoreRule as ScoreRule +from .execute_rule import ExecuteRule as ExecuteRule +from .rewrite_rule import RewriteRule as RewriteRule +from .logging_param import LoggingParam as LoggingParam +from .redirect_rule import RedirectRule as RedirectRule +from .challenge_rule import ChallengeRule as ChallengeRule +from .log_rule_param import LogRuleParam as LogRuleParam +from .set_config_rule import SetConfigRule as SetConfigRule +from .skip_rule_param import SkipRuleParam as SkipRuleParam +from .block_rule_param import BlockRuleParam as BlockRuleParam +from .rewrite_uri_part import RewriteURIPart as RewriteURIPart +from .route_rule_param import RouteRuleParam as RouteRuleParam from .rule_edit_params import RuleEditParams as RuleEditParams +from .score_rule_param import ScoreRuleParam as ScoreRuleParam +from .serve_error_rule import ServeErrorRule as ServeErrorRule +from .js_challenge_rule import JSChallengeRule as JSChallengeRule +from .execute_rule_param import ExecuteRuleParam as ExecuteRuleParam +from .phase_get_response import PhaseGetResponse as PhaseGetResponse +from .rewrite_rule_param import RewriteRuleParam as RewriteRuleParam from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_edit_response import RuleEditResponse as RuleEditResponse from .phase_update_params import PhaseUpdateParams as PhaseUpdateParams -from .version_list_response import VersionListResponse as VersionListResponse +from .redirect_rule_param import RedirectRuleParam as RedirectRuleParam +from .challenge_rule_param import ChallengeRuleParam as ChallengeRuleParam +from .rule_create_response import RuleCreateResponse as RuleCreateResponse +from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse +from .ruleset_get_response import RulesetGetResponse as RulesetGetResponse +from .version_get_response import VersionGetResponse as VersionGetResponse +from .phase_update_response import PhaseUpdateResponse as PhaseUpdateResponse +from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams +from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams +from .set_config_rule_param import SetConfigRuleParam as SetConfigRuleParam +from .compress_response_rule import CompressResponseRule as CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule as ManagedChallengeRule +from .rewrite_uri_part_param import RewriteURIPartParam as RewriteURIPartParam +from .serve_error_rule_param import ServeErrorRuleParam as ServeErrorRuleParam +from .js_challenge_rule_param import JSChallengeRuleParam as JSChallengeRuleParam +from .ruleset_create_response import RulesetCreateResponse as RulesetCreateResponse +from .ruleset_update_response import RulesetUpdateResponse as RulesetUpdateResponse +from .set_cache_settings_rule import SetCacheSettingsRule as SetCacheSettingsRule +from .compress_response_rule_param import CompressResponseRuleParam as CompressResponseRuleParam +from .managed_challenge_rule_param import ManagedChallengeRuleParam as ManagedChallengeRuleParam +from .set_cache_settings_rule_param import SetCacheSettingsRuleParam as SetCacheSettingsRuleParam diff --git a/src/cloudflare/types/rulesets/block_rule.py b/src/cloudflare/types/rulesets/block_rule.py new file mode 100644 index 00000000000..2efc89a4e2d --- /dev/null +++ b/src/cloudflare/types/rulesets/block_rule.py @@ -0,0 +1,61 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["BlockRule", "ActionParameters", "ActionParametersResponse"] + + +class ActionParametersResponse(BaseModel): + content: str + """The content to return.""" + + content_type: str + """The type of the content to return.""" + + status_code: int + """The status code to return.""" + + +class ActionParameters(BaseModel): + response: Optional[ActionParametersResponse] = None + """The response to show when the block is applied.""" + + +class BlockRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["block"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/block_rule_param.py b/src/cloudflare/types/rulesets/block_rule_param.py new file mode 100644 index 00000000000..c1ff6a627cf --- /dev/null +++ b/src/cloudflare/types/rulesets/block_rule_param.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["BlockRuleParam", "ActionParameters", "ActionParametersResponse"] + + +class ActionParametersResponse(TypedDict, total=False): + content: Required[str] + """The content to return.""" + + content_type: Required[str] + """The type of the content to return.""" + + status_code: Required[int] + """The status code to return.""" + + +class ActionParameters(TypedDict, total=False): + response: ActionParametersResponse + """The response to show when the block is applied.""" + + +class BlockRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["block"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/challenge_rule.py b/src/cloudflare/types/rulesets/challenge_rule.py new file mode 100644 index 00000000000..5443d8298e5 --- /dev/null +++ b/src/cloudflare/types/rulesets/challenge_rule.py @@ -0,0 +1,45 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["ChallengeRule"] + + +class ChallengeRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["challenge"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/challenge_rule_param.py b/src/cloudflare/types/rulesets/challenge_rule_param.py new file mode 100644 index 00000000000..d430a95a678 --- /dev/null +++ b/src/cloudflare/types/rulesets/challenge_rule_param.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["ChallengeRuleParam"] + + +class ChallengeRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/compress_response_rule.py b/src/cloudflare/types/rulesets/compress_response_rule.py new file mode 100644 index 00000000000..cfadff08d90 --- /dev/null +++ b/src/cloudflare/types/rulesets/compress_response_rule.py @@ -0,0 +1,55 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["CompressResponseRule", "ActionParameters", "ActionParametersAlgorithm"] + + +class ActionParametersAlgorithm(BaseModel): + name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None + """Name of compression algorithm to enable.""" + + +class ActionParameters(BaseModel): + algorithms: Optional[List[ActionParametersAlgorithm]] = None + """Custom order for compression algorithms.""" + + +class CompressResponseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["compress_response"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/compress_response_rule_param.py b/src/cloudflare/types/rulesets/compress_response_rule_param.py new file mode 100644 index 00000000000..79c4ef44957 --- /dev/null +++ b/src/cloudflare/types/rulesets/compress_response_rule_param.py @@ -0,0 +1,46 @@ +# 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, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["CompressResponseRuleParam", "ActionParameters", "ActionParametersAlgorithm"] + + +class ActionParametersAlgorithm(TypedDict, total=False): + name: Literal["none", "auto", "default", "gzip", "brotli"] + """Name of compression algorithm to enable.""" + + +class ActionParameters(TypedDict, total=False): + algorithms: Iterable[ActionParametersAlgorithm] + """Custom order for compression algorithms.""" + + +class CompressResponseRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["compress_response"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/execute_rule.py b/src/cloudflare/types/rulesets/execute_rule.py new file mode 100644 index 00000000000..fc82785cd1a --- /dev/null +++ b/src/cloudflare/types/rulesets/execute_rule.py @@ -0,0 +1,129 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = [ + "ExecuteRule", + "ActionParameters", + "ActionParametersMatchedData", + "ActionParametersOverrides", + "ActionParametersOverridesCategory", + "ActionParametersOverridesRule", +] + + +class ActionParametersMatchedData(BaseModel): + public_key: str + """The public key to encrypt matched data logs with.""" + + +class ActionParametersOverridesCategory(BaseModel): + category: str + """The name of the category to override.""" + + action: Optional[str] = None + """The action to override rules in the category with.""" + + enabled: Optional[bool] = None + """Whether to enable execution of rules in the category.""" + + sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None + """The sensitivity level to use for rules in the category.""" + + +class ActionParametersOverridesRule(BaseModel): + id: str + """The ID of the rule to override.""" + + action: Optional[str] = None + """The action to override the rule with.""" + + enabled: Optional[bool] = None + """Whether to enable execution of the rule.""" + + score_threshold: Optional[int] = None + """The score threshold to use for the rule.""" + + sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None + """The sensitivity level to use for the rule.""" + + +class ActionParametersOverrides(BaseModel): + action: Optional[str] = None + """An action to override all rules with. + + This option has lower precedence than rule and category overrides. + """ + + categories: Optional[List[ActionParametersOverridesCategory]] = None + """A list of category-level overrides. + + This option has the second-highest precedence after rule-level overrides. + """ + + enabled: Optional[bool] = None + """Whether to enable execution of all rules. + + This option has lower precedence than rule and category overrides. + """ + + rules: Optional[List[ActionParametersOverridesRule]] = None + """A list of rule-level overrides. This option has the highest precedence.""" + + sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None + """A sensitivity level to set for all rules. + + This option has lower precedence than rule and category overrides and is only + applicable for DDoS phases. + """ + + +class ActionParameters(BaseModel): + id: str + """The ID of the ruleset to execute.""" + + matched_data: Optional[ActionParametersMatchedData] = None + """The configuration to use for matched data logging.""" + + overrides: Optional[ActionParametersOverrides] = None + """A set of overrides to apply to the target ruleset.""" + + +class ExecuteRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["execute"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/execute_rule_param.py b/src/cloudflare/types/rulesets/execute_rule_param.py new file mode 100644 index 00000000000..e720f682577 --- /dev/null +++ b/src/cloudflare/types/rulesets/execute_rule_param.py @@ -0,0 +1,120 @@ +# 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 + +from .logging_param import LoggingParam + +__all__ = [ + "ExecuteRuleParam", + "ActionParameters", + "ActionParametersMatchedData", + "ActionParametersOverrides", + "ActionParametersOverridesCategory", + "ActionParametersOverridesRule", +] + + +class ActionParametersMatchedData(TypedDict, total=False): + public_key: Required[str] + """The public key to encrypt matched data logs with.""" + + +class ActionParametersOverridesCategory(TypedDict, total=False): + category: Required[str] + """The name of the category to override.""" + + action: str + """The action to override rules in the category with.""" + + enabled: bool + """Whether to enable execution of rules in the category.""" + + sensitivity_level: Literal["default", "medium", "low", "eoff"] + """The sensitivity level to use for rules in the category.""" + + +class ActionParametersOverridesRule(TypedDict, total=False): + id: Required[str] + """The ID of the rule to override.""" + + action: str + """The action to override the rule with.""" + + enabled: bool + """Whether to enable execution of the rule.""" + + score_threshold: int + """The score threshold to use for the rule.""" + + sensitivity_level: Literal["default", "medium", "low", "eoff"] + """The sensitivity level to use for the rule.""" + + +class ActionParametersOverrides(TypedDict, total=False): + action: str + """An action to override all rules with. + + This option has lower precedence than rule and category overrides. + """ + + categories: Iterable[ActionParametersOverridesCategory] + """A list of category-level overrides. + + This option has the second-highest precedence after rule-level overrides. + """ + + enabled: bool + """Whether to enable execution of all rules. + + This option has lower precedence than rule and category overrides. + """ + + rules: Iterable[ActionParametersOverridesRule] + """A list of rule-level overrides. This option has the highest precedence.""" + + sensitivity_level: Literal["default", "medium", "low", "eoff"] + """A sensitivity level to set for all rules. + + This option has lower precedence than rule and category overrides and is only + applicable for DDoS phases. + """ + + +class ActionParameters(TypedDict, total=False): + id: Required[str] + """The ID of the ruleset to execute.""" + + matched_data: ActionParametersMatchedData + """The configuration to use for matched data logging.""" + + overrides: ActionParametersOverrides + """A set of overrides to apply to the target ruleset.""" + + +class ExecuteRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["execute"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/js_challenge_rule.py b/src/cloudflare/types/rulesets/js_challenge_rule.py new file mode 100644 index 00000000000..7e1325ba2e3 --- /dev/null +++ b/src/cloudflare/types/rulesets/js_challenge_rule.py @@ -0,0 +1,45 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["JSChallengeRule"] + + +class JSChallengeRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["js_challenge"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/js_challenge_rule_param.py b/src/cloudflare/types/rulesets/js_challenge_rule_param.py new file mode 100644 index 00000000000..ded155dfeb2 --- /dev/null +++ b/src/cloudflare/types/rulesets/js_challenge_rule_param.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["JSChallengeRuleParam"] + + +class JSChallengeRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["js_challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/log_rule.py b/src/cloudflare/types/rulesets/log_rule.py new file mode 100644 index 00000000000..2f0ae1804b8 --- /dev/null +++ b/src/cloudflare/types/rulesets/log_rule.py @@ -0,0 +1,45 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["LogRule"] + + +class LogRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["log"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/log_rule_param.py b/src/cloudflare/types/rulesets/log_rule_param.py new file mode 100644 index 00000000000..ef0c1e455ca --- /dev/null +++ b/src/cloudflare/types/rulesets/log_rule_param.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["LogRuleParam"] + + +class LogRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["log"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/logging.py b/src/cloudflare/types/rulesets/logging.py new file mode 100644 index 00000000000..d7a37ba86e6 --- /dev/null +++ b/src/cloudflare/types/rulesets/logging.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Logging"] + + +class Logging(BaseModel): + enabled: bool + """Whether to generate a log when the rule matches.""" diff --git a/src/cloudflare/types/rulesets/logging_param.py b/src/cloudflare/types/rulesets/logging_param.py new file mode 100644 index 00000000000..7ffdd5a2f4d --- /dev/null +++ b/src/cloudflare/types/rulesets/logging_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LoggingParam"] + + +class LoggingParam(TypedDict, total=False): + enabled: Required[bool] + """Whether to generate a log when the rule matches.""" diff --git a/src/cloudflare/types/rulesets/managed_challenge_rule.py b/src/cloudflare/types/rulesets/managed_challenge_rule.py new file mode 100644 index 00000000000..6c2772bd14d --- /dev/null +++ b/src/cloudflare/types/rulesets/managed_challenge_rule.py @@ -0,0 +1,45 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["ManagedChallengeRule"] + + +class ManagedChallengeRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["managed_challenge"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/managed_challenge_rule_param.py b/src/cloudflare/types/rulesets/managed_challenge_rule_param.py new file mode 100644 index 00000000000..63ccee1f4a2 --- /dev/null +++ b/src/cloudflare/types/rulesets/managed_challenge_rule_param.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["ManagedChallengeRuleParam"] + + +class ManagedChallengeRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["managed_challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py new file mode 100644 index 00000000000..ba836f604ee --- /dev/null +++ b/src/cloudflare/types/rulesets/phase_get_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["PhaseGetResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class PhaseGetResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py index 478f38a9f16..234efabd899 100644 --- a/src/cloudflare/types/rulesets/phase_update_params.py +++ b/src/cloudflare/types/rulesets/phase_update_params.py @@ -2,35 +2,29 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable +from typing import Union, Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = [ - "PhaseUpdateParams", - "Rule", - "RuleRulesetsBlockRule", - "RuleRulesetsBlockRuleActionParameters", - "RuleRulesetsBlockRuleActionParametersResponse", - "RuleRulesetsBlockRuleLogging", - "RuleRulesetsExecuteRule", - "RuleRulesetsExecuteRuleActionParameters", - "RuleRulesetsExecuteRuleActionParametersMatchedData", - "RuleRulesetsExecuteRuleActionParametersOverrides", - "RuleRulesetsExecuteRuleActionParametersOverridesCategory", - "RuleRulesetsExecuteRuleActionParametersOverridesRule", - "RuleRulesetsExecuteRuleLogging", - "RuleRulesetsLogRule", - "RuleRulesetsLogRuleLogging", - "RuleRulesetsSkipRule", - "RuleRulesetsSkipRuleActionParameters", - "RuleRulesetsSkipRuleLogging", -] +from .log_rule_param import LogRuleParam +from .skip_rule_param import SkipRuleParam +from .block_rule_param import BlockRuleParam +from .route_rule_param import RouteRuleParam +from .score_rule_param import ScoreRuleParam +from .execute_rule_param import ExecuteRuleParam +from .rewrite_rule_param import RewriteRuleParam +from .redirect_rule_param import RedirectRuleParam +from .challenge_rule_param import ChallengeRuleParam +from .set_config_rule_param import SetConfigRuleParam +from .serve_error_rule_param import ServeErrorRuleParam +from .js_challenge_rule_param import JSChallengeRuleParam +from .compress_response_rule_param import CompressResponseRuleParam +from .managed_challenge_rule_param import ManagedChallengeRuleParam +from .set_cache_settings_rule_param import SetCacheSettingsRuleParam + +__all__ = ["PhaseUpdateParams", "Rule"] class PhaseUpdateParams(TypedDict, total=False): - id: Required[str] - """The unique ID of the ruleset.""" - rules: Required[Iterable[Rule]] """The list of rules in the ruleset.""" @@ -77,276 +71,20 @@ class PhaseUpdateParams(TypedDict, total=False): """The phase of the ruleset.""" -class RuleRulesetsBlockRuleActionParametersResponse(TypedDict, total=False): - content: Required[str] - """The content to return.""" - - content_type: Required[str] - """The type of the content to return.""" - - status_code: Required[int] - """The status code to return.""" - - -class RuleRulesetsBlockRuleActionParameters(TypedDict, total=False): - response: RuleRulesetsBlockRuleActionParametersResponse - """The response to show when the block is applied.""" - - -class RuleRulesetsBlockRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsBlockRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["block"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsBlockRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsBlockRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False): - public_key: Required[str] - """The public key to encrypt matched data logs with.""" - - -class RuleRulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False): - category: Required[str] - """The name of the category to override.""" - - action: str - """The action to override rules in the category with.""" - - enabled: bool - """Whether to enable execution of rules in the category.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """The sensitivity level to use for rules in the category.""" - - -class RuleRulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False): - id: Required[str] - """The ID of the rule to override.""" - - action: str - """The action to override the rule with.""" - - enabled: bool - """Whether to enable execution of the rule.""" - - score_threshold: int - """The score threshold to use for the rule.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """The sensitivity level to use for the rule.""" - - -class RuleRulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): - action: str - """An action to override all rules with. - - This option has lower precedence than rule and category overrides. - """ - - categories: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesCategory] - """A list of category-level overrides. - - This option has the second-highest precedence after rule-level overrides. - """ - - enabled: bool - """Whether to enable execution of all rules. - - This option has lower precedence than rule and category overrides. - """ - - rules: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesRule] - """A list of rule-level overrides. This option has the highest precedence.""" - - sensitivity_level: Literal["default", "medium", "low", "eoff"] - """A sensitivity level to set for all rules. - - This option has lower precedence than rule and category overrides and is only - applicable for DDoS phases. - """ - - -class RuleRulesetsExecuteRuleActionParameters(TypedDict, total=False): - id: Required[str] - """The ID of the ruleset to execute.""" - - matched_data: RuleRulesetsExecuteRuleActionParametersMatchedData - """The configuration to use for matched data logging.""" - - overrides: RuleRulesetsExecuteRuleActionParametersOverrides - """A set of overrides to apply to the target ruleset.""" - - -class RuleRulesetsExecuteRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsExecuteRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["execute"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsExecuteRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsExecuteRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsLogRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsLogRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["log"] - """The action to perform when the rule matches.""" - - action_parameters: object - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsLogRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -class RuleRulesetsSkipRuleActionParameters(TypedDict, total=False): - phases: List[ - Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - ] - """A list of phases to skip the execution of. - - This option is incompatible with the ruleset and rulesets options. - """ - - products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]] - """A list of legacy security products to skip the execution of.""" - - rules: Dict[str, List[str]] - """ - A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the - execution of. This option is incompatible with the ruleset option. - """ - - ruleset: Literal["current"] - """A ruleset to skip the execution of. - - This option is incompatible with the rulesets, rules and phases options. - """ - - rulesets: List[str] - """A list of ruleset IDs to skip the execution of. - - This option is incompatible with the ruleset and phases options. - """ - - -class RuleRulesetsSkipRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" - - -class RuleRulesetsSkipRule(TypedDict, total=False): - id: str - """The unique ID of the rule.""" - - action: Literal["skip"] - """The action to perform when the rule matches.""" - - action_parameters: RuleRulesetsSkipRuleActionParameters - """The parameters configuring the rule's action.""" - - description: str - """An informative description of the rule.""" - - enabled: bool - """Whether the rule should be executed.""" - - expression: str - """The expression defining which traffic will match the rule.""" - - logging: RuleRulesetsSkipRuleLogging - """An object configuring the rule's logging behavior.""" - - ref: str - """The reference of the rule (the rule ID by default).""" - - -Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule] +Rule = Union[ + BlockRuleParam, + ChallengeRuleParam, + CompressResponseRuleParam, + ExecuteRuleParam, + JSChallengeRuleParam, + LogRuleParam, + ManagedChallengeRuleParam, + RedirectRuleParam, + RewriteRuleParam, + RouteRuleParam, + ScoreRuleParam, + ServeErrorRuleParam, + SetConfigRuleParam, + SkipRuleParam, + SetCacheSettingsRuleParam, +] diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py new file mode 100644 index 00000000000..41257fc0f35 --- /dev/null +++ b/src/cloudflare/types/rulesets/phase_update_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["PhaseUpdateResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class PhaseUpdateResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/phases/__init__.py b/src/cloudflare/types/rulesets/phases/__init__.py index 6164c34d4c8..398f2bd04ad 100644 --- a/src/cloudflare/types/rulesets/phases/__init__.py +++ b/src/cloudflare/types/rulesets/phases/__init__.py @@ -2,4 +2,4 @@ from __future__ import annotations -from .version_list_response import VersionListResponse as VersionListResponse +from .version_get_response import VersionGetResponse as VersionGetResponse diff --git a/src/cloudflare/types/rulesets/phases/version_get_response.py b/src/cloudflare/types/rulesets/phases/version_get_response.py new file mode 100644 index 00000000000..3109c6c05f3 --- /dev/null +++ b/src/cloudflare/types/rulesets/phases/version_get_response.py @@ -0,0 +1,92 @@ +# 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 + +from ..log_rule import LogRule +from ...._models import BaseModel +from ..skip_rule import SkipRule +from ..block_rule import BlockRule +from ..route_rule import RouteRule +from ..score_rule import ScoreRule +from ..execute_rule import ExecuteRule +from ..rewrite_rule import RewriteRule +from ..redirect_rule import RedirectRule +from ..challenge_rule import ChallengeRule +from ..set_config_rule import SetConfigRule +from ..serve_error_rule import ServeErrorRule +from ..js_challenge_rule import JSChallengeRule +from ..compress_response_rule import CompressResponseRule +from ..managed_challenge_rule import ManagedChallengeRule +from ..set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["VersionGetResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class VersionGetResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/phases/version_list_response.py b/src/cloudflare/types/rulesets/phases/version_list_response.py deleted file mode 100644 index f91c007c1f9..00000000000 --- a/src/cloudflare/types/rulesets/phases/version_list_response.py +++ /dev/null @@ -1,56 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["VersionListResponse"] - - -class VersionListResponse(BaseModel): - kind: Literal["managed", "custom", "root", "zone"] - """The kind of the ruleset.""" - - name: str - """The human-readable name of the ruleset.""" - - phase: Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - """The phase of the ruleset.""" - - id: Optional[str] = None - """The unique ID of the ruleset.""" - - description: Optional[str] = None - """An informative description of the ruleset.""" - - last_updated: Optional[datetime] = None - """The timestamp of when the ruleset was last modified.""" - - version: Optional[str] = None - """The version of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/redirect_rule.py b/src/cloudflare/types/rulesets/redirect_rule.py new file mode 100644 index 00000000000..9c8d6246760 --- /dev/null +++ b/src/cloudflare/types/rulesets/redirect_rule.py @@ -0,0 +1,95 @@ +# 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 + +from .logging import Logging +from ..._models import BaseModel + +__all__ = [ + "RedirectRule", + "ActionParameters", + "ActionParametersFromList", + "ActionParametersFromValue", + "ActionParametersFromValueTargetURL", + "ActionParametersFromValueTargetURLStaticURLRedirect", + "ActionParametersFromValueTargetURLDynamicURLRedirect", +] + + +class ActionParametersFromList(BaseModel): + key: Optional[str] = None + """Expression that evaluates to the list lookup key.""" + + name: Optional[str] = None + """The name of the list to match against.""" + + +class ActionParametersFromValueTargetURLStaticURLRedirect(BaseModel): + value: Optional[str] = None + """The URL to redirect the request to.""" + + +class ActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel): + expression: Optional[str] = None + """An expression to evaluate to get the URL to redirect the request to.""" + + +ActionParametersFromValueTargetURL = Union[ + ActionParametersFromValueTargetURLStaticURLRedirect, ActionParametersFromValueTargetURLDynamicURLRedirect +] + + +class ActionParametersFromValue(BaseModel): + preserve_query_string: Optional[bool] = None + """Keep the query string of the original request.""" + + status_code: Optional[Literal[301, 302, 303, 307, 308]] = None + """The status code to be used for the redirect.""" + + target_url: Optional[ActionParametersFromValueTargetURL] = None + """The URL to redirect the request to.""" + + +class ActionParameters(BaseModel): + from_list: Optional[ActionParametersFromList] = None + """Serve a redirect based on a bulk list lookup.""" + + from_value: Optional[ActionParametersFromValue] = None + """Serve a redirect based on the request properties.""" + + +class RedirectRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["redirect"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/redirect_rule_param.py b/src/cloudflare/types/rulesets/redirect_rule_param.py new file mode 100644 index 00000000000..ef67a8411f7 --- /dev/null +++ b/src/cloudflare/types/rulesets/redirect_rule_param.py @@ -0,0 +1,86 @@ +# 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, TypedDict + +from .logging_param import LoggingParam + +__all__ = [ + "RedirectRuleParam", + "ActionParameters", + "ActionParametersFromList", + "ActionParametersFromValue", + "ActionParametersFromValueTargetURL", + "ActionParametersFromValueTargetURLStaticURLRedirect", + "ActionParametersFromValueTargetURLDynamicURLRedirect", +] + + +class ActionParametersFromList(TypedDict, total=False): + key: str + """Expression that evaluates to the list lookup key.""" + + name: str + """The name of the list to match against.""" + + +class ActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False): + value: str + """The URL to redirect the request to.""" + + +class ActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False): + expression: str + """An expression to evaluate to get the URL to redirect the request to.""" + + +ActionParametersFromValueTargetURL = Union[ + ActionParametersFromValueTargetURLStaticURLRedirect, ActionParametersFromValueTargetURLDynamicURLRedirect +] + + +class ActionParametersFromValue(TypedDict, total=False): + preserve_query_string: bool + """Keep the query string of the original request.""" + + status_code: Literal[301, 302, 303, 307, 308] + """The status code to be used for the redirect.""" + + target_url: ActionParametersFromValueTargetURL + """The URL to redirect the request to.""" + + +class ActionParameters(TypedDict, total=False): + from_list: ActionParametersFromList + """Serve a redirect based on a bulk list lookup.""" + + from_value: ActionParametersFromValue + """Serve a redirect based on the request properties.""" + + +class RedirectRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["redirect"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/rewrite_rule.py b/src/cloudflare/types/rulesets/rewrite_rule.py new file mode 100644 index 00000000000..aa76c3d0894 --- /dev/null +++ b/src/cloudflare/types/rulesets/rewrite_rule.py @@ -0,0 +1,93 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from .logging import Logging +from ..._models import BaseModel +from .rewrite_uri_part import RewriteURIPart + +__all__ = [ + "RewriteRule", + "ActionParameters", + "ActionParametersHeaders", + "ActionParametersHeadersRemoveHeader", + "ActionParametersHeadersStaticHeader", + "ActionParametersHeadersDynamicHeader", + "ActionParametersURI", +] + + +class ActionParametersHeadersRemoveHeader(BaseModel): + operation: Literal["remove"] + + +class ActionParametersHeadersStaticHeader(BaseModel): + operation: Literal["set"] + + value: str + """Static value for the header.""" + + +class ActionParametersHeadersDynamicHeader(BaseModel): + expression: str + """Expression for the header value.""" + + operation: Literal["set"] + + +ActionParametersHeaders = Union[ + ActionParametersHeadersRemoveHeader, ActionParametersHeadersStaticHeader, ActionParametersHeadersDynamicHeader +] + + +class ActionParametersURI(BaseModel): + path: Optional[RewriteURIPart] = None + """Path portion rewrite.""" + + query: Optional[RewriteURIPart] = None + """Query portion rewrite.""" + + +class ActionParameters(BaseModel): + headers: Optional[Dict[str, ActionParametersHeaders]] = None + """Map of request headers to modify.""" + + uri: Optional[ActionParametersURI] = None + """URI to rewrite the request to.""" + + +class RewriteRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["rewrite"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/rewrite_rule_param.py b/src/cloudflare/types/rulesets/rewrite_rule_param.py new file mode 100644 index 00000000000..0b0e5617f65 --- /dev/null +++ b/src/cloudflare/types/rulesets/rewrite_rule_param.py @@ -0,0 +1,84 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union +from typing_extensions import Literal, Required, TypedDict + +from .logging_param import LoggingParam +from .rewrite_uri_part_param import RewriteURIPartParam + +__all__ = [ + "RewriteRuleParam", + "ActionParameters", + "ActionParametersHeaders", + "ActionParametersHeadersRemoveHeader", + "ActionParametersHeadersStaticHeader", + "ActionParametersHeadersDynamicHeader", + "ActionParametersURI", +] + + +class ActionParametersHeadersRemoveHeader(TypedDict, total=False): + operation: Required[Literal["remove"]] + + +class ActionParametersHeadersStaticHeader(TypedDict, total=False): + operation: Required[Literal["set"]] + + value: Required[str] + """Static value for the header.""" + + +class ActionParametersHeadersDynamicHeader(TypedDict, total=False): + expression: Required[str] + """Expression for the header value.""" + + operation: Required[Literal["set"]] + + +ActionParametersHeaders = Union[ + ActionParametersHeadersRemoveHeader, ActionParametersHeadersStaticHeader, ActionParametersHeadersDynamicHeader +] + + +class ActionParametersURI(TypedDict, total=False): + path: RewriteURIPartParam + """Path portion rewrite.""" + + query: RewriteURIPartParam + """Query portion rewrite.""" + + +class ActionParameters(TypedDict, total=False): + headers: Dict[str, ActionParametersHeaders] + """Map of request headers to modify.""" + + uri: ActionParametersURI + """URI to rewrite the request to.""" + + +class RewriteRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["rewrite"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/rewrite_uri_part.py b/src/cloudflare/types/rulesets/rewrite_uri_part.py new file mode 100644 index 00000000000..b8620330c13 --- /dev/null +++ b/src/cloudflare/types/rulesets/rewrite_uri_part.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +from ..._models import BaseModel + +__all__ = ["RewriteURIPart", "StaticValue", "DynamicValue"] + + +class StaticValue(BaseModel): + value: str + """Predefined replacement value.""" + + +class DynamicValue(BaseModel): + expression: str + """Expression to evaluate for the replacement value.""" + + +RewriteURIPart = Union[StaticValue, DynamicValue] diff --git a/src/cloudflare/types/rulesets/rewrite_uri_part_param.py b/src/cloudflare/types/rulesets/rewrite_uri_part_param.py new file mode 100644 index 00000000000..32d4397ceee --- /dev/null +++ b/src/cloudflare/types/rulesets/rewrite_uri_part_param.py @@ -0,0 +1,21 @@ +# 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 Required, TypedDict + +__all__ = ["RewriteURIPartParam", "StaticValue", "DynamicValue"] + + +class StaticValue(TypedDict, total=False): + value: Required[str] + """Predefined replacement value.""" + + +class DynamicValue(TypedDict, total=False): + expression: Required[str] + """Expression to evaluate for the replacement value.""" + + +RewriteURIPartParam = Union[StaticValue, DynamicValue] diff --git a/src/cloudflare/types/rulesets/route_rule.py b/src/cloudflare/types/rulesets/route_rule.py new file mode 100644 index 00000000000..79ac7512ba0 --- /dev/null +++ b/src/cloudflare/types/rulesets/route_rule.py @@ -0,0 +1,69 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["RouteRule", "ActionParameters", "ActionParametersOrigin", "ActionParametersSni"] + + +class ActionParametersOrigin(BaseModel): + host: Optional[str] = None + """Override the resolved hostname.""" + + port: Optional[float] = None + """Override the destination port.""" + + +class ActionParametersSni(BaseModel): + value: str + """The SNI override.""" + + +class ActionParameters(BaseModel): + host_header: Optional[str] = None + """Rewrite the HTTP Host header.""" + + origin: Optional[ActionParametersOrigin] = None + """Override the IP/TCP destination.""" + + sni: Optional[ActionParametersSni] = None + """Override the Server Name Indication (SNI).""" + + +class RouteRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["route"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/route_rule_param.py b/src/cloudflare/types/rulesets/route_rule_param.py new file mode 100644 index 00000000000..06ba330a332 --- /dev/null +++ b/src/cloudflare/types/rulesets/route_rule_param.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["RouteRuleParam", "ActionParameters", "ActionParametersOrigin", "ActionParametersSni"] + + +class ActionParametersOrigin(TypedDict, total=False): + host: str + """Override the resolved hostname.""" + + port: float + """Override the destination port.""" + + +class ActionParametersSni(TypedDict, total=False): + value: Required[str] + """The SNI override.""" + + +class ActionParameters(TypedDict, total=False): + host_header: str + """Rewrite the HTTP Host header.""" + + origin: ActionParametersOrigin + """Override the IP/TCP destination.""" + + sni: ActionParametersSni + """Override the Server Name Indication (SNI).""" + + +class RouteRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["route"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/rule_create_params.py b/src/cloudflare/types/rulesets/rule_create_params.py index 3a8867ac974..0aa3ff1f5a8 100644 --- a/src/cloudflare/types/rulesets/rule_create_params.py +++ b/src/cloudflare/types/rulesets/rule_create_params.py @@ -5,28 +5,75 @@ from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypedDict +from .logging_param import LoggingParam +from .rewrite_uri_part_param import RewriteURIPartParam + __all__ = [ "RuleCreateParams", - "RulesetsBlockRule", - "RulesetsBlockRuleActionParameters", - "RulesetsBlockRuleActionParametersResponse", - "RulesetsBlockRuleLogging", - "RulesetsExecuteRule", - "RulesetsExecuteRuleActionParameters", - "RulesetsExecuteRuleActionParametersMatchedData", - "RulesetsExecuteRuleActionParametersOverrides", - "RulesetsExecuteRuleActionParametersOverridesCategory", - "RulesetsExecuteRuleActionParametersOverridesRule", - "RulesetsExecuteRuleLogging", - "RulesetsLogRule", - "RulesetsLogRuleLogging", - "RulesetsSkipRule", - "RulesetsSkipRuleActionParameters", - "RulesetsSkipRuleLogging", + "BlockRule", + "BlockRuleActionParameters", + "BlockRuleActionParametersResponse", + "ChallengeRule", + "CompressResponseRule", + "CompressResponseRuleActionParameters", + "CompressResponseRuleActionParametersAlgorithm", + "ExecuteRule", + "ExecuteRuleActionParameters", + "ExecuteRuleActionParametersMatchedData", + "ExecuteRuleActionParametersOverrides", + "ExecuteRuleActionParametersOverridesCategory", + "ExecuteRuleActionParametersOverridesRule", + "JSChallengeRule", + "LogRule", + "ManagedChallengeRule", + "RedirectRule", + "RedirectRuleActionParameters", + "RedirectRuleActionParametersFromList", + "RedirectRuleActionParametersFromValue", + "RedirectRuleActionParametersFromValueTargetURL", + "RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect", + "RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect", + "RewriteRule", + "RewriteRuleActionParameters", + "RewriteRuleActionParametersHeaders", + "RewriteRuleActionParametersHeadersRemoveHeader", + "RewriteRuleActionParametersHeadersStaticHeader", + "RewriteRuleActionParametersHeadersDynamicHeader", + "RewriteRuleActionParametersURI", + "RouteRule", + "RouteRuleActionParameters", + "RouteRuleActionParametersOrigin", + "RouteRuleActionParametersSni", + "ScoreRule", + "ScoreRuleActionParameters", + "ServeErrorRule", + "ServeErrorRuleActionParameters", + "SetConfigRule", + "SetConfigRuleActionParameters", + "SetConfigRuleActionParametersAutominify", + "SkipRule", + "SkipRuleActionParameters", + "SetCacheSettingsRule", + "SetCacheSettingsRuleActionParameters", + "SetCacheSettingsRuleActionParametersBrowserTTL", + "SetCacheSettingsRuleActionParametersCacheKey", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKey", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser", + "SetCacheSettingsRuleActionParametersCacheReserve", + "SetCacheSettingsRuleActionParametersEdgeTTL", + "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL", + "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange", + "SetCacheSettingsRuleActionParametersServeStale", ] -class RulesetsBlockRule(TypedDict, total=False): +class BlockRule(TypedDict, total=False): account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" @@ -39,7 +86,7 @@ class RulesetsBlockRule(TypedDict, total=False): action: Literal["block"] """The action to perform when the rule matches.""" - action_parameters: RulesetsBlockRuleActionParameters + action_parameters: BlockRuleActionParameters """The parameters configuring the rule's action.""" description: str @@ -51,14 +98,14 @@ class RulesetsBlockRule(TypedDict, total=False): expression: str """The expression defining which traffic will match the rule.""" - logging: RulesetsBlockRuleLogging + logging: LoggingParam """An object configuring the rule's logging behavior.""" ref: str """The reference of the rule (the rule ID by default).""" -class RulesetsBlockRuleActionParametersResponse(TypedDict, total=False): +class BlockRuleActionParametersResponse(TypedDict, total=False): content: Required[str] """The content to return.""" @@ -69,17 +116,86 @@ class RulesetsBlockRuleActionParametersResponse(TypedDict, total=False): """The status code to return.""" -class RulesetsBlockRuleActionParameters(TypedDict, total=False): - response: RulesetsBlockRuleActionParametersResponse +class BlockRuleActionParameters(TypedDict, total=False): + response: BlockRuleActionParametersResponse """The response to show when the block is applied.""" -class RulesetsBlockRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" +class ChallengeRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class CompressResponseRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["compress_response"] + """The action to perform when the rule matches.""" + + action_parameters: CompressResponseRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + enabled: bool + """Whether the rule should be executed.""" -class RulesetsExecuteRule(TypedDict, total=False): + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class CompressResponseRuleActionParametersAlgorithm(TypedDict, total=False): + name: Literal["none", "auto", "default", "gzip", "brotli"] + """Name of compression algorithm to enable.""" + + +class CompressResponseRuleActionParameters(TypedDict, total=False): + algorithms: Iterable[CompressResponseRuleActionParametersAlgorithm] + """Custom order for compression algorithms.""" + + +class ExecuteRule(TypedDict, total=False): account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" @@ -92,7 +208,7 @@ class RulesetsExecuteRule(TypedDict, total=False): action: Literal["execute"] """The action to perform when the rule matches.""" - action_parameters: RulesetsExecuteRuleActionParameters + action_parameters: ExecuteRuleActionParameters """The parameters configuring the rule's action.""" description: str @@ -104,19 +220,19 @@ class RulesetsExecuteRule(TypedDict, total=False): expression: str """The expression defining which traffic will match the rule.""" - logging: RulesetsExecuteRuleLogging + logging: LoggingParam """An object configuring the rule's logging behavior.""" ref: str """The reference of the rule (the rule ID by default).""" -class RulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False): +class ExecuteRuleActionParametersMatchedData(TypedDict, total=False): public_key: Required[str] """The public key to encrypt matched data logs with.""" -class RulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False): +class ExecuteRuleActionParametersOverridesCategory(TypedDict, total=False): category: Required[str] """The name of the category to override.""" @@ -130,7 +246,7 @@ class RulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=Fals """The sensitivity level to use for rules in the category.""" -class RulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False): +class ExecuteRuleActionParametersOverridesRule(TypedDict, total=False): id: Required[str] """The ID of the rule to override.""" @@ -147,14 +263,14 @@ class RulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False): """The sensitivity level to use for the rule.""" -class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): +class ExecuteRuleActionParametersOverrides(TypedDict, total=False): action: str """An action to override all rules with. This option has lower precedence than rule and category overrides. """ - categories: Iterable[RulesetsExecuteRuleActionParametersOverridesCategory] + categories: Iterable[ExecuteRuleActionParametersOverridesCategory] """A list of category-level overrides. This option has the second-highest precedence after rule-level overrides. @@ -166,7 +282,7 @@ class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): This option has lower precedence than rule and category overrides. """ - rules: Iterable[RulesetsExecuteRuleActionParametersOverridesRule] + rules: Iterable[ExecuteRuleActionParametersOverridesRule] """A list of rule-level overrides. This option has the highest precedence.""" sensitivity_level: Literal["default", "medium", "low", "eoff"] @@ -177,23 +293,50 @@ class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): """ -class RulesetsExecuteRuleActionParameters(TypedDict, total=False): +class ExecuteRuleActionParameters(TypedDict, total=False): id: Required[str] """The ID of the ruleset to execute.""" - matched_data: RulesetsExecuteRuleActionParametersMatchedData + matched_data: ExecuteRuleActionParametersMatchedData """The configuration to use for matched data logging.""" - overrides: RulesetsExecuteRuleActionParametersOverrides + overrides: ExecuteRuleActionParametersOverrides """A set of overrides to apply to the target ruleset.""" -class RulesetsExecuteRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" +class JSChallengeRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["js_challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" -class RulesetsLogRule(TypedDict, total=False): + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class LogRule(TypedDict, total=False): account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" @@ -218,19 +361,423 @@ class RulesetsLogRule(TypedDict, total=False): expression: str """The expression defining which traffic will match the rule.""" - logging: RulesetsLogRuleLogging + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class ManagedChallengeRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["managed_challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RedirectRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["redirect"] + """The action to perform when the rule matches.""" + + action_parameters: RedirectRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RedirectRuleActionParametersFromList(TypedDict, total=False): + key: str + """Expression that evaluates to the list lookup key.""" + + name: str + """The name of the list to match against.""" + + +class RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False): + value: str + """The URL to redirect the request to.""" + + +class RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False): + expression: str + """An expression to evaluate to get the URL to redirect the request to.""" + + +RedirectRuleActionParametersFromValueTargetURL = Union[ + RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect, + RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect, +] + + +class RedirectRuleActionParametersFromValue(TypedDict, total=False): + preserve_query_string: bool + """Keep the query string of the original request.""" + + status_code: Literal[301, 302, 303, 307, 308] + """The status code to be used for the redirect.""" + + target_url: RedirectRuleActionParametersFromValueTargetURL + """The URL to redirect the request to.""" + + +class RedirectRuleActionParameters(TypedDict, total=False): + from_list: RedirectRuleActionParametersFromList + """Serve a redirect based on a bulk list lookup.""" + + from_value: RedirectRuleActionParametersFromValue + """Serve a redirect based on the request properties.""" + + +class RewriteRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["rewrite"] + """The action to perform when the rule matches.""" + + action_parameters: RewriteRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False): + operation: Required[Literal["remove"]] + + +class RewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False): + operation: Required[Literal["set"]] + + value: Required[str] + """Static value for the header.""" + + +class RewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False): + expression: Required[str] + """Expression for the header value.""" + + operation: Required[Literal["set"]] + + +RewriteRuleActionParametersHeaders = Union[ + RewriteRuleActionParametersHeadersRemoveHeader, + RewriteRuleActionParametersHeadersStaticHeader, + RewriteRuleActionParametersHeadersDynamicHeader, +] + + +class RewriteRuleActionParametersURI(TypedDict, total=False): + path: RewriteURIPartParam + """Path portion rewrite.""" + + query: RewriteURIPartParam + """Query portion rewrite.""" + + +class RewriteRuleActionParameters(TypedDict, total=False): + headers: Dict[str, RewriteRuleActionParametersHeaders] + """Map of request headers to modify.""" + + uri: RewriteRuleActionParametersURI + """URI to rewrite the request to.""" + + +class RouteRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["route"] + """The action to perform when the rule matches.""" + + action_parameters: RouteRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RouteRuleActionParametersOrigin(TypedDict, total=False): + host: str + """Override the resolved hostname.""" + + port: float + """Override the destination port.""" + + +class RouteRuleActionParametersSni(TypedDict, total=False): + value: Required[str] + """The SNI override.""" + + +class RouteRuleActionParameters(TypedDict, total=False): + host_header: str + """Rewrite the HTTP Host header.""" + + origin: RouteRuleActionParametersOrigin + """Override the IP/TCP destination.""" + + sni: RouteRuleActionParametersSni + """Override the Server Name Indication (SNI).""" + + +class ScoreRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["score"] + """The action to perform when the rule matches.""" + + action_parameters: ScoreRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class ScoreRuleActionParameters(TypedDict, total=False): + increment: int + """ + Increment contains the delta to change the score and can be either positive or + negative. + """ + + +class ServeErrorRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["serve_error"] + """The action to perform when the rule matches.""" + + action_parameters: ServeErrorRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam """An object configuring the rule's logging behavior.""" ref: str """The reference of the rule (the rule ID by default).""" -class RulesetsLogRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" +class ServeErrorRuleActionParameters(TypedDict, total=False): + content: str + """Error response content.""" + + content_type: Literal["application/json", "text/xml", "text/plain", "text/html"] + """Content-type header to set with the response.""" + status_code: float + """The status code to use for the error.""" -class RulesetsSkipRule(TypedDict, total=False): + +class SetConfigRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["set_config"] + """The action to perform when the rule matches.""" + + action_parameters: SetConfigRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class SetConfigRuleActionParametersAutominify(TypedDict, total=False): + css: bool + """Minify CSS files.""" + + html: bool + """Minify HTML files.""" + + js: bool + """Minify JS files.""" + + +class SetConfigRuleActionParameters(TypedDict, total=False): + automatic_https_rewrites: bool + """Turn on or off Automatic HTTPS Rewrites.""" + + autominify: SetConfigRuleActionParametersAutominify + """Select which file extensions to minify automatically.""" + + bic: bool + """Turn on or off Browser Integrity Check.""" + + disable_apps: bool + """Turn off all active Cloudflare Apps.""" + + disable_zaraz: bool + """Turn off Zaraz.""" + + email_obfuscation: bool + """Turn on or off Email Obfuscation.""" + + hotlink_protection: bool + """Turn on or off the Hotlink Protection.""" + + mirage: bool + """Turn on or off Mirage.""" + + opportunistic_encryption: bool + """Turn on or off Opportunistic Encryption.""" + + polish: Literal["off", "lossless", "lossy"] + """Configure the Polish level.""" + + rocket_loader: bool + """Turn on or off Rocket Loader""" + + security_level: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] + """Configure the Security Level.""" + + server_side_excludes: bool + """Turn on or off Server Side Excludes.""" + + ssl: Literal["off", "flexible", "full", "strict", "origin_pull"] + """Configure the SSL level.""" + + sxg: bool + """Turn on or off Signed Exchanges (SXG).""" + + +class SkipRule(TypedDict, total=False): account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" @@ -243,7 +790,7 @@ class RulesetsSkipRule(TypedDict, total=False): action: Literal["skip"] """The action to perform when the rule matches.""" - action_parameters: RulesetsSkipRuleActionParameters + action_parameters: SkipRuleActionParameters """The parameters configuring the rule's action.""" description: str @@ -255,14 +802,14 @@ class RulesetsSkipRule(TypedDict, total=False): expression: str """The expression defining which traffic will match the rule.""" - logging: RulesetsSkipRuleLogging + logging: LoggingParam """An object configuring the rule's logging behavior.""" ref: str """The reference of the rule (the rule ID by default).""" -class RulesetsSkipRuleActionParameters(TypedDict, total=False): +class SkipRuleActionParameters(TypedDict, total=False): phases: List[ Literal[ "ddos_l4", @@ -317,9 +864,317 @@ class RulesetsSkipRuleActionParameters(TypedDict, total=False): """ -class RulesetsSkipRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" +class SetCacheSettingsRule(TypedDict, total=False): + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["set_cache_settings"] + """The action to perform when the rule matches.""" + + action_parameters: SetCacheSettingsRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class SetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False): + mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]] + """Determines which browser ttl mode to use.""" + + default: int + """The TTL (in seconds) if you choose override_origin mode.""" + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False): + check_presence: List[str] + """Checks for the presence of these cookie names. + + The presence of these cookies is used in building the cache key. + """ + + include: List[str] + """Include these cookies' names and their values.""" + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False): + check_presence: List[str] + """Checks for the presence of these header names. + + The presence of these headers is used in building the cache key. + """ + + exclude_origin: bool + """Whether or not to include the origin header. + + A value of true will exclude the origin header in the cache key. + """ + + include: List[str] + """Include these headers' names and their values.""" + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False): + resolved: bool + """Use the resolved host in the cache key. + + A value of true will use the resolved host, while a value or false will use the + original host. + """ + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False): + all: bool + """Exclude all query string parameters from use in building 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. + """ + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False): + all: bool + """Use all query string parameters in the cache key.""" + + 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 + """ + + include: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude + """ + build the cache key using a list of query string parameters that ARE in the + request. + """ + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False): + device_type: bool + """Use the user agent's device type in the cache key.""" + + geo: bool + """Use the user agents's country in the cache key.""" + + lang: bool + """Use the user agent's language in the cache key.""" + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False): + cookie: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie + """The cookies to include in building the cache key.""" + + header: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader + """The header names and values to include in building the cache key.""" + + host: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost + """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. + """ + + user: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser + """Characteristics of the request user agent used in building the cache key.""" + + +class SetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False): + cache_by_device_type: bool + """Separate cached content based on the visitor’s device type""" + + cache_deception_armor: bool + """ + Protect from web cache deception attacks while allowing static assets to be + cached + """ -RuleCreateParams = Union[RulesetsBlockRule, RulesetsExecuteRule, RulesetsLogRule, RulesetsSkipRule] + custom_key: SetCacheSettingsRuleActionParametersCacheKeyCustomKey + """ + Customize which components of the request are included or excluded from the + cache key. + """ + + ignore_query_strings_order: bool + """ + Treat requests with the same query parameters the same, regardless of the order + those query parameters are in. A value of true ignores the query strings' order. + """ + + +class SetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False): + eligible: Required[bool] + """Determines whether cache reserve is enabled. + + If this is true and a request meets eligibility criteria, Cloudflare will write + the resource to cache reserve. + """ + + min_file_size: Required[int] + """The minimum file size eligible for store in cache reserve.""" + + +_SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict( + "_SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords", + { + "from": int, + }, + total=False, +) + + +class SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange( + _SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False +): + to: Required[int] + """response status code upper bound""" + + +class SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False): + value: Required[int] + """Time to cache a response (in seconds). + + A value of 0 is equivalent to setting the Cache-Control header with the value + "no-cache". A value of -1 is equivalent to setting Cache-Control header with the + value of "no-store". + """ + + status_code_range: SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange + """The range of status codes used to apply the selected mode.""" + + status_code_value: int + """Set the ttl for responses with this specific status code""" + + +class SetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False): + default: Required[int] + """The TTL (in seconds) if you choose override_origin mode.""" + + mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]] + """edge ttl options""" + + status_code_ttl: Required[Iterable[SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]] + """List of single status codes, or status code ranges to apply the selected mode""" + + +class SetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False): + disable_stale_while_updating: Required[bool] + """Defines whether Cloudflare should serve stale content while updating. + + If true, Cloudflare will not serve stale content while getting the latest + content from the origin. + """ + + +class SetCacheSettingsRuleActionParameters(TypedDict, total=False): + additional_cacheable_ports: Iterable[int] + """List of additional ports that caching can be enabled on.""" + + browser_ttl: SetCacheSettingsRuleActionParametersBrowserTTL + """Specify how long client browsers should cache the response. + + Cloudflare cache purge will not purge content cached on client browsers, so high + browser TTLs may lead to stale content. + """ + + cache: bool + """Mark whether the request’s response from origin is eligible for caching. + + Caching itself will still depend on the cache-control header and your other + caching configurations. + """ + + cache_key: SetCacheSettingsRuleActionParametersCacheKey + """ + Define which components of the request are included or excluded from the cache + key Cloudflare uses to store the response in cache. + """ + + cache_reserve: SetCacheSettingsRuleActionParametersCacheReserve + """ + Mark whether the request's response from origin is eligible for Cache Reserve + (requires a Cache Reserve add-on plan). + """ + + edge_ttl: SetCacheSettingsRuleActionParametersEdgeTTL + """ + TTL (Time to Live) specifies the maximum time to cache a resource in the + Cloudflare edge network. + """ + + origin_cache_control: bool + """When enabled, Cloudflare will aim to strictly adhere to RFC 7234.""" + + origin_error_page_passthru: bool + """Generate Cloudflare error pages from issues sent from the origin server. + + When on, error pages will trigger for issues from the origin + """ + + read_timeout: int + """ + Define a timeout value between two successive read operations to your origin + server. Historically, the timeout value between two read options from Cloudflare + to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 + errors because of timeouts from an origin server, try increasing this timeout + value. + """ + + respect_strong_etags: bool + """ + Specify whether or not Cloudflare should respect strong ETag (entity tag) + headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. + """ + + serve_stale: SetCacheSettingsRuleActionParametersServeStale + """ + Define if Cloudflare should serve stale content while getting the latest content + from the origin. If on, Cloudflare will not serve stale content while getting + the latest content from the origin. + """ + + +RuleCreateParams = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py new file mode 100644 index 00000000000..8e554d96ac9 --- /dev/null +++ b/src/cloudflare/types/rulesets/rule_create_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["RuleCreateResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class RuleCreateResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py new file mode 100644 index 00000000000..d729df47b53 --- /dev/null +++ b/src/cloudflare/types/rulesets/rule_delete_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["RuleDeleteResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class RuleDeleteResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/rule_edit_params.py b/src/cloudflare/types/rulesets/rule_edit_params.py index 4c92db407db..2b4fabd4b76 100644 --- a/src/cloudflare/types/rulesets/rule_edit_params.py +++ b/src/cloudflare/types/rulesets/rule_edit_params.py @@ -5,28 +5,75 @@ from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypedDict +from .logging_param import LoggingParam +from .rewrite_uri_part_param import RewriteURIPartParam + __all__ = [ "RuleEditParams", - "RulesetsBlockRule", - "RulesetsBlockRuleActionParameters", - "RulesetsBlockRuleActionParametersResponse", - "RulesetsBlockRuleLogging", - "RulesetsExecuteRule", - "RulesetsExecuteRuleActionParameters", - "RulesetsExecuteRuleActionParametersMatchedData", - "RulesetsExecuteRuleActionParametersOverrides", - "RulesetsExecuteRuleActionParametersOverridesCategory", - "RulesetsExecuteRuleActionParametersOverridesRule", - "RulesetsExecuteRuleLogging", - "RulesetsLogRule", - "RulesetsLogRuleLogging", - "RulesetsSkipRule", - "RulesetsSkipRuleActionParameters", - "RulesetsSkipRuleLogging", + "BlockRule", + "BlockRuleActionParameters", + "BlockRuleActionParametersResponse", + "ChallengeRule", + "CompressResponseRule", + "CompressResponseRuleActionParameters", + "CompressResponseRuleActionParametersAlgorithm", + "ExecuteRule", + "ExecuteRuleActionParameters", + "ExecuteRuleActionParametersMatchedData", + "ExecuteRuleActionParametersOverrides", + "ExecuteRuleActionParametersOverridesCategory", + "ExecuteRuleActionParametersOverridesRule", + "JSChallengeRule", + "LogRule", + "ManagedChallengeRule", + "RedirectRule", + "RedirectRuleActionParameters", + "RedirectRuleActionParametersFromList", + "RedirectRuleActionParametersFromValue", + "RedirectRuleActionParametersFromValueTargetURL", + "RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect", + "RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect", + "RewriteRule", + "RewriteRuleActionParameters", + "RewriteRuleActionParametersHeaders", + "RewriteRuleActionParametersHeadersRemoveHeader", + "RewriteRuleActionParametersHeadersStaticHeader", + "RewriteRuleActionParametersHeadersDynamicHeader", + "RewriteRuleActionParametersURI", + "RouteRule", + "RouteRuleActionParameters", + "RouteRuleActionParametersOrigin", + "RouteRuleActionParametersSni", + "ScoreRule", + "ScoreRuleActionParameters", + "ServeErrorRule", + "ServeErrorRuleActionParameters", + "SetConfigRule", + "SetConfigRuleActionParameters", + "SetConfigRuleActionParametersAutominify", + "SkipRule", + "SkipRuleActionParameters", + "SetCacheSettingsRule", + "SetCacheSettingsRuleActionParameters", + "SetCacheSettingsRuleActionParametersBrowserTTL", + "SetCacheSettingsRuleActionParametersCacheKey", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKey", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude", + "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser", + "SetCacheSettingsRuleActionParametersCacheReserve", + "SetCacheSettingsRuleActionParametersEdgeTTL", + "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL", + "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange", + "SetCacheSettingsRuleActionParametersServeStale", ] -class RulesetsBlockRule(TypedDict, total=False): +class BlockRule(TypedDict, total=False): ruleset_id: Required[str] """The unique ID of the ruleset.""" @@ -42,7 +89,7 @@ class RulesetsBlockRule(TypedDict, total=False): action: Literal["block"] """The action to perform when the rule matches.""" - action_parameters: RulesetsBlockRuleActionParameters + action_parameters: BlockRuleActionParameters """The parameters configuring the rule's action.""" description: str @@ -54,14 +101,14 @@ class RulesetsBlockRule(TypedDict, total=False): expression: str """The expression defining which traffic will match the rule.""" - logging: RulesetsBlockRuleLogging + logging: LoggingParam """An object configuring the rule's logging behavior.""" ref: str """The reference of the rule (the rule ID by default).""" -class RulesetsBlockRuleActionParametersResponse(TypedDict, total=False): +class BlockRuleActionParametersResponse(TypedDict, total=False): content: Required[str] """The content to return.""" @@ -72,17 +119,92 @@ class RulesetsBlockRuleActionParametersResponse(TypedDict, total=False): """The status code to return.""" -class RulesetsBlockRuleActionParameters(TypedDict, total=False): - response: RulesetsBlockRuleActionParametersResponse +class BlockRuleActionParameters(TypedDict, total=False): + response: BlockRuleActionParametersResponse """The response to show when the block is applied.""" -class RulesetsBlockRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" +class ChallengeRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class CompressResponseRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["compress_response"] + """The action to perform when the rule matches.""" + + action_parameters: CompressResponseRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class CompressResponseRuleActionParametersAlgorithm(TypedDict, total=False): + name: Literal["none", "auto", "default", "gzip", "brotli"] + """Name of compression algorithm to enable.""" -class RulesetsExecuteRule(TypedDict, total=False): +class CompressResponseRuleActionParameters(TypedDict, total=False): + algorithms: Iterable[CompressResponseRuleActionParametersAlgorithm] + """Custom order for compression algorithms.""" + + +class ExecuteRule(TypedDict, total=False): ruleset_id: Required[str] """The unique ID of the ruleset.""" @@ -98,7 +220,7 @@ class RulesetsExecuteRule(TypedDict, total=False): action: Literal["execute"] """The action to perform when the rule matches.""" - action_parameters: RulesetsExecuteRuleActionParameters + action_parameters: ExecuteRuleActionParameters """The parameters configuring the rule's action.""" description: str @@ -110,19 +232,19 @@ class RulesetsExecuteRule(TypedDict, total=False): expression: str """The expression defining which traffic will match the rule.""" - logging: RulesetsExecuteRuleLogging + logging: LoggingParam """An object configuring the rule's logging behavior.""" ref: str """The reference of the rule (the rule ID by default).""" -class RulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False): +class ExecuteRuleActionParametersMatchedData(TypedDict, total=False): public_key: Required[str] """The public key to encrypt matched data logs with.""" -class RulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False): +class ExecuteRuleActionParametersOverridesCategory(TypedDict, total=False): category: Required[str] """The name of the category to override.""" @@ -136,7 +258,7 @@ class RulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=Fals """The sensitivity level to use for rules in the category.""" -class RulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False): +class ExecuteRuleActionParametersOverridesRule(TypedDict, total=False): id: Required[str] """The ID of the rule to override.""" @@ -153,14 +275,14 @@ class RulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False): """The sensitivity level to use for the rule.""" -class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): +class ExecuteRuleActionParametersOverrides(TypedDict, total=False): action: str """An action to override all rules with. This option has lower precedence than rule and category overrides. """ - categories: Iterable[RulesetsExecuteRuleActionParametersOverridesCategory] + categories: Iterable[ExecuteRuleActionParametersOverridesCategory] """A list of category-level overrides. This option has the second-highest precedence after rule-level overrides. @@ -172,7 +294,7 @@ class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): This option has lower precedence than rule and category overrides. """ - rules: Iterable[RulesetsExecuteRuleActionParametersOverridesRule] + rules: Iterable[ExecuteRuleActionParametersOverridesRule] """A list of rule-level overrides. This option has the highest precedence.""" sensitivity_level: Literal["default", "medium", "low", "eoff"] @@ -183,23 +305,53 @@ class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False): """ -class RulesetsExecuteRuleActionParameters(TypedDict, total=False): +class ExecuteRuleActionParameters(TypedDict, total=False): id: Required[str] """The ID of the ruleset to execute.""" - matched_data: RulesetsExecuteRuleActionParametersMatchedData + matched_data: ExecuteRuleActionParametersMatchedData """The configuration to use for matched data logging.""" - overrides: RulesetsExecuteRuleActionParametersOverrides + overrides: ExecuteRuleActionParametersOverrides """A set of overrides to apply to the target ruleset.""" -class RulesetsExecuteRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" +class JSChallengeRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["js_challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" -class RulesetsLogRule(TypedDict, total=False): +class LogRule(TypedDict, total=False): ruleset_id: Required[str] """The unique ID of the ruleset.""" @@ -227,19 +379,49 @@ class RulesetsLogRule(TypedDict, total=False): expression: str """The expression defining which traffic will match the rule.""" - logging: RulesetsLogRuleLogging + logging: LoggingParam """An object configuring the rule's logging behavior.""" ref: str """The reference of the rule (the rule ID by default).""" -class RulesetsLogRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" +class ManagedChallengeRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["managed_challenge"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" -class RulesetsSkipRule(TypedDict, total=False): + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RedirectRule(TypedDict, total=False): ruleset_id: Required[str] """The unique ID of the ruleset.""" @@ -252,10 +434,10 @@ class RulesetsSkipRule(TypedDict, total=False): id: str """The unique ID of the rule.""" - action: Literal["skip"] + action: Literal["redirect"] """The action to perform when the rule matches.""" - action_parameters: RulesetsSkipRuleActionParameters + action_parameters: RedirectRuleActionParameters """The parameters configuring the rule's action.""" description: str @@ -267,71 +449,777 @@ class RulesetsSkipRule(TypedDict, total=False): expression: str """The expression defining which traffic will match the rule.""" - logging: RulesetsSkipRuleLogging + logging: LoggingParam """An object configuring the rule's logging behavior.""" ref: str """The reference of the rule (the rule ID by default).""" -class RulesetsSkipRuleActionParameters(TypedDict, total=False): - phases: List[ - Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - ] - """A list of phases to skip the execution of. +class RedirectRuleActionParametersFromList(TypedDict, total=False): + key: str + """Expression that evaluates to the list lookup key.""" - This option is incompatible with the ruleset and rulesets options. - """ + name: str + """The name of the list to match against.""" - products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]] - """A list of legacy security products to skip the execution of.""" - rules: Dict[str, List[str]] - """ - A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the - execution of. This option is incompatible with the ruleset option. - """ +class RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False): + value: str + """The URL to redirect the request to.""" - ruleset: Literal["current"] - """A ruleset to skip the execution of. - This option is incompatible with the rulesets, rules and phases options. - """ +class RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False): + expression: str + """An expression to evaluate to get the URL to redirect the request to.""" - rulesets: List[str] - """A list of ruleset IDs to skip the execution of. - This option is incompatible with the ruleset and phases options. - """ +RedirectRuleActionParametersFromValueTargetURL = Union[ + RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect, + RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect, +] + + +class RedirectRuleActionParametersFromValue(TypedDict, total=False): + preserve_query_string: bool + """Keep the query string of the original request.""" + + status_code: Literal[301, 302, 303, 307, 308] + """The status code to be used for the redirect.""" + + target_url: RedirectRuleActionParametersFromValueTargetURL + """The URL to redirect the request to.""" + + +class RedirectRuleActionParameters(TypedDict, total=False): + from_list: RedirectRuleActionParametersFromList + """Serve a redirect based on a bulk list lookup.""" + + from_value: RedirectRuleActionParametersFromValue + """Serve a redirect based on the request properties.""" + + +class RewriteRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["rewrite"] + """The action to perform when the rule matches.""" + + action_parameters: RewriteRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False): + operation: Required[Literal["remove"]] + + +class RewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False): + operation: Required[Literal["set"]] + + value: Required[str] + """Static value for the header.""" + + +class RewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False): + expression: Required[str] + """Expression for the header value.""" + + operation: Required[Literal["set"]] + + +RewriteRuleActionParametersHeaders = Union[ + RewriteRuleActionParametersHeadersRemoveHeader, + RewriteRuleActionParametersHeadersStaticHeader, + RewriteRuleActionParametersHeadersDynamicHeader, +] + +class RewriteRuleActionParametersURI(TypedDict, total=False): + path: RewriteURIPartParam + """Path portion rewrite.""" -class RulesetsSkipRuleLogging(TypedDict, total=False): - enabled: Required[bool] - """Whether to generate a log when the rule matches.""" + query: RewriteURIPartParam + """Query portion rewrite.""" -RuleEditParams = Union[RulesetsBlockRule, RulesetsExecuteRule, RulesetsLogRule, RulesetsSkipRule] +class RewriteRuleActionParameters(TypedDict, total=False): + headers: Dict[str, RewriteRuleActionParametersHeaders] + """Map of request headers to modify.""" + + uri: RewriteRuleActionParametersURI + """URI to rewrite the request to.""" + + +class RouteRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["route"] + """The action to perform when the rule matches.""" + + action_parameters: RouteRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RouteRuleActionParametersOrigin(TypedDict, total=False): + host: str + """Override the resolved hostname.""" + + port: float + """Override the destination port.""" + + +class RouteRuleActionParametersSni(TypedDict, total=False): + value: Required[str] + """The SNI override.""" + + +class RouteRuleActionParameters(TypedDict, total=False): + host_header: str + """Rewrite the HTTP Host header.""" + + origin: RouteRuleActionParametersOrigin + """Override the IP/TCP destination.""" + + sni: RouteRuleActionParametersSni + """Override the Server Name Indication (SNI).""" + + +class ScoreRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["score"] + """The action to perform when the rule matches.""" + + action_parameters: ScoreRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class ScoreRuleActionParameters(TypedDict, total=False): + increment: int + """ + Increment contains the delta to change the score and can be either positive or + negative. + """ + + +class ServeErrorRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["serve_error"] + """The action to perform when the rule matches.""" + + action_parameters: ServeErrorRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class ServeErrorRuleActionParameters(TypedDict, total=False): + content: str + """Error response content.""" + + content_type: Literal["application/json", "text/xml", "text/plain", "text/html"] + """Content-type header to set with the response.""" + + status_code: float + """The status code to use for the error.""" + + +class SetConfigRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["set_config"] + """The action to perform when the rule matches.""" + + action_parameters: SetConfigRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class SetConfigRuleActionParametersAutominify(TypedDict, total=False): + css: bool + """Minify CSS files.""" + + html: bool + """Minify HTML files.""" + + js: bool + """Minify JS files.""" + + +class SetConfigRuleActionParameters(TypedDict, total=False): + automatic_https_rewrites: bool + """Turn on or off Automatic HTTPS Rewrites.""" + + autominify: SetConfigRuleActionParametersAutominify + """Select which file extensions to minify automatically.""" + + bic: bool + """Turn on or off Browser Integrity Check.""" + + disable_apps: bool + """Turn off all active Cloudflare Apps.""" + + disable_zaraz: bool + """Turn off Zaraz.""" + + email_obfuscation: bool + """Turn on or off Email Obfuscation.""" + + hotlink_protection: bool + """Turn on or off the Hotlink Protection.""" + + mirage: bool + """Turn on or off Mirage.""" + + opportunistic_encryption: bool + """Turn on or off Opportunistic Encryption.""" + + polish: Literal["off", "lossless", "lossy"] + """Configure the Polish level.""" + + rocket_loader: bool + """Turn on or off Rocket Loader""" + + security_level: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] + """Configure the Security Level.""" + + server_side_excludes: bool + """Turn on or off Server Side Excludes.""" + + ssl: Literal["off", "flexible", "full", "strict", "origin_pull"] + """Configure the SSL level.""" + + sxg: bool + """Turn on or off Signed Exchanges (SXG).""" + + +class SkipRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["skip"] + """The action to perform when the rule matches.""" + + action_parameters: SkipRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class SkipRuleActionParameters(TypedDict, total=False): + phases: List[ + Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + ] + """A list of phases to skip the execution of. + + This option is incompatible with the ruleset and rulesets options. + """ + + products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]] + """A list of legacy security products to skip the execution of.""" + + rules: Dict[str, List[str]] + """ + A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + execution of. This option is incompatible with the ruleset option. + """ + + ruleset: Literal["current"] + """A ruleset to skip the execution of. + + This option is incompatible with the rulesets, rules and phases options. + """ + + rulesets: List[str] + """A list of ruleset IDs to skip the execution of. + + This option is incompatible with the ruleset and phases options. + """ + + +class SetCacheSettingsRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + 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.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["set_cache_settings"] + """The action to perform when the rule matches.""" + + action_parameters: SetCacheSettingsRuleActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class SetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False): + mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]] + """Determines which browser ttl mode to use.""" + + default: int + """The TTL (in seconds) if you choose override_origin mode.""" + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False): + check_presence: List[str] + """Checks for the presence of these cookie names. + + The presence of these cookies is used in building the cache key. + """ + + include: List[str] + """Include these cookies' names and their values.""" + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False): + check_presence: List[str] + """Checks for the presence of these header names. + + The presence of these headers is used in building the cache key. + """ + + exclude_origin: bool + """Whether or not to include the origin header. + + A value of true will exclude the origin header in the cache key. + """ + + include: List[str] + """Include these headers' names and their values.""" + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False): + resolved: bool + """Use the resolved host in the cache key. + + A value of true will use the resolved host, while a value or false will use the + original host. + """ + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False): + all: bool + """Exclude all query string parameters from use in building 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. + """ + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False): + all: bool + """Use all query string parameters in the cache key.""" + + 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 + """ + + include: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude + """ + build the cache key using a list of query string parameters that ARE in the + request. + """ + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False): + device_type: bool + """Use the user agent's device type in the cache key.""" + + geo: bool + """Use the user agents's country in the cache key.""" + + lang: bool + """Use the user agent's language in the cache key.""" + + +class SetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False): + cookie: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie + """The cookies to include in building the cache key.""" + + header: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader + """The header names and values to include in building the cache key.""" + + host: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost + """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. + """ + + user: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser + """Characteristics of the request user agent used in building the cache key.""" + + +class SetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False): + cache_by_device_type: bool + """Separate cached content based on the visitor’s device type""" + + cache_deception_armor: bool + """ + Protect from web cache deception attacks while allowing static assets to be + cached + """ + + custom_key: SetCacheSettingsRuleActionParametersCacheKeyCustomKey + """ + Customize which components of the request are included or excluded from the + cache key. + """ + + ignore_query_strings_order: bool + """ + Treat requests with the same query parameters the same, regardless of the order + those query parameters are in. A value of true ignores the query strings' order. + """ + + +class SetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False): + eligible: Required[bool] + """Determines whether cache reserve is enabled. + + If this is true and a request meets eligibility criteria, Cloudflare will write + the resource to cache reserve. + """ + + min_file_size: Required[int] + """The minimum file size eligible for store in cache reserve.""" + + +_SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict( + "_SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords", + { + "from": int, + }, + total=False, +) + + +class SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange( + _SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False +): + to: Required[int] + """response status code upper bound""" + + +class SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False): + value: Required[int] + """Time to cache a response (in seconds). + + A value of 0 is equivalent to setting the Cache-Control header with the value + "no-cache". A value of -1 is equivalent to setting Cache-Control header with the + value of "no-store". + """ + + status_code_range: SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange + """The range of status codes used to apply the selected mode.""" + + status_code_value: int + """Set the ttl for responses with this specific status code""" + + +class SetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False): + default: Required[int] + """The TTL (in seconds) if you choose override_origin mode.""" + + mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]] + """edge ttl options""" + + status_code_ttl: Required[Iterable[SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]] + """List of single status codes, or status code ranges to apply the selected mode""" + + +class SetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False): + disable_stale_while_updating: Required[bool] + """Defines whether Cloudflare should serve stale content while updating. + + If true, Cloudflare will not serve stale content while getting the latest + content from the origin. + """ + + +class SetCacheSettingsRuleActionParameters(TypedDict, total=False): + additional_cacheable_ports: Iterable[int] + """List of additional ports that caching can be enabled on.""" + + browser_ttl: SetCacheSettingsRuleActionParametersBrowserTTL + """Specify how long client browsers should cache the response. + + Cloudflare cache purge will not purge content cached on client browsers, so high + browser TTLs may lead to stale content. + """ + + cache: bool + """Mark whether the request’s response from origin is eligible for caching. + + Caching itself will still depend on the cache-control header and your other + caching configurations. + """ + + cache_key: SetCacheSettingsRuleActionParametersCacheKey + """ + Define which components of the request are included or excluded from the cache + key Cloudflare uses to store the response in cache. + """ + + cache_reserve: SetCacheSettingsRuleActionParametersCacheReserve + """ + Mark whether the request's response from origin is eligible for Cache Reserve + (requires a Cache Reserve add-on plan). + """ + + edge_ttl: SetCacheSettingsRuleActionParametersEdgeTTL + """ + TTL (Time to Live) specifies the maximum time to cache a resource in the + Cloudflare edge network. + """ + + origin_cache_control: bool + """When enabled, Cloudflare will aim to strictly adhere to RFC 7234.""" + + origin_error_page_passthru: bool + """Generate Cloudflare error pages from issues sent from the origin server. + + When on, error pages will trigger for issues from the origin + """ + + read_timeout: int + """ + Define a timeout value between two successive read operations to your origin + server. Historically, the timeout value between two read options from Cloudflare + to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 + errors because of timeouts from an origin server, try increasing this timeout + value. + """ + + respect_strong_etags: bool + """ + Specify whether or not Cloudflare should respect strong ETag (entity tag) + headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. + """ + + serve_stale: SetCacheSettingsRuleActionParametersServeStale + """ + Define if Cloudflare should serve stale content while getting the latest content + from the origin. If on, Cloudflare will not serve stale content while getting + the latest content from the origin. + """ + + +RuleEditParams = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py new file mode 100644 index 00000000000..9239500ea74 --- /dev/null +++ b/src/cloudflare/types/rulesets/rule_edit_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["RuleEditResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class RuleEditResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/ruleset.py b/src/cloudflare/types/rulesets/ruleset.py new file mode 100644 index 00000000000..e5973e1c4fc --- /dev/null +++ b/src/cloudflare/types/rulesets/ruleset.py @@ -0,0 +1,58 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Ruleset"] + + +class Ruleset(BaseModel): + id: str + """The unique ID of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" + + kind: Optional[Literal["managed", "custom", "root", "zone"]] = None + """The kind of the ruleset.""" + + name: Optional[str] = None + """The human-readable name of the ruleset.""" + + phase: Optional[ + Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + ] = None + """The phase of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/ruleset_create_params.py b/src/cloudflare/types/rulesets/ruleset_create_params.py new file mode 100644 index 00000000000..dba6629645b --- /dev/null +++ b/src/cloudflare/types/rulesets/ruleset_create_params.py @@ -0,0 +1,92 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .log_rule_param import LogRuleParam +from .skip_rule_param import SkipRuleParam +from .block_rule_param import BlockRuleParam +from .route_rule_param import RouteRuleParam +from .score_rule_param import ScoreRuleParam +from .execute_rule_param import ExecuteRuleParam +from .rewrite_rule_param import RewriteRuleParam +from .redirect_rule_param import RedirectRuleParam +from .challenge_rule_param import ChallengeRuleParam +from .set_config_rule_param import SetConfigRuleParam +from .serve_error_rule_param import ServeErrorRuleParam +from .js_challenge_rule_param import JSChallengeRuleParam +from .compress_response_rule_param import CompressResponseRuleParam +from .managed_challenge_rule_param import ManagedChallengeRuleParam +from .set_cache_settings_rule_param import SetCacheSettingsRuleParam + +__all__ = ["RulesetCreateParams", "Rule"] + + +class RulesetCreateParams(TypedDict, total=False): + kind: Required[Literal["managed", "custom", "root", "zone"]] + """The kind of the ruleset.""" + + name: Required[str] + """The human-readable name of the ruleset.""" + + phase: Required[ + Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + ] + """The phase of the ruleset.""" + + rules: Required[Iterable[Rule]] + """The list of rules in the ruleset.""" + + 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.""" + + description: str + """An informative description of the ruleset.""" + + +Rule = Union[ + BlockRuleParam, + ChallengeRuleParam, + CompressResponseRuleParam, + ExecuteRuleParam, + JSChallengeRuleParam, + LogRuleParam, + ManagedChallengeRuleParam, + RedirectRuleParam, + RewriteRuleParam, + RouteRuleParam, + ScoreRuleParam, + ServeErrorRuleParam, + SetConfigRuleParam, + SkipRuleParam, + SetCacheSettingsRuleParam, +] diff --git a/src/cloudflare/types/rulesets/ruleset_create_response.py b/src/cloudflare/types/rulesets/ruleset_create_response.py new file mode 100644 index 00000000000..a4cbefe983c --- /dev/null +++ b/src/cloudflare/types/rulesets/ruleset_create_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["RulesetCreateResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class RulesetCreateResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/ruleset_get_response.py b/src/cloudflare/types/rulesets/ruleset_get_response.py new file mode 100644 index 00000000000..b4eeea24277 --- /dev/null +++ b/src/cloudflare/types/rulesets/ruleset_get_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["RulesetGetResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class RulesetGetResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/ruleset_update_params.py b/src/cloudflare/types/rulesets/ruleset_update_params.py new file mode 100644 index 00000000000..328c7fbed0a --- /dev/null +++ b/src/cloudflare/types/rulesets/ruleset_update_params.py @@ -0,0 +1,90 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .log_rule_param import LogRuleParam +from .skip_rule_param import SkipRuleParam +from .block_rule_param import BlockRuleParam +from .route_rule_param import RouteRuleParam +from .score_rule_param import ScoreRuleParam +from .execute_rule_param import ExecuteRuleParam +from .rewrite_rule_param import RewriteRuleParam +from .redirect_rule_param import RedirectRuleParam +from .challenge_rule_param import ChallengeRuleParam +from .set_config_rule_param import SetConfigRuleParam +from .serve_error_rule_param import ServeErrorRuleParam +from .js_challenge_rule_param import JSChallengeRuleParam +from .compress_response_rule_param import CompressResponseRuleParam +from .managed_challenge_rule_param import ManagedChallengeRuleParam +from .set_cache_settings_rule_param import SetCacheSettingsRuleParam + +__all__ = ["RulesetUpdateParams", "Rule"] + + +class RulesetUpdateParams(TypedDict, total=False): + rules: Required[Iterable[Rule]] + """The list of rules in the ruleset.""" + + 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.""" + + description: str + """An informative description of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + +Rule = Union[ + BlockRuleParam, + ChallengeRuleParam, + CompressResponseRuleParam, + ExecuteRuleParam, + JSChallengeRuleParam, + LogRuleParam, + ManagedChallengeRuleParam, + RedirectRuleParam, + RewriteRuleParam, + RouteRuleParam, + ScoreRuleParam, + ServeErrorRuleParam, + SetConfigRuleParam, + SkipRuleParam, + SetCacheSettingsRuleParam, +] diff --git a/src/cloudflare/types/rulesets/ruleset_update_response.py b/src/cloudflare/types/rulesets/ruleset_update_response.py new file mode 100644 index 00000000000..7ed717a100d --- /dev/null +++ b/src/cloudflare/types/rulesets/ruleset_update_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["RulesetUpdateResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class RulesetUpdateResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/score_rule.py b/src/cloudflare/types/rulesets/score_rule.py new file mode 100644 index 00000000000..508adc8d594 --- /dev/null +++ b/src/cloudflare/types/rulesets/score_rule.py @@ -0,0 +1,53 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["ScoreRule", "ActionParameters"] + + +class ActionParameters(BaseModel): + increment: Optional[int] = None + """ + Increment contains the delta to change the score and can be either positive or + negative. + """ + + +class ScoreRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["score"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/score_rule_param.py b/src/cloudflare/types/rulesets/score_rule_param.py new file mode 100644 index 00000000000..9a1db280e51 --- /dev/null +++ b/src/cloudflare/types/rulesets/score_rule_param.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["ScoreRuleParam", "ActionParameters"] + + +class ActionParameters(TypedDict, total=False): + increment: int + """ + Increment contains the delta to change the score and can be either positive or + negative. + """ + + +class ScoreRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["score"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/serve_error_rule.py b/src/cloudflare/types/rulesets/serve_error_rule.py new file mode 100644 index 00000000000..2713e5ec61d --- /dev/null +++ b/src/cloudflare/types/rulesets/serve_error_rule.py @@ -0,0 +1,56 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["ServeErrorRule", "ActionParameters"] + + +class ActionParameters(BaseModel): + content: Optional[str] = None + """Error response content.""" + + content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None + """Content-type header to set with the response.""" + + status_code: Optional[float] = None + """The status code to use for the error.""" + + +class ServeErrorRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["serve_error"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/serve_error_rule_param.py b/src/cloudflare/types/rulesets/serve_error_rule_param.py new file mode 100644 index 00000000000..d9d51bdbc08 --- /dev/null +++ b/src/cloudflare/types/rulesets/serve_error_rule_param.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["ServeErrorRuleParam", "ActionParameters"] + + +class ActionParameters(TypedDict, total=False): + content: str + """Error response content.""" + + content_type: Literal["application/json", "text/xml", "text/plain", "text/html"] + """Content-type header to set with the response.""" + + status_code: float + """The status code to use for the error.""" + + +class ServeErrorRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["serve_error"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/set_cache_settings_rule.py b/src/cloudflare/types/rulesets/set_cache_settings_rule.py new file mode 100644 index 00000000000..caac51356cf --- /dev/null +++ b/src/cloudflare/types/rulesets/set_cache_settings_rule.py @@ -0,0 +1,322 @@ +# 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 pydantic import Field as FieldInfo + +from .logging import Logging +from ..._models import BaseModel + +__all__ = [ + "SetCacheSettingsRule", + "ActionParameters", + "ActionParametersBrowserTTL", + "ActionParametersCacheKey", + "ActionParametersCacheKeyCustomKey", + "ActionParametersCacheKeyCustomKeyCookie", + "ActionParametersCacheKeyCustomKeyHeader", + "ActionParametersCacheKeyCustomKeyHost", + "ActionParametersCacheKeyCustomKeyQueryString", + "ActionParametersCacheKeyCustomKeyQueryStringExclude", + "ActionParametersCacheKeyCustomKeyQueryStringInclude", + "ActionParametersCacheKeyCustomKeyUser", + "ActionParametersCacheReserve", + "ActionParametersEdgeTTL", + "ActionParametersEdgeTTLStatusCodeTTL", + "ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange", + "ActionParametersServeStale", +] + + +class ActionParametersBrowserTTL(BaseModel): + mode: Literal["respect_origin", "bypass_by_default", "override_origin"] + """Determines which browser ttl mode to use.""" + + default: Optional[int] = None + """The TTL (in seconds) if you choose override_origin mode.""" + + +class ActionParametersCacheKeyCustomKeyCookie(BaseModel): + check_presence: Optional[List[str]] = None + """Checks for the presence of these cookie names. + + The presence of these cookies is used in building the cache key. + """ + + include: Optional[List[str]] = None + """Include these cookies' names and their values.""" + + +class ActionParametersCacheKeyCustomKeyHeader(BaseModel): + check_presence: Optional[List[str]] = None + """Checks for the presence of these header names. + + The presence of these headers is used in building the cache key. + """ + + exclude_origin: Optional[bool] = None + """Whether or not to include the origin header. + + A value of true will exclude the origin header in the cache key. + """ + + include: Optional[List[str]] = None + """Include these headers' names and their values.""" + + +class ActionParametersCacheKeyCustomKeyHost(BaseModel): + resolved: Optional[bool] = None + """Use the resolved host in the cache key. + + A value of true will use the resolved host, while a value or false will use the + original host. + """ + + +class ActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel): + all: Optional[bool] = None + """Exclude all query string parameters from use in building 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. + """ + + +class ActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel): + all: Optional[bool] = None + """Use all query string parameters in the cache key.""" + + 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 + """ + + include: Optional[ActionParametersCacheKeyCustomKeyQueryStringInclude] = None + """ + build the cache key using a list of query string parameters that ARE in the + request. + """ + + +class ActionParametersCacheKeyCustomKeyUser(BaseModel): + device_type: Optional[bool] = None + """Use the user agent's device type in the cache key.""" + + geo: Optional[bool] = None + """Use the user agents's country in the cache key.""" + + lang: Optional[bool] = None + """Use the user agent's language in the cache key.""" + + +class ActionParametersCacheKeyCustomKey(BaseModel): + cookie: Optional[ActionParametersCacheKeyCustomKeyCookie] = None + """The cookies to include in building the cache key.""" + + header: Optional[ActionParametersCacheKeyCustomKeyHeader] = None + """The header names and values to include in building the cache key.""" + + host: Optional[ActionParametersCacheKeyCustomKeyHost] = None + """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. + """ + + user: Optional[ActionParametersCacheKeyCustomKeyUser] = None + """Characteristics of the request user agent used in building the cache key.""" + + +class ActionParametersCacheKey(BaseModel): + cache_by_device_type: Optional[bool] = None + """Separate cached content based on the visitor’s device type""" + + cache_deception_armor: Optional[bool] = None + """ + Protect from web cache deception attacks while allowing static assets to be + cached + """ + + custom_key: Optional[ActionParametersCacheKeyCustomKey] = None + """ + Customize which components of the request are included or excluded from the + cache key. + """ + + ignore_query_strings_order: Optional[bool] = None + """ + Treat requests with the same query parameters the same, regardless of the order + those query parameters are in. A value of true ignores the query strings' order. + """ + + +class ActionParametersCacheReserve(BaseModel): + eligible: bool + """Determines whether cache reserve is enabled. + + If this is true and a request meets eligibility criteria, Cloudflare will write + the resource to cache reserve. + """ + + min_file_size: int + """The minimum file size eligible for store in cache reserve.""" + + +class ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel): + from_: int = FieldInfo(alias="from") + """response status code lower bound""" + + to: int + """response status code upper bound""" + + +class ActionParametersEdgeTTLStatusCodeTTL(BaseModel): + value: int + """Time to cache a response (in seconds). + + A value of 0 is equivalent to setting the Cache-Control header with the value + "no-cache". A value of -1 is equivalent to setting Cache-Control header with the + value of "no-store". + """ + + status_code_range: Optional[ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] = None + """The range of status codes used to apply the selected mode.""" + + status_code_value: Optional[int] = None + """Set the ttl for responses with this specific status code""" + + +class ActionParametersEdgeTTL(BaseModel): + default: int + """The TTL (in seconds) if you choose override_origin mode.""" + + mode: Literal["respect_origin", "bypass_by_default", "override_origin"] + """edge ttl options""" + + status_code_ttl: List[ActionParametersEdgeTTLStatusCodeTTL] + """List of single status codes, or status code ranges to apply the selected mode""" + + +class ActionParametersServeStale(BaseModel): + disable_stale_while_updating: bool + """Defines whether Cloudflare should serve stale content while updating. + + If true, Cloudflare will not serve stale content while getting the latest + content from the origin. + """ + + +class ActionParameters(BaseModel): + additional_cacheable_ports: Optional[List[int]] = None + """List of additional ports that caching can be enabled on.""" + + browser_ttl: Optional[ActionParametersBrowserTTL] = None + """Specify how long client browsers should cache the response. + + Cloudflare cache purge will not purge content cached on client browsers, so high + browser TTLs may lead to stale content. + """ + + cache: Optional[bool] = None + """Mark whether the request’s response from origin is eligible for caching. + + Caching itself will still depend on the cache-control header and your other + caching configurations. + """ + + cache_key: Optional[ActionParametersCacheKey] = None + """ + Define which components of the request are included or excluded from the cache + key Cloudflare uses to store the response in cache. + """ + + cache_reserve: Optional[ActionParametersCacheReserve] = None + """ + Mark whether the request's response from origin is eligible for Cache Reserve + (requires a Cache Reserve add-on plan). + """ + + edge_ttl: Optional[ActionParametersEdgeTTL] = None + """ + TTL (Time to Live) specifies the maximum time to cache a resource in the + Cloudflare edge network. + """ + + origin_cache_control: Optional[bool] = None + """When enabled, Cloudflare will aim to strictly adhere to RFC 7234.""" + + origin_error_page_passthru: Optional[bool] = None + """Generate Cloudflare error pages from issues sent from the origin server. + + When on, error pages will trigger for issues from the origin + """ + + read_timeout: Optional[int] = None + """ + Define a timeout value between two successive read operations to your origin + server. Historically, the timeout value between two read options from Cloudflare + to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 + errors because of timeouts from an origin server, try increasing this timeout + value. + """ + + respect_strong_etags: Optional[bool] = None + """ + Specify whether or not Cloudflare should respect strong ETag (entity tag) + headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. + """ + + serve_stale: Optional[ActionParametersServeStale] = None + """ + Define if Cloudflare should serve stale content while getting the latest content + from the origin. If on, Cloudflare will not serve stale content while getting + the latest content from the origin. + """ + + +class SetCacheSettingsRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["set_cache_settings"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py b/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py new file mode 100644 index 00000000000..cc507f4b01f --- /dev/null +++ b/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py @@ -0,0 +1,319 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .logging_param import LoggingParam + +__all__ = [ + "SetCacheSettingsRuleParam", + "ActionParameters", + "ActionParametersBrowserTTL", + "ActionParametersCacheKey", + "ActionParametersCacheKeyCustomKey", + "ActionParametersCacheKeyCustomKeyCookie", + "ActionParametersCacheKeyCustomKeyHeader", + "ActionParametersCacheKeyCustomKeyHost", + "ActionParametersCacheKeyCustomKeyQueryString", + "ActionParametersCacheKeyCustomKeyQueryStringExclude", + "ActionParametersCacheKeyCustomKeyQueryStringInclude", + "ActionParametersCacheKeyCustomKeyUser", + "ActionParametersCacheReserve", + "ActionParametersEdgeTTL", + "ActionParametersEdgeTTLStatusCodeTTL", + "ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange", + "ActionParametersServeStale", +] + + +class ActionParametersBrowserTTL(TypedDict, total=False): + mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]] + """Determines which browser ttl mode to use.""" + + default: int + """The TTL (in seconds) if you choose override_origin mode.""" + + +class ActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False): + check_presence: List[str] + """Checks for the presence of these cookie names. + + The presence of these cookies is used in building the cache key. + """ + + include: List[str] + """Include these cookies' names and their values.""" + + +class ActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False): + check_presence: List[str] + """Checks for the presence of these header names. + + The presence of these headers is used in building the cache key. + """ + + exclude_origin: bool + """Whether or not to include the origin header. + + A value of true will exclude the origin header in the cache key. + """ + + include: List[str] + """Include these headers' names and their values.""" + + +class ActionParametersCacheKeyCustomKeyHost(TypedDict, total=False): + resolved: bool + """Use the resolved host in the cache key. + + A value of true will use the resolved host, while a value or false will use the + original host. + """ + + +class ActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False): + all: bool + """Exclude all query string parameters from use in building 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. + """ + + +class ActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False): + all: bool + """Use all query string parameters in the cache key.""" + + 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 + """ + + include: ActionParametersCacheKeyCustomKeyQueryStringInclude + """ + build the cache key using a list of query string parameters that ARE in the + request. + """ + + +class ActionParametersCacheKeyCustomKeyUser(TypedDict, total=False): + device_type: bool + """Use the user agent's device type in the cache key.""" + + geo: bool + """Use the user agents's country in the cache key.""" + + lang: bool + """Use the user agent's language in the cache key.""" + + +class ActionParametersCacheKeyCustomKey(TypedDict, total=False): + cookie: ActionParametersCacheKeyCustomKeyCookie + """The cookies to include in building the cache key.""" + + header: ActionParametersCacheKeyCustomKeyHeader + """The header names and values to include in building the cache key.""" + + host: ActionParametersCacheKeyCustomKeyHost + """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. + """ + + user: ActionParametersCacheKeyCustomKeyUser + """Characteristics of the request user agent used in building the cache key.""" + + +class ActionParametersCacheKey(TypedDict, total=False): + cache_by_device_type: bool + """Separate cached content based on the visitor’s device type""" + + cache_deception_armor: bool + """ + Protect from web cache deception attacks while allowing static assets to be + cached + """ + + custom_key: ActionParametersCacheKeyCustomKey + """ + Customize which components of the request are included or excluded from the + cache key. + """ + + ignore_query_strings_order: bool + """ + Treat requests with the same query parameters the same, regardless of the order + those query parameters are in. A value of true ignores the query strings' order. + """ + + +class ActionParametersCacheReserve(TypedDict, total=False): + eligible: Required[bool] + """Determines whether cache reserve is enabled. + + If this is true and a request meets eligibility criteria, Cloudflare will write + the resource to cache reserve. + """ + + min_file_size: Required[int] + """The minimum file size eligible for store in cache reserve.""" + + +_ActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict( + "_ActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords", + { + "from": int, + }, + total=False, +) + + +class ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange( + _ActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False +): + to: Required[int] + """response status code upper bound""" + + +class ActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False): + value: Required[int] + """Time to cache a response (in seconds). + + A value of 0 is equivalent to setting the Cache-Control header with the value + "no-cache". A value of -1 is equivalent to setting Cache-Control header with the + value of "no-store". + """ + + status_code_range: ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange + """The range of status codes used to apply the selected mode.""" + + status_code_value: int + """Set the ttl for responses with this specific status code""" + + +class ActionParametersEdgeTTL(TypedDict, total=False): + default: Required[int] + """The TTL (in seconds) if you choose override_origin mode.""" + + mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]] + """edge ttl options""" + + status_code_ttl: Required[Iterable[ActionParametersEdgeTTLStatusCodeTTL]] + """List of single status codes, or status code ranges to apply the selected mode""" + + +class ActionParametersServeStale(TypedDict, total=False): + disable_stale_while_updating: Required[bool] + """Defines whether Cloudflare should serve stale content while updating. + + If true, Cloudflare will not serve stale content while getting the latest + content from the origin. + """ + + +class ActionParameters(TypedDict, total=False): + additional_cacheable_ports: Iterable[int] + """List of additional ports that caching can be enabled on.""" + + browser_ttl: ActionParametersBrowserTTL + """Specify how long client browsers should cache the response. + + Cloudflare cache purge will not purge content cached on client browsers, so high + browser TTLs may lead to stale content. + """ + + cache: bool + """Mark whether the request’s response from origin is eligible for caching. + + Caching itself will still depend on the cache-control header and your other + caching configurations. + """ + + cache_key: ActionParametersCacheKey + """ + Define which components of the request are included or excluded from the cache + key Cloudflare uses to store the response in cache. + """ + + cache_reserve: ActionParametersCacheReserve + """ + Mark whether the request's response from origin is eligible for Cache Reserve + (requires a Cache Reserve add-on plan). + """ + + edge_ttl: ActionParametersEdgeTTL + """ + TTL (Time to Live) specifies the maximum time to cache a resource in the + Cloudflare edge network. + """ + + origin_cache_control: bool + """When enabled, Cloudflare will aim to strictly adhere to RFC 7234.""" + + origin_error_page_passthru: bool + """Generate Cloudflare error pages from issues sent from the origin server. + + When on, error pages will trigger for issues from the origin + """ + + read_timeout: int + """ + Define a timeout value between two successive read operations to your origin + server. Historically, the timeout value between two read options from Cloudflare + to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 + errors because of timeouts from an origin server, try increasing this timeout + value. + """ + + respect_strong_etags: bool + """ + Specify whether or not Cloudflare should respect strong ETag (entity tag) + headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. + """ + + serve_stale: ActionParametersServeStale + """ + Define if Cloudflare should serve stale content while getting the latest content + from the origin. If on, Cloudflare will not serve stale content while getting + the latest content from the origin. + """ + + +class SetCacheSettingsRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["set_cache_settings"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/set_config_rule.py b/src/cloudflare/types/rulesets/set_config_rule.py new file mode 100644 index 00000000000..8d135f95608 --- /dev/null +++ b/src/cloudflare/types/rulesets/set_config_rule.py @@ -0,0 +1,103 @@ +# 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 .logging import Logging +from ..._models import BaseModel + +__all__ = ["SetConfigRule", "ActionParameters", "ActionParametersAutominify"] + + +class ActionParametersAutominify(BaseModel): + css: Optional[bool] = None + """Minify CSS files.""" + + html: Optional[bool] = None + """Minify HTML files.""" + + js: Optional[bool] = None + """Minify JS files.""" + + +class ActionParameters(BaseModel): + automatic_https_rewrites: Optional[bool] = None + """Turn on or off Automatic HTTPS Rewrites.""" + + autominify: Optional[ActionParametersAutominify] = None + """Select which file extensions to minify automatically.""" + + bic: Optional[bool] = None + """Turn on or off Browser Integrity Check.""" + + disable_apps: Optional[bool] = None + """Turn off all active Cloudflare Apps.""" + + disable_zaraz: Optional[bool] = None + """Turn off Zaraz.""" + + email_obfuscation: Optional[bool] = None + """Turn on or off Email Obfuscation.""" + + hotlink_protection: Optional[bool] = None + """Turn on or off the Hotlink Protection.""" + + mirage: Optional[bool] = None + """Turn on or off Mirage.""" + + opportunistic_encryption: Optional[bool] = None + """Turn on or off Opportunistic Encryption.""" + + polish: Optional[Literal["off", "lossless", "lossy"]] = None + """Configure the Polish level.""" + + rocket_loader: Optional[bool] = None + """Turn on or off Rocket Loader""" + + security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None + """Configure the Security Level.""" + + server_side_excludes: Optional[bool] = None + """Turn on or off Server Side Excludes.""" + + ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None + """Configure the SSL level.""" + + sxg: Optional[bool] = None + """Turn on or off Signed Exchanges (SXG).""" + + +class SetConfigRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["set_config"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/set_config_rule_param.py b/src/cloudflare/types/rulesets/set_config_rule_param.py new file mode 100644 index 00000000000..e90a1670126 --- /dev/null +++ b/src/cloudflare/types/rulesets/set_config_rule_param.py @@ -0,0 +1,93 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["SetConfigRuleParam", "ActionParameters", "ActionParametersAutominify"] + + +class ActionParametersAutominify(TypedDict, total=False): + css: bool + """Minify CSS files.""" + + html: bool + """Minify HTML files.""" + + js: bool + """Minify JS files.""" + + +class ActionParameters(TypedDict, total=False): + automatic_https_rewrites: bool + """Turn on or off Automatic HTTPS Rewrites.""" + + autominify: ActionParametersAutominify + """Select which file extensions to minify automatically.""" + + bic: bool + """Turn on or off Browser Integrity Check.""" + + disable_apps: bool + """Turn off all active Cloudflare Apps.""" + + disable_zaraz: bool + """Turn off Zaraz.""" + + email_obfuscation: bool + """Turn on or off Email Obfuscation.""" + + hotlink_protection: bool + """Turn on or off the Hotlink Protection.""" + + mirage: bool + """Turn on or off Mirage.""" + + opportunistic_encryption: bool + """Turn on or off Opportunistic Encryption.""" + + polish: Literal["off", "lossless", "lossy"] + """Configure the Polish level.""" + + rocket_loader: bool + """Turn on or off Rocket Loader""" + + security_level: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] + """Configure the Security Level.""" + + server_side_excludes: bool + """Turn on or off Server Side Excludes.""" + + ssl: Literal["off", "flexible", "full", "strict", "origin_pull"] + """Configure the SSL level.""" + + sxg: bool + """Turn on or off Signed Exchanges (SXG).""" + + +class SetConfigRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["set_config"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/skip_rule.py b/src/cloudflare/types/rulesets/skip_rule.py new file mode 100644 index 00000000000..ae51803c15b --- /dev/null +++ b/src/cloudflare/types/rulesets/skip_rule.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .logging import Logging +from ..._models import BaseModel + +__all__ = ["SkipRule", "ActionParameters"] + + +class ActionParameters(BaseModel): + phases: Optional[ + List[ + Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + ] + ] = None + """A list of phases to skip the execution of. + + This option is incompatible with the ruleset and rulesets options. + """ + + products: Optional[ + List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]] + ] = None + """A list of legacy security products to skip the execution of.""" + + rules: Optional[Dict[str, List[str]]] = None + """ + A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + execution of. This option is incompatible with the ruleset option. + """ + + ruleset: Optional[Literal["current"]] = None + """A ruleset to skip the execution of. + + This option is incompatible with the rulesets, rules and phases options. + """ + + rulesets: Optional[List[str]] = None + """A list of ruleset IDs to skip the execution of. + + This option is incompatible with the ruleset and phases options. + """ + + +class SkipRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["skip"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[ActionParameters] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/skip_rule_param.py b/src/cloudflare/types/rulesets/skip_rule_param.py new file mode 100644 index 00000000000..27b20ebba30 --- /dev/null +++ b/src/cloudflare/types/rulesets/skip_rule_param.py @@ -0,0 +1,91 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List +from typing_extensions import Literal, TypedDict + +from .logging_param import LoggingParam + +__all__ = ["SkipRuleParam", "ActionParameters"] + + +class ActionParameters(TypedDict, total=False): + phases: List[ + Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + ] + """A list of phases to skip the execution of. + + This option is incompatible with the ruleset and rulesets options. + """ + + products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]] + """A list of legacy security products to skip the execution of.""" + + rules: Dict[str, List[str]] + """ + A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + execution of. This option is incompatible with the ruleset option. + """ + + ruleset: Literal["current"] + """A ruleset to skip the execution of. + + This option is incompatible with the rulesets, rules and phases options. + """ + + rulesets: List[str] + """A list of ruleset IDs to skip the execution of. + + This option is incompatible with the ruleset and phases options. + """ + + +class SkipRuleParam(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["skip"] + """The action to perform when the rule matches.""" + + action_parameters: ActionParameters + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py new file mode 100644 index 00000000000..63d43d6a422 --- /dev/null +++ b/src/cloudflare/types/rulesets/version_get_response.py @@ -0,0 +1,92 @@ +# 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 + +from .log_rule import LogRule +from ..._models import BaseModel +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .route_rule import RouteRule +from .score_rule import ScoreRule +from .execute_rule import ExecuteRule +from .rewrite_rule import RewriteRule +from .redirect_rule import RedirectRule +from .challenge_rule import ChallengeRule +from .set_config_rule import SetConfigRule +from .serve_error_rule import ServeErrorRule +from .js_challenge_rule import JSChallengeRule +from .compress_response_rule import CompressResponseRule +from .managed_challenge_rule import ManagedChallengeRule +from .set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["VersionGetResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class VersionGetResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/version_list_response.py b/src/cloudflare/types/rulesets/version_list_response.py deleted file mode 100644 index dd14aeee32a..00000000000 --- a/src/cloudflare/types/rulesets/version_list_response.py +++ /dev/null @@ -1,56 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["VersionListResponse"] - - -class VersionListResponse(BaseModel): - kind: Literal["managed", "custom", "root", "zone"] - """The kind of the ruleset.""" - - name: str - """The human-readable name of the ruleset.""" - - phase: Literal[ - "ddos_l4", - "ddos_l7", - "http_config_settings", - "http_custom_errors", - "http_log_custom_fields", - "http_ratelimit", - "http_request_cache_settings", - "http_request_dynamic_redirect", - "http_request_firewall_custom", - "http_request_firewall_managed", - "http_request_late_transform", - "http_request_origin", - "http_request_redirect", - "http_request_sanitize", - "http_request_sbfm", - "http_request_select_configuration", - "http_request_transform", - "http_response_compression", - "http_response_firewall_managed", - "http_response_headers_transform", - "magic_transit", - "magic_transit_ids_managed", - "magic_transit_managed", - ] - """The phase of the ruleset.""" - - id: Optional[str] = None - """The unique ID of the ruleset.""" - - description: Optional[str] = None - """An informative description of the ruleset.""" - - last_updated: Optional[datetime] = None - """The timestamp of when the ruleset was last modified.""" - - version: Optional[str] = None - """The version of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/versions/__init__.py b/src/cloudflare/types/rulesets/versions/__init__.py index f8ee8b14b1c..eedd7781951 100644 --- a/src/cloudflare/types/rulesets/versions/__init__.py +++ b/src/cloudflare/types/rulesets/versions/__init__.py @@ -1,3 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .by_tag_get_response import ByTagGetResponse as ByTagGetResponse diff --git a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py new file mode 100644 index 00000000000..b5b714a8119 --- /dev/null +++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py @@ -0,0 +1,92 @@ +# 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 + +from ..log_rule import LogRule +from ...._models import BaseModel +from ..skip_rule import SkipRule +from ..block_rule import BlockRule +from ..route_rule import RouteRule +from ..score_rule import ScoreRule +from ..execute_rule import ExecuteRule +from ..rewrite_rule import RewriteRule +from ..redirect_rule import RedirectRule +from ..challenge_rule import ChallengeRule +from ..set_config_rule import SetConfigRule +from ..serve_error_rule import ServeErrorRule +from ..js_challenge_rule import JSChallengeRule +from ..compress_response_rule import CompressResponseRule +from ..managed_challenge_rule import ManagedChallengeRule +from ..set_cache_settings_rule import SetCacheSettingsRule + +__all__ = ["ByTagGetResponse", "Rule"] + +Rule = Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, +] + + +class ByTagGetResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + rules: List[Rule] + """The list of rules in the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rum/__init__.py b/src/cloudflare/types/rum/__init__.py index 353cacb011f..870d7373122 100644 --- a/src/cloudflare/types/rum/__init__.py +++ b/src/cloudflare/types/rum/__init__.py @@ -2,8 +2,8 @@ from __future__ import annotations +from .site import Site as Site from .rum_rule import RUMRule as RUMRule -from .rum_site import RUMSite as RUMSite from .rule_create_params import RuleCreateParams as RuleCreateParams from .rule_list_response import RuleListResponse as RuleListResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams diff --git a/src/cloudflare/types/rum/rum_site.py b/src/cloudflare/types/rum/rum_site.py deleted file mode 100644 index 0aece867ff9..00000000000 --- a/src/cloudflare/types/rum/rum_site.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from .rum_rule import RUMRule -from ..._models import BaseModel - -__all__ = ["RUMSite", "Ruleset"] - - -class Ruleset(BaseModel): - id: Optional[str] = None - """The Web Analytics ruleset identifier.""" - - enabled: Optional[bool] = None - """Whether the ruleset is enabled.""" - - zone_name: Optional[str] = None - - zone_tag: Optional[str] = None - """The zone identifier.""" - - -class RUMSite(BaseModel): - auto_install: Optional[bool] = None - """ - If enabled, the JavaScript snippet is automatically injected for orange-clouded - sites. - """ - - created: Optional[datetime] = None - - rules: Optional[List[RUMRule]] = None - """A list of rules.""" - - ruleset: Optional[Ruleset] = None - - site_tag: Optional[str] = None - """The Web Analytics site identifier.""" - - site_token: Optional[str] = None - """The Web Analytics site token.""" - - snippet: Optional[str] = None - """Encoded JavaScript snippet.""" diff --git a/src/cloudflare/types/rum/site.py b/src/cloudflare/types/rum/site.py new file mode 100644 index 00000000000..504caf445d8 --- /dev/null +++ b/src/cloudflare/types/rum/site.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .rum_rule import RUMRule +from ..._models import BaseModel + +__all__ = ["Site", "Ruleset"] + + +class Ruleset(BaseModel): + id: Optional[str] = None + """The Web Analytics ruleset identifier.""" + + enabled: Optional[bool] = None + """Whether the ruleset is enabled.""" + + zone_name: Optional[str] = None + + zone_tag: Optional[str] = None + """The zone identifier.""" + + +class Site(BaseModel): + auto_install: Optional[bool] = None + """ + If enabled, the JavaScript snippet is automatically injected for orange-clouded + sites. + """ + + created: Optional[datetime] = None + + rules: Optional[List[RUMRule]] = None + """A list of rules.""" + + ruleset: Optional[Ruleset] = None + + site_tag: Optional[str] = None + """The Web Analytics site identifier.""" + + site_token: Optional[str] = None + """The Web Analytics site token.""" + + snippet: Optional[str] = None + """Encoded JavaScript snippet.""" diff --git a/src/cloudflare/types/secondary_dns/__init__.py b/src/cloudflare/types/secondary_dns/__init__.py index cae90a7d2c4..72716c6630b 100644 --- a/src/cloudflare/types/secondary_dns/__init__.py +++ b/src/cloudflare/types/secondary_dns/__init__.py @@ -2,31 +2,41 @@ from __future__ import annotations +from .acl import ACL as ACL +from .peer import Peer as Peer +from .tsig import TSIG as TSIG +from .force_axfr import ForceAXFR as ForceAXFR +from .enable_transfer import EnableTransfer as EnableTransfer +from .outgoing_status import OutgoingStatus as OutgoingStatus +from .disable_transfer import DisableTransfer as DisableTransfer from .acl_create_params import ACLCreateParams as ACLCreateParams +from .acl_delete_params import ACLDeleteParams as ACLDeleteParams from .acl_update_params import ACLUpdateParams as ACLUpdateParams -from .secondary_dns_acl import SecondaryDNSACL as SecondaryDNSACL from .peer_create_params import PeerCreateParams as PeerCreateParams +from .peer_delete_params import PeerDeleteParams as PeerDeleteParams from .peer_update_params import PeerUpdateParams as PeerUpdateParams -from .secondary_dns_peer import SecondaryDNSPeer as SecondaryDNSPeer -from .secondary_dns_tsig import SecondaryDNSTSIG as SecondaryDNSTSIG from .tsig_create_params import TSIGCreateParams as TSIGCreateParams +from .tsig_delete_params import TSIGDeleteParams as TSIGDeleteParams from .tsig_update_params import TSIGUpdateParams as TSIGUpdateParams from .acl_delete_response import ACLDeleteResponse as ACLDeleteResponse -from .secondary_dns_force import SecondaryDNSForce as SecondaryDNSForce from .peer_delete_response import PeerDeleteResponse as PeerDeleteResponse from .tsig_delete_response import TSIGDeleteResponse as TSIGDeleteResponse from .incoming_get_response import IncomingGetResponse as IncomingGetResponse from .outgoing_get_response import OutgoingGetResponse as OutgoingGetResponse from .incoming_create_params import IncomingCreateParams as IncomingCreateParams +from .incoming_delete_params import IncomingDeleteParams as IncomingDeleteParams from .incoming_update_params import IncomingUpdateParams as IncomingUpdateParams from .outgoing_create_params import OutgoingCreateParams as OutgoingCreateParams +from .outgoing_delete_params import OutgoingDeleteParams as OutgoingDeleteParams +from .outgoing_enable_params import OutgoingEnableParams as OutgoingEnableParams from .outgoing_update_params import OutgoingUpdateParams as OutgoingUpdateParams +from .outgoing_disable_params import OutgoingDisableParams as OutgoingDisableParams +from .force_axfr_create_params import ForceAXFRCreateParams as ForceAXFRCreateParams from .incoming_create_response import IncomingCreateResponse as IncomingCreateResponse from .incoming_delete_response import IncomingDeleteResponse as IncomingDeleteResponse from .incoming_update_response import IncomingUpdateResponse as IncomingUpdateResponse from .outgoing_create_response import OutgoingCreateResponse as OutgoingCreateResponse from .outgoing_delete_response import OutgoingDeleteResponse as OutgoingDeleteResponse from .outgoing_update_response import OutgoingUpdateResponse as OutgoingUpdateResponse -from .secondary_dns_enable_transfer import SecondaryDNSEnableTransfer as SecondaryDNSEnableTransfer +from .outgoing_force_notify_params import OutgoingForceNotifyParams as OutgoingForceNotifyParams from .outgoing_force_notify_response import OutgoingForceNotifyResponse as OutgoingForceNotifyResponse -from .secondary_dns_disable_transfer import SecondaryDNSDisableTransfer as SecondaryDNSDisableTransfer diff --git a/src/cloudflare/types/secondary_dns/acl.py b/src/cloudflare/types/secondary_dns/acl.py new file mode 100644 index 00000000000..46ca034a4e7 --- /dev/null +++ b/src/cloudflare/types/secondary_dns/acl.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ACL"] + + +class ACL(BaseModel): + id: str + + ip_range: str + """Allowed IPv4/IPv6 address range of primary or secondary nameservers. + + This will be applied for the entire account. The IP range is used to allow + additional NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR + requests from for primary zones. CIDRs are limited to a maximum of /24 for IPv4 + and /64 for IPv6 respectively. + """ + + name: str + """The name of the acl.""" diff --git a/src/cloudflare/types/secondary_dns/acl_delete_params.py b/src/cloudflare/types/secondary_dns/acl_delete_params.py new file mode 100644 index 00000000000..16de02d2864 --- /dev/null +++ b/src/cloudflare/types/secondary_dns/acl_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ACLDeleteParams"] + + +class ACLDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/secondary_dns/disable_transfer.py b/src/cloudflare/types/secondary_dns/disable_transfer.py new file mode 100644 index 00000000000..2fe723b6626 --- /dev/null +++ b/src/cloudflare/types/secondary_dns/disable_transfer.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["DisableTransfer"] + +DisableTransfer = str diff --git a/src/cloudflare/types/secondary_dns/enable_transfer.py b/src/cloudflare/types/secondary_dns/enable_transfer.py new file mode 100644 index 00000000000..a26d91b7bb8 --- /dev/null +++ b/src/cloudflare/types/secondary_dns/enable_transfer.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["EnableTransfer"] + +EnableTransfer = str diff --git a/src/cloudflare/types/secondary_dns/force_axfr.py b/src/cloudflare/types/secondary_dns/force_axfr.py new file mode 100644 index 00000000000..a70773f1b4e --- /dev/null +++ b/src/cloudflare/types/secondary_dns/force_axfr.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["ForceAXFR"] + +ForceAXFR = str diff --git a/src/cloudflare/types/secondary_dns/force_axfr_create_params.py b/src/cloudflare/types/secondary_dns/force_axfr_create_params.py new file mode 100644 index 00000000000..892842697cb --- /dev/null +++ b/src/cloudflare/types/secondary_dns/force_axfr_create_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ForceAXFRCreateParams"] + + +class ForceAXFRCreateParams(TypedDict, total=False): + zone_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/secondary_dns/incoming.py b/src/cloudflare/types/secondary_dns/incoming.py new file mode 100644 index 00000000000..026e5c4c043 --- /dev/null +++ b/src/cloudflare/types/secondary_dns/incoming.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Incoming"] + + +class Incoming(BaseModel): + id: Optional[str] = None + + auto_refresh_seconds: Optional[float] = None + """ + How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not + applicable for primary zones. + """ + + checked_time: Optional[str] = None + """The time for a specific event.""" + + created_time: Optional[str] = None + """The time for a specific event.""" + + modified_time: Optional[str] = None + """The time for a specific event.""" + + name: Optional[str] = None + """Zone name.""" + + peers: Optional[List[object]] = None + """A list of peer tags.""" + + soa_serial: Optional[float] = None + """The serial number of the SOA for the given zone.""" diff --git a/src/cloudflare/types/secondary_dns/incoming_delete_params.py b/src/cloudflare/types/secondary_dns/incoming_delete_params.py new file mode 100644 index 00000000000..f38fedf881d --- /dev/null +++ b/src/cloudflare/types/secondary_dns/incoming_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IncomingDeleteParams"] + + +class IncomingDeleteParams(TypedDict, total=False): + zone_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/secondary_dns/outgoing/__init__.py b/src/cloudflare/types/secondary_dns/outgoing/__init__.py index f8ee8b14b1c..78d1ff6c78f 100644 --- a/src/cloudflare/types/secondary_dns/outgoing/__init__.py +++ b/src/cloudflare/types/secondary_dns/outgoing/__init__.py @@ -1,3 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .outgoing import Outgoing as Outgoing diff --git a/src/cloudflare/types/secondary_dns/outgoing/outgoing.py b/src/cloudflare/types/secondary_dns/outgoing/outgoing.py new file mode 100644 index 00000000000..59d9ef2378b --- /dev/null +++ b/src/cloudflare/types/secondary_dns/outgoing/outgoing.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["Outgoing"] + + +class Outgoing(BaseModel): + id: Optional[str] = None + + checked_time: Optional[str] = None + """The time for a specific event.""" + + created_time: Optional[str] = None + """The time for a specific event.""" + + last_transferred_time: Optional[str] = None + """The time for a specific event.""" + + name: Optional[str] = None + """Zone name.""" + + peers: Optional[List[object]] = None + """A list of peer tags.""" + + soa_serial: Optional[float] = None + """The serial number of the SOA for the given zone.""" diff --git a/src/cloudflare/types/secondary_dns/outgoing_delete_params.py b/src/cloudflare/types/secondary_dns/outgoing_delete_params.py new file mode 100644 index 00000000000..68387b9fa08 --- /dev/null +++ b/src/cloudflare/types/secondary_dns/outgoing_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["OutgoingDeleteParams"] + + +class OutgoingDeleteParams(TypedDict, total=False): + zone_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/secondary_dns/outgoing_disable_params.py b/src/cloudflare/types/secondary_dns/outgoing_disable_params.py new file mode 100644 index 00000000000..08d06c56acf --- /dev/null +++ b/src/cloudflare/types/secondary_dns/outgoing_disable_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["OutgoingDisableParams"] + + +class OutgoingDisableParams(TypedDict, total=False): + zone_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/secondary_dns/outgoing_enable_params.py b/src/cloudflare/types/secondary_dns/outgoing_enable_params.py new file mode 100644 index 00000000000..93e197b2bac --- /dev/null +++ b/src/cloudflare/types/secondary_dns/outgoing_enable_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["OutgoingEnableParams"] + + +class OutgoingEnableParams(TypedDict, total=False): + zone_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/secondary_dns/outgoing_force_notify_params.py b/src/cloudflare/types/secondary_dns/outgoing_force_notify_params.py new file mode 100644 index 00000000000..7835ae3d3ca --- /dev/null +++ b/src/cloudflare/types/secondary_dns/outgoing_force_notify_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["OutgoingForceNotifyParams"] + + +class OutgoingForceNotifyParams(TypedDict, total=False): + zone_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/secondary_dns/outgoing_status.py b/src/cloudflare/types/secondary_dns/outgoing_status.py new file mode 100644 index 00000000000..df54f14d58a --- /dev/null +++ b/src/cloudflare/types/secondary_dns/outgoing_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +__all__ = ["OutgoingStatus"] + +OutgoingStatus = Optional[str] diff --git a/src/cloudflare/types/secondary_dns/peer.py b/src/cloudflare/types/secondary_dns/peer.py new file mode 100644 index 00000000000..502be2d220f --- /dev/null +++ b/src/cloudflare/types/secondary_dns/peer.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Peer"] + + +class Peer(BaseModel): + id: str + + name: str + """The name of the peer.""" + + ip: Optional[str] = None + """ + IPv4/IPv6 address of primary or secondary nameserver, depending on what zone + this peer is linked to. For primary zones this IP defines the IP of the + secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary + zones this IP defines the IP of the primary nameserver Cloudflare will send + AXFR/IXFR requests to. + """ + + ixfr_enable: Optional[bool] = None + """Enable IXFR transfer protocol, default is AXFR. + + Only applicable to secondary zones. + """ + + port: Optional[float] = None + """ + DNS port of primary or secondary nameserver, depending on what zone this peer is + linked to. + """ + + tsig_id: Optional[str] = None + """TSIG authentication will be used for zone transfer if configured.""" diff --git a/src/cloudflare/types/secondary_dns/peer_delete_params.py b/src/cloudflare/types/secondary_dns/peer_delete_params.py new file mode 100644 index 00000000000..86d9970947e --- /dev/null +++ b/src/cloudflare/types/secondary_dns/peer_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["PeerDeleteParams"] + + +class PeerDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/secondary_dns/secondary_dns_acl.py b/src/cloudflare/types/secondary_dns/secondary_dns_acl.py deleted file mode 100644 index 712ec9defc2..00000000000 --- a/src/cloudflare/types/secondary_dns/secondary_dns_acl.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["SecondaryDNSACL"] - - -class SecondaryDNSACL(BaseModel): - id: str - - ip_range: str - """Allowed IPv4/IPv6 address range of primary or secondary nameservers. - - This will be applied for the entire account. The IP range is used to allow - additional NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR - requests from for primary zones. CIDRs are limited to a maximum of /24 for IPv4 - and /64 for IPv6 respectively. - """ - - name: str - """The name of the acl.""" diff --git a/src/cloudflare/types/secondary_dns/secondary_dns_disable_transfer.py b/src/cloudflare/types/secondary_dns/secondary_dns_disable_transfer.py deleted file mode 100644 index cca54ddc05b..00000000000 --- a/src/cloudflare/types/secondary_dns/secondary_dns_disable_transfer.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -__all__ = ["SecondaryDNSDisableTransfer"] - -SecondaryDNSDisableTransfer = str diff --git a/src/cloudflare/types/secondary_dns/secondary_dns_enable_transfer.py b/src/cloudflare/types/secondary_dns/secondary_dns_enable_transfer.py deleted file mode 100644 index 2faf7d71613..00000000000 --- a/src/cloudflare/types/secondary_dns/secondary_dns_enable_transfer.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -__all__ = ["SecondaryDNSEnableTransfer"] - -SecondaryDNSEnableTransfer = str diff --git a/src/cloudflare/types/secondary_dns/secondary_dns_force.py b/src/cloudflare/types/secondary_dns/secondary_dns_force.py deleted file mode 100644 index 7b693b2feb6..00000000000 --- a/src/cloudflare/types/secondary_dns/secondary_dns_force.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -__all__ = ["SecondaryDNSForce"] - -SecondaryDNSForce = str diff --git a/src/cloudflare/types/secondary_dns/secondary_dns_peer.py b/src/cloudflare/types/secondary_dns/secondary_dns_peer.py deleted file mode 100644 index 3e52227627f..00000000000 --- a/src/cloudflare/types/secondary_dns/secondary_dns_peer.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["SecondaryDNSPeer"] - - -class SecondaryDNSPeer(BaseModel): - id: str - - name: str - """The name of the peer.""" - - ip: Optional[str] = None - """ - IPv4/IPv6 address of primary or secondary nameserver, depending on what zone - this peer is linked to. For primary zones this IP defines the IP of the - secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary - zones this IP defines the IP of the primary nameserver Cloudflare will send - AXFR/IXFR requests to. - """ - - ixfr_enable: Optional[bool] = None - """Enable IXFR transfer protocol, default is AXFR. - - Only applicable to secondary zones. - """ - - port: Optional[float] = None - """ - DNS port of primary or secondary nameserver, depending on what zone this peer is - linked to. - """ - - tsig_id: Optional[str] = None - """TSIG authentication will be used for zone transfer if configured.""" diff --git a/src/cloudflare/types/secondary_dns/secondary_dns_tsig.py b/src/cloudflare/types/secondary_dns/secondary_dns_tsig.py deleted file mode 100644 index 857423481f0..00000000000 --- a/src/cloudflare/types/secondary_dns/secondary_dns_tsig.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["SecondaryDNSTSIG"] - - -class SecondaryDNSTSIG(BaseModel): - id: str - - algo: str - """TSIG algorithm.""" - - name: str - """TSIG key name.""" - - secret: str - """TSIG secret.""" diff --git a/src/cloudflare/types/secondary_dns/tsig.py b/src/cloudflare/types/secondary_dns/tsig.py new file mode 100644 index 00000000000..2c91099f98c --- /dev/null +++ b/src/cloudflare/types/secondary_dns/tsig.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["TSIG"] + + +class TSIG(BaseModel): + id: str + + algo: str + """TSIG algorithm.""" + + name: str + """TSIG key name.""" + + secret: str + """TSIG secret.""" diff --git a/src/cloudflare/types/secondary_dns/tsig_delete_params.py b/src/cloudflare/types/secondary_dns/tsig_delete_params.py new file mode 100644 index 00000000000..1c2ab15aefa --- /dev/null +++ b/src/cloudflare/types/secondary_dns/tsig_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["TSIGDeleteParams"] + + +class TSIGDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/shared/__init__.py b/src/cloudflare/types/shared/__init__.py index 28c422b2fc6..d6d57611926 100644 --- a/src/cloudflare/types/shared/__init__.py +++ b/src/cloudflare/types/shared/__init__.py @@ -1,3 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .asn import ASN as ASN +from .role import Role as Role +from .member import Member as Member +from .result import Result as Result +from .audit_log import AuditLog as AuditLog from .error_data import ErrorData as ErrorData +from .identifier import Identifier as Identifier +from .permission import Permission as Permission +from .response_info import ResponseInfo as ResponseInfo +from .pagination_info import PaginationInfo as PaginationInfo +from .permission_grant import PermissionGrant as PermissionGrant +from .cloudflare_tunnel import CloudflareTunnel as CloudflareTunnel +from .load_balancer_preview import LoadBalancerPreview as LoadBalancerPreview diff --git a/src/cloudflare/types/shared/asn.py b/src/cloudflare/types/shared/asn.py new file mode 100644 index 00000000000..429e7bf4301 --- /dev/null +++ b/src/cloudflare/types/shared/asn.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + + + +__all__ = ["ASN"] + +ASN = int diff --git a/src/cloudflare/types/shared/audit_log.py b/src/cloudflare/types/shared/audit_log.py new file mode 100644 index 00000000000..22eef13a50c --- /dev/null +++ b/src/cloudflare/types/shared/audit_log.py @@ -0,0 +1,80 @@ +# 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__ = ["AuditLog", "Action", "Actor", "Owner", "Resource"] + + +class Action(BaseModel): + result: Optional[bool] = None + """A boolean that indicates if the action attempted was successful.""" + + type: Optional[str] = None + """A short string that describes the action that was performed.""" + + +class Actor(BaseModel): + id: Optional[str] = None + """The ID of the actor that performed the action. + + If a user performed the action, this will be their User ID. + """ + + email: Optional[str] = None + """The email of the user that performed the action.""" + + ip: Optional[str] = None + """The IP address of the request that performed the action.""" + + type: Optional[Literal["user", "admin", "Cloudflare"]] = None + """The type of actor, whether a User, Cloudflare Admin, or an Automated System.""" + + +class Owner(BaseModel): + id: Optional[str] = None + """Identifier""" + + +class Resource(BaseModel): + id: Optional[str] = None + """An identifier for the resource that was affected by the action.""" + + type: Optional[str] = None + """A short string that describes the resource that was affected by the action.""" + + +class AuditLog(BaseModel): + id: Optional[str] = None + """A string that uniquely identifies the audit log.""" + + action: Optional[Action] = None + + actor: Optional[Actor] = None + + interface: Optional[str] = None + """The source of the event.""" + + metadata: Optional[object] = None + """An object which can lend more context to the action being logged. + + This is a flexible value and varies between different actions. + """ + + new_value: Optional[str] = FieldInfo(alias="newValue", default=None) + """The new value of the resource that was modified.""" + + old_value: Optional[str] = FieldInfo(alias="oldValue", default=None) + """The value of the resource before it was modified.""" + + owner: Optional[Owner] = None + + resource: Optional[Resource] = None + + when: Optional[datetime] = None + """A UTC RFC3339 timestamp that specifies when the action being logged occured.""" diff --git a/src/cloudflare/types/shared/cloudflare_tunnel.py b/src/cloudflare/types/shared/cloudflare_tunnel.py new file mode 100644 index 00000000000..63f80cc424a --- /dev/null +++ b/src/cloudflare/types/shared/cloudflare_tunnel.py @@ -0,0 +1,96 @@ +# 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__ = ["CloudflareTunnel", "Connection"] + + +class Connection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class CloudflareTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for a tunnel.""" + + remote_config: Optional[bool] = None + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + + If `false`, the tunnel must be configured locally on the origin machine. + """ + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" diff --git a/src/cloudflare/types/shared/identifier.py b/src/cloudflare/types/shared/identifier.py new file mode 100644 index 00000000000..f45e7984c3f --- /dev/null +++ b/src/cloudflare/types/shared/identifier.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__ = ["Identifier"] + + +class Identifier(BaseModel): + id: Optional[str] = None + """Identifier""" diff --git a/src/cloudflare/types/shared/load_balancer_preview.py b/src/cloudflare/types/shared/load_balancer_preview.py new file mode 100644 index 00000000000..e57784aa9b5 --- /dev/null +++ b/src/cloudflare/types/shared/load_balancer_preview.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ..._models import BaseModel + +__all__ = ["LoadBalancerPreview"] + + +class LoadBalancerPreview(BaseModel): + pools: Optional[Dict[str, str]] = None + """Monitored pool IDs mapped to their respective names.""" + + preview_id: Optional[str] = None diff --git a/src/cloudflare/types/shared/member.py b/src/cloudflare/types/shared/member.py new file mode 100644 index 00000000000..101555dd229 --- /dev/null +++ b/src/cloudflare/types/shared/member.py @@ -0,0 +1,79 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .permission_grant import PermissionGrant + +__all__ = ["Member", "Role", "RolePermissions", "User"] + + +class RolePermissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class Role(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: RolePermissions + + +class User(BaseModel): + email: str + """The contact email address of the user.""" + + id: Optional[str] = None + """Identifier""" + + first_name: Optional[str] = None + """User's first name""" + + last_name: Optional[str] = None + """User's last name""" + + two_factor_authentication_enabled: Optional[bool] = None + """Indicates whether two-factor authentication is enabled for the user account. + + Does not apply to API authentication. + """ + + +class Member(BaseModel): + id: str + """Membership identifier tag.""" + + roles: List[Role] + """Roles assigned to this member.""" + + status: object + + user: User diff --git a/src/cloudflare/types/shared/pagination_info.py b/src/cloudflare/types/shared/pagination_info.py new file mode 100644 index 00000000000..917e3e94ea0 --- /dev/null +++ b/src/cloudflare/types/shared/pagination_info.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["PaginationInfo"] + + +class PaginationInfo(BaseModel): + count: Optional[float] = None + """Total number of results for the requested service""" + + page: Optional[float] = None + """Current page within paginated list of results""" + + per_page: Optional[float] = None + """Number of results per page of results""" + + total_count: Optional[float] = None + """Total results available without any search parameters""" diff --git a/src/cloudflare/types/shared/permission.py b/src/cloudflare/types/shared/permission.py new file mode 100644 index 00000000000..09793e2cb6f --- /dev/null +++ b/src/cloudflare/types/shared/permission.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + + + +__all__ = ["Permission"] + +Permission = str diff --git a/src/cloudflare/types/shared/permission_grant.py b/src/cloudflare/types/shared/permission_grant.py new file mode 100644 index 00000000000..b62bae8a56b --- /dev/null +++ b/src/cloudflare/types/shared/permission_grant.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["PermissionGrant"] + + +class PermissionGrant(BaseModel): + read: Optional[bool] = None + + write: Optional[bool] = None diff --git a/src/cloudflare/types/shared/response_info.py b/src/cloudflare/types/shared/response_info.py new file mode 100644 index 00000000000..3208261ab12 --- /dev/null +++ b/src/cloudflare/types/shared/response_info.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + + +from ..._models import BaseModel + +__all__ = ["ResponseInfo"] + + +class ResponseInfo(BaseModel): + code: int + + message: str diff --git a/src/cloudflare/types/shared/result.py b/src/cloudflare/types/shared/result.py new file mode 100644 index 00000000000..27983e6c0fd --- /dev/null +++ b/src/cloudflare/types/shared/result.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal + +from ..._models import BaseModel +from .audit_log import AuditLog +from .response_info import ResponseInfo + +__all__ = ["Result", "UnionMember0", "AaaAPIResponseCommon"] + + +class UnionMember0(BaseModel): + errors: Optional[object] = None + + messages: Optional[List[object]] = None + + result: Optional[List[AuditLog]] = None + + success: Optional[bool] = None + + +class AaaAPIResponseCommon(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + result: Union[List[object], str, object] + + success: Literal[True] + """Whether the API call was successful""" + + +Result = Union[UnionMember0, AaaAPIResponseCommon] diff --git a/src/cloudflare/types/accounts/role.py b/src/cloudflare/types/shared/role.py similarity index 84% rename from src/cloudflare/types/accounts/role.py rename to src/cloudflare/types/shared/role.py index 85afa978780..8bfd1f8f6ae 100644 --- a/src/cloudflare/types/accounts/role.py +++ b/src/cloudflare/types/shared/role.py @@ -3,6 +3,7 @@ from typing import List from ..._models import BaseModel +from .permission import Permission __all__ = ["Role"] @@ -17,5 +18,5 @@ class Role(BaseModel): name: str """Role Name.""" - permissions: List[str] + permissions: List[Permission] """Access permissions for this User.""" diff --git a/src/cloudflare/types/shared_params/__init__.py b/src/cloudflare/types/shared_params/__init__.py new file mode 100644 index 00000000000..9d75a6e1543 --- /dev/null +++ b/src/cloudflare/types/shared_params/__init__.py @@ -0,0 +1,4 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .asn import ASN as ASN +from .permission_grant import PermissionGrant as PermissionGrant diff --git a/src/cloudflare/types/shared_params/asn.py b/src/cloudflare/types/shared_params/asn.py new file mode 100644 index 00000000000..ade2d504bf0 --- /dev/null +++ b/src/cloudflare/types/shared_params/asn.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +__all__ = ["ASN"] + +ASN = int diff --git a/src/cloudflare/types/shared_params/permission_grant.py b/src/cloudflare/types/shared_params/permission_grant.py new file mode 100644 index 00000000000..9e670639ee1 --- /dev/null +++ b/src/cloudflare/types/shared_params/permission_grant.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["PermissionGrant"] + + +class PermissionGrant(TypedDict, total=False): + read: bool + + write: bool diff --git a/src/cloudflare/types/snippets/__init__.py b/src/cloudflare/types/snippets/__init__.py index 2cf9f9bde2d..2084aa6e7bb 100644 --- a/src/cloudflare/types/snippets/__init__.py +++ b/src/cloudflare/types/snippets/__init__.py @@ -2,6 +2,9 @@ from __future__ import annotations +from .snippet import Snippet as Snippet from .rule_list_response import RuleListResponse as RuleListResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams from .rule_update_response import RuleUpdateResponse as RuleUpdateResponse +from .snippet_update_params import SnippetUpdateParams as SnippetUpdateParams +from .snippet_delete_response import SnippetDeleteResponse as SnippetDeleteResponse diff --git a/src/cloudflare/types/snippet.py b/src/cloudflare/types/snippets/snippet.py similarity index 92% rename from src/cloudflare/types/snippet.py rename to src/cloudflare/types/snippets/snippet.py index 140c3b0edea..69dc660896e 100644 --- a/src/cloudflare/types/snippet.py +++ b/src/cloudflare/types/snippets/snippet.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["Snippet"] diff --git a/src/cloudflare/types/snippet_delete_response.py b/src/cloudflare/types/snippets/snippet_delete_response.py similarity index 100% rename from src/cloudflare/types/snippet_delete_response.py rename to src/cloudflare/types/snippets/snippet_delete_response.py diff --git a/src/cloudflare/types/snippet_update_params.py b/src/cloudflare/types/snippets/snippet_update_params.py similarity index 100% rename from src/cloudflare/types/snippet_update_params.py rename to src/cloudflare/types/snippets/snippet_update_params.py diff --git a/src/cloudflare/types/spectrum/__init__.py b/src/cloudflare/types/spectrum/__init__.py index 316d4fa6f16..a0c9f08e48a 100644 --- a/src/cloudflare/types/spectrum/__init__.py +++ b/src/cloudflare/types/spectrum/__init__.py @@ -2,10 +2,19 @@ from __future__ import annotations +from .dns import DNS as DNS +from .edge_ips import EdgeIPs as EdgeIPs +from .dns_param import DNSParam as DNSParam +from .origin_dns import OriginDNS as OriginDNS +from .origin_port import OriginPort as OriginPort +from .edge_ips_param import EdgeIPsParam as EdgeIPsParam from .app_list_params import AppListParams as AppListParams from .app_get_response import AppGetResponse as AppGetResponse +from .origin_dns_param import OriginDNSParam as OriginDNSParam from .app_create_params import AppCreateParams as AppCreateParams +from .app_delete_params import AppDeleteParams as AppDeleteParams from .app_update_params import AppUpdateParams as AppUpdateParams +from .origin_port_param import OriginPortParam as OriginPortParam from .app_create_response import AppCreateResponse as AppCreateResponse from .app_delete_response import AppDeleteResponse as AppDeleteResponse from .app_update_response import AppUpdateResponse as AppUpdateResponse diff --git a/src/cloudflare/types/spectrum/analytics/__init__.py b/src/cloudflare/types/spectrum/analytics/__init__.py index f8ee8b14b1c..1ffcad41306 100644 --- a/src/cloudflare/types/spectrum/analytics/__init__.py +++ b/src/cloudflare/types/spectrum/analytics/__init__.py @@ -1,3 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .dimension import Dimension as Dimension diff --git a/src/cloudflare/types/spectrum/analytics/dimension.py b/src/cloudflare/types/spectrum/analytics/dimension.py new file mode 100644 index 00000000000..0b53b87214b --- /dev/null +++ b/src/cloudflare/types/spectrum/analytics/dimension.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["Dimension"] + +Dimension = Literal["event", "appID", "coloName", "ipVersion"] diff --git a/src/cloudflare/types/spectrum/analytics/events/bytime_get_params.py b/src/cloudflare/types/spectrum/analytics/events/bytime_get_params.py index ce7f3f2b47c..2f9fde1b5a1 100644 --- a/src/cloudflare/types/spectrum/analytics/events/bytime_get_params.py +++ b/src/cloudflare/types/spectrum/analytics/events/bytime_get_params.py @@ -7,12 +7,13 @@ from typing_extensions import Literal, Annotated, TypedDict from ....._utils import PropertyInfo +from ..dimension import Dimension __all__ = ["BytimeGetParams"] class BytimeGetParams(TypedDict, total=False): - dimensions: List[Literal["event", "appID", "coloName", "ipVersion"]] + dimensions: List[Dimension] """Can be used to break down the data by given attributes. Options are: | Dimension | Name | Example | diff --git a/src/cloudflare/types/spectrum/analytics/events/summary_get_params.py b/src/cloudflare/types/spectrum/analytics/events/summary_get_params.py index 6785b937109..0fc955c44fb 100644 --- a/src/cloudflare/types/spectrum/analytics/events/summary_get_params.py +++ b/src/cloudflare/types/spectrum/analytics/events/summary_get_params.py @@ -7,12 +7,13 @@ from typing_extensions import Literal, Annotated, TypedDict from ....._utils import PropertyInfo +from ..dimension import Dimension __all__ = ["SummaryGetParams"] class SummaryGetParams(TypedDict, total=False): - dimensions: List[Literal["event", "appID", "coloName", "ipVersion"]] + dimensions: List[Dimension] """Can be used to break down the data by given attributes. Options are: | Dimension | Name | Example | diff --git a/src/cloudflare/types/spectrum/app_create_params.py b/src/cloudflare/types/spectrum/app_create_params.py index 2e9794fa965..dbd9189a007 100644 --- a/src/cloudflare/types/spectrum/app_create_params.py +++ b/src/cloudflare/types/spectrum/app_create_params.py @@ -2,20 +2,24 @@ from __future__ import annotations -from typing import List, Union from typing_extensions import Literal, Required, TypedDict -__all__ = ["AppCreateParams", "DNS", "OriginDNS", "EdgeIPs", "EdgeIPsEyeballIPs", "EdgeIPsCustomerOwnedIPs"] +from .dns_param import DNSParam +from .edge_ips_param import EdgeIPsParam +from .origin_dns_param import OriginDNSParam +from .origin_port_param import OriginPortParam + +__all__ = ["AppCreateParams"] class AppCreateParams(TypedDict, total=False): - dns: Required[DNS] + dns: Required[DNSParam] """The name and type of DNS record for the Spectrum application.""" - origin_dns: Required[OriginDNS] + origin_dns: Required[OriginDNSParam] """The name and type of DNS record for the Spectrum application.""" - origin_port: Required[Union[int, str]] + origin_port: Required[OriginPortParam] """The destination port at the origin. Only specified in conjunction with origin_dns. May use an integer to specify a @@ -38,7 +42,7 @@ class AppCreateParams(TypedDict, total=False): applications with traffic_type set to "direct". """ - edge_ips: EdgeIPs + edge_ips: EdgeIPsParam """The anycast edge IP configuration for the hostname of this application.""" ip_firewall: bool @@ -67,55 +71,3 @@ class AppCreateParams(TypedDict, total=False): "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and the application type matches this property exactly. """ - - -class DNS(TypedDict, total=False): - name: str - """The name of the DNS record associated with the application.""" - - type: Literal["CNAME", "ADDRESS"] - """The type of DNS record associated with the application.""" - - -class OriginDNS(TypedDict, total=False): - name: str - """The name of the DNS record associated with the origin.""" - - ttl: int - """The TTL of our resolution of your DNS record in seconds.""" - - type: Literal["", "A", "AAAA", "SRV"] - """The type of DNS record associated with the origin. - - "" is used to specify a combination of A/AAAA records. - """ - - -class EdgeIPsEyeballIPs(TypedDict, total=False): - connectivity: Literal["all", "ipv4", "ipv6"] - """The IP versions supported for inbound connections on Spectrum anycast IPs.""" - - type: Literal["dynamic"] - """The type of edge IP configuration specified. - - Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the - connectivity you specify. Only valid with CNAME DNS names. - """ - - -class EdgeIPsCustomerOwnedIPs(TypedDict, total=False): - ips: List[str] - """ - The array of customer owned IPs we broadcast via anycast for this hostname and - application. - """ - - type: Literal["static"] - """The type of edge IP configuration specified. - - Statically allocated edge IPs use customer IPs in accordance with the ips array - you specify. Only valid with ADDRESS DNS names. - """ - - -EdgeIPs = Union[EdgeIPsEyeballIPs, EdgeIPsCustomerOwnedIPs] diff --git a/src/cloudflare/types/spectrum/app_create_response.py b/src/cloudflare/types/spectrum/app_create_response.py index 04087a8e63d..4b3530730e1 100644 --- a/src/cloudflare/types/spectrum/app_create_response.py +++ b/src/cloudflare/types/spectrum/app_create_response.py @@ -1,64 +1,16 @@ # 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 +from .dns import DNS +from .edge_ips import EdgeIPs from ..._models import BaseModel +from .origin_dns import OriginDNS +from .origin_port import OriginPort -__all__ = ["AppCreateResponse", "DNS", "EdgeIPs", "EdgeIPsEyeballIPs", "EdgeIPsCustomerOwnedIPs", "OriginDNS"] - - -class DNS(BaseModel): - name: Optional[str] = None - """The name of the DNS record associated with the application.""" - - type: Optional[Literal["CNAME", "ADDRESS"]] = None - """The type of DNS record associated with the application.""" - - -class EdgeIPsEyeballIPs(BaseModel): - connectivity: Optional[Literal["all", "ipv4", "ipv6"]] = None - """The IP versions supported for inbound connections on Spectrum anycast IPs.""" - - type: Optional[Literal["dynamic"]] = None - """The type of edge IP configuration specified. - - Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the - connectivity you specify. Only valid with CNAME DNS names. - """ - - -class EdgeIPsCustomerOwnedIPs(BaseModel): - ips: Optional[List[str]] = None - """ - The array of customer owned IPs we broadcast via anycast for this hostname and - application. - """ - - type: Optional[Literal["static"]] = None - """The type of edge IP configuration specified. - - Statically allocated edge IPs use customer IPs in accordance with the ips array - you specify. Only valid with ADDRESS DNS names. - """ - - -EdgeIPs = Union[EdgeIPsEyeballIPs, EdgeIPsCustomerOwnedIPs] - - -class OriginDNS(BaseModel): - name: Optional[str] = None - """The name of the DNS record associated with the origin.""" - - ttl: Optional[int] = None - """The TTL of our resolution of your DNS record in seconds.""" - - type: Optional[Literal["", "A", "AAAA", "SRV"]] = None - """The type of DNS record associated with the origin. - - "" is used to specify a combination of A/AAAA records. - """ +__all__ = ["AppCreateResponse"] class AppCreateResponse(BaseModel): @@ -92,7 +44,7 @@ class AppCreateResponse(BaseModel): origin_dns: Optional[OriginDNS] = None """The name and type of DNS record for the Spectrum application.""" - origin_port: Union[int, str, None] = None + origin_port: Optional[OriginPort] = None """The destination port at the origin. Only specified in conjunction with origin_dns. May use an integer to specify a diff --git a/src/cloudflare/types/spectrum/app_delete_params.py b/src/cloudflare/types/spectrum/app_delete_params.py new file mode 100644 index 00000000000..9f31b197105 --- /dev/null +++ b/src/cloudflare/types/spectrum/app_delete_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__ = ["AppDeleteParams"] + + +class AppDeleteParams(TypedDict, total=False): + zone: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/spectrum/app_get_response.py b/src/cloudflare/types/spectrum/app_get_response.py index c236b54c610..67e2aa1f173 100644 --- a/src/cloudflare/types/spectrum/app_get_response.py +++ b/src/cloudflare/types/spectrum/app_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["AppGetResponse"] -AppGetResponse = Union[str, object, None] +AppGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/spectrum/app_update_params.py b/src/cloudflare/types/spectrum/app_update_params.py index 7ac95ea46a7..9a19d2453da 100644 --- a/src/cloudflare/types/spectrum/app_update_params.py +++ b/src/cloudflare/types/spectrum/app_update_params.py @@ -2,23 +2,27 @@ from __future__ import annotations -from typing import List, Union from typing_extensions import Literal, Required, TypedDict -__all__ = ["AppUpdateParams", "DNS", "OriginDNS", "EdgeIPs", "EdgeIPsEyeballIPs", "EdgeIPsCustomerOwnedIPs"] +from .dns_param import DNSParam +from .edge_ips_param import EdgeIPsParam +from .origin_dns_param import OriginDNSParam +from .origin_port_param import OriginPortParam + +__all__ = ["AppUpdateParams"] class AppUpdateParams(TypedDict, total=False): zone: Required[str] """Identifier""" - dns: Required[DNS] + dns: Required[DNSParam] """The name and type of DNS record for the Spectrum application.""" - origin_dns: Required[OriginDNS] + origin_dns: Required[OriginDNSParam] """The name and type of DNS record for the Spectrum application.""" - origin_port: Required[Union[int, str]] + origin_port: Required[OriginPortParam] """The destination port at the origin. Only specified in conjunction with origin_dns. May use an integer to specify a @@ -41,7 +45,7 @@ class AppUpdateParams(TypedDict, total=False): applications with traffic_type set to "direct". """ - edge_ips: EdgeIPs + edge_ips: EdgeIPsParam """The anycast edge IP configuration for the hostname of this application.""" ip_firewall: bool @@ -70,55 +74,3 @@ class AppUpdateParams(TypedDict, total=False): "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and the application type matches this property exactly. """ - - -class DNS(TypedDict, total=False): - name: str - """The name of the DNS record associated with the application.""" - - type: Literal["CNAME", "ADDRESS"] - """The type of DNS record associated with the application.""" - - -class OriginDNS(TypedDict, total=False): - name: str - """The name of the DNS record associated with the origin.""" - - ttl: int - """The TTL of our resolution of your DNS record in seconds.""" - - type: Literal["", "A", "AAAA", "SRV"] - """The type of DNS record associated with the origin. - - "" is used to specify a combination of A/AAAA records. - """ - - -class EdgeIPsEyeballIPs(TypedDict, total=False): - connectivity: Literal["all", "ipv4", "ipv6"] - """The IP versions supported for inbound connections on Spectrum anycast IPs.""" - - type: Literal["dynamic"] - """The type of edge IP configuration specified. - - Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the - connectivity you specify. Only valid with CNAME DNS names. - """ - - -class EdgeIPsCustomerOwnedIPs(TypedDict, total=False): - ips: List[str] - """ - The array of customer owned IPs we broadcast via anycast for this hostname and - application. - """ - - type: Literal["static"] - """The type of edge IP configuration specified. - - Statically allocated edge IPs use customer IPs in accordance with the ips array - you specify. Only valid with ADDRESS DNS names. - """ - - -EdgeIPs = Union[EdgeIPsEyeballIPs, EdgeIPsCustomerOwnedIPs] diff --git a/src/cloudflare/types/spectrum/app_update_response.py b/src/cloudflare/types/spectrum/app_update_response.py index 6a337f26b92..9f16609934f 100644 --- a/src/cloudflare/types/spectrum/app_update_response.py +++ b/src/cloudflare/types/spectrum/app_update_response.py @@ -1,64 +1,16 @@ # 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 +from .dns import DNS +from .edge_ips import EdgeIPs from ..._models import BaseModel +from .origin_dns import OriginDNS +from .origin_port import OriginPort -__all__ = ["AppUpdateResponse", "DNS", "EdgeIPs", "EdgeIPsEyeballIPs", "EdgeIPsCustomerOwnedIPs", "OriginDNS"] - - -class DNS(BaseModel): - name: Optional[str] = None - """The name of the DNS record associated with the application.""" - - type: Optional[Literal["CNAME", "ADDRESS"]] = None - """The type of DNS record associated with the application.""" - - -class EdgeIPsEyeballIPs(BaseModel): - connectivity: Optional[Literal["all", "ipv4", "ipv6"]] = None - """The IP versions supported for inbound connections on Spectrum anycast IPs.""" - - type: Optional[Literal["dynamic"]] = None - """The type of edge IP configuration specified. - - Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the - connectivity you specify. Only valid with CNAME DNS names. - """ - - -class EdgeIPsCustomerOwnedIPs(BaseModel): - ips: Optional[List[str]] = None - """ - The array of customer owned IPs we broadcast via anycast for this hostname and - application. - """ - - type: Optional[Literal["static"]] = None - """The type of edge IP configuration specified. - - Statically allocated edge IPs use customer IPs in accordance with the ips array - you specify. Only valid with ADDRESS DNS names. - """ - - -EdgeIPs = Union[EdgeIPsEyeballIPs, EdgeIPsCustomerOwnedIPs] - - -class OriginDNS(BaseModel): - name: Optional[str] = None - """The name of the DNS record associated with the origin.""" - - ttl: Optional[int] = None - """The TTL of our resolution of your DNS record in seconds.""" - - type: Optional[Literal["", "A", "AAAA", "SRV"]] = None - """The type of DNS record associated with the origin. - - "" is used to specify a combination of A/AAAA records. - """ +__all__ = ["AppUpdateResponse"] class AppUpdateResponse(BaseModel): @@ -92,7 +44,7 @@ class AppUpdateResponse(BaseModel): origin_dns: Optional[OriginDNS] = None """The name and type of DNS record for the Spectrum application.""" - origin_port: Union[int, str, None] = None + origin_port: Optional[OriginPort] = None """The destination port at the origin. Only specified in conjunction with origin_dns. May use an integer to specify a diff --git a/src/cloudflare/types/spectrum/dns.py b/src/cloudflare/types/spectrum/dns.py new file mode 100644 index 00000000000..6b21157c6f6 --- /dev/null +++ b/src/cloudflare/types/spectrum/dns.py @@ -0,0 +1,16 @@ +# 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__ = ["DNS"] + + +class DNS(BaseModel): + name: Optional[str] = None + """The name of the DNS record associated with the application.""" + + type: Optional[Literal["CNAME", "ADDRESS"]] = None + """The type of DNS record associated with the application.""" diff --git a/src/cloudflare/types/spectrum/dns_param.py b/src/cloudflare/types/spectrum/dns_param.py new file mode 100644 index 00000000000..ef8fdee11b5 --- /dev/null +++ b/src/cloudflare/types/spectrum/dns_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["DNSParam"] + + +class DNSParam(TypedDict, total=False): + name: str + """The name of the DNS record associated with the application.""" + + type: Literal["CNAME", "ADDRESS"] + """The type of DNS record associated with the application.""" diff --git a/src/cloudflare/types/spectrum/edge_ips.py b/src/cloudflare/types/spectrum/edge_ips.py new file mode 100644 index 00000000000..2b789322dfe --- /dev/null +++ b/src/cloudflare/types/spectrum/edge_ips.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["EdgeIPs", "EyeballIPs", "CustomerOwnedIPs"] + + +class EyeballIPs(BaseModel): + connectivity: Optional[Literal["all", "ipv4", "ipv6"]] = None + """The IP versions supported for inbound connections on Spectrum anycast IPs.""" + + type: Optional[Literal["dynamic"]] = None + """The type of edge IP configuration specified. + + Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the + connectivity you specify. Only valid with CNAME DNS names. + """ + + +class CustomerOwnedIPs(BaseModel): + ips: Optional[List[str]] = None + """ + The array of customer owned IPs we broadcast via anycast for this hostname and + application. + """ + + type: Optional[Literal["static"]] = None + """The type of edge IP configuration specified. + + Statically allocated edge IPs use customer IPs in accordance with the ips array + you specify. Only valid with ADDRESS DNS names. + """ + + +EdgeIPs = Union[EyeballIPs, CustomerOwnedIPs] diff --git a/src/cloudflare/types/spectrum/edge_ips_param.py b/src/cloudflare/types/spectrum/edge_ips_param.py new file mode 100644 index 00000000000..54e00328eea --- /dev/null +++ b/src/cloudflare/types/spectrum/edge_ips_param.py @@ -0,0 +1,38 @@ +# 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, TypedDict + +__all__ = ["EdgeIPsParam", "EyeballIPs", "CustomerOwnedIPs"] + + +class EyeballIPs(TypedDict, total=False): + connectivity: Literal["all", "ipv4", "ipv6"] + """The IP versions supported for inbound connections on Spectrum anycast IPs.""" + + type: Literal["dynamic"] + """The type of edge IP configuration specified. + + Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the + connectivity you specify. Only valid with CNAME DNS names. + """ + + +class CustomerOwnedIPs(TypedDict, total=False): + ips: List[str] + """ + The array of customer owned IPs we broadcast via anycast for this hostname and + application. + """ + + type: Literal["static"] + """The type of edge IP configuration specified. + + Statically allocated edge IPs use customer IPs in accordance with the ips array + you specify. Only valid with ADDRESS DNS names. + """ + + +EdgeIPsParam = Union[EyeballIPs, CustomerOwnedIPs] diff --git a/src/cloudflare/types/spectrum/origin_dns.py b/src/cloudflare/types/spectrum/origin_dns.py new file mode 100644 index 00000000000..09bb671aef6 --- /dev/null +++ b/src/cloudflare/types/spectrum/origin_dns.py @@ -0,0 +1,22 @@ +# 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__ = ["OriginDNS"] + + +class OriginDNS(BaseModel): + name: Optional[str] = None + """The name of the DNS record associated with the origin.""" + + ttl: Optional[int] = None + """The TTL of our resolution of your DNS record in seconds.""" + + type: Optional[Literal["", "A", "AAAA", "SRV"]] = None + """The type of DNS record associated with the origin. + + "" is used to specify a combination of A/AAAA records. + """ diff --git a/src/cloudflare/types/spectrum/origin_dns_param.py b/src/cloudflare/types/spectrum/origin_dns_param.py new file mode 100644 index 00000000000..7549c967f1b --- /dev/null +++ b/src/cloudflare/types/spectrum/origin_dns_param.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 Literal, TypedDict + +__all__ = ["OriginDNSParam"] + + +class OriginDNSParam(TypedDict, total=False): + name: str + """The name of the DNS record associated with the origin.""" + + ttl: int + """The TTL of our resolution of your DNS record in seconds.""" + + type: Literal["", "A", "AAAA", "SRV"] + """The type of DNS record associated with the origin. + + "" is used to specify a combination of A/AAAA records. + """ diff --git a/src/cloudflare/types/spectrum/origin_port.py b/src/cloudflare/types/spectrum/origin_port.py new file mode 100644 index 00000000000..8079b9b3479 --- /dev/null +++ b/src/cloudflare/types/spectrum/origin_port.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +__all__ = ["OriginPort"] + +OriginPort = Union[int, str] diff --git a/src/cloudflare/types/spectrum/origin_port_param.py b/src/cloudflare/types/spectrum/origin_port_param.py new file mode 100644 index 00000000000..ce64ccbc3d1 --- /dev/null +++ b/src/cloudflare/types/spectrum/origin_port_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +__all__ = ["OriginPortParam"] + +OriginPortParam = Union[int, str] diff --git a/src/cloudflare/types/speed/__init__.py b/src/cloudflare/types/speed/__init__.py index 86dea078f40..4a31ccc0a91 100644 --- a/src/cloudflare/types/speed/__init__.py +++ b/src/cloudflare/types/speed/__init__.py @@ -2,13 +2,22 @@ from __future__ import annotations +from .test import Test as Test +from .trend import Trend as Trend +from .schedule import Schedule as Schedule +from .availability import Availability as Availability +from .labeled_region import LabeledRegion as LabeledRegion +from .schedule_param import ScheduleParam as ScheduleParam from .test_list_params import TestListParams as TestListParams +from .lighthouse_report import LighthouseReport as LighthouseReport from .page_list_response import PageListResponse as PageListResponse from .test_create_params import TestCreateParams as TestCreateParams from .test_delete_params import TestDeleteParams as TestDeleteParams from .test_list_response import TestListResponse as TestListResponse +from .speed_delete_params import SpeedDeleteParams as SpeedDeleteParams from .test_delete_response import TestDeleteResponse as TestDeleteResponse -from .observatory_page_test import ObservatoryPageTest as ObservatoryPageTest +from .speed_delete_response import SpeedDeleteResponse as SpeedDeleteResponse from .schedule_create_params import ScheduleCreateParams as ScheduleCreateParams from .schedule_create_response import ScheduleCreateResponse as ScheduleCreateResponse -from .observatory_availabilities import ObservatoryAvailabilities as ObservatoryAvailabilities +from .speed_trends_list_params import SpeedTrendsListParams as SpeedTrendsListParams +from .speed_schedule_get_params import SpeedScheduleGetParams as SpeedScheduleGetParams diff --git a/src/cloudflare/types/speed/availability.py b/src/cloudflare/types/speed/availability.py new file mode 100644 index 00000000000..96562a49349 --- /dev/null +++ b/src/cloudflare/types/speed/availability.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .labeled_region import LabeledRegion + +__all__ = ["Availability", "Quota"] + + +class Quota(BaseModel): + plan: Optional[str] = None + """Cloudflare plan.""" + + quotas_per_plan: Optional[Dict[str, float]] = FieldInfo(alias="quotasPerPlan", default=None) + """The number of tests available per plan.""" + + remaining_schedules: Optional[float] = FieldInfo(alias="remainingSchedules", default=None) + """The number of remaining schedules available.""" + + remaining_tests: Optional[float] = FieldInfo(alias="remainingTests", default=None) + """The number of remaining tests available.""" + + schedule_quotas_per_plan: Optional[Dict[str, float]] = FieldInfo(alias="scheduleQuotasPerPlan", default=None) + """The number of schedules available per plan.""" + + +class Availability(BaseModel): + quota: Optional[Quota] = None + + regions: Optional[List[LabeledRegion]] = None + + regions_per_plan: Optional[object] = FieldInfo(alias="regionsPerPlan", default=None) diff --git a/src/cloudflare/types/speed/labeled_region.py b/src/cloudflare/types/speed/labeled_region.py new file mode 100644 index 00000000000..a6d8ab6a7bd --- /dev/null +++ b/src/cloudflare/types/speed/labeled_region.py @@ -0,0 +1,39 @@ +# 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__ = ["LabeledRegion"] + + +class LabeledRegion(BaseModel): + label: Optional[str] = None + + value: Optional[ + Literal[ + "asia-east1", + "asia-northeast1", + "asia-northeast2", + "asia-south1", + "asia-southeast1", + "australia-southeast1", + "europe-north1", + "europe-southwest1", + "europe-west1", + "europe-west2", + "europe-west3", + "europe-west4", + "europe-west8", + "europe-west9", + "me-west1", + "southamerica-east1", + "us-central1", + "us-east1", + "us-east4", + "us-south1", + "us-west1", + ] + ] = None + """A test region.""" diff --git a/src/cloudflare/types/speed/lighthouse_report.py b/src/cloudflare/types/speed/lighthouse_report.py new file mode 100644 index 00000000000..95948430129 --- /dev/null +++ b/src/cloudflare/types/speed/lighthouse_report.py @@ -0,0 +1,58 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LighthouseReport", "Error"] + + +class Error(BaseModel): + code: Optional[Literal["NOT_REACHABLE", "DNS_FAILURE", "NOT_HTML", "LIGHTHOUSE_TIMEOUT", "UNKNOWN"]] = None + """The error code of the Lighthouse result.""" + + detail: Optional[str] = None + """Detailed error message.""" + + final_displayed_url: Optional[str] = FieldInfo(alias="finalDisplayedUrl", default=None) + """The final URL displayed to the user.""" + + +class LighthouseReport(BaseModel): + cls: Optional[float] = None + """Cumulative Layout Shift.""" + + device_type: Optional[Literal["DESKTOP", "MOBILE"]] = FieldInfo(alias="deviceType", default=None) + """The type of device.""" + + error: Optional[Error] = None + + fcp: Optional[float] = None + """First Contentful Paint.""" + + json_report_url: Optional[str] = FieldInfo(alias="jsonReportUrl", default=None) + """The URL to the full Lighthouse JSON report.""" + + lcp: Optional[float] = None + """Largest Contentful Paint.""" + + performance_score: Optional[float] = FieldInfo(alias="performanceScore", default=None) + """The Lighthouse performance score.""" + + si: Optional[float] = None + """Speed Index.""" + + state: Optional[Literal["RUNNING", "COMPLETE", "FAILED"]] = None + """The state of the Lighthouse report.""" + + tbt: Optional[float] = None + """Total Blocking Time.""" + + ttfb: Optional[float] = None + """Time To First Byte.""" + + tti: Optional[float] = None + """Time To Interactive.""" diff --git a/src/cloudflare/types/speed/observatory_availabilities.py b/src/cloudflare/types/speed/observatory_availabilities.py deleted file mode 100644 index 8f30451b153..00000000000 --- a/src/cloudflare/types/speed/observatory_availabilities.py +++ /dev/null @@ -1,66 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["ObservatoryAvailabilities", "Quota", "Region"] - - -class Quota(BaseModel): - plan: Optional[str] = None - """Cloudflare plan.""" - - quotas_per_plan: Optional[Dict[str, float]] = FieldInfo(alias="quotasPerPlan", default=None) - """The number of tests available per plan.""" - - remaining_schedules: Optional[float] = FieldInfo(alias="remainingSchedules", default=None) - """The number of remaining schedules available.""" - - remaining_tests: Optional[float] = FieldInfo(alias="remainingTests", default=None) - """The number of remaining tests available.""" - - schedule_quotas_per_plan: Optional[Dict[str, float]] = FieldInfo(alias="scheduleQuotasPerPlan", default=None) - """The number of schedules available per plan.""" - - -class Region(BaseModel): - label: Optional[str] = None - - value: Optional[ - Literal[ - "asia-east1", - "asia-northeast1", - "asia-northeast2", - "asia-south1", - "asia-southeast1", - "australia-southeast1", - "europe-north1", - "europe-southwest1", - "europe-west1", - "europe-west2", - "europe-west3", - "europe-west4", - "europe-west8", - "europe-west9", - "me-west1", - "southamerica-east1", - "us-central1", - "us-east1", - "us-east4", - "us-south1", - "us-west1", - ] - ] = None - """A test region.""" - - -class ObservatoryAvailabilities(BaseModel): - quota: Optional[Quota] = None - - regions: Optional[List[Region]] = None - - regions_per_plan: Optional[object] = FieldInfo(alias="regionsPerPlan", default=None) diff --git a/src/cloudflare/types/speed/observatory_page_test.py b/src/cloudflare/types/speed/observatory_page_test.py deleted file mode 100644 index e766a5fa9fa..00000000000 --- a/src/cloudflare/types/speed/observatory_page_test.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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__ = ["ObservatoryPageTest", "DesktopReport", "DesktopReportError", "MobileReport", "MobileReportError", "Region"] - - -class DesktopReportError(BaseModel): - code: Optional[Literal["NOT_REACHABLE", "DNS_FAILURE", "NOT_HTML", "LIGHTHOUSE_TIMEOUT", "UNKNOWN"]] = None - """The error code of the Lighthouse result.""" - - detail: Optional[str] = None - """Detailed error message.""" - - final_displayed_url: Optional[str] = FieldInfo(alias="finalDisplayedUrl", default=None) - """The final URL displayed to the user.""" - - -class DesktopReport(BaseModel): - cls: Optional[float] = None - """Cumulative Layout Shift.""" - - device_type: Optional[Literal["DESKTOP", "MOBILE"]] = FieldInfo(alias="deviceType", default=None) - """The type of device.""" - - error: Optional[DesktopReportError] = None - - fcp: Optional[float] = None - """First Contentful Paint.""" - - json_report_url: Optional[str] = FieldInfo(alias="jsonReportUrl", default=None) - """The URL to the full Lighthouse JSON report.""" - - lcp: Optional[float] = None - """Largest Contentful Paint.""" - - performance_score: Optional[float] = FieldInfo(alias="performanceScore", default=None) - """The Lighthouse performance score.""" - - si: Optional[float] = None - """Speed Index.""" - - state: Optional[Literal["RUNNING", "COMPLETE", "FAILED"]] = None - """The state of the Lighthouse report.""" - - tbt: Optional[float] = None - """Total Blocking Time.""" - - ttfb: Optional[float] = None - """Time To First Byte.""" - - tti: Optional[float] = None - """Time To Interactive.""" - - -class MobileReportError(BaseModel): - code: Optional[Literal["NOT_REACHABLE", "DNS_FAILURE", "NOT_HTML", "LIGHTHOUSE_TIMEOUT", "UNKNOWN"]] = None - """The error code of the Lighthouse result.""" - - detail: Optional[str] = None - """Detailed error message.""" - - final_displayed_url: Optional[str] = FieldInfo(alias="finalDisplayedUrl", default=None) - """The final URL displayed to the user.""" - - -class MobileReport(BaseModel): - cls: Optional[float] = None - """Cumulative Layout Shift.""" - - device_type: Optional[Literal["DESKTOP", "MOBILE"]] = FieldInfo(alias="deviceType", default=None) - """The type of device.""" - - error: Optional[MobileReportError] = None - - fcp: Optional[float] = None - """First Contentful Paint.""" - - json_report_url: Optional[str] = FieldInfo(alias="jsonReportUrl", default=None) - """The URL to the full Lighthouse JSON report.""" - - lcp: Optional[float] = None - """Largest Contentful Paint.""" - - performance_score: Optional[float] = FieldInfo(alias="performanceScore", default=None) - """The Lighthouse performance score.""" - - si: Optional[float] = None - """Speed Index.""" - - state: Optional[Literal["RUNNING", "COMPLETE", "FAILED"]] = None - """The state of the Lighthouse report.""" - - tbt: Optional[float] = None - """Total Blocking Time.""" - - ttfb: Optional[float] = None - """Time To First Byte.""" - - tti: Optional[float] = None - """Time To Interactive.""" - - -class Region(BaseModel): - label: Optional[str] = None - - value: Optional[ - Literal[ - "asia-east1", - "asia-northeast1", - "asia-northeast2", - "asia-south1", - "asia-southeast1", - "australia-southeast1", - "europe-north1", - "europe-southwest1", - "europe-west1", - "europe-west2", - "europe-west3", - "europe-west4", - "europe-west8", - "europe-west9", - "me-west1", - "southamerica-east1", - "us-central1", - "us-east1", - "us-east4", - "us-south1", - "us-west1", - ] - ] = None - """A test region.""" - - -class ObservatoryPageTest(BaseModel): - id: Optional[str] = None - """UUID""" - - date: Optional[datetime] = None - - desktop_report: Optional[DesktopReport] = FieldInfo(alias="desktopReport", default=None) - """The Lighthouse report.""" - - mobile_report: Optional[MobileReport] = FieldInfo(alias="mobileReport", default=None) - """The Lighthouse report.""" - - region: Optional[Region] = None - """A test region with a label.""" - - schedule_frequency: Optional[Literal["DAILY", "WEEKLY"]] = FieldInfo(alias="scheduleFrequency", default=None) - """The frequency of the test.""" - - url: Optional[str] = None - """A URL.""" diff --git a/src/cloudflare/types/speed/page_list_response.py b/src/cloudflare/types/speed/page_list_response.py index a8d40729f35..e90c0dc3704 100644 --- a/src/cloudflare/types/speed/page_list_response.py +++ b/src/cloudflare/types/speed/page_list_response.py @@ -5,51 +5,21 @@ from pydantic import Field as FieldInfo +from .test import Test from ..._models import BaseModel -from .observatory_page_test import ObservatoryPageTest - -__all__ = ["PageListResponse", "Region"] - - -class Region(BaseModel): - label: Optional[str] = None - - value: Optional[ - Literal[ - "asia-east1", - "asia-northeast1", - "asia-northeast2", - "asia-south1", - "asia-southeast1", - "australia-southeast1", - "europe-north1", - "europe-southwest1", - "europe-west1", - "europe-west2", - "europe-west3", - "europe-west4", - "europe-west8", - "europe-west9", - "me-west1", - "southamerica-east1", - "us-central1", - "us-east1", - "us-east4", - "us-south1", - "us-west1", - ] - ] = None - """A test region.""" +from .labeled_region import LabeledRegion + +__all__ = ["PageListResponse"] class PageListResponse(BaseModel): - region: Optional[Region] = None + region: Optional[LabeledRegion] = None """A test region with a label.""" schedule_frequency: Optional[Literal["DAILY", "WEEKLY"]] = FieldInfo(alias="scheduleFrequency", default=None) """The frequency of the test.""" - tests: Optional[List[ObservatoryPageTest]] = None + tests: Optional[List[Test]] = None url: Optional[str] = None """A URL.""" diff --git a/src/cloudflare/types/speed/schedule.py b/src/cloudflare/types/speed/schedule.py new file mode 100644 index 00000000000..42ae4c52008 --- /dev/null +++ b/src/cloudflare/types/speed/schedule.py @@ -0,0 +1,43 @@ +# 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__ = ["Schedule"] + + +class Schedule(BaseModel): + frequency: Optional[Literal["DAILY", "WEEKLY"]] = None + """The frequency of the test.""" + + region: Optional[ + Literal[ + "asia-east1", + "asia-northeast1", + "asia-northeast2", + "asia-south1", + "asia-southeast1", + "australia-southeast1", + "europe-north1", + "europe-southwest1", + "europe-west1", + "europe-west2", + "europe-west3", + "europe-west4", + "europe-west8", + "europe-west9", + "me-west1", + "southamerica-east1", + "us-central1", + "us-east1", + "us-east4", + "us-south1", + "us-west1", + ] + ] = None + """A test region.""" + + url: Optional[str] = None + """A URL.""" diff --git a/src/cloudflare/types/speed/schedule_create_response.py b/src/cloudflare/types/speed/schedule_create_response.py index 9c9eb38b426..50ef4d668ed 100644 --- a/src/cloudflare/types/speed/schedule_create_response.py +++ b/src/cloudflare/types/speed/schedule_create_response.py @@ -2,15 +2,15 @@ from typing import Optional +from .test import Test +from .schedule import Schedule from ..._models import BaseModel -from ..observatory_schedule import ObservatorySchedule -from .observatory_page_test import ObservatoryPageTest __all__ = ["ScheduleCreateResponse"] class ScheduleCreateResponse(BaseModel): - schedule: Optional[ObservatorySchedule] = None + schedule: Optional[Schedule] = None """The test schedule.""" - test: Optional[ObservatoryPageTest] = None + test: Optional[Test] = None diff --git a/src/cloudflare/types/speed/schedule_param.py b/src/cloudflare/types/speed/schedule_param.py new file mode 100644 index 00000000000..0b2f7bb2059 --- /dev/null +++ b/src/cloudflare/types/speed/schedule_param.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["ScheduleParam"] + + +class ScheduleParam(TypedDict, total=False): + frequency: Literal["DAILY", "WEEKLY"] + """The frequency of the test.""" + + region: Literal[ + "asia-east1", + "asia-northeast1", + "asia-northeast2", + "asia-south1", + "asia-southeast1", + "australia-southeast1", + "europe-north1", + "europe-southwest1", + "europe-west1", + "europe-west2", + "europe-west3", + "europe-west4", + "europe-west8", + "europe-west9", + "me-west1", + "southamerica-east1", + "us-central1", + "us-east1", + "us-east4", + "us-south1", + "us-west1", + ] + """A test region.""" + + url: str + """A URL.""" diff --git a/src/cloudflare/types/speed_delete_params.py b/src/cloudflare/types/speed/speed_delete_params.py similarity index 100% rename from src/cloudflare/types/speed_delete_params.py rename to src/cloudflare/types/speed/speed_delete_params.py diff --git a/src/cloudflare/types/speed_delete_response.py b/src/cloudflare/types/speed/speed_delete_response.py similarity index 88% rename from src/cloudflare/types/speed_delete_response.py rename to src/cloudflare/types/speed/speed_delete_response.py index ca2cd434822..71d39113616 100644 --- a/src/cloudflare/types/speed_delete_response.py +++ b/src/cloudflare/types/speed/speed_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["SpeedDeleteResponse"] diff --git a/src/cloudflare/types/speed_schedule_get_params.py b/src/cloudflare/types/speed/speed_schedule_get_params.py similarity index 100% rename from src/cloudflare/types/speed_schedule_get_params.py rename to src/cloudflare/types/speed/speed_schedule_get_params.py diff --git a/src/cloudflare/types/speed_trends_list_params.py b/src/cloudflare/types/speed/speed_trends_list_params.py similarity index 84% rename from src/cloudflare/types/speed_trends_list_params.py rename to src/cloudflare/types/speed/speed_trends_list_params.py index 5f034857052..2af594b00dc 100644 --- a/src/cloudflare/types/speed_trends_list_params.py +++ b/src/cloudflare/types/speed/speed_trends_list_params.py @@ -2,9 +2,11 @@ from __future__ import annotations +from typing import Union +from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypedDict -from .._utils import PropertyInfo +from ..._utils import PropertyInfo __all__ = ["SpeedTrendsListParams"] @@ -46,5 +48,9 @@ class SpeedTrendsListParams(TypedDict, total=False): ] """A test region.""" + start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + tz: Required[str] """The timezone of the start and end timestamps.""" + + end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] diff --git a/src/cloudflare/types/speed/test.py b/src/cloudflare/types/speed/test.py new file mode 100644 index 00000000000..7bb5951eb72 --- /dev/null +++ b/src/cloudflare/types/speed/test.py @@ -0,0 +1,36 @@ +# 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 +from .labeled_region import LabeledRegion +from .lighthouse_report import LighthouseReport + +__all__ = ["Test"] + + +class Test(BaseModel): + __test__ = False + id: Optional[str] = None + """UUID""" + + date: Optional[datetime] = None + + desktop_report: Optional[LighthouseReport] = FieldInfo(alias="desktopReport", default=None) + """The Lighthouse report.""" + + mobile_report: Optional[LighthouseReport] = FieldInfo(alias="mobileReport", default=None) + """The Lighthouse report.""" + + region: Optional[LabeledRegion] = None + """A test region with a label.""" + + schedule_frequency: Optional[Literal["DAILY", "WEEKLY"]] = FieldInfo(alias="scheduleFrequency", default=None) + """The frequency of the test.""" + + url: Optional[str] = None + """A URL.""" diff --git a/src/cloudflare/types/speed/test_list_response.py b/src/cloudflare/types/speed/test_list_response.py index 0c610a295bc..122df70f30f 100644 --- a/src/cloudflare/types/speed/test_list_response.py +++ b/src/cloudflare/types/speed/test_list_response.py @@ -3,20 +3,9 @@ from typing import List, Optional from ..._models import BaseModel +from ..shared.response_info import ResponseInfo -__all__ = ["TestListResponse", "Error", "Message", "ResultInfo"] - - -class Error(BaseModel): - code: int - - message: str - - -class Message(BaseModel): - code: int - - message: str +__all__ = ["TestListResponse", "ResultInfo"] class ResultInfo(BaseModel): @@ -31,9 +20,9 @@ class ResultInfo(BaseModel): class TestListResponse(BaseModel): __test__ = False - errors: List[Error] + errors: List[ResponseInfo] - messages: List[Message] + messages: List[ResponseInfo] success: bool """Whether the API call was successful.""" diff --git a/src/cloudflare/types/speed/trend.py b/src/cloudflare/types/speed/trend.py new file mode 100644 index 00000000000..713aecd2e80 --- /dev/null +++ b/src/cloudflare/types/speed/trend.py @@ -0,0 +1,35 @@ +# 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__ = ["Trend"] + + +class Trend(BaseModel): + cls: Optional[List[Optional[float]]] = None + """Cumulative Layout Shift trend.""" + + fcp: Optional[List[Optional[float]]] = None + """First Contentful Paint trend.""" + + lcp: Optional[List[Optional[float]]] = None + """Largest Contentful Paint trend.""" + + performance_score: Optional[List[Optional[float]]] = FieldInfo(alias="performanceScore", default=None) + """The Lighthouse score trend.""" + + si: Optional[List[Optional[float]]] = None + """Speed Index trend.""" + + tbt: Optional[List[Optional[float]]] = None + """Total Blocking Time trend.""" + + ttfb: Optional[List[Optional[float]]] = None + """Time To First Byte trend.""" + + tti: Optional[List[Optional[float]]] = None + """Time To Interactive trend.""" diff --git a/src/cloudflare/types/ssl/__init__.py b/src/cloudflare/types/ssl/__init__.py index ce56689f3f6..6fce3a9b641 100644 --- a/src/cloudflare/types/ssl/__init__.py +++ b/src/cloudflare/types/ssl/__init__.py @@ -2,15 +2,18 @@ from __future__ import annotations +from .host import Host as Host +from .verification import Verification as Verification from .analyze_create_params import AnalyzeCreateParams as AnalyzeCreateParams from .analyze_create_response import AnalyzeCreateResponse as AnalyzeCreateResponse from .verification_get_params import VerificationGetParams as VerificationGetParams -from .tls_verification_setting import TLSVerificationSetting as TLSVerificationSetting from .verification_edit_params import VerificationEditParams as VerificationEditParams from .verification_get_response import VerificationGetResponse as VerificationGetResponse from .verification_edit_response import VerificationEditResponse as VerificationEditResponse from .recommendation_get_response import RecommendationGetResponse as RecommendationGetResponse +from .certificate_pack_edit_params import CertificatePackEditParams as CertificatePackEditParams from .certificate_pack_list_params import CertificatePackListParams as CertificatePackListParams from .certificate_pack_get_response import CertificatePackGetResponse as CertificatePackGetResponse +from .certificate_pack_delete_params import CertificatePackDeleteParams as CertificatePackDeleteParams from .certificate_pack_edit_response import CertificatePackEditResponse as CertificatePackEditResponse from .certificate_pack_delete_response import CertificatePackDeleteResponse as CertificatePackDeleteResponse diff --git a/src/cloudflare/types/ssl/analyze_create_params.py b/src/cloudflare/types/ssl/analyze_create_params.py index 0e19cf3b6a2..eb06d135711 100644 --- a/src/cloudflare/types/ssl/analyze_create_params.py +++ b/src/cloudflare/types/ssl/analyze_create_params.py @@ -2,7 +2,9 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict + +from ..custom_hostnames.bundle_method import BundleMethod __all__ = ["AnalyzeCreateParams"] @@ -11,7 +13,7 @@ class AnalyzeCreateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - bundle_method: Literal["ubiquitous", "optimal", "force"] + bundle_method: BundleMethod """ A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses diff --git a/src/cloudflare/types/ssl/analyze_create_response.py b/src/cloudflare/types/ssl/analyze_create_response.py index 71192d91d66..7f3bb40cf1f 100644 --- a/src/cloudflare/types/ssl/analyze_create_response.py +++ b/src/cloudflare/types/ssl/analyze_create_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["AnalyzeCreateResponse"] -AnalyzeCreateResponse = Union[str, object] +AnalyzeCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/ssl/certificate_pack_delete_params.py b/src/cloudflare/types/ssl/certificate_pack_delete_params.py new file mode 100644 index 00000000000..ccd358d487f --- /dev/null +++ b/src/cloudflare/types/ssl/certificate_pack_delete_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__ = ["CertificatePackDeleteParams"] + + +class CertificatePackDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/ssl/certificate_pack_edit_params.py b/src/cloudflare/types/ssl/certificate_pack_edit_params.py new file mode 100644 index 00000000000..3ca3b845dda --- /dev/null +++ b/src/cloudflare/types/ssl/certificate_pack_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_extensions import Required, TypedDict + +__all__ = ["CertificatePackEditParams"] + + +class CertificatePackEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/ssl/certificate_pack_edit_response.py b/src/cloudflare/types/ssl/certificate_pack_edit_response.py index fc7c617ae08..2b9475f83c5 100644 --- a/src/cloudflare/types/ssl/certificate_pack_edit_response.py +++ b/src/cloudflare/types/ssl/certificate_pack_edit_response.py @@ -3,6 +3,7 @@ from typing import List, Optional from typing_extensions import Literal +from .host import Host from ..._models import BaseModel __all__ = ["CertificatePackEditResponse"] @@ -25,7 +26,7 @@ class CertificatePackEditResponse(BaseModel): This will add sni.cloudflaressl.com as the Common Name if set true. """ - hosts: Optional[List[str]] = None + hosts: Optional[List[Host]] = None """Comma separated list of valid host names for the certificate packs. Must contain the zone apex, may not contain more than 50 hosts, and may not be diff --git a/src/cloudflare/types/ssl/certificate_pack_get_response.py b/src/cloudflare/types/ssl/certificate_pack_get_response.py index b232e7c2018..3623b6ab5af 100644 --- a/src/cloudflare/types/ssl/certificate_pack_get_response.py +++ b/src/cloudflare/types/ssl/certificate_pack_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["CertificatePackGetResponse"] -CertificatePackGetResponse = Union[str, object] +CertificatePackGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/ssl/certificate_packs/order_create_params.py b/src/cloudflare/types/ssl/certificate_packs/order_create_params.py index 64d25fae31c..103bd5658af 100644 --- a/src/cloudflare/types/ssl/certificate_packs/order_create_params.py +++ b/src/cloudflare/types/ssl/certificate_packs/order_create_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Literal, Required, TypedDict +from ..host import Host + __all__ = ["OrderCreateParams"] @@ -19,7 +21,7 @@ class OrderCreateParams(TypedDict, total=False): [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) """ - hosts: Required[List[str]] + hosts: Required[List[Host]] """Comma separated list of valid host names for the certificate packs. Must contain the zone apex, may not contain more than 50 hosts, and may not be diff --git a/src/cloudflare/types/ssl/certificate_packs/order_create_response.py b/src/cloudflare/types/ssl/certificate_packs/order_create_response.py index c7b71c73ed5..e0c4d08946a 100644 --- a/src/cloudflare/types/ssl/certificate_packs/order_create_response.py +++ b/src/cloudflare/types/ssl/certificate_packs/order_create_response.py @@ -3,6 +3,7 @@ from typing import List, Optional from typing_extensions import Literal +from ..host import Host from ...._models import BaseModel __all__ = ["OrderCreateResponse"] @@ -25,7 +26,7 @@ class OrderCreateResponse(BaseModel): This will add sni.cloudflaressl.com as the Common Name if set true. """ - hosts: Optional[List[str]] = None + hosts: Optional[List[Host]] = None """Comma separated list of valid host names for the certificate packs. Must contain the zone apex, may not contain more than 50 hosts, and may not be diff --git a/src/cloudflare/types/ssl/host.py b/src/cloudflare/types/ssl/host.py new file mode 100644 index 00000000000..f5b05acf1c6 --- /dev/null +++ b/src/cloudflare/types/ssl/host.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["Host"] + +Host = str diff --git a/src/cloudflare/types/ssl/tls_verification_setting.py b/src/cloudflare/types/ssl/tls_verification_setting.py deleted file mode 100644 index 0435f6f6e22..00000000000 --- a/src/cloudflare/types/ssl/tls_verification_setting.py +++ /dev/null @@ -1,47 +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__ = ["TLSVerificationSetting", "VerificationInfo"] - - -class VerificationInfo(BaseModel): - record_name: Optional[Literal["record_name", "http_url", "cname", "txt_name"]] = None - """Name of CNAME record.""" - - record_target: Optional[Literal["record_value", "http_body", "cname_target", "txt_value"]] = None - """Target of CNAME record.""" - - -class TLSVerificationSetting(BaseModel): - certificate_status: Literal[ - "initializing", "authorizing", "active", "expired", "issuing", "timing_out", "pending_deployment" - ] - """Current status of certificate.""" - - brand_check: Optional[bool] = None - """Certificate Authority is manually reviewing the order.""" - - cert_pack_uuid: Optional[str] = None - """Certificate Pack UUID.""" - - signature: Optional[Literal["ECDSAWithSHA256", "SHA1WithRSA", "SHA256WithRSA"]] = None - """Certificate's signature algorithm.""" - - validation_method: Optional[Literal["http", "cname", "txt"]] = None - """Validation method in use for a certificate pack order.""" - - verification_info: Optional[VerificationInfo] = None - """Certificate's required verification information.""" - - verification_status: Optional[bool] = None - """ - Status of the required verification information, omitted if verification status - is unknown. - """ - - verification_type: Optional[Literal["cname", "meta tag"]] = None - """Method of verification.""" diff --git a/src/cloudflare/types/ssl/verification.py b/src/cloudflare/types/ssl/verification.py new file mode 100644 index 00000000000..deae77ca45f --- /dev/null +++ b/src/cloudflare/types/ssl/verification.py @@ -0,0 +1,47 @@ +# 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__ = ["Verification", "VerificationInfo"] + + +class VerificationInfo(BaseModel): + record_name: Optional[Literal["record_name", "http_url", "cname", "txt_name"]] = None + """Name of CNAME record.""" + + record_target: Optional[Literal["record_value", "http_body", "cname_target", "txt_value"]] = None + """Target of CNAME record.""" + + +class Verification(BaseModel): + certificate_status: Literal[ + "initializing", "authorizing", "active", "expired", "issuing", "timing_out", "pending_deployment" + ] + """Current status of certificate.""" + + brand_check: Optional[bool] = None + """Certificate Authority is manually reviewing the order.""" + + cert_pack_uuid: Optional[str] = None + """Certificate Pack UUID.""" + + signature: Optional[Literal["ECDSAWithSHA256", "SHA1WithRSA", "SHA256WithRSA"]] = None + """Certificate's signature algorithm.""" + + validation_method: Optional[Literal["http", "cname", "txt"]] = None + """Validation method in use for a certificate pack order.""" + + verification_info: Optional[VerificationInfo] = None + """Certificate's required verification information.""" + + verification_status: Optional[bool] = None + """ + Status of the required verification information, omitted if verification status + is unknown. + """ + + verification_type: Optional[Literal["cname", "meta tag"]] = None + """Method of verification.""" diff --git a/src/cloudflare/types/ssl/verification_get_response.py b/src/cloudflare/types/ssl/verification_get_response.py index 7d6fe83cab4..d273404bc2f 100644 --- a/src/cloudflare/types/ssl/verification_get_response.py +++ b/src/cloudflare/types/ssl/verification_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .tls_verification_setting import TLSVerificationSetting +from .verification import Verification __all__ = ["VerificationGetResponse"] -VerificationGetResponse = List[TLSVerificationSetting] +VerificationGetResponse = List[Verification] diff --git a/src/cloudflare/types/storage/__init__.py b/src/cloudflare/types/storage/__init__.py index c5b7f500d59..003dd49ba66 100644 --- a/src/cloudflare/types/storage/__init__.py +++ b/src/cloudflare/types/storage/__init__.py @@ -2,7 +2,7 @@ from __future__ import annotations +from .schema import Schema as Schema +from .components import Components as Components from .analytics_list_params import AnalyticsListParams as AnalyticsListParams from .analytics_stored_params import AnalyticsStoredParams as AnalyticsStoredParams -from .workers_kv_schemas_result import WorkersKVSchemasResult as WorkersKVSchemasResult -from .workers_kv_components_schemas_result import WorkersKVComponentsSchemasResult as WorkersKVComponentsSchemasResult diff --git a/src/cloudflare/types/storage/components.py b/src/cloudflare/types/storage/components.py new file mode 100644 index 00000000000..301f41ede27 --- /dev/null +++ b/src/cloudflare/types/storage/components.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["Components", "Data", "Query"] + + +class Data(BaseModel): + metrics: List[object] + """List of metrics returned by the query.""" + + +class Query(BaseModel): + dimensions: Optional[List[str]] = None + """Can be used to break down the data by given attributes.""" + + filters: Optional[str] = None + """Used to filter rows by one or more dimensions. + + Filters can be combined using OR and AND boolean logic. AND takes precedence + over OR in all the expressions. The OR operator is defined using a comma (,) or + OR keyword surrounded by whitespace. The AND operator is defined using a + semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon + is a reserved character in URLs (rfc1738) and needs to be percent-encoded as + %3B. Comparison options are: + + | Operator | Name | URL Encoded | + | -------- | ------------------------ | ----------- | + | == | Equals | %3D%3D | + | != | Does not equals | !%3D | + | > | Greater Than | %3E | + | < | Less Than | %3C | + | >= | Greater than or equal to | %3E%3D | + | <= | Less than or equal to | %3C%3D . | + """ + + limit: Optional[int] = None + """Limit number of returned metrics.""" + + metrics: Optional[List[str]] = None + """One or more metrics to compute.""" + + since: Optional[datetime] = None + """Start of time interval to query, defaults to 6 hours before request received.""" + + sort: Optional[List[object]] = None + """ + Array of dimensions or metrics to sort by, each dimension/metric may be prefixed + by - (descending) or + (ascending). + """ + + until: Optional[datetime] = None + """End of time interval to query, defaults to current time.""" + + +class Components(BaseModel): + data: Optional[List[Data]] = None + + data_lag: float + """Number of seconds between current time and last processed event, i.e. + + how many seconds of data could be missing. + """ + + max: object + """Maximum results for each metric.""" + + min: object + """Minimum results for each metric.""" + + query: Query + """For specifying result metrics.""" + + rows: float + """Total number of rows in the result.""" + + totals: object + """Total results for metrics across all data.""" diff --git a/src/cloudflare/types/storage/schema.py b/src/cloudflare/types/storage/schema.py new file mode 100644 index 00000000000..2e1c5743d29 --- /dev/null +++ b/src/cloudflare/types/storage/schema.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["Schema", "Data", "Query"] + + +class Data(BaseModel): + metrics: List[object] + """List of metrics returned by the query.""" + + +class Query(BaseModel): + dimensions: Optional[List[str]] = None + """Can be used to break down the data by given attributes.""" + + filters: Optional[str] = None + """Used to filter rows by one or more dimensions. + + Filters can be combined using OR and AND boolean logic. AND takes precedence + over OR in all the expressions. The OR operator is defined using a comma (,) or + OR keyword surrounded by whitespace. The AND operator is defined using a + semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon + is a reserved character in URLs (rfc1738) and needs to be percent-encoded as + %3B. Comparison options are: + + | Operator | Name | URL Encoded | + | -------- | ------------------------ | ----------- | + | == | Equals | %3D%3D | + | != | Does not equals | !%3D | + | > | Greater Than | %3E | + | < | Less Than | %3C | + | >= | Greater than or equal to | %3E%3D | + | <= | Less than or equal to | %3C%3D . | + """ + + limit: Optional[int] = None + """Limit number of returned metrics.""" + + metrics: Optional[List[str]] = None + """One or more metrics to compute.""" + + since: Optional[datetime] = None + """Start of time interval to query, defaults to 6 hours before request received.""" + + sort: Optional[List[object]] = None + """ + Array of dimensions or metrics to sort by, each dimension/metric may be prefixed + by - (descending) or + (ascending). + """ + + until: Optional[datetime] = None + """End of time interval to query, defaults to current time.""" + + +class Schema(BaseModel): + data: Optional[List[Data]] = None + + data_lag: float + """Number of seconds between current time and last processed event, i.e. + + how many seconds of data could be missing. + """ + + max: object + """Maximum results for each metric.""" + + min: object + """Minimum results for each metric.""" + + query: Query + """For specifying result metrics.""" + + rows: float + """Total number of rows in the result.""" + + totals: object + """Total results for metrics across all data.""" diff --git a/src/cloudflare/types/storage/workers_kv_components_schemas_result.py b/src/cloudflare/types/storage/workers_kv_components_schemas_result.py deleted file mode 100644 index 8f1f1306ee8..00000000000 --- a/src/cloudflare/types/storage/workers_kv_components_schemas_result.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["WorkersKVComponentsSchemasResult", "Data", "Query"] - - -class Data(BaseModel): - metrics: List[object] - """List of metrics returned by the query.""" - - -class Query(BaseModel): - dimensions: Optional[List[str]] = None - """Can be used to break down the data by given attributes.""" - - filters: Optional[str] = None - """Used to filter rows by one or more dimensions. - - Filters can be combined using OR and AND boolean logic. AND takes precedence - over OR in all the expressions. The OR operator is defined using a comma (,) or - OR keyword surrounded by whitespace. The AND operator is defined using a - semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon - is a reserved character in URLs (rfc1738) and needs to be percent-encoded as - %3B. Comparison options are: - - | Operator | Name | URL Encoded | - | -------- | ------------------------ | ----------- | - | == | Equals | %3D%3D | - | != | Does not equals | !%3D | - | > | Greater Than | %3E | - | < | Less Than | %3C | - | >= | Greater than or equal to | %3E%3D | - | <= | Less than or equal to | %3C%3D . | - """ - - limit: Optional[int] = None - """Limit number of returned metrics.""" - - metrics: Optional[List[str]] = None - """One or more metrics to compute.""" - - since: Optional[datetime] = None - """Start of time interval to query, defaults to 6 hours before request received.""" - - sort: Optional[List[object]] = None - """ - Array of dimensions or metrics to sort by, each dimension/metric may be prefixed - by - (descending) or + (ascending). - """ - - until: Optional[datetime] = None - """End of time interval to query, defaults to current time.""" - - -class WorkersKVComponentsSchemasResult(BaseModel): - data: Optional[List[Data]] = None - - data_lag: float - """Number of seconds between current time and last processed event, i.e. - - how many seconds of data could be missing. - """ - - max: object - """Maximum results for each metric.""" - - min: object - """Minimum results for each metric.""" - - query: Query - """For specifying result metrics.""" - - rows: float - """Total number of rows in the result.""" - - totals: object - """Total results for metrics across all data.""" diff --git a/src/cloudflare/types/storage/workers_kv_schemas_result.py b/src/cloudflare/types/storage/workers_kv_schemas_result.py deleted file mode 100644 index fede9df26ce..00000000000 --- a/src/cloudflare/types/storage/workers_kv_schemas_result.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["WorkersKVSchemasResult", "Data", "Query"] - - -class Data(BaseModel): - metrics: List[object] - """List of metrics returned by the query.""" - - -class Query(BaseModel): - dimensions: Optional[List[str]] = None - """Can be used to break down the data by given attributes.""" - - filters: Optional[str] = None - """Used to filter rows by one or more dimensions. - - Filters can be combined using OR and AND boolean logic. AND takes precedence - over OR in all the expressions. The OR operator is defined using a comma (,) or - OR keyword surrounded by whitespace. The AND operator is defined using a - semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon - is a reserved character in URLs (rfc1738) and needs to be percent-encoded as - %3B. Comparison options are: - - | Operator | Name | URL Encoded | - | -------- | ------------------------ | ----------- | - | == | Equals | %3D%3D | - | != | Does not equals | !%3D | - | > | Greater Than | %3E | - | < | Less Than | %3C | - | >= | Greater than or equal to | %3E%3D | - | <= | Less than or equal to | %3C%3D . | - """ - - limit: Optional[int] = None - """Limit number of returned metrics.""" - - metrics: Optional[List[str]] = None - """One or more metrics to compute.""" - - since: Optional[datetime] = None - """Start of time interval to query, defaults to 6 hours before request received.""" - - sort: Optional[List[object]] = None - """ - Array of dimensions or metrics to sort by, each dimension/metric may be prefixed - by - (descending) or + (ascending). - """ - - until: Optional[datetime] = None - """End of time interval to query, defaults to current time.""" - - -class WorkersKVSchemasResult(BaseModel): - data: Optional[List[Data]] = None - - data_lag: float - """Number of seconds between current time and last processed event, i.e. - - how many seconds of data could be missing. - """ - - max: object - """Maximum results for each metric.""" - - min: object - """Minimum results for each metric.""" - - query: Query - """For specifying result metrics.""" - - rows: float - """Total number of rows in the result.""" - - totals: object - """Total results for metrics across all data.""" diff --git a/src/cloudflare/types/stream/__init__.py b/src/cloudflare/types/stream/__init__.py index c80b853fe3f..f9400109986 100644 --- a/src/cloudflare/types/stream/__init__.py +++ b/src/cloudflare/types/stream/__init__.py @@ -2,40 +2,46 @@ from __future__ import annotations -from .stream_keys import StreamKeys as StreamKeys -from .stream_audio import StreamAudio as StreamAudio -from .stream_captions import StreamCaptions as StreamCaptions -from .stream_clipping import StreamClipping as StreamClipping +from .clip import Clip as Clip +from .keys import Keys as Keys +from .audio import Audio as Audio +from .video import Video as Video +from .caption import Caption as Caption +from .watermark import Watermark as Watermark +from .live_input import LiveInput as LiveInput +from .allowed_origins import AllowedOrigins as AllowedOrigins from .key_get_response import KeyGetResponse as KeyGetResponse -from .stream_live_input import StreamLiveInput as StreamLiveInput -from .stream_watermarks import StreamWatermarks as StreamWatermarks +from .key_create_params import KeyCreateParams as KeyCreateParams +from .key_delete_params import KeyDeleteParams as KeyDeleteParams from .clip_create_params import ClipCreateParams as ClipCreateParams from .copy_create_params import CopyCreateParams as CopyCreateParams from .embed_get_response import EmbedGetResponse as EmbedGetResponse +from .stream_list_params import StreamListParams as StreamListParams from .key_delete_response import KeyDeleteResponse as KeyDeleteResponse from .token_create_params import TokenCreateParams as TokenCreateParams from .caption_get_response import CaptionGetResponse as CaptionGetResponse +from .stream_create_params import StreamCreateParams as StreamCreateParams +from .stream_delete_params import StreamDeleteParams as StreamDeleteParams from .webhook_get_response import WebhookGetResponse as WebhookGetResponse -from .caption_update_params import CaptionUpdateParams as CaptionUpdateParams from .download_get_response import DownloadGetResponse as DownloadGetResponse from .token_create_response import TokenCreateResponse as TokenCreateResponse +from .webhook_delete_params import WebhookDeleteParams as WebhookDeleteParams from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams +from .download_create_params import DownloadCreateParams as DownloadCreateParams from .live_input_list_params import LiveInputListParams as LiveInputListParams -from .watermark_get_response import WatermarkGetResponse as WatermarkGetResponse from .audio_track_copy_params import AudioTrackCopyParams as AudioTrackCopyParams from .audio_track_edit_params import AudioTrackEditParams as AudioTrackEditParams -from .caption_delete_response import CaptionDeleteResponse as CaptionDeleteResponse -from .caption_update_response import CaptionUpdateResponse as CaptionUpdateResponse from .watermark_create_params import WatermarkCreateParams as WatermarkCreateParams +from .watermark_delete_params import WatermarkDeleteParams as WatermarkDeleteParams from .webhook_delete_response import WebhookDeleteResponse as WebhookDeleteResponse from .webhook_update_response import WebhookUpdateResponse as WebhookUpdateResponse from .audio_track_get_response import AudioTrackGetResponse as AudioTrackGetResponse from .download_create_response import DownloadCreateResponse as DownloadCreateResponse from .download_delete_response import DownloadDeleteResponse as DownloadDeleteResponse from .live_input_create_params import LiveInputCreateParams as LiveInputCreateParams +from .live_input_delete_params import LiveInputDeleteParams as LiveInputDeleteParams from .live_input_list_response import LiveInputListResponse as LiveInputListResponse from .live_input_update_params import LiveInputUpdateParams as LiveInputUpdateParams -from .watermark_create_response import WatermarkCreateResponse as WatermarkCreateResponse from .watermark_delete_response import WatermarkDeleteResponse as WatermarkDeleteResponse from .video_storage_usage_params import VideoStorageUsageParams as VideoStorageUsageParams from .audio_track_delete_response import AudioTrackDeleteResponse as AudioTrackDeleteResponse diff --git a/src/cloudflare/types/stream/allowed_origins.py b/src/cloudflare/types/stream/allowed_origins.py new file mode 100644 index 00000000000..d18558e3958 --- /dev/null +++ b/src/cloudflare/types/stream/allowed_origins.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["AllowedOrigins"] + +AllowedOrigins = str diff --git a/src/cloudflare/types/stream/audio.py b/src/cloudflare/types/stream/audio.py new file mode 100644 index 00000000000..d3f241ce3f3 --- /dev/null +++ b/src/cloudflare/types/stream/audio.py @@ -0,0 +1,25 @@ +# 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__ = ["Audio"] + + +class Audio(BaseModel): + default: Optional[bool] = None + """Denotes whether the audio track will be played by default in a player.""" + + label: Optional[str] = None + """ + A string to uniquely identify the track amongst other audio track labels for the + specified video. + """ + + status: Optional[Literal["queued", "ready", "error"]] = None + """Specifies the processing status of the video.""" + + uid: Optional[str] = None + """A Cloudflare-generated unique identifier for a media item.""" diff --git a/src/cloudflare/types/stream/audio_track_get_response.py b/src/cloudflare/types/stream/audio_track_get_response.py index 893a4995463..63d138912a2 100644 --- a/src/cloudflare/types/stream/audio_track_get_response.py +++ b/src/cloudflare/types/stream/audio_track_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .stream_audio import StreamAudio +from .audio import Audio __all__ = ["AudioTrackGetResponse"] -AudioTrackGetResponse = List[StreamAudio] +AudioTrackGetResponse = List[Audio] diff --git a/src/cloudflare/types/stream/caption.py b/src/cloudflare/types/stream/caption.py new file mode 100644 index 00000000000..4fc03b8b2f4 --- /dev/null +++ b/src/cloudflare/types/stream/caption.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__ = ["Caption"] + + +class Caption(BaseModel): + label: Optional[str] = None + """The language label displayed in the native language to users.""" + + language: Optional[str] = None + """The language tag in BCP 47 format.""" diff --git a/src/cloudflare/types/stream/caption_delete_response.py b/src/cloudflare/types/stream/caption_delete_response.py deleted file mode 100644 index 569104a09db..00000000000 --- a/src/cloudflare/types/stream/caption_delete_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union - -__all__ = ["CaptionDeleteResponse"] - -CaptionDeleteResponse = Union[List[object], str, object] diff --git a/src/cloudflare/types/stream/caption_get_response.py b/src/cloudflare/types/stream/caption_get_response.py index 9a78fc893b2..dac0ff81d99 100644 --- a/src/cloudflare/types/stream/caption_get_response.py +++ b/src/cloudflare/types/stream/caption_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .stream_captions import StreamCaptions +from .caption import Caption __all__ = ["CaptionGetResponse"] -CaptionGetResponse = List[StreamCaptions] +CaptionGetResponse = List[Caption] diff --git a/src/cloudflare/types/stream/caption_update_params.py b/src/cloudflare/types/stream/caption_update_params.py deleted file mode 100644 index f75ea53cbd8..00000000000 --- a/src/cloudflare/types/stream/caption_update_params.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 Required, TypedDict - -__all__ = ["CaptionUpdateParams"] - - -class CaptionUpdateParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - identifier: Required[str] - """A Cloudflare-generated unique identifier for a media item.""" - - file: Required[str] - """The WebVTT file containing the caption or subtitle content.""" diff --git a/src/cloudflare/types/stream/caption_update_response.py b/src/cloudflare/types/stream/caption_update_response.py deleted file mode 100644 index e35e3e0b6b6..00000000000 --- a/src/cloudflare/types/stream/caption_update_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["CaptionUpdateResponse"] - -CaptionUpdateResponse = Union[str, object] diff --git a/src/cloudflare/types/stream/captions/__init__.py b/src/cloudflare/types/stream/captions/__init__.py new file mode 100644 index 00000000000..f34bcc36978 --- /dev/null +++ b/src/cloudflare/types/stream/captions/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .language_delete_params import LanguageDeleteParams as LanguageDeleteParams +from .language_update_params import LanguageUpdateParams as LanguageUpdateParams +from .language_delete_response import LanguageDeleteResponse as LanguageDeleteResponse diff --git a/src/cloudflare/types/stream/captions/language/__init__.py b/src/cloudflare/types/stream/captions/language/__init__.py new file mode 100644 index 00000000000..066985970d6 --- /dev/null +++ b/src/cloudflare/types/stream/captions/language/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .vtt_get_response import VttGetResponse as VttGetResponse diff --git a/src/cloudflare/types/stream/captions/language/vtt_get_response.py b/src/cloudflare/types/stream/captions/language/vtt_get_response.py new file mode 100644 index 00000000000..b4f2213435c --- /dev/null +++ b/src/cloudflare/types/stream/captions/language/vtt_get_response.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["VttGetResponse"] + +VttGetResponse = str diff --git a/src/cloudflare/types/stream/captions/language_delete_params.py b/src/cloudflare/types/stream/captions/language_delete_params.py new file mode 100644 index 00000000000..348f01f68e0 --- /dev/null +++ b/src/cloudflare/types/stream/captions/language_delete_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__ = ["LanguageDeleteParams"] + + +class LanguageDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + identifier: Required[str] + """A Cloudflare-generated unique identifier for a media item.""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/captions/language_delete_response.py b/src/cloudflare/types/stream/captions/language_delete_response.py new file mode 100644 index 00000000000..4c79b0573b6 --- /dev/null +++ b/src/cloudflare/types/stream/captions/language_delete_response.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["LanguageDeleteResponse"] + +LanguageDeleteResponse = str diff --git a/src/cloudflare/types/stream/captions/language_update_params.py b/src/cloudflare/types/stream/captions/language_update_params.py new file mode 100644 index 00000000000..66f85180bf2 --- /dev/null +++ b/src/cloudflare/types/stream/captions/language_update_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LanguageUpdateParams"] + + +class LanguageUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + identifier: Required[str] + """A Cloudflare-generated unique identifier for a media item.""" + + file: Required[str] + """The WebVTT file containing the caption or subtitle content.""" diff --git a/src/cloudflare/types/stream/clip.py b/src/cloudflare/types/stream/clip.py new file mode 100644 index 00000000000..9c6197aec52 --- /dev/null +++ b/src/cloudflare/types/stream/clip.py @@ -0,0 +1,91 @@ +# 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 pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .allowed_origins import AllowedOrigins + +__all__ = ["Clip", "Playback", "Watermark"] + + +class Playback(BaseModel): + dash: Optional[str] = None + """DASH Media Presentation Description for the video.""" + + hls: Optional[str] = None + """The HLS manifest for the video.""" + + +class Watermark(BaseModel): + uid: Optional[str] = None + """The unique identifier for the watermark profile.""" + + +class Clip(BaseModel): + allowed_origins: Optional[List[AllowedOrigins]] = FieldInfo(alias="allowedOrigins", default=None) + """Lists the origins allowed to display the video. + + Enter allowed origin domains in an array and use `*` for wildcard subdomains. + Empty arrays allow the video to be viewed on any origin. + """ + + clipped_from_video_uid: Optional[str] = FieldInfo(alias="clippedFromVideoUID", default=None) + """The unique video identifier (UID).""" + + created: Optional[datetime] = None + """The date and time the clip was created.""" + + creator: Optional[str] = None + """A user-defined identifier for the media creator.""" + + end_time_seconds: Optional[int] = FieldInfo(alias="endTimeSeconds", default=None) + """Specifies the end time for the video clip in seconds.""" + + max_duration_seconds: Optional[int] = FieldInfo(alias="maxDurationSeconds", default=None) + """The maximum duration in seconds for a video upload. + + Can be set for a video that is not yet uploaded to limit its duration. Uploads + that exceed the specified duration will fail during processing. A value of `-1` + means the value is unknown. + """ + + meta: Optional[object] = None + """ + A user modifiable key-value store used to reference other systems of record for + managing videos. + """ + + modified: Optional[datetime] = None + """The date and time the live input was last modified.""" + + playback: Optional[Playback] = None + + preview: Optional[str] = None + """The video's preview page URI. This field is omitted until encoding is complete.""" + + require_signed_urls: Optional[bool] = FieldInfo(alias="requireSignedURLs", default=None) + """Indicates whether the video can be a accessed using the UID. + + When set to `true`, a signed token must be generated with a signing key to view + the video. + """ + + start_time_seconds: Optional[int] = FieldInfo(alias="startTimeSeconds", default=None) + """Specifies the start time for the video clip in seconds.""" + + status: Optional[Literal["pendingupload", "downloading", "queued", "inprogress", "ready", "error"]] = None + """Specifies the processing status for all quality levels for a video.""" + + thumbnail_timestamp_pct: Optional[float] = FieldInfo(alias="thumbnailTimestampPct", default=None) + """ + The timestamp for a thumbnail image calculated as a percentage value of the + video's duration. To convert from a second-wise timestamp to a percentage, + divide the desired timestamp by the total duration of the video. If this value + is not set, the default thumbnail image is taken from 0s of the video. + """ + + watermark: Optional[Watermark] = None diff --git a/src/cloudflare/types/stream/clip_create_params.py b/src/cloudflare/types/stream/clip_create_params.py index 8c46a159546..b3a5e5d5526 100644 --- a/src/cloudflare/types/stream/clip_create_params.py +++ b/src/cloudflare/types/stream/clip_create_params.py @@ -6,6 +6,7 @@ from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo +from .allowed_origins import AllowedOrigins __all__ = ["ClipCreateParams", "Watermark"] @@ -23,7 +24,7 @@ class ClipCreateParams(TypedDict, total=False): start_time_seconds: Required[Annotated[int, PropertyInfo(alias="startTimeSeconds")]] """Specifies the start time for the video clip in seconds.""" - allowed_origins: Annotated[List[str], PropertyInfo(alias="allowedOrigins")] + allowed_origins: Annotated[List[AllowedOrigins], PropertyInfo(alias="allowedOrigins")] """Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. diff --git a/src/cloudflare/types/stream/copy_create_params.py b/src/cloudflare/types/stream/copy_create_params.py index 46c6d4afa85..7049042d564 100644 --- a/src/cloudflare/types/stream/copy_create_params.py +++ b/src/cloudflare/types/stream/copy_create_params.py @@ -7,6 +7,7 @@ from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo +from .allowed_origins import AllowedOrigins __all__ = ["CopyCreateParams", "Watermark"] @@ -23,7 +24,7 @@ class CopyCreateParams(TypedDict, total=False): with a `content-range` header that includes the size of the file. """ - allowed_origins: Annotated[List[str], PropertyInfo(alias="allowedOrigins")] + allowed_origins: Annotated[List[AllowedOrigins], PropertyInfo(alias="allowedOrigins")] """Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. diff --git a/src/cloudflare/types/stream/direct_upload_create_params.py b/src/cloudflare/types/stream/direct_upload_create_params.py index e853d136d6f..6689ff92e37 100644 --- a/src/cloudflare/types/stream/direct_upload_create_params.py +++ b/src/cloudflare/types/stream/direct_upload_create_params.py @@ -7,6 +7,7 @@ from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo +from .allowed_origins import AllowedOrigins __all__ = ["DirectUploadCreateParams", "Watermark"] @@ -23,7 +24,7 @@ class DirectUploadCreateParams(TypedDict, total=False): means the value is unknown. """ - allowed_origins: Annotated[List[str], PropertyInfo(alias="allowedOrigins")] + allowed_origins: Annotated[List[AllowedOrigins], PropertyInfo(alias="allowedOrigins")] """Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. diff --git a/src/cloudflare/types/stream/direct_upload_create_response.py b/src/cloudflare/types/stream/direct_upload_create_response.py index c43a4ae00c3..241adb04ca6 100644 --- a/src/cloudflare/types/stream/direct_upload_create_response.py +++ b/src/cloudflare/types/stream/direct_upload_create_response.py @@ -6,7 +6,7 @@ from pydantic import Field as FieldInfo from ..._models import BaseModel -from .stream_watermarks import StreamWatermarks +from .watermark import Watermark __all__ = ["DirectUploadCreateResponse"] @@ -29,4 +29,4 @@ class DirectUploadCreateResponse(BaseModel): `HTTP POST multipart/form-data` request. """ - watermark: Optional[StreamWatermarks] = None + watermark: Optional[Watermark] = None diff --git a/src/cloudflare/types/stream/download_create_params.py b/src/cloudflare/types/stream/download_create_params.py new file mode 100644 index 00000000000..ba0fb74b32c --- /dev/null +++ b/src/cloudflare/types/stream/download_create_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__ = ["DownloadCreateParams"] + + +class DownloadCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/download_create_response.py b/src/cloudflare/types/stream/download_create_response.py index 3b49a17fbbf..814ff089c4a 100644 --- a/src/cloudflare/types/stream/download_create_response.py +++ b/src/cloudflare/types/stream/download_create_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["DownloadCreateResponse"] -DownloadCreateResponse = Union[str, object] +DownloadCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/stream/download_get_response.py b/src/cloudflare/types/stream/download_get_response.py index 86c81865af3..59e574ca9de 100644 --- a/src/cloudflare/types/stream/download_get_response.py +++ b/src/cloudflare/types/stream/download_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["DownloadGetResponse"] -DownloadGetResponse = Union[str, object] +DownloadGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/stream/key_create_params.py b/src/cloudflare/types/stream/key_create_params.py new file mode 100644 index 00000000000..3f1891d27e3 --- /dev/null +++ b/src/cloudflare/types/stream/key_create_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__ = ["KeyCreateParams"] + + +class KeyCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/key_delete_params.py b/src/cloudflare/types/stream/key_delete_params.py new file mode 100644 index 00000000000..d4e21761a90 --- /dev/null +++ b/src/cloudflare/types/stream/key_delete_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__ = ["KeyDeleteParams"] + + +class KeyDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/keys.py b/src/cloudflare/types/stream/keys.py new file mode 100644 index 00000000000..f638edbc213 --- /dev/null +++ b/src/cloudflare/types/stream/keys.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__ = ["Keys"] + + +class Keys(BaseModel): + id: Optional[str] = None + """Identifier""" + + created: Optional[datetime] = None + """The date and time a signing key was created.""" + + jwk: Optional[str] = None + """The signing key in JWK format.""" + + pem: Optional[str] = None + """The signing key in PEM format.""" diff --git a/src/cloudflare/types/stream/live_input.py b/src/cloudflare/types/stream/live_input.py new file mode 100644 index 00000000000..9d9834cec1a --- /dev/null +++ b/src/cloudflare/types/stream/live_input.py @@ -0,0 +1,156 @@ +# 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 pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LiveInput", "Recording", "Rtmps", "RtmpsPlayback", "Srt", "SrtPlayback", "WebRtc", "WebRtcPlayback"] + + +class Recording(BaseModel): + allowed_origins: Optional[List[str]] = FieldInfo(alias="allowedOrigins", default=None) + """Lists the origins allowed to display videos created with this input. + + Enter allowed origin domains in an array and use `*` for wildcard subdomains. An + empty array allows videos to be viewed on any origin. + """ + + mode: Optional[Literal["off", "automatic"]] = None + """Specifies the recording behavior for the live input. + + Set this value to `off` to prevent a recording. Set the value to `automatic` to + begin a recording and transition to on-demand after Stream Live stops receiving + input. + """ + + require_signed_urls: Optional[bool] = FieldInfo(alias="requireSignedURLs", default=None) + """ + Indicates if a video using the live input has the `requireSignedURLs` property + set. Also enforces access controls on any video recording of the livestream with + the live input. + """ + + timeout_seconds: Optional[int] = FieldInfo(alias="timeoutSeconds", default=None) + """ + Determines the amount of time a live input configured in `automatic` mode should + wait before a recording transitions from live to on-demand. `0` is recommended + for most use cases and indicates the platform default should be used. + """ + + +class Rtmps(BaseModel): + stream_key: Optional[str] = FieldInfo(alias="streamKey", default=None) + """The secret key to use when streaming via RTMPS to a live input.""" + + url: Optional[str] = None + """The RTMPS URL you provide to the broadcaster, which they stream live video to.""" + + +class RtmpsPlayback(BaseModel): + stream_key: Optional[str] = FieldInfo(alias="streamKey", default=None) + """The secret key to use for playback via RTMPS.""" + + url: Optional[str] = None + """The URL used to play live video over RTMPS.""" + + +class Srt(BaseModel): + passphrase: Optional[str] = None + """The secret key to use when streaming via SRT to a live input.""" + + stream_id: Optional[str] = FieldInfo(alias="streamId", default=None) + """The identifier of the live input to use when streaming via SRT.""" + + url: Optional[str] = None + """The SRT URL you provide to the broadcaster, which they stream live video to.""" + + +class SrtPlayback(BaseModel): + passphrase: Optional[str] = None + """The secret key to use for playback via SRT.""" + + stream_id: Optional[str] = FieldInfo(alias="streamId", default=None) + """The identifier of the live input to use for playback via SRT.""" + + url: Optional[str] = None + """The URL used to play live video over SRT.""" + + +class WebRtc(BaseModel): + url: Optional[str] = None + """The WebRTC URL you provide to the broadcaster, which they stream live video to.""" + + +class WebRtcPlayback(BaseModel): + url: Optional[str] = None + """The URL used to play live video over WebRTC.""" + + +class LiveInput(BaseModel): + created: Optional[datetime] = None + """The date and time the live input was created.""" + + delete_recording_after_days: Optional[float] = FieldInfo(alias="deleteRecordingAfterDays", default=None) + """ + Indicates the number of days after which the live inputs recordings will be + deleted. When a stream completes and the recording is ready, the value is used + to calculate a scheduled deletion date for that recording. Omit the field to + indicate no change, or include with a `null` value to remove an existing + scheduled deletion. + """ + + meta: Optional[object] = None + """ + A user modifiable key-value store used to reference other systems of record for + managing live inputs. + """ + + modified: Optional[datetime] = None + """The date and time the live input was last modified.""" + + recording: Optional[Recording] = None + """Records the input to a Cloudflare Stream video. + + Behavior depends on the mode. In most cases, the video will initially be + viewable as a live video and transition to on-demand after a condition is + satisfied. + """ + + rtmps: Optional[Rtmps] = None + """Details for streaming to an live input using RTMPS.""" + + rtmps_playback: Optional[RtmpsPlayback] = FieldInfo(alias="rtmpsPlayback", default=None) + """Details for playback from an live input using RTMPS.""" + + srt: Optional[Srt] = None + """Details for streaming to a live input using SRT.""" + + srt_playback: Optional[SrtPlayback] = FieldInfo(alias="srtPlayback", default=None) + """Details for playback from an live input using SRT.""" + + status: Optional[ + Literal[ + "connected", + "reconnected", + "reconnecting", + "client_disconnect", + "ttl_exceeded", + "failed_to_connect", + "failed_to_reconnect", + "new_configuration_accepted", + ] + ] = None + """The connection status of a live input.""" + + uid: Optional[str] = None + """A unique identifier for a live input.""" + + web_rtc: Optional[WebRtc] = FieldInfo(alias="webRTC", default=None) + """Details for streaming to a live input using WebRTC.""" + + web_rtc_playback: Optional[WebRtcPlayback] = FieldInfo(alias="webRTCPlayback", default=None) + """Details for playback from a live input using WebRTC.""" diff --git a/src/cloudflare/types/stream/live_input_delete_params.py b/src/cloudflare/types/stream/live_input_delete_params.py new file mode 100644 index 00000000000..7677bd9f9ed --- /dev/null +++ b/src/cloudflare/types/stream/live_input_delete_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__ = ["LiveInputDeleteParams"] + + +class LiveInputDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/live_inputs/__init__.py b/src/cloudflare/types/stream/live_inputs/__init__.py index be1652c3338..e8063b8b859 100644 --- a/src/cloudflare/types/stream/live_inputs/__init__.py +++ b/src/cloudflare/types/stream/live_inputs/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations -from .stream_output import StreamOutput as StreamOutput +from .output import Output as Output from .output_create_params import OutputCreateParams as OutputCreateParams +from .output_delete_params import OutputDeleteParams as OutputDeleteParams from .output_update_params import OutputUpdateParams as OutputUpdateParams diff --git a/src/cloudflare/types/stream/live_inputs/output.py b/src/cloudflare/types/stream/live_inputs/output.py new file mode 100644 index 00000000000..bc47dd26d9d --- /dev/null +++ b/src/cloudflare/types/stream/live_inputs/output.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["Output"] + + +class Output(BaseModel): + enabled: Optional[bool] = None + """ + When enabled, live video streamed to the associated live input will be sent to + the output URL. When disabled, live video will not be sent to the output URL, + even when streaming to the associated live input. Use this to control precisely + when you start and stop simulcasting to specific destinations like YouTube and + Twitch. + """ + + stream_key: Optional[str] = FieldInfo(alias="streamKey", default=None) + """The streamKey used to authenticate against an output's target.""" + + uid: Optional[str] = None + """A unique identifier for the output.""" + + url: Optional[str] = None + """The URL an output uses to restream.""" diff --git a/src/cloudflare/types/stream/live_inputs/output_delete_params.py b/src/cloudflare/types/stream/live_inputs/output_delete_params.py new file mode 100644 index 00000000000..83c119db571 --- /dev/null +++ b/src/cloudflare/types/stream/live_inputs/output_delete_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__ = ["OutputDeleteParams"] + + +class OutputDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + live_input_identifier: Required[str] + """A unique identifier for a live input.""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/live_inputs/stream_output.py b/src/cloudflare/types/stream/live_inputs/stream_output.py deleted file mode 100644 index eb78f4fe309..00000000000 --- a/src/cloudflare/types/stream/live_inputs/stream_output.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["StreamOutput"] - - -class StreamOutput(BaseModel): - enabled: Optional[bool] = None - """ - When enabled, live video streamed to the associated live input will be sent to - the output URL. When disabled, live video will not be sent to the output URL, - even when streaming to the associated live input. Use this to control precisely - when you start and stop simulcasting to specific destinations like YouTube and - Twitch. - """ - - stream_key: Optional[str] = FieldInfo(alias="streamKey", default=None) - """The streamKey used to authenticate against an output's target.""" - - uid: Optional[str] = None - """A unique identifier for the output.""" - - url: Optional[str] = None - """The URL an output uses to restream.""" diff --git a/src/cloudflare/types/stream/stream_audio.py b/src/cloudflare/types/stream/stream_audio.py deleted file mode 100644 index 2b90d9a8d8e..00000000000 --- a/src/cloudflare/types/stream/stream_audio.py +++ /dev/null @@ -1,25 +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__ = ["StreamAudio"] - - -class StreamAudio(BaseModel): - default: Optional[bool] = None - """Denotes whether the audio track will be played by default in a player.""" - - label: Optional[str] = None - """ - A string to uniquely identify the track amongst other audio track labels for the - specified video. - """ - - status: Optional[Literal["queued", "ready", "error"]] = None - """Specifies the processing status of the video.""" - - uid: Optional[str] = None - """A Cloudflare-generated unique identifier for a media item.""" diff --git a/src/cloudflare/types/stream/stream_captions.py b/src/cloudflare/types/stream/stream_captions.py deleted file mode 100644 index 4239fffd3a2..00000000000 --- a/src/cloudflare/types/stream/stream_captions.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__ = ["StreamCaptions"] - - -class StreamCaptions(BaseModel): - label: Optional[str] = None - """The language label displayed in the native language to users.""" - - language: Optional[str] = None - """The language tag in BCP 47 format.""" diff --git a/src/cloudflare/types/stream/stream_clipping.py b/src/cloudflare/types/stream/stream_clipping.py deleted file mode 100644 index 99af9383d1d..00000000000 --- a/src/cloudflare/types/stream/stream_clipping.py +++ /dev/null @@ -1,90 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["StreamClipping", "Playback", "Watermark"] - - -class Playback(BaseModel): - dash: Optional[str] = None - """DASH Media Presentation Description for the video.""" - - hls: Optional[str] = None - """The HLS manifest for the video.""" - - -class Watermark(BaseModel): - uid: Optional[str] = None - """The unique identifier for the watermark profile.""" - - -class StreamClipping(BaseModel): - allowed_origins: Optional[List[str]] = FieldInfo(alias="allowedOrigins", default=None) - """Lists the origins allowed to display the video. - - Enter allowed origin domains in an array and use `*` for wildcard subdomains. - Empty arrays allow the video to be viewed on any origin. - """ - - clipped_from_video_uid: Optional[str] = FieldInfo(alias="clippedFromVideoUID", default=None) - """The unique video identifier (UID).""" - - created: Optional[datetime] = None - """The date and time the clip was created.""" - - creator: Optional[str] = None - """A user-defined identifier for the media creator.""" - - end_time_seconds: Optional[int] = FieldInfo(alias="endTimeSeconds", default=None) - """Specifies the end time for the video clip in seconds.""" - - max_duration_seconds: Optional[int] = FieldInfo(alias="maxDurationSeconds", default=None) - """The maximum duration in seconds for a video upload. - - Can be set for a video that is not yet uploaded to limit its duration. Uploads - that exceed the specified duration will fail during processing. A value of `-1` - means the value is unknown. - """ - - meta: Optional[object] = None - """ - A user modifiable key-value store used to reference other systems of record for - managing videos. - """ - - modified: Optional[datetime] = None - """The date and time the live input was last modified.""" - - playback: Optional[Playback] = None - - preview: Optional[str] = None - """The video's preview page URI. This field is omitted until encoding is complete.""" - - require_signed_urls: Optional[bool] = FieldInfo(alias="requireSignedURLs", default=None) - """Indicates whether the video can be a accessed using the UID. - - When set to `true`, a signed token must be generated with a signing key to view - the video. - """ - - start_time_seconds: Optional[int] = FieldInfo(alias="startTimeSeconds", default=None) - """Specifies the start time for the video clip in seconds.""" - - status: Optional[Literal["pendingupload", "downloading", "queued", "inprogress", "ready", "error"]] = None - """Specifies the processing status for all quality levels for a video.""" - - thumbnail_timestamp_pct: Optional[float] = FieldInfo(alias="thumbnailTimestampPct", default=None) - """ - The timestamp for a thumbnail image calculated as a percentage value of the - video's duration. To convert from a second-wise timestamp to a percentage, - divide the desired timestamp by the total duration of the video. If this value - is not set, the default thumbnail image is taken from 0s of the video. - """ - - watermark: Optional[Watermark] = None diff --git a/src/cloudflare/types/stream/stream_create_params.py b/src/cloudflare/types/stream/stream_create_params.py new file mode 100644 index 00000000000..438ac398bc7 --- /dev/null +++ b/src/cloudflare/types/stream/stream_create_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__ = ["StreamCreateParams"] + + +class StreamCreateParams(TypedDict, total=False): + account_id: Required[str] + """The account identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/stream_delete_params.py b/src/cloudflare/types/stream/stream_delete_params.py new file mode 100644 index 00000000000..dd5ef8cbb5d --- /dev/null +++ b/src/cloudflare/types/stream/stream_delete_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__ = ["StreamDeleteParams"] + + +class StreamDeleteParams(TypedDict, total=False): + account_id: Required[str] + """The account identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/stream_keys.py b/src/cloudflare/types/stream/stream_keys.py deleted file mode 100644 index 28d692daf6b..00000000000 --- a/src/cloudflare/types/stream/stream_keys.py +++ /dev/null @@ -1,22 +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__ = ["StreamKeys"] - - -class StreamKeys(BaseModel): - id: Optional[str] = None - """Identifier""" - - created: Optional[datetime] = None - """The date and time a signing key was created.""" - - jwk: Optional[str] = None - """The signing key in JWK format.""" - - pem: Optional[str] = None - """The signing key in PEM format.""" diff --git a/src/cloudflare/types/stream_list_params.py b/src/cloudflare/types/stream/stream_list_params.py similarity index 97% rename from src/cloudflare/types/stream_list_params.py rename to src/cloudflare/types/stream/stream_list_params.py index f41f20ba174..5d9ed520774 100644 --- a/src/cloudflare/types/stream_list_params.py +++ b/src/cloudflare/types/stream/stream_list_params.py @@ -6,7 +6,7 @@ from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypedDict -from .._utils import PropertyInfo +from ..._utils import PropertyInfo __all__ = ["StreamListParams"] diff --git a/src/cloudflare/types/stream/stream_live_input.py b/src/cloudflare/types/stream/stream_live_input.py deleted file mode 100644 index fe07b2e299c..00000000000 --- a/src/cloudflare/types/stream/stream_live_input.py +++ /dev/null @@ -1,156 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["StreamLiveInput", "Recording", "Rtmps", "RtmpsPlayback", "Srt", "SrtPlayback", "WebRtc", "WebRtcPlayback"] - - -class Recording(BaseModel): - allowed_origins: Optional[List[str]] = FieldInfo(alias="allowedOrigins", default=None) - """Lists the origins allowed to display videos created with this input. - - Enter allowed origin domains in an array and use `*` for wildcard subdomains. An - empty array allows videos to be viewed on any origin. - """ - - mode: Optional[Literal["off", "automatic"]] = None - """Specifies the recording behavior for the live input. - - Set this value to `off` to prevent a recording. Set the value to `automatic` to - begin a recording and transition to on-demand after Stream Live stops receiving - input. - """ - - require_signed_urls: Optional[bool] = FieldInfo(alias="requireSignedURLs", default=None) - """ - Indicates if a video using the live input has the `requireSignedURLs` property - set. Also enforces access controls on any video recording of the livestream with - the live input. - """ - - timeout_seconds: Optional[int] = FieldInfo(alias="timeoutSeconds", default=None) - """ - Determines the amount of time a live input configured in `automatic` mode should - wait before a recording transitions from live to on-demand. `0` is recommended - for most use cases and indicates the platform default should be used. - """ - - -class Rtmps(BaseModel): - stream_key: Optional[str] = FieldInfo(alias="streamKey", default=None) - """The secret key to use when streaming via RTMPS to a live input.""" - - url: Optional[str] = None - """The RTMPS URL you provide to the broadcaster, which they stream live video to.""" - - -class RtmpsPlayback(BaseModel): - stream_key: Optional[str] = FieldInfo(alias="streamKey", default=None) - """The secret key to use for playback via RTMPS.""" - - url: Optional[str] = None - """The URL used to play live video over RTMPS.""" - - -class Srt(BaseModel): - passphrase: Optional[str] = None - """The secret key to use when streaming via SRT to a live input.""" - - stream_id: Optional[str] = FieldInfo(alias="streamId", default=None) - """The identifier of the live input to use when streaming via SRT.""" - - url: Optional[str] = None - """The SRT URL you provide to the broadcaster, which they stream live video to.""" - - -class SrtPlayback(BaseModel): - passphrase: Optional[str] = None - """The secret key to use for playback via SRT.""" - - stream_id: Optional[str] = FieldInfo(alias="streamId", default=None) - """The identifier of the live input to use for playback via SRT.""" - - url: Optional[str] = None - """The URL used to play live video over SRT.""" - - -class WebRtc(BaseModel): - url: Optional[str] = None - """The WebRTC URL you provide to the broadcaster, which they stream live video to.""" - - -class WebRtcPlayback(BaseModel): - url: Optional[str] = None - """The URL used to play live video over WebRTC.""" - - -class StreamLiveInput(BaseModel): - created: Optional[datetime] = None - """The date and time the live input was created.""" - - delete_recording_after_days: Optional[float] = FieldInfo(alias="deleteRecordingAfterDays", default=None) - """ - Indicates the number of days after which the live inputs recordings will be - deleted. When a stream completes and the recording is ready, the value is used - to calculate a scheduled deletion date for that recording. Omit the field to - indicate no change, or include with a `null` value to remove an existing - scheduled deletion. - """ - - meta: Optional[object] = None - """ - A user modifiable key-value store used to reference other systems of record for - managing live inputs. - """ - - modified: Optional[datetime] = None - """The date and time the live input was last modified.""" - - recording: Optional[Recording] = None - """Records the input to a Cloudflare Stream video. - - Behavior depends on the mode. In most cases, the video will initially be - viewable as a live video and transition to on-demand after a condition is - satisfied. - """ - - rtmps: Optional[Rtmps] = None - """Details for streaming to an live input using RTMPS.""" - - rtmps_playback: Optional[RtmpsPlayback] = FieldInfo(alias="rtmpsPlayback", default=None) - """Details for playback from an live input using RTMPS.""" - - srt: Optional[Srt] = None - """Details for streaming to a live input using SRT.""" - - srt_playback: Optional[SrtPlayback] = FieldInfo(alias="srtPlayback", default=None) - """Details for playback from an live input using SRT.""" - - status: Optional[ - Literal[ - "connected", - "reconnected", - "reconnecting", - "client_disconnect", - "ttl_exceeded", - "failed_to_connect", - "failed_to_reconnect", - "new_configuration_accepted", - ] - ] = None - """The connection status of a live input.""" - - uid: Optional[str] = None - """A unique identifier for a live input.""" - - web_rtc: Optional[WebRtc] = FieldInfo(alias="webRTC", default=None) - """Details for streaming to a live input using WebRTC.""" - - web_rtc_playback: Optional[WebRtcPlayback] = FieldInfo(alias="webRTCPlayback", default=None) - """Details for playback from a live input using WebRTC.""" diff --git a/src/cloudflare/types/stream/stream_watermarks.py b/src/cloudflare/types/stream/stream_watermarks.py deleted file mode 100644 index c90c31654e5..00000000000 --- a/src/cloudflare/types/stream/stream_watermarks.py +++ /dev/null @@ -1,66 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["StreamWatermarks"] - - -class StreamWatermarks(BaseModel): - created: Optional[datetime] = None - """The date and a time a watermark profile was created.""" - - downloaded_from: Optional[str] = FieldInfo(alias="downloadedFrom", default=None) - """The source URL for a downloaded image. - - If the watermark profile was created via direct upload, this field is null. - """ - - height: Optional[int] = None - """The height of the image in pixels.""" - - name: Optional[str] = None - """A short description of the watermark profile.""" - - opacity: Optional[float] = None - """The translucency of the image. - - A value of `0.0` makes the image completely transparent, and `1.0` makes the - image completely opaque. Note that if the image is already semi-transparent, - setting this to `1.0` will not make the image completely opaque. - """ - - padding: Optional[float] = None - """ - The whitespace between the adjacent edges (determined by position) of the video - and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded - video width or length, as determined by the algorithm. - """ - - position: Optional[str] = None - """The location of the image. - - Valid positions are: `upperRight`, `upperLeft`, `lowerLeft`, `lowerRight`, and - `center`. Note that `center` ignores the `padding` parameter. - """ - - scale: Optional[float] = None - """The size of the image relative to the overall size of the video. - - This parameter will adapt to horizontal and vertical videos automatically. `0.0` - indicates no scaling (use the size of the image as-is), and `1.0 `fills the - entire video. - """ - - size: Optional[float] = None - """The size of the image in bytes.""" - - uid: Optional[str] = None - """The unique identifier for a watermark profile.""" - - width: Optional[int] = None - """The width of the image in pixels.""" diff --git a/src/cloudflare/types/stream/video.py b/src/cloudflare/types/stream/video.py new file mode 100644 index 00000000000..d53fad7387f --- /dev/null +++ b/src/cloudflare/types/stream/video.py @@ -0,0 +1,180 @@ +# 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 pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .watermark import Watermark +from .allowed_origins import AllowedOrigins + +__all__ = ["Video", "Input", "Playback", "Status"] + + +class Input(BaseModel): + height: Optional[int] = None + """The video height in pixels. + + A value of `-1` means the height is unknown. The value becomes available after + the upload and before the video is ready. + """ + + width: Optional[int] = None + """The video width in pixels. + + A value of `-1` means the width is unknown. The value becomes available after + the upload and before the video is ready. + """ + + +class Playback(BaseModel): + dash: Optional[str] = None + """DASH Media Presentation Description for the video.""" + + hls: Optional[str] = None + """The HLS manifest for the video.""" + + +class Status(BaseModel): + error_reason_code: Optional[str] = FieldInfo(alias="errorReasonCode", default=None) + """Specifies why the video failed to encode. + + This field is empty if the video is not in an `error` state. Preferred for + programmatic use. + """ + + error_reason_text: Optional[str] = FieldInfo(alias="errorReasonText", default=None) + """ + Specifies why the video failed to encode using a human readable error message in + English. This field is empty if the video is not in an `error` state. + """ + + pct_complete: Optional[str] = FieldInfo(alias="pctComplete", default=None) + """Indicates the size of the entire upload in bytes. + + The value must be a non-negative integer. + """ + + state: Optional[Literal["pendingupload", "downloading", "queued", "inprogress", "ready", "error"]] = None + """Specifies the processing status for all quality levels for a video.""" + + +class Video(BaseModel): + allowed_origins: Optional[List[AllowedOrigins]] = FieldInfo(alias="allowedOrigins", default=None) + """Lists the origins allowed to display the video. + + Enter allowed origin domains in an array and use `*` for wildcard subdomains. + Empty arrays allow the video to be viewed on any origin. + """ + + created: Optional[datetime] = None + """The date and time the media item was created.""" + + creator: Optional[str] = None + """A user-defined identifier for the media creator.""" + + duration: Optional[float] = None + """The duration of the video in seconds. + + A value of `-1` means the duration is unknown. The duration becomes available + after the upload and before the video is ready. + """ + + input: Optional[Input] = None + + live_input: Optional[str] = FieldInfo(alias="liveInput", default=None) + """The live input ID used to upload a video with Stream Live.""" + + max_duration_seconds: Optional[int] = FieldInfo(alias="maxDurationSeconds", default=None) + """The maximum duration in seconds for a video upload. + + Can be set for a video that is not yet uploaded to limit its duration. Uploads + that exceed the specified duration will fail during processing. A value of `-1` + means the value is unknown. + """ + + meta: Optional[object] = None + """ + A user modifiable key-value store used to reference other systems of record for + managing videos. + """ + + modified: Optional[datetime] = None + """The date and time the media item was last modified.""" + + playback: Optional[Playback] = None + + preview: Optional[str] = None + """The video's preview page URI. This field is omitted until encoding is complete.""" + + ready_to_stream: Optional[bool] = FieldInfo(alias="readyToStream", default=None) + """Indicates whether the video is playable. + + The field is empty if the video is not ready for viewing or the live stream is + still in progress. + """ + + ready_to_stream_at: Optional[datetime] = FieldInfo(alias="readyToStreamAt", default=None) + """Indicates the time at which the video became playable. + + The field is empty if the video is not ready for viewing or the live stream is + still in progress. + """ + + require_signed_urls: Optional[bool] = FieldInfo(alias="requireSignedURLs", default=None) + """Indicates whether the video can be a accessed using the UID. + + When set to `true`, a signed token must be generated with a signing key to view + the video. + """ + + scheduled_deletion: Optional[datetime] = FieldInfo(alias="scheduledDeletion", default=None) + """Indicates the date and time at which the video will be deleted. + + Omit the field to indicate no change, or include with a `null` value to remove + an existing scheduled deletion. If specified, must be at least 30 days from + upload time. + """ + + size: Optional[float] = None + """The size of the media item in bytes.""" + + status: Optional[Status] = None + """Specifies a detailed status for a video. + + If the `state` is `inprogress` or `error`, the `step` field returns `encoding` + or `manifest`. If the `state` is `inprogress`, `pctComplete` returns a number + between 0 and 100 to indicate the approximate percent of completion. If the + `state` is `error`, `errorReasonCode` and `errorReasonText` provide additional + details. + """ + + thumbnail: Optional[str] = None + """The media item's thumbnail URI. + + This field is omitted until encoding is complete. + """ + + thumbnail_timestamp_pct: Optional[float] = FieldInfo(alias="thumbnailTimestampPct", default=None) + """ + The timestamp for a thumbnail image calculated as a percentage value of the + video's duration. To convert from a second-wise timestamp to a percentage, + divide the desired timestamp by the total duration of the video. If this value + is not set, the default thumbnail image is taken from 0s of the video. + """ + + uid: Optional[str] = None + """A Cloudflare-generated unique identifier for a media item.""" + + uploaded: Optional[datetime] = None + """The date and time the media item was uploaded.""" + + upload_expiry: Optional[datetime] = FieldInfo(alias="uploadExpiry", default=None) + """ + The date and time when the video upload URL is no longer valid for direct user + uploads. + """ + + watermark: Optional[Watermark] = None diff --git a/src/cloudflare/types/stream/watermark.py b/src/cloudflare/types/stream/watermark.py new file mode 100644 index 00000000000..e36de655af1 --- /dev/null +++ b/src/cloudflare/types/stream/watermark.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["Watermark"] + + +class Watermark(BaseModel): + created: Optional[datetime] = None + """The date and a time a watermark profile was created.""" + + downloaded_from: Optional[str] = FieldInfo(alias="downloadedFrom", default=None) + """The source URL for a downloaded image. + + If the watermark profile was created via direct upload, this field is null. + """ + + height: Optional[int] = None + """The height of the image in pixels.""" + + name: Optional[str] = None + """A short description of the watermark profile.""" + + opacity: Optional[float] = None + """The translucency of the image. + + A value of `0.0` makes the image completely transparent, and `1.0` makes the + image completely opaque. Note that if the image is already semi-transparent, + setting this to `1.0` will not make the image completely opaque. + """ + + padding: Optional[float] = None + """ + The whitespace between the adjacent edges (determined by position) of the video + and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded + video width or length, as determined by the algorithm. + """ + + position: Optional[str] = None + """The location of the image. + + Valid positions are: `upperRight`, `upperLeft`, `lowerLeft`, `lowerRight`, and + `center`. Note that `center` ignores the `padding` parameter. + """ + + scale: Optional[float] = None + """The size of the image relative to the overall size of the video. + + This parameter will adapt to horizontal and vertical videos automatically. `0.0` + indicates no scaling (use the size of the image as-is), and `1.0 `fills the + entire video. + """ + + size: Optional[float] = None + """The size of the image in bytes.""" + + uid: Optional[str] = None + """The unique identifier for a watermark profile.""" + + width: Optional[int] = None + """The width of the image in pixels.""" diff --git a/src/cloudflare/types/stream/watermark_create_response.py b/src/cloudflare/types/stream/watermark_create_response.py deleted file mode 100644 index aa2d892dc74..00000000000 --- a/src/cloudflare/types/stream/watermark_create_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["WatermarkCreateResponse"] - -WatermarkCreateResponse = Union[str, object] diff --git a/src/cloudflare/types/stream/watermark_delete_params.py b/src/cloudflare/types/stream/watermark_delete_params.py new file mode 100644 index 00000000000..5fc8a672ea1 --- /dev/null +++ b/src/cloudflare/types/stream/watermark_delete_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__ = ["WatermarkDeleteParams"] + + +class WatermarkDeleteParams(TypedDict, total=False): + account_id: Required[str] + """The account identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/watermark_get_response.py b/src/cloudflare/types/stream/watermark_get_response.py deleted file mode 100644 index 10fb745c0a1..00000000000 --- a/src/cloudflare/types/stream/watermark_get_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["WatermarkGetResponse"] - -WatermarkGetResponse = Union[str, object] diff --git a/src/cloudflare/types/stream/webhook_delete_params.py b/src/cloudflare/types/stream/webhook_delete_params.py new file mode 100644 index 00000000000..63b392c9146 --- /dev/null +++ b/src/cloudflare/types/stream/webhook_delete_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__ = ["WebhookDeleteParams"] + + +class WebhookDeleteParams(TypedDict, total=False): + account_id: Required[str] + """The account identifier tag.""" + + body: Required[object] diff --git a/src/cloudflare/types/stream/webhook_get_response.py b/src/cloudflare/types/stream/webhook_get_response.py index 9335fac3543..bc96795077e 100644 --- a/src/cloudflare/types/stream/webhook_get_response.py +++ b/src/cloudflare/types/stream/webhook_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["WebhookGetResponse"] -WebhookGetResponse = Union[str, object] +WebhookGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/stream/webhook_update_response.py b/src/cloudflare/types/stream/webhook_update_response.py index 64e235c1a9a..d313dbcbd1e 100644 --- a/src/cloudflare/types/stream/webhook_update_response.py +++ b/src/cloudflare/types/stream/webhook_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["WebhookUpdateResponse"] -WebhookUpdateResponse = Union[str, object] +WebhookUpdateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/stream_videos.py b/src/cloudflare/types/stream_videos.py deleted file mode 100644 index 681515079c6..00000000000 --- a/src/cloudflare/types/stream_videos.py +++ /dev/null @@ -1,179 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .stream import StreamWatermarks -from .._models import BaseModel - -__all__ = ["StreamVideos", "Input", "Playback", "Status"] - - -class Input(BaseModel): - height: Optional[int] = None - """The video height in pixels. - - A value of `-1` means the height is unknown. The value becomes available after - the upload and before the video is ready. - """ - - width: Optional[int] = None - """The video width in pixels. - - A value of `-1` means the width is unknown. The value becomes available after - the upload and before the video is ready. - """ - - -class Playback(BaseModel): - dash: Optional[str] = None - """DASH Media Presentation Description for the video.""" - - hls: Optional[str] = None - """The HLS manifest for the video.""" - - -class Status(BaseModel): - error_reason_code: Optional[str] = FieldInfo(alias="errorReasonCode", default=None) - """Specifies why the video failed to encode. - - This field is empty if the video is not in an `error` state. Preferred for - programmatic use. - """ - - error_reason_text: Optional[str] = FieldInfo(alias="errorReasonText", default=None) - """ - Specifies why the video failed to encode using a human readable error message in - English. This field is empty if the video is not in an `error` state. - """ - - pct_complete: Optional[str] = FieldInfo(alias="pctComplete", default=None) - """Indicates the size of the entire upload in bytes. - - The value must be a non-negative integer. - """ - - state: Optional[Literal["pendingupload", "downloading", "queued", "inprogress", "ready", "error"]] = None - """Specifies the processing status for all quality levels for a video.""" - - -class StreamVideos(BaseModel): - allowed_origins: Optional[List[str]] = FieldInfo(alias="allowedOrigins", default=None) - """Lists the origins allowed to display the video. - - Enter allowed origin domains in an array and use `*` for wildcard subdomains. - Empty arrays allow the video to be viewed on any origin. - """ - - created: Optional[datetime] = None - """The date and time the media item was created.""" - - creator: Optional[str] = None - """A user-defined identifier for the media creator.""" - - duration: Optional[float] = None - """The duration of the video in seconds. - - A value of `-1` means the duration is unknown. The duration becomes available - after the upload and before the video is ready. - """ - - input: Optional[Input] = None - - live_input: Optional[str] = FieldInfo(alias="liveInput", default=None) - """The live input ID used to upload a video with Stream Live.""" - - max_duration_seconds: Optional[int] = FieldInfo(alias="maxDurationSeconds", default=None) - """The maximum duration in seconds for a video upload. - - Can be set for a video that is not yet uploaded to limit its duration. Uploads - that exceed the specified duration will fail during processing. A value of `-1` - means the value is unknown. - """ - - meta: Optional[object] = None - """ - A user modifiable key-value store used to reference other systems of record for - managing videos. - """ - - modified: Optional[datetime] = None - """The date and time the media item was last modified.""" - - playback: Optional[Playback] = None - - preview: Optional[str] = None - """The video's preview page URI. This field is omitted until encoding is complete.""" - - ready_to_stream: Optional[bool] = FieldInfo(alias="readyToStream", default=None) - """Indicates whether the video is playable. - - The field is empty if the video is not ready for viewing or the live stream is - still in progress. - """ - - ready_to_stream_at: Optional[datetime] = FieldInfo(alias="readyToStreamAt", default=None) - """Indicates the time at which the video became playable. - - The field is empty if the video is not ready for viewing or the live stream is - still in progress. - """ - - require_signed_urls: Optional[bool] = FieldInfo(alias="requireSignedURLs", default=None) - """Indicates whether the video can be a accessed using the UID. - - When set to `true`, a signed token must be generated with a signing key to view - the video. - """ - - scheduled_deletion: Optional[datetime] = FieldInfo(alias="scheduledDeletion", default=None) - """Indicates the date and time at which the video will be deleted. - - Omit the field to indicate no change, or include with a `null` value to remove - an existing scheduled deletion. If specified, must be at least 30 days from - upload time. - """ - - size: Optional[float] = None - """The size of the media item in bytes.""" - - status: Optional[Status] = None - """Specifies a detailed status for a video. - - If the `state` is `inprogress` or `error`, the `step` field returns `encoding` - or `manifest`. If the `state` is `inprogress`, `pctComplete` returns a number - between 0 and 100 to indicate the approximate percent of completion. If the - `state` is `error`, `errorReasonCode` and `errorReasonText` provide additional - details. - """ - - thumbnail: Optional[str] = None - """The media item's thumbnail URI. - - This field is omitted until encoding is complete. - """ - - thumbnail_timestamp_pct: Optional[float] = FieldInfo(alias="thumbnailTimestampPct", default=None) - """ - The timestamp for a thumbnail image calculated as a percentage value of the - video's duration. To convert from a second-wise timestamp to a percentage, - divide the desired timestamp by the total duration of the video. If this value - is not set, the default thumbnail image is taken from 0s of the video. - """ - - uid: Optional[str] = None - """A Cloudflare-generated unique identifier for a media item.""" - - uploaded: Optional[datetime] = None - """The date and time the media item was uploaded.""" - - upload_expiry: Optional[datetime] = FieldInfo(alias="uploadExpiry", default=None) - """ - The date and time when the video upload URL is no longer valid for direct user - uploads. - """ - - watermark: Optional[StreamWatermarks] = None diff --git a/src/cloudflare/types/subscription_create_params.py b/src/cloudflare/types/subscription_create_params.py deleted file mode 100644 index b345c7a8b90..00000000000 --- a/src/cloudflare/types/subscription_create_params.py +++ /dev/null @@ -1,70 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable -from typing_extensions import Literal, TypedDict - -__all__ = ["SubscriptionCreateParams", "App", "ComponentValue", "RatePlan", "Zone"] - - -class SubscriptionCreateParams(TypedDict, total=False): - app: App - - component_values: Iterable[ComponentValue] - """The list of add-ons subscribed to.""" - - frequency: Literal["weekly", "monthly", "quarterly", "yearly"] - """How often the subscription is renewed automatically.""" - - rate_plan: RatePlan - """The rate plan applied to the subscription.""" - - zone: Zone - """A simple zone object. May have null properties if not a zone subscription.""" - - -class App(TypedDict, total=False): - install_id: str - """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/subscription_list_response.py b/src/cloudflare/types/subscription_list_response.py deleted file mode 100644 index 88d6c34f983..00000000000 --- a/src/cloudflare/types/subscription_list_response.py +++ /dev/null @@ -1,96 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["SubscriptionListResponse", "App", "ComponentValue", "RatePlan", "Zone"] - - -class App(BaseModel): - install_id: Optional[str] = None - """app install id.""" - - -class ComponentValue(BaseModel): - default: Optional[float] = None - """The default amount assigned.""" - - name: Optional[str] = None - """The name of the component value.""" - - price: Optional[float] = None - """The unit price for the component value.""" - - value: Optional[float] = None - """The amount of the component value assigned.""" - - -class RatePlan(BaseModel): - id: Optional[str] = None - """The ID of the rate plan.""" - - currency: Optional[str] = None - """The currency applied to the rate plan subscription.""" - - externally_managed: Optional[bool] = None - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: Optional[bool] = None - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: Optional[str] = None - """The full name of the rate plan.""" - - scope: Optional[str] = None - """The scope that this rate plan applies to.""" - - sets: Optional[List[str]] = None - """The list of sets this rate plan applies to.""" - - -class Zone(BaseModel): - id: Optional[str] = None - """Identifier""" - - name: Optional[str] = None - """The domain name""" - - -class SubscriptionListResponse(BaseModel): - id: Optional[str] = None - """Subscription identifier tag.""" - - app: Optional[App] = None - - component_values: Optional[List[ComponentValue]] = None - """The list of add-ons subscribed to.""" - - currency: Optional[str] = None - """The monetary unit in which pricing information is displayed.""" - - current_period_end: Optional[datetime] = None - """The end of the current period and also when the next billing is due.""" - - current_period_start: Optional[datetime] = None - """When the current billing period started. - - May match initial_period_start if this is the first period. - """ - - frequency: Optional[Literal["weekly", "monthly", "quarterly", "yearly"]] = None - """How often the subscription is renewed automatically.""" - - price: Optional[float] = None - """The price of the subscription that will be billed, in US dollars.""" - - rate_plan: Optional[RatePlan] = None - """The rate plan applied to the subscription.""" - - state: Optional[Literal["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]] = None - """The state that the subscription is in.""" - - zone: Optional[Zone] = None - """A simple zone object. May have null properties if not a zone subscription.""" diff --git a/src/cloudflare/types/subscription_update_params.py b/src/cloudflare/types/subscription_update_params.py deleted file mode 100644 index dfc3e37e92d..00000000000 --- a/src/cloudflare/types/subscription_update_params.py +++ /dev/null @@ -1,73 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["SubscriptionUpdateParams", "App", "ComponentValue", "RatePlan", "Zone"] - - -class SubscriptionUpdateParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - app: App - - component_values: Iterable[ComponentValue] - """The list of add-ons subscribed to.""" - - frequency: Literal["weekly", "monthly", "quarterly", "yearly"] - """How often the subscription is renewed automatically.""" - - rate_plan: RatePlan - """The rate plan applied to the subscription.""" - - zone: Zone - """A simple zone object. May have null properties if not a zone subscription.""" - - -class App(TypedDict, total=False): - install_id: str - """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/subscriptions/__init__.py b/src/cloudflare/types/subscriptions/__init__.py new file mode 100644 index 00000000000..662a2dae32c --- /dev/null +++ b/src/cloudflare/types/subscriptions/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse +from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams +from .subscription_delete_params import SubscriptionDeleteParams as SubscriptionDeleteParams +from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams +from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse +from .subscription_delete_response import SubscriptionDeleteResponse as SubscriptionDeleteResponse +from .subscription_update_response import SubscriptionUpdateResponse as SubscriptionUpdateResponse diff --git a/src/cloudflare/types/subscriptions/subscription_create_params.py b/src/cloudflare/types/subscriptions/subscription_create_params.py new file mode 100644 index 00000000000..362a204da34 --- /dev/null +++ b/src/cloudflare/types/subscriptions/subscription_create_params.py @@ -0,0 +1,33 @@ +# 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, TypedDict + +from ..user.rate_plan_param import RatePlanParam +from ..user.subscription_zone_param import SubscriptionZoneParam +from ..user.subscription_component_param import SubscriptionComponentParam + +__all__ = ["SubscriptionCreateParams", "App"] + + +class SubscriptionCreateParams(TypedDict, total=False): + app: App + + component_values: Iterable[SubscriptionComponentParam] + """The list of add-ons subscribed to.""" + + frequency: Literal["weekly", "monthly", "quarterly", "yearly"] + """How often the subscription is renewed automatically.""" + + rate_plan: RatePlanParam + """The rate plan applied to the subscription.""" + + zone: SubscriptionZoneParam + """A simple zone object. May have null properties if not a zone subscription.""" + + +class App(TypedDict, total=False): + install_id: str + """app install id.""" diff --git a/src/cloudflare/types/subscription_create_response.py b/src/cloudflare/types/subscriptions/subscription_create_response.py similarity index 100% rename from src/cloudflare/types/subscription_create_response.py rename to src/cloudflare/types/subscriptions/subscription_create_response.py diff --git a/src/cloudflare/types/subscriptions/subscription_delete_params.py b/src/cloudflare/types/subscriptions/subscription_delete_params.py new file mode 100644 index 00000000000..9fb12eee32c --- /dev/null +++ b/src/cloudflare/types/subscriptions/subscription_delete_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__ = ["SubscriptionDeleteParams"] + + +class SubscriptionDeleteParams(TypedDict, total=False): + account_identifier: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/subscription_delete_response.py b/src/cloudflare/types/subscriptions/subscription_delete_response.py similarity index 89% rename from src/cloudflare/types/subscription_delete_response.py rename to src/cloudflare/types/subscriptions/subscription_delete_response.py index ce2b575d64b..9afa5116dc3 100644 --- a/src/cloudflare/types/subscription_delete_response.py +++ b/src/cloudflare/types/subscriptions/subscription_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["SubscriptionDeleteResponse"] diff --git a/src/cloudflare/types/subscription_get_response.py b/src/cloudflare/types/subscriptions/subscription_get_response.py similarity index 100% rename from src/cloudflare/types/subscription_get_response.py rename to src/cloudflare/types/subscriptions/subscription_get_response.py diff --git a/src/cloudflare/types/subscriptions/subscription_update_params.py b/src/cloudflare/types/subscriptions/subscription_update_params.py new file mode 100644 index 00000000000..c68cf10cca6 --- /dev/null +++ b/src/cloudflare/types/subscriptions/subscription_update_params.py @@ -0,0 +1,36 @@ +# 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 + +from ..user.rate_plan_param import RatePlanParam +from ..user.subscription_zone_param import SubscriptionZoneParam +from ..user.subscription_component_param import SubscriptionComponentParam + +__all__ = ["SubscriptionUpdateParams", "App"] + + +class SubscriptionUpdateParams(TypedDict, total=False): + account_identifier: Required[str] + """Identifier""" + + app: App + + component_values: Iterable[SubscriptionComponentParam] + """The list of add-ons subscribed to.""" + + frequency: Literal["weekly", "monthly", "quarterly", "yearly"] + """How often the subscription is renewed automatically.""" + + rate_plan: RatePlanParam + """The rate plan applied to the subscription.""" + + zone: SubscriptionZoneParam + """A simple zone object. May have null properties if not a zone subscription.""" + + +class App(TypedDict, total=False): + install_id: str + """app install id.""" diff --git a/src/cloudflare/types/subscription_update_response.py b/src/cloudflare/types/subscriptions/subscription_update_response.py similarity index 100% rename from src/cloudflare/types/subscription_update_response.py rename to src/cloudflare/types/subscriptions/subscription_update_response.py diff --git a/src/cloudflare/types/url_normalization/__init__.py b/src/cloudflare/types/url_normalization/__init__.py new file mode 100644 index 00000000000..6016d4f7824 --- /dev/null +++ b/src/cloudflare/types/url_normalization/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .url_normalization_get_response import URLNormalizationGetResponse as URLNormalizationGetResponse +from .url_normalization_update_params import URLNormalizationUpdateParams as URLNormalizationUpdateParams +from .url_normalization_update_response import URLNormalizationUpdateResponse as URLNormalizationUpdateResponse diff --git a/src/cloudflare/types/url_normalization_get_response.py b/src/cloudflare/types/url_normalization/url_normalization_get_response.py similarity index 92% rename from src/cloudflare/types/url_normalization_get_response.py rename to src/cloudflare/types/url_normalization/url_normalization_get_response.py index 883506990f2..0bebaa4413c 100644 --- a/src/cloudflare/types/url_normalization_get_response.py +++ b/src/cloudflare/types/url_normalization/url_normalization_get_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["URLNormalizationGetResponse"] diff --git a/src/cloudflare/types/url_normalization_update_params.py b/src/cloudflare/types/url_normalization/url_normalization_update_params.py similarity index 100% rename from src/cloudflare/types/url_normalization_update_params.py rename to src/cloudflare/types/url_normalization/url_normalization_update_params.py diff --git a/src/cloudflare/types/url_normalization_update_response.py b/src/cloudflare/types/url_normalization/url_normalization_update_response.py similarity index 92% rename from src/cloudflare/types/url_normalization_update_response.py rename to src/cloudflare/types/url_normalization/url_normalization_update_response.py index a3f68fe45fb..b7d70096ced 100644 --- a/src/cloudflare/types/url_normalization_update_response.py +++ b/src/cloudflare/types/url_normalization/url_normalization_update_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["URLNormalizationUpdateResponse"] diff --git a/src/cloudflare/types/url_scanner/__init__.py b/src/cloudflare/types/url_scanner/__init__.py index 06a15905741..dc7c82ec8f9 100644 --- a/src/cloudflare/types/url_scanner/__init__.py +++ b/src/cloudflare/types/url_scanner/__init__.py @@ -5,5 +5,8 @@ from .scan_get_response import ScanGetResponse as ScanGetResponse from .scan_har_response import ScanHarResponse as ScanHarResponse from .scan_create_params import ScanCreateParams as ScanCreateParams +from .url_scanner_domain import URLScannerDomain as URLScannerDomain from .scan_create_response import ScanCreateResponse as ScanCreateResponse from .scan_screenshot_params import ScanScreenshotParams as ScanScreenshotParams +from .url_scanner_scan_params import URLScannerScanParams as URLScannerScanParams +from .url_scanner_scan_response import URLScannerScanResponse as URLScannerScanResponse diff --git a/src/cloudflare/types/url_scanner/scan_get_response.py b/src/cloudflare/types/url_scanner/scan_get_response.py index 0864a5ce690..dc384e7a7b8 100644 --- a/src/cloudflare/types/url_scanner/scan_get_response.py +++ b/src/cloudflare/types/url_scanner/scan_get_response.py @@ -6,6 +6,8 @@ from pydantic import Field as FieldInfo from ..._models import BaseModel +from .url_scanner_domain import URLScannerDomain +from ..radar.http.browser import Browser __all__ = [ "ScanGetResponse", @@ -15,7 +17,6 @@ "ScanMeta", "ScanMetaProcessors", "ScanMetaProcessorsCategories", - "ScanMetaProcessorsCategoriesContent", "ScanMetaProcessorsCategoriesRisk", "ScanMetaProcessorsRank", "ScanMetaProcessorsTech", @@ -24,10 +25,9 @@ "ScanMetaProcessorsTechEvidencePattern", "ScanPage", "ScanPageConsole", - "ScanPageCooky", - "ScanPageHeader", - "ScanPageJs", - "ScanPageJsVariable", + "ScanPageCookie", + "ScanPageJS", + "ScanPageJSVariable", "ScanPageSecurityViolation", "ScanPerformance", "ScanTask", @@ -42,10 +42,6 @@ "ScanDomainsExampleCom", "ScanDomainsExampleComCategories", "ScanDomainsExampleComCategoriesInherited", - "ScanDomainsExampleComCategoriesInheritedContent", - "ScanDomainsExampleComCategoriesInheritedRisk", - "ScanDomainsExampleComCategoriesContent", - "ScanDomainsExampleComCategoriesRisk", "ScanDomainsExampleComDNS", "ScanDomainsExampleComRank", "ScanIPs", @@ -73,14 +69,6 @@ class ScanGeo(BaseModel): """GeoIP country location""" -class ScanMetaProcessorsCategoriesContent(BaseModel): - id: int - - name: str - - super_category_id: Optional[int] = None - - class ScanMetaProcessorsCategoriesRisk(BaseModel): id: int @@ -90,7 +78,7 @@ class ScanMetaProcessorsCategoriesRisk(BaseModel): class ScanMetaProcessorsCategories(BaseModel): - content: List[ScanMetaProcessorsCategoriesContent] + content: List[URLScannerDomain] risks: List[ScanMetaProcessorsCategoriesRisk] @@ -188,7 +176,7 @@ class ScanPageConsole(BaseModel): url: Optional[str] = None -class ScanPageCooky(BaseModel): +class ScanPageCookie(BaseModel): domain: str expires: float @@ -216,20 +204,14 @@ class ScanPageCooky(BaseModel): priority: Optional[str] = None -class ScanPageHeader(BaseModel): - name: str - - value: str - - -class ScanPageJsVariable(BaseModel): +class ScanPageJSVariable(BaseModel): name: str type: str -class ScanPageJs(BaseModel): - variables: List[ScanPageJsVariable] +class ScanPageJS(BaseModel): + variables: List[ScanPageJSVariable] class ScanPageSecurityViolation(BaseModel): @@ -249,7 +231,7 @@ class ScanPage(BaseModel): console: List[ScanPageConsole] - cookies: List[ScanPageCooky] + cookies: List[ScanPageCookie] country: str @@ -257,11 +239,11 @@ class ScanPage(BaseModel): domain: str - headers: List[ScanPageHeader] + headers: List[Browser] ip: str - js: ScanPageJs + js: ScanPageJS security_violations: List[ScanPageSecurityViolation] = FieldInfo(alias="securityViolations") @@ -418,52 +400,20 @@ class ScanASNs(BaseModel): """ASN's contacted""" -class ScanDomainsExampleComCategoriesInheritedContent(BaseModel): - id: int - - name: str - - super_category_id: Optional[int] = None - - -class ScanDomainsExampleComCategoriesInheritedRisk(BaseModel): - id: int - - name: str - - super_category_id: Optional[int] = None - - class ScanDomainsExampleComCategoriesInherited(BaseModel): - content: Optional[List[ScanDomainsExampleComCategoriesInheritedContent]] = None + content: Optional[List[URLScannerDomain]] = None from_: Optional[str] = FieldInfo(alias="from", default=None) - risks: Optional[List[ScanDomainsExampleComCategoriesInheritedRisk]] = None - - -class ScanDomainsExampleComCategoriesContent(BaseModel): - id: int - - name: str - - super_category_id: Optional[int] = None - - -class ScanDomainsExampleComCategoriesRisk(BaseModel): - id: int - - name: str - - super_category_id: Optional[int] = None + risks: Optional[List[URLScannerDomain]] = None class ScanDomainsExampleComCategories(BaseModel): inherited: ScanDomainsExampleComCategoriesInherited - content: Optional[List[ScanDomainsExampleComCategoriesContent]] = None + content: Optional[List[URLScannerDomain]] = None - risks: Optional[List[ScanDomainsExampleComCategoriesRisk]] = None + risks: Optional[List[URLScannerDomain]] = None class ScanDomainsExampleComDNS(BaseModel): diff --git a/src/cloudflare/types/url_scanner/scan_har_response.py b/src/cloudflare/types/url_scanner/scan_har_response.py index 9aeb2baa2f9..c6bae2fc9fa 100644 --- a/src/cloudflare/types/url_scanner/scan_har_response.py +++ b/src/cloudflare/types/url_scanner/scan_har_response.py @@ -5,6 +5,7 @@ from pydantic import Field as FieldInfo from ..._models import BaseModel +from ..radar.http.browser import Browser __all__ = [ "ScanHarResponse", @@ -13,10 +14,8 @@ "HarLogCreator", "HarLogEntry", "HarLogEntryRequest", - "HarLogEntryRequestHeader", "HarLogEntryResponse", "HarLogEntryResponseContent", - "HarLogEntryResponseHeader", "HarLogPage", "HarLogPagePageTimings", ] @@ -30,16 +29,10 @@ class HarLogCreator(BaseModel): version: str -class HarLogEntryRequestHeader(BaseModel): - name: str - - value: str - - class HarLogEntryRequest(BaseModel): body_size: float = FieldInfo(alias="bodySize") - headers: List[HarLogEntryRequestHeader] + headers: List[Browser] headers_size: float = FieldInfo(alias="headersSize") @@ -58,12 +51,6 @@ class HarLogEntryResponseContent(BaseModel): compression: Optional[int] = None -class HarLogEntryResponseHeader(BaseModel): - name: str - - value: str - - class HarLogEntryResponse(BaseModel): transfer_size: float = FieldInfo(alias="_transferSize") @@ -71,7 +58,7 @@ class HarLogEntryResponse(BaseModel): content: HarLogEntryResponseContent - headers: List[HarLogEntryResponseHeader] + headers: List[Browser] headers_size: float = FieldInfo(alias="headersSize") diff --git a/src/cloudflare/types/url_scanner/url_scanner_domain.py b/src/cloudflare/types/url_scanner/url_scanner_domain.py new file mode 100644 index 00000000000..d9f0f7479ab --- /dev/null +++ b/src/cloudflare/types/url_scanner/url_scanner_domain.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__ = ["URLScannerDomain"] + + +class URLScannerDomain(BaseModel): + id: int + + name: str + + super_category_id: Optional[int] = None diff --git a/src/cloudflare/types/url_scanner_scan_params.py b/src/cloudflare/types/url_scanner/url_scanner_scan_params.py similarity index 98% rename from src/cloudflare/types/url_scanner_scan_params.py rename to src/cloudflare/types/url_scanner/url_scanner_scan_params.py index 6fe41f6372a..3c7a9527f47 100644 --- a/src/cloudflare/types/url_scanner_scan_params.py +++ b/src/cloudflare/types/url_scanner/url_scanner_scan_params.py @@ -6,7 +6,7 @@ from datetime import datetime from typing_extensions import Annotated, TypedDict -from .._utils import PropertyInfo +from ..._utils import PropertyInfo __all__ = ["URLScannerScanParams"] diff --git a/src/cloudflare/types/url_scanner_scan_response.py b/src/cloudflare/types/url_scanner/url_scanner_scan_response.py similarity index 94% rename from src/cloudflare/types/url_scanner_scan_response.py rename to src/cloudflare/types/url_scanner/url_scanner_scan_response.py index 6d2c2bedc94..cf576f43774 100644 --- a/src/cloudflare/types/url_scanner_scan_response.py +++ b/src/cloudflare/types/url_scanner/url_scanner_scan_response.py @@ -3,7 +3,7 @@ from typing import List from datetime import datetime -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["URLScannerScanResponse", "Task"] diff --git a/src/cloudflare/types/user/__init__.py b/src/cloudflare/types/user/__init__.py index 5281439e432..357891efc5e 100644 --- a/src/cloudflare/types/user/__init__.py +++ b/src/cloudflare/types/user/__init__.py @@ -2,28 +2,42 @@ from __future__ import annotations -from .user import User as User +from .invite import Invite as Invite +from .policy import Policy as Policy +from .cidr_list import CIDRList as CIDRList +from .rate_plan import RatePlan as RatePlan from .organization import Organization as Organization +from .policy_param import PolicyParam as PolicyParam +from .subscription import Subscription as Subscription +from .rate_plan_param import RatePlanParam as RatePlanParam +from .user_edit_params import UserEditParams as UserEditParams +from .subscription_zone import SubscriptionZone as SubscriptionZone from .token_list_params import TokenListParams as TokenListParams +from .user_get_response import UserGetResponse as UserGetResponse from .invite_edit_params import InviteEditParams as InviteEditParams from .token_get_response import TokenGetResponse as TokenGetResponse +from .user_edit_response import UserEditResponse as UserEditResponse from .invite_get_response import InviteGetResponse as InviteGetResponse from .token_create_params import TokenCreateParams as TokenCreateParams +from .token_delete_params import TokenDeleteParams as TokenDeleteParams from .token_update_params import TokenUpdateParams as TokenUpdateParams from .invite_edit_response import InviteEditResponse as InviteEditResponse -from .invite_list_response import InviteListResponse as InviteListResponse from .audit_log_list_params import AuditLogListParams as AuditLogListParams from .token_create_response import TokenCreateResponse as TokenCreateResponse from .token_delete_response import TokenDeleteResponse as TokenDeleteResponse from .token_update_response import TokenUpdateResponse as TokenUpdateResponse from .token_verify_response import TokenVerifyResponse as TokenVerifyResponse -from .audit_log_list_response import AuditLogListResponse as AuditLogListResponse +from .subscription_component import SubscriptionComponent as SubscriptionComponent +from .subscription_zone_param import SubscriptionZoneParam as SubscriptionZoneParam from .organization_list_params import OrganizationListParams as OrganizationListParams from .subscription_edit_params import SubscriptionEditParams as SubscriptionEditParams from .organization_get_response import OrganizationGetResponse as OrganizationGetResponse from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse +from .organization_delete_params import OrganizationDeleteParams as OrganizationDeleteParams +from .subscription_delete_params import SubscriptionDeleteParams as SubscriptionDeleteParams from .subscription_edit_response import SubscriptionEditResponse as SubscriptionEditResponse from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams from .organization_delete_response import OrganizationDeleteResponse as OrganizationDeleteResponse +from .subscription_component_param import SubscriptionComponentParam as SubscriptionComponentParam from .subscription_delete_response import SubscriptionDeleteResponse as SubscriptionDeleteResponse from .subscription_update_response import SubscriptionUpdateResponse as SubscriptionUpdateResponse diff --git a/src/cloudflare/types/user/audit_log_list_response.py b/src/cloudflare/types/user/audit_log_list_response.py deleted file mode 100644 index 4d7f2580aae..00000000000 --- a/src/cloudflare/types/user/audit_log_list_response.py +++ /dev/null @@ -1,80 +0,0 @@ -# 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__ = ["AuditLogListResponse", "Action", "Actor", "Owner", "Resource"] - - -class Action(BaseModel): - result: Optional[bool] = None - """A boolean that indicates if the action attempted was successful.""" - - type: Optional[str] = None - """A short string that describes the action that was performed.""" - - -class Actor(BaseModel): - id: Optional[str] = None - """The ID of the actor that performed the action. - - If a user performed the action, this will be their User ID. - """ - - email: Optional[str] = None - """The email of the user that performed the action.""" - - ip: Optional[str] = None - """The IP address of the request that performed the action.""" - - type: Optional[Literal["user", "admin", "Cloudflare"]] = None - """The type of actor, whether a User, Cloudflare Admin, or an Automated System.""" - - -class Owner(BaseModel): - id: Optional[str] = None - """Identifier""" - - -class Resource(BaseModel): - id: Optional[str] = None - """An identifier for the resource that was affected by the action.""" - - type: Optional[str] = None - """A short string that describes the resource that was affected by the action.""" - - -class AuditLogListResponse(BaseModel): - id: Optional[str] = None - """A string that uniquely identifies the audit log.""" - - action: Optional[Action] = None - - actor: Optional[Actor] = None - - interface: Optional[str] = None - """The source of the event.""" - - metadata: Optional[object] = None - """An object which can lend more context to the action being logged. - - This is a flexible value and varies between different actions. - """ - - new_value: Optional[str] = FieldInfo(alias="newValue", default=None) - """The new value of the resource that was modified.""" - - old_value: Optional[str] = FieldInfo(alias="oldValue", default=None) - """The value of the resource before it was modified.""" - - owner: Optional[Owner] = None - - resource: Optional[Resource] = None - - when: Optional[datetime] = None - """A UTC RFC3339 timestamp that specifies when the action being logged occured.""" diff --git a/src/cloudflare/types/user/billing/__init__.py b/src/cloudflare/types/user/billing/__init__.py index e8ddc3e1d28..6ec9233866f 100644 --- a/src/cloudflare/types/user/billing/__init__.py +++ b/src/cloudflare/types/user/billing/__init__.py @@ -3,6 +3,5 @@ from __future__ import annotations from .billing_history import BillingHistory as BillingHistory -from .history_get_params import HistoryGetParams as HistoryGetParams -from .history_get_response import HistoryGetResponse as HistoryGetResponse +from .history_list_params import HistoryListParams as HistoryListParams from .profile_get_response import ProfileGetResponse as ProfileGetResponse diff --git a/src/cloudflare/types/user/billing/history_get_params.py b/src/cloudflare/types/user/billing/history_get_params.py deleted file mode 100644 index 6e336dee904..00000000000 --- a/src/cloudflare/types/user/billing/history_get_params.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, TypedDict - -__all__ = ["HistoryGetParams"] - - -class HistoryGetParams(TypedDict, total=False): - order: Literal["type", "occured_at", "action"] - """Field to order billing history by.""" - - page: float - """Page number of paginated results.""" - - per_page: float - """Number of items per page.""" diff --git a/src/cloudflare/types/user/billing/history_get_response.py b/src/cloudflare/types/user/billing/history_get_response.py deleted file mode 100644 index a3679cab400..00000000000 --- a/src/cloudflare/types/user/billing/history_get_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .billing_history import BillingHistory - -__all__ = ["HistoryGetResponse"] - -HistoryGetResponse = List[BillingHistory] diff --git a/src/cloudflare/types/user/billing/history_list_params.py b/src/cloudflare/types/user/billing/history_list_params.py new file mode 100644 index 00000000000..fa4ce0d1076 --- /dev/null +++ b/src/cloudflare/types/user/billing/history_list_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["HistoryListParams"] + + +class HistoryListParams(TypedDict, total=False): + action: str + """The billing item action.""" + + occured_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """When the billing item was created.""" + + occurred_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """When the billing item was created.""" + + order: Literal["type", "occured_at", "action"] + """Field to order billing history by.""" + + page: float + """Page number of paginated results.""" + + per_page: float + """Number of items per page.""" + + type: str + """The billing item type.""" diff --git a/src/cloudflare/types/user/cidr_list.py b/src/cloudflare/types/user/cidr_list.py new file mode 100644 index 00000000000..f0adf1151fe --- /dev/null +++ b/src/cloudflare/types/user/cidr_list.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["CIDRList"] + +CIDRList = str diff --git a/src/cloudflare/types/user/firewall/__init__.py b/src/cloudflare/types/user/firewall/__init__.py deleted file mode 100644 index 252757e1979..00000000000 --- a/src/cloudflare/types/user/firewall/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .firewall_rule import FirewallRule as FirewallRule -from .access_rule_edit_params import AccessRuleEditParams as AccessRuleEditParams -from .access_rule_list_params import AccessRuleListParams as AccessRuleListParams -from .access_rule_create_params import AccessRuleCreateParams as AccessRuleCreateParams -from .access_rule_delete_response import AccessRuleDeleteResponse as AccessRuleDeleteResponse diff --git a/src/cloudflare/types/user/firewall/access_rule_create_params.py b/src/cloudflare/types/user/firewall/access_rule_create_params.py deleted file mode 100644 index 8ea7233a043..00000000000 --- a/src/cloudflare/types/user/firewall/access_rule_create_params.py +++ /dev/null @@ -1,106 +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, TypedDict - -__all__ = [ - "AccessRuleCreateParams", - "Configuration", - "ConfigurationLegacyJhsIPConfiguration", - "ConfigurationLegacyJhsIPV6Configuration", - "ConfigurationLegacyJhsCIDRConfiguration", - "ConfigurationLegacyJhsASNConfiguration", - "ConfigurationLegacyJhsCountryConfiguration", -] - - -class AccessRuleCreateParams(TypedDict, total=False): - configuration: Required[Configuration] - """The rule configuration.""" - - mode: Required[Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"]] - """The action to apply to a matched request.""" - - notes: str - """ - An informative summary of the rule, typically used as a reminder or explanation. - """ - - -class ConfigurationLegacyJhsIPConfiguration(TypedDict, total=False): - target: Literal["ip"] - """The configuration target. - - You must set the target to `ip` when specifying an IP address in the rule. - """ - - value: str - """The IP address to match. - - This address will be compared to the IP address of incoming requests. - """ - - -class ConfigurationLegacyJhsIPV6Configuration(TypedDict, total=False): - target: Literal["ip6"] - """The configuration target. - - You must set the target to `ip6` when specifying an IPv6 address in the rule. - """ - - value: str - """The IPv6 address to match.""" - - -class ConfigurationLegacyJhsCIDRConfiguration(TypedDict, total=False): - target: Literal["ip_range"] - """The configuration target. - - You must set the target to `ip_range` when specifying an IP address range in the - rule. - """ - - value: str - """The IP address range to match. - - You can only use prefix lengths `/16` and `/24` for IPv4 ranges, and prefix - lengths `/32`, `/48`, and `/64` for IPv6 ranges. - """ - - -class ConfigurationLegacyJhsASNConfiguration(TypedDict, total=False): - target: Literal["asn"] - """The configuration target. - - You must set the target to `asn` when specifying an Autonomous System Number - (ASN) in the rule. - """ - - value: str - """The AS number to match.""" - - -class ConfigurationLegacyJhsCountryConfiguration(TypedDict, total=False): - target: Literal["country"] - """The configuration target. - - You must set the target to `country` when specifying a country code in the rule. - """ - - value: str - """The two-letter ISO-3166-1 alpha-2 code to match. - - For more information, refer to - [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). - """ - - -Configuration = Union[ - ConfigurationLegacyJhsIPConfiguration, - ConfigurationLegacyJhsIPV6Configuration, - ConfigurationLegacyJhsCIDRConfiguration, - ConfigurationLegacyJhsASNConfiguration, - ConfigurationLegacyJhsCountryConfiguration, -] diff --git a/src/cloudflare/types/user/firewall/access_rule_delete_response.py b/src/cloudflare/types/user/firewall/access_rule_delete_response.py deleted file mode 100644 index 562531b8891..00000000000 --- a/src/cloudflare/types/user/firewall/access_rule_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["AccessRuleDeleteResponse"] - - -class AccessRuleDeleteResponse(BaseModel): - id: Optional[str] = None - """The unique identifier of the IP Access rule.""" diff --git a/src/cloudflare/types/user/firewall/access_rule_edit_params.py b/src/cloudflare/types/user/firewall/access_rule_edit_params.py deleted file mode 100644 index 474b77feee1..00000000000 --- a/src/cloudflare/types/user/firewall/access_rule_edit_params.py +++ /dev/null @@ -1,17 +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__ = ["AccessRuleEditParams"] - - -class AccessRuleEditParams(TypedDict, total=False): - mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"] - """The action to apply to a matched request.""" - - notes: str - """ - An informative summary of the rule, typically used as a reminder or explanation. - """ diff --git a/src/cloudflare/types/user/firewall/access_rule_list_params.py b/src/cloudflare/types/user/firewall/access_rule_list_params.py deleted file mode 100644 index e43846189d7..00000000000 --- a/src/cloudflare/types/user/firewall/access_rule_list_params.py +++ /dev/null @@ -1,74 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["AccessRuleListParams", "EgsPagination", "EgsPaginationJson", "Filters"] - - -class AccessRuleListParams(TypedDict, total=False): - direction: Literal["asc", "desc"] - """The direction used to sort returned rules.""" - - egs_pagination: Annotated[EgsPagination, PropertyInfo(alias="egs-pagination")] - - filters: Filters - - order: Literal["configuration.target", "configuration.value", "mode"] - """The field used to sort returned rules.""" - - page: float - """Requested page within paginated list of results.""" - - per_page: float - """Maximum number of results requested.""" - - -class EgsPaginationJson(TypedDict, total=False): - page: float - """The page number of paginated results.""" - - per_page: float - """The maximum number of results per page. - - You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, - or `20`. - """ - - -class EgsPagination(TypedDict, total=False): - json: EgsPaginationJson - - -class Filters(TypedDict, total=False): - configuration_target: Annotated[ - Literal["ip", "ip_range", "asn", "country"], PropertyInfo(alias="configuration.target") - ] - """The target to search in existing rules.""" - - configuration_value: Annotated[str, PropertyInfo(alias="configuration.value")] - """ - The target value to search for in existing rules: an IP address, an IP address - range, or a country code, depending on the provided `configuration.target`. - Notes: You can search for a single IPv4 address, an IP address range with a - subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code. - """ - - match: Literal["any", "all"] - """When set to `all`, all the search requirements must match. - - When set to `any`, only one of the search requirements has to match. - """ - - mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"] - """The action to apply to a matched request.""" - - notes: str - """ - The string to search for in the notes of existing IP Access rules. Notes: For - example, the string 'attack' would match IP Access rules with notes 'Attack - 26/02' and 'Attack 27/02'. The search is case insensitive. - """ diff --git a/src/cloudflare/types/user/firewall/firewall_rule.py b/src/cloudflare/types/user/firewall/firewall_rule.py deleted file mode 100644 index f7bc7e5f602..00000000000 --- a/src/cloudflare/types/user/firewall/firewall_rule.py +++ /dev/null @@ -1,119 +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 - -from ...._models import BaseModel - -__all__ = [ - "FirewallRule", - "Configuration", - "ConfigurationLegacyJhsIPConfiguration", - "ConfigurationLegacyJhsIPV6Configuration", - "ConfigurationLegacyJhsCIDRConfiguration", - "ConfigurationLegacyJhsASNConfiguration", - "ConfigurationLegacyJhsCountryConfiguration", -] - - -class ConfigurationLegacyJhsIPConfiguration(BaseModel): - target: Optional[Literal["ip"]] = None - """The configuration target. - - You must set the target to `ip` when specifying an IP address in the rule. - """ - - value: Optional[str] = None - """The IP address to match. - - This address will be compared to the IP address of incoming requests. - """ - - -class ConfigurationLegacyJhsIPV6Configuration(BaseModel): - target: Optional[Literal["ip6"]] = None - """The configuration target. - - You must set the target to `ip6` when specifying an IPv6 address in the rule. - """ - - value: Optional[str] = None - """The IPv6 address to match.""" - - -class ConfigurationLegacyJhsCIDRConfiguration(BaseModel): - target: Optional[Literal["ip_range"]] = None - """The configuration target. - - You must set the target to `ip_range` when specifying an IP address range in the - rule. - """ - - value: Optional[str] = None - """The IP address range to match. - - You can only use prefix lengths `/16` and `/24` for IPv4 ranges, and prefix - lengths `/32`, `/48`, and `/64` for IPv6 ranges. - """ - - -class ConfigurationLegacyJhsASNConfiguration(BaseModel): - target: Optional[Literal["asn"]] = None - """The configuration target. - - You must set the target to `asn` when specifying an Autonomous System Number - (ASN) in the rule. - """ - - value: Optional[str] = None - """The AS number to match.""" - - -class ConfigurationLegacyJhsCountryConfiguration(BaseModel): - target: Optional[Literal["country"]] = None - """The configuration target. - - You must set the target to `country` when specifying a country code in the rule. - """ - - value: Optional[str] = None - """The two-letter ISO-3166-1 alpha-2 code to match. - - For more information, refer to - [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). - """ - - -Configuration = Union[ - ConfigurationLegacyJhsIPConfiguration, - ConfigurationLegacyJhsIPV6Configuration, - ConfigurationLegacyJhsCIDRConfiguration, - ConfigurationLegacyJhsASNConfiguration, - ConfigurationLegacyJhsCountryConfiguration, -] - - -class FirewallRule(BaseModel): - id: str - """The unique identifier of the IP Access rule.""" - - allowed_modes: List[Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"]] - """The available actions that a rule can apply to a matched request.""" - - configuration: Configuration - """The rule configuration.""" - - mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"] - """The action to apply to a matched request.""" - - created_on: Optional[datetime] = None - """The timestamp of when the rule was created.""" - - modified_on: Optional[datetime] = None - """The timestamp of when the rule was last modified.""" - - notes: Optional[str] = None - """ - An informative summary of the rule, typically used as a reminder or explanation. - """ diff --git a/src/cloudflare/types/user/invite.py b/src/cloudflare/types/user/invite.py new file mode 100644 index 00000000000..00c7cf5ce22 --- /dev/null +++ b/src/cloudflare/types/user/invite.py @@ -0,0 +1,42 @@ +# 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 +from ..shared.role import Role + +__all__ = ["Invite"] + + +class Invite(BaseModel): + invited_member_id: Optional[str] = None + """ID of the user to add to the organization.""" + + organization_id: str + """ID of the organization the user will be added to.""" + + id: Optional[str] = None + """Invite identifier tag.""" + + expires_on: Optional[datetime] = None + """When the invite is no longer active.""" + + invited_by: Optional[str] = None + """The email address of the user who created the invite.""" + + invited_member_email: Optional[str] = None + """Email address of the user to add to the organization.""" + + invited_on: Optional[datetime] = None + """When the invite was sent.""" + + organization_name: Optional[str] = None + """Organization name.""" + + roles: Optional[List[Role]] = None + """Roles to be assigned to this user.""" + + status: Optional[Literal["pending", "accepted", "rejected", "expired"]] = None + """Current status of the invitation.""" diff --git a/src/cloudflare/types/user/invite_list_response.py b/src/cloudflare/types/user/invite_list_response.py deleted file mode 100644 index 4552dab6bdb..00000000000 --- a/src/cloudflare/types/user/invite_list_response.py +++ /dev/null @@ -1,42 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel -from ..accounts import Role - -__all__ = ["InviteListResponse"] - - -class InviteListResponse(BaseModel): - invited_member_id: Optional[str] = None - """ID of the user to add to the organization.""" - - organization_id: str - """ID of the organization the user will be added to.""" - - id: Optional[str] = None - """Invite identifier tag.""" - - expires_on: Optional[datetime] = None - """When the invite is no longer active.""" - - invited_by: Optional[str] = None - """The email address of the user who created the invite.""" - - invited_member_email: Optional[str] = None - """Email address of the user to add to the organization.""" - - invited_on: Optional[datetime] = None - """When the invite was sent.""" - - organization_name: Optional[str] = None - """Organization name.""" - - roles: Optional[List[Role]] = None - """Roles to be assigned to this user.""" - - status: Optional[Literal["pending", "accepted", "rejected", "expired"]] = None - """Current status of the invitation.""" diff --git a/src/cloudflare/types/user/load_balancers/__init__.py b/src/cloudflare/types/user/load_balancers/__init__.py deleted file mode 100644 index acb23dfd758..00000000000 --- a/src/cloudflare/types/user/load_balancers/__init__.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 .pool_edit_params import PoolEditParams as PoolEditParams -from .pool_list_params import PoolListParams as PoolListParams -from .pool_create_params import PoolCreateParams as PoolCreateParams -from .pool_update_params import PoolUpdateParams as PoolUpdateParams -from .load_balancing_pool import LoadBalancingPool as LoadBalancingPool -from .monitor_edit_params import MonitorEditParams as MonitorEditParams -from .pool_preview_params import PoolPreviewParams as PoolPreviewParams -from .pool_delete_response import PoolDeleteResponse as PoolDeleteResponse -from .pool_health_response import PoolHealthResponse as PoolHealthResponse -from .monitor_create_params import MonitorCreateParams as MonitorCreateParams -from .monitor_update_params import MonitorUpdateParams as MonitorUpdateParams -from .pool_preview_response import PoolPreviewResponse as PoolPreviewResponse -from .load_balancing_monitor import LoadBalancingMonitor as LoadBalancingMonitor -from .load_balancing_preview import LoadBalancingPreview as LoadBalancingPreview -from .monitor_preview_params import MonitorPreviewParams as MonitorPreviewParams -from .monitor_delete_response import MonitorDeleteResponse as MonitorDeleteResponse -from .monitor_preview_response import MonitorPreviewResponse as MonitorPreviewResponse -from .pool_references_response import PoolReferencesResponse as PoolReferencesResponse -from .monitor_references_response import MonitorReferencesResponse as MonitorReferencesResponse diff --git a/src/cloudflare/types/user/load_balancers/analytics/__init__.py b/src/cloudflare/types/user/load_balancers/analytics/__init__.py deleted file mode 100644 index 6e17e38c1cd..00000000000 --- a/src/cloudflare/types/user/load_balancers/analytics/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .event_list_params import EventListParams as EventListParams -from .load_balancing_analytics import LoadBalancingAnalytics as LoadBalancingAnalytics diff --git a/src/cloudflare/types/user/load_balancers/analytics/event_list_params.py b/src/cloudflare/types/user/load_balancers/analytics/event_list_params.py deleted file mode 100644 index cd27e66a9b6..00000000000 --- a/src/cloudflare/types/user/load_balancers/analytics/event_list_params.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Annotated, TypedDict - -from ....._utils import PropertyInfo - -__all__ = ["EventListParams"] - - -class EventListParams(TypedDict, total=False): - origin_healthy: bool - """If true, filter events where the origin status is healthy. - - If false, filter events where the origin status is unhealthy. - """ - - origin_name: str - """The name for the origin to filter.""" - - pool_healthy: bool - """If true, filter events where the pool status is healthy. - - If false, filter events where the pool status is unhealthy. - """ - - pool_id: str - - pool_name: str - """The name for the pool to filter.""" - - since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Start date and time of requesting data period in the ISO8601 format.""" - - until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """End date and time of requesting data period in the ISO8601 format.""" diff --git a/src/cloudflare/types/user/load_balancers/analytics/load_balancing_analytics.py b/src/cloudflare/types/user/load_balancers/analytics/load_balancing_analytics.py deleted file mode 100644 index a1995d5ec68..00000000000 --- a/src/cloudflare/types/user/load_balancers/analytics/load_balancing_analytics.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ....._models import BaseModel - -__all__ = ["LoadBalancingAnalytics"] - - -class LoadBalancingAnalytics(BaseModel): - id: Optional[int] = None - - origins: Optional[List[object]] = None - - pool: Optional[object] = None - - timestamp: Optional[datetime] = None diff --git a/src/cloudflare/types/user/load_balancers/load_balancing_monitor.py b/src/cloudflare/types/user/load_balancers/load_balancing_monitor.py deleted file mode 100644 index 5d89fdbd050..00000000000 --- a/src/cloudflare/types/user/load_balancers/load_balancing_monitor.py +++ /dev/null @@ -1,113 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["LoadBalancingMonitor"] - - -class LoadBalancingMonitor(BaseModel): - id: Optional[str] = None - - allow_insecure: Optional[bool] = None - """Do not validate the certificate when monitor use HTTPS. - - This parameter is currently only valid for HTTP and HTTPS monitors. - """ - - consecutive_down: Optional[int] = None - """ - To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - """ - - consecutive_up: Optional[int] = None - """ - To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - """ - - created_on: Optional[datetime] = None - - description: Optional[str] = None - """Object description.""" - - expected_body: Optional[str] = None - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. This - parameter is only valid for HTTP and HTTPS monitors. - """ - - expected_codes: Optional[str] = None - """The expected HTTP response code or code range of the health check. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - follow_redirects: Optional[bool] = None - """Follow redirects if returned by the origin. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - header: Optional[object] = None - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. This parameter is only valid for HTTP and HTTPS monitors. - """ - - interval: Optional[int] = None - """The interval between each health check. - - Shorter intervals may improve failover time, but will increase load on the - origins as we check from multiple locations. - """ - - method: Optional[str] = None - """The method to use for the health check. - - This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' - for TCP based health checks. - """ - - modified_on: Optional[datetime] = None - - path: Optional[str] = None - """The endpoint path you want to conduct a health check against. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - port: Optional[int] = None - """The port number to connect to for the health check. - - Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define - the port when using a non-standard port (HTTP: default 80, HTTPS: default 443). - """ - - probe_zone: Optional[str] = None - """Assign this monitor to emulate the specified zone while probing. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - retries: Optional[int] = None - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - timeout: Optional[int] = None - """The timeout (in seconds) before marking the health check as failed.""" - - type: Optional[Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"]] = None - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', - 'UDP-ICMP', and 'SMTP'. - """ diff --git a/src/cloudflare/types/user/load_balancers/load_balancing_pool.py b/src/cloudflare/types/user/load_balancers/load_balancing_pool.py deleted file mode 100644 index 6204fd4f094..00000000000 --- a/src/cloudflare/types/user/load_balancers/load_balancing_pool.py +++ /dev/null @@ -1,273 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "LoadBalancingPool", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", - "Origin", - "OriginHeader", -] - - -class LoadShedding(BaseModel): - default_percent: Optional[float] = None - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Optional[Literal["random", "hash"]] = None - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: Optional[float] = None - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Optional[Literal["hash"]] = None - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(BaseModel): - disable: Optional[bool] = None - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] = None - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(BaseModel): - disable: Optional[bool] = None - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] = None - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(BaseModel): - origin: Optional[NotificationFilterOrigin] = None - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] = None - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(BaseModel): - policy: Optional[Literal["random", "hash", "least_outstanding_requests", "least_connections"]] = None - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ - - -class OriginHeader(BaseModel): - host: Optional[List[str]] = FieldInfo(alias="Host", default=None) - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(BaseModel): - address: Optional[str] = None - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - disabled_at: Optional[datetime] = None - """This field shows up only if the origin is disabled. - - This field is set with the time the origin was disabled. - """ - - enabled: Optional[bool] = None - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: Optional[OriginHeader] = None - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: Optional[str] = None - """A human-identifiable name for the origin.""" - - virtual_network_id: Optional[str] = None - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: Optional[float] = None - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadBalancingPool(BaseModel): - id: Optional[str] = None - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] = None - """A list of regions from which to run health checks. - - Null means every Cloudflare data center. - """ - - created_on: Optional[datetime] = None - - description: Optional[str] = None - """A human-readable description of the pool.""" - - disabled_at: Optional[datetime] = None - """This field shows up only if the pool is disabled. - - This field is set with the time the pool was disabled at. - """ - - enabled: Optional[bool] = None - """Whether to enable (the default) or disable this pool. - - Disabled pools will not receive traffic and are excluded from health checks. - Disabling a pool will cause any load balancers using it to failover to the next - pool (if any). - """ - - latitude: Optional[float] = None - """ - The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - """ - - load_shedding: Optional[LoadShedding] = None - """Configures load shedding policies and percentages for the pool.""" - - longitude: Optional[float] = None - """ - The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - """ - - minimum_origins: Optional[int] = None - """ - The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - """ - - modified_on: Optional[datetime] = None - - monitor: Optional[object] = None - """ - The ID of the Monitor to use for checking the health of origins within this - pool. - """ - - name: Optional[str] = None - """A short name (tag) for the pool. - - Only alphanumeric characters, hyphens, and underscores are allowed. - """ - - notification_email: Optional[str] = None - """This field is now deprecated. - - It has been moved to Cloudflare's Centralized Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - """ - - notification_filter: Optional[NotificationFilter] = None - """Filter pool and origin health notifications by resource type or health status. - - Use null to reset. - """ - - origin_steering: Optional[OriginSteering] = None - """Configures origin steering for the pool. - - Controls how origins are selected for new sessions and traffic without session - affinity. - """ - - origins: Optional[List[Origin]] = None - """The list of origins within this pool. - - Traffic directed at this pool is balanced across all currently healthy origins, - provided the pool itself is healthy. - """ diff --git a/src/cloudflare/types/user/load_balancers/load_balancing_preview.py b/src/cloudflare/types/user/load_balancers/load_balancing_preview.py deleted file mode 100644 index 6ab9378796f..00000000000 --- a/src/cloudflare/types/user/load_balancers/load_balancing_preview.py +++ /dev/null @@ -1,30 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional - -from ...._models import BaseModel - -__all__ = [ - "LoadBalancingPreview", - "LoadBalancingPreviewItem", - "LoadBalancingPreviewItemOriginLoadBalancingPreviewItemOriginItem", -] - - -class LoadBalancingPreviewItemOriginLoadBalancingPreviewItemOriginItem(BaseModel): - failure_reason: Optional[str] = None - - healthy: Optional[bool] = None - - response_code: Optional[float] = None - - rtt: Optional[str] = None - - -class LoadBalancingPreviewItem(BaseModel): - healthy: Optional[bool] = None - - origins: Optional[List[Dict[str, LoadBalancingPreviewItemOriginLoadBalancingPreviewItemOriginItem]]] = None - - -LoadBalancingPreview = Dict[str, LoadBalancingPreviewItem] diff --git a/src/cloudflare/types/user/load_balancers/monitor_create_params.py b/src/cloudflare/types/user/load_balancers/monitor_create_params.py deleted file mode 100644 index e111b9e8502..00000000000 --- a/src/cloudflare/types/user/load_balancers/monitor_create_params.py +++ /dev/null @@ -1,107 +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, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["MonitorCreateParams"] - - -class MonitorCreateParams(TypedDict, total=False): - expected_codes: Required[str] - """The expected HTTP response code or code range of the health check. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - allow_insecure: bool - """Do not validate the certificate when monitor use HTTPS. - - This parameter is currently only valid for HTTP and HTTPS monitors. - """ - - consecutive_down: int - """ - To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - """ - - consecutive_up: int - """ - To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - """ - - description: str - """Object description.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. This - parameter is only valid for HTTP and HTTPS monitors. - """ - - follow_redirects: bool - """Follow redirects if returned by the origin. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - header: object - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. This parameter is only valid for HTTP and HTTPS monitors. - """ - - interval: int - """The interval between each health check. - - Shorter intervals may improve failover time, but will increase load on the - origins as we check from multiple locations. - """ - - method: str - """The method to use for the health check. - - This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' - for TCP based health checks. - """ - - path: str - """The endpoint path you want to conduct a health check against. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - port: int - """The port number to connect to for the health check. - - Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define - the port when using a non-standard port (HTTP: default 80, HTTPS: default 443). - """ - - probe_zone: str - """Assign this monitor to emulate the specified zone while probing. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - load_balancer_monitor_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', - 'UDP-ICMP', and 'SMTP'. - """ diff --git a/src/cloudflare/types/user/load_balancers/monitor_delete_response.py b/src/cloudflare/types/user/load_balancers/monitor_delete_response.py deleted file mode 100644 index d6859459202..00000000000 --- a/src/cloudflare/types/user/load_balancers/monitor_delete_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["MonitorDeleteResponse"] - - -class MonitorDeleteResponse(BaseModel): - id: Optional[str] = None diff --git a/src/cloudflare/types/user/load_balancers/monitor_edit_params.py b/src/cloudflare/types/user/load_balancers/monitor_edit_params.py deleted file mode 100644 index ddea561e7f6..00000000000 --- a/src/cloudflare/types/user/load_balancers/monitor_edit_params.py +++ /dev/null @@ -1,107 +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, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["MonitorEditParams"] - - -class MonitorEditParams(TypedDict, total=False): - expected_codes: Required[str] - """The expected HTTP response code or code range of the health check. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - allow_insecure: bool - """Do not validate the certificate when monitor use HTTPS. - - This parameter is currently only valid for HTTP and HTTPS monitors. - """ - - consecutive_down: int - """ - To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - """ - - consecutive_up: int - """ - To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - """ - - description: str - """Object description.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. This - parameter is only valid for HTTP and HTTPS monitors. - """ - - follow_redirects: bool - """Follow redirects if returned by the origin. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - header: object - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. This parameter is only valid for HTTP and HTTPS monitors. - """ - - interval: int - """The interval between each health check. - - Shorter intervals may improve failover time, but will increase load on the - origins as we check from multiple locations. - """ - - method: str - """The method to use for the health check. - - This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' - for TCP based health checks. - """ - - path: str - """The endpoint path you want to conduct a health check against. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - port: int - """The port number to connect to for the health check. - - Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define - the port when using a non-standard port (HTTP: default 80, HTTPS: default 443). - """ - - probe_zone: str - """Assign this monitor to emulate the specified zone while probing. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - load_balancer_monitor_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', - 'UDP-ICMP', and 'SMTP'. - """ diff --git a/src/cloudflare/types/user/load_balancers/monitor_preview_params.py b/src/cloudflare/types/user/load_balancers/monitor_preview_params.py deleted file mode 100644 index 41b03b20c9d..00000000000 --- a/src/cloudflare/types/user/load_balancers/monitor_preview_params.py +++ /dev/null @@ -1,107 +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, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["MonitorPreviewParams"] - - -class MonitorPreviewParams(TypedDict, total=False): - expected_codes: Required[str] - """The expected HTTP response code or code range of the health check. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - allow_insecure: bool - """Do not validate the certificate when monitor use HTTPS. - - This parameter is currently only valid for HTTP and HTTPS monitors. - """ - - consecutive_down: int - """ - To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - """ - - consecutive_up: int - """ - To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - """ - - description: str - """Object description.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. This - parameter is only valid for HTTP and HTTPS monitors. - """ - - follow_redirects: bool - """Follow redirects if returned by the origin. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - header: object - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. This parameter is only valid for HTTP and HTTPS monitors. - """ - - interval: int - """The interval between each health check. - - Shorter intervals may improve failover time, but will increase load on the - origins as we check from multiple locations. - """ - - method: str - """The method to use for the health check. - - This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' - for TCP based health checks. - """ - - path: str - """The endpoint path you want to conduct a health check against. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - port: int - """The port number to connect to for the health check. - - Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define - the port when using a non-standard port (HTTP: default 80, HTTPS: default 443). - """ - - probe_zone: str - """Assign this monitor to emulate the specified zone while probing. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - load_balancer_monitor_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', - 'UDP-ICMP', and 'SMTP'. - """ diff --git a/src/cloudflare/types/user/load_balancers/monitor_preview_response.py b/src/cloudflare/types/user/load_balancers/monitor_preview_response.py deleted file mode 100644 index fb8eac11116..00000000000 --- a/src/cloudflare/types/user/load_balancers/monitor_preview_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional - -from ...._models import BaseModel - -__all__ = ["MonitorPreviewResponse"] - - -class MonitorPreviewResponse(BaseModel): - pools: Optional[Dict[str, str]] = None - """Monitored pool IDs mapped to their respective names.""" - - preview_id: Optional[str] = None diff --git a/src/cloudflare/types/user/load_balancers/monitor_references_response.py b/src/cloudflare/types/user/load_balancers/monitor_references_response.py deleted file mode 100644 index 2abe92dc5ae..00000000000 --- a/src/cloudflare/types/user/load_balancers/monitor_references_response.py +++ /dev/null @@ -1,21 +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__ = ["MonitorReferencesResponse", "MonitorReferencesResponseItem"] - - -class MonitorReferencesResponseItem(BaseModel): - reference_type: Optional[Literal["*", "referral", "referrer"]] = None - - resource_id: Optional[str] = None - - resource_name: Optional[str] = None - - resource_type: Optional[str] = None - - -MonitorReferencesResponse = List[MonitorReferencesResponseItem] diff --git a/src/cloudflare/types/user/load_balancers/monitor_update_params.py b/src/cloudflare/types/user/load_balancers/monitor_update_params.py deleted file mode 100644 index cad53e542d7..00000000000 --- a/src/cloudflare/types/user/load_balancers/monitor_update_params.py +++ /dev/null @@ -1,107 +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, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["MonitorUpdateParams"] - - -class MonitorUpdateParams(TypedDict, total=False): - expected_codes: Required[str] - """The expected HTTP response code or code range of the health check. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - allow_insecure: bool - """Do not validate the certificate when monitor use HTTPS. - - This parameter is currently only valid for HTTP and HTTPS monitors. - """ - - consecutive_down: int - """ - To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - """ - - consecutive_up: int - """ - To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - """ - - description: str - """Object description.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. This - parameter is only valid for HTTP and HTTPS monitors. - """ - - follow_redirects: bool - """Follow redirects if returned by the origin. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - header: object - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. This parameter is only valid for HTTP and HTTPS monitors. - """ - - interval: int - """The interval between each health check. - - Shorter intervals may improve failover time, but will increase load on the - origins as we check from multiple locations. - """ - - method: str - """The method to use for the health check. - - This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' - for TCP based health checks. - """ - - path: str - """The endpoint path you want to conduct a health check against. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - port: int - """The port number to connect to for the health check. - - Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define - the port when using a non-standard port (HTTP: default 80, HTTPS: default 443). - """ - - probe_zone: str - """Assign this monitor to emulate the specified zone while probing. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - load_balancer_monitor_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', - 'UDP-ICMP', and 'SMTP'. - """ diff --git a/src/cloudflare/types/user/load_balancers/pool_create_params.py b/src/cloudflare/types/user/load_balancers/pool_create_params.py deleted file mode 100644 index 65019aee9a1..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_create_params.py +++ /dev/null @@ -1,254 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = [ - "PoolCreateParams", - "Origin", - "OriginHeader", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", -] - - -class PoolCreateParams(TypedDict, total=False): - name: Required[str] - """A short name (tag) for the pool. - - Only alphanumeric characters, hyphens, and underscores are allowed. - """ - - origins: Required[Iterable[Origin]] - """The list of origins within this pool. - - Traffic directed at this pool is balanced across all currently healthy origins, - provided the pool itself is healthy. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means every Cloudflare data center. - """ - - description: str - """A human-readable description of the pool.""" - - enabled: bool - """Whether to enable (the default) or disable this pool. - - Disabled pools will not receive traffic and are excluded from health checks. - Disabling a pool will cause any load balancers using it to failover to the next - pool (if any). - """ - - latitude: float - """ - The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - """ - - load_shedding: LoadShedding - """Configures load shedding policies and percentages for the pool.""" - - longitude: float - """ - The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - """ - - minimum_origins: int - """ - The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - """ - - monitor: object - """ - The ID of the Monitor to use for checking the health of origins within this - pool. - """ - - notification_email: str - """This field is now deprecated. - - It has been moved to Cloudflare's Centralized Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - """ - - notification_filter: Optional[NotificationFilter] - """Filter pool and origin health notifications by resource type or health status. - - Use null to reset. - """ - - origin_steering: OriginSteering - """Configures origin steering for the pool. - - Controls how origins are selected for new sessions and traffic without session - affinity. - """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ diff --git a/src/cloudflare/types/user/load_balancers/pool_delete_response.py b/src/cloudflare/types/user/load_balancers/pool_delete_response.py deleted file mode 100644 index a37b03d533d..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_delete_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["PoolDeleteResponse"] - - -class PoolDeleteResponse(BaseModel): - id: Optional[str] = None diff --git a/src/cloudflare/types/user/load_balancers/pool_edit_params.py b/src/cloudflare/types/user/load_balancers/pool_edit_params.py deleted file mode 100644 index f046e3937c3..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_edit_params.py +++ /dev/null @@ -1,254 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable, Optional -from typing_extensions import Literal, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = [ - "PoolEditParams", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", - "Origin", - "OriginHeader", -] - - -class PoolEditParams(TypedDict, total=False): - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means every Cloudflare data center. - """ - - description: str - """A human-readable description of the pool.""" - - enabled: bool - """Whether to enable (the default) or disable this pool. - - Disabled pools will not receive traffic and are excluded from health checks. - Disabling a pool will cause any load balancers using it to failover to the next - pool (if any). - """ - - latitude: float - """ - The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - """ - - load_shedding: LoadShedding - """Configures load shedding policies and percentages for the pool.""" - - longitude: float - """ - The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - """ - - minimum_origins: int - """ - The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - """ - - monitor: object - """ - The ID of the Monitor to use for checking the health of origins within this - pool. - """ - - name: str - """A short name (tag) for the pool. - - Only alphanumeric characters, hyphens, and underscores are allowed. - """ - - notification_email: str - """This field is now deprecated. - - It has been moved to Cloudflare's Centralized Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - """ - - notification_filter: Optional[NotificationFilter] - """Filter pool and origin health notifications by resource type or health status. - - Use null to reset. - """ - - origin_steering: OriginSteering - """Configures origin steering for the pool. - - Controls how origins are selected for new sessions and traffic without session - affinity. - """ - - origins: Iterable[Origin] - """The list of origins within this pool. - - Traffic directed at this pool is balanced across all currently healthy origins, - provided the pool itself is healthy. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ diff --git a/src/cloudflare/types/user/load_balancers/pool_health_response.py b/src/cloudflare/types/user/load_balancers/pool_health_response.py deleted file mode 100644 index a79512176b5..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_health_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional - -__all__ = ["PoolHealthResponse"] - -PoolHealthResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/user/load_balancers/pool_list_params.py b/src/cloudflare/types/user/load_balancers/pool_list_params.py deleted file mode 100644 index 042d577c886..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_list_params.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__ = ["PoolListParams"] - - -class PoolListParams(TypedDict, total=False): - monitor: object - """ - The ID of the Monitor to use for checking the health of origins within this - pool. - """ diff --git a/src/cloudflare/types/user/load_balancers/pool_preview_params.py b/src/cloudflare/types/user/load_balancers/pool_preview_params.py deleted file mode 100644 index dae827868c1..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_preview_params.py +++ /dev/null @@ -1,107 +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, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["PoolPreviewParams"] - - -class PoolPreviewParams(TypedDict, total=False): - expected_codes: Required[str] - """The expected HTTP response code or code range of the health check. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - allow_insecure: bool - """Do not validate the certificate when monitor use HTTPS. - - This parameter is currently only valid for HTTP and HTTPS monitors. - """ - - consecutive_down: int - """ - To be marked unhealthy the monitored origin must fail this healthcheck N - consecutive times. - """ - - consecutive_up: int - """ - To be marked healthy the monitored origin must pass this healthcheck N - consecutive times. - """ - - description: str - """Object description.""" - - expected_body: str - """A case-insensitive sub-string to look for in the response body. - - If this string is not found, the origin will be marked as unhealthy. This - parameter is only valid for HTTP and HTTPS monitors. - """ - - follow_redirects: bool - """Follow redirects if returned by the origin. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - header: object - """The HTTP request headers to send in the health check. - - It is recommended you set a Host header by default. The User-Agent header cannot - be overridden. This parameter is only valid for HTTP and HTTPS monitors. - """ - - interval: int - """The interval between each health check. - - Shorter intervals may improve failover time, but will increase load on the - origins as we check from multiple locations. - """ - - method: str - """The method to use for the health check. - - This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' - for TCP based health checks. - """ - - path: str - """The endpoint path you want to conduct a health check against. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - port: int - """The port number to connect to for the health check. - - Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define - the port when using a non-standard port (HTTP: default 80, HTTPS: default 443). - """ - - probe_zone: str - """Assign this monitor to emulate the specified zone while probing. - - This parameter is only valid for HTTP and HTTPS monitors. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - load_balancer_monitor_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: Literal["http", "https", "tcp", "udp_icmp", "icmp_ping", "smtp"] - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', - 'UDP-ICMP', and 'SMTP'. - """ diff --git a/src/cloudflare/types/user/load_balancers/pool_preview_response.py b/src/cloudflare/types/user/load_balancers/pool_preview_response.py deleted file mode 100644 index 606edb5783a..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_preview_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional - -from ...._models import BaseModel - -__all__ = ["PoolPreviewResponse"] - - -class PoolPreviewResponse(BaseModel): - pools: Optional[Dict[str, str]] = None - """Monitored pool IDs mapped to their respective names.""" - - preview_id: Optional[str] = None diff --git a/src/cloudflare/types/user/load_balancers/pool_references_response.py b/src/cloudflare/types/user/load_balancers/pool_references_response.py deleted file mode 100644 index 2dfacceb259..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_references_response.py +++ /dev/null @@ -1,21 +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__ = ["PoolReferencesResponse", "PoolReferencesResponseItem"] - - -class PoolReferencesResponseItem(BaseModel): - reference_type: Optional[Literal["*", "referral", "referrer"]] = None - - resource_id: Optional[str] = None - - resource_name: Optional[str] = None - - resource_type: Optional[str] = None - - -PoolReferencesResponse = List[PoolReferencesResponseItem] diff --git a/src/cloudflare/types/user/load_balancers/pool_update_params.py b/src/cloudflare/types/user/load_balancers/pool_update_params.py deleted file mode 100644 index e073f1cb377..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_update_params.py +++ /dev/null @@ -1,254 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = [ - "PoolUpdateParams", - "Origin", - "OriginHeader", - "LoadShedding", - "NotificationFilter", - "NotificationFilterOrigin", - "NotificationFilterPool", - "OriginSteering", -] - - -class PoolUpdateParams(TypedDict, total=False): - name: Required[str] - """A short name (tag) for the pool. - - Only alphanumeric characters, hyphens, and underscores are allowed. - """ - - origins: Required[Iterable[Origin]] - """The list of origins within this pool. - - Traffic directed at this pool is balanced across all currently healthy origins, - provided the pool itself is healthy. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "SAS", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means every Cloudflare data center. - """ - - description: str - """A human-readable description of the pool.""" - - enabled: bool - """Whether to enable (the default) or disable this pool. - - Disabled pools will not receive traffic and are excluded from health checks. - Disabling a pool will cause any load balancers using it to failover to the next - pool (if any). - """ - - latitude: float - """ - The latitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, longitude must also be set. - """ - - load_shedding: LoadShedding - """Configures load shedding policies and percentages for the pool.""" - - longitude: float - """ - The longitude of the data center containing the origins used in this pool in - decimal degrees. If this is set, latitude must also be set. - """ - - minimum_origins: int - """ - The minimum number of origins that must be healthy for this pool to serve - traffic. If the number of healthy origins falls below this number, the pool will - be marked unhealthy and will failover to the next available pool. - """ - - monitor: object - """ - The ID of the Monitor to use for checking the health of origins within this - pool. - """ - - notification_email: str - """This field is now deprecated. - - It has been moved to Cloudflare's Centralized Notification service - https://developers.cloudflare.com/fundamentals/notifications/. The email address - to send health status notifications to. This can be an individual mailbox or a - mailing list. Multiple emails can be supplied as a comma delimited list. - """ - - notification_filter: Optional[NotificationFilter] - """Filter pool and origin health notifications by resource type or health status. - - Use null to reset. - """ - - origin_steering: OriginSteering - """Configures origin steering for the pool. - - Controls how origins are selected for new sessions and traffic without session - affinity. - """ - - -class OriginHeader(TypedDict, total=False): - host: Annotated[List[str], PropertyInfo(alias="Host")] - """The 'Host' header allows to override the hostname set in the HTTP request. - - Current support is 1 'Host' header override per origin. - """ - - -class Origin(TypedDict, total=False): - address: str - """ - The IP address (IPv4 or IPv6) of the origin, or its publicly addressable - hostname. Hostnames entered here should resolve directly to the origin, and not - be a hostname proxied by Cloudflare. To set an internal/reserved address, - virtual_network_id must also be set. - """ - - enabled: bool - """Whether to enable (the default) this origin within the pool. - - Disabled origins will not receive traffic and are excluded from health checks. - The origin will only be disabled for the current pool. - """ - - header: OriginHeader - """The request header is used to pass additional information with an HTTP request. - - Currently supported header is 'Host'. - """ - - name: str - """A human-identifiable name for the origin.""" - - virtual_network_id: str - """The virtual network subnet ID the origin belongs in. - - Virtual network must also belong to the account. - """ - - weight: float - """The weight of this origin relative to other origins in the pool. - - Based on the configured weight the total traffic is distributed among origins - within the pool. - - - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the - origin's outstanding requests. - - `origin_steering.policy="least_connections"`: Use weight to scale the origin's - open connections. - """ - - -class LoadShedding(TypedDict, total=False): - default_percent: float - """The percent of traffic to shed from the pool, according to the default policy. - - Applies to new sessions and traffic without session affinity. - """ - - default_policy: Literal["random", "hash"] - """The default policy to use when load shedding. - - A random policy randomly sheds a given percent of requests. A hash policy - computes a hash over the CF-Connecting-IP address and sheds all requests - originating from a percent of IPs. - """ - - session_percent: float - """ - The percent of existing sessions to shed from the pool, according to the session - policy. - """ - - session_policy: Literal["hash"] - """ - Only the hash policy is supported for existing sessions (to avoid exponential - decay). - """ - - -class NotificationFilterOrigin(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilterPool(TypedDict, total=False): - disable: bool - """If set true, disable notifications for this type of resource (pool or origin).""" - - healthy: Optional[bool] - """If present, send notifications only for this health status (e.g. - - false for only DOWN events). Use null to reset (all events). - """ - - -class NotificationFilter(TypedDict, total=False): - origin: Optional[NotificationFilterOrigin] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - pool: Optional[NotificationFilterPool] - """Filter options for a particular resource type (pool or origin). - - Use null to reset. - """ - - -class OriginSteering(TypedDict, total=False): - policy: Literal["random", "hash", "least_outstanding_requests", "least_connections"] - """The type of origin steering policy to use. - - - `"random"`: Select an origin randomly. - - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP - address. - - `"least_outstanding_requests"`: Select an origin by taking into consideration - origin weights, as well as each origin's number of outstanding requests. - Origins with more pending requests are weighted proportionately less relative - to others. - - `"least_connections"`: Select an origin by taking into consideration origin - weights, as well as each origin's number of open connections. Origins with - more open connections are weighted proportionately less relative to others. - Supported for HTTP/1 and HTTP/2 connections. - """ diff --git a/src/cloudflare/types/user/organization.py b/src/cloudflare/types/user/organization.py index bd59f71e4b1..1db4388d7de 100644 --- a/src/cloudflare/types/user/organization.py +++ b/src/cloudflare/types/user/organization.py @@ -4,6 +4,7 @@ from typing_extensions import Literal from ..._models import BaseModel +from ..shared.permission import Permission __all__ = ["Organization"] @@ -15,7 +16,7 @@ class Organization(BaseModel): name: Optional[str] = None """Organization name.""" - permissions: Optional[List[str]] = None + permissions: Optional[List[Permission]] = None """Access permissions for this User.""" roles: Optional[List[str]] = None diff --git a/src/cloudflare/types/user/organization_delete_params.py b/src/cloudflare/types/user/organization_delete_params.py new file mode 100644 index 00000000000..0344f7e4d9a --- /dev/null +++ b/src/cloudflare/types/user/organization_delete_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["OrganizationDeleteParams"] + + +class OrganizationDeleteParams(TypedDict, total=False): + body: Required[object] diff --git a/src/cloudflare/types/user/policy.py b/src/cloudflare/types/user/policy.py new file mode 100644 index 00000000000..02bb3290430 --- /dev/null +++ b/src/cloudflare/types/user/policy.py @@ -0,0 +1,30 @@ +# 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__ = ["Policy", "PermissionGroup"] + + +class PermissionGroup(BaseModel): + id: str + """Identifier of the group.""" + + name: Optional[str] = None + """Name of the group.""" + + +class Policy(BaseModel): + id: str + """Policy identifier.""" + + effect: Literal["allow", "deny"] + """Allow or deny operations against the resources.""" + + permission_groups: List[PermissionGroup] + """A set of permission groups that are specified to the policy.""" + + resources: object + """A list of resource names that the policy applies to.""" diff --git a/src/cloudflare/types/user/policy_param.py b/src/cloudflare/types/user/policy_param.py new file mode 100644 index 00000000000..d9f62820fe7 --- /dev/null +++ b/src/cloudflare/types/user/policy_param.py @@ -0,0 +1,23 @@ +# 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__ = ["PolicyParam", "PermissionGroup"] + + +class PermissionGroup(TypedDict, total=False): + pass + + +class PolicyParam(TypedDict, total=False): + effect: Required[Literal["allow", "deny"]] + """Allow or deny operations against the resources.""" + + permission_groups: Required[Iterable[PermissionGroup]] + """A set of permission groups that are specified to the policy.""" + + resources: Required[object] + """A list of resource names that the policy applies to.""" diff --git a/src/cloudflare/types/user/rate_plan.py b/src/cloudflare/types/user/rate_plan.py new file mode 100644 index 00000000000..deab37dc61c --- /dev/null +++ b/src/cloudflare/types/user/rate_plan.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["RatePlan"] + + +class RatePlan(BaseModel): + id: Optional[str] = None + """The ID of the rate plan.""" + + currency: Optional[str] = None + """The currency applied to the rate plan subscription.""" + + externally_managed: Optional[bool] = None + """Whether this rate plan is managed externally from Cloudflare.""" + + is_contract: Optional[bool] = None + """Whether a rate plan is enterprise-based (or newly adopted term contract).""" + + public_name: Optional[str] = None + """The full name of the rate plan.""" + + scope: Optional[str] = None + """The scope that this rate plan applies to.""" + + sets: Optional[List[str]] = None + """The list of sets this rate plan applies to.""" diff --git a/src/cloudflare/types/user/rate_plan_param.py b/src/cloudflare/types/user/rate_plan_param.py new file mode 100644 index 00000000000..a937bcdf0f0 --- /dev/null +++ b/src/cloudflare/types/user/rate_plan_param.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 List +from typing_extensions import TypedDict + +__all__ = ["RatePlanParam"] + + +class RatePlanParam(TypedDict, total=False): + id: str + """The ID of the rate plan.""" + + currency: str + """The currency applied to the rate plan subscription.""" + + externally_managed: bool + """Whether this rate plan is managed externally from Cloudflare.""" + + is_contract: bool + """Whether a rate plan is enterprise-based (or newly adopted term contract).""" + + public_name: str + """The full name of the rate plan.""" + + scope: str + """The scope that this rate plan applies to.""" + + sets: List[str] + """The list of sets this rate plan applies to.""" diff --git a/src/cloudflare/types/user/subscription.py b/src/cloudflare/types/user/subscription.py new file mode 100644 index 00000000000..1265c4f04cc --- /dev/null +++ b/src/cloudflare/types/user/subscription.py @@ -0,0 +1,54 @@ +# 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 +from .rate_plan import RatePlan +from .subscription_zone import SubscriptionZone +from .subscription_component import SubscriptionComponent + +__all__ = ["Subscription", "App"] + + +class App(BaseModel): + install_id: Optional[str] = None + """app install id.""" + + +class Subscription(BaseModel): + id: Optional[str] = None + """Subscription identifier tag.""" + + app: Optional[App] = None + + component_values: Optional[List[SubscriptionComponent]] = None + """The list of add-ons subscribed to.""" + + currency: Optional[str] = None + """The monetary unit in which pricing information is displayed.""" + + current_period_end: Optional[datetime] = None + """The end of the current period and also when the next billing is due.""" + + current_period_start: Optional[datetime] = None + """When the current billing period started. + + May match initial_period_start if this is the first period. + """ + + frequency: Optional[Literal["weekly", "monthly", "quarterly", "yearly"]] = None + """How often the subscription is renewed automatically.""" + + price: Optional[float] = None + """The price of the subscription that will be billed, in US dollars.""" + + rate_plan: Optional[RatePlan] = None + """The rate plan applied to the subscription.""" + + state: Optional[Literal["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]] = None + """The state that the subscription is in.""" + + zone: Optional[SubscriptionZone] = None + """A simple zone object. May have null properties if not a zone subscription.""" diff --git a/src/cloudflare/types/user/subscription_component.py b/src/cloudflare/types/user/subscription_component.py new file mode 100644 index 00000000000..3bfb3faf7b6 --- /dev/null +++ b/src/cloudflare/types/user/subscription_component.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["SubscriptionComponent"] + + +class SubscriptionComponent(BaseModel): + default: Optional[float] = None + """The default amount assigned.""" + + name: Optional[str] = None + """The name of the component value.""" + + price: Optional[float] = None + """The unit price for the component value.""" + + value: Optional[float] = None + """The amount of the component value assigned.""" diff --git a/src/cloudflare/types/user/subscription_component_param.py b/src/cloudflare/types/user/subscription_component_param.py new file mode 100644 index 00000000000..958846faedd --- /dev/null +++ b/src/cloudflare/types/user/subscription_component_param.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 TypedDict + +__all__ = ["SubscriptionComponentParam"] + + +class SubscriptionComponentParam(TypedDict, total=False): + default: float + """The default amount assigned.""" + + name: str + """The name of the component value.""" + + price: float + """The unit price for the component value.""" + + value: float + """The amount of the component value assigned.""" diff --git a/src/cloudflare/types/user/subscription_delete_params.py b/src/cloudflare/types/user/subscription_delete_params.py new file mode 100644 index 00000000000..1f60057b206 --- /dev/null +++ b/src/cloudflare/types/user/subscription_delete_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SubscriptionDeleteParams"] + + +class SubscriptionDeleteParams(TypedDict, total=False): + body: Required[object] diff --git a/src/cloudflare/types/user/subscription_edit_params.py b/src/cloudflare/types/user/subscription_edit_params.py index 6a56403b8b8..42587341cbe 100644 --- a/src/cloudflare/types/user/subscription_edit_params.py +++ b/src/cloudflare/types/user/subscription_edit_params.py @@ -2,69 +2,32 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, TypedDict -__all__ = ["SubscriptionEditParams", "App", "ComponentValue", "RatePlan", "Zone"] +from .rate_plan_param import RatePlanParam +from .subscription_zone_param import SubscriptionZoneParam +from .subscription_component_param import SubscriptionComponentParam + +__all__ = ["SubscriptionEditParams", "App"] class SubscriptionEditParams(TypedDict, total=False): app: App - component_values: Iterable[ComponentValue] + component_values: Iterable[SubscriptionComponentParam] """The list of add-ons subscribed to.""" frequency: Literal["weekly", "monthly", "quarterly", "yearly"] """How often the subscription is renewed automatically.""" - rate_plan: RatePlan + rate_plan: RatePlanParam """The rate plan applied to the subscription.""" - zone: Zone + zone: SubscriptionZoneParam """A simple zone object. May have null properties if not a zone subscription.""" class App(TypedDict, total=False): install_id: str """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/user/subscription_get_response.py b/src/cloudflare/types/user/subscription_get_response.py index 47a3a862044..fa83d5ed88c 100644 --- a/src/cloudflare/types/user/subscription_get_response.py +++ b/src/cloudflare/types/user/subscription_get_response.py @@ -1,106 +1,9 @@ # 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 typing import List -from ..._models import BaseModel +from .subscription import Subscription -__all__ = [ - "SubscriptionGetResponse", - "SubscriptionGetResponseItem", - "SubscriptionGetResponseItemApp", - "SubscriptionGetResponseItemComponentValue", - "SubscriptionGetResponseItemRatePlan", - "SubscriptionGetResponseItemZone", -] +__all__ = ["SubscriptionGetResponse"] - -class SubscriptionGetResponseItemApp(BaseModel): - install_id: Optional[str] = None - """app install id.""" - - -class SubscriptionGetResponseItemComponentValue(BaseModel): - default: Optional[float] = None - """The default amount assigned.""" - - name: Optional[str] = None - """The name of the component value.""" - - price: Optional[float] = None - """The unit price for the component value.""" - - value: Optional[float] = None - """The amount of the component value assigned.""" - - -class SubscriptionGetResponseItemRatePlan(BaseModel): - id: Optional[str] = None - """The ID of the rate plan.""" - - currency: Optional[str] = None - """The currency applied to the rate plan subscription.""" - - externally_managed: Optional[bool] = None - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: Optional[bool] = None - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: Optional[str] = None - """The full name of the rate plan.""" - - scope: Optional[str] = None - """The scope that this rate plan applies to.""" - - sets: Optional[List[str]] = None - """The list of sets this rate plan applies to.""" - - -class SubscriptionGetResponseItemZone(BaseModel): - id: Optional[str] = None - """Identifier""" - - name: Optional[str] = None - """The domain name""" - - -class SubscriptionGetResponseItem(BaseModel): - id: Optional[str] = None - """Subscription identifier tag.""" - - app: Optional[SubscriptionGetResponseItemApp] = None - - component_values: Optional[List[SubscriptionGetResponseItemComponentValue]] = None - """The list of add-ons subscribed to.""" - - currency: Optional[str] = None - """The monetary unit in which pricing information is displayed.""" - - current_period_end: Optional[datetime] = None - """The end of the current period and also when the next billing is due.""" - - current_period_start: Optional[datetime] = None - """When the current billing period started. - - May match initial_period_start if this is the first period. - """ - - frequency: Optional[Literal["weekly", "monthly", "quarterly", "yearly"]] = None - """How often the subscription is renewed automatically.""" - - price: Optional[float] = None - """The price of the subscription that will be billed, in US dollars.""" - - rate_plan: Optional[SubscriptionGetResponseItemRatePlan] = None - """The rate plan applied to the subscription.""" - - state: Optional[Literal["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]] = None - """The state that the subscription is in.""" - - zone: Optional[SubscriptionGetResponseItemZone] = None - """A simple zone object. May have null properties if not a zone subscription.""" - - -SubscriptionGetResponse = List[SubscriptionGetResponseItem] +SubscriptionGetResponse = List[Subscription] diff --git a/src/cloudflare/types/user/subscription_update_params.py b/src/cloudflare/types/user/subscription_update_params.py index b131772a989..e0114c776e4 100644 --- a/src/cloudflare/types/user/subscription_update_params.py +++ b/src/cloudflare/types/user/subscription_update_params.py @@ -2,69 +2,32 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, TypedDict -__all__ = ["SubscriptionUpdateParams", "App", "ComponentValue", "RatePlan", "Zone"] +from .rate_plan_param import RatePlanParam +from .subscription_zone_param import SubscriptionZoneParam +from .subscription_component_param import SubscriptionComponentParam + +__all__ = ["SubscriptionUpdateParams", "App"] class SubscriptionUpdateParams(TypedDict, total=False): app: App - component_values: Iterable[ComponentValue] + component_values: Iterable[SubscriptionComponentParam] """The list of add-ons subscribed to.""" frequency: Literal["weekly", "monthly", "quarterly", "yearly"] """How often the subscription is renewed automatically.""" - rate_plan: RatePlan + rate_plan: RatePlanParam """The rate plan applied to the subscription.""" - zone: Zone + zone: SubscriptionZoneParam """A simple zone object. May have null properties if not a zone subscription.""" class App(TypedDict, total=False): install_id: str """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/user/subscription_zone.py b/src/cloudflare/types/user/subscription_zone.py new file mode 100644 index 00000000000..353d7100d9b --- /dev/null +++ b/src/cloudflare/types/user/subscription_zone.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__ = ["SubscriptionZone"] + + +class SubscriptionZone(BaseModel): + id: Optional[str] = None + """Identifier""" + + name: Optional[str] = None + """The domain name""" diff --git a/src/cloudflare/types/user/subscription_zone_param.py b/src/cloudflare/types/user/subscription_zone_param.py new file mode 100644 index 00000000000..5cc2fcb6b0c --- /dev/null +++ b/src/cloudflare/types/user/subscription_zone_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SubscriptionZoneParam"] + + +class SubscriptionZoneParam(TypedDict, total=False): + pass diff --git a/src/cloudflare/types/user/token_create_params.py b/src/cloudflare/types/user/token_create_params.py index 1a0f5035187..4ab228c06c6 100644 --- a/src/cloudflare/types/user/token_create_params.py +++ b/src/cloudflare/types/user/token_create_params.py @@ -4,18 +4,20 @@ from typing import List, Union, Iterable from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo +from .cidr_list import CIDRList +from .policy_param import PolicyParam -__all__ = ["TokenCreateParams", "Policy", "PolicyPermissionGroup", "Condition", "ConditionRequestIP"] +__all__ = ["TokenCreateParams", "Condition", "ConditionRequestIP"] class TokenCreateParams(TypedDict, total=False): name: Required[str] """Token name.""" - policies: Required[Iterable[Policy]] + policies: Required[Iterable[PolicyParam]] """List of access policies assigned to the token.""" condition: Condition @@ -30,32 +32,17 @@ class TokenCreateParams(TypedDict, total=False): """The time before which the token MUST NOT be accepted for processing.""" -class PolicyPermissionGroup(TypedDict, total=False): - pass - - -class Policy(TypedDict, total=False): - effect: Required[Literal["allow", "deny"]] - """Allow or deny operations against the resources.""" - - permission_groups: Required[Iterable[PolicyPermissionGroup]] - """A set of permission groups that are specified to the policy.""" - - resources: Required[object] - """A list of resource names that the policy applies to.""" - - _ConditionRequestIPReservedKeywords = TypedDict( "_ConditionRequestIPReservedKeywords", { - "in": List[str], + "in": List[CIDRList], }, total=False, ) class ConditionRequestIP(_ConditionRequestIPReservedKeywords, total=False): - not_in: List[str] + not_in: List[CIDRList] """List of IPv4/IPv6 CIDR addresses.""" diff --git a/src/cloudflare/types/user/token_create_response.py b/src/cloudflare/types/user/token_create_response.py index 45701a4c3f1..4d68a326873 100644 --- a/src/cloudflare/types/user/token_create_response.py +++ b/src/cloudflare/types/user/token_create_response.py @@ -2,12 +2,12 @@ from typing import Optional -from .tokens import TokenValue from ..._models import BaseModel +from .tokens.value import Value __all__ = ["TokenCreateResponse"] class TokenCreateResponse(BaseModel): - value: Optional[TokenValue] = None + value: Optional[Value] = None """The token value.""" diff --git a/src/cloudflare/types/user/token_delete_params.py b/src/cloudflare/types/user/token_delete_params.py new file mode 100644 index 00000000000..6b9d4f8abef --- /dev/null +++ b/src/cloudflare/types/user/token_delete_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["TokenDeleteParams"] + + +class TokenDeleteParams(TypedDict, total=False): + body: Required[object] diff --git a/src/cloudflare/types/user/token_update_params.py b/src/cloudflare/types/user/token_update_params.py index c7816503b2d..d564213465b 100644 --- a/src/cloudflare/types/user/token_update_params.py +++ b/src/cloudflare/types/user/token_update_params.py @@ -7,15 +7,17 @@ from typing_extensions import Literal, Required, Annotated, TypedDict from ..._utils import PropertyInfo +from .cidr_list import CIDRList +from .policy_param import PolicyParam -__all__ = ["TokenUpdateParams", "Policy", "PolicyPermissionGroup", "Condition", "ConditionRequestIP"] +__all__ = ["TokenUpdateParams", "Condition", "ConditionRequestIP"] class TokenUpdateParams(TypedDict, total=False): name: Required[str] """Token name.""" - policies: Required[Iterable[Policy]] + policies: Required[Iterable[PolicyParam]] """List of access policies assigned to the token.""" status: Required[Literal["active", "disabled", "expired"]] @@ -33,32 +35,17 @@ class TokenUpdateParams(TypedDict, total=False): """The time before which the token MUST NOT be accepted for processing.""" -class PolicyPermissionGroup(TypedDict, total=False): - pass - - -class Policy(TypedDict, total=False): - effect: Required[Literal["allow", "deny"]] - """Allow or deny operations against the resources.""" - - permission_groups: Required[Iterable[PolicyPermissionGroup]] - """A set of permission groups that are specified to the policy.""" - - resources: Required[object] - """A list of resource names that the policy applies to.""" - - _ConditionRequestIPReservedKeywords = TypedDict( "_ConditionRequestIPReservedKeywords", { - "in": List[str], + "in": List[CIDRList], }, total=False, ) class ConditionRequestIP(_ConditionRequestIPReservedKeywords, total=False): - not_in: List[str] + not_in: List[CIDRList] """List of IPv4/IPv6 CIDR addresses.""" diff --git a/src/cloudflare/types/user/tokens/__init__.py b/src/cloudflare/types/user/tokens/__init__.py index 11148d0023c..b2609995ed7 100644 --- a/src/cloudflare/types/user/tokens/__init__.py +++ b/src/cloudflare/types/user/tokens/__init__.py @@ -2,5 +2,5 @@ from __future__ import annotations -from .token_value import TokenValue as TokenValue +from .value import Value as Value from .value_update_params import ValueUpdateParams as ValueUpdateParams diff --git a/src/cloudflare/types/user/tokens/token_value.py b/src/cloudflare/types/user/tokens/token_value.py deleted file mode 100644 index 8087bf31b1e..00000000000 --- a/src/cloudflare/types/user/tokens/token_value.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -__all__ = ["TokenValue"] - -TokenValue = str diff --git a/src/cloudflare/types/user/tokens/value.py b/src/cloudflare/types/user/tokens/value.py new file mode 100644 index 00000000000..669b0678918 --- /dev/null +++ b/src/cloudflare/types/user/tokens/value.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["Value"] + +Value = str diff --git a/src/cloudflare/types/user/user.py b/src/cloudflare/types/user/user.py deleted file mode 100644 index 1e5679f21a7..00000000000 --- a/src/cloudflare/types/user/user.py +++ /dev/null @@ -1,48 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["User"] - - -class User(BaseModel): - address: str - """Address.""" - - city: str - """City.""" - - country: Optional[str] = None - """The country in which the user lives.""" - - first_name: Optional[str] = None - """User's first name""" - - last_name: Optional[str] = None - """User's last name""" - - organization: str - """Name of organization.""" - - phone: Optional[str] = None - """User's telephone number""" - - state: str - """State.""" - - zip: Optional[str] = None - """The zipcode or postal code where the user lives.""" - - id: Optional[str] = None - """Contact Identifier.""" - - address2: Optional[str] = None - """Optional address line for unit, floor, suite, etc.""" - - email: Optional[str] = None - """The contact email address of the user.""" - - fax: Optional[str] = None - """Contact fax number.""" diff --git a/src/cloudflare/types/user_edit_params.py b/src/cloudflare/types/user/user_edit_params.py similarity index 100% rename from src/cloudflare/types/user_edit_params.py rename to src/cloudflare/types/user/user_edit_params.py diff --git a/src/cloudflare/types/user_edit_response.py b/src/cloudflare/types/user/user_edit_response.py similarity index 100% rename from src/cloudflare/types/user_edit_response.py rename to src/cloudflare/types/user/user_edit_response.py diff --git a/src/cloudflare/types/user_get_response.py b/src/cloudflare/types/user/user_get_response.py similarity index 100% rename from src/cloudflare/types/user_get_response.py rename to src/cloudflare/types/user/user_get_response.py diff --git a/src/cloudflare/types/vectorize/__init__.py b/src/cloudflare/types/vectorize/__init__.py index 2abd20d71b2..756fca55ae5 100644 --- a/src/cloudflare/types/vectorize/__init__.py +++ b/src/cloudflare/types/vectorize/__init__.py @@ -2,14 +2,18 @@ from __future__ import annotations +from .index_query import IndexQuery as IndexQuery +from .create_index import CreateIndex as CreateIndex +from .index_insert import IndexInsert as IndexInsert +from .index_upsert import IndexUpsert as IndexUpsert from .index_query_params import IndexQueryParams as IndexQueryParams from .index_create_params import IndexCreateParams as IndexCreateParams +from .index_insert_params import IndexInsertParams as IndexInsertParams from .index_update_params import IndexUpdateParams as IndexUpdateParams +from .index_upsert_params import IndexUpsertParams as IndexUpsertParams from .index_delete_response import IndexDeleteResponse as IndexDeleteResponse -from .vectorize_index_query import VectorizeIndexQuery as VectorizeIndexQuery -from .vectorize_create_index import VectorizeCreateIndex as VectorizeCreateIndex -from .vectorize_index_insert import VectorizeIndexInsert as VectorizeIndexInsert -from .vectorize_index_upsert import VectorizeIndexUpsert as VectorizeIndexUpsert from .index_get_by_ids_params import IndexGetByIDsParams as IndexGetByIDsParams from .index_delete_by_ids_params import IndexDeleteByIDsParams as IndexDeleteByIDsParams -from .vectorize_index_delete_vectors_by_id import VectorizeIndexDeleteVectorsByID as VectorizeIndexDeleteVectorsByID +from .index_delete_vectors_by_id import IndexDeleteVectorsByID as IndexDeleteVectorsByID +from .index_dimension_configuration import IndexDimensionConfiguration as IndexDimensionConfiguration +from .index_dimension_configuration_param import IndexDimensionConfigurationParam as IndexDimensionConfigurationParam diff --git a/src/cloudflare/types/vectorize/create_index.py b/src/cloudflare/types/vectorize/create_index.py new file mode 100644 index 00000000000..e28d4e352d4 --- /dev/null +++ b/src/cloudflare/types/vectorize/create_index.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .index_dimension_configuration import IndexDimensionConfiguration + +__all__ = ["CreateIndex"] + + +class CreateIndex(BaseModel): + config: Optional[IndexDimensionConfiguration] = None + + created_on: Optional[str] = None + """Specifies the timestamp the resource was created as an ISO8601 string.""" + + description: Optional[str] = None + """Specifies the description of the index.""" + + modified_on: Optional[str] = None + """Specifies the timestamp the resource was modified as an ISO8601 string.""" + + name: Optional[str] = None diff --git a/src/cloudflare/types/vectorize/index_create_params.py b/src/cloudflare/types/vectorize/index_create_params.py index 914d89c4ed3..cd89ecd2673 100644 --- a/src/cloudflare/types/vectorize/index_create_params.py +++ b/src/cloudflare/types/vectorize/index_create_params.py @@ -5,15 +5,15 @@ from typing import Union from typing_extensions import Literal, Required, TypedDict -__all__ = [ - "IndexCreateParams", - "Config", - "ConfigVectorizeIndexPresetConfiguration", - "ConfigVectorizeIndexDimensionConfiguration", -] +from .index_dimension_configuration_param import IndexDimensionConfigurationParam + +__all__ = ["IndexCreateParams", "Config", "ConfigVectorizeIndexPresetConfiguration"] class IndexCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + config: Required[Config] """Specifies the type of configuration to use for the index.""" @@ -36,12 +36,4 @@ class ConfigVectorizeIndexPresetConfiguration(TypedDict, total=False): """Specifies the preset to use for the index.""" -class ConfigVectorizeIndexDimensionConfiguration(TypedDict, total=False): - dimensions: Required[int] - """Specifies the number of dimensions for the index""" - - metric: Required[Literal["cosine", "euclidean", "dot-product"]] - """Specifies the type of metric to use calculating distance.""" - - -Config = Union[ConfigVectorizeIndexPresetConfiguration, ConfigVectorizeIndexDimensionConfiguration] +Config = Union[IndexDimensionConfigurationParam, ConfigVectorizeIndexPresetConfiguration] diff --git a/src/cloudflare/types/vectorize/index_delete_by_ids_params.py b/src/cloudflare/types/vectorize/index_delete_by_ids_params.py index a9416916892..606c8b152f2 100644 --- a/src/cloudflare/types/vectorize/index_delete_by_ids_params.py +++ b/src/cloudflare/types/vectorize/index_delete_by_ids_params.py @@ -9,7 +9,7 @@ class IndexDeleteByIDsParams(TypedDict, total=False): - account_identifier: Required[str] + account_id: Required[str] """Identifier""" ids: List[str] diff --git a/src/cloudflare/types/vectorize/index_delete_response.py b/src/cloudflare/types/vectorize/index_delete_response.py index 813386c525b..b64904cdd6e 100644 --- a/src/cloudflare/types/vectorize/index_delete_response.py +++ b/src/cloudflare/types/vectorize/index_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["IndexDeleteResponse"] -IndexDeleteResponse = Union[str, object, None] +IndexDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/vectorize/index_delete_vectors_by_id.py b/src/cloudflare/types/vectorize/index_delete_vectors_by_id.py new file mode 100644 index 00000000000..b06650b76cb --- /dev/null +++ b/src/cloudflare/types/vectorize/index_delete_vectors_by_id.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["IndexDeleteVectorsByID"] + + +class IndexDeleteVectorsByID(BaseModel): + count: Optional[int] = None + """The count of the vectors successfully deleted.""" + + ids: Optional[List[str]] = None + """ + Array of vector identifiers of the vectors that were successfully processed for + deletion. + """ diff --git a/src/cloudflare/types/vectorize/index_dimension_configuration.py b/src/cloudflare/types/vectorize/index_dimension_configuration.py new file mode 100644 index 00000000000..f9450682916 --- /dev/null +++ b/src/cloudflare/types/vectorize/index_dimension_configuration.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["IndexDimensionConfiguration"] + + +class IndexDimensionConfiguration(BaseModel): + dimensions: int + """Specifies the number of dimensions for the index""" + + metric: Literal["cosine", "euclidean", "dot-product"] + """Specifies the type of metric to use calculating distance.""" diff --git a/src/cloudflare/types/vectorize/index_dimension_configuration_param.py b/src/cloudflare/types/vectorize/index_dimension_configuration_param.py new file mode 100644 index 00000000000..13c383d6dc2 --- /dev/null +++ b/src/cloudflare/types/vectorize/index_dimension_configuration_param.py @@ -0,0 +1,15 @@ +# 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__ = ["IndexDimensionConfigurationParam"] + + +class IndexDimensionConfigurationParam(TypedDict, total=False): + dimensions: Required[int] + """Specifies the number of dimensions for the index""" + + metric: Required[Literal["cosine", "euclidean", "dot-product"]] + """Specifies the type of metric to use calculating distance.""" diff --git a/src/cloudflare/types/vectorize/index_get_by_ids_params.py b/src/cloudflare/types/vectorize/index_get_by_ids_params.py index d29234183c1..89fdd20578e 100644 --- a/src/cloudflare/types/vectorize/index_get_by_ids_params.py +++ b/src/cloudflare/types/vectorize/index_get_by_ids_params.py @@ -9,7 +9,7 @@ class IndexGetByIDsParams(TypedDict, total=False): - account_identifier: Required[str] + account_id: Required[str] """Identifier""" ids: List[str] diff --git a/src/cloudflare/types/vectorize/index_insert.py b/src/cloudflare/types/vectorize/index_insert.py new file mode 100644 index 00000000000..17cc6ecbe4b --- /dev/null +++ b/src/cloudflare/types/vectorize/index_insert.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__ = ["IndexInsert"] + + +class IndexInsert(BaseModel): + count: Optional[int] = None + """Specifies the count of the vectors successfully inserted.""" + + ids: Optional[List[str]] = None + """Array of vector identifiers of the vectors successfully inserted.""" diff --git a/src/cloudflare/types/vectorize/index_insert_params.py b/src/cloudflare/types/vectorize/index_insert_params.py new file mode 100644 index 00000000000..d5a829f9ee3 --- /dev/null +++ b/src/cloudflare/types/vectorize/index_insert_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__ = ["IndexInsertParams"] + + +class IndexInsertParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/vectorize/index_query.py b/src/cloudflare/types/vectorize/index_query.py new file mode 100644 index 00000000000..11de5c950e0 --- /dev/null +++ b/src/cloudflare/types/vectorize/index_query.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["IndexQuery", "Match"] + + +class Match(BaseModel): + id: Optional[str] = None + """Identifier""" + + metadata: Optional[object] = None + + score: Optional[float] = None + """The score of the vector according to the index's distance metric""" + + values: Optional[List[float]] = None + + +class IndexQuery(BaseModel): + count: Optional[int] = None + """Specifies the count of vectors returned by the search""" + + matches: Optional[List[Match]] = None + """Array of vectors matched by the search""" diff --git a/src/cloudflare/types/vectorize/index_query_params.py b/src/cloudflare/types/vectorize/index_query_params.py index e4853aa0ba5..97fe6efc32d 100644 --- a/src/cloudflare/types/vectorize/index_query_params.py +++ b/src/cloudflare/types/vectorize/index_query_params.py @@ -11,9 +11,15 @@ class IndexQueryParams(TypedDict, total=False): - account_identifier: Required[str] + account_id: Required[str] """Identifier""" + vector: Required[Iterable[float]] + """The search vector that will be used to find the nearest neighbors.""" + + filter: object + """A metadata filter expression used to limit nearest neighbor results.""" + return_metadata: Annotated[bool, PropertyInfo(alias="returnMetadata")] """Whether to return the metadata associated with the closest vectors.""" @@ -22,6 +28,3 @@ class IndexQueryParams(TypedDict, total=False): top_k: Annotated[float, PropertyInfo(alias="topK")] """The number of nearest neighbors to find.""" - - vector: Iterable[float] - """The search vector that will be used to find the nearest neighbors.""" diff --git a/src/cloudflare/types/vectorize/index_update_params.py b/src/cloudflare/types/vectorize/index_update_params.py index 57f2ab477d4..2cb1ad85804 100644 --- a/src/cloudflare/types/vectorize/index_update_params.py +++ b/src/cloudflare/types/vectorize/index_update_params.py @@ -8,7 +8,7 @@ class IndexUpdateParams(TypedDict, total=False): - account_identifier: Required[str] + account_id: Required[str] """Identifier""" description: Required[str] diff --git a/src/cloudflare/types/vectorize/index_upsert.py b/src/cloudflare/types/vectorize/index_upsert.py new file mode 100644 index 00000000000..400b88324fa --- /dev/null +++ b/src/cloudflare/types/vectorize/index_upsert.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__ = ["IndexUpsert"] + + +class IndexUpsert(BaseModel): + count: Optional[int] = None + """Specifies the count of the vectors successfully inserted.""" + + ids: Optional[List[str]] = None + """Array of vector identifiers of the vectors successfully inserted.""" diff --git a/src/cloudflare/types/vectorize/index_upsert_params.py b/src/cloudflare/types/vectorize/index_upsert_params.py new file mode 100644 index 00000000000..6b187a77059 --- /dev/null +++ b/src/cloudflare/types/vectorize/index_upsert_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__ = ["IndexUpsertParams"] + + +class IndexUpsertParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/vectorize/vectorize_create_index.py b/src/cloudflare/types/vectorize/vectorize_create_index.py deleted file mode 100644 index 62d78f0b633..00000000000 --- a/src/cloudflare/types/vectorize/vectorize_create_index.py +++ /dev/null @@ -1,31 +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__ = ["VectorizeCreateIndex", "Config"] - - -class Config(BaseModel): - dimensions: int - """Specifies the number of dimensions for the index""" - - metric: Literal["cosine", "euclidean", "dot-product"] - """Specifies the type of metric to use calculating distance.""" - - -class VectorizeCreateIndex(BaseModel): - config: Optional[Config] = None - - created_on: Optional[str] = None - """Specifies the timestamp the resource was created as an ISO8601 string.""" - - description: Optional[str] = None - """Specifies the description of the index.""" - - modified_on: Optional[str] = None - """Specifies the timestamp the resource was modified as an ISO8601 string.""" - - name: Optional[str] = None diff --git a/src/cloudflare/types/vectorize/vectorize_index_delete_vectors_by_id.py b/src/cloudflare/types/vectorize/vectorize_index_delete_vectors_by_id.py deleted file mode 100644 index 529836ab63e..00000000000 --- a/src/cloudflare/types/vectorize/vectorize_index_delete_vectors_by_id.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["VectorizeIndexDeleteVectorsByID"] - - -class VectorizeIndexDeleteVectorsByID(BaseModel): - count: Optional[int] = None - """The count of the vectors successfully deleted.""" - - ids: Optional[List[str]] = None - """ - Array of vector identifiers of the vectors that were successfully processed for - deletion. - """ diff --git a/src/cloudflare/types/vectorize/vectorize_index_insert.py b/src/cloudflare/types/vectorize/vectorize_index_insert.py deleted file mode 100644 index 6e5d18853aa..00000000000 --- a/src/cloudflare/types/vectorize/vectorize_index_insert.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["VectorizeIndexInsert"] - - -class VectorizeIndexInsert(BaseModel): - count: Optional[int] = None - """Specifies the count of the vectors successfully inserted.""" - - ids: Optional[List[str]] = None - """Array of vector identifiers of the vectors successfully inserted.""" diff --git a/src/cloudflare/types/vectorize/vectorize_index_query.py b/src/cloudflare/types/vectorize/vectorize_index_query.py deleted file mode 100644 index c00ef6f19e5..00000000000 --- a/src/cloudflare/types/vectorize/vectorize_index_query.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["VectorizeIndexQuery", "Match"] - - -class Match(BaseModel): - id: Optional[str] = None - """Identifier""" - - metadata: Optional[object] = None - - score: Optional[float] = None - """The score of the vector according to the index's distance metric""" - - values: Optional[List[float]] = None - - -class VectorizeIndexQuery(BaseModel): - count: Optional[int] = None - """Specifies the count of vectors returned by the search""" - - matches: Optional[List[Match]] = None - """Array of vectors matched by the search""" diff --git a/src/cloudflare/types/vectorize/vectorize_index_upsert.py b/src/cloudflare/types/vectorize/vectorize_index_upsert.py deleted file mode 100644 index b0903513f36..00000000000 --- a/src/cloudflare/types/vectorize/vectorize_index_upsert.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["VectorizeIndexUpsert"] - - -class VectorizeIndexUpsert(BaseModel): - count: Optional[int] = None - """Specifies the count of the vectors successfully inserted.""" - - ids: Optional[List[str]] = None - """Array of vector identifiers of the vectors successfully inserted.""" diff --git a/src/cloudflare/types/waiting_rooms/__init__.py b/src/cloudflare/types/waiting_rooms/__init__.py index 0ca5f4aadf1..28092b72bf5 100644 --- a/src/cloudflare/types/waiting_rooms/__init__.py +++ b/src/cloudflare/types/waiting_rooms/__init__.py @@ -2,14 +2,21 @@ from __future__ import annotations +from .event import Event as Event +from .setting import Setting as Setting +from .waiting_room import WaitingRoom as WaitingRoom from .rule_edit_params import RuleEditParams as RuleEditParams -from .waitingroom_rule import WaitingroomRule as WaitingroomRule +from .additional_routes import AdditionalRoutes as AdditionalRoutes +from .cookie_attributes import CookieAttributes as CookieAttributes from .event_edit_params import EventEditParams as EventEditParams -from .waitingroom_event import WaitingroomEvent as WaitingroomEvent +from .event_list_params import EventListParams as EventListParams +from .waiting_room_rule import WaitingRoomRule as WaitingRoomRule from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_delete_params import RuleDeleteParams as RuleDeleteParams from .rule_edit_response import RuleEditResponse as RuleEditResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams from .event_create_params import EventCreateParams as EventCreateParams +from .event_delete_params import EventDeleteParams as EventDeleteParams from .event_update_params import EventUpdateParams as EventUpdateParams from .page_preview_params import PagePreviewParams as PagePreviewParams from .setting_edit_params import SettingEditParams as SettingEditParams @@ -22,4 +29,12 @@ from .page_preview_response import PagePreviewResponse as PagePreviewResponse from .setting_edit_response import SettingEditResponse as SettingEditResponse from .setting_update_params import SettingUpdateParams as SettingUpdateParams +from .additional_routes_param import AdditionalRoutesParam as AdditionalRoutesParam +from .cookie_attributes_param import CookieAttributesParam as CookieAttributesParam from .setting_update_response import SettingUpdateResponse as SettingUpdateResponse +from .waiting_room_edit_params import WaitingRoomEditParams as WaitingRoomEditParams +from .waiting_room_list_params import WaitingRoomListParams as WaitingRoomListParams +from .waiting_room_create_params import WaitingRoomCreateParams as WaitingRoomCreateParams +from .waiting_room_delete_params import WaitingRoomDeleteParams as WaitingRoomDeleteParams +from .waiting_room_update_params import WaitingRoomUpdateParams as WaitingRoomUpdateParams +from .waiting_room_delete_response import WaitingRoomDeleteResponse as WaitingRoomDeleteResponse diff --git a/src/cloudflare/types/waiting_rooms/additional_routes.py b/src/cloudflare/types/waiting_rooms/additional_routes.py new file mode 100644 index 00000000000..5f3d576b32c --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/additional_routes.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["AdditionalRoutes"] + + +class AdditionalRoutes(BaseModel): + host: Optional[str] = None + """The hostname to which this waiting room will be applied (no wildcards). + + The hostname must be the primary domain, subdomain, or custom hostname (if using + SSL for SaaS) of this zone. Please do not include the scheme (http:// or + https://). + """ + + path: Optional[str] = None + """Sets the path within the host to enable the waiting room on. + + The waiting room will be enabled for all subpaths as well. If there are two + waiting rooms on the same subpath, the waiting room for the most specific path + will be chosen. Wildcards and query parameters are not supported. + """ diff --git a/src/cloudflare/types/waiting_rooms/additional_routes_param.py b/src/cloudflare/types/waiting_rooms/additional_routes_param.py new file mode 100644 index 00000000000..15e87927ff3 --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/additional_routes_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["AdditionalRoutesParam"] + + +class AdditionalRoutesParam(TypedDict, total=False): + host: str + """The hostname to which this waiting room will be applied (no wildcards). + + The hostname must be the primary domain, subdomain, or custom hostname (if using + SSL for SaaS) of this zone. Please do not include the scheme (http:// or + https://). + """ + + path: str + """Sets the path within the host to enable the waiting room on. + + The waiting room will be enabled for all subpaths as well. If there are two + waiting rooms on the same subpath, the waiting room for the most specific path + will be chosen. Wildcards and query parameters are not supported. + """ diff --git a/src/cloudflare/types/waiting_rooms/cookie_attributes.py b/src/cloudflare/types/waiting_rooms/cookie_attributes.py new file mode 100644 index 00000000000..d757eb26275 --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/cookie_attributes.py @@ -0,0 +1,26 @@ +# 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__ = ["CookieAttributes"] + + +class CookieAttributes(BaseModel): + samesite: Optional[Literal["auto", "lax", "none", "strict"]] = None + """Configures the SameSite attribute on the waiting room cookie. + + Value `auto` will be translated to `lax` or `none` depending if **Always Use + HTTPS** is enabled. Note that when using value `none`, the secure attribute + cannot be set to `never`. + """ + + secure: Optional[Literal["auto", "always", "never"]] = None + """Configures the Secure attribute on the waiting room cookie. + + Value `always` indicates that the Secure attribute will be set in the Set-Cookie + header, `never` indicates that the Secure attribute will not be set, and `auto` + will set the Secure attribute depending if **Always Use HTTPS** is enabled. + """ diff --git a/src/cloudflare/types/waiting_rooms/cookie_attributes_param.py b/src/cloudflare/types/waiting_rooms/cookie_attributes_param.py new file mode 100644 index 00000000000..2724c2105c7 --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/cookie_attributes_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["CookieAttributesParam"] + + +class CookieAttributesParam(TypedDict, total=False): + samesite: Literal["auto", "lax", "none", "strict"] + """Configures the SameSite attribute on the waiting room cookie. + + Value `auto` will be translated to `lax` or `none` depending if **Always Use + HTTPS** is enabled. Note that when using value `none`, the secure attribute + cannot be set to `never`. + """ + + secure: Literal["auto", "always", "never"] + """Configures the Secure attribute on the waiting room cookie. + + Value `always` indicates that the Secure attribute will be set in the Set-Cookie + header, `never` indicates that the Secure attribute will not be set, and `auto` + will set the Secure attribute depending if **Always Use HTTPS** is enabled. + """ diff --git a/src/cloudflare/types/waiting_rooms/event.py b/src/cloudflare/types/waiting_rooms/event.py new file mode 100644 index 00000000000..682983566d1 --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/event.py @@ -0,0 +1,97 @@ +# 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__ = ["Event"] + + +class Event(BaseModel): + id: Optional[str] = None + + created_on: Optional[datetime] = None + + custom_page_html: Optional[str] = None + """ + If set, the event will override the waiting room's `custom_page_html` property + while it is active. If null, the event will inherit it. + """ + + description: Optional[str] = None + """A note that you can use to add more details about the event.""" + + disable_session_renewal: Optional[bool] = None + """ + If set, the event will override the waiting room's `disable_session_renewal` + property while it is active. If null, the event will inherit it. + """ + + event_end_time: Optional[str] = None + """An ISO 8601 timestamp that marks the end of the event.""" + + event_start_time: Optional[str] = None + """An ISO 8601 timestamp that marks the start of the event. + + At this time, queued users will be processed with the event's configuration. The + start time must be at least one minute before `event_end_time`. + """ + + modified_on: Optional[datetime] = None + + name: Optional[str] = None + """A unique name to identify the event. + + Only alphanumeric characters, hyphens and underscores are allowed. + """ + + new_users_per_minute: Optional[int] = None + """ + If set, the event will override the waiting room's `new_users_per_minute` + property while it is active. If null, the event will inherit it. This can only + be set if the event's `total_active_users` property is also set. + """ + + prequeue_start_time: Optional[str] = None + """ + An ISO 8601 timestamp that marks when to begin queueing all users before the + event starts. The prequeue must start at least five minutes before + `event_start_time`. + """ + + queueing_method: Optional[str] = None + """ + If set, the event will override the waiting room's `queueing_method` property + while it is active. If null, the event will inherit it. + """ + + session_duration: Optional[int] = None + """ + If set, the event will override the waiting room's `session_duration` property + while it is active. If null, the event will inherit it. + """ + + shuffle_at_event_start: Optional[bool] = None + """ + If enabled, users in the prequeue will be shuffled randomly at the + `event_start_time`. Requires that `prequeue_start_time` is not null. This is + useful for situations when many users will join the event prequeue at the same + time and you want to shuffle them to ensure fairness. Naturally, it makes the + most sense to enable this feature when the `queueing_method` during the event + respects ordering such as **fifo**, or else the shuffling may be unnecessary. + """ + + suspended: Optional[bool] = None + """Suspends or allows an event. + + If set to `true`, the event is ignored and traffic will be handled based on the + waiting room configuration. + """ + + total_active_users: Optional[int] = None + """ + If set, the event will override the waiting room's `total_active_users` property + while it is active. If null, the event will inherit it. This can only be set if + the event's `new_users_per_minute` property is also set. + """ diff --git a/src/cloudflare/types/waiting_rooms/event_create_params.py b/src/cloudflare/types/waiting_rooms/event_create_params.py index 202372165ea..b4da24a3fd9 100644 --- a/src/cloudflare/types/waiting_rooms/event_create_params.py +++ b/src/cloudflare/types/waiting_rooms/event_create_params.py @@ -9,7 +9,7 @@ class EventCreateParams(TypedDict, total=False): - zone_identifier: Required[str] + zone_id: Required[str] """Identifier""" event_end_time: Required[str] diff --git a/src/cloudflare/types/waiting_rooms/event_delete_params.py b/src/cloudflare/types/waiting_rooms/event_delete_params.py new file mode 100644 index 00000000000..785cbedc49a --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/event_delete_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["EventDeleteParams"] + + +class EventDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + waiting_room_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/waiting_rooms/event_edit_params.py b/src/cloudflare/types/waiting_rooms/event_edit_params.py index 681f80ae773..3078d7cc905 100644 --- a/src/cloudflare/types/waiting_rooms/event_edit_params.py +++ b/src/cloudflare/types/waiting_rooms/event_edit_params.py @@ -9,7 +9,7 @@ class EventEditParams(TypedDict, total=False): - zone_identifier: Required[str] + zone_id: Required[str] """Identifier""" waiting_room_id: Required[str] diff --git a/src/cloudflare/types/waiting_rooms/event_list_params.py b/src/cloudflare/types/waiting_rooms/event_list_params.py new file mode 100644 index 00000000000..99ae24766eb --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/event_list_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["EventListParams"] + + +class EventListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + page: object + """Page number of paginated results.""" + + per_page: object + """Maximum number of results per page. Must be a multiple of 5.""" diff --git a/src/cloudflare/types/waiting_rooms/event_update_params.py b/src/cloudflare/types/waiting_rooms/event_update_params.py index eb2da5bd225..50b5fda9b82 100644 --- a/src/cloudflare/types/waiting_rooms/event_update_params.py +++ b/src/cloudflare/types/waiting_rooms/event_update_params.py @@ -9,7 +9,7 @@ class EventUpdateParams(TypedDict, total=False): - zone_identifier: Required[str] + zone_id: Required[str] """Identifier""" waiting_room_id: Required[str] diff --git a/src/cloudflare/types/waiting_rooms/events/__init__.py b/src/cloudflare/types/waiting_rooms/events/__init__.py index cbaf1d11ff9..4c6d7381f8d 100644 --- a/src/cloudflare/types/waiting_rooms/events/__init__.py +++ b/src/cloudflare/types/waiting_rooms/events/__init__.py @@ -2,4 +2,4 @@ from __future__ import annotations -from .waitingroom_event_details import WaitingroomEventDetails as WaitingroomEventDetails +from .detail_get_response import DetailGetResponse as DetailGetResponse diff --git a/src/cloudflare/types/waiting_rooms/events/detail_get_response.py b/src/cloudflare/types/waiting_rooms/events/detail_get_response.py new file mode 100644 index 00000000000..bed7ae01e3b --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/events/detail_get_response.py @@ -0,0 +1,71 @@ +# 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__ = ["DetailGetResponse"] + + +class DetailGetResponse(BaseModel): + id: Optional[str] = None + + created_on: Optional[datetime] = None + + custom_page_html: Optional[str] = None + + description: Optional[str] = None + """A note that you can use to add more details about the event.""" + + disable_session_renewal: Optional[bool] = None + + event_end_time: Optional[str] = None + """An ISO 8601 timestamp that marks the end of the event.""" + + event_start_time: Optional[str] = None + """An ISO 8601 timestamp that marks the start of the event. + + At this time, queued users will be processed with the event's configuration. The + start time must be at least one minute before `event_end_time`. + """ + + modified_on: Optional[datetime] = None + + name: Optional[str] = None + """A unique name to identify the event. + + Only alphanumeric characters, hyphens and underscores are allowed. + """ + + new_users_per_minute: Optional[int] = None + + prequeue_start_time: Optional[str] = None + """ + An ISO 8601 timestamp that marks when to begin queueing all users before the + event starts. The prequeue must start at least five minutes before + `event_start_time`. + """ + + queueing_method: Optional[str] = None + + session_duration: Optional[int] = None + + shuffle_at_event_start: Optional[bool] = None + """ + If enabled, users in the prequeue will be shuffled randomly at the + `event_start_time`. Requires that `prequeue_start_time` is not null. This is + useful for situations when many users will join the event prequeue at the same + time and you want to shuffle them to ensure fairness. Naturally, it makes the + most sense to enable this feature when the `queueing_method` during the event + respects ordering such as **fifo**, or else the shuffling may be unnecessary. + """ + + suspended: Optional[bool] = None + """Suspends or allows an event. + + If set to `true`, the event is ignored and traffic will be handled based on the + waiting room configuration. + """ + + total_active_users: Optional[int] = None diff --git a/src/cloudflare/types/waiting_rooms/events/waitingroom_event_details.py b/src/cloudflare/types/waiting_rooms/events/waitingroom_event_details.py deleted file mode 100644 index c366a49bc46..00000000000 --- a/src/cloudflare/types/waiting_rooms/events/waitingroom_event_details.py +++ /dev/null @@ -1,71 +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__ = ["WaitingroomEventDetails"] - - -class WaitingroomEventDetails(BaseModel): - id: Optional[str] = None - - created_on: Optional[datetime] = None - - custom_page_html: Optional[str] = None - - description: Optional[str] = None - """A note that you can use to add more details about the event.""" - - disable_session_renewal: Optional[bool] = None - - event_end_time: Optional[str] = None - """An ISO 8601 timestamp that marks the end of the event.""" - - event_start_time: Optional[str] = None - """An ISO 8601 timestamp that marks the start of the event. - - At this time, queued users will be processed with the event's configuration. The - start time must be at least one minute before `event_end_time`. - """ - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """A unique name to identify the event. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - new_users_per_minute: Optional[int] = None - - prequeue_start_time: Optional[str] = None - """ - An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - """ - - queueing_method: Optional[str] = None - - session_duration: Optional[int] = None - - shuffle_at_event_start: Optional[bool] = None - """ - If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - """ - - suspended: Optional[bool] = None - """Suspends or allows an event. - - If set to `true`, the event is ignored and traffic will be handled based on the - waiting room configuration. - """ - - total_active_users: Optional[int] = None diff --git a/src/cloudflare/types/waiting_rooms/page_preview_params.py b/src/cloudflare/types/waiting_rooms/page_preview_params.py index abad091d6b5..79df9ba1d9f 100644 --- a/src/cloudflare/types/waiting_rooms/page_preview_params.py +++ b/src/cloudflare/types/waiting_rooms/page_preview_params.py @@ -8,6 +8,9 @@ class PagePreviewParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + custom_html: Required[str] """Only available for the Waiting Room Advanced subscription. diff --git a/src/cloudflare/types/waiting_rooms/rule_create_params.py b/src/cloudflare/types/waiting_rooms/rule_create_params.py index 6460270cab9..d86f7db2a61 100644 --- a/src/cloudflare/types/waiting_rooms/rule_create_params.py +++ b/src/cloudflare/types/waiting_rooms/rule_create_params.py @@ -8,7 +8,7 @@ class RuleCreateParams(TypedDict, total=False): - zone_identifier: Required[str] + zone_id: Required[str] """Identifier""" action: Required[Literal["bypass_waiting_room"]] diff --git a/src/cloudflare/types/waiting_rooms/rule_create_response.py b/src/cloudflare/types/waiting_rooms/rule_create_response.py index 0b669b7e5da..c9705035570 100644 --- a/src/cloudflare/types/waiting_rooms/rule_create_response.py +++ b/src/cloudflare/types/waiting_rooms/rule_create_response.py @@ -2,8 +2,8 @@ from typing import List -from .waitingroom_rule import WaitingroomRule +from .waiting_room_rule import WaitingRoomRule __all__ = ["RuleCreateResponse"] -RuleCreateResponse = List[WaitingroomRule] +RuleCreateResponse = List[WaitingRoomRule] diff --git a/src/cloudflare/types/waiting_rooms/rule_delete_params.py b/src/cloudflare/types/waiting_rooms/rule_delete_params.py new file mode 100644 index 00000000000..34c03b42387 --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/rule_delete_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RuleDeleteParams"] + + +class RuleDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + waiting_room_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/waiting_rooms/rule_delete_response.py b/src/cloudflare/types/waiting_rooms/rule_delete_response.py index 6c5de05a3fe..0dbcc72e87f 100644 --- a/src/cloudflare/types/waiting_rooms/rule_delete_response.py +++ b/src/cloudflare/types/waiting_rooms/rule_delete_response.py @@ -2,8 +2,8 @@ from typing import List -from .waitingroom_rule import WaitingroomRule +from .waiting_room_rule import WaitingRoomRule __all__ = ["RuleDeleteResponse"] -RuleDeleteResponse = List[WaitingroomRule] +RuleDeleteResponse = List[WaitingRoomRule] diff --git a/src/cloudflare/types/waiting_rooms/rule_edit_params.py b/src/cloudflare/types/waiting_rooms/rule_edit_params.py index 5c4e42e1be6..dc61762935d 100644 --- a/src/cloudflare/types/waiting_rooms/rule_edit_params.py +++ b/src/cloudflare/types/waiting_rooms/rule_edit_params.py @@ -9,7 +9,7 @@ class RuleEditParams(TypedDict, total=False): - zone_identifier: Required[str] + zone_id: Required[str] """Identifier""" waiting_room_id: Required[str] diff --git a/src/cloudflare/types/waiting_rooms/rule_edit_response.py b/src/cloudflare/types/waiting_rooms/rule_edit_response.py index 326fed99592..0f5c77dfdbc 100644 --- a/src/cloudflare/types/waiting_rooms/rule_edit_response.py +++ b/src/cloudflare/types/waiting_rooms/rule_edit_response.py @@ -2,8 +2,8 @@ from typing import List -from .waitingroom_rule import WaitingroomRule +from .waiting_room_rule import WaitingRoomRule __all__ = ["RuleEditResponse"] -RuleEditResponse = List[WaitingroomRule] +RuleEditResponse = List[WaitingRoomRule] diff --git a/src/cloudflare/types/waiting_rooms/rule_update_params.py b/src/cloudflare/types/waiting_rooms/rule_update_params.py index 298673d0c76..57a22f8d87b 100644 --- a/src/cloudflare/types/waiting_rooms/rule_update_params.py +++ b/src/cloudflare/types/waiting_rooms/rule_update_params.py @@ -9,7 +9,7 @@ class RuleUpdateParams(TypedDict, total=False): - zone_identifier: Required[str] + zone_id: Required[str] """Identifier""" body: Required[Iterable[Body]] diff --git a/src/cloudflare/types/waiting_rooms/rule_update_response.py b/src/cloudflare/types/waiting_rooms/rule_update_response.py index e3fb52ec9c0..775cd3292e4 100644 --- a/src/cloudflare/types/waiting_rooms/rule_update_response.py +++ b/src/cloudflare/types/waiting_rooms/rule_update_response.py @@ -2,8 +2,8 @@ from typing import List -from .waitingroom_rule import WaitingroomRule +from .waiting_room_rule import WaitingRoomRule __all__ = ["RuleUpdateResponse"] -RuleUpdateResponse = List[WaitingroomRule] +RuleUpdateResponse = List[WaitingRoomRule] diff --git a/src/cloudflare/types/waiting_rooms/setting.py b/src/cloudflare/types/waiting_rooms/setting.py new file mode 100644 index 00000000000..62555a567ef --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/setting.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Setting"] + + +class Setting(BaseModel): + search_engine_crawler_bypass: bool + """ + Whether to allow verified search engine crawlers to bypass all waiting rooms on + this zone. Verified search engine crawlers will not be tracked or counted by the + waiting room system, and will not appear in waiting room analytics. + """ diff --git a/src/cloudflare/types/waiting_rooms/setting_edit_params.py b/src/cloudflare/types/waiting_rooms/setting_edit_params.py index 6591e2b3177..e922cf94de5 100644 --- a/src/cloudflare/types/waiting_rooms/setting_edit_params.py +++ b/src/cloudflare/types/waiting_rooms/setting_edit_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict __all__ = ["SettingEditParams"] class SettingEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + search_engine_crawler_bypass: bool """ Whether to allow verified search engine crawlers to bypass all waiting rooms on diff --git a/src/cloudflare/types/waiting_rooms/setting_update_params.py b/src/cloudflare/types/waiting_rooms/setting_update_params.py index 68c2f6dab20..eab75ef9b66 100644 --- a/src/cloudflare/types/waiting_rooms/setting_update_params.py +++ b/src/cloudflare/types/waiting_rooms/setting_update_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict __all__ = ["SettingUpdateParams"] class SettingUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + search_engine_crawler_bypass: bool """ Whether to allow verified search engine crawlers to bypass all waiting rooms on diff --git a/src/cloudflare/types/waiting_room.py b/src/cloudflare/types/waiting_rooms/waiting_room.py similarity index 91% rename from src/cloudflare/types/waiting_room.py rename to src/cloudflare/types/waiting_rooms/waiting_room.py index 7c45f1f0099..e78da6a6efc 100644 --- a/src/cloudflare/types/waiting_room.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room.py @@ -4,51 +4,17 @@ from datetime import datetime from typing_extensions import Literal -from .._models import BaseModel +from ..._models import BaseModel +from .additional_routes import AdditionalRoutes +from .cookie_attributes import CookieAttributes -__all__ = ["WaitingRoom", "AdditionalRoute", "CookieAttributes"] - - -class AdditionalRoute(BaseModel): - host: Optional[str] = None - """The hostname to which this waiting room will be applied (no wildcards). - - The hostname must be the primary domain, subdomain, or custom hostname (if using - SSL for SaaS) of this zone. Please do not include the scheme (http:// or - https://). - """ - - path: Optional[str] = None - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - -class CookieAttributes(BaseModel): - samesite: Optional[Literal["auto", "lax", "none", "strict"]] = None - """Configures the SameSite attribute on the waiting room cookie. - - Value `auto` will be translated to `lax` or `none` depending if **Always Use - HTTPS** is enabled. Note that when using value `none`, the secure attribute - cannot be set to `never`. - """ - - secure: Optional[Literal["auto", "always", "never"]] = None - """Configures the Secure attribute on the waiting room cookie. - - Value `always` indicates that the Secure attribute will be set in the Set-Cookie - header, `never` indicates that the Secure attribute will not be set, and `auto` - will set the Secure attribute depending if **Always Use HTTPS** is enabled. - """ +__all__ = ["WaitingRoom"] class WaitingRoom(BaseModel): id: Optional[str] = None - additional_routes: Optional[List[AdditionalRoute]] = None + additional_routes: Optional[List[AdditionalRoutes]] = None """Only available for the Waiting Room Advanced subscription. Additional hostname and path combinations to which this waiting room will be diff --git a/src/cloudflare/types/waiting_room_create_params.py b/src/cloudflare/types/waiting_rooms/waiting_room_create_params.py similarity index 90% rename from src/cloudflare/types/waiting_room_create_params.py rename to src/cloudflare/types/waiting_rooms/waiting_room_create_params.py index 175b8436280..a8c7ae9a694 100644 --- a/src/cloudflare/types/waiting_room_create_params.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room_create_params.py @@ -5,10 +5,16 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["WaitingRoomCreateParams", "AdditionalRoute", "CookieAttributes"] +from .additional_routes_param import AdditionalRoutesParam +from .cookie_attributes_param import CookieAttributesParam + +__all__ = ["WaitingRoomCreateParams"] class WaitingRoomCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + host: Required[str] """The host name to which the waiting room will be applied (no wildcards). @@ -40,7 +46,7 @@ class WaitingRoomCreateParams(TypedDict, total=False): around the world. """ - additional_routes: Iterable[AdditionalRoute] + additional_routes: Iterable[AdditionalRoutesParam] """Only available for the Waiting Room Advanced subscription. Additional hostname and path combinations to which this waiting room will be @@ -48,7 +54,7 @@ class WaitingRoomCreateParams(TypedDict, total=False): path combination must be unique to this and all other waiting rooms. """ - cookie_attributes: CookieAttributes + cookie_attributes: CookieAttributesParam """Configures cookie attributes for the waiting room cookie. This encrypted cookie stores a user's status in the waiting room, such as queue @@ -335,39 +341,3 @@ class WaitingRoomCreateParams(TypedDict, total=False): If set to `true`, the traffic will not go to the waiting room. """ - - -class AdditionalRoute(TypedDict, total=False): - host: str - """The hostname to which this waiting room will be applied (no wildcards). - - The hostname must be the primary domain, subdomain, or custom hostname (if using - SSL for SaaS) of this zone. Please do not include the scheme (http:// or - https://). - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - -class CookieAttributes(TypedDict, total=False): - samesite: Literal["auto", "lax", "none", "strict"] - """Configures the SameSite attribute on the waiting room cookie. - - Value `auto` will be translated to `lax` or `none` depending if **Always Use - HTTPS** is enabled. Note that when using value `none`, the secure attribute - cannot be set to `never`. - """ - - secure: Literal["auto", "always", "never"] - """Configures the Secure attribute on the waiting room cookie. - - Value `always` indicates that the Secure attribute will be set in the Set-Cookie - header, `never` indicates that the Secure attribute will not be set, and `auto` - will set the Secure attribute depending if **Always Use HTTPS** is enabled. - """ diff --git a/src/cloudflare/types/waiting_rooms/waiting_room_delete_params.py b/src/cloudflare/types/waiting_rooms/waiting_room_delete_params.py new file mode 100644 index 00000000000..3db5c55c43d --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/waiting_room_delete_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__ = ["WaitingRoomDeleteParams"] + + +class WaitingRoomDeleteParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/waiting_room_delete_response.py b/src/cloudflare/types/waiting_rooms/waiting_room_delete_response.py similarity index 87% rename from src/cloudflare/types/waiting_room_delete_response.py rename to src/cloudflare/types/waiting_rooms/waiting_room_delete_response.py index 75446852d17..9ae3650b77d 100644 --- a/src/cloudflare/types/waiting_room_delete_response.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["WaitingRoomDeleteResponse"] diff --git a/src/cloudflare/types/waiting_room_edit_params.py b/src/cloudflare/types/waiting_rooms/waiting_room_edit_params.py similarity index 90% rename from src/cloudflare/types/waiting_room_edit_params.py rename to src/cloudflare/types/waiting_rooms/waiting_room_edit_params.py index 15b838a5acb..c3cc4b662ca 100644 --- a/src/cloudflare/types/waiting_room_edit_params.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room_edit_params.py @@ -5,11 +5,14 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["WaitingRoomEditParams", "AdditionalRoute", "CookieAttributes"] +from .additional_routes_param import AdditionalRoutesParam +from .cookie_attributes_param import CookieAttributesParam + +__all__ = ["WaitingRoomEditParams"] class WaitingRoomEditParams(TypedDict, total=False): - zone_identifier: Required[str] + zone_id: Required[str] """Identifier""" host: Required[str] @@ -43,7 +46,7 @@ class WaitingRoomEditParams(TypedDict, total=False): around the world. """ - additional_routes: Iterable[AdditionalRoute] + additional_routes: Iterable[AdditionalRoutesParam] """Only available for the Waiting Room Advanced subscription. Additional hostname and path combinations to which this waiting room will be @@ -51,7 +54,7 @@ class WaitingRoomEditParams(TypedDict, total=False): path combination must be unique to this and all other waiting rooms. """ - cookie_attributes: CookieAttributes + cookie_attributes: CookieAttributesParam """Configures cookie attributes for the waiting room cookie. This encrypted cookie stores a user's status in the waiting room, such as queue @@ -338,39 +341,3 @@ class WaitingRoomEditParams(TypedDict, total=False): If set to `true`, the traffic will not go to the waiting room. """ - - -class AdditionalRoute(TypedDict, total=False): - host: str - """The hostname to which this waiting room will be applied (no wildcards). - - The hostname must be the primary domain, subdomain, or custom hostname (if using - SSL for SaaS) of this zone. Please do not include the scheme (http:// or - https://). - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - -class CookieAttributes(TypedDict, total=False): - samesite: Literal["auto", "lax", "none", "strict"] - """Configures the SameSite attribute on the waiting room cookie. - - Value `auto` will be translated to `lax` or `none` depending if **Always Use - HTTPS** is enabled. Note that when using value `none`, the secure attribute - cannot be set to `never`. - """ - - secure: Literal["auto", "always", "never"] - """Configures the Secure attribute on the waiting room cookie. - - Value `always` indicates that the Secure attribute will be set in the Set-Cookie - header, `never` indicates that the Secure attribute will not be set, and `auto` - will set the Secure attribute depending if **Always Use HTTPS** is enabled. - """ diff --git a/src/cloudflare/types/waiting_rooms/waiting_room_list_params.py b/src/cloudflare/types/waiting_rooms/waiting_room_list_params.py new file mode 100644 index 00000000000..d601612834c --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/waiting_room_list_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["WaitingRoomListParams"] + + +class WaitingRoomListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + page: object + """Page number of paginated results.""" + + per_page: object + """Maximum number of results per page. Must be a multiple of 5.""" diff --git a/src/cloudflare/types/waiting_rooms/waiting_room_rule.py b/src/cloudflare/types/waiting_rooms/waiting_room_rule.py new file mode 100644 index 00000000000..1478deef005 --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/waiting_room_rule.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["WaitingRoomRule"] + + +class WaitingRoomRule(BaseModel): + id: Optional[str] = None + """The ID of the rule.""" + + action: Optional[Literal["bypass_waiting_room"]] = None + """The action to take when the expression matches.""" + + description: Optional[str] = None + """The description of the rule.""" + + enabled: Optional[bool] = None + """When set to true, the rule is enabled.""" + + expression: Optional[str] = None + """Criteria defining when there is a match for the current rule.""" + + last_updated: Optional[datetime] = None + + version: Optional[str] = None + """The version of the rule.""" diff --git a/src/cloudflare/types/waiting_room_update_params.py b/src/cloudflare/types/waiting_rooms/waiting_room_update_params.py similarity index 90% rename from src/cloudflare/types/waiting_room_update_params.py rename to src/cloudflare/types/waiting_rooms/waiting_room_update_params.py index dd73542e4a4..9f494bbcd82 100644 --- a/src/cloudflare/types/waiting_room_update_params.py +++ b/src/cloudflare/types/waiting_rooms/waiting_room_update_params.py @@ -5,11 +5,14 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["WaitingRoomUpdateParams", "AdditionalRoute", "CookieAttributes"] +from .additional_routes_param import AdditionalRoutesParam +from .cookie_attributes_param import CookieAttributesParam + +__all__ = ["WaitingRoomUpdateParams"] class WaitingRoomUpdateParams(TypedDict, total=False): - zone_identifier: Required[str] + zone_id: Required[str] """Identifier""" host: Required[str] @@ -43,7 +46,7 @@ class WaitingRoomUpdateParams(TypedDict, total=False): around the world. """ - additional_routes: Iterable[AdditionalRoute] + additional_routes: Iterable[AdditionalRoutesParam] """Only available for the Waiting Room Advanced subscription. Additional hostname and path combinations to which this waiting room will be @@ -51,7 +54,7 @@ class WaitingRoomUpdateParams(TypedDict, total=False): path combination must be unique to this and all other waiting rooms. """ - cookie_attributes: CookieAttributes + cookie_attributes: CookieAttributesParam """Configures cookie attributes for the waiting room cookie. This encrypted cookie stores a user's status in the waiting room, such as queue @@ -338,39 +341,3 @@ class WaitingRoomUpdateParams(TypedDict, total=False): If set to `true`, the traffic will not go to the waiting room. """ - - -class AdditionalRoute(TypedDict, total=False): - host: str - """The hostname to which this waiting room will be applied (no wildcards). - - The hostname must be the primary domain, subdomain, or custom hostname (if using - SSL for SaaS) of this zone. Please do not include the scheme (http:// or - https://). - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - -class CookieAttributes(TypedDict, total=False): - samesite: Literal["auto", "lax", "none", "strict"] - """Configures the SameSite attribute on the waiting room cookie. - - Value `auto` will be translated to `lax` or `none` depending if **Always Use - HTTPS** is enabled. Note that when using value `none`, the secure attribute - cannot be set to `never`. - """ - - secure: Literal["auto", "always", "never"] - """Configures the Secure attribute on the waiting room cookie. - - Value `always` indicates that the Secure attribute will be set in the Set-Cookie - header, `never` indicates that the Secure attribute will not be set, and `auto` - will set the Secure attribute depending if **Always Use HTTPS** is enabled. - """ diff --git a/src/cloudflare/types/waiting_rooms/waitingroom_event.py b/src/cloudflare/types/waiting_rooms/waitingroom_event.py deleted file mode 100644 index d44568e4b15..00000000000 --- a/src/cloudflare/types/waiting_rooms/waitingroom_event.py +++ /dev/null @@ -1,97 +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__ = ["WaitingroomEvent"] - - -class WaitingroomEvent(BaseModel): - id: Optional[str] = None - - created_on: Optional[datetime] = None - - custom_page_html: Optional[str] = None - """ - If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - """ - - description: Optional[str] = None - """A note that you can use to add more details about the event.""" - - disable_session_renewal: Optional[bool] = None - """ - If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - """ - - event_end_time: Optional[str] = None - """An ISO 8601 timestamp that marks the end of the event.""" - - event_start_time: Optional[str] = None - """An ISO 8601 timestamp that marks the start of the event. - - At this time, queued users will be processed with the event's configuration. The - start time must be at least one minute before `event_end_time`. - """ - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """A unique name to identify the event. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - new_users_per_minute: Optional[int] = None - """ - If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - """ - - prequeue_start_time: Optional[str] = None - """ - An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - """ - - queueing_method: Optional[str] = None - """ - If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - """ - - session_duration: Optional[int] = None - """ - If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - """ - - shuffle_at_event_start: Optional[bool] = None - """ - If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - """ - - suspended: Optional[bool] = None - """Suspends or allows an event. - - If set to `true`, the event is ignored and traffic will be handled based on the - waiting room configuration. - """ - - total_active_users: Optional[int] = None - """ - If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - """ diff --git a/src/cloudflare/types/waiting_rooms/waitingroom_rule.py b/src/cloudflare/types/waiting_rooms/waitingroom_rule.py deleted file mode 100644 index 1d5a191aad7..00000000000 --- a/src/cloudflare/types/waiting_rooms/waitingroom_rule.py +++ /dev/null @@ -1,31 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["WaitingroomRule"] - - -class WaitingroomRule(BaseModel): - id: Optional[str] = None - """The ID of the rule.""" - - action: Optional[Literal["bypass_waiting_room"]] = None - """The action to take when the expression matches.""" - - description: Optional[str] = None - """The description of the rule.""" - - enabled: Optional[bool] = None - """When set to true, the rule is enabled.""" - - expression: Optional[str] = None - """Criteria defining when there is a match for the current rule.""" - - last_updated: Optional[datetime] = None - - version: Optional[str] = None - """The version of the rule.""" diff --git a/src/cloudflare/types/warp_connector/__init__.py b/src/cloudflare/types/warp_connector/__init__.py new file mode 100644 index 00000000000..9fbbe448c87 --- /dev/null +++ b/src/cloudflare/types/warp_connector/__init__.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .warp_connector_edit_params import WARPConnectorEditParams as WARPConnectorEditParams +from .warp_connector_list_params import WARPConnectorListParams as WARPConnectorListParams +from .warp_connector_get_response import WARPConnectorGetResponse as WARPConnectorGetResponse +from .warp_connector_create_params import WARPConnectorCreateParams as WARPConnectorCreateParams +from .warp_connector_delete_params import WARPConnectorDeleteParams as WARPConnectorDeleteParams +from .warp_connector_edit_response import WARPConnectorEditResponse as WARPConnectorEditResponse +from .warp_connector_list_response import WARPConnectorListResponse as WARPConnectorListResponse +from .warp_connector_token_response import WARPConnectorTokenResponse as WARPConnectorTokenResponse +from .warp_connector_create_response import WARPConnectorCreateResponse as WARPConnectorCreateResponse +from .warp_connector_delete_response import WARPConnectorDeleteResponse as WARPConnectorDeleteResponse diff --git a/src/cloudflare/types/warp_connector_create_params.py b/src/cloudflare/types/warp_connector/warp_connector_create_params.py similarity index 88% rename from src/cloudflare/types/warp_connector_create_params.py rename to src/cloudflare/types/warp_connector/warp_connector_create_params.py index 30a1cf2999c..79206222a60 100644 --- a/src/cloudflare/types/warp_connector_create_params.py +++ b/src/cloudflare/types/warp_connector/warp_connector_create_params.py @@ -12,4 +12,4 @@ class WARPConnectorCreateParams(TypedDict, total=False): """Cloudflare account ID""" name: Required[str] - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" diff --git a/src/cloudflare/types/warp_connector/warp_connector_create_response.py b/src/cloudflare/types/warp_connector/warp_connector_create_response.py new file mode 100644 index 00000000000..f76eda94d7c --- /dev/null +++ b/src/cloudflare/types/warp_connector/warp_connector_create_response.py @@ -0,0 +1,94 @@ +# 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 + +from ..._models import BaseModel +from ..shared.cloudflare_tunnel import CloudflareTunnel + +__all__ = ["WARPConnectorCreateResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"] + + +class TunnelWARPConnectorTunnelConnection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for a tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorCreateResponse = Union[CloudflareTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_delete_params.py b/src/cloudflare/types/warp_connector/warp_connector_delete_params.py similarity index 100% rename from src/cloudflare/types/warp_connector_delete_params.py rename to src/cloudflare/types/warp_connector/warp_connector_delete_params.py diff --git a/src/cloudflare/types/warp_connector/warp_connector_delete_response.py b/src/cloudflare/types/warp_connector/warp_connector_delete_response.py new file mode 100644 index 00000000000..22c9fd73ca3 --- /dev/null +++ b/src/cloudflare/types/warp_connector/warp_connector_delete_response.py @@ -0,0 +1,94 @@ +# 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 + +from ..._models import BaseModel +from ..shared.cloudflare_tunnel import CloudflareTunnel + +__all__ = ["WARPConnectorDeleteResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"] + + +class TunnelWARPConnectorTunnelConnection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for a tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorDeleteResponse = Union[CloudflareTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_edit_params.py b/src/cloudflare/types/warp_connector/warp_connector_edit_params.py similarity index 91% rename from src/cloudflare/types/warp_connector_edit_params.py rename to src/cloudflare/types/warp_connector/warp_connector_edit_params.py index c61bff80432..86d2f3b97b9 100644 --- a/src/cloudflare/types/warp_connector_edit_params.py +++ b/src/cloudflare/types/warp_connector/warp_connector_edit_params.py @@ -12,7 +12,7 @@ class WARPConnectorEditParams(TypedDict, total=False): """Cloudflare account ID""" name: str - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" tunnel_secret: str """Sets the password required to run a locally-managed tunnel. diff --git a/src/cloudflare/types/warp_connector/warp_connector_edit_response.py b/src/cloudflare/types/warp_connector/warp_connector_edit_response.py new file mode 100644 index 00000000000..19ac4305497 --- /dev/null +++ b/src/cloudflare/types/warp_connector/warp_connector_edit_response.py @@ -0,0 +1,94 @@ +# 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 + +from ..._models import BaseModel +from ..shared.cloudflare_tunnel import CloudflareTunnel + +__all__ = ["WARPConnectorEditResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"] + + +class TunnelWARPConnectorTunnelConnection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for a tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorEditResponse = Union[CloudflareTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector/warp_connector_get_response.py b/src/cloudflare/types/warp_connector/warp_connector_get_response.py new file mode 100644 index 00000000000..aab7e8cfb2c --- /dev/null +++ b/src/cloudflare/types/warp_connector/warp_connector_get_response.py @@ -0,0 +1,94 @@ +# 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 + +from ..._models import BaseModel +from ..shared.cloudflare_tunnel import CloudflareTunnel + +__all__ = ["WARPConnectorGetResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"] + + +class TunnelWARPConnectorTunnelConnection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for a tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorGetResponse = Union[CloudflareTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_list_params.py b/src/cloudflare/types/warp_connector/warp_connector_list_params.py similarity index 93% rename from src/cloudflare/types/warp_connector_list_params.py rename to src/cloudflare/types/warp_connector/warp_connector_list_params.py index a023a1f810f..e58a6e75cc1 100644 --- a/src/cloudflare/types/warp_connector_list_params.py +++ b/src/cloudflare/types/warp_connector/warp_connector_list_params.py @@ -6,7 +6,7 @@ from datetime import datetime from typing_extensions import Required, Annotated, TypedDict -from .._utils import PropertyInfo +from ..._utils import PropertyInfo __all__ = ["WARPConnectorListParams"] @@ -40,6 +40,9 @@ class WARPConnectorListParams(TypedDict, total=False): per_page: float """Number of results to display.""" + uuid: str + """UUID of the tunnel.""" + was_active_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] was_inactive_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] diff --git a/src/cloudflare/types/warp_connector/warp_connector_list_response.py b/src/cloudflare/types/warp_connector/warp_connector_list_response.py new file mode 100644 index 00000000000..a5b67df48c4 --- /dev/null +++ b/src/cloudflare/types/warp_connector/warp_connector_list_response.py @@ -0,0 +1,94 @@ +# 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 + +from ..._models import BaseModel +from ..shared.cloudflare_tunnel import CloudflareTunnel + +__all__ = ["WARPConnectorListResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"] + + +class TunnelWARPConnectorTunnelConnection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for a tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorListResponse = Union[CloudflareTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_token_response.py b/src/cloudflare/types/warp_connector/warp_connector_token_response.py similarity index 100% rename from src/cloudflare/types/warp_connector_token_response.py rename to src/cloudflare/types/warp_connector/warp_connector_token_response.py diff --git a/src/cloudflare/types/warp_connector_create_response.py b/src/cloudflare/types/warp_connector_create_response.py deleted file mode 100644 index 776956bfd9c..00000000000 --- a/src/cloudflare/types/warp_connector_create_response.py +++ /dev/null @@ -1,186 +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 - -from .._models import BaseModel - -__all__ = [ - "WARPConnectorCreateResponse", - "TunnelCfdTunnel", - "TunnelCfdTunnelConnection", - "TunnelWARPConnectorTunnel", - "TunnelWARPConnectorTunnelConnection", -] - - -class TunnelCfdTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelCfdTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -class TunnelWARPConnectorTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelWARPConnectorTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -WARPConnectorCreateResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_delete_response.py b/src/cloudflare/types/warp_connector_delete_response.py deleted file mode 100644 index a5d35ddd2f9..00000000000 --- a/src/cloudflare/types/warp_connector_delete_response.py +++ /dev/null @@ -1,186 +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 - -from .._models import BaseModel - -__all__ = [ - "WARPConnectorDeleteResponse", - "TunnelCfdTunnel", - "TunnelCfdTunnelConnection", - "TunnelWARPConnectorTunnel", - "TunnelWARPConnectorTunnelConnection", -] - - -class TunnelCfdTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelCfdTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -class TunnelWARPConnectorTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelWARPConnectorTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -WARPConnectorDeleteResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_edit_response.py b/src/cloudflare/types/warp_connector_edit_response.py deleted file mode 100644 index 614246293b8..00000000000 --- a/src/cloudflare/types/warp_connector_edit_response.py +++ /dev/null @@ -1,186 +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 - -from .._models import BaseModel - -__all__ = [ - "WARPConnectorEditResponse", - "TunnelCfdTunnel", - "TunnelCfdTunnelConnection", - "TunnelWARPConnectorTunnel", - "TunnelWARPConnectorTunnelConnection", -] - - -class TunnelCfdTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelCfdTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -class TunnelWARPConnectorTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelWARPConnectorTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -WARPConnectorEditResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_get_response.py b/src/cloudflare/types/warp_connector_get_response.py deleted file mode 100644 index 43a01e55291..00000000000 --- a/src/cloudflare/types/warp_connector_get_response.py +++ /dev/null @@ -1,186 +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 - -from .._models import BaseModel - -__all__ = [ - "WARPConnectorGetResponse", - "TunnelCfdTunnel", - "TunnelCfdTunnelConnection", - "TunnelWARPConnectorTunnel", - "TunnelWARPConnectorTunnelConnection", -] - - -class TunnelCfdTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelCfdTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -class TunnelWARPConnectorTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelWARPConnectorTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -WARPConnectorGetResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_list_response.py b/src/cloudflare/types/warp_connector_list_response.py deleted file mode 100644 index 019433baa2c..00000000000 --- a/src/cloudflare/types/warp_connector_list_response.py +++ /dev/null @@ -1,186 +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 - -from .._models import BaseModel - -__all__ = [ - "WARPConnectorListResponse", - "TunnelCfdTunnel", - "TunnelCfdTunnelConnection", - "TunnelWARPConnectorTunnel", - "TunnelWARPConnectorTunnelConnection", -] - - -class TunnelCfdTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelCfdTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -class TunnelWARPConnectorTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelWARPConnectorTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - -WARPConnectorListResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/web3/__init__.py b/src/cloudflare/types/web3/__init__.py index f4b73f59178..4cf398f3222 100644 --- a/src/cloudflare/types/web3/__init__.py +++ b/src/cloudflare/types/web3/__init__.py @@ -2,7 +2,9 @@ from __future__ import annotations +from .hostname import Hostname as Hostname +from .hostname_param import HostnameParam as HostnameParam from .hostname_edit_params import HostnameEditParams as HostnameEditParams from .hostname_create_params import HostnameCreateParams as HostnameCreateParams -from .distributed_web_hostname import DistributedWebHostname as DistributedWebHostname +from .hostname_delete_params import HostnameDeleteParams as HostnameDeleteParams from .hostname_delete_response import HostnameDeleteResponse as HostnameDeleteResponse diff --git a/src/cloudflare/types/web3/distributed_web_hostname.py b/src/cloudflare/types/web3/distributed_web_hostname.py deleted file mode 100644 index b52e645215e..00000000000 --- a/src/cloudflare/types/web3/distributed_web_hostname.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["DistributedWebHostname"] - - -class DistributedWebHostname(BaseModel): - id: Optional[str] = None - """Identifier""" - - created_on: Optional[datetime] = None - - description: Optional[str] = None - """An optional description of the hostname.""" - - dnslink: Optional[str] = None - """DNSLink value used if the target is ipfs.""" - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """The hostname that will point to the target gateway via CNAME.""" - - status: Optional[Literal["active", "pending", "deleting", "error"]] = None - """Status of the hostname's activation.""" - - target: Optional[Literal["ethereum", "ipfs", "ipfs_universal_path"]] = None - """Target gateway of the hostname.""" diff --git a/src/cloudflare/types/web3/hostname.py b/src/cloudflare/types/web3/hostname.py new file mode 100644 index 00000000000..befb6b79bf1 --- /dev/null +++ b/src/cloudflare/types/web3/hostname.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Hostname"] + + +class Hostname(BaseModel): + id: Optional[str] = None + """Identifier""" + + created_on: Optional[datetime] = None + + description: Optional[str] = None + """An optional description of the hostname.""" + + dnslink: Optional[str] = None + """DNSLink value used if the target is ipfs.""" + + modified_on: Optional[datetime] = None + + name: Optional[str] = None + """The hostname that will point to the target gateway via CNAME.""" + + status: Optional[Literal["active", "pending", "deleting", "error"]] = None + """Status of the hostname's activation.""" + + target: Optional[Literal["ethereum", "ipfs", "ipfs_universal_path"]] = None + """Target gateway of the hostname.""" diff --git a/src/cloudflare/types/web3/hostname_delete_params.py b/src/cloudflare/types/web3/hostname_delete_params.py new file mode 100644 index 00000000000..2ca89e1cf67 --- /dev/null +++ b/src/cloudflare/types/web3/hostname_delete_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__ = ["HostnameDeleteParams"] + + +class HostnameDeleteParams(TypedDict, total=False): + zone_identifier: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/web3/hostname_param.py b/src/cloudflare/types/web3/hostname_param.py new file mode 100644 index 00000000000..87d4041607d --- /dev/null +++ b/src/cloudflare/types/web3/hostname_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["HostnameParam"] + + +class HostnameParam(TypedDict, total=False): + description: str + """An optional description of the hostname.""" + + dnslink: str + """DNSLink value used if the target is ipfs.""" + + target: Literal["ethereum", "ipfs", "ipfs_universal_path"] + """Target gateway of the hostname.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/__init__.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/__init__.py index d04e7354b66..c97af8e9619 100644 --- a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/__init__.py +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/__init__.py @@ -2,5 +2,5 @@ from __future__ import annotations +from .content_list import ContentList as ContentList from .content_list_update_params import ContentListUpdateParams as ContentListUpdateParams -from .distributed_web_config_content_list import DistributedWebConfigContentList as DistributedWebConfigContentList diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_list.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_list.py new file mode 100644 index 00000000000..3585768a617 --- /dev/null +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_list.py @@ -0,0 +1,13 @@ +# 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__ = ["ContentList"] + + +class ContentList(BaseModel): + action: Optional[Literal["block"]] = None + """Behavior of the content list.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_list_update_params.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_list_update_params.py index 3f3fa96834b..a7758805219 100644 --- a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_list_update_params.py +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_list_update_params.py @@ -5,9 +5,7 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -from .content_lists import DistributedWebConfigContentListEntryParam - -__all__ = ["ContentListUpdateParams"] +__all__ = ["ContentListUpdateParams", "Entry"] class ContentListUpdateParams(TypedDict, total=False): @@ -17,5 +15,16 @@ class ContentListUpdateParams(TypedDict, total=False): action: Required[Literal["block"]] """Behavior of the content list.""" - entries: Required[Iterable[DistributedWebConfigContentListEntryParam]] + entries: Required[Iterable[Entry]] """Content list entries.""" + + +class Entry(TypedDict, total=False): + content: str + """CID or content path of content to block.""" + + description: str + """An optional description of the content list entry.""" + + type: Literal["cid", "content_path"] + """Type of content list entry to block.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/__init__.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/__init__.py index 45265480334..e28878b6b70 100644 --- a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/__init__.py +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/__init__.py @@ -2,13 +2,11 @@ from __future__ import annotations +from .entry_get_response import EntryGetResponse as EntryGetResponse from .entry_create_params import EntryCreateParams as EntryCreateParams +from .entry_delete_params import EntryDeleteParams as EntryDeleteParams from .entry_list_response import EntryListResponse as EntryListResponse from .entry_update_params import EntryUpdateParams as EntryUpdateParams +from .entry_create_response import EntryCreateResponse as EntryCreateResponse from .entry_delete_response import EntryDeleteResponse as EntryDeleteResponse -from .distributed_web_config_content_list_entry import ( - DistributedWebConfigContentListEntry as DistributedWebConfigContentListEntry, -) -from .distributed_web_config_content_list_entry_param import ( - DistributedWebConfigContentListEntryParam as DistributedWebConfigContentListEntryParam, -) +from .entry_update_response import EntryUpdateResponse as EntryUpdateResponse diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/distributed_web_config_content_list_entry.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/distributed_web_config_content_list_entry.py deleted file mode 100644 index c5fce5cb602..00000000000 --- a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/distributed_web_config_content_list_entry.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ......_models import BaseModel - -__all__ = ["DistributedWebConfigContentListEntry"] - - -class DistributedWebConfigContentListEntry(BaseModel): - id: Optional[str] = None - """Identifier""" - - content: Optional[str] = None - """CID or content path of content to block.""" - - created_on: Optional[datetime] = None - - description: Optional[str] = None - """An optional description of the content list entry.""" - - modified_on: Optional[datetime] = None - - type: Optional[Literal["cid", "content_path"]] = None - """Type of content list entry to block.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/distributed_web_config_content_list_entry_param.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/distributed_web_config_content_list_entry_param.py deleted file mode 100644 index 807e005c31a..00000000000 --- a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/distributed_web_config_content_list_entry_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, TypedDict - -__all__ = ["DistributedWebConfigContentListEntryParam"] - - -class DistributedWebConfigContentListEntryParam(TypedDict, total=False): - content: str - """CID or content path of content to block.""" - - description: str - """An optional description of the content list entry.""" - - type: Literal["cid", "content_path"] - """Type of content list entry to block.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_create_response.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_create_response.py new file mode 100644 index 00000000000..429847809f0 --- /dev/null +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_create_response.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ......_models import BaseModel + +__all__ = ["EntryCreateResponse"] + + +class EntryCreateResponse(BaseModel): + id: Optional[str] = None + """Identifier""" + + content: Optional[str] = None + """CID or content path of content to block.""" + + created_on: Optional[datetime] = None + + description: Optional[str] = None + """An optional description of the content list entry.""" + + modified_on: Optional[datetime] = None + + type: Optional[Literal["cid", "content_path"]] = None + """Type of content list entry to block.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_delete_params.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_delete_params.py new file mode 100644 index 00000000000..1a69c5ee227 --- /dev/null +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_delete_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__ = ["EntryDeleteParams"] + + +class EntryDeleteParams(TypedDict, total=False): + zone_identifier: Required[str] + """Identifier""" + + identifier: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_get_response.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_get_response.py new file mode 100644 index 00000000000..90c70bb7c57 --- /dev/null +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_get_response.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ......_models import BaseModel + +__all__ = ["EntryGetResponse"] + + +class EntryGetResponse(BaseModel): + id: Optional[str] = None + """Identifier""" + + content: Optional[str] = None + """CID or content path of content to block.""" + + created_on: Optional[datetime] = None + + description: Optional[str] = None + """An optional description of the content list entry.""" + + modified_on: Optional[datetime] = None + + type: Optional[Literal["cid", "content_path"]] = None + """Type of content list entry to block.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_list_response.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_list_response.py index d7b9953cb39..b1de50eaf73 100644 --- a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_list_response.py +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_list_response.py @@ -1,13 +1,32 @@ # 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 -from .distributed_web_config_content_list_entry import DistributedWebConfigContentListEntry -__all__ = ["EntryListResponse"] +__all__ = ["EntryListResponse", "Entry"] + + +class Entry(BaseModel): + id: Optional[str] = None + """Identifier""" + + content: Optional[str] = None + """CID or content path of content to block.""" + + created_on: Optional[datetime] = None + + description: Optional[str] = None + """An optional description of the content list entry.""" + + modified_on: Optional[datetime] = None + + type: Optional[Literal["cid", "content_path"]] = None + """Type of content list entry to block.""" class EntryListResponse(BaseModel): - entries: Optional[List[DistributedWebConfigContentListEntry]] = None + entries: Optional[List[Entry]] = None """Content list entries.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_update_response.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_update_response.py new file mode 100644 index 00000000000..e61fc00ffee --- /dev/null +++ b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/content_lists/entry_update_response.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ......_models import BaseModel + +__all__ = ["EntryUpdateResponse"] + + +class EntryUpdateResponse(BaseModel): + id: Optional[str] = None + """Identifier""" + + content: Optional[str] = None + """CID or content path of content to block.""" + + created_on: Optional[datetime] = None + + description: Optional[str] = None + """An optional description of the content list entry.""" + + modified_on: Optional[datetime] = None + + type: Optional[Literal["cid", "content_path"]] = None + """Type of content list entry to block.""" diff --git a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/distributed_web_config_content_list.py b/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/distributed_web_config_content_list.py deleted file mode 100644 index 8151db7cbce..00000000000 --- a/src/cloudflare/types/web3/hostnames/ipfs_universal_paths/distributed_web_config_content_list.py +++ /dev/null @@ -1,13 +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__ = ["DistributedWebConfigContentList"] - - -class DistributedWebConfigContentList(BaseModel): - action: Optional[Literal["block"]] = None - """Behavior of the content list.""" diff --git a/src/cloudflare/types/workers/__init__.py b/src/cloudflare/types/workers/__init__.py index 64fead694f0..0a1b7dabef1 100644 --- a/src/cloudflare/types/workers/__init__.py +++ b/src/cloudflare/types/workers/__init__.py @@ -2,27 +2,44 @@ from __future__ import annotations +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 .workers_route import WorkersRoute as WorkersRoute -from .workers_domain import WorkersDomain as WorkersDomain -from .workers_filter import WorkersFilter as WorkersFilter -from .workers_script import WorkersScript as WorkersScript +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_create_params import RouteCreateParams as RouteCreateParams -from .route_update_params import RouteUpdateParams as RouteUpdateParams +from .domain_delete_params import DomainDeleteParams as DomainDeleteParams from .domain_update_params import DomainUpdateParams as DomainUpdateParams -from .filter_create_params import FilterCreateParams as FilterCreateParams -from .filter_update_params import FilterUpdateParams as FilterUpdateParams +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 .route_create_response import RouteCreateResponse as RouteCreateResponse -from .route_delete_response import RouteDeleteResponse as RouteDeleteResponse -from .filter_create_response import FilterCreateResponse as FilterCreateResponse -from .filter_delete_response import FilterDeleteResponse as FilterDeleteResponse +from .service_binding_param import ServiceBindingParam as ServiceBindingParam +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 .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/ai_run_params.py b/src/cloudflare/types/workers/ai_run_params.py index f29e3068b68..888e17d7d99 100644 --- a/src/cloudflare/types/workers/ai_run_params.py +++ b/src/cloudflare/types/workers/ai_run_params.py @@ -19,6 +19,7 @@ "Translation", "Summarization", "ImageToText", + "ImageToTextMessage", ] @@ -119,12 +120,24 @@ class Summarization(TypedDict, total=False): class ImageToText(TypedDict, total=False): account_id: Required[str] - image: Iterable[float] + image: Required[Iterable[float]] max_tokens: int + messages: Iterable[ImageToTextMessage] + prompt: str + raw: bool + + temperature: float + + +class ImageToTextMessage(TypedDict, total=False): + content: Required[str] + + role: Required[str] + AIRunParams = Union[ TextClassification, diff --git a/src/cloudflare/types/workers/binding.py b/src/cloudflare/types/workers/binding.py new file mode 100644 index 00000000000..e2bf21c1be4 --- /dev/null +++ b/src/cloudflare/types/workers/binding.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal + +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"] + + +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.""" + + +Binding = Union[ + KVNamespaceBinding, + ServiceBinding, + DurableObjectBinding, + R2Binding, + WorkersQueueBinding, + D1Binding, + DispatchNamespaceBinding, + MTLSCERTBinding, +] diff --git a/src/cloudflare/types/workers/binding_param.py b/src/cloudflare/types/workers/binding_param.py new file mode 100644 index 00000000000..478be46927b --- /dev/null +++ b/src/cloudflare/types/workers/binding_param.py @@ -0,0 +1,36 @@ +# 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, 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"] + + +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.""" + + +BindingParam = Union[ + KVNamespaceBindingParam, + ServiceBindingParam, + DurableObjectBindingParam, + R2BindingParam, + WorkersQueueBinding, + D1BindingParam, + DispatchNamespaceBindingParam, + MTLSCERTBindingParam, +] diff --git a/src/cloudflare/types/workers/d1_binding.py b/src/cloudflare/types/workers/d1_binding.py new file mode 100644 index 00000000000..7010fcfa068 --- /dev/null +++ b/src/cloudflare/types/workers/d1_binding.py @@ -0,0 +1,21 @@ +# 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 new file mode 100644 index 00000000000..74face1628f --- /dev/null +++ b/src/cloudflare/types/workers/d1_binding_param.py @@ -0,0 +1,18 @@ +# 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/deployments/__init__.py b/src/cloudflare/types/workers/deployments/__init__.py deleted file mode 100644 index ea1470ce8e2..00000000000 --- a/src/cloudflare/types/workers/deployments/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .by_script_get_response import ByScriptGetResponse as ByScriptGetResponse diff --git a/src/cloudflare/types/workers/deployments/by_script_get_response.py b/src/cloudflare/types/workers/deployments/by_script_get_response.py deleted file mode 100644 index fb8906f16fc..00000000000 --- a/src/cloudflare/types/workers/deployments/by_script_get_response.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["ByScriptGetResponse"] - - -class ByScriptGetResponse(BaseModel): - items: Optional[List[object]] = None - - latest: Optional[object] = None diff --git a/src/cloudflare/types/workers/deployments/by_scripts/__init__.py b/src/cloudflare/types/workers/deployments/by_scripts/__init__.py deleted file mode 100644 index 4c6d7381f8d..00000000000 --- a/src/cloudflare/types/workers/deployments/by_scripts/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .detail_get_response import DetailGetResponse as DetailGetResponse diff --git a/src/cloudflare/types/workers/deployments/by_scripts/detail_get_response.py b/src/cloudflare/types/workers/deployments/by_scripts/detail_get_response.py deleted file mode 100644 index 53d1943d50e..00000000000 --- a/src/cloudflare/types/workers/deployments/by_scripts/detail_get_response.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 ....._models import BaseModel - -__all__ = ["DetailGetResponse"] - - -class DetailGetResponse(BaseModel): - id: Optional[str] = None - - metadata: Optional[object] = None - - number: Optional[float] = None - - resources: Optional[object] = None diff --git a/src/cloudflare/types/workers/dispatch_namespace_binding.py b/src/cloudflare/types/workers/dispatch_namespace_binding.py new file mode 100644 index 00000000000..7211e0a0dbb --- /dev/null +++ b/src/cloudflare/types/workers/dispatch_namespace_binding.py @@ -0,0 +1,41 @@ +# 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 new file mode 100644 index 00000000000..584c5d86e15 --- /dev/null +++ b/src/cloudflare/types/workers/dispatch_namespace_binding_param.py @@ -0,0 +1,38 @@ +# 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/domain.py b/src/cloudflare/types/workers/domain.py new file mode 100644 index 00000000000..81b1799627b --- /dev/null +++ b/src/cloudflare/types/workers/domain.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Domain"] + + +class Domain(BaseModel): + id: Optional[str] = None + """Identifer of the Worker Domain.""" + + environment: Optional[str] = None + """Worker environment associated with the zone and hostname.""" + + hostname: Optional[str] = None + """Hostname of the Worker Domain.""" + + service: Optional[str] = None + """Worker service associated with the zone and hostname.""" + + zone_id: Optional[str] = None + """Identifier of the zone.""" + + zone_name: Optional[str] = None + """Name of the zone.""" diff --git a/src/cloudflare/types/workers/domain_delete_params.py b/src/cloudflare/types/workers/domain_delete_params.py new file mode 100644 index 00000000000..59d634fdbef --- /dev/null +++ b/src/cloudflare/types/workers/domain_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["DomainDeleteParams"] + + +class DomainDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/workers/durable_object_binding.py b/src/cloudflare/types/workers/durable_object_binding.py new file mode 100644 index 00000000000..acef5a67aae --- /dev/null +++ b/src/cloudflare/types/workers/durable_object_binding.py @@ -0,0 +1,30 @@ +# 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 new file mode 100644 index 00000000000..6c00bbd63a9 --- /dev/null +++ b/src/cloudflare/types/workers/durable_object_binding_param.py @@ -0,0 +1,23 @@ +# 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/filter_create_params.py b/src/cloudflare/types/workers/filter_create_params.py deleted file mode 100644 index 93ec5dfc940..00000000000 --- a/src/cloudflare/types/workers/filter_create_params.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 Required, TypedDict - -__all__ = ["FilterCreateParams"] - - -class FilterCreateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - enabled: Required[bool] - - pattern: Required[str] diff --git a/src/cloudflare/types/workers/filter_create_response.py b/src/cloudflare/types/workers/filter_create_response.py deleted file mode 100644 index 3d03316378c..00000000000 --- a/src/cloudflare/types/workers/filter_create_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["FilterCreateResponse"] - - -class FilterCreateResponse(BaseModel): - id: str - """Identifier""" diff --git a/src/cloudflare/types/workers/filter_delete_response.py b/src/cloudflare/types/workers/filter_delete_response.py deleted file mode 100644 index 557d1f24790..00000000000 --- a/src/cloudflare/types/workers/filter_delete_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["FilterDeleteResponse"] - - -class FilterDeleteResponse(BaseModel): - id: str - """Identifier""" diff --git a/src/cloudflare/types/workers/filter_update_params.py b/src/cloudflare/types/workers/filter_update_params.py deleted file mode 100644 index 601049d7b5f..00000000000 --- a/src/cloudflare/types/workers/filter_update_params.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 Required, TypedDict - -__all__ = ["FilterUpdateParams"] - - -class FilterUpdateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - enabled: Required[bool] - - pattern: Required[str] diff --git a/src/cloudflare/types/workers/kv_namespace_binding.py b/src/cloudflare/types/workers/kv_namespace_binding.py new file mode 100644 index 00000000000..bf28ce9caac --- /dev/null +++ b/src/cloudflare/types/workers/kv_namespace_binding.py @@ -0,0 +1,18 @@ +# 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 new file mode 100644 index 00000000000..7dc97bab2a6 --- /dev/null +++ b/src/cloudflare/types/workers/kv_namespace_binding_param.py @@ -0,0 +1,12 @@ +# 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/migration_step.py b/src/cloudflare/types/workers/migration_step.py new file mode 100644 index 00000000000..c345d2027b6 --- /dev/null +++ b/src/cloudflare/types/workers/migration_step.py @@ -0,0 +1,40 @@ +# 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__ = ["MigrationStep", "RenamedClass", "TransferredClass"] + + +class RenamedClass(BaseModel): + from_: Optional[str] = FieldInfo(alias="from", default=None) + + to: Optional[str] = None + + +class TransferredClass(BaseModel): + from_: Optional[str] = FieldInfo(alias="from", default=None) + + from_script: Optional[str] = None + + to: Optional[str] = None + + +class MigrationStep(BaseModel): + deleted_classes: Optional[List[str]] = None + """A list of classes to delete Durable Object namespaces from.""" + + new_classes: Optional[List[str]] = None + """A list of classes to create Durable Object namespaces from.""" + + renamed_classes: Optional[List[RenamedClass]] = None + """A list of classes with Durable Object namespaces that were renamed.""" + + transferred_classes: Optional[List[TransferredClass]] = None + """ + A list of transfers for Durable Object namespaces from a different Worker and + class to a class defined in this Worker. + """ diff --git a/src/cloudflare/types/workers/migration_step_param.py b/src/cloudflare/types/workers/migration_step_param.py new file mode 100644 index 00000000000..87c80f048fc --- /dev/null +++ b/src/cloudflare/types/workers/migration_step_param.py @@ -0,0 +1,52 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import TypedDict + +__all__ = ["MigrationStepParam", "RenamedClass", "TransferredClass"] + +_RenamedClassReservedKeywords = TypedDict( + "_RenamedClassReservedKeywords", + { + "from": str, + }, + total=False, +) + + +class RenamedClass(_RenamedClassReservedKeywords, total=False): + to: str + + +_TransferredClassReservedKeywords = TypedDict( + "_TransferredClassReservedKeywords", + { + "from": str, + }, + total=False, +) + + +class TransferredClass(_TransferredClassReservedKeywords, total=False): + from_script: str + + to: str + + +class MigrationStepParam(TypedDict, total=False): + deleted_classes: List[str] + """A list of classes to delete Durable Object namespaces from.""" + + new_classes: List[str] + """A list of classes to create Durable Object namespaces from.""" + + renamed_classes: Iterable[RenamedClass] + """A list of classes with Durable Object namespaces that were renamed.""" + + transferred_classes: Iterable[TransferredClass] + """ + A list of transfers for Durable Object namespaces from a different Worker and + class to a class defined in this Worker. + """ diff --git a/src/cloudflare/types/workers/mtls_cert_binding.py b/src/cloudflare/types/workers/mtls_cert_binding.py new file mode 100644 index 00000000000..ce77744c7c7 --- /dev/null +++ b/src/cloudflare/types/workers/mtls_cert_binding.py @@ -0,0 +1,21 @@ +# 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__ = ["MTLSCERTBinding"] + + +class MTLSCERTBinding(BaseModel): + certificate: object + + name: str + """A JavaScript variable name for the binding.""" + + type: Literal["mtls_certificate"] + """The class of resource that the binding provides.""" + + certificate_id: Optional[str] = None + """ID of the certificate to bind to""" diff --git a/src/cloudflare/types/workers/mtls_cert_binding_param.py b/src/cloudflare/types/workers/mtls_cert_binding_param.py new file mode 100644 index 00000000000..e6d8c865b55 --- /dev/null +++ b/src/cloudflare/types/workers/mtls_cert_binding_param.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 Literal, Required, TypedDict + +__all__ = ["MTLSCERTBindingParam"] + + +class MTLSCERTBindingParam(TypedDict, total=False): + certificate: Required[object] + + type: Required[Literal["mtls_certificate"]] + """The class of resource that the binding provides.""" + + certificate_id: str + """ID of the certificate to bind to""" diff --git a/src/cloudflare/types/workers/placement_configuration.py b/src/cloudflare/types/workers/placement_configuration.py new file mode 100644 index 00000000000..0eb2b9eec7d --- /dev/null +++ b/src/cloudflare/types/workers/placement_configuration.py @@ -0,0 +1,17 @@ +# 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 new file mode 100644 index 00000000000..f6ef4c070fd --- /dev/null +++ b/src/cloudflare/types/workers/placement_configuration_param.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000000..523844ac272 --- /dev/null +++ b/src/cloudflare/types/workers/r2_binding.py @@ -0,0 +1,18 @@ +# 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 new file mode 100644 index 00000000000..559667ded10 --- /dev/null +++ b/src/cloudflare/types/workers/r2_binding_param.py @@ -0,0 +1,15 @@ +# 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 deleted file mode 100644 index 479c701b0e9..00000000000 --- a/src/cloudflare/types/workers/route_create_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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/workers/route_create_response.py b/src/cloudflare/types/workers/route_create_response.py deleted file mode 100644 index c841ac52d0e..00000000000 --- a/src/cloudflare/types/workers/route_create_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["RouteCreateResponse"] - -RouteCreateResponse = Union[str, object] diff --git a/src/cloudflare/types/workers/route_delete_response.py b/src/cloudflare/types/workers/route_delete_response.py deleted file mode 100644 index f84ca5cc534..00000000000 --- a/src/cloudflare/types/workers/route_delete_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["RouteDeleteResponse"] - -RouteDeleteResponse = Union[str, object] diff --git a/src/cloudflare/types/workers/route_update_params.py b/src/cloudflare/types/workers/route_update_params.py deleted file mode 100644 index d4954d0bd6a..00000000000 --- a/src/cloudflare/types/workers/route_update_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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/script.py b/src/cloudflare/types/workers/script.py new file mode 100644 index 00000000000..233187b23ec --- /dev/null +++ b/src/cloudflare/types/workers/script.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel +from .scripts.consumer_script import ConsumerScript + +__all__ = ["Script"] + + +class Script(BaseModel): + id: Optional[str] = None + """The id of the script in the Workers system. Usually the script name.""" + + created_on: Optional[datetime] = None + """When the script was created.""" + + etag: Optional[str] = None + """Hashed script content, can be used in a If-None-Match header when updating.""" + + logpush: Optional[bool] = None + """Whether Logpush is turned on for the Worker.""" + + 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').""" + + 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').""" diff --git a/src/cloudflare/types/workers/script_delete_params.py b/src/cloudflare/types/workers/script_delete_params.py index 1d8d872feca..0766c499c83 100644 --- a/src/cloudflare/types/workers/script_delete_params.py +++ b/src/cloudflare/types/workers/script_delete_params.py @@ -11,6 +11,8 @@ class ScriptDeleteParams(TypedDict, total=False): account_id: Required[str] """Identifier""" + body: Required[object] + force: bool """ If set to true, delete will not be stopped by associated service binding, diff --git a/src/cloudflare/types/workers/script_setting.py b/src/cloudflare/types/workers/script_setting.py new file mode 100644 index 00000000000..9b0b43d6364 --- /dev/null +++ b/src/cloudflare/types/workers/script_setting.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .scripts.consumer_script import ConsumerScript + +__all__ = ["ScriptSetting"] + + +class ScriptSetting(BaseModel): + logpush: Optional[bool] = None + """Whether Logpush is turned on for the Worker.""" + + tail_consumers: Optional[List[ConsumerScript]] = None + """List of Workers that will consume logs from the attached Worker.""" diff --git a/src/cloudflare/types/workers/script_update_params.py b/src/cloudflare/types/workers/script_update_params.py index f5d078c31e2..5f85fd04e21 100644 --- a/src/cloudflare/types/workers/script_update_params.py +++ b/src/cloudflare/types/workers/script_update_params.py @@ -7,23 +7,12 @@ from ..._types import FileTypes from ..._utils import PropertyInfo +from .stepped_migration_param import SteppedMigrationParam +from .single_step_migration_param import SingleStepMigrationParam +from .placement_configuration_param import PlacementConfigurationParam +from .scripts.consumer_script_param import ConsumerScriptParam -__all__ = [ - "ScriptUpdateParams", - "Variant0", - "Variant0Metadata", - "Variant0MetadataMigrations", - "Variant0MetadataMigrationsWorkersSingleStepMigrations", - "Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass", - "Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass", - "Variant0MetadataMigrationsWorkersSteppedMigrations", - "Variant0MetadataMigrationsWorkersSteppedMigrationsStep", - "Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClass", - "Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClass", - "Variant0MetadataPlacement", - "Variant0MetadataTailConsumer", - "Variant1", -] +__all__ = ["ScriptUpdateParams", "Variant0", "Variant0Metadata", "Variant0MetadataMigrations", "Variant1"] class Variant0(TypedDict, total=False): @@ -43,157 +32,15 @@ class Variant0(TypedDict, total=False): 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. + `body_part` by part name. Source maps may also be included using the + `application/source-map` content type. """ metadata: Variant0Metadata """JSON encoded metadata about the uploaded parts and Worker configuration.""" -_Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords = TypedDict( - "_Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass( - _Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords, total=False -): - to: str - - -_Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords = TypedDict( - "_Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass( - _Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class Variant0MetadataMigrationsWorkersSingleStepMigrations(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Iterable[Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -_Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords = TypedDict( - "_Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClass( - _Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords, total=False -): - to: str - - -_Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords = TypedDict( - "_Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClass( - _Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class Variant0MetadataMigrationsWorkersSteppedMigrationsStep(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Iterable[Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class Variant0MetadataMigrationsWorkersSteppedMigrations(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[Variant0MetadataMigrationsWorkersSteppedMigrationsStep] - """Migrations to apply in order.""" - - -Variant0MetadataMigrations = Union[ - Variant0MetadataMigrationsWorkersSingleStepMigrations, Variant0MetadataMigrationsWorkersSteppedMigrations -] - - -class Variant0MetadataPlacement(TypedDict, total=False): - mode: Literal["smart"] - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class Variant0MetadataTailConsumer(TypedDict, total=False): - service: Required[str] - """Name of Worker that is to be the consumer.""" - - environment: str - """Optional environment if the Worker utilizes one.""" - - namespace: str - """Optional dispatch namespace the script belongs to.""" +Variant0MetadataMigrations = Union[SingleStepMigrationParam, SteppedMigrationParam] class Variant0Metadata(TypedDict, total=False): @@ -236,12 +83,12 @@ class Variant0Metadata(TypedDict, total=False): migrations: Variant0MetadataMigrations """Migrations to apply for Durable Objects associated with this Worker.""" - placement: Variant0MetadataPlacement + placement: PlacementConfigurationParam tags: List[str] """List of strings to use as tags for this Worker""" - tail_consumers: Iterable[Variant0MetadataTailConsumer] + tail_consumers: Iterable[ConsumerScriptParam] """List of Workers that will consume logs from the attached Worker.""" usage_model: Literal["bundled", "unbound"] diff --git a/src/cloudflare/types/workers/scripts/__init__.py b/src/cloudflare/types/workers/scripts/__init__.py index cff0ed258aa..dca9f8b1963 100644 --- a/src/cloudflare/types/workers/scripts/__init__.py +++ b/src/cloudflare/types/workers/scripts/__init__.py @@ -2,18 +2,26 @@ from __future__ import annotations -from .workers_binding import WorkersBinding as WorkersBinding +from .schedule import Schedule as Schedule +from .deployment import Deployment as Deployment +from .schedule_param import ScheduleParam as ScheduleParam +from .consumer_script import ConsumerScript as ConsumerScript +from .deployment_param import DeploymentParam as DeploymentParam from .tail_get_response import TailGetResponse as TailGetResponse +from .tail_create_params import TailCreateParams as TailCreateParams +from .tail_delete_params import TailDeleteParams as TailDeleteParams from .setting_edit_params import SettingEditParams as SettingEditParams -from .binding_get_response import BindingGetResponse as BindingGetResponse -from .setting_get_response import SettingGetResponse as SettingGetResponse from .tail_create_response import TailCreateResponse as TailCreateResponse from .tail_delete_response import TailDeleteResponse as TailDeleteResponse +from .version_get_response import VersionGetResponse as VersionGetResponse +from .consumer_script_param import ConsumerScriptParam as ConsumerScriptParam from .content_update_params import ContentUpdateParams as ContentUpdateParams from .schedule_get_response import ScheduleGetResponse as ScheduleGetResponse -from .setting_edit_response import SettingEditResponse as SettingEditResponse +from .version_create_params import VersionCreateParams as VersionCreateParams +from .version_list_response import VersionListResponse as VersionListResponse from .schedule_update_params import ScheduleUpdateParams as ScheduleUpdateParams +from .deployment_get_response import DeploymentGetResponse as DeploymentGetResponse +from .version_create_response import VersionCreateResponse as VersionCreateResponse +from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams from .schedule_update_response import ScheduleUpdateResponse as ScheduleUpdateResponse -from .usage_model_get_response import UsageModelGetResponse as UsageModelGetResponse -from .usage_model_update_params import UsageModelUpdateParams as UsageModelUpdateParams -from .usage_model_update_response import UsageModelUpdateResponse as UsageModelUpdateResponse +from .deployment_create_response import DeploymentCreateResponse as DeploymentCreateResponse diff --git a/src/cloudflare/types/workers/scripts/binding_get_response.py b/src/cloudflare/types/workers/scripts/binding_get_response.py deleted file mode 100644 index 92532801f20..00000000000 --- a/src/cloudflare/types/workers/scripts/binding_get_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .workers_binding import WorkersBinding - -__all__ = ["BindingGetResponse"] - -BindingGetResponse = List[WorkersBinding] diff --git a/src/cloudflare/types/workers/scripts/consumer_script.py b/src/cloudflare/types/workers/scripts/consumer_script.py new file mode 100644 index 00000000000..6d933e952fc --- /dev/null +++ b/src/cloudflare/types/workers/scripts/consumer_script.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["ConsumerScript"] + + +class ConsumerScript(BaseModel): + service: str + """Name of Worker that is to be the consumer.""" + + environment: Optional[str] = None + """Optional environment if the Worker utilizes one.""" + + namespace: Optional[str] = None + """Optional dispatch namespace the script belongs to.""" diff --git a/src/cloudflare/types/workers/scripts/consumer_script_param.py b/src/cloudflare/types/workers/scripts/consumer_script_param.py new file mode 100644 index 00000000000..2d7996c8449 --- /dev/null +++ b/src/cloudflare/types/workers/scripts/consumer_script_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ConsumerScriptParam"] + + +class ConsumerScriptParam(TypedDict, total=False): + service: Required[str] + """Name of Worker that is to be the consumer.""" + + environment: str + """Optional environment if the Worker utilizes one.""" + + namespace: str + """Optional dispatch namespace the script belongs to.""" diff --git a/src/cloudflare/types/workers/scripts/content_update_params.py b/src/cloudflare/types/workers/scripts/content_update_params.py index e19775eaa3c..8cc85869cad 100644 --- a/src/cloudflare/types/workers/scripts/content_update_params.py +++ b/src/cloudflare/types/workers/scripts/content_update_params.py @@ -7,8 +7,9 @@ from ...._types import FileTypes from ...._utils import PropertyInfo +from ..worker_metadata_param import WorkerMetadataParam -__all__ = ["ContentUpdateParams", "Metadata"] +__all__ = ["ContentUpdateParams"] class ContentUpdateParams(TypedDict, total=False): @@ -22,23 +23,9 @@ class ContentUpdateParams(TypedDict, total=False): 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. + part name. Source maps may also be included using the `application/source-map` + content type. """ - metadata: Metadata + metadata: WorkerMetadataParam """JSON encoded metadata about the uploaded parts and Worker configuration.""" - - -class Metadata(TypedDict, total=False): - body_part: str - """Name of the part in the multipart request that contains the script (e.g. - - the file adding a listener to the `fetch` event). Indicates a - `service worker syntax` Worker. - """ - - 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. - """ diff --git a/src/cloudflare/types/workers/scripts/deployment.py b/src/cloudflare/types/workers/scripts/deployment.py new file mode 100644 index 00000000000..a07f4231c28 --- /dev/null +++ b/src/cloudflare/types/workers/scripts/deployment.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["Deployment"] + + +class Deployment(BaseModel): + workers_message: Optional[str] = FieldInfo(alias="workers/message", default=None) + """Human-readable message about the deployment.""" diff --git a/src/cloudflare/types/workers/scripts/deployment_create_params.py b/src/cloudflare/types/workers/scripts/deployment_create_params.py new file mode 100644 index 00000000000..e9f1f6b7a17 --- /dev/null +++ b/src/cloudflare/types/workers/scripts/deployment_create_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .deployment_param import DeploymentParam + +__all__ = ["DeploymentCreateParams"] + + +class DeploymentCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + annotations: DeploymentParam + + strategy: str diff --git a/src/cloudflare/types/workers/scripts/deployment_create_response.py b/src/cloudflare/types/workers/scripts/deployment_create_response.py new file mode 100644 index 00000000000..8625732c33c --- /dev/null +++ b/src/cloudflare/types/workers/scripts/deployment_create_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel +from .deployment import Deployment + +__all__ = ["DeploymentCreateResponse"] + + +class DeploymentCreateResponse(BaseModel): + id: Optional[str] = None + + annotations: Optional[Deployment] = None + + author_email: Optional[str] = None + + created_on: Optional[str] = None + + source: Optional[str] = None + + strategy: Optional[str] = None diff --git a/src/cloudflare/types/workers/scripts/deployment_get_response.py b/src/cloudflare/types/workers/scripts/deployment_get_response.py new file mode 100644 index 00000000000..9224f4034cc --- /dev/null +++ b/src/cloudflare/types/workers/scripts/deployment_get_response.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from . import deployment +from ...._models import BaseModel + +__all__ = ["DeploymentGetResponse", "Deployment"] + + +class Deployment(BaseModel): + id: Optional[str] = None + + annotations: Optional[deployment.Deployment] = None + + author_email: Optional[str] = None + + created_on: Optional[str] = None + + source: Optional[str] = None + + strategy: Optional[str] = None + + +class DeploymentGetResponse(BaseModel): + deployments: Optional[List[Deployment]] = None diff --git a/src/cloudflare/types/workers/scripts/deployment_param.py b/src/cloudflare/types/workers/scripts/deployment_param.py new file mode 100644 index 00000000000..c25292cba40 --- /dev/null +++ b/src/cloudflare/types/workers/scripts/deployment_param.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 Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["DeploymentParam"] + + +class DeploymentParam(TypedDict, total=False): + workers_message: Annotated[str, PropertyInfo(alias="workers/message")] + """Human-readable message about the deployment.""" diff --git a/src/cloudflare/types/workers/scripts/schedule.py b/src/cloudflare/types/workers/scripts/schedule.py new file mode 100644 index 00000000000..28b027a0796 --- /dev/null +++ b/src/cloudflare/types/workers/scripts/schedule.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__ = ["Schedule"] + + +class Schedule(BaseModel): + created_on: Optional[object] = None + + cron: Optional[object] = None + + modified_on: Optional[object] = None diff --git a/src/cloudflare/types/workers/scripts/schedule_get_response.py b/src/cloudflare/types/workers/scripts/schedule_get_response.py index f0d5df2f111..5d430c7ce85 100644 --- a/src/cloudflare/types/workers/scripts/schedule_get_response.py +++ b/src/cloudflare/types/workers/scripts/schedule_get_response.py @@ -2,17 +2,10 @@ from typing import List, Optional +from .schedule import Schedule from ...._models import BaseModel -__all__ = ["ScheduleGetResponse", "Schedule"] - - -class Schedule(BaseModel): - created_on: Optional[object] = None - - cron: Optional[object] = None - - modified_on: Optional[object] = None +__all__ = ["ScheduleGetResponse"] class ScheduleGetResponse(BaseModel): diff --git a/src/cloudflare/types/workers/scripts/schedule_param.py b/src/cloudflare/types/workers/scripts/schedule_param.py new file mode 100644 index 00000000000..5054e6e4f94 --- /dev/null +++ b/src/cloudflare/types/workers/scripts/schedule_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ScheduleParam"] + + +class ScheduleParam(TypedDict, total=False): + pass diff --git a/src/cloudflare/types/workers/scripts/schedule_update_response.py b/src/cloudflare/types/workers/scripts/schedule_update_response.py index 7a2565993a1..0024bf49131 100644 --- a/src/cloudflare/types/workers/scripts/schedule_update_response.py +++ b/src/cloudflare/types/workers/scripts/schedule_update_response.py @@ -2,17 +2,10 @@ from typing import List, Optional +from .schedule import Schedule from ...._models import BaseModel -__all__ = ["ScheduleUpdateResponse", "Schedule"] - - -class Schedule(BaseModel): - created_on: Optional[object] = None - - cron: Optional[object] = None - - modified_on: Optional[object] = None +__all__ = ["ScheduleUpdateResponse"] class ScheduleUpdateResponse(BaseModel): diff --git a/src/cloudflare/types/workers/scripts/setting_edit_params.py b/src/cloudflare/types/workers/scripts/setting_edit_params.py index b99fd88f5d7..760ce3ac226 100644 --- a/src/cloudflare/types/workers/scripts/setting_edit_params.py +++ b/src/cloudflare/types/workers/scripts/setting_edit_params.py @@ -2,346 +2,20 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict +from typing import Iterable +from typing_extensions import Required, TypedDict -__all__ = [ - "SettingEditParams", - "Settings", - "SettingsError", - "SettingsMessage", - "SettingsResult", - "SettingsResultBinding", - "SettingsResultBindingWorkersKVNamespaceBinding", - "SettingsResultBindingWorkersServiceBinding", - "SettingsResultBindingWorkersDoBinding", - "SettingsResultBindingWorkersR2Binding", - "SettingsResultBindingWorkersQueueBinding", - "SettingsResultBindingWorkersD1Binding", - "SettingsResultBindingWorkersDispatchNamespaceBinding", - "SettingsResultBindingWorkersDispatchNamespaceBindingOutbound", - "SettingsResultBindingWorkersDispatchNamespaceBindingOutboundWorker", - "SettingsResultBindingWorkersMTLSCERTBinding", - "SettingsResultMigrations", - "SettingsResultMigrationsWorkersSingleStepMigrations", - "SettingsResultMigrationsWorkersSingleStepMigrationsRenamedClass", - "SettingsResultMigrationsWorkersSingleStepMigrationsTransferredClass", - "SettingsResultMigrationsWorkersSteppedMigrations", - "SettingsResultMigrationsWorkersSteppedMigrationsStep", - "SettingsResultMigrationsWorkersSteppedMigrationsStepRenamedClass", - "SettingsResultMigrationsWorkersSteppedMigrationsStepTransferredClass", - "SettingsResultPlacement", - "SettingsResultTailConsumer", -] +from .consumer_script_param import ConsumerScriptParam + +__all__ = ["SettingEditParams"] class SettingEditParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - settings: Settings - - -class SettingsError(TypedDict, total=False): - code: Required[int] - - message: Required[str] - - -class SettingsMessage(TypedDict, total=False): - code: Required[int] - - message: Required[str] - - -class SettingsResultBindingWorkersKVNamespaceBinding(TypedDict, total=False): - type: Required[Literal["kv_namespace"]] - """The class of resource that the binding provides.""" - - -class SettingsResultBindingWorkersServiceBinding(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.""" - - -class SettingsResultBindingWorkersDoBinding(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 - """ - - -class SettingsResultBindingWorkersR2Binding(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.""" - - -class SettingsResultBindingWorkersQueueBinding(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 SettingsResultBindingWorkersD1Binding(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.""" - - -class SettingsResultBindingWorkersDispatchNamespaceBindingOutboundWorker(TypedDict, total=False): - environment: str - """Environment of the outbound worker""" - - service: str - """Name of the outbound worker""" - - -class SettingsResultBindingWorkersDispatchNamespaceBindingOutbound(TypedDict, total=False): - params: List[str] - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: SettingsResultBindingWorkersDispatchNamespaceBindingOutboundWorker - """Outbound worker""" - - -class SettingsResultBindingWorkersDispatchNamespaceBinding(TypedDict, total=False): - namespace: Required[str] - """Namespace to bind to""" - - type: Required[Literal["dispatch_namespace"]] - """The class of resource that the binding provides.""" - - outbound: SettingsResultBindingWorkersDispatchNamespaceBindingOutbound - """Outbound worker""" - - -class SettingsResultBindingWorkersMTLSCERTBinding(TypedDict, total=False): - type: Required[Literal["mtls_certificate"]] - """The class of resource that the binding provides.""" - - certificate_id: str - """ID of the certificate to bind to""" - - -SettingsResultBinding = Union[ - SettingsResultBindingWorkersKVNamespaceBinding, - SettingsResultBindingWorkersServiceBinding, - SettingsResultBindingWorkersDoBinding, - SettingsResultBindingWorkersR2Binding, - SettingsResultBindingWorkersQueueBinding, - SettingsResultBindingWorkersD1Binding, - SettingsResultBindingWorkersDispatchNamespaceBinding, - SettingsResultBindingWorkersMTLSCERTBinding, -] - -_SettingsResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords = TypedDict( - "_SettingsResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class SettingsResultMigrationsWorkersSingleStepMigrationsRenamedClass( - _SettingsResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords, total=False -): - to: str - - -_SettingsResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords = TypedDict( - "_SettingsResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class SettingsResultMigrationsWorkersSingleStepMigrationsTransferredClass( - _SettingsResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class SettingsResultMigrationsWorkersSingleStepMigrations(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Iterable[SettingsResultMigrationsWorkersSingleStepMigrationsRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[SettingsResultMigrationsWorkersSingleStepMigrationsTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -_SettingsResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords = TypedDict( - "_SettingsResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class SettingsResultMigrationsWorkersSteppedMigrationsStepRenamedClass( - _SettingsResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords, total=False -): - to: str - - -_SettingsResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords = TypedDict( - "_SettingsResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class SettingsResultMigrationsWorkersSteppedMigrationsStepTransferredClass( - _SettingsResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class SettingsResultMigrationsWorkersSteppedMigrationsStep(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Iterable[SettingsResultMigrationsWorkersSteppedMigrationsStepRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[SettingsResultMigrationsWorkersSteppedMigrationsStepTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class SettingsResultMigrationsWorkersSteppedMigrations(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[SettingsResultMigrationsWorkersSteppedMigrationsStep] - """Migrations to apply in order.""" - - -SettingsResultMigrations = Union[ - SettingsResultMigrationsWorkersSingleStepMigrations, SettingsResultMigrationsWorkersSteppedMigrations -] - - -class SettingsResultPlacement(TypedDict, total=False): - mode: Literal["smart"] - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class SettingsResultTailConsumer(TypedDict, total=False): - service: Required[str] - """Name of Worker that is to be the consumer.""" - - environment: str - """Optional environment if the Worker utilizes one.""" - - namespace: str - """Optional dispatch namespace the script belongs to.""" - - -class SettingsResult(TypedDict, total=False): - bindings: Iterable[SettingsResultBinding] - """List of bindings attached to this Worker""" - - compatibility_date: str - """Opt your Worker into changes after this date""" - - compatibility_flags: List[str] - """Opt your Worker into specific changes""" - logpush: bool """Whether Logpush is turned on for the Worker.""" - migrations: SettingsResultMigrations - """Migrations to apply for Durable Objects associated with this Worker.""" - - placement: SettingsResultPlacement - - tags: List[str] - """Tags to help you manage your Workers""" - - tail_consumers: Iterable[SettingsResultTailConsumer] + 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').""" - - -class Settings(TypedDict, total=False): - errors: Required[Iterable[SettingsError]] - - messages: Required[Iterable[SettingsMessage]] - - result: Required[SettingsResult] - - success: Required[Literal[True]] - """Whether the API call was successful""" diff --git a/src/cloudflare/types/workers/scripts/setting_edit_response.py b/src/cloudflare/types/workers/scripts/setting_edit_response.py deleted file mode 100644 index b7cda59b6a1..00000000000 --- a/src/cloudflare/types/workers/scripts/setting_edit_response.py +++ /dev/null @@ -1,308 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "SettingEditResponse", - "Binding", - "BindingWorkersKVNamespaceBinding", - "BindingWorkersServiceBinding", - "BindingWorkersDoBinding", - "BindingWorkersR2Binding", - "BindingWorkersQueueBinding", - "BindingWorkersD1Binding", - "BindingWorkersDispatchNamespaceBinding", - "BindingWorkersDispatchNamespaceBindingOutbound", - "BindingWorkersDispatchNamespaceBindingOutboundWorker", - "BindingWorkersMTLSCERTBinding", - "Migrations", - "MigrationsWorkersSingleStepMigrations", - "MigrationsWorkersSingleStepMigrationsRenamedClass", - "MigrationsWorkersSingleStepMigrationsTransferredClass", - "MigrationsWorkersSteppedMigrations", - "MigrationsWorkersSteppedMigrationsStep", - "MigrationsWorkersSteppedMigrationsStepRenamedClass", - "MigrationsWorkersSteppedMigrationsStepTransferredClass", - "Placement", - "TailConsumer", -] - - -class BindingWorkersKVNamespaceBinding(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.""" - - -class BindingWorkersServiceBinding(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.""" - - -class BindingWorkersDoBinding(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 - """ - - -class BindingWorkersR2Binding(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.""" - - -class BindingWorkersQueueBinding(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 BindingWorkersD1Binding(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.""" - - -class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel): - environment: Optional[str] = None - """Environment of the outbound worker""" - - service: Optional[str] = None - """Name of the outbound worker""" - - -class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel): - params: Optional[List[str]] = None - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None - """Outbound worker""" - - -class BindingWorkersDispatchNamespaceBinding(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[BindingWorkersDispatchNamespaceBindingOutbound] = None - """Outbound worker""" - - -class BindingWorkersMTLSCERTBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["mtls_certificate"] - """The class of resource that the binding provides.""" - - certificate_id: Optional[str] = None - """ID of the certificate to bind to""" - - -Binding = Union[ - BindingWorkersKVNamespaceBinding, - BindingWorkersServiceBinding, - BindingWorkersDoBinding, - BindingWorkersR2Binding, - BindingWorkersQueueBinding, - BindingWorkersD1Binding, - BindingWorkersDispatchNamespaceBinding, - BindingWorkersMTLSCERTBinding, -] - - -class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrations(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStep(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None - """Migrations to apply in order.""" - - -Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations] - - -class Placement(BaseModel): - mode: Optional[Literal["smart"]] = None - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class TailConsumer(BaseModel): - service: str - """Name of Worker that is to be the consumer.""" - - environment: Optional[str] = None - """Optional environment if the Worker utilizes one.""" - - namespace: Optional[str] = None - """Optional dispatch namespace the script belongs to.""" - - -class SettingEditResponse(BaseModel): - bindings: Optional[List[Binding]] = None - """List of bindings attached to this Worker""" - - compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" - - compatibility_flags: Optional[List[str]] = None - """Opt your Worker into specific changes""" - - logpush: Optional[bool] = None - """Whether Logpush is turned on for the Worker.""" - - migrations: Optional[Migrations] = None - """Migrations to apply for Durable Objects associated with this Worker.""" - - placement: Optional[Placement] = None - - tags: Optional[List[str]] = None - """Tags to help you manage your Workers""" - - tail_consumers: Optional[List[TailConsumer]] = 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').""" diff --git a/src/cloudflare/types/workers/scripts/setting_get_response.py b/src/cloudflare/types/workers/scripts/setting_get_response.py deleted file mode 100644 index 36b3bb99d35..00000000000 --- a/src/cloudflare/types/workers/scripts/setting_get_response.py +++ /dev/null @@ -1,308 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "SettingGetResponse", - "Binding", - "BindingWorkersKVNamespaceBinding", - "BindingWorkersServiceBinding", - "BindingWorkersDoBinding", - "BindingWorkersR2Binding", - "BindingWorkersQueueBinding", - "BindingWorkersD1Binding", - "BindingWorkersDispatchNamespaceBinding", - "BindingWorkersDispatchNamespaceBindingOutbound", - "BindingWorkersDispatchNamespaceBindingOutboundWorker", - "BindingWorkersMTLSCERTBinding", - "Migrations", - "MigrationsWorkersSingleStepMigrations", - "MigrationsWorkersSingleStepMigrationsRenamedClass", - "MigrationsWorkersSingleStepMigrationsTransferredClass", - "MigrationsWorkersSteppedMigrations", - "MigrationsWorkersSteppedMigrationsStep", - "MigrationsWorkersSteppedMigrationsStepRenamedClass", - "MigrationsWorkersSteppedMigrationsStepTransferredClass", - "Placement", - "TailConsumer", -] - - -class BindingWorkersKVNamespaceBinding(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.""" - - -class BindingWorkersServiceBinding(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.""" - - -class BindingWorkersDoBinding(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 - """ - - -class BindingWorkersR2Binding(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.""" - - -class BindingWorkersQueueBinding(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 BindingWorkersD1Binding(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.""" - - -class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel): - environment: Optional[str] = None - """Environment of the outbound worker""" - - service: Optional[str] = None - """Name of the outbound worker""" - - -class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel): - params: Optional[List[str]] = None - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None - """Outbound worker""" - - -class BindingWorkersDispatchNamespaceBinding(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[BindingWorkersDispatchNamespaceBindingOutbound] = None - """Outbound worker""" - - -class BindingWorkersMTLSCERTBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["mtls_certificate"] - """The class of resource that the binding provides.""" - - certificate_id: Optional[str] = None - """ID of the certificate to bind to""" - - -Binding = Union[ - BindingWorkersKVNamespaceBinding, - BindingWorkersServiceBinding, - BindingWorkersDoBinding, - BindingWorkersR2Binding, - BindingWorkersQueueBinding, - BindingWorkersD1Binding, - BindingWorkersDispatchNamespaceBinding, - BindingWorkersMTLSCERTBinding, -] - - -class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrations(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStep(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None - """Migrations to apply in order.""" - - -Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations] - - -class Placement(BaseModel): - mode: Optional[Literal["smart"]] = None - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class TailConsumer(BaseModel): - service: str - """Name of Worker that is to be the consumer.""" - - environment: Optional[str] = None - """Optional environment if the Worker utilizes one.""" - - namespace: Optional[str] = None - """Optional dispatch namespace the script belongs to.""" - - -class SettingGetResponse(BaseModel): - bindings: Optional[List[Binding]] = None - """List of bindings attached to this Worker""" - - compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" - - compatibility_flags: Optional[List[str]] = None - """Opt your Worker into specific changes""" - - logpush: Optional[bool] = None - """Whether Logpush is turned on for the Worker.""" - - migrations: Optional[Migrations] = None - """Migrations to apply for Durable Objects associated with this Worker.""" - - placement: Optional[Placement] = None - - tags: Optional[List[str]] = None - """Tags to help you manage your Workers""" - - tail_consumers: Optional[List[TailConsumer]] = 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').""" diff --git a/src/cloudflare/types/workers/scripts/tail_create_params.py b/src/cloudflare/types/workers/scripts/tail_create_params.py new file mode 100644 index 00000000000..5fd1875c6ee --- /dev/null +++ b/src/cloudflare/types/workers/scripts/tail_create_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__ = ["TailCreateParams"] + + +class TailCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/workers/scripts/tail_delete_params.py b/src/cloudflare/types/workers/scripts/tail_delete_params.py new file mode 100644 index 00000000000..7b10be84f1b --- /dev/null +++ b/src/cloudflare/types/workers/scripts/tail_delete_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__ = ["TailDeleteParams"] + + +class TailDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + script_name: Required[str] + """Name of the script, used in URLs and route configuration.""" + + body: Required[object] diff --git a/src/cloudflare/types/workers/scripts/tail_delete_response.py b/src/cloudflare/types/workers/scripts/tail_delete_response.py index 5c1bf53bdf6..a1947aaa697 100644 --- a/src/cloudflare/types/workers/scripts/tail_delete_response.py +++ b/src/cloudflare/types/workers/scripts/tail_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel +from ...shared.response_info import ResponseInfo __all__ = ["TailDeleteResponse"] -TailDeleteResponse = Union[List[object], str, object] + +class TailDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/workers/scripts/usage_model_get_response.py b/src/cloudflare/types/workers/scripts/usage_model_get_response.py deleted file mode 100644 index 7c10aaeeb56..00000000000 --- a/src/cloudflare/types/workers/scripts/usage_model_get_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["UsageModelGetResponse"] - - -class UsageModelGetResponse(BaseModel): - usage_model: Optional[object] = None diff --git a/src/cloudflare/types/workers/scripts/usage_model_update_params.py b/src/cloudflare/types/workers/scripts/usage_model_update_params.py deleted file mode 100644 index 2958d1944ce..00000000000 --- a/src/cloudflare/types/workers/scripts/usage_model_update_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["UsageModelUpdateParams"] - - -class UsageModelUpdateParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - body: Required[str] diff --git a/src/cloudflare/types/workers/scripts/usage_model_update_response.py b/src/cloudflare/types/workers/scripts/usage_model_update_response.py deleted file mode 100644 index cbd4c307cf6..00000000000 --- a/src/cloudflare/types/workers/scripts/usage_model_update_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["UsageModelUpdateResponse"] - - -class UsageModelUpdateResponse(BaseModel): - usage_model: Optional[object] = None diff --git a/src/cloudflare/types/workers/scripts/version_create_params.py b/src/cloudflare/types/workers/scripts/version_create_params.py new file mode 100644 index 00000000000..3a488701355 --- /dev/null +++ b/src/cloudflare/types/workers/scripts/version_create_params.py @@ -0,0 +1,67 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._types import FileTypes +from ...._utils import PropertyInfo + +__all__ = ["VersionCreateParams", "Metadata", "MetadataAnnotations"] + + +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 + """JSON encoded metadata about the uploaded parts and Worker configuration.""" + + +class MetadataAnnotations(TypedDict, total=False): + workers_message: Annotated[str, PropertyInfo(alias="workers/message")] + """Human-readable message about the version.""" + + workers_tag: Annotated[str, PropertyInfo(alias="workers/tag")] + """User-provided identifier for the version.""" + + +class Metadata(TypedDict, total=False): + annotations: MetadataAnnotations + + bindings: Iterable[object] + """List of bindings available to the worker.""" + + compatibility_date: str + """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] + """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`. + """ + + 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.""" diff --git a/src/cloudflare/types/workers/scripts/version_create_response.py b/src/cloudflare/types/workers/scripts/version_create_response.py new file mode 100644 index 00000000000..75e17d7f44f --- /dev/null +++ b/src/cloudflare/types/workers/scripts/version_create_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["VersionCreateResponse"] + + +class VersionCreateResponse(BaseModel): + resources: object + + id: Optional[str] = None + + metadata: Optional[object] = None + + number: Optional[float] = None diff --git a/src/cloudflare/types/workers/scripts/version_get_response.py b/src/cloudflare/types/workers/scripts/version_get_response.py new file mode 100644 index 00000000000..9a0dbd121eb --- /dev/null +++ b/src/cloudflare/types/workers/scripts/version_get_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["VersionGetResponse"] + + +class VersionGetResponse(BaseModel): + resources: object + + id: Optional[str] = None + + metadata: Optional[object] = None + + number: Optional[float] = None diff --git a/src/cloudflare/types/workers/scripts/version_list_response.py b/src/cloudflare/types/workers/scripts/version_list_response.py new file mode 100644 index 00000000000..fd3de314931 --- /dev/null +++ b/src/cloudflare/types/workers/scripts/version_list_response.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["VersionListResponse", "Item"] + + +class Item(BaseModel): + id: Optional[str] = None + + metadata: Optional[object] = None + + number: Optional[float] = None + + +class VersionListResponse(BaseModel): + items: Optional[List[Item]] = None diff --git a/src/cloudflare/types/workers/scripts/workers_binding.py b/src/cloudflare/types/workers/scripts/workers_binding.py deleted file mode 100644 index f14b3ffbd68..00000000000 --- a/src/cloudflare/types/workers/scripts/workers_binding.py +++ /dev/null @@ -1,30 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["WorkersBinding", "WorkersKVNamespaceBinding", "WorkersWasmModuleBinding"] - - -class WorkersKVNamespaceBinding(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.""" - - -class WorkersWasmModuleBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["wasm_module"] - """The class of resource that the binding provides.""" - - -WorkersBinding = Union[WorkersKVNamespaceBinding, WorkersWasmModuleBinding] diff --git a/src/cloudflare/types/workers/service_binding.py b/src/cloudflare/types/workers/service_binding.py new file mode 100644 index 00000000000..ffd0c7b07f5 --- /dev/null +++ b/src/cloudflare/types/workers/service_binding.py @@ -0,0 +1,21 @@ +# 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 new file mode 100644 index 00000000000..52ecb335075 --- /dev/null +++ b/src/cloudflare/types/workers/service_binding_param.py @@ -0,0 +1,18 @@ +# 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/services/environments/__init__.py b/src/cloudflare/types/workers/services/environments/__init__.py deleted file mode 100644 index ae528cab93f..00000000000 --- a/src/cloudflare/types/workers/services/environments/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .setting_edit_params import SettingEditParams as SettingEditParams -from .setting_get_response import SettingGetResponse as SettingGetResponse -from .content_update_params import ContentUpdateParams as ContentUpdateParams -from .setting_edit_response import SettingEditResponse as SettingEditResponse diff --git a/src/cloudflare/types/workers/services/environments/content_update_params.py b/src/cloudflare/types/workers/services/environments/content_update_params.py deleted file mode 100644 index cd2a645e3cc..00000000000 --- a/src/cloudflare/types/workers/services/environments/content_update_params.py +++ /dev/null @@ -1,47 +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 Required, Annotated, TypedDict - -from ....._types import FileTypes -from ....._utils import PropertyInfo - -__all__ = ["ContentUpdateParams", "Metadata"] - - -class ContentUpdateParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - service_name: Required[str] - """Name of Worker to bind to""" - - 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. - """ - - metadata: Metadata - """JSON encoded metadata about the uploaded parts and Worker configuration.""" - - -class Metadata(TypedDict, total=False): - body_part: str - """Name of the part in the multipart request that contains the script (e.g. - - the file adding a listener to the `fetch` event). Indicates a - `service worker syntax` Worker. - """ - - 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. - """ diff --git a/src/cloudflare/types/workers/services/environments/setting_edit_params.py b/src/cloudflare/types/workers/services/environments/setting_edit_params.py deleted file mode 100644 index 949a8f955c2..00000000000 --- a/src/cloudflare/types/workers/services/environments/setting_edit_params.py +++ /dev/null @@ -1,343 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = [ - "SettingEditParams", - "Error", - "Message", - "Result", - "ResultBinding", - "ResultBindingWorkersKVNamespaceBinding", - "ResultBindingWorkersServiceBinding", - "ResultBindingWorkersDoBinding", - "ResultBindingWorkersR2Binding", - "ResultBindingWorkersQueueBinding", - "ResultBindingWorkersD1Binding", - "ResultBindingWorkersDispatchNamespaceBinding", - "ResultBindingWorkersDispatchNamespaceBindingOutbound", - "ResultBindingWorkersDispatchNamespaceBindingOutboundWorker", - "ResultBindingWorkersMTLSCERTBinding", - "ResultMigrations", - "ResultMigrationsWorkersSingleStepMigrations", - "ResultMigrationsWorkersSingleStepMigrationsRenamedClass", - "ResultMigrationsWorkersSingleStepMigrationsTransferredClass", - "ResultMigrationsWorkersSteppedMigrations", - "ResultMigrationsWorkersSteppedMigrationsStep", - "ResultMigrationsWorkersSteppedMigrationsStepRenamedClass", - "ResultMigrationsWorkersSteppedMigrationsStepTransferredClass", - "ResultPlacement", - "ResultTailConsumer", -] - - -class SettingEditParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - service_name: Required[str] - """Name of Worker to bind to""" - - errors: Required[Iterable[Error]] - - messages: Required[Iterable[Message]] - - result: Required[Result] - - success: Required[Literal[True]] - """Whether the API call was successful""" - - -class Error(TypedDict, total=False): - code: Required[int] - - message: Required[str] - - -class Message(TypedDict, total=False): - code: Required[int] - - message: Required[str] - - -class ResultBindingWorkersKVNamespaceBinding(TypedDict, total=False): - type: Required[Literal["kv_namespace"]] - """The class of resource that the binding provides.""" - - -class ResultBindingWorkersServiceBinding(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.""" - - -class ResultBindingWorkersDoBinding(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 - """ - - -class ResultBindingWorkersR2Binding(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.""" - - -class ResultBindingWorkersQueueBinding(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 ResultBindingWorkersD1Binding(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.""" - - -class ResultBindingWorkersDispatchNamespaceBindingOutboundWorker(TypedDict, total=False): - environment: str - """Environment of the outbound worker""" - - service: str - """Name of the outbound worker""" - - -class ResultBindingWorkersDispatchNamespaceBindingOutbound(TypedDict, total=False): - params: List[str] - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: ResultBindingWorkersDispatchNamespaceBindingOutboundWorker - """Outbound worker""" - - -class ResultBindingWorkersDispatchNamespaceBinding(TypedDict, total=False): - namespace: Required[str] - """Namespace to bind to""" - - type: Required[Literal["dispatch_namespace"]] - """The class of resource that the binding provides.""" - - outbound: ResultBindingWorkersDispatchNamespaceBindingOutbound - """Outbound worker""" - - -class ResultBindingWorkersMTLSCERTBinding(TypedDict, total=False): - type: Required[Literal["mtls_certificate"]] - """The class of resource that the binding provides.""" - - certificate_id: str - """ID of the certificate to bind to""" - - -ResultBinding = Union[ - ResultBindingWorkersKVNamespaceBinding, - ResultBindingWorkersServiceBinding, - ResultBindingWorkersDoBinding, - ResultBindingWorkersR2Binding, - ResultBindingWorkersQueueBinding, - ResultBindingWorkersD1Binding, - ResultBindingWorkersDispatchNamespaceBinding, - ResultBindingWorkersMTLSCERTBinding, -] - -_ResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords = TypedDict( - "_ResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class ResultMigrationsWorkersSingleStepMigrationsRenamedClass( - _ResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords, total=False -): - to: str - - -_ResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords = TypedDict( - "_ResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class ResultMigrationsWorkersSingleStepMigrationsTransferredClass( - _ResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class ResultMigrationsWorkersSingleStepMigrations(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Iterable[ResultMigrationsWorkersSingleStepMigrationsRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[ResultMigrationsWorkersSingleStepMigrationsTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -_ResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords = TypedDict( - "_ResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class ResultMigrationsWorkersSteppedMigrationsStepRenamedClass( - _ResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords, total=False -): - to: str - - -_ResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords = TypedDict( - "_ResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class ResultMigrationsWorkersSteppedMigrationsStepTransferredClass( - _ResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class ResultMigrationsWorkersSteppedMigrationsStep(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Iterable[ResultMigrationsWorkersSteppedMigrationsStepRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[ResultMigrationsWorkersSteppedMigrationsStepTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class ResultMigrationsWorkersSteppedMigrations(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[ResultMigrationsWorkersSteppedMigrationsStep] - """Migrations to apply in order.""" - - -ResultMigrations = Union[ResultMigrationsWorkersSingleStepMigrations, ResultMigrationsWorkersSteppedMigrations] - - -class ResultPlacement(TypedDict, total=False): - mode: Literal["smart"] - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class ResultTailConsumer(TypedDict, total=False): - service: Required[str] - """Name of Worker that is to be the consumer.""" - - environment: str - """Optional environment if the Worker utilizes one.""" - - namespace: str - """Optional dispatch namespace the script belongs to.""" - - -class Result(TypedDict, total=False): - bindings: Iterable[ResultBinding] - """List of bindings attached to this Worker""" - - compatibility_date: str - """Opt your Worker into changes after this date""" - - compatibility_flags: List[str] - """Opt your Worker into specific changes""" - - logpush: bool - """Whether Logpush is turned on for the Worker.""" - - migrations: ResultMigrations - """Migrations to apply for Durable Objects associated with this Worker.""" - - placement: ResultPlacement - - tags: List[str] - """Tags to help you manage your Workers""" - - tail_consumers: Iterable[ResultTailConsumer] - """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').""" diff --git a/src/cloudflare/types/workers/services/environments/setting_edit_response.py b/src/cloudflare/types/workers/services/environments/setting_edit_response.py deleted file mode 100644 index 8428ab40658..00000000000 --- a/src/cloudflare/types/workers/services/environments/setting_edit_response.py +++ /dev/null @@ -1,308 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "SettingEditResponse", - "Binding", - "BindingWorkersKVNamespaceBinding", - "BindingWorkersServiceBinding", - "BindingWorkersDoBinding", - "BindingWorkersR2Binding", - "BindingWorkersQueueBinding", - "BindingWorkersD1Binding", - "BindingWorkersDispatchNamespaceBinding", - "BindingWorkersDispatchNamespaceBindingOutbound", - "BindingWorkersDispatchNamespaceBindingOutboundWorker", - "BindingWorkersMTLSCERTBinding", - "Migrations", - "MigrationsWorkersSingleStepMigrations", - "MigrationsWorkersSingleStepMigrationsRenamedClass", - "MigrationsWorkersSingleStepMigrationsTransferredClass", - "MigrationsWorkersSteppedMigrations", - "MigrationsWorkersSteppedMigrationsStep", - "MigrationsWorkersSteppedMigrationsStepRenamedClass", - "MigrationsWorkersSteppedMigrationsStepTransferredClass", - "Placement", - "TailConsumer", -] - - -class BindingWorkersKVNamespaceBinding(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.""" - - -class BindingWorkersServiceBinding(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.""" - - -class BindingWorkersDoBinding(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 - """ - - -class BindingWorkersR2Binding(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.""" - - -class BindingWorkersQueueBinding(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 BindingWorkersD1Binding(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.""" - - -class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel): - environment: Optional[str] = None - """Environment of the outbound worker""" - - service: Optional[str] = None - """Name of the outbound worker""" - - -class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel): - params: Optional[List[str]] = None - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None - """Outbound worker""" - - -class BindingWorkersDispatchNamespaceBinding(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[BindingWorkersDispatchNamespaceBindingOutbound] = None - """Outbound worker""" - - -class BindingWorkersMTLSCERTBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["mtls_certificate"] - """The class of resource that the binding provides.""" - - certificate_id: Optional[str] = None - """ID of the certificate to bind to""" - - -Binding = Union[ - BindingWorkersKVNamespaceBinding, - BindingWorkersServiceBinding, - BindingWorkersDoBinding, - BindingWorkersR2Binding, - BindingWorkersQueueBinding, - BindingWorkersD1Binding, - BindingWorkersDispatchNamespaceBinding, - BindingWorkersMTLSCERTBinding, -] - - -class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrations(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStep(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None - """Migrations to apply in order.""" - - -Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations] - - -class Placement(BaseModel): - mode: Optional[Literal["smart"]] = None - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class TailConsumer(BaseModel): - service: str - """Name of Worker that is to be the consumer.""" - - environment: Optional[str] = None - """Optional environment if the Worker utilizes one.""" - - namespace: Optional[str] = None - """Optional dispatch namespace the script belongs to.""" - - -class SettingEditResponse(BaseModel): - bindings: Optional[List[Binding]] = None - """List of bindings attached to this Worker""" - - compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" - - compatibility_flags: Optional[List[str]] = None - """Opt your Worker into specific changes""" - - logpush: Optional[bool] = None - """Whether Logpush is turned on for the Worker.""" - - migrations: Optional[Migrations] = None - """Migrations to apply for Durable Objects associated with this Worker.""" - - placement: Optional[Placement] = None - - tags: Optional[List[str]] = None - """Tags to help you manage your Workers""" - - tail_consumers: Optional[List[TailConsumer]] = 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').""" diff --git a/src/cloudflare/types/workers/services/environments/setting_get_response.py b/src/cloudflare/types/workers/services/environments/setting_get_response.py deleted file mode 100644 index d8aae88365b..00000000000 --- a/src/cloudflare/types/workers/services/environments/setting_get_response.py +++ /dev/null @@ -1,308 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "SettingGetResponse", - "Binding", - "BindingWorkersKVNamespaceBinding", - "BindingWorkersServiceBinding", - "BindingWorkersDoBinding", - "BindingWorkersR2Binding", - "BindingWorkersQueueBinding", - "BindingWorkersD1Binding", - "BindingWorkersDispatchNamespaceBinding", - "BindingWorkersDispatchNamespaceBindingOutbound", - "BindingWorkersDispatchNamespaceBindingOutboundWorker", - "BindingWorkersMTLSCERTBinding", - "Migrations", - "MigrationsWorkersSingleStepMigrations", - "MigrationsWorkersSingleStepMigrationsRenamedClass", - "MigrationsWorkersSingleStepMigrationsTransferredClass", - "MigrationsWorkersSteppedMigrations", - "MigrationsWorkersSteppedMigrationsStep", - "MigrationsWorkersSteppedMigrationsStepRenamedClass", - "MigrationsWorkersSteppedMigrationsStepTransferredClass", - "Placement", - "TailConsumer", -] - - -class BindingWorkersKVNamespaceBinding(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.""" - - -class BindingWorkersServiceBinding(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.""" - - -class BindingWorkersDoBinding(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 - """ - - -class BindingWorkersR2Binding(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.""" - - -class BindingWorkersQueueBinding(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 BindingWorkersD1Binding(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.""" - - -class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel): - environment: Optional[str] = None - """Environment of the outbound worker""" - - service: Optional[str] = None - """Name of the outbound worker""" - - -class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel): - params: Optional[List[str]] = None - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None - """Outbound worker""" - - -class BindingWorkersDispatchNamespaceBinding(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[BindingWorkersDispatchNamespaceBindingOutbound] = None - """Outbound worker""" - - -class BindingWorkersMTLSCERTBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["mtls_certificate"] - """The class of resource that the binding provides.""" - - certificate_id: Optional[str] = None - """ID of the certificate to bind to""" - - -Binding = Union[ - BindingWorkersKVNamespaceBinding, - BindingWorkersServiceBinding, - BindingWorkersDoBinding, - BindingWorkersR2Binding, - BindingWorkersQueueBinding, - BindingWorkersD1Binding, - BindingWorkersDispatchNamespaceBinding, - BindingWorkersMTLSCERTBinding, -] - - -class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrations(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStep(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None - """Migrations to apply in order.""" - - -Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations] - - -class Placement(BaseModel): - mode: Optional[Literal["smart"]] = None - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class TailConsumer(BaseModel): - service: str - """Name of Worker that is to be the consumer.""" - - environment: Optional[str] = None - """Optional environment if the Worker utilizes one.""" - - namespace: Optional[str] = None - """Optional dispatch namespace the script belongs to.""" - - -class SettingGetResponse(BaseModel): - bindings: Optional[List[Binding]] = None - """List of bindings attached to this Worker""" - - compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" - - compatibility_flags: Optional[List[str]] = None - """Opt your Worker into specific changes""" - - logpush: Optional[bool] = None - """Whether Logpush is turned on for the Worker.""" - - migrations: Optional[Migrations] = None - """Migrations to apply for Durable Objects associated with this Worker.""" - - placement: Optional[Placement] = None - - tags: Optional[List[str]] = None - """Tags to help you manage your Workers""" - - tail_consumers: Optional[List[TailConsumer]] = 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').""" diff --git a/src/cloudflare/types/workers/single_step_migration.py b/src/cloudflare/types/workers/single_step_migration.py new file mode 100644 index 00000000000..2c07c2f4a22 --- /dev/null +++ b/src/cloudflare/types/workers/single_step_migration.py @@ -0,0 +1,49 @@ +# 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__ = ["SingleStepMigration", "RenamedClass", "TransferredClass"] + + +class RenamedClass(BaseModel): + from_: Optional[str] = FieldInfo(alias="from", default=None) + + to: Optional[str] = None + + +class TransferredClass(BaseModel): + from_: Optional[str] = FieldInfo(alias="from", default=None) + + from_script: Optional[str] = None + + to: Optional[str] = None + + +class SingleStepMigration(BaseModel): + deleted_classes: Optional[List[str]] = None + """A list of classes to delete Durable Object namespaces from.""" + + new_classes: Optional[List[str]] = None + """A list of classes to create Durable Object namespaces from.""" + + 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. + """ + + renamed_classes: Optional[List[RenamedClass]] = None + """A list of classes with Durable Object namespaces that were renamed.""" + + transferred_classes: Optional[List[TransferredClass]] = None + """ + A list of transfers for Durable Object namespaces from a different Worker and + class to a class defined in this Worker. + """ diff --git a/src/cloudflare/types/workers/single_step_migration_param.py b/src/cloudflare/types/workers/single_step_migration_param.py new file mode 100644 index 00000000000..0c831efe8af --- /dev/null +++ b/src/cloudflare/types/workers/single_step_migration_param.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import TypedDict + +__all__ = ["SingleStepMigrationParam", "RenamedClass", "TransferredClass"] + +_RenamedClassReservedKeywords = TypedDict( + "_RenamedClassReservedKeywords", + { + "from": str, + }, + total=False, +) + + +class RenamedClass(_RenamedClassReservedKeywords, total=False): + to: str + + +_TransferredClassReservedKeywords = TypedDict( + "_TransferredClassReservedKeywords", + { + "from": str, + }, + total=False, +) + + +class TransferredClass(_TransferredClassReservedKeywords, total=False): + from_script: str + + to: str + + +class SingleStepMigrationParam(TypedDict, total=False): + deleted_classes: List[str] + """A list of classes to delete Durable Object namespaces from.""" + + new_classes: List[str] + """A list of classes to create Durable Object namespaces from.""" + + 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. + """ + + renamed_classes: Iterable[RenamedClass] + """A list of classes with Durable Object namespaces that were renamed.""" + + transferred_classes: Iterable[TransferredClass] + """ + A list of transfers for Durable Object namespaces from a different Worker and + class to a class defined in this Worker. + """ diff --git a/src/cloudflare/types/workers/stepped_migration.py b/src/cloudflare/types/workers/stepped_migration.py new file mode 100644 index 00000000000..3383a9a473f --- /dev/null +++ b/src/cloudflare/types/workers/stepped_migration.py @@ -0,0 +1,22 @@ +# 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 new file mode 100644 index 00000000000..2465041142b --- /dev/null +++ b/src/cloudflare/types/workers/stepped_migration_param.py @@ -0,0 +1,24 @@ +# 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/worker_metadata_param.py b/src/cloudflare/types/workers/worker_metadata_param.py new file mode 100644 index 00000000000..dbfae3cd26d --- /dev/null +++ b/src/cloudflare/types/workers/worker_metadata_param.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 TypedDict + +__all__ = ["WorkerMetadataParam"] + + +class WorkerMetadataParam(TypedDict, total=False): + body_part: str + """Name of the part in the multipart request that contains the script (e.g. + + the file adding a listener to the `fetch` event). Indicates a + `service worker syntax` Worker. + """ + + 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. + """ diff --git a/src/cloudflare/types/workers/workers_domain.py b/src/cloudflare/types/workers/workers_domain.py deleted file mode 100644 index aded9cc334d..00000000000 --- a/src/cloudflare/types/workers/workers_domain.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["WorkersDomain"] - - -class WorkersDomain(BaseModel): - id: Optional[str] = None - """Identifer of the Worker Domain.""" - - environment: Optional[str] = None - """Worker environment associated with the zone and hostname.""" - - hostname: Optional[str] = None - """Hostname of the Worker Domain.""" - - service: Optional[str] = None - """Worker service associated with the zone and hostname.""" - - zone_id: Optional[str] = None - """Identifier of the zone.""" - - zone_name: Optional[str] = None - """Name of the zone.""" diff --git a/src/cloudflare/types/workers/workers_filter.py b/src/cloudflare/types/workers/workers_filter.py deleted file mode 100644 index 9d2862df88c..00000000000 --- a/src/cloudflare/types/workers/workers_filter.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["WorkersFilter"] - - -class WorkersFilter(BaseModel): - id: str - """Identifier""" - - enabled: bool - - pattern: str diff --git a/src/cloudflare/types/workers/workers_route.py b/src/cloudflare/types/workers/workers_route.py deleted file mode 100644 index 85b33f5124c..00000000000 --- a/src/cloudflare/types/workers/workers_route.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["WorkersRoute"] - - -class WorkersRoute(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/workers_script.py b/src/cloudflare/types/workers/workers_script.py deleted file mode 100644 index 808d0e390a9..00000000000 --- a/src/cloudflare/types/workers/workers_script.py +++ /dev/null @@ -1,48 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["WorkersScript", "TailConsumer"] - - -class TailConsumer(BaseModel): - service: str - """Name of Worker that is to be the consumer.""" - - environment: Optional[str] = None - """Optional environment if the Worker utilizes one.""" - - namespace: Optional[str] = None - """Optional dispatch namespace the script belongs to.""" - - -class WorkersScript(BaseModel): - id: Optional[str] = None - """The id of the script in the Workers system. Usually the script name.""" - - created_on: Optional[datetime] = None - """When the script was created.""" - - etag: Optional[str] = None - """Hashed script content, can be used in a If-None-Match header when updating.""" - - logpush: Optional[bool] = None - """Whether Logpush is turned on for the Worker.""" - - modified_on: Optional[datetime] = None - """When the script was last modified.""" - - pipeline_hash: Optional[str] = None - """Deprecated. Deployment metadata for internal usage.""" - - placement_mode: Optional[str] = None - """Specifies the placement mode for the Worker (e.g. 'smart').""" - - tail_consumers: Optional[List[TailConsumer]] = 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').""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/__init__.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/__init__.py index e80f466f64f..ce0b9cc9fcd 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/__init__.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/__init__.py @@ -2,8 +2,6 @@ from __future__ import annotations +from .script import Script as Script from .script_delete_params import ScriptDeleteParams as ScriptDeleteParams from .script_update_params import ScriptUpdateParams as ScriptUpdateParams -from .workers_for_platforms_namespace_script import ( - WorkersForPlatformsNamespaceScript as WorkersForPlatformsNamespaceScript, -) diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script.py new file mode 100644 index 00000000000..8cdabbbabf3 --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script.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 ....workers import script as _script +from ....._models import BaseModel + +__all__ = ["Script"] + + +class Script(BaseModel): + created_on: Optional[datetime] = None + """When the script was created.""" + + dispatch_namespace: Optional[str] = None + """Name of the Workers for Platforms dispatch namespace.""" + + modified_on: Optional[datetime] = None + """When the script was last modified.""" + + script: Optional[_script.Script] = None diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_params.py index 4ab2a41fd37..7e319272717 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_params.py @@ -14,6 +14,8 @@ class ScriptDeleteParams(TypedDict, total=False): dispatch_namespace: Required[str] """Name of the Workers for Platforms dispatch namespace.""" + body: Required[object] + force: bool """ If set to true, delete will not be stopped by associated service binding, 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 a0117316558..53bb144df7d 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 @@ -7,23 +7,12 @@ from ....._types import FileTypes from ....._utils import PropertyInfo +from ....workers.stepped_migration_param import SteppedMigrationParam +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", - "Variant0MetadataMigrations", - "Variant0MetadataMigrationsWorkersSingleStepMigrations", - "Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass", - "Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass", - "Variant0MetadataMigrationsWorkersSteppedMigrations", - "Variant0MetadataMigrationsWorkersSteppedMigrationsStep", - "Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClass", - "Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClass", - "Variant0MetadataPlacement", - "Variant0MetadataTailConsumer", - "Variant1", -] +__all__ = ["ScriptUpdateParams", "Variant0", "Variant0Metadata", "Variant0MetadataMigrations", "Variant1"] class Variant0(TypedDict, total=False): @@ -38,157 +27,15 @@ class Variant0(TypedDict, total=False): 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. + `body_part` by part name. Source maps may also be included using the + `application/source-map` content type. """ metadata: Variant0Metadata """JSON encoded metadata about the uploaded parts and Worker configuration.""" -_Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords = TypedDict( - "_Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass( - _Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords, total=False -): - to: str - - -_Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords = TypedDict( - "_Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass( - _Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class Variant0MetadataMigrationsWorkersSingleStepMigrations(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Iterable[Variant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[Variant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -_Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords = TypedDict( - "_Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClass( - _Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords, total=False -): - to: str - - -_Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords = TypedDict( - "_Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClass( - _Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class Variant0MetadataMigrationsWorkersSteppedMigrationsStep(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Iterable[Variant0MetadataMigrationsWorkersSteppedMigrationsStepRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[Variant0MetadataMigrationsWorkersSteppedMigrationsStepTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class Variant0MetadataMigrationsWorkersSteppedMigrations(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[Variant0MetadataMigrationsWorkersSteppedMigrationsStep] - """Migrations to apply in order.""" - - -Variant0MetadataMigrations = Union[ - Variant0MetadataMigrationsWorkersSingleStepMigrations, Variant0MetadataMigrationsWorkersSteppedMigrations -] - - -class Variant0MetadataPlacement(TypedDict, total=False): - mode: Literal["smart"] - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class Variant0MetadataTailConsumer(TypedDict, total=False): - service: Required[str] - """Name of Worker that is to be the consumer.""" - - environment: str - """Optional environment if the Worker utilizes one.""" - - namespace: str - """Optional dispatch namespace the script belongs to.""" +Variant0MetadataMigrations = Union[SingleStepMigrationParam, SteppedMigrationParam] class Variant0Metadata(TypedDict, total=False): @@ -231,12 +78,12 @@ class Variant0Metadata(TypedDict, total=False): migrations: Variant0MetadataMigrations """Migrations to apply for Durable Objects associated with this Worker.""" - placement: Variant0MetadataPlacement + placement: PlacementConfigurationParam tags: List[str] """List of strings to use as tags for this Worker""" - tail_consumers: Iterable[Variant0MetadataTailConsumer] + tail_consumers: Iterable[ConsumerScriptParam] """List of Workers that will consume logs from the attached Worker.""" usage_model: Literal["bundled", "unbound"] 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 f02cfa2e631..0aa7d524060 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 @@ -2,8 +2,14 @@ from __future__ import annotations +from .tag_list_response import TagListResponse as TagListResponse +from .tag_update_params import TagUpdateParams as TagUpdateParams from .setting_edit_params import SettingEditParams as SettingEditParams +from .tag_update_response import TagUpdateResponse as TagUpdateResponse from .binding_get_response import BindingGetResponse as BindingGetResponse +from .secret_list_response import SecretListResponse as SecretListResponse +from .secret_update_params import SecretUpdateParams as SecretUpdateParams from .setting_get_response import SettingGetResponse as SettingGetResponse from .content_update_params import ContentUpdateParams as ContentUpdateParams from .setting_edit_response import SettingEditResponse as SettingEditResponse +from .secret_update_response import SecretUpdateResponse as SecretUpdateResponse 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 6f4b5914e88..9d8efdf1f7b 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,159 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from typing_extensions import Literal +from typing import List -from ......_models import BaseModel +from .....workers.binding import Binding -__all__ = [ - "BindingGetResponse", - "WorkersKVNamespaceBinding", - "WorkersServiceBinding", - "WorkersDoBinding", - "WorkersR2Binding", - "WorkersQueueBinding", - "WorkersD1Binding", - "WorkersDispatchNamespaceBinding", - "WorkersDispatchNamespaceBindingOutbound", - "WorkersDispatchNamespaceBindingOutboundWorker", - "WorkersMTLSCERTBinding", -] +__all__ = ["BindingGetResponse"] - -class WorkersKVNamespaceBinding(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.""" - - -class WorkersServiceBinding(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.""" - - -class WorkersDoBinding(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 - """ - - -class WorkersR2Binding(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.""" - - -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 WorkersD1Binding(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.""" - - -class WorkersDispatchNamespaceBindingOutboundWorker(BaseModel): - environment: Optional[str] = None - """Environment of the outbound worker""" - - service: Optional[str] = None - """Name of the outbound worker""" - - -class WorkersDispatchNamespaceBindingOutbound(BaseModel): - params: Optional[List[str]] = None - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: Optional[WorkersDispatchNamespaceBindingOutboundWorker] = None - """Outbound worker""" - - -class WorkersDispatchNamespaceBinding(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[WorkersDispatchNamespaceBindingOutbound] = None - """Outbound worker""" - - -class WorkersMTLSCERTBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["mtls_certificate"] - """The class of resource that the binding provides.""" - - certificate_id: Optional[str] = None - """ID of the certificate to bind to""" - - -BindingGetResponse = Union[ - WorkersKVNamespaceBinding, - WorkersServiceBinding, - WorkersDoBinding, - WorkersR2Binding, - WorkersQueueBinding, - WorkersD1Binding, - WorkersDispatchNamespaceBinding, - WorkersMTLSCERTBinding, -] +BindingGetResponse = List[Binding] 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 1b619827982..a9f9eceeb85 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 @@ -7,8 +7,9 @@ from ......_types import FileTypes from ......_utils import PropertyInfo +from .....workers.worker_metadata_param import WorkerMetadataParam -__all__ = ["ContentUpdateParams", "Metadata"] +__all__ = ["ContentUpdateParams"] class ContentUpdateParams(TypedDict, total=False): @@ -25,23 +26,9 @@ class ContentUpdateParams(TypedDict, total=False): 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. + part name. Source maps may also be included using the `application/source-map` + content type. """ - metadata: Metadata + metadata: WorkerMetadataParam """JSON encoded metadata about the uploaded parts and Worker configuration.""" - - -class Metadata(TypedDict, total=False): - body_part: str - """Name of the part in the multipart request that contains the script (e.g. - - the file adding a listener to the `fetch` event). Indicates a - `service worker syntax` Worker. - """ - - 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. - """ diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_list_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_list_response.py new file mode 100644 index 00000000000..86ea1859cb1 --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_list_response.py @@ -0,0 +1,16 @@ +# 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__ = ["SecretListResponse"] + + +class SecretListResponse(BaseModel): + name: Optional[str] = None + """The name of this secret, this is what will be to access it inside the Worker.""" + + type: Optional[Literal["secret_text"]] = None + """The type of secret to put.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py new file mode 100644 index 00000000000..572b6f5e008 --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py @@ -0,0 +1,24 @@ +# 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__ = ["SecretUpdateParams"] + + +class SecretUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + dispatch_namespace: Required[str] + """Name of the Workers for Platforms dispatch namespace.""" + + name: str + """The name of this secret, this is what will be to access it inside the Worker.""" + + text: str + """The value of the secret.""" + + type: Literal["secret_text"] + """The type of secret to put.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py new file mode 100644 index 00000000000..df496e500d8 --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py @@ -0,0 +1,16 @@ +# 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__ = ["SecretUpdateResponse"] + + +class SecretUpdateResponse(BaseModel): + name: Optional[str] = None + """The name of this secret, this is what will be to access it inside the Worker.""" + + type: Optional[Literal["secret_text"]] = None + """The type of secret to put.""" 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 378c1606f72..1d4c53175c3 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 @@ -3,35 +3,15 @@ from __future__ import annotations from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = [ - "SettingEditParams", - "Error", - "Message", - "Result", - "ResultBinding", - "ResultBindingWorkersKVNamespaceBinding", - "ResultBindingWorkersServiceBinding", - "ResultBindingWorkersDoBinding", - "ResultBindingWorkersR2Binding", - "ResultBindingWorkersQueueBinding", - "ResultBindingWorkersD1Binding", - "ResultBindingWorkersDispatchNamespaceBinding", - "ResultBindingWorkersDispatchNamespaceBindingOutbound", - "ResultBindingWorkersDispatchNamespaceBindingOutboundWorker", - "ResultBindingWorkersMTLSCERTBinding", - "ResultMigrations", - "ResultMigrationsWorkersSingleStepMigrations", - "ResultMigrationsWorkersSingleStepMigrationsRenamedClass", - "ResultMigrationsWorkersSingleStepMigrationsTransferredClass", - "ResultMigrationsWorkersSteppedMigrations", - "ResultMigrationsWorkersSteppedMigrationsStep", - "ResultMigrationsWorkersSteppedMigrationsStepRenamedClass", - "ResultMigrationsWorkersSteppedMigrationsStepTransferredClass", - "ResultPlacement", - "ResultTailConsumer", -] +from .....workers.binding_param import BindingParam +from .....workers.stepped_migration_param import SteppedMigrationParam +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"] class SettingEditParams(TypedDict, total=False): @@ -41,282 +21,19 @@ class SettingEditParams(TypedDict, total=False): dispatch_namespace: Required[str] """Name of the Workers for Platforms dispatch namespace.""" - errors: Required[Iterable[Error]] - - messages: Required[Iterable[Message]] - - result: Required[Result] - - success: Required[Literal[True]] - """Whether the API call was successful""" - - -class Error(TypedDict, total=False): - code: Required[int] - - message: Required[str] - - -class Message(TypedDict, total=False): - code: Required[int] - - message: Required[str] - - -class ResultBindingWorkersKVNamespaceBinding(TypedDict, total=False): - type: Required[Literal["kv_namespace"]] - """The class of resource that the binding provides.""" - - -class ResultBindingWorkersServiceBinding(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.""" - - -class ResultBindingWorkersDoBinding(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 - """ - - -class ResultBindingWorkersR2Binding(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.""" - - -class ResultBindingWorkersQueueBinding(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 ResultBindingWorkersD1Binding(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.""" - - -class ResultBindingWorkersDispatchNamespaceBindingOutboundWorker(TypedDict, total=False): - environment: str - """Environment of the outbound worker""" - - service: str - """Name of the outbound worker""" - - -class ResultBindingWorkersDispatchNamespaceBindingOutbound(TypedDict, total=False): - params: List[str] - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: ResultBindingWorkersDispatchNamespaceBindingOutboundWorker - """Outbound worker""" - - -class ResultBindingWorkersDispatchNamespaceBinding(TypedDict, total=False): - namespace: Required[str] - """Namespace to bind to""" - - type: Required[Literal["dispatch_namespace"]] - """The class of resource that the binding provides.""" - - outbound: ResultBindingWorkersDispatchNamespaceBindingOutbound - """Outbound worker""" - - -class ResultBindingWorkersMTLSCERTBinding(TypedDict, total=False): - type: Required[Literal["mtls_certificate"]] - """The class of resource that the binding provides.""" + settings: Settings - certificate_id: str - """ID of the certificate to bind to""" +class SettingsLimits(TypedDict, total=False): + cpu_ms: int + """The amount of CPU time this Worker can use in milliseconds.""" -ResultBinding = Union[ - ResultBindingWorkersKVNamespaceBinding, - ResultBindingWorkersServiceBinding, - ResultBindingWorkersDoBinding, - ResultBindingWorkersR2Binding, - ResultBindingWorkersQueueBinding, - ResultBindingWorkersD1Binding, - ResultBindingWorkersDispatchNamespaceBinding, - ResultBindingWorkersMTLSCERTBinding, -] -_ResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords = TypedDict( - "_ResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) +SettingsMigrations = Union[SingleStepMigrationParam, SteppedMigrationParam] -class ResultMigrationsWorkersSingleStepMigrationsRenamedClass( - _ResultMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords, total=False -): - to: str - - -_ResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords = TypedDict( - "_ResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class ResultMigrationsWorkersSingleStepMigrationsTransferredClass( - _ResultMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class ResultMigrationsWorkersSingleStepMigrations(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Iterable[ResultMigrationsWorkersSingleStepMigrationsRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[ResultMigrationsWorkersSingleStepMigrationsTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -_ResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords = TypedDict( - "_ResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class ResultMigrationsWorkersSteppedMigrationsStepRenamedClass( - _ResultMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords, total=False -): - to: str - - -_ResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords = TypedDict( - "_ResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords", - { - "from": str, - }, - total=False, -) - - -class ResultMigrationsWorkersSteppedMigrationsStepTransferredClass( - _ResultMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords, total=False -): - from_script: str - - to: str - - -class ResultMigrationsWorkersSteppedMigrationsStep(TypedDict, total=False): - deleted_classes: List[str] - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: List[str] - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Iterable[ResultMigrationsWorkersSteppedMigrationsStepRenamedClass] - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Iterable[ResultMigrationsWorkersSteppedMigrationsStepTransferredClass] - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class ResultMigrationsWorkersSteppedMigrations(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[ResultMigrationsWorkersSteppedMigrationsStep] - """Migrations to apply in order.""" - - -ResultMigrations = Union[ResultMigrationsWorkersSingleStepMigrations, ResultMigrationsWorkersSteppedMigrations] - - -class ResultPlacement(TypedDict, total=False): - mode: Literal["smart"] - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class ResultTailConsumer(TypedDict, total=False): - service: Required[str] - """Name of Worker that is to be the consumer.""" - - environment: str - """Optional environment if the Worker utilizes one.""" - - namespace: str - """Optional dispatch namespace the script belongs to.""" - - -class Result(TypedDict, total=False): - bindings: Iterable[ResultBinding] +class Settings(TypedDict, total=False): + bindings: Iterable[BindingParam] """List of bindings attached to this Worker""" compatibility_date: str @@ -325,18 +42,21 @@ class Result(TypedDict, total=False): compatibility_flags: List[str] """Opt your Worker into specific changes""" + limits: SettingsLimits + """Limits to apply for this Worker.""" + logpush: bool """Whether Logpush is turned on for the Worker.""" - migrations: ResultMigrations + migrations: SettingsMigrations """Migrations to apply for Durable Objects associated with this Worker.""" - placement: ResultPlacement + placement: PlacementConfigurationParam tags: List[str] """Tags to help you manage your Workers""" - tail_consumers: Iterable[ResultTailConsumer] + tail_consumers: Iterable[ConsumerScriptParam] """List of Workers that will consume logs from the attached Worker.""" usage_model: str 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 28aa5217ce7..e25777737a2 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,283 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Union, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ......_models import BaseModel +from .....workers.binding import Binding +from .....workers.stepped_migration import SteppedMigration +from .....workers.single_step_migration import SingleStepMigration +from .....workers.placement_configuration import PlacementConfiguration +from .....workers.scripts.consumer_script import ConsumerScript -__all__ = [ - "SettingEditResponse", - "Binding", - "BindingWorkersKVNamespaceBinding", - "BindingWorkersServiceBinding", - "BindingWorkersDoBinding", - "BindingWorkersR2Binding", - "BindingWorkersQueueBinding", - "BindingWorkersD1Binding", - "BindingWorkersDispatchNamespaceBinding", - "BindingWorkersDispatchNamespaceBindingOutbound", - "BindingWorkersDispatchNamespaceBindingOutboundWorker", - "BindingWorkersMTLSCERTBinding", - "Migrations", - "MigrationsWorkersSingleStepMigrations", - "MigrationsWorkersSingleStepMigrationsRenamedClass", - "MigrationsWorkersSingleStepMigrationsTransferredClass", - "MigrationsWorkersSteppedMigrations", - "MigrationsWorkersSteppedMigrationsStep", - "MigrationsWorkersSteppedMigrationsStepRenamedClass", - "MigrationsWorkersSteppedMigrationsStepTransferredClass", - "Placement", - "TailConsumer", -] - - -class BindingWorkersKVNamespaceBinding(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.""" - - -class BindingWorkersServiceBinding(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.""" - - -class BindingWorkersDoBinding(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 - """ - - -class BindingWorkersR2Binding(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.""" - - -class BindingWorkersQueueBinding(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 BindingWorkersD1Binding(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.""" - - -class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel): - environment: Optional[str] = None - """Environment of the outbound worker""" - - service: Optional[str] = None - """Name of the outbound worker""" - - -class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel): - params: Optional[List[str]] = None - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None - """Outbound worker""" - - -class BindingWorkersDispatchNamespaceBinding(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[BindingWorkersDispatchNamespaceBindingOutbound] = None - """Outbound worker""" - +__all__ = ["SettingEditResponse", "Limits", "Migrations"] -class BindingWorkersMTLSCERTBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - type: Literal["mtls_certificate"] - """The class of resource that the binding provides.""" +class Limits(BaseModel): + cpu_ms: Optional[int] = None + """The amount of CPU time this Worker can use in milliseconds.""" - certificate_id: Optional[str] = None - """ID of the certificate to bind to""" - -Binding = Union[ - BindingWorkersKVNamespaceBinding, - BindingWorkersServiceBinding, - BindingWorkersDoBinding, - BindingWorkersR2Binding, - BindingWorkersQueueBinding, - BindingWorkersD1Binding, - BindingWorkersDispatchNamespaceBinding, - BindingWorkersMTLSCERTBinding, -] - - -class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrations(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStep(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None - """Migrations to apply in order.""" - - -Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations] - - -class Placement(BaseModel): - mode: Optional[Literal["smart"]] = None - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class TailConsumer(BaseModel): - service: str - """Name of Worker that is to be the consumer.""" - - environment: Optional[str] = None - """Optional environment if the Worker utilizes one.""" - - namespace: Optional[str] = None - """Optional dispatch namespace the script belongs to.""" +Migrations = Union[SingleStepMigration, SteppedMigration] class SettingEditResponse(BaseModel): @@ -290,18 +30,21 @@ class SettingEditResponse(BaseModel): compatibility_flags: Optional[List[str]] = None """Opt your Worker into specific changes""" + limits: Optional[Limits] = None + """Limits to apply for this Worker.""" + logpush: Optional[bool] = None """Whether Logpush is turned on for the Worker.""" migrations: Optional[Migrations] = None """Migrations to apply for Durable Objects associated with this Worker.""" - placement: Optional[Placement] = None + placement: Optional[PlacementConfiguration] = None tags: Optional[List[str]] = None """Tags to help you manage your Workers""" - tail_consumers: Optional[List[TailConsumer]] = None + tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" usage_model: Optional[str] = None 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 8b545565fe0..da7cf1eb242 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,283 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Union, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ......_models import BaseModel +from .....workers.binding import Binding +from .....workers.stepped_migration import SteppedMigration +from .....workers.single_step_migration import SingleStepMigration +from .....workers.placement_configuration import PlacementConfiguration +from .....workers.scripts.consumer_script import ConsumerScript -__all__ = [ - "SettingGetResponse", - "Binding", - "BindingWorkersKVNamespaceBinding", - "BindingWorkersServiceBinding", - "BindingWorkersDoBinding", - "BindingWorkersR2Binding", - "BindingWorkersQueueBinding", - "BindingWorkersD1Binding", - "BindingWorkersDispatchNamespaceBinding", - "BindingWorkersDispatchNamespaceBindingOutbound", - "BindingWorkersDispatchNamespaceBindingOutboundWorker", - "BindingWorkersMTLSCERTBinding", - "Migrations", - "MigrationsWorkersSingleStepMigrations", - "MigrationsWorkersSingleStepMigrationsRenamedClass", - "MigrationsWorkersSingleStepMigrationsTransferredClass", - "MigrationsWorkersSteppedMigrations", - "MigrationsWorkersSteppedMigrationsStep", - "MigrationsWorkersSteppedMigrationsStepRenamedClass", - "MigrationsWorkersSteppedMigrationsStepTransferredClass", - "Placement", - "TailConsumer", -] - - -class BindingWorkersKVNamespaceBinding(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.""" - - -class BindingWorkersServiceBinding(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.""" - - -class BindingWorkersDoBinding(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 - """ - - -class BindingWorkersR2Binding(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.""" - - -class BindingWorkersQueueBinding(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 BindingWorkersD1Binding(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.""" - - -class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel): - environment: Optional[str] = None - """Environment of the outbound worker""" - - service: Optional[str] = None - """Name of the outbound worker""" - - -class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel): - params: Optional[List[str]] = None - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None - """Outbound worker""" - - -class BindingWorkersDispatchNamespaceBinding(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[BindingWorkersDispatchNamespaceBindingOutbound] = None - """Outbound worker""" - +__all__ = ["SettingGetResponse", "Limits", "Migrations"] -class BindingWorkersMTLSCERTBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - type: Literal["mtls_certificate"] - """The class of resource that the binding provides.""" +class Limits(BaseModel): + cpu_ms: Optional[int] = None + """The amount of CPU time this Worker can use in milliseconds.""" - certificate_id: Optional[str] = None - """ID of the certificate to bind to""" - -Binding = Union[ - BindingWorkersKVNamespaceBinding, - BindingWorkersServiceBinding, - BindingWorkersDoBinding, - BindingWorkersR2Binding, - BindingWorkersQueueBinding, - BindingWorkersD1Binding, - BindingWorkersDispatchNamespaceBinding, - BindingWorkersMTLSCERTBinding, -] - - -class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSingleStepMigrations(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - 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. - """ - - renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationsWorkersSteppedMigrationsStep(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ - - -class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None - """Migrations to apply in order.""" - - -Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations] - - -class Placement(BaseModel): - mode: Optional[Literal["smart"]] = None - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ - - -class TailConsumer(BaseModel): - service: str - """Name of Worker that is to be the consumer.""" - - environment: Optional[str] = None - """Optional environment if the Worker utilizes one.""" - - namespace: Optional[str] = None - """Optional dispatch namespace the script belongs to.""" +Migrations = Union[SingleStepMigration, SteppedMigration] class SettingGetResponse(BaseModel): @@ -290,18 +30,21 @@ class SettingGetResponse(BaseModel): compatibility_flags: Optional[List[str]] = None """Opt your Worker into specific changes""" + limits: Optional[Limits] = None + """Limits to apply for this Worker.""" + logpush: Optional[bool] = None """Whether Logpush is turned on for the Worker.""" migrations: Optional[Migrations] = None """Migrations to apply for Durable Objects associated with this Worker.""" - placement: Optional[Placement] = None + placement: Optional[PlacementConfiguration] = None tags: Optional[List[str]] = None """Tags to help you manage your Workers""" - tail_consumers: Optional[List[TailConsumer]] = None + tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" usage_model: Optional[str] = None diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_list_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_list_response.py new file mode 100644 index 00000000000..f26fb51fb7e --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_list_response.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["TagListResponse"] + +TagListResponse = str diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_params.py new file mode 100644 index 00000000000..e423cd8440d --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_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 import List +from typing_extensions import Required, TypedDict + +__all__ = ["TagUpdateParams"] + + +class TagUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + dispatch_namespace: Required[str] + """Name of the Workers for Platforms dispatch namespace.""" + + body: Required[List[str]] + """Tags to help you manage your Workers""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_response.py new file mode 100644 index 00000000000..52678a8e0b8 --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +__all__ = ["TagUpdateResponse"] + +TagUpdateResponse = List[str] diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/workers_for_platforms_namespace_script.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/workers_for_platforms_namespace_script.py deleted file mode 100644 index 0b9fcd58016..00000000000 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/workers_for_platforms_namespace_script.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ....workers import WorkersScript -from ....._models import BaseModel - -__all__ = ["WorkersForPlatformsNamespaceScript"] - - -class WorkersForPlatformsNamespaceScript(BaseModel): - created_on: Optional[datetime] = None - """When the script was created.""" - - dispatch_namespace: Optional[str] = None - """Name of the Workers for Platforms dispatch namespace.""" - - modified_on: Optional[datetime] = None - """When the script was last modified.""" - - script: Optional[WorkersScript] = None diff --git a/src/cloudflare/types/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index 63750a56b20..733d9109806 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -2,30 +2,88 @@ from __future__ import annotations +from .seat import Seat as Seat +from .device import Device as Device +from .ip_rule import IPRule as IPRule +from .azure_ad import AzureAD as AzureAD +from .connection import Connection as Connection +from .email_rule import EmailRule as EmailRule +from .group_rule import GroupRule as GroupRule +from .access_rule import AccessRule as AccessRule +from .domain_rule import DomainRule as DomainRule +from .percentiles import Percentiles as Percentiles +from .scim_config import ScimConfig as ScimConfig +from .country_rule import CountryRule as CountryRule +from .ip_list_rule import IPListRule as IPListRule +from .login_design import LoginDesign as LoginDesign +from .network_path import NetworkPath as NetworkPath +from .organization import Organization as Organization +from .everyone_rule import EveryoneRule as EveryoneRule +from .ip_rule_param import IPRuleParam as IPRuleParam +from .email_list_rule import EmailListRule as EmailListRule +from .okta_group_rule import OktaGroupRule as OktaGroupRule +from .saml_group_rule import SAMLGroupRule as SAMLGroupRule +from .azure_group_rule import AzureGroupRule as AzureGroupRule +from .certificate_rule import CertificateRule as CertificateRule +from .email_rule_param import EmailRuleParam as EmailRuleParam +from .group_rule_param import GroupRuleParam as GroupRuleParam from .seat_edit_params import SeatEditParams as SeatEditParams -from .zero_trust_seats import ZeroTrustSeats as ZeroTrustSeats +from .access_rule_param import AccessRuleParam as AccessRuleParam +from .domain_rule_param import DomainRuleParam as DomainRuleParam +from .gsuite_group_rule import GSuiteGroupRule as GSuiteGroupRule +from .identity_provider import IdentityProvider as IdentityProvider +from .scim_config_param import ScimConfigParam as ScimConfigParam +from .country_rule_param import CountryRuleParam as CountryRuleParam +from .ip_list_rule_param import IPListRuleParam as IPListRuleParam +from .login_design_param import LoginDesignParam as LoginDesignParam from .seat_edit_response import SeatEditResponse as SeatEditResponse -from .tunnel_argo_tunnel import TunnelArgoTunnel as TunnelArgoTunnel +from .service_token_rule import ServiceTokenRule as ServiceTokenRule from .tunnel_edit_params import TunnelEditParams as TunnelEditParams from .tunnel_list_params import TunnelListParams as TunnelListParams -from .zero_trust_devices import ZeroTrustDevices as ZeroTrustDevices from .device_get_response import DeviceGetResponse as DeviceGetResponse +from .everyone_rule_param import EveryoneRuleParam as EveryoneRuleParam +from .tunnel_get_response import TunnelGetResponse as TunnelGetResponse +from .generic_oauth_config import GenericOAuthConfig as GenericOAuthConfig from .tunnel_create_params import TunnelCreateParams as TunnelCreateParams from .tunnel_delete_params import TunnelDeleteParams as TunnelDeleteParams from .tunnel_edit_response import TunnelEditResponse as TunnelEditResponse from .tunnel_list_response import TunnelListResponse as TunnelListResponse +from .email_list_rule_param import EmailListRuleParam as EmailListRuleParam from .gateway_list_response import GatewayListResponse as GatewayListResponse +from .network_path_response import NetworkPathResponse as NetworkPathResponse +from .okta_group_rule_param import OktaGroupRuleParam as OktaGroupRuleParam +from .saml_group_rule_param import SAMLGroupRuleParam as SAMLGroupRuleParam +from .azure_group_rule_param import AzureGroupRuleParam as AzureGroupRuleParam +from .certificate_rule_param import CertificateRuleParam as CertificateRuleParam +from .identity_provider_type import IdentityProviderType as IdentityProviderType +from .tunnel_create_response import TunnelCreateResponse as TunnelCreateResponse +from .tunnel_delete_response import TunnelDeleteResponse as TunnelDeleteResponse from .gateway_create_response import GatewayCreateResponse as GatewayCreateResponse -from .zero_trust_organizations import ZeroTrustOrganizations as ZeroTrustOrganizations +from .gsuite_group_rule_param import GSuiteGroupRuleParam as GSuiteGroupRuleParam +from .risk_scoring_get_params import RiskScoringGetParams as RiskScoringGetParams +from .external_evaluation_rule import ExternalEvaluationRule as ExternalEvaluationRule +from .github_organization_rule import GitHubOrganizationRule as GitHubOrganizationRule +from .service_token_rule_param import ServiceTokenRuleParam as ServiceTokenRuleParam +from .device_experience_monitor import DeviceExperienceMonitor as DeviceExperienceMonitor +from .risk_scoring_get_response import RiskScoringGetResponse as RiskScoringGetResponse +from .access_device_posture_rule import AccessDevicePostureRule as AccessDevicePostureRule +from .authentication_method_rule import AuthenticationMethodRule as AuthenticationMethodRule +from .generic_oauth_config_param import GenericOAuthConfigParam as GenericOAuthConfigParam from .organization_create_params import OrganizationCreateParams as OrganizationCreateParams from .organization_update_params import OrganizationUpdateParams as OrganizationUpdateParams -from .zero_trust_identity_providers import ZeroTrustIdentityProviders as ZeroTrustIdentityProviders +from .risk_scoring_reset_response import RiskScoringResetResponse as RiskScoringResetResponse +from .any_valid_service_token_rule import AnyValidServiceTokenRule as AnyValidServiceTokenRule +from .external_evaluation_rule_param import ExternalEvaluationRuleParam as ExternalEvaluationRuleParam +from .github_organization_rule_param import GitHubOrganizationRuleParam as GitHubOrganizationRuleParam from .identity_provider_create_params import IdentityProviderCreateParams as IdentityProviderCreateParams from .identity_provider_list_response import IdentityProviderListResponse as IdentityProviderListResponse from .identity_provider_update_params import IdentityProviderUpdateParams as IdentityProviderUpdateParams +from .access_device_posture_rule_param import AccessDevicePostureRuleParam as AccessDevicePostureRuleParam +from .authentication_method_rule_param import AuthenticationMethodRuleParam as AuthenticationMethodRuleParam from .connectivity_setting_edit_params import ConnectivitySettingEditParams as ConnectivitySettingEditParams from .organization_revoke_users_params import OrganizationRevokeUsersParams as OrganizationRevokeUsersParams from .connectivity_setting_get_response import ConnectivitySettingGetResponse as ConnectivitySettingGetResponse from .identity_provider_delete_response import IdentityProviderDeleteResponse as IdentityProviderDeleteResponse +from .any_valid_service_token_rule_param import AnyValidServiceTokenRuleParam as AnyValidServiceTokenRuleParam from .connectivity_setting_edit_response import ConnectivitySettingEditResponse as ConnectivitySettingEditResponse from .organization_revoke_users_response import OrganizationRevokeUsersResponse as OrganizationRevokeUsersResponse diff --git a/src/cloudflare/types/zero_trust/access/__init__.py b/src/cloudflare/types/zero_trust/access/__init__.py index 8406db99375..bdbafbcc60b 100644 --- a/src/cloudflare/types/zero_trust/access/__init__.py +++ b/src/cloudflare/types/zero_trust/access/__init__.py @@ -2,31 +2,51 @@ from __future__ import annotations -from .zero_trust_tag import ZeroTrustTag as ZeroTrustTag -from .zero_trust_apps import ZeroTrustApps as ZeroTrustApps +from .tag import Tag as Tag +from .bookmark import Bookmark as Bookmark +from .access_user import AccessUser as AccessUser +from .application import Application as Application +from .certificate import Certificate as Certificate +from .custom_page import CustomPage as CustomPage +from .app_id_param import AppIDParam as AppIDParam +from .cors_headers import CORSHeaders as CORSHeaders +from .allowed_idpsh import AllowedIdpsh as AllowedIdpsh +from .custom_pagesh import CustomPagesh as CustomPagesh +from .saml_saas_app import SAMLSaaSApp as SAMLSaaSApp +from .service_token import ServiceToken as ServiceToken +from .saas_app_source import SaaSAppSource as SaaSAppSource +from .allowed_headersh import AllowedHeadersh as AllowedHeadersh +from .allowed_methodsh import AllowedMethodsh as AllowedMethodsh +from .allowed_originsh import AllowedOriginsh as AllowedOriginsh from .key_get_response import KeyGetResponse as KeyGetResponse -from .zero_trust_users import ZeroTrustUsers as ZeroTrustUsers +from .zero_trust_group import ZeroTrustGroup as ZeroTrustGroup from .key_update_params import KeyUpdateParams as KeyUpdateParams from .tag_create_params import TagCreateParams as TagCreateParams from .tag_update_params import TagUpdateParams as TagUpdateParams -from .zero_trust_groups import ZeroTrustGroups as ZeroTrustGroups +from .cors_headers_param import CORSHeadersParam as CORSHeadersParam from .group_create_params import GroupCreateParams as GroupCreateParams from .group_update_params import GroupUpdateParams as GroupUpdateParams from .key_rotate_response import KeyRotateResponse as KeyRotateResponse from .key_update_response import KeyUpdateResponse as KeyUpdateResponse +from .saml_saas_app_param import SAMLSaaSAppParam as SAMLSaaSAppParam from .tag_delete_response import TagDeleteResponse as TagDeleteResponse -from .zero_trust_bookmarks import ZeroTrustBookmarks as ZeroTrustBookmarks +from .associated_hostnames import AssociatedHostnames as AssociatedHostnames +from .saas_app_name_format import SaaSAppNameFormat as SaaSAppNameFormat +from .self_hosted_domainsh import SelfHostedDomainsh as SelfHostedDomainsh from .group_delete_response import GroupDeleteResponse as GroupDeleteResponse -from .zero_trust_custom_page import ZeroTrustCustomPage as ZeroTrustCustomPage -from .zero_trust_certificates import ZeroTrustCertificates as ZeroTrustCertificates +from .saas_app_source_param import SaaSAppSourceParam as SaaSAppSourceParam +from .bookmark_create_params import BookmarkCreateParams as BookmarkCreateParams +from .bookmark_delete_params import BookmarkDeleteParams as BookmarkDeleteParams +from .bookmark_update_params import BookmarkUpdateParams as BookmarkUpdateParams +from .saas_app_name_id_format import SaaSAppNameIDFormat as SaaSAppNameIDFormat from .bookmark_delete_response import BookmarkDeleteResponse as BookmarkDeleteResponse +from .custom_page_without_html import CustomPageWithoutHTML as CustomPageWithoutHTML from .application_create_params import ApplicationCreateParams as ApplicationCreateParams from .application_update_params import ApplicationUpdateParams as ApplicationUpdateParams from .certificate_create_params import CertificateCreateParams as CertificateCreateParams from .certificate_update_params import CertificateUpdateParams as CertificateUpdateParams from .custom_page_create_params import CustomPageCreateParams as CustomPageCreateParams from .custom_page_update_params import CustomPageUpdateParams as CustomPageUpdateParams -from .zero_trust_service_tokens import ZeroTrustServiceTokens as ZeroTrustServiceTokens from .application_delete_response import ApplicationDeleteResponse as ApplicationDeleteResponse from .certificate_delete_response import CertificateDeleteResponse as CertificateDeleteResponse from .custom_page_delete_response import CustomPageDeleteResponse as CustomPageDeleteResponse @@ -34,4 +54,3 @@ from .service_token_update_params import ServiceTokenUpdateParams as ServiceTokenUpdateParams from .service_token_create_response import ServiceTokenCreateResponse as ServiceTokenCreateResponse from .service_token_rotate_response import ServiceTokenRotateResponse as ServiceTokenRotateResponse -from .zero_trust_custom_page_without_html import ZeroTrustCustomPageWithoutHTML as ZeroTrustCustomPageWithoutHTML diff --git a/src/cloudflare/types/zero_trust/access/access_user.py b/src/cloudflare/types/zero_trust/access/access_user.py new file mode 100644 index 00000000000..2430d721cf2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/access_user.py @@ -0,0 +1,41 @@ +# 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__ = ["AccessUser"] + + +class AccessUser(BaseModel): + id: Optional[str] = None + """UUID""" + + access_seat: Optional[bool] = None + """True if the user has authenticated with Cloudflare Access.""" + + active_device_count: Optional[float] = None + """The number of active devices registered to the user.""" + + created_at: Optional[datetime] = None + + email: Optional[str] = None + """The email of the user.""" + + gateway_seat: Optional[bool] = None + """True if the user has logged into the WARP client.""" + + last_successful_login: Optional[datetime] = None + """The time at which the user last successfully logged in.""" + + name: Optional[str] = None + """The name of the user.""" + + seat_uid: Optional[str] = None + """The unique API identifier for the Zero Trust seat.""" + + uid: Optional[str] = None + """The unique API identifier for the user.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/allowed_headersh.py b/src/cloudflare/types/zero_trust/access/allowed_headersh.py new file mode 100644 index 00000000000..5eab7035a5c --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/allowed_headersh.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["AllowedHeadersh"] + +AllowedHeadersh = str diff --git a/src/cloudflare/types/zero_trust/access/allowed_idpsh.py b/src/cloudflare/types/zero_trust/access/allowed_idpsh.py new file mode 100644 index 00000000000..06ac561930d --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/allowed_idpsh.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["AllowedIdpsh"] + +AllowedIdpsh = str diff --git a/src/cloudflare/types/zero_trust/access/allowed_methodsh.py b/src/cloudflare/types/zero_trust/access/allowed_methodsh.py new file mode 100644 index 00000000000..9ce6cd1709b --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/allowed_methodsh.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["AllowedMethodsh"] + +AllowedMethodsh = Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"] diff --git a/src/cloudflare/types/zero_trust/access/allowed_originsh.py b/src/cloudflare/types/zero_trust/access/allowed_originsh.py new file mode 100644 index 00000000000..dbd56ff86ca --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/allowed_originsh.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["AllowedOriginsh"] + +AllowedOriginsh = str diff --git a/src/cloudflare/types/zero_trust/access/app_id_param.py b/src/cloudflare/types/zero_trust/access/app_id_param.py new file mode 100644 index 00000000000..a0db766c1c1 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/app_id_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +__all__ = ["AppIDParam"] + +AppIDParam = Union[str, str] diff --git a/src/cloudflare/types/zero_trust/access/application.py b/src/cloudflare/types/zero_trust/access/application.py new file mode 100644 index 00000000000..cd1cae01256 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/application.py @@ -0,0 +1,709 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel +from .cors_headers import CORSHeaders +from .allowed_idpsh import AllowedIdpsh +from .custom_pagesh import CustomPagesh +from .saml_saas_app import SAMLSaaSApp +from .self_hosted_domainsh import SelfHostedDomainsh + +__all__ = [ + "Application", + "SelfHostedApplication", + "SaaSApplication", + "SaaSApplicationSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", + "BrowserSSHApplication", + "BrowserVncApplication", + "AppLauncherApplication", + "DeviceEnrollmentPermissionsApplication", + "BrowserIsolationPermissionsApplication", + "BookmarkApplication", +] + + +class SelfHostedApplication(BaseModel): + domain: str + """The primary hostname and path that Access will secure. + + If the app is visible in the App Launcher dashboard, this is the domain that + will be displayed. + """ + + type: str + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allow_authenticate_via_warp: Optional[bool] = None + """ + When set to true, users can authenticate to this application using their WARP + session. When set to false this application will always require direct IdP + authentication. This setting always overrides the organization setting for WARP + authentication. + """ + + allowed_idps: Optional[List[AllowedIdpsh]] = None + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + app_launcher_visible: Optional[bool] = None + """Displays the application in the App Launcher.""" + + aud: Optional[str] = None + """Audience tag.""" + + auto_redirect_to_identity: Optional[bool] = None + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + cors_headers: Optional[CORSHeaders] = None + + created_at: Optional[datetime] = None + + custom_deny_message: Optional[str] = None + """ + The custom error message shown to a user when they are denied access to the + application. + """ + + custom_deny_url: Optional[str] = None + """ + The custom URL a user is redirected to when they are denied access to the + application when failing identity-based rules. + """ + + custom_non_identity_deny_url: Optional[str] = None + """ + The custom URL a user is redirected to when they are denied access to the + application when failing non-identity rules. + """ + + custom_pages: Optional[List[CustomPagesh]] = None + """The custom pages that will be displayed when applicable for this application""" + + enable_binding_cookie: Optional[bool] = None + """ + Enables the binding cookie, which increases security against compromised + authorization tokens and CSRF attacks. + """ + + http_only_cookie_attribute: Optional[bool] = None + """ + Enables the HttpOnly cookie attribute, which increases security against XSS + attacks. + """ + + logo_url: Optional[str] = None + """The image URL for the logo shown in the App Launcher dashboard.""" + + name: Optional[str] = None + """The name of the application.""" + + options_preflight_bypass: Optional[bool] = None + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + + path_cookie_attribute: Optional[bool] = None + """Enables cookie paths to scope an application's JWT to the application path. + + If disabled, the JWT will scope to the hostname by default + """ + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + self_hosted_domains: Optional[List[SelfHostedDomainsh]] = None + """List of domains that Access will secure.""" + + service_auth_401_redirect: Optional[bool] = None + """Returns a 401 status code when the request is blocked by a Service Auth policy.""" + + session_duration: Optional[str] = None + """The amount of time that tokens issued for this application will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ + + skip_interstitial: Optional[bool] = None + """Enables automatic authentication through cloudflared.""" + + tags: Optional[List[str]] = None + """The tags you want assigned to an application. + + Tags are used to filter applications in the App Launcher dashboard. + """ + + updated_at: Optional[datetime] = None + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(BaseModel): + name: Optional[str] = None + """The name of the IdP claim.""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(BaseModel): + name: Optional[str] = None + """The name of the claim.""" + + name_by_idp: Optional[Dict[str, str]] = None + """A mapping from IdP ID to claim name.""" + + required: Optional[bool] = None + """If the claim is required when building an OIDC token.""" + + scope: Optional[Literal["groups", "profile", "email", "openid"]] = None + """The scope of the claim.""" + + source: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource] = None + + +class SaaSApplicationSaaSAppAccessOIDCSaaSApp(BaseModel): + app_launcher_url: Optional[str] = None + """The URL where this applications tile redirects users""" + + auth_type: Optional[Literal["saml", "oidc"]] = None + """Identifier of the authentication protocol used for the saas app. + + Required for OIDC. + """ + + client_id: Optional[str] = None + """The application client id""" + + client_secret: Optional[str] = None + """The application client secret, only returned on POST request.""" + + created_at: Optional[datetime] = None + + custom_claims: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims] = None + + grant_types: Optional[List[Literal["authorization_code", "authorization_code_with_pkce"]]] = None + """The OIDC flows supported by this application""" + + group_filter_regex: Optional[str] = None + """A regex to filter Cloudflare groups returned in ID token and userinfo endpoint""" + + public_key: Optional[str] = None + """The Access public certificate that will be used to verify your identity.""" + + redirect_uris: Optional[List[str]] = None + """ + The permitted URL's for Cloudflare to return Authorization codes and Access/ID + tokens + """ + + scopes: Optional[List[Literal["openid", "groups", "email", "profile"]]] = None + """Define the user information shared with access""" + + updated_at: Optional[datetime] = None + + +SaaSApplicationSaaSApp = Union[SAMLSaaSApp, SaaSApplicationSaaSAppAccessOIDCSaaSApp] + + +class SaaSApplication(BaseModel): + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdpsh]] = None + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + app_launcher_visible: Optional[bool] = None + """Displays the application in the App Launcher.""" + + aud: Optional[str] = None + """Audience tag.""" + + auto_redirect_to_identity: Optional[bool] = None + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + created_at: Optional[datetime] = None + + custom_pages: Optional[List[CustomPagesh]] = None + """The custom pages that will be displayed when applicable for this application""" + + logo_url: Optional[str] = None + """The image URL for the logo shown in the App Launcher dashboard.""" + + name: Optional[str] = None + """The name of the application.""" + + saas_app: Optional[SaaSApplicationSaaSApp] = None + + tags: Optional[List[str]] = None + """The tags you want assigned to an application. + + Tags are used to filter applications in the App Launcher dashboard. + """ + + type: Optional[str] = None + """The application type.""" + + updated_at: Optional[datetime] = None + + +class BrowserSSHApplication(BaseModel): + domain: str + """The primary hostname and path that Access will secure. + + If the app is visible in the App Launcher dashboard, this is the domain that + will be displayed. + """ + + type: str + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allow_authenticate_via_warp: Optional[bool] = None + """ + When set to true, users can authenticate to this application using their WARP + session. When set to false this application will always require direct IdP + authentication. This setting always overrides the organization setting for WARP + authentication. + """ + + allowed_idps: Optional[List[AllowedIdpsh]] = None + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + app_launcher_visible: Optional[bool] = None + """Displays the application in the App Launcher.""" + + aud: Optional[str] = None + """Audience tag.""" + + auto_redirect_to_identity: Optional[bool] = None + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + cors_headers: Optional[CORSHeaders] = None + + created_at: Optional[datetime] = None + + custom_deny_message: Optional[str] = None + """ + The custom error message shown to a user when they are denied access to the + application. + """ + + custom_deny_url: Optional[str] = None + """ + The custom URL a user is redirected to when they are denied access to the + application when failing identity-based rules. + """ + + custom_non_identity_deny_url: Optional[str] = None + """ + The custom URL a user is redirected to when they are denied access to the + application when failing non-identity rules. + """ + + custom_pages: Optional[List[CustomPagesh]] = None + """The custom pages that will be displayed when applicable for this application""" + + enable_binding_cookie: Optional[bool] = None + """ + Enables the binding cookie, which increases security against compromised + authorization tokens and CSRF attacks. + """ + + http_only_cookie_attribute: Optional[bool] = None + """ + Enables the HttpOnly cookie attribute, which increases security against XSS + attacks. + """ + + logo_url: Optional[str] = None + """The image URL for the logo shown in the App Launcher dashboard.""" + + name: Optional[str] = None + """The name of the application.""" + + options_preflight_bypass: Optional[bool] = None + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + + path_cookie_attribute: Optional[bool] = None + """Enables cookie paths to scope an application's JWT to the application path. + + If disabled, the JWT will scope to the hostname by default + """ + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + self_hosted_domains: Optional[List[SelfHostedDomainsh]] = None + """List of domains that Access will secure.""" + + service_auth_401_redirect: Optional[bool] = None + """Returns a 401 status code when the request is blocked by a Service Auth policy.""" + + session_duration: Optional[str] = None + """The amount of time that tokens issued for this application will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ + + skip_interstitial: Optional[bool] = None + """Enables automatic authentication through cloudflared.""" + + tags: Optional[List[str]] = None + """The tags you want assigned to an application. + + Tags are used to filter applications in the App Launcher dashboard. + """ + + updated_at: Optional[datetime] = None + + +class BrowserVncApplication(BaseModel): + domain: str + """The primary hostname and path that Access will secure. + + If the app is visible in the App Launcher dashboard, this is the domain that + will be displayed. + """ + + type: str + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allow_authenticate_via_warp: Optional[bool] = None + """ + When set to true, users can authenticate to this application using their WARP + session. When set to false this application will always require direct IdP + authentication. This setting always overrides the organization setting for WARP + authentication. + """ + + allowed_idps: Optional[List[AllowedIdpsh]] = None + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + app_launcher_visible: Optional[bool] = None + """Displays the application in the App Launcher.""" + + aud: Optional[str] = None + """Audience tag.""" + + auto_redirect_to_identity: Optional[bool] = None + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + cors_headers: Optional[CORSHeaders] = None + + created_at: Optional[datetime] = None + + custom_deny_message: Optional[str] = None + """ + The custom error message shown to a user when they are denied access to the + application. + """ + + custom_deny_url: Optional[str] = None + """ + The custom URL a user is redirected to when they are denied access to the + application when failing identity-based rules. + """ + + custom_non_identity_deny_url: Optional[str] = None + """ + The custom URL a user is redirected to when they are denied access to the + application when failing non-identity rules. + """ + + custom_pages: Optional[List[CustomPagesh]] = None + """The custom pages that will be displayed when applicable for this application""" + + enable_binding_cookie: Optional[bool] = None + """ + Enables the binding cookie, which increases security against compromised + authorization tokens and CSRF attacks. + """ + + http_only_cookie_attribute: Optional[bool] = None + """ + Enables the HttpOnly cookie attribute, which increases security against XSS + attacks. + """ + + logo_url: Optional[str] = None + """The image URL for the logo shown in the App Launcher dashboard.""" + + name: Optional[str] = None + """The name of the application.""" + + options_preflight_bypass: Optional[bool] = None + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + + path_cookie_attribute: Optional[bool] = None + """Enables cookie paths to scope an application's JWT to the application path. + + If disabled, the JWT will scope to the hostname by default + """ + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + self_hosted_domains: Optional[List[SelfHostedDomainsh]] = None + """List of domains that Access will secure.""" + + service_auth_401_redirect: Optional[bool] = None + """Returns a 401 status code when the request is blocked by a Service Auth policy.""" + + session_duration: Optional[str] = None + """The amount of time that tokens issued for this application will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ + + skip_interstitial: Optional[bool] = None + """Enables automatic authentication through cloudflared.""" + + tags: Optional[List[str]] = None + """The tags you want assigned to an application. + + Tags are used to filter applications in the App Launcher dashboard. + """ + + updated_at: Optional[datetime] = None + + +class AppLauncherApplication(BaseModel): + type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"] + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdpsh]] = None + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + aud: Optional[str] = None + """Audience tag.""" + + auto_redirect_to_identity: Optional[bool] = None + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + created_at: Optional[datetime] = None + + domain: Optional[str] = None + """The primary hostname and path that Access will secure. + + If the app is visible in the App Launcher dashboard, this is the domain that + will be displayed. + """ + + name: Optional[str] = None + """The name of the application.""" + + session_duration: Optional[str] = None + """The amount of time that tokens issued for this application will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ + + updated_at: Optional[datetime] = None + + +class DeviceEnrollmentPermissionsApplication(BaseModel): + type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"] + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdpsh]] = None + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + aud: Optional[str] = None + """Audience tag.""" + + auto_redirect_to_identity: Optional[bool] = None + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + created_at: Optional[datetime] = None + + domain: Optional[str] = None + """The primary hostname and path that Access will secure. + + If the app is visible in the App Launcher dashboard, this is the domain that + will be displayed. + """ + + name: Optional[str] = None + """The name of the application.""" + + session_duration: Optional[str] = None + """The amount of time that tokens issued for this application will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ + + updated_at: Optional[datetime] = None + + +class BrowserIsolationPermissionsApplication(BaseModel): + type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"] + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdpsh]] = None + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + aud: Optional[str] = None + """Audience tag.""" + + auto_redirect_to_identity: Optional[bool] = None + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + created_at: Optional[datetime] = None + + domain: Optional[str] = None + """The primary hostname and path that Access will secure. + + If the app is visible in the App Launcher dashboard, this is the domain that + will be displayed. + """ + + name: Optional[str] = None + """The name of the application.""" + + session_duration: Optional[str] = None + """The amount of time that tokens issued for this application will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ + + updated_at: Optional[datetime] = None + + +class BookmarkApplication(BaseModel): + id: Optional[str] = None + """UUID""" + + app_launcher_visible: Optional[bool] = None + """Displays the application in the App Launcher.""" + + aud: Optional[str] = None + """Audience tag.""" + + created_at: Optional[datetime] = None + + domain: Optional[str] = None + """The URL or domain of the bookmark.""" + + logo_url: Optional[str] = None + """The image URL for the logo shown in the App Launcher dashboard.""" + + name: Optional[str] = None + """The name of the application.""" + + tags: Optional[List[str]] = None + """The tags you want assigned to an application. + + Tags are used to filter applications in the App Launcher dashboard. + """ + + type: Optional[str] = None + """The application type.""" + + updated_at: Optional[datetime] = None + + +Application = Union[ + SelfHostedApplication, + SaaSApplication, + BrowserSSHApplication, + BrowserVncApplication, + AppLauncherApplication, + DeviceEnrollmentPermissionsApplication, + BrowserIsolationPermissionsApplication, + BookmarkApplication, +] 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 c8cf94ea9fa..0197e6e388d 100644 --- a/src/cloudflare/types/zero_trust/access/application_create_params.py +++ b/src/cloudflare/types/zero_trust/access/application_create_params.py @@ -2,23 +2,25 @@ from __future__ import annotations -from typing import List, Union +from typing import Dict, List, Union from typing_extensions import Literal, Required, TypedDict +from .allowed_idpsh import AllowedIdpsh +from .custom_pagesh import CustomPagesh +from .cors_headers_param import CORSHeadersParam +from .saml_saas_app_param import SAMLSaaSAppParam +from .self_hosted_domainsh import SelfHostedDomainsh + __all__ = [ "ApplicationCreateParams", "SelfHostedApplication", - "SelfHostedApplicationCorsHeaders", "SaaSApplication", - "SaaSApplicationSaasApp", - "SaaSApplicationSaasAppAccessSamlSaasApp", - "SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes", - "SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource", - "SaaSApplicationSaasAppAccessOidcSaasApp", + "SaaSApplicationSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", "BrowserSSHApplication", - "BrowserSSHApplicationCorsHeaders", "BrowserVncApplication", - "BrowserVncApplicationCorsHeaders", "AppLauncherApplication", "DeviceEnrollmentPermissionsApplication", "BrowserIsolationPermissionsApplication", @@ -51,7 +53,7 @@ class SelfHostedApplication(TypedDict, total=False): authentication. """ - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -68,7 +70,7 @@ class SelfHostedApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ - cors_headers: SelfHostedApplicationCorsHeaders + cors_headers: CORSHeadersParam custom_deny_message: str """ @@ -88,7 +90,7 @@ class SelfHostedApplication(TypedDict, total=False): application when failing non-identity rules. """ - custom_pages: List[str] + custom_pages: List[CustomPagesh] """The custom pages that will be displayed when applicable for this application""" enable_binding_cookie: bool @@ -109,6 +111,12 @@ class SelfHostedApplication(TypedDict, total=False): name: str """The name of the application.""" + options_preflight_bypass: bool + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + path_cookie_attribute: bool """Enables cookie paths to scope an application's JWT to the application path. @@ -121,7 +129,7 @@ class SelfHostedApplication(TypedDict, total=False): attacks. """ - self_hosted_domains: List[str] + self_hosted_domains: List[SelfHostedDomainsh] """List of domains that Access will secure.""" service_auth_401_redirect: bool @@ -144,35 +152,6 @@ class SelfHostedApplication(TypedDict, total=False): """ -class SelfHostedApplicationCorsHeaders(TypedDict, total=False): - allow_all_headers: bool - """Allows all HTTP request headers.""" - - allow_all_methods: bool - """Allows all HTTP request methods.""" - - allow_all_origins: bool - """Allows all origins.""" - - allow_credentials: bool - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: List[str] - """Allowed HTTP request headers.""" - - allowed_methods: List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - """Allowed HTTP request methods.""" - - allowed_origins: List[str] - """Allowed origins.""" - - max_age: float - """The maximum number of seconds the results of a preflight request can be cached.""" - - class SaaSApplication(TypedDict, total=False): account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" @@ -180,7 +159,7 @@ class SaaSApplication(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -197,7 +176,7 @@ class SaaSApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ - custom_pages: List[str] + custom_pages: List[CustomPagesh] """The custom pages that will be displayed when applicable for this application""" logo_url: str @@ -206,7 +185,7 @@ class SaaSApplication(TypedDict, total=False): name: str """The name of the application.""" - saas_app: SaaSApplicationSaasApp + saas_app: SaaSApplicationSaaSApp tags: List[str] """The tags you want assigned to an application. @@ -218,81 +197,28 @@ class SaaSApplication(TypedDict, total=False): """The application type.""" -class SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource(TypedDict, total=False): +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(TypedDict, total=False): name: str - """The name of the IdP attribute.""" + """The name of the IdP claim.""" -class SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes(TypedDict, total=False): +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(TypedDict, total=False): name: str - """The name of the attribute.""" - - name_format: Literal[ - "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified", - "urn:oasis:names:tc:SAML:2.0:attrname-format:basic", - "urn:oasis:names:tc:SAML:2.0:attrname-format:uri", - ] - """A globally unique name for an identity or service provider.""" - - source: SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource + """The name of the claim.""" + name_by_idp: Dict[str, str] + """A mapping from IdP ID to claim name.""" -class SaaSApplicationSaasAppAccessSamlSaasApp(TypedDict, total=False): - auth_type: Literal["saml", "oidc"] - """Optional identifier indicating the authentication protocol used for the saas - app. - - Required for OIDC. Default if unset is "saml" - """ + required: bool + """If the claim is required when building an OIDC token.""" - consumer_service_url: str - """ - The service provider's endpoint that is responsible for receiving and parsing a - SAML assertion. - """ - - custom_attributes: SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes - - default_relay_state: str - """ - The URL that the user will be redirected to after a successful login for IDP - initiated logins. - """ + scope: Literal["groups", "profile", "email", "openid"] + """The scope of the claim.""" - idp_entity_id: str - """The unique identifier for your SaaS application.""" + source: SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource - name_id_format: Literal["id", "email"] - """The format of the name identifier sent to the SaaS application.""" - name_id_transform_jsonata: str - """ - A [JSONata](https://jsonata.org/) expression that transforms an application's - user identities into a NameID value for its SAML assertion. This expression - should evaluate to a singular string. The output of this expression can override - the `name_id_format` setting. - """ - - public_key: str - """The Access public certificate that will be used to verify your identity.""" - - saml_attribute_transform_jsonata: str - """ - A [JSONata] (https://jsonata.org/) expression that transforms an application's - user identities into attribute assertions in the SAML response. The expression - can transform id, email, name, and groups values. It can also transform fields - listed in the saml_attributes or oidc_fields of the identity provider used to - authenticate. The output of this expression must be a JSON object. - """ - - sp_entity_id: str - """A globally unique name for an identity or service provider.""" - - sso_endpoint: str - """The endpoint where your SaaS application will send login requests.""" - - -class SaaSApplicationSaasAppAccessOidcSaasApp(TypedDict, total=False): +class SaaSApplicationSaaSAppAccessOIDCSaaSApp(TypedDict, total=False): app_launcher_url: str """The URL where this applications tile redirects users""" @@ -308,6 +234,8 @@ class SaaSApplicationSaasAppAccessOidcSaasApp(TypedDict, total=False): client_secret: str """The application client secret, only returned on POST request.""" + custom_claims: SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims + grant_types: List[Literal["authorization_code", "authorization_code_with_pkce"]] """The OIDC flows supported by this application""" @@ -327,7 +255,7 @@ class SaaSApplicationSaasAppAccessOidcSaasApp(TypedDict, total=False): """Define the user information shared with access""" -SaaSApplicationSaasApp = Union[SaaSApplicationSaasAppAccessSamlSaasApp, SaaSApplicationSaasAppAccessOidcSaasApp] +SaaSApplicationSaaSApp = Union[SAMLSaaSAppParam, SaaSApplicationSaaSAppAccessOIDCSaaSApp] class BrowserSSHApplication(TypedDict, total=False): @@ -355,7 +283,7 @@ class BrowserSSHApplication(TypedDict, total=False): authentication. """ - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -372,7 +300,7 @@ class BrowserSSHApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ - cors_headers: BrowserSSHApplicationCorsHeaders + cors_headers: CORSHeadersParam custom_deny_message: str """ @@ -392,7 +320,7 @@ class BrowserSSHApplication(TypedDict, total=False): application when failing non-identity rules. """ - custom_pages: List[str] + custom_pages: List[CustomPagesh] """The custom pages that will be displayed when applicable for this application""" enable_binding_cookie: bool @@ -413,6 +341,12 @@ class BrowserSSHApplication(TypedDict, total=False): name: str """The name of the application.""" + options_preflight_bypass: bool + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + path_cookie_attribute: bool """Enables cookie paths to scope an application's JWT to the application path. @@ -425,7 +359,7 @@ class BrowserSSHApplication(TypedDict, total=False): attacks. """ - self_hosted_domains: List[str] + self_hosted_domains: List[SelfHostedDomainsh] """List of domains that Access will secure.""" service_auth_401_redirect: bool @@ -448,35 +382,6 @@ class BrowserSSHApplication(TypedDict, total=False): """ -class BrowserSSHApplicationCorsHeaders(TypedDict, total=False): - allow_all_headers: bool - """Allows all HTTP request headers.""" - - allow_all_methods: bool - """Allows all HTTP request methods.""" - - allow_all_origins: bool - """Allows all origins.""" - - allow_credentials: bool - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: List[str] - """Allowed HTTP request headers.""" - - allowed_methods: List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - """Allowed HTTP request methods.""" - - allowed_origins: List[str] - """Allowed origins.""" - - max_age: float - """The maximum number of seconds the results of a preflight request can be cached.""" - - class BrowserVncApplication(TypedDict, total=False): domain: Required[str] """The primary hostname and path that Access will secure. @@ -502,7 +407,7 @@ class BrowserVncApplication(TypedDict, total=False): authentication. """ - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -519,7 +424,7 @@ class BrowserVncApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ - cors_headers: BrowserVncApplicationCorsHeaders + cors_headers: CORSHeadersParam custom_deny_message: str """ @@ -539,7 +444,7 @@ class BrowserVncApplication(TypedDict, total=False): application when failing non-identity rules. """ - custom_pages: List[str] + custom_pages: List[CustomPagesh] """The custom pages that will be displayed when applicable for this application""" enable_binding_cookie: bool @@ -560,6 +465,12 @@ class BrowserVncApplication(TypedDict, total=False): name: str """The name of the application.""" + options_preflight_bypass: bool + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + path_cookie_attribute: bool """Enables cookie paths to scope an application's JWT to the application path. @@ -572,7 +483,7 @@ class BrowserVncApplication(TypedDict, total=False): attacks. """ - self_hosted_domains: List[str] + self_hosted_domains: List[SelfHostedDomainsh] """List of domains that Access will secure.""" service_auth_401_redirect: bool @@ -595,35 +506,6 @@ class BrowserVncApplication(TypedDict, total=False): """ -class BrowserVncApplicationCorsHeaders(TypedDict, total=False): - allow_all_headers: bool - """Allows all HTTP request headers.""" - - allow_all_methods: bool - """Allows all HTTP request methods.""" - - allow_all_origins: bool - """Allows all origins.""" - - allow_credentials: bool - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: List[str] - """Allowed HTTP request headers.""" - - allowed_methods: List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - """Allowed HTTP request methods.""" - - allowed_origins: List[str] - """Allowed origins.""" - - max_age: float - """The maximum number of seconds the results of a preflight request can be cached.""" - - class AppLauncherApplication(TypedDict, total=False): type: Required[Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"]] """The application type.""" @@ -634,7 +516,7 @@ class AppLauncherApplication(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -666,7 +548,7 @@ class DeviceEnrollmentPermissionsApplication(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -698,7 +580,7 @@ class BrowserIsolationPermissionsApplication(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. 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 e722654c5b7..06535294710 100644 --- a/src/cloudflare/types/zero_trust/access/application_update_params.py +++ b/src/cloudflare/types/zero_trust/access/application_update_params.py @@ -2,23 +2,25 @@ from __future__ import annotations -from typing import List, Union +from typing import Dict, List, Union from typing_extensions import Literal, Required, TypedDict +from .allowed_idpsh import AllowedIdpsh +from .custom_pagesh import CustomPagesh +from .cors_headers_param import CORSHeadersParam +from .saml_saas_app_param import SAMLSaaSAppParam +from .self_hosted_domainsh import SelfHostedDomainsh + __all__ = [ "ApplicationUpdateParams", "SelfHostedApplication", - "SelfHostedApplicationCorsHeaders", "SaaSApplication", - "SaaSApplicationSaasApp", - "SaaSApplicationSaasAppAccessSamlSaasApp", - "SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes", - "SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource", - "SaaSApplicationSaasAppAccessOidcSaasApp", + "SaaSApplicationSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", "BrowserSSHApplication", - "BrowserSSHApplicationCorsHeaders", "BrowserVncApplication", - "BrowserVncApplicationCorsHeaders", "AppLauncherApplication", "DeviceEnrollmentPermissionsApplication", "BrowserIsolationPermissionsApplication", @@ -51,7 +53,7 @@ class SelfHostedApplication(TypedDict, total=False): authentication. """ - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -68,7 +70,7 @@ class SelfHostedApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ - cors_headers: SelfHostedApplicationCorsHeaders + cors_headers: CORSHeadersParam custom_deny_message: str """ @@ -88,7 +90,7 @@ class SelfHostedApplication(TypedDict, total=False): application when failing non-identity rules. """ - custom_pages: List[str] + custom_pages: List[CustomPagesh] """The custom pages that will be displayed when applicable for this application""" enable_binding_cookie: bool @@ -109,6 +111,12 @@ class SelfHostedApplication(TypedDict, total=False): name: str """The name of the application.""" + options_preflight_bypass: bool + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + path_cookie_attribute: bool """Enables cookie paths to scope an application's JWT to the application path. @@ -121,7 +129,7 @@ class SelfHostedApplication(TypedDict, total=False): attacks. """ - self_hosted_domains: List[str] + self_hosted_domains: List[SelfHostedDomainsh] """List of domains that Access will secure.""" service_auth_401_redirect: bool @@ -144,35 +152,6 @@ class SelfHostedApplication(TypedDict, total=False): """ -class SelfHostedApplicationCorsHeaders(TypedDict, total=False): - allow_all_headers: bool - """Allows all HTTP request headers.""" - - allow_all_methods: bool - """Allows all HTTP request methods.""" - - allow_all_origins: bool - """Allows all origins.""" - - allow_credentials: bool - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: List[str] - """Allowed HTTP request headers.""" - - allowed_methods: List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - """Allowed HTTP request methods.""" - - allowed_origins: List[str] - """Allowed origins.""" - - max_age: float - """The maximum number of seconds the results of a preflight request can be cached.""" - - class SaaSApplication(TypedDict, total=False): account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" @@ -180,7 +159,7 @@ class SaaSApplication(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -197,7 +176,7 @@ class SaaSApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ - custom_pages: List[str] + custom_pages: List[CustomPagesh] """The custom pages that will be displayed when applicable for this application""" logo_url: str @@ -206,7 +185,7 @@ class SaaSApplication(TypedDict, total=False): name: str """The name of the application.""" - saas_app: SaaSApplicationSaasApp + saas_app: SaaSApplicationSaaSApp tags: List[str] """The tags you want assigned to an application. @@ -218,81 +197,28 @@ class SaaSApplication(TypedDict, total=False): """The application type.""" -class SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource(TypedDict, total=False): +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(TypedDict, total=False): name: str - """The name of the IdP attribute.""" + """The name of the IdP claim.""" -class SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes(TypedDict, total=False): +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(TypedDict, total=False): name: str - """The name of the attribute.""" - - name_format: Literal[ - "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified", - "urn:oasis:names:tc:SAML:2.0:attrname-format:basic", - "urn:oasis:names:tc:SAML:2.0:attrname-format:uri", - ] - """A globally unique name for an identity or service provider.""" - - source: SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource + """The name of the claim.""" + name_by_idp: Dict[str, str] + """A mapping from IdP ID to claim name.""" -class SaaSApplicationSaasAppAccessSamlSaasApp(TypedDict, total=False): - auth_type: Literal["saml", "oidc"] - """Optional identifier indicating the authentication protocol used for the saas - app. - - Required for OIDC. Default if unset is "saml" - """ + required: bool + """If the claim is required when building an OIDC token.""" - consumer_service_url: str - """ - The service provider's endpoint that is responsible for receiving and parsing a - SAML assertion. - """ - - custom_attributes: SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes - - default_relay_state: str - """ - The URL that the user will be redirected to after a successful login for IDP - initiated logins. - """ + scope: Literal["groups", "profile", "email", "openid"] + """The scope of the claim.""" - idp_entity_id: str - """The unique identifier for your SaaS application.""" + source: SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource - name_id_format: Literal["id", "email"] - """The format of the name identifier sent to the SaaS application.""" - name_id_transform_jsonata: str - """ - A [JSONata](https://jsonata.org/) expression that transforms an application's - user identities into a NameID value for its SAML assertion. This expression - should evaluate to a singular string. The output of this expression can override - the `name_id_format` setting. - """ - - public_key: str - """The Access public certificate that will be used to verify your identity.""" - - saml_attribute_transform_jsonata: str - """ - A [JSONata] (https://jsonata.org/) expression that transforms an application's - user identities into attribute assertions in the SAML response. The expression - can transform id, email, name, and groups values. It can also transform fields - listed in the saml_attributes or oidc_fields of the identity provider used to - authenticate. The output of this expression must be a JSON object. - """ - - sp_entity_id: str - """A globally unique name for an identity or service provider.""" - - sso_endpoint: str - """The endpoint where your SaaS application will send login requests.""" - - -class SaaSApplicationSaasAppAccessOidcSaasApp(TypedDict, total=False): +class SaaSApplicationSaaSAppAccessOIDCSaaSApp(TypedDict, total=False): app_launcher_url: str """The URL where this applications tile redirects users""" @@ -308,6 +234,8 @@ class SaaSApplicationSaasAppAccessOidcSaasApp(TypedDict, total=False): client_secret: str """The application client secret, only returned on POST request.""" + custom_claims: SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims + grant_types: List[Literal["authorization_code", "authorization_code_with_pkce"]] """The OIDC flows supported by this application""" @@ -327,7 +255,7 @@ class SaaSApplicationSaasAppAccessOidcSaasApp(TypedDict, total=False): """Define the user information shared with access""" -SaaSApplicationSaasApp = Union[SaaSApplicationSaasAppAccessSamlSaasApp, SaaSApplicationSaasAppAccessOidcSaasApp] +SaaSApplicationSaaSApp = Union[SAMLSaaSAppParam, SaaSApplicationSaaSAppAccessOIDCSaaSApp] class BrowserSSHApplication(TypedDict, total=False): @@ -355,7 +283,7 @@ class BrowserSSHApplication(TypedDict, total=False): authentication. """ - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -372,7 +300,7 @@ class BrowserSSHApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ - cors_headers: BrowserSSHApplicationCorsHeaders + cors_headers: CORSHeadersParam custom_deny_message: str """ @@ -392,7 +320,7 @@ class BrowserSSHApplication(TypedDict, total=False): application when failing non-identity rules. """ - custom_pages: List[str] + custom_pages: List[CustomPagesh] """The custom pages that will be displayed when applicable for this application""" enable_binding_cookie: bool @@ -413,6 +341,12 @@ class BrowserSSHApplication(TypedDict, total=False): name: str """The name of the application.""" + options_preflight_bypass: bool + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + path_cookie_attribute: bool """Enables cookie paths to scope an application's JWT to the application path. @@ -425,7 +359,7 @@ class BrowserSSHApplication(TypedDict, total=False): attacks. """ - self_hosted_domains: List[str] + self_hosted_domains: List[SelfHostedDomainsh] """List of domains that Access will secure.""" service_auth_401_redirect: bool @@ -448,35 +382,6 @@ class BrowserSSHApplication(TypedDict, total=False): """ -class BrowserSSHApplicationCorsHeaders(TypedDict, total=False): - allow_all_headers: bool - """Allows all HTTP request headers.""" - - allow_all_methods: bool - """Allows all HTTP request methods.""" - - allow_all_origins: bool - """Allows all origins.""" - - allow_credentials: bool - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: List[str] - """Allowed HTTP request headers.""" - - allowed_methods: List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - """Allowed HTTP request methods.""" - - allowed_origins: List[str] - """Allowed origins.""" - - max_age: float - """The maximum number of seconds the results of a preflight request can be cached.""" - - class BrowserVncApplication(TypedDict, total=False): domain: Required[str] """The primary hostname and path that Access will secure. @@ -502,7 +407,7 @@ class BrowserVncApplication(TypedDict, total=False): authentication. """ - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -519,7 +424,7 @@ class BrowserVncApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ - cors_headers: BrowserVncApplicationCorsHeaders + cors_headers: CORSHeadersParam custom_deny_message: str """ @@ -539,7 +444,7 @@ class BrowserVncApplication(TypedDict, total=False): application when failing non-identity rules. """ - custom_pages: List[str] + custom_pages: List[CustomPagesh] """The custom pages that will be displayed when applicable for this application""" enable_binding_cookie: bool @@ -560,6 +465,12 @@ class BrowserVncApplication(TypedDict, total=False): name: str """The name of the application.""" + options_preflight_bypass: bool + """ + Allows options preflight requests to bypass Access authentication and go + directly to the origin. Cannot turn on if cors_headers is set. + """ + path_cookie_attribute: bool """Enables cookie paths to scope an application's JWT to the application path. @@ -572,7 +483,7 @@ class BrowserVncApplication(TypedDict, total=False): attacks. """ - self_hosted_domains: List[str] + self_hosted_domains: List[SelfHostedDomainsh] """List of domains that Access will secure.""" service_auth_401_redirect: bool @@ -595,35 +506,6 @@ class BrowserVncApplication(TypedDict, total=False): """ -class BrowserVncApplicationCorsHeaders(TypedDict, total=False): - allow_all_headers: bool - """Allows all HTTP request headers.""" - - allow_all_methods: bool - """Allows all HTTP request methods.""" - - allow_all_origins: bool - """Allows all origins.""" - - allow_credentials: bool - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: List[str] - """Allowed HTTP request headers.""" - - allowed_methods: List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - """Allowed HTTP request methods.""" - - allowed_origins: List[str] - """Allowed origins.""" - - max_age: float - """The maximum number of seconds the results of a preflight request can be cached.""" - - class AppLauncherApplication(TypedDict, total=False): type: Required[Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"]] """The application type.""" @@ -634,7 +516,7 @@ class AppLauncherApplication(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -666,7 +548,7 @@ class DeviceEnrollmentPermissionsApplication(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. @@ -698,7 +580,7 @@ class BrowserIsolationPermissionsApplication(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - allowed_idps: List[str] + allowed_idps: List[AllowedIdpsh] """The identity providers your users can select when connecting to this application. diff --git a/src/cloudflare/types/zero_trust/access/applications/__init__.py b/src/cloudflare/types/zero_trust/access/applications/__init__.py index 4c51f6afacf..6abb930af01 100644 --- a/src/cloudflare/types/zero_trust/access/applications/__init__.py +++ b/src/cloudflare/types/zero_trust/access/applications/__init__.py @@ -2,12 +2,16 @@ from __future__ import annotations -from .zero_trust_ca import ZeroTrustCA as ZeroTrustCA +from .ca import CA as CA +from .policy import Policy as Policy +from .policy_param import PolicyParam as PolicyParam +from .approval_group import ApprovalGroup as ApprovalGroup from .ca_get_response import CAGetResponse as CAGetResponse from .ca_create_response import CACreateResponse as CACreateResponse from .ca_delete_response import CADeleteResponse as CADeleteResponse -from .zero_trust_policies import ZeroTrustPolicies as ZeroTrustPolicies +from .approval_group_param import ApprovalGroupParam as ApprovalGroupParam from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams +from .user_policy_check_geo import UserPolicyCheckGeo as UserPolicyCheckGeo from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse from .user_policy_check_list_response import UserPolicyCheckListResponse as UserPolicyCheckListResponse diff --git a/src/cloudflare/types/zero_trust/access/applications/approval_group.py b/src/cloudflare/types/zero_trust/access/applications/approval_group.py new file mode 100644 index 00000000000..d9f57327b86 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/approval_group.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ....._models import BaseModel + +__all__ = ["ApprovalGroup"] + + +class ApprovalGroup(BaseModel): + approvals_needed: float + """The number of approvals needed to obtain access.""" + + email_addresses: Optional[List[str]] = None + """A list of emails that can approve the access request.""" + + email_list_uuid: Optional[str] = None + """The UUID of an re-usable email list.""" diff --git a/src/cloudflare/types/zero_trust/access/applications/approval_group_param.py b/src/cloudflare/types/zero_trust/access/applications/approval_group_param.py new file mode 100644 index 00000000000..8428aad8822 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/approval_group_param.py @@ -0,0 +1,19 @@ +# 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 Required, TypedDict + +__all__ = ["ApprovalGroupParam"] + + +class ApprovalGroupParam(TypedDict, total=False): + approvals_needed: Required[float] + """The number of approvals needed to obtain access.""" + + email_addresses: List[str] + """A list of emails that can approve the access request.""" + + email_list_uuid: str + """The UUID of an re-usable email list.""" diff --git a/src/cloudflare/types/zero_trust/access/applications/ca.py b/src/cloudflare/types/zero_trust/access/applications/ca.py new file mode 100644 index 00000000000..423af7ae089 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/ca.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ....._models import BaseModel + +__all__ = ["CA"] + + +class CA(BaseModel): + id: Optional[str] = None + """The ID of the CA.""" + + aud: Optional[str] = None + """The Application Audience (AUD) tag. + + Identifies the application associated with the CA. + """ + + public_key: Optional[str] = None + """The public key to add to your SSH server configuration.""" diff --git a/src/cloudflare/types/zero_trust/access/applications/ca_create_response.py b/src/cloudflare/types/zero_trust/access/applications/ca_create_response.py index a104dcf93de..c0a4d7af889 100644 --- a/src/cloudflare/types/zero_trust/access/applications/ca_create_response.py +++ b/src/cloudflare/types/zero_trust/access/applications/ca_create_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["CACreateResponse"] -CACreateResponse = Union[str, object] +CACreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/access/applications/ca_get_response.py b/src/cloudflare/types/zero_trust/access/applications/ca_get_response.py index 01b4759ad89..8a2b05ffa92 100644 --- a/src/cloudflare/types/zero_trust/access/applications/ca_get_response.py +++ b/src/cloudflare/types/zero_trust/access/applications/ca_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["CAGetResponse"] -CAGetResponse = Union[str, object] +CAGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/access/applications/policy.py b/src/cloudflare/types/zero_trust/access/applications/policy.py new file mode 100644 index 00000000000..b19d148cea2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/policy.py @@ -0,0 +1,76 @@ +# 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 +from ...access_rule import AccessRule +from .approval_group import ApprovalGroup + +__all__ = ["Policy"] + + +class Policy(BaseModel): + id: Optional[str] = None + """UUID""" + + approval_groups: Optional[List[ApprovalGroup]] = None + """Administrators who can approve a temporary authentication request.""" + + approval_required: Optional[bool] = None + """ + Requires the user to request access from an administrator at the start of each + session. + """ + + created_at: Optional[datetime] = None + + decision: Optional[Literal["allow", "deny", "non_identity", "bypass"]] = None + """The action Access will take if a user matches this policy.""" + + exclude: Optional[List[AccessRule]] = None + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude rules. + """ + + include: Optional[List[AccessRule]] = None + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + isolation_required: Optional[bool] = None + """ + Require this application to be served in an isolated browser for users matching + this policy. 'Client Web Isolation' must be on for the account in order to use + this feature. + """ + + name: Optional[str] = None + """The name of the Access policy.""" + + precedence: Optional[int] = None + """The order of execution for this policy. Must be unique for each policy.""" + + purpose_justification_prompt: Optional[str] = None + """A custom message that will appear on the purpose justification screen.""" + + purpose_justification_required: Optional[bool] = None + """Require users to enter a justification when they log in to the application.""" + + require: Optional[List[AccessRule]] = None + """Rules evaluated with an AND logical operator. + + To match the policy, a user must meet all of the Require rules. + """ + + session_duration: Optional[str] = None + """The amount of time that tokens issued for the application will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_create_params.py b/src/cloudflare/types/zero_trust/access/applications/policy_create_params.py index a6d53febf41..4d782cdf8c0 100644 --- a/src/cloudflare/types/zero_trust/access/applications/policy_create_params.py +++ b/src/cloudflare/types/zero_trust/access/applications/policy_create_params.py @@ -2,130 +2,20 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict -from ....._utils import PropertyInfo +from ...access_rule_param import AccessRuleParam +from .approval_group_param import ApprovalGroupParam -__all__ = [ - "PolicyCreateParams", - "Include", - "IncludeAccessEmailRule", - "IncludeAccessEmailRuleEmail", - "IncludeAccessEmailListRule", - "IncludeAccessEmailListRuleEmailList", - "IncludeAccessDomainRule", - "IncludeAccessDomainRuleEmailDomain", - "IncludeAccessEveryoneRule", - "IncludeAccessIPRule", - "IncludeAccessIPRuleIP", - "IncludeAccessIPListRule", - "IncludeAccessIPListRuleIPList", - "IncludeAccessCertificateRule", - "IncludeAccessAccessGroupRule", - "IncludeAccessAccessGroupRuleGroup", - "IncludeAccessAzureGroupRule", - "IncludeAccessAzureGroupRuleAzureAd", - "IncludeAccessGitHubOrganizationRule", - "IncludeAccessGitHubOrganizationRuleGitHubOrganization", - "IncludeAccessGsuiteGroupRule", - "IncludeAccessGsuiteGroupRuleGsuite", - "IncludeAccessOktaGroupRule", - "IncludeAccessOktaGroupRuleOkta", - "IncludeAccessSamlGroupRule", - "IncludeAccessSamlGroupRuleSaml", - "IncludeAccessServiceTokenRule", - "IncludeAccessServiceTokenRuleServiceToken", - "IncludeAccessAnyValidServiceTokenRule", - "IncludeAccessExternalEvaluationRule", - "IncludeAccessExternalEvaluationRuleExternalEvaluation", - "IncludeAccessCountryRule", - "IncludeAccessCountryRuleGeo", - "IncludeAccessAuthenticationMethodRule", - "IncludeAccessAuthenticationMethodRuleAuthMethod", - "IncludeAccessDevicePostureRule", - "IncludeAccessDevicePostureRuleDevicePosture", - "ApprovalGroup", - "Exclude", - "ExcludeAccessEmailRule", - "ExcludeAccessEmailRuleEmail", - "ExcludeAccessEmailListRule", - "ExcludeAccessEmailListRuleEmailList", - "ExcludeAccessDomainRule", - "ExcludeAccessDomainRuleEmailDomain", - "ExcludeAccessEveryoneRule", - "ExcludeAccessIPRule", - "ExcludeAccessIPRuleIP", - "ExcludeAccessIPListRule", - "ExcludeAccessIPListRuleIPList", - "ExcludeAccessCertificateRule", - "ExcludeAccessAccessGroupRule", - "ExcludeAccessAccessGroupRuleGroup", - "ExcludeAccessAzureGroupRule", - "ExcludeAccessAzureGroupRuleAzureAd", - "ExcludeAccessGitHubOrganizationRule", - "ExcludeAccessGitHubOrganizationRuleGitHubOrganization", - "ExcludeAccessGsuiteGroupRule", - "ExcludeAccessGsuiteGroupRuleGsuite", - "ExcludeAccessOktaGroupRule", - "ExcludeAccessOktaGroupRuleOkta", - "ExcludeAccessSamlGroupRule", - "ExcludeAccessSamlGroupRuleSaml", - "ExcludeAccessServiceTokenRule", - "ExcludeAccessServiceTokenRuleServiceToken", - "ExcludeAccessAnyValidServiceTokenRule", - "ExcludeAccessExternalEvaluationRule", - "ExcludeAccessExternalEvaluationRuleExternalEvaluation", - "ExcludeAccessCountryRule", - "ExcludeAccessCountryRuleGeo", - "ExcludeAccessAuthenticationMethodRule", - "ExcludeAccessAuthenticationMethodRuleAuthMethod", - "ExcludeAccessDevicePostureRule", - "ExcludeAccessDevicePostureRuleDevicePosture", - "Require", - "RequireAccessEmailRule", - "RequireAccessEmailRuleEmail", - "RequireAccessEmailListRule", - "RequireAccessEmailListRuleEmailList", - "RequireAccessDomainRule", - "RequireAccessDomainRuleEmailDomain", - "RequireAccessEveryoneRule", - "RequireAccessIPRule", - "RequireAccessIPRuleIP", - "RequireAccessIPListRule", - "RequireAccessIPListRuleIPList", - "RequireAccessCertificateRule", - "RequireAccessAccessGroupRule", - "RequireAccessAccessGroupRuleGroup", - "RequireAccessAzureGroupRule", - "RequireAccessAzureGroupRuleAzureAd", - "RequireAccessGitHubOrganizationRule", - "RequireAccessGitHubOrganizationRuleGitHubOrganization", - "RequireAccessGsuiteGroupRule", - "RequireAccessGsuiteGroupRuleGsuite", - "RequireAccessOktaGroupRule", - "RequireAccessOktaGroupRuleOkta", - "RequireAccessSamlGroupRule", - "RequireAccessSamlGroupRuleSaml", - "RequireAccessServiceTokenRule", - "RequireAccessServiceTokenRuleServiceToken", - "RequireAccessAnyValidServiceTokenRule", - "RequireAccessExternalEvaluationRule", - "RequireAccessExternalEvaluationRuleExternalEvaluation", - "RequireAccessCountryRule", - "RequireAccessCountryRuleGeo", - "RequireAccessAuthenticationMethodRule", - "RequireAccessAuthenticationMethodRuleAuthMethod", - "RequireAccessDevicePostureRule", - "RequireAccessDevicePostureRuleDevicePosture", -] +__all__ = ["PolicyCreateParams"] class PolicyCreateParams(TypedDict, total=False): decision: Required[Literal["allow", "deny", "non_identity", "bypass"]] """The action Access will take if a user matches this policy.""" - include: Required[Iterable[Include]] + include: Required[Iterable[AccessRuleParam]] """Rules evaluated with an OR logical operator. A user needs to meet only one of the Include rules. @@ -140,7 +30,7 @@ class PolicyCreateParams(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - approval_groups: Iterable[ApprovalGroup] + approval_groups: Iterable[ApprovalGroupParam] """Administrators who can approve a temporary authentication request.""" approval_required: bool @@ -149,7 +39,7 @@ class PolicyCreateParams(TypedDict, total=False): session. """ - exclude: Iterable[Exclude] + exclude: Iterable[AccessRuleParam] """Rules evaluated with a NOT logical operator. To match the policy, a user cannot meet any of the Exclude rules. @@ -171,7 +61,7 @@ class PolicyCreateParams(TypedDict, total=False): purpose_justification_required: bool """Require users to enter a justification when they log in to the application.""" - require: Iterable[Require] + require: Iterable[AccessRuleParam] """Rules evaluated with an AND logical operator. To match the policy, a user must meet all of the Require rules. @@ -183,632 +73,3 @@ class PolicyCreateParams(TypedDict, total=False): Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. """ - - -class IncludeAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class IncludeAccessEmailRule(TypedDict, total=False): - email: Required[IncludeAccessEmailRuleEmail] - - -class IncludeAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class IncludeAccessEmailListRule(TypedDict, total=False): - email_list: Required[IncludeAccessEmailListRuleEmailList] - - -class IncludeAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class IncludeAccessDomainRule(TypedDict, total=False): - email_domain: Required[IncludeAccessDomainRuleEmailDomain] - - -class IncludeAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class IncludeAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class IncludeAccessIPRule(TypedDict, total=False): - ip: Required[IncludeAccessIPRuleIP] - - -class IncludeAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class IncludeAccessIPListRule(TypedDict, total=False): - ip_list: Required[IncludeAccessIPListRuleIPList] - - -class IncludeAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class IncludeAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class IncludeAccessAccessGroupRule(TypedDict, total=False): - group: Required[IncludeAccessAccessGroupRuleGroup] - - -class IncludeAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class IncludeAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[IncludeAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class IncludeAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class IncludeAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[IncludeAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class IncludeAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class IncludeAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[IncludeAccessGsuiteGroupRuleGsuite] - - -class IncludeAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class IncludeAccessOktaGroupRule(TypedDict, total=False): - okta: Required[IncludeAccessOktaGroupRuleOkta] - - -class IncludeAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class IncludeAccessSamlGroupRule(TypedDict, total=False): - saml: Required[IncludeAccessSamlGroupRuleSaml] - - -class IncludeAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class IncludeAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[IncludeAccessServiceTokenRuleServiceToken] - - -class IncludeAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class IncludeAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class IncludeAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[IncludeAccessExternalEvaluationRuleExternalEvaluation] - - -class IncludeAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class IncludeAccessCountryRule(TypedDict, total=False): - geo: Required[IncludeAccessCountryRuleGeo] - - -class IncludeAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class IncludeAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[IncludeAccessAuthenticationMethodRuleAuthMethod] - - -class IncludeAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class IncludeAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[IncludeAccessDevicePostureRuleDevicePosture] - - -Include = Union[ - IncludeAccessEmailRule, - IncludeAccessEmailListRule, - IncludeAccessDomainRule, - IncludeAccessEveryoneRule, - IncludeAccessIPRule, - IncludeAccessIPListRule, - IncludeAccessCertificateRule, - IncludeAccessAccessGroupRule, - IncludeAccessAzureGroupRule, - IncludeAccessGitHubOrganizationRule, - IncludeAccessGsuiteGroupRule, - IncludeAccessOktaGroupRule, - IncludeAccessSamlGroupRule, - IncludeAccessServiceTokenRule, - IncludeAccessAnyValidServiceTokenRule, - IncludeAccessExternalEvaluationRule, - IncludeAccessCountryRule, - IncludeAccessAuthenticationMethodRule, - IncludeAccessDevicePostureRule, -] - - -class ApprovalGroup(TypedDict, total=False): - approvals_needed: Required[float] - """The number of approvals needed to obtain access.""" - - email_addresses: List[str] - """A list of emails that can approve the access request.""" - - email_list_uuid: str - """The UUID of an re-usable email list.""" - - -class ExcludeAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class ExcludeAccessEmailRule(TypedDict, total=False): - email: Required[ExcludeAccessEmailRuleEmail] - - -class ExcludeAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class ExcludeAccessEmailListRule(TypedDict, total=False): - email_list: Required[ExcludeAccessEmailListRuleEmailList] - - -class ExcludeAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class ExcludeAccessDomainRule(TypedDict, total=False): - email_domain: Required[ExcludeAccessDomainRuleEmailDomain] - - -class ExcludeAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class ExcludeAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class ExcludeAccessIPRule(TypedDict, total=False): - ip: Required[ExcludeAccessIPRuleIP] - - -class ExcludeAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class ExcludeAccessIPListRule(TypedDict, total=False): - ip_list: Required[ExcludeAccessIPListRuleIPList] - - -class ExcludeAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class ExcludeAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class ExcludeAccessAccessGroupRule(TypedDict, total=False): - group: Required[ExcludeAccessAccessGroupRuleGroup] - - -class ExcludeAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class ExcludeAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[ExcludeAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class ExcludeAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class ExcludeAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[ExcludeAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class ExcludeAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class ExcludeAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[ExcludeAccessGsuiteGroupRuleGsuite] - - -class ExcludeAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class ExcludeAccessOktaGroupRule(TypedDict, total=False): - okta: Required[ExcludeAccessOktaGroupRuleOkta] - - -class ExcludeAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class ExcludeAccessSamlGroupRule(TypedDict, total=False): - saml: Required[ExcludeAccessSamlGroupRuleSaml] - - -class ExcludeAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class ExcludeAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[ExcludeAccessServiceTokenRuleServiceToken] - - -class ExcludeAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class ExcludeAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class ExcludeAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[ExcludeAccessExternalEvaluationRuleExternalEvaluation] - - -class ExcludeAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class ExcludeAccessCountryRule(TypedDict, total=False): - geo: Required[ExcludeAccessCountryRuleGeo] - - -class ExcludeAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class ExcludeAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[ExcludeAccessAuthenticationMethodRuleAuthMethod] - - -class ExcludeAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class ExcludeAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[ExcludeAccessDevicePostureRuleDevicePosture] - - -Exclude = Union[ - ExcludeAccessEmailRule, - ExcludeAccessEmailListRule, - ExcludeAccessDomainRule, - ExcludeAccessEveryoneRule, - ExcludeAccessIPRule, - ExcludeAccessIPListRule, - ExcludeAccessCertificateRule, - ExcludeAccessAccessGroupRule, - ExcludeAccessAzureGroupRule, - ExcludeAccessGitHubOrganizationRule, - ExcludeAccessGsuiteGroupRule, - ExcludeAccessOktaGroupRule, - ExcludeAccessSamlGroupRule, - ExcludeAccessServiceTokenRule, - ExcludeAccessAnyValidServiceTokenRule, - ExcludeAccessExternalEvaluationRule, - ExcludeAccessCountryRule, - ExcludeAccessAuthenticationMethodRule, - ExcludeAccessDevicePostureRule, -] - - -class RequireAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class RequireAccessEmailRule(TypedDict, total=False): - email: Required[RequireAccessEmailRuleEmail] - - -class RequireAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class RequireAccessEmailListRule(TypedDict, total=False): - email_list: Required[RequireAccessEmailListRuleEmailList] - - -class RequireAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class RequireAccessDomainRule(TypedDict, total=False): - email_domain: Required[RequireAccessDomainRuleEmailDomain] - - -class RequireAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class RequireAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class RequireAccessIPRule(TypedDict, total=False): - ip: Required[RequireAccessIPRuleIP] - - -class RequireAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class RequireAccessIPListRule(TypedDict, total=False): - ip_list: Required[RequireAccessIPListRuleIPList] - - -class RequireAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class RequireAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class RequireAccessAccessGroupRule(TypedDict, total=False): - group: Required[RequireAccessAccessGroupRuleGroup] - - -class RequireAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class RequireAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[RequireAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class RequireAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class RequireAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[RequireAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class RequireAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class RequireAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[RequireAccessGsuiteGroupRuleGsuite] - - -class RequireAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class RequireAccessOktaGroupRule(TypedDict, total=False): - okta: Required[RequireAccessOktaGroupRuleOkta] - - -class RequireAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class RequireAccessSamlGroupRule(TypedDict, total=False): - saml: Required[RequireAccessSamlGroupRuleSaml] - - -class RequireAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class RequireAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[RequireAccessServiceTokenRuleServiceToken] - - -class RequireAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class RequireAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class RequireAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[RequireAccessExternalEvaluationRuleExternalEvaluation] - - -class RequireAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class RequireAccessCountryRule(TypedDict, total=False): - geo: Required[RequireAccessCountryRuleGeo] - - -class RequireAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class RequireAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[RequireAccessAuthenticationMethodRuleAuthMethod] - - -class RequireAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class RequireAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[RequireAccessDevicePostureRuleDevicePosture] - - -Require = Union[ - RequireAccessEmailRule, - RequireAccessEmailListRule, - RequireAccessDomainRule, - RequireAccessEveryoneRule, - RequireAccessIPRule, - RequireAccessIPListRule, - RequireAccessCertificateRule, - RequireAccessAccessGroupRule, - RequireAccessAzureGroupRule, - RequireAccessGitHubOrganizationRule, - RequireAccessGsuiteGroupRule, - RequireAccessOktaGroupRule, - RequireAccessSamlGroupRule, - RequireAccessServiceTokenRule, - RequireAccessAnyValidServiceTokenRule, - RequireAccessExternalEvaluationRule, - RequireAccessCountryRule, - RequireAccessAuthenticationMethodRule, - RequireAccessDevicePostureRule, -] diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_param.py b/src/cloudflare/types/zero_trust/access/applications/policy_param.py new file mode 100644 index 00000000000..c9d3abfd454 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/policy_param.py @@ -0,0 +1,69 @@ +# 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, TypedDict + +from ...access_rule_param import AccessRuleParam +from .approval_group_param import ApprovalGroupParam + +__all__ = ["PolicyParam"] + + +class PolicyParam(TypedDict, total=False): + approval_groups: Iterable[ApprovalGroupParam] + """Administrators who can approve a temporary authentication request.""" + + approval_required: bool + """ + Requires the user to request access from an administrator at the start of each + session. + """ + + decision: Literal["allow", "deny", "non_identity", "bypass"] + """The action Access will take if a user matches this policy.""" + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude rules. + """ + + include: Iterable[AccessRuleParam] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + isolation_required: bool + """ + Require this application to be served in an isolated browser for users matching + this policy. 'Client Web Isolation' must be on for the account in order to use + this feature. + """ + + name: str + """The name of the Access policy.""" + + precedence: int + """The order of execution for this policy. Must be unique for each policy.""" + + purpose_justification_prompt: str + """A custom message that will appear on the purpose justification screen.""" + + purpose_justification_required: bool + """Require users to enter a justification when they log in to the application.""" + + require: Iterable[AccessRuleParam] + """Rules evaluated with an AND logical operator. + + To match the policy, a user must meet all of the Require rules. + """ + + session_duration: str + """The amount of time that tokens issued for the application will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py b/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py index 223aea70ccd..6047e104f04 100644 --- a/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py +++ b/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py @@ -2,123 +2,13 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict -from ....._utils import PropertyInfo +from ...access_rule_param import AccessRuleParam +from .approval_group_param import ApprovalGroupParam -__all__ = [ - "PolicyUpdateParams", - "Include", - "IncludeAccessEmailRule", - "IncludeAccessEmailRuleEmail", - "IncludeAccessEmailListRule", - "IncludeAccessEmailListRuleEmailList", - "IncludeAccessDomainRule", - "IncludeAccessDomainRuleEmailDomain", - "IncludeAccessEveryoneRule", - "IncludeAccessIPRule", - "IncludeAccessIPRuleIP", - "IncludeAccessIPListRule", - "IncludeAccessIPListRuleIPList", - "IncludeAccessCertificateRule", - "IncludeAccessAccessGroupRule", - "IncludeAccessAccessGroupRuleGroup", - "IncludeAccessAzureGroupRule", - "IncludeAccessAzureGroupRuleAzureAd", - "IncludeAccessGitHubOrganizationRule", - "IncludeAccessGitHubOrganizationRuleGitHubOrganization", - "IncludeAccessGsuiteGroupRule", - "IncludeAccessGsuiteGroupRuleGsuite", - "IncludeAccessOktaGroupRule", - "IncludeAccessOktaGroupRuleOkta", - "IncludeAccessSamlGroupRule", - "IncludeAccessSamlGroupRuleSaml", - "IncludeAccessServiceTokenRule", - "IncludeAccessServiceTokenRuleServiceToken", - "IncludeAccessAnyValidServiceTokenRule", - "IncludeAccessExternalEvaluationRule", - "IncludeAccessExternalEvaluationRuleExternalEvaluation", - "IncludeAccessCountryRule", - "IncludeAccessCountryRuleGeo", - "IncludeAccessAuthenticationMethodRule", - "IncludeAccessAuthenticationMethodRuleAuthMethod", - "IncludeAccessDevicePostureRule", - "IncludeAccessDevicePostureRuleDevicePosture", - "ApprovalGroup", - "Exclude", - "ExcludeAccessEmailRule", - "ExcludeAccessEmailRuleEmail", - "ExcludeAccessEmailListRule", - "ExcludeAccessEmailListRuleEmailList", - "ExcludeAccessDomainRule", - "ExcludeAccessDomainRuleEmailDomain", - "ExcludeAccessEveryoneRule", - "ExcludeAccessIPRule", - "ExcludeAccessIPRuleIP", - "ExcludeAccessIPListRule", - "ExcludeAccessIPListRuleIPList", - "ExcludeAccessCertificateRule", - "ExcludeAccessAccessGroupRule", - "ExcludeAccessAccessGroupRuleGroup", - "ExcludeAccessAzureGroupRule", - "ExcludeAccessAzureGroupRuleAzureAd", - "ExcludeAccessGitHubOrganizationRule", - "ExcludeAccessGitHubOrganizationRuleGitHubOrganization", - "ExcludeAccessGsuiteGroupRule", - "ExcludeAccessGsuiteGroupRuleGsuite", - "ExcludeAccessOktaGroupRule", - "ExcludeAccessOktaGroupRuleOkta", - "ExcludeAccessSamlGroupRule", - "ExcludeAccessSamlGroupRuleSaml", - "ExcludeAccessServiceTokenRule", - "ExcludeAccessServiceTokenRuleServiceToken", - "ExcludeAccessAnyValidServiceTokenRule", - "ExcludeAccessExternalEvaluationRule", - "ExcludeAccessExternalEvaluationRuleExternalEvaluation", - "ExcludeAccessCountryRule", - "ExcludeAccessCountryRuleGeo", - "ExcludeAccessAuthenticationMethodRule", - "ExcludeAccessAuthenticationMethodRuleAuthMethod", - "ExcludeAccessDevicePostureRule", - "ExcludeAccessDevicePostureRuleDevicePosture", - "Require", - "RequireAccessEmailRule", - "RequireAccessEmailRuleEmail", - "RequireAccessEmailListRule", - "RequireAccessEmailListRuleEmailList", - "RequireAccessDomainRule", - "RequireAccessDomainRuleEmailDomain", - "RequireAccessEveryoneRule", - "RequireAccessIPRule", - "RequireAccessIPRuleIP", - "RequireAccessIPListRule", - "RequireAccessIPListRuleIPList", - "RequireAccessCertificateRule", - "RequireAccessAccessGroupRule", - "RequireAccessAccessGroupRuleGroup", - "RequireAccessAzureGroupRule", - "RequireAccessAzureGroupRuleAzureAd", - "RequireAccessGitHubOrganizationRule", - "RequireAccessGitHubOrganizationRuleGitHubOrganization", - "RequireAccessGsuiteGroupRule", - "RequireAccessGsuiteGroupRuleGsuite", - "RequireAccessOktaGroupRule", - "RequireAccessOktaGroupRuleOkta", - "RequireAccessSamlGroupRule", - "RequireAccessSamlGroupRuleSaml", - "RequireAccessServiceTokenRule", - "RequireAccessServiceTokenRuleServiceToken", - "RequireAccessAnyValidServiceTokenRule", - "RequireAccessExternalEvaluationRule", - "RequireAccessExternalEvaluationRuleExternalEvaluation", - "RequireAccessCountryRule", - "RequireAccessCountryRuleGeo", - "RequireAccessAuthenticationMethodRule", - "RequireAccessAuthenticationMethodRuleAuthMethod", - "RequireAccessDevicePostureRule", - "RequireAccessDevicePostureRuleDevicePosture", -] +__all__ = ["PolicyUpdateParams"] class PolicyUpdateParams(TypedDict, total=False): @@ -128,7 +18,7 @@ class PolicyUpdateParams(TypedDict, total=False): decision: Required[Literal["allow", "deny", "non_identity", "bypass"]] """The action Access will take if a user matches this policy.""" - include: Required[Iterable[Include]] + include: Required[Iterable[AccessRuleParam]] """Rules evaluated with an OR logical operator. A user needs to meet only one of the Include rules. @@ -143,7 +33,7 @@ class PolicyUpdateParams(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - approval_groups: Iterable[ApprovalGroup] + approval_groups: Iterable[ApprovalGroupParam] """Administrators who can approve a temporary authentication request.""" approval_required: bool @@ -152,7 +42,7 @@ class PolicyUpdateParams(TypedDict, total=False): session. """ - exclude: Iterable[Exclude] + exclude: Iterable[AccessRuleParam] """Rules evaluated with a NOT logical operator. To match the policy, a user cannot meet any of the Exclude rules. @@ -174,7 +64,7 @@ class PolicyUpdateParams(TypedDict, total=False): purpose_justification_required: bool """Require users to enter a justification when they log in to the application.""" - require: Iterable[Require] + require: Iterable[AccessRuleParam] """Rules evaluated with an AND logical operator. To match the policy, a user must meet all of the Require rules. @@ -186,632 +76,3 @@ class PolicyUpdateParams(TypedDict, total=False): Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. """ - - -class IncludeAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class IncludeAccessEmailRule(TypedDict, total=False): - email: Required[IncludeAccessEmailRuleEmail] - - -class IncludeAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class IncludeAccessEmailListRule(TypedDict, total=False): - email_list: Required[IncludeAccessEmailListRuleEmailList] - - -class IncludeAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class IncludeAccessDomainRule(TypedDict, total=False): - email_domain: Required[IncludeAccessDomainRuleEmailDomain] - - -class IncludeAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class IncludeAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class IncludeAccessIPRule(TypedDict, total=False): - ip: Required[IncludeAccessIPRuleIP] - - -class IncludeAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class IncludeAccessIPListRule(TypedDict, total=False): - ip_list: Required[IncludeAccessIPListRuleIPList] - - -class IncludeAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class IncludeAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class IncludeAccessAccessGroupRule(TypedDict, total=False): - group: Required[IncludeAccessAccessGroupRuleGroup] - - -class IncludeAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class IncludeAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[IncludeAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class IncludeAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class IncludeAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[IncludeAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class IncludeAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class IncludeAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[IncludeAccessGsuiteGroupRuleGsuite] - - -class IncludeAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class IncludeAccessOktaGroupRule(TypedDict, total=False): - okta: Required[IncludeAccessOktaGroupRuleOkta] - - -class IncludeAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class IncludeAccessSamlGroupRule(TypedDict, total=False): - saml: Required[IncludeAccessSamlGroupRuleSaml] - - -class IncludeAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class IncludeAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[IncludeAccessServiceTokenRuleServiceToken] - - -class IncludeAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class IncludeAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class IncludeAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[IncludeAccessExternalEvaluationRuleExternalEvaluation] - - -class IncludeAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class IncludeAccessCountryRule(TypedDict, total=False): - geo: Required[IncludeAccessCountryRuleGeo] - - -class IncludeAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class IncludeAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[IncludeAccessAuthenticationMethodRuleAuthMethod] - - -class IncludeAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class IncludeAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[IncludeAccessDevicePostureRuleDevicePosture] - - -Include = Union[ - IncludeAccessEmailRule, - IncludeAccessEmailListRule, - IncludeAccessDomainRule, - IncludeAccessEveryoneRule, - IncludeAccessIPRule, - IncludeAccessIPListRule, - IncludeAccessCertificateRule, - IncludeAccessAccessGroupRule, - IncludeAccessAzureGroupRule, - IncludeAccessGitHubOrganizationRule, - IncludeAccessGsuiteGroupRule, - IncludeAccessOktaGroupRule, - IncludeAccessSamlGroupRule, - IncludeAccessServiceTokenRule, - IncludeAccessAnyValidServiceTokenRule, - IncludeAccessExternalEvaluationRule, - IncludeAccessCountryRule, - IncludeAccessAuthenticationMethodRule, - IncludeAccessDevicePostureRule, -] - - -class ApprovalGroup(TypedDict, total=False): - approvals_needed: Required[float] - """The number of approvals needed to obtain access.""" - - email_addresses: List[str] - """A list of emails that can approve the access request.""" - - email_list_uuid: str - """The UUID of an re-usable email list.""" - - -class ExcludeAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class ExcludeAccessEmailRule(TypedDict, total=False): - email: Required[ExcludeAccessEmailRuleEmail] - - -class ExcludeAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class ExcludeAccessEmailListRule(TypedDict, total=False): - email_list: Required[ExcludeAccessEmailListRuleEmailList] - - -class ExcludeAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class ExcludeAccessDomainRule(TypedDict, total=False): - email_domain: Required[ExcludeAccessDomainRuleEmailDomain] - - -class ExcludeAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class ExcludeAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class ExcludeAccessIPRule(TypedDict, total=False): - ip: Required[ExcludeAccessIPRuleIP] - - -class ExcludeAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class ExcludeAccessIPListRule(TypedDict, total=False): - ip_list: Required[ExcludeAccessIPListRuleIPList] - - -class ExcludeAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class ExcludeAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class ExcludeAccessAccessGroupRule(TypedDict, total=False): - group: Required[ExcludeAccessAccessGroupRuleGroup] - - -class ExcludeAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class ExcludeAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[ExcludeAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class ExcludeAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class ExcludeAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[ExcludeAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class ExcludeAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class ExcludeAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[ExcludeAccessGsuiteGroupRuleGsuite] - - -class ExcludeAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class ExcludeAccessOktaGroupRule(TypedDict, total=False): - okta: Required[ExcludeAccessOktaGroupRuleOkta] - - -class ExcludeAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class ExcludeAccessSamlGroupRule(TypedDict, total=False): - saml: Required[ExcludeAccessSamlGroupRuleSaml] - - -class ExcludeAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class ExcludeAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[ExcludeAccessServiceTokenRuleServiceToken] - - -class ExcludeAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class ExcludeAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class ExcludeAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[ExcludeAccessExternalEvaluationRuleExternalEvaluation] - - -class ExcludeAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class ExcludeAccessCountryRule(TypedDict, total=False): - geo: Required[ExcludeAccessCountryRuleGeo] - - -class ExcludeAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class ExcludeAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[ExcludeAccessAuthenticationMethodRuleAuthMethod] - - -class ExcludeAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class ExcludeAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[ExcludeAccessDevicePostureRuleDevicePosture] - - -Exclude = Union[ - ExcludeAccessEmailRule, - ExcludeAccessEmailListRule, - ExcludeAccessDomainRule, - ExcludeAccessEveryoneRule, - ExcludeAccessIPRule, - ExcludeAccessIPListRule, - ExcludeAccessCertificateRule, - ExcludeAccessAccessGroupRule, - ExcludeAccessAzureGroupRule, - ExcludeAccessGitHubOrganizationRule, - ExcludeAccessGsuiteGroupRule, - ExcludeAccessOktaGroupRule, - ExcludeAccessSamlGroupRule, - ExcludeAccessServiceTokenRule, - ExcludeAccessAnyValidServiceTokenRule, - ExcludeAccessExternalEvaluationRule, - ExcludeAccessCountryRule, - ExcludeAccessAuthenticationMethodRule, - ExcludeAccessDevicePostureRule, -] - - -class RequireAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class RequireAccessEmailRule(TypedDict, total=False): - email: Required[RequireAccessEmailRuleEmail] - - -class RequireAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class RequireAccessEmailListRule(TypedDict, total=False): - email_list: Required[RequireAccessEmailListRuleEmailList] - - -class RequireAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class RequireAccessDomainRule(TypedDict, total=False): - email_domain: Required[RequireAccessDomainRuleEmailDomain] - - -class RequireAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class RequireAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class RequireAccessIPRule(TypedDict, total=False): - ip: Required[RequireAccessIPRuleIP] - - -class RequireAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class RequireAccessIPListRule(TypedDict, total=False): - ip_list: Required[RequireAccessIPListRuleIPList] - - -class RequireAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class RequireAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class RequireAccessAccessGroupRule(TypedDict, total=False): - group: Required[RequireAccessAccessGroupRuleGroup] - - -class RequireAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class RequireAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[RequireAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class RequireAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class RequireAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[RequireAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class RequireAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class RequireAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[RequireAccessGsuiteGroupRuleGsuite] - - -class RequireAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class RequireAccessOktaGroupRule(TypedDict, total=False): - okta: Required[RequireAccessOktaGroupRuleOkta] - - -class RequireAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class RequireAccessSamlGroupRule(TypedDict, total=False): - saml: Required[RequireAccessSamlGroupRuleSaml] - - -class RequireAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class RequireAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[RequireAccessServiceTokenRuleServiceToken] - - -class RequireAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class RequireAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class RequireAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[RequireAccessExternalEvaluationRuleExternalEvaluation] - - -class RequireAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class RequireAccessCountryRule(TypedDict, total=False): - geo: Required[RequireAccessCountryRuleGeo] - - -class RequireAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class RequireAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[RequireAccessAuthenticationMethodRuleAuthMethod] - - -class RequireAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class RequireAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[RequireAccessDevicePostureRuleDevicePosture] - - -Require = Union[ - RequireAccessEmailRule, - RequireAccessEmailListRule, - RequireAccessDomainRule, - RequireAccessEveryoneRule, - RequireAccessIPRule, - RequireAccessIPListRule, - RequireAccessCertificateRule, - RequireAccessAccessGroupRule, - RequireAccessAzureGroupRule, - RequireAccessGitHubOrganizationRule, - RequireAccessGsuiteGroupRule, - RequireAccessOktaGroupRule, - RequireAccessSamlGroupRule, - RequireAccessServiceTokenRule, - RequireAccessAnyValidServiceTokenRule, - RequireAccessExternalEvaluationRule, - RequireAccessCountryRule, - RequireAccessAuthenticationMethodRule, - RequireAccessDevicePostureRule, -] diff --git a/src/cloudflare/types/zero_trust/access/applications/user_policy_check_geo.py b/src/cloudflare/types/zero_trust/access/applications/user_policy_check_geo.py new file mode 100644 index 00000000000..b99d468ab06 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/user_policy_check_geo.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__ = ["UserPolicyCheckGeo"] + + +class UserPolicyCheckGeo(BaseModel): + country: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/access/applications/user_policy_check_list_response.py b/src/cloudflare/types/zero_trust/access/applications/user_policy_check_list_response.py index 7e0bd187b85..3622477b98e 100644 --- a/src/cloudflare/types/zero_trust/access/applications/user_policy_check_list_response.py +++ b/src/cloudflare/types/zero_trust/access/applications/user_policy_check_list_response.py @@ -3,8 +3,9 @@ from typing import List, Optional from ....._models import BaseModel +from .user_policy_check_geo import UserPolicyCheckGeo -__all__ = ["UserPolicyCheckListResponse", "AppState", "UserIdentity", "UserIdentityGeo"] +__all__ = ["UserPolicyCheckListResponse", "AppState", "UserIdentity"] class AppState(BaseModel): @@ -22,10 +23,6 @@ class AppState(BaseModel): status: Optional[str] = None -class UserIdentityGeo(BaseModel): - country: Optional[str] = None - - class UserIdentity(BaseModel): id: Optional[str] = None @@ -35,7 +32,7 @@ class UserIdentity(BaseModel): email: Optional[str] = None - geo: Optional[UserIdentityGeo] = None + geo: Optional[UserPolicyCheckGeo] = None iat: Optional[int] = None diff --git a/src/cloudflare/types/zero_trust/access/applications/zero_trust_ca.py b/src/cloudflare/types/zero_trust/access/applications/zero_trust_ca.py deleted file mode 100644 index ab676fbdc23..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/zero_trust_ca.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ....._models import BaseModel - -__all__ = ["ZeroTrustCA"] - - -class ZeroTrustCA(BaseModel): - id: Optional[str] = None - """The ID of the CA.""" - - aud: Optional[str] = None - """The Application Audience (AUD) tag. - - Identifies the application associated with the CA. - """ - - public_key: Optional[str] = None - """The public key to add to your SSH server configuration.""" diff --git a/src/cloudflare/types/zero_trust/access/applications/zero_trust_policies.py b/src/cloudflare/types/zero_trust/access/applications/zero_trust_policies.py deleted file mode 100644 index 91fd93a10f2..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/zero_trust_policies.py +++ /dev/null @@ -1,810 +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 - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "ZeroTrustPolicies", - "ApprovalGroup", - "Exclude", - "ExcludeAccessEmailRule", - "ExcludeAccessEmailRuleEmail", - "ExcludeAccessEmailListRule", - "ExcludeAccessEmailListRuleEmailList", - "ExcludeAccessDomainRule", - "ExcludeAccessDomainRuleEmailDomain", - "ExcludeAccessEveryoneRule", - "ExcludeAccessIPRule", - "ExcludeAccessIPRuleIP", - "ExcludeAccessIPListRule", - "ExcludeAccessIPListRuleIPList", - "ExcludeAccessCertificateRule", - "ExcludeAccessAccessGroupRule", - "ExcludeAccessAccessGroupRuleGroup", - "ExcludeAccessAzureGroupRule", - "ExcludeAccessAzureGroupRuleAzureAd", - "ExcludeAccessGitHubOrganizationRule", - "ExcludeAccessGitHubOrganizationRuleGitHubOrganization", - "ExcludeAccessGsuiteGroupRule", - "ExcludeAccessGsuiteGroupRuleGsuite", - "ExcludeAccessOktaGroupRule", - "ExcludeAccessOktaGroupRuleOkta", - "ExcludeAccessSamlGroupRule", - "ExcludeAccessSamlGroupRuleSaml", - "ExcludeAccessServiceTokenRule", - "ExcludeAccessServiceTokenRuleServiceToken", - "ExcludeAccessAnyValidServiceTokenRule", - "ExcludeAccessExternalEvaluationRule", - "ExcludeAccessExternalEvaluationRuleExternalEvaluation", - "ExcludeAccessCountryRule", - "ExcludeAccessCountryRuleGeo", - "ExcludeAccessAuthenticationMethodRule", - "ExcludeAccessAuthenticationMethodRuleAuthMethod", - "ExcludeAccessDevicePostureRule", - "ExcludeAccessDevicePostureRuleDevicePosture", - "Include", - "IncludeAccessEmailRule", - "IncludeAccessEmailRuleEmail", - "IncludeAccessEmailListRule", - "IncludeAccessEmailListRuleEmailList", - "IncludeAccessDomainRule", - "IncludeAccessDomainRuleEmailDomain", - "IncludeAccessEveryoneRule", - "IncludeAccessIPRule", - "IncludeAccessIPRuleIP", - "IncludeAccessIPListRule", - "IncludeAccessIPListRuleIPList", - "IncludeAccessCertificateRule", - "IncludeAccessAccessGroupRule", - "IncludeAccessAccessGroupRuleGroup", - "IncludeAccessAzureGroupRule", - "IncludeAccessAzureGroupRuleAzureAd", - "IncludeAccessGitHubOrganizationRule", - "IncludeAccessGitHubOrganizationRuleGitHubOrganization", - "IncludeAccessGsuiteGroupRule", - "IncludeAccessGsuiteGroupRuleGsuite", - "IncludeAccessOktaGroupRule", - "IncludeAccessOktaGroupRuleOkta", - "IncludeAccessSamlGroupRule", - "IncludeAccessSamlGroupRuleSaml", - "IncludeAccessServiceTokenRule", - "IncludeAccessServiceTokenRuleServiceToken", - "IncludeAccessAnyValidServiceTokenRule", - "IncludeAccessExternalEvaluationRule", - "IncludeAccessExternalEvaluationRuleExternalEvaluation", - "IncludeAccessCountryRule", - "IncludeAccessCountryRuleGeo", - "IncludeAccessAuthenticationMethodRule", - "IncludeAccessAuthenticationMethodRuleAuthMethod", - "IncludeAccessDevicePostureRule", - "IncludeAccessDevicePostureRuleDevicePosture", - "Require", - "RequireAccessEmailRule", - "RequireAccessEmailRuleEmail", - "RequireAccessEmailListRule", - "RequireAccessEmailListRuleEmailList", - "RequireAccessDomainRule", - "RequireAccessDomainRuleEmailDomain", - "RequireAccessEveryoneRule", - "RequireAccessIPRule", - "RequireAccessIPRuleIP", - "RequireAccessIPListRule", - "RequireAccessIPListRuleIPList", - "RequireAccessCertificateRule", - "RequireAccessAccessGroupRule", - "RequireAccessAccessGroupRuleGroup", - "RequireAccessAzureGroupRule", - "RequireAccessAzureGroupRuleAzureAd", - "RequireAccessGitHubOrganizationRule", - "RequireAccessGitHubOrganizationRuleGitHubOrganization", - "RequireAccessGsuiteGroupRule", - "RequireAccessGsuiteGroupRuleGsuite", - "RequireAccessOktaGroupRule", - "RequireAccessOktaGroupRuleOkta", - "RequireAccessSamlGroupRule", - "RequireAccessSamlGroupRuleSaml", - "RequireAccessServiceTokenRule", - "RequireAccessServiceTokenRuleServiceToken", - "RequireAccessAnyValidServiceTokenRule", - "RequireAccessExternalEvaluationRule", - "RequireAccessExternalEvaluationRuleExternalEvaluation", - "RequireAccessCountryRule", - "RequireAccessCountryRuleGeo", - "RequireAccessAuthenticationMethodRule", - "RequireAccessAuthenticationMethodRuleAuthMethod", - "RequireAccessDevicePostureRule", - "RequireAccessDevicePostureRuleDevicePosture", -] - - -class ApprovalGroup(BaseModel): - approvals_needed: float - """The number of approvals needed to obtain access.""" - - email_addresses: Optional[List[str]] = None - """A list of emails that can approve the access request.""" - - email_list_uuid: Optional[str] = None - """The UUID of an re-usable email list.""" - - -class ExcludeAccessEmailRuleEmail(BaseModel): - email: str - """The email of the user.""" - - -class ExcludeAccessEmailRule(BaseModel): - email: ExcludeAccessEmailRuleEmail - - -class ExcludeAccessEmailListRuleEmailList(BaseModel): - id: str - """The ID of a previously created email list.""" - - -class ExcludeAccessEmailListRule(BaseModel): - email_list: ExcludeAccessEmailListRuleEmailList - - -class ExcludeAccessDomainRuleEmailDomain(BaseModel): - domain: str - """The email domain to match.""" - - -class ExcludeAccessDomainRule(BaseModel): - email_domain: ExcludeAccessDomainRuleEmailDomain - - -class ExcludeAccessEveryoneRule(BaseModel): - everyone: object - """An empty object which matches on all users.""" - - -class ExcludeAccessIPRuleIP(BaseModel): - ip: str - """An IPv4 or IPv6 CIDR block.""" - - -class ExcludeAccessIPRule(BaseModel): - ip: ExcludeAccessIPRuleIP - - -class ExcludeAccessIPListRuleIPList(BaseModel): - id: str - """The ID of a previously created IP list.""" - - -class ExcludeAccessIPListRule(BaseModel): - ip_list: ExcludeAccessIPListRuleIPList - - -class ExcludeAccessCertificateRule(BaseModel): - certificate: object - - -class ExcludeAccessAccessGroupRuleGroup(BaseModel): - id: str - """The ID of a previously created Access group.""" - - -class ExcludeAccessAccessGroupRule(BaseModel): - group: ExcludeAccessAccessGroupRuleGroup - - -class ExcludeAccessAzureGroupRuleAzureAd(BaseModel): - id: str - """The ID of an Azure group.""" - - connection_id: str - """The ID of your Azure identity provider.""" - - -class ExcludeAccessAzureGroupRule(BaseModel): - azure_ad: ExcludeAccessAzureGroupRuleAzureAd = FieldInfo(alias="azureAD") - - -class ExcludeAccessGitHubOrganizationRuleGitHubOrganization(BaseModel): - connection_id: str - """The ID of your Github identity provider.""" - - name: str - """The name of the organization.""" - - -class ExcludeAccessGitHubOrganizationRule(BaseModel): - github_organization: ExcludeAccessGitHubOrganizationRuleGitHubOrganization = FieldInfo(alias="github-organization") - - -class ExcludeAccessGsuiteGroupRuleGsuite(BaseModel): - connection_id: str - """The ID of your Google Workspace identity provider.""" - - email: str - """The email of the Google Workspace group.""" - - -class ExcludeAccessGsuiteGroupRule(BaseModel): - gsuite: ExcludeAccessGsuiteGroupRuleGsuite - - -class ExcludeAccessOktaGroupRuleOkta(BaseModel): - connection_id: str - """The ID of your Okta identity provider.""" - - email: str - """The email of the Okta group.""" - - -class ExcludeAccessOktaGroupRule(BaseModel): - okta: ExcludeAccessOktaGroupRuleOkta - - -class ExcludeAccessSamlGroupRuleSaml(BaseModel): - attribute_name: str - """The name of the SAML attribute.""" - - attribute_value: str - """The SAML attribute value to look for.""" - - -class ExcludeAccessSamlGroupRule(BaseModel): - saml: ExcludeAccessSamlGroupRuleSaml - - -class ExcludeAccessServiceTokenRuleServiceToken(BaseModel): - token_id: str - """The ID of a Service Token.""" - - -class ExcludeAccessServiceTokenRule(BaseModel): - service_token: ExcludeAccessServiceTokenRuleServiceToken - - -class ExcludeAccessAnyValidServiceTokenRule(BaseModel): - any_valid_service_token: object - """An empty object which matches on all service tokens.""" - - -class ExcludeAccessExternalEvaluationRuleExternalEvaluation(BaseModel): - evaluate_url: str - """The API endpoint containing your business logic.""" - - keys_url: str - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class ExcludeAccessExternalEvaluationRule(BaseModel): - external_evaluation: ExcludeAccessExternalEvaluationRuleExternalEvaluation - - -class ExcludeAccessCountryRuleGeo(BaseModel): - country_code: str - """The country code that should be matched.""" - - -class ExcludeAccessCountryRule(BaseModel): - geo: ExcludeAccessCountryRuleGeo - - -class ExcludeAccessAuthenticationMethodRuleAuthMethod(BaseModel): - auth_method: str - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class ExcludeAccessAuthenticationMethodRule(BaseModel): - auth_method: ExcludeAccessAuthenticationMethodRuleAuthMethod - - -class ExcludeAccessDevicePostureRuleDevicePosture(BaseModel): - integration_uid: str - """The ID of a device posture integration.""" - - -class ExcludeAccessDevicePostureRule(BaseModel): - device_posture: ExcludeAccessDevicePostureRuleDevicePosture - - -Exclude = Union[ - ExcludeAccessEmailRule, - ExcludeAccessEmailListRule, - ExcludeAccessDomainRule, - ExcludeAccessEveryoneRule, - ExcludeAccessIPRule, - ExcludeAccessIPListRule, - ExcludeAccessCertificateRule, - ExcludeAccessAccessGroupRule, - ExcludeAccessAzureGroupRule, - ExcludeAccessGitHubOrganizationRule, - ExcludeAccessGsuiteGroupRule, - ExcludeAccessOktaGroupRule, - ExcludeAccessSamlGroupRule, - ExcludeAccessServiceTokenRule, - ExcludeAccessAnyValidServiceTokenRule, - ExcludeAccessExternalEvaluationRule, - ExcludeAccessCountryRule, - ExcludeAccessAuthenticationMethodRule, - ExcludeAccessDevicePostureRule, -] - - -class IncludeAccessEmailRuleEmail(BaseModel): - email: str - """The email of the user.""" - - -class IncludeAccessEmailRule(BaseModel): - email: IncludeAccessEmailRuleEmail - - -class IncludeAccessEmailListRuleEmailList(BaseModel): - id: str - """The ID of a previously created email list.""" - - -class IncludeAccessEmailListRule(BaseModel): - email_list: IncludeAccessEmailListRuleEmailList - - -class IncludeAccessDomainRuleEmailDomain(BaseModel): - domain: str - """The email domain to match.""" - - -class IncludeAccessDomainRule(BaseModel): - email_domain: IncludeAccessDomainRuleEmailDomain - - -class IncludeAccessEveryoneRule(BaseModel): - everyone: object - """An empty object which matches on all users.""" - - -class IncludeAccessIPRuleIP(BaseModel): - ip: str - """An IPv4 or IPv6 CIDR block.""" - - -class IncludeAccessIPRule(BaseModel): - ip: IncludeAccessIPRuleIP - - -class IncludeAccessIPListRuleIPList(BaseModel): - id: str - """The ID of a previously created IP list.""" - - -class IncludeAccessIPListRule(BaseModel): - ip_list: IncludeAccessIPListRuleIPList - - -class IncludeAccessCertificateRule(BaseModel): - certificate: object - - -class IncludeAccessAccessGroupRuleGroup(BaseModel): - id: str - """The ID of a previously created Access group.""" - - -class IncludeAccessAccessGroupRule(BaseModel): - group: IncludeAccessAccessGroupRuleGroup - - -class IncludeAccessAzureGroupRuleAzureAd(BaseModel): - id: str - """The ID of an Azure group.""" - - connection_id: str - """The ID of your Azure identity provider.""" - - -class IncludeAccessAzureGroupRule(BaseModel): - azure_ad: IncludeAccessAzureGroupRuleAzureAd = FieldInfo(alias="azureAD") - - -class IncludeAccessGitHubOrganizationRuleGitHubOrganization(BaseModel): - connection_id: str - """The ID of your Github identity provider.""" - - name: str - """The name of the organization.""" - - -class IncludeAccessGitHubOrganizationRule(BaseModel): - github_organization: IncludeAccessGitHubOrganizationRuleGitHubOrganization = FieldInfo(alias="github-organization") - - -class IncludeAccessGsuiteGroupRuleGsuite(BaseModel): - connection_id: str - """The ID of your Google Workspace identity provider.""" - - email: str - """The email of the Google Workspace group.""" - - -class IncludeAccessGsuiteGroupRule(BaseModel): - gsuite: IncludeAccessGsuiteGroupRuleGsuite - - -class IncludeAccessOktaGroupRuleOkta(BaseModel): - connection_id: str - """The ID of your Okta identity provider.""" - - email: str - """The email of the Okta group.""" - - -class IncludeAccessOktaGroupRule(BaseModel): - okta: IncludeAccessOktaGroupRuleOkta - - -class IncludeAccessSamlGroupRuleSaml(BaseModel): - attribute_name: str - """The name of the SAML attribute.""" - - attribute_value: str - """The SAML attribute value to look for.""" - - -class IncludeAccessSamlGroupRule(BaseModel): - saml: IncludeAccessSamlGroupRuleSaml - - -class IncludeAccessServiceTokenRuleServiceToken(BaseModel): - token_id: str - """The ID of a Service Token.""" - - -class IncludeAccessServiceTokenRule(BaseModel): - service_token: IncludeAccessServiceTokenRuleServiceToken - - -class IncludeAccessAnyValidServiceTokenRule(BaseModel): - any_valid_service_token: object - """An empty object which matches on all service tokens.""" - - -class IncludeAccessExternalEvaluationRuleExternalEvaluation(BaseModel): - evaluate_url: str - """The API endpoint containing your business logic.""" - - keys_url: str - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class IncludeAccessExternalEvaluationRule(BaseModel): - external_evaluation: IncludeAccessExternalEvaluationRuleExternalEvaluation - - -class IncludeAccessCountryRuleGeo(BaseModel): - country_code: str - """The country code that should be matched.""" - - -class IncludeAccessCountryRule(BaseModel): - geo: IncludeAccessCountryRuleGeo - - -class IncludeAccessAuthenticationMethodRuleAuthMethod(BaseModel): - auth_method: str - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class IncludeAccessAuthenticationMethodRule(BaseModel): - auth_method: IncludeAccessAuthenticationMethodRuleAuthMethod - - -class IncludeAccessDevicePostureRuleDevicePosture(BaseModel): - integration_uid: str - """The ID of a device posture integration.""" - - -class IncludeAccessDevicePostureRule(BaseModel): - device_posture: IncludeAccessDevicePostureRuleDevicePosture - - -Include = Union[ - IncludeAccessEmailRule, - IncludeAccessEmailListRule, - IncludeAccessDomainRule, - IncludeAccessEveryoneRule, - IncludeAccessIPRule, - IncludeAccessIPListRule, - IncludeAccessCertificateRule, - IncludeAccessAccessGroupRule, - IncludeAccessAzureGroupRule, - IncludeAccessGitHubOrganizationRule, - IncludeAccessGsuiteGroupRule, - IncludeAccessOktaGroupRule, - IncludeAccessSamlGroupRule, - IncludeAccessServiceTokenRule, - IncludeAccessAnyValidServiceTokenRule, - IncludeAccessExternalEvaluationRule, - IncludeAccessCountryRule, - IncludeAccessAuthenticationMethodRule, - IncludeAccessDevicePostureRule, -] - - -class RequireAccessEmailRuleEmail(BaseModel): - email: str - """The email of the user.""" - - -class RequireAccessEmailRule(BaseModel): - email: RequireAccessEmailRuleEmail - - -class RequireAccessEmailListRuleEmailList(BaseModel): - id: str - """The ID of a previously created email list.""" - - -class RequireAccessEmailListRule(BaseModel): - email_list: RequireAccessEmailListRuleEmailList - - -class RequireAccessDomainRuleEmailDomain(BaseModel): - domain: str - """The email domain to match.""" - - -class RequireAccessDomainRule(BaseModel): - email_domain: RequireAccessDomainRuleEmailDomain - - -class RequireAccessEveryoneRule(BaseModel): - everyone: object - """An empty object which matches on all users.""" - - -class RequireAccessIPRuleIP(BaseModel): - ip: str - """An IPv4 or IPv6 CIDR block.""" - - -class RequireAccessIPRule(BaseModel): - ip: RequireAccessIPRuleIP - - -class RequireAccessIPListRuleIPList(BaseModel): - id: str - """The ID of a previously created IP list.""" - - -class RequireAccessIPListRule(BaseModel): - ip_list: RequireAccessIPListRuleIPList - - -class RequireAccessCertificateRule(BaseModel): - certificate: object - - -class RequireAccessAccessGroupRuleGroup(BaseModel): - id: str - """The ID of a previously created Access group.""" - - -class RequireAccessAccessGroupRule(BaseModel): - group: RequireAccessAccessGroupRuleGroup - - -class RequireAccessAzureGroupRuleAzureAd(BaseModel): - id: str - """The ID of an Azure group.""" - - connection_id: str - """The ID of your Azure identity provider.""" - - -class RequireAccessAzureGroupRule(BaseModel): - azure_ad: RequireAccessAzureGroupRuleAzureAd = FieldInfo(alias="azureAD") - - -class RequireAccessGitHubOrganizationRuleGitHubOrganization(BaseModel): - connection_id: str - """The ID of your Github identity provider.""" - - name: str - """The name of the organization.""" - - -class RequireAccessGitHubOrganizationRule(BaseModel): - github_organization: RequireAccessGitHubOrganizationRuleGitHubOrganization = FieldInfo(alias="github-organization") - - -class RequireAccessGsuiteGroupRuleGsuite(BaseModel): - connection_id: str - """The ID of your Google Workspace identity provider.""" - - email: str - """The email of the Google Workspace group.""" - - -class RequireAccessGsuiteGroupRule(BaseModel): - gsuite: RequireAccessGsuiteGroupRuleGsuite - - -class RequireAccessOktaGroupRuleOkta(BaseModel): - connection_id: str - """The ID of your Okta identity provider.""" - - email: str - """The email of the Okta group.""" - - -class RequireAccessOktaGroupRule(BaseModel): - okta: RequireAccessOktaGroupRuleOkta - - -class RequireAccessSamlGroupRuleSaml(BaseModel): - attribute_name: str - """The name of the SAML attribute.""" - - attribute_value: str - """The SAML attribute value to look for.""" - - -class RequireAccessSamlGroupRule(BaseModel): - saml: RequireAccessSamlGroupRuleSaml - - -class RequireAccessServiceTokenRuleServiceToken(BaseModel): - token_id: str - """The ID of a Service Token.""" - - -class RequireAccessServiceTokenRule(BaseModel): - service_token: RequireAccessServiceTokenRuleServiceToken - - -class RequireAccessAnyValidServiceTokenRule(BaseModel): - any_valid_service_token: object - """An empty object which matches on all service tokens.""" - - -class RequireAccessExternalEvaluationRuleExternalEvaluation(BaseModel): - evaluate_url: str - """The API endpoint containing your business logic.""" - - keys_url: str - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class RequireAccessExternalEvaluationRule(BaseModel): - external_evaluation: RequireAccessExternalEvaluationRuleExternalEvaluation - - -class RequireAccessCountryRuleGeo(BaseModel): - country_code: str - """The country code that should be matched.""" - - -class RequireAccessCountryRule(BaseModel): - geo: RequireAccessCountryRuleGeo - - -class RequireAccessAuthenticationMethodRuleAuthMethod(BaseModel): - auth_method: str - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class RequireAccessAuthenticationMethodRule(BaseModel): - auth_method: RequireAccessAuthenticationMethodRuleAuthMethod - - -class RequireAccessDevicePostureRuleDevicePosture(BaseModel): - integration_uid: str - """The ID of a device posture integration.""" - - -class RequireAccessDevicePostureRule(BaseModel): - device_posture: RequireAccessDevicePostureRuleDevicePosture - - -Require = Union[ - RequireAccessEmailRule, - RequireAccessEmailListRule, - RequireAccessDomainRule, - RequireAccessEveryoneRule, - RequireAccessIPRule, - RequireAccessIPListRule, - RequireAccessCertificateRule, - RequireAccessAccessGroupRule, - RequireAccessAzureGroupRule, - RequireAccessGitHubOrganizationRule, - RequireAccessGsuiteGroupRule, - RequireAccessOktaGroupRule, - RequireAccessSamlGroupRule, - RequireAccessServiceTokenRule, - RequireAccessAnyValidServiceTokenRule, - RequireAccessExternalEvaluationRule, - RequireAccessCountryRule, - RequireAccessAuthenticationMethodRule, - RequireAccessDevicePostureRule, -] - - -class ZeroTrustPolicies(BaseModel): - id: Optional[str] = None - """UUID""" - - approval_groups: Optional[List[ApprovalGroup]] = None - """Administrators who can approve a temporary authentication request.""" - - approval_required: Optional[bool] = None - """ - Requires the user to request access from an administrator at the start of each - session. - """ - - created_at: Optional[datetime] = None - - decision: Optional[Literal["allow", "deny", "non_identity", "bypass"]] = None - """The action Access will take if a user matches this policy.""" - - exclude: Optional[List[Exclude]] = None - """Rules evaluated with a NOT logical operator. - - To match the policy, a user cannot meet any of the Exclude rules. - """ - - include: Optional[List[Include]] = None - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - isolation_required: Optional[bool] = None - """ - Require this application to be served in an isolated browser for users matching - this policy. 'Client Web Isolation' must be on for the account in order to use - this feature. - """ - - name: Optional[str] = None - """The name of the Access policy.""" - - precedence: Optional[int] = None - """The order of execution for this policy. Must be unique for each policy.""" - - purpose_justification_prompt: Optional[str] = None - """A custom message that will appear on the purpose justification screen.""" - - purpose_justification_required: Optional[bool] = None - """Require users to enter a justification when they log in to the application.""" - - require: Optional[List[Require]] = None - """Rules evaluated with an AND logical operator. - - To match the policy, a user must meet all of the Require rules. - """ - - session_duration: Optional[str] = None - """The amount of time that tokens issued for the application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/associated_hostnames.py b/src/cloudflare/types/zero_trust/access/associated_hostnames.py new file mode 100644 index 00000000000..2a772cfdd0f --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/associated_hostnames.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["AssociatedHostnames"] + +AssociatedHostnames = str diff --git a/src/cloudflare/types/zero_trust/access/bookmark.py b/src/cloudflare/types/zero_trust/access/bookmark.py new file mode 100644 index 00000000000..5d20f8b964c --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/bookmark.py @@ -0,0 +1,29 @@ +# 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__ = ["Bookmark"] + + +class Bookmark(BaseModel): + id: Optional[str] = None + """The unique identifier for the Bookmark application.""" + + app_launcher_visible: Optional[bool] = None + """Displays the application in the App Launcher.""" + + created_at: Optional[datetime] = None + + domain: Optional[str] = None + """The domain of the Bookmark application.""" + + logo_url: Optional[str] = None + """The image URL for the logo shown in the App Launcher dashboard.""" + + name: Optional[str] = None + """The name of the Bookmark application.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/bookmark_create_params.py b/src/cloudflare/types/zero_trust/access/bookmark_create_params.py new file mode 100644 index 00000000000..4680f846d12 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/bookmark_create_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["BookmarkCreateParams"] + + +class BookmarkCreateParams(TypedDict, total=False): + identifier: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/access/bookmark_delete_params.py b/src/cloudflare/types/zero_trust/access/bookmark_delete_params.py new file mode 100644 index 00000000000..394d90aa66a --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/bookmark_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["BookmarkDeleteParams"] + + +class BookmarkDeleteParams(TypedDict, total=False): + identifier: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/access/bookmark_update_params.py b/src/cloudflare/types/zero_trust/access/bookmark_update_params.py new file mode 100644 index 00000000000..58286a723f3 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/bookmark_update_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["BookmarkUpdateParams"] + + +class BookmarkUpdateParams(TypedDict, total=False): + identifier: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/access/certificate.py b/src/cloudflare/types/zero_trust/access/certificate.py new file mode 100644 index 00000000000..6c05b85be1e --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/certificate.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel +from .associated_hostnames import AssociatedHostnames + +__all__ = ["Certificate"] + + +class Certificate(BaseModel): + id: Optional[str] = None + """The ID of the application that will use this certificate.""" + + associated_hostnames: Optional[List[AssociatedHostnames]] = None + """The hostnames of the applications that will use this certificate.""" + + created_at: Optional[datetime] = None + + expires_on: Optional[datetime] = None + + fingerprint: Optional[str] = None + """The MD5 fingerprint of the certificate.""" + + name: Optional[str] = None + """The name of the certificate.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/certificate_create_params.py b/src/cloudflare/types/zero_trust/access/certificate_create_params.py index 319d55c8b08..d98ff4df949 100644 --- a/src/cloudflare/types/zero_trust/access/certificate_create_params.py +++ b/src/cloudflare/types/zero_trust/access/certificate_create_params.py @@ -5,6 +5,8 @@ from typing import List from typing_extensions import Required, TypedDict +from .associated_hostnames import AssociatedHostnames + __all__ = ["CertificateCreateParams"] @@ -21,5 +23,5 @@ class CertificateCreateParams(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - associated_hostnames: List[str] + associated_hostnames: List[AssociatedHostnames] """The hostnames of the applications that will use this certificate.""" diff --git a/src/cloudflare/types/zero_trust/access/certificate_update_params.py b/src/cloudflare/types/zero_trust/access/certificate_update_params.py index f0a2c325e15..e546c333f21 100644 --- a/src/cloudflare/types/zero_trust/access/certificate_update_params.py +++ b/src/cloudflare/types/zero_trust/access/certificate_update_params.py @@ -5,11 +5,13 @@ from typing import List from typing_extensions import Required, TypedDict +from .associated_hostnames import AssociatedHostnames + __all__ = ["CertificateUpdateParams"] class CertificateUpdateParams(TypedDict, total=False): - associated_hostnames: Required[List[str]] + associated_hostnames: Required[List[AssociatedHostnames]] """The hostnames of the applications that will use this certificate.""" account_id: str diff --git a/src/cloudflare/types/zero_trust/access/certificates/__init__.py b/src/cloudflare/types/zero_trust/access/certificates/__init__.py index 24e86cca8a5..2a8e492f5d5 100644 --- a/src/cloudflare/types/zero_trust/access/certificates/__init__.py +++ b/src/cloudflare/types/zero_trust/access/certificates/__init__.py @@ -2,8 +2,8 @@ from __future__ import annotations -from .zero_trust_settings import ZeroTrustSettings as ZeroTrustSettings +from .certificate_settings import CertificateSettings as CertificateSettings from .setting_get_response import SettingGetResponse as SettingGetResponse from .setting_update_params import SettingUpdateParams as SettingUpdateParams from .setting_update_response import SettingUpdateResponse as SettingUpdateResponse -from .zero_trust_settings_param import ZeroTrustSettingsParam as ZeroTrustSettingsParam +from .certificate_settings_param import CertificateSettingsParam as CertificateSettingsParam diff --git a/src/cloudflare/types/zero_trust/access/certificates/certificate_settings.py b/src/cloudflare/types/zero_trust/access/certificates/certificate_settings.py new file mode 100644 index 00000000000..f2307e896f0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/certificates/certificate_settings.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ....._models import BaseModel + +__all__ = ["CertificateSettings"] + + +class CertificateSettings(BaseModel): + china_network: bool + """Request client certificates for this hostname in China. + + Can only be set to true if this zone is china network enabled. + """ + + client_certificate_forwarding: bool + """ + Client Certificate Forwarding is a feature that takes the client cert provided + by the eyeball to the edge, and forwards it to the origin as a HTTP header to + allow logging on the origin. + """ + + hostname: str + """The hostname that these settings apply to.""" diff --git a/src/cloudflare/types/zero_trust/access/certificates/certificate_settings_param.py b/src/cloudflare/types/zero_trust/access/certificates/certificate_settings_param.py new file mode 100644 index 00000000000..f80bcb0940e --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/certificates/certificate_settings_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CertificateSettingsParam"] + + +class CertificateSettingsParam(TypedDict, total=False): + china_network: Required[bool] + """Request client certificates for this hostname in China. + + Can only be set to true if this zone is china network enabled. + """ + + client_certificate_forwarding: Required[bool] + """ + Client Certificate Forwarding is a feature that takes the client cert provided + by the eyeball to the edge, and forwards it to the origin as a HTTP header to + allow logging on the origin. + """ + + hostname: Required[str] + """The hostname that these settings apply to.""" diff --git a/src/cloudflare/types/zero_trust/access/certificates/setting_get_response.py b/src/cloudflare/types/zero_trust/access/certificates/setting_get_response.py index ff1630df053..454c55986c2 100644 --- a/src/cloudflare/types/zero_trust/access/certificates/setting_get_response.py +++ b/src/cloudflare/types/zero_trust/access/certificates/setting_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .zero_trust_settings import ZeroTrustSettings +from .certificate_settings import CertificateSettings __all__ = ["SettingGetResponse"] -SettingGetResponse = List[ZeroTrustSettings] +SettingGetResponse = List[CertificateSettings] diff --git a/src/cloudflare/types/zero_trust/access/certificates/setting_update_params.py b/src/cloudflare/types/zero_trust/access/certificates/setting_update_params.py index 47e314677b8..80d05fa2e09 100644 --- a/src/cloudflare/types/zero_trust/access/certificates/setting_update_params.py +++ b/src/cloudflare/types/zero_trust/access/certificates/setting_update_params.py @@ -5,13 +5,13 @@ from typing import Iterable from typing_extensions import Required, TypedDict -from .zero_trust_settings_param import ZeroTrustSettingsParam +from .certificate_settings_param import CertificateSettingsParam __all__ = ["SettingUpdateParams"] class SettingUpdateParams(TypedDict, total=False): - settings: Required[Iterable[ZeroTrustSettingsParam]] + settings: Required[Iterable[CertificateSettingsParam]] account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" diff --git a/src/cloudflare/types/zero_trust/access/certificates/setting_update_response.py b/src/cloudflare/types/zero_trust/access/certificates/setting_update_response.py index c13e095df93..d3d17631972 100644 --- a/src/cloudflare/types/zero_trust/access/certificates/setting_update_response.py +++ b/src/cloudflare/types/zero_trust/access/certificates/setting_update_response.py @@ -2,8 +2,8 @@ from typing import List -from .zero_trust_settings import ZeroTrustSettings +from .certificate_settings import CertificateSettings __all__ = ["SettingUpdateResponse"] -SettingUpdateResponse = List[ZeroTrustSettings] +SettingUpdateResponse = List[CertificateSettings] diff --git a/src/cloudflare/types/zero_trust/access/certificates/zero_trust_settings.py b/src/cloudflare/types/zero_trust/access/certificates/zero_trust_settings.py deleted file mode 100644 index 76f7bf04f6a..00000000000 --- a/src/cloudflare/types/zero_trust/access/certificates/zero_trust_settings.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ....._models import BaseModel - -__all__ = ["ZeroTrustSettings"] - - -class ZeroTrustSettings(BaseModel): - china_network: bool - """Request client certificates for this hostname in China. - - Can only be set to true if this zone is china network enabled. - """ - - client_certificate_forwarding: bool - """ - Client Certificate Forwarding is a feature that takes the client cert provided - by the eyeball to the edge, and forwards it to the origin as a HTTP header to - allow logging on the origin. - """ - - hostname: str - """The hostname that these settings apply to.""" diff --git a/src/cloudflare/types/zero_trust/access/certificates/zero_trust_settings_param.py b/src/cloudflare/types/zero_trust/access/certificates/zero_trust_settings_param.py deleted file mode 100644 index c435a987681..00000000000 --- a/src/cloudflare/types/zero_trust/access/certificates/zero_trust_settings_param.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["ZeroTrustSettingsParam"] - - -class ZeroTrustSettingsParam(TypedDict, total=False): - china_network: Required[bool] - """Request client certificates for this hostname in China. - - Can only be set to true if this zone is china network enabled. - """ - - client_certificate_forwarding: Required[bool] - """ - Client Certificate Forwarding is a feature that takes the client cert provided - by the eyeball to the edge, and forwards it to the origin as a HTTP header to - allow logging on the origin. - """ - - hostname: Required[str] - """The hostname that these settings apply to.""" diff --git a/src/cloudflare/types/zero_trust/access/cors_headers.py b/src/cloudflare/types/zero_trust/access/cors_headers.py new file mode 100644 index 00000000000..dd0d1dee6d6 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/cors_headers.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel +from .allowed_headersh import AllowedHeadersh +from .allowed_methodsh import AllowedMethodsh +from .allowed_originsh import AllowedOriginsh + +__all__ = ["CORSHeaders"] + + +class CORSHeaders(BaseModel): + allow_all_headers: Optional[bool] = None + """Allows all HTTP request headers.""" + + allow_all_methods: Optional[bool] = None + """Allows all HTTP request methods.""" + + allow_all_origins: Optional[bool] = None + """Allows all origins.""" + + allow_credentials: Optional[bool] = None + """ + When set to `true`, includes credentials (cookies, authorization headers, or TLS + client certificates) with requests. + """ + + allowed_headers: Optional[List[AllowedHeadersh]] = None + """Allowed HTTP request headers.""" + + allowed_methods: Optional[List[AllowedMethodsh]] = None + """Allowed HTTP request methods.""" + + allowed_origins: Optional[List[AllowedOriginsh]] = None + """Allowed origins.""" + + max_age: Optional[float] = None + """The maximum number of seconds the results of a preflight request can be cached.""" diff --git a/src/cloudflare/types/zero_trust/access/cors_headers_param.py b/src/cloudflare/types/zero_trust/access/cors_headers_param.py new file mode 100644 index 00000000000..9a78d765436 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/cors_headers_param.py @@ -0,0 +1,41 @@ +# 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 TypedDict + +from .allowed_headersh import AllowedHeadersh +from .allowed_methodsh import AllowedMethodsh +from .allowed_originsh import AllowedOriginsh + +__all__ = ["CORSHeadersParam"] + + +class CORSHeadersParam(TypedDict, total=False): + allow_all_headers: bool + """Allows all HTTP request headers.""" + + allow_all_methods: bool + """Allows all HTTP request methods.""" + + allow_all_origins: bool + """Allows all origins.""" + + allow_credentials: bool + """ + When set to `true`, includes credentials (cookies, authorization headers, or TLS + client certificates) with requests. + """ + + allowed_headers: List[AllowedHeadersh] + """Allowed HTTP request headers.""" + + allowed_methods: List[AllowedMethodsh] + """Allowed HTTP request methods.""" + + allowed_origins: List[AllowedOriginsh] + """Allowed origins.""" + + max_age: float + """The maximum number of seconds the results of a preflight request can be cached.""" diff --git a/src/cloudflare/types/zero_trust/access/custom_page.py b/src/cloudflare/types/zero_trust/access/custom_page.py new file mode 100644 index 00000000000..4593071d37a --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/custom_page.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["CustomPage"] + + +class CustomPage(BaseModel): + custom_html: str + """Custom page HTML.""" + + name: str + """Custom page name.""" + + type: Literal["identity_denied", "forbidden"] + """Custom page type.""" + + app_count: Optional[int] = None + """Number of apps the custom page is assigned to.""" + + created_at: Optional[datetime] = None + + uid: Optional[str] = None + """UUID""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/custom_page_without_html.py b/src/cloudflare/types/zero_trust/access/custom_page_without_html.py new file mode 100644 index 00000000000..d0aecfa61f5 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/custom_page_without_html.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["CustomPageWithoutHTML"] + + +class CustomPageWithoutHTML(BaseModel): + name: str + """Custom page name.""" + + type: Literal["identity_denied", "forbidden"] + """Custom page type.""" + + app_count: Optional[int] = None + """Number of apps the custom page is assigned to.""" + + created_at: Optional[datetime] = None + + uid: Optional[str] = None + """UUID""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/custom_pagesh.py b/src/cloudflare/types/zero_trust/access/custom_pagesh.py new file mode 100644 index 00000000000..c85ccdf5283 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/custom_pagesh.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["CustomPagesh"] + +CustomPagesh = str diff --git a/src/cloudflare/types/zero_trust/access/group_create_params.py b/src/cloudflare/types/zero_trust/access/group_create_params.py index c7866aad82e..04c7006d842 100644 --- a/src/cloudflare/types/zero_trust/access/group_create_params.py +++ b/src/cloudflare/types/zero_trust/access/group_create_params.py @@ -2,126 +2,16 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Required, Annotated, TypedDict +from typing import Iterable +from typing_extensions import Required, TypedDict -from ...._utils import PropertyInfo +from ..access_rule_param import AccessRuleParam -__all__ = [ - "GroupCreateParams", - "Include", - "IncludeAccessEmailRule", - "IncludeAccessEmailRuleEmail", - "IncludeAccessEmailListRule", - "IncludeAccessEmailListRuleEmailList", - "IncludeAccessDomainRule", - "IncludeAccessDomainRuleEmailDomain", - "IncludeAccessEveryoneRule", - "IncludeAccessIPRule", - "IncludeAccessIPRuleIP", - "IncludeAccessIPListRule", - "IncludeAccessIPListRuleIPList", - "IncludeAccessCertificateRule", - "IncludeAccessAccessGroupRule", - "IncludeAccessAccessGroupRuleGroup", - "IncludeAccessAzureGroupRule", - "IncludeAccessAzureGroupRuleAzureAd", - "IncludeAccessGitHubOrganizationRule", - "IncludeAccessGitHubOrganizationRuleGitHubOrganization", - "IncludeAccessGsuiteGroupRule", - "IncludeAccessGsuiteGroupRuleGsuite", - "IncludeAccessOktaGroupRule", - "IncludeAccessOktaGroupRuleOkta", - "IncludeAccessSamlGroupRule", - "IncludeAccessSamlGroupRuleSaml", - "IncludeAccessServiceTokenRule", - "IncludeAccessServiceTokenRuleServiceToken", - "IncludeAccessAnyValidServiceTokenRule", - "IncludeAccessExternalEvaluationRule", - "IncludeAccessExternalEvaluationRuleExternalEvaluation", - "IncludeAccessCountryRule", - "IncludeAccessCountryRuleGeo", - "IncludeAccessAuthenticationMethodRule", - "IncludeAccessAuthenticationMethodRuleAuthMethod", - "IncludeAccessDevicePostureRule", - "IncludeAccessDevicePostureRuleDevicePosture", - "Exclude", - "ExcludeAccessEmailRule", - "ExcludeAccessEmailRuleEmail", - "ExcludeAccessEmailListRule", - "ExcludeAccessEmailListRuleEmailList", - "ExcludeAccessDomainRule", - "ExcludeAccessDomainRuleEmailDomain", - "ExcludeAccessEveryoneRule", - "ExcludeAccessIPRule", - "ExcludeAccessIPRuleIP", - "ExcludeAccessIPListRule", - "ExcludeAccessIPListRuleIPList", - "ExcludeAccessCertificateRule", - "ExcludeAccessAccessGroupRule", - "ExcludeAccessAccessGroupRuleGroup", - "ExcludeAccessAzureGroupRule", - "ExcludeAccessAzureGroupRuleAzureAd", - "ExcludeAccessGitHubOrganizationRule", - "ExcludeAccessGitHubOrganizationRuleGitHubOrganization", - "ExcludeAccessGsuiteGroupRule", - "ExcludeAccessGsuiteGroupRuleGsuite", - "ExcludeAccessOktaGroupRule", - "ExcludeAccessOktaGroupRuleOkta", - "ExcludeAccessSamlGroupRule", - "ExcludeAccessSamlGroupRuleSaml", - "ExcludeAccessServiceTokenRule", - "ExcludeAccessServiceTokenRuleServiceToken", - "ExcludeAccessAnyValidServiceTokenRule", - "ExcludeAccessExternalEvaluationRule", - "ExcludeAccessExternalEvaluationRuleExternalEvaluation", - "ExcludeAccessCountryRule", - "ExcludeAccessCountryRuleGeo", - "ExcludeAccessAuthenticationMethodRule", - "ExcludeAccessAuthenticationMethodRuleAuthMethod", - "ExcludeAccessDevicePostureRule", - "ExcludeAccessDevicePostureRuleDevicePosture", - "Require", - "RequireAccessEmailRule", - "RequireAccessEmailRuleEmail", - "RequireAccessEmailListRule", - "RequireAccessEmailListRuleEmailList", - "RequireAccessDomainRule", - "RequireAccessDomainRuleEmailDomain", - "RequireAccessEveryoneRule", - "RequireAccessIPRule", - "RequireAccessIPRuleIP", - "RequireAccessIPListRule", - "RequireAccessIPListRuleIPList", - "RequireAccessCertificateRule", - "RequireAccessAccessGroupRule", - "RequireAccessAccessGroupRuleGroup", - "RequireAccessAzureGroupRule", - "RequireAccessAzureGroupRuleAzureAd", - "RequireAccessGitHubOrganizationRule", - "RequireAccessGitHubOrganizationRuleGitHubOrganization", - "RequireAccessGsuiteGroupRule", - "RequireAccessGsuiteGroupRuleGsuite", - "RequireAccessOktaGroupRule", - "RequireAccessOktaGroupRuleOkta", - "RequireAccessSamlGroupRule", - "RequireAccessSamlGroupRuleSaml", - "RequireAccessServiceTokenRule", - "RequireAccessServiceTokenRuleServiceToken", - "RequireAccessAnyValidServiceTokenRule", - "RequireAccessExternalEvaluationRule", - "RequireAccessExternalEvaluationRuleExternalEvaluation", - "RequireAccessCountryRule", - "RequireAccessCountryRuleGeo", - "RequireAccessAuthenticationMethodRule", - "RequireAccessAuthenticationMethodRuleAuthMethod", - "RequireAccessDevicePostureRule", - "RequireAccessDevicePostureRuleDevicePosture", -] +__all__ = ["GroupCreateParams"] class GroupCreateParams(TypedDict, total=False): - include: Required[Iterable[Include]] + include: Required[Iterable[AccessRuleParam]] """Rules evaluated with an OR logical operator. A user needs to meet only one of the Include rules. @@ -136,7 +26,7 @@ class GroupCreateParams(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - exclude: Iterable[Exclude] + exclude: Iterable[AccessRuleParam] """Rules evaluated with a NOT logical operator. To match a policy, a user cannot meet any of the Exclude rules. @@ -145,626 +35,8 @@ class GroupCreateParams(TypedDict, total=False): is_default: bool """Whether this is the default group""" - require: Iterable[Require] + require: Iterable[AccessRuleParam] """Rules evaluated with an AND logical operator. To match a policy, a user must meet all of the Require rules. """ - - -class IncludeAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class IncludeAccessEmailRule(TypedDict, total=False): - email: Required[IncludeAccessEmailRuleEmail] - - -class IncludeAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class IncludeAccessEmailListRule(TypedDict, total=False): - email_list: Required[IncludeAccessEmailListRuleEmailList] - - -class IncludeAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class IncludeAccessDomainRule(TypedDict, total=False): - email_domain: Required[IncludeAccessDomainRuleEmailDomain] - - -class IncludeAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class IncludeAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class IncludeAccessIPRule(TypedDict, total=False): - ip: Required[IncludeAccessIPRuleIP] - - -class IncludeAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class IncludeAccessIPListRule(TypedDict, total=False): - ip_list: Required[IncludeAccessIPListRuleIPList] - - -class IncludeAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class IncludeAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class IncludeAccessAccessGroupRule(TypedDict, total=False): - group: Required[IncludeAccessAccessGroupRuleGroup] - - -class IncludeAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class IncludeAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[IncludeAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class IncludeAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class IncludeAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[IncludeAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class IncludeAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class IncludeAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[IncludeAccessGsuiteGroupRuleGsuite] - - -class IncludeAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class IncludeAccessOktaGroupRule(TypedDict, total=False): - okta: Required[IncludeAccessOktaGroupRuleOkta] - - -class IncludeAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class IncludeAccessSamlGroupRule(TypedDict, total=False): - saml: Required[IncludeAccessSamlGroupRuleSaml] - - -class IncludeAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class IncludeAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[IncludeAccessServiceTokenRuleServiceToken] - - -class IncludeAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class IncludeAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class IncludeAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[IncludeAccessExternalEvaluationRuleExternalEvaluation] - - -class IncludeAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class IncludeAccessCountryRule(TypedDict, total=False): - geo: Required[IncludeAccessCountryRuleGeo] - - -class IncludeAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class IncludeAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[IncludeAccessAuthenticationMethodRuleAuthMethod] - - -class IncludeAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class IncludeAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[IncludeAccessDevicePostureRuleDevicePosture] - - -Include = Union[ - IncludeAccessEmailRule, - IncludeAccessEmailListRule, - IncludeAccessDomainRule, - IncludeAccessEveryoneRule, - IncludeAccessIPRule, - IncludeAccessIPListRule, - IncludeAccessCertificateRule, - IncludeAccessAccessGroupRule, - IncludeAccessAzureGroupRule, - IncludeAccessGitHubOrganizationRule, - IncludeAccessGsuiteGroupRule, - IncludeAccessOktaGroupRule, - IncludeAccessSamlGroupRule, - IncludeAccessServiceTokenRule, - IncludeAccessAnyValidServiceTokenRule, - IncludeAccessExternalEvaluationRule, - IncludeAccessCountryRule, - IncludeAccessAuthenticationMethodRule, - IncludeAccessDevicePostureRule, -] - - -class ExcludeAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class ExcludeAccessEmailRule(TypedDict, total=False): - email: Required[ExcludeAccessEmailRuleEmail] - - -class ExcludeAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class ExcludeAccessEmailListRule(TypedDict, total=False): - email_list: Required[ExcludeAccessEmailListRuleEmailList] - - -class ExcludeAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class ExcludeAccessDomainRule(TypedDict, total=False): - email_domain: Required[ExcludeAccessDomainRuleEmailDomain] - - -class ExcludeAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class ExcludeAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class ExcludeAccessIPRule(TypedDict, total=False): - ip: Required[ExcludeAccessIPRuleIP] - - -class ExcludeAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class ExcludeAccessIPListRule(TypedDict, total=False): - ip_list: Required[ExcludeAccessIPListRuleIPList] - - -class ExcludeAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class ExcludeAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class ExcludeAccessAccessGroupRule(TypedDict, total=False): - group: Required[ExcludeAccessAccessGroupRuleGroup] - - -class ExcludeAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class ExcludeAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[ExcludeAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class ExcludeAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class ExcludeAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[ExcludeAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class ExcludeAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class ExcludeAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[ExcludeAccessGsuiteGroupRuleGsuite] - - -class ExcludeAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class ExcludeAccessOktaGroupRule(TypedDict, total=False): - okta: Required[ExcludeAccessOktaGroupRuleOkta] - - -class ExcludeAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class ExcludeAccessSamlGroupRule(TypedDict, total=False): - saml: Required[ExcludeAccessSamlGroupRuleSaml] - - -class ExcludeAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class ExcludeAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[ExcludeAccessServiceTokenRuleServiceToken] - - -class ExcludeAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class ExcludeAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class ExcludeAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[ExcludeAccessExternalEvaluationRuleExternalEvaluation] - - -class ExcludeAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class ExcludeAccessCountryRule(TypedDict, total=False): - geo: Required[ExcludeAccessCountryRuleGeo] - - -class ExcludeAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class ExcludeAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[ExcludeAccessAuthenticationMethodRuleAuthMethod] - - -class ExcludeAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class ExcludeAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[ExcludeAccessDevicePostureRuleDevicePosture] - - -Exclude = Union[ - ExcludeAccessEmailRule, - ExcludeAccessEmailListRule, - ExcludeAccessDomainRule, - ExcludeAccessEveryoneRule, - ExcludeAccessIPRule, - ExcludeAccessIPListRule, - ExcludeAccessCertificateRule, - ExcludeAccessAccessGroupRule, - ExcludeAccessAzureGroupRule, - ExcludeAccessGitHubOrganizationRule, - ExcludeAccessGsuiteGroupRule, - ExcludeAccessOktaGroupRule, - ExcludeAccessSamlGroupRule, - ExcludeAccessServiceTokenRule, - ExcludeAccessAnyValidServiceTokenRule, - ExcludeAccessExternalEvaluationRule, - ExcludeAccessCountryRule, - ExcludeAccessAuthenticationMethodRule, - ExcludeAccessDevicePostureRule, -] - - -class RequireAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class RequireAccessEmailRule(TypedDict, total=False): - email: Required[RequireAccessEmailRuleEmail] - - -class RequireAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class RequireAccessEmailListRule(TypedDict, total=False): - email_list: Required[RequireAccessEmailListRuleEmailList] - - -class RequireAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class RequireAccessDomainRule(TypedDict, total=False): - email_domain: Required[RequireAccessDomainRuleEmailDomain] - - -class RequireAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class RequireAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class RequireAccessIPRule(TypedDict, total=False): - ip: Required[RequireAccessIPRuleIP] - - -class RequireAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class RequireAccessIPListRule(TypedDict, total=False): - ip_list: Required[RequireAccessIPListRuleIPList] - - -class RequireAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class RequireAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class RequireAccessAccessGroupRule(TypedDict, total=False): - group: Required[RequireAccessAccessGroupRuleGroup] - - -class RequireAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class RequireAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[RequireAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class RequireAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class RequireAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[RequireAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class RequireAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class RequireAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[RequireAccessGsuiteGroupRuleGsuite] - - -class RequireAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class RequireAccessOktaGroupRule(TypedDict, total=False): - okta: Required[RequireAccessOktaGroupRuleOkta] - - -class RequireAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class RequireAccessSamlGroupRule(TypedDict, total=False): - saml: Required[RequireAccessSamlGroupRuleSaml] - - -class RequireAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class RequireAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[RequireAccessServiceTokenRuleServiceToken] - - -class RequireAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class RequireAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class RequireAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[RequireAccessExternalEvaluationRuleExternalEvaluation] - - -class RequireAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class RequireAccessCountryRule(TypedDict, total=False): - geo: Required[RequireAccessCountryRuleGeo] - - -class RequireAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class RequireAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[RequireAccessAuthenticationMethodRuleAuthMethod] - - -class RequireAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class RequireAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[RequireAccessDevicePostureRuleDevicePosture] - - -Require = Union[ - RequireAccessEmailRule, - RequireAccessEmailListRule, - RequireAccessDomainRule, - RequireAccessEveryoneRule, - RequireAccessIPRule, - RequireAccessIPListRule, - RequireAccessCertificateRule, - RequireAccessAccessGroupRule, - RequireAccessAzureGroupRule, - RequireAccessGitHubOrganizationRule, - RequireAccessGsuiteGroupRule, - RequireAccessOktaGroupRule, - RequireAccessSamlGroupRule, - RequireAccessServiceTokenRule, - RequireAccessAnyValidServiceTokenRule, - RequireAccessExternalEvaluationRule, - RequireAccessCountryRule, - RequireAccessAuthenticationMethodRule, - RequireAccessDevicePostureRule, -] diff --git a/src/cloudflare/types/zero_trust/access/group_update_params.py b/src/cloudflare/types/zero_trust/access/group_update_params.py index 15684eaf347..68672edb40e 100644 --- a/src/cloudflare/types/zero_trust/access/group_update_params.py +++ b/src/cloudflare/types/zero_trust/access/group_update_params.py @@ -2,126 +2,16 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Required, Annotated, TypedDict +from typing import Iterable +from typing_extensions import Required, TypedDict -from ...._utils import PropertyInfo +from ..access_rule_param import AccessRuleParam -__all__ = [ - "GroupUpdateParams", - "Include", - "IncludeAccessEmailRule", - "IncludeAccessEmailRuleEmail", - "IncludeAccessEmailListRule", - "IncludeAccessEmailListRuleEmailList", - "IncludeAccessDomainRule", - "IncludeAccessDomainRuleEmailDomain", - "IncludeAccessEveryoneRule", - "IncludeAccessIPRule", - "IncludeAccessIPRuleIP", - "IncludeAccessIPListRule", - "IncludeAccessIPListRuleIPList", - "IncludeAccessCertificateRule", - "IncludeAccessAccessGroupRule", - "IncludeAccessAccessGroupRuleGroup", - "IncludeAccessAzureGroupRule", - "IncludeAccessAzureGroupRuleAzureAd", - "IncludeAccessGitHubOrganizationRule", - "IncludeAccessGitHubOrganizationRuleGitHubOrganization", - "IncludeAccessGsuiteGroupRule", - "IncludeAccessGsuiteGroupRuleGsuite", - "IncludeAccessOktaGroupRule", - "IncludeAccessOktaGroupRuleOkta", - "IncludeAccessSamlGroupRule", - "IncludeAccessSamlGroupRuleSaml", - "IncludeAccessServiceTokenRule", - "IncludeAccessServiceTokenRuleServiceToken", - "IncludeAccessAnyValidServiceTokenRule", - "IncludeAccessExternalEvaluationRule", - "IncludeAccessExternalEvaluationRuleExternalEvaluation", - "IncludeAccessCountryRule", - "IncludeAccessCountryRuleGeo", - "IncludeAccessAuthenticationMethodRule", - "IncludeAccessAuthenticationMethodRuleAuthMethod", - "IncludeAccessDevicePostureRule", - "IncludeAccessDevicePostureRuleDevicePosture", - "Exclude", - "ExcludeAccessEmailRule", - "ExcludeAccessEmailRuleEmail", - "ExcludeAccessEmailListRule", - "ExcludeAccessEmailListRuleEmailList", - "ExcludeAccessDomainRule", - "ExcludeAccessDomainRuleEmailDomain", - "ExcludeAccessEveryoneRule", - "ExcludeAccessIPRule", - "ExcludeAccessIPRuleIP", - "ExcludeAccessIPListRule", - "ExcludeAccessIPListRuleIPList", - "ExcludeAccessCertificateRule", - "ExcludeAccessAccessGroupRule", - "ExcludeAccessAccessGroupRuleGroup", - "ExcludeAccessAzureGroupRule", - "ExcludeAccessAzureGroupRuleAzureAd", - "ExcludeAccessGitHubOrganizationRule", - "ExcludeAccessGitHubOrganizationRuleGitHubOrganization", - "ExcludeAccessGsuiteGroupRule", - "ExcludeAccessGsuiteGroupRuleGsuite", - "ExcludeAccessOktaGroupRule", - "ExcludeAccessOktaGroupRuleOkta", - "ExcludeAccessSamlGroupRule", - "ExcludeAccessSamlGroupRuleSaml", - "ExcludeAccessServiceTokenRule", - "ExcludeAccessServiceTokenRuleServiceToken", - "ExcludeAccessAnyValidServiceTokenRule", - "ExcludeAccessExternalEvaluationRule", - "ExcludeAccessExternalEvaluationRuleExternalEvaluation", - "ExcludeAccessCountryRule", - "ExcludeAccessCountryRuleGeo", - "ExcludeAccessAuthenticationMethodRule", - "ExcludeAccessAuthenticationMethodRuleAuthMethod", - "ExcludeAccessDevicePostureRule", - "ExcludeAccessDevicePostureRuleDevicePosture", - "Require", - "RequireAccessEmailRule", - "RequireAccessEmailRuleEmail", - "RequireAccessEmailListRule", - "RequireAccessEmailListRuleEmailList", - "RequireAccessDomainRule", - "RequireAccessDomainRuleEmailDomain", - "RequireAccessEveryoneRule", - "RequireAccessIPRule", - "RequireAccessIPRuleIP", - "RequireAccessIPListRule", - "RequireAccessIPListRuleIPList", - "RequireAccessCertificateRule", - "RequireAccessAccessGroupRule", - "RequireAccessAccessGroupRuleGroup", - "RequireAccessAzureGroupRule", - "RequireAccessAzureGroupRuleAzureAd", - "RequireAccessGitHubOrganizationRule", - "RequireAccessGitHubOrganizationRuleGitHubOrganization", - "RequireAccessGsuiteGroupRule", - "RequireAccessGsuiteGroupRuleGsuite", - "RequireAccessOktaGroupRule", - "RequireAccessOktaGroupRuleOkta", - "RequireAccessSamlGroupRule", - "RequireAccessSamlGroupRuleSaml", - "RequireAccessServiceTokenRule", - "RequireAccessServiceTokenRuleServiceToken", - "RequireAccessAnyValidServiceTokenRule", - "RequireAccessExternalEvaluationRule", - "RequireAccessExternalEvaluationRuleExternalEvaluation", - "RequireAccessCountryRule", - "RequireAccessCountryRuleGeo", - "RequireAccessAuthenticationMethodRule", - "RequireAccessAuthenticationMethodRuleAuthMethod", - "RequireAccessDevicePostureRule", - "RequireAccessDevicePostureRuleDevicePosture", -] +__all__ = ["GroupUpdateParams"] class GroupUpdateParams(TypedDict, total=False): - include: Required[Iterable[Include]] + include: Required[Iterable[AccessRuleParam]] """Rules evaluated with an OR logical operator. A user needs to meet only one of the Include rules. @@ -136,7 +26,7 @@ class GroupUpdateParams(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - exclude: Iterable[Exclude] + exclude: Iterable[AccessRuleParam] """Rules evaluated with a NOT logical operator. To match a policy, a user cannot meet any of the Exclude rules. @@ -145,626 +35,8 @@ class GroupUpdateParams(TypedDict, total=False): is_default: bool """Whether this is the default group""" - require: Iterable[Require] + require: Iterable[AccessRuleParam] """Rules evaluated with an AND logical operator. To match a policy, a user must meet all of the Require rules. """ - - -class IncludeAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class IncludeAccessEmailRule(TypedDict, total=False): - email: Required[IncludeAccessEmailRuleEmail] - - -class IncludeAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class IncludeAccessEmailListRule(TypedDict, total=False): - email_list: Required[IncludeAccessEmailListRuleEmailList] - - -class IncludeAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class IncludeAccessDomainRule(TypedDict, total=False): - email_domain: Required[IncludeAccessDomainRuleEmailDomain] - - -class IncludeAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class IncludeAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class IncludeAccessIPRule(TypedDict, total=False): - ip: Required[IncludeAccessIPRuleIP] - - -class IncludeAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class IncludeAccessIPListRule(TypedDict, total=False): - ip_list: Required[IncludeAccessIPListRuleIPList] - - -class IncludeAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class IncludeAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class IncludeAccessAccessGroupRule(TypedDict, total=False): - group: Required[IncludeAccessAccessGroupRuleGroup] - - -class IncludeAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class IncludeAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[IncludeAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class IncludeAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class IncludeAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[IncludeAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class IncludeAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class IncludeAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[IncludeAccessGsuiteGroupRuleGsuite] - - -class IncludeAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class IncludeAccessOktaGroupRule(TypedDict, total=False): - okta: Required[IncludeAccessOktaGroupRuleOkta] - - -class IncludeAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class IncludeAccessSamlGroupRule(TypedDict, total=False): - saml: Required[IncludeAccessSamlGroupRuleSaml] - - -class IncludeAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class IncludeAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[IncludeAccessServiceTokenRuleServiceToken] - - -class IncludeAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class IncludeAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class IncludeAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[IncludeAccessExternalEvaluationRuleExternalEvaluation] - - -class IncludeAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class IncludeAccessCountryRule(TypedDict, total=False): - geo: Required[IncludeAccessCountryRuleGeo] - - -class IncludeAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class IncludeAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[IncludeAccessAuthenticationMethodRuleAuthMethod] - - -class IncludeAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class IncludeAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[IncludeAccessDevicePostureRuleDevicePosture] - - -Include = Union[ - IncludeAccessEmailRule, - IncludeAccessEmailListRule, - IncludeAccessDomainRule, - IncludeAccessEveryoneRule, - IncludeAccessIPRule, - IncludeAccessIPListRule, - IncludeAccessCertificateRule, - IncludeAccessAccessGroupRule, - IncludeAccessAzureGroupRule, - IncludeAccessGitHubOrganizationRule, - IncludeAccessGsuiteGroupRule, - IncludeAccessOktaGroupRule, - IncludeAccessSamlGroupRule, - IncludeAccessServiceTokenRule, - IncludeAccessAnyValidServiceTokenRule, - IncludeAccessExternalEvaluationRule, - IncludeAccessCountryRule, - IncludeAccessAuthenticationMethodRule, - IncludeAccessDevicePostureRule, -] - - -class ExcludeAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class ExcludeAccessEmailRule(TypedDict, total=False): - email: Required[ExcludeAccessEmailRuleEmail] - - -class ExcludeAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class ExcludeAccessEmailListRule(TypedDict, total=False): - email_list: Required[ExcludeAccessEmailListRuleEmailList] - - -class ExcludeAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class ExcludeAccessDomainRule(TypedDict, total=False): - email_domain: Required[ExcludeAccessDomainRuleEmailDomain] - - -class ExcludeAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class ExcludeAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class ExcludeAccessIPRule(TypedDict, total=False): - ip: Required[ExcludeAccessIPRuleIP] - - -class ExcludeAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class ExcludeAccessIPListRule(TypedDict, total=False): - ip_list: Required[ExcludeAccessIPListRuleIPList] - - -class ExcludeAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class ExcludeAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class ExcludeAccessAccessGroupRule(TypedDict, total=False): - group: Required[ExcludeAccessAccessGroupRuleGroup] - - -class ExcludeAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class ExcludeAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[ExcludeAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class ExcludeAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class ExcludeAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[ExcludeAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class ExcludeAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class ExcludeAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[ExcludeAccessGsuiteGroupRuleGsuite] - - -class ExcludeAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class ExcludeAccessOktaGroupRule(TypedDict, total=False): - okta: Required[ExcludeAccessOktaGroupRuleOkta] - - -class ExcludeAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class ExcludeAccessSamlGroupRule(TypedDict, total=False): - saml: Required[ExcludeAccessSamlGroupRuleSaml] - - -class ExcludeAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class ExcludeAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[ExcludeAccessServiceTokenRuleServiceToken] - - -class ExcludeAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class ExcludeAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class ExcludeAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[ExcludeAccessExternalEvaluationRuleExternalEvaluation] - - -class ExcludeAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class ExcludeAccessCountryRule(TypedDict, total=False): - geo: Required[ExcludeAccessCountryRuleGeo] - - -class ExcludeAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class ExcludeAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[ExcludeAccessAuthenticationMethodRuleAuthMethod] - - -class ExcludeAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class ExcludeAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[ExcludeAccessDevicePostureRuleDevicePosture] - - -Exclude = Union[ - ExcludeAccessEmailRule, - ExcludeAccessEmailListRule, - ExcludeAccessDomainRule, - ExcludeAccessEveryoneRule, - ExcludeAccessIPRule, - ExcludeAccessIPListRule, - ExcludeAccessCertificateRule, - ExcludeAccessAccessGroupRule, - ExcludeAccessAzureGroupRule, - ExcludeAccessGitHubOrganizationRule, - ExcludeAccessGsuiteGroupRule, - ExcludeAccessOktaGroupRule, - ExcludeAccessSamlGroupRule, - ExcludeAccessServiceTokenRule, - ExcludeAccessAnyValidServiceTokenRule, - ExcludeAccessExternalEvaluationRule, - ExcludeAccessCountryRule, - ExcludeAccessAuthenticationMethodRule, - ExcludeAccessDevicePostureRule, -] - - -class RequireAccessEmailRuleEmail(TypedDict, total=False): - email: Required[str] - """The email of the user.""" - - -class RequireAccessEmailRule(TypedDict, total=False): - email: Required[RequireAccessEmailRuleEmail] - - -class RequireAccessEmailListRuleEmailList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created email list.""" - - -class RequireAccessEmailListRule(TypedDict, total=False): - email_list: Required[RequireAccessEmailListRuleEmailList] - - -class RequireAccessDomainRuleEmailDomain(TypedDict, total=False): - domain: Required[str] - """The email domain to match.""" - - -class RequireAccessDomainRule(TypedDict, total=False): - email_domain: Required[RequireAccessDomainRuleEmailDomain] - - -class RequireAccessEveryoneRule(TypedDict, total=False): - everyone: Required[object] - """An empty object which matches on all users.""" - - -class RequireAccessIPRuleIP(TypedDict, total=False): - ip: Required[str] - """An IPv4 or IPv6 CIDR block.""" - - -class RequireAccessIPRule(TypedDict, total=False): - ip: Required[RequireAccessIPRuleIP] - - -class RequireAccessIPListRuleIPList(TypedDict, total=False): - id: Required[str] - """The ID of a previously created IP list.""" - - -class RequireAccessIPListRule(TypedDict, total=False): - ip_list: Required[RequireAccessIPListRuleIPList] - - -class RequireAccessCertificateRule(TypedDict, total=False): - certificate: Required[object] - - -class RequireAccessAccessGroupRuleGroup(TypedDict, total=False): - id: Required[str] - """The ID of a previously created Access group.""" - - -class RequireAccessAccessGroupRule(TypedDict, total=False): - group: Required[RequireAccessAccessGroupRuleGroup] - - -class RequireAccessAzureGroupRuleAzureAd(TypedDict, total=False): - id: Required[str] - """The ID of an Azure group.""" - - connection_id: Required[str] - """The ID of your Azure identity provider.""" - - -class RequireAccessAzureGroupRule(TypedDict, total=False): - azure_ad: Required[Annotated[RequireAccessAzureGroupRuleAzureAd, PropertyInfo(alias="azureAD")]] - - -class RequireAccessGitHubOrganizationRuleGitHubOrganization(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Github identity provider.""" - - name: Required[str] - """The name of the organization.""" - - -class RequireAccessGitHubOrganizationRule(TypedDict, total=False): - github_organization: Required[ - Annotated[RequireAccessGitHubOrganizationRuleGitHubOrganization, PropertyInfo(alias="github-organization")] - ] - - -class RequireAccessGsuiteGroupRuleGsuite(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Google Workspace identity provider.""" - - email: Required[str] - """The email of the Google Workspace group.""" - - -class RequireAccessGsuiteGroupRule(TypedDict, total=False): - gsuite: Required[RequireAccessGsuiteGroupRuleGsuite] - - -class RequireAccessOktaGroupRuleOkta(TypedDict, total=False): - connection_id: Required[str] - """The ID of your Okta identity provider.""" - - email: Required[str] - """The email of the Okta group.""" - - -class RequireAccessOktaGroupRule(TypedDict, total=False): - okta: Required[RequireAccessOktaGroupRuleOkta] - - -class RequireAccessSamlGroupRuleSaml(TypedDict, total=False): - attribute_name: Required[str] - """The name of the SAML attribute.""" - - attribute_value: Required[str] - """The SAML attribute value to look for.""" - - -class RequireAccessSamlGroupRule(TypedDict, total=False): - saml: Required[RequireAccessSamlGroupRuleSaml] - - -class RequireAccessServiceTokenRuleServiceToken(TypedDict, total=False): - token_id: Required[str] - """The ID of a Service Token.""" - - -class RequireAccessServiceTokenRule(TypedDict, total=False): - service_token: Required[RequireAccessServiceTokenRuleServiceToken] - - -class RequireAccessAnyValidServiceTokenRule(TypedDict, total=False): - any_valid_service_token: Required[object] - """An empty object which matches on all service tokens.""" - - -class RequireAccessExternalEvaluationRuleExternalEvaluation(TypedDict, total=False): - evaluate_url: Required[str] - """The API endpoint containing your business logic.""" - - keys_url: Required[str] - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class RequireAccessExternalEvaluationRule(TypedDict, total=False): - external_evaluation: Required[RequireAccessExternalEvaluationRuleExternalEvaluation] - - -class RequireAccessCountryRuleGeo(TypedDict, total=False): - country_code: Required[str] - """The country code that should be matched.""" - - -class RequireAccessCountryRule(TypedDict, total=False): - geo: Required[RequireAccessCountryRuleGeo] - - -class RequireAccessAuthenticationMethodRuleAuthMethod(TypedDict, total=False): - auth_method: Required[str] - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class RequireAccessAuthenticationMethodRule(TypedDict, total=False): - auth_method: Required[RequireAccessAuthenticationMethodRuleAuthMethod] - - -class RequireAccessDevicePostureRuleDevicePosture(TypedDict, total=False): - integration_uid: Required[str] - """The ID of a device posture integration.""" - - -class RequireAccessDevicePostureRule(TypedDict, total=False): - device_posture: Required[RequireAccessDevicePostureRuleDevicePosture] - - -Require = Union[ - RequireAccessEmailRule, - RequireAccessEmailListRule, - RequireAccessDomainRule, - RequireAccessEveryoneRule, - RequireAccessIPRule, - RequireAccessIPListRule, - RequireAccessCertificateRule, - RequireAccessAccessGroupRule, - RequireAccessAzureGroupRule, - RequireAccessGitHubOrganizationRule, - RequireAccessGsuiteGroupRule, - RequireAccessOktaGroupRule, - RequireAccessSamlGroupRule, - RequireAccessServiceTokenRule, - RequireAccessAnyValidServiceTokenRule, - RequireAccessExternalEvaluationRule, - RequireAccessCountryRule, - RequireAccessAuthenticationMethodRule, - RequireAccessDevicePostureRule, -] diff --git a/src/cloudflare/types/zero_trust/access/logs/__init__.py b/src/cloudflare/types/zero_trust/access/logs/__init__.py index 3877a88828f..8044ec713b3 100644 --- a/src/cloudflare/types/zero_trust/access/logs/__init__.py +++ b/src/cloudflare/types/zero_trust/access/logs/__init__.py @@ -2,5 +2,5 @@ from __future__ import annotations -from .zero_trust_access_requests import ZeroTrustAccessRequests as ZeroTrustAccessRequests +from .access_requests import AccessRequests as AccessRequests from .access_request_list_response import AccessRequestListResponse as AccessRequestListResponse diff --git a/src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py b/src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py index 698535e88d5..b48a60046d9 100644 --- a/src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py +++ b/src/cloudflare/types/zero_trust/access/logs/access_request_list_response.py @@ -2,8 +2,8 @@ from typing import List -from .zero_trust_access_requests import ZeroTrustAccessRequests +from .access_requests import AccessRequests __all__ = ["AccessRequestListResponse"] -AccessRequestListResponse = List[ZeroTrustAccessRequests] +AccessRequestListResponse = List[AccessRequests] diff --git a/src/cloudflare/types/zero_trust/access/logs/access_requests.py b/src/cloudflare/types/zero_trust/access/logs/access_requests.py new file mode 100644 index 00000000000..7baca33ef79 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/logs/access_requests.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = ["AccessRequests"] + + +class AccessRequests(BaseModel): + action: Optional[str] = None + """The event that occurred, such as a login attempt.""" + + allowed: Optional[bool] = None + """The result of the authentication event.""" + + app_domain: Optional[str] = None + """The URL of the Access application.""" + + app_uid: Optional[str] = None + """The unique identifier for the Access application.""" + + connection: Optional[str] = None + """The IdP used to authenticate.""" + + created_at: Optional[datetime] = None + + ip_address: Optional[str] = None + """The IP address of the authenticating user.""" + + rayid: Optional[str] = FieldInfo(alias="ray_id", default=None) + """The unique identifier for the request to Cloudflare.""" + + user_email: Optional[str] = None + """The email address of the authenticating user.""" diff --git a/src/cloudflare/types/zero_trust/access/logs/zero_trust_access_requests.py b/src/cloudflare/types/zero_trust/access/logs/zero_trust_access_requests.py deleted file mode 100644 index f3467107fc2..00000000000 --- a/src/cloudflare/types/zero_trust/access/logs/zero_trust_access_requests.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = ["ZeroTrustAccessRequests"] - - -class ZeroTrustAccessRequests(BaseModel): - action: Optional[str] = None - """The event that occurred, such as a login attempt.""" - - allowed: Optional[bool] = None - """The result of the authentication event.""" - - app_domain: Optional[str] = None - """The URL of the Access application.""" - - app_uid: Optional[str] = None - """The unique identifier for the Access application.""" - - connection: Optional[str] = None - """The IdP used to authenticate.""" - - created_at: Optional[datetime] = None - - ip_address: Optional[str] = None - """The IP address of the authenticating user.""" - - rayid: Optional[str] = FieldInfo(alias="ray_id", default=None) - """The unique identifier for the request to Cloudflare.""" - - user_email: Optional[str] = None - """The email address of the authenticating user.""" diff --git a/src/cloudflare/types/zero_trust/access/saas_app_name_format.py b/src/cloudflare/types/zero_trust/access/saas_app_name_format.py new file mode 100644 index 00000000000..07f7e79cfae --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/saas_app_name_format.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["SaaSAppNameFormat"] + +SaaSAppNameFormat = Literal[ + "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified", + "urn:oasis:names:tc:SAML:2.0:attrname-format:basic", + "urn:oasis:names:tc:SAML:2.0:attrname-format:uri", +] diff --git a/src/cloudflare/types/zero_trust/access/saas_app_name_id_format.py b/src/cloudflare/types/zero_trust/access/saas_app_name_id_format.py new file mode 100644 index 00000000000..15af2a15b16 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/saas_app_name_id_format.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["SaaSAppNameIDFormat"] + +SaaSAppNameIDFormat = Literal["id", "email"] diff --git a/src/cloudflare/types/zero_trust/access/saas_app_source.py b/src/cloudflare/types/zero_trust/access/saas_app_source.py new file mode 100644 index 00000000000..5a4e157c195 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/saas_app_source.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ...._models import BaseModel + +__all__ = ["SaaSAppSource"] + + +class SaaSAppSource(BaseModel): + name: Optional[str] = None + """The name of the IdP attribute.""" + + name_by_idp: Optional[Dict[str, str]] = None + """A mapping from IdP ID to attribute name.""" diff --git a/src/cloudflare/types/zero_trust/access/saas_app_source_param.py b/src/cloudflare/types/zero_trust/access/saas_app_source_param.py new file mode 100644 index 00000000000..12b4abc2d05 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/saas_app_source_param.py @@ -0,0 +1,16 @@ +# 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 TypedDict + +__all__ = ["SaaSAppSourceParam"] + + +class SaaSAppSourceParam(TypedDict, total=False): + name: str + """The name of the IdP attribute.""" + + name_by_idp: Dict[str, str] + """A mapping from IdP ID to attribute name.""" diff --git a/src/cloudflare/types/zero_trust/access/saml_saas_app.py b/src/cloudflare/types/zero_trust/access/saml_saas_app.py new file mode 100644 index 00000000000..495e76604aa --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/saml_saas_app.py @@ -0,0 +1,87 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel +from .saas_app_source import SaaSAppSource +from .saas_app_name_format import SaaSAppNameFormat +from .saas_app_name_id_format import SaaSAppNameIDFormat + +__all__ = ["SAMLSaaSApp", "CustomAttributes"] + + +class CustomAttributes(BaseModel): + friendly_name: Optional[str] = None + """The SAML FriendlyName of the attribute.""" + + name: Optional[str] = None + """The name of the attribute.""" + + name_format: Optional[SaaSAppNameFormat] = None + """A globally unique name for an identity or service provider.""" + + required: Optional[bool] = None + """If the attribute is required when building a SAML assertion.""" + + source: Optional[SaaSAppSource] = None + + +class SAMLSaaSApp(BaseModel): + auth_type: Optional[Literal["saml", "oidc"]] = None + """Optional identifier indicating the authentication protocol used for the saas + app. + + Required for OIDC. Default if unset is "saml" + """ + + consumer_service_url: Optional[str] = None + """ + The service provider's endpoint that is responsible for receiving and parsing a + SAML assertion. + """ + + created_at: Optional[datetime] = None + + custom_attributes: Optional[CustomAttributes] = None + + default_relay_state: Optional[str] = None + """ + The URL that the user will be redirected to after a successful login for IDP + initiated logins. + """ + + idp_entity_id: Optional[str] = None + """The unique identifier for your SaaS application.""" + + name_id_format: Optional[SaaSAppNameIDFormat] = None + """The format of the name identifier sent to the SaaS application.""" + + name_id_transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms an application's + user identities into a NameID value for its SAML assertion. This expression + should evaluate to a singular string. The output of this expression can override + the `name_id_format` setting. + """ + + public_key: Optional[str] = None + """The Access public certificate that will be used to verify your identity.""" + + saml_attribute_transform_jsonata: Optional[str] = None + """ + A [JSONata] (https://jsonata.org/) expression that transforms an application's + user identities into attribute assertions in the SAML response. The expression + can transform id, email, name, and groups values. It can also transform fields + listed in the saml_attributes or oidc_fields of the identity provider used to + authenticate. The output of this expression must be a JSON object. + """ + + sp_entity_id: Optional[str] = None + """A globally unique name for an identity or service provider.""" + + sso_endpoint: Optional[str] = None + """The endpoint where your SaaS application will send login requests.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/saml_saas_app_param.py b/src/cloudflare/types/zero_trust/access/saml_saas_app_param.py new file mode 100644 index 00000000000..8eace9c0634 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/saml_saas_app_param.py @@ -0,0 +1,82 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +from .saas_app_name_format import SaaSAppNameFormat +from .saas_app_source_param import SaaSAppSourceParam +from .saas_app_name_id_format import SaaSAppNameIDFormat + +__all__ = ["SAMLSaaSAppParam", "CustomAttributes"] + + +class CustomAttributes(TypedDict, total=False): + friendly_name: str + """The SAML FriendlyName of the attribute.""" + + name: str + """The name of the attribute.""" + + name_format: SaaSAppNameFormat + """A globally unique name for an identity or service provider.""" + + required: bool + """If the attribute is required when building a SAML assertion.""" + + source: SaaSAppSourceParam + + +class SAMLSaaSAppParam(TypedDict, total=False): + auth_type: Literal["saml", "oidc"] + """Optional identifier indicating the authentication protocol used for the saas + app. + + Required for OIDC. Default if unset is "saml" + """ + + consumer_service_url: str + """ + The service provider's endpoint that is responsible for receiving and parsing a + SAML assertion. + """ + + custom_attributes: CustomAttributes + + default_relay_state: str + """ + The URL that the user will be redirected to after a successful login for IDP + initiated logins. + """ + + idp_entity_id: str + """The unique identifier for your SaaS application.""" + + name_id_format: SaaSAppNameIDFormat + """The format of the name identifier sent to the SaaS application.""" + + name_id_transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms an application's + user identities into a NameID value for its SAML assertion. This expression + should evaluate to a singular string. The output of this expression can override + the `name_id_format` setting. + """ + + public_key: str + """The Access public certificate that will be used to verify your identity.""" + + saml_attribute_transform_jsonata: str + """ + A [JSONata] (https://jsonata.org/) expression that transforms an application's + user identities into attribute assertions in the SAML response. The expression + can transform id, email, name, and groups values. It can also transform fields + listed in the saml_attributes or oidc_fields of the identity provider used to + authenticate. The output of this expression must be a JSON object. + """ + + sp_entity_id: str + """A globally unique name for an identity or service provider.""" + + sso_endpoint: str + """The endpoint where your SaaS application will send login requests.""" diff --git a/src/cloudflare/types/zero_trust/access/self_hosted_domainsh.py b/src/cloudflare/types/zero_trust/access/self_hosted_domainsh.py new file mode 100644 index 00000000000..7dd81dca382 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/self_hosted_domainsh.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["SelfHostedDomainsh"] + +SelfHostedDomainsh = str diff --git a/src/cloudflare/types/zero_trust/access/service_token.py b/src/cloudflare/types/zero_trust/access/service_token.py new file mode 100644 index 00000000000..97ffd3bcdeb --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/service_token.py @@ -0,0 +1,33 @@ +# 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__ = ["ServiceToken"] + + +class ServiceToken(BaseModel): + id: Optional[object] = None + """The ID of the service token.""" + + client_id: Optional[str] = None + """The Client ID for the service token. + + Access will check for this value in the `CF-Access-Client-ID` request header. + """ + + created_at: Optional[datetime] = None + + duration: Optional[str] = None + """The duration for how long the service token will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. The default is 1 year in hours (8760h). + """ + + name: Optional[str] = None + """The name of the service token.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/tag.py b/src/cloudflare/types/zero_trust/access/tag.py new file mode 100644 index 00000000000..bf386015544 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/tag.py @@ -0,0 +1,20 @@ +# 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__ = ["Tag"] + + +class Tag(BaseModel): + name: str + """The name of the tag""" + + app_count: Optional[int] = None + """The number of applications that have this tag""" + + created_at: Optional[datetime] = None + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/users/__init__.py b/src/cloudflare/types/zero_trust/access/users/__init__.py index 5d2c3738998..5f23decf1fe 100644 --- a/src/cloudflare/types/zero_trust/access/users/__init__.py +++ b/src/cloudflare/types/zero_trust/access/users/__init__.py @@ -2,7 +2,7 @@ from __future__ import annotations -from .zero_trust_identity import ZeroTrustIdentity as ZeroTrustIdentity +from .identity import Identity as Identity from .failed_login_list_response import FailedLoginListResponse as FailedLoginListResponse from .active_session_get_response import ActiveSessionGetResponse as ActiveSessionGetResponse from .active_session_list_response import ActiveSessionListResponse as ActiveSessionListResponse diff --git a/src/cloudflare/types/zero_trust/access/users/active_session_get_response.py b/src/cloudflare/types/zero_trust/access/users/active_session_get_response.py index 523b0f0fc48..2414f09a55c 100644 --- a/src/cloudflare/types/zero_trust/access/users/active_session_get_response.py +++ b/src/cloudflare/types/zero_trust/access/users/active_session_get_response.py @@ -5,16 +5,9 @@ from pydantic import Field as FieldInfo from ....._models import BaseModel +from ..applications.user_policy_check_geo import UserPolicyCheckGeo -__all__ = [ - "ActiveSessionGetResponse", - "DeviceSessions", - "DevicePosture", - "DevicePostureCheck", - "Geo", - "IDP", - "MTLSAuth", -] +__all__ = ["ActiveSessionGetResponse", "DeviceSessions", "DevicePosture", "DevicePostureCheck", "IdP", "MTLSAuth"] class DeviceSessions(BaseModel): @@ -47,11 +40,7 @@ class DevicePosture(BaseModel): type: Optional[str] = None -class Geo(BaseModel): - country: Optional[str] = None - - -class IDP(BaseModel): +class IdP(BaseModel): id: Optional[str] = None type: Optional[str] = None @@ -84,11 +73,11 @@ class ActiveSessionGetResponse(BaseModel): email: Optional[str] = None - geo: Optional[Geo] = None + geo: Optional[UserPolicyCheckGeo] = None iat: Optional[float] = None - idp: Optional[IDP] = None + idp: Optional[IdP] = None ip: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/access/users/identity.py b/src/cloudflare/types/zero_trust/access/users/identity.py new file mode 100644 index 00000000000..52f27fee6c2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/users/identity.py @@ -0,0 +1,96 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel +from ..applications.user_policy_check_geo import UserPolicyCheckGeo + +__all__ = ["Identity", "DeviceSessions", "DevicePosture", "DevicePostureCheck", "IdP", "MTLSAuth"] + + +class DeviceSessions(BaseModel): + last_authenticated: Optional[float] = None + + +class DevicePostureCheck(BaseModel): + exists: Optional[bool] = None + + path: Optional[str] = None + + +class DevicePosture(BaseModel): + id: Optional[str] = None + + check: Optional[DevicePostureCheck] = None + + data: Optional[object] = None + + description: Optional[str] = None + + error: Optional[str] = None + + rule_name: Optional[str] = None + + success: Optional[bool] = None + + timestamp: Optional[str] = None + + type: Optional[str] = None + + +class IdP(BaseModel): + id: Optional[str] = None + + type: Optional[str] = None + + +class MTLSAuth(BaseModel): + auth_status: Optional[str] = None + + cert_issuer_dn: Optional[str] = None + + cert_issuer_ski: Optional[str] = None + + cert_presented: Optional[bool] = None + + cert_serial: Optional[str] = None + + +class Identity(BaseModel): + account_id: Optional[str] = None + + auth_status: Optional[str] = None + + common_name: Optional[str] = None + + device_id: Optional[str] = None + + device_sessions: Optional[Dict[str, DeviceSessions]] = None + + device_posture: Optional[Dict[str, DevicePosture]] = FieldInfo(alias="devicePosture", default=None) + + email: Optional[str] = None + + geo: Optional[UserPolicyCheckGeo] = None + + iat: Optional[float] = None + + idp: Optional[IdP] = None + + ip: Optional[str] = None + + is_gateway: Optional[bool] = None + + is_warp: Optional[bool] = None + + mtls_auth: Optional[MTLSAuth] = None + + service_token_id: Optional[str] = None + + service_token_status: Optional[bool] = None + + user_uuid: Optional[str] = None + + version: Optional[float] = None diff --git a/src/cloudflare/types/zero_trust/access/users/zero_trust_identity.py b/src/cloudflare/types/zero_trust/access/users/zero_trust_identity.py deleted file mode 100644 index 8411f8fe6dd..00000000000 --- a/src/cloudflare/types/zero_trust/access/users/zero_trust_identity.py +++ /dev/null @@ -1,99 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = ["ZeroTrustIdentity", "DeviceSessions", "DevicePosture", "DevicePostureCheck", "Geo", "IDP", "MTLSAuth"] - - -class DeviceSessions(BaseModel): - last_authenticated: Optional[float] = None - - -class DevicePostureCheck(BaseModel): - exists: Optional[bool] = None - - path: Optional[str] = None - - -class DevicePosture(BaseModel): - id: Optional[str] = None - - check: Optional[DevicePostureCheck] = None - - data: Optional[object] = None - - description: Optional[str] = None - - error: Optional[str] = None - - rule_name: Optional[str] = None - - success: Optional[bool] = None - - timestamp: Optional[str] = None - - type: Optional[str] = None - - -class Geo(BaseModel): - country: Optional[str] = None - - -class IDP(BaseModel): - id: Optional[str] = None - - type: Optional[str] = None - - -class MTLSAuth(BaseModel): - auth_status: Optional[str] = None - - cert_issuer_dn: Optional[str] = None - - cert_issuer_ski: Optional[str] = None - - cert_presented: Optional[bool] = None - - cert_serial: Optional[str] = None - - -class ZeroTrustIdentity(BaseModel): - account_id: Optional[str] = None - - auth_status: Optional[str] = None - - common_name: Optional[str] = None - - device_id: Optional[str] = None - - device_sessions: Optional[Dict[str, DeviceSessions]] = None - - device_posture: Optional[Dict[str, DevicePosture]] = FieldInfo(alias="devicePosture", default=None) - - email: Optional[str] = None - - geo: Optional[Geo] = None - - iat: Optional[float] = None - - idp: Optional[IDP] = None - - ip: Optional[str] = None - - is_gateway: Optional[bool] = None - - is_warp: Optional[bool] = None - - mtls_auth: Optional[MTLSAuth] = None - - service_token_id: Optional[str] = None - - service_token_status: Optional[bool] = None - - user_uuid: Optional[str] = None - - version: Optional[float] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_apps.py b/src/cloudflare/types/zero_trust/access/zero_trust_apps.py deleted file mode 100644 index bbd1111c7da..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_apps.py +++ /dev/null @@ -1,840 +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 - -from ...._models import BaseModel - -__all__ = [ - "ZeroTrustApps", - "SelfHostedApplication", - "SelfHostedApplicationCorsHeaders", - "SaaSApplication", - "SaaSApplicationSaasApp", - "SaaSApplicationSaasAppAccessSamlSaasApp", - "SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes", - "SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource", - "SaaSApplicationSaasAppAccessOidcSaasApp", - "BrowserSSHApplication", - "BrowserSSHApplicationCorsHeaders", - "BrowserVncApplication", - "BrowserVncApplicationCorsHeaders", - "AppLauncherApplication", - "DeviceEnrollmentPermissionsApplication", - "BrowserIsolationPermissionsApplication", - "BookmarkApplication", -] - - -class SelfHostedApplicationCorsHeaders(BaseModel): - allow_all_headers: Optional[bool] = None - """Allows all HTTP request headers.""" - - allow_all_methods: Optional[bool] = None - """Allows all HTTP request methods.""" - - allow_all_origins: Optional[bool] = None - """Allows all origins.""" - - allow_credentials: Optional[bool] = None - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: Optional[List[str]] = None - """Allowed HTTP request headers.""" - - allowed_methods: Optional[ - List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - ] = None - """Allowed HTTP request methods.""" - - allowed_origins: Optional[List[str]] = None - """Allowed origins.""" - - max_age: Optional[float] = None - """The maximum number of seconds the results of a preflight request can be cached.""" - - -class SelfHostedApplication(BaseModel): - domain: str - """The primary hostname and path that Access will secure. - - If the app is visible in the App Launcher dashboard, this is the domain that - will be displayed. - """ - - type: str - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allow_authenticate_via_warp: Optional[bool] = None - """ - When set to true, users can authenticate to this application using their WARP - session. When set to false this application will always require direct IdP - authentication. This setting always overrides the organization setting for WARP - authentication. - """ - - allowed_idps: Optional[List[str]] = None - """The identity providers your users can select when connecting to this - application. - - Defaults to all IdPs configured in your account. - """ - - app_launcher_visible: Optional[bool] = None - """Displays the application in the App Launcher.""" - - aud: Optional[str] = None - """Audience tag.""" - - auto_redirect_to_identity: Optional[bool] = None - """When set to `true`, users skip the identity provider selection step during - login. - - You must specify only one identity provider in allowed_idps. - """ - - cors_headers: Optional[SelfHostedApplicationCorsHeaders] = None - - created_at: Optional[datetime] = None - - custom_deny_message: Optional[str] = None - """ - The custom error message shown to a user when they are denied access to the - application. - """ - - custom_deny_url: Optional[str] = None - """ - The custom URL a user is redirected to when they are denied access to the - application when failing identity-based rules. - """ - - custom_non_identity_deny_url: Optional[str] = None - """ - The custom URL a user is redirected to when they are denied access to the - application when failing non-identity rules. - """ - - custom_pages: Optional[List[str]] = None - """The custom pages that will be displayed when applicable for this application""" - - enable_binding_cookie: Optional[bool] = None - """ - Enables the binding cookie, which increases security against compromised - authorization tokens and CSRF attacks. - """ - - http_only_cookie_attribute: Optional[bool] = None - """ - Enables the HttpOnly cookie attribute, which increases security against XSS - attacks. - """ - - logo_url: Optional[str] = None - """The image URL for the logo shown in the App Launcher dashboard.""" - - name: Optional[str] = None - """The name of the application.""" - - path_cookie_attribute: Optional[bool] = None - """Enables cookie paths to scope an application's JWT to the application path. - - If disabled, the JWT will scope to the hostname by default - """ - - same_site_cookie_attribute: Optional[str] = None - """ - Sets the SameSite cookie setting, which provides increased security against CSRF - attacks. - """ - - self_hosted_domains: Optional[List[str]] = None - """List of domains that Access will secure.""" - - service_auth_401_redirect: Optional[bool] = None - """Returns a 401 status code when the request is blocked by a Service Auth policy.""" - - session_duration: Optional[str] = None - """The amount of time that tokens issued for this application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - skip_interstitial: Optional[bool] = None - """Enables automatic authentication through cloudflared.""" - - tags: Optional[List[str]] = None - """The tags you want assigned to an application. - - Tags are used to filter applications in the App Launcher dashboard. - """ - - updated_at: Optional[datetime] = None - - -class SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource(BaseModel): - name: Optional[str] = None - """The name of the IdP attribute.""" - - -class SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes(BaseModel): - name: Optional[str] = None - """The name of the attribute.""" - - name_format: Optional[ - Literal[ - "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified", - "urn:oasis:names:tc:SAML:2.0:attrname-format:basic", - "urn:oasis:names:tc:SAML:2.0:attrname-format:uri", - ] - ] = None - """A globally unique name for an identity or service provider.""" - - source: Optional[SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource] = None - - -class SaaSApplicationSaasAppAccessSamlSaasApp(BaseModel): - auth_type: Optional[Literal["saml", "oidc"]] = None - """Optional identifier indicating the authentication protocol used for the saas - app. - - Required for OIDC. Default if unset is "saml" - """ - - consumer_service_url: Optional[str] = None - """ - The service provider's endpoint that is responsible for receiving and parsing a - SAML assertion. - """ - - created_at: Optional[datetime] = None - - custom_attributes: Optional[SaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes] = None - - default_relay_state: Optional[str] = None - """ - The URL that the user will be redirected to after a successful login for IDP - initiated logins. - """ - - idp_entity_id: Optional[str] = None - """The unique identifier for your SaaS application.""" - - name_id_format: Optional[Literal["id", "email"]] = None - """The format of the name identifier sent to the SaaS application.""" - - name_id_transform_jsonata: Optional[str] = None - """ - A [JSONata](https://jsonata.org/) expression that transforms an application's - user identities into a NameID value for its SAML assertion. This expression - should evaluate to a singular string. The output of this expression can override - the `name_id_format` setting. - """ - - public_key: Optional[str] = None - """The Access public certificate that will be used to verify your identity.""" - - saml_attribute_transform_jsonata: Optional[str] = None - """ - A [JSONata] (https://jsonata.org/) expression that transforms an application's - user identities into attribute assertions in the SAML response. The expression - can transform id, email, name, and groups values. It can also transform fields - listed in the saml_attributes or oidc_fields of the identity provider used to - authenticate. The output of this expression must be a JSON object. - """ - - sp_entity_id: Optional[str] = None - """A globally unique name for an identity or service provider.""" - - sso_endpoint: Optional[str] = None - """The endpoint where your SaaS application will send login requests.""" - - updated_at: Optional[datetime] = None - - -class SaaSApplicationSaasAppAccessOidcSaasApp(BaseModel): - app_launcher_url: Optional[str] = None - """The URL where this applications tile redirects users""" - - auth_type: Optional[Literal["saml", "oidc"]] = None - """Identifier of the authentication protocol used for the saas app. - - Required for OIDC. - """ - - client_id: Optional[str] = None - """The application client id""" - - client_secret: Optional[str] = None - """The application client secret, only returned on POST request.""" - - created_at: Optional[datetime] = None - - grant_types: Optional[List[Literal["authorization_code", "authorization_code_with_pkce"]]] = None - """The OIDC flows supported by this application""" - - group_filter_regex: Optional[str] = None - """A regex to filter Cloudflare groups returned in ID token and userinfo endpoint""" - - public_key: Optional[str] = None - """The Access public certificate that will be used to verify your identity.""" - - redirect_uris: Optional[List[str]] = None - """ - The permitted URL's for Cloudflare to return Authorization codes and Access/ID - tokens - """ - - scopes: Optional[List[Literal["openid", "groups", "email", "profile"]]] = None - """Define the user information shared with access""" - - updated_at: Optional[datetime] = None - - -SaaSApplicationSaasApp = Union[SaaSApplicationSaasAppAccessSamlSaasApp, SaaSApplicationSaasAppAccessOidcSaasApp] - - -class SaaSApplication(BaseModel): - id: Optional[str] = None - """UUID""" - - allowed_idps: Optional[List[str]] = None - """The identity providers your users can select when connecting to this - application. - - Defaults to all IdPs configured in your account. - """ - - app_launcher_visible: Optional[bool] = None - """Displays the application in the App Launcher.""" - - aud: Optional[str] = None - """Audience tag.""" - - auto_redirect_to_identity: Optional[bool] = None - """When set to `true`, users skip the identity provider selection step during - login. - - You must specify only one identity provider in allowed_idps. - """ - - created_at: Optional[datetime] = None - - custom_pages: Optional[List[str]] = None - """The custom pages that will be displayed when applicable for this application""" - - logo_url: Optional[str] = None - """The image URL for the logo shown in the App Launcher dashboard.""" - - name: Optional[str] = None - """The name of the application.""" - - saas_app: Optional[SaaSApplicationSaasApp] = None - - tags: Optional[List[str]] = None - """The tags you want assigned to an application. - - Tags are used to filter applications in the App Launcher dashboard. - """ - - type: Optional[str] = None - """The application type.""" - - updated_at: Optional[datetime] = None - - -class BrowserSSHApplicationCorsHeaders(BaseModel): - allow_all_headers: Optional[bool] = None - """Allows all HTTP request headers.""" - - allow_all_methods: Optional[bool] = None - """Allows all HTTP request methods.""" - - allow_all_origins: Optional[bool] = None - """Allows all origins.""" - - allow_credentials: Optional[bool] = None - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: Optional[List[str]] = None - """Allowed HTTP request headers.""" - - allowed_methods: Optional[ - List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - ] = None - """Allowed HTTP request methods.""" - - allowed_origins: Optional[List[str]] = None - """Allowed origins.""" - - max_age: Optional[float] = None - """The maximum number of seconds the results of a preflight request can be cached.""" - - -class BrowserSSHApplication(BaseModel): - domain: str - """The primary hostname and path that Access will secure. - - If the app is visible in the App Launcher dashboard, this is the domain that - will be displayed. - """ - - type: str - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allow_authenticate_via_warp: Optional[bool] = None - """ - When set to true, users can authenticate to this application using their WARP - session. When set to false this application will always require direct IdP - authentication. This setting always overrides the organization setting for WARP - authentication. - """ - - allowed_idps: Optional[List[str]] = None - """The identity providers your users can select when connecting to this - application. - - Defaults to all IdPs configured in your account. - """ - - app_launcher_visible: Optional[bool] = None - """Displays the application in the App Launcher.""" - - aud: Optional[str] = None - """Audience tag.""" - - auto_redirect_to_identity: Optional[bool] = None - """When set to `true`, users skip the identity provider selection step during - login. - - You must specify only one identity provider in allowed_idps. - """ - - cors_headers: Optional[BrowserSSHApplicationCorsHeaders] = None - - created_at: Optional[datetime] = None - - custom_deny_message: Optional[str] = None - """ - The custom error message shown to a user when they are denied access to the - application. - """ - - custom_deny_url: Optional[str] = None - """ - The custom URL a user is redirected to when they are denied access to the - application when failing identity-based rules. - """ - - custom_non_identity_deny_url: Optional[str] = None - """ - The custom URL a user is redirected to when they are denied access to the - application when failing non-identity rules. - """ - - custom_pages: Optional[List[str]] = None - """The custom pages that will be displayed when applicable for this application""" - - enable_binding_cookie: Optional[bool] = None - """ - Enables the binding cookie, which increases security against compromised - authorization tokens and CSRF attacks. - """ - - http_only_cookie_attribute: Optional[bool] = None - """ - Enables the HttpOnly cookie attribute, which increases security against XSS - attacks. - """ - - logo_url: Optional[str] = None - """The image URL for the logo shown in the App Launcher dashboard.""" - - name: Optional[str] = None - """The name of the application.""" - - path_cookie_attribute: Optional[bool] = None - """Enables cookie paths to scope an application's JWT to the application path. - - If disabled, the JWT will scope to the hostname by default - """ - - same_site_cookie_attribute: Optional[str] = None - """ - Sets the SameSite cookie setting, which provides increased security against CSRF - attacks. - """ - - self_hosted_domains: Optional[List[str]] = None - """List of domains that Access will secure.""" - - service_auth_401_redirect: Optional[bool] = None - """Returns a 401 status code when the request is blocked by a Service Auth policy.""" - - session_duration: Optional[str] = None - """The amount of time that tokens issued for this application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - skip_interstitial: Optional[bool] = None - """Enables automatic authentication through cloudflared.""" - - tags: Optional[List[str]] = None - """The tags you want assigned to an application. - - Tags are used to filter applications in the App Launcher dashboard. - """ - - updated_at: Optional[datetime] = None - - -class BrowserVncApplicationCorsHeaders(BaseModel): - allow_all_headers: Optional[bool] = None - """Allows all HTTP request headers.""" - - allow_all_methods: Optional[bool] = None - """Allows all HTTP request methods.""" - - allow_all_origins: Optional[bool] = None - """Allows all origins.""" - - allow_credentials: Optional[bool] = None - """ - When set to `true`, includes credentials (cookies, authorization headers, or TLS - client certificates) with requests. - """ - - allowed_headers: Optional[List[str]] = None - """Allowed HTTP request headers.""" - - allowed_methods: Optional[ - List[Literal["GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]] - ] = None - """Allowed HTTP request methods.""" - - allowed_origins: Optional[List[str]] = None - """Allowed origins.""" - - max_age: Optional[float] = None - """The maximum number of seconds the results of a preflight request can be cached.""" - - -class BrowserVncApplication(BaseModel): - domain: str - """The primary hostname and path that Access will secure. - - If the app is visible in the App Launcher dashboard, this is the domain that - will be displayed. - """ - - type: str - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allow_authenticate_via_warp: Optional[bool] = None - """ - When set to true, users can authenticate to this application using their WARP - session. When set to false this application will always require direct IdP - authentication. This setting always overrides the organization setting for WARP - authentication. - """ - - allowed_idps: Optional[List[str]] = None - """The identity providers your users can select when connecting to this - application. - - Defaults to all IdPs configured in your account. - """ - - app_launcher_visible: Optional[bool] = None - """Displays the application in the App Launcher.""" - - aud: Optional[str] = None - """Audience tag.""" - - auto_redirect_to_identity: Optional[bool] = None - """When set to `true`, users skip the identity provider selection step during - login. - - You must specify only one identity provider in allowed_idps. - """ - - cors_headers: Optional[BrowserVncApplicationCorsHeaders] = None - - created_at: Optional[datetime] = None - - custom_deny_message: Optional[str] = None - """ - The custom error message shown to a user when they are denied access to the - application. - """ - - custom_deny_url: Optional[str] = None - """ - The custom URL a user is redirected to when they are denied access to the - application when failing identity-based rules. - """ - - custom_non_identity_deny_url: Optional[str] = None - """ - The custom URL a user is redirected to when they are denied access to the - application when failing non-identity rules. - """ - - custom_pages: Optional[List[str]] = None - """The custom pages that will be displayed when applicable for this application""" - - enable_binding_cookie: Optional[bool] = None - """ - Enables the binding cookie, which increases security against compromised - authorization tokens and CSRF attacks. - """ - - http_only_cookie_attribute: Optional[bool] = None - """ - Enables the HttpOnly cookie attribute, which increases security against XSS - attacks. - """ - - logo_url: Optional[str] = None - """The image URL for the logo shown in the App Launcher dashboard.""" - - name: Optional[str] = None - """The name of the application.""" - - path_cookie_attribute: Optional[bool] = None - """Enables cookie paths to scope an application's JWT to the application path. - - If disabled, the JWT will scope to the hostname by default - """ - - same_site_cookie_attribute: Optional[str] = None - """ - Sets the SameSite cookie setting, which provides increased security against CSRF - attacks. - """ - - self_hosted_domains: Optional[List[str]] = None - """List of domains that Access will secure.""" - - service_auth_401_redirect: Optional[bool] = None - """Returns a 401 status code when the request is blocked by a Service Auth policy.""" - - session_duration: Optional[str] = None - """The amount of time that tokens issued for this application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - skip_interstitial: Optional[bool] = None - """Enables automatic authentication through cloudflared.""" - - tags: Optional[List[str]] = None - """The tags you want assigned to an application. - - Tags are used to filter applications in the App Launcher dashboard. - """ - - updated_at: Optional[datetime] = None - - -class AppLauncherApplication(BaseModel): - type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"] - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allowed_idps: Optional[List[str]] = None - """The identity providers your users can select when connecting to this - application. - - Defaults to all IdPs configured in your account. - """ - - aud: Optional[str] = None - """Audience tag.""" - - auto_redirect_to_identity: Optional[bool] = None - """When set to `true`, users skip the identity provider selection step during - login. - - You must specify only one identity provider in allowed_idps. - """ - - created_at: Optional[datetime] = None - - domain: Optional[str] = None - """The primary hostname and path that Access will secure. - - If the app is visible in the App Launcher dashboard, this is the domain that - will be displayed. - """ - - name: Optional[str] = None - """The name of the application.""" - - session_duration: Optional[str] = None - """The amount of time that tokens issued for this application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - updated_at: Optional[datetime] = None - - -class DeviceEnrollmentPermissionsApplication(BaseModel): - type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"] - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allowed_idps: Optional[List[str]] = None - """The identity providers your users can select when connecting to this - application. - - Defaults to all IdPs configured in your account. - """ - - aud: Optional[str] = None - """Audience tag.""" - - auto_redirect_to_identity: Optional[bool] = None - """When set to `true`, users skip the identity provider selection step during - login. - - You must specify only one identity provider in allowed_idps. - """ - - created_at: Optional[datetime] = None - - domain: Optional[str] = None - """The primary hostname and path that Access will secure. - - If the app is visible in the App Launcher dashboard, this is the domain that - will be displayed. - """ - - name: Optional[str] = None - """The name of the application.""" - - session_duration: Optional[str] = None - """The amount of time that tokens issued for this application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - updated_at: Optional[datetime] = None - - -class BrowserIsolationPermissionsApplication(BaseModel): - type: Literal["self_hosted", "saas", "ssh", "vnc", "app_launcher", "warp", "biso", "bookmark", "dash_sso"] - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allowed_idps: Optional[List[str]] = None - """The identity providers your users can select when connecting to this - application. - - Defaults to all IdPs configured in your account. - """ - - aud: Optional[str] = None - """Audience tag.""" - - auto_redirect_to_identity: Optional[bool] = None - """When set to `true`, users skip the identity provider selection step during - login. - - You must specify only one identity provider in allowed_idps. - """ - - created_at: Optional[datetime] = None - - domain: Optional[str] = None - """The primary hostname and path that Access will secure. - - If the app is visible in the App Launcher dashboard, this is the domain that - will be displayed. - """ - - name: Optional[str] = None - """The name of the application.""" - - session_duration: Optional[str] = None - """The amount of time that tokens issued for this application will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - updated_at: Optional[datetime] = None - - -class BookmarkApplication(BaseModel): - id: Optional[str] = None - """UUID""" - - app_launcher_visible: Optional[bool] = None - """Displays the application in the App Launcher.""" - - aud: Optional[str] = None - """Audience tag.""" - - created_at: Optional[datetime] = None - - domain: Optional[str] = None - """The URL or domain of the bookmark.""" - - logo_url: Optional[str] = None - """The image URL for the logo shown in the App Launcher dashboard.""" - - name: Optional[str] = None - """The name of the application.""" - - tags: Optional[List[str]] = None - """The tags you want assigned to an application. - - Tags are used to filter applications in the App Launcher dashboard. - """ - - type: Optional[str] = None - """The application type.""" - - updated_at: Optional[datetime] = None - - -ZeroTrustApps = Union[ - SelfHostedApplication, - SaaSApplication, - BrowserSSHApplication, - BrowserVncApplication, - AppLauncherApplication, - DeviceEnrollmentPermissionsApplication, - BrowserIsolationPermissionsApplication, - BookmarkApplication, -] diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_bookmarks.py b/src/cloudflare/types/zero_trust/access/zero_trust_bookmarks.py deleted file mode 100644 index 6ecee05ac03..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_bookmarks.py +++ /dev/null @@ -1,29 +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__ = ["ZeroTrustBookmarks"] - - -class ZeroTrustBookmarks(BaseModel): - id: Optional[str] = None - """The unique identifier for the Bookmark application.""" - - app_launcher_visible: Optional[bool] = None - """Displays the application in the App Launcher.""" - - created_at: Optional[datetime] = None - - domain: Optional[str] = None - """The domain of the Bookmark application.""" - - logo_url: Optional[str] = None - """The image URL for the logo shown in the App Launcher dashboard.""" - - name: Optional[str] = None - """The name of the Bookmark application.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_certificates.py b/src/cloudflare/types/zero_trust/access/zero_trust_certificates.py deleted file mode 100644 index 07c742c30e3..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_certificates.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["ZeroTrustCertificates"] - - -class ZeroTrustCertificates(BaseModel): - id: Optional[str] = None - """The ID of the application that will use this certificate.""" - - associated_hostnames: Optional[List[str]] = None - """The hostnames of the applications that will use this certificate.""" - - created_at: Optional[datetime] = None - - expires_on: Optional[datetime] = None - - fingerprint: Optional[str] = None - """The MD5 fingerprint of the certificate.""" - - name: Optional[str] = None - """The name of the certificate.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_custom_page.py b/src/cloudflare/types/zero_trust/access/zero_trust_custom_page.py deleted file mode 100644 index cb9da69fd4b..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_custom_page.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 datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZeroTrustCustomPage"] - - -class ZeroTrustCustomPage(BaseModel): - custom_html: str - """Custom page HTML.""" - - name: str - """Custom page name.""" - - type: Literal["identity_denied", "forbidden"] - """Custom page type.""" - - app_count: Optional[int] = None - """Number of apps the custom page is assigned to.""" - - created_at: Optional[datetime] = None - - uid: Optional[str] = None - """UUID""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_custom_page_without_html.py b/src/cloudflare/types/zero_trust/access/zero_trust_custom_page_without_html.py deleted file mode 100644 index 3bd6d73efa2..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_custom_page_without_html.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZeroTrustCustomPageWithoutHTML"] - - -class ZeroTrustCustomPageWithoutHTML(BaseModel): - name: str - """Custom page name.""" - - type: Literal["identity_denied", "forbidden"] - """Custom page type.""" - - app_count: Optional[int] = None - """Number of apps the custom page is assigned to.""" - - created_at: Optional[datetime] = None - - uid: Optional[str] = None - """UUID""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_group.py b/src/cloudflare/types/zero_trust/access/zero_trust_group.py new file mode 100644 index 00000000000..eae4f03b8f2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/zero_trust_group.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel +from ..access_rule import AccessRule + +__all__ = ["ZeroTrustGroup"] + + +class ZeroTrustGroup(BaseModel): + id: Optional[str] = None + """UUID""" + + created_at: Optional[datetime] = None + + exclude: Optional[List[AccessRule]] = None + """Rules evaluated with a NOT logical operator. + + To match a policy, a user cannot meet any of the Exclude rules. + """ + + include: Optional[List[AccessRule]] = None + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + is_default: Optional[List[AccessRule]] = None + """Rules evaluated with an AND logical operator. + + To match a policy, a user must meet all of the Require rules. + """ + + name: Optional[str] = None + """The name of the Access group.""" + + require: Optional[List[AccessRule]] = None + """Rules evaluated with an AND logical operator. + + To match a policy, a user must meet all of the Require rules. + """ + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_groups.py b/src/cloudflare/types/zero_trust/access/zero_trust_groups.py deleted file mode 100644 index f7cde2ccddb..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_groups.py +++ /dev/null @@ -1,1010 +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 pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "ZeroTrustGroups", - "Exclude", - "ExcludeAccessEmailRule", - "ExcludeAccessEmailRuleEmail", - "ExcludeAccessEmailListRule", - "ExcludeAccessEmailListRuleEmailList", - "ExcludeAccessDomainRule", - "ExcludeAccessDomainRuleEmailDomain", - "ExcludeAccessEveryoneRule", - "ExcludeAccessIPRule", - "ExcludeAccessIPRuleIP", - "ExcludeAccessIPListRule", - "ExcludeAccessIPListRuleIPList", - "ExcludeAccessCertificateRule", - "ExcludeAccessAccessGroupRule", - "ExcludeAccessAccessGroupRuleGroup", - "ExcludeAccessAzureGroupRule", - "ExcludeAccessAzureGroupRuleAzureAd", - "ExcludeAccessGitHubOrganizationRule", - "ExcludeAccessGitHubOrganizationRuleGitHubOrganization", - "ExcludeAccessGsuiteGroupRule", - "ExcludeAccessGsuiteGroupRuleGsuite", - "ExcludeAccessOktaGroupRule", - "ExcludeAccessOktaGroupRuleOkta", - "ExcludeAccessSamlGroupRule", - "ExcludeAccessSamlGroupRuleSaml", - "ExcludeAccessServiceTokenRule", - "ExcludeAccessServiceTokenRuleServiceToken", - "ExcludeAccessAnyValidServiceTokenRule", - "ExcludeAccessExternalEvaluationRule", - "ExcludeAccessExternalEvaluationRuleExternalEvaluation", - "ExcludeAccessCountryRule", - "ExcludeAccessCountryRuleGeo", - "ExcludeAccessAuthenticationMethodRule", - "ExcludeAccessAuthenticationMethodRuleAuthMethod", - "ExcludeAccessDevicePostureRule", - "ExcludeAccessDevicePostureRuleDevicePosture", - "Include", - "IncludeAccessEmailRule", - "IncludeAccessEmailRuleEmail", - "IncludeAccessEmailListRule", - "IncludeAccessEmailListRuleEmailList", - "IncludeAccessDomainRule", - "IncludeAccessDomainRuleEmailDomain", - "IncludeAccessEveryoneRule", - "IncludeAccessIPRule", - "IncludeAccessIPRuleIP", - "IncludeAccessIPListRule", - "IncludeAccessIPListRuleIPList", - "IncludeAccessCertificateRule", - "IncludeAccessAccessGroupRule", - "IncludeAccessAccessGroupRuleGroup", - "IncludeAccessAzureGroupRule", - "IncludeAccessAzureGroupRuleAzureAd", - "IncludeAccessGitHubOrganizationRule", - "IncludeAccessGitHubOrganizationRuleGitHubOrganization", - "IncludeAccessGsuiteGroupRule", - "IncludeAccessGsuiteGroupRuleGsuite", - "IncludeAccessOktaGroupRule", - "IncludeAccessOktaGroupRuleOkta", - "IncludeAccessSamlGroupRule", - "IncludeAccessSamlGroupRuleSaml", - "IncludeAccessServiceTokenRule", - "IncludeAccessServiceTokenRuleServiceToken", - "IncludeAccessAnyValidServiceTokenRule", - "IncludeAccessExternalEvaluationRule", - "IncludeAccessExternalEvaluationRuleExternalEvaluation", - "IncludeAccessCountryRule", - "IncludeAccessCountryRuleGeo", - "IncludeAccessAuthenticationMethodRule", - "IncludeAccessAuthenticationMethodRuleAuthMethod", - "IncludeAccessDevicePostureRule", - "IncludeAccessDevicePostureRuleDevicePosture", - "IsDefault", - "IsDefaultAccessEmailRule", - "IsDefaultAccessEmailRuleEmail", - "IsDefaultAccessEmailListRule", - "IsDefaultAccessEmailListRuleEmailList", - "IsDefaultAccessDomainRule", - "IsDefaultAccessDomainRuleEmailDomain", - "IsDefaultAccessEveryoneRule", - "IsDefaultAccessIPRule", - "IsDefaultAccessIPRuleIP", - "IsDefaultAccessIPListRule", - "IsDefaultAccessIPListRuleIPList", - "IsDefaultAccessCertificateRule", - "IsDefaultAccessAccessGroupRule", - "IsDefaultAccessAccessGroupRuleGroup", - "IsDefaultAccessAzureGroupRule", - "IsDefaultAccessAzureGroupRuleAzureAd", - "IsDefaultAccessGitHubOrganizationRule", - "IsDefaultAccessGitHubOrganizationRuleGitHubOrganization", - "IsDefaultAccessGsuiteGroupRule", - "IsDefaultAccessGsuiteGroupRuleGsuite", - "IsDefaultAccessOktaGroupRule", - "IsDefaultAccessOktaGroupRuleOkta", - "IsDefaultAccessSamlGroupRule", - "IsDefaultAccessSamlGroupRuleSaml", - "IsDefaultAccessServiceTokenRule", - "IsDefaultAccessServiceTokenRuleServiceToken", - "IsDefaultAccessAnyValidServiceTokenRule", - "IsDefaultAccessExternalEvaluationRule", - "IsDefaultAccessExternalEvaluationRuleExternalEvaluation", - "IsDefaultAccessCountryRule", - "IsDefaultAccessCountryRuleGeo", - "IsDefaultAccessAuthenticationMethodRule", - "IsDefaultAccessAuthenticationMethodRuleAuthMethod", - "IsDefaultAccessDevicePostureRule", - "IsDefaultAccessDevicePostureRuleDevicePosture", - "Require", - "RequireAccessEmailRule", - "RequireAccessEmailRuleEmail", - "RequireAccessEmailListRule", - "RequireAccessEmailListRuleEmailList", - "RequireAccessDomainRule", - "RequireAccessDomainRuleEmailDomain", - "RequireAccessEveryoneRule", - "RequireAccessIPRule", - "RequireAccessIPRuleIP", - "RequireAccessIPListRule", - "RequireAccessIPListRuleIPList", - "RequireAccessCertificateRule", - "RequireAccessAccessGroupRule", - "RequireAccessAccessGroupRuleGroup", - "RequireAccessAzureGroupRule", - "RequireAccessAzureGroupRuleAzureAd", - "RequireAccessGitHubOrganizationRule", - "RequireAccessGitHubOrganizationRuleGitHubOrganization", - "RequireAccessGsuiteGroupRule", - "RequireAccessGsuiteGroupRuleGsuite", - "RequireAccessOktaGroupRule", - "RequireAccessOktaGroupRuleOkta", - "RequireAccessSamlGroupRule", - "RequireAccessSamlGroupRuleSaml", - "RequireAccessServiceTokenRule", - "RequireAccessServiceTokenRuleServiceToken", - "RequireAccessAnyValidServiceTokenRule", - "RequireAccessExternalEvaluationRule", - "RequireAccessExternalEvaluationRuleExternalEvaluation", - "RequireAccessCountryRule", - "RequireAccessCountryRuleGeo", - "RequireAccessAuthenticationMethodRule", - "RequireAccessAuthenticationMethodRuleAuthMethod", - "RequireAccessDevicePostureRule", - "RequireAccessDevicePostureRuleDevicePosture", -] - - -class ExcludeAccessEmailRuleEmail(BaseModel): - email: str - """The email of the user.""" - - -class ExcludeAccessEmailRule(BaseModel): - email: ExcludeAccessEmailRuleEmail - - -class ExcludeAccessEmailListRuleEmailList(BaseModel): - id: str - """The ID of a previously created email list.""" - - -class ExcludeAccessEmailListRule(BaseModel): - email_list: ExcludeAccessEmailListRuleEmailList - - -class ExcludeAccessDomainRuleEmailDomain(BaseModel): - domain: str - """The email domain to match.""" - - -class ExcludeAccessDomainRule(BaseModel): - email_domain: ExcludeAccessDomainRuleEmailDomain - - -class ExcludeAccessEveryoneRule(BaseModel): - everyone: object - """An empty object which matches on all users.""" - - -class ExcludeAccessIPRuleIP(BaseModel): - ip: str - """An IPv4 or IPv6 CIDR block.""" - - -class ExcludeAccessIPRule(BaseModel): - ip: ExcludeAccessIPRuleIP - - -class ExcludeAccessIPListRuleIPList(BaseModel): - id: str - """The ID of a previously created IP list.""" - - -class ExcludeAccessIPListRule(BaseModel): - ip_list: ExcludeAccessIPListRuleIPList - - -class ExcludeAccessCertificateRule(BaseModel): - certificate: object - - -class ExcludeAccessAccessGroupRuleGroup(BaseModel): - id: str - """The ID of a previously created Access group.""" - - -class ExcludeAccessAccessGroupRule(BaseModel): - group: ExcludeAccessAccessGroupRuleGroup - - -class ExcludeAccessAzureGroupRuleAzureAd(BaseModel): - id: str - """The ID of an Azure group.""" - - connection_id: str - """The ID of your Azure identity provider.""" - - -class ExcludeAccessAzureGroupRule(BaseModel): - azure_ad: ExcludeAccessAzureGroupRuleAzureAd = FieldInfo(alias="azureAD") - - -class ExcludeAccessGitHubOrganizationRuleGitHubOrganization(BaseModel): - connection_id: str - """The ID of your Github identity provider.""" - - name: str - """The name of the organization.""" - - -class ExcludeAccessGitHubOrganizationRule(BaseModel): - github_organization: ExcludeAccessGitHubOrganizationRuleGitHubOrganization = FieldInfo(alias="github-organization") - - -class ExcludeAccessGsuiteGroupRuleGsuite(BaseModel): - connection_id: str - """The ID of your Google Workspace identity provider.""" - - email: str - """The email of the Google Workspace group.""" - - -class ExcludeAccessGsuiteGroupRule(BaseModel): - gsuite: ExcludeAccessGsuiteGroupRuleGsuite - - -class ExcludeAccessOktaGroupRuleOkta(BaseModel): - connection_id: str - """The ID of your Okta identity provider.""" - - email: str - """The email of the Okta group.""" - - -class ExcludeAccessOktaGroupRule(BaseModel): - okta: ExcludeAccessOktaGroupRuleOkta - - -class ExcludeAccessSamlGroupRuleSaml(BaseModel): - attribute_name: str - """The name of the SAML attribute.""" - - attribute_value: str - """The SAML attribute value to look for.""" - - -class ExcludeAccessSamlGroupRule(BaseModel): - saml: ExcludeAccessSamlGroupRuleSaml - - -class ExcludeAccessServiceTokenRuleServiceToken(BaseModel): - token_id: str - """The ID of a Service Token.""" - - -class ExcludeAccessServiceTokenRule(BaseModel): - service_token: ExcludeAccessServiceTokenRuleServiceToken - - -class ExcludeAccessAnyValidServiceTokenRule(BaseModel): - any_valid_service_token: object - """An empty object which matches on all service tokens.""" - - -class ExcludeAccessExternalEvaluationRuleExternalEvaluation(BaseModel): - evaluate_url: str - """The API endpoint containing your business logic.""" - - keys_url: str - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class ExcludeAccessExternalEvaluationRule(BaseModel): - external_evaluation: ExcludeAccessExternalEvaluationRuleExternalEvaluation - - -class ExcludeAccessCountryRuleGeo(BaseModel): - country_code: str - """The country code that should be matched.""" - - -class ExcludeAccessCountryRule(BaseModel): - geo: ExcludeAccessCountryRuleGeo - - -class ExcludeAccessAuthenticationMethodRuleAuthMethod(BaseModel): - auth_method: str - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class ExcludeAccessAuthenticationMethodRule(BaseModel): - auth_method: ExcludeAccessAuthenticationMethodRuleAuthMethod - - -class ExcludeAccessDevicePostureRuleDevicePosture(BaseModel): - integration_uid: str - """The ID of a device posture integration.""" - - -class ExcludeAccessDevicePostureRule(BaseModel): - device_posture: ExcludeAccessDevicePostureRuleDevicePosture - - -Exclude = Union[ - ExcludeAccessEmailRule, - ExcludeAccessEmailListRule, - ExcludeAccessDomainRule, - ExcludeAccessEveryoneRule, - ExcludeAccessIPRule, - ExcludeAccessIPListRule, - ExcludeAccessCertificateRule, - ExcludeAccessAccessGroupRule, - ExcludeAccessAzureGroupRule, - ExcludeAccessGitHubOrganizationRule, - ExcludeAccessGsuiteGroupRule, - ExcludeAccessOktaGroupRule, - ExcludeAccessSamlGroupRule, - ExcludeAccessServiceTokenRule, - ExcludeAccessAnyValidServiceTokenRule, - ExcludeAccessExternalEvaluationRule, - ExcludeAccessCountryRule, - ExcludeAccessAuthenticationMethodRule, - ExcludeAccessDevicePostureRule, -] - - -class IncludeAccessEmailRuleEmail(BaseModel): - email: str - """The email of the user.""" - - -class IncludeAccessEmailRule(BaseModel): - email: IncludeAccessEmailRuleEmail - - -class IncludeAccessEmailListRuleEmailList(BaseModel): - id: str - """The ID of a previously created email list.""" - - -class IncludeAccessEmailListRule(BaseModel): - email_list: IncludeAccessEmailListRuleEmailList - - -class IncludeAccessDomainRuleEmailDomain(BaseModel): - domain: str - """The email domain to match.""" - - -class IncludeAccessDomainRule(BaseModel): - email_domain: IncludeAccessDomainRuleEmailDomain - - -class IncludeAccessEveryoneRule(BaseModel): - everyone: object - """An empty object which matches on all users.""" - - -class IncludeAccessIPRuleIP(BaseModel): - ip: str - """An IPv4 or IPv6 CIDR block.""" - - -class IncludeAccessIPRule(BaseModel): - ip: IncludeAccessIPRuleIP - - -class IncludeAccessIPListRuleIPList(BaseModel): - id: str - """The ID of a previously created IP list.""" - - -class IncludeAccessIPListRule(BaseModel): - ip_list: IncludeAccessIPListRuleIPList - - -class IncludeAccessCertificateRule(BaseModel): - certificate: object - - -class IncludeAccessAccessGroupRuleGroup(BaseModel): - id: str - """The ID of a previously created Access group.""" - - -class IncludeAccessAccessGroupRule(BaseModel): - group: IncludeAccessAccessGroupRuleGroup - - -class IncludeAccessAzureGroupRuleAzureAd(BaseModel): - id: str - """The ID of an Azure group.""" - - connection_id: str - """The ID of your Azure identity provider.""" - - -class IncludeAccessAzureGroupRule(BaseModel): - azure_ad: IncludeAccessAzureGroupRuleAzureAd = FieldInfo(alias="azureAD") - - -class IncludeAccessGitHubOrganizationRuleGitHubOrganization(BaseModel): - connection_id: str - """The ID of your Github identity provider.""" - - name: str - """The name of the organization.""" - - -class IncludeAccessGitHubOrganizationRule(BaseModel): - github_organization: IncludeAccessGitHubOrganizationRuleGitHubOrganization = FieldInfo(alias="github-organization") - - -class IncludeAccessGsuiteGroupRuleGsuite(BaseModel): - connection_id: str - """The ID of your Google Workspace identity provider.""" - - email: str - """The email of the Google Workspace group.""" - - -class IncludeAccessGsuiteGroupRule(BaseModel): - gsuite: IncludeAccessGsuiteGroupRuleGsuite - - -class IncludeAccessOktaGroupRuleOkta(BaseModel): - connection_id: str - """The ID of your Okta identity provider.""" - - email: str - """The email of the Okta group.""" - - -class IncludeAccessOktaGroupRule(BaseModel): - okta: IncludeAccessOktaGroupRuleOkta - - -class IncludeAccessSamlGroupRuleSaml(BaseModel): - attribute_name: str - """The name of the SAML attribute.""" - - attribute_value: str - """The SAML attribute value to look for.""" - - -class IncludeAccessSamlGroupRule(BaseModel): - saml: IncludeAccessSamlGroupRuleSaml - - -class IncludeAccessServiceTokenRuleServiceToken(BaseModel): - token_id: str - """The ID of a Service Token.""" - - -class IncludeAccessServiceTokenRule(BaseModel): - service_token: IncludeAccessServiceTokenRuleServiceToken - - -class IncludeAccessAnyValidServiceTokenRule(BaseModel): - any_valid_service_token: object - """An empty object which matches on all service tokens.""" - - -class IncludeAccessExternalEvaluationRuleExternalEvaluation(BaseModel): - evaluate_url: str - """The API endpoint containing your business logic.""" - - keys_url: str - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class IncludeAccessExternalEvaluationRule(BaseModel): - external_evaluation: IncludeAccessExternalEvaluationRuleExternalEvaluation - - -class IncludeAccessCountryRuleGeo(BaseModel): - country_code: str - """The country code that should be matched.""" - - -class IncludeAccessCountryRule(BaseModel): - geo: IncludeAccessCountryRuleGeo - - -class IncludeAccessAuthenticationMethodRuleAuthMethod(BaseModel): - auth_method: str - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class IncludeAccessAuthenticationMethodRule(BaseModel): - auth_method: IncludeAccessAuthenticationMethodRuleAuthMethod - - -class IncludeAccessDevicePostureRuleDevicePosture(BaseModel): - integration_uid: str - """The ID of a device posture integration.""" - - -class IncludeAccessDevicePostureRule(BaseModel): - device_posture: IncludeAccessDevicePostureRuleDevicePosture - - -Include = Union[ - IncludeAccessEmailRule, - IncludeAccessEmailListRule, - IncludeAccessDomainRule, - IncludeAccessEveryoneRule, - IncludeAccessIPRule, - IncludeAccessIPListRule, - IncludeAccessCertificateRule, - IncludeAccessAccessGroupRule, - IncludeAccessAzureGroupRule, - IncludeAccessGitHubOrganizationRule, - IncludeAccessGsuiteGroupRule, - IncludeAccessOktaGroupRule, - IncludeAccessSamlGroupRule, - IncludeAccessServiceTokenRule, - IncludeAccessAnyValidServiceTokenRule, - IncludeAccessExternalEvaluationRule, - IncludeAccessCountryRule, - IncludeAccessAuthenticationMethodRule, - IncludeAccessDevicePostureRule, -] - - -class IsDefaultAccessEmailRuleEmail(BaseModel): - email: str - """The email of the user.""" - - -class IsDefaultAccessEmailRule(BaseModel): - email: IsDefaultAccessEmailRuleEmail - - -class IsDefaultAccessEmailListRuleEmailList(BaseModel): - id: str - """The ID of a previously created email list.""" - - -class IsDefaultAccessEmailListRule(BaseModel): - email_list: IsDefaultAccessEmailListRuleEmailList - - -class IsDefaultAccessDomainRuleEmailDomain(BaseModel): - domain: str - """The email domain to match.""" - - -class IsDefaultAccessDomainRule(BaseModel): - email_domain: IsDefaultAccessDomainRuleEmailDomain - - -class IsDefaultAccessEveryoneRule(BaseModel): - everyone: object - """An empty object which matches on all users.""" - - -class IsDefaultAccessIPRuleIP(BaseModel): - ip: str - """An IPv4 or IPv6 CIDR block.""" - - -class IsDefaultAccessIPRule(BaseModel): - ip: IsDefaultAccessIPRuleIP - - -class IsDefaultAccessIPListRuleIPList(BaseModel): - id: str - """The ID of a previously created IP list.""" - - -class IsDefaultAccessIPListRule(BaseModel): - ip_list: IsDefaultAccessIPListRuleIPList - - -class IsDefaultAccessCertificateRule(BaseModel): - certificate: object - - -class IsDefaultAccessAccessGroupRuleGroup(BaseModel): - id: str - """The ID of a previously created Access group.""" - - -class IsDefaultAccessAccessGroupRule(BaseModel): - group: IsDefaultAccessAccessGroupRuleGroup - - -class IsDefaultAccessAzureGroupRuleAzureAd(BaseModel): - id: str - """The ID of an Azure group.""" - - connection_id: str - """The ID of your Azure identity provider.""" - - -class IsDefaultAccessAzureGroupRule(BaseModel): - azure_ad: IsDefaultAccessAzureGroupRuleAzureAd = FieldInfo(alias="azureAD") - - -class IsDefaultAccessGitHubOrganizationRuleGitHubOrganization(BaseModel): - connection_id: str - """The ID of your Github identity provider.""" - - name: str - """The name of the organization.""" - - -class IsDefaultAccessGitHubOrganizationRule(BaseModel): - github_organization: IsDefaultAccessGitHubOrganizationRuleGitHubOrganization = FieldInfo( - alias="github-organization" - ) - - -class IsDefaultAccessGsuiteGroupRuleGsuite(BaseModel): - connection_id: str - """The ID of your Google Workspace identity provider.""" - - email: str - """The email of the Google Workspace group.""" - - -class IsDefaultAccessGsuiteGroupRule(BaseModel): - gsuite: IsDefaultAccessGsuiteGroupRuleGsuite - - -class IsDefaultAccessOktaGroupRuleOkta(BaseModel): - connection_id: str - """The ID of your Okta identity provider.""" - - email: str - """The email of the Okta group.""" - - -class IsDefaultAccessOktaGroupRule(BaseModel): - okta: IsDefaultAccessOktaGroupRuleOkta - - -class IsDefaultAccessSamlGroupRuleSaml(BaseModel): - attribute_name: str - """The name of the SAML attribute.""" - - attribute_value: str - """The SAML attribute value to look for.""" - - -class IsDefaultAccessSamlGroupRule(BaseModel): - saml: IsDefaultAccessSamlGroupRuleSaml - - -class IsDefaultAccessServiceTokenRuleServiceToken(BaseModel): - token_id: str - """The ID of a Service Token.""" - - -class IsDefaultAccessServiceTokenRule(BaseModel): - service_token: IsDefaultAccessServiceTokenRuleServiceToken - - -class IsDefaultAccessAnyValidServiceTokenRule(BaseModel): - any_valid_service_token: object - """An empty object which matches on all service tokens.""" - - -class IsDefaultAccessExternalEvaluationRuleExternalEvaluation(BaseModel): - evaluate_url: str - """The API endpoint containing your business logic.""" - - keys_url: str - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class IsDefaultAccessExternalEvaluationRule(BaseModel): - external_evaluation: IsDefaultAccessExternalEvaluationRuleExternalEvaluation - - -class IsDefaultAccessCountryRuleGeo(BaseModel): - country_code: str - """The country code that should be matched.""" - - -class IsDefaultAccessCountryRule(BaseModel): - geo: IsDefaultAccessCountryRuleGeo - - -class IsDefaultAccessAuthenticationMethodRuleAuthMethod(BaseModel): - auth_method: str - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class IsDefaultAccessAuthenticationMethodRule(BaseModel): - auth_method: IsDefaultAccessAuthenticationMethodRuleAuthMethod - - -class IsDefaultAccessDevicePostureRuleDevicePosture(BaseModel): - integration_uid: str - """The ID of a device posture integration.""" - - -class IsDefaultAccessDevicePostureRule(BaseModel): - device_posture: IsDefaultAccessDevicePostureRuleDevicePosture - - -IsDefault = Union[ - IsDefaultAccessEmailRule, - IsDefaultAccessEmailListRule, - IsDefaultAccessDomainRule, - IsDefaultAccessEveryoneRule, - IsDefaultAccessIPRule, - IsDefaultAccessIPListRule, - IsDefaultAccessCertificateRule, - IsDefaultAccessAccessGroupRule, - IsDefaultAccessAzureGroupRule, - IsDefaultAccessGitHubOrganizationRule, - IsDefaultAccessGsuiteGroupRule, - IsDefaultAccessOktaGroupRule, - IsDefaultAccessSamlGroupRule, - IsDefaultAccessServiceTokenRule, - IsDefaultAccessAnyValidServiceTokenRule, - IsDefaultAccessExternalEvaluationRule, - IsDefaultAccessCountryRule, - IsDefaultAccessAuthenticationMethodRule, - IsDefaultAccessDevicePostureRule, -] - - -class RequireAccessEmailRuleEmail(BaseModel): - email: str - """The email of the user.""" - - -class RequireAccessEmailRule(BaseModel): - email: RequireAccessEmailRuleEmail - - -class RequireAccessEmailListRuleEmailList(BaseModel): - id: str - """The ID of a previously created email list.""" - - -class RequireAccessEmailListRule(BaseModel): - email_list: RequireAccessEmailListRuleEmailList - - -class RequireAccessDomainRuleEmailDomain(BaseModel): - domain: str - """The email domain to match.""" - - -class RequireAccessDomainRule(BaseModel): - email_domain: RequireAccessDomainRuleEmailDomain - - -class RequireAccessEveryoneRule(BaseModel): - everyone: object - """An empty object which matches on all users.""" - - -class RequireAccessIPRuleIP(BaseModel): - ip: str - """An IPv4 or IPv6 CIDR block.""" - - -class RequireAccessIPRule(BaseModel): - ip: RequireAccessIPRuleIP - - -class RequireAccessIPListRuleIPList(BaseModel): - id: str - """The ID of a previously created IP list.""" - - -class RequireAccessIPListRule(BaseModel): - ip_list: RequireAccessIPListRuleIPList - - -class RequireAccessCertificateRule(BaseModel): - certificate: object - - -class RequireAccessAccessGroupRuleGroup(BaseModel): - id: str - """The ID of a previously created Access group.""" - - -class RequireAccessAccessGroupRule(BaseModel): - group: RequireAccessAccessGroupRuleGroup - - -class RequireAccessAzureGroupRuleAzureAd(BaseModel): - id: str - """The ID of an Azure group.""" - - connection_id: str - """The ID of your Azure identity provider.""" - - -class RequireAccessAzureGroupRule(BaseModel): - azure_ad: RequireAccessAzureGroupRuleAzureAd = FieldInfo(alias="azureAD") - - -class RequireAccessGitHubOrganizationRuleGitHubOrganization(BaseModel): - connection_id: str - """The ID of your Github identity provider.""" - - name: str - """The name of the organization.""" - - -class RequireAccessGitHubOrganizationRule(BaseModel): - github_organization: RequireAccessGitHubOrganizationRuleGitHubOrganization = FieldInfo(alias="github-organization") - - -class RequireAccessGsuiteGroupRuleGsuite(BaseModel): - connection_id: str - """The ID of your Google Workspace identity provider.""" - - email: str - """The email of the Google Workspace group.""" - - -class RequireAccessGsuiteGroupRule(BaseModel): - gsuite: RequireAccessGsuiteGroupRuleGsuite - - -class RequireAccessOktaGroupRuleOkta(BaseModel): - connection_id: str - """The ID of your Okta identity provider.""" - - email: str - """The email of the Okta group.""" - - -class RequireAccessOktaGroupRule(BaseModel): - okta: RequireAccessOktaGroupRuleOkta - - -class RequireAccessSamlGroupRuleSaml(BaseModel): - attribute_name: str - """The name of the SAML attribute.""" - - attribute_value: str - """The SAML attribute value to look for.""" - - -class RequireAccessSamlGroupRule(BaseModel): - saml: RequireAccessSamlGroupRuleSaml - - -class RequireAccessServiceTokenRuleServiceToken(BaseModel): - token_id: str - """The ID of a Service Token.""" - - -class RequireAccessServiceTokenRule(BaseModel): - service_token: RequireAccessServiceTokenRuleServiceToken - - -class RequireAccessAnyValidServiceTokenRule(BaseModel): - any_valid_service_token: object - """An empty object which matches on all service tokens.""" - - -class RequireAccessExternalEvaluationRuleExternalEvaluation(BaseModel): - evaluate_url: str - """The API endpoint containing your business logic.""" - - keys_url: str - """ - The API endpoint containing the key that Access uses to verify that the response - came from your API. - """ - - -class RequireAccessExternalEvaluationRule(BaseModel): - external_evaluation: RequireAccessExternalEvaluationRuleExternalEvaluation - - -class RequireAccessCountryRuleGeo(BaseModel): - country_code: str - """The country code that should be matched.""" - - -class RequireAccessCountryRule(BaseModel): - geo: RequireAccessCountryRuleGeo - - -class RequireAccessAuthenticationMethodRuleAuthMethod(BaseModel): - auth_method: str - """ - The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. - """ - - -class RequireAccessAuthenticationMethodRule(BaseModel): - auth_method: RequireAccessAuthenticationMethodRuleAuthMethod - - -class RequireAccessDevicePostureRuleDevicePosture(BaseModel): - integration_uid: str - """The ID of a device posture integration.""" - - -class RequireAccessDevicePostureRule(BaseModel): - device_posture: RequireAccessDevicePostureRuleDevicePosture - - -Require = Union[ - RequireAccessEmailRule, - RequireAccessEmailListRule, - RequireAccessDomainRule, - RequireAccessEveryoneRule, - RequireAccessIPRule, - RequireAccessIPListRule, - RequireAccessCertificateRule, - RequireAccessAccessGroupRule, - RequireAccessAzureGroupRule, - RequireAccessGitHubOrganizationRule, - RequireAccessGsuiteGroupRule, - RequireAccessOktaGroupRule, - RequireAccessSamlGroupRule, - RequireAccessServiceTokenRule, - RequireAccessAnyValidServiceTokenRule, - RequireAccessExternalEvaluationRule, - RequireAccessCountryRule, - RequireAccessAuthenticationMethodRule, - RequireAccessDevicePostureRule, -] - - -class ZeroTrustGroups(BaseModel): - id: Optional[str] = None - """UUID""" - - created_at: Optional[datetime] = None - - exclude: Optional[List[Exclude]] = None - """Rules evaluated with a NOT logical operator. - - To match a policy, a user cannot meet any of the Exclude rules. - """ - - include: Optional[List[Include]] = None - """Rules evaluated with an OR logical operator. - - A user needs to meet only one of the Include rules. - """ - - is_default: Optional[List[IsDefault]] = None - """Rules evaluated with an AND logical operator. - - To match a policy, a user must meet all of the Require rules. - """ - - name: Optional[str] = None - """The name of the Access group.""" - - require: Optional[List[Require]] = None - """Rules evaluated with an AND logical operator. - - To match a policy, a user must meet all of the Require rules. - """ - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_service_tokens.py b/src/cloudflare/types/zero_trust/access/zero_trust_service_tokens.py deleted file mode 100644 index 7a521c84758..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_service_tokens.py +++ /dev/null @@ -1,33 +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__ = ["ZeroTrustServiceTokens"] - - -class ZeroTrustServiceTokens(BaseModel): - id: Optional[object] = None - """The ID of the service token.""" - - client_id: Optional[str] = None - """The Client ID for the service token. - - Access will check for this value in the `CF-Access-Client-ID` request header. - """ - - created_at: Optional[datetime] = None - - duration: Optional[str] = None - """The duration for how long the service token will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. The default is 1 year in hours (8760h). - """ - - name: Optional[str] = None - """The name of the service token.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_tag.py b/src/cloudflare/types/zero_trust/access/zero_trust_tag.py deleted file mode 100644 index 0c6838a56ae..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_tag.py +++ /dev/null @@ -1,20 +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__ = ["ZeroTrustTag"] - - -class ZeroTrustTag(BaseModel): - name: str - """The name of the tag""" - - app_count: Optional[int] = None - """The number of applications that have this tag""" - - created_at: Optional[datetime] = None - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access/zero_trust_users.py b/src/cloudflare/types/zero_trust/access/zero_trust_users.py deleted file mode 100644 index df60d7a1ecf..00000000000 --- a/src/cloudflare/types/zero_trust/access/zero_trust_users.py +++ /dev/null @@ -1,41 +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__ = ["ZeroTrustUsers"] - - -class ZeroTrustUsers(BaseModel): - id: Optional[str] = None - """UUID""" - - access_seat: Optional[bool] = None - """True if the user has authenticated with Cloudflare Access.""" - - active_device_count: Optional[float] = None - """The number of active devices registered to the user.""" - - created_at: Optional[datetime] = None - - email: Optional[str] = None - """The email of the user.""" - - gateway_seat: Optional[bool] = None - """True if the user has logged into the WARP client.""" - - last_successful_login: Optional[datetime] = None - """The time at which the user last successfully logged in.""" - - name: Optional[str] = None - """The name of the user.""" - - seat_uid: Optional[str] = None - """The unique API identifier for the Zero Trust seat.""" - - uid: Optional[str] = None - """The unique API identifier for the user.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/access_device_posture_rule.py b/src/cloudflare/types/zero_trust/access_device_posture_rule.py new file mode 100644 index 00000000000..7465d128873 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access_device_posture_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["AccessDevicePostureRule", "DevicePosture"] + + +class DevicePosture(BaseModel): + integration_uid: str + """The ID of a device posture integration.""" + + +class AccessDevicePostureRule(BaseModel): + device_posture: DevicePosture diff --git a/src/cloudflare/types/zero_trust/access_device_posture_rule_param.py b/src/cloudflare/types/zero_trust/access_device_posture_rule_param.py new file mode 100644 index 00000000000..d67cc39b2c3 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access_device_posture_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["AccessDevicePostureRuleParam", "DevicePosture"] + + +class DevicePosture(TypedDict, total=False): + integration_uid: Required[str] + """The ID of a device posture integration.""" + + +class AccessDevicePostureRuleParam(TypedDict, total=False): + device_posture: Required[DevicePosture] diff --git a/src/cloudflare/types/zero_trust/access_rule.py b/src/cloudflare/types/zero_trust/access_rule.py new file mode 100644 index 00000000000..18ea411a51c --- /dev/null +++ b/src/cloudflare/types/zero_trust/access_rule.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +from .ip_rule import IPRule +from .email_rule import EmailRule +from .group_rule import GroupRule +from .domain_rule import DomainRule +from .country_rule import CountryRule +from .ip_list_rule import IPListRule +from .everyone_rule import EveryoneRule +from .email_list_rule import EmailListRule +from .okta_group_rule import OktaGroupRule +from .saml_group_rule import SAMLGroupRule +from .azure_group_rule import AzureGroupRule +from .certificate_rule import CertificateRule +from .gsuite_group_rule import GSuiteGroupRule +from .service_token_rule import ServiceTokenRule +from .external_evaluation_rule import ExternalEvaluationRule +from .github_organization_rule import GitHubOrganizationRule +from .access_device_posture_rule import AccessDevicePostureRule +from .authentication_method_rule import AuthenticationMethodRule +from .any_valid_service_token_rule import AnyValidServiceTokenRule + +__all__ = ["AccessRule"] + +AccessRule = Union[ + EmailRule, + EmailListRule, + DomainRule, + EveryoneRule, + IPRule, + IPListRule, + CertificateRule, + GroupRule, + AzureGroupRule, + GitHubOrganizationRule, + GSuiteGroupRule, + OktaGroupRule, + SAMLGroupRule, + ServiceTokenRule, + AnyValidServiceTokenRule, + ExternalEvaluationRule, + CountryRule, + AuthenticationMethodRule, + AccessDevicePostureRule, +] diff --git a/src/cloudflare/types/zero_trust/access_rule_param.py b/src/cloudflare/types/zero_trust/access_rule_param.py new file mode 100644 index 00000000000..2aa7dfd4a41 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access_rule_param.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union + +from .ip_rule_param import IPRuleParam +from .email_rule_param import EmailRuleParam +from .group_rule_param import GroupRuleParam +from .domain_rule_param import DomainRuleParam +from .country_rule_param import CountryRuleParam +from .ip_list_rule_param import IPListRuleParam +from .everyone_rule_param import EveryoneRuleParam +from .email_list_rule_param import EmailListRuleParam +from .okta_group_rule_param import OktaGroupRuleParam +from .saml_group_rule_param import SAMLGroupRuleParam +from .azure_group_rule_param import AzureGroupRuleParam +from .certificate_rule_param import CertificateRuleParam +from .gsuite_group_rule_param import GSuiteGroupRuleParam +from .service_token_rule_param import ServiceTokenRuleParam +from .external_evaluation_rule_param import ExternalEvaluationRuleParam +from .github_organization_rule_param import GitHubOrganizationRuleParam +from .access_device_posture_rule_param import AccessDevicePostureRuleParam +from .authentication_method_rule_param import AuthenticationMethodRuleParam +from .any_valid_service_token_rule_param import AnyValidServiceTokenRuleParam + +__all__ = ["AccessRuleParam"] + +AccessRuleParam = Union[ + EmailRuleParam, + EmailListRuleParam, + DomainRuleParam, + EveryoneRuleParam, + IPRuleParam, + IPListRuleParam, + CertificateRuleParam, + GroupRuleParam, + AzureGroupRuleParam, + GitHubOrganizationRuleParam, + GSuiteGroupRuleParam, + OktaGroupRuleParam, + SAMLGroupRuleParam, + ServiceTokenRuleParam, + AnyValidServiceTokenRuleParam, + ExternalEvaluationRuleParam, + CountryRuleParam, + AuthenticationMethodRuleParam, + AccessDevicePostureRuleParam, +] diff --git a/src/cloudflare/types/zero_trust/any_valid_service_token_rule.py b/src/cloudflare/types/zero_trust/any_valid_service_token_rule.py new file mode 100644 index 00000000000..2613ccdd5fd --- /dev/null +++ b/src/cloudflare/types/zero_trust/any_valid_service_token_rule.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["AnyValidServiceTokenRule"] + + +class AnyValidServiceTokenRule(BaseModel): + any_valid_service_token: object + """An empty object which matches on all service tokens.""" diff --git a/src/cloudflare/types/zero_trust/any_valid_service_token_rule_param.py b/src/cloudflare/types/zero_trust/any_valid_service_token_rule_param.py new file mode 100644 index 00000000000..462d4957f89 --- /dev/null +++ b/src/cloudflare/types/zero_trust/any_valid_service_token_rule_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["AnyValidServiceTokenRuleParam"] + + +class AnyValidServiceTokenRuleParam(TypedDict, total=False): + any_valid_service_token: Required[object] + """An empty object which matches on all service tokens.""" diff --git a/src/cloudflare/types/zero_trust/authentication_method_rule.py b/src/cloudflare/types/zero_trust/authentication_method_rule.py new file mode 100644 index 00000000000..6c95a0f424b --- /dev/null +++ b/src/cloudflare/types/zero_trust/authentication_method_rule.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["AuthenticationMethodRule", "AuthMethod"] + + +class AuthMethod(BaseModel): + auth_method: str + """ + The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + """ + + +class AuthenticationMethodRule(BaseModel): + auth_method: AuthMethod diff --git a/src/cloudflare/types/zero_trust/authentication_method_rule_param.py b/src/cloudflare/types/zero_trust/authentication_method_rule_param.py new file mode 100644 index 00000000000..369c85cbe30 --- /dev/null +++ b/src/cloudflare/types/zero_trust/authentication_method_rule_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["AuthenticationMethodRuleParam", "AuthMethod"] + + +class AuthMethod(TypedDict, total=False): + auth_method: Required[str] + """ + The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + """ + + +class AuthenticationMethodRuleParam(TypedDict, total=False): + auth_method: Required[AuthMethod] diff --git a/src/cloudflare/types/zero_trust/azure_ad.py b/src/cloudflare/types/zero_trust/azure_ad.py new file mode 100644 index 00000000000..2d8690b282a --- /dev/null +++ b/src/cloudflare/types/zero_trust/azure_ad.py @@ -0,0 +1,74 @@ +# 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 +from .scim_config import ScimConfig +from .identity_provider_type import IdentityProviderType + +__all__ = ["AzureAD", "Config"] + + +class Config(BaseModel): + claims: Optional[List[str]] = None + """Custom claims""" + + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" + + conditional_access_enabled: Optional[bool] = None + """Should Cloudflare try to load authentication contexts from your account""" + + directory_id: Optional[str] = None + """Your Azure directory uuid""" + + email_claim_name: Optional[str] = None + """The claim name for email in the id_token response.""" + + prompt: Optional[Literal["login", "select_account", "none"]] = None + """Indicates the type of user interaction that is required. + + prompt=login forces the user to enter their credentials on that request, + negating single-sign on. prompt=none is the opposite. It ensures that the user + isn't presented with any interactive prompt. If the request can't be completed + silently by using single-sign on, the Microsoft identity platform returns an + interaction_required error. prompt=select_account interrupts single sign-on + providing account selection experience listing all the accounts either in + session or any remembered account or an option to choose to use a different + account altogether. + """ + + support_groups: Optional[bool] = None + """Should Cloudflare try to load groups from your account""" + + +class AzureAD(BaseModel): + config: Config + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ diff --git a/src/cloudflare/types/zero_trust/azure_group_rule.py b/src/cloudflare/types/zero_trust/azure_group_rule.py new file mode 100644 index 00000000000..aecd2930885 --- /dev/null +++ b/src/cloudflare/types/zero_trust/azure_group_rule.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["AzureGroupRule", "AzureAD"] + + +class AzureAD(BaseModel): + id: str + """The ID of an Azure group.""" + + connection_id: str + """The ID of your Azure identity provider.""" + + +class AzureGroupRule(BaseModel): + azure_ad: AzureAD = FieldInfo(alias="azureAD") diff --git a/src/cloudflare/types/zero_trust/azure_group_rule_param.py b/src/cloudflare/types/zero_trust/azure_group_rule_param.py new file mode 100644 index 00000000000..93a64fab94e --- /dev/null +++ b/src/cloudflare/types/zero_trust/azure_group_rule_param.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, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["AzureGroupRuleParam", "AzureAD"] + + +class AzureAD(TypedDict, total=False): + id: Required[str] + """The ID of an Azure group.""" + + connection_id: Required[str] + """The ID of your Azure identity provider.""" + + +class AzureGroupRuleParam(TypedDict, total=False): + azure_ad: Required[Annotated[AzureAD, PropertyInfo(alias="azureAD")]] diff --git a/src/cloudflare/types/zero_trust/certificate_rule.py b/src/cloudflare/types/zero_trust/certificate_rule.py new file mode 100644 index 00000000000..5327168c525 --- /dev/null +++ b/src/cloudflare/types/zero_trust/certificate_rule.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["CertificateRule"] + + +class CertificateRule(BaseModel): + certificate: object diff --git a/src/cloudflare/types/zero_trust/certificate_rule_param.py b/src/cloudflare/types/zero_trust/certificate_rule_param.py new file mode 100644 index 00000000000..a93d12ae10b --- /dev/null +++ b/src/cloudflare/types/zero_trust/certificate_rule_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CertificateRuleParam"] + + +class CertificateRuleParam(TypedDict, total=False): + certificate: Required[object] diff --git a/src/cloudflare/types/zero_trust/connection.py b/src/cloudflare/types/zero_trust/connection.py new file mode 100644 index 00000000000..9d1f58e7fe1 --- /dev/null +++ b/src/cloudflare/types/zero_trust/connection.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Connection"] + + +class Connection(BaseModel): + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" diff --git a/src/cloudflare/types/zero_trust/country_rule.py b/src/cloudflare/types/zero_trust/country_rule.py new file mode 100644 index 00000000000..a2bb9437377 --- /dev/null +++ b/src/cloudflare/types/zero_trust/country_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["CountryRule", "Geo"] + + +class Geo(BaseModel): + country_code: str + """The country code that should be matched.""" + + +class CountryRule(BaseModel): + geo: Geo diff --git a/src/cloudflare/types/zero_trust/country_rule_param.py b/src/cloudflare/types/zero_trust/country_rule_param.py new file mode 100644 index 00000000000..f6cc5b28073 --- /dev/null +++ b/src/cloudflare/types/zero_trust/country_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CountryRuleParam", "Geo"] + + +class Geo(TypedDict, total=False): + country_code: Required[str] + """The country code that should be matched.""" + + +class CountryRuleParam(TypedDict, total=False): + geo: Required[Geo] diff --git a/src/cloudflare/types/zero_trust/device.py b/src/cloudflare/types/zero_trust/device.py new file mode 100644 index 00000000000..41c7eba972d --- /dev/null +++ b/src/cloudflare/types/zero_trust/device.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Device", "User"] + + +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 Device(BaseModel): + id: Optional[str] = None + """Device ID.""" + + created: Optional[datetime] = None + """When the device was created.""" + + deleted: Optional[bool] = None + """True if the device was deleted.""" + + device_type: Optional[Literal["windows", "mac", "linux", "android", "ios"]] = None + + ip: Optional[str] = None + """IPv4 or IPv6 address.""" + + key: Optional[str] = None + """The device's public key.""" + + last_seen: Optional[datetime] = None + """When the device last connected to Cloudflare services.""" + + mac_address: Optional[str] = None + """The device mac address.""" + + manufacturer: Optional[str] = None + """The device manufacturer name.""" + + model: Optional[str] = None + """The device model name.""" + + name: Optional[str] = None + """The device name.""" + + os_distro_name: Optional[str] = None + """The Linux distro name.""" + + os_distro_revision: Optional[str] = None + """The Linux distro revision.""" + + os_version: Optional[str] = None + """The operating system version.""" + + os_version_extra: Optional[str] = None + """The operating system version extra parameter.""" + + revoked_at: Optional[datetime] = None + """When the device was revoked.""" + + serial_number: Optional[str] = None + """The device serial number.""" + + 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/device_experience_monitor.py b/src/cloudflare/types/zero_trust/device_experience_monitor.py new file mode 100644 index 00000000000..ca07797fd0a --- /dev/null +++ b/src/cloudflare/types/zero_trust/device_experience_monitor.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["DeviceExperienceMonitor"] + + +class DeviceExperienceMonitor(BaseModel): + id: str + + default: bool + """Whether the policy is the default for the account""" + + name: str diff --git a/src/cloudflare/types/zero_trust/device_get_response.py b/src/cloudflare/types/zero_trust/device_get_response.py index 0365cadad59..8bc4c694795 100644 --- a/src/cloudflare/types/zero_trust/device_get_response.py +++ b/src/cloudflare/types/zero_trust/device_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["DeviceGetResponse"] -DeviceGetResponse = Union[str, object, None] +DeviceGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/devices/__init__.py b/src/cloudflare/types/zero_trust/devices/__init__.py index 138d36d47e8..cdcdaa700c9 100644 --- a/src/cloudflare/types/zero_trust/devices/__init__.py +++ b/src/cloudflare/types/zero_trust/devices/__init__.py @@ -2,26 +2,64 @@ from __future__ import annotations +from .file_input import FileInput as FileInput +from .schema_data import SchemaData as SchemaData +from .schema_http import SchemaHTTP as SchemaHTTP +from .device_input import DeviceInput as DeviceInput +from .device_match import DeviceMatch as DeviceMatch +from .intune_input import IntuneInput as IntuneInput +from .kolide_input import KolideInput as KolideInput +from .tanium_input import TaniumInput as TaniumInput +from .device_network import DeviceNetwork as DeviceNetwork +from .firewall_input import FirewallInput as FirewallInput +from .device_settings import DeviceSettings as DeviceSettings +from .settings_policy import SettingsPolicy as SettingsPolicy +from .file_input_param import FileInputParam as FileInputParam +from .os_version_input import OSVersionInput as OSVersionInput +from .carbonblack_input import CarbonblackInput as CarbonblackInput +from .crowdstrike_input import CrowdstrikeInput as CrowdstrikeInput +from .schema_data_param import SchemaDataParam as SchemaDataParam +from .sentinelone_input import SentineloneInput as SentineloneInput +from .device_input_param import DeviceInputParam as DeviceInputParam +from .device_match_param import DeviceMatchParam as DeviceMatchParam +from .intune_input_param import IntuneInputParam as IntuneInputParam +from .kolide_input_param import KolideInputParam as KolideInputParam from .policy_edit_params import PolicyEditParams as PolicyEditParams -from .device_posture_rules import DevicePostureRules as DevicePostureRules +from .tanium_input_param import TaniumInputParam as TaniumInputParam +from .device_posture_rule import DevicePostureRule as DevicePostureRule +from .domain_joined_input import DomainJoinedInput as DomainJoinedInput +from .workspace_one_input import WorkspaceOneInput as WorkspaceOneInput +from .firewall_input_param import FirewallInputParam as FirewallInputParam from .policy_create_params import PolicyCreateParams as PolicyCreateParams +from .policy_delete_params import PolicyDeleteParams as PolicyDeleteParams from .revoke_create_params import RevokeCreateParams as RevokeCreateParams -from .dex_test_schemas_http import DEXTestSchemasHTTP as DEXTestSchemasHTTP +from .disk_encryption_input import DiskEncryptionInput as DiskEncryptionInput from .network_create_params import NetworkCreateParams as NetworkCreateParams +from .network_delete_params import NetworkDeleteParams as NetworkDeleteParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .posture_create_params import PostureCreateParams as PostureCreateParams +from .posture_delete_params import PostureDeleteParams as PostureDeleteParams from .posture_update_params import PostureUpdateParams as PostureUpdateParams +from .sentinelone_s2s_input import SentineloneS2sInput as SentineloneS2sInput from .setting_update_params import SettingUpdateParams as SettingUpdateParams from .dex_test_create_params import DEXTestCreateParams as DEXTestCreateParams from .dex_test_update_params import DEXTestUpdateParams as DEXTestUpdateParams +from .os_version_input_param import OSVersionInputParam as OSVersionInputParam from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse from .revoke_create_response import RevokeCreateResponse as RevokeCreateResponse +from .unique_client_id_input import UniqueClientIDInput as UniqueClientIDInput from .unrevoke_create_params import UnrevokeCreateParams as UnrevokeCreateParams -from .device_managed_networks import DeviceManagedNetworks as DeviceManagedNetworks +from .crowdstrike_input_param import CrowdstrikeInputParam as CrowdstrikeInputParam from .network_delete_response import NetworkDeleteResponse as NetworkDeleteResponse from .posture_delete_response import PostureDeleteResponse as PostureDeleteResponse +from .sentinelone_input_param import SentineloneInputParam as SentineloneInputParam +from .client_certificate_input import ClientCertificateInput as ClientCertificateInput from .dex_test_delete_response import DEXTestDeleteResponse as DEXTestDeleteResponse from .unrevoke_create_response import UnrevokeCreateResponse as UnrevokeCreateResponse +from .domain_joined_input_param import DomainJoinedInputParam as DomainJoinedInputParam +from .workspace_one_input_param import WorkspaceOneInputParam as WorkspaceOneInputParam +from .disk_encryption_input_param import DiskEncryptionInputParam as DiskEncryptionInputParam from .override_code_list_response import OverrideCodeListResponse as OverrideCodeListResponse -from .devices_device_settings_policy import DevicesDeviceSettingsPolicy as DevicesDeviceSettingsPolicy -from .zero_trust_account_device_settings import ZeroTrustAccountDeviceSettings as ZeroTrustAccountDeviceSettings +from .sentinelone_s2s_input_param import SentineloneS2sInputParam as SentineloneS2sInputParam +from .unique_client_id_input_param import UniqueClientIDInputParam as UniqueClientIDInputParam +from .client_certificate_input_param import ClientCertificateInputParam as ClientCertificateInputParam diff --git a/src/cloudflare/types/zero_trust/devices/carbonblack_input.py b/src/cloudflare/types/zero_trust/devices/carbonblack_input.py new file mode 100644 index 00000000000..d28931df22c --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/carbonblack_input.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["CarbonblackInput"] + +CarbonblackInput = str diff --git a/src/cloudflare/types/zero_trust/devices/client_certificate_input.py b/src/cloudflare/types/zero_trust/devices/client_certificate_input.py new file mode 100644 index 00000000000..f1884b8bcdc --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/client_certificate_input.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["ClientCertificateInput"] + + +class ClientCertificateInput(BaseModel): + certificate_id: str + """UUID of Cloudflare managed certificate.""" + + cn: str + """Common Name that is protected by the certificate""" diff --git a/src/cloudflare/types/zero_trust/devices/client_certificate_input_param.py b/src/cloudflare/types/zero_trust/devices/client_certificate_input_param.py new file mode 100644 index 00000000000..626f69e4a32 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/client_certificate_input_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ClientCertificateInputParam"] + + +class ClientCertificateInputParam(TypedDict, total=False): + certificate_id: Required[str] + """UUID of Cloudflare managed certificate.""" + + cn: Required[str] + """Common Name that is protected by the certificate""" diff --git a/src/cloudflare/types/zero_trust/devices/crowdstrike_input.py b/src/cloudflare/types/zero_trust/devices/crowdstrike_input.py new file mode 100644 index 00000000000..b46afbf4142 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/crowdstrike_input.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["CrowdstrikeInput"] + + +class CrowdstrikeInput(BaseModel): + connection_id: str + """Posture Integration ID.""" + + last_seen: Optional[str] = None + """For more details on last seen, please refer to the Crowdstrike documentation.""" + + operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = None + """operator""" + + os: Optional[str] = None + """Os Version""" + + overall: Optional[str] = None + """overall""" + + sensor_config: Optional[str] = None + """SensorConfig""" + + state: Optional[Literal["online", "offline", "unknown"]] = None + """For more details on state, please refer to the Crowdstrike documentation.""" + + version: Optional[str] = None + """Version""" + + version_operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = FieldInfo(alias="versionOperator", default=None) + """Version Operator""" diff --git a/src/cloudflare/types/zero_trust/devices/crowdstrike_input_param.py b/src/cloudflare/types/zero_trust/devices/crowdstrike_input_param.py new file mode 100644 index 00000000000..7cc4fc7e593 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/crowdstrike_input_param.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["CrowdstrikeInputParam"] + + +class CrowdstrikeInputParam(TypedDict, total=False): + connection_id: Required[str] + """Posture Integration ID.""" + + last_seen: str + """For more details on last seen, please refer to the Crowdstrike documentation.""" + + operator: Literal["<", "<=", ">", ">=", "=="] + """operator""" + + os: str + """Os Version""" + + overall: str + """overall""" + + sensor_config: str + """SensorConfig""" + + state: Literal["online", "offline", "unknown"] + """For more details on state, please refer to the Crowdstrike documentation.""" + + version: str + """Version""" + + version_operator: Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="versionOperator")] + """Version Operator""" diff --git a/src/cloudflare/types/zero_trust/devices/device_input.py b/src/cloudflare/types/zero_trust/devices/device_input.py new file mode 100644 index 00000000000..a6f97bd41f3 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/device_input.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from ...._models import BaseModel +from .file_input import FileInput +from .intune_input import IntuneInput +from .kolide_input import KolideInput +from .tanium_input import TaniumInput +from .firewall_input import FirewallInput +from .os_version_input import OSVersionInput +from .crowdstrike_input import CrowdstrikeInput +from .sentinelone_input import SentineloneInput +from .domain_joined_input import DomainJoinedInput +from .workspace_one_input import WorkspaceOneInput +from .disk_encryption_input import DiskEncryptionInput +from .sentinelone_s2s_input import SentineloneS2sInput +from .unique_client_id_input import UniqueClientIDInput +from .client_certificate_input import ClientCertificateInput + +__all__ = ["DeviceInput", "TeamsDevicesCarbonblackInputRequest", "TeamsDevicesApplicationInputRequest"] + + +class TeamsDevicesCarbonblackInputRequest(BaseModel): + operating_system: Literal["windows", "linux", "mac"] + """Operating system""" + + path: str + """File path.""" + + sha256: Optional[str] = None + """SHA-256.""" + + thumbprint: Optional[str] = None + """Signing certificate thumbprint.""" + + +class TeamsDevicesApplicationInputRequest(BaseModel): + operating_system: Literal["windows", "linux", "mac"] + """Operating system""" + + path: str + """Path for the application.""" + + sha256: Optional[str] = None + """SHA-256.""" + + thumbprint: Optional[str] = None + """Signing certificate thumbprint.""" + + +DeviceInput = Union[ + FileInput, + UniqueClientIDInput, + DomainJoinedInput, + OSVersionInput, + FirewallInput, + SentineloneInput, + TeamsDevicesCarbonblackInputRequest, + DiskEncryptionInput, + TeamsDevicesApplicationInputRequest, + ClientCertificateInput, + WorkspaceOneInput, + CrowdstrikeInput, + IntuneInput, + KolideInput, + TaniumInput, + SentineloneS2sInput, +] diff --git a/src/cloudflare/types/zero_trust/devices/device_input_param.py b/src/cloudflare/types/zero_trust/devices/device_input_param.py new file mode 100644 index 00000000000..9ec80edd418 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/device_input_param.py @@ -0,0 +1,71 @@ +# 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, TypedDict + +from .file_input_param import FileInputParam +from .intune_input_param import IntuneInputParam +from .kolide_input_param import KolideInputParam +from .tanium_input_param import TaniumInputParam +from .firewall_input_param import FirewallInputParam +from .os_version_input_param import OSVersionInputParam +from .crowdstrike_input_param import CrowdstrikeInputParam +from .sentinelone_input_param import SentineloneInputParam +from .domain_joined_input_param import DomainJoinedInputParam +from .workspace_one_input_param import WorkspaceOneInputParam +from .disk_encryption_input_param import DiskEncryptionInputParam +from .sentinelone_s2s_input_param import SentineloneS2sInputParam +from .unique_client_id_input_param import UniqueClientIDInputParam +from .client_certificate_input_param import ClientCertificateInputParam + +__all__ = ["DeviceInputParam", "TeamsDevicesCarbonblackInputRequest", "TeamsDevicesApplicationInputRequest"] + + +class TeamsDevicesCarbonblackInputRequest(TypedDict, total=False): + operating_system: Required[Literal["windows", "linux", "mac"]] + """Operating system""" + + path: Required[str] + """File path.""" + + sha256: str + """SHA-256.""" + + thumbprint: str + """Signing certificate thumbprint.""" + + +class TeamsDevicesApplicationInputRequest(TypedDict, total=False): + operating_system: Required[Literal["windows", "linux", "mac"]] + """Operating system""" + + path: Required[str] + """Path for the application.""" + + sha256: str + """SHA-256.""" + + thumbprint: str + """Signing certificate thumbprint.""" + + +DeviceInputParam = Union[ + FileInputParam, + UniqueClientIDInputParam, + DomainJoinedInputParam, + OSVersionInputParam, + FirewallInputParam, + SentineloneInputParam, + TeamsDevicesCarbonblackInputRequest, + DiskEncryptionInputParam, + TeamsDevicesApplicationInputRequest, + ClientCertificateInputParam, + WorkspaceOneInputParam, + CrowdstrikeInputParam, + IntuneInputParam, + KolideInputParam, + TaniumInputParam, + SentineloneS2sInputParam, +] diff --git a/src/cloudflare/types/zero_trust/devices/device_managed_networks.py b/src/cloudflare/types/zero_trust/devices/device_managed_networks.py deleted file mode 100644 index b0d21f88d0b..00000000000 --- a/src/cloudflare/types/zero_trust/devices/device_managed_networks.py +++ /dev/null @@ -1,40 +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__ = ["DeviceManagedNetworks", "Config"] - - -class Config(BaseModel): - tls_sockaddr: str - """ - A network address of the form "host:port" that the WARP client will use to - detect the presence of a TLS host. - """ - - sha256: Optional[str] = None - """ - The SHA-256 hash of the TLS certificate presented by the host found at - tls_sockaddr. If absent, regular certificate verification (trusted roots, valid - timestamp, etc) will be used to validate the certificate. - """ - - -class DeviceManagedNetworks(BaseModel): - config: Optional[Config] = None - """ - The configuration object containing information for the WARP client to detect - the managed network. - """ - - name: Optional[str] = None - """The name of the device managed network. This name must be unique.""" - - network_id: Optional[str] = None - """API UUID.""" - - type: Optional[Literal["tls"]] = None - """The type of device managed network.""" diff --git a/src/cloudflare/types/zero_trust/devices/device_match.py b/src/cloudflare/types/zero_trust/devices/device_match.py new file mode 100644 index 00000000000..719a707d6f2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/device_match.py @@ -0,0 +1,12 @@ +# 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__ = ["DeviceMatch"] + + +class DeviceMatch(BaseModel): + platform: Optional[Literal["windows", "mac", "linux", "android", "ios"]] = None diff --git a/src/cloudflare/types/zero_trust/devices/device_match_param.py b/src/cloudflare/types/zero_trust/devices/device_match_param.py new file mode 100644 index 00000000000..8ecbc486e4f --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/device_match_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["DeviceMatchParam"] + + +class DeviceMatchParam(TypedDict, total=False): + platform: Literal["windows", "mac", "linux", "android", "ios"] diff --git a/src/cloudflare/types/zero_trust/devices/device_network.py b/src/cloudflare/types/zero_trust/devices/device_network.py new file mode 100644 index 00000000000..db154213768 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/device_network.py @@ -0,0 +1,40 @@ +# 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__ = ["DeviceNetwork", "Config"] + + +class Config(BaseModel): + tls_sockaddr: str + """ + A network address of the form "host:port" that the WARP client will use to + detect the presence of a TLS host. + """ + + sha256: Optional[str] = None + """ + The SHA-256 hash of the TLS certificate presented by the host found at + tls_sockaddr. If absent, regular certificate verification (trusted roots, valid + timestamp, etc) will be used to validate the certificate. + """ + + +class DeviceNetwork(BaseModel): + config: Optional[Config] = None + """ + The configuration object containing information for the WARP client to detect + the managed network. + """ + + name: Optional[str] = None + """The name of the device managed network. This name must be unique.""" + + network_id: Optional[str] = None + """API UUID.""" + + type: Optional[Literal["tls"]] = None + """The type of device managed network.""" diff --git a/src/cloudflare/types/zero_trust/devices/device_posture_rule.py b/src/cloudflare/types/zero_trust/devices/device_posture_rule.py new file mode 100644 index 00000000000..1817b557e0b --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/device_posture_rule.py @@ -0,0 +1,65 @@ +# 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 +from .device_input import DeviceInput +from .device_match import DeviceMatch + +__all__ = ["DevicePostureRule"] + + +class DevicePostureRule(BaseModel): + id: Optional[str] = None + """API UUID.""" + + description: Optional[str] = None + """The description of the device posture rule.""" + + expiration: Optional[str] = None + """Sets the expiration time for a posture check result. + + If empty, the result remains valid until it is overwritten by new data from the + WARP client. + """ + + input: Optional[DeviceInput] = None + """The value to be checked against.""" + + match: Optional[List[DeviceMatch]] = None + """The conditions that the client must match to run the rule.""" + + name: Optional[str] = None + """The name of the device posture rule.""" + + schedule: Optional[str] = None + """Polling frequency for the WARP client posture check. + + Default: `5m` (poll every five minutes). Minimum: `1m`. + """ + + type: Optional[ + Literal[ + "file", + "application", + "tanium", + "gateway", + "warp", + "disk_encryption", + "sentinelone", + "carbonblack", + "firewall", + "os_version", + "domain_joined", + "client_certificate", + "unique_client_id", + "kolide", + "tanium_s2s", + "crowdstrike_s2s", + "intune", + "workspace_one", + "sentinelone_s2s", + ] + ] = None + """The type of device posture rule.""" diff --git a/src/cloudflare/types/zero_trust/devices/device_posture_rules.py b/src/cloudflare/types/zero_trust/devices/device_posture_rules.py deleted file mode 100644 index 0ec5ff47a90..00000000000 --- a/src/cloudflare/types/zero_trust/devices/device_posture_rules.py +++ /dev/null @@ -1,328 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "DevicePostureRules", - "Input", - "InputTeamsDevicesFileInputRequest", - "InputTeamsDevicesUniqueClientIDInputRequest", - "InputTeamsDevicesDomainJoinedInputRequest", - "InputTeamsDevicesOSVersionInputRequest", - "InputTeamsDevicesFirewallInputRequest", - "InputTeamsDevicesSentineloneInputRequest", - "InputTeamsDevicesCarbonblackInputRequest", - "InputTeamsDevicesDiskEncryptionInputRequest", - "InputTeamsDevicesApplicationInputRequest", - "InputTeamsDevicesClientCertificateInputRequest", - "InputTeamsDevicesWorkspaceOneInputRequest", - "InputTeamsDevicesCrowdstrikeInputRequest", - "InputTeamsDevicesIntuneInputRequest", - "InputTeamsDevicesKolideInputRequest", - "InputTeamsDevicesTaniumInputRequest", - "InputTeamsDevicesSentineloneS2sInputRequest", - "Match", -] - - -class InputTeamsDevicesFileInputRequest(BaseModel): - operating_system: Literal["windows", "linux", "mac"] - """Operating system""" - - path: str - """File path.""" - - exists: Optional[bool] = None - """Whether or not file exists""" - - sha256: Optional[str] = None - """SHA-256.""" - - thumbprint: Optional[str] = None - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesUniqueClientIDInputRequest(BaseModel): - id: str - """List ID.""" - - operating_system: Literal["android", "ios", "chromeos"] - """Operating System""" - - -class InputTeamsDevicesDomainJoinedInputRequest(BaseModel): - operating_system: Literal["windows"] - """Operating System""" - - domain: Optional[str] = None - """Domain""" - - -class InputTeamsDevicesOSVersionInputRequest(BaseModel): - operating_system: Literal["windows"] - """Operating System""" - - operator: Literal["<", "<=", ">", ">=", "=="] - """Operator""" - - version: str - """Version of OS""" - - os_distro_name: Optional[str] = None - """Operating System Distribution Name (linux only)""" - - os_distro_revision: Optional[str] = None - """Version of OS Distribution (linux only)""" - - os_version_extra: Optional[str] = None - """Additional version data. - - For Mac or iOS, the Product Verison Extra. For Linux, the kernel release - version. (Mac, iOS, and Linux only) - """ - - -class InputTeamsDevicesFirewallInputRequest(BaseModel): - enabled: bool - """Enabled""" - - operating_system: Literal["windows", "mac"] - """Operating System""" - - -class InputTeamsDevicesSentineloneInputRequest(BaseModel): - operating_system: Literal["windows", "linux", "mac"] - """Operating system""" - - path: str - """File path.""" - - sha256: Optional[str] = None - """SHA-256.""" - - thumbprint: Optional[str] = None - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesCarbonblackInputRequest(BaseModel): - operating_system: Literal["windows", "linux", "mac"] - """Operating system""" - - path: str - """File path.""" - - sha256: Optional[str] = None - """SHA-256.""" - - thumbprint: Optional[str] = None - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesDiskEncryptionInputRequest(BaseModel): - check_disks: Optional[List[str]] = FieldInfo(alias="checkDisks", default=None) - """List of volume names to be checked for encryption.""" - - require_all: Optional[bool] = FieldInfo(alias="requireAll", default=None) - """Whether to check all disks for encryption.""" - - -class InputTeamsDevicesApplicationInputRequest(BaseModel): - operating_system: Literal["windows", "linux", "mac"] - """Operating system""" - - path: str - """Path for the application.""" - - sha256: Optional[str] = None - """SHA-256.""" - - thumbprint: Optional[str] = None - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesClientCertificateInputRequest(BaseModel): - certificate_id: str - """UUID of Cloudflare managed certificate.""" - - cn: str - """Common Name that is protected by the certificate""" - - -class InputTeamsDevicesWorkspaceOneInputRequest(BaseModel): - compliance_status: Literal["compliant", "noncompliant", "unknown"] - """Compliance Status""" - - connection_id: str - """Posture Integration ID.""" - - -class InputTeamsDevicesCrowdstrikeInputRequest(BaseModel): - connection_id: str - """Posture Integration ID.""" - - last_seen: Optional[str] = None - """For more details on last seen, please refer to the Crowdstrike documentation.""" - - operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = None - """Operator""" - - os: Optional[str] = None - """Os Version""" - - overall: Optional[str] = None - """overall""" - - sensor_config: Optional[str] = None - """SensorConfig""" - - state: Optional[Literal["online", "offline", "unknown"]] = None - """For more details on state, please refer to the Crowdstrike documentation.""" - - version: Optional[str] = None - """Version""" - - version_operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = FieldInfo(alias="versionOperator", default=None) - """Version Operator""" - - -class InputTeamsDevicesIntuneInputRequest(BaseModel): - compliance_status: Literal["compliant", "noncompliant", "unknown", "notapplicable", "ingraceperiod", "error"] - """Compliance Status""" - - connection_id: str - """Posture Integration ID.""" - - -class InputTeamsDevicesKolideInputRequest(BaseModel): - connection_id: str - """Posture Integration ID.""" - - count_operator: Literal["<", "<=", ">", ">=", "=="] = FieldInfo(alias="countOperator") - """Count Operator""" - - issue_count: str - """The Number of Issues.""" - - -class InputTeamsDevicesTaniumInputRequest(BaseModel): - connection_id: str - """Posture Integration ID.""" - - eid_last_seen: Optional[str] = None - """For more details on eid last seen, refer to the Tanium documentation.""" - - operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = None - """Operator to evaluate risk_level or eid_last_seen.""" - - risk_level: Optional[Literal["low", "medium", "high", "critical"]] = None - """For more details on risk level, refer to the Tanium documentation.""" - - score_operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = FieldInfo(alias="scoreOperator", default=None) - """Score Operator""" - - total_score: Optional[float] = None - """For more details on total score, refer to the Tanium documentation.""" - - -class InputTeamsDevicesSentineloneS2sInputRequest(BaseModel): - connection_id: str - """Posture Integration ID.""" - - active_threats: Optional[float] = None - """The Number of active threats.""" - - infected: Optional[bool] = None - """Whether device is infected.""" - - is_active: Optional[bool] = None - """Whether device is active.""" - - network_status: Optional[Literal["connected", "disconnected", "disconnecting", "connecting"]] = None - """Network status of device.""" - - operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = None - """operator""" - - -Input = Union[ - InputTeamsDevicesFileInputRequest, - InputTeamsDevicesUniqueClientIDInputRequest, - InputTeamsDevicesDomainJoinedInputRequest, - InputTeamsDevicesOSVersionInputRequest, - InputTeamsDevicesFirewallInputRequest, - InputTeamsDevicesSentineloneInputRequest, - InputTeamsDevicesCarbonblackInputRequest, - InputTeamsDevicesDiskEncryptionInputRequest, - InputTeamsDevicesApplicationInputRequest, - InputTeamsDevicesClientCertificateInputRequest, - InputTeamsDevicesWorkspaceOneInputRequest, - InputTeamsDevicesCrowdstrikeInputRequest, - InputTeamsDevicesIntuneInputRequest, - InputTeamsDevicesKolideInputRequest, - InputTeamsDevicesTaniumInputRequest, - InputTeamsDevicesSentineloneS2sInputRequest, -] - - -class Match(BaseModel): - platform: Optional[Literal["windows", "mac", "linux", "android", "ios"]] = None - - -class DevicePostureRules(BaseModel): - id: Optional[str] = None - """API UUID.""" - - description: Optional[str] = None - """The description of the device posture rule.""" - - expiration: Optional[str] = None - """Sets the expiration time for a posture check result. - - If empty, the result remains valid until it is overwritten by new data from the - WARP client. - """ - - input: Optional[Input] = None - """The value to be checked against.""" - - match: Optional[List[Match]] = None - """The conditions that the client must match to run the rule.""" - - name: Optional[str] = None - """The name of the device posture rule.""" - - schedule: Optional[str] = None - """Polling frequency for the WARP client posture check. - - Default: `5m` (poll every five minutes). Minimum: `1m`. - """ - - type: Optional[ - Literal[ - "file", - "application", - "tanium", - "gateway", - "warp", - "disk_encryption", - "sentinelone", - "carbonblack", - "firewall", - "os_version", - "domain_joined", - "client_certificate", - "unique_client_id", - "kolide", - "tanium_s2s", - "crowdstrike_s2s", - "intune", - "workspace_one", - "sentinelone_s2s", - ] - ] = None - """The type of device posture rule.""" diff --git a/src/cloudflare/types/zero_trust/devices/device_settings.py b/src/cloudflare/types/zero_trust/devices/device_settings.py new file mode 100644 index 00000000000..6b737b04044 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/device_settings.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["DeviceSettings"] + + +class DeviceSettings(BaseModel): + gateway_proxy_enabled: Optional[bool] = None + """Enable gateway proxy filtering on TCP.""" + + gateway_udp_proxy_enabled: Optional[bool] = None + """Enable gateway proxy filtering on UDP.""" + + root_certificate_installation_enabled: Optional[bool] = None + """Enable installation of cloudflare managed root certificate.""" + + use_zt_virtual_ip: Optional[bool] = None + """Enable using CGNAT virtual IPv4.""" diff --git a/src/cloudflare/types/zero_trust/devices/devices_device_settings_policy.py b/src/cloudflare/types/zero_trust/devices/devices_device_settings_policy.py deleted file mode 100644 index ddad4b60b9d..00000000000 --- a/src/cloudflare/types/zero_trust/devices/devices_device_settings_policy.py +++ /dev/null @@ -1,103 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .policies import DevicesSplitTunnel, DevicesFallbackDomain, DevicesSplitTunnelInclude -from ...._models import BaseModel - -__all__ = ["DevicesDeviceSettingsPolicy", "ServiceModeV2"] - - -class ServiceModeV2(BaseModel): - mode: Optional[str] = None - """The mode to run the WARP client under.""" - - port: Optional[float] = None - """The port number when used with proxy mode.""" - - -class DevicesDeviceSettingsPolicy(BaseModel): - allow_mode_switch: Optional[bool] = None - """Whether to allow the user to switch WARP between modes.""" - - allow_updates: Optional[bool] = None - """ - Whether to receive update notifications when a new version of the client is - available. - """ - - allowed_to_leave: Optional[bool] = None - """Whether to allow devices to leave the organization.""" - - auto_connect: Optional[float] = None - """The amount of time in minutes to reconnect after having been disabled.""" - - captive_portal: Optional[float] = None - """Turn on the captive portal after the specified amount of time.""" - - default: Optional[bool] = None - """Whether the policy is the default policy for an account.""" - - description: Optional[str] = None - """A description of the policy.""" - - disable_auto_fallback: Optional[bool] = None - """ - If the `dns_server` field of a fallback domain is not present, the client will - fall back to a best guess of the default/system DNS resolvers unless this policy - option is set to `true`. - """ - - enabled: Optional[bool] = None - """Whether the policy will be applied to matching devices.""" - - exclude: Optional[List[DevicesSplitTunnel]] = None - - exclude_office_ips: Optional[bool] = None - """Whether to add Microsoft IPs to Split Tunnel exclusions.""" - - fallback_domains: Optional[List[DevicesFallbackDomain]] = None - - gateway_unique_id: Optional[str] = None - - include: Optional[List[DevicesSplitTunnelInclude]] = None - - lan_allow_minutes: Optional[float] = None - """The amount of time in minutes a user is allowed access to their LAN. - - A value of 0 will allow LAN access until the next WARP reconnection, such as a - reboot or a laptop waking from sleep. Note that this field is omitted from the - response if null or unset. - """ - - lan_allow_subnet_size: Optional[float] = None - """The size of the subnet for the local access network. - - Note that this field is omitted from the response if null or unset. - """ - - match: Optional[str] = None - """The wirefilter expression to match devices.""" - - name: Optional[str] = None - """The name of the device settings profile.""" - - policy_id: Optional[str] = None - """Device ID.""" - - precedence: Optional[float] = None - """The precedence of the policy. - - Lower values indicate higher precedence. Policies will be evaluated in ascending - order of this field. - """ - - service_mode_v2: Optional[ServiceModeV2] = None - - support_url: Optional[str] = None - """The URL to launch when the Send Feedback button is clicked.""" - - switch_locked: Optional[bool] = None - """ - Whether to allow the user to turn off the WARP switch and disconnect the client. - """ diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_create_params.py b/src/cloudflare/types/zero_trust/devices/dex_test_create_params.py index f784a1888e1..340d9d17999 100644 --- a/src/cloudflare/types/zero_trust/devices/dex_test_create_params.py +++ b/src/cloudflare/types/zero_trust/devices/dex_test_create_params.py @@ -2,15 +2,18 @@ from __future__ import annotations +from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = ["DEXTestCreateParams", "Data"] +from .schema_data_param import SchemaDataParam + +__all__ = ["DEXTestCreateParams", "TargetPolicy"] class DEXTestCreateParams(TypedDict, total=False): account_id: Required[str] - data: Required[Data] + data: Required[SchemaDataParam] """ The configuration object which contains the details for the WARP client to conduct the test. @@ -28,13 +31,18 @@ class DEXTestCreateParams(TypedDict, total=False): description: str """Additional details about the test.""" + target_policies: Iterable[TargetPolicy] + """Device settings profiles targeted by this test""" + + targeted: bool + -class Data(TypedDict, total=False): - host: str - """The desired endpoint to test.""" +class TargetPolicy(TypedDict, total=False): + id: str + """The id of the device settings profile""" - kind: str - """The type of test.""" + default: bool + """Whether the profile is the account default""" - method: str - """The HTTP request method type.""" + name: str + """The name of the device settings profile""" diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_delete_response.py b/src/cloudflare/types/zero_trust/devices/dex_test_delete_response.py index 66f2f3fbb27..a096bb5f470 100644 --- a/src/cloudflare/types/zero_trust/devices/dex_test_delete_response.py +++ b/src/cloudflare/types/zero_trust/devices/dex_test_delete_response.py @@ -2,8 +2,8 @@ from typing import List -from .dex_test_schemas_http import DEXTestSchemasHTTP +from .schema_http import SchemaHTTP __all__ = ["DEXTestDeleteResponse"] -DEXTestDeleteResponse = List[DEXTestSchemasHTTP] +DEXTestDeleteResponse = List[SchemaHTTP] diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_schemas_http.py b/src/cloudflare/types/zero_trust/devices/dex_test_schemas_http.py deleted file mode 100644 index 263ec67f9b3..00000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_schemas_http.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["DEXTestSchemasHTTP", "Data"] - - -class Data(BaseModel): - host: Optional[str] = None - """The desired endpoint to test.""" - - kind: Optional[str] = None - """The type of test.""" - - method: Optional[str] = None - """The HTTP request method type.""" - - -class DEXTestSchemasHTTP(BaseModel): - data: Data - """ - The configuration object which contains the details for the WARP client to - conduct the test. - """ - - enabled: bool - """Determines whether or not the test is active.""" - - interval: str - """How often the test will run.""" - - name: str - """The name of the DEX test. Must be unique.""" - - description: Optional[str] = None - """Additional details about the test.""" diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_update_params.py b/src/cloudflare/types/zero_trust/devices/dex_test_update_params.py index f7d63e62c30..1e09ce4d599 100644 --- a/src/cloudflare/types/zero_trust/devices/dex_test_update_params.py +++ b/src/cloudflare/types/zero_trust/devices/dex_test_update_params.py @@ -2,15 +2,18 @@ from __future__ import annotations +from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = ["DEXTestUpdateParams", "Data"] +from .schema_data_param import SchemaDataParam + +__all__ = ["DEXTestUpdateParams", "TargetPolicy"] class DEXTestUpdateParams(TypedDict, total=False): account_id: Required[str] - data: Required[Data] + data: Required[SchemaDataParam] """ The configuration object which contains the details for the WARP client to conduct the test. @@ -28,13 +31,18 @@ class DEXTestUpdateParams(TypedDict, total=False): description: str """Additional details about the test.""" + target_policies: Iterable[TargetPolicy] + """Device settings profiles targeted by this test""" + + targeted: bool + -class Data(TypedDict, total=False): - host: str - """The desired endpoint to test.""" +class TargetPolicy(TypedDict, total=False): + id: str + """The id of the device settings profile""" - kind: str - """The type of test.""" + default: bool + """Whether the profile is the account default""" - method: str - """The HTTP request method type.""" + name: str + """The name of the device settings profile""" diff --git a/src/cloudflare/types/zero_trust/devices/disk_encryption_input.py b/src/cloudflare/types/zero_trust/devices/disk_encryption_input.py new file mode 100644 index 00000000000..d431097485e --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/disk_encryption_input.py @@ -0,0 +1,18 @@ +# 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 +from .carbonblack_input import CarbonblackInput + +__all__ = ["DiskEncryptionInput"] + + +class DiskEncryptionInput(BaseModel): + check_disks: Optional[List[CarbonblackInput]] = FieldInfo(alias="checkDisks", default=None) + """List of volume names to be checked for encryption.""" + + require_all: Optional[bool] = FieldInfo(alias="requireAll", default=None) + """Whether to check all disks for encryption.""" diff --git a/src/cloudflare/types/zero_trust/devices/disk_encryption_input_param.py b/src/cloudflare/types/zero_trust/devices/disk_encryption_input_param.py new file mode 100644 index 00000000000..2bd2097cc3f --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/disk_encryption_input_param.py @@ -0,0 +1,19 @@ +# 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 Annotated, TypedDict + +from ...._utils import PropertyInfo +from .carbonblack_input import CarbonblackInput + +__all__ = ["DiskEncryptionInputParam"] + + +class DiskEncryptionInputParam(TypedDict, total=False): + check_disks: Annotated[List[CarbonblackInput], PropertyInfo(alias="checkDisks")] + """List of volume names to be checked for encryption.""" + + require_all: Annotated[bool, PropertyInfo(alias="requireAll")] + """Whether to check all disks for encryption.""" diff --git a/src/cloudflare/types/zero_trust/devices/domain_joined_input.py b/src/cloudflare/types/zero_trust/devices/domain_joined_input.py new file mode 100644 index 00000000000..4788e81e662 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/domain_joined_input.py @@ -0,0 +1,16 @@ +# 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__ = ["DomainJoinedInput"] + + +class DomainJoinedInput(BaseModel): + operating_system: Literal["windows"] + """Operating System""" + + domain: Optional[str] = None + """Domain""" diff --git a/src/cloudflare/types/zero_trust/devices/domain_joined_input_param.py b/src/cloudflare/types/zero_trust/devices/domain_joined_input_param.py new file mode 100644 index 00000000000..e105b58434c --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/domain_joined_input_param.py @@ -0,0 +1,15 @@ +# 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__ = ["DomainJoinedInputParam"] + + +class DomainJoinedInputParam(TypedDict, total=False): + operating_system: Required[Literal["windows"]] + """Operating System""" + + domain: str + """Domain""" diff --git a/src/cloudflare/types/zero_trust/devices/file_input.py b/src/cloudflare/types/zero_trust/devices/file_input.py new file mode 100644 index 00000000000..214bf876ee0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/file_input.py @@ -0,0 +1,25 @@ +# 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__ = ["FileInput"] + + +class FileInput(BaseModel): + operating_system: Literal["windows", "linux", "mac"] + """Operating system""" + + path: str + """File path.""" + + exists: Optional[bool] = None + """Whether or not file exists""" + + sha256: Optional[str] = None + """SHA-256.""" + + thumbprint: Optional[str] = None + """Signing certificate thumbprint.""" diff --git a/src/cloudflare/types/zero_trust/devices/file_input_param.py b/src/cloudflare/types/zero_trust/devices/file_input_param.py new file mode 100644 index 00000000000..d50a8f505d4 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/file_input_param.py @@ -0,0 +1,24 @@ +# 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__ = ["FileInputParam"] + + +class FileInputParam(TypedDict, total=False): + operating_system: Required[Literal["windows", "linux", "mac"]] + """Operating system""" + + path: Required[str] + """File path.""" + + exists: bool + """Whether or not file exists""" + + sha256: str + """SHA-256.""" + + thumbprint: str + """Signing certificate thumbprint.""" diff --git a/src/cloudflare/types/zero_trust/devices/firewall_input.py b/src/cloudflare/types/zero_trust/devices/firewall_input.py new file mode 100644 index 00000000000..022d78c05b8 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/firewall_input.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["FirewallInput"] + + +class FirewallInput(BaseModel): + enabled: bool + """Enabled""" + + operating_system: Literal["windows", "mac"] + """Operating System""" diff --git a/src/cloudflare/types/zero_trust/devices/firewall_input_param.py b/src/cloudflare/types/zero_trust/devices/firewall_input_param.py new file mode 100644 index 00000000000..aa4f2edd3d8 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/firewall_input_param.py @@ -0,0 +1,15 @@ +# 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__ = ["FirewallInputParam"] + + +class FirewallInputParam(TypedDict, total=False): + enabled: Required[bool] + """Enabled""" + + operating_system: Required[Literal["windows", "mac"]] + """Operating System""" diff --git a/src/cloudflare/types/zero_trust/devices/intune_input.py b/src/cloudflare/types/zero_trust/devices/intune_input.py new file mode 100644 index 00000000000..881e02ae00e --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/intune_input.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["IntuneInput"] + + +class IntuneInput(BaseModel): + compliance_status: Literal["compliant", "noncompliant", "unknown", "notapplicable", "ingraceperiod", "error"] + """Compliance Status""" + + connection_id: str + """Posture Integration ID.""" diff --git a/src/cloudflare/types/zero_trust/devices/intune_input_param.py b/src/cloudflare/types/zero_trust/devices/intune_input_param.py new file mode 100644 index 00000000000..938f5fdfef5 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/intune_input_param.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 Literal, Required, TypedDict + +__all__ = ["IntuneInputParam"] + + +class IntuneInputParam(TypedDict, total=False): + compliance_status: Required[ + Literal["compliant", "noncompliant", "unknown", "notapplicable", "ingraceperiod", "error"] + ] + """Compliance Status""" + + connection_id: Required[str] + """Posture Integration ID.""" diff --git a/src/cloudflare/types/zero_trust/devices/kolide_input.py b/src/cloudflare/types/zero_trust/devices/kolide_input.py new file mode 100644 index 00000000000..c61481d2b3e --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/kolide_input.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["KolideInput"] + + +class KolideInput(BaseModel): + connection_id: str + """Posture Integration ID.""" + + count_operator: Literal["<", "<=", ">", ">=", "=="] = FieldInfo(alias="countOperator") + """Count Operator""" + + issue_count: str + """The Number of Issues.""" diff --git a/src/cloudflare/types/zero_trust/devices/kolide_input_param.py b/src/cloudflare/types/zero_trust/devices/kolide_input_param.py new file mode 100644 index 00000000000..134335be39f --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/kolide_input_param.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 Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["KolideInputParam"] + + +class KolideInputParam(TypedDict, total=False): + connection_id: Required[str] + """Posture Integration ID.""" + + count_operator: Required[Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="countOperator")]] + """Count Operator""" + + issue_count: Required[str] + """The Number of Issues.""" diff --git a/src/cloudflare/types/zero_trust/devices/network_delete_params.py b/src/cloudflare/types/zero_trust/devices/network_delete_params.py new file mode 100644 index 00000000000..f8d4d2308be --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/network_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["NetworkDeleteParams"] + + +class NetworkDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/devices/network_delete_response.py b/src/cloudflare/types/zero_trust/devices/network_delete_response.py index 33c32453dee..a849bc78a8a 100644 --- a/src/cloudflare/types/zero_trust/devices/network_delete_response.py +++ b/src/cloudflare/types/zero_trust/devices/network_delete_response.py @@ -2,8 +2,8 @@ from typing import List -from .device_managed_networks import DeviceManagedNetworks +from .device_network import DeviceNetwork __all__ = ["NetworkDeleteResponse"] -NetworkDeleteResponse = List[DeviceManagedNetworks] +NetworkDeleteResponse = List[DeviceNetwork] diff --git a/src/cloudflare/types/zero_trust/devices/os_version_input.py b/src/cloudflare/types/zero_trust/devices/os_version_input.py new file mode 100644 index 00000000000..ae5e2019461 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/os_version_input.py @@ -0,0 +1,32 @@ +# 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__ = ["OSVersionInput"] + + +class OSVersionInput(BaseModel): + operating_system: Literal["windows"] + """Operating System""" + + operator: Literal["<", "<=", ">", ">=", "=="] + """operator""" + + version: str + """Version of OS""" + + os_distro_name: Optional[str] = None + """Operating System Distribution Name (linux only)""" + + os_distro_revision: Optional[str] = None + """Version of OS Distribution (linux only)""" + + os_version_extra: Optional[str] = None + """Additional version data. + + For Mac or iOS, the Product Verison Extra. For Linux, the kernel release + version. (Mac, iOS, and Linux only) + """ diff --git a/src/cloudflare/types/zero_trust/devices/os_version_input_param.py b/src/cloudflare/types/zero_trust/devices/os_version_input_param.py new file mode 100644 index 00000000000..6bc8122e315 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/os_version_input_param.py @@ -0,0 +1,31 @@ +# 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__ = ["OSVersionInputParam"] + + +class OSVersionInputParam(TypedDict, total=False): + operating_system: Required[Literal["windows"]] + """Operating System""" + + operator: Required[Literal["<", "<=", ">", ">=", "=="]] + """operator""" + + version: Required[str] + """Version of OS""" + + os_distro_name: str + """Operating System Distribution Name (linux only)""" + + os_distro_revision: str + """Version of OS Distribution (linux only)""" + + os_version_extra: str + """Additional version data. + + For Mac or iOS, the Product Verison Extra. For Linux, the kernel release + version. (Mac, iOS, and Linux only) + """ diff --git a/src/cloudflare/types/zero_trust/devices/policies/__init__.py b/src/cloudflare/types/zero_trust/devices/policies/__init__.py index 8e3419b0673..1534f635ab8 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/__init__.py +++ b/src/cloudflare/types/zero_trust/devices/policies/__init__.py @@ -2,19 +2,19 @@ from __future__ import annotations -from .devices_split_tunnel import DevicesSplitTunnel as DevicesSplitTunnel +from .fallback_domain import FallbackDomain as FallbackDomain from .exclude_get_response import ExcludeGetResponse as ExcludeGetResponse from .include_get_response import IncludeGetResponse as IncludeGetResponse +from .split_tunnel_exclude import SplitTunnelExclude as SplitTunnelExclude +from .split_tunnel_include import SplitTunnelInclude as SplitTunnelInclude from .exclude_update_params import ExcludeUpdateParams as ExcludeUpdateParams +from .fallback_domain_param import FallbackDomainParam as FallbackDomainParam from .include_update_params import IncludeUpdateParams as IncludeUpdateParams -from .devices_fallback_domain import DevicesFallbackDomain as DevicesFallbackDomain from .exclude_update_response import ExcludeUpdateResponse as ExcludeUpdateResponse from .include_update_response import IncludeUpdateResponse as IncludeUpdateResponse -from .devices_split_tunnel_param import DevicesSplitTunnelParam as DevicesSplitTunnelParam +from .split_tunnel_exclude_param import SplitTunnelExcludeParam as SplitTunnelExcludeParam +from .split_tunnel_include_param import SplitTunnelIncludeParam as SplitTunnelIncludeParam from .default_policy_get_response import DefaultPolicyGetResponse as DefaultPolicyGetResponse -from .devices_split_tunnel_include import DevicesSplitTunnelInclude as DevicesSplitTunnelInclude from .fallback_domain_get_response import FallbackDomainGetResponse as FallbackDomainGetResponse -from .devices_fallback_domain_param import DevicesFallbackDomainParam as DevicesFallbackDomainParam from .fallback_domain_update_params import FallbackDomainUpdateParams as FallbackDomainUpdateParams from .fallback_domain_update_response import FallbackDomainUpdateResponse as FallbackDomainUpdateResponse -from .devices_split_tunnel_include_param import DevicesSplitTunnelIncludeParam as DevicesSplitTunnelIncludeParam diff --git a/src/cloudflare/types/zero_trust/devices/policies/devices_fallback_domain.py b/src/cloudflare/types/zero_trust/devices/policies/devices_fallback_domain.py deleted file mode 100644 index b8779327e4f..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/devices_fallback_domain.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ....._models import BaseModel - -__all__ = ["DevicesFallbackDomain"] - - -class DevicesFallbackDomain(BaseModel): - suffix: str - """The domain suffix to match when resolving locally.""" - - description: Optional[str] = None - """A description of the fallback domain, displayed in the client UI.""" - - dns_server: Optional[List[object]] = None - """A list of IP addresses to handle domain resolution.""" diff --git a/src/cloudflare/types/zero_trust/devices/policies/devices_fallback_domain_param.py b/src/cloudflare/types/zero_trust/devices/policies/devices_fallback_domain_param.py deleted file mode 100644 index 41f28722cb5..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/devices_fallback_domain_param.py +++ /dev/null @@ -1,19 +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 Required, TypedDict - -__all__ = ["DevicesFallbackDomainParam"] - - -class DevicesFallbackDomainParam(TypedDict, total=False): - suffix: Required[str] - """The domain suffix to match when resolving locally.""" - - description: str - """A description of the fallback domain, displayed in the client UI.""" - - dns_server: Iterable[object] - """A list of IP addresses to handle domain resolution.""" diff --git a/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel.py b/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel.py deleted file mode 100644 index 6644d40583c..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ....._models import BaseModel - -__all__ = ["DevicesSplitTunnel"] - - -class DevicesSplitTunnel(BaseModel): - address: str - """The address in CIDR format to exclude from the tunnel. - - If `address` is present, `host` must not be present. - """ - - description: str - """A description of the Split Tunnel item, displayed in the client UI.""" - - host: Optional[str] = None - """The domain name to exclude from the tunnel. - - If `host` is present, `address` must not be present. - """ diff --git a/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_include.py b/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_include.py deleted file mode 100644 index c067eafb1ad..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_include.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ....._models import BaseModel - -__all__ = ["DevicesSplitTunnelInclude"] - - -class DevicesSplitTunnelInclude(BaseModel): - address: str - """The address in CIDR format to include in the tunnel. - - If address is present, host must not be present. - """ - - description: str - """A description of the split tunnel item, displayed in the client UI.""" - - host: Optional[str] = None - """The domain name to include in the tunnel. - - If host is present, address must not be present. - """ diff --git a/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_include_param.py b/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_include_param.py deleted file mode 100644 index 85707e7270e..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_include_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_extensions import Required, TypedDict - -__all__ = ["DevicesSplitTunnelIncludeParam"] - - -class DevicesSplitTunnelIncludeParam(TypedDict, total=False): - address: Required[str] - """The address in CIDR format to include in the tunnel. - - If address is present, host must not be present. - """ - - description: Required[str] - """A description of the split tunnel item, displayed in the client UI.""" - - host: str - """The domain name to include in the tunnel. - - If host is present, address must not be present. - """ diff --git a/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_param.py b/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_param.py deleted file mode 100644 index 4e506e978fa..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/devices_split_tunnel_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_extensions import Required, TypedDict - -__all__ = ["DevicesSplitTunnelParam"] - - -class DevicesSplitTunnelParam(TypedDict, total=False): - address: Required[str] - """The address in CIDR format to exclude from the tunnel. - - If `address` is present, `host` must not be present. - """ - - description: Required[str] - """A description of the Split Tunnel item, displayed in the client UI.""" - - host: str - """The domain name to exclude from the tunnel. - - If `host` is present, `address` must not be present. - """ diff --git a/src/cloudflare/types/zero_trust/devices/policies/exclude_get_response.py b/src/cloudflare/types/zero_trust/devices/policies/exclude_get_response.py index 824f866d464..98a5259c101 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/exclude_get_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/exclude_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .devices_split_tunnel import DevicesSplitTunnel +from .split_tunnel_exclude import SplitTunnelExclude __all__ = ["ExcludeGetResponse"] -ExcludeGetResponse = List[DevicesSplitTunnel] +ExcludeGetResponse = List[SplitTunnelExclude] diff --git a/src/cloudflare/types/zero_trust/devices/policies/exclude_update_params.py b/src/cloudflare/types/zero_trust/devices/policies/exclude_update_params.py index 41121b97c0a..21ac467a9eb 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/exclude_update_params.py +++ b/src/cloudflare/types/zero_trust/devices/policies/exclude_update_params.py @@ -5,7 +5,7 @@ from typing import Iterable from typing_extensions import Required, TypedDict -from .devices_split_tunnel_param import DevicesSplitTunnelParam +from .split_tunnel_exclude_param import SplitTunnelExcludeParam __all__ = ["ExcludeUpdateParams"] @@ -13,4 +13,4 @@ class ExcludeUpdateParams(TypedDict, total=False): account_id: Required[str] - body: Required[Iterable[DevicesSplitTunnelParam]] + body: Required[Iterable[SplitTunnelExcludeParam]] diff --git a/src/cloudflare/types/zero_trust/devices/policies/exclude_update_response.py b/src/cloudflare/types/zero_trust/devices/policies/exclude_update_response.py index 4aa7da541dd..1174ff1c3ed 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/exclude_update_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/exclude_update_response.py @@ -2,8 +2,8 @@ from typing import List -from .devices_split_tunnel import DevicesSplitTunnel +from .split_tunnel_exclude import SplitTunnelExclude __all__ = ["ExcludeUpdateResponse"] -ExcludeUpdateResponse = List[DevicesSplitTunnel] +ExcludeUpdateResponse = List[SplitTunnelExclude] diff --git a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain.py b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain.py new file mode 100644 index 00000000000..41c5d376a14 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ....._models import BaseModel + +__all__ = ["FallbackDomain"] + + +class FallbackDomain(BaseModel): + suffix: str + """The domain suffix to match when resolving locally.""" + + description: Optional[str] = None + """A description of the fallback domain, displayed in the client UI.""" + + dns_server: Optional[List[object]] = None + """A list of IP addresses to handle domain resolution.""" diff --git a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_get_response.py b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_get_response.py index d71cd600688..a55049118d5 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_get_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .devices_fallback_domain import DevicesFallbackDomain +from .fallback_domain import FallbackDomain __all__ = ["FallbackDomainGetResponse"] -FallbackDomainGetResponse = List[DevicesFallbackDomain] +FallbackDomainGetResponse = List[FallbackDomain] diff --git a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_param.py b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_param.py new file mode 100644 index 00000000000..67428e45afd --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_param.py @@ -0,0 +1,19 @@ +# 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 Required, TypedDict + +__all__ = ["FallbackDomainParam"] + + +class FallbackDomainParam(TypedDict, total=False): + suffix: Required[str] + """The domain suffix to match when resolving locally.""" + + description: str + """A description of the fallback domain, displayed in the client UI.""" + + dns_server: Iterable[object] + """A list of IP addresses to handle domain resolution.""" diff --git a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_update_params.py b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_update_params.py index acd8bbb0eb9..d88155dca61 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_update_params.py +++ b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_update_params.py @@ -5,7 +5,7 @@ from typing import Iterable from typing_extensions import Required, TypedDict -from .devices_fallback_domain_param import DevicesFallbackDomainParam +from .fallback_domain_param import FallbackDomainParam __all__ = ["FallbackDomainUpdateParams"] @@ -13,4 +13,4 @@ class FallbackDomainUpdateParams(TypedDict, total=False): account_id: Required[str] - body: Required[Iterable[DevicesFallbackDomainParam]] + body: Required[Iterable[FallbackDomainParam]] diff --git a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_update_response.py b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_update_response.py index 3b2c8e5b25b..6a97b5caa93 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_update_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_update_response.py @@ -2,8 +2,8 @@ from typing import List -from .devices_fallback_domain import DevicesFallbackDomain +from .fallback_domain import FallbackDomain __all__ = ["FallbackDomainUpdateResponse"] -FallbackDomainUpdateResponse = List[DevicesFallbackDomain] +FallbackDomainUpdateResponse = List[FallbackDomain] diff --git a/src/cloudflare/types/zero_trust/devices/policies/include_get_response.py b/src/cloudflare/types/zero_trust/devices/policies/include_get_response.py index d7d9f61e972..1a09a0101a4 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/include_get_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/include_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .devices_split_tunnel_include import DevicesSplitTunnelInclude +from .split_tunnel_include import SplitTunnelInclude __all__ = ["IncludeGetResponse"] -IncludeGetResponse = List[DevicesSplitTunnelInclude] +IncludeGetResponse = List[SplitTunnelInclude] diff --git a/src/cloudflare/types/zero_trust/devices/policies/include_update_params.py b/src/cloudflare/types/zero_trust/devices/policies/include_update_params.py index 467152a8553..ac7f05b4141 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/include_update_params.py +++ b/src/cloudflare/types/zero_trust/devices/policies/include_update_params.py @@ -5,7 +5,7 @@ from typing import Iterable from typing_extensions import Required, TypedDict -from .devices_split_tunnel_include_param import DevicesSplitTunnelIncludeParam +from .split_tunnel_include_param import SplitTunnelIncludeParam __all__ = ["IncludeUpdateParams"] @@ -13,4 +13,4 @@ class IncludeUpdateParams(TypedDict, total=False): account_id: Required[str] - body: Required[Iterable[DevicesSplitTunnelIncludeParam]] + body: Required[Iterable[SplitTunnelIncludeParam]] diff --git a/src/cloudflare/types/zero_trust/devices/policies/include_update_response.py b/src/cloudflare/types/zero_trust/devices/policies/include_update_response.py index 18529735936..c5e7d02c0d7 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/include_update_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/include_update_response.py @@ -2,8 +2,8 @@ from typing import List -from .devices_split_tunnel_include import DevicesSplitTunnelInclude +from .split_tunnel_include import SplitTunnelInclude __all__ = ["IncludeUpdateResponse"] -IncludeUpdateResponse = List[DevicesSplitTunnelInclude] +IncludeUpdateResponse = List[SplitTunnelInclude] diff --git a/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_exclude.py b/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_exclude.py new file mode 100644 index 00000000000..cd78772008c --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_exclude.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ....._models import BaseModel + +__all__ = ["SplitTunnelExclude"] + + +class SplitTunnelExclude(BaseModel): + address: str + """The address in CIDR format to exclude from the tunnel. + + If `address` is present, `host` must not be present. + """ + + description: str + """A description of the Split Tunnel item, displayed in the client UI.""" + + host: Optional[str] = None + """The domain name to exclude from the tunnel. + + If `host` is present, `address` must not be present. + """ diff --git a/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_exclude_param.py b/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_exclude_param.py new file mode 100644 index 00000000000..99998a52335 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_exclude_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SplitTunnelExcludeParam"] + + +class SplitTunnelExcludeParam(TypedDict, total=False): + address: Required[str] + """The address in CIDR format to exclude from the tunnel. + + If `address` is present, `host` must not be present. + """ + + description: Required[str] + """A description of the Split Tunnel item, displayed in the client UI.""" + + host: str + """The domain name to exclude from the tunnel. + + If `host` is present, `address` must not be present. + """ diff --git a/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_include.py b/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_include.py new file mode 100644 index 00000000000..0791d7c0eda --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_include.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ....._models import BaseModel + +__all__ = ["SplitTunnelInclude"] + + +class SplitTunnelInclude(BaseModel): + address: str + """The address in CIDR format to include in the tunnel. + + If address is present, host must not be present. + """ + + description: str + """A description of the split tunnel item, displayed in the client UI.""" + + host: Optional[str] = None + """The domain name to include in the tunnel. + + If host is present, address must not be present. + """ diff --git a/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_include_param.py b/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_include_param.py new file mode 100644 index 00000000000..70474cc5f5f --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/policies/split_tunnel_include_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SplitTunnelIncludeParam"] + + +class SplitTunnelIncludeParam(TypedDict, total=False): + address: Required[str] + """The address in CIDR format to include in the tunnel. + + If address is present, host must not be present. + """ + + description: Required[str] + """A description of the split tunnel item, displayed in the client UI.""" + + host: str + """The domain name to include in the tunnel. + + If host is present, address must not be present. + """ diff --git a/src/cloudflare/types/zero_trust/devices/policy_delete_params.py b/src/cloudflare/types/zero_trust/devices/policy_delete_params.py new file mode 100644 index 00000000000..4cb2ee753ce --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/policy_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["PolicyDeleteParams"] + + +class PolicyDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/devices/policy_delete_response.py b/src/cloudflare/types/zero_trust/devices/policy_delete_response.py index aecbb1e54ca..1e4273f04e7 100644 --- a/src/cloudflare/types/zero_trust/devices/policy_delete_response.py +++ b/src/cloudflare/types/zero_trust/devices/policy_delete_response.py @@ -2,8 +2,8 @@ from typing import List -from .devices_device_settings_policy import DevicesDeviceSettingsPolicy +from .settings_policy import SettingsPolicy __all__ = ["PolicyDeleteResponse"] -PolicyDeleteResponse = List[DevicesDeviceSettingsPolicy] +PolicyDeleteResponse = List[SettingsPolicy] diff --git a/src/cloudflare/types/zero_trust/devices/posture/__init__.py b/src/cloudflare/types/zero_trust/devices/posture/__init__.py index 3771dca8a78..c2a4c5f170b 100644 --- a/src/cloudflare/types/zero_trust/devices/posture/__init__.py +++ b/src/cloudflare/types/zero_trust/devices/posture/__init__.py @@ -2,7 +2,8 @@ from __future__ import annotations +from .integration import Integration as Integration from .integration_edit_params import IntegrationEditParams as IntegrationEditParams from .integration_create_params import IntegrationCreateParams as IntegrationCreateParams -from .device_posture_integrations import DevicePostureIntegrations as DevicePostureIntegrations +from .integration_delete_params import IntegrationDeleteParams as IntegrationDeleteParams from .integration_delete_response import IntegrationDeleteResponse as IntegrationDeleteResponse diff --git a/src/cloudflare/types/zero_trust/devices/posture/device_posture_integrations.py b/src/cloudflare/types/zero_trust/devices/posture/device_posture_integrations.py deleted file mode 100644 index 7728e3f5d05..00000000000 --- a/src/cloudflare/types/zero_trust/devices/posture/device_posture_integrations.py +++ /dev/null @@ -1,41 +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__ = ["DevicePostureIntegrations", "Config"] - - -class Config(BaseModel): - api_url: str - """The Workspace One API URL provided in the Workspace One Admin Dashboard.""" - - auth_url: str - """The Workspace One Authorization URL depending on your region.""" - - client_id: str - """The Workspace One client ID provided in the Workspace One Admin Dashboard.""" - - -class DevicePostureIntegrations(BaseModel): - id: Optional[str] = None - """API UUID.""" - - config: Optional[Config] = None - """The configuration object containing third-party integration information.""" - - interval: Optional[str] = None - """The interval between each posture check with the third-party API. - - Use `m` for minutes (e.g. `5m`) and `h` for hours (e.g. `12h`). - """ - - name: Optional[str] = None - """The name of the device posture integration.""" - - type: Optional[ - Literal["workspace_one", "crowdstrike_s2s", "uptycs", "intune", "kolide", "tanium", "sentinelone_s2s"] - ] = None - """The type of device posture integration.""" diff --git a/src/cloudflare/types/zero_trust/devices/posture/integration.py b/src/cloudflare/types/zero_trust/devices/posture/integration.py new file mode 100644 index 00000000000..505d151031f --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/posture/integration.py @@ -0,0 +1,41 @@ +# 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__ = ["Integration", "Config"] + + +class Config(BaseModel): + api_url: str + """The Workspace One API URL provided in the Workspace One Admin Dashboard.""" + + auth_url: str + """The Workspace One Authorization URL depending on your region.""" + + client_id: str + """The Workspace One client ID provided in the Workspace One Admin Dashboard.""" + + +class Integration(BaseModel): + id: Optional[str] = None + """API UUID.""" + + config: Optional[Config] = None + """The configuration object containing third-party integration information.""" + + interval: Optional[str] = None + """The interval between each posture check with the third-party API. + + Use `m` for minutes (e.g. `5m`) and `h` for hours (e.g. `12h`). + """ + + name: Optional[str] = None + """The name of the device posture integration.""" + + type: Optional[ + Literal["workspace_one", "crowdstrike_s2s", "uptycs", "intune", "kolide", "tanium", "sentinelone_s2s"] + ] = None + """The type of device posture integration.""" diff --git a/src/cloudflare/types/zero_trust/devices/posture/integration_delete_params.py b/src/cloudflare/types/zero_trust/devices/posture/integration_delete_params.py new file mode 100644 index 00000000000..ec8c43a8246 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/posture/integration_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IntegrationDeleteParams"] + + +class IntegrationDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] 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 05c1748f44b..6f19fa53620 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,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["IntegrationDeleteResponse"] -IntegrationDeleteResponse = Union[str, object, None] +IntegrationDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/devices/posture_create_params.py b/src/cloudflare/types/zero_trust/devices/posture_create_params.py index 1372b6ab886..69c45532eed 100644 --- a/src/cloudflare/types/zero_trust/devices/posture_create_params.py +++ b/src/cloudflare/types/zero_trust/devices/posture_create_params.py @@ -2,32 +2,13 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict -from ...._utils import PropertyInfo +from .device_input_param import DeviceInputParam +from .device_match_param import DeviceMatchParam -__all__ = [ - "PostureCreateParams", - "Input", - "InputTeamsDevicesFileInputRequest", - "InputTeamsDevicesUniqueClientIDInputRequest", - "InputTeamsDevicesDomainJoinedInputRequest", - "InputTeamsDevicesOSVersionInputRequest", - "InputTeamsDevicesFirewallInputRequest", - "InputTeamsDevicesSentineloneInputRequest", - "InputTeamsDevicesCarbonblackInputRequest", - "InputTeamsDevicesDiskEncryptionInputRequest", - "InputTeamsDevicesApplicationInputRequest", - "InputTeamsDevicesClientCertificateInputRequest", - "InputTeamsDevicesWorkspaceOneInputRequest", - "InputTeamsDevicesCrowdstrikeInputRequest", - "InputTeamsDevicesIntuneInputRequest", - "InputTeamsDevicesKolideInputRequest", - "InputTeamsDevicesTaniumInputRequest", - "InputTeamsDevicesSentineloneS2sInputRequest", - "Match", -] +__all__ = ["PostureCreateParams"] class PostureCreateParams(TypedDict, total=False): @@ -71,10 +52,10 @@ class PostureCreateParams(TypedDict, total=False): WARP client. """ - input: Input + input: DeviceInputParam """The value to be checked against.""" - match: Iterable[Match] + match: Iterable[DeviceMatchParam] """The conditions that the client must match to run the rule.""" schedule: str @@ -82,248 +63,3 @@ class PostureCreateParams(TypedDict, total=False): Default: `5m` (poll every five minutes). Minimum: `1m`. """ - - -class InputTeamsDevicesFileInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows", "linux", "mac"]] - """Operating system""" - - path: Required[str] - """File path.""" - - exists: bool - """Whether or not file exists""" - - sha256: str - """SHA-256.""" - - thumbprint: str - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesUniqueClientIDInputRequest(TypedDict, total=False): - id: Required[str] - """List ID.""" - - operating_system: Required[Literal["android", "ios", "chromeos"]] - """Operating System""" - - -class InputTeamsDevicesDomainJoinedInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows"]] - """Operating System""" - - domain: str - """Domain""" - - -class InputTeamsDevicesOSVersionInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows"]] - """Operating System""" - - operator: Required[Literal["<", "<=", ">", ">=", "=="]] - """Operator""" - - version: Required[str] - """Version of OS""" - - os_distro_name: str - """Operating System Distribution Name (linux only)""" - - os_distro_revision: str - """Version of OS Distribution (linux only)""" - - os_version_extra: str - """Additional version data. - - For Mac or iOS, the Product Verison Extra. For Linux, the kernel release - version. (Mac, iOS, and Linux only) - """ - - -class InputTeamsDevicesFirewallInputRequest(TypedDict, total=False): - enabled: Required[bool] - """Enabled""" - - operating_system: Required[Literal["windows", "mac"]] - """Operating System""" - - -class InputTeamsDevicesSentineloneInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows", "linux", "mac"]] - """Operating system""" - - path: Required[str] - """File path.""" - - sha256: str - """SHA-256.""" - - thumbprint: str - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesCarbonblackInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows", "linux", "mac"]] - """Operating system""" - - path: Required[str] - """File path.""" - - sha256: str - """SHA-256.""" - - thumbprint: str - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesDiskEncryptionInputRequest(TypedDict, total=False): - check_disks: Annotated[List[str], PropertyInfo(alias="checkDisks")] - """List of volume names to be checked for encryption.""" - - require_all: Annotated[bool, PropertyInfo(alias="requireAll")] - """Whether to check all disks for encryption.""" - - -class InputTeamsDevicesApplicationInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows", "linux", "mac"]] - """Operating system""" - - path: Required[str] - """Path for the application.""" - - sha256: str - """SHA-256.""" - - thumbprint: str - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesClientCertificateInputRequest(TypedDict, total=False): - certificate_id: Required[str] - """UUID of Cloudflare managed certificate.""" - - cn: Required[str] - """Common Name that is protected by the certificate""" - - -class InputTeamsDevicesWorkspaceOneInputRequest(TypedDict, total=False): - compliance_status: Required[Literal["compliant", "noncompliant", "unknown"]] - """Compliance Status""" - - connection_id: Required[str] - """Posture Integration ID.""" - - -class InputTeamsDevicesCrowdstrikeInputRequest(TypedDict, total=False): - connection_id: Required[str] - """Posture Integration ID.""" - - last_seen: str - """For more details on last seen, please refer to the Crowdstrike documentation.""" - - operator: Literal["<", "<=", ">", ">=", "=="] - """Operator""" - - os: str - """Os Version""" - - overall: str - """overall""" - - sensor_config: str - """SensorConfig""" - - state: Literal["online", "offline", "unknown"] - """For more details on state, please refer to the Crowdstrike documentation.""" - - version: str - """Version""" - - version_operator: Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="versionOperator")] - """Version Operator""" - - -class InputTeamsDevicesIntuneInputRequest(TypedDict, total=False): - compliance_status: Required[ - Literal["compliant", "noncompliant", "unknown", "notapplicable", "ingraceperiod", "error"] - ] - """Compliance Status""" - - connection_id: Required[str] - """Posture Integration ID.""" - - -class InputTeamsDevicesKolideInputRequest(TypedDict, total=False): - connection_id: Required[str] - """Posture Integration ID.""" - - count_operator: Required[Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="countOperator")]] - """Count Operator""" - - issue_count: Required[str] - """The Number of Issues.""" - - -class InputTeamsDevicesTaniumInputRequest(TypedDict, total=False): - connection_id: Required[str] - """Posture Integration ID.""" - - eid_last_seen: str - """For more details on eid last seen, refer to the Tanium documentation.""" - - operator: Literal["<", "<=", ">", ">=", "=="] - """Operator to evaluate risk_level or eid_last_seen.""" - - risk_level: Literal["low", "medium", "high", "critical"] - """For more details on risk level, refer to the Tanium documentation.""" - - score_operator: Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="scoreOperator")] - """Score Operator""" - - total_score: float - """For more details on total score, refer to the Tanium documentation.""" - - -class InputTeamsDevicesSentineloneS2sInputRequest(TypedDict, total=False): - connection_id: Required[str] - """Posture Integration ID.""" - - active_threats: float - """The Number of active threats.""" - - infected: bool - """Whether device is infected.""" - - is_active: bool - """Whether device is active.""" - - network_status: Literal["connected", "disconnected", "disconnecting", "connecting"] - """Network status of device.""" - - operator: Literal["<", "<=", ">", ">=", "=="] - """operator""" - - -Input = Union[ - InputTeamsDevicesFileInputRequest, - InputTeamsDevicesUniqueClientIDInputRequest, - InputTeamsDevicesDomainJoinedInputRequest, - InputTeamsDevicesOSVersionInputRequest, - InputTeamsDevicesFirewallInputRequest, - InputTeamsDevicesSentineloneInputRequest, - InputTeamsDevicesCarbonblackInputRequest, - InputTeamsDevicesDiskEncryptionInputRequest, - InputTeamsDevicesApplicationInputRequest, - InputTeamsDevicesClientCertificateInputRequest, - InputTeamsDevicesWorkspaceOneInputRequest, - InputTeamsDevicesCrowdstrikeInputRequest, - InputTeamsDevicesIntuneInputRequest, - InputTeamsDevicesKolideInputRequest, - InputTeamsDevicesTaniumInputRequest, - InputTeamsDevicesSentineloneS2sInputRequest, -] - - -class Match(TypedDict, total=False): - platform: Literal["windows", "mac", "linux", "android", "ios"] diff --git a/src/cloudflare/types/zero_trust/devices/posture_delete_params.py b/src/cloudflare/types/zero_trust/devices/posture_delete_params.py new file mode 100644 index 00000000000..302a213ee48 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/posture_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["PostureDeleteParams"] + + +class PostureDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/devices/posture_update_params.py b/src/cloudflare/types/zero_trust/devices/posture_update_params.py index 4d672e25d9a..7d32102d7dd 100644 --- a/src/cloudflare/types/zero_trust/devices/posture_update_params.py +++ b/src/cloudflare/types/zero_trust/devices/posture_update_params.py @@ -2,32 +2,13 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict -from ...._utils import PropertyInfo +from .device_input_param import DeviceInputParam +from .device_match_param import DeviceMatchParam -__all__ = [ - "PostureUpdateParams", - "Input", - "InputTeamsDevicesFileInputRequest", - "InputTeamsDevicesUniqueClientIDInputRequest", - "InputTeamsDevicesDomainJoinedInputRequest", - "InputTeamsDevicesOSVersionInputRequest", - "InputTeamsDevicesFirewallInputRequest", - "InputTeamsDevicesSentineloneInputRequest", - "InputTeamsDevicesCarbonblackInputRequest", - "InputTeamsDevicesDiskEncryptionInputRequest", - "InputTeamsDevicesApplicationInputRequest", - "InputTeamsDevicesClientCertificateInputRequest", - "InputTeamsDevicesWorkspaceOneInputRequest", - "InputTeamsDevicesCrowdstrikeInputRequest", - "InputTeamsDevicesIntuneInputRequest", - "InputTeamsDevicesKolideInputRequest", - "InputTeamsDevicesTaniumInputRequest", - "InputTeamsDevicesSentineloneS2sInputRequest", - "Match", -] +__all__ = ["PostureUpdateParams"] class PostureUpdateParams(TypedDict, total=False): @@ -71,10 +52,10 @@ class PostureUpdateParams(TypedDict, total=False): WARP client. """ - input: Input + input: DeviceInputParam """The value to be checked against.""" - match: Iterable[Match] + match: Iterable[DeviceMatchParam] """The conditions that the client must match to run the rule.""" schedule: str @@ -82,248 +63,3 @@ class PostureUpdateParams(TypedDict, total=False): Default: `5m` (poll every five minutes). Minimum: `1m`. """ - - -class InputTeamsDevicesFileInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows", "linux", "mac"]] - """Operating system""" - - path: Required[str] - """File path.""" - - exists: bool - """Whether or not file exists""" - - sha256: str - """SHA-256.""" - - thumbprint: str - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesUniqueClientIDInputRequest(TypedDict, total=False): - id: Required[str] - """List ID.""" - - operating_system: Required[Literal["android", "ios", "chromeos"]] - """Operating System""" - - -class InputTeamsDevicesDomainJoinedInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows"]] - """Operating System""" - - domain: str - """Domain""" - - -class InputTeamsDevicesOSVersionInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows"]] - """Operating System""" - - operator: Required[Literal["<", "<=", ">", ">=", "=="]] - """Operator""" - - version: Required[str] - """Version of OS""" - - os_distro_name: str - """Operating System Distribution Name (linux only)""" - - os_distro_revision: str - """Version of OS Distribution (linux only)""" - - os_version_extra: str - """Additional version data. - - For Mac or iOS, the Product Verison Extra. For Linux, the kernel release - version. (Mac, iOS, and Linux only) - """ - - -class InputTeamsDevicesFirewallInputRequest(TypedDict, total=False): - enabled: Required[bool] - """Enabled""" - - operating_system: Required[Literal["windows", "mac"]] - """Operating System""" - - -class InputTeamsDevicesSentineloneInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows", "linux", "mac"]] - """Operating system""" - - path: Required[str] - """File path.""" - - sha256: str - """SHA-256.""" - - thumbprint: str - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesCarbonblackInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows", "linux", "mac"]] - """Operating system""" - - path: Required[str] - """File path.""" - - sha256: str - """SHA-256.""" - - thumbprint: str - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesDiskEncryptionInputRequest(TypedDict, total=False): - check_disks: Annotated[List[str], PropertyInfo(alias="checkDisks")] - """List of volume names to be checked for encryption.""" - - require_all: Annotated[bool, PropertyInfo(alias="requireAll")] - """Whether to check all disks for encryption.""" - - -class InputTeamsDevicesApplicationInputRequest(TypedDict, total=False): - operating_system: Required[Literal["windows", "linux", "mac"]] - """Operating system""" - - path: Required[str] - """Path for the application.""" - - sha256: str - """SHA-256.""" - - thumbprint: str - """Signing certificate thumbprint.""" - - -class InputTeamsDevicesClientCertificateInputRequest(TypedDict, total=False): - certificate_id: Required[str] - """UUID of Cloudflare managed certificate.""" - - cn: Required[str] - """Common Name that is protected by the certificate""" - - -class InputTeamsDevicesWorkspaceOneInputRequest(TypedDict, total=False): - compliance_status: Required[Literal["compliant", "noncompliant", "unknown"]] - """Compliance Status""" - - connection_id: Required[str] - """Posture Integration ID.""" - - -class InputTeamsDevicesCrowdstrikeInputRequest(TypedDict, total=False): - connection_id: Required[str] - """Posture Integration ID.""" - - last_seen: str - """For more details on last seen, please refer to the Crowdstrike documentation.""" - - operator: Literal["<", "<=", ">", ">=", "=="] - """Operator""" - - os: str - """Os Version""" - - overall: str - """overall""" - - sensor_config: str - """SensorConfig""" - - state: Literal["online", "offline", "unknown"] - """For more details on state, please refer to the Crowdstrike documentation.""" - - version: str - """Version""" - - version_operator: Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="versionOperator")] - """Version Operator""" - - -class InputTeamsDevicesIntuneInputRequest(TypedDict, total=False): - compliance_status: Required[ - Literal["compliant", "noncompliant", "unknown", "notapplicable", "ingraceperiod", "error"] - ] - """Compliance Status""" - - connection_id: Required[str] - """Posture Integration ID.""" - - -class InputTeamsDevicesKolideInputRequest(TypedDict, total=False): - connection_id: Required[str] - """Posture Integration ID.""" - - count_operator: Required[Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="countOperator")]] - """Count Operator""" - - issue_count: Required[str] - """The Number of Issues.""" - - -class InputTeamsDevicesTaniumInputRequest(TypedDict, total=False): - connection_id: Required[str] - """Posture Integration ID.""" - - eid_last_seen: str - """For more details on eid last seen, refer to the Tanium documentation.""" - - operator: Literal["<", "<=", ">", ">=", "=="] - """Operator to evaluate risk_level or eid_last_seen.""" - - risk_level: Literal["low", "medium", "high", "critical"] - """For more details on risk level, refer to the Tanium documentation.""" - - score_operator: Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="scoreOperator")] - """Score Operator""" - - total_score: float - """For more details on total score, refer to the Tanium documentation.""" - - -class InputTeamsDevicesSentineloneS2sInputRequest(TypedDict, total=False): - connection_id: Required[str] - """Posture Integration ID.""" - - active_threats: float - """The Number of active threats.""" - - infected: bool - """Whether device is infected.""" - - is_active: bool - """Whether device is active.""" - - network_status: Literal["connected", "disconnected", "disconnecting", "connecting"] - """Network status of device.""" - - operator: Literal["<", "<=", ">", ">=", "=="] - """operator""" - - -Input = Union[ - InputTeamsDevicesFileInputRequest, - InputTeamsDevicesUniqueClientIDInputRequest, - InputTeamsDevicesDomainJoinedInputRequest, - InputTeamsDevicesOSVersionInputRequest, - InputTeamsDevicesFirewallInputRequest, - InputTeamsDevicesSentineloneInputRequest, - InputTeamsDevicesCarbonblackInputRequest, - InputTeamsDevicesDiskEncryptionInputRequest, - InputTeamsDevicesApplicationInputRequest, - InputTeamsDevicesClientCertificateInputRequest, - InputTeamsDevicesWorkspaceOneInputRequest, - InputTeamsDevicesCrowdstrikeInputRequest, - InputTeamsDevicesIntuneInputRequest, - InputTeamsDevicesKolideInputRequest, - InputTeamsDevicesTaniumInputRequest, - InputTeamsDevicesSentineloneS2sInputRequest, -] - - -class Match(TypedDict, total=False): - platform: Literal["windows", "mac", "linux", "android", "ios"] 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 67ea75e5ec0..9eb7a16d7cf 100644 --- a/src/cloudflare/types/zero_trust/devices/revoke_create_response.py +++ b/src/cloudflare/types/zero_trust/devices/revoke_create_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["RevokeCreateResponse"] -RevokeCreateResponse = Union[str, object, None] +RevokeCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/devices/schema_data.py b/src/cloudflare/types/zero_trust/devices/schema_data.py new file mode 100644 index 00000000000..8d57277eba9 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/schema_data.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["SchemaData"] + + +class SchemaData(BaseModel): + host: Optional[str] = None + """The desired endpoint to test.""" + + kind: Optional[str] = None + """The type of test.""" + + method: Optional[str] = None + """The HTTP request method type.""" diff --git a/src/cloudflare/types/zero_trust/devices/schema_data_param.py b/src/cloudflare/types/zero_trust/devices/schema_data_param.py new file mode 100644 index 00000000000..b071470c9c9 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/schema_data_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SchemaDataParam"] + + +class SchemaDataParam(TypedDict, total=False): + host: str + """The desired endpoint to test.""" + + kind: str + """The type of test.""" + + method: str + """The HTTP request method type.""" diff --git a/src/cloudflare/types/zero_trust/devices/schema_http.py b/src/cloudflare/types/zero_trust/devices/schema_http.py new file mode 100644 index 00000000000..43e763610ff --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/schema_http.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel +from .schema_data import SchemaData + +__all__ = ["SchemaHTTP", "TargetPolicy"] + + +class TargetPolicy(BaseModel): + id: Optional[str] = None + """The id of the device settings profile""" + + default: Optional[bool] = None + """Whether the profile is the account default""" + + name: Optional[str] = None + """The name of the device settings profile""" + + +class SchemaHTTP(BaseModel): + data: SchemaData + """ + The configuration object which contains the details for the WARP client to + conduct the test. + """ + + enabled: bool + """Determines whether or not the test is active.""" + + interval: str + """How often the test will run.""" + + name: str + """The name of the DEX test. Must be unique.""" + + description: Optional[str] = None + """Additional details about the test.""" + + target_policies: Optional[List[TargetPolicy]] = None + """Device settings profiles targeted by this test""" + + targeted: Optional[bool] = None diff --git a/src/cloudflare/types/zero_trust/devices/sentinelone_input.py b/src/cloudflare/types/zero_trust/devices/sentinelone_input.py new file mode 100644 index 00000000000..cfe6b020f91 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/sentinelone_input.py @@ -0,0 +1,22 @@ +# 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__ = ["SentineloneInput"] + + +class SentineloneInput(BaseModel): + operating_system: Literal["windows", "linux", "mac"] + """Operating system""" + + path: str + """File path.""" + + sha256: Optional[str] = None + """SHA-256.""" + + thumbprint: Optional[str] = None + """Signing certificate thumbprint.""" diff --git a/src/cloudflare/types/zero_trust/devices/sentinelone_input_param.py b/src/cloudflare/types/zero_trust/devices/sentinelone_input_param.py new file mode 100644 index 00000000000..062c2a5206d --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/sentinelone_input_param.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 Literal, Required, TypedDict + +__all__ = ["SentineloneInputParam"] + + +class SentineloneInputParam(TypedDict, total=False): + operating_system: Required[Literal["windows", "linux", "mac"]] + """Operating system""" + + path: Required[str] + """File path.""" + + sha256: str + """SHA-256.""" + + thumbprint: str + """Signing certificate thumbprint.""" diff --git a/src/cloudflare/types/zero_trust/devices/sentinelone_s2s_input.py b/src/cloudflare/types/zero_trust/devices/sentinelone_s2s_input.py new file mode 100644 index 00000000000..fbd2d9ca1e2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/sentinelone_s2s_input.py @@ -0,0 +1,28 @@ +# 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__ = ["SentineloneS2sInput"] + + +class SentineloneS2sInput(BaseModel): + connection_id: str + """Posture Integration ID.""" + + active_threats: Optional[float] = None + """The Number of active threats.""" + + infected: Optional[bool] = None + """Whether device is infected.""" + + is_active: Optional[bool] = None + """Whether device is active.""" + + network_status: Optional[Literal["connected", "disconnected", "disconnecting", "connecting"]] = None + """Network status of device.""" + + operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = None + """operator""" diff --git a/src/cloudflare/types/zero_trust/devices/sentinelone_s2s_input_param.py b/src/cloudflare/types/zero_trust/devices/sentinelone_s2s_input_param.py new file mode 100644 index 00000000000..6b73f36f07e --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/sentinelone_s2s_input_param.py @@ -0,0 +1,27 @@ +# 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__ = ["SentineloneS2sInputParam"] + + +class SentineloneS2sInputParam(TypedDict, total=False): + connection_id: Required[str] + """Posture Integration ID.""" + + active_threats: float + """The Number of active threats.""" + + infected: bool + """Whether device is infected.""" + + is_active: bool + """Whether device is active.""" + + network_status: Literal["connected", "disconnected", "disconnecting", "connecting"] + """Network status of device.""" + + operator: Literal["<", "<=", ">", ">=", "=="] + """operator""" diff --git a/src/cloudflare/types/zero_trust/devices/settings_policy.py b/src/cloudflare/types/zero_trust/devices/settings_policy.py new file mode 100644 index 00000000000..a670a4c8927 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/settings_policy.py @@ -0,0 +1,115 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel +from .policies.fallback_domain import FallbackDomain +from .policies.split_tunnel_exclude import SplitTunnelExclude +from .policies.split_tunnel_include import SplitTunnelInclude + +__all__ = ["SettingsPolicy", "ServiceModeV2", "TargetTest"] + + +class ServiceModeV2(BaseModel): + mode: Optional[str] = None + """The mode to run the WARP client under.""" + + port: Optional[float] = None + """The port number when used with proxy mode.""" + + +class TargetTest(BaseModel): + id: Optional[str] = None + """The id of the DEX test targeting this policy""" + + name: Optional[str] = None + """The name of the DEX test targeting this policy""" + + +class SettingsPolicy(BaseModel): + allow_mode_switch: Optional[bool] = None + """Whether to allow the user to switch WARP between modes.""" + + allow_updates: Optional[bool] = None + """ + Whether to receive update notifications when a new version of the client is + available. + """ + + allowed_to_leave: Optional[bool] = None + """Whether to allow devices to leave the organization.""" + + auto_connect: Optional[float] = None + """The amount of time in minutes to reconnect after having been disabled.""" + + captive_portal: Optional[float] = None + """Turn on the captive portal after the specified amount of time.""" + + default: Optional[bool] = None + """Whether the policy is the default policy for an account.""" + + description: Optional[str] = None + """A description of the policy.""" + + disable_auto_fallback: Optional[bool] = None + """ + If the `dns_server` field of a fallback domain is not present, the client will + fall back to a best guess of the default/system DNS resolvers unless this policy + option is set to `true`. + """ + + enabled: Optional[bool] = None + """Whether the policy will be applied to matching devices.""" + + exclude: Optional[List[SplitTunnelExclude]] = None + + exclude_office_ips: Optional[bool] = None + """Whether to add Microsoft IPs to Split Tunnel exclusions.""" + + fallback_domains: Optional[List[FallbackDomain]] = None + + gateway_unique_id: Optional[str] = None + + include: Optional[List[SplitTunnelInclude]] = None + + lan_allow_minutes: Optional[float] = None + """The amount of time in minutes a user is allowed access to their LAN. + + A value of 0 will allow LAN access until the next WARP reconnection, such as a + reboot or a laptop waking from sleep. Note that this field is omitted from the + response if null or unset. + """ + + lan_allow_subnet_size: Optional[float] = None + """The size of the subnet for the local access network. + + Note that this field is omitted from the response if null or unset. + """ + + match: Optional[str] = None + """The wirefilter expression to match devices.""" + + name: Optional[str] = None + """The name of the device settings profile.""" + + policy_id: Optional[str] = None + """Device ID.""" + + precedence: Optional[float] = None + """The precedence of the policy. + + Lower values indicate higher precedence. Policies will be evaluated in ascending + order of this field. + """ + + service_mode_v2: Optional[ServiceModeV2] = None + + support_url: Optional[str] = None + """The URL to launch when the Send Feedback button is clicked.""" + + switch_locked: Optional[bool] = None + """ + Whether to allow the user to turn off the WARP switch and disconnect the client. + """ + + target_tests: Optional[List[TargetTest]] = None diff --git a/src/cloudflare/types/zero_trust/devices/tanium_input.py b/src/cloudflare/types/zero_trust/devices/tanium_input.py new file mode 100644 index 00000000000..80f623cf50e --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/tanium_input.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["TaniumInput"] + + +class TaniumInput(BaseModel): + connection_id: str + """Posture Integration ID.""" + + eid_last_seen: Optional[str] = None + """For more details on eid last seen, refer to the Tanium documentation.""" + + operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = None + """Operator to evaluate risk_level or eid_last_seen.""" + + risk_level: Optional[Literal["low", "medium", "high", "critical"]] = None + """For more details on risk level, refer to the Tanium documentation.""" + + score_operator: Optional[Literal["<", "<=", ">", ">=", "=="]] = FieldInfo(alias="scoreOperator", default=None) + """Score Operator""" + + total_score: Optional[float] = None + """For more details on total score, refer to the Tanium documentation.""" diff --git a/src/cloudflare/types/zero_trust/devices/tanium_input_param.py b/src/cloudflare/types/zero_trust/devices/tanium_input_param.py new file mode 100644 index 00000000000..e62ab115ef0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/tanium_input_param.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 Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["TaniumInputParam"] + + +class TaniumInputParam(TypedDict, total=False): + connection_id: Required[str] + """Posture Integration ID.""" + + eid_last_seen: str + """For more details on eid last seen, refer to the Tanium documentation.""" + + operator: Literal["<", "<=", ">", ">=", "=="] + """Operator to evaluate risk_level or eid_last_seen.""" + + risk_level: Literal["low", "medium", "high", "critical"] + """For more details on risk level, refer to the Tanium documentation.""" + + score_operator: Annotated[Literal["<", "<=", ">", ">=", "=="], PropertyInfo(alias="scoreOperator")] + """Score Operator""" + + total_score: float + """For more details on total score, refer to the Tanium documentation.""" diff --git a/src/cloudflare/types/zero_trust/devices/unique_client_id_input.py b/src/cloudflare/types/zero_trust/devices/unique_client_id_input.py new file mode 100644 index 00000000000..524cfa7f3b8 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/unique_client_id_input.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["UniqueClientIDInput"] + + +class UniqueClientIDInput(BaseModel): + id: str + """List ID.""" + + operating_system: Literal["android", "ios", "chromeos"] + """Operating System""" diff --git a/src/cloudflare/types/zero_trust/devices/unique_client_id_input_param.py b/src/cloudflare/types/zero_trust/devices/unique_client_id_input_param.py new file mode 100644 index 00000000000..d6245c49c5a --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/unique_client_id_input_param.py @@ -0,0 +1,15 @@ +# 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__ = ["UniqueClientIDInputParam"] + + +class UniqueClientIDInputParam(TypedDict, total=False): + id: Required[str] + """List ID.""" + + operating_system: Required[Literal["android", "ios", "chromeos"]] + """Operating System""" 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 7462d7fafeb..0abba62d03a 100644 --- a/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py +++ b/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["UnrevokeCreateResponse"] -UnrevokeCreateResponse = Union[str, object, None] +UnrevokeCreateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/devices/workspace_one_input.py b/src/cloudflare/types/zero_trust/devices/workspace_one_input.py new file mode 100644 index 00000000000..4f532e33c1a --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/workspace_one_input.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["WorkspaceOneInput"] + + +class WorkspaceOneInput(BaseModel): + compliance_status: Literal["compliant", "noncompliant", "unknown"] + """Compliance Status""" + + connection_id: str + """Posture Integration ID.""" diff --git a/src/cloudflare/types/zero_trust/devices/workspace_one_input_param.py b/src/cloudflare/types/zero_trust/devices/workspace_one_input_param.py new file mode 100644 index 00000000000..1c82dfaf594 --- /dev/null +++ b/src/cloudflare/types/zero_trust/devices/workspace_one_input_param.py @@ -0,0 +1,15 @@ +# 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__ = ["WorkspaceOneInputParam"] + + +class WorkspaceOneInputParam(TypedDict, total=False): + compliance_status: Required[Literal["compliant", "noncompliant", "unknown"]] + """Compliance Status""" + + connection_id: Required[str] + """Posture Integration ID.""" diff --git a/src/cloudflare/types/zero_trust/devices/zero_trust_account_device_settings.py b/src/cloudflare/types/zero_trust/devices/zero_trust_account_device_settings.py deleted file mode 100644 index 17535b12e09..00000000000 --- a/src/cloudflare/types/zero_trust/devices/zero_trust_account_device_settings.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["ZeroTrustAccountDeviceSettings"] - - -class ZeroTrustAccountDeviceSettings(BaseModel): - gateway_proxy_enabled: Optional[bool] = None - """Enable gateway proxy filtering on TCP.""" - - gateway_udp_proxy_enabled: Optional[bool] = None - """Enable gateway proxy filtering on UDP.""" - - root_certificate_installation_enabled: Optional[bool] = None - """Enable installation of cloudflare managed root certificate.""" - - use_zt_virtual_ip: Optional[bool] = None - """Enable using CGNAT virtual IPv4.""" diff --git a/src/cloudflare/types/zero_trust/dex/__init__.py b/src/cloudflare/types/zero_trust/dex/__init__.py index 7262361be64..efa573e206b 100644 --- a/src/cloudflare/types/zero_trust/dex/__init__.py +++ b/src/cloudflare/types/zero_trust/dex/__init__.py @@ -2,26 +2,19 @@ from __future__ import annotations +from .tests import Tests as Tests +from .live_stat import LiveStat as LiveStat +from .traceroute import Traceroute as Traceroute +from .http_details import HTTPDetails as HTTPDetails from .colo_list_params import ColoListParams as ColoListParams from .test_list_params import TestListParams as TestListParams from .test_list_response import TestListResponse as TestListResponse from .http_test_get_params import HTTPTestGetParams as HTTPTestGetParams +from .aggregate_time_period import AggregateTimePeriod as AggregateTimePeriod from .fleet_status_live_params import FleetStatusLiveParams as FleetStatusLiveParams from .fleet_status_live_response import FleetStatusLiveResponse as FleetStatusLiveResponse from .traceroute_test_get_params import TracerouteTestGetParams as TracerouteTestGetParams from .fleet_status_over_time_params import FleetStatusOverTimeParams as FleetStatusOverTimeParams from .traceroute_test_percentiles_params import TracerouteTestPercentilesParams as TracerouteTestPercentilesParams -from .digital_experience_monitoring_tests import DigitalExperienceMonitoringTests as DigitalExperienceMonitoringTests from .traceroute_test_network_path_params import TracerouteTestNetworkPathParams as TracerouteTestNetworkPathParams -from .digital_experience_monitoring_http_details import ( - DigitalExperienceMonitoringHTTPDetails as DigitalExperienceMonitoringHTTPDetails, -) -from .digital_experience_monitoring_traceroute_details import ( - DigitalExperienceMonitoringTracerouteDetails as DigitalExperienceMonitoringTracerouteDetails, -) -from .digital_experience_monitoring_traceroute_test_network_path import ( - DigitalExperienceMonitoringTracerouteTestNetworkPath as DigitalExperienceMonitoringTracerouteTestNetworkPath, -) -from .digital_experience_monitoring_traceroute_details_percentiles import ( - DigitalExperienceMonitoringTracerouteDetailsPercentiles as DigitalExperienceMonitoringTracerouteDetailsPercentiles, -) +from .traceroute_test_percentiles_response import TracerouteTestPercentilesResponse as TracerouteTestPercentilesResponse diff --git a/src/cloudflare/types/zero_trust/dex/aggregate_time_period.py b/src/cloudflare/types/zero_trust/dex/aggregate_time_period.py new file mode 100644 index 00000000000..2a855a312a7 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/aggregate_time_period.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AggregateTimePeriod"] + + +class AggregateTimePeriod(BaseModel): + units: Literal["hours", "days", "testRuns"] + + value: int diff --git a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_http_details.py b/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_http_details.py deleted file mode 100644 index dd285570478..00000000000 --- a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_http_details.py +++ /dev/null @@ -1,214 +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 pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "DigitalExperienceMonitoringHTTPDetails", - "HTTPStats", - "HTTPStatsDNSResponseTimeMs", - "HTTPStatsDNSResponseTimeMsSlot", - "HTTPStatsHTTPStatusCode", - "HTTPStatsResourceFetchTimeMs", - "HTTPStatsResourceFetchTimeMsSlot", - "HTTPStatsServerResponseTimeMs", - "HTTPStatsServerResponseTimeMsSlot", - "HTTPStatsByColo", - "HTTPStatsByColoDNSResponseTimeMs", - "HTTPStatsByColoDNSResponseTimeMsSlot", - "HTTPStatsByColoHTTPStatusCode", - "HTTPStatsByColoResourceFetchTimeMs", - "HTTPStatsByColoResourceFetchTimeMsSlot", - "HTTPStatsByColoServerResponseTimeMs", - "HTTPStatsByColoServerResponseTimeMsSlot", -] - - -class HTTPStatsDNSResponseTimeMsSlot(BaseModel): - timestamp: str - - value: int - - -class HTTPStatsDNSResponseTimeMs(BaseModel): - slots: List[HTTPStatsDNSResponseTimeMsSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class HTTPStatsHTTPStatusCode(BaseModel): - status200: int - - status300: int - - status400: int - - status500: int - - timestamp: str - - -class HTTPStatsResourceFetchTimeMsSlot(BaseModel): - timestamp: str - - value: int - - -class HTTPStatsResourceFetchTimeMs(BaseModel): - slots: List[HTTPStatsResourceFetchTimeMsSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class HTTPStatsServerResponseTimeMsSlot(BaseModel): - timestamp: str - - value: int - - -class HTTPStatsServerResponseTimeMs(BaseModel): - slots: List[HTTPStatsServerResponseTimeMsSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class HTTPStats(BaseModel): - dns_response_time_ms: HTTPStatsDNSResponseTimeMs = FieldInfo(alias="dnsResponseTimeMs") - - http_status_code: List[HTTPStatsHTTPStatusCode] = FieldInfo(alias="httpStatusCode") - - resource_fetch_time_ms: HTTPStatsResourceFetchTimeMs = FieldInfo(alias="resourceFetchTimeMs") - - server_response_time_ms: HTTPStatsServerResponseTimeMs = FieldInfo(alias="serverResponseTimeMs") - - unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") - """Count of unique devices that have run this test in the given time period""" - - -class HTTPStatsByColoDNSResponseTimeMsSlot(BaseModel): - timestamp: str - - value: int - - -class HTTPStatsByColoDNSResponseTimeMs(BaseModel): - slots: List[HTTPStatsByColoDNSResponseTimeMsSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class HTTPStatsByColoHTTPStatusCode(BaseModel): - status200: int - - status300: int - - status400: int - - status500: int - - timestamp: str - - -class HTTPStatsByColoResourceFetchTimeMsSlot(BaseModel): - timestamp: str - - value: int - - -class HTTPStatsByColoResourceFetchTimeMs(BaseModel): - slots: List[HTTPStatsByColoResourceFetchTimeMsSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class HTTPStatsByColoServerResponseTimeMsSlot(BaseModel): - timestamp: str - - value: int - - -class HTTPStatsByColoServerResponseTimeMs(BaseModel): - slots: List[HTTPStatsByColoServerResponseTimeMsSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class HTTPStatsByColo(BaseModel): - colo: str - - dns_response_time_ms: HTTPStatsByColoDNSResponseTimeMs = FieldInfo(alias="dnsResponseTimeMs") - - http_status_code: List[HTTPStatsByColoHTTPStatusCode] = FieldInfo(alias="httpStatusCode") - - resource_fetch_time_ms: HTTPStatsByColoResourceFetchTimeMs = FieldInfo(alias="resourceFetchTimeMs") - - server_response_time_ms: HTTPStatsByColoServerResponseTimeMs = FieldInfo(alias="serverResponseTimeMs") - - unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") - """Count of unique devices that have run this test in the given time period""" - - -class DigitalExperienceMonitoringHTTPDetails(BaseModel): - host: Optional[str] = None - """The url of the HTTP synthetic application test""" - - http_stats: Optional[HTTPStats] = FieldInfo(alias="httpStats", default=None) - - http_stats_by_colo: Optional[List[HTTPStatsByColo]] = FieldInfo(alias="httpStatsByColo", default=None) - - interval: Optional[str] = None - """The interval at which the HTTP synthetic application test is set to run.""" - - kind: Optional[Literal["http"]] = None - - method: Optional[str] = None - """The HTTP method to use when running the test""" - - name: Optional[str] = None - """The name of the HTTP synthetic application test""" diff --git a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_tests.py b/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_tests.py deleted file mode 100644 index 21272b79796..00000000000 --- a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_tests.py +++ /dev/null @@ -1,311 +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 pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "DigitalExperienceMonitoringTests", - "OverviewMetrics", - "Test", - "TestHTTPResults", - "TestHTTPResultsResourceFetchTime", - "TestHTTPResultsResourceFetchTimeHistory", - "TestHTTPResultsResourceFetchTimeHistoryTimePeriod", - "TestHTTPResultsResourceFetchTimeOverTime", - "TestHTTPResultsResourceFetchTimeOverTimeTimePeriod", - "TestHTTPResultsResourceFetchTimeOverTimeValue", - "TestHTTPResultsByColo", - "TestHTTPResultsByColoResourceFetchTime", - "TestHTTPResultsByColoResourceFetchTimeHistory", - "TestHTTPResultsByColoResourceFetchTimeHistoryTimePeriod", - "TestHTTPResultsByColoResourceFetchTimeOverTime", - "TestHTTPResultsByColoResourceFetchTimeOverTimeTimePeriod", - "TestHTTPResultsByColoResourceFetchTimeOverTimeValue", - "TestTracerouteResults", - "TestTracerouteResultsRoundTripTime", - "TestTracerouteResultsRoundTripTimeHistory", - "TestTracerouteResultsRoundTripTimeHistoryTimePeriod", - "TestTracerouteResultsRoundTripTimeOverTime", - "TestTracerouteResultsRoundTripTimeOverTimeTimePeriod", - "TestTracerouteResultsRoundTripTimeOverTimeValue", - "TestTracerouteResultsByColo", - "TestTracerouteResultsByColoRoundTripTime", - "TestTracerouteResultsByColoRoundTripTimeHistory", - "TestTracerouteResultsByColoRoundTripTimeHistoryTimePeriod", - "TestTracerouteResultsByColoRoundTripTimeOverTime", - "TestTracerouteResultsByColoRoundTripTimeOverTimeTimePeriod", - "TestTracerouteResultsByColoRoundTripTimeOverTimeValue", -] - - -class OverviewMetrics(BaseModel): - tests_total: int = FieldInfo(alias="testsTotal") - """number of tests.""" - - avg_traceroute_availability_pct: Optional[float] = FieldInfo(alias="avgTracerouteAvailabilityPct", default=None) - """percentage availability for all traceroutes results in response""" - - -class TestHTTPResultsResourceFetchTimeHistoryTimePeriod(BaseModel): - __test__ = False - units: Literal["hours", "days", "testRuns"] - - value: int - - -class TestHTTPResultsResourceFetchTimeHistory(BaseModel): - __test__ = False - time_period: TestHTTPResultsResourceFetchTimeHistoryTimePeriod = FieldInfo(alias="timePeriod") - - avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) - - delta_pct: Optional[float] = FieldInfo(alias="deltaPct", default=None) - - -class TestHTTPResultsResourceFetchTimeOverTimeTimePeriod(BaseModel): - __test__ = False - units: Literal["hours", "days", "testRuns"] - - value: int - - -class TestHTTPResultsResourceFetchTimeOverTimeValue(BaseModel): - __test__ = False - avg_ms: int = FieldInfo(alias="avgMs") - - timestamp: str - - -class TestHTTPResultsResourceFetchTimeOverTime(BaseModel): - __test__ = False - time_period: TestHTTPResultsResourceFetchTimeOverTimeTimePeriod = FieldInfo(alias="timePeriod") - - values: List[TestHTTPResultsResourceFetchTimeOverTimeValue] - - -class TestHTTPResultsResourceFetchTime(BaseModel): - __test__ = False - history: List[TestHTTPResultsResourceFetchTimeHistory] - - avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) - - over_time: Optional[TestHTTPResultsResourceFetchTimeOverTime] = FieldInfo(alias="overTime", default=None) - - -class TestHTTPResults(BaseModel): - __test__ = False - resource_fetch_time: TestHTTPResultsResourceFetchTime = FieldInfo(alias="resourceFetchTime") - - -class TestHTTPResultsByColoResourceFetchTimeHistoryTimePeriod(BaseModel): - __test__ = False - units: Literal["hours", "days", "testRuns"] - - value: int - - -class TestHTTPResultsByColoResourceFetchTimeHistory(BaseModel): - __test__ = False - time_period: TestHTTPResultsByColoResourceFetchTimeHistoryTimePeriod = FieldInfo(alias="timePeriod") - - avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) - - delta_pct: Optional[float] = FieldInfo(alias="deltaPct", default=None) - - -class TestHTTPResultsByColoResourceFetchTimeOverTimeTimePeriod(BaseModel): - __test__ = False - units: Literal["hours", "days", "testRuns"] - - value: int - - -class TestHTTPResultsByColoResourceFetchTimeOverTimeValue(BaseModel): - __test__ = False - avg_ms: int = FieldInfo(alias="avgMs") - - timestamp: str - - -class TestHTTPResultsByColoResourceFetchTimeOverTime(BaseModel): - __test__ = False - time_period: TestHTTPResultsByColoResourceFetchTimeOverTimeTimePeriod = FieldInfo(alias="timePeriod") - - values: List[TestHTTPResultsByColoResourceFetchTimeOverTimeValue] - - -class TestHTTPResultsByColoResourceFetchTime(BaseModel): - __test__ = False - history: List[TestHTTPResultsByColoResourceFetchTimeHistory] - - avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) - - over_time: Optional[TestHTTPResultsByColoResourceFetchTimeOverTime] = FieldInfo(alias="overTime", default=None) - - -class TestHTTPResultsByColo(BaseModel): - __test__ = False - colo: str - """Cloudflare colo""" - - resource_fetch_time: TestHTTPResultsByColoResourceFetchTime = FieldInfo(alias="resourceFetchTime") - - -class TestTracerouteResultsRoundTripTimeHistoryTimePeriod(BaseModel): - __test__ = False - units: Literal["hours", "days", "testRuns"] - - value: int - - -class TestTracerouteResultsRoundTripTimeHistory(BaseModel): - __test__ = False - time_period: TestTracerouteResultsRoundTripTimeHistoryTimePeriod = FieldInfo(alias="timePeriod") - - avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) - - delta_pct: Optional[float] = FieldInfo(alias="deltaPct", default=None) - - -class TestTracerouteResultsRoundTripTimeOverTimeTimePeriod(BaseModel): - __test__ = False - units: Literal["hours", "days", "testRuns"] - - value: int - - -class TestTracerouteResultsRoundTripTimeOverTimeValue(BaseModel): - __test__ = False - avg_ms: int = FieldInfo(alias="avgMs") - - timestamp: str - - -class TestTracerouteResultsRoundTripTimeOverTime(BaseModel): - __test__ = False - time_period: TestTracerouteResultsRoundTripTimeOverTimeTimePeriod = FieldInfo(alias="timePeriod") - - values: List[TestTracerouteResultsRoundTripTimeOverTimeValue] - - -class TestTracerouteResultsRoundTripTime(BaseModel): - __test__ = False - history: List[TestTracerouteResultsRoundTripTimeHistory] - - avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) - - over_time: Optional[TestTracerouteResultsRoundTripTimeOverTime] = FieldInfo(alias="overTime", default=None) - - -class TestTracerouteResults(BaseModel): - __test__ = False - round_trip_time: TestTracerouteResultsRoundTripTime = FieldInfo(alias="roundTripTime") - - -class TestTracerouteResultsByColoRoundTripTimeHistoryTimePeriod(BaseModel): - __test__ = False - units: Literal["hours", "days", "testRuns"] - - value: int - - -class TestTracerouteResultsByColoRoundTripTimeHistory(BaseModel): - __test__ = False - time_period: TestTracerouteResultsByColoRoundTripTimeHistoryTimePeriod = FieldInfo(alias="timePeriod") - - avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) - - delta_pct: Optional[float] = FieldInfo(alias="deltaPct", default=None) - - -class TestTracerouteResultsByColoRoundTripTimeOverTimeTimePeriod(BaseModel): - __test__ = False - units: Literal["hours", "days", "testRuns"] - - value: int - - -class TestTracerouteResultsByColoRoundTripTimeOverTimeValue(BaseModel): - __test__ = False - avg_ms: int = FieldInfo(alias="avgMs") - - timestamp: str - - -class TestTracerouteResultsByColoRoundTripTimeOverTime(BaseModel): - __test__ = False - time_period: TestTracerouteResultsByColoRoundTripTimeOverTimeTimePeriod = FieldInfo(alias="timePeriod") - - values: List[TestTracerouteResultsByColoRoundTripTimeOverTimeValue] - - -class TestTracerouteResultsByColoRoundTripTime(BaseModel): - __test__ = False - history: List[TestTracerouteResultsByColoRoundTripTimeHistory] - - avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) - - over_time: Optional[TestTracerouteResultsByColoRoundTripTimeOverTime] = FieldInfo(alias="overTime", default=None) - - -class TestTracerouteResultsByColo(BaseModel): - __test__ = False - colo: str - """Cloudflare colo""" - - round_trip_time: TestTracerouteResultsByColoRoundTripTime = FieldInfo(alias="roundTripTime") - - -class Test(BaseModel): - __test__ = False - id: str - """API Resource UUID tag.""" - - created: str - """date the test was created.""" - - description: str - """the test description defined during configuration""" - - enabled: bool - """if true, then the test will run on targeted devices. - - Else, the test will not run. - """ - - host: str - - interval: str - """The interval at which the synthetic application test is set to run.""" - - kind: Literal["http", "traceroute"] - """test type, http or traceroute""" - - name: str - """name given to this test""" - - updated: str - - http_results: Optional[TestHTTPResults] = FieldInfo(alias="httpResults", default=None) - - http_results_by_colo: Optional[List[TestHTTPResultsByColo]] = FieldInfo(alias="httpResultsByColo", default=None) - - method: Optional[str] = None - """for HTTP, the method to use when running the test""" - - traceroute_results: Optional[TestTracerouteResults] = FieldInfo(alias="tracerouteResults", default=None) - - traceroute_results_by_colo: Optional[List[TestTracerouteResultsByColo]] = FieldInfo( - alias="tracerouteResultsByColo", default=None - ) - - -class DigitalExperienceMonitoringTests(BaseModel): - overview_metrics: OverviewMetrics = FieldInfo(alias="overviewMetrics") - - tests: List[Test] - """array of test results objects.""" diff --git a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_details.py b/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_details.py deleted file mode 100644 index 3c95b785c6f..00000000000 --- a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_details.py +++ /dev/null @@ -1,229 +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 pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "DigitalExperienceMonitoringTracerouteDetails", - "TracerouteStats", - "TracerouteStatsAvailabilityPct", - "TracerouteStatsAvailabilityPctSlot", - "TracerouteStatsHopsCount", - "TracerouteStatsHopsCountSlot", - "TracerouteStatsPacketLossPct", - "TracerouteStatsPacketLossPctSlot", - "TracerouteStatsRoundTripTimeMs", - "TracerouteStatsRoundTripTimeMsSlot", - "TracerouteStatsByColo", - "TracerouteStatsByColoAvailabilityPct", - "TracerouteStatsByColoAvailabilityPctSlot", - "TracerouteStatsByColoHopsCount", - "TracerouteStatsByColoHopsCountSlot", - "TracerouteStatsByColoPacketLossPct", - "TracerouteStatsByColoPacketLossPctSlot", - "TracerouteStatsByColoRoundTripTimeMs", - "TracerouteStatsByColoRoundTripTimeMsSlot", -] - - -class TracerouteStatsAvailabilityPctSlot(BaseModel): - timestamp: str - - value: float - - -class TracerouteStatsAvailabilityPct(BaseModel): - slots: List[TracerouteStatsAvailabilityPctSlot] - - avg: Optional[float] = None - """average observed in the time period""" - - max: Optional[float] = None - """highest observed in the time period""" - - min: Optional[float] = None - """lowest observed in the time period""" - - -class TracerouteStatsHopsCountSlot(BaseModel): - timestamp: str - - value: int - - -class TracerouteStatsHopsCount(BaseModel): - slots: List[TracerouteStatsHopsCountSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class TracerouteStatsPacketLossPctSlot(BaseModel): - timestamp: str - - value: float - - -class TracerouteStatsPacketLossPct(BaseModel): - slots: List[TracerouteStatsPacketLossPctSlot] - - avg: Optional[float] = None - """average observed in the time period""" - - max: Optional[float] = None - """highest observed in the time period""" - - min: Optional[float] = None - """lowest observed in the time period""" - - -class TracerouteStatsRoundTripTimeMsSlot(BaseModel): - timestamp: str - - value: int - - -class TracerouteStatsRoundTripTimeMs(BaseModel): - slots: List[TracerouteStatsRoundTripTimeMsSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class TracerouteStats(BaseModel): - availability_pct: TracerouteStatsAvailabilityPct = FieldInfo(alias="availabilityPct") - - hops_count: TracerouteStatsHopsCount = FieldInfo(alias="hopsCount") - - packet_loss_pct: TracerouteStatsPacketLossPct = FieldInfo(alias="packetLossPct") - - round_trip_time_ms: TracerouteStatsRoundTripTimeMs = FieldInfo(alias="roundTripTimeMs") - - unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") - """Count of unique devices that have run this test in the given time period""" - - -class TracerouteStatsByColoAvailabilityPctSlot(BaseModel): - timestamp: str - - value: float - - -class TracerouteStatsByColoAvailabilityPct(BaseModel): - slots: List[TracerouteStatsByColoAvailabilityPctSlot] - - avg: Optional[float] = None - """average observed in the time period""" - - max: Optional[float] = None - """highest observed in the time period""" - - min: Optional[float] = None - """lowest observed in the time period""" - - -class TracerouteStatsByColoHopsCountSlot(BaseModel): - timestamp: str - - value: int - - -class TracerouteStatsByColoHopsCount(BaseModel): - slots: List[TracerouteStatsByColoHopsCountSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class TracerouteStatsByColoPacketLossPctSlot(BaseModel): - timestamp: str - - value: float - - -class TracerouteStatsByColoPacketLossPct(BaseModel): - slots: List[TracerouteStatsByColoPacketLossPctSlot] - - avg: Optional[float] = None - """average observed in the time period""" - - max: Optional[float] = None - """highest observed in the time period""" - - min: Optional[float] = None - """lowest observed in the time period""" - - -class TracerouteStatsByColoRoundTripTimeMsSlot(BaseModel): - timestamp: str - - value: int - - -class TracerouteStatsByColoRoundTripTimeMs(BaseModel): - slots: List[TracerouteStatsByColoRoundTripTimeMsSlot] - - avg: Optional[int] = None - """average observed in the time period""" - - max: Optional[int] = None - """highest observed in the time period""" - - min: Optional[int] = None - """lowest observed in the time period""" - - -class TracerouteStatsByColo(BaseModel): - availability_pct: TracerouteStatsByColoAvailabilityPct = FieldInfo(alias="availabilityPct") - - colo: str - - hops_count: TracerouteStatsByColoHopsCount = FieldInfo(alias="hopsCount") - - packet_loss_pct: TracerouteStatsByColoPacketLossPct = FieldInfo(alias="packetLossPct") - - round_trip_time_ms: TracerouteStatsByColoRoundTripTimeMs = FieldInfo(alias="roundTripTimeMs") - - unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") - """Count of unique devices that have run this test in the given time period""" - - -class DigitalExperienceMonitoringTracerouteDetails(BaseModel): - host: str - """The host of the Traceroute synthetic application test""" - - interval: str - """The interval at which the Traceroute synthetic application test is set to run.""" - - kind: Literal["traceroute"] - - name: str - """The name of the Traceroute synthetic application test""" - - traceroute_stats: Optional[TracerouteStats] = FieldInfo(alias="tracerouteStats", default=None) - - traceroute_stats_by_colo: Optional[List[TracerouteStatsByColo]] = FieldInfo( - alias="tracerouteStatsByColo", default=None - ) diff --git a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_details_percentiles.py b/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_details_percentiles.py deleted file mode 100644 index 3782a505f57..00000000000 --- a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_details_percentiles.py +++ /dev/null @@ -1,59 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["DigitalExperienceMonitoringTracerouteDetailsPercentiles", "HopsCount", "PacketLossPct", "RoundTripTimeMs"] - - -class HopsCount(BaseModel): - p50: Optional[float] = None - """p50 observed in the time period""" - - p90: Optional[float] = None - """p90 observed in the time period""" - - p95: Optional[float] = None - """p95 observed in the time period""" - - p99: Optional[float] = None - """p99 observed in the time period""" - - -class PacketLossPct(BaseModel): - p50: Optional[float] = None - """p50 observed in the time period""" - - p90: Optional[float] = None - """p90 observed in the time period""" - - p95: Optional[float] = None - """p95 observed in the time period""" - - p99: Optional[float] = None - """p99 observed in the time period""" - - -class RoundTripTimeMs(BaseModel): - p50: Optional[float] = None - """p50 observed in the time period""" - - p90: Optional[float] = None - """p90 observed in the time period""" - - p95: Optional[float] = None - """p95 observed in the time period""" - - p99: Optional[float] = None - """p99 observed in the time period""" - - -class DigitalExperienceMonitoringTracerouteDetailsPercentiles(BaseModel): - hops_count: Optional[HopsCount] = FieldInfo(alias="hopsCount", default=None) - - packet_loss_pct: Optional[PacketLossPct] = FieldInfo(alias="packetLossPct", default=None) - - round_trip_time_ms: Optional[RoundTripTimeMs] = FieldInfo(alias="roundTripTimeMs", default=None) diff --git a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_test_network_path.py b/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_test_network_path.py deleted file mode 100644 index 8dc34d3cab8..00000000000 --- a/src/cloudflare/types/zero_trust/dex/digital_experience_monitoring_traceroute_test_network_path.py +++ /dev/null @@ -1,70 +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 pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "DigitalExperienceMonitoringTracerouteTestNetworkPath", - "NetworkPath", - "NetworkPathSlot", - "NetworkPathSampling", -] - - -class NetworkPathSlot(BaseModel): - id: str - """API Resource UUID tag.""" - - client_to_app_rtt_ms: Optional[int] = FieldInfo(alias="clientToAppRttMs", default=None) - """Round trip time in ms of the client to app mile""" - - client_to_cf_egress_rtt_ms: Optional[int] = FieldInfo(alias="clientToCfEgressRttMs", default=None) - """Round trip time in ms of the client to Cloudflare egress mile""" - - client_to_cf_ingress_rtt_ms: Optional[int] = FieldInfo(alias="clientToCfIngressRttMs", default=None) - """Round trip time in ms of the client to Cloudflare ingress mile""" - - timestamp: str - - client_to_isp_rtt_ms: Optional[int] = FieldInfo(alias="clientToIspRttMs", default=None) - """Round trip time in ms of the client to ISP mile""" - - -class NetworkPathSampling(BaseModel): - unit: Literal["hours"] - - value: int - - -class NetworkPath(BaseModel): - slots: List[NetworkPathSlot] - - sampling: Optional[NetworkPathSampling] = None - """Specifies the sampling applied, if any, to the slots response. - - When sampled, results shown represent the first test run to the start of each - sampling interval. - """ - - -class DigitalExperienceMonitoringTracerouteTestNetworkPath(BaseModel): - id: str - """API Resource UUID tag.""" - - device_name: Optional[str] = FieldInfo(alias="deviceName", default=None) - - interval: Optional[str] = None - """The interval at which the Traceroute synthetic application test is set to run.""" - - kind: Optional[Literal["traceroute"]] = None - - name: Optional[str] = None - - network_path: Optional[NetworkPath] = FieldInfo(alias="networkPath", default=None) - - url: Optional[str] = None - """The host of the Traceroute synthetic application test""" diff --git a/src/cloudflare/types/zero_trust/dex/fleet_status/__init__.py b/src/cloudflare/types/zero_trust/dex/fleet_status/__init__.py index 0f5a1d08889..62c9574d136 100644 --- a/src/cloudflare/types/zero_trust/dex/fleet_status/__init__.py +++ b/src/cloudflare/types/zero_trust/dex/fleet_status/__init__.py @@ -3,4 +3,4 @@ from __future__ import annotations from .device_list_params import DeviceListParams as DeviceListParams -from .digital_experience_monitoring_device import DigitalExperienceMonitoringDevice as DigitalExperienceMonitoringDevice +from .device_list_response import DeviceListResponse as DeviceListResponse diff --git a/src/cloudflare/types/zero_trust/dex/fleet_status/device_list_response.py b/src/cloudflare/types/zero_trust/dex/fleet_status/device_list_response.py new file mode 100644 index 00000000000..cc90fd794a6 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/fleet_status/device_list_response.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = ["DeviceListResponse"] + + +class DeviceListResponse(BaseModel): + colo: str + """Cloudflare colo""" + + device_id: str = FieldInfo(alias="deviceId") + """Device identifier (UUID v4)""" + + mode: object + + platform: str + """Operating system""" + + status: str + """Network status""" + + timestamp: object + + version: str + """WARP client version""" + + 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""" diff --git a/src/cloudflare/types/zero_trust/dex/fleet_status/digital_experience_monitoring_device.py b/src/cloudflare/types/zero_trust/dex/fleet_status/digital_experience_monitoring_device.py deleted file mode 100644 index 4723dd364ac..00000000000 --- a/src/cloudflare/types/zero_trust/dex/fleet_status/digital_experience_monitoring_device.py +++ /dev/null @@ -1,32 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = ["DigitalExperienceMonitoringDevice"] - - -class DigitalExperienceMonitoringDevice(BaseModel): - colo: str - """Cloudflare colo""" - - device_id: str = FieldInfo(alias="deviceId") - """Device identifier (UUID v4)""" - - platform: str - """Operating system""" - - status: str - """Network status""" - - version: str - """WARP client version""" - - 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""" diff --git a/src/cloudflare/types/zero_trust/dex/fleet_status_live_response.py b/src/cloudflare/types/zero_trust/dex/fleet_status_live_response.py index e7af617306b..1ddb17c9fbf 100644 --- a/src/cloudflare/types/zero_trust/dex/fleet_status_live_response.py +++ b/src/cloudflare/types/zero_trust/dex/fleet_status_live_response.py @@ -4,64 +4,22 @@ from pydantic import Field as FieldInfo +from .live_stat import LiveStat from ...._models import BaseModel -__all__ = [ - "FleetStatusLiveResponse", - "DeviceStats", - "DeviceStatsByColo", - "DeviceStatsByMode", - "DeviceStatsByPlatform", - "DeviceStatsByStatus", - "DeviceStatsByVersion", -] - - -class DeviceStatsByColo(BaseModel): - unique_devices_total: Optional[float] = FieldInfo(alias="uniqueDevicesTotal", default=None) - """Number of unique devices""" - - value: Optional[str] = None - - -class DeviceStatsByMode(BaseModel): - unique_devices_total: Optional[float] = FieldInfo(alias="uniqueDevicesTotal", default=None) - """Number of unique devices""" - - value: Optional[str] = None - - -class DeviceStatsByPlatform(BaseModel): - unique_devices_total: Optional[float] = FieldInfo(alias="uniqueDevicesTotal", default=None) - """Number of unique devices""" - - value: Optional[str] = None - - -class DeviceStatsByStatus(BaseModel): - unique_devices_total: Optional[float] = FieldInfo(alias="uniqueDevicesTotal", default=None) - """Number of unique devices""" - - value: Optional[str] = None - - -class DeviceStatsByVersion(BaseModel): - unique_devices_total: Optional[float] = FieldInfo(alias="uniqueDevicesTotal", default=None) - """Number of unique devices""" - - value: Optional[str] = None +__all__ = ["FleetStatusLiveResponse", "DeviceStats"] class DeviceStats(BaseModel): - by_colo: Optional[List[DeviceStatsByColo]] = FieldInfo(alias="byColo", default=None) + by_colo: Optional[List[LiveStat]] = FieldInfo(alias="byColo", default=None) - by_mode: Optional[List[DeviceStatsByMode]] = FieldInfo(alias="byMode", default=None) + by_mode: Optional[List[LiveStat]] = FieldInfo(alias="byMode", default=None) - by_platform: Optional[List[DeviceStatsByPlatform]] = FieldInfo(alias="byPlatform", default=None) + by_platform: Optional[List[LiveStat]] = FieldInfo(alias="byPlatform", default=None) - by_status: Optional[List[DeviceStatsByStatus]] = FieldInfo(alias="byStatus", default=None) + by_status: Optional[List[LiveStat]] = FieldInfo(alias="byStatus", default=None) - by_version: Optional[List[DeviceStatsByVersion]] = FieldInfo(alias="byVersion", default=None) + by_version: Optional[List[LiveStat]] = FieldInfo(alias="byVersion", default=None) unique_devices_total: Optional[float] = FieldInfo(alias="uniqueDevicesTotal", default=None) """Number of unique devices""" diff --git a/src/cloudflare/types/zero_trust/dex/http_details.py b/src/cloudflare/types/zero_trust/dex/http_details.py new file mode 100644 index 00000000000..a8f9463ddf0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/http_details.py @@ -0,0 +1,140 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from ..device_experience_monitor import DeviceExperienceMonitor +from .http_tests.test_stat_over_time import TestStatOverTime + +__all__ = [ + "HTTPDetails", + "HTTPStats", + "HTTPStatsAvailabilityPct", + "HTTPStatsAvailabilityPctSlot", + "HTTPStatsHTTPStatusCode", + "HTTPStatsByColo", + "HTTPStatsByColoAvailabilityPct", + "HTTPStatsByColoAvailabilityPctSlot", + "HTTPStatsByColoHTTPStatusCode", +] + + +class HTTPStatsAvailabilityPctSlot(BaseModel): + timestamp: str + + value: float + + +class HTTPStatsAvailabilityPct(BaseModel): + slots: List[HTTPStatsAvailabilityPctSlot] + + avg: Optional[float] = None + """average observed in the time period""" + + max: Optional[float] = None + """highest observed in the time period""" + + min: Optional[float] = None + """lowest observed in the time period""" + + +class HTTPStatsHTTPStatusCode(BaseModel): + status200: int + + status300: int + + status400: int + + status500: int + + timestamp: str + + +class HTTPStats(BaseModel): + availability_pct: HTTPStatsAvailabilityPct = FieldInfo(alias="availabilityPct") + + dns_response_time_ms: TestStatOverTime = FieldInfo(alias="dnsResponseTimeMs") + + http_status_code: List[HTTPStatsHTTPStatusCode] = FieldInfo(alias="httpStatusCode") + + resource_fetch_time_ms: TestStatOverTime = FieldInfo(alias="resourceFetchTimeMs") + + server_response_time_ms: TestStatOverTime = FieldInfo(alias="serverResponseTimeMs") + + unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") + """Count of unique devices that have run this test in the given time period""" + + +class HTTPStatsByColoAvailabilityPctSlot(BaseModel): + timestamp: str + + value: float + + +class HTTPStatsByColoAvailabilityPct(BaseModel): + slots: List[HTTPStatsByColoAvailabilityPctSlot] + + avg: Optional[float] = None + """average observed in the time period""" + + max: Optional[float] = None + """highest observed in the time period""" + + min: Optional[float] = None + """lowest observed in the time period""" + + +class HTTPStatsByColoHTTPStatusCode(BaseModel): + status200: int + + status300: int + + status400: int + + status500: int + + timestamp: str + + +class HTTPStatsByColo(BaseModel): + availability_pct: HTTPStatsByColoAvailabilityPct = FieldInfo(alias="availabilityPct") + + colo: str + + dns_response_time_ms: TestStatOverTime = FieldInfo(alias="dnsResponseTimeMs") + + http_status_code: List[HTTPStatsByColoHTTPStatusCode] = FieldInfo(alias="httpStatusCode") + + resource_fetch_time_ms: TestStatOverTime = FieldInfo(alias="resourceFetchTimeMs") + + server_response_time_ms: TestStatOverTime = FieldInfo(alias="serverResponseTimeMs") + + unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") + """Count of unique devices that have run this test in the given time period""" + + +class HTTPDetails(BaseModel): + host: Optional[str] = None + """The url of the HTTP synthetic application test""" + + http_stats: Optional[HTTPStats] = FieldInfo(alias="httpStats", default=None) + + http_stats_by_colo: Optional[List[HTTPStatsByColo]] = FieldInfo(alias="httpStatsByColo", default=None) + + interval: Optional[str] = None + """The interval at which the HTTP synthetic application test is set to run.""" + + kind: Optional[Literal["http"]] = None + + method: Optional[str] = None + """The HTTP method to use when running the test""" + + name: Optional[str] = None + """The name of the HTTP synthetic application test""" + + target_policies: Optional[List[DeviceExperienceMonitor]] = None + + targeted: Optional[bool] = None diff --git a/src/cloudflare/types/zero_trust/dex/http_tests/__init__.py b/src/cloudflare/types/zero_trust/dex/http_tests/__init__.py index a7ca0cdc394..548d69697a2 100644 --- a/src/cloudflare/types/zero_trust/dex/http_tests/__init__.py +++ b/src/cloudflare/types/zero_trust/dex/http_tests/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations +from .test_stat_over_time import TestStatOverTime as TestStatOverTime from .percentile_get_params import PercentileGetParams as PercentileGetParams -from .digital_experience_monitoring_http_details_percentiles import ( - DigitalExperienceMonitoringHTTPDetailsPercentiles as DigitalExperienceMonitoringHTTPDetailsPercentiles, -) +from .http_details_percentiles import HTTPDetailsPercentiles as HTTPDetailsPercentiles diff --git a/src/cloudflare/types/zero_trust/dex/http_tests/digital_experience_monitoring_http_details_percentiles.py b/src/cloudflare/types/zero_trust/dex/http_tests/digital_experience_monitoring_http_details_percentiles.py deleted file mode 100644 index ff368294744..00000000000 --- a/src/cloudflare/types/zero_trust/dex/http_tests/digital_experience_monitoring_http_details_percentiles.py +++ /dev/null @@ -1,64 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "DigitalExperienceMonitoringHTTPDetailsPercentiles", - "DNSResponseTimeMs", - "ResourceFetchTimeMs", - "ServerResponseTimeMs", -] - - -class DNSResponseTimeMs(BaseModel): - p50: Optional[float] = None - """p50 observed in the time period""" - - p90: Optional[float] = None - """p90 observed in the time period""" - - p95: Optional[float] = None - """p95 observed in the time period""" - - p99: Optional[float] = None - """p99 observed in the time period""" - - -class ResourceFetchTimeMs(BaseModel): - p50: Optional[float] = None - """p50 observed in the time period""" - - p90: Optional[float] = None - """p90 observed in the time period""" - - p95: Optional[float] = None - """p95 observed in the time period""" - - p99: Optional[float] = None - """p99 observed in the time period""" - - -class ServerResponseTimeMs(BaseModel): - p50: Optional[float] = None - """p50 observed in the time period""" - - p90: Optional[float] = None - """p90 observed in the time period""" - - p95: Optional[float] = None - """p95 observed in the time period""" - - p99: Optional[float] = None - """p99 observed in the time period""" - - -class DigitalExperienceMonitoringHTTPDetailsPercentiles(BaseModel): - dns_response_time_ms: Optional[DNSResponseTimeMs] = FieldInfo(alias="dnsResponseTimeMs", default=None) - - resource_fetch_time_ms: Optional[ResourceFetchTimeMs] = FieldInfo(alias="resourceFetchTimeMs", default=None) - - server_response_time_ms: Optional[ServerResponseTimeMs] = FieldInfo(alias="serverResponseTimeMs", default=None) diff --git a/src/cloudflare/types/zero_trust/dex/http_tests/http_details_percentiles.py b/src/cloudflare/types/zero_trust/dex/http_tests/http_details_percentiles.py new file mode 100644 index 00000000000..3c1210d08d1 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/http_tests/http_details_percentiles.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel +from ...percentiles import Percentiles + +__all__ = ["HTTPDetailsPercentiles"] + + +class HTTPDetailsPercentiles(BaseModel): + dns_response_time_ms: Optional[Percentiles] = FieldInfo(alias="dnsResponseTimeMs", default=None) + + resource_fetch_time_ms: Optional[Percentiles] = FieldInfo(alias="resourceFetchTimeMs", default=None) + + server_response_time_ms: Optional[Percentiles] = FieldInfo(alias="serverResponseTimeMs", default=None) diff --git a/src/cloudflare/types/zero_trust/dex/http_tests/test_stat_over_time.py b/src/cloudflare/types/zero_trust/dex/http_tests/test_stat_over_time.py new file mode 100644 index 00000000000..6fd470656f2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/http_tests/test_stat_over_time.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ....._models import BaseModel + +__all__ = ["TestStatOverTime", "Slot"] + + +class Slot(BaseModel): + timestamp: str + + value: int + + +class TestStatOverTime(BaseModel): + __test__ = False + slots: List[Slot] + + avg: Optional[int] = None + """average observed in the time period""" + + max: Optional[int] = None + """highest observed in the time period""" + + min: Optional[int] = None + """lowest observed in the time period""" diff --git a/src/cloudflare/types/zero_trust/dex/live_stat.py b/src/cloudflare/types/zero_trust/dex/live_stat.py new file mode 100644 index 00000000000..653520ff97c --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/live_stat.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["LiveStat"] + + +class LiveStat(BaseModel): + unique_devices_total: Optional[float] = FieldInfo(alias="uniqueDevicesTotal", default=None) + """Number of unique devices""" + + value: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dex/test_list_response.py b/src/cloudflare/types/zero_trust/dex/test_list_response.py index 561b2839018..140ad36e45d 100644 --- a/src/cloudflare/types/zero_trust/dex/test_list_response.py +++ b/src/cloudflare/types/zero_trust/dex/test_list_response.py @@ -4,21 +4,10 @@ from typing_extensions import Literal from ...._models import BaseModel -from .digital_experience_monitoring_tests import DigitalExperienceMonitoringTests +from .tests.tests import Tests +from ...shared.response_info import ResponseInfo -__all__ = ["TestListResponse", "Error", "Message", "ResultInfo"] - - -class Error(BaseModel): - code: int - - message: str - - -class Message(BaseModel): - code: int - - message: str +__all__ = ["TestListResponse", "ResultInfo"] class ResultInfo(BaseModel): @@ -37,13 +26,13 @@ class ResultInfo(BaseModel): class TestListResponse(BaseModel): __test__ = False - errors: List[Error] + errors: List[ResponseInfo] - messages: List[Message] - - result: DigitalExperienceMonitoringTests + messages: List[ResponseInfo] success: Literal[True] """Whether the API call was successful""" + result: Optional[Tests] = None + result_info: Optional[ResultInfo] = None diff --git a/src/cloudflare/types/zero_trust/dex/tests/__init__.py b/src/cloudflare/types/zero_trust/dex/tests/__init__.py index f0387f08db8..3fe0c580a6a 100644 --- a/src/cloudflare/types/zero_trust/dex/tests/__init__.py +++ b/src/cloudflare/types/zero_trust/dex/tests/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations +from .tests import Tests as Tests +from .unique_devices import UniqueDevices as UniqueDevices from .unique_device_list_params import UniqueDeviceListParams as UniqueDeviceListParams -from .digital_experience_monitoring_unique_devices import ( - DigitalExperienceMonitoringUniqueDevices as DigitalExperienceMonitoringUniqueDevices, -) diff --git a/src/cloudflare/types/zero_trust/dex/tests/digital_experience_monitoring_unique_devices.py b/src/cloudflare/types/zero_trust/dex/tests/digital_experience_monitoring_unique_devices.py deleted file mode 100644 index d1b033d998b..00000000000 --- a/src/cloudflare/types/zero_trust/dex/tests/digital_experience_monitoring_unique_devices.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = ["DigitalExperienceMonitoringUniqueDevices"] - - -class DigitalExperienceMonitoringUniqueDevices(BaseModel): - unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") - """total number of unique devices""" diff --git a/src/cloudflare/types/zero_trust/dex/tests/tests.py b/src/cloudflare/types/zero_trust/dex/tests/tests.py new file mode 100644 index 00000000000..208a0f31c31 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/tests/tests.py @@ -0,0 +1,257 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel +from ..aggregate_time_period import AggregateTimePeriod +from ...device_experience_monitor import DeviceExperienceMonitor + +__all__ = [ + "Tests", + "OverviewMetrics", + "Test", + "TestHTTPResults", + "TestHTTPResultsResourceFetchTime", + "TestHTTPResultsResourceFetchTimeHistory", + "TestHTTPResultsResourceFetchTimeOverTime", + "TestHTTPResultsResourceFetchTimeOverTimeValue", + "TestHTTPResultsByColo", + "TestHTTPResultsByColoResourceFetchTime", + "TestHTTPResultsByColoResourceFetchTimeHistory", + "TestHTTPResultsByColoResourceFetchTimeOverTime", + "TestHTTPResultsByColoResourceFetchTimeOverTimeValue", + "TestTracerouteResults", + "TestTracerouteResultsRoundTripTime", + "TestTracerouteResultsRoundTripTimeHistory", + "TestTracerouteResultsRoundTripTimeOverTime", + "TestTracerouteResultsRoundTripTimeOverTimeValue", + "TestTracerouteResultsByColo", + "TestTracerouteResultsByColoRoundTripTime", + "TestTracerouteResultsByColoRoundTripTimeHistory", + "TestTracerouteResultsByColoRoundTripTimeOverTime", + "TestTracerouteResultsByColoRoundTripTimeOverTimeValue", +] + + +class OverviewMetrics(BaseModel): + tests_total: int = FieldInfo(alias="testsTotal") + """number of tests.""" + + avg_http_availability_pct: Optional[float] = FieldInfo(alias="avgHttpAvailabilityPct", default=None) + """percentage availability for all HTTP test results in response""" + + avg_traceroute_availability_pct: Optional[float] = FieldInfo(alias="avgTracerouteAvailabilityPct", default=None) + """percentage availability for all traceroutes results in response""" + + +class TestHTTPResultsResourceFetchTimeHistory(BaseModel): + __test__ = False + time_period: AggregateTimePeriod = FieldInfo(alias="timePeriod") + + avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) + + delta_pct: Optional[float] = FieldInfo(alias="deltaPct", default=None) + + +class TestHTTPResultsResourceFetchTimeOverTimeValue(BaseModel): + __test__ = False + avg_ms: int = FieldInfo(alias="avgMs") + + timestamp: str + + +class TestHTTPResultsResourceFetchTimeOverTime(BaseModel): + __test__ = False + time_period: AggregateTimePeriod = FieldInfo(alias="timePeriod") + + values: List[TestHTTPResultsResourceFetchTimeOverTimeValue] + + +class TestHTTPResultsResourceFetchTime(BaseModel): + __test__ = False + history: List[TestHTTPResultsResourceFetchTimeHistory] + + avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) + + over_time: Optional[TestHTTPResultsResourceFetchTimeOverTime] = FieldInfo(alias="overTime", default=None) + + +class TestHTTPResults(BaseModel): + __test__ = False + resource_fetch_time: TestHTTPResultsResourceFetchTime = FieldInfo(alias="resourceFetchTime") + + +class TestHTTPResultsByColoResourceFetchTimeHistory(BaseModel): + __test__ = False + time_period: AggregateTimePeriod = FieldInfo(alias="timePeriod") + + avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) + + delta_pct: Optional[float] = FieldInfo(alias="deltaPct", default=None) + + +class TestHTTPResultsByColoResourceFetchTimeOverTimeValue(BaseModel): + __test__ = False + avg_ms: int = FieldInfo(alias="avgMs") + + timestamp: str + + +class TestHTTPResultsByColoResourceFetchTimeOverTime(BaseModel): + __test__ = False + time_period: AggregateTimePeriod = FieldInfo(alias="timePeriod") + + values: List[TestHTTPResultsByColoResourceFetchTimeOverTimeValue] + + +class TestHTTPResultsByColoResourceFetchTime(BaseModel): + __test__ = False + history: List[TestHTTPResultsByColoResourceFetchTimeHistory] + + avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) + + over_time: Optional[TestHTTPResultsByColoResourceFetchTimeOverTime] = FieldInfo(alias="overTime", default=None) + + +class TestHTTPResultsByColo(BaseModel): + __test__ = False + colo: str + """Cloudflare colo""" + + resource_fetch_time: TestHTTPResultsByColoResourceFetchTime = FieldInfo(alias="resourceFetchTime") + + +class TestTracerouteResultsRoundTripTimeHistory(BaseModel): + __test__ = False + time_period: AggregateTimePeriod = FieldInfo(alias="timePeriod") + + avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) + + delta_pct: Optional[float] = FieldInfo(alias="deltaPct", default=None) + + +class TestTracerouteResultsRoundTripTimeOverTimeValue(BaseModel): + __test__ = False + avg_ms: int = FieldInfo(alias="avgMs") + + timestamp: str + + +class TestTracerouteResultsRoundTripTimeOverTime(BaseModel): + __test__ = False + time_period: AggregateTimePeriod = FieldInfo(alias="timePeriod") + + values: List[TestTracerouteResultsRoundTripTimeOverTimeValue] + + +class TestTracerouteResultsRoundTripTime(BaseModel): + __test__ = False + history: List[TestTracerouteResultsRoundTripTimeHistory] + + avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) + + over_time: Optional[TestTracerouteResultsRoundTripTimeOverTime] = FieldInfo(alias="overTime", default=None) + + +class TestTracerouteResults(BaseModel): + __test__ = False + round_trip_time: TestTracerouteResultsRoundTripTime = FieldInfo(alias="roundTripTime") + + +class TestTracerouteResultsByColoRoundTripTimeHistory(BaseModel): + __test__ = False + time_period: AggregateTimePeriod = FieldInfo(alias="timePeriod") + + avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) + + delta_pct: Optional[float] = FieldInfo(alias="deltaPct", default=None) + + +class TestTracerouteResultsByColoRoundTripTimeOverTimeValue(BaseModel): + __test__ = False + avg_ms: int = FieldInfo(alias="avgMs") + + timestamp: str + + +class TestTracerouteResultsByColoRoundTripTimeOverTime(BaseModel): + __test__ = False + time_period: AggregateTimePeriod = FieldInfo(alias="timePeriod") + + values: List[TestTracerouteResultsByColoRoundTripTimeOverTimeValue] + + +class TestTracerouteResultsByColoRoundTripTime(BaseModel): + __test__ = False + history: List[TestTracerouteResultsByColoRoundTripTimeHistory] + + avg_ms: Optional[int] = FieldInfo(alias="avgMs", default=None) + + over_time: Optional[TestTracerouteResultsByColoRoundTripTimeOverTime] = FieldInfo(alias="overTime", default=None) + + +class TestTracerouteResultsByColo(BaseModel): + __test__ = False + colo: str + """Cloudflare colo""" + + round_trip_time: TestTracerouteResultsByColoRoundTripTime = FieldInfo(alias="roundTripTime") + + +class Test(BaseModel): + __test__ = False + id: str + """API Resource UUID tag.""" + + created: str + """date the test was created.""" + + description: str + """the test description defined during configuration""" + + enabled: bool + """if true, then the test will run on targeted devices. + + Else, the test will not run. + """ + + host: str + + interval: str + """The interval at which the synthetic application test is set to run.""" + + kind: Literal["http", "traceroute"] + """test type, http or traceroute""" + + name: str + """name given to this test""" + + updated: str + + http_results: Optional[TestHTTPResults] = FieldInfo(alias="httpResults", default=None) + + http_results_by_colo: Optional[List[TestHTTPResultsByColo]] = FieldInfo(alias="httpResultsByColo", default=None) + + method: Optional[str] = None + """for HTTP, the method to use when running the test""" + + target_policies: Optional[List[DeviceExperienceMonitor]] = None + + targeted: Optional[bool] = None + + traceroute_results: Optional[TestTracerouteResults] = FieldInfo(alias="tracerouteResults", default=None) + + traceroute_results_by_colo: Optional[List[TestTracerouteResultsByColo]] = FieldInfo( + alias="tracerouteResultsByColo", default=None + ) + + +class Tests(BaseModel): + __test__ = False + overview_metrics: OverviewMetrics = FieldInfo(alias="overviewMetrics") + + tests: List[Test] + """array of test results objects.""" diff --git a/src/cloudflare/types/zero_trust/dex/tests/unique_devices.py b/src/cloudflare/types/zero_trust/dex/tests/unique_devices.py new file mode 100644 index 00000000000..7c43e52888b --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/tests/unique_devices.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = ["UniqueDevices"] + + +class UniqueDevices(BaseModel): + unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") + """total number of unique devices""" diff --git a/src/cloudflare/types/zero_trust/dex/traceroute.py b/src/cloudflare/types/zero_trust/dex/traceroute.py new file mode 100644 index 00000000000..3faa4dbcb9b --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/traceroute.py @@ -0,0 +1,151 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from ..device_experience_monitor import DeviceExperienceMonitor +from .http_tests.test_stat_over_time import TestStatOverTime + +__all__ = [ + "Traceroute", + "TracerouteStats", + "TracerouteStatsAvailabilityPct", + "TracerouteStatsAvailabilityPctSlot", + "TracerouteStatsPacketLossPct", + "TracerouteStatsPacketLossPctSlot", + "TracerouteStatsByColo", + "TracerouteStatsByColoAvailabilityPct", + "TracerouteStatsByColoAvailabilityPctSlot", + "TracerouteStatsByColoPacketLossPct", + "TracerouteStatsByColoPacketLossPctSlot", +] + + +class TracerouteStatsAvailabilityPctSlot(BaseModel): + timestamp: str + + value: float + + +class TracerouteStatsAvailabilityPct(BaseModel): + slots: List[TracerouteStatsAvailabilityPctSlot] + + avg: Optional[float] = None + """average observed in the time period""" + + max: Optional[float] = None + """highest observed in the time period""" + + min: Optional[float] = None + """lowest observed in the time period""" + + +class TracerouteStatsPacketLossPctSlot(BaseModel): + timestamp: str + + value: float + + +class TracerouteStatsPacketLossPct(BaseModel): + slots: List[TracerouteStatsPacketLossPctSlot] + + avg: Optional[float] = None + """average observed in the time period""" + + max: Optional[float] = None + """highest observed in the time period""" + + min: Optional[float] = None + """lowest observed in the time period""" + + +class TracerouteStats(BaseModel): + availability_pct: TracerouteStatsAvailabilityPct = FieldInfo(alias="availabilityPct") + + hops_count: TestStatOverTime = FieldInfo(alias="hopsCount") + + packet_loss_pct: TracerouteStatsPacketLossPct = FieldInfo(alias="packetLossPct") + + round_trip_time_ms: TestStatOverTime = FieldInfo(alias="roundTripTimeMs") + + unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") + """Count of unique devices that have run this test in the given time period""" + + +class TracerouteStatsByColoAvailabilityPctSlot(BaseModel): + timestamp: str + + value: float + + +class TracerouteStatsByColoAvailabilityPct(BaseModel): + slots: List[TracerouteStatsByColoAvailabilityPctSlot] + + avg: Optional[float] = None + """average observed in the time period""" + + max: Optional[float] = None + """highest observed in the time period""" + + min: Optional[float] = None + """lowest observed in the time period""" + + +class TracerouteStatsByColoPacketLossPctSlot(BaseModel): + timestamp: str + + value: float + + +class TracerouteStatsByColoPacketLossPct(BaseModel): + slots: List[TracerouteStatsByColoPacketLossPctSlot] + + avg: Optional[float] = None + """average observed in the time period""" + + max: Optional[float] = None + """highest observed in the time period""" + + min: Optional[float] = None + """lowest observed in the time period""" + + +class TracerouteStatsByColo(BaseModel): + availability_pct: TracerouteStatsByColoAvailabilityPct = FieldInfo(alias="availabilityPct") + + colo: str + + hops_count: TestStatOverTime = FieldInfo(alias="hopsCount") + + packet_loss_pct: TracerouteStatsByColoPacketLossPct = FieldInfo(alias="packetLossPct") + + round_trip_time_ms: TestStatOverTime = FieldInfo(alias="roundTripTimeMs") + + unique_devices_total: int = FieldInfo(alias="uniqueDevicesTotal") + """Count of unique devices that have run this test in the given time period""" + + +class Traceroute(BaseModel): + host: str + """The host of the Traceroute synthetic application test""" + + interval: str + """The interval at which the Traceroute synthetic application test is set to run.""" + + kind: Literal["traceroute"] + + name: str + """The name of the Traceroute synthetic application test""" + + target_policies: Optional[List[DeviceExperienceMonitor]] = None + + targeted: Optional[bool] = None + + traceroute_stats: Optional[TracerouteStats] = FieldInfo(alias="tracerouteStats", default=None) + + traceroute_stats_by_colo: Optional[List[TracerouteStatsByColo]] = FieldInfo( + alias="tracerouteStatsByColo", default=None + ) diff --git a/src/cloudflare/types/zero_trust/dex/traceroute_test_percentiles_response.py b/src/cloudflare/types/zero_trust/dex/traceroute_test_percentiles_response.py new file mode 100644 index 00000000000..8644cb3fbd2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/traceroute_test_percentiles_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from ..percentiles import Percentiles + +__all__ = ["TracerouteTestPercentilesResponse"] + + +class TracerouteTestPercentilesResponse(BaseModel): + hops_count: Optional[Percentiles] = FieldInfo(alias="hopsCount", default=None) + + packet_loss_pct: Optional[Percentiles] = FieldInfo(alias="packetLossPct", default=None) + + round_trip_time_ms: Optional[Percentiles] = FieldInfo(alias="roundTripTimeMs", default=None) diff --git a/src/cloudflare/types/zero_trust/dex/traceroute_test_results/__init__.py b/src/cloudflare/types/zero_trust/dex/traceroute_test_results/__init__.py index 324bd436e7e..02438e6c643 100644 --- a/src/cloudflare/types/zero_trust/dex/traceroute_test_results/__init__.py +++ b/src/cloudflare/types/zero_trust/dex/traceroute_test_results/__init__.py @@ -2,6 +2,4 @@ from __future__ import annotations -from .digital_experience_monitoring_traceroute_test_result_network_path import ( - DigitalExperienceMonitoringTracerouteTestResultNetworkPath as DigitalExperienceMonitoringTracerouteTestResultNetworkPath, -) +from .network_path_get_response import NetworkPathGetResponse as NetworkPathGetResponse diff --git a/src/cloudflare/types/zero_trust/dex/traceroute_test_results/digital_experience_monitoring_traceroute_test_result_network_path.py b/src/cloudflare/types/zero_trust/dex/traceroute_test_results/digital_experience_monitoring_traceroute_test_result_network_path.py deleted file mode 100644 index b9bae536212..00000000000 --- a/src/cloudflare/types/zero_trust/dex/traceroute_test_results/digital_experience_monitoring_traceroute_test_result_network_path.py +++ /dev/null @@ -1,58 +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 pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = ["DigitalExperienceMonitoringTracerouteTestResultNetworkPath", "Hop", "HopLocation"] - - -class HopLocation(BaseModel): - city: Optional[str] = None - - state: Optional[str] = None - - zip: Optional[str] = None - - -class Hop(BaseModel): - ttl: int - - asn: Optional[int] = None - - aso: Optional[str] = None - - ip_address: Optional[str] = FieldInfo(alias="ipAddress", default=None) - - location: Optional[HopLocation] = None - - mile: Optional[Literal["client-to-app", "client-to-cf-egress", "client-to-cf-ingress", "client-to-isp"]] = None - - name: Optional[str] = None - - packet_loss_pct: Optional[float] = FieldInfo(alias="packetLossPct", default=None) - - rtt_ms: Optional[int] = FieldInfo(alias="rttMs", default=None) - - -class DigitalExperienceMonitoringTracerouteTestResultNetworkPath(BaseModel): - hops: List[Hop] - """an array of the hops taken by the device to reach the end destination""" - - result_id: str = FieldInfo(alias="resultId") - """API Resource UUID tag.""" - - time_start: str - """date time of this traceroute test""" - - device_name: Optional[str] = FieldInfo(alias="deviceName", default=None) - """name of the device associated with this network path response""" - - test_id: Optional[str] = FieldInfo(alias="testId", default=None) - """API Resource UUID tag.""" - - test_name: Optional[str] = FieldInfo(alias="testName", default=None) - """name of the tracroute test""" diff --git a/src/cloudflare/types/zero_trust/dex/traceroute_test_results/network_path_get_response.py b/src/cloudflare/types/zero_trust/dex/traceroute_test_results/network_path_get_response.py new file mode 100644 index 00000000000..2dc7a507b92 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dex/traceroute_test_results/network_path_get_response.py @@ -0,0 +1,58 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = ["NetworkPathGetResponse", "Hop", "HopLocation"] + + +class HopLocation(BaseModel): + city: Optional[str] = None + + state: Optional[str] = None + + zip: Optional[str] = None + + +class Hop(BaseModel): + ttl: int + + asn: Optional[int] = None + + aso: Optional[str] = None + + ip_address: Optional[str] = FieldInfo(alias="ipAddress", default=None) + + location: Optional[HopLocation] = None + + mile: Optional[Literal["client-to-app", "client-to-cf-egress", "client-to-cf-ingress", "client-to-isp"]] = None + + name: Optional[str] = None + + packet_loss_pct: Optional[float] = FieldInfo(alias="packetLossPct", default=None) + + rtt_ms: Optional[int] = FieldInfo(alias="rttMs", default=None) + + +class NetworkPathGetResponse(BaseModel): + hops: List[Hop] + """an array of the hops taken by the device to reach the end destination""" + + result_id: str = FieldInfo(alias="resultId") + """API Resource UUID tag.""" + + time_start: str + """date time of this traceroute test""" + + device_name: Optional[str] = FieldInfo(alias="deviceName", default=None) + """name of the device associated with this network path response""" + + test_id: Optional[str] = FieldInfo(alias="testId", default=None) + """API Resource UUID tag.""" + + test_name: Optional[str] = FieldInfo(alias="testName", default=None) + """name of the tracroute test""" diff --git a/src/cloudflare/types/zero_trust/dlp/__init__.py b/src/cloudflare/types/zero_trust/dlp/__init__.py index 5786dd444be..15ad89dc639 100644 --- a/src/cloudflare/types/zero_trust/dlp/__init__.py +++ b/src/cloudflare/types/zero_trust/dlp/__init__.py @@ -2,15 +2,18 @@ from __future__ import annotations -from .dlp_dataset import DLPDataset as DLPDataset -from .dlp_profiles import DLPProfiles as DLPProfiles -from .dlp_dataset_array import DLPDatasetArray as DLPDatasetArray -from .dlp_dataset_creation import DLPDatasetCreation as DLPDatasetCreation +from .dataset import Dataset as Dataset +from .profile import Profile as Profile +from .dataset_array import DatasetArray as DatasetArray +from .dataset_creation import DatasetCreation as DatasetCreation +from .context_awareness import ContextAwareness as ContextAwareness +from .skip_configuration import SkipConfiguration as SkipConfiguration from .profile_get_response import ProfileGetResponse as ProfileGetResponse from .dataset_create_params import DatasetCreateParams as DatasetCreateParams from .dataset_update_params import DatasetUpdateParams as DatasetUpdateParams +from .context_awareness_param import ContextAwarenessParam as ContextAwarenessParam from .pattern_validate_params import PatternValidateParams as PatternValidateParams from .payload_log_get_response import PayloadLogGetResponse as PayloadLogGetResponse -from .pattern_validate_response import PatternValidateResponse as PatternValidateResponse +from .skip_configuration_param import SkipConfigurationParam as SkipConfigurationParam from .payload_log_update_params import PayloadLogUpdateParams as PayloadLogUpdateParams from .payload_log_update_response import PayloadLogUpdateResponse as PayloadLogUpdateResponse diff --git a/src/cloudflare/types/zero_trust/dlp/context_awareness.py b/src/cloudflare/types/zero_trust/dlp/context_awareness.py new file mode 100644 index 00000000000..fceb2c25057 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/context_awareness.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + + +from ...._models import BaseModel +from .skip_configuration import SkipConfiguration + +__all__ = ["ContextAwareness"] + + +class ContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: SkipConfiguration + """Content types to exclude from context analysis and return all matches.""" diff --git a/src/cloudflare/types/zero_trust/dlp/context_awareness_param.py b/src/cloudflare/types/zero_trust/dlp/context_awareness_param.py new file mode 100644 index 00000000000..9f9d92b1cc5 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/context_awareness_param.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 + +from .skip_configuration_param import SkipConfigurationParam + +__all__ = ["ContextAwarenessParam"] + + +class ContextAwarenessParam(TypedDict, total=False): + enabled: Required[bool] + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: Required[SkipConfigurationParam] + """Content types to exclude from context analysis and return all matches.""" diff --git a/src/cloudflare/types/zero_trust/dlp/dataset.py b/src/cloudflare/types/zero_trust/dlp/dataset.py new file mode 100644 index 00000000000..6654f6111af --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/dataset.py @@ -0,0 +1,37 @@ +# 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__ = ["Dataset", "Upload"] + + +class Upload(BaseModel): + num_cells: int + + status: Literal["empty", "uploading", "failed", "complete"] + + version: int + + +class Dataset(BaseModel): + id: str + + created_at: datetime + + name: str + + num_cells: int + + secret: bool + + status: Literal["empty", "uploading", "failed", "complete"] + + updated_at: datetime + + uploads: List[Upload] + + description: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/dataset_array.py b/src/cloudflare/types/zero_trust/dlp/dataset_array.py new file mode 100644 index 00000000000..c3ea24b0c36 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/dataset_array.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .dataset import Dataset + +__all__ = ["DatasetArray"] + +DatasetArray = List[Dataset] diff --git a/src/cloudflare/types/zero_trust/dlp/dataset_creation.py b/src/cloudflare/types/zero_trust/dlp/dataset_creation.py new file mode 100644 index 00000000000..c27598ed117 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/dataset_creation.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .dataset import Dataset +from ...._models import BaseModel + +__all__ = ["DatasetCreation"] + + +class DatasetCreation(BaseModel): + dataset: Dataset + + max_cells: int + + version: int + """The version to use when uploading the dataset.""" + + secret: Optional[str] = None + """The secret to use for Exact Data Match datasets. + + This is not present in Custom Wordlists. + """ diff --git a/src/cloudflare/types/zero_trust/dlp/datasets/__init__.py b/src/cloudflare/types/zero_trust/dlp/datasets/__init__.py index 9c101f89c1f..05b90b2cbb8 100644 --- a/src/cloudflare/types/zero_trust/dlp/datasets/__init__.py +++ b/src/cloudflare/types/zero_trust/dlp/datasets/__init__.py @@ -2,4 +2,5 @@ from __future__ import annotations -from .dlp_dataset_new_version import DLPDatasetNewVersion as DLPDatasetNewVersion +from .new_version import NewVersion as NewVersion +from .upload_edit_params import UploadEditParams as UploadEditParams diff --git a/src/cloudflare/types/zero_trust/dlp/datasets/dlp_dataset_new_version.py b/src/cloudflare/types/zero_trust/dlp/datasets/dlp_dataset_new_version.py deleted file mode 100644 index 78a4a4b98c3..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/datasets/dlp_dataset_new_version.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__ = ["DLPDatasetNewVersion"] - - -class DLPDatasetNewVersion(BaseModel): - max_cells: int - - version: int - - secret: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/datasets/new_version.py b/src/cloudflare/types/zero_trust/dlp/datasets/new_version.py new file mode 100644 index 00000000000..fb8411a8cce --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/datasets/new_version.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__ = ["NewVersion"] + + +class NewVersion(BaseModel): + max_cells: int + + version: int + + secret: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/datasets/upload_edit_params.py b/src/cloudflare/types/zero_trust/dlp/datasets/upload_edit_params.py new file mode 100644 index 00000000000..3427ac066d8 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/datasets/upload_edit_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["UploadEditParams"] + + +class UploadEditParams(TypedDict, total=False): + account_id: Required[str] + + dataset_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/dlp/dlp_dataset.py b/src/cloudflare/types/zero_trust/dlp/dlp_dataset.py deleted file mode 100644 index cae21720512..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/dlp_dataset.py +++ /dev/null @@ -1,37 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["DLPDataset", "Upload"] - - -class Upload(BaseModel): - num_cells: int - - status: Literal["empty", "uploading", "failed", "complete"] - - version: int - - -class DLPDataset(BaseModel): - id: str - - created_at: datetime - - name: str - - num_cells: int - - secret: bool - - status: Literal["empty", "uploading", "failed", "complete"] - - updated_at: datetime - - uploads: List[Upload] - - description: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/dlp/dlp_dataset_array.py b/src/cloudflare/types/zero_trust/dlp/dlp_dataset_array.py deleted file mode 100644 index c68abb112e5..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/dlp_dataset_array.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .dlp_dataset import DLPDataset - -__all__ = ["DLPDatasetArray"] - -DLPDatasetArray = List[DLPDataset] diff --git a/src/cloudflare/types/zero_trust/dlp/dlp_dataset_creation.py b/src/cloudflare/types/zero_trust/dlp/dlp_dataset_creation.py deleted file mode 100644 index 6dfdaa3ddb2..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/dlp_dataset_creation.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel -from .dlp_dataset import DLPDataset - -__all__ = ["DLPDatasetCreation"] - - -class DLPDatasetCreation(BaseModel): - dataset: DLPDataset - - max_cells: int - - version: int - """The version to use when uploading the dataset.""" - - secret: Optional[str] = None - """The secret to use for Exact Data Match datasets. - - This is not present in Custom Wordlists. - """ diff --git a/src/cloudflare/types/zero_trust/dlp/dlp_profiles.py b/src/cloudflare/types/zero_trust/dlp/dlp_profiles.py deleted file mode 100644 index 2748fb9afb4..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/dlp_profiles.py +++ /dev/null @@ -1,52 +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 - -from .profiles import DLPCustomProfile, DLPPredefinedProfile -from ...._models import BaseModel - -__all__ = ["DLPProfiles", "DLPIntegrationProfile", "DLPIntegrationProfileEntry"] - - -class DLPIntegrationProfileEntry(BaseModel): - id: Optional[str] = None - """The ID for this entry""" - - created_at: Optional[datetime] = None - - enabled: Optional[bool] = None - """Whether the entry is enabled or not.""" - - name: Optional[str] = None - """The name of the entry.""" - - profile_id: Optional[object] = None - """ID of the parent profile""" - - updated_at: Optional[datetime] = None - - -class DLPIntegrationProfile(BaseModel): - id: Optional[str] = None - """The ID for this profile""" - - created_at: Optional[datetime] = None - - description: Optional[str] = None - """The description of the profile.""" - - entries: Optional[List[DLPIntegrationProfileEntry]] = None - """The entries for this profile.""" - - name: Optional[str] = None - """The name of the profile.""" - - type: Optional[Literal["integration"]] = None - """The type of the profile.""" - - updated_at: Optional[datetime] = None - - -DLPProfiles = Union[DLPPredefinedProfile, DLPCustomProfile, DLPIntegrationProfile] diff --git a/src/cloudflare/types/zero_trust/dlp/pattern_validate_response.py b/src/cloudflare/types/zero_trust/dlp/pattern_validate_response.py deleted file mode 100644 index c2f67a1de2f..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/pattern_validate_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["PatternValidateResponse"] - - -class PatternValidateResponse(BaseModel): - valid: Optional[bool] = None diff --git a/src/cloudflare/types/zero_trust/dlp/profile.py b/src/cloudflare/types/zero_trust/dlp/profile.py new file mode 100644 index 00000000000..ecc092685a0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/profile.py @@ -0,0 +1,53 @@ +# 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 + +from ...._models import BaseModel +from .profiles.custom_profile import CustomProfile +from .profiles.predefined_profile import PredefinedProfile + +__all__ = ["Profile", "DLPIntegrationProfile", "DLPIntegrationProfileEntry"] + + +class DLPIntegrationProfileEntry(BaseModel): + id: Optional[str] = None + """The ID for this entry""" + + created_at: Optional[datetime] = None + + enabled: Optional[bool] = None + """Whether the entry is enabled or not.""" + + name: Optional[str] = None + """The name of the entry.""" + + profile_id: Optional[object] = None + """ID of the parent profile""" + + updated_at: Optional[datetime] = None + + +class DLPIntegrationProfile(BaseModel): + id: Optional[str] = None + """The ID for this profile""" + + created_at: Optional[datetime] = None + + description: Optional[str] = None + """The description of the profile.""" + + entries: Optional[List[DLPIntegrationProfileEntry]] = None + """The entries for this profile.""" + + name: Optional[str] = None + """The name of the profile.""" + + type: Optional[Literal["integration"]] = None + """The type of the profile.""" + + updated_at: Optional[datetime] = None + + +Profile = Union[PredefinedProfile, CustomProfile, DLPIntegrationProfile] diff --git a/src/cloudflare/types/zero_trust/dlp/profile_get_response.py b/src/cloudflare/types/zero_trust/dlp/profile_get_response.py index 385dcdc18e8..c8e1a4e93ed 100644 --- a/src/cloudflare/types/zero_trust/dlp/profile_get_response.py +++ b/src/cloudflare/types/zero_trust/dlp/profile_get_response.py @@ -4,8 +4,9 @@ from datetime import datetime from typing_extensions import Literal -from .profiles import DLPCustomProfile, DLPPredefinedProfile from ...._models import BaseModel +from .profiles.custom_profile import CustomProfile +from .profiles.predefined_profile import PredefinedProfile __all__ = ["ProfileGetResponse", "DLPIntegrationProfile", "DLPIntegrationProfileEntry"] @@ -49,4 +50,4 @@ class DLPIntegrationProfile(BaseModel): updated_at: Optional[datetime] = None -ProfileGetResponse = Union[DLPPredefinedProfile, DLPCustomProfile, DLPIntegrationProfile] +ProfileGetResponse = Union[PredefinedProfile, CustomProfile, DLPIntegrationProfile] diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/__init__.py b/src/cloudflare/types/zero_trust/dlp/profiles/__init__.py index d8af316f546..0b64a904912 100644 --- a/src/cloudflare/types/zero_trust/dlp/profiles/__init__.py +++ b/src/cloudflare/types/zero_trust/dlp/profiles/__init__.py @@ -2,10 +2,13 @@ from __future__ import annotations -from .dlp_custom_profile import DLPCustomProfile as DLPCustomProfile +from .pattern import Pattern as Pattern +from .pattern_param import PatternParam as PatternParam +from .custom_profile import CustomProfile as CustomProfile +from .predefined_profile import PredefinedProfile as PredefinedProfile from .custom_create_params import CustomCreateParams as CustomCreateParams +from .custom_delete_params import CustomDeleteParams as CustomDeleteParams from .custom_update_params import CustomUpdateParams as CustomUpdateParams from .custom_create_response import CustomCreateResponse as CustomCreateResponse from .custom_delete_response import CustomDeleteResponse as CustomDeleteResponse -from .dlp_predefined_profile import DLPPredefinedProfile as DLPPredefinedProfile from .predefined_update_params import PredefinedUpdateParams as PredefinedUpdateParams diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/custom_create_params.py b/src/cloudflare/types/zero_trust/dlp/profiles/custom_create_params.py index a36b4fe62d6..08a716d502e 100644 --- a/src/cloudflare/types/zero_trust/dlp/profiles/custom_create_params.py +++ b/src/cloudflare/types/zero_trust/dlp/profiles/custom_create_params.py @@ -3,16 +3,12 @@ from __future__ import annotations from typing import Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = [ - "CustomCreateParams", - "Profile", - "ProfileContextAwareness", - "ProfileContextAwarenessSkip", - "ProfileEntry", - "ProfileEntryPattern", -] +from .pattern_param import PatternParam +from ..context_awareness_param import ContextAwarenessParam + +__all__ = ["CustomCreateParams", "Profile", "ProfileEntry"] class CustomCreateParams(TypedDict, total=False): @@ -22,34 +18,6 @@ class CustomCreateParams(TypedDict, total=False): profiles: Required[Iterable[Profile]] -class ProfileContextAwarenessSkip(TypedDict, total=False): - files: Required[bool] - """If the content type is a file, skip context analysis and return all matches.""" - - -class ProfileContextAwareness(TypedDict, total=False): - enabled: Required[bool] - """ - If true, scan the context of predefined entries to only return matches - surrounded by keywords. - """ - - skip: Required[ProfileContextAwarenessSkip] - """Content types to exclude from context analysis and return all matches.""" - - -class ProfileEntryPattern(TypedDict, total=False): - regex: Required[str] - """The regex pattern.""" - - validation: Literal["luhn"] - """Validation algorithm for the pattern. - - This algorithm will get run on potential matches, and if it returns false, the - entry will not be matched. - """ - - class ProfileEntry(TypedDict, total=False): enabled: Required[bool] """Whether the entry is enabled or not.""" @@ -57,7 +25,7 @@ class ProfileEntry(TypedDict, total=False): name: Required[str] """The name of the entry.""" - pattern: Required[ProfileEntryPattern] + pattern: Required[PatternParam] """A pattern that matches an entry""" @@ -65,7 +33,7 @@ class Profile(TypedDict, total=False): allowed_match_count: float """Related DLP policies will trigger when the match count exceeds the number set.""" - context_awareness: ProfileContextAwareness + context_awareness: ContextAwarenessParam """ Scan the context of predefined entries to only return matches surrounded by keywords. diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/custom_create_response.py b/src/cloudflare/types/zero_trust/dlp/profiles/custom_create_response.py index d396fbecf88..7eedf697c45 100644 --- a/src/cloudflare/types/zero_trust/dlp/profiles/custom_create_response.py +++ b/src/cloudflare/types/zero_trust/dlp/profiles/custom_create_response.py @@ -2,8 +2,8 @@ from typing import List -from .dlp_custom_profile import DLPCustomProfile +from .custom_profile import CustomProfile __all__ = ["CustomCreateResponse"] -CustomCreateResponse = List[DLPCustomProfile] +CustomCreateResponse = List[CustomProfile] diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/custom_delete_params.py b/src/cloudflare/types/zero_trust/dlp/profiles/custom_delete_params.py new file mode 100644 index 00000000000..a4c6ca2be51 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/profiles/custom_delete_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__ = ["CustomDeleteParams"] + + +class CustomDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/custom_profile.py b/src/cloudflare/types/zero_trust/dlp/profiles/custom_profile.py new file mode 100644 index 00000000000..b098fae9766 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/profiles/custom_profile.py @@ -0,0 +1,65 @@ +# 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 .pattern import Pattern +from ....._models import BaseModel +from ..context_awareness import ContextAwareness + +__all__ = ["CustomProfile", "Entry"] + + +class Entry(BaseModel): + id: Optional[str] = None + """The ID for this entry""" + + created_at: Optional[datetime] = None + + enabled: Optional[bool] = None + """Whether the entry is enabled or not.""" + + name: Optional[str] = None + """The name of the entry.""" + + pattern: Optional[Pattern] = None + """A pattern that matches an entry""" + + profile_id: Optional[object] = None + """ID of the parent profile""" + + updated_at: Optional[datetime] = None + + +class CustomProfile(BaseModel): + id: Optional[str] = None + """The ID for this profile""" + + allowed_match_count: Optional[float] = None + """Related DLP policies will trigger when the match count exceeds the number set.""" + + context_awareness: Optional[ContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + + created_at: Optional[datetime] = None + + description: Optional[str] = None + """The description of the profile.""" + + entries: Optional[List[Entry]] = None + """The entries for this profile.""" + + name: Optional[str] = None + """The name of the profile.""" + + ocr_enabled: Optional[bool] = None + """If true, scan images via OCR to determine if any text present matches filters.""" + + type: Optional[Literal["custom"]] = None + """The type of the profile.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/custom_update_params.py b/src/cloudflare/types/zero_trust/dlp/profiles/custom_update_params.py index 265f70d5da0..cceb67fe6c8 100644 --- a/src/cloudflare/types/zero_trust/dlp/profiles/custom_update_params.py +++ b/src/cloudflare/types/zero_trust/dlp/profiles/custom_update_params.py @@ -3,14 +3,14 @@ from __future__ import annotations from typing import Union, Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict + +from .pattern_param import PatternParam +from ..context_awareness_param import ContextAwarenessParam __all__ = [ "CustomUpdateParams", - "ContextAwareness", - "ContextAwarenessSkip", "Entry", - "EntryPattern", "SharedEntry", "SharedEntryDLPSharedEntryUpdatePredefined", "SharedEntryDLPSharedEntryUpdateIntegration", @@ -24,7 +24,7 @@ class CustomUpdateParams(TypedDict, total=False): allowed_match_count: float """Related DLP policies will trigger when the match count exceeds the number set.""" - context_awareness: ContextAwareness + context_awareness: ContextAwarenessParam """ Scan the context of predefined entries to only return matches surrounded by keywords. @@ -54,34 +54,6 @@ class CustomUpdateParams(TypedDict, total=False): """ -class ContextAwarenessSkip(TypedDict, total=False): - files: Required[bool] - """If the content type is a file, skip context analysis and return all matches.""" - - -class ContextAwareness(TypedDict, total=False): - enabled: Required[bool] - """ - If true, scan the context of predefined entries to only return matches - surrounded by keywords. - """ - - skip: Required[ContextAwarenessSkip] - """Content types to exclude from context analysis and return all matches.""" - - -class EntryPattern(TypedDict, total=False): - regex: Required[str] - """The regex pattern.""" - - validation: Literal["luhn"] - """Validation algorithm for the pattern. - - This algorithm will get run on potential matches, and if it returns false, the - entry will not be matched. - """ - - class Entry(TypedDict, total=False): enabled: bool """Whether the entry is enabled or not.""" @@ -89,7 +61,7 @@ class Entry(TypedDict, total=False): name: str """The name of the entry.""" - pattern: EntryPattern + pattern: PatternParam """A pattern that matches an entry""" profile_id: object diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/dlp_custom_profile.py b/src/cloudflare/types/zero_trust/dlp/profiles/dlp_custom_profile.py deleted file mode 100644 index 746676ab3d9..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/profiles/dlp_custom_profile.py +++ /dev/null @@ -1,91 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ....._models import BaseModel - -__all__ = ["DLPCustomProfile", "ContextAwareness", "ContextAwarenessSkip", "Entry", "EntryPattern"] - - -class ContextAwarenessSkip(BaseModel): - files: bool - """If the content type is a file, skip context analysis and return all matches.""" - - -class ContextAwareness(BaseModel): - enabled: bool - """ - If true, scan the context of predefined entries to only return matches - surrounded by keywords. - """ - - skip: ContextAwarenessSkip - """Content types to exclude from context analysis and return all matches.""" - - -class EntryPattern(BaseModel): - regex: str - """The regex pattern.""" - - validation: Optional[Literal["luhn"]] = None - """Validation algorithm for the pattern. - - This algorithm will get run on potential matches, and if it returns false, the - entry will not be matched. - """ - - -class Entry(BaseModel): - id: Optional[str] = None - """The ID for this entry""" - - created_at: Optional[datetime] = None - - enabled: Optional[bool] = None - """Whether the entry is enabled or not.""" - - name: Optional[str] = None - """The name of the entry.""" - - pattern: Optional[EntryPattern] = None - """A pattern that matches an entry""" - - profile_id: Optional[object] = None - """ID of the parent profile""" - - updated_at: Optional[datetime] = None - - -class DLPCustomProfile(BaseModel): - id: Optional[str] = None - """The ID for this profile""" - - allowed_match_count: Optional[float] = None - """Related DLP policies will trigger when the match count exceeds the number set.""" - - context_awareness: Optional[ContextAwareness] = None - """ - Scan the context of predefined entries to only return matches surrounded by - keywords. - """ - - created_at: Optional[datetime] = None - - description: Optional[str] = None - """The description of the profile.""" - - entries: Optional[List[Entry]] = None - """The entries for this profile.""" - - name: Optional[str] = None - """The name of the profile.""" - - ocr_enabled: Optional[bool] = None - """If true, scan images via OCR to determine if any text present matches filters.""" - - type: Optional[Literal["custom"]] = None - """The type of the profile.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/dlp_predefined_profile.py b/src/cloudflare/types/zero_trust/dlp/profiles/dlp_predefined_profile.py deleted file mode 100644 index 78d59d7e297..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/profiles/dlp_predefined_profile.py +++ /dev/null @@ -1,64 +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__ = ["DLPPredefinedProfile", "ContextAwareness", "ContextAwarenessSkip", "Entry"] - - -class ContextAwarenessSkip(BaseModel): - files: bool - """If the content type is a file, skip context analysis and return all matches.""" - - -class ContextAwareness(BaseModel): - enabled: bool - """ - If true, scan the context of predefined entries to only return matches - surrounded by keywords. - """ - - skip: ContextAwarenessSkip - """Content types to exclude from context analysis and return all matches.""" - - -class Entry(BaseModel): - id: Optional[str] = None - """The ID for this entry""" - - enabled: Optional[bool] = None - """Whether the entry is enabled or not.""" - - name: Optional[str] = None - """The name of the entry.""" - - profile_id: Optional[object] = None - """ID of the parent profile""" - - -class DLPPredefinedProfile(BaseModel): - id: Optional[str] = None - """The ID for this profile""" - - allowed_match_count: Optional[float] = None - """Related DLP policies will trigger when the match count exceeds the number set.""" - - context_awareness: Optional[ContextAwareness] = None - """ - Scan the context of predefined entries to only return matches surrounded by - keywords. - """ - - entries: Optional[List[Entry]] = None - """The entries for this profile.""" - - name: Optional[str] = None - """The name of the profile.""" - - ocr_enabled: Optional[bool] = None - """If true, scan images via OCR to determine if any text present matches filters.""" - - type: Optional[Literal["predefined"]] = None - """The type of the profile.""" diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/pattern.py b/src/cloudflare/types/zero_trust/dlp/profiles/pattern.py new file mode 100644 index 00000000000..3c4d074a92a --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/profiles/pattern.py @@ -0,0 +1,20 @@ +# 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__ = ["Pattern"] + + +class Pattern(BaseModel): + regex: str + """The regex pattern.""" + + validation: Optional[Literal["luhn"]] = None + """Validation algorithm for the pattern. + + This algorithm will get run on potential matches, and if it returns false, the + entry will not be matched. + """ diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/pattern_param.py b/src/cloudflare/types/zero_trust/dlp/profiles/pattern_param.py new file mode 100644 index 00000000000..300edd1ebf6 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/profiles/pattern_param.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 Literal, Required, TypedDict + +__all__ = ["PatternParam"] + + +class PatternParam(TypedDict, total=False): + regex: Required[str] + """The regex pattern.""" + + validation: Literal["luhn"] + """Validation algorithm for the pattern. + + This algorithm will get run on potential matches, and if it returns false, the + entry will not be matched. + """ diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/predefined_profile.py b/src/cloudflare/types/zero_trust/dlp/profiles/predefined_profile.py new file mode 100644 index 00000000000..6796888383a --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/profiles/predefined_profile.py @@ -0,0 +1,49 @@ +# 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 +from ..context_awareness import ContextAwareness + +__all__ = ["PredefinedProfile", "Entry"] + + +class Entry(BaseModel): + id: Optional[str] = None + """The ID for this entry""" + + enabled: Optional[bool] = None + """Whether the entry is enabled or not.""" + + name: Optional[str] = None + """The name of the entry.""" + + profile_id: Optional[object] = None + """ID of the parent profile""" + + +class PredefinedProfile(BaseModel): + id: Optional[str] = None + """The ID for this profile""" + + allowed_match_count: Optional[float] = None + """Related DLP policies will trigger when the match count exceeds the number set.""" + + context_awareness: Optional[ContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + + entries: Optional[List[Entry]] = None + """The entries for this profile.""" + + name: Optional[str] = None + """The name of the profile.""" + + ocr_enabled: Optional[bool] = None + """If true, scan images via OCR to determine if any text present matches filters.""" + + type: Optional[Literal["predefined"]] = None + """The type of the profile.""" diff --git a/src/cloudflare/types/zero_trust/dlp/profiles/predefined_update_params.py b/src/cloudflare/types/zero_trust/dlp/profiles/predefined_update_params.py index 6708f7e7eea..6ba7ebccb4b 100644 --- a/src/cloudflare/types/zero_trust/dlp/profiles/predefined_update_params.py +++ b/src/cloudflare/types/zero_trust/dlp/profiles/predefined_update_params.py @@ -5,7 +5,9 @@ from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = ["PredefinedUpdateParams", "ContextAwareness", "ContextAwarenessSkip", "Entry"] +from ..context_awareness_param import ContextAwarenessParam + +__all__ = ["PredefinedUpdateParams", "Entry"] class PredefinedUpdateParams(TypedDict, total=False): @@ -15,7 +17,7 @@ class PredefinedUpdateParams(TypedDict, total=False): allowed_match_count: float """Related DLP policies will trigger when the match count exceeds the number set.""" - context_awareness: ContextAwareness + context_awareness: ContextAwarenessParam """ Scan the context of predefined entries to only return matches surrounded by keywords. @@ -28,22 +30,6 @@ class PredefinedUpdateParams(TypedDict, total=False): """If true, scan images via OCR to determine if any text present matches filters.""" -class ContextAwarenessSkip(TypedDict, total=False): - files: Required[bool] - """If the content type is a file, skip context analysis and return all matches.""" - - -class ContextAwareness(TypedDict, total=False): - enabled: Required[bool] - """ - If true, scan the context of predefined entries to only return matches - surrounded by keywords. - """ - - skip: Required[ContextAwarenessSkip] - """Content types to exclude from context analysis and return all matches.""" - - class Entry(TypedDict, total=False): enabled: bool """Whether the entry is enabled or not.""" diff --git a/src/cloudflare/types/zero_trust/dlp/skip_configuration.py b/src/cloudflare/types/zero_trust/dlp/skip_configuration.py new file mode 100644 index 00000000000..c7a9139bf06 --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/skip_configuration.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["SkipConfiguration"] + + +class SkipConfiguration(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" diff --git a/src/cloudflare/types/zero_trust/dlp/skip_configuration_param.py b/src/cloudflare/types/zero_trust/dlp/skip_configuration_param.py new file mode 100644 index 00000000000..e8d6c634eab --- /dev/null +++ b/src/cloudflare/types/zero_trust/dlp/skip_configuration_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SkipConfigurationParam"] + + +class SkipConfigurationParam(TypedDict, total=False): + files: Required[bool] + """If the content type is a file, skip context analysis and return all matches.""" diff --git a/src/cloudflare/types/zero_trust/domain_rule.py b/src/cloudflare/types/zero_trust/domain_rule.py new file mode 100644 index 00000000000..4c75958da62 --- /dev/null +++ b/src/cloudflare/types/zero_trust/domain_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["DomainRule", "EmailDomain"] + + +class EmailDomain(BaseModel): + domain: str + """The email domain to match.""" + + +class DomainRule(BaseModel): + email_domain: EmailDomain diff --git a/src/cloudflare/types/zero_trust/domain_rule_param.py b/src/cloudflare/types/zero_trust/domain_rule_param.py new file mode 100644 index 00000000000..e8bcab749fd --- /dev/null +++ b/src/cloudflare/types/zero_trust/domain_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["DomainRuleParam", "EmailDomain"] + + +class EmailDomain(TypedDict, total=False): + domain: Required[str] + """The email domain to match.""" + + +class DomainRuleParam(TypedDict, total=False): + email_domain: Required[EmailDomain] diff --git a/src/cloudflare/types/zero_trust/email_list_rule.py b/src/cloudflare/types/zero_trust/email_list_rule.py new file mode 100644 index 00000000000..6423b3d2f6b --- /dev/null +++ b/src/cloudflare/types/zero_trust/email_list_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["EmailListRule", "EmailList"] + + +class EmailList(BaseModel): + id: str + """The ID of a previously created email list.""" + + +class EmailListRule(BaseModel): + email_list: EmailList diff --git a/src/cloudflare/types/zero_trust/email_list_rule_param.py b/src/cloudflare/types/zero_trust/email_list_rule_param.py new file mode 100644 index 00000000000..71b725e2fef --- /dev/null +++ b/src/cloudflare/types/zero_trust/email_list_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["EmailListRuleParam", "EmailList"] + + +class EmailList(TypedDict, total=False): + id: Required[str] + """The ID of a previously created email list.""" + + +class EmailListRuleParam(TypedDict, total=False): + email_list: Required[EmailList] diff --git a/src/cloudflare/types/zero_trust/email_rule.py b/src/cloudflare/types/zero_trust/email_rule.py new file mode 100644 index 00000000000..1f344e6499a --- /dev/null +++ b/src/cloudflare/types/zero_trust/email_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["EmailRule", "Email"] + + +class Email(BaseModel): + email: str + """The email of the user.""" + + +class EmailRule(BaseModel): + email: Email diff --git a/src/cloudflare/types/zero_trust/email_rule_param.py b/src/cloudflare/types/zero_trust/email_rule_param.py new file mode 100644 index 00000000000..b43061fe44f --- /dev/null +++ b/src/cloudflare/types/zero_trust/email_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["EmailRuleParam", "Email"] + + +class Email(TypedDict, total=False): + email: Required[str] + """The email of the user.""" + + +class EmailRuleParam(TypedDict, total=False): + email: Required[Email] diff --git a/src/cloudflare/types/zero_trust/everyone_rule.py b/src/cloudflare/types/zero_trust/everyone_rule.py new file mode 100644 index 00000000000..c6eb677a828 --- /dev/null +++ b/src/cloudflare/types/zero_trust/everyone_rule.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["EveryoneRule"] + + +class EveryoneRule(BaseModel): + everyone: object + """An empty object which matches on all users.""" diff --git a/src/cloudflare/types/zero_trust/everyone_rule_param.py b/src/cloudflare/types/zero_trust/everyone_rule_param.py new file mode 100644 index 00000000000..b026c3d21f0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/everyone_rule_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["EveryoneRuleParam"] + + +class EveryoneRuleParam(TypedDict, total=False): + everyone: Required[object] + """An empty object which matches on all users.""" diff --git a/src/cloudflare/types/zero_trust/external_evaluation_rule.py b/src/cloudflare/types/zero_trust/external_evaluation_rule.py new file mode 100644 index 00000000000..ab6449b3a48 --- /dev/null +++ b/src/cloudflare/types/zero_trust/external_evaluation_rule.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ExternalEvaluationRule", "ExternalEvaluation"] + + +class ExternalEvaluation(BaseModel): + evaluate_url: str + """The API endpoint containing your business logic.""" + + keys_url: str + """ + The API endpoint containing the key that Access uses to verify that the response + came from your API. + """ + + +class ExternalEvaluationRule(BaseModel): + external_evaluation: ExternalEvaluation diff --git a/src/cloudflare/types/zero_trust/external_evaluation_rule_param.py b/src/cloudflare/types/zero_trust/external_evaluation_rule_param.py new file mode 100644 index 00000000000..df598ab7c8b --- /dev/null +++ b/src/cloudflare/types/zero_trust/external_evaluation_rule_param.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__ = ["ExternalEvaluationRuleParam", "ExternalEvaluation"] + + +class ExternalEvaluation(TypedDict, total=False): + evaluate_url: Required[str] + """The API endpoint containing your business logic.""" + + keys_url: Required[str] + """ + The API endpoint containing the key that Access uses to verify that the response + came from your API. + """ + + +class ExternalEvaluationRuleParam(TypedDict, total=False): + external_evaluation: Required[ExternalEvaluation] diff --git a/src/cloudflare/types/zero_trust/gateway/__init__.py b/src/cloudflare/types/zero_trust/gateway/__init__.py index b828b0a8432..836e219582a 100644 --- a/src/cloudflare/types/zero_trust/gateway/__init__.py +++ b/src/cloudflare/types/zero_trust/gateway/__init__.py @@ -2,34 +2,74 @@ from __future__ import annotations +from .app_type import AppType as AppType +from .category import Category as Category +from .location import Location as Location +from .schedule import Schedule as Schedule +from .gateway_ips import GatewayIPs as GatewayIPs +from .gateway_item import GatewayItem as GatewayItem +from .gateway_list import GatewayList as GatewayList +from .gateway_rule import GatewayRule as GatewayRule +from .rule_setting import RuleSetting as RuleSetting +from .tls_settings import TLSSettings as TLSSettings +from .fips_settings import FipsSettings as FipsSettings +from .gateway_filter import GatewayFilter as GatewayFilter +from .proxy_endpoint import ProxyEndpoint as ProxyEndpoint +from .schedule_param import ScheduleParam as ScheduleParam +from .logging_setting import LoggingSetting as LoggingSetting +from .gateway_settings import GatewaySettings as GatewaySettings from .list_edit_params import ListEditParams as ListEditParams +from .location_network import LocationNetwork as LocationNetwork +from .gateway_item_param import GatewayItemParam as GatewayItemParam from .list_create_params import ListCreateParams as ListCreateParams +from .list_delete_params import ListDeleteParams as ListDeleteParams from .list_update_params import ListUpdateParams as ListUpdateParams +from .protocol_detection import ProtocolDetection as ProtocolDetection from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_delete_params import RuleDeleteParams as RuleDeleteParams +from .rule_setting_param import RuleSettingParam as RuleSettingParam from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .tls_settings_param import TLSSettingsParam as TLSSettingsParam +from .anti_virus_settings import AntiVirusSettings as AntiVirusSettings +from .block_page_settings import BlockPageSettings as BlockPageSettings +from .fips_settings_param import FipsSettingsParam as FipsSettingsParam from .list_create_response import ListCreateResponse as ListCreateResponse from .list_delete_response import ListDeleteResponse as ListDeleteResponse from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse +from .activity_log_settings import ActivityLogSettings as ActivityLogSettings from .logging_update_params import LoggingUpdateParams as LoggingUpdateParams +from .notification_settings import NotificationSettings as NotificationSettings +from .body_scanning_settings import BodyScanningSettings as BodyScanningSettings from .location_create_params import LocationCreateParams as LocationCreateParams +from .location_delete_params import LocationDeleteParams as LocationDeleteParams +from .location_network_param import LocationNetworkParam as LocationNetworkParam from .location_update_params import LocationUpdateParams as LocationUpdateParams +from .extended_email_matching import ExtendedEmailMatching as ExtendedEmailMatching +from .dns_resolver_settings_v4 import DNSResolverSettingsV4 as DNSResolverSettingsV4 +from .dns_resolver_settings_v6 import DNSResolverSettingsV6 as DNSResolverSettingsV6 from .location_delete_response import LocationDeleteResponse as LocationDeleteResponse -from .zero_trust_gateway_lists import ZeroTrustGatewayLists as ZeroTrustGatewayLists -from .zero_trust_gateway_rules import ZeroTrustGatewayRules as ZeroTrustGatewayRules +from .protocol_detection_param import ProtocolDetectionParam as ProtocolDetectionParam +from .anti_virus_settings_param import AntiVirusSettingsParam as AntiVirusSettingsParam +from .block_page_settings_param import BlockPageSettingsParam as BlockPageSettingsParam from .configuration_edit_params import ConfigurationEditParams as ConfigurationEditParams +from .browser_isolation_settings import BrowserIsolationSettings as BrowserIsolationSettings from .configuration_get_response import ConfigurationGetResponse as ConfigurationGetResponse from .proxy_endpoint_edit_params import ProxyEndpointEditParams as ProxyEndpointEditParams +from .activity_log_settings_param import ActivityLogSettingsParam as ActivityLogSettingsParam from .configuration_edit_response import ConfigurationEditResponse as ConfigurationEditResponse from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams -from .zero_trust_gateway_settings import ZeroTrustGatewaySettings as ZeroTrustGatewaySettings +from .custom_certificate_settings import CustomCertificateSettings as CustomCertificateSettings +from .notification_settings_param import NotificationSettingsParam as NotificationSettingsParam +from .body_scanning_settings_param import BodyScanningSettingsParam as BodyScanningSettingsParam from .proxy_endpoint_create_params import ProxyEndpointCreateParams as ProxyEndpointCreateParams -from .zero_trust_gateway_app_types import ZeroTrustGatewayAppTypes as ZeroTrustGatewayAppTypes -from .zero_trust_gateway_locations import ZeroTrustGatewayLocations as ZeroTrustGatewayLocations +from .proxy_endpoint_delete_params import ProxyEndpointDeleteParams as ProxyEndpointDeleteParams from .configuration_update_response import ConfigurationUpdateResponse as ConfigurationUpdateResponse -from .zero_trust_gateway_categories import ZeroTrustGatewayCategories as ZeroTrustGatewayCategories +from .extended_email_matching_param import ExtendedEmailMatchingParam as ExtendedEmailMatchingParam +from .dns_resolver_settings_v4_param import DNSResolverSettingsV4Param as DNSResolverSettingsV4Param +from .dns_resolver_settings_v6_param import DNSResolverSettingsV6Param as DNSResolverSettingsV6Param +from .gateway_configuration_settings import GatewayConfigurationSettings as GatewayConfigurationSettings from .proxy_endpoint_delete_response import ProxyEndpointDeleteResponse as ProxyEndpointDeleteResponse from .audit_ssh_setting_update_params import AuditSSHSettingUpdateParams as AuditSSHSettingUpdateParams -from .zero_trust_gateway_proxy_endpoints import ZeroTrustGatewayProxyEndpoints as ZeroTrustGatewayProxyEndpoints -from .zero_trust_gateway_gateway_account_logging_settings import ( - ZeroTrustGatewayGatewayAccountLoggingSettings as ZeroTrustGatewayGatewayAccountLoggingSettings, -) +from .browser_isolation_settings_param import BrowserIsolationSettingsParam as BrowserIsolationSettingsParam +from .custom_certificate_settings_param import CustomCertificateSettingsParam as CustomCertificateSettingsParam +from .gateway_configuration_settings_param import GatewayConfigurationSettingsParam as GatewayConfigurationSettingsParam diff --git a/src/cloudflare/types/zero_trust/gateway/activity_log_settings.py b/src/cloudflare/types/zero_trust/gateway/activity_log_settings.py new file mode 100644 index 00000000000..d17f765af7e --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/activity_log_settings.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__ = ["ActivityLogSettings"] + + +class ActivityLogSettings(BaseModel): + enabled: Optional[bool] = None + """Enable activity logging.""" diff --git a/src/cloudflare/types/zero_trust/gateway/activity_log_settings_param.py b/src/cloudflare/types/zero_trust/gateway/activity_log_settings_param.py new file mode 100644 index 00000000000..5dcdd0e03b6 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/activity_log_settings_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ActivityLogSettingsParam"] + + +class ActivityLogSettingsParam(TypedDict, total=False): + enabled: bool + """Enable activity logging.""" diff --git a/src/cloudflare/types/zero_trust/gateway/anti_virus_settings.py b/src/cloudflare/types/zero_trust/gateway/anti_virus_settings.py new file mode 100644 index 00000000000..85cf41948ef --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/anti_virus_settings.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel +from .notification_settings import NotificationSettings + +__all__ = ["AntiVirusSettings"] + + +class AntiVirusSettings(BaseModel): + enabled_download_phase: Optional[bool] = None + """Enable anti-virus scanning on downloads.""" + + enabled_upload_phase: Optional[bool] = None + """Enable anti-virus scanning on uploads.""" + + fail_closed: Optional[bool] = None + """Block requests for files that cannot be scanned.""" + + notification_settings: Optional[NotificationSettings] = None + """ + Configure a message to display on the user's device when an antivirus search is + performed. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/anti_virus_settings_param.py b/src/cloudflare/types/zero_trust/gateway/anti_virus_settings_param.py new file mode 100644 index 00000000000..ee88b2f890e --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/anti_virus_settings_param.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .notification_settings_param import NotificationSettingsParam + +__all__ = ["AntiVirusSettingsParam"] + + +class AntiVirusSettingsParam(TypedDict, total=False): + enabled_download_phase: bool + """Enable anti-virus scanning on downloads.""" + + enabled_upload_phase: bool + """Enable anti-virus scanning on uploads.""" + + fail_closed: bool + """Block requests for files that cannot be scanned.""" + + notification_settings: NotificationSettingsParam + """ + Configure a message to display on the user's device when an antivirus search is + performed. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/app_type.py b/src/cloudflare/types/zero_trust/gateway/app_type.py new file mode 100644 index 00000000000..d3c9c4dee03 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/app_type.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["AppType", "ZeroTrustGatewayApplication", "ZeroTrustGatewayApplicationType"] + + +class ZeroTrustGatewayApplication(BaseModel): + id: Optional[int] = None + """The identifier for this application. There is only one application per ID.""" + + application_type_id: Optional[int] = None + """The identifier for the type of this application. + + There can be many applications with the same type. This refers to the `id` of a + returned application type. + """ + + created_at: Optional[datetime] = None + + name: Optional[str] = None + """The name of the application or application type.""" + + +class ZeroTrustGatewayApplicationType(BaseModel): + id: Optional[int] = None + """The identifier for the type of this application. + + There can be many applications with the same type. This refers to the `id` of a + returned application type. + """ + + created_at: Optional[datetime] = None + + description: Optional[str] = None + """A short summary of applications with this type.""" + + name: Optional[str] = None + """The name of the application or application type.""" + + +AppType = Union[ZeroTrustGatewayApplication, ZeroTrustGatewayApplicationType] diff --git a/src/cloudflare/types/zero_trust/gateway/block_page_settings.py b/src/cloudflare/types/zero_trust/gateway/block_page_settings.py new file mode 100644 index 00000000000..403fbcbb70f --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/block_page_settings.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["BlockPageSettings"] + + +class BlockPageSettings(BaseModel): + background_color: Optional[str] = None + """Block page background color in #rrggbb format.""" + + enabled: Optional[bool] = None + """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" + + footer_text: Optional[str] = None + """Block page footer text.""" + + header_text: Optional[str] = None + """Block page header text.""" + + logo_path: Optional[str] = None + """Full URL to the logo file.""" + + mailto_address: Optional[str] = None + """Admin email for users to contact.""" + + mailto_subject: Optional[str] = None + """Subject line for emails created from block page.""" + + name: Optional[str] = None + """Block page title.""" + + suppress_footer: Optional[bool] = None + """Suppress detailed info at the bottom of the block page.""" diff --git a/src/cloudflare/types/zero_trust/gateway/block_page_settings_param.py b/src/cloudflare/types/zero_trust/gateway/block_page_settings_param.py new file mode 100644 index 00000000000..8adca2cfdb0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/block_page_settings_param.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["BlockPageSettingsParam"] + + +class BlockPageSettingsParam(TypedDict, total=False): + background_color: str + """Block page background color in #rrggbb format.""" + + enabled: bool + """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" + + footer_text: str + """Block page footer text.""" + + header_text: str + """Block page header text.""" + + logo_path: str + """Full URL to the logo file.""" + + mailto_address: str + """Admin email for users to contact.""" + + mailto_subject: str + """Subject line for emails created from block page.""" + + name: str + """Block page title.""" + + suppress_footer: bool + """Suppress detailed info at the bottom of the block page.""" diff --git a/src/cloudflare/types/zero_trust/gateway/body_scanning_settings.py b/src/cloudflare/types/zero_trust/gateway/body_scanning_settings.py new file mode 100644 index 00000000000..4d21ed246a6 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/body_scanning_settings.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__ = ["BodyScanningSettings"] + + +class BodyScanningSettings(BaseModel): + inspection_mode: Optional[str] = None + """Set the inspection mode to either `deep` or `shallow`.""" diff --git a/src/cloudflare/types/zero_trust/gateway/body_scanning_settings_param.py b/src/cloudflare/types/zero_trust/gateway/body_scanning_settings_param.py new file mode 100644 index 00000000000..3ffd6f9037e --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/body_scanning_settings_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["BodyScanningSettingsParam"] + + +class BodyScanningSettingsParam(TypedDict, total=False): + inspection_mode: str + """Set the inspection mode to either `deep` or `shallow`.""" diff --git a/src/cloudflare/types/zero_trust/gateway/browser_isolation_settings.py b/src/cloudflare/types/zero_trust/gateway/browser_isolation_settings.py new file mode 100644 index 00000000000..e55ca6ff780 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/browser_isolation_settings.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__ = ["BrowserIsolationSettings"] + + +class BrowserIsolationSettings(BaseModel): + non_identity_enabled: Optional[bool] = None + """Enable non-identity onramp support for Browser Isolation.""" + + url_browser_isolation_enabled: Optional[bool] = None + """Enable Clientless Browser Isolation.""" diff --git a/src/cloudflare/types/zero_trust/gateway/browser_isolation_settings_param.py b/src/cloudflare/types/zero_trust/gateway/browser_isolation_settings_param.py new file mode 100644 index 00000000000..3b43b6df009 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/browser_isolation_settings_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["BrowserIsolationSettingsParam"] + + +class BrowserIsolationSettingsParam(TypedDict, total=False): + non_identity_enabled: bool + """Enable non-identity onramp support for Browser Isolation.""" + + url_browser_isolation_enabled: bool + """Enable Clientless Browser Isolation.""" diff --git a/src/cloudflare/types/zero_trust/gateway/category.py b/src/cloudflare/types/zero_trust/gateway/category.py new file mode 100644 index 00000000000..32ac136b133 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/category.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["Category", "Subcategory"] + + +class Subcategory(BaseModel): + id: Optional[int] = None + """The identifier for this category. There is only one category per ID.""" + + beta: Optional[bool] = None + """True if the category is in beta and subject to change.""" + + class_: Optional[Literal["free", "premium", "blocked", "removalPending", "noBlock"]] = FieldInfo( + alias="class", default=None + ) + """Which account types are allowed to create policies based on this category. + + `blocked` categories are blocked unconditionally for all accounts. + `removalPending` categories can be removed from policies but not added. + `noBlock` categories cannot be blocked. + """ + + description: Optional[str] = None + """A short summary of domains in the category.""" + + name: Optional[str] = None + """The name of the category.""" + + +class Category(BaseModel): + id: Optional[int] = None + """The identifier for this category. There is only one category per ID.""" + + beta: Optional[bool] = None + """True if the category is in beta and subject to change.""" + + class_: Optional[Literal["free", "premium", "blocked", "removalPending", "noBlock"]] = FieldInfo( + alias="class", default=None + ) + """Which account types are allowed to create policies based on this category. + + `blocked` categories are blocked unconditionally for all accounts. + `removalPending` categories can be removed from policies but not added. + `noBlock` categories cannot be blocked. + """ + + description: Optional[str] = None + """A short summary of domains in the category.""" + + name: Optional[str] = None + """The name of the category.""" + + subcategories: Optional[List[Subcategory]] = None + """All subcategories for this category.""" 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 1b8b4486943..9adb3f5ae01 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_edit_params.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_edit_params.py @@ -4,166 +4,13 @@ from typing_extensions import Required, TypedDict -__all__ = [ - "ConfigurationEditParams", - "Settings", - "SettingsActivityLog", - "SettingsAntivirus", - "SettingsAntivirusNotificationSettings", - "SettingsBlockPage", - "SettingsBodyScanning", - "SettingsBrowserIsolation", - "SettingsCustomCertificate", - "SettingsExtendedEmailMatching", - "SettingsFips", - "SettingsProtocolDetection", - "SettingsTLSDecrypt", -] +from .gateway_configuration_settings_param import GatewayConfigurationSettingsParam + +__all__ = ["ConfigurationEditParams"] class ConfigurationEditParams(TypedDict, total=False): account_id: Required[str] - settings: Settings + settings: GatewayConfigurationSettingsParam """account settings.""" - - -class SettingsActivityLog(TypedDict, total=False): - enabled: bool - """Enable activity logging.""" - - -class SettingsAntivirusNotificationSettings(TypedDict, total=False): - enabled: bool - """Set notification on""" - - msg: str - """Customize the message shown in the notification.""" - - support_url: str - """Optional URL to direct users to additional information. - - If not set, the notification will open a block page. - """ - - -class SettingsAntivirus(TypedDict, total=False): - enabled_download_phase: bool - """Enable anti-virus scanning on downloads.""" - - enabled_upload_phase: bool - """Enable anti-virus scanning on uploads.""" - - fail_closed: bool - """Block requests for files that cannot be scanned.""" - - notification_settings: SettingsAntivirusNotificationSettings - """ - Configure a message to display on the user's device when an antivirus search is - performed. - """ - - -class SettingsBlockPage(TypedDict, total=False): - background_color: str - """Block page background color in #rrggbb format.""" - - enabled: bool - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - footer_text: str - """Block page footer text.""" - - header_text: str - """Block page header text.""" - - logo_path: str - """Full URL to the logo file.""" - - mailto_address: str - """Admin email for users to contact.""" - - mailto_subject: str - """Subject line for emails created from block page.""" - - name: str - """Block page title.""" - - suppress_footer: bool - """Suppress detailed info at the bottom of the block page.""" - - -class SettingsBodyScanning(TypedDict, total=False): - inspection_mode: str - """Set the inspection mode to either `deep` or `shallow`.""" - - -class SettingsBrowserIsolation(TypedDict, total=False): - non_identity_enabled: bool - """Enable non-identity onramp support for Browser Isolation.""" - - url_browser_isolation_enabled: bool - """Enable Clientless Browser Isolation.""" - - -class SettingsCustomCertificate(TypedDict, total=False): - enabled: Required[bool] - """Enable use of custom certificate authority for signing Gateway traffic.""" - - id: str - """UUID of certificate (ID from MTLS certificate store).""" - - -class SettingsExtendedEmailMatching(TypedDict, total=False): - enabled: bool - """Enable matching all variants of user emails (with + or . - - modifiers) used as criteria in Firewall policies. - """ - - -class SettingsFips(TypedDict, total=False): - tls: bool - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - -class SettingsProtocolDetection(TypedDict, total=False): - enabled: bool - """Enable detecting protocol on initial bytes of client traffic.""" - - -class SettingsTLSDecrypt(TypedDict, total=False): - enabled: bool - """Enable inspecting encrypted HTTP traffic.""" - - -class Settings(TypedDict, total=False): - activity_log: SettingsActivityLog - """Activity log settings.""" - - antivirus: SettingsAntivirus - """Anti-virus settings.""" - - block_page: SettingsBlockPage - """Block page layout settings.""" - - body_scanning: SettingsBodyScanning - """DLP body scanning settings.""" - - browser_isolation: SettingsBrowserIsolation - """Browser isolation settings.""" - - custom_certificate: SettingsCustomCertificate - """Custom certificate settings for BYO-PKI.""" - - extended_email_matching: SettingsExtendedEmailMatching - """Extended e-mail matching settings.""" - - fips: SettingsFips - """FIPS settings.""" - - protocol_detection: SettingsProtocolDetection - """Protocol Detection settings.""" - - tls_decrypt: SettingsTLSDecrypt - """TLS interception 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 4e067c18509..e7659cf264e 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_edit_response.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_edit_response.py @@ -4,174 +4,15 @@ from datetime import datetime from ...._models import BaseModel +from .gateway_configuration_settings import GatewayConfigurationSettings -__all__ = [ - "ConfigurationEditResponse", - "Settings", - "SettingsActivityLog", - "SettingsAntivirus", - "SettingsAntivirusNotificationSettings", - "SettingsBlockPage", - "SettingsBodyScanning", - "SettingsBrowserIsolation", - "SettingsCustomCertificate", - "SettingsExtendedEmailMatching", - "SettingsFips", - "SettingsProtocolDetection", - "SettingsTLSDecrypt", -] - - -class SettingsActivityLog(BaseModel): - enabled: Optional[bool] = None - """Enable activity logging.""" - - -class SettingsAntivirusNotificationSettings(BaseModel): - enabled: Optional[bool] = None - """Set notification on""" - - msg: Optional[str] = None - """Customize the message shown in the notification.""" - - support_url: Optional[str] = None - """Optional URL to direct users to additional information. - - If not set, the notification will open a block page. - """ - - -class SettingsAntivirus(BaseModel): - enabled_download_phase: Optional[bool] = None - """Enable anti-virus scanning on downloads.""" - - enabled_upload_phase: Optional[bool] = None - """Enable anti-virus scanning on uploads.""" - - fail_closed: Optional[bool] = None - """Block requests for files that cannot be scanned.""" - - notification_settings: Optional[SettingsAntivirusNotificationSettings] = None - """ - Configure a message to display on the user's device when an antivirus search is - performed. - """ - - -class SettingsBlockPage(BaseModel): - background_color: Optional[str] = None - """Block page background color in #rrggbb format.""" - - enabled: Optional[bool] = None - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - footer_text: Optional[str] = None - """Block page footer text.""" - - header_text: Optional[str] = None - """Block page header text.""" - - logo_path: Optional[str] = None - """Full URL to the logo file.""" - - mailto_address: Optional[str] = None - """Admin email for users to contact.""" - - mailto_subject: Optional[str] = None - """Subject line for emails created from block page.""" - - name: Optional[str] = None - """Block page title.""" - - suppress_footer: Optional[bool] = None - """Suppress detailed info at the bottom of the block page.""" - - -class SettingsBodyScanning(BaseModel): - inspection_mode: Optional[str] = None - """Set the inspection mode to either `deep` or `shallow`.""" - - -class SettingsBrowserIsolation(BaseModel): - non_identity_enabled: Optional[bool] = None - """Enable non-identity onramp support for Browser Isolation.""" - - url_browser_isolation_enabled: Optional[bool] = None - """Enable Clientless Browser Isolation.""" - - -class SettingsCustomCertificate(BaseModel): - enabled: bool - """Enable use of custom certificate authority for signing Gateway traffic.""" - - id: Optional[str] = None - """UUID of certificate (ID from MTLS certificate store).""" - - binding_status: Optional[str] = None - """Certificate status (internal).""" - - updated_at: Optional[datetime] = None - - -class SettingsExtendedEmailMatching(BaseModel): - enabled: Optional[bool] = None - """Enable matching all variants of user emails (with + or . - - modifiers) used as criteria in Firewall policies. - """ - - -class SettingsFips(BaseModel): - tls: Optional[bool] = None - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - -class SettingsProtocolDetection(BaseModel): - enabled: Optional[bool] = None - """Enable detecting protocol on initial bytes of client traffic.""" - - -class SettingsTLSDecrypt(BaseModel): - enabled: Optional[bool] = None - """Enable inspecting encrypted HTTP traffic.""" - - -class Settings(BaseModel): - activity_log: Optional[SettingsActivityLog] = None - """Activity log settings.""" - - antivirus: Optional[SettingsAntivirus] = None - """Anti-virus settings.""" - - block_page: Optional[SettingsBlockPage] = None - """Block page layout settings.""" - - body_scanning: Optional[SettingsBodyScanning] = None - """DLP body scanning settings.""" - - browser_isolation: Optional[SettingsBrowserIsolation] = None - """Browser isolation settings.""" - - custom_certificate: Optional[SettingsCustomCertificate] = None - """Custom certificate settings for BYO-PKI.""" - - extended_email_matching: Optional[SettingsExtendedEmailMatching] = None - """Extended e-mail matching settings.""" - - fips: Optional[SettingsFips] = None - """FIPS settings.""" - - protocol_detection: Optional[SettingsProtocolDetection] = None - """Protocol Detection settings.""" - - tls_decrypt: Optional[SettingsTLSDecrypt] = None - """TLS interception settings.""" +__all__ = ["ConfigurationEditResponse"] class ConfigurationEditResponse(BaseModel): created_at: Optional[datetime] = None - settings: Optional[Settings] = None + settings: Optional[GatewayConfigurationSettings] = None """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 b4b6520dc3b..ab5d764c721 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_get_response.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_get_response.py @@ -4,174 +4,15 @@ from datetime import datetime from ...._models import BaseModel +from .gateway_configuration_settings import GatewayConfigurationSettings -__all__ = [ - "ConfigurationGetResponse", - "Settings", - "SettingsActivityLog", - "SettingsAntivirus", - "SettingsAntivirusNotificationSettings", - "SettingsBlockPage", - "SettingsBodyScanning", - "SettingsBrowserIsolation", - "SettingsCustomCertificate", - "SettingsExtendedEmailMatching", - "SettingsFips", - "SettingsProtocolDetection", - "SettingsTLSDecrypt", -] - - -class SettingsActivityLog(BaseModel): - enabled: Optional[bool] = None - """Enable activity logging.""" - - -class SettingsAntivirusNotificationSettings(BaseModel): - enabled: Optional[bool] = None - """Set notification on""" - - msg: Optional[str] = None - """Customize the message shown in the notification.""" - - support_url: Optional[str] = None - """Optional URL to direct users to additional information. - - If not set, the notification will open a block page. - """ - - -class SettingsAntivirus(BaseModel): - enabled_download_phase: Optional[bool] = None - """Enable anti-virus scanning on downloads.""" - - enabled_upload_phase: Optional[bool] = None - """Enable anti-virus scanning on uploads.""" - - fail_closed: Optional[bool] = None - """Block requests for files that cannot be scanned.""" - - notification_settings: Optional[SettingsAntivirusNotificationSettings] = None - """ - Configure a message to display on the user's device when an antivirus search is - performed. - """ - - -class SettingsBlockPage(BaseModel): - background_color: Optional[str] = None - """Block page background color in #rrggbb format.""" - - enabled: Optional[bool] = None - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - footer_text: Optional[str] = None - """Block page footer text.""" - - header_text: Optional[str] = None - """Block page header text.""" - - logo_path: Optional[str] = None - """Full URL to the logo file.""" - - mailto_address: Optional[str] = None - """Admin email for users to contact.""" - - mailto_subject: Optional[str] = None - """Subject line for emails created from block page.""" - - name: Optional[str] = None - """Block page title.""" - - suppress_footer: Optional[bool] = None - """Suppress detailed info at the bottom of the block page.""" - - -class SettingsBodyScanning(BaseModel): - inspection_mode: Optional[str] = None - """Set the inspection mode to either `deep` or `shallow`.""" - - -class SettingsBrowserIsolation(BaseModel): - non_identity_enabled: Optional[bool] = None - """Enable non-identity onramp support for Browser Isolation.""" - - url_browser_isolation_enabled: Optional[bool] = None - """Enable Clientless Browser Isolation.""" - - -class SettingsCustomCertificate(BaseModel): - enabled: bool - """Enable use of custom certificate authority for signing Gateway traffic.""" - - id: Optional[str] = None - """UUID of certificate (ID from MTLS certificate store).""" - - binding_status: Optional[str] = None - """Certificate status (internal).""" - - updated_at: Optional[datetime] = None - - -class SettingsExtendedEmailMatching(BaseModel): - enabled: Optional[bool] = None - """Enable matching all variants of user emails (with + or . - - modifiers) used as criteria in Firewall policies. - """ - - -class SettingsFips(BaseModel): - tls: Optional[bool] = None - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - -class SettingsProtocolDetection(BaseModel): - enabled: Optional[bool] = None - """Enable detecting protocol on initial bytes of client traffic.""" - - -class SettingsTLSDecrypt(BaseModel): - enabled: Optional[bool] = None - """Enable inspecting encrypted HTTP traffic.""" - - -class Settings(BaseModel): - activity_log: Optional[SettingsActivityLog] = None - """Activity log settings.""" - - antivirus: Optional[SettingsAntivirus] = None - """Anti-virus settings.""" - - block_page: Optional[SettingsBlockPage] = None - """Block page layout settings.""" - - body_scanning: Optional[SettingsBodyScanning] = None - """DLP body scanning settings.""" - - browser_isolation: Optional[SettingsBrowserIsolation] = None - """Browser isolation settings.""" - - custom_certificate: Optional[SettingsCustomCertificate] = None - """Custom certificate settings for BYO-PKI.""" - - extended_email_matching: Optional[SettingsExtendedEmailMatching] = None - """Extended e-mail matching settings.""" - - fips: Optional[SettingsFips] = None - """FIPS settings.""" - - protocol_detection: Optional[SettingsProtocolDetection] = None - """Protocol Detection settings.""" - - tls_decrypt: Optional[SettingsTLSDecrypt] = None - """TLS interception settings.""" +__all__ = ["ConfigurationGetResponse"] class ConfigurationGetResponse(BaseModel): created_at: Optional[datetime] = None - settings: Optional[Settings] = None + settings: Optional[GatewayConfigurationSettings] = None """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 e2c78e50f50..7fcc1d00377 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_update_params.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_update_params.py @@ -4,166 +4,13 @@ from typing_extensions import Required, TypedDict -__all__ = [ - "ConfigurationUpdateParams", - "Settings", - "SettingsActivityLog", - "SettingsAntivirus", - "SettingsAntivirusNotificationSettings", - "SettingsBlockPage", - "SettingsBodyScanning", - "SettingsBrowserIsolation", - "SettingsCustomCertificate", - "SettingsExtendedEmailMatching", - "SettingsFips", - "SettingsProtocolDetection", - "SettingsTLSDecrypt", -] +from .gateway_configuration_settings_param import GatewayConfigurationSettingsParam + +__all__ = ["ConfigurationUpdateParams"] class ConfigurationUpdateParams(TypedDict, total=False): account_id: Required[str] - settings: Settings + settings: GatewayConfigurationSettingsParam """account settings.""" - - -class SettingsActivityLog(TypedDict, total=False): - enabled: bool - """Enable activity logging.""" - - -class SettingsAntivirusNotificationSettings(TypedDict, total=False): - enabled: bool - """Set notification on""" - - msg: str - """Customize the message shown in the notification.""" - - support_url: str - """Optional URL to direct users to additional information. - - If not set, the notification will open a block page. - """ - - -class SettingsAntivirus(TypedDict, total=False): - enabled_download_phase: bool - """Enable anti-virus scanning on downloads.""" - - enabled_upload_phase: bool - """Enable anti-virus scanning on uploads.""" - - fail_closed: bool - """Block requests for files that cannot be scanned.""" - - notification_settings: SettingsAntivirusNotificationSettings - """ - Configure a message to display on the user's device when an antivirus search is - performed. - """ - - -class SettingsBlockPage(TypedDict, total=False): - background_color: str - """Block page background color in #rrggbb format.""" - - enabled: bool - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - footer_text: str - """Block page footer text.""" - - header_text: str - """Block page header text.""" - - logo_path: str - """Full URL to the logo file.""" - - mailto_address: str - """Admin email for users to contact.""" - - mailto_subject: str - """Subject line for emails created from block page.""" - - name: str - """Block page title.""" - - suppress_footer: bool - """Suppress detailed info at the bottom of the block page.""" - - -class SettingsBodyScanning(TypedDict, total=False): - inspection_mode: str - """Set the inspection mode to either `deep` or `shallow`.""" - - -class SettingsBrowserIsolation(TypedDict, total=False): - non_identity_enabled: bool - """Enable non-identity onramp support for Browser Isolation.""" - - url_browser_isolation_enabled: bool - """Enable Clientless Browser Isolation.""" - - -class SettingsCustomCertificate(TypedDict, total=False): - enabled: Required[bool] - """Enable use of custom certificate authority for signing Gateway traffic.""" - - id: str - """UUID of certificate (ID from MTLS certificate store).""" - - -class SettingsExtendedEmailMatching(TypedDict, total=False): - enabled: bool - """Enable matching all variants of user emails (with + or . - - modifiers) used as criteria in Firewall policies. - """ - - -class SettingsFips(TypedDict, total=False): - tls: bool - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - -class SettingsProtocolDetection(TypedDict, total=False): - enabled: bool - """Enable detecting protocol on initial bytes of client traffic.""" - - -class SettingsTLSDecrypt(TypedDict, total=False): - enabled: bool - """Enable inspecting encrypted HTTP traffic.""" - - -class Settings(TypedDict, total=False): - activity_log: SettingsActivityLog - """Activity log settings.""" - - antivirus: SettingsAntivirus - """Anti-virus settings.""" - - block_page: SettingsBlockPage - """Block page layout settings.""" - - body_scanning: SettingsBodyScanning - """DLP body scanning settings.""" - - browser_isolation: SettingsBrowserIsolation - """Browser isolation settings.""" - - custom_certificate: SettingsCustomCertificate - """Custom certificate settings for BYO-PKI.""" - - extended_email_matching: SettingsExtendedEmailMatching - """Extended e-mail matching settings.""" - - fips: SettingsFips - """FIPS settings.""" - - protocol_detection: SettingsProtocolDetection - """Protocol Detection settings.""" - - tls_decrypt: SettingsTLSDecrypt - """TLS interception 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 faec0a5c9be..f88c116ea7e 100644 --- a/src/cloudflare/types/zero_trust/gateway/configuration_update_response.py +++ b/src/cloudflare/types/zero_trust/gateway/configuration_update_response.py @@ -4,174 +4,15 @@ from datetime import datetime from ...._models import BaseModel +from .gateway_configuration_settings import GatewayConfigurationSettings -__all__ = [ - "ConfigurationUpdateResponse", - "Settings", - "SettingsActivityLog", - "SettingsAntivirus", - "SettingsAntivirusNotificationSettings", - "SettingsBlockPage", - "SettingsBodyScanning", - "SettingsBrowserIsolation", - "SettingsCustomCertificate", - "SettingsExtendedEmailMatching", - "SettingsFips", - "SettingsProtocolDetection", - "SettingsTLSDecrypt", -] - - -class SettingsActivityLog(BaseModel): - enabled: Optional[bool] = None - """Enable activity logging.""" - - -class SettingsAntivirusNotificationSettings(BaseModel): - enabled: Optional[bool] = None - """Set notification on""" - - msg: Optional[str] = None - """Customize the message shown in the notification.""" - - support_url: Optional[str] = None - """Optional URL to direct users to additional information. - - If not set, the notification will open a block page. - """ - - -class SettingsAntivirus(BaseModel): - enabled_download_phase: Optional[bool] = None - """Enable anti-virus scanning on downloads.""" - - enabled_upload_phase: Optional[bool] = None - """Enable anti-virus scanning on uploads.""" - - fail_closed: Optional[bool] = None - """Block requests for files that cannot be scanned.""" - - notification_settings: Optional[SettingsAntivirusNotificationSettings] = None - """ - Configure a message to display on the user's device when an antivirus search is - performed. - """ - - -class SettingsBlockPage(BaseModel): - background_color: Optional[str] = None - """Block page background color in #rrggbb format.""" - - enabled: Optional[bool] = None - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - footer_text: Optional[str] = None - """Block page footer text.""" - - header_text: Optional[str] = None - """Block page header text.""" - - logo_path: Optional[str] = None - """Full URL to the logo file.""" - - mailto_address: Optional[str] = None - """Admin email for users to contact.""" - - mailto_subject: Optional[str] = None - """Subject line for emails created from block page.""" - - name: Optional[str] = None - """Block page title.""" - - suppress_footer: Optional[bool] = None - """Suppress detailed info at the bottom of the block page.""" - - -class SettingsBodyScanning(BaseModel): - inspection_mode: Optional[str] = None - """Set the inspection mode to either `deep` or `shallow`.""" - - -class SettingsBrowserIsolation(BaseModel): - non_identity_enabled: Optional[bool] = None - """Enable non-identity onramp support for Browser Isolation.""" - - url_browser_isolation_enabled: Optional[bool] = None - """Enable Clientless Browser Isolation.""" - - -class SettingsCustomCertificate(BaseModel): - enabled: bool - """Enable use of custom certificate authority for signing Gateway traffic.""" - - id: Optional[str] = None - """UUID of certificate (ID from MTLS certificate store).""" - - binding_status: Optional[str] = None - """Certificate status (internal).""" - - updated_at: Optional[datetime] = None - - -class SettingsExtendedEmailMatching(BaseModel): - enabled: Optional[bool] = None - """Enable matching all variants of user emails (with + or . - - modifiers) used as criteria in Firewall policies. - """ - - -class SettingsFips(BaseModel): - tls: Optional[bool] = None - """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" - - -class SettingsProtocolDetection(BaseModel): - enabled: Optional[bool] = None - """Enable detecting protocol on initial bytes of client traffic.""" - - -class SettingsTLSDecrypt(BaseModel): - enabled: Optional[bool] = None - """Enable inspecting encrypted HTTP traffic.""" - - -class Settings(BaseModel): - activity_log: Optional[SettingsActivityLog] = None - """Activity log settings.""" - - antivirus: Optional[SettingsAntivirus] = None - """Anti-virus settings.""" - - block_page: Optional[SettingsBlockPage] = None - """Block page layout settings.""" - - body_scanning: Optional[SettingsBodyScanning] = None - """DLP body scanning settings.""" - - browser_isolation: Optional[SettingsBrowserIsolation] = None - """Browser isolation settings.""" - - custom_certificate: Optional[SettingsCustomCertificate] = None - """Custom certificate settings for BYO-PKI.""" - - extended_email_matching: Optional[SettingsExtendedEmailMatching] = None - """Extended e-mail matching settings.""" - - fips: Optional[SettingsFips] = None - """FIPS settings.""" - - protocol_detection: Optional[SettingsProtocolDetection] = None - """Protocol Detection settings.""" - - tls_decrypt: Optional[SettingsTLSDecrypt] = None - """TLS interception settings.""" +__all__ = ["ConfigurationUpdateResponse"] class ConfigurationUpdateResponse(BaseModel): created_at: Optional[datetime] = None - settings: Optional[Settings] = None + settings: Optional[GatewayConfigurationSettings] = None """account settings.""" updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/custom_certificate_settings.py b/src/cloudflare/types/zero_trust/gateway/custom_certificate_settings.py new file mode 100644 index 00000000000..95540254905 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/custom_certificate_settings.py @@ -0,0 +1,21 @@ +# 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__ = ["CustomCertificateSettings"] + + +class CustomCertificateSettings(BaseModel): + enabled: bool + """Enable use of custom certificate authority for signing Gateway traffic.""" + + id: Optional[str] = None + """UUID of certificate (ID from MTLS certificate store).""" + + binding_status: Optional[str] = None + """Certificate status (internal).""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/custom_certificate_settings_param.py b/src/cloudflare/types/zero_trust/gateway/custom_certificate_settings_param.py new file mode 100644 index 00000000000..60627d47117 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/custom_certificate_settings_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CustomCertificateSettingsParam"] + + +class CustomCertificateSettingsParam(TypedDict, total=False): + enabled: Required[bool] + """Enable use of custom certificate authority for signing Gateway traffic.""" + + id: str + """UUID of certificate (ID from MTLS certificate store).""" diff --git a/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v4.py b/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v4.py new file mode 100644 index 00000000000..0d328be7c4c --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v4.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["DNSResolverSettingsV4"] + + +class DNSResolverSettingsV4(BaseModel): + ip: str + """IPv4 address of upstream resolver.""" + + port: Optional[int] = None + """A port number to use for upstream resolver. Defaults to 53 if unspecified.""" + + route_through_private_network: Optional[bool] = None + """Whether to connect to this resolver over a private network. + + Must be set when vnet_id is set. + """ + + vnet_id: Optional[str] = None + """Optionally specify a virtual network for this resolver. + + Uses default virtual network id if omitted. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v4_param.py b/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v4_param.py new file mode 100644 index 00000000000..4b6f3e0620b --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v4_param.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["DNSResolverSettingsV4Param"] + + +class DNSResolverSettingsV4Param(TypedDict, total=False): + ip: Required[str] + """IPv4 address of upstream resolver.""" + + port: int + """A port number to use for upstream resolver. Defaults to 53 if unspecified.""" + + route_through_private_network: bool + """Whether to connect to this resolver over a private network. + + Must be set when vnet_id is set. + """ + + vnet_id: str + """Optionally specify a virtual network for this resolver. + + Uses default virtual network id if omitted. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v6.py b/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v6.py new file mode 100644 index 00000000000..535616c4d1e --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v6.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["DNSResolverSettingsV6"] + + +class DNSResolverSettingsV6(BaseModel): + ip: str + """IPv6 address of upstream resolver.""" + + port: Optional[int] = None + """A port number to use for upstream resolver. Defaults to 53 if unspecified.""" + + route_through_private_network: Optional[bool] = None + """Whether to connect to this resolver over a private network. + + Must be set when vnet_id is set. + """ + + vnet_id: Optional[str] = None + """Optionally specify a virtual network for this resolver. + + Uses default virtual network id if omitted. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v6_param.py b/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v6_param.py new file mode 100644 index 00000000000..a1f47e3691b --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/dns_resolver_settings_v6_param.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["DNSResolverSettingsV6Param"] + + +class DNSResolverSettingsV6Param(TypedDict, total=False): + ip: Required[str] + """IPv6 address of upstream resolver.""" + + port: int + """A port number to use for upstream resolver. Defaults to 53 if unspecified.""" + + route_through_private_network: bool + """Whether to connect to this resolver over a private network. + + Must be set when vnet_id is set. + """ + + vnet_id: str + """Optionally specify a virtual network for this resolver. + + Uses default virtual network id if omitted. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/extended_email_matching.py b/src/cloudflare/types/zero_trust/gateway/extended_email_matching.py new file mode 100644 index 00000000000..ff34962235c --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/extended_email_matching.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__ = ["ExtendedEmailMatching"] + + +class ExtendedEmailMatching(BaseModel): + enabled: Optional[bool] = None + """Enable matching all variants of user emails (with + or . + + modifiers) used as criteria in Firewall policies. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/extended_email_matching_param.py b/src/cloudflare/types/zero_trust/gateway/extended_email_matching_param.py new file mode 100644 index 00000000000..cdf65749933 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/extended_email_matching_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ExtendedEmailMatchingParam"] + + +class ExtendedEmailMatchingParam(TypedDict, total=False): + enabled: bool + """Enable matching all variants of user emails (with + or . + + modifiers) used as criteria in Firewall policies. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/fips_settings.py b/src/cloudflare/types/zero_trust/gateway/fips_settings.py new file mode 100644 index 00000000000..357e4b5c704 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/fips_settings.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__ = ["FipsSettings"] + + +class FipsSettings(BaseModel): + tls: Optional[bool] = None + """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" diff --git a/src/cloudflare/types/zero_trust/gateway/fips_settings_param.py b/src/cloudflare/types/zero_trust/gateway/fips_settings_param.py new file mode 100644 index 00000000000..4c344325f56 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/fips_settings_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["FipsSettingsParam"] + + +class FipsSettingsParam(TypedDict, total=False): + tls: bool + """Enable only cipher suites and TLS versions compliant with FIPS 140-2.""" diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings.py b/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings.py new file mode 100644 index 00000000000..13705c996f6 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel +from .tls_settings import TLSSettings +from .fips_settings import FipsSettings +from .protocol_detection import ProtocolDetection +from .anti_virus_settings import AntiVirusSettings +from .block_page_settings import BlockPageSettings +from .activity_log_settings import ActivityLogSettings +from .body_scanning_settings import BodyScanningSettings +from .extended_email_matching import ExtendedEmailMatching +from .browser_isolation_settings import BrowserIsolationSettings +from .custom_certificate_settings import CustomCertificateSettings + +__all__ = ["GatewayConfigurationSettings"] + + +class GatewayConfigurationSettings(BaseModel): + activity_log: Optional[ActivityLogSettings] = None + """Activity log settings.""" + + antivirus: Optional[AntiVirusSettings] = None + """Anti-virus settings.""" + + block_page: Optional[BlockPageSettings] = None + """Block page layout settings.""" + + body_scanning: Optional[BodyScanningSettings] = None + """DLP body scanning settings.""" + + browser_isolation: Optional[BrowserIsolationSettings] = None + """Browser isolation settings.""" + + custom_certificate: Optional[CustomCertificateSettings] = None + """Custom certificate settings for BYO-PKI.""" + + extended_email_matching: Optional[ExtendedEmailMatching] = None + """Extended e-mail matching settings.""" + + fips: Optional[FipsSettings] = None + """FIPS settings.""" + + protocol_detection: Optional[ProtocolDetection] = None + """Protocol Detection settings.""" + + tls_decrypt: Optional[TLSSettings] = None + """TLS interception settings.""" diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings_param.py b/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings_param.py new file mode 100644 index 00000000000..8b0b1443581 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings_param.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .tls_settings_param import TLSSettingsParam +from .fips_settings_param import FipsSettingsParam +from .protocol_detection_param import ProtocolDetectionParam +from .anti_virus_settings_param import AntiVirusSettingsParam +from .block_page_settings_param import BlockPageSettingsParam +from .activity_log_settings_param import ActivityLogSettingsParam +from .body_scanning_settings_param import BodyScanningSettingsParam +from .extended_email_matching_param import ExtendedEmailMatchingParam +from .browser_isolation_settings_param import BrowserIsolationSettingsParam +from .custom_certificate_settings_param import CustomCertificateSettingsParam + +__all__ = ["GatewayConfigurationSettingsParam"] + + +class GatewayConfigurationSettingsParam(TypedDict, total=False): + activity_log: ActivityLogSettingsParam + """Activity log settings.""" + + antivirus: AntiVirusSettingsParam + """Anti-virus settings.""" + + block_page: BlockPageSettingsParam + """Block page layout settings.""" + + body_scanning: BodyScanningSettingsParam + """DLP body scanning settings.""" + + browser_isolation: BrowserIsolationSettingsParam + """Browser isolation settings.""" + + custom_certificate: CustomCertificateSettingsParam + """Custom certificate settings for BYO-PKI.""" + + extended_email_matching: ExtendedEmailMatchingParam + """Extended e-mail matching settings.""" + + fips: FipsSettingsParam + """FIPS settings.""" + + protocol_detection: ProtocolDetectionParam + """Protocol Detection settings.""" + + tls_decrypt: TLSSettingsParam + """TLS interception settings.""" diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_filter.py b/src/cloudflare/types/zero_trust/gateway/gateway_filter.py new file mode 100644 index 00000000000..3cf57f644ff --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_filter.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["GatewayFilter"] + +GatewayFilter = Literal["http", "dns", "l4", "egress"] diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_ips.py b/src/cloudflare/types/zero_trust/gateway/gateway_ips.py new file mode 100644 index 00000000000..269847dd2ef --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_ips.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["GatewayIPs"] + +GatewayIPs = str diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_item.py b/src/cloudflare/types/zero_trust/gateway/gateway_item.py new file mode 100644 index 00000000000..44efdae06e5 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_item.py @@ -0,0 +1,15 @@ +# 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__ = ["GatewayItem"] + + +class GatewayItem(BaseModel): + created_at: Optional[datetime] = None + + value: Optional[str] = None + """The value of the item in a list.""" diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_item_param.py b/src/cloudflare/types/zero_trust/gateway/gateway_item_param.py new file mode 100644 index 00000000000..5b5d081859d --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_item_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["GatewayItemParam"] + + +class GatewayItemParam(TypedDict, total=False): + value: str + """The value of the item in a list.""" diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_list.py b/src/cloudflare/types/zero_trust/gateway/gateway_list.py new file mode 100644 index 00000000000..f24abb3c84a --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_list.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["GatewayList"] + + +class GatewayList(BaseModel): + id: Optional[str] = None + """API Resource UUID tag.""" + + count: Optional[float] = None + """The number of items in the list.""" + + created_at: Optional[datetime] = None + + description: Optional[str] = None + """The description of the list.""" + + name: Optional[str] = None + """The name of the list.""" + + type: Optional[Literal["SERIAL", "URL", "DOMAIN", "EMAIL", "IP"]] = None + """The type of list.""" + + 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 new file mode 100644 index 00000000000..d0db3cbe8e9 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_rule.py @@ -0,0 +1,88 @@ +# 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 .schedule import Schedule +from ...._models import BaseModel +from .rule_setting import RuleSetting +from .gateway_filter import GatewayFilter + +__all__ = ["GatewayRule"] + + +class GatewayRule(BaseModel): + id: Optional[str] = None + """The API resource UUID.""" + + action: Optional[ + Literal[ + "on", + "off", + "allow", + "block", + "scan", + "noscan", + "safesearch", + "ytrestricted", + "isolate", + "noisolate", + "override", + "l4_override", + "egress", + "audit_ssh", + "resolve", + ] + ] = None + """ + The action to preform when the associated traffic, identity, and device posture + expressions are either absent or evaluate to `true`. + """ + + created_at: Optional[datetime] = None + + deleted_at: Optional[datetime] = None + """Date of deletion, if any.""" + + description: Optional[str] = None + """The description of the rule.""" + + device_posture: Optional[str] = None + """The wirefilter expression used for device posture check matching.""" + + enabled: Optional[bool] = None + """True if the rule is enabled.""" + + filters: Optional[List[GatewayFilter]] = None + """ + The protocol or layer to evaluate the traffic, identity, and device posture + expressions. + """ + + identity: Optional[str] = None + """The wirefilter expression used for identity matching.""" + + name: Optional[str] = None + """The name of the rule.""" + + precedence: Optional[int] = None + """Precedence sets the order of your rules. + + Lower values indicate higher precedence. At each processing phase, applicable + rules are evaluated in ascending order of this value. + """ + + rule_settings: Optional[RuleSetting] = None + """Additional settings that modify the rule's action.""" + + schedule: Optional[Schedule] = None + """The schedule for activating DNS policies. + + This does not apply to HTTP or network policies. + """ + + traffic: Optional[str] = None + """The wirefilter expression used for traffic matching.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_settings.py b/src/cloudflare/types/zero_trust/gateway/gateway_settings.py new file mode 100644 index 00000000000..9b4982435da --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/gateway_settings.py @@ -0,0 +1,20 @@ +# 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__ = ["GatewaySettings"] + + +class GatewaySettings(BaseModel): + created_at: Optional[datetime] = None + + public_key: Optional[str] = None + """SSH encryption public key""" + + seed_id: Optional[str] = None + """Seed ID""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/list_create_params.py b/src/cloudflare/types/zero_trust/gateway/list_create_params.py index 073d8e8b866..c1d48ff069c 100644 --- a/src/cloudflare/types/zero_trust/gateway/list_create_params.py +++ b/src/cloudflare/types/zero_trust/gateway/list_create_params.py @@ -5,7 +5,9 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["ListCreateParams", "Item"] +from .gateway_item_param import GatewayItemParam + +__all__ = ["ListCreateParams"] class ListCreateParams(TypedDict, total=False): @@ -20,10 +22,5 @@ class ListCreateParams(TypedDict, total=False): description: str """The description of the list.""" - items: Iterable[Item] + items: Iterable[GatewayItemParam] """The items in the list.""" - - -class Item(TypedDict, total=False): - value: str - """The value of the item in a list.""" diff --git a/src/cloudflare/types/zero_trust/gateway/list_create_response.py b/src/cloudflare/types/zero_trust/gateway/list_create_response.py index 8b23cd72691..5db7e9b6e86 100644 --- a/src/cloudflare/types/zero_trust/gateway/list_create_response.py +++ b/src/cloudflare/types/zero_trust/gateway/list_create_response.py @@ -5,15 +5,9 @@ from typing_extensions import Literal from ...._models import BaseModel +from .gateway_item import GatewayItem -__all__ = ["ListCreateResponse", "Item"] - - -class Item(BaseModel): - created_at: Optional[datetime] = None - - value: Optional[str] = None - """The value of the item in a list.""" +__all__ = ["ListCreateResponse"] class ListCreateResponse(BaseModel): @@ -25,7 +19,7 @@ class ListCreateResponse(BaseModel): description: Optional[str] = None """The description of the list.""" - items: Optional[List[Item]] = None + items: Optional[List[GatewayItem]] = None """The items in the list.""" name: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/gateway/list_delete_params.py b/src/cloudflare/types/zero_trust/gateway/list_delete_params.py new file mode 100644 index 00000000000..42858bd751e --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/list_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ListDeleteParams"] + + +class ListDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/gateway/list_delete_response.py b/src/cloudflare/types/zero_trust/gateway/list_delete_response.py index ca9c43f744b..a798b20e4ad 100644 --- a/src/cloudflare/types/zero_trust/gateway/list_delete_response.py +++ b/src/cloudflare/types/zero_trust/gateway/list_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["ListDeleteResponse"] -ListDeleteResponse = Union[str, object] +ListDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/gateway/list_edit_params.py b/src/cloudflare/types/zero_trust/gateway/list_edit_params.py index c5fbd71771a..bdc08db33cc 100644 --- a/src/cloudflare/types/zero_trust/gateway/list_edit_params.py +++ b/src/cloudflare/types/zero_trust/gateway/list_edit_params.py @@ -5,19 +5,16 @@ from typing import List, Iterable from typing_extensions import Required, TypedDict -__all__ = ["ListEditParams", "Append"] +from .gateway_item_param import GatewayItemParam + +__all__ = ["ListEditParams"] class ListEditParams(TypedDict, total=False): account_id: Required[str] - append: Iterable[Append] + append: Iterable[GatewayItemParam] """The items in the list.""" remove: List[str] """A list of the item values you want to remove.""" - - -class Append(TypedDict, total=False): - value: str - """The value of the item in a list.""" diff --git a/src/cloudflare/types/zero_trust/gateway/lists/item_list_response.py b/src/cloudflare/types/zero_trust/gateway/lists/item_list_response.py index a1537bbcdde..5c1ec2f93af 100644 --- a/src/cloudflare/types/zero_trust/gateway/lists/item_list_response.py +++ b/src/cloudflare/types/zero_trust/gateway/lists/item_list_response.py @@ -1,18 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime +from typing import List -from ....._models import BaseModel +from ..gateway_item import GatewayItem -__all__ = ["ItemListResponse", "ItemListResponseItem"] +__all__ = ["ItemListResponse"] - -class ItemListResponseItem(BaseModel): - created_at: Optional[datetime] = None - - value: Optional[str] = None - """The value of the item in a list.""" - - -ItemListResponse = List[ItemListResponseItem] +ItemListResponse = List[GatewayItem] diff --git a/src/cloudflare/types/zero_trust/gateway/location.py b/src/cloudflare/types/zero_trust/gateway/location.py new file mode 100644 index 00000000000..cf69688dc8b --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/location.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel +from .location_network import LocationNetwork + +__all__ = ["Location"] + + +class Location(BaseModel): + id: Optional[str] = None + + client_default: Optional[bool] = None + """True if the location is the default location.""" + + created_at: Optional[datetime] = None + + doh_subdomain: Optional[str] = None + """The DNS over HTTPS domain to send DNS requests to. + + This field is auto-generated by Gateway. + """ + + ecs_support: Optional[bool] = None + """True if the location needs to resolve EDNS queries.""" + + ip: Optional[str] = None + """IPV6 destination ip assigned to this location. + + DNS requests sent to this IP will counted as the request under this location. + This field is auto-generated by Gateway. + """ + + name: Optional[str] = None + """The name of the location.""" + + networks: Optional[List[LocationNetwork]] = None + """A list of network ranges that requests from this location would originate from.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/location_create_params.py b/src/cloudflare/types/zero_trust/gateway/location_create_params.py index fec8c1c68cb..183da6b0292 100644 --- a/src/cloudflare/types/zero_trust/gateway/location_create_params.py +++ b/src/cloudflare/types/zero_trust/gateway/location_create_params.py @@ -5,7 +5,9 @@ from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = ["LocationCreateParams", "Network"] +from .location_network_param import LocationNetworkParam + +__all__ = ["LocationCreateParams"] class LocationCreateParams(TypedDict, total=False): @@ -20,10 +22,5 @@ class LocationCreateParams(TypedDict, total=False): ecs_support: bool """True if the location needs to resolve EDNS queries.""" - networks: Iterable[Network] + networks: Iterable[LocationNetworkParam] """A list of network ranges that requests from this location would originate from.""" - - -class Network(TypedDict, total=False): - network: Required[str] - """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" diff --git a/src/cloudflare/types/zero_trust/gateway/location_delete_params.py b/src/cloudflare/types/zero_trust/gateway/location_delete_params.py new file mode 100644 index 00000000000..afb7d137250 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/location_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LocationDeleteParams"] + + +class LocationDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/gateway/location_delete_response.py b/src/cloudflare/types/zero_trust/gateway/location_delete_response.py index 5c1f628ac32..d152621d0fa 100644 --- a/src/cloudflare/types/zero_trust/gateway/location_delete_response.py +++ b/src/cloudflare/types/zero_trust/gateway/location_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["LocationDeleteResponse"] -LocationDeleteResponse = Union[str, object] +LocationDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/gateway/location_network.py b/src/cloudflare/types/zero_trust/gateway/location_network.py new file mode 100644 index 00000000000..7b520e22ba1 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/location_network.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["LocationNetwork"] + + +class LocationNetwork(BaseModel): + network: str + """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" diff --git a/src/cloudflare/types/zero_trust/gateway/location_network_param.py b/src/cloudflare/types/zero_trust/gateway/location_network_param.py new file mode 100644 index 00000000000..e0328ee41ca --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/location_network_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LocationNetworkParam"] + + +class LocationNetworkParam(TypedDict, total=False): + network: Required[str] + """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" diff --git a/src/cloudflare/types/zero_trust/gateway/location_update_params.py b/src/cloudflare/types/zero_trust/gateway/location_update_params.py index 69f383f51f7..f563e09fa0f 100644 --- a/src/cloudflare/types/zero_trust/gateway/location_update_params.py +++ b/src/cloudflare/types/zero_trust/gateway/location_update_params.py @@ -5,7 +5,9 @@ from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = ["LocationUpdateParams", "Network"] +from .location_network_param import LocationNetworkParam + +__all__ = ["LocationUpdateParams"] class LocationUpdateParams(TypedDict, total=False): @@ -20,10 +22,5 @@ class LocationUpdateParams(TypedDict, total=False): ecs_support: bool """True if the location needs to resolve EDNS queries.""" - networks: Iterable[Network] + networks: Iterable[LocationNetworkParam] """A list of network ranges that requests from this location would originate from.""" - - -class Network(TypedDict, total=False): - network: Required[str] - """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" diff --git a/src/cloudflare/types/zero_trust/gateway/logging_setting.py b/src/cloudflare/types/zero_trust/gateway/logging_setting.py new file mode 100644 index 00000000000..7fd32c437a6 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/logging_setting.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["LoggingSetting", "SettingsByRuleType"] + + +class SettingsByRuleType(BaseModel): + dns: Optional[object] = None + """Logging settings for DNS firewall.""" + + http: Optional[object] = None + """Logging settings for HTTP/HTTPS firewall.""" + + l4: Optional[object] = None + """Logging settings for Network firewall.""" + + +class LoggingSetting(BaseModel): + redact_pii: Optional[bool] = None + """ + Redact personally identifiable information from activity logging (PII fields + are: source IP, user email, user ID, device ID, URL, referrer, user agent). + """ + + settings_by_rule_type: Optional[SettingsByRuleType] = None + """Logging settings by rule type.""" diff --git a/src/cloudflare/types/zero_trust/gateway/notification_settings.py b/src/cloudflare/types/zero_trust/gateway/notification_settings.py new file mode 100644 index 00000000000..0a1be707f81 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/notification_settings.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["NotificationSettings"] + + +class NotificationSettings(BaseModel): + enabled: Optional[bool] = None + """Set notification on""" + + msg: Optional[str] = None + """Customize the message shown in the notification.""" + + support_url: Optional[str] = None + """Optional URL to direct users to additional information. + + If not set, the notification will open a block page. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/notification_settings_param.py b/src/cloudflare/types/zero_trust/gateway/notification_settings_param.py new file mode 100644 index 00000000000..96db4b9f3c9 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/notification_settings_param.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 TypedDict + +__all__ = ["NotificationSettingsParam"] + + +class NotificationSettingsParam(TypedDict, total=False): + enabled: bool + """Set notification on""" + + msg: str + """Customize the message shown in the notification.""" + + support_url: str + """Optional URL to direct users to additional information. + + If not set, the notification will open a block page. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/protocol_detection.py b/src/cloudflare/types/zero_trust/gateway/protocol_detection.py new file mode 100644 index 00000000000..7d082eb6c2c --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/protocol_detection.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__ = ["ProtocolDetection"] + + +class ProtocolDetection(BaseModel): + enabled: Optional[bool] = None + """Enable detecting protocol on initial bytes of client traffic.""" diff --git a/src/cloudflare/types/zero_trust/gateway/protocol_detection_param.py b/src/cloudflare/types/zero_trust/gateway/protocol_detection_param.py new file mode 100644 index 00000000000..faece993406 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/protocol_detection_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ProtocolDetectionParam"] + + +class ProtocolDetectionParam(TypedDict, total=False): + enabled: bool + """Enable detecting protocol on initial bytes of client traffic.""" diff --git a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint.py b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint.py new file mode 100644 index 00000000000..8366853ea4e --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel +from .gateway_ips import GatewayIPs + +__all__ = ["ProxyEndpoint"] + + +class ProxyEndpoint(BaseModel): + id: Optional[str] = None + + created_at: Optional[datetime] = None + + ips: Optional[List[GatewayIPs]] = None + """A list of CIDRs to restrict ingress connections.""" + + name: Optional[str] = None + """The name of the proxy endpoint.""" + + subdomain: Optional[str] = None + """The subdomain to be used as the destination in the proxy client.""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_create_params.py b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_create_params.py index 13b00e30d42..d7c6c6674e8 100644 --- a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_create_params.py +++ b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_create_params.py @@ -5,17 +5,16 @@ from typing import List from typing_extensions import Required, TypedDict +from .gateway_ips import GatewayIPs + __all__ = ["ProxyEndpointCreateParams"] class ProxyEndpointCreateParams(TypedDict, total=False): account_id: Required[str] - ips: Required[List[str]] + ips: Required[List[GatewayIPs]] """A list of CIDRs to restrict ingress connections.""" name: Required[str] """The name of the proxy endpoint.""" - - subdomain: str - """The subdomain to be used as the destination in the proxy client.""" diff --git a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_delete_params.py b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_delete_params.py new file mode 100644 index 00000000000..0eaa7e21a79 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ProxyEndpointDeleteParams"] + + +class ProxyEndpointDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_delete_response.py b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_delete_response.py index 633466c153c..00e29cea0c4 100644 --- a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_delete_response.py +++ b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["ProxyEndpointDeleteResponse"] -ProxyEndpointDeleteResponse = Union[str, object] +ProxyEndpointDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_edit_params.py b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_edit_params.py index d5fa2e5b3af..9110c0529bb 100644 --- a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_edit_params.py +++ b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_edit_params.py @@ -5,17 +5,16 @@ from typing import List from typing_extensions import Required, TypedDict +from .gateway_ips import GatewayIPs + __all__ = ["ProxyEndpointEditParams"] class ProxyEndpointEditParams(TypedDict, total=False): account_id: Required[str] - ips: List[str] + ips: List[GatewayIPs] """A list of CIDRs to restrict ingress connections.""" name: str """The name of the proxy endpoint.""" - - subdomain: str - """The subdomain to be used as the destination in the proxy client.""" diff --git a/src/cloudflare/types/zero_trust/gateway/rule_create_params.py b/src/cloudflare/types/zero_trust/gateway/rule_create_params.py index fab6e56cb0d..72298b7f6df 100644 --- a/src/cloudflare/types/zero_trust/gateway/rule_create_params.py +++ b/src/cloudflare/types/zero_trust/gateway/rule_create_params.py @@ -2,25 +2,14 @@ from __future__ import annotations -from typing import List, Iterable +from typing import List from typing_extensions import Literal, Required, TypedDict -__all__ = [ - "RuleCreateParams", - "RuleSettings", - "RuleSettingsAuditSSH", - "RuleSettingsBisoAdminControls", - "RuleSettingsCheckSession", - "RuleSettingsDNSResolvers", - "RuleSettingsDNSResolversIPV4", - "RuleSettingsDNSResolversIPV6", - "RuleSettingsEgress", - "RuleSettingsL4override", - "RuleSettingsNotificationSettings", - "RuleSettingsPayloadLog", - "RuleSettingsUntrustedCERT", - "Schedule", -] +from .gateway_filter import GatewayFilter +from .schedule_param import ScheduleParam +from .rule_setting_param import RuleSettingParam + +__all__ = ["RuleCreateParams"] class RuleCreateParams(TypedDict, total=False): @@ -42,6 +31,7 @@ class RuleCreateParams(TypedDict, total=False): "l4_override", "egress", "audit_ssh", + "resolve", ] ] """ @@ -61,7 +51,7 @@ class RuleCreateParams(TypedDict, total=False): enabled: bool """True if the rule is enabled.""" - filters: List[Literal["http", "dns", "l4", "egress"]] + filters: List[GatewayFilter] """ The protocol or layer to evaluate the traffic, identity, and device posture expressions. @@ -77,10 +67,10 @@ class RuleCreateParams(TypedDict, total=False): rules are evaluated in ascending order of this value. """ - rule_settings: RuleSettings + rule_settings: RuleSettingParam """Additional settings that modify the rule's action.""" - schedule: Schedule + schedule: ScheduleParam """The schedule for activating DNS policies. This does not apply to HTTP or network policies. @@ -88,280 +78,3 @@ class RuleCreateParams(TypedDict, total=False): traffic: str """The wirefilter expression used for traffic matching.""" - - -class RuleSettingsAuditSSH(TypedDict, total=False): - command_logging: bool - """Enable to turn on SSH command logging.""" - - -class RuleSettingsBisoAdminControls(TypedDict, total=False): - dcp: bool - """Set to true to enable copy-pasting.""" - - dd: bool - """Set to true to enable downloading.""" - - dk: bool - """Set to true to enable keyboard usage.""" - - dp: bool - """Set to true to enable printing.""" - - du: bool - """Set to true to enable uploading.""" - - -class RuleSettingsCheckSession(TypedDict, total=False): - duration: str - """Configure how fresh the session needs to be to be considered valid.""" - - enforce: bool - """Set to true to enable session enforcement.""" - - -class RuleSettingsDNSResolversIPV4(TypedDict, total=False): - ip: Required[str] - """IP address of upstream resolver.""" - - port: int - """A port number to use for upstream resolver.""" - - route_through_private_network: bool - """Whether to connect to this resolver over a private network. - - Must be set when vnet_id is set. - """ - - vnet_id: str - """Optionally specify a virtual network for this resolver. - - Uses default virtual network id if omitted. - """ - - -class RuleSettingsDNSResolversIPV6(TypedDict, total=False): - ip: Required[str] - """IP address of upstream resolver.""" - - port: int - """A port number to use for upstream resolver.""" - - route_through_private_network: bool - """Whether to connect to this resolver over a private network. - - Must be set when vnet_id is set. - """ - - vnet_id: str - """Optionally specify a virtual network for this resolver. - - Uses default virtual network id if omitted. - """ - - -class RuleSettingsDNSResolvers(TypedDict, total=False): - ipv4: Iterable[RuleSettingsDNSResolversIPV4] - - ipv6: Iterable[RuleSettingsDNSResolversIPV6] - - -class RuleSettingsEgress(TypedDict, total=False): - ipv4: str - """The IPv4 address to be used for egress.""" - - ipv4_fallback: str - """ - The fallback IPv4 address to be used for egress in the event of an error - egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via - WARP IPs. - """ - - ipv6: str - """The IPv6 range to be used for egress.""" - - -class RuleSettingsL4override(TypedDict, total=False): - ip: str - """IPv4 or IPv6 address.""" - - port: int - """A port number to use for TCP/UDP overrides.""" - - -class RuleSettingsNotificationSettings(TypedDict, total=False): - enabled: bool - """Set notification on""" - - msg: str - """Customize the message shown in the notification.""" - - support_url: str - """Optional URL to direct users to additional information. - - If not set, the notification will open a block page. - """ - - -class RuleSettingsPayloadLog(TypedDict, total=False): - enabled: bool - """Set to true to enable DLP payload logging for this rule.""" - - -class RuleSettingsUntrustedCERT(TypedDict, total=False): - action: Literal["pass_through", "block", "error"] - """The action performed when an untrusted certificate is seen. - - The default action is an error with HTTP code 526. - """ - - -class RuleSettings(TypedDict, total=False): - add_headers: object - """Add custom headers to allowed requests, in the form of key-value pairs. - - Keys are header names, pointing to an array with its header value(s). - """ - - allow_child_bypass: bool - """Set by parent MSP accounts to enable their children to bypass this rule.""" - - audit_ssh: RuleSettingsAuditSSH - """Settings for the Audit SSH action.""" - - biso_admin_controls: RuleSettingsBisoAdminControls - """Configure how browser isolation behaves.""" - - block_page_enabled: bool - """Enable the custom block page.""" - - block_reason: str - """ - The text describing why this block occurred, displayed on the custom block page - (if enabled). - """ - - bypass_parent_rule: bool - """Set by children MSP accounts to bypass their parent's rules.""" - - check_session: RuleSettingsCheckSession - """Configure how session check behaves.""" - - dns_resolvers: RuleSettingsDNSResolvers - """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. - """ - - egress: RuleSettingsEgress - """Configure how Gateway Proxy traffic egresses. - - You can enable this setting for rules with Egress actions and filters, or omit - it to indicate local egress via WARP IPs. - """ - - insecure_disable_dnssec_validation: bool - """INSECURE - disable DNSSEC validation (for Allow actions).""" - - ip_categories: bool - """Set to true to enable IPs in DNS resolver category blocks. - - By default categories only block based on domain names. - """ - - ip_indicator_feeds: bool - """Set to true to include IPs in DNS resolver indicator feed blocks. - - By default indicator feeds only block based on domain names. - """ - - l4override: RuleSettingsL4override - """Send matching traffic to the supplied destination IP address and port.""" - - notification_settings: RuleSettingsNotificationSettings - """ - Configure a notification to display on the user's device when this rule is - matched. - """ - - override_host: str - """Override matching DNS queries with a hostname.""" - - override_ips: List[str] - """Override matching DNS queries with an IP or set of IPs.""" - - payload_log: RuleSettingsPayloadLog - """Configure DLP payload logging.""" - - 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. - """ - - untrusted_cert: RuleSettingsUntrustedCERT - """Configure behavior when an upstream cert is invalid or an SSL error occurs.""" - - -class Schedule(TypedDict, total=False): - fri: str - """ - The time intervals when the rule will be active on Fridays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Fridays. - """ - - mon: str - """ - The time intervals when the rule will be active on Mondays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Mondays. - """ - - sat: str - """ - The time intervals when the rule will be active on Saturdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Saturdays. - """ - - sun: str - """ - The time intervals when the rule will be active on Sundays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Sundays. - """ - - thu: str - """ - The time intervals when the rule will be active on Thursdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Thursdays. - """ - - time_zone: str - """The time zone the rule will be evaluated against. - - If a - [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) - is provided, Gateway will always use the current time at that time zone. If this - parameter is omitted, then Gateway will use the time zone inferred from the - user's source IP to evaluate the rule. If Gateway cannot determine the time zone - from the IP, we will fall back to the time zone of the user's connected data - center. - """ - - tue: str - """ - The time intervals when the rule will be active on Tuesdays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Tuesdays. - """ - - wed: str - """ - The time intervals when the rule will be active on Wednesdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Wednesdays. - """ diff --git a/src/cloudflare/types/zero_trust/gateway/rule_delete_params.py b/src/cloudflare/types/zero_trust/gateway/rule_delete_params.py new file mode 100644 index 00000000000..f729aaf685c --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/rule_delete_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RuleDeleteParams"] + + +class RuleDeleteParams(TypedDict, total=False): + account_id: Required[str] + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/gateway/rule_delete_response.py b/src/cloudflare/types/zero_trust/gateway/rule_delete_response.py index ba9fb55f8dc..e26a4455b29 100644 --- a/src/cloudflare/types/zero_trust/gateway/rule_delete_response.py +++ b/src/cloudflare/types/zero_trust/gateway/rule_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional __all__ = ["RuleDeleteResponse"] -RuleDeleteResponse = Union[str, object] +RuleDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/gateway/rule_setting.py b/src/cloudflare/types/zero_trust/gateway/rule_setting.py new file mode 100644 index 00000000000..9af12528729 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/rule_setting.py @@ -0,0 +1,197 @@ +# 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 +from .dns_resolver_settings_v4 import DNSResolverSettingsV4 +from .dns_resolver_settings_v6 import DNSResolverSettingsV6 + +__all__ = [ + "RuleSetting", + "AuditSSH", + "BisoAdminControls", + "CheckSession", + "DNSResolvers", + "Egress", + "L4override", + "NotificationSettings", + "PayloadLog", + "UntrustedCERT", +] + + +class AuditSSH(BaseModel): + command_logging: Optional[bool] = None + """Enable to turn on SSH command logging.""" + + +class BisoAdminControls(BaseModel): + dcp: Optional[bool] = None + """Set to true to enable copy-pasting.""" + + dd: Optional[bool] = None + """Set to true to enable downloading.""" + + dk: Optional[bool] = None + """Set to true to enable keyboard usage.""" + + dp: Optional[bool] = None + """Set to true to enable printing.""" + + du: Optional[bool] = None + """Set to true to enable uploading.""" + + +class CheckSession(BaseModel): + duration: Optional[str] = None + """Configure how fresh the session needs to be to be considered valid.""" + + enforce: Optional[bool] = None + """Set to true to enable session enforcement.""" + + +class DNSResolvers(BaseModel): + ipv4: Optional[List[DNSResolverSettingsV4]] = None + + ipv6: Optional[List[DNSResolverSettingsV6]] = None + + +class Egress(BaseModel): + ipv4: Optional[str] = None + """The IPv4 address to be used for egress.""" + + ipv4_fallback: Optional[str] = None + """ + The fallback IPv4 address to be used for egress in the event of an error + egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via + WARP IPs. + """ + + ipv6: Optional[str] = None + """The IPv6 range to be used for egress.""" + + +class L4override(BaseModel): + ip: Optional[str] = None + """IPv4 or IPv6 address.""" + + port: Optional[int] = None + """A port number to use for TCP/UDP overrides.""" + + +class NotificationSettings(BaseModel): + enabled: Optional[bool] = None + """Set notification on""" + + msg: Optional[str] = None + """Customize the message shown in the notification.""" + + support_url: Optional[str] = None + """Optional URL to direct users to additional information. + + If not set, the notification will open a block page. + """ + + +class PayloadLog(BaseModel): + enabled: Optional[bool] = None + """Set to true to enable DLP payload logging for this rule.""" + + +class UntrustedCERT(BaseModel): + action: Optional[Literal["pass_through", "block", "error"]] = None + """The action performed when an untrusted certificate is seen. + + The default action is an error with HTTP code 526. + """ + + +class RuleSetting(BaseModel): + add_headers: Optional[object] = None + """Add custom headers to allowed requests, in the form of key-value pairs. + + Keys are header names, pointing to an array with its header value(s). + """ + + allow_child_bypass: Optional[bool] = None + """Set by parent MSP accounts to enable their children to bypass this rule.""" + + audit_ssh: Optional[AuditSSH] = None + """Settings for the Audit SSH action.""" + + biso_admin_controls: Optional[BisoAdminControls] = None + """Configure how browser isolation behaves.""" + + block_page_enabled: Optional[bool] = None + """Enable the custom block page.""" + + block_reason: Optional[str] = None + """ + The text describing why this block occurred, displayed on the custom block page + (if enabled). + """ + + bypass_parent_rule: Optional[bool] = None + """Set by children MSP accounts to bypass their parent's rules.""" + + check_session: Optional[CheckSession] = None + """Configure how session check behaves.""" + + 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'. + """ + + egress: Optional[Egress] = None + """Configure how Gateway Proxy traffic egresses. + + You can enable this setting for rules with Egress actions and filters, or omit + it to indicate local egress via WARP IPs. + """ + + insecure_disable_dnssec_validation: Optional[bool] = None + """INSECURE - disable DNSSEC validation (for Allow actions).""" + + ip_categories: Optional[bool] = None + """Set to true to enable IPs in DNS resolver category blocks. + + By default categories only block based on domain names. + """ + + ip_indicator_feeds: Optional[bool] = None + """Set to true to include IPs in DNS resolver indicator feed blocks. + + By default indicator feeds only block based on domain names. + """ + + l4override: Optional[L4override] = None + """Send matching traffic to the supplied destination IP address and port.""" + + notification_settings: Optional[NotificationSettings] = None + """ + Configure a notification to display on the user's device when this rule is + matched. + """ + + override_host: Optional[str] = None + """Override matching DNS queries with a hostname.""" + + override_ips: Optional[List[str]] = None + """Override matching DNS queries with an IP or set of IPs.""" + + payload_log: Optional[PayloadLog] = None + """Configure DLP payload logging.""" + + 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'. + """ + + untrusted_cert: Optional[UntrustedCERT] = None + """Configure behavior when an upstream cert is invalid or an SSL error occurs.""" diff --git a/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py b/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py new file mode 100644 index 00000000000..62fe1523f29 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py @@ -0,0 +1,198 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, TypedDict + +from .dns_resolver_settings_v4_param import DNSResolverSettingsV4Param +from .dns_resolver_settings_v6_param import DNSResolverSettingsV6Param + +__all__ = [ + "RuleSettingParam", + "AuditSSH", + "BisoAdminControls", + "CheckSession", + "DNSResolvers", + "Egress", + "L4override", + "NotificationSettings", + "PayloadLog", + "UntrustedCERT", +] + + +class AuditSSH(TypedDict, total=False): + command_logging: bool + """Enable to turn on SSH command logging.""" + + +class BisoAdminControls(TypedDict, total=False): + dcp: bool + """Set to true to enable copy-pasting.""" + + dd: bool + """Set to true to enable downloading.""" + + dk: bool + """Set to true to enable keyboard usage.""" + + dp: bool + """Set to true to enable printing.""" + + du: bool + """Set to true to enable uploading.""" + + +class CheckSession(TypedDict, total=False): + duration: str + """Configure how fresh the session needs to be to be considered valid.""" + + enforce: bool + """Set to true to enable session enforcement.""" + + +class DNSResolvers(TypedDict, total=False): + ipv4: Iterable[DNSResolverSettingsV4Param] + + ipv6: Iterable[DNSResolverSettingsV6Param] + + +class Egress(TypedDict, total=False): + ipv4: str + """The IPv4 address to be used for egress.""" + + ipv4_fallback: str + """ + The fallback IPv4 address to be used for egress in the event of an error + egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via + WARP IPs. + """ + + ipv6: str + """The IPv6 range to be used for egress.""" + + +class L4override(TypedDict, total=False): + ip: str + """IPv4 or IPv6 address.""" + + port: int + """A port number to use for TCP/UDP overrides.""" + + +class NotificationSettings(TypedDict, total=False): + enabled: bool + """Set notification on""" + + msg: str + """Customize the message shown in the notification.""" + + support_url: str + """Optional URL to direct users to additional information. + + If not set, the notification will open a block page. + """ + + +class PayloadLog(TypedDict, total=False): + enabled: bool + """Set to true to enable DLP payload logging for this rule.""" + + +class UntrustedCERT(TypedDict, total=False): + action: Literal["pass_through", "block", "error"] + """The action performed when an untrusted certificate is seen. + + The default action is an error with HTTP code 526. + """ + + +class RuleSettingParam(TypedDict, total=False): + add_headers: object + """Add custom headers to allowed requests, in the form of key-value pairs. + + Keys are header names, pointing to an array with its header value(s). + """ + + allow_child_bypass: bool + """Set by parent MSP accounts to enable their children to bypass this rule.""" + + audit_ssh: AuditSSH + """Settings for the Audit SSH action.""" + + biso_admin_controls: BisoAdminControls + """Configure how browser isolation behaves.""" + + block_page_enabled: bool + """Enable the custom block page.""" + + block_reason: str + """ + The text describing why this block occurred, displayed on the custom block page + (if enabled). + """ + + bypass_parent_rule: bool + """Set by children MSP accounts to bypass their parent's rules.""" + + check_session: CheckSession + """Configure how session check behaves.""" + + 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'. + """ + + egress: Egress + """Configure how Gateway Proxy traffic egresses. + + You can enable this setting for rules with Egress actions and filters, or omit + it to indicate local egress via WARP IPs. + """ + + insecure_disable_dnssec_validation: bool + """INSECURE - disable DNSSEC validation (for Allow actions).""" + + ip_categories: bool + """Set to true to enable IPs in DNS resolver category blocks. + + By default categories only block based on domain names. + """ + + ip_indicator_feeds: bool + """Set to true to include IPs in DNS resolver indicator feed blocks. + + By default indicator feeds only block based on domain names. + """ + + l4override: L4override + """Send matching traffic to the supplied destination IP address and port.""" + + notification_settings: NotificationSettings + """ + Configure a notification to display on the user's device when this rule is + matched. + """ + + override_host: str + """Override matching DNS queries with a hostname.""" + + override_ips: List[str] + """Override matching DNS queries with an IP or set of IPs.""" + + payload_log: PayloadLog + """Configure DLP payload logging.""" + + 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'. + """ + + untrusted_cert: UntrustedCERT + """Configure behavior when an upstream cert is invalid or an SSL error occurs.""" diff --git a/src/cloudflare/types/zero_trust/gateway/rule_update_params.py b/src/cloudflare/types/zero_trust/gateway/rule_update_params.py index f15db14ba88..eb1be8a66bf 100644 --- a/src/cloudflare/types/zero_trust/gateway/rule_update_params.py +++ b/src/cloudflare/types/zero_trust/gateway/rule_update_params.py @@ -2,25 +2,14 @@ from __future__ import annotations -from typing import List, Iterable +from typing import List from typing_extensions import Literal, Required, TypedDict -__all__ = [ - "RuleUpdateParams", - "RuleSettings", - "RuleSettingsAuditSSH", - "RuleSettingsBisoAdminControls", - "RuleSettingsCheckSession", - "RuleSettingsDNSResolvers", - "RuleSettingsDNSResolversIPV4", - "RuleSettingsDNSResolversIPV6", - "RuleSettingsEgress", - "RuleSettingsL4override", - "RuleSettingsNotificationSettings", - "RuleSettingsPayloadLog", - "RuleSettingsUntrustedCERT", - "Schedule", -] +from .gateway_filter import GatewayFilter +from .schedule_param import ScheduleParam +from .rule_setting_param import RuleSettingParam + +__all__ = ["RuleUpdateParams"] class RuleUpdateParams(TypedDict, total=False): @@ -42,6 +31,7 @@ class RuleUpdateParams(TypedDict, total=False): "l4_override", "egress", "audit_ssh", + "resolve", ] ] """ @@ -61,7 +51,7 @@ class RuleUpdateParams(TypedDict, total=False): enabled: bool """True if the rule is enabled.""" - filters: List[Literal["http", "dns", "l4", "egress"]] + filters: List[GatewayFilter] """ The protocol or layer to evaluate the traffic, identity, and device posture expressions. @@ -77,10 +67,10 @@ class RuleUpdateParams(TypedDict, total=False): rules are evaluated in ascending order of this value. """ - rule_settings: RuleSettings + rule_settings: RuleSettingParam """Additional settings that modify the rule's action.""" - schedule: Schedule + schedule: ScheduleParam """The schedule for activating DNS policies. This does not apply to HTTP or network policies. @@ -88,280 +78,3 @@ class RuleUpdateParams(TypedDict, total=False): traffic: str """The wirefilter expression used for traffic matching.""" - - -class RuleSettingsAuditSSH(TypedDict, total=False): - command_logging: bool - """Enable to turn on SSH command logging.""" - - -class RuleSettingsBisoAdminControls(TypedDict, total=False): - dcp: bool - """Set to true to enable copy-pasting.""" - - dd: bool - """Set to true to enable downloading.""" - - dk: bool - """Set to true to enable keyboard usage.""" - - dp: bool - """Set to true to enable printing.""" - - du: bool - """Set to true to enable uploading.""" - - -class RuleSettingsCheckSession(TypedDict, total=False): - duration: str - """Configure how fresh the session needs to be to be considered valid.""" - - enforce: bool - """Set to true to enable session enforcement.""" - - -class RuleSettingsDNSResolversIPV4(TypedDict, total=False): - ip: Required[str] - """IP address of upstream resolver.""" - - port: int - """A port number to use for upstream resolver.""" - - route_through_private_network: bool - """Whether to connect to this resolver over a private network. - - Must be set when vnet_id is set. - """ - - vnet_id: str - """Optionally specify a virtual network for this resolver. - - Uses default virtual network id if omitted. - """ - - -class RuleSettingsDNSResolversIPV6(TypedDict, total=False): - ip: Required[str] - """IP address of upstream resolver.""" - - port: int - """A port number to use for upstream resolver.""" - - route_through_private_network: bool - """Whether to connect to this resolver over a private network. - - Must be set when vnet_id is set. - """ - - vnet_id: str - """Optionally specify a virtual network for this resolver. - - Uses default virtual network id if omitted. - """ - - -class RuleSettingsDNSResolvers(TypedDict, total=False): - ipv4: Iterable[RuleSettingsDNSResolversIPV4] - - ipv6: Iterable[RuleSettingsDNSResolversIPV6] - - -class RuleSettingsEgress(TypedDict, total=False): - ipv4: str - """The IPv4 address to be used for egress.""" - - ipv4_fallback: str - """ - The fallback IPv4 address to be used for egress in the event of an error - egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via - WARP IPs. - """ - - ipv6: str - """The IPv6 range to be used for egress.""" - - -class RuleSettingsL4override(TypedDict, total=False): - ip: str - """IPv4 or IPv6 address.""" - - port: int - """A port number to use for TCP/UDP overrides.""" - - -class RuleSettingsNotificationSettings(TypedDict, total=False): - enabled: bool - """Set notification on""" - - msg: str - """Customize the message shown in the notification.""" - - support_url: str - """Optional URL to direct users to additional information. - - If not set, the notification will open a block page. - """ - - -class RuleSettingsPayloadLog(TypedDict, total=False): - enabled: bool - """Set to true to enable DLP payload logging for this rule.""" - - -class RuleSettingsUntrustedCERT(TypedDict, total=False): - action: Literal["pass_through", "block", "error"] - """The action performed when an untrusted certificate is seen. - - The default action is an error with HTTP code 526. - """ - - -class RuleSettings(TypedDict, total=False): - add_headers: object - """Add custom headers to allowed requests, in the form of key-value pairs. - - Keys are header names, pointing to an array with its header value(s). - """ - - allow_child_bypass: bool - """Set by parent MSP accounts to enable their children to bypass this rule.""" - - audit_ssh: RuleSettingsAuditSSH - """Settings for the Audit SSH action.""" - - biso_admin_controls: RuleSettingsBisoAdminControls - """Configure how browser isolation behaves.""" - - block_page_enabled: bool - """Enable the custom block page.""" - - block_reason: str - """ - The text describing why this block occurred, displayed on the custom block page - (if enabled). - """ - - bypass_parent_rule: bool - """Set by children MSP accounts to bypass their parent's rules.""" - - check_session: RuleSettingsCheckSession - """Configure how session check behaves.""" - - dns_resolvers: RuleSettingsDNSResolvers - """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. - """ - - egress: RuleSettingsEgress - """Configure how Gateway Proxy traffic egresses. - - You can enable this setting for rules with Egress actions and filters, or omit - it to indicate local egress via WARP IPs. - """ - - insecure_disable_dnssec_validation: bool - """INSECURE - disable DNSSEC validation (for Allow actions).""" - - ip_categories: bool - """Set to true to enable IPs in DNS resolver category blocks. - - By default categories only block based on domain names. - """ - - ip_indicator_feeds: bool - """Set to true to include IPs in DNS resolver indicator feed blocks. - - By default indicator feeds only block based on domain names. - """ - - l4override: RuleSettingsL4override - """Send matching traffic to the supplied destination IP address and port.""" - - notification_settings: RuleSettingsNotificationSettings - """ - Configure a notification to display on the user's device when this rule is - matched. - """ - - override_host: str - """Override matching DNS queries with a hostname.""" - - override_ips: List[str] - """Override matching DNS queries with an IP or set of IPs.""" - - payload_log: RuleSettingsPayloadLog - """Configure DLP payload logging.""" - - 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. - """ - - untrusted_cert: RuleSettingsUntrustedCERT - """Configure behavior when an upstream cert is invalid or an SSL error occurs.""" - - -class Schedule(TypedDict, total=False): - fri: str - """ - The time intervals when the rule will be active on Fridays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Fridays. - """ - - mon: str - """ - The time intervals when the rule will be active on Mondays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Mondays. - """ - - sat: str - """ - The time intervals when the rule will be active on Saturdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Saturdays. - """ - - sun: str - """ - The time intervals when the rule will be active on Sundays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Sundays. - """ - - thu: str - """ - The time intervals when the rule will be active on Thursdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Thursdays. - """ - - time_zone: str - """The time zone the rule will be evaluated against. - - If a - [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) - is provided, Gateway will always use the current time at that time zone. If this - parameter is omitted, then Gateway will use the time zone inferred from the - user's source IP to evaluate the rule. If Gateway cannot determine the time zone - from the IP, we will fall back to the time zone of the user's connected data - center. - """ - - tue: str - """ - The time intervals when the rule will be active on Tuesdays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Tuesdays. - """ - - wed: str - """ - The time intervals when the rule will be active on Wednesdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Wednesdays. - """ diff --git a/src/cloudflare/types/zero_trust/gateway/schedule.py b/src/cloudflare/types/zero_trust/gateway/schedule.py new file mode 100644 index 00000000000..2554002fa1b --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/schedule.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["Schedule"] + + +class Schedule(BaseModel): + fri: Optional[str] = None + """ + The time intervals when the rule will be active on Fridays, in increasing order + from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + Fridays. + """ + + mon: Optional[str] = None + """ + The time intervals when the rule will be active on Mondays, in increasing order + from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + Mondays. + """ + + sat: Optional[str] = None + """ + The time intervals when the rule will be active on Saturdays, in increasing + order from 00:00-24:00. If this parameter is omitted, the rule will be + deactivated on Saturdays. + """ + + sun: Optional[str] = None + """ + The time intervals when the rule will be active on Sundays, in increasing order + from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + Sundays. + """ + + thu: Optional[str] = None + """ + The time intervals when the rule will be active on Thursdays, in increasing + order from 00:00-24:00. If this parameter is omitted, the rule will be + deactivated on Thursdays. + """ + + time_zone: Optional[str] = None + """The time zone the rule will be evaluated against. + + If a + [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) + is provided, Gateway will always use the current time at that time zone. If this + parameter is omitted, then Gateway will use the time zone inferred from the + user's source IP to evaluate the rule. If Gateway cannot determine the time zone + from the IP, we will fall back to the time zone of the user's connected data + center. + """ + + tue: Optional[str] = None + """ + The time intervals when the rule will be active on Tuesdays, in increasing order + from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + Tuesdays. + """ + + wed: Optional[str] = None + """ + The time intervals when the rule will be active on Wednesdays, in increasing + order from 00:00-24:00. If this parameter is omitted, the rule will be + deactivated on Wednesdays. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/schedule_param.py b/src/cloudflare/types/zero_trust/gateway/schedule_param.py new file mode 100644 index 00000000000..3fe65febb4d --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/schedule_param.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ScheduleParam"] + + +class ScheduleParam(TypedDict, total=False): + fri: str + """ + The time intervals when the rule will be active on Fridays, in increasing order + from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + Fridays. + """ + + mon: str + """ + The time intervals when the rule will be active on Mondays, in increasing order + from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + Mondays. + """ + + sat: str + """ + The time intervals when the rule will be active on Saturdays, in increasing + order from 00:00-24:00. If this parameter is omitted, the rule will be + deactivated on Saturdays. + """ + + sun: str + """ + The time intervals when the rule will be active on Sundays, in increasing order + from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + Sundays. + """ + + thu: str + """ + The time intervals when the rule will be active on Thursdays, in increasing + order from 00:00-24:00. If this parameter is omitted, the rule will be + deactivated on Thursdays. + """ + + time_zone: str + """The time zone the rule will be evaluated against. + + If a + [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) + is provided, Gateway will always use the current time at that time zone. If this + parameter is omitted, then Gateway will use the time zone inferred from the + user's source IP to evaluate the rule. If Gateway cannot determine the time zone + from the IP, we will fall back to the time zone of the user's connected data + center. + """ + + tue: str + """ + The time intervals when the rule will be active on Tuesdays, in increasing order + from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + Tuesdays. + """ + + wed: str + """ + The time intervals when the rule will be active on Wednesdays, in increasing + order from 00:00-24:00. If this parameter is omitted, the rule will be + deactivated on Wednesdays. + """ diff --git a/src/cloudflare/types/zero_trust/gateway/tls_settings.py b/src/cloudflare/types/zero_trust/gateway/tls_settings.py new file mode 100644 index 00000000000..e0a3fae4b5d --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/tls_settings.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__ = ["TLSSettings"] + + +class TLSSettings(BaseModel): + enabled: Optional[bool] = None + """Enable inspecting encrypted HTTP traffic.""" diff --git a/src/cloudflare/types/zero_trust/gateway/tls_settings_param.py b/src/cloudflare/types/zero_trust/gateway/tls_settings_param.py new file mode 100644 index 00000000000..ed0a04116aa --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/tls_settings_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["TLSSettingsParam"] + + +class TLSSettingsParam(TypedDict, total=False): + enabled: bool + """Enable inspecting encrypted HTTP traffic.""" diff --git a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_app_types.py b/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_app_types.py deleted file mode 100644 index bb651977018..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_app_types.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["ZeroTrustGatewayAppTypes", "ZeroTrustGatewayApplication", "ZeroTrustGatewayApplicationType"] - - -class ZeroTrustGatewayApplication(BaseModel): - id: Optional[int] = None - """The identifier for this application. There is only one application per ID.""" - - application_type_id: Optional[int] = None - """The identifier for the type of this application. - - There can be many applications with the same type. This refers to the `id` of a - returned application type. - """ - - created_at: Optional[datetime] = None - - name: Optional[str] = None - """The name of the application or application type.""" - - -class ZeroTrustGatewayApplicationType(BaseModel): - id: Optional[int] = None - """The identifier for the type of this application. - - There can be many applications with the same type. This refers to the `id` of a - returned application type. - """ - - created_at: Optional[datetime] = None - - description: Optional[str] = None - """A short summary of applications with this type.""" - - name: Optional[str] = None - """The name of the application or application type.""" - - -ZeroTrustGatewayAppTypes = Union[ZeroTrustGatewayApplication, ZeroTrustGatewayApplicationType] diff --git a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_categories.py b/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_categories.py deleted file mode 100644 index caf7453bb59..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_categories.py +++ /dev/null @@ -1,61 +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 pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["ZeroTrustGatewayCategories", "Subcategory"] - - -class Subcategory(BaseModel): - id: Optional[int] = None - """The identifier for this category. There is only one category per ID.""" - - beta: Optional[bool] = None - """True if the category is in beta and subject to change.""" - - class_: Optional[Literal["free", "premium", "blocked", "removalPending", "noBlock"]] = FieldInfo( - alias="class", default=None - ) - """Which account types are allowed to create policies based on this category. - - `blocked` categories are blocked unconditionally for all accounts. - `removalPending` categories can be removed from policies but not added. - `noBlock` categories cannot be blocked. - """ - - description: Optional[str] = None - """A short summary of domains in the category.""" - - name: Optional[str] = None - """The name of the category.""" - - -class ZeroTrustGatewayCategories(BaseModel): - id: Optional[int] = None - """The identifier for this category. There is only one category per ID.""" - - beta: Optional[bool] = None - """True if the category is in beta and subject to change.""" - - class_: Optional[Literal["free", "premium", "blocked", "removalPending", "noBlock"]] = FieldInfo( - alias="class", default=None - ) - """Which account types are allowed to create policies based on this category. - - `blocked` categories are blocked unconditionally for all accounts. - `removalPending` categories can be removed from policies but not added. - `noBlock` categories cannot be blocked. - """ - - description: Optional[str] = None - """A short summary of domains in the category.""" - - name: Optional[str] = None - """The name of the category.""" - - subcategories: Optional[List[Subcategory]] = None - """All subcategories for this category.""" diff --git a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_gateway_account_logging_settings.py b/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_gateway_account_logging_settings.py deleted file mode 100644 index 940be064172..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_gateway_account_logging_settings.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["ZeroTrustGatewayGatewayAccountLoggingSettings", "SettingsByRuleType"] - - -class SettingsByRuleType(BaseModel): - dns: Optional[object] = None - """Logging settings for DNS firewall.""" - - http: Optional[object] = None - """Logging settings for HTTP/HTTPS firewall.""" - - l4: Optional[object] = None - """Logging settings for Network firewall.""" - - -class ZeroTrustGatewayGatewayAccountLoggingSettings(BaseModel): - redact_pii: Optional[bool] = None - """ - Redact personally identifiable information from activity logging (PII fields - are: source IP, user email, user ID, device ID, URL, referrer, user agent). - """ - - settings_by_rule_type: Optional[SettingsByRuleType] = None - """Logging settings by rule type.""" diff --git a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_lists.py b/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_lists.py deleted file mode 100644 index 5cbd26fb325..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_lists.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 datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZeroTrustGatewayLists"] - - -class ZeroTrustGatewayLists(BaseModel): - id: Optional[str] = None - """API Resource UUID tag.""" - - count: Optional[float] = None - """The number of items in the list.""" - - created_at: Optional[datetime] = None - - description: Optional[str] = None - """The description of the list.""" - - name: Optional[str] = None - """The name of the list.""" - - type: Optional[Literal["SERIAL", "URL", "DOMAIN", "EMAIL", "IP"]] = None - """The type of list.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_locations.py b/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_locations.py deleted file mode 100644 index bee1b9fa203..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_locations.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["ZeroTrustGatewayLocations", "Network"] - - -class Network(BaseModel): - network: str - """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" - - -class ZeroTrustGatewayLocations(BaseModel): - id: Optional[str] = None - - client_default: Optional[bool] = None - """True if the location is the default location.""" - - created_at: Optional[datetime] = None - - doh_subdomain: Optional[str] = None - """The DNS over HTTPS domain to send DNS requests to. - - This field is auto-generated by Gateway. - """ - - ecs_support: Optional[bool] = None - """True if the location needs to resolve EDNS queries.""" - - ip: Optional[str] = None - """IPV6 destination ip assigned to this location. - - DNS requests sent to this IP will counted as the request under this location. - This field is auto-generated by Gateway. - """ - - name: Optional[str] = None - """The name of the location.""" - - networks: Optional[List[Network]] = None - """A list of network ranges that requests from this location would originate from.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_proxy_endpoints.py b/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_proxy_endpoints.py deleted file mode 100644 index 4524e201ceb..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_proxy_endpoints.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["ZeroTrustGatewayProxyEndpoints"] - - -class ZeroTrustGatewayProxyEndpoints(BaseModel): - id: Optional[str] = None - - created_at: Optional[datetime] = None - - ips: Optional[List[str]] = None - """A list of CIDRs to restrict ingress connections.""" - - name: Optional[str] = None - """The name of the proxy endpoint.""" - - subdomain: Optional[str] = None - """The subdomain to be used as the destination in the proxy client.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_rules.py b/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_rules.py deleted file mode 100644 index 66c415a0cc9..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_rules.py +++ /dev/null @@ -1,376 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = [ - "ZeroTrustGatewayRules", - "RuleSettings", - "RuleSettingsAuditSSH", - "RuleSettingsBisoAdminControls", - "RuleSettingsCheckSession", - "RuleSettingsDNSResolvers", - "RuleSettingsDNSResolversIPV4", - "RuleSettingsDNSResolversIPV6", - "RuleSettingsEgress", - "RuleSettingsL4override", - "RuleSettingsNotificationSettings", - "RuleSettingsPayloadLog", - "RuleSettingsUntrustedCERT", - "Schedule", -] - - -class RuleSettingsAuditSSH(BaseModel): - command_logging: Optional[bool] = None - """Enable to turn on SSH command logging.""" - - -class RuleSettingsBisoAdminControls(BaseModel): - dcp: Optional[bool] = None - """Set to true to enable copy-pasting.""" - - dd: Optional[bool] = None - """Set to true to enable downloading.""" - - dk: Optional[bool] = None - """Set to true to enable keyboard usage.""" - - dp: Optional[bool] = None - """Set to true to enable printing.""" - - du: Optional[bool] = None - """Set to true to enable uploading.""" - - -class RuleSettingsCheckSession(BaseModel): - duration: Optional[str] = None - """Configure how fresh the session needs to be to be considered valid.""" - - enforce: Optional[bool] = None - """Set to true to enable session enforcement.""" - - -class RuleSettingsDNSResolversIPV4(BaseModel): - ip: str - """IP address of upstream resolver.""" - - port: Optional[int] = None - """A port number to use for upstream resolver.""" - - route_through_private_network: Optional[bool] = None - """Whether to connect to this resolver over a private network. - - Must be set when vnet_id is set. - """ - - vnet_id: Optional[str] = None - """Optionally specify a virtual network for this resolver. - - Uses default virtual network id if omitted. - """ - - -class RuleSettingsDNSResolversIPV6(BaseModel): - ip: str - """IP address of upstream resolver.""" - - port: Optional[int] = None - """A port number to use for upstream resolver.""" - - route_through_private_network: Optional[bool] = None - """Whether to connect to this resolver over a private network. - - Must be set when vnet_id is set. - """ - - vnet_id: Optional[str] = None - """Optionally specify a virtual network for this resolver. - - Uses default virtual network id if omitted. - """ - - -class RuleSettingsDNSResolvers(BaseModel): - ipv4: Optional[List[RuleSettingsDNSResolversIPV4]] = None - - ipv6: Optional[List[RuleSettingsDNSResolversIPV6]] = None - - -class RuleSettingsEgress(BaseModel): - ipv4: Optional[str] = None - """The IPv4 address to be used for egress.""" - - ipv4_fallback: Optional[str] = None - """ - The fallback IPv4 address to be used for egress in the event of an error - egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via - WARP IPs. - """ - - ipv6: Optional[str] = None - """The IPv6 range to be used for egress.""" - - -class RuleSettingsL4override(BaseModel): - ip: Optional[str] = None - """IPv4 or IPv6 address.""" - - port: Optional[int] = None - """A port number to use for TCP/UDP overrides.""" - - -class RuleSettingsNotificationSettings(BaseModel): - enabled: Optional[bool] = None - """Set notification on""" - - msg: Optional[str] = None - """Customize the message shown in the notification.""" - - support_url: Optional[str] = None - """Optional URL to direct users to additional information. - - If not set, the notification will open a block page. - """ - - -class RuleSettingsPayloadLog(BaseModel): - enabled: Optional[bool] = None - """Set to true to enable DLP payload logging for this rule.""" - - -class RuleSettingsUntrustedCERT(BaseModel): - action: Optional[Literal["pass_through", "block", "error"]] = None - """The action performed when an untrusted certificate is seen. - - The default action is an error with HTTP code 526. - """ - - -class RuleSettings(BaseModel): - add_headers: Optional[object] = None - """Add custom headers to allowed requests, in the form of key-value pairs. - - Keys are header names, pointing to an array with its header value(s). - """ - - allow_child_bypass: Optional[bool] = None - """Set by parent MSP accounts to enable their children to bypass this rule.""" - - audit_ssh: Optional[RuleSettingsAuditSSH] = None - """Settings for the Audit SSH action.""" - - biso_admin_controls: Optional[RuleSettingsBisoAdminControls] = None - """Configure how browser isolation behaves.""" - - block_page_enabled: Optional[bool] = None - """Enable the custom block page.""" - - block_reason: Optional[str] = None - """ - The text describing why this block occurred, displayed on the custom block page - (if enabled). - """ - - bypass_parent_rule: Optional[bool] = None - """Set by children MSP accounts to bypass their parent's rules.""" - - check_session: Optional[RuleSettingsCheckSession] = None - """Configure how session check behaves.""" - - dns_resolvers: Optional[RuleSettingsDNSResolvers] = 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. - """ - - egress: Optional[RuleSettingsEgress] = None - """Configure how Gateway Proxy traffic egresses. - - You can enable this setting for rules with Egress actions and filters, or omit - it to indicate local egress via WARP IPs. - """ - - insecure_disable_dnssec_validation: Optional[bool] = None - """INSECURE - disable DNSSEC validation (for Allow actions).""" - - ip_categories: Optional[bool] = None - """Set to true to enable IPs in DNS resolver category blocks. - - By default categories only block based on domain names. - """ - - ip_indicator_feeds: Optional[bool] = None - """Set to true to include IPs in DNS resolver indicator feed blocks. - - By default indicator feeds only block based on domain names. - """ - - l4override: Optional[RuleSettingsL4override] = None - """Send matching traffic to the supplied destination IP address and port.""" - - notification_settings: Optional[RuleSettingsNotificationSettings] = None - """ - Configure a notification to display on the user's device when this rule is - matched. - """ - - override_host: Optional[str] = None - """Override matching DNS queries with a hostname.""" - - override_ips: Optional[List[str]] = None - """Override matching DNS queries with an IP or set of IPs.""" - - payload_log: Optional[RuleSettingsPayloadLog] = None - """Configure DLP payload logging.""" - - 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. - """ - - untrusted_cert: Optional[RuleSettingsUntrustedCERT] = None - """Configure behavior when an upstream cert is invalid or an SSL error occurs.""" - - -class Schedule(BaseModel): - fri: Optional[str] = None - """ - The time intervals when the rule will be active on Fridays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Fridays. - """ - - mon: Optional[str] = None - """ - The time intervals when the rule will be active on Mondays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Mondays. - """ - - sat: Optional[str] = None - """ - The time intervals when the rule will be active on Saturdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Saturdays. - """ - - sun: Optional[str] = None - """ - The time intervals when the rule will be active on Sundays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Sundays. - """ - - thu: Optional[str] = None - """ - The time intervals when the rule will be active on Thursdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Thursdays. - """ - - time_zone: Optional[str] = None - """The time zone the rule will be evaluated against. - - If a - [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) - is provided, Gateway will always use the current time at that time zone. If this - parameter is omitted, then Gateway will use the time zone inferred from the - user's source IP to evaluate the rule. If Gateway cannot determine the time zone - from the IP, we will fall back to the time zone of the user's connected data - center. - """ - - tue: Optional[str] = None - """ - The time intervals when the rule will be active on Tuesdays, in increasing order - from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on - Tuesdays. - """ - - wed: Optional[str] = None - """ - The time intervals when the rule will be active on Wednesdays, in increasing - order from 00:00-24:00. If this parameter is omitted, the rule will be - deactivated on Wednesdays. - """ - - -class ZeroTrustGatewayRules(BaseModel): - id: Optional[str] = None - """The API resource UUID.""" - - action: Optional[ - Literal[ - "on", - "off", - "allow", - "block", - "scan", - "noscan", - "safesearch", - "ytrestricted", - "isolate", - "noisolate", - "override", - "l4_override", - "egress", - "audit_ssh", - ] - ] = None - """ - The action to preform when the associated traffic, identity, and device posture - expressions are either absent or evaluate to `true`. - """ - - created_at: Optional[datetime] = None - - deleted_at: Optional[datetime] = None - """Date of deletion, if any.""" - - description: Optional[str] = None - """The description of the rule.""" - - device_posture: Optional[str] = None - """The wirefilter expression used for device posture check matching.""" - - enabled: Optional[bool] = None - """True if the rule is enabled.""" - - filters: Optional[List[Literal["http", "dns", "l4", "egress"]]] = None - """ - The protocol or layer to evaluate the traffic, identity, and device posture - expressions. - """ - - identity: Optional[str] = None - """The wirefilter expression used for identity matching.""" - - name: Optional[str] = None - """The name of the rule.""" - - precedence: Optional[int] = None - """Precedence sets the order of your rules. - - Lower values indicate higher precedence. At each processing phase, applicable - rules are evaluated in ascending order of this value. - """ - - rule_settings: Optional[RuleSettings] = None - """Additional settings that modify the rule's action.""" - - schedule: Optional[Schedule] = None - """The schedule for activating DNS policies. - - This does not apply to HTTP or network policies. - """ - - traffic: Optional[str] = None - """The wirefilter expression used for traffic matching.""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_settings.py b/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_settings.py deleted file mode 100644 index fb079396284..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/zero_trust_gateway_settings.py +++ /dev/null @@ -1,20 +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__ = ["ZeroTrustGatewaySettings"] - - -class ZeroTrustGatewaySettings(BaseModel): - created_at: Optional[datetime] = None - - public_key: Optional[str] = None - """SSH encryption public key""" - - seed_id: Optional[str] = None - """Seed ID""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/generic_oauth_config.py b/src/cloudflare/types/zero_trust/generic_oauth_config.py new file mode 100644 index 00000000000..372dfe9acf2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/generic_oauth_config.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__ = ["GenericOAuthConfig"] + + +class GenericOAuthConfig(BaseModel): + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" diff --git a/src/cloudflare/types/zero_trust/generic_oauth_config_param.py b/src/cloudflare/types/zero_trust/generic_oauth_config_param.py new file mode 100644 index 00000000000..94dd0225c0f --- /dev/null +++ b/src/cloudflare/types/zero_trust/generic_oauth_config_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["GenericOAuthConfigParam"] + + +class GenericOAuthConfigParam(TypedDict, total=False): + client_id: str + """Your OAuth Client ID""" + + client_secret: str + """Your OAuth Client Secret""" diff --git a/src/cloudflare/types/zero_trust/github_organization_rule.py b/src/cloudflare/types/zero_trust/github_organization_rule.py new file mode 100644 index 00000000000..828ab5751e9 --- /dev/null +++ b/src/cloudflare/types/zero_trust/github_organization_rule.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["GitHubOrganizationRule", "GitHubOrganization"] + + +class GitHubOrganization(BaseModel): + connection_id: str + """The ID of your Github identity provider.""" + + name: str + """The name of the organization.""" + + +class GitHubOrganizationRule(BaseModel): + github_organization: GitHubOrganization = FieldInfo(alias="github-organization") diff --git a/src/cloudflare/types/zero_trust/github_organization_rule_param.py b/src/cloudflare/types/zero_trust/github_organization_rule_param.py new file mode 100644 index 00000000000..094533d5156 --- /dev/null +++ b/src/cloudflare/types/zero_trust/github_organization_rule_param.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, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["GitHubOrganizationRuleParam", "GitHubOrganization"] + + +class GitHubOrganization(TypedDict, total=False): + connection_id: Required[str] + """The ID of your Github identity provider.""" + + name: Required[str] + """The name of the organization.""" + + +class GitHubOrganizationRuleParam(TypedDict, total=False): + github_organization: Required[Annotated[GitHubOrganization, PropertyInfo(alias="github-organization")]] diff --git a/src/cloudflare/types/zero_trust/group_rule.py b/src/cloudflare/types/zero_trust/group_rule.py new file mode 100644 index 00000000000..00aa6257072 --- /dev/null +++ b/src/cloudflare/types/zero_trust/group_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["GroupRule", "Group"] + + +class Group(BaseModel): + id: str + """The ID of a previously created Access group.""" + + +class GroupRule(BaseModel): + group: Group diff --git a/src/cloudflare/types/zero_trust/group_rule_param.py b/src/cloudflare/types/zero_trust/group_rule_param.py new file mode 100644 index 00000000000..54ce30e003e --- /dev/null +++ b/src/cloudflare/types/zero_trust/group_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["GroupRuleParam", "Group"] + + +class Group(TypedDict, total=False): + id: Required[str] + """The ID of a previously created Access group.""" + + +class GroupRuleParam(TypedDict, total=False): + group: Required[Group] diff --git a/src/cloudflare/types/zero_trust/gsuite_group_rule.py b/src/cloudflare/types/zero_trust/gsuite_group_rule.py new file mode 100644 index 00000000000..ebc864e0666 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gsuite_group_rule.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["GSuiteGroupRule", "GSuite"] + + +class GSuite(BaseModel): + connection_id: str + """The ID of your Google Workspace identity provider.""" + + email: str + """The email of the Google Workspace group.""" + + +class GSuiteGroupRule(BaseModel): + gsuite: GSuite diff --git a/src/cloudflare/types/zero_trust/gsuite_group_rule_param.py b/src/cloudflare/types/zero_trust/gsuite_group_rule_param.py new file mode 100644 index 00000000000..fc29c250b86 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gsuite_group_rule_param.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__ = ["GSuiteGroupRuleParam", "GSuite"] + + +class GSuite(TypedDict, total=False): + connection_id: Required[str] + """The ID of your Google Workspace identity provider.""" + + email: Required[str] + """The email of the Google Workspace group.""" + + +class GSuiteGroupRuleParam(TypedDict, total=False): + gsuite: Required[GSuite] diff --git a/src/cloudflare/types/zero_trust/identity_provider.py b/src/cloudflare/types/zero_trust/identity_provider.py new file mode 100644 index 00000000000..6731d7bc439 --- /dev/null +++ b/src/cloudflare/types/zero_trust/identity_provider.py @@ -0,0 +1,588 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional + +from .azure_ad import AzureAD +from ..._models import BaseModel +from .scim_config import ScimConfig +from .generic_oauth_config import GenericOAuthConfig +from .identity_provider_type import IdentityProviderType + +__all__ = [ + "IdentityProvider", + "AccessCentrify", + "AccessCentrifyConfig", + "AccessFacebook", + "AccessGitHub", + "AccessGoogle", + "AccessGoogleConfig", + "AccessGoogleApps", + "AccessGoogleAppsConfig", + "AccessLinkedin", + "AccessOIDC", + "AccessOIDCConfig", + "AccessOkta", + "AccessOktaConfig", + "AccessOnelogin", + "AccessOneloginConfig", + "AccessPingone", + "AccessPingoneConfig", + "AccessSAML", + "AccessSAMLConfig", + "AccessSAMLConfigHeaderAttribute", + "AccessYandex", + "AccessOnetimepin", +] + + +class AccessCentrifyConfig(BaseModel): + centrify_account: Optional[str] = None + """Your centrify account url""" + + centrify_app_id: Optional[str] = None + """Your centrify app id""" + + claims: Optional[List[str]] = None + """Custom claims""" + + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" + + email_claim_name: Optional[str] = None + """The claim name for email in the id_token response.""" + + +class AccessCentrify(BaseModel): + config: AccessCentrifyConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessFacebook(BaseModel): + config: GenericOAuthConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessGitHub(BaseModel): + config: GenericOAuthConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessGoogleConfig(BaseModel): + claims: Optional[List[str]] = None + """Custom claims""" + + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" + + email_claim_name: Optional[str] = None + """The claim name for email in the id_token response.""" + + +class AccessGoogle(BaseModel): + config: AccessGoogleConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessGoogleAppsConfig(BaseModel): + apps_domain: Optional[str] = None + """Your companies TLD""" + + claims: Optional[List[str]] = None + """Custom claims""" + + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" + + email_claim_name: Optional[str] = None + """The claim name for email in the id_token response.""" + + +class AccessGoogleApps(BaseModel): + config: AccessGoogleAppsConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessLinkedin(BaseModel): + config: GenericOAuthConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessOIDCConfig(BaseModel): + auth_url: Optional[str] = None + """The authorization_endpoint URL of your IdP""" + + certs_url: Optional[str] = None + """The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens""" + + claims: Optional[List[str]] = None + """Custom claims""" + + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" + + email_claim_name: Optional[str] = None + """The claim name for email in the id_token response.""" + + scopes: Optional[List[str]] = None + """OAuth scopes""" + + token_url: Optional[str] = None + """The token_endpoint URL of your IdP""" + + +class AccessOIDC(BaseModel): + config: AccessOIDCConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessOktaConfig(BaseModel): + authorization_server_id: Optional[str] = None + """Your okta authorization server id""" + + claims: Optional[List[str]] = None + """Custom claims""" + + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" + + email_claim_name: Optional[str] = None + """The claim name for email in the id_token response.""" + + okta_account: Optional[str] = None + """Your okta account url""" + + +class AccessOkta(BaseModel): + config: AccessOktaConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessOneloginConfig(BaseModel): + claims: Optional[List[str]] = None + """Custom claims""" + + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" + + email_claim_name: Optional[str] = None + """The claim name for email in the id_token response.""" + + onelogin_account: Optional[str] = None + """Your OneLogin account url""" + + +class AccessOnelogin(BaseModel): + config: AccessOneloginConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessPingoneConfig(BaseModel): + claims: Optional[List[str]] = None + """Custom claims""" + + client_id: Optional[str] = None + """Your OAuth Client ID""" + + client_secret: Optional[str] = None + """Your OAuth Client Secret""" + + email_claim_name: Optional[str] = None + """The claim name for email in the id_token response.""" + + ping_env_id: Optional[str] = None + """Your PingOne environment identifier""" + + +class AccessPingone(BaseModel): + config: AccessPingoneConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessSAMLConfigHeaderAttribute(BaseModel): + attribute_name: Optional[str] = None + """attribute name from the IDP""" + + header_name: Optional[str] = None + """header that will be added on the request to the origin""" + + +class AccessSAMLConfig(BaseModel): + attributes: Optional[List[str]] = None + """ + A list of SAML attribute names that will be added to your signed JWT token and + can be used in SAML policy rules. + """ + + email_attribute_name: Optional[str] = None + """The attribute name for email in the SAML response.""" + + header_attributes: Optional[List[AccessSAMLConfigHeaderAttribute]] = None + """ + Add a list of attribute names that will be returned in the response header from + the Access callback. + """ + + idp_public_certs: Optional[List[str]] = None + """X509 certificate to verify the signature in the SAML authentication response""" + + issuer_url: Optional[str] = None + """IdP Entity ID or Issuer URL""" + + sign_request: Optional[bool] = None + """Sign the SAML authentication request with Access credentials. + + To verify the signature, use the public key from the Access certs endpoints. + """ + + sso_target_url: Optional[str] = None + """URL to send the SAML authentication requests to""" + + +class AccessSAML(BaseModel): + config: AccessSAMLConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessYandex(BaseModel): + config: GenericOAuthConfig + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +class AccessOnetimepin(BaseModel): + config: object + """The configuration parameters for the identity provider. + + To view the required parameters for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + name: str + """The name of the identity provider, shown to users on the login page.""" + + type: IdentityProviderType + """The type of identity provider. + + To determine the value for a specific provider, refer to our + [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + """ + + id: Optional[str] = None + """UUID""" + + scim_config: Optional[ScimConfig] = None + """ + The configuration settings for enabling a System for Cross-Domain Identity + Management (SCIM) with the identity provider. + """ + + +IdentityProvider = Union[ + AzureAD, + AccessCentrify, + AccessFacebook, + AccessGitHub, + AccessGoogle, + AccessGoogleApps, + AccessLinkedin, + AccessOIDC, + AccessOkta, + AccessOnelogin, + AccessPingone, + AccessSAML, + AccessYandex, + AccessOnetimepin, +] diff --git a/src/cloudflare/types/zero_trust/identity_provider_create_params.py b/src/cloudflare/types/zero_trust/identity_provider_create_params.py index 1361f7a999c..907f7124fdb 100644 --- a/src/cloudflare/types/zero_trust/identity_provider_create_params.py +++ b/src/cloudflare/types/zero_trust/identity_provider_create_params.py @@ -5,55 +5,41 @@ from typing import List, Union, Iterable from typing_extensions import Literal, Required, TypedDict +from .scim_config_param import ScimConfigParam +from .identity_provider_type import IdentityProviderType +from .generic_oauth_config_param import GenericOAuthConfigParam + __all__ = [ "IdentityProviderCreateParams", - "AccessAzureAd", - "AccessAzureAdConfig", - "AccessAzureAdScimConfig", + "AzureAD", + "AzureADConfig", "AccessCentrify", "AccessCentrifyConfig", - "AccessCentrifyScimConfig", "AccessFacebook", - "AccessFacebookConfig", - "AccessFacebookScimConfig", "AccessGitHub", - "AccessGitHubConfig", - "AccessGitHubScimConfig", "AccessGoogle", "AccessGoogleConfig", - "AccessGoogleScimConfig", "AccessGoogleApps", "AccessGoogleAppsConfig", - "AccessGoogleAppsScimConfig", "AccessLinkedin", - "AccessLinkedinConfig", - "AccessLinkedinScimConfig", - "AccessOidc", - "AccessOidcConfig", - "AccessOidcScimConfig", + "AccessOIDC", + "AccessOIDCConfig", "AccessOkta", "AccessOktaConfig", - "AccessOktaScimConfig", "AccessOnelogin", "AccessOneloginConfig", - "AccessOneloginScimConfig", "AccessPingone", "AccessPingoneConfig", - "AccessPingoneScimConfig", - "AccessSaml", - "AccessSamlConfig", - "AccessSamlConfigHeaderAttribute", - "AccessSamlScimConfig", + "AccessSAML", + "AccessSAMLConfig", + "AccessSAMLConfigHeaderAttribute", "AccessYandex", - "AccessYandexConfig", - "AccessYandexScimConfig", "AccessOnetimepin", - "AccessOnetimepinScimConfig", ] -class AccessAzureAd(TypedDict, total=False): - config: Required[AccessAzureAdConfig] +class AzureAD(TypedDict, total=False): + config: Required[AzureADConfig] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -63,24 +49,7 @@ class AccessAzureAd(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -93,14 +62,14 @@ class AccessAzureAd(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessAzureAdScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessAzureAdConfig(TypedDict, total=False): +class AzureADConfig(TypedDict, total=False): claims: List[str] """Custom claims""" @@ -136,38 +105,6 @@ class AccessAzureAdConfig(TypedDict, total=False): """Should Cloudflare try to load groups from your account""" -class AccessAzureAdScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessCentrify(TypedDict, total=False): config: Required[AccessCentrifyConfig] """The configuration parameters for the identity provider. @@ -179,24 +116,7 @@ class AccessCentrify(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -209,7 +129,7 @@ class AccessCentrify(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessCentrifyScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -236,40 +156,8 @@ class AccessCentrifyConfig(TypedDict, total=False): """The claim name for email in the id_token response.""" -class AccessCentrifyScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessFacebook(TypedDict, total=False): - config: Required[AccessFacebookConfig] + config: Required[GenericOAuthConfigParam] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -279,24 +167,7 @@ class AccessFacebook(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -309,55 +180,15 @@ class AccessFacebook(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessFacebookScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessFacebookConfig(TypedDict, total=False): - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - -class AccessFacebookScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGitHub(TypedDict, total=False): - config: Required[AccessGitHubConfig] + config: Required[GenericOAuthConfigParam] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -367,24 +198,7 @@ class AccessGitHub(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -397,53 +211,13 @@ class AccessGitHub(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessGitHubScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessGitHubConfig(TypedDict, total=False): - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - -class AccessGitHubScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGoogle(TypedDict, total=False): config: Required[AccessGoogleConfig] """The configuration parameters for the identity provider. @@ -455,24 +229,7 @@ class AccessGoogle(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -485,7 +242,7 @@ class AccessGoogle(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessGoogleScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -506,38 +263,6 @@ class AccessGoogleConfig(TypedDict, total=False): """The claim name for email in the id_token response.""" -class AccessGoogleScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGoogleApps(TypedDict, total=False): config: Required[AccessGoogleAppsConfig] """The configuration parameters for the identity provider. @@ -549,24 +274,7 @@ class AccessGoogleApps(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -579,7 +287,7 @@ class AccessGoogleApps(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessGoogleAppsScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -603,40 +311,8 @@ class AccessGoogleAppsConfig(TypedDict, total=False): """The claim name for email in the id_token response.""" -class AccessGoogleAppsScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessLinkedin(TypedDict, total=False): - config: Required[AccessLinkedinConfig] + config: Required[GenericOAuthConfigParam] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -646,24 +322,7 @@ class AccessLinkedin(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -676,55 +335,15 @@ class AccessLinkedin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessLinkedinScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessLinkedinConfig(TypedDict, total=False): - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - -class AccessLinkedinScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessOidc(TypedDict, total=False): - config: Required[AccessOidcConfig] +class AccessOIDC(TypedDict, total=False): + config: Required[AccessOIDCConfig] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -734,24 +353,7 @@ class AccessOidc(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -764,14 +366,14 @@ class AccessOidc(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessOidcScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessOidcConfig(TypedDict, total=False): +class AccessOIDCConfig(TypedDict, total=False): auth_url: str """The authorization_endpoint URL of your IdP""" @@ -797,38 +399,6 @@ class AccessOidcConfig(TypedDict, total=False): """The token_endpoint URL of your IdP""" -class AccessOidcScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessOkta(TypedDict, total=False): config: Required[AccessOktaConfig] """The configuration parameters for the identity provider. @@ -840,24 +410,7 @@ class AccessOkta(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -870,7 +423,7 @@ class AccessOkta(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessOktaScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -897,38 +450,6 @@ class AccessOktaConfig(TypedDict, total=False): """Your okta account url""" -class AccessOktaScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessOnelogin(TypedDict, total=False): config: Required[AccessOneloginConfig] """The configuration parameters for the identity provider. @@ -940,24 +461,7 @@ class AccessOnelogin(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -970,7 +474,7 @@ class AccessOnelogin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessOneloginScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -994,38 +498,6 @@ class AccessOneloginConfig(TypedDict, total=False): """Your OneLogin account url""" -class AccessOneloginScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessPingone(TypedDict, total=False): config: Required[AccessPingoneConfig] """The configuration parameters for the identity provider. @@ -1037,24 +509,7 @@ class AccessPingone(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1067,7 +522,7 @@ class AccessPingone(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessPingoneScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -1091,40 +546,8 @@ class AccessPingoneConfig(TypedDict, total=False): """Your PingOne environment identifier""" -class AccessPingoneScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessSaml(TypedDict, total=False): - config: Required[AccessSamlConfig] +class AccessSAML(TypedDict, total=False): + config: Required[AccessSAMLConfig] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1134,24 +557,7 @@ class AccessSaml(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1164,14 +570,14 @@ class AccessSaml(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessSamlScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessSamlConfigHeaderAttribute(TypedDict, total=False): +class AccessSAMLConfigHeaderAttribute(TypedDict, total=False): attribute_name: str """attribute name from the IDP""" @@ -1179,7 +585,7 @@ class AccessSamlConfigHeaderAttribute(TypedDict, total=False): """header that will be added on the request to the origin""" -class AccessSamlConfig(TypedDict, total=False): +class AccessSAMLConfig(TypedDict, total=False): attributes: List[str] """ A list of SAML attribute names that will be added to your signed JWT token and @@ -1189,7 +595,7 @@ class AccessSamlConfig(TypedDict, total=False): email_attribute_name: str """The attribute name for email in the SAML response.""" - header_attributes: Iterable[AccessSamlConfigHeaderAttribute] + header_attributes: Iterable[AccessSAMLConfigHeaderAttribute] """ Add a list of attribute names that will be returned in the response header from the Access callback. @@ -1211,40 +617,8 @@ class AccessSamlConfig(TypedDict, total=False): """URL to send the SAML authentication requests to""" -class AccessSamlScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessYandex(TypedDict, total=False): - config: Required[AccessYandexConfig] + config: Required[GenericOAuthConfigParam] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1254,24 +628,7 @@ class AccessYandex(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1284,53 +641,13 @@ class AccessYandex(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessYandexScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessYandexConfig(TypedDict, total=False): - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - -class AccessYandexScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessOnetimepin(TypedDict, total=False): config: Required[object] """The configuration parameters for the identity provider. @@ -1342,24 +659,7 @@ class AccessOnetimepin(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1372,58 +672,26 @@ class AccessOnetimepin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessOnetimepinScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessOnetimepinScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - IdentityProviderCreateParams = Union[ - AccessAzureAd, + AzureAD, AccessCentrify, AccessFacebook, AccessGitHub, AccessGoogle, AccessGoogleApps, AccessLinkedin, - AccessOidc, + AccessOIDC, AccessOkta, AccessOnelogin, AccessPingone, - AccessSaml, + AccessSAML, AccessYandex, AccessOnetimepin, ] diff --git a/src/cloudflare/types/zero_trust/identity_provider_list_response.py b/src/cloudflare/types/zero_trust/identity_provider_list_response.py index fe476a77ad3..7fe980dcac8 100644 --- a/src/cloudflare/types/zero_trust/identity_provider_list_response.py +++ b/src/cloudflare/types/zero_trust/identity_provider_list_response.py @@ -1,166 +1,39 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Union, Optional -from typing_extensions import Literal +from .azure_ad import AzureAD from ..._models import BaseModel +from .scim_config import ScimConfig +from .generic_oauth_config import GenericOAuthConfig +from .identity_provider_type import IdentityProviderType __all__ = [ "IdentityProviderListResponse", - "AccessAzureAd", - "AccessAzureAdConfig", - "AccessAzureAdScimConfig", "AccessCentrify", "AccessCentrifyConfig", - "AccessCentrifyScimConfig", "AccessFacebook", - "AccessFacebookConfig", - "AccessFacebookScimConfig", "AccessGitHub", - "AccessGitHubConfig", - "AccessGitHubScimConfig", "AccessGoogle", "AccessGoogleConfig", - "AccessGoogleScimConfig", "AccessGoogleApps", "AccessGoogleAppsConfig", - "AccessGoogleAppsScimConfig", "AccessLinkedin", - "AccessLinkedinConfig", - "AccessLinkedinScimConfig", - "AccessOidc", - "AccessOidcConfig", - "AccessOidcScimConfig", + "AccessOIDC", + "AccessOIDCConfig", "AccessOkta", "AccessOktaConfig", - "AccessOktaScimConfig", "AccessOnelogin", "AccessOneloginConfig", - "AccessOneloginScimConfig", "AccessPingone", "AccessPingoneConfig", - "AccessPingoneScimConfig", - "AccessSaml", - "AccessSamlConfig", - "AccessSamlConfigHeaderAttribute", - "AccessSamlScimConfig", + "AccessSAML", + "AccessSAMLConfig", + "AccessSAMLConfigHeaderAttribute", "AccessYandex", - "AccessYandexConfig", - "AccessYandexScimConfig", ] -class AccessAzureAdConfig(BaseModel): - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - conditional_access_enabled: Optional[bool] = None - """Should Cloudflare try to load authentication contexts from your account""" - - directory_id: Optional[str] = None - """Your Azure directory uuid""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - prompt: Optional[Literal["login", "select_account", "none"]] = None - """Indicates the type of user interaction that is required. - - prompt=login forces the user to enter their credentials on that request, - negating single-sign on. prompt=none is the opposite. It ensures that the user - isn't presented with any interactive prompt. If the request can't be completed - silently by using single-sign on, the Microsoft identity platform returns an - interaction_required error. prompt=select_account interrupts single sign-on - providing account selection experience listing all the accounts either in - session or any remembered account or an option to choose to use a different - account altogether. - """ - - support_groups: Optional[bool] = None - """Should Cloudflare try to load groups from your account""" - - -class AccessAzureAdScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessAzureAd(BaseModel): - config: AccessAzureAdConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessAzureAdScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - class AccessCentrifyConfig(BaseModel): centrify_account: Optional[str] = None """Your centrify account url""" @@ -181,38 +54,6 @@ class AccessCentrifyConfig(BaseModel): """The claim name for email in the id_token response.""" -class AccessCentrifyScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessCentrify(BaseModel): config: AccessCentrifyConfig """The configuration parameters for the identity provider. @@ -224,22 +65,7 @@ class AccessCentrify(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -249,55 +75,15 @@ class AccessCentrify(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessCentrifyScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessFacebookConfig(BaseModel): - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - -class AccessFacebookScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessFacebook(BaseModel): - config: AccessFacebookConfig + config: GenericOAuthConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -307,22 +93,7 @@ class AccessFacebook(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -332,55 +103,15 @@ class AccessFacebook(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessFacebookScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessGitHubConfig(BaseModel): - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - -class AccessGitHubScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGitHub(BaseModel): - config: AccessGitHubConfig + config: GenericOAuthConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -390,22 +121,7 @@ class AccessGitHub(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -415,7 +131,7 @@ class AccessGitHub(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessGitHubScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -436,38 +152,6 @@ class AccessGoogleConfig(BaseModel): """The claim name for email in the id_token response.""" -class AccessGoogleScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGoogle(BaseModel): config: AccessGoogleConfig """The configuration parameters for the identity provider. @@ -479,22 +163,7 @@ class AccessGoogle(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -504,7 +173,7 @@ class AccessGoogle(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessGoogleScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -528,38 +197,6 @@ class AccessGoogleAppsConfig(BaseModel): """The claim name for email in the id_token response.""" -class AccessGoogleAppsScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGoogleApps(BaseModel): config: AccessGoogleAppsConfig """The configuration parameters for the identity provider. @@ -571,22 +208,7 @@ class AccessGoogleApps(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -596,55 +218,15 @@ class AccessGoogleApps(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessGoogleAppsScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessLinkedinConfig(BaseModel): - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - -class AccessLinkedinScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessLinkedin(BaseModel): - config: AccessLinkedinConfig + config: GenericOAuthConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -654,22 +236,7 @@ class AccessLinkedin(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -679,14 +246,14 @@ class AccessLinkedin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessLinkedinScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessOidcConfig(BaseModel): +class AccessOIDCConfig(BaseModel): auth_url: Optional[str] = None """The authorization_endpoint URL of your IdP""" @@ -712,40 +279,8 @@ class AccessOidcConfig(BaseModel): """The token_endpoint URL of your IdP""" -class AccessOidcScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessOidc(BaseModel): - config: AccessOidcConfig +class AccessOIDC(BaseModel): + config: AccessOIDCConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -755,22 +290,7 @@ class AccessOidc(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -780,7 +300,7 @@ class AccessOidc(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessOidcScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -807,38 +327,6 @@ class AccessOktaConfig(BaseModel): """Your okta account url""" -class AccessOktaScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessOkta(BaseModel): config: AccessOktaConfig """The configuration parameters for the identity provider. @@ -850,22 +338,7 @@ class AccessOkta(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -875,7 +348,7 @@ class AccessOkta(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessOktaScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -899,38 +372,6 @@ class AccessOneloginConfig(BaseModel): """Your OneLogin account url""" -class AccessOneloginScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessOnelogin(BaseModel): config: AccessOneloginConfig """The configuration parameters for the identity provider. @@ -942,22 +383,7 @@ class AccessOnelogin(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -967,7 +393,7 @@ class AccessOnelogin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessOneloginScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -991,38 +417,6 @@ class AccessPingoneConfig(BaseModel): """Your PingOne environment identifier""" -class AccessPingoneScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessPingone(BaseModel): config: AccessPingoneConfig """The configuration parameters for the identity provider. @@ -1034,22 +428,7 @@ class AccessPingone(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1059,14 +438,14 @@ class AccessPingone(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessPingoneScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessSamlConfigHeaderAttribute(BaseModel): +class AccessSAMLConfigHeaderAttribute(BaseModel): attribute_name: Optional[str] = None """attribute name from the IDP""" @@ -1074,7 +453,7 @@ class AccessSamlConfigHeaderAttribute(BaseModel): """header that will be added on the request to the origin""" -class AccessSamlConfig(BaseModel): +class AccessSAMLConfig(BaseModel): attributes: Optional[List[str]] = None """ A list of SAML attribute names that will be added to your signed JWT token and @@ -1084,7 +463,7 @@ class AccessSamlConfig(BaseModel): email_attribute_name: Optional[str] = None """The attribute name for email in the SAML response.""" - header_attributes: Optional[List[AccessSamlConfigHeaderAttribute]] = None + header_attributes: Optional[List[AccessSAMLConfigHeaderAttribute]] = None """ Add a list of attribute names that will be returned in the response header from the Access callback. @@ -1106,40 +485,8 @@ class AccessSamlConfig(BaseModel): """URL to send the SAML authentication requests to""" -class AccessSamlScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessSaml(BaseModel): - config: AccessSamlConfig +class AccessSAML(BaseModel): + config: AccessSAMLConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1149,22 +496,7 @@ class AccessSaml(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1174,55 +506,15 @@ class AccessSaml(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessSamlScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessYandexConfig(BaseModel): - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - -class AccessYandexScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessYandex(BaseModel): - config: AccessYandexConfig + config: GenericOAuthConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1232,22 +524,7 @@ class AccessYandex(BaseModel): name: str """The name of the identity provider, shown to users on the login page.""" - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] + type: IdentityProviderType """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1257,7 +534,7 @@ class AccessYandex(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[AccessYandexScimConfig] = None + scim_config: Optional[ScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -1265,17 +542,17 @@ class AccessYandex(BaseModel): IdentityProviderListResponse = Union[ - AccessAzureAd, + AzureAD, AccessCentrify, AccessFacebook, AccessGitHub, AccessGoogle, AccessGoogleApps, AccessLinkedin, - AccessOidc, + AccessOIDC, AccessOkta, AccessOnelogin, AccessPingone, - AccessSaml, + AccessSAML, AccessYandex, ] diff --git a/src/cloudflare/types/zero_trust/identity_provider_type.py b/src/cloudflare/types/zero_trust/identity_provider_type.py new file mode 100644 index 00000000000..8435e951d8d --- /dev/null +++ b/src/cloudflare/types/zero_trust/identity_provider_type.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["IdentityProviderType"] + +IdentityProviderType = Literal[ + "onetimepin", + "azureAD", + "saml", + "centrify", + "facebook", + "github", + "google-apps", + "google", + "linkedin", + "oidc", + "okta", + "onelogin", + "pingone", + "yandex", +] diff --git a/src/cloudflare/types/zero_trust/identity_provider_update_params.py b/src/cloudflare/types/zero_trust/identity_provider_update_params.py index 27b9ae810b7..9667f9f04ba 100644 --- a/src/cloudflare/types/zero_trust/identity_provider_update_params.py +++ b/src/cloudflare/types/zero_trust/identity_provider_update_params.py @@ -5,55 +5,41 @@ from typing import List, Union, Iterable from typing_extensions import Literal, Required, TypedDict +from .scim_config_param import ScimConfigParam +from .identity_provider_type import IdentityProviderType +from .generic_oauth_config_param import GenericOAuthConfigParam + __all__ = [ "IdentityProviderUpdateParams", - "AccessAzureAd", - "AccessAzureAdConfig", - "AccessAzureAdScimConfig", + "AzureAD", + "AzureADConfig", "AccessCentrify", "AccessCentrifyConfig", - "AccessCentrifyScimConfig", "AccessFacebook", - "AccessFacebookConfig", - "AccessFacebookScimConfig", "AccessGitHub", - "AccessGitHubConfig", - "AccessGitHubScimConfig", "AccessGoogle", "AccessGoogleConfig", - "AccessGoogleScimConfig", "AccessGoogleApps", "AccessGoogleAppsConfig", - "AccessGoogleAppsScimConfig", "AccessLinkedin", - "AccessLinkedinConfig", - "AccessLinkedinScimConfig", - "AccessOidc", - "AccessOidcConfig", - "AccessOidcScimConfig", + "AccessOIDC", + "AccessOIDCConfig", "AccessOkta", "AccessOktaConfig", - "AccessOktaScimConfig", "AccessOnelogin", "AccessOneloginConfig", - "AccessOneloginScimConfig", "AccessPingone", "AccessPingoneConfig", - "AccessPingoneScimConfig", - "AccessSaml", - "AccessSamlConfig", - "AccessSamlConfigHeaderAttribute", - "AccessSamlScimConfig", + "AccessSAML", + "AccessSAMLConfig", + "AccessSAMLConfigHeaderAttribute", "AccessYandex", - "AccessYandexConfig", - "AccessYandexScimConfig", "AccessOnetimepin", - "AccessOnetimepinScimConfig", ] -class AccessAzureAd(TypedDict, total=False): - config: Required[AccessAzureAdConfig] +class AzureAD(TypedDict, total=False): + config: Required[AzureADConfig] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -63,24 +49,7 @@ class AccessAzureAd(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -93,14 +62,14 @@ class AccessAzureAd(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessAzureAdScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessAzureAdConfig(TypedDict, total=False): +class AzureADConfig(TypedDict, total=False): claims: List[str] """Custom claims""" @@ -136,38 +105,6 @@ class AccessAzureAdConfig(TypedDict, total=False): """Should Cloudflare try to load groups from your account""" -class AccessAzureAdScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessCentrify(TypedDict, total=False): config: Required[AccessCentrifyConfig] """The configuration parameters for the identity provider. @@ -179,24 +116,7 @@ class AccessCentrify(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -209,7 +129,7 @@ class AccessCentrify(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessCentrifyScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -236,40 +156,8 @@ class AccessCentrifyConfig(TypedDict, total=False): """The claim name for email in the id_token response.""" -class AccessCentrifyScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessFacebook(TypedDict, total=False): - config: Required[AccessFacebookConfig] + config: Required[GenericOAuthConfigParam] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -279,24 +167,7 @@ class AccessFacebook(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -309,55 +180,15 @@ class AccessFacebook(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessFacebookScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessFacebookConfig(TypedDict, total=False): - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - -class AccessFacebookScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGitHub(TypedDict, total=False): - config: Required[AccessGitHubConfig] + config: Required[GenericOAuthConfigParam] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -367,24 +198,7 @@ class AccessGitHub(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -397,53 +211,13 @@ class AccessGitHub(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessGitHubScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessGitHubConfig(TypedDict, total=False): - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - -class AccessGitHubScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGoogle(TypedDict, total=False): config: Required[AccessGoogleConfig] """The configuration parameters for the identity provider. @@ -455,24 +229,7 @@ class AccessGoogle(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -485,7 +242,7 @@ class AccessGoogle(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessGoogleScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -506,38 +263,6 @@ class AccessGoogleConfig(TypedDict, total=False): """The claim name for email in the id_token response.""" -class AccessGoogleScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessGoogleApps(TypedDict, total=False): config: Required[AccessGoogleAppsConfig] """The configuration parameters for the identity provider. @@ -549,24 +274,7 @@ class AccessGoogleApps(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -579,7 +287,7 @@ class AccessGoogleApps(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessGoogleAppsScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -603,40 +311,8 @@ class AccessGoogleAppsConfig(TypedDict, total=False): """The claim name for email in the id_token response.""" -class AccessGoogleAppsScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessLinkedin(TypedDict, total=False): - config: Required[AccessLinkedinConfig] + config: Required[GenericOAuthConfigParam] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -646,24 +322,7 @@ class AccessLinkedin(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -676,55 +335,15 @@ class AccessLinkedin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessLinkedinScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessLinkedinConfig(TypedDict, total=False): - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - -class AccessLinkedinScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessOidc(TypedDict, total=False): - config: Required[AccessOidcConfig] +class AccessOIDC(TypedDict, total=False): + config: Required[AccessOIDCConfig] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -734,24 +353,7 @@ class AccessOidc(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -764,14 +366,14 @@ class AccessOidc(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessOidcScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessOidcConfig(TypedDict, total=False): +class AccessOIDCConfig(TypedDict, total=False): auth_url: str """The authorization_endpoint URL of your IdP""" @@ -797,38 +399,6 @@ class AccessOidcConfig(TypedDict, total=False): """The token_endpoint URL of your IdP""" -class AccessOidcScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessOkta(TypedDict, total=False): config: Required[AccessOktaConfig] """The configuration parameters for the identity provider. @@ -840,24 +410,7 @@ class AccessOkta(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -870,7 +423,7 @@ class AccessOkta(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessOktaScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -897,38 +450,6 @@ class AccessOktaConfig(TypedDict, total=False): """Your okta account url""" -class AccessOktaScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessOnelogin(TypedDict, total=False): config: Required[AccessOneloginConfig] """The configuration parameters for the identity provider. @@ -940,24 +461,7 @@ class AccessOnelogin(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -970,7 +474,7 @@ class AccessOnelogin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessOneloginScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -994,38 +498,6 @@ class AccessOneloginConfig(TypedDict, total=False): """Your OneLogin account url""" -class AccessOneloginScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessPingone(TypedDict, total=False): config: Required[AccessPingoneConfig] """The configuration parameters for the identity provider. @@ -1037,24 +509,7 @@ class AccessPingone(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1067,7 +522,7 @@ class AccessPingone(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessPingoneScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -1091,40 +546,8 @@ class AccessPingoneConfig(TypedDict, total=False): """Your PingOne environment identifier""" -class AccessPingoneScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessSaml(TypedDict, total=False): - config: Required[AccessSamlConfig] +class AccessSAML(TypedDict, total=False): + config: Required[AccessSAMLConfig] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1134,24 +557,7 @@ class AccessSaml(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1164,14 +570,14 @@ class AccessSaml(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessSamlScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessSamlConfigHeaderAttribute(TypedDict, total=False): +class AccessSAMLConfigHeaderAttribute(TypedDict, total=False): attribute_name: str """attribute name from the IDP""" @@ -1179,7 +585,7 @@ class AccessSamlConfigHeaderAttribute(TypedDict, total=False): """header that will be added on the request to the origin""" -class AccessSamlConfig(TypedDict, total=False): +class AccessSAMLConfig(TypedDict, total=False): attributes: List[str] """ A list of SAML attribute names that will be added to your signed JWT token and @@ -1189,7 +595,7 @@ class AccessSamlConfig(TypedDict, total=False): email_attribute_name: str """The attribute name for email in the SAML response.""" - header_attributes: Iterable[AccessSamlConfigHeaderAttribute] + header_attributes: Iterable[AccessSAMLConfigHeaderAttribute] """ Add a list of attribute names that will be returned in the response header from the Access callback. @@ -1211,40 +617,8 @@ class AccessSamlConfig(TypedDict, total=False): """URL to send the SAML authentication requests to""" -class AccessSamlScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessYandex(TypedDict, total=False): - config: Required[AccessYandexConfig] + config: Required[GenericOAuthConfigParam] """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1254,24 +628,7 @@ class AccessYandex(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1284,53 +641,13 @@ class AccessYandex(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessYandexScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessYandexConfig(TypedDict, total=False): - client_id: str - """Your OAuth Client ID""" - - client_secret: str - """Your OAuth Client Secret""" - - -class AccessYandexScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - class AccessOnetimepin(TypedDict, total=False): config: Required[object] """The configuration parameters for the identity provider. @@ -1342,24 +659,7 @@ class AccessOnetimepin(TypedDict, total=False): name: Required[str] """The name of the identity provider, shown to users on the login page.""" - type: Required[ - Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - ] + type: Required[IdentityProviderType] """The type of identity provider. To determine the value for a specific provider, refer to our @@ -1372,58 +672,26 @@ class AccessOnetimepin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: AccessOnetimepinScimConfig + scim_config: ScimConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class AccessOnetimepinScimConfig(TypedDict, total=False): - enabled: bool - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: bool - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: bool - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: str - """ - 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. - """ - - user_deprovision: bool - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - IdentityProviderUpdateParams = Union[ - AccessAzureAd, + AzureAD, AccessCentrify, AccessFacebook, AccessGitHub, AccessGoogle, AccessGoogleApps, AccessLinkedin, - AccessOidc, + AccessOIDC, AccessOkta, AccessOnelogin, AccessPingone, - AccessSaml, + AccessSAML, AccessYandex, AccessOnetimepin, ] diff --git a/src/cloudflare/types/zero_trust/ip_list_rule.py b/src/cloudflare/types/zero_trust/ip_list_rule.py new file mode 100644 index 00000000000..30388e43ef7 --- /dev/null +++ b/src/cloudflare/types/zero_trust/ip_list_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["IPListRule", "IPList"] + + +class IPList(BaseModel): + id: str + """The ID of a previously created IP list.""" + + +class IPListRule(BaseModel): + ip_list: IPList diff --git a/src/cloudflare/types/zero_trust/ip_list_rule_param.py b/src/cloudflare/types/zero_trust/ip_list_rule_param.py new file mode 100644 index 00000000000..af094a8b74f --- /dev/null +++ b/src/cloudflare/types/zero_trust/ip_list_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPListRuleParam", "IPList"] + + +class IPList(TypedDict, total=False): + id: Required[str] + """The ID of a previously created IP list.""" + + +class IPListRuleParam(TypedDict, total=False): + ip_list: Required[IPList] diff --git a/src/cloudflare/types/zero_trust/ip_rule.py b/src/cloudflare/types/zero_trust/ip_rule.py new file mode 100644 index 00000000000..503109876fe --- /dev/null +++ b/src/cloudflare/types/zero_trust/ip_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["IPRule", "IP"] + + +class IP(BaseModel): + ip: str + """An IPv4 or IPv6 CIDR block.""" + + +class IPRule(BaseModel): + ip: IP diff --git a/src/cloudflare/types/zero_trust/ip_rule_param.py b/src/cloudflare/types/zero_trust/ip_rule_param.py new file mode 100644 index 00000000000..57ad07219bb --- /dev/null +++ b/src/cloudflare/types/zero_trust/ip_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPRuleParam", "IP"] + + +class IP(TypedDict, total=False): + ip: Required[str] + """An IPv4 or IPv6 CIDR block.""" + + +class IPRuleParam(TypedDict, total=False): + ip: Required[IP] diff --git a/src/cloudflare/types/zero_trust/login_design.py b/src/cloudflare/types/zero_trust/login_design.py new file mode 100644 index 00000000000..51a09469848 --- /dev/null +++ b/src/cloudflare/types/zero_trust/login_design.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["LoginDesign"] + + +class LoginDesign(BaseModel): + background_color: Optional[str] = None + """The background color on your login page.""" + + footer_text: Optional[str] = None + """The text at the bottom of your login page.""" + + header_text: Optional[str] = None + """The text at the top of your login page.""" + + logo_path: Optional[str] = None + """The URL of the logo on your login page.""" + + text_color: Optional[str] = None + """The text color on your login page.""" diff --git a/src/cloudflare/types/zero_trust/login_design_param.py b/src/cloudflare/types/zero_trust/login_design_param.py new file mode 100644 index 00000000000..87a74d34723 --- /dev/null +++ b/src/cloudflare/types/zero_trust/login_design_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["LoginDesignParam"] + + +class LoginDesignParam(TypedDict, total=False): + background_color: str + """The background color on your login page.""" + + footer_text: str + """The text at the bottom of your login page.""" + + header_text: str + """The text at the top of your login page.""" + + logo_path: str + """The URL of the logo on your login page.""" + + text_color: str + """The text color on your login page.""" diff --git a/src/cloudflare/types/zero_trust/network_path.py b/src/cloudflare/types/zero_trust/network_path.py new file mode 100644 index 00000000000..7eb7ac7912c --- /dev/null +++ b/src/cloudflare/types/zero_trust/network_path.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["NetworkPath", "Slot", "Sampling"] + + +class Slot(BaseModel): + id: str + """API Resource UUID tag.""" + + client_to_app_rtt_ms: Optional[int] = FieldInfo(alias="clientToAppRttMs", default=None) + """Round trip time in ms of the client to app mile""" + + client_to_cf_egress_rtt_ms: Optional[int] = FieldInfo(alias="clientToCfEgressRttMs", default=None) + """Round trip time in ms of the client to Cloudflare egress mile""" + + client_to_cf_ingress_rtt_ms: Optional[int] = FieldInfo(alias="clientToCfIngressRttMs", default=None) + """Round trip time in ms of the client to Cloudflare ingress mile""" + + timestamp: str + + client_to_isp_rtt_ms: Optional[int] = FieldInfo(alias="clientToIspRttMs", default=None) + """Round trip time in ms of the client to ISP mile""" + + +class Sampling(BaseModel): + unit: Literal["hours"] + + value: int + + +class NetworkPath(BaseModel): + slots: List[Slot] + + sampling: Optional[Sampling] = None + """Specifies the sampling applied, if any, to the slots response. + + When sampled, results shown represent the first test run to the start of each + sampling interval. + """ diff --git a/src/cloudflare/types/zero_trust/network_path_response.py b/src/cloudflare/types/zero_trust/network_path_response.py new file mode 100644 index 00000000000..c0c4f672893 --- /dev/null +++ b/src/cloudflare/types/zero_trust/network_path_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .network_path import NetworkPath + +__all__ = ["NetworkPathResponse"] + + +class NetworkPathResponse(BaseModel): + id: str + """API Resource UUID tag.""" + + device_name: Optional[str] = FieldInfo(alias="deviceName", default=None) + + interval: Optional[str] = None + """The interval at which the Traceroute synthetic application test is set to run.""" + + kind: Optional[Literal["traceroute"]] = None + + name: Optional[str] = None + + network_path: Optional[NetworkPath] = FieldInfo(alias="networkPath", default=None) + + url: Optional[str] = None + """The host of the Traceroute synthetic application test""" diff --git a/src/cloudflare/types/zero_trust/networks/__init__.py b/src/cloudflare/types/zero_trust/networks/__init__.py index 09faf7e0596..36cce8dd60e 100644 --- a/src/cloudflare/types/zero_trust/networks/__init__.py +++ b/src/cloudflare/types/zero_trust/networks/__init__.py @@ -2,15 +2,17 @@ from __future__ import annotations -from .tunnel_route import TunnelRoute as TunnelRoute -from .tunnel_teamnet import TunnelTeamnet as TunnelTeamnet +from .route import Route as Route +from .teamnet import Teamnet as Teamnet +from .route_param import RouteParam as RouteParam +from .virtual_network import VirtualNetwork as VirtualNetwork from .route_edit_params import RouteEditParams as RouteEditParams from .route_list_params import RouteListParams as RouteListParams from .route_create_params import RouteCreateParams as RouteCreateParams -from .tunnel_virtual_network import TunnelVirtualNetwork as TunnelVirtualNetwork from .virtual_network_edit_params import VirtualNetworkEditParams as VirtualNetworkEditParams from .virtual_network_list_params import VirtualNetworkListParams as VirtualNetworkListParams from .virtual_network_create_params import VirtualNetworkCreateParams as VirtualNetworkCreateParams +from .virtual_network_delete_params import VirtualNetworkDeleteParams as VirtualNetworkDeleteParams from .virtual_network_edit_response import VirtualNetworkEditResponse as VirtualNetworkEditResponse from .virtual_network_create_response import VirtualNetworkCreateResponse as VirtualNetworkCreateResponse from .virtual_network_delete_response import VirtualNetworkDeleteResponse as VirtualNetworkDeleteResponse diff --git a/src/cloudflare/types/zero_trust/networks/route.py b/src/cloudflare/types/zero_trust/networks/route.py new file mode 100644 index 00000000000..bbfa9994665 --- /dev/null +++ b/src/cloudflare/types/zero_trust/networks/route.py @@ -0,0 +1,34 @@ +# 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__ = ["Route"] + + +class Route(BaseModel): + id: Optional[str] = None + """UUID of the route.""" + + comment: Optional[str] = None + """Optional remark describing the route.""" + + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + network: Optional[str] = None + """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" + + tunnel_id: Optional[str] = None + """UUID of the tunnel.""" + + virtual_network_id: Optional[str] = None + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/route_create_params.py b/src/cloudflare/types/zero_trust/networks/route_create_params.py index 007ff171323..1d2fe28479d 100644 --- a/src/cloudflare/types/zero_trust/networks/route_create_params.py +++ b/src/cloudflare/types/zero_trust/networks/route_create_params.py @@ -11,15 +11,11 @@ class RouteCreateParams(TypedDict, total=False): account_id: Required[str] """Cloudflare account ID""" - ip_network: Required[str] + network: Required[str] """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" comment: str """Optional remark describing the route.""" - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/route_edit_params.py b/src/cloudflare/types/zero_trust/networks/route_edit_params.py index 9bb5ad3ceb6..1640ce2c28b 100644 --- a/src/cloudflare/types/zero_trust/networks/route_edit_params.py +++ b/src/cloudflare/types/zero_trust/networks/route_edit_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict __all__ = ["RouteEditParams"] @@ -17,15 +17,5 @@ class RouteEditParams(TypedDict, total=False): network: str """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" - tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] - """The type of tunnel.""" - - tunnel_id: object - """UUID of the Cloudflare Tunnel serving the route.""" - - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/route_list_params.py b/src/cloudflare/types/zero_trust/networks/route_list_params.py index 379c44217c1..15a5e7bb478 100644 --- a/src/cloudflare/types/zero_trust/networks/route_list_params.py +++ b/src/cloudflare/types/zero_trust/networks/route_list_params.py @@ -2,7 +2,11 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo __all__ = ["RouteListParams"] @@ -14,22 +18,22 @@ class RouteListParams(TypedDict, total=False): comment: str """Optional remark describing the route.""" - existed_at: object + existed_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ - If provided, include only routes that were created (and not deleted) before this - time. + If provided, include only tunnels that were created (and not deleted) before + this time. """ - is_deleted: object + is_deleted: bool """If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. """ - network_subset: object + network_subset: str """If set, only list routes that are contained within this IP range.""" - network_superset: object + network_superset: str """If set, only list routes that contain this IP range.""" page: float @@ -38,15 +42,14 @@ class RouteListParams(TypedDict, total=False): per_page: float """Number of results to display.""" + route_id: str + """UUID of the route.""" + tun_types: str """The types of tunnels to filter separated by a comma.""" - tunnel_id: object - """UUID of the Cloudflare Tunnel serving the route.""" + tunnel_id: str + """UUID of the tunnel.""" - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/route_param.py b/src/cloudflare/types/zero_trust/networks/route_param.py new file mode 100644 index 00000000000..8fa3a2b483e --- /dev/null +++ b/src/cloudflare/types/zero_trust/networks/route_param.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 Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["RouteParam"] + + +class RouteParam(TypedDict, total=False): + comment: str + """Optional remark describing the route.""" + + created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Timestamp of when the resource was created.""" + + deleted_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + network: str + """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" + + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/routes/ip_get_params.py b/src/cloudflare/types/zero_trust/networks/routes/ip_get_params.py index 5d4f7f932a2..2e0092ae453 100644 --- a/src/cloudflare/types/zero_trust/networks/routes/ip_get_params.py +++ b/src/cloudflare/types/zero_trust/networks/routes/ip_get_params.py @@ -11,9 +11,5 @@ class IPGetParams(TypedDict, total=False): account_id: Required[str] """Cloudflare account ID""" - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/routes/network_create_params.py b/src/cloudflare/types/zero_trust/networks/routes/network_create_params.py index c2faad3a12c..5f145557ca0 100644 --- a/src/cloudflare/types/zero_trust/networks/routes/network_create_params.py +++ b/src/cloudflare/types/zero_trust/networks/routes/network_create_params.py @@ -14,9 +14,5 @@ class NetworkCreateParams(TypedDict, total=False): comment: str """Optional remark describing the route.""" - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/routes/network_delete_params.py b/src/cloudflare/types/zero_trust/networks/routes/network_delete_params.py index f82b29850f8..73d466c6529 100644 --- a/src/cloudflare/types/zero_trust/networks/routes/network_delete_params.py +++ b/src/cloudflare/types/zero_trust/networks/routes/network_delete_params.py @@ -13,3 +13,9 @@ class NetworkDeleteParams(TypedDict, total=False): tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] """The type of tunnel.""" + + tunnel_id: str + """UUID of the tunnel.""" + + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/teamnet.py b/src/cloudflare/types/zero_trust/networks/teamnet.py new file mode 100644 index 00000000000..768b4564a71 --- /dev/null +++ b/src/cloudflare/types/zero_trust/networks/teamnet.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Teamnet"] + + +class Teamnet(BaseModel): + id: Optional[str] = None + """UUID of the route.""" + + comment: Optional[str] = None + """Optional remark describing the route.""" + + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ + + network: Optional[str] = None + """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + tunnel_id: Optional[str] = None + """UUID of the tunnel.""" + + tunnel_name: Optional[str] = None + """A user-friendly name for a tunnel.""" + + virtual_network_id: Optional[str] = None + """UUID of the virtual network.""" + + virtual_network_name: Optional[str] = None + """A user-friendly name for the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/tunnel_route.py b/src/cloudflare/types/zero_trust/networks/tunnel_route.py deleted file mode 100644 index b1fa6674837..00000000000 --- a/src/cloudflare/types/zero_trust/networks/tunnel_route.py +++ /dev/null @@ -1,38 +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__ = ["TunnelRoute"] - - -class TunnelRoute(BaseModel): - id: Optional[str] = None - """UUID of the route.""" - - comment: Optional[str] = None - """Optional remark describing the route.""" - - created_at: Optional[object] = None - """Timestamp of when the route was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the route was deleted. - - If `null`, the route has not been deleted. - """ - - network: Optional[str] = None - """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" - - tunnel_id: Optional[object] = None - """UUID of the Cloudflare Tunnel serving the route.""" - - virtual_network_id: Optional[object] = None - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ diff --git a/src/cloudflare/types/zero_trust/networks/tunnel_teamnet.py b/src/cloudflare/types/zero_trust/networks/tunnel_teamnet.py deleted file mode 100644 index e43de119e23..00000000000 --- a/src/cloudflare/types/zero_trust/networks/tunnel_teamnet.py +++ /dev/null @@ -1,48 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["TunnelTeamnet"] - - -class TunnelTeamnet(BaseModel): - id: Optional[str] = None - """UUID of the route.""" - - comment: Optional[str] = None - """Optional remark describing the route.""" - - created_at: Optional[object] = None - """Timestamp of when the route was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the route was deleted. - - If `null`, the route has not been deleted. - """ - - network: Optional[str] = None - """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" - - tunnel_id: Optional[object] = None - """UUID of the Cloudflare Tunnel serving the route.""" - - tunnel_name: Optional[object] = None - """The user-friendly name of the Cloudflare Tunnel serving the route.""" - - virtual_network_id: Optional[object] = None - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ - - virtual_network_name: Optional[str] = None - """A user-friendly name for the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/tunnel_virtual_network.py b/src/cloudflare/types/zero_trust/networks/tunnel_virtual_network.py deleted file mode 100644 index fc464f5f05c..00000000000 --- a/src/cloudflare/types/zero_trust/networks/tunnel_virtual_network.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 ...._models import BaseModel - -__all__ = ["TunnelVirtualNetwork"] - - -class TunnelVirtualNetwork(BaseModel): - id: str - """UUID of the virtual network.""" - - comment: str - """Optional remark describing the virtual network.""" - - created_at: object - """Timestamp of when the virtual network was created.""" - - is_default_network: bool - """If `true`, this virtual network is the default for the account.""" - - name: str - """A user-friendly name for the virtual network.""" - - deleted_at: Optional[object] = None - """Timestamp of when the virtual network was deleted. - - If `null`, the virtual network has not been deleted. - """ diff --git a/src/cloudflare/types/zero_trust/networks/virtual_network.py b/src/cloudflare/types/zero_trust/networks/virtual_network.py new file mode 100644 index 00000000000..f6b70152188 --- /dev/null +++ b/src/cloudflare/types/zero_trust/networks/virtual_network.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["VirtualNetwork"] + + +class VirtualNetwork(BaseModel): + id: str + """UUID of the virtual network.""" + + comment: str + """Optional remark describing the virtual network.""" + + created_at: datetime + """Timestamp of when the resource was created.""" + + is_default_network: bool + """If `true`, this virtual network is the default for the account.""" + + name: str + """A user-friendly name for the virtual network.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ diff --git a/src/cloudflare/types/zero_trust/networks/virtual_network_delete_params.py b/src/cloudflare/types/zero_trust/networks/virtual_network_delete_params.py new file mode 100644 index 00000000000..6fe5cb76ca2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/networks/virtual_network_delete_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__ = ["VirtualNetworkDeleteParams"] + + +class VirtualNetworkDeleteParams(TypedDict, total=False): + account_id: Required[str] + """Cloudflare account ID""" + + body: Required[object] diff --git a/src/cloudflare/types/zero_trust/networks/virtual_network_list_params.py b/src/cloudflare/types/zero_trust/networks/virtual_network_list_params.py index 22ea35d39b9..3168639a9d1 100644 --- a/src/cloudflare/types/zero_trust/networks/virtual_network_list_params.py +++ b/src/cloudflare/types/zero_trust/networks/virtual_network_list_params.py @@ -11,14 +11,17 @@ class VirtualNetworkListParams(TypedDict, total=False): account_id: Required[str] """Cloudflare account ID""" - is_default: object + id: str + """UUID of the virtual network.""" + + is_default: bool """If `true`, only include the default virtual network. If `false`, exclude the default virtual network. If empty, all virtual networks will be included. """ - is_deleted: object + is_deleted: bool """If `true`, only include deleted virtual networks. If `false`, exclude deleted virtual networks. If empty, all virtual networks @@ -27,6 +30,3 @@ class VirtualNetworkListParams(TypedDict, total=False): name: str """A user-friendly name for the virtual network.""" - - vnet_name: str - """A user-friendly name for the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/okta_group_rule.py b/src/cloudflare/types/zero_trust/okta_group_rule.py new file mode 100644 index 00000000000..1c9e66889d1 --- /dev/null +++ b/src/cloudflare/types/zero_trust/okta_group_rule.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["OktaGroupRule", "Okta"] + + +class Okta(BaseModel): + connection_id: str + """The ID of your Okta identity provider.""" + + email: str + """The email of the Okta group.""" + + +class OktaGroupRule(BaseModel): + okta: Okta diff --git a/src/cloudflare/types/zero_trust/okta_group_rule_param.py b/src/cloudflare/types/zero_trust/okta_group_rule_param.py new file mode 100644 index 00000000000..34d48a81073 --- /dev/null +++ b/src/cloudflare/types/zero_trust/okta_group_rule_param.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__ = ["OktaGroupRuleParam", "Okta"] + + +class Okta(TypedDict, total=False): + connection_id: Required[str] + """The ID of your Okta identity provider.""" + + email: Required[str] + """The email of the Okta group.""" + + +class OktaGroupRuleParam(TypedDict, total=False): + okta: Required[Okta] diff --git a/src/cloudflare/types/zero_trust/organization.py b/src/cloudflare/types/zero_trust/organization.py new file mode 100644 index 00000000000..69d8412d852 --- /dev/null +++ b/src/cloudflare/types/zero_trust/organization.py @@ -0,0 +1,79 @@ +# 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 +from .login_design import LoginDesign + +__all__ = ["Organization", "CustomPages"] + + +class CustomPages(BaseModel): + forbidden: Optional[str] = None + """ + The uid of the custom page to use when a user is denied access after failing a + non-identity rule. + """ + + identity_denied: Optional[str] = None + """The uid of the custom page to use when a user is denied access.""" + + +class Organization(BaseModel): + allow_authenticate_via_warp: Optional[bool] = None + """ + When set to true, users can authenticate via WARP for any application in your + organization. Application settings will take precedence over this value. + """ + + auth_domain: Optional[str] = None + """The unique subdomain assigned to your Zero Trust organization.""" + + auto_redirect_to_identity: Optional[bool] = None + """ + When set to `true`, users skip the identity provider selection step during + login. + """ + + created_at: Optional[datetime] = None + + custom_pages: Optional[CustomPages] = None + + is_ui_read_only: Optional[bool] = None + """Lock all settings as Read-Only in the Dashboard, regardless of user permission. + + Updates may only be made via the API or Terraform for this account when enabled. + """ + + login_design: Optional[LoginDesign] = None + + name: Optional[str] = None + """The name of your Zero Trust organization.""" + + session_duration: Optional[str] = None + """The amount of time that tokens issued for applications will be valid. + + Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), + ms, s, m, h. + """ + + ui_read_only_toggle_reason: Optional[str] = None + """A description of the reason why the UI read only field is being toggled.""" + + updated_at: Optional[datetime] = None + + user_seat_expiration_inactive_time: Optional[str] = None + """The amount of time a user seat is inactive before it expires. + + When the user seat exceeds the set time of inactivity, the user is removed as an + active seat and no longer counts against your Teams seat count. Must be in the + format `300ms` or `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, + `s`, `m`, `h`. + """ + + warp_auth_session_duration: Optional[str] = None + """The amount of time that tokens issued for applications will be valid. + + Must be in the format `30m` or `2h45m`. Valid time units are: m, h. + """ diff --git a/src/cloudflare/types/zero_trust/organization_create_params.py b/src/cloudflare/types/zero_trust/organization_create_params.py index 8d9c829f764..35e0f167871 100644 --- a/src/cloudflare/types/zero_trust/organization_create_params.py +++ b/src/cloudflare/types/zero_trust/organization_create_params.py @@ -4,7 +4,9 @@ from typing_extensions import Required, TypedDict -__all__ = ["OrganizationCreateParams", "LoginDesign"] +from .login_design_param import LoginDesignParam + +__all__ = ["OrganizationCreateParams"] class OrganizationCreateParams(TypedDict, total=False): @@ -38,7 +40,7 @@ class OrganizationCreateParams(TypedDict, total=False): Updates may only be made via the API or Terraform for this account when enabled. """ - login_design: LoginDesign + login_design: LoginDesignParam session_duration: str """The amount of time that tokens issued for applications will be valid. @@ -64,20 +66,3 @@ class OrganizationCreateParams(TypedDict, total=False): Must be in the format `30m` or `2h45m`. Valid time units are: m, h. """ - - -class LoginDesign(TypedDict, total=False): - background_color: str - """The background color on your login page.""" - - footer_text: str - """The text at the bottom of your login page.""" - - header_text: str - """The text at the top of your login page.""" - - logo_path: str - """The URL of the logo on your login page.""" - - text_color: str - """The text color on your login page.""" diff --git a/src/cloudflare/types/zero_trust/organization_update_params.py b/src/cloudflare/types/zero_trust/organization_update_params.py index 2c722fadda1..c83c066fb26 100644 --- a/src/cloudflare/types/zero_trust/organization_update_params.py +++ b/src/cloudflare/types/zero_trust/organization_update_params.py @@ -4,7 +4,9 @@ from typing_extensions import TypedDict -__all__ = ["OrganizationUpdateParams", "CustomPages", "LoginDesign"] +from .login_design_param import LoginDesignParam + +__all__ = ["OrganizationUpdateParams", "CustomPages"] class OrganizationUpdateParams(TypedDict, total=False): @@ -37,7 +39,7 @@ class OrganizationUpdateParams(TypedDict, total=False): Updates may only be made via the API or Terraform for this account when enabled. """ - login_design: LoginDesign + login_design: LoginDesignParam name: str """The name of your Zero Trust organization.""" @@ -77,20 +79,3 @@ class CustomPages(TypedDict, total=False): identity_denied: str """The uid of the custom page to use when a user is denied access.""" - - -class LoginDesign(TypedDict, total=False): - background_color: str - """The background color on your login page.""" - - footer_text: str - """The text at the bottom of your login page.""" - - header_text: str - """The text at the top of your login page.""" - - logo_path: str - """The URL of the logo on your login page.""" - - text_color: str - """The text color on your login page.""" diff --git a/src/cloudflare/types/zero_trust/percentiles.py b/src/cloudflare/types/zero_trust/percentiles.py new file mode 100644 index 00000000000..fe27397ea19 --- /dev/null +++ b/src/cloudflare/types/zero_trust/percentiles.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Percentiles"] + + +class Percentiles(BaseModel): + p50: Optional[float] = None + """p50 observed in the time period""" + + p90: Optional[float] = None + """p90 observed in the time period""" + + p95: Optional[float] = None + """p95 observed in the time period""" + + p99: Optional[float] = None + """p99 observed in the time period""" diff --git a/src/cloudflare/types/zero_trust/risk_scoring/__init__.py b/src/cloudflare/types/zero_trust/risk_scoring/__init__.py new file mode 100644 index 00000000000..dce834add7c --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/__init__.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .summary_get_params import SummaryGetParams as SummaryGetParams +from .summary_get_response import SummaryGetResponse as SummaryGetResponse +from .behaviour_get_response import BehaviourGetResponse as BehaviourGetResponse +from .behaviour_update_params import BehaviourUpdateParams as BehaviourUpdateParams +from .behaviour_update_response import BehaviourUpdateResponse as BehaviourUpdateResponse diff --git a/src/cloudflare/types/zero_trust/risk_scoring/behaviour_get_response.py b/src/cloudflare/types/zero_trust/risk_scoring/behaviour_get_response.py new file mode 100644 index 00000000000..5233be19794 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/behaviour_get_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BehaviourGetResponse", "Behaviors"] + + +class Behaviors(BaseModel): + description: Optional[str] = None + + enabled: Optional[bool] = None + + name: Optional[str] = None + + risk_level: Optional[Literal["low", "medium", "high"]] = None + + +class BehaviourGetResponse(BaseModel): + behaviors: Optional[Dict[str, Behaviors]] = None diff --git a/src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_params.py b/src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_params.py new file mode 100644 index 00000000000..c0180b2da17 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BehaviourUpdateParams", "Behaviors"] + + +class BehaviourUpdateParams(TypedDict, total=False): + behaviors: Dict[str, Behaviors] + + +class Behaviors(TypedDict, total=False): + enabled: Required[bool] + + risk_level: Required[Optional[Literal["low", "medium", "high"]]] diff --git a/src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_response.py b/src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_response.py new file mode 100644 index 00000000000..ff2cb7b3fef --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BehaviourUpdateResponse", "Behaviors"] + + +class Behaviors(BaseModel): + description: Optional[str] = None + + enabled: Optional[bool] = None + + name: Optional[str] = None + + risk_level: Optional[Literal["low", "medium", "high"]] = None + + +class BehaviourUpdateResponse(BaseModel): + behaviors: Optional[Dict[str, Behaviors]] = None diff --git a/src/cloudflare/types/zero_trust/risk_scoring/summary_get_params.py b/src/cloudflare/types/zero_trust/risk_scoring/summary_get_params.py new file mode 100644 index 00000000000..591d0359289 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/summary_get_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 Literal, TypedDict + +__all__ = ["SummaryGetParams"] + + +class SummaryGetParams(TypedDict, total=False): + direction: Literal["desc", "asc"] + + order_by: Literal["timestamp", "event_count", "max_risk_level"] + + page: int + + per_page: int diff --git a/src/cloudflare/types/zero_trust/risk_scoring/summary_get_response.py b/src/cloudflare/types/zero_trust/risk_scoring/summary_get_response.py new file mode 100644 index 00000000000..c15eb288655 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/summary_get_response.py @@ -0,0 +1,28 @@ +# 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__ = ["SummaryGetResponse", "User"] + + +class User(BaseModel): + email: str + + event_count: int + + last_event: datetime + + max_risk_level: Optional[Literal["low", "medium", "high"]] = None + + name: str + + user_id: str + """The ID for a user""" + + +class SummaryGetResponse(BaseModel): + users: Optional[List[User]] = None diff --git a/src/cloudflare/types/zero_trust/risk_scoring_get_params.py b/src/cloudflare/types/zero_trust/risk_scoring_get_params.py new file mode 100644 index 00000000000..05adf69a3b3 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring_get_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 Literal, Required, TypedDict + +__all__ = ["RiskScoringGetParams"] + + +class RiskScoringGetParams(TypedDict, total=False): + account_identifier: Required[str] + """Identifier""" + + direction: Literal["desc", "asc"] + + order_by: Literal["timestamp", "risk_level"] + + page: int + + per_page: int diff --git a/src/cloudflare/types/zero_trust/risk_scoring_get_response.py b/src/cloudflare/types/zero_trust/risk_scoring_get_response.py new file mode 100644 index 00000000000..2b6ae19f438 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring_get_response.py @@ -0,0 +1,33 @@ +# 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__ = ["RiskScoringGetResponse", "Event"] + + +class Event(BaseModel): + id: str + + name: str + + risk_level: Optional[Literal["low", "medium", "high"]] = None + + timestamp: datetime + + event_details: Optional[object] = None + + +class RiskScoringGetResponse(BaseModel): + email: Optional[str] = None + + events: Optional[List[Event]] = None + + last_reset_time: Optional[datetime] = None + + name: Optional[str] = None + + risk_level: Optional[Literal["low", "medium", "high"]] = None diff --git a/src/cloudflare/types/zero_trust/risk_scoring_reset_response.py b/src/cloudflare/types/zero_trust/risk_scoring_reset_response.py new file mode 100644 index 00000000000..ffc6a070c07 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring_reset_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +__all__ = ["RiskScoringResetResponse"] + +RiskScoringResetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/zero_trust/saml_group_rule.py b/src/cloudflare/types/zero_trust/saml_group_rule.py new file mode 100644 index 00000000000..7a311bb901c --- /dev/null +++ b/src/cloudflare/types/zero_trust/saml_group_rule.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["SAMLGroupRule", "SAML"] + + +class SAML(BaseModel): + attribute_name: str + """The name of the SAML attribute.""" + + attribute_value: str + """The SAML attribute value to look for.""" + + +class SAMLGroupRule(BaseModel): + saml: SAML diff --git a/src/cloudflare/types/zero_trust/saml_group_rule_param.py b/src/cloudflare/types/zero_trust/saml_group_rule_param.py new file mode 100644 index 00000000000..78aa37ef3a7 --- /dev/null +++ b/src/cloudflare/types/zero_trust/saml_group_rule_param.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__ = ["SAMLGroupRuleParam", "SAML"] + + +class SAML(TypedDict, total=False): + attribute_name: Required[str] + """The name of the SAML attribute.""" + + attribute_value: Required[str] + """The SAML attribute value to look for.""" + + +class SAMLGroupRuleParam(TypedDict, total=False): + saml: Required[SAML] diff --git a/src/cloudflare/types/zero_trust/scim_config.py b/src/cloudflare/types/zero_trust/scim_config.py new file mode 100644 index 00000000000..f7f9f993662 --- /dev/null +++ b/src/cloudflare/types/zero_trust/scim_config.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ScimConfig"] + + +class ScimConfig(BaseModel): + enabled: Optional[bool] = None + """A flag to enable or disable SCIM for the identity provider.""" + + group_member_deprovision: Optional[bool] = None + """ + A flag to revoke a user's session in Access and force a reauthentication on the + user's Gateway session when they have been added or removed from a group in the + Identity Provider. + """ + + seat_deprovision: Optional[bool] = None + """ + A flag to remove a user's seat in Zero Trust when they have been deprovisioned + in the Identity Provider. This cannot be enabled unless user_deprovision is also + enabled. + """ + + secret: Optional[str] = None + """ + 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. + """ + + user_deprovision: Optional[bool] = None + """ + A flag to enable revoking a user's session in Access and Gateway when they have + been deprovisioned in the Identity Provider. + """ diff --git a/src/cloudflare/types/zero_trust/scim_config_param.py b/src/cloudflare/types/zero_trust/scim_config_param.py new file mode 100644 index 00000000000..2ae697d9a43 --- /dev/null +++ b/src/cloudflare/types/zero_trust/scim_config_param.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ScimConfigParam"] + + +class ScimConfigParam(TypedDict, total=False): + enabled: bool + """A flag to enable or disable SCIM for the identity provider.""" + + group_member_deprovision: bool + """ + A flag to revoke a user's session in Access and force a reauthentication on the + user's Gateway session when they have been added or removed from a group in the + Identity Provider. + """ + + seat_deprovision: bool + """ + A flag to remove a user's seat in Zero Trust when they have been deprovisioned + in the Identity Provider. This cannot be enabled unless user_deprovision is also + enabled. + """ + + secret: str + """ + 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. + """ + + user_deprovision: bool + """ + A flag to enable revoking a user's session in Access and Gateway when they have + been deprovisioned in the Identity Provider. + """ diff --git a/src/cloudflare/types/zero_trust/seat.py b/src/cloudflare/types/zero_trust/seat.py new file mode 100644 index 00000000000..bf56403a543 --- /dev/null +++ b/src/cloudflare/types/zero_trust/seat.py @@ -0,0 +1,23 @@ +# 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__ = ["Seat"] + + +class Seat(BaseModel): + access_seat: Optional[bool] = None + """True if the seat is part of Access.""" + + created_at: Optional[datetime] = None + + gateway_seat: Optional[bool] = None + """True if the seat is part of Gateway.""" + + seat_uid: Optional[str] = None + """Identifier""" + + updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/seat_edit_response.py b/src/cloudflare/types/zero_trust/seat_edit_response.py index 17305d6920b..a29d3feb33b 100644 --- a/src/cloudflare/types/zero_trust/seat_edit_response.py +++ b/src/cloudflare/types/zero_trust/seat_edit_response.py @@ -2,8 +2,8 @@ from typing import List -from .zero_trust_seats import ZeroTrustSeats +from .seat import Seat __all__ = ["SeatEditResponse"] -SeatEditResponse = List[ZeroTrustSeats] +SeatEditResponse = List[Seat] diff --git a/src/cloudflare/types/zero_trust/service_token_rule.py b/src/cloudflare/types/zero_trust/service_token_rule.py new file mode 100644 index 00000000000..b8c4353ec77 --- /dev/null +++ b/src/cloudflare/types/zero_trust/service_token_rule.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ServiceTokenRule", "ServiceToken"] + + +class ServiceToken(BaseModel): + token_id: str + """The ID of a Service Token.""" + + +class ServiceTokenRule(BaseModel): + service_token: ServiceToken diff --git a/src/cloudflare/types/zero_trust/service_token_rule_param.py b/src/cloudflare/types/zero_trust/service_token_rule_param.py new file mode 100644 index 00000000000..1c51cea4168 --- /dev/null +++ b/src/cloudflare/types/zero_trust/service_token_rule_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ServiceTokenRuleParam", "ServiceToken"] + + +class ServiceToken(TypedDict, total=False): + token_id: Required[str] + """The ID of a Service Token.""" + + +class ServiceTokenRuleParam(TypedDict, total=False): + service_token: Required[ServiceToken] diff --git a/src/cloudflare/types/zero_trust/tunnel_argo_tunnel.py b/src/cloudflare/types/zero_trust/tunnel_argo_tunnel.py deleted file mode 100644 index 30d85bd4589..00000000000 --- a/src/cloudflare/types/zero_trust/tunnel_argo_tunnel.py +++ /dev/null @@ -1,44 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["TunnelArgoTunnel", "Connection"] - - -class Connection(BaseModel): - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelArgoTunnel(BaseModel): - id: str - """UUID of the tunnel.""" - - connections: List[Connection] - """The tunnel connections between your origin and Cloudflare's edge.""" - - created_at: datetime - """Timestamp of when the tunnel was created.""" - - name: str - """A user-friendly name for the tunnel.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ diff --git a/src/cloudflare/types/zero_trust/tunnel_create_params.py b/src/cloudflare/types/zero_trust/tunnel_create_params.py index 892756ccac4..dfc1ee811cc 100644 --- a/src/cloudflare/types/zero_trust/tunnel_create_params.py +++ b/src/cloudflare/types/zero_trust/tunnel_create_params.py @@ -12,10 +12,10 @@ class TunnelCreateParams(TypedDict, total=False): """Cloudflare account ID""" name: Required[str] - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" - tunnel_secret: Required[object] - """Sets the password required to run the tunnel. + tunnel_secret: Required[str] + """Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. """ diff --git a/src/cloudflare/types/zero_trust/tunnel_create_response.py b/src/cloudflare/types/zero_trust/tunnel_create_response.py new file mode 100644 index 00000000000..b39079e78e2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_create_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel +from .connection import Connection + +__all__ = ["TunnelCreateResponse"] + + +class TunnelCreateResponse(BaseModel): + id: str + """UUID of the tunnel.""" + + connections: List[Connection] + """The tunnel connections between your origin and Cloudflare's edge.""" + + created_at: datetime + """Timestamp of when the resource was created.""" + + name: str + """A user-friendly name for a tunnel.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ diff --git a/src/cloudflare/types/zero_trust/tunnel_delete_response.py b/src/cloudflare/types/zero_trust/tunnel_delete_response.py new file mode 100644 index 00000000000..b26adb49ef0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_delete_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel +from .connection import Connection + +__all__ = ["TunnelDeleteResponse"] + + +class TunnelDeleteResponse(BaseModel): + id: str + """UUID of the tunnel.""" + + connections: List[Connection] + """The tunnel connections between your origin and Cloudflare's edge.""" + + created_at: datetime + """Timestamp of when the resource was created.""" + + name: str + """A user-friendly name for a tunnel.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ diff --git a/src/cloudflare/types/zero_trust/tunnel_edit_params.py b/src/cloudflare/types/zero_trust/tunnel_edit_params.py index 20fb9f8da8e..b8174879460 100644 --- a/src/cloudflare/types/zero_trust/tunnel_edit_params.py +++ b/src/cloudflare/types/zero_trust/tunnel_edit_params.py @@ -12,7 +12,7 @@ class TunnelEditParams(TypedDict, total=False): """Cloudflare account ID""" name: str - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" tunnel_secret: str """Sets the password required to run a locally-managed tunnel. diff --git a/src/cloudflare/types/zero_trust/tunnel_edit_response.py b/src/cloudflare/types/zero_trust/tunnel_edit_response.py index 2089655cc5e..b1871e21042 100644 --- a/src/cloudflare/types/zero_trust/tunnel_edit_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_edit_response.py @@ -5,109 +5,17 @@ from typing_extensions import Literal from ..._models import BaseModel +from ..shared.cloudflare_tunnel import CloudflareTunnel -__all__ = [ - "TunnelEditResponse", - "TunnelCfdTunnel", - "TunnelCfdTunnelConnection", - "TunnelWARPConnectorTunnel", - "TunnelWARPConnectorTunnelConnection", -] - - -class TunnelCfdTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelCfdTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["TunnelEditResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"] class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -156,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. @@ -183,4 +91,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -TunnelEditResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +TunnelEditResponse = Union[CloudflareTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/zero_trust/tunnel_get_response.py b/src/cloudflare/types/zero_trust/tunnel_get_response.py new file mode 100644 index 00000000000..58be38689ff --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_get_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel +from .connection import Connection + +__all__ = ["TunnelGetResponse"] + + +class TunnelGetResponse(BaseModel): + id: str + """UUID of the tunnel.""" + + connections: List[Connection] + """The tunnel connections between your origin and Cloudflare's edge.""" + + created_at: datetime + """Timestamp of when the resource was created.""" + + name: str + """A user-friendly name for a tunnel.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. + + If `null`, the resource has not been deleted. + """ diff --git a/src/cloudflare/types/zero_trust/tunnel_list_params.py b/src/cloudflare/types/zero_trust/tunnel_list_params.py index 8b2139d800b..e5f6d43dd32 100644 --- a/src/cloudflare/types/zero_trust/tunnel_list_params.py +++ b/src/cloudflare/types/zero_trust/tunnel_list_params.py @@ -43,6 +43,9 @@ class TunnelListParams(TypedDict, total=False): tun_types: str """The types of tunnels to filter separated by a comma.""" + uuid: str + """UUID of the tunnel.""" + was_active_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] was_inactive_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] diff --git a/src/cloudflare/types/zero_trust/tunnel_list_response.py b/src/cloudflare/types/zero_trust/tunnel_list_response.py index cd8241050c5..ab94c69f9b7 100644 --- a/src/cloudflare/types/zero_trust/tunnel_list_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_list_response.py @@ -5,109 +5,17 @@ from typing_extensions import Literal from ..._models import BaseModel +from ..shared.cloudflare_tunnel import CloudflareTunnel -__all__ = [ - "TunnelListResponse", - "TunnelCfdTunnel", - "TunnelCfdTunnelConnection", - "TunnelWARPConnectorTunnel", - "TunnelWARPConnectorTunnelConnection", -] - - -class TunnelCfdTunnelConnection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[List[TunnelCfdTunnelConnection]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["TunnelListResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"] class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -156,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. @@ -183,4 +91,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -TunnelListResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +TunnelListResponse = Union[CloudflareTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/zero_trust/tunnels/__init__.py b/src/cloudflare/types/zero_trust/tunnels/__init__.py index b0c08785096..cdfdf2d324e 100644 --- a/src/cloudflare/types/zero_trust/tunnels/__init__.py +++ b/src/cloudflare/types/zero_trust/tunnels/__init__.py @@ -2,8 +2,8 @@ from __future__ import annotations +from .client import Client as Client from .token_get_response import TokenGetResponse as TokenGetResponse -from .tunnel_tunnel_client import TunnelTunnelClient as TunnelTunnelClient from .connection_get_response import ConnectionGetResponse as ConnectionGetResponse from .connection_delete_params import ConnectionDeleteParams as ConnectionDeleteParams from .management_create_params import ManagementCreateParams as ManagementCreateParams diff --git a/src/cloudflare/types/zero_trust/tunnels/client.py b/src/cloudflare/types/zero_trust/tunnels/client.py new file mode 100644 index 00000000000..2e8e5b973fc --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnels/client.py @@ -0,0 +1,65 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["Client", "Conn"] + + +class Conn(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class Client(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + arch: Optional[str] = None + """The cloudflared OS architecture used to establish this connection.""" + + config_version: Optional[int] = None + """The version of the remote tunnel configuration. + + Used internally to sync cloudflared with the Zero Trust dashboard. + """ + + conns: Optional[List[Conn]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + features: Optional[List[str]] = None + """Features enabled for the Cloudflare Tunnel.""" + + run_at: Optional[datetime] = None + """Timestamp of when the tunnel connection was started.""" + + version: Optional[str] = None + """The cloudflared version used to establish this connection.""" diff --git a/src/cloudflare/types/zero_trust/tunnels/configuration_update_params.py b/src/cloudflare/types/zero_trust/tunnels/configuration_update_params.py index f2e306a4899..d01c0015e5c 100644 --- a/src/cloudflare/types/zero_trust/tunnels/configuration_update_params.py +++ b/src/cloudflare/types/zero_trust/tunnels/configuration_update_params.py @@ -21,7 +21,7 @@ class ConfigurationUpdateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Cloudflare account ID""" config: Config """The tunnel configuration and ingress rules.""" @@ -128,7 +128,10 @@ class ConfigIngress(TypedDict, total=False): """ origin_request: Annotated[ConfigIngressOriginRequest, PropertyInfo(alias="originRequest")] - """Configuration parameters of connection between cloudflared and origin server.""" + """ + Configuration parameters for the public hostname specific connection settings + between cloudflared and origin server. + """ path: str """Requests with this path route to this public hostname.""" @@ -231,7 +234,10 @@ class Config(TypedDict, total=False): """List of public hostname definitions""" origin_request: Annotated[ConfigOriginRequest, PropertyInfo(alias="originRequest")] - """Configuration parameters of connection between cloudflared and origin server.""" + """ + Configuration parameters for the public hostname specific connection settings + between cloudflared and origin server. + """ warp_routing: Annotated[ConfigWARPRouting, PropertyInfo(alias="warp-routing")] """Enable private network access from WARP users to private network routes""" diff --git a/src/cloudflare/types/zero_trust/tunnels/connection_get_response.py b/src/cloudflare/types/zero_trust/tunnels/connection_get_response.py index 6bc0f6e39c0..d219ccbb0be 100644 --- a/src/cloudflare/types/zero_trust/tunnels/connection_get_response.py +++ b/src/cloudflare/types/zero_trust/tunnels/connection_get_response.py @@ -2,8 +2,8 @@ from typing import List -from .tunnel_tunnel_client import TunnelTunnelClient +from .client import Client __all__ = ["ConnectionGetResponse"] -ConnectionGetResponse = List[TunnelTunnelClient] +ConnectionGetResponse = List[Client] diff --git a/src/cloudflare/types/zero_trust/tunnels/tunnel_tunnel_client.py b/src/cloudflare/types/zero_trust/tunnels/tunnel_tunnel_client.py deleted file mode 100644 index 5720c182f20..00000000000 --- a/src/cloudflare/types/zero_trust/tunnels/tunnel_tunnel_client.py +++ /dev/null @@ -1,65 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["TunnelTunnelClient", "Conn"] - - -class Conn(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class TunnelTunnelClient(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - arch: Optional[str] = None - """The cloudflared OS architecture used to establish this connection.""" - - config_version: Optional[int] = None - """The version of the remote tunnel configuration. - - Used internally to sync cloudflared with the Zero Trust dashboard. - """ - - conns: Optional[List[Conn]] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - features: Optional[List[str]] = None - """Features enabled for the Cloudflare Tunnel.""" - - run_at: Optional[datetime] = None - """Timestamp of when the tunnel connection was started.""" - - version: Optional[str] = None - """The cloudflared version used to establish this connection.""" diff --git a/src/cloudflare/types/zero_trust/zero_trust_devices.py b/src/cloudflare/types/zero_trust/zero_trust_devices.py deleted file mode 100644 index 1be55deab17..00000000000 --- a/src/cloudflare/types/zero_trust/zero_trust_devices.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ZeroTrustDevices", "User"] - - -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 ZeroTrustDevices(BaseModel): - id: Optional[str] = None - """Device ID.""" - - created: Optional[datetime] = None - """When the device was created.""" - - deleted: Optional[bool] = None - """True if the device was deleted.""" - - device_type: Optional[Literal["windows", "mac", "linux", "android", "ios"]] = None - - ip: Optional[str] = None - """IPv4 or IPv6 address.""" - - key: Optional[str] = None - """The device's public key.""" - - last_seen: Optional[datetime] = None - """When the device last connected to Cloudflare services.""" - - mac_address: Optional[str] = None - """The device mac address.""" - - manufacturer: Optional[str] = None - """The device manufacturer name.""" - - model: Optional[str] = None - """The device model name.""" - - name: Optional[str] = None - """The device name.""" - - os_distro_name: Optional[str] = None - """The Linux distro name.""" - - os_distro_revision: Optional[str] = None - """The Linux distro revision.""" - - os_version: Optional[str] = None - """The operating system version.""" - - os_version_extra: Optional[str] = None - """The operating system version extra parameter.""" - - revoked_at: Optional[datetime] = None - """When the device was revoked.""" - - serial_number: Optional[str] = None - """The device serial number.""" - - 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/zero_trust_identity_providers.py b/src/cloudflare/types/zero_trust/zero_trust_identity_providers.py deleted file mode 100644 index d4d22daa810..00000000000 --- a/src/cloudflare/types/zero_trust/zero_trust_identity_providers.py +++ /dev/null @@ -1,1359 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = [ - "ZeroTrustIdentityProviders", - "AccessAzureAd", - "AccessAzureAdConfig", - "AccessAzureAdScimConfig", - "AccessCentrify", - "AccessCentrifyConfig", - "AccessCentrifyScimConfig", - "AccessFacebook", - "AccessFacebookConfig", - "AccessFacebookScimConfig", - "AccessGitHub", - "AccessGitHubConfig", - "AccessGitHubScimConfig", - "AccessGoogle", - "AccessGoogleConfig", - "AccessGoogleScimConfig", - "AccessGoogleApps", - "AccessGoogleAppsConfig", - "AccessGoogleAppsScimConfig", - "AccessLinkedin", - "AccessLinkedinConfig", - "AccessLinkedinScimConfig", - "AccessOidc", - "AccessOidcConfig", - "AccessOidcScimConfig", - "AccessOkta", - "AccessOktaConfig", - "AccessOktaScimConfig", - "AccessOnelogin", - "AccessOneloginConfig", - "AccessOneloginScimConfig", - "AccessPingone", - "AccessPingoneConfig", - "AccessPingoneScimConfig", - "AccessSaml", - "AccessSamlConfig", - "AccessSamlConfigHeaderAttribute", - "AccessSamlScimConfig", - "AccessYandex", - "AccessYandexConfig", - "AccessYandexScimConfig", - "AccessOnetimepin", - "AccessOnetimepinScimConfig", -] - - -class AccessAzureAdConfig(BaseModel): - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - conditional_access_enabled: Optional[bool] = None - """Should Cloudflare try to load authentication contexts from your account""" - - directory_id: Optional[str] = None - """Your Azure directory uuid""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - prompt: Optional[Literal["login", "select_account", "none"]] = None - """Indicates the type of user interaction that is required. - - prompt=login forces the user to enter their credentials on that request, - negating single-sign on. prompt=none is the opposite. It ensures that the user - isn't presented with any interactive prompt. If the request can't be completed - silently by using single-sign on, the Microsoft identity platform returns an - interaction_required error. prompt=select_account interrupts single sign-on - providing account selection experience listing all the accounts either in - session or any remembered account or an option to choose to use a different - account altogether. - """ - - support_groups: Optional[bool] = None - """Should Cloudflare try to load groups from your account""" - - -class AccessAzureAdScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessAzureAd(BaseModel): - config: AccessAzureAdConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessAzureAdScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessCentrifyConfig(BaseModel): - centrify_account: Optional[str] = None - """Your centrify account url""" - - centrify_app_id: Optional[str] = None - """Your centrify app id""" - - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - -class AccessCentrifyScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessCentrify(BaseModel): - config: AccessCentrifyConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessCentrifyScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessFacebookConfig(BaseModel): - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - -class AccessFacebookScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessFacebook(BaseModel): - config: AccessFacebookConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessFacebookScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessGitHubConfig(BaseModel): - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - -class AccessGitHubScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessGitHub(BaseModel): - config: AccessGitHubConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessGitHubScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessGoogleConfig(BaseModel): - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - -class AccessGoogleScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessGoogle(BaseModel): - config: AccessGoogleConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessGoogleScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessGoogleAppsConfig(BaseModel): - apps_domain: Optional[str] = None - """Your companies TLD""" - - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - -class AccessGoogleAppsScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessGoogleApps(BaseModel): - config: AccessGoogleAppsConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessGoogleAppsScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessLinkedinConfig(BaseModel): - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - -class AccessLinkedinScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessLinkedin(BaseModel): - config: AccessLinkedinConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessLinkedinScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOidcConfig(BaseModel): - auth_url: Optional[str] = None - """The authorization_endpoint URL of your IdP""" - - certs_url: Optional[str] = None - """The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens""" - - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - scopes: Optional[List[str]] = None - """OAuth scopes""" - - token_url: Optional[str] = None - """The token_endpoint URL of your IdP""" - - -class AccessOidcScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessOidc(BaseModel): - config: AccessOidcConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessOidcScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOktaConfig(BaseModel): - authorization_server_id: Optional[str] = None - """Your okta authorization server id""" - - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - okta_account: Optional[str] = None - """Your okta account url""" - - -class AccessOktaScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessOkta(BaseModel): - config: AccessOktaConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessOktaScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOneloginConfig(BaseModel): - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - onelogin_account: Optional[str] = None - """Your OneLogin account url""" - - -class AccessOneloginScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessOnelogin(BaseModel): - config: AccessOneloginConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessOneloginScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessPingoneConfig(BaseModel): - claims: Optional[List[str]] = None - """Custom claims""" - - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - email_claim_name: Optional[str] = None - """The claim name for email in the id_token response.""" - - ping_env_id: Optional[str] = None - """Your PingOne environment identifier""" - - -class AccessPingoneScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessPingone(BaseModel): - config: AccessPingoneConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessPingoneScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessSamlConfigHeaderAttribute(BaseModel): - attribute_name: Optional[str] = None - """attribute name from the IDP""" - - header_name: Optional[str] = None - """header that will be added on the request to the origin""" - - -class AccessSamlConfig(BaseModel): - attributes: Optional[List[str]] = None - """ - A list of SAML attribute names that will be added to your signed JWT token and - can be used in SAML policy rules. - """ - - email_attribute_name: Optional[str] = None - """The attribute name for email in the SAML response.""" - - header_attributes: Optional[List[AccessSamlConfigHeaderAttribute]] = None - """ - Add a list of attribute names that will be returned in the response header from - the Access callback. - """ - - idp_public_certs: Optional[List[str]] = None - """X509 certificate to verify the signature in the SAML authentication response""" - - issuer_url: Optional[str] = None - """IdP Entity ID or Issuer URL""" - - sign_request: Optional[bool] = None - """Sign the SAML authentication request with Access credentials. - - To verify the signature, use the public key from the Access certs endpoints. - """ - - sso_target_url: Optional[str] = None - """URL to send the SAML authentication requests to""" - - -class AccessSamlScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessSaml(BaseModel): - config: AccessSamlConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessSamlScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessYandexConfig(BaseModel): - client_id: Optional[str] = None - """Your OAuth Client ID""" - - client_secret: Optional[str] = None - """Your OAuth Client Secret""" - - -class AccessYandexScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessYandex(BaseModel): - config: AccessYandexConfig - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessYandexScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -class AccessOnetimepinScimConfig(BaseModel): - enabled: Optional[bool] = None - """A flag to enable or disable SCIM for the identity provider.""" - - group_member_deprovision: Optional[bool] = None - """ - A flag to revoke a user's session in Access and force a reauthentication on the - user's Gateway session when they have been added or removed from a group in the - Identity Provider. - """ - - seat_deprovision: Optional[bool] = None - """ - A flag to remove a user's seat in Zero Trust when they have been deprovisioned - in the Identity Provider. This cannot be enabled unless user_deprovision is also - enabled. - """ - - secret: Optional[str] = None - """ - 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. - """ - - user_deprovision: Optional[bool] = None - """ - A flag to enable revoking a user's session in Access and Gateway when they have - been deprovisioned in the Identity Provider. - """ - - -class AccessOnetimepin(BaseModel): - config: object - """The configuration parameters for the identity provider. - - To view the required parameters for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - name: str - """The name of the identity provider, shown to users on the login page.""" - - type: Literal[ - "onetimepin", - "azureAD", - "saml", - "centrify", - "facebook", - "github", - "google-apps", - "google", - "linkedin", - "oidc", - "okta", - "onelogin", - "pingone", - "yandex", - ] - """The type of identity provider. - - To determine the value for a specific provider, refer to our - [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - """ - - id: Optional[str] = None - """UUID""" - - scim_config: Optional[AccessOnetimepinScimConfig] = None - """ - The configuration settings for enabling a System for Cross-Domain Identity - Management (SCIM) with the identity provider. - """ - - -ZeroTrustIdentityProviders = Union[ - AccessAzureAd, - AccessCentrify, - AccessFacebook, - AccessGitHub, - AccessGoogle, - AccessGoogleApps, - AccessLinkedin, - AccessOidc, - AccessOkta, - AccessOnelogin, - AccessPingone, - AccessSaml, - AccessYandex, - AccessOnetimepin, -] diff --git a/src/cloudflare/types/zero_trust/zero_trust_organizations.py b/src/cloudflare/types/zero_trust/zero_trust_organizations.py deleted file mode 100644 index b0bb2210663..00000000000 --- a/src/cloudflare/types/zero_trust/zero_trust_organizations.py +++ /dev/null @@ -1,95 +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__ = ["ZeroTrustOrganizations", "CustomPages", "LoginDesign"] - - -class CustomPages(BaseModel): - forbidden: Optional[str] = None - """ - The uid of the custom page to use when a user is denied access after failing a - non-identity rule. - """ - - identity_denied: Optional[str] = None - """The uid of the custom page to use when a user is denied access.""" - - -class LoginDesign(BaseModel): - background_color: Optional[str] = None - """The background color on your login page.""" - - footer_text: Optional[str] = None - """The text at the bottom of your login page.""" - - header_text: Optional[str] = None - """The text at the top of your login page.""" - - logo_path: Optional[str] = None - """The URL of the logo on your login page.""" - - text_color: Optional[str] = None - """The text color on your login page.""" - - -class ZeroTrustOrganizations(BaseModel): - allow_authenticate_via_warp: Optional[bool] = None - """ - When set to true, users can authenticate via WARP for any application in your - organization. Application settings will take precedence over this value. - """ - - auth_domain: Optional[str] = None - """The unique subdomain assigned to your Zero Trust organization.""" - - auto_redirect_to_identity: Optional[bool] = None - """ - When set to `true`, users skip the identity provider selection step during - login. - """ - - created_at: Optional[datetime] = None - - custom_pages: Optional[CustomPages] = None - - is_ui_read_only: Optional[bool] = None - """Lock all settings as Read-Only in the Dashboard, regardless of user permission. - - Updates may only be made via the API or Terraform for this account when enabled. - """ - - login_design: Optional[LoginDesign] = None - - name: Optional[str] = None - """The name of your Zero Trust organization.""" - - session_duration: Optional[str] = None - """The amount of time that tokens issued for applications will be valid. - - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. - """ - - ui_read_only_toggle_reason: Optional[str] = None - """A description of the reason why the UI read only field is being toggled.""" - - updated_at: Optional[datetime] = None - - user_seat_expiration_inactive_time: Optional[str] = None - """The amount of time a user seat is inactive before it expires. - - When the user seat exceeds the set time of inactivity, the user is removed as an - active seat and no longer counts against your Teams seat count. Must be in the - format `300ms` or `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, - `s`, `m`, `h`. - """ - - warp_auth_session_duration: Optional[str] = None - """The amount of time that tokens issued for applications will be valid. - - Must be in the format `30m` or `2h45m`. Valid time units are: m, h. - """ diff --git a/src/cloudflare/types/zero_trust/zero_trust_seats.py b/src/cloudflare/types/zero_trust/zero_trust_seats.py deleted file mode 100644 index 0800a49be50..00000000000 --- a/src/cloudflare/types/zero_trust/zero_trust_seats.py +++ /dev/null @@ -1,23 +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__ = ["ZeroTrustSeats"] - - -class ZeroTrustSeats(BaseModel): - access_seat: Optional[bool] = None - """True if the seat is part of Access.""" - - created_at: Optional[datetime] = None - - gateway_seat: Optional[bool] = None - """True if the seat is part of Gateway.""" - - seat_uid: Optional[str] = None - """Identifier""" - - updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zones/__init__.py b/src/cloudflare/types/zones/__init__.py index 3fb58b135a5..1f0b10e4ded 100644 --- a/src/cloudflare/types/zones/__init__.py +++ b/src/cloudflare/types/zones/__init__.py @@ -2,20 +2,20 @@ from __future__ import annotations -from .hold_get_response import HoldGetResponse as HoldGetResponse +from .zone import Zone as Zone +from .zone_hold import ZoneHold as ZoneHold +from .nameserver import Nameserver as Nameserver +from .dns_setting import DNSSetting as DNSSetting +from .nameserver_param import NameserverParam as NameserverParam +from .zone_edit_params import ZoneEditParams as ZoneEditParams +from .zone_list_params import ZoneListParams as ZoneListParams from .hold_create_params import HoldCreateParams as HoldCreateParams from .hold_delete_params import HoldDeleteParams as HoldDeleteParams -from .setting_edit_params import SettingEditParams as SettingEditParams -from .hold_create_response import HoldCreateResponse as HoldCreateResponse -from .hold_delete_response import HoldDeleteResponse as HoldDeleteResponse -from .setting_get_response import SettingGetResponse as SettingGetResponse -from .setting_edit_response import SettingEditResponse as SettingEditResponse +from .zone_create_params import ZoneCreateParams as ZoneCreateParams +from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse from .dns_setting_edit_params import DNSSettingEditParams as DNSSettingEditParams -from .dns_setting_get_response import DNSSettingGetResponse as DNSSettingGetResponse -from .dns_setting_edit_response import DNSSettingEditResponse as DNSSettingEditResponse from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams -from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse from .custom_nameserver_update_params import CustomNameserverUpdateParams as CustomNameserverUpdateParams diff --git a/src/cloudflare/types/zones/dns_setting.py b/src/cloudflare/types/zones/dns_setting.py new file mode 100644 index 00000000000..ea337af7a25 --- /dev/null +++ b/src/cloudflare/types/zones/dns_setting.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .nameserver import Nameserver + +__all__ = ["DNSSetting"] + + +class DNSSetting(BaseModel): + foundation_dns: Optional[bool] = None + """Whether to enable Foundation DNS Advanced Nameservers on the zone.""" + + multi_provider: Optional[bool] = None + """ + Whether to enable multi-provider DNS, which causes Cloudflare to activate the + zone even when non-Cloudflare NS records exist, and to respect NS records at the + zone apex during outbound zone transfers. + """ + + nameservers: Optional[Nameserver] = None + """ + Settings determining the nameservers through which the zone should be available. + """ + + secondary_overrides: Optional[bool] = None + """ + Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + """ diff --git a/src/cloudflare/types/zones/dns_setting_edit_params.py b/src/cloudflare/types/zones/dns_setting_edit_params.py index 63d0e28208c..fa2cdb1dca2 100644 --- a/src/cloudflare/types/zones/dns_setting_edit_params.py +++ b/src/cloudflare/types/zones/dns_setting_edit_params.py @@ -2,21 +2,34 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["DNSSettingEditParams", "Nameservers"] +from .nameserver_param import NameserverParam + +__all__ = ["DNSSettingEditParams"] class DNSSettingEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - nameservers: Nameservers + foundation_dns: bool + """Whether to enable Foundation DNS Advanced Nameservers on the zone.""" + + multi_provider: bool """ - Settings determining the nameservers through which the zone should be available. + Whether to enable multi-provider DNS, which causes Cloudflare to activate the + zone even when non-Cloudflare NS records exist, and to respect NS records at the + zone apex during outbound zone transfers. """ + nameservers: NameserverParam + """ + Settings determining the nameservers through which the zone should be available. + """ -class Nameservers(TypedDict, total=False): - type: Required[Literal["cloudflare.standard", "cloudflare.foundation_dns"]] - """Nameserver type""" + secondary_overrides: bool + """ + Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + """ diff --git a/src/cloudflare/types/zones/dns_setting_edit_response.py b/src/cloudflare/types/zones/dns_setting_edit_response.py deleted file mode 100644 index e1a4b6d6c17..00000000000 --- a/src/cloudflare/types/zones/dns_setting_edit_response.py +++ /dev/null @@ -1,20 +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__ = ["DNSSettingEditResponse", "Nameservers"] - - -class Nameservers(BaseModel): - type: Literal["cloudflare.standard", "cloudflare.foundation_dns"] - """Nameserver type""" - - -class DNSSettingEditResponse(BaseModel): - nameservers: Optional[Nameservers] = None - """ - Settings determining the nameservers through which the zone should be available. - """ diff --git a/src/cloudflare/types/zones/dns_setting_get_response.py b/src/cloudflare/types/zones/dns_setting_get_response.py deleted file mode 100644 index 784da31db6e..00000000000 --- a/src/cloudflare/types/zones/dns_setting_get_response.py +++ /dev/null @@ -1,20 +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__ = ["DNSSettingGetResponse", "Nameservers"] - - -class Nameservers(BaseModel): - type: Literal["cloudflare.standard", "cloudflare.foundation_dns"] - """Nameserver type""" - - -class DNSSettingGetResponse(BaseModel): - nameservers: Optional[Nameservers] = None - """ - Settings determining the nameservers through which the zone should be available. - """ diff --git a/src/cloudflare/types/zones/hold_create_response.py b/src/cloudflare/types/zones/hold_create_response.py deleted file mode 100644 index c2080e94756..00000000000 --- a/src/cloudflare/types/zones/hold_create_response.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__ = ["HoldCreateResponse"] - - -class HoldCreateResponse(BaseModel): - hold: Optional[bool] = None - - hold_after: Optional[str] = None - - include_subdomains: Optional[str] = None diff --git a/src/cloudflare/types/zones/hold_delete_response.py b/src/cloudflare/types/zones/hold_delete_response.py deleted file mode 100644 index 7050fac8a9e..00000000000 --- a/src/cloudflare/types/zones/hold_delete_response.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__ = ["HoldDeleteResponse"] - - -class HoldDeleteResponse(BaseModel): - hold: Optional[bool] = None - - hold_after: Optional[str] = None - - include_subdomains: Optional[str] = None diff --git a/src/cloudflare/types/zones/hold_get_response.py b/src/cloudflare/types/zones/hold_get_response.py deleted file mode 100644 index 33c1edfe722..00000000000 --- a/src/cloudflare/types/zones/hold_get_response.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__ = ["HoldGetResponse"] - - -class HoldGetResponse(BaseModel): - hold: Optional[bool] = None - - hold_after: Optional[str] = None - - include_subdomains: Optional[str] = None diff --git a/src/cloudflare/types/zones/nameserver.py b/src/cloudflare/types/zones/nameserver.py new file mode 100644 index 00000000000..3076da16fbd --- /dev/null +++ b/src/cloudflare/types/zones/nameserver.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Nameserver"] + + +class Nameserver(BaseModel): + type: Literal["cloudflare.standard"] + """Nameserver type""" diff --git a/src/cloudflare/types/zones/nameserver_param.py b/src/cloudflare/types/zones/nameserver_param.py new file mode 100644 index 00000000000..6d73075a2ae --- /dev/null +++ b/src/cloudflare/types/zones/nameserver_param.py @@ -0,0 +1,12 @@ +# 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__ = ["NameserverParam"] + + +class NameserverParam(TypedDict, total=False): + type: Required[Literal["cloudflare.standard"]] + """Nameserver type""" diff --git a/src/cloudflare/types/zones/setting_edit_params.py b/src/cloudflare/types/zones/setting_edit_params.py deleted file mode 100644 index cf0c7c0befe..00000000000 --- a/src/cloudflare/types/zones/setting_edit_params.py +++ /dev/null @@ -1,207 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable -from typing_extensions import Literal, Required, TypedDict - -from .settings import ( - ZoneSettingNELParam, - ZoneSettingSSLParam, - ZoneSettingWAFParam, - ZoneSetting0rttParam, - ZoneSettingIPV6Param, - ZoneSettingWebPParam, - ZoneSettingHTTP2Param, - ZoneSettingHTTP3Param, - ZoneSettingBrotliParam, - ZoneSettingMinifyParam, - ZoneSettingMirageParam, - ZoneSettingPolishParam, - ZoneSettingTLS1_3Param, - ZoneSettingCiphersParam, - ZoneSettingBufferingParam, - ZoneSettingCacheLevelParam, - ZoneSettingEarlyHintsParam, - ZoneSettingPseudoIPV4Param, - ZoneSettingWebsocketsParam, - ZoneSettingAdvancedDDoSParam, - ZoneSettingAlwaysOnlineParam, - ZoneSettingBrowserCheckParam, - ZoneSettingChallengeTTLParam, - ZoneSettingRocketLoaderParam, - ZoneSettingImageResizingParam, - ZoneSettingIPGeolocationParam, - ZoneSettingMinTLSVersionParam, - ZoneSettingSecurityLevelParam, - ZoneSettingTLSClientAuthParam, - ZoneSettingAlwaysUseHTTPSParam, - ZoneSettingMobileRedirectParam, - ZoneSettingOrangeToOrangeParam, - ZoneSettingSecurityHeaderParam, - ZoneSettingSSLRecommenderParam, - ZoneSettingBrowserCacheTTLParam, - ZoneSettingDevelopmentModeParam, - ZoneSettingPrefetchPreloadParam, - ZoneSettingEmailObfuscationParam, - ZoneSettingH2PrioritizationParam, - ZoneSettingProxyReadTimeoutParam, - ZoneSettingHotlinkProtectionParam, - ZoneSettingServerSideExcludeParam, - ZoneSettingOpportunisticOnionParam, - ZoneSettingTrueClientIPHeaderParam, - ZoneSettingAutomaticHTTPSRewritesParam, - ZoneSettingOpportunisticEncryptionParam, - ZoneSettingOriginErrorPagePassThruParam, - ZoneSettingSortQueryStringForCacheParam, - ZoneSettingAutomaticPlatformOptimizationParam, -) - -__all__ = [ - "SettingEditParams", - "Item", - "ItemZonesCNAMEFlattening", - "ItemZonesEdgeCacheTTL", - "ItemZonesMaxUpload", - "ItemZonesSchemasAutomaticPlatformOptimization", - "ItemZonesSha1Support", - "ItemZonesTLS1_2Only", -] - - -class SettingEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - items: Required[Iterable[Item]] - """One or more zone setting objects. Must contain an ID and a value.""" - - -class ItemZonesCNAMEFlattening(TypedDict, total=False): - id: Required[Literal["cname_flattening"]] - """How to flatten the cname destination.""" - - value: Required[Literal["flatten_at_root", "flatten_all"]] - """Current value of the zone setting.""" - - -class ItemZonesEdgeCacheTTL(TypedDict, total=False): - id: Required[Literal["edge_cache_ttl"]] - """ID of the zone setting.""" - - value: Required[ - Literal[ - 30, - 60, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 518400, - 604800, - ] - ] - """Current value of the zone setting.""" - - -class ItemZonesMaxUpload(TypedDict, total=False): - id: Required[Literal["max_upload"]] - """identifier of the zone setting.""" - - value: Required[Literal[100, 200, 500]] - """Current value of the zone setting.""" - - -class ItemZonesSchemasAutomaticPlatformOptimization(TypedDict, total=False): - id: Required[Literal["automatic_platform_optimization"]] - """ID of the zone setting.""" - - value: Required[ZoneSettingAutomaticPlatformOptimizationParam] - """Current value of the zone setting.""" - - -class ItemZonesSha1Support(TypedDict, total=False): - id: Required[Literal["sha1_support"]] - """Zone setting identifier.""" - - value: Required[Literal["off", "on"]] - """Current value of the zone setting.""" - - -class ItemZonesTLS1_2Only(TypedDict, total=False): - id: Required[Literal["tls_1_2_only"]] - """Zone setting identifier.""" - - value: Required[Literal["off", "on"]] - """Current value of the zone setting.""" - - -Item = Union[ - ZoneSetting0rttParam, - ZoneSettingAdvancedDDoSParam, - ZoneSettingAlwaysOnlineParam, - ZoneSettingAlwaysUseHTTPSParam, - ZoneSettingAutomaticHTTPSRewritesParam, - ZoneSettingBrotliParam, - ZoneSettingBrowserCacheTTLParam, - ZoneSettingBrowserCheckParam, - ZoneSettingCacheLevelParam, - ZoneSettingChallengeTTLParam, - ZoneSettingCiphersParam, - ItemZonesCNAMEFlattening, - ZoneSettingDevelopmentModeParam, - ZoneSettingEarlyHintsParam, - ItemZonesEdgeCacheTTL, - ZoneSettingEmailObfuscationParam, - ZoneSettingH2PrioritizationParam, - ZoneSettingHotlinkProtectionParam, - ZoneSettingHTTP2Param, - ZoneSettingHTTP3Param, - ZoneSettingImageResizingParam, - ZoneSettingIPGeolocationParam, - ZoneSettingIPV6Param, - ItemZonesMaxUpload, - ZoneSettingMinTLSVersionParam, - ZoneSettingMinifyParam, - ZoneSettingMirageParam, - ZoneSettingMobileRedirectParam, - ZoneSettingNELParam, - ZoneSettingOpportunisticEncryptionParam, - ZoneSettingOpportunisticOnionParam, - ZoneSettingOrangeToOrangeParam, - ZoneSettingOriginErrorPagePassThruParam, - ZoneSettingPolishParam, - ZoneSettingPrefetchPreloadParam, - ZoneSettingProxyReadTimeoutParam, - ZoneSettingPseudoIPV4Param, - ZoneSettingBufferingParam, - ZoneSettingRocketLoaderParam, - ItemZonesSchemasAutomaticPlatformOptimization, - ZoneSettingSecurityHeaderParam, - ZoneSettingSecurityLevelParam, - ZoneSettingServerSideExcludeParam, - ItemZonesSha1Support, - ZoneSettingSortQueryStringForCacheParam, - ZoneSettingSSLParam, - ZoneSettingSSLRecommenderParam, - ItemZonesTLS1_2Only, - ZoneSettingTLS1_3Param, - ZoneSettingTLSClientAuthParam, - ZoneSettingTrueClientIPHeaderParam, - ZoneSettingWAFParam, - ZoneSettingWebPParam, - ZoneSettingWebsocketsParam, -] diff --git a/src/cloudflare/types/zones/setting_edit_response.py b/src/cloudflare/types/zones/setting_edit_response.py deleted file mode 100644 index 28cc6aa5e87..00000000000 --- a/src/cloudflare/types/zones/setting_edit_response.py +++ /dev/null @@ -1,253 +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 - -from .settings import ( - ZoneSettingNEL, - ZoneSettingSSL, - ZoneSettingWAF, - ZoneSetting0rtt, - ZoneSettingIPV6, - ZoneSettingWebP, - ZoneSettingHTTP2, - ZoneSettingHTTP3, - ZoneSettingBrotli, - ZoneSettingMinify, - ZoneSettingMirage, - ZoneSettingPolish, - ZoneSettingTLS1_3, - ZoneSettingCiphers, - ZoneSettingBuffering, - ZoneSettingCacheLevel, - ZoneSettingEarlyHints, - ZoneSettingPseudoIPV4, - ZoneSettingWebsockets, - ZoneSettingAdvancedDDoS, - ZoneSettingAlwaysOnline, - ZoneSettingBrowserCheck, - ZoneSettingChallengeTTL, - ZoneSettingRocketLoader, - ZoneSettingImageResizing, - ZoneSettingIPGeolocation, - ZoneSettingMinTLSVersion, - ZoneSettingSecurityLevel, - ZoneSettingTLSClientAuth, - ZoneSettingAlwaysUseHTTPS, - ZoneSettingMobileRedirect, - ZoneSettingOrangeToOrange, - ZoneSettingSecurityHeader, - ZoneSettingSSLRecommender, - ZoneSettingBrowserCacheTTL, - ZoneSettingDevelopmentMode, - ZoneSettingPrefetchPreload, - ZoneSettingEmailObfuscation, - ZoneSettingH2Prioritization, - ZoneSettingProxyReadTimeout, - ZoneSettingHotlinkProtection, - ZoneSettingServerSideExclude, - ZoneSettingOpportunisticOnion, - ZoneSettingTrueClientIPHeader, - ZoneSettingAutomaticHTTPSRewrites, - ZoneSettingOpportunisticEncryption, - ZoneSettingOriginErrorPagePassThru, - ZoneSettingSortQueryStringForCache, - ZoneSettingAutomaticPlatformOptimization, -) -from ..._models import BaseModel - -__all__ = [ - "SettingEditResponse", - "SettingEditResponseItem", - "SettingEditResponseItemZonesCNAMEFlattening", - "SettingEditResponseItemZonesEdgeCacheTTL", - "SettingEditResponseItemZonesMaxUpload", - "SettingEditResponseItemZonesSchemasAutomaticPlatformOptimization", - "SettingEditResponseItemZonesSha1Support", - "SettingEditResponseItemZonesTLS1_2Only", -] - - -class SettingEditResponseItemZonesCNAMEFlattening(BaseModel): - id: Literal["cname_flattening"] - """How to flatten the cname destination.""" - - value: Literal["flatten_at_root", "flatten_all"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingEditResponseItemZonesEdgeCacheTTL(BaseModel): - id: Literal["edge_cache_ttl"] - """ID of the zone setting.""" - - value: Literal[ - 30, - 60, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 518400, - 604800, - ] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingEditResponseItemZonesMaxUpload(BaseModel): - id: Literal["max_upload"] - """identifier of the zone setting.""" - - value: Literal[100, 200, 500] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingEditResponseItemZonesSchemasAutomaticPlatformOptimization(BaseModel): - id: Literal["automatic_platform_optimization"] - """ID of the zone setting.""" - - value: ZoneSettingAutomaticPlatformOptimization - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingEditResponseItemZonesSha1Support(BaseModel): - id: Literal["sha1_support"] - """Zone setting identifier.""" - - value: Literal["off", "on"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingEditResponseItemZonesTLS1_2Only(BaseModel): - id: Literal["tls_1_2_only"] - """Zone setting identifier.""" - - value: Literal["off", "on"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -SettingEditResponseItem = Union[ - ZoneSetting0rtt, - ZoneSettingAdvancedDDoS, - ZoneSettingAlwaysOnline, - ZoneSettingAlwaysUseHTTPS, - ZoneSettingAutomaticHTTPSRewrites, - ZoneSettingBrotli, - ZoneSettingBrowserCacheTTL, - ZoneSettingBrowserCheck, - ZoneSettingCacheLevel, - ZoneSettingChallengeTTL, - ZoneSettingCiphers, - SettingEditResponseItemZonesCNAMEFlattening, - ZoneSettingDevelopmentMode, - ZoneSettingEarlyHints, - SettingEditResponseItemZonesEdgeCacheTTL, - ZoneSettingEmailObfuscation, - ZoneSettingH2Prioritization, - ZoneSettingHotlinkProtection, - ZoneSettingHTTP2, - ZoneSettingHTTP3, - ZoneSettingImageResizing, - ZoneSettingIPGeolocation, - ZoneSettingIPV6, - SettingEditResponseItemZonesMaxUpload, - ZoneSettingMinTLSVersion, - ZoneSettingMinify, - ZoneSettingMirage, - ZoneSettingMobileRedirect, - ZoneSettingNEL, - ZoneSettingOpportunisticEncryption, - ZoneSettingOpportunisticOnion, - ZoneSettingOrangeToOrange, - ZoneSettingOriginErrorPagePassThru, - ZoneSettingPolish, - ZoneSettingPrefetchPreload, - ZoneSettingProxyReadTimeout, - ZoneSettingPseudoIPV4, - ZoneSettingBuffering, - ZoneSettingRocketLoader, - SettingEditResponseItemZonesSchemasAutomaticPlatformOptimization, - ZoneSettingSecurityHeader, - ZoneSettingSecurityLevel, - ZoneSettingServerSideExclude, - SettingEditResponseItemZonesSha1Support, - ZoneSettingSortQueryStringForCache, - ZoneSettingSSL, - ZoneSettingSSLRecommender, - SettingEditResponseItemZonesTLS1_2Only, - ZoneSettingTLS1_3, - ZoneSettingTLSClientAuth, - ZoneSettingTrueClientIPHeader, - ZoneSettingWAF, - ZoneSettingWebP, - ZoneSettingWebsockets, -] - -SettingEditResponse = List[SettingEditResponseItem] diff --git a/src/cloudflare/types/zones/setting_get_response.py b/src/cloudflare/types/zones/setting_get_response.py deleted file mode 100644 index f4d66ec4769..00000000000 --- a/src/cloudflare/types/zones/setting_get_response.py +++ /dev/null @@ -1,253 +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 - -from .settings import ( - ZoneSettingNEL, - ZoneSettingSSL, - ZoneSettingWAF, - ZoneSetting0rtt, - ZoneSettingIPV6, - ZoneSettingWebP, - ZoneSettingHTTP2, - ZoneSettingHTTP3, - ZoneSettingBrotli, - ZoneSettingMinify, - ZoneSettingMirage, - ZoneSettingPolish, - ZoneSettingTLS1_3, - ZoneSettingCiphers, - ZoneSettingBuffering, - ZoneSettingCacheLevel, - ZoneSettingEarlyHints, - ZoneSettingPseudoIPV4, - ZoneSettingWebsockets, - ZoneSettingAdvancedDDoS, - ZoneSettingAlwaysOnline, - ZoneSettingBrowserCheck, - ZoneSettingChallengeTTL, - ZoneSettingRocketLoader, - ZoneSettingImageResizing, - ZoneSettingIPGeolocation, - ZoneSettingMinTLSVersion, - ZoneSettingSecurityLevel, - ZoneSettingTLSClientAuth, - ZoneSettingAlwaysUseHTTPS, - ZoneSettingMobileRedirect, - ZoneSettingOrangeToOrange, - ZoneSettingSecurityHeader, - ZoneSettingSSLRecommender, - ZoneSettingBrowserCacheTTL, - ZoneSettingDevelopmentMode, - ZoneSettingPrefetchPreload, - ZoneSettingEmailObfuscation, - ZoneSettingH2Prioritization, - ZoneSettingProxyReadTimeout, - ZoneSettingHotlinkProtection, - ZoneSettingServerSideExclude, - ZoneSettingOpportunisticOnion, - ZoneSettingTrueClientIPHeader, - ZoneSettingAutomaticHTTPSRewrites, - ZoneSettingOpportunisticEncryption, - ZoneSettingOriginErrorPagePassThru, - ZoneSettingSortQueryStringForCache, - ZoneSettingAutomaticPlatformOptimization, -) -from ..._models import BaseModel - -__all__ = [ - "SettingGetResponse", - "SettingGetResponseItem", - "SettingGetResponseItemZonesCNAMEFlattening", - "SettingGetResponseItemZonesEdgeCacheTTL", - "SettingGetResponseItemZonesMaxUpload", - "SettingGetResponseItemZonesSchemasAutomaticPlatformOptimization", - "SettingGetResponseItemZonesSha1Support", - "SettingGetResponseItemZonesTLS1_2Only", -] - - -class SettingGetResponseItemZonesCNAMEFlattening(BaseModel): - id: Literal["cname_flattening"] - """How to flatten the cname destination.""" - - value: Literal["flatten_at_root", "flatten_all"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingGetResponseItemZonesEdgeCacheTTL(BaseModel): - id: Literal["edge_cache_ttl"] - """ID of the zone setting.""" - - value: Literal[ - 30, - 60, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 518400, - 604800, - ] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingGetResponseItemZonesMaxUpload(BaseModel): - id: Literal["max_upload"] - """identifier of the zone setting.""" - - value: Literal[100, 200, 500] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingGetResponseItemZonesSchemasAutomaticPlatformOptimization(BaseModel): - id: Literal["automatic_platform_optimization"] - """ID of the zone setting.""" - - value: ZoneSettingAutomaticPlatformOptimization - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingGetResponseItemZonesSha1Support(BaseModel): - id: Literal["sha1_support"] - """Zone setting identifier.""" - - value: Literal["off", "on"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class SettingGetResponseItemZonesTLS1_2Only(BaseModel): - id: Literal["tls_1_2_only"] - """Zone setting identifier.""" - - value: Literal["off", "on"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -SettingGetResponseItem = Union[ - ZoneSetting0rtt, - ZoneSettingAdvancedDDoS, - ZoneSettingAlwaysOnline, - ZoneSettingAlwaysUseHTTPS, - ZoneSettingAutomaticHTTPSRewrites, - ZoneSettingBrotli, - ZoneSettingBrowserCacheTTL, - ZoneSettingBrowserCheck, - ZoneSettingCacheLevel, - ZoneSettingChallengeTTL, - ZoneSettingCiphers, - SettingGetResponseItemZonesCNAMEFlattening, - ZoneSettingDevelopmentMode, - ZoneSettingEarlyHints, - SettingGetResponseItemZonesEdgeCacheTTL, - ZoneSettingEmailObfuscation, - ZoneSettingH2Prioritization, - ZoneSettingHotlinkProtection, - ZoneSettingHTTP2, - ZoneSettingHTTP3, - ZoneSettingImageResizing, - ZoneSettingIPGeolocation, - ZoneSettingIPV6, - SettingGetResponseItemZonesMaxUpload, - ZoneSettingMinTLSVersion, - ZoneSettingMinify, - ZoneSettingMirage, - ZoneSettingMobileRedirect, - ZoneSettingNEL, - ZoneSettingOpportunisticEncryption, - ZoneSettingOpportunisticOnion, - ZoneSettingOrangeToOrange, - ZoneSettingOriginErrorPagePassThru, - ZoneSettingPolish, - ZoneSettingPrefetchPreload, - ZoneSettingProxyReadTimeout, - ZoneSettingPseudoIPV4, - ZoneSettingBuffering, - ZoneSettingRocketLoader, - SettingGetResponseItemZonesSchemasAutomaticPlatformOptimization, - ZoneSettingSecurityHeader, - ZoneSettingSecurityLevel, - ZoneSettingServerSideExclude, - SettingGetResponseItemZonesSha1Support, - ZoneSettingSortQueryStringForCache, - ZoneSettingSSL, - ZoneSettingSSLRecommender, - SettingGetResponseItemZonesTLS1_2Only, - ZoneSettingTLS1_3, - ZoneSettingTLSClientAuth, - ZoneSettingTrueClientIPHeader, - ZoneSettingWAF, - ZoneSettingWebP, - ZoneSettingWebsockets, -] - -SettingGetResponse = List[SettingGetResponseItem] diff --git a/src/cloudflare/types/zones/settings/__init__.py b/src/cloudflare/types/zones/settings/__init__.py index b52ab846052..28f4f4e8a01 100644 --- a/src/cloudflare/types/zones/settings/__init__.py +++ b/src/cloudflare/types/zones/settings/__init__.py @@ -2,188 +2,123 @@ from __future__ import annotations +from .nel import NEL as NEL +from .ssl import SSL as SSL +from .waf import WAF as WAF +from .ipv6 import IPV6 as IPV6 +from .webp import WebP as WebP +from .http2 import HTTP2 as HTTP2 +from .http3 import HTTP3 as HTTP3 +from .brotli import Brotli as Brotli +from .minify import Minify as Minify +from .mirage import Mirage as Mirage +from .polish import Polish as Polish +from .ciphers import Ciphers as Ciphers +from .tls_1_3 import TLS1_3 as TLS1_3 +from .zero_rtt import ZeroRTT as ZeroRTT +from .nel_param import NELParam as NELParam +from .websocket import Websocket as Websocket +from .cache_level import CacheLevel as CacheLevel +from .early_hints import EarlyHints as EarlyHints +from .pseudo_ipv4 import PseudoIPV4 as PseudoIPV4 +from .polish_param import PolishParam as PolishParam +from .advanced_ddos import AdvancedDDoS as AdvancedDDoS +from .always_online import AlwaysOnline as AlwaysOnline +from .browser_check import BrowserCheck as BrowserCheck +from .challenge_ttl import ChallengeTTL as ChallengeTTL +from .font_settings import FontSettings as FontSettings +from .rocket_loader import RocketLoader as RocketLoader +from .image_resizing import ImageResizing as ImageResizing +from .ip_geolocation import IPGeolocation as IPGeolocation +from .security_level import SecurityLevel as SecurityLevel +from .min_tls_version import MinTLSVersion as MinTLSVersion +from .mobile_redirect import MobileRedirect as MobileRedirect from .nel_edit_params import NELEditParams as NELEditParams from .ssl_edit_params import SSLEditParams as SSLEditParams +from .ssl_recommender import SSLRecommender as SSLRecommender +from .tls_client_auth import TLSClientAuth as TLSClientAuth from .waf_edit_params import WAFEditParams as WAFEditParams +from .always_use_https import AlwaysUseHTTPS as AlwaysUseHTTPS +from .development_mode import DevelopmentMode as DevelopmentMode from .ipv6_edit_params import IPV6EditParams as IPV6EditParams +from .orange_to_orange import OrangeToOrange as OrangeToOrange +from .prefetch_preload import PrefetchPreload as PrefetchPreload +from .security_headers import SecurityHeaders as SecurityHeaders from .webp_edit_params import WebPEditParams as WebPEditParams -from .zone_setting_nel import ZoneSettingNEL as ZoneSettingNEL -from .zone_setting_ssl import ZoneSettingSSL as ZoneSettingSSL -from .zone_setting_waf import ZoneSettingWAF as ZoneSettingWAF +from .browser_cache_ttl import BrowserCacheTTL as BrowserCacheTTL +from .email_obfuscation import EmailObfuscation as EmailObfuscation +from .h2_prioritization import H2Prioritization as H2Prioritization from .http2_edit_params import HTTP2EditParams as HTTP2EditParams from .http3_edit_params import HTTP3EditParams as HTTP3EditParams -from .zone_setting_0rtt import ZoneSetting0rtt as ZoneSetting0rtt -from .zone_setting_ipv6 import ZoneSettingIPV6 as ZoneSettingIPV6 -from .zone_setting_webp import ZoneSettingWebP as ZoneSettingWebP from .brotli_edit_params import BrotliEditParams as BrotliEditParams from .cipher_edit_params import CipherEditParams as CipherEditParams +from .hotlink_protection import HotlinkProtection as HotlinkProtection from .minify_edit_params import MinifyEditParams as MinifyEditParams from .mirage_edit_params import MirageEditParams as MirageEditParams from .polish_edit_params import PolishEditParams as PolishEditParams -from .zone_setting_fonts import ZoneSettingFonts as ZoneSettingFonts -from .zone_setting_http2 import ZoneSettingHTTP2 as ZoneSettingHTTP2 -from .zone_setting_http3 import ZoneSettingHTTP3 as ZoneSettingHTTP3 +from .proxy_read_timeout import ProxyReadTimeout as ProxyReadTimeout +from .response_buffering import ResponseBuffering as ResponseBuffering +from .opportunistic_onion import OpportunisticOnion as OpportunisticOnion +from .rocket_loader_param import RocketLoaderParam as RocketLoaderParam from .tls_1_3_edit_params import TLS1_3EditParams as TLS1_3EditParams -from .zone_setting_brotli import ZoneSettingBrotli as ZoneSettingBrotli -from .zone_setting_minify import ZoneSettingMinify as ZoneSettingMinify -from .zone_setting_mirage import ZoneSettingMirage as ZoneSettingMirage -from .zone_setting_polish import ZoneSettingPolish as ZoneSettingPolish +from .image_resizing_param import ImageResizingParam as ImageResizingParam +from .server_side_excludes import ServerSideExcludes as ServerSideExcludes from .zero_rtt_edit_params import ZeroRTTEditParams as ZeroRTTEditParams -from .zone_setting_ciphers import ZoneSettingCiphers as ZoneSettingCiphers -from .zone_setting_tls_1_3 import ZoneSettingTLS1_3 as ZoneSettingTLS1_3 +from .ssl_recommender_param import SSLRecommenderParam as SSLRecommenderParam +from .true_client_ip_header import TrueClientIPHeader as TrueClientIPHeader from .websocket_edit_params import WebsocketEditParams as WebsocketEditParams from .early_hint_edit_params import EarlyHintEditParams as EarlyHintEditParams -from .zone_setting_buffering import ZoneSettingBuffering as ZoneSettingBuffering -from .zone_setting_nel_param import ZoneSettingNELParam as ZoneSettingNELParam -from .zone_setting_ssl_param import ZoneSettingSSLParam as ZoneSettingSSLParam -from .zone_setting_waf_param import ZoneSettingWAFParam as ZoneSettingWAFParam +from .orange_to_orange_param import OrangeToOrangeParam as OrangeToOrangeParam from .cache_level_edit_params import CacheLevelEditParams as CacheLevelEditParams +from .h2_prioritization_param import H2PrioritizationParam as H2PrioritizationParam +from .origin_max_http_version import OriginMaxHTTPVersion as OriginMaxHTTPVersion from .pseudo_ipv4_edit_params import PseudoIPV4EditParams as PseudoIPV4EditParams -from .zone_setting_0rtt_param import ZoneSetting0rttParam as ZoneSetting0rttParam -from .zone_setting_ipv6_param import ZoneSettingIPV6Param as ZoneSettingIPV6Param -from .zone_setting_webp_param import ZoneSettingWebPParam as ZoneSettingWebPParam -from .zone_setting_websockets import ZoneSettingWebsockets as ZoneSettingWebsockets +from .automatic_https_rewrites import AutomaticHTTPSRewrites as AutomaticHTTPSRewrites from .font_setting_edit_params import FontSettingEditParams as FontSettingEditParams -from .zone_setting_cache_level import ZoneSettingCacheLevel as ZoneSettingCacheLevel -from .zone_setting_early_hints import ZoneSettingEarlyHints as ZoneSettingEarlyHints -from .zone_setting_http2_param import ZoneSettingHTTP2Param as ZoneSettingHTTP2Param -from .zone_setting_http3_param import ZoneSettingHTTP3Param as ZoneSettingHTTP3Param -from .zone_setting_pseudo_ipv4 import ZoneSettingPseudoIPV4 as ZoneSettingPseudoIPV4 +from .opportunistic_encryption import OpportunisticEncryption as OpportunisticEncryption +from .proxy_read_timeout_param import ProxyReadTimeoutParam as ProxyReadTimeoutParam from .always_online_edit_params import AlwaysOnlineEditParams as AlwaysOnlineEditParams from .browser_check_edit_params import BrowserCheckEditParams as BrowserCheckEditParams from .challenge_ttl_edit_params import ChallengeTTLEditParams as ChallengeTTLEditParams from .rocket_loader_edit_params import RocketLoaderEditParams as RocketLoaderEditParams -from .zone_setting_brotli_param import ZoneSettingBrotliParam as ZoneSettingBrotliParam -from .zone_setting_minify_param import ZoneSettingMinifyParam as ZoneSettingMinifyParam -from .zone_setting_mirage_param import ZoneSettingMirageParam as ZoneSettingMirageParam -from .zone_setting_polish_param import ZoneSettingPolishParam as ZoneSettingPolishParam from .image_resizing_edit_params import ImageResizingEditParams as ImageResizingEditParams from .ip_geolocation_edit_params import IPGeolocationEditParams as IPGeolocationEditParams from .security_level_edit_params import SecurityLevelEditParams as SecurityLevelEditParams -from .zone_setting_advanced_ddos import ZoneSettingAdvancedDDoS as ZoneSettingAdvancedDDoS -from .zone_setting_always_online import ZoneSettingAlwaysOnline as ZoneSettingAlwaysOnline -from .zone_setting_browser_check import ZoneSettingBrowserCheck as ZoneSettingBrowserCheck -from .zone_setting_challenge_ttl import ZoneSettingChallengeTTL as ZoneSettingChallengeTTL -from .zone_setting_ciphers_param import ZoneSettingCiphersParam as ZoneSettingCiphersParam -from .zone_setting_rocket_loader import ZoneSettingRocketLoader as ZoneSettingRocketLoader -from .zone_setting_tls_1_3_param import ZoneSettingTLS1_3Param as ZoneSettingTLS1_3Param from .min_tls_version_edit_params import MinTLSVersionEditParams as MinTLSVersionEditParams from .mobile_redirect_edit_params import MobileRedirectEditParams as MobileRedirectEditParams +from .origin_error_page_pass_thru import OriginErrorPagePassThru as OriginErrorPagePassThru from .security_header_edit_params import SecurityHeaderEditParams as SecurityHeaderEditParams +from .sort_query_string_for_cache import SortQueryStringForCache as SortQueryStringForCache from .ssl_recommender_edit_params import SSLRecommenderEditParams as SSLRecommenderEditParams from .tls_client_auth_edit_params import TLSClientAuthEditParams as TLSClientAuthEditParams -from .zone_setting_image_resizing import ZoneSettingImageResizing as ZoneSettingImageResizing -from .zone_setting_ip_geolocation import ZoneSettingIPGeolocation as ZoneSettingIPGeolocation -from .zone_setting_security_level import ZoneSettingSecurityLevel as ZoneSettingSecurityLevel from .always_use_https_edit_params import AlwaysUseHTTPSEditParams as AlwaysUseHTTPSEditParams from .development_mode_edit_params import DevelopmentModeEditParams as DevelopmentModeEditParams from .orange_to_orange_edit_params import OrangeToOrangeEditParams as OrangeToOrangeEditParams from .prefetch_preload_edit_params import PrefetchPreloadEditParams as PrefetchPreloadEditParams -from .zone_setting_buffering_param import ZoneSettingBufferingParam as ZoneSettingBufferingParam -from .zone_setting_min_tls_version import ZoneSettingMinTLSVersion as ZoneSettingMinTLSVersion -from .zone_setting_mobile_redirect import ZoneSettingMobileRedirect as ZoneSettingMobileRedirect -from .zone_setting_security_header import ZoneSettingSecurityHeader as ZoneSettingSecurityHeader -from .zone_setting_ssl_recommender import ZoneSettingSSLRecommender as ZoneSettingSSLRecommender -from .zone_setting_tls_client_auth import ZoneSettingTLSClientAuth as ZoneSettingTLSClientAuth from .browser_cache_ttl_edit_params import BrowserCacheTTLEditParams as BrowserCacheTTLEditParams from .email_obfuscation_edit_params import EmailObfuscationEditParams as EmailObfuscationEditParams from .h2_prioritization_edit_params import H2PrioritizationEditParams as H2PrioritizationEditParams -from .zone_setting_always_use_https import ZoneSettingAlwaysUseHTTPS as ZoneSettingAlwaysUseHTTPS -from .zone_setting_development_mode import ZoneSettingDevelopmentMode as ZoneSettingDevelopmentMode -from .zone_setting_orange_to_orange import ZoneSettingOrangeToOrange as ZoneSettingOrangeToOrange -from .zone_setting_prefetch_preload import ZoneSettingPrefetchPreload as ZoneSettingPrefetchPreload -from .zone_setting_websockets_param import ZoneSettingWebsocketsParam as ZoneSettingWebsocketsParam from .hotlink_protection_edit_params import HotlinkProtectionEditParams as HotlinkProtectionEditParams from .proxy_read_timeout_edit_params import ProxyReadTimeoutEditParams as ProxyReadTimeoutEditParams from .response_buffering_edit_params import ResponseBufferingEditParams as ResponseBufferingEditParams -from .zone_setting_browser_cache_ttl import ZoneSettingBrowserCacheTTL as ZoneSettingBrowserCacheTTL -from .zone_setting_cache_level_param import ZoneSettingCacheLevelParam as ZoneSettingCacheLevelParam -from .zone_setting_early_hints_param import ZoneSettingEarlyHintsParam as ZoneSettingEarlyHintsParam -from .zone_setting_email_obfuscation import ZoneSettingEmailObfuscation as ZoneSettingEmailObfuscation -from .zone_setting_h2_prioritization import ZoneSettingH2Prioritization as ZoneSettingH2Prioritization -from .zone_setting_pseudo_ipv4_param import ZoneSettingPseudoIPV4Param as ZoneSettingPseudoIPV4Param +from .automatic_platform_optimization import AutomaticPlatformOptimization as AutomaticPlatformOptimization from .opportunistic_onion_edit_params import OpportunisticOnionEditParams as OpportunisticOnionEditParams from .server_side_exclude_edit_params import ServerSideExcludeEditParams as ServerSideExcludeEditParams -from .zone_setting_hotlink_protection import ZoneSettingHotlinkProtection as ZoneSettingHotlinkProtection -from .zone_setting_proxy_read_timeout import ZoneSettingProxyReadTimeout as ZoneSettingProxyReadTimeout -from .zone_setting_advanced_ddos_param import ZoneSettingAdvancedDDoSParam as ZoneSettingAdvancedDDoSParam -from .zone_setting_always_online_param import ZoneSettingAlwaysOnlineParam as ZoneSettingAlwaysOnlineParam -from .zone_setting_browser_check_param import ZoneSettingBrowserCheckParam as ZoneSettingBrowserCheckParam -from .zone_setting_challenge_ttl_param import ZoneSettingChallengeTTLParam as ZoneSettingChallengeTTLParam -from .zone_setting_opportunistic_onion import ZoneSettingOpportunisticOnion as ZoneSettingOpportunisticOnion -from .zone_setting_rocket_loader_param import ZoneSettingRocketLoaderParam as ZoneSettingRocketLoaderParam -from .zone_setting_server_side_exclude import ZoneSettingServerSideExclude as ZoneSettingServerSideExclude from .true_client_ip_header_edit_params import TrueClientIPHeaderEditParams as TrueClientIPHeaderEditParams -from .zone_setting_image_resizing_param import ZoneSettingImageResizingParam as ZoneSettingImageResizingParam -from .zone_setting_ip_geolocation_param import ZoneSettingIPGeolocationParam as ZoneSettingIPGeolocationParam -from .zone_setting_security_level_param import ZoneSettingSecurityLevelParam as ZoneSettingSecurityLevelParam -from .zone_setting_min_tls_version_param import ZoneSettingMinTLSVersionParam as ZoneSettingMinTLSVersionParam -from .zone_setting_mobile_redirect_param import ZoneSettingMobileRedirectParam as ZoneSettingMobileRedirectParam -from .zone_setting_security_header_param import ZoneSettingSecurityHeaderParam as ZoneSettingSecurityHeaderParam -from .zone_setting_ssl_recommender_param import ZoneSettingSSLRecommenderParam as ZoneSettingSSLRecommenderParam -from .zone_setting_tls_client_auth_param import ZoneSettingTLSClientAuthParam as ZoneSettingTLSClientAuthParam -from .zone_setting_true_client_ip_header import ZoneSettingTrueClientIPHeader as ZoneSettingTrueClientIPHeader from .automatic_https_rewrite_edit_params import AutomaticHTTPSRewriteEditParams as AutomaticHTTPSRewriteEditParams from .origin_max_http_version_edit_params import OriginMaxHTTPVersionEditParams as OriginMaxHTTPVersionEditParams -from .zone_setting_always_use_https_param import ZoneSettingAlwaysUseHTTPSParam as ZoneSettingAlwaysUseHTTPSParam -from .zone_setting_development_mode_param import ZoneSettingDevelopmentModeParam as ZoneSettingDevelopmentModeParam -from .zone_setting_orange_to_orange_param import ZoneSettingOrangeToOrangeParam as ZoneSettingOrangeToOrangeParam -from .zone_setting_prefetch_preload_param import ZoneSettingPrefetchPreloadParam as ZoneSettingPrefetchPreloadParam from .opportunistic_encryption_edit_params import OpportunisticEncryptionEditParams as OpportunisticEncryptionEditParams from .origin_max_http_version_get_response import OriginMaxHTTPVersionGetResponse as OriginMaxHTTPVersionGetResponse -from .zone_setting_browser_cache_ttl_param import ZoneSettingBrowserCacheTTLParam as ZoneSettingBrowserCacheTTLParam -from .zone_setting_email_obfuscation_param import ZoneSettingEmailObfuscationParam as ZoneSettingEmailObfuscationParam -from .zone_setting_h2_prioritization_param import ZoneSettingH2PrioritizationParam as ZoneSettingH2PrioritizationParam -from .origin_max_http_version_edit_response import OriginMaxHTTPVersionEditResponse as OriginMaxHTTPVersionEditResponse -from .zone_setting_automatic_https_rewrites import ( - ZoneSettingAutomaticHTTPSRewrites as ZoneSettingAutomaticHTTPSRewrites, -) -from .zone_setting_hotlink_protection_param import ( - ZoneSettingHotlinkProtectionParam as ZoneSettingHotlinkProtectionParam, -) -from .zone_setting_opportunistic_encryption import ( - ZoneSettingOpportunisticEncryption as ZoneSettingOpportunisticEncryption, -) -from .zone_setting_proxy_read_timeout_param import ZoneSettingProxyReadTimeoutParam as ZoneSettingProxyReadTimeoutParam -from .zone_setting_opportunistic_onion_param import ( - ZoneSettingOpportunisticOnionParam as ZoneSettingOpportunisticOnionParam, -) -from .zone_setting_server_side_exclude_param import ( - ZoneSettingServerSideExcludeParam as ZoneSettingServerSideExcludeParam, +from .automatic_platform_optimization_param import ( + AutomaticPlatformOptimizationParam as AutomaticPlatformOptimizationParam, ) +from .origin_max_http_version_edit_response import OriginMaxHTTPVersionEditResponse as OriginMaxHTTPVersionEditResponse from .origin_error_page_pass_thru_edit_params import ( OriginErrorPagePassThruEditParams as OriginErrorPagePassThruEditParams, ) from .sort_query_string_for_cache_edit_params import ( SortQueryStringForCacheEditParams as SortQueryStringForCacheEditParams, ) -from .zone_setting_origin_error_page_pass_thru import ( - ZoneSettingOriginErrorPagePassThru as ZoneSettingOriginErrorPagePassThru, -) -from .zone_setting_sort_query_string_for_cache import ( - ZoneSettingSortQueryStringForCache as ZoneSettingSortQueryStringForCache, -) -from .zone_setting_true_client_ip_header_param import ( - ZoneSettingTrueClientIPHeaderParam as ZoneSettingTrueClientIPHeaderParam, -) from .automatic_platform_optimization_edit_params import ( AutomaticPlatformOptimizationEditParams as AutomaticPlatformOptimizationEditParams, ) -from .zone_setting_automatic_https_rewrites_param import ( - ZoneSettingAutomaticHTTPSRewritesParam as ZoneSettingAutomaticHTTPSRewritesParam, -) -from .zone_setting_opportunistic_encryption_param import ( - ZoneSettingOpportunisticEncryptionParam as ZoneSettingOpportunisticEncryptionParam, -) -from .zone_setting_automatic_platform_optimization import ( - ZoneSettingAutomaticPlatformOptimization as ZoneSettingAutomaticPlatformOptimization, -) -from .zone_setting_origin_error_page_pass_thru_param import ( - ZoneSettingOriginErrorPagePassThruParam as ZoneSettingOriginErrorPagePassThruParam, -) -from .zone_setting_sort_query_string_for_cache_param import ( - ZoneSettingSortQueryStringForCacheParam as ZoneSettingSortQueryStringForCacheParam, -) -from .zone_setting_automatic_platform_optimization_param import ( - ZoneSettingAutomaticPlatformOptimizationParam as ZoneSettingAutomaticPlatformOptimizationParam, -) diff --git a/src/cloudflare/types/zones/settings/advanced_ddos.py b/src/cloudflare/types/zones/settings/advanced_ddos.py new file mode 100644 index 00000000000..b399aa5033b --- /dev/null +++ b/src/cloudflare/types/zones/settings/advanced_ddos.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AdvancedDDoS"] + + +class AdvancedDDoS(BaseModel): + id: Literal["advanced_ddos"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/always_online.py b/src/cloudflare/types/zones/settings/always_online.py new file mode 100644 index 00000000000..8e6e3530c86 --- /dev/null +++ b/src/cloudflare/types/zones/settings/always_online.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AlwaysOnline"] + + +class AlwaysOnline(BaseModel): + id: Literal["always_online"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/always_use_https.py b/src/cloudflare/types/zones/settings/always_use_https.py new file mode 100644 index 00000000000..683e5f5f23c --- /dev/null +++ b/src/cloudflare/types/zones/settings/always_use_https.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AlwaysUseHTTPS"] + + +class AlwaysUseHTTPS(BaseModel): + id: Literal["always_use_https"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/automatic_https_rewrites.py b/src/cloudflare/types/zones/settings/automatic_https_rewrites.py new file mode 100644 index 00000000000..bc1d055b2c9 --- /dev/null +++ b/src/cloudflare/types/zones/settings/automatic_https_rewrites.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AutomaticHTTPSRewrites"] + + +class AutomaticHTTPSRewrites(BaseModel): + id: Literal["automatic_https_rewrites"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/automatic_platform_optimization.py b/src/cloudflare/types/zones/settings/automatic_platform_optimization.py new file mode 100644 index 00000000000..1523e6d792d --- /dev/null +++ b/src/cloudflare/types/zones/settings/automatic_platform_optimization.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel + +__all__ = ["AutomaticPlatformOptimization"] + + +class AutomaticPlatformOptimization(BaseModel): + cache_by_device_type: bool + """ + Indicates whether or not + [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + is enabled. + """ + + cf: bool + """Indicates whether or not Cloudflare proxy is enabled.""" + + enabled: bool + """Indicates whether or not Automatic Platform Optimization is enabled.""" + + hostnames: List[str] + """ + An array of hostnames where Automatic Platform Optimization for WordPress is + activated. + """ + + wordpress: bool + """Indicates whether or not site is powered by WordPress.""" + + wp_plugin: bool + """ + Indicates whether or not + [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + installed. + """ diff --git a/src/cloudflare/types/zones/settings/automatic_platform_optimization_edit_params.py b/src/cloudflare/types/zones/settings/automatic_platform_optimization_edit_params.py index e7e7da4514e..a0f822dc9e1 100644 --- a/src/cloudflare/types/zones/settings/automatic_platform_optimization_edit_params.py +++ b/src/cloudflare/types/zones/settings/automatic_platform_optimization_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_automatic_platform_optimization_param import ZoneSettingAutomaticPlatformOptimizationParam +from .automatic_platform_optimization_param import AutomaticPlatformOptimizationParam __all__ = ["AutomaticPlatformOptimizationEditParams"] @@ -13,4 +13,4 @@ class AutomaticPlatformOptimizationEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingAutomaticPlatformOptimizationParam] + value: Required[AutomaticPlatformOptimizationParam] diff --git a/src/cloudflare/types/zones/settings/automatic_platform_optimization_param.py b/src/cloudflare/types/zones/settings/automatic_platform_optimization_param.py new file mode 100644 index 00000000000..b39664ca0e8 --- /dev/null +++ b/src/cloudflare/types/zones/settings/automatic_platform_optimization_param.py @@ -0,0 +1,39 @@ +# 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 Required, TypedDict + +__all__ = ["AutomaticPlatformOptimizationParam"] + + +class AutomaticPlatformOptimizationParam(TypedDict, total=False): + cache_by_device_type: Required[bool] + """ + Indicates whether or not + [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + is enabled. + """ + + cf: Required[bool] + """Indicates whether or not Cloudflare proxy is enabled.""" + + enabled: Required[bool] + """Indicates whether or not Automatic Platform Optimization is enabled.""" + + hostnames: Required[List[str]] + """ + An array of hostnames where Automatic Platform Optimization for WordPress is + activated. + """ + + wordpress: Required[bool] + """Indicates whether or not site is powered by WordPress.""" + + wp_plugin: Required[bool] + """ + Indicates whether or not + [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + installed. + """ diff --git a/src/cloudflare/types/zones/settings/brotli.py b/src/cloudflare/types/zones/settings/brotli.py new file mode 100644 index 00000000000..b950810ee41 --- /dev/null +++ b/src/cloudflare/types/zones/settings/brotli.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Brotli"] + + +class Brotli(BaseModel): + id: Literal["brotli"] + """ID of the zone setting.""" + + value: Literal["off", "on"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/browser_cache_ttl.py b/src/cloudflare/types/zones/settings/browser_cache_ttl.py new file mode 100644 index 00000000000..f24f141978c --- /dev/null +++ b/src/cloudflare/types/zones/settings/browser_cache_ttl.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BrowserCacheTTL"] + + +class BrowserCacheTTL(BaseModel): + id: Literal["browser_cache_ttl"] + """ID of the zone setting.""" + + value: Literal[ + 0, + 30, + 60, + 120, + 300, + 1200, + 1800, + 3600, + 7200, + 10800, + 14400, + 18000, + 28800, + 43200, + 57600, + 72000, + 86400, + 172800, + 259200, + 345600, + 432000, + 691200, + 1382400, + 2073600, + 2678400, + 5356800, + 16070400, + 31536000, + ] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/browser_check.py b/src/cloudflare/types/zones/settings/browser_check.py new file mode 100644 index 00000000000..eadee65af2a --- /dev/null +++ b/src/cloudflare/types/zones/settings/browser_check.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BrowserCheck"] + + +class BrowserCheck(BaseModel): + id: Literal["browser_check"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/cache_level.py b/src/cloudflare/types/zones/settings/cache_level.py new file mode 100644 index 00000000000..d383d1f6f60 --- /dev/null +++ b/src/cloudflare/types/zones/settings/cache_level.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["CacheLevel"] + + +class CacheLevel(BaseModel): + id: Literal["cache_level"] + """ID of the zone setting.""" + + value: Literal["aggressive", "basic", "simplified"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/challenge_ttl.py b/src/cloudflare/types/zones/settings/challenge_ttl.py new file mode 100644 index 00000000000..3006c3220d0 --- /dev/null +++ b/src/cloudflare/types/zones/settings/challenge_ttl.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ChallengeTTL"] + + +class ChallengeTTL(BaseModel): + id: Literal["challenge_ttl"] + """ID of the zone setting.""" + + value: Literal[300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/ciphers.py b/src/cloudflare/types/zones/settings/ciphers.py new file mode 100644 index 00000000000..a27c8eed620 --- /dev/null +++ b/src/cloudflare/types/zones/settings/ciphers.py @@ -0,0 +1,26 @@ +# 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__ = ["Ciphers"] + + +class Ciphers(BaseModel): + id: Literal["ciphers"] + """ID of the zone setting.""" + + value: List[str] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/development_mode.py b/src/cloudflare/types/zones/settings/development_mode.py new file mode 100644 index 00000000000..d5f856dd284 --- /dev/null +++ b/src/cloudflare/types/zones/settings/development_mode.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["DevelopmentMode"] + + +class DevelopmentMode(BaseModel): + id: Literal["development_mode"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + time_remaining: Optional[float] = None + """ + Value of the zone setting. Notes: The interval (in seconds) from when + development mode expires (positive integer) or last expired (negative integer) + for the domain. If development mode has never been enabled, this value is false. + """ diff --git a/src/cloudflare/types/zones/settings/early_hints.py b/src/cloudflare/types/zones/settings/early_hints.py new file mode 100644 index 00000000000..db3e20a7e80 --- /dev/null +++ b/src/cloudflare/types/zones/settings/early_hints.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["EarlyHints"] + + +class EarlyHints(BaseModel): + id: Literal["early_hints"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/email_obfuscation.py b/src/cloudflare/types/zones/settings/email_obfuscation.py new file mode 100644 index 00000000000..278226136b5 --- /dev/null +++ b/src/cloudflare/types/zones/settings/email_obfuscation.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["EmailObfuscation"] + + +class EmailObfuscation(BaseModel): + id: Literal["email_obfuscation"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/font_settings.py b/src/cloudflare/types/zones/settings/font_settings.py new file mode 100644 index 00000000000..c0fc9cdfac3 --- /dev/null +++ b/src/cloudflare/types/zones/settings/font_settings.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["FontSettings"] + + +class FontSettings(BaseModel): + id: Literal["fonts"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/h2_prioritization.py b/src/cloudflare/types/zones/settings/h2_prioritization.py new file mode 100644 index 00000000000..7a9144ae8b1 --- /dev/null +++ b/src/cloudflare/types/zones/settings/h2_prioritization.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["H2Prioritization"] + + +class H2Prioritization(BaseModel): + id: Literal["h2_prioritization"] + """ID of the zone setting.""" + + value: Literal["on", "off", "custom"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/h2_prioritization_edit_params.py b/src/cloudflare/types/zones/settings/h2_prioritization_edit_params.py index ac5feb84511..1b51b6116d1 100644 --- a/src/cloudflare/types/zones/settings/h2_prioritization_edit_params.py +++ b/src/cloudflare/types/zones/settings/h2_prioritization_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_h2_prioritization_param import ZoneSettingH2PrioritizationParam +from .h2_prioritization_param import H2PrioritizationParam __all__ = ["H2PrioritizationEditParams"] @@ -13,7 +13,7 @@ class H2PrioritizationEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingH2PrioritizationParam] + value: Required[H2PrioritizationParam] """ HTTP/2 Edge Prioritization optimises the delivery of resources served through HTTP/2 to improve page load performance. It also supports fine control of diff --git a/src/cloudflare/types/zones/settings/h2_prioritization_param.py b/src/cloudflare/types/zones/settings/h2_prioritization_param.py new file mode 100644 index 00000000000..0d3cc769689 --- /dev/null +++ b/src/cloudflare/types/zones/settings/h2_prioritization_param.py @@ -0,0 +1,15 @@ +# 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__ = ["H2PrioritizationParam"] + + +class H2PrioritizationParam(TypedDict, total=False): + id: Required[Literal["h2_prioritization"]] + """ID of the zone setting.""" + + value: Required[Literal["on", "off", "custom"]] + """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/hotlink_protection.py b/src/cloudflare/types/zones/settings/hotlink_protection.py new file mode 100644 index 00000000000..52fa412f29b --- /dev/null +++ b/src/cloudflare/types/zones/settings/hotlink_protection.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["HotlinkProtection"] + + +class HotlinkProtection(BaseModel): + id: Literal["hotlink_protection"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/http2.py b/src/cloudflare/types/zones/settings/http2.py new file mode 100644 index 00000000000..8d539940248 --- /dev/null +++ b/src/cloudflare/types/zones/settings/http2.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["HTTP2"] + + +class HTTP2(BaseModel): + id: Literal["http2"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/http3.py b/src/cloudflare/types/zones/settings/http3.py new file mode 100644 index 00000000000..2b65951e377 --- /dev/null +++ b/src/cloudflare/types/zones/settings/http3.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["HTTP3"] + + +class HTTP3(BaseModel): + id: Literal["http3"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/image_resizing.py b/src/cloudflare/types/zones/settings/image_resizing.py new file mode 100644 index 00000000000..8fa332009e7 --- /dev/null +++ b/src/cloudflare/types/zones/settings/image_resizing.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ImageResizing"] + + +class ImageResizing(BaseModel): + id: Literal["image_resizing"] + """ID of the zone setting.""" + + value: Literal["on", "off", "open"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/image_resizing_edit_params.py b/src/cloudflare/types/zones/settings/image_resizing_edit_params.py index f36d9285cd3..4425d3e42c6 100644 --- a/src/cloudflare/types/zones/settings/image_resizing_edit_params.py +++ b/src/cloudflare/types/zones/settings/image_resizing_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_image_resizing_param import ZoneSettingImageResizingParam +from .image_resizing_param import ImageResizingParam __all__ = ["ImageResizingEditParams"] @@ -13,7 +13,7 @@ class ImageResizingEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingImageResizingParam] + value: Required[ImageResizingParam] """ Image Resizing provides on-demand resizing, conversion and optimisation for images served through Cloudflare's network. Refer to the diff --git a/src/cloudflare/types/zones/settings/image_resizing_param.py b/src/cloudflare/types/zones/settings/image_resizing_param.py new file mode 100644 index 00000000000..0b6d7c66979 --- /dev/null +++ b/src/cloudflare/types/zones/settings/image_resizing_param.py @@ -0,0 +1,15 @@ +# 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__ = ["ImageResizingParam"] + + +class ImageResizingParam(TypedDict, total=False): + id: Required[Literal["image_resizing"]] + """ID of the zone setting.""" + + value: Required[Literal["on", "off", "open"]] + """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/ip_geolocation.py b/src/cloudflare/types/zones/settings/ip_geolocation.py new file mode 100644 index 00000000000..faa0d44caec --- /dev/null +++ b/src/cloudflare/types/zones/settings/ip_geolocation.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["IPGeolocation"] + + +class IPGeolocation(BaseModel): + id: Literal["ip_geolocation"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/ipv6.py b/src/cloudflare/types/zones/settings/ipv6.py new file mode 100644 index 00000000000..d99f87c4568 --- /dev/null +++ b/src/cloudflare/types/zones/settings/ipv6.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["IPV6"] + + +class IPV6(BaseModel): + id: Literal["ipv6"] + """ID of the zone setting.""" + + value: Literal["off", "on"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/min_tls_version.py b/src/cloudflare/types/zones/settings/min_tls_version.py new file mode 100644 index 00000000000..20908024cda --- /dev/null +++ b/src/cloudflare/types/zones/settings/min_tls_version.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["MinTLSVersion"] + + +class MinTLSVersion(BaseModel): + id: Literal["min_tls_version"] + """ID of the zone setting.""" + + value: Literal["1.0", "1.1", "1.2", "1.3"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/minify.py b/src/cloudflare/types/zones/settings/minify.py new file mode 100644 index 00000000000..eae119b2741 --- /dev/null +++ b/src/cloudflare/types/zones/settings/minify.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Minify", "Value"] + + +class Value(BaseModel): + css: Optional[Literal["on", "off"]] = None + """Automatically minify all CSS files for your website.""" + + html: Optional[Literal["on", "off"]] = None + """Automatically minify all HTML files for your website.""" + + js: Optional[Literal["on", "off"]] = None + """Automatically minify all JavaScript files for your website.""" + + +class Minify(BaseModel): + id: Literal["minify"] + """Zone setting identifier.""" + + value: Value + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/mirage.py b/src/cloudflare/types/zones/settings/mirage.py new file mode 100644 index 00000000000..bbd2722212e --- /dev/null +++ b/src/cloudflare/types/zones/settings/mirage.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Mirage"] + + +class Mirage(BaseModel): + id: Literal["mirage"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/mobile_redirect.py b/src/cloudflare/types/zones/settings/mobile_redirect.py new file mode 100644 index 00000000000..66bab1b5ff9 --- /dev/null +++ b/src/cloudflare/types/zones/settings/mobile_redirect.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["MobileRedirect", "Value"] + + +class Value(BaseModel): + mobile_subdomain: Optional[str] = None + """ + Which subdomain prefix you wish to redirect visitors on mobile devices to + (subdomain must already exist). + """ + + status: Optional[Literal["on", "off"]] = None + """Whether or not mobile redirect is enabled.""" + + strip_uri: Optional[bool] = None + """ + Whether to drop the current page path and redirect to the mobile subdomain URL + root, or keep the path and redirect to the same page on the mobile subdomain. + """ + + +class MobileRedirect(BaseModel): + id: Literal["mobile_redirect"] + """Identifier of the zone setting.""" + + value: Value + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/nel.py b/src/cloudflare/types/zones/settings/nel.py new file mode 100644 index 00000000000..f8b8d437e7e --- /dev/null +++ b/src/cloudflare/types/zones/settings/nel.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["NEL", "Value"] + + +class Value(BaseModel): + enabled: Optional[bool] = None + + +class NEL(BaseModel): + id: Literal["nel"] + """Zone setting identifier.""" + + value: Value + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/nel_edit_params.py b/src/cloudflare/types/zones/settings/nel_edit_params.py index 1043d489c22..114d1000df4 100644 --- a/src/cloudflare/types/zones/settings/nel_edit_params.py +++ b/src/cloudflare/types/zones/settings/nel_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_nel_param import ZoneSettingNELParam +from .nel_param import NELParam __all__ = ["NELEditParams"] @@ -13,5 +13,5 @@ class NELEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingNELParam] + value: Required[NELParam] """Enable Network Error Logging reporting on your zone. (Beta)""" diff --git a/src/cloudflare/types/zones/settings/nel_param.py b/src/cloudflare/types/zones/settings/nel_param.py new file mode 100644 index 00000000000..c692f294f67 --- /dev/null +++ b/src/cloudflare/types/zones/settings/nel_param.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 Literal, Required, TypedDict + +__all__ = ["NELParam", "Value"] + + +class Value(TypedDict, total=False): + enabled: bool + + +class NELParam(TypedDict, total=False): + id: Required[Literal["nel"]] + """Zone setting identifier.""" + + value: Required[Value] + """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/opportunistic_encryption.py b/src/cloudflare/types/zones/settings/opportunistic_encryption.py new file mode 100644 index 00000000000..30ecc81168b --- /dev/null +++ b/src/cloudflare/types/zones/settings/opportunistic_encryption.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["OpportunisticEncryption"] + + +class OpportunisticEncryption(BaseModel): + id: Literal["opportunistic_encryption"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/opportunistic_onion.py b/src/cloudflare/types/zones/settings/opportunistic_onion.py new file mode 100644 index 00000000000..d0beb361768 --- /dev/null +++ b/src/cloudflare/types/zones/settings/opportunistic_onion.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["OpportunisticOnion"] + + +class OpportunisticOnion(BaseModel): + id: Literal["opportunistic_onion"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/orange_to_orange.py b/src/cloudflare/types/zones/settings/orange_to_orange.py new file mode 100644 index 00000000000..ae7a5cd519e --- /dev/null +++ b/src/cloudflare/types/zones/settings/orange_to_orange.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["OrangeToOrange"] + + +class OrangeToOrange(BaseModel): + id: Literal["orange_to_orange"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/orange_to_orange_edit_params.py b/src/cloudflare/types/zones/settings/orange_to_orange_edit_params.py index 5758995a76e..d2b659926cf 100644 --- a/src/cloudflare/types/zones/settings/orange_to_orange_edit_params.py +++ b/src/cloudflare/types/zones/settings/orange_to_orange_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_orange_to_orange_param import ZoneSettingOrangeToOrangeParam +from .orange_to_orange_param import OrangeToOrangeParam __all__ = ["OrangeToOrangeEditParams"] @@ -13,7 +13,7 @@ class OrangeToOrangeEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingOrangeToOrangeParam] + value: Required[OrangeToOrangeParam] """ Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also on Cloudflare. diff --git a/src/cloudflare/types/zones/settings/orange_to_orange_param.py b/src/cloudflare/types/zones/settings/orange_to_orange_param.py new file mode 100644 index 00000000000..9a28f503c63 --- /dev/null +++ b/src/cloudflare/types/zones/settings/orange_to_orange_param.py @@ -0,0 +1,15 @@ +# 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__ = ["OrangeToOrangeParam"] + + +class OrangeToOrangeParam(TypedDict, total=False): + id: Required[Literal["orange_to_orange"]] + """ID of the zone setting.""" + + value: Required[Literal["on", "off"]] + """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/origin_error_page_pass_thru.py b/src/cloudflare/types/zones/settings/origin_error_page_pass_thru.py new file mode 100644 index 00000000000..000e5e4940e --- /dev/null +++ b/src/cloudflare/types/zones/settings/origin_error_page_pass_thru.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["OriginErrorPagePassThru"] + + +class OriginErrorPagePassThru(BaseModel): + id: Literal["origin_error_page_pass_thru"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/origin_max_http_version.py b/src/cloudflare/types/zones/settings/origin_max_http_version.py new file mode 100644 index 00000000000..338eb691310 --- /dev/null +++ b/src/cloudflare/types/zones/settings/origin_max_http_version.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["OriginMaxHTTPVersion"] + +OriginMaxHTTPVersion = Literal["origin_max_http_version"] diff --git a/src/cloudflare/types/zones/settings/origin_max_http_version_edit_response.py b/src/cloudflare/types/zones/settings/origin_max_http_version_edit_response.py index bd12478c643..f147194e780 100644 --- a/src/cloudflare/types/zones/settings/origin_max_http_version_edit_response.py +++ b/src/cloudflare/types/zones/settings/origin_max_http_version_edit_response.py @@ -5,12 +5,13 @@ from typing_extensions import Literal from ...._models import BaseModel +from .origin_max_http_version import OriginMaxHTTPVersion __all__ = ["OriginMaxHTTPVersionEditResponse"] class OriginMaxHTTPVersionEditResponse(BaseModel): - id: Literal["origin_max_http_version"] + id: OriginMaxHTTPVersion """Value of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/zones/settings/origin_max_http_version_get_response.py b/src/cloudflare/types/zones/settings/origin_max_http_version_get_response.py index a3ef1e821f1..035e11644f5 100644 --- a/src/cloudflare/types/zones/settings/origin_max_http_version_get_response.py +++ b/src/cloudflare/types/zones/settings/origin_max_http_version_get_response.py @@ -5,12 +5,13 @@ from typing_extensions import Literal from ...._models import BaseModel +from .origin_max_http_version import OriginMaxHTTPVersion __all__ = ["OriginMaxHTTPVersionGetResponse"] class OriginMaxHTTPVersionGetResponse(BaseModel): - id: Literal["origin_max_http_version"] + id: OriginMaxHTTPVersion """Value of the zone setting.""" modified_on: Optional[datetime] = None diff --git a/src/cloudflare/types/zones/settings/polish.py b/src/cloudflare/types/zones/settings/polish.py new file mode 100644 index 00000000000..0caf6611eb3 --- /dev/null +++ b/src/cloudflare/types/zones/settings/polish.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Polish"] + + +class Polish(BaseModel): + id: Literal["polish"] + """ID of the zone setting.""" + + value: Literal["off", "lossless", "lossy"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/polish_edit_params.py b/src/cloudflare/types/zones/settings/polish_edit_params.py index 4612df87efa..044f3b98989 100644 --- a/src/cloudflare/types/zones/settings/polish_edit_params.py +++ b/src/cloudflare/types/zones/settings/polish_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_polish_param import ZoneSettingPolishParam +from .polish_param import PolishParam __all__ = ["PolishEditParams"] @@ -13,7 +13,7 @@ class PolishEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingPolishParam] + value: Required[PolishParam] """Removes metadata and compresses your images for faster page load times. Basic (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on diff --git a/src/cloudflare/types/zones/settings/polish_param.py b/src/cloudflare/types/zones/settings/polish_param.py new file mode 100644 index 00000000000..84f4c0b65c9 --- /dev/null +++ b/src/cloudflare/types/zones/settings/polish_param.py @@ -0,0 +1,15 @@ +# 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__ = ["PolishParam"] + + +class PolishParam(TypedDict, total=False): + id: Required[Literal["polish"]] + """ID of the zone setting.""" + + value: Required[Literal["off", "lossless", "lossy"]] + """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/prefetch_preload.py b/src/cloudflare/types/zones/settings/prefetch_preload.py new file mode 100644 index 00000000000..4482bee389c --- /dev/null +++ b/src/cloudflare/types/zones/settings/prefetch_preload.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["PrefetchPreload"] + + +class PrefetchPreload(BaseModel): + id: Literal["prefetch_preload"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/proxy_read_timeout.py b/src/cloudflare/types/zones/settings/proxy_read_timeout.py new file mode 100644 index 00000000000..1533eb571fe --- /dev/null +++ b/src/cloudflare/types/zones/settings/proxy_read_timeout.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ProxyReadTimeout"] + + +class ProxyReadTimeout(BaseModel): + id: Literal["proxy_read_timeout"] + """ID of the zone setting.""" + + value: float + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/proxy_read_timeout_edit_params.py b/src/cloudflare/types/zones/settings/proxy_read_timeout_edit_params.py index a01e1c1c05f..7813472d0e3 100644 --- a/src/cloudflare/types/zones/settings/proxy_read_timeout_edit_params.py +++ b/src/cloudflare/types/zones/settings/proxy_read_timeout_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_proxy_read_timeout_param import ZoneSettingProxyReadTimeoutParam +from .proxy_read_timeout_param import ProxyReadTimeoutParam __all__ = ["ProxyReadTimeoutEditParams"] @@ -13,5 +13,5 @@ class ProxyReadTimeoutEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingProxyReadTimeoutParam] + value: Required[ProxyReadTimeoutParam] """Maximum time between two read operations from origin.""" diff --git a/src/cloudflare/types/zones/settings/proxy_read_timeout_param.py b/src/cloudflare/types/zones/settings/proxy_read_timeout_param.py new file mode 100644 index 00000000000..5db20403058 --- /dev/null +++ b/src/cloudflare/types/zones/settings/proxy_read_timeout_param.py @@ -0,0 +1,15 @@ +# 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__ = ["ProxyReadTimeoutParam"] + + +class ProxyReadTimeoutParam(TypedDict, total=False): + id: Required[Literal["proxy_read_timeout"]] + """ID of the zone setting.""" + + value: Required[float] + """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/pseudo_ipv4.py b/src/cloudflare/types/zones/settings/pseudo_ipv4.py new file mode 100644 index 00000000000..d0e154d9ed6 --- /dev/null +++ b/src/cloudflare/types/zones/settings/pseudo_ipv4.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["PseudoIPV4"] + + +class PseudoIPV4(BaseModel): + id: Literal["pseudo_ipv4"] + """Value of the Pseudo IPv4 setting.""" + + value: Literal["off", "add_header", "overwrite_header"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/response_buffering.py b/src/cloudflare/types/zones/settings/response_buffering.py new file mode 100644 index 00000000000..567acd1b665 --- /dev/null +++ b/src/cloudflare/types/zones/settings/response_buffering.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ResponseBuffering"] + + +class ResponseBuffering(BaseModel): + id: Literal["response_buffering"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/rocket_loader.py b/src/cloudflare/types/zones/settings/rocket_loader.py new file mode 100644 index 00000000000..92374df7dd1 --- /dev/null +++ b/src/cloudflare/types/zones/settings/rocket_loader.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["RocketLoader"] + + +class RocketLoader(BaseModel): + id: Literal["rocket_loader"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/rocket_loader_edit_params.py b/src/cloudflare/types/zones/settings/rocket_loader_edit_params.py index a1ac846330c..e66a7c774cb 100644 --- a/src/cloudflare/types/zones/settings/rocket_loader_edit_params.py +++ b/src/cloudflare/types/zones/settings/rocket_loader_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_rocket_loader_param import ZoneSettingRocketLoaderParam +from .rocket_loader_param import RocketLoaderParam __all__ = ["RocketLoaderEditParams"] @@ -13,7 +13,7 @@ class RocketLoaderEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingRocketLoaderParam] + value: Required[RocketLoaderParam] """ Rocket Loader is a general-purpose asynchronous JavaScript optimisation that prioritises rendering your content while loading your site's Javascript diff --git a/src/cloudflare/types/zones/settings/rocket_loader_param.py b/src/cloudflare/types/zones/settings/rocket_loader_param.py new file mode 100644 index 00000000000..d72dfe24e23 --- /dev/null +++ b/src/cloudflare/types/zones/settings/rocket_loader_param.py @@ -0,0 +1,15 @@ +# 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__ = ["RocketLoaderParam"] + + +class RocketLoaderParam(TypedDict, total=False): + id: Required[Literal["rocket_loader"]] + """ID of the zone setting.""" + + value: Required[Literal["on", "off"]] + """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/security_headers.py b/src/cloudflare/types/zones/settings/security_headers.py new file mode 100644 index 00000000000..2399ebe976c --- /dev/null +++ b/src/cloudflare/types/zones/settings/security_headers.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["SecurityHeaders", "Value", "ValueStrictTransportSecurity"] + + +class ValueStrictTransportSecurity(BaseModel): + enabled: Optional[bool] = None + """Whether or not strict transport security is enabled.""" + + include_subdomains: Optional[bool] = None + """Include all subdomains for strict transport security.""" + + max_age: Optional[float] = None + """Max age in seconds of the strict transport security.""" + + nosniff: Optional[bool] = None + """Whether or not to include 'X-Content-Type-Options: nosniff' header.""" + + +class Value(BaseModel): + strict_transport_security: Optional[ValueStrictTransportSecurity] = None + """Strict Transport Security.""" + + +class SecurityHeaders(BaseModel): + id: Literal["security_header"] + """ID of the zone's security header.""" + + value: Value + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/security_level.py b/src/cloudflare/types/zones/settings/security_level.py new file mode 100644 index 00000000000..36676d1e644 --- /dev/null +++ b/src/cloudflare/types/zones/settings/security_level.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["SecurityLevel"] + + +class SecurityLevel(BaseModel): + id: Literal["security_level"] + """ID of the zone setting.""" + + value: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/server_side_excludes.py b/src/cloudflare/types/zones/settings/server_side_excludes.py new file mode 100644 index 00000000000..96f3581d609 --- /dev/null +++ b/src/cloudflare/types/zones/settings/server_side_excludes.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ServerSideExcludes"] + + +class ServerSideExcludes(BaseModel): + id: Literal["server_side_exclude"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/sort_query_string_for_cache.py b/src/cloudflare/types/zones/settings/sort_query_string_for_cache.py new file mode 100644 index 00000000000..a60d4bfb63d --- /dev/null +++ b/src/cloudflare/types/zones/settings/sort_query_string_for_cache.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["SortQueryStringForCache"] + + +class SortQueryStringForCache(BaseModel): + id: Literal["sort_query_string_for_cache"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/ssl.py b/src/cloudflare/types/zones/settings/ssl.py new file mode 100644 index 00000000000..43cf8ae0cb7 --- /dev/null +++ b/src/cloudflare/types/zones/settings/ssl.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["SSL"] + + +class SSL(BaseModel): + id: Literal["ssl"] + """ID of the zone setting.""" + + value: Literal["off", "flexible", "full", "strict"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/ssl_recommender.py b/src/cloudflare/types/zones/settings/ssl_recommender.py new file mode 100644 index 00000000000..c3a36d8f3c8 --- /dev/null +++ b/src/cloudflare/types/zones/settings/ssl_recommender.py @@ -0,0 +1,16 @@ +# 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__ = ["SSLRecommender"] + + +class SSLRecommender(BaseModel): + id: Optional[Literal["ssl_recommender"]] = None + """Enrollment value for SSL/TLS Recommender.""" + + enabled: Optional[bool] = None + """ssl-recommender enrollment setting.""" diff --git a/src/cloudflare/types/zones/settings/ssl_recommender_edit_params.py b/src/cloudflare/types/zones/settings/ssl_recommender_edit_params.py index f2db5469144..4006b39479e 100644 --- a/src/cloudflare/types/zones/settings/ssl_recommender_edit_params.py +++ b/src/cloudflare/types/zones/settings/ssl_recommender_edit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from .zone_setting_ssl_recommender_param import ZoneSettingSSLRecommenderParam +from .ssl_recommender_param import SSLRecommenderParam __all__ = ["SSLRecommenderEditParams"] @@ -13,7 +13,7 @@ class SSLRecommenderEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - value: Required[ZoneSettingSSLRecommenderParam] + value: Required[SSLRecommenderParam] """ Enrollment in the SSL/TLS Recommender service which tries to detect and recommend (by sending periodic emails) the most secure SSL/TLS setting your diff --git a/src/cloudflare/types/zones/settings/ssl_recommender_param.py b/src/cloudflare/types/zones/settings/ssl_recommender_param.py new file mode 100644 index 00000000000..0189ce02e60 --- /dev/null +++ b/src/cloudflare/types/zones/settings/ssl_recommender_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["SSLRecommenderParam"] + + +class SSLRecommenderParam(TypedDict, total=False): + id: Literal["ssl_recommender"] + """Enrollment value for SSL/TLS Recommender.""" + + enabled: bool + """ssl-recommender enrollment setting.""" diff --git a/src/cloudflare/types/zones/settings/tls_1_3.py b/src/cloudflare/types/zones/settings/tls_1_3.py new file mode 100644 index 00000000000..6e72f90e7b9 --- /dev/null +++ b/src/cloudflare/types/zones/settings/tls_1_3.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["TLS1_3"] + + +class TLS1_3(BaseModel): + id: Literal["tls_1_3"] + """ID of the zone setting.""" + + value: Literal["on", "off", "zrt"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/tls_client_auth.py b/src/cloudflare/types/zones/settings/tls_client_auth.py new file mode 100644 index 00000000000..e1ab61fb85b --- /dev/null +++ b/src/cloudflare/types/zones/settings/tls_client_auth.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["TLSClientAuth"] + + +class TLSClientAuth(BaseModel): + id: Literal["tls_client_auth"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/true_client_ip_header.py b/src/cloudflare/types/zones/settings/true_client_ip_header.py new file mode 100644 index 00000000000..12fd0a2d037 --- /dev/null +++ b/src/cloudflare/types/zones/settings/true_client_ip_header.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["TrueClientIPHeader"] + + +class TrueClientIPHeader(BaseModel): + id: Literal["true_client_ip_header"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/waf.py b/src/cloudflare/types/zones/settings/waf.py new file mode 100644 index 00000000000..ec7a5487541 --- /dev/null +++ b/src/cloudflare/types/zones/settings/waf.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["WAF"] + + +class WAF(BaseModel): + id: Literal["waf"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/webp.py b/src/cloudflare/types/zones/settings/webp.py new file mode 100644 index 00000000000..9f4cfaeee3f --- /dev/null +++ b/src/cloudflare/types/zones/settings/webp.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["WebP"] + + +class WebP(BaseModel): + id: Literal["webp"] + """ID of the zone setting.""" + + value: Literal["off", "on"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/websocket.py b/src/cloudflare/types/zones/settings/websocket.py new file mode 100644 index 00000000000..c8471ef28f9 --- /dev/null +++ b/src/cloudflare/types/zones/settings/websocket.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["Websocket"] + + +class Websocket(BaseModel): + id: Literal["websockets"] + """ID of the zone setting.""" + + value: Literal["off", "on"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zero_rtt.py b/src/cloudflare/types/zones/settings/zero_rtt.py new file mode 100644 index 00000000000..a627cbcc738 --- /dev/null +++ b/src/cloudflare/types/zones/settings/zero_rtt.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ZeroRTT"] + + +class ZeroRTT(BaseModel): + id: Literal["0rtt"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_0rtt.py b/src/cloudflare/types/zones/settings/zone_setting_0rtt.py deleted file mode 100644 index dbe59f9b50b..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_0rtt.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSetting0rtt"] - - -class ZoneSetting0rtt(BaseModel): - id: Literal["0rtt"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_0rtt_param.py b/src/cloudflare/types/zones/settings/zone_setting_0rtt_param.py deleted file mode 100644 index 784c92adabd..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_0rtt_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__ = ["ZoneSetting0rttParam"] - - -class ZoneSetting0rttParam(TypedDict, total=False): - id: Required[Literal["0rtt"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_advanced_ddos.py b/src/cloudflare/types/zones/settings/zone_setting_advanced_ddos.py deleted file mode 100644 index ea88edd4793..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_advanced_ddos.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingAdvancedDDoS"] - - -class ZoneSettingAdvancedDDoS(BaseModel): - id: Literal["advanced_ddos"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_advanced_ddos_param.py b/src/cloudflare/types/zones/settings/zone_setting_advanced_ddos_param.py deleted file mode 100644 index 508516ae76d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_advanced_ddos_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__ = ["ZoneSettingAdvancedDDoSParam"] - - -class ZoneSettingAdvancedDDoSParam(TypedDict, total=False): - id: Required[Literal["advanced_ddos"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_always_online.py b/src/cloudflare/types/zones/settings/zone_setting_always_online.py deleted file mode 100644 index 2fb96c5f808..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_always_online.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingAlwaysOnline"] - - -class ZoneSettingAlwaysOnline(BaseModel): - id: Literal["always_online"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_always_online_param.py b/src/cloudflare/types/zones/settings/zone_setting_always_online_param.py deleted file mode 100644 index 3691306d0a2..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_always_online_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__ = ["ZoneSettingAlwaysOnlineParam"] - - -class ZoneSettingAlwaysOnlineParam(TypedDict, total=False): - id: Required[Literal["always_online"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_always_use_https.py b/src/cloudflare/types/zones/settings/zone_setting_always_use_https.py deleted file mode 100644 index 500d331ab02..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_always_use_https.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingAlwaysUseHTTPS"] - - -class ZoneSettingAlwaysUseHTTPS(BaseModel): - id: Literal["always_use_https"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_always_use_https_param.py b/src/cloudflare/types/zones/settings/zone_setting_always_use_https_param.py deleted file mode 100644 index 899c460b940..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_always_use_https_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__ = ["ZoneSettingAlwaysUseHTTPSParam"] - - -class ZoneSettingAlwaysUseHTTPSParam(TypedDict, total=False): - id: Required[Literal["always_use_https"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_automatic_https_rewrites.py b/src/cloudflare/types/zones/settings/zone_setting_automatic_https_rewrites.py deleted file mode 100644 index c6b14fb8df4..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_automatic_https_rewrites.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingAutomaticHTTPSRewrites"] - - -class ZoneSettingAutomaticHTTPSRewrites(BaseModel): - id: Literal["automatic_https_rewrites"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_automatic_https_rewrites_param.py b/src/cloudflare/types/zones/settings/zone_setting_automatic_https_rewrites_param.py deleted file mode 100644 index dada4f53714..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_automatic_https_rewrites_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__ = ["ZoneSettingAutomaticHTTPSRewritesParam"] - - -class ZoneSettingAutomaticHTTPSRewritesParam(TypedDict, total=False): - id: Required[Literal["automatic_https_rewrites"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_automatic_platform_optimization.py b/src/cloudflare/types/zones/settings/zone_setting_automatic_platform_optimization.py deleted file mode 100644 index c36be435288..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_automatic_platform_optimization.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel - -__all__ = ["ZoneSettingAutomaticPlatformOptimization"] - - -class ZoneSettingAutomaticPlatformOptimization(BaseModel): - cache_by_device_type: bool - """ - Indicates whether or not - [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - is enabled. - """ - - cf: bool - """Indicates whether or not Cloudflare proxy is enabled.""" - - enabled: bool - """Indicates whether or not Automatic Platform Optimization is enabled.""" - - hostnames: List[str] - """ - An array of hostnames where Automatic Platform Optimization for WordPress is - activated. - """ - - wordpress: bool - """Indicates whether or not site is powered by WordPress.""" - - wp_plugin: bool - """ - Indicates whether or not - [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - installed. - """ diff --git a/src/cloudflare/types/zones/settings/zone_setting_automatic_platform_optimization_param.py b/src/cloudflare/types/zones/settings/zone_setting_automatic_platform_optimization_param.py deleted file mode 100644 index bcc686bc18d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_automatic_platform_optimization_param.py +++ /dev/null @@ -1,39 +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 Required, TypedDict - -__all__ = ["ZoneSettingAutomaticPlatformOptimizationParam"] - - -class ZoneSettingAutomaticPlatformOptimizationParam(TypedDict, total=False): - cache_by_device_type: Required[bool] - """ - Indicates whether or not - [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - is enabled. - """ - - cf: Required[bool] - """Indicates whether or not Cloudflare proxy is enabled.""" - - enabled: Required[bool] - """Indicates whether or not Automatic Platform Optimization is enabled.""" - - hostnames: Required[List[str]] - """ - An array of hostnames where Automatic Platform Optimization for WordPress is - activated. - """ - - wordpress: Required[bool] - """Indicates whether or not site is powered by WordPress.""" - - wp_plugin: Required[bool] - """ - Indicates whether or not - [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - installed. - """ diff --git a/src/cloudflare/types/zones/settings/zone_setting_brotli.py b/src/cloudflare/types/zones/settings/zone_setting_brotli.py deleted file mode 100644 index 6e9515ab6ef..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_brotli.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingBrotli"] - - -class ZoneSettingBrotli(BaseModel): - id: Literal["brotli"] - """ID of the zone setting.""" - - value: Literal["off", "on"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_brotli_param.py b/src/cloudflare/types/zones/settings/zone_setting_brotli_param.py deleted file mode 100644 index 51031e0d3f5..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_brotli_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__ = ["ZoneSettingBrotliParam"] - - -class ZoneSettingBrotliParam(TypedDict, total=False): - id: Required[Literal["brotli"]] - """ID of the zone setting.""" - - value: Required[Literal["off", "on"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_browser_cache_ttl.py b/src/cloudflare/types/zones/settings/zone_setting_browser_cache_ttl.py deleted file mode 100644 index 6240c2511d7..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_browser_cache_ttl.py +++ /dev/null @@ -1,55 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingBrowserCacheTTL"] - - -class ZoneSettingBrowserCacheTTL(BaseModel): - id: Literal["browser_cache_ttl"] - """ID of the zone setting.""" - - value: Literal[ - 0, - 30, - 60, - 120, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 691200, - 1382400, - 2073600, - 2678400, - 5356800, - 16070400, - 31536000, - ] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_browser_cache_ttl_param.py b/src/cloudflare/types/zones/settings/zone_setting_browser_cache_ttl_param.py deleted file mode 100644 index e88cc4cc66a..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_browser_cache_ttl_param.py +++ /dev/null @@ -1,46 +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__ = ["ZoneSettingBrowserCacheTTLParam"] - - -class ZoneSettingBrowserCacheTTLParam(TypedDict, total=False): - id: Required[Literal["browser_cache_ttl"]] - """ID of the zone setting.""" - - value: Required[ - Literal[ - 0, - 30, - 60, - 120, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 691200, - 1382400, - 2073600, - 2678400, - 5356800, - 16070400, - 31536000, - ] - ] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_browser_check.py b/src/cloudflare/types/zones/settings/zone_setting_browser_check.py deleted file mode 100644 index b02ced91ce1..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_browser_check.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingBrowserCheck"] - - -class ZoneSettingBrowserCheck(BaseModel): - id: Literal["browser_check"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_browser_check_param.py b/src/cloudflare/types/zones/settings/zone_setting_browser_check_param.py deleted file mode 100644 index 5a6c5f3f209..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_browser_check_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__ = ["ZoneSettingBrowserCheckParam"] - - -class ZoneSettingBrowserCheckParam(TypedDict, total=False): - id: Required[Literal["browser_check"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_buffering.py b/src/cloudflare/types/zones/settings/zone_setting_buffering.py deleted file mode 100644 index 6f7ba2ca4ab..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_buffering.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingBuffering"] - - -class ZoneSettingBuffering(BaseModel): - id: Literal["response_buffering"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_buffering_param.py b/src/cloudflare/types/zones/settings/zone_setting_buffering_param.py deleted file mode 100644 index 17a385a19a4..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_buffering_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__ = ["ZoneSettingBufferingParam"] - - -class ZoneSettingBufferingParam(TypedDict, total=False): - id: Required[Literal["response_buffering"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_cache_level.py b/src/cloudflare/types/zones/settings/zone_setting_cache_level.py deleted file mode 100644 index fd9f1bd0a14..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_cache_level.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingCacheLevel"] - - -class ZoneSettingCacheLevel(BaseModel): - id: Literal["cache_level"] - """ID of the zone setting.""" - - value: Literal["aggressive", "basic", "simplified"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_cache_level_param.py b/src/cloudflare/types/zones/settings/zone_setting_cache_level_param.py deleted file mode 100644 index 7261291c5cd..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_cache_level_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__ = ["ZoneSettingCacheLevelParam"] - - -class ZoneSettingCacheLevelParam(TypedDict, total=False): - id: Required[Literal["cache_level"]] - """ID of the zone setting.""" - - value: Required[Literal["aggressive", "basic", "simplified"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_challenge_ttl.py b/src/cloudflare/types/zones/settings/zone_setting_challenge_ttl.py deleted file mode 100644 index b803bef9eb8..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_challenge_ttl.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingChallengeTTL"] - - -class ZoneSettingChallengeTTL(BaseModel): - id: Literal["challenge_ttl"] - """ID of the zone setting.""" - - value: Literal[300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_challenge_ttl_param.py b/src/cloudflare/types/zones/settings/zone_setting_challenge_ttl_param.py deleted file mode 100644 index 0c04152a21d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_challenge_ttl_param.py +++ /dev/null @@ -1,17 +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__ = ["ZoneSettingChallengeTTLParam"] - - -class ZoneSettingChallengeTTLParam(TypedDict, total=False): - id: Required[Literal["challenge_ttl"]] - """ID of the zone setting.""" - - value: Required[ - Literal[300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000] - ] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ciphers.py b/src/cloudflare/types/zones/settings/zone_setting_ciphers.py deleted file mode 100644 index 7c3d9c9f847..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ciphers.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingCiphers"] - - -class ZoneSettingCiphers(BaseModel): - id: Literal["ciphers"] - """ID of the zone setting.""" - - value: List[str] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ciphers_param.py b/src/cloudflare/types/zones/settings/zone_setting_ciphers_param.py deleted file mode 100644 index 4e2c4b1dc5c..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ciphers_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 import List -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["ZoneSettingCiphersParam"] - - -class ZoneSettingCiphersParam(TypedDict, total=False): - id: Required[Literal["ciphers"]] - """ID of the zone setting.""" - - value: Required[List[str]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_development_mode.py b/src/cloudflare/types/zones/settings/zone_setting_development_mode.py deleted file mode 100644 index 74e2376535d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_development_mode.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingDevelopmentMode"] - - -class ZoneSettingDevelopmentMode(BaseModel): - id: Literal["development_mode"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - time_remaining: Optional[float] = None - """ - Value of the zone setting. Notes: The interval (in seconds) from when - development mode expires (positive integer) or last expired (negative integer) - for the domain. If development mode has never been enabled, this value is false. - """ diff --git a/src/cloudflare/types/zones/settings/zone_setting_development_mode_param.py b/src/cloudflare/types/zones/settings/zone_setting_development_mode_param.py deleted file mode 100644 index d19a68448db..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_development_mode_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__ = ["ZoneSettingDevelopmentModeParam"] - - -class ZoneSettingDevelopmentModeParam(TypedDict, total=False): - id: Required[Literal["development_mode"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_early_hints.py b/src/cloudflare/types/zones/settings/zone_setting_early_hints.py deleted file mode 100644 index 81ec9c31569..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_early_hints.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingEarlyHints"] - - -class ZoneSettingEarlyHints(BaseModel): - id: Literal["early_hints"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_early_hints_param.py b/src/cloudflare/types/zones/settings/zone_setting_early_hints_param.py deleted file mode 100644 index fef3800eda5..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_early_hints_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__ = ["ZoneSettingEarlyHintsParam"] - - -class ZoneSettingEarlyHintsParam(TypedDict, total=False): - id: Required[Literal["early_hints"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_email_obfuscation.py b/src/cloudflare/types/zones/settings/zone_setting_email_obfuscation.py deleted file mode 100644 index a30cea80c8f..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_email_obfuscation.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingEmailObfuscation"] - - -class ZoneSettingEmailObfuscation(BaseModel): - id: Literal["email_obfuscation"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_email_obfuscation_param.py b/src/cloudflare/types/zones/settings/zone_setting_email_obfuscation_param.py deleted file mode 100644 index e8a3899b8ba..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_email_obfuscation_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__ = ["ZoneSettingEmailObfuscationParam"] - - -class ZoneSettingEmailObfuscationParam(TypedDict, total=False): - id: Required[Literal["email_obfuscation"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_fonts.py b/src/cloudflare/types/zones/settings/zone_setting_fonts.py deleted file mode 100644 index 4463cc08a78..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_fonts.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingFonts"] - - -class ZoneSettingFonts(BaseModel): - id: Literal["fonts"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_h2_prioritization.py b/src/cloudflare/types/zones/settings/zone_setting_h2_prioritization.py deleted file mode 100644 index 4c457096b37..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_h2_prioritization.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingH2Prioritization"] - - -class ZoneSettingH2Prioritization(BaseModel): - id: Literal["h2_prioritization"] - """ID of the zone setting.""" - - value: Literal["on", "off", "custom"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_h2_prioritization_param.py b/src/cloudflare/types/zones/settings/zone_setting_h2_prioritization_param.py deleted file mode 100644 index 5d20c404271..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_h2_prioritization_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__ = ["ZoneSettingH2PrioritizationParam"] - - -class ZoneSettingH2PrioritizationParam(TypedDict, total=False): - id: Required[Literal["h2_prioritization"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off", "custom"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_hotlink_protection.py b/src/cloudflare/types/zones/settings/zone_setting_hotlink_protection.py deleted file mode 100644 index 1046ff6e793..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_hotlink_protection.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingHotlinkProtection"] - - -class ZoneSettingHotlinkProtection(BaseModel): - id: Literal["hotlink_protection"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_hotlink_protection_param.py b/src/cloudflare/types/zones/settings/zone_setting_hotlink_protection_param.py deleted file mode 100644 index 72c5f4d95a3..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_hotlink_protection_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__ = ["ZoneSettingHotlinkProtectionParam"] - - -class ZoneSettingHotlinkProtectionParam(TypedDict, total=False): - id: Required[Literal["hotlink_protection"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_http2.py b/src/cloudflare/types/zones/settings/zone_setting_http2.py deleted file mode 100644 index 5a5de9d13e8..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_http2.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingHTTP2"] - - -class ZoneSettingHTTP2(BaseModel): - id: Literal["http2"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_http2_param.py b/src/cloudflare/types/zones/settings/zone_setting_http2_param.py deleted file mode 100644 index d50fcd3b769..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_http2_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__ = ["ZoneSettingHTTP2Param"] - - -class ZoneSettingHTTP2Param(TypedDict, total=False): - id: Required[Literal["http2"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_http3.py b/src/cloudflare/types/zones/settings/zone_setting_http3.py deleted file mode 100644 index 2de87134547..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_http3.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingHTTP3"] - - -class ZoneSettingHTTP3(BaseModel): - id: Literal["http3"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_http3_param.py b/src/cloudflare/types/zones/settings/zone_setting_http3_param.py deleted file mode 100644 index 04c78da68c7..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_http3_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__ = ["ZoneSettingHTTP3Param"] - - -class ZoneSettingHTTP3Param(TypedDict, total=False): - id: Required[Literal["http3"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_image_resizing.py b/src/cloudflare/types/zones/settings/zone_setting_image_resizing.py deleted file mode 100644 index 1454491319c..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_image_resizing.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingImageResizing"] - - -class ZoneSettingImageResizing(BaseModel): - id: Literal["image_resizing"] - """ID of the zone setting.""" - - value: Literal["on", "off", "open"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_image_resizing_param.py b/src/cloudflare/types/zones/settings/zone_setting_image_resizing_param.py deleted file mode 100644 index 6de5628ebda..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_image_resizing_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__ = ["ZoneSettingImageResizingParam"] - - -class ZoneSettingImageResizingParam(TypedDict, total=False): - id: Required[Literal["image_resizing"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off", "open"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ip_geolocation.py b/src/cloudflare/types/zones/settings/zone_setting_ip_geolocation.py deleted file mode 100644 index f0d8e581b00..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ip_geolocation.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingIPGeolocation"] - - -class ZoneSettingIPGeolocation(BaseModel): - id: Literal["ip_geolocation"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ip_geolocation_param.py b/src/cloudflare/types/zones/settings/zone_setting_ip_geolocation_param.py deleted file mode 100644 index 083c1db940e..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ip_geolocation_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__ = ["ZoneSettingIPGeolocationParam"] - - -class ZoneSettingIPGeolocationParam(TypedDict, total=False): - id: Required[Literal["ip_geolocation"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ipv6.py b/src/cloudflare/types/zones/settings/zone_setting_ipv6.py deleted file mode 100644 index a2cf8a358b4..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ipv6.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingIPV6"] - - -class ZoneSettingIPV6(BaseModel): - id: Literal["ipv6"] - """ID of the zone setting.""" - - value: Literal["off", "on"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ipv6_param.py b/src/cloudflare/types/zones/settings/zone_setting_ipv6_param.py deleted file mode 100644 index 4053b7bff06..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ipv6_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__ = ["ZoneSettingIPV6Param"] - - -class ZoneSettingIPV6Param(TypedDict, total=False): - id: Required[Literal["ipv6"]] - """ID of the zone setting.""" - - value: Required[Literal["off", "on"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_min_tls_version.py b/src/cloudflare/types/zones/settings/zone_setting_min_tls_version.py deleted file mode 100644 index 67facc86e08..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_min_tls_version.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingMinTLSVersion"] - - -class ZoneSettingMinTLSVersion(BaseModel): - id: Literal["min_tls_version"] - """ID of the zone setting.""" - - value: Literal["1.0", "1.1", "1.2", "1.3"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_min_tls_version_param.py b/src/cloudflare/types/zones/settings/zone_setting_min_tls_version_param.py deleted file mode 100644 index e7cf1d38f71..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_min_tls_version_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__ = ["ZoneSettingMinTLSVersionParam"] - - -class ZoneSettingMinTLSVersionParam(TypedDict, total=False): - id: Required[Literal["min_tls_version"]] - """ID of the zone setting.""" - - value: Required[Literal["1.0", "1.1", "1.2", "1.3"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_minify.py b/src/cloudflare/types/zones/settings/zone_setting_minify.py deleted file mode 100644 index efb415b7712..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_minify.py +++ /dev/null @@ -1,37 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingMinify", "Value"] - - -class Value(BaseModel): - css: Optional[Literal["on", "off"]] = None - """Automatically minify all CSS files for your website.""" - - html: Optional[Literal["on", "off"]] = None - """Automatically minify all HTML files for your website.""" - - js: Optional[Literal["on", "off"]] = None - """Automatically minify all JavaScript files for your website.""" - - -class ZoneSettingMinify(BaseModel): - id: Literal["minify"] - """Zone setting identifier.""" - - value: Value - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_minify_param.py b/src/cloudflare/types/zones/settings/zone_setting_minify_param.py deleted file mode 100644 index f812a1d9ca4..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_minify_param.py +++ /dev/null @@ -1,26 +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__ = ["ZoneSettingMinifyParam", "Value"] - - -class Value(TypedDict, total=False): - css: Literal["on", "off"] - """Automatically minify all CSS files for your website.""" - - html: Literal["on", "off"] - """Automatically minify all HTML files for your website.""" - - js: Literal["on", "off"] - """Automatically minify all JavaScript files for your website.""" - - -class ZoneSettingMinifyParam(TypedDict, total=False): - id: Required[Literal["minify"]] - """Zone setting identifier.""" - - value: Required[Value] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_mirage.py b/src/cloudflare/types/zones/settings/zone_setting_mirage.py deleted file mode 100644 index f6d62586f93..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_mirage.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingMirage"] - - -class ZoneSettingMirage(BaseModel): - id: Literal["mirage"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_mirage_param.py b/src/cloudflare/types/zones/settings/zone_setting_mirage_param.py deleted file mode 100644 index 6a35c1a6510..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_mirage_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__ = ["ZoneSettingMirageParam"] - - -class ZoneSettingMirageParam(TypedDict, total=False): - id: Required[Literal["mirage"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_mobile_redirect.py b/src/cloudflare/types/zones/settings/zone_setting_mobile_redirect.py deleted file mode 100644 index 0e2823aa806..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_mobile_redirect.py +++ /dev/null @@ -1,43 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingMobileRedirect", "Value"] - - -class Value(BaseModel): - mobile_subdomain: Optional[str] = None - """ - Which subdomain prefix you wish to redirect visitors on mobile devices to - (subdomain must already exist). - """ - - status: Optional[Literal["on", "off"]] = None - """Whether or not mobile redirect is enabled.""" - - strip_uri: Optional[bool] = None - """ - Whether to drop the current page path and redirect to the mobile subdomain URL - root, or keep the path and redirect to the same page on the mobile subdomain. - """ - - -class ZoneSettingMobileRedirect(BaseModel): - id: Literal["mobile_redirect"] - """Identifier of the zone setting.""" - - value: Value - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_mobile_redirect_param.py b/src/cloudflare/types/zones/settings/zone_setting_mobile_redirect_param.py deleted file mode 100644 index dd412e92ad5..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_mobile_redirect_param.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["ZoneSettingMobileRedirectParam", "Value"] - - -class Value(TypedDict, total=False): - mobile_subdomain: Optional[str] - """ - Which subdomain prefix you wish to redirect visitors on mobile devices to - (subdomain must already exist). - """ - - status: Literal["on", "off"] - """Whether or not mobile redirect is enabled.""" - - strip_uri: bool - """ - Whether to drop the current page path and redirect to the mobile subdomain URL - root, or keep the path and redirect to the same page on the mobile subdomain. - """ - - -class ZoneSettingMobileRedirectParam(TypedDict, total=False): - id: Required[Literal["mobile_redirect"]] - """Identifier of the zone setting.""" - - value: Required[Value] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_nel.py b/src/cloudflare/types/zones/settings/zone_setting_nel.py deleted file mode 100644 index 949c3684977..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_nel.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 datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingNEL", "Value"] - - -class Value(BaseModel): - enabled: Optional[bool] = None - - -class ZoneSettingNEL(BaseModel): - id: Literal["nel"] - """Zone setting identifier.""" - - value: Value - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_nel_param.py b/src/cloudflare/types/zones/settings/zone_setting_nel_param.py deleted file mode 100644 index 863351497d8..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_nel_param.py +++ /dev/null @@ -1,19 +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__ = ["ZoneSettingNELParam", "Value"] - - -class Value(TypedDict, total=False): - enabled: bool - - -class ZoneSettingNELParam(TypedDict, total=False): - id: Required[Literal["nel"]] - """Zone setting identifier.""" - - value: Required[Value] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_opportunistic_encryption.py b/src/cloudflare/types/zones/settings/zone_setting_opportunistic_encryption.py deleted file mode 100644 index 2f3f067df9c..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_opportunistic_encryption.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingOpportunisticEncryption"] - - -class ZoneSettingOpportunisticEncryption(BaseModel): - id: Literal["opportunistic_encryption"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_opportunistic_encryption_param.py b/src/cloudflare/types/zones/settings/zone_setting_opportunistic_encryption_param.py deleted file mode 100644 index 5d54e34433c..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_opportunistic_encryption_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__ = ["ZoneSettingOpportunisticEncryptionParam"] - - -class ZoneSettingOpportunisticEncryptionParam(TypedDict, total=False): - id: Required[Literal["opportunistic_encryption"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_opportunistic_onion.py b/src/cloudflare/types/zones/settings/zone_setting_opportunistic_onion.py deleted file mode 100644 index 224a12945cb..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_opportunistic_onion.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingOpportunisticOnion"] - - -class ZoneSettingOpportunisticOnion(BaseModel): - id: Literal["opportunistic_onion"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_opportunistic_onion_param.py b/src/cloudflare/types/zones/settings/zone_setting_opportunistic_onion_param.py deleted file mode 100644 index 4d20469de98..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_opportunistic_onion_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__ = ["ZoneSettingOpportunisticOnionParam"] - - -class ZoneSettingOpportunisticOnionParam(TypedDict, total=False): - id: Required[Literal["opportunistic_onion"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_orange_to_orange.py b/src/cloudflare/types/zones/settings/zone_setting_orange_to_orange.py deleted file mode 100644 index 1f0912d04bd..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_orange_to_orange.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingOrangeToOrange"] - - -class ZoneSettingOrangeToOrange(BaseModel): - id: Literal["orange_to_orange"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_orange_to_orange_param.py b/src/cloudflare/types/zones/settings/zone_setting_orange_to_orange_param.py deleted file mode 100644 index 4628db5b90d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_orange_to_orange_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__ = ["ZoneSettingOrangeToOrangeParam"] - - -class ZoneSettingOrangeToOrangeParam(TypedDict, total=False): - id: Required[Literal["orange_to_orange"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_origin_error_page_pass_thru.py b/src/cloudflare/types/zones/settings/zone_setting_origin_error_page_pass_thru.py deleted file mode 100644 index 47751d84e3a..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_origin_error_page_pass_thru.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingOriginErrorPagePassThru"] - - -class ZoneSettingOriginErrorPagePassThru(BaseModel): - id: Literal["origin_error_page_pass_thru"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_origin_error_page_pass_thru_param.py b/src/cloudflare/types/zones/settings/zone_setting_origin_error_page_pass_thru_param.py deleted file mode 100644 index b78f43e801a..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_origin_error_page_pass_thru_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__ = ["ZoneSettingOriginErrorPagePassThruParam"] - - -class ZoneSettingOriginErrorPagePassThruParam(TypedDict, total=False): - id: Required[Literal["origin_error_page_pass_thru"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_polish.py b/src/cloudflare/types/zones/settings/zone_setting_polish.py deleted file mode 100644 index f3209e0bd7d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_polish.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingPolish"] - - -class ZoneSettingPolish(BaseModel): - id: Literal["polish"] - """ID of the zone setting.""" - - value: Literal["off", "lossless", "lossy"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_polish_param.py b/src/cloudflare/types/zones/settings/zone_setting_polish_param.py deleted file mode 100644 index 5b66bb60ac3..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_polish_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__ = ["ZoneSettingPolishParam"] - - -class ZoneSettingPolishParam(TypedDict, total=False): - id: Required[Literal["polish"]] - """ID of the zone setting.""" - - value: Required[Literal["off", "lossless", "lossy"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_prefetch_preload.py b/src/cloudflare/types/zones/settings/zone_setting_prefetch_preload.py deleted file mode 100644 index a92fe806ecd..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_prefetch_preload.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingPrefetchPreload"] - - -class ZoneSettingPrefetchPreload(BaseModel): - id: Literal["prefetch_preload"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_prefetch_preload_param.py b/src/cloudflare/types/zones/settings/zone_setting_prefetch_preload_param.py deleted file mode 100644 index 4588c815a34..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_prefetch_preload_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__ = ["ZoneSettingPrefetchPreloadParam"] - - -class ZoneSettingPrefetchPreloadParam(TypedDict, total=False): - id: Required[Literal["prefetch_preload"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_proxy_read_timeout.py b/src/cloudflare/types/zones/settings/zone_setting_proxy_read_timeout.py deleted file mode 100644 index ab9f562a168..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_proxy_read_timeout.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingProxyReadTimeout"] - - -class ZoneSettingProxyReadTimeout(BaseModel): - id: Literal["proxy_read_timeout"] - """ID of the zone setting.""" - - value: float - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_proxy_read_timeout_param.py b/src/cloudflare/types/zones/settings/zone_setting_proxy_read_timeout_param.py deleted file mode 100644 index a555a87da22..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_proxy_read_timeout_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__ = ["ZoneSettingProxyReadTimeoutParam"] - - -class ZoneSettingProxyReadTimeoutParam(TypedDict, total=False): - id: Required[Literal["proxy_read_timeout"]] - """ID of the zone setting.""" - - value: Required[float] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_pseudo_ipv4.py b/src/cloudflare/types/zones/settings/zone_setting_pseudo_ipv4.py deleted file mode 100644 index 81e5172f55a..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_pseudo_ipv4.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingPseudoIPV4"] - - -class ZoneSettingPseudoIPV4(BaseModel): - id: Literal["pseudo_ipv4"] - """Value of the Pseudo IPv4 setting.""" - - value: Literal["off", "add_header", "overwrite_header"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_pseudo_ipv4_param.py b/src/cloudflare/types/zones/settings/zone_setting_pseudo_ipv4_param.py deleted file mode 100644 index 947aa8bfa5d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_pseudo_ipv4_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__ = ["ZoneSettingPseudoIPV4Param"] - - -class ZoneSettingPseudoIPV4Param(TypedDict, total=False): - id: Required[Literal["pseudo_ipv4"]] - """Value of the Pseudo IPv4 setting.""" - - value: Required[Literal["off", "add_header", "overwrite_header"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_rocket_loader.py b/src/cloudflare/types/zones/settings/zone_setting_rocket_loader.py deleted file mode 100644 index 4d0d5404a77..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_rocket_loader.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingRocketLoader"] - - -class ZoneSettingRocketLoader(BaseModel): - id: Literal["rocket_loader"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_rocket_loader_param.py b/src/cloudflare/types/zones/settings/zone_setting_rocket_loader_param.py deleted file mode 100644 index deed2713e41..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_rocket_loader_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__ = ["ZoneSettingRocketLoaderParam"] - - -class ZoneSettingRocketLoaderParam(TypedDict, total=False): - id: Required[Literal["rocket_loader"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_security_header.py b/src/cloudflare/types/zones/settings/zone_setting_security_header.py deleted file mode 100644 index 5da19ea926a..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_security_header.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingSecurityHeader", "Value", "ValueStrictTransportSecurity"] - - -class ValueStrictTransportSecurity(BaseModel): - enabled: Optional[bool] = None - """Whether or not strict transport security is enabled.""" - - include_subdomains: Optional[bool] = None - """Include all subdomains for strict transport security.""" - - max_age: Optional[float] = None - """Max age in seconds of the strict transport security.""" - - nosniff: Optional[bool] = None - """Whether or not to include 'X-Content-Type-Options: nosniff' header.""" - - -class Value(BaseModel): - strict_transport_security: Optional[ValueStrictTransportSecurity] = None - """Strict Transport Security.""" - - -class ZoneSettingSecurityHeader(BaseModel): - id: Literal["security_header"] - """ID of the zone's security header.""" - - value: Value - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_security_header_param.py b/src/cloudflare/types/zones/settings/zone_setting_security_header_param.py deleted file mode 100644 index f3ae4d8ddfc..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_security_header_param.py +++ /dev/null @@ -1,34 +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__ = ["ZoneSettingSecurityHeaderParam", "Value", "ValueStrictTransportSecurity"] - - -class ValueStrictTransportSecurity(TypedDict, total=False): - enabled: bool - """Whether or not strict transport security is enabled.""" - - include_subdomains: bool - """Include all subdomains for strict transport security.""" - - max_age: float - """Max age in seconds of the strict transport security.""" - - nosniff: bool - """Whether or not to include 'X-Content-Type-Options: nosniff' header.""" - - -class Value(TypedDict, total=False): - strict_transport_security: ValueStrictTransportSecurity - """Strict Transport Security.""" - - -class ZoneSettingSecurityHeaderParam(TypedDict, total=False): - id: Required[Literal["security_header"]] - """ID of the zone's security header.""" - - value: Required[Value] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_security_level.py b/src/cloudflare/types/zones/settings/zone_setting_security_level.py deleted file mode 100644 index 23079ae5b14..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_security_level.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingSecurityLevel"] - - -class ZoneSettingSecurityLevel(BaseModel): - id: Literal["security_level"] - """ID of the zone setting.""" - - value: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_security_level_param.py b/src/cloudflare/types/zones/settings/zone_setting_security_level_param.py deleted file mode 100644 index fae5fca9c08..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_security_level_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__ = ["ZoneSettingSecurityLevelParam"] - - -class ZoneSettingSecurityLevelParam(TypedDict, total=False): - id: Required[Literal["security_level"]] - """ID of the zone setting.""" - - value: Required[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_server_side_exclude.py b/src/cloudflare/types/zones/settings/zone_setting_server_side_exclude.py deleted file mode 100644 index afcb204ae3d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_server_side_exclude.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingServerSideExclude"] - - -class ZoneSettingServerSideExclude(BaseModel): - id: Literal["server_side_exclude"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_server_side_exclude_param.py b/src/cloudflare/types/zones/settings/zone_setting_server_side_exclude_param.py deleted file mode 100644 index 6a95d138f5a..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_server_side_exclude_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__ = ["ZoneSettingServerSideExcludeParam"] - - -class ZoneSettingServerSideExcludeParam(TypedDict, total=False): - id: Required[Literal["server_side_exclude"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_sort_query_string_for_cache.py b/src/cloudflare/types/zones/settings/zone_setting_sort_query_string_for_cache.py deleted file mode 100644 index cd70a12f554..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_sort_query_string_for_cache.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingSortQueryStringForCache"] - - -class ZoneSettingSortQueryStringForCache(BaseModel): - id: Literal["sort_query_string_for_cache"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_sort_query_string_for_cache_param.py b/src/cloudflare/types/zones/settings/zone_setting_sort_query_string_for_cache_param.py deleted file mode 100644 index 212bdcdffb4..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_sort_query_string_for_cache_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__ = ["ZoneSettingSortQueryStringForCacheParam"] - - -class ZoneSettingSortQueryStringForCacheParam(TypedDict, total=False): - id: Required[Literal["sort_query_string_for_cache"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ssl.py b/src/cloudflare/types/zones/settings/zone_setting_ssl.py deleted file mode 100644 index 59fde7f0bb3..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ssl.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingSSL"] - - -class ZoneSettingSSL(BaseModel): - id: Literal["ssl"] - """ID of the zone setting.""" - - value: Literal["off", "flexible", "full", "strict"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ssl_param.py b/src/cloudflare/types/zones/settings/zone_setting_ssl_param.py deleted file mode 100644 index 3737c7ee4c8..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ssl_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__ = ["ZoneSettingSSLParam"] - - -class ZoneSettingSSLParam(TypedDict, total=False): - id: Required[Literal["ssl"]] - """ID of the zone setting.""" - - value: Required[Literal["off", "flexible", "full", "strict"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ssl_recommender.py b/src/cloudflare/types/zones/settings/zone_setting_ssl_recommender.py deleted file mode 100644 index f6daa585189..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ssl_recommender.py +++ /dev/null @@ -1,16 +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__ = ["ZoneSettingSSLRecommender"] - - -class ZoneSettingSSLRecommender(BaseModel): - id: Optional[Literal["ssl_recommender"]] = None - """Enrollment value for SSL/TLS Recommender.""" - - enabled: Optional[bool] = None - """ssl-recommender enrollment setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_ssl_recommender_param.py b/src/cloudflare/types/zones/settings/zone_setting_ssl_recommender_param.py deleted file mode 100644 index 7be93660ca4..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_ssl_recommender_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, TypedDict - -__all__ = ["ZoneSettingSSLRecommenderParam"] - - -class ZoneSettingSSLRecommenderParam(TypedDict, total=False): - id: Literal["ssl_recommender"] - """Enrollment value for SSL/TLS Recommender.""" - - enabled: bool - """ssl-recommender enrollment setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_tls_1_3.py b/src/cloudflare/types/zones/settings/zone_setting_tls_1_3.py deleted file mode 100644 index 358da89a923..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_tls_1_3.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingTLS1_3"] - - -class ZoneSettingTLS1_3(BaseModel): - id: Literal["tls_1_3"] - """ID of the zone setting.""" - - value: Literal["on", "off", "zrt"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_tls_1_3_param.py b/src/cloudflare/types/zones/settings/zone_setting_tls_1_3_param.py deleted file mode 100644 index d20c15d5bfb..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_tls_1_3_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__ = ["ZoneSettingTLS1_3Param"] - - -class ZoneSettingTLS1_3Param(TypedDict, total=False): - id: Required[Literal["tls_1_3"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off", "zrt"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_tls_client_auth.py b/src/cloudflare/types/zones/settings/zone_setting_tls_client_auth.py deleted file mode 100644 index f0e6b95ec4c..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_tls_client_auth.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingTLSClientAuth"] - - -class ZoneSettingTLSClientAuth(BaseModel): - id: Literal["tls_client_auth"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_tls_client_auth_param.py b/src/cloudflare/types/zones/settings/zone_setting_tls_client_auth_param.py deleted file mode 100644 index 289a202f08d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_tls_client_auth_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__ = ["ZoneSettingTLSClientAuthParam"] - - -class ZoneSettingTLSClientAuthParam(TypedDict, total=False): - id: Required[Literal["tls_client_auth"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_true_client_ip_header.py b/src/cloudflare/types/zones/settings/zone_setting_true_client_ip_header.py deleted file mode 100644 index f9a885775b1..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_true_client_ip_header.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingTrueClientIPHeader"] - - -class ZoneSettingTrueClientIPHeader(BaseModel): - id: Literal["true_client_ip_header"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_true_client_ip_header_param.py b/src/cloudflare/types/zones/settings/zone_setting_true_client_ip_header_param.py deleted file mode 100644 index ea4ebe080bf..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_true_client_ip_header_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__ = ["ZoneSettingTrueClientIPHeaderParam"] - - -class ZoneSettingTrueClientIPHeaderParam(TypedDict, total=False): - id: Required[Literal["true_client_ip_header"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_waf.py b/src/cloudflare/types/zones/settings/zone_setting_waf.py deleted file mode 100644 index 807977534a3..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_waf.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingWAF"] - - -class ZoneSettingWAF(BaseModel): - id: Literal["waf"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_waf_param.py b/src/cloudflare/types/zones/settings/zone_setting_waf_param.py deleted file mode 100644 index bbd479b146d..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_waf_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__ = ["ZoneSettingWAFParam"] - - -class ZoneSettingWAFParam(TypedDict, total=False): - id: Required[Literal["waf"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_webp.py b/src/cloudflare/types/zones/settings/zone_setting_webp.py deleted file mode 100644 index 35a3bb58b40..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_webp.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingWebP"] - - -class ZoneSettingWebP(BaseModel): - id: Literal["webp"] - """ID of the zone setting.""" - - value: Literal["off", "on"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_webp_param.py b/src/cloudflare/types/zones/settings/zone_setting_webp_param.py deleted file mode 100644 index 45147aa2f27..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_webp_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__ = ["ZoneSettingWebPParam"] - - -class ZoneSettingWebPParam(TypedDict, total=False): - id: Required[Literal["webp"]] - """ID of the zone setting.""" - - value: Required[Literal["off", "on"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_websockets.py b/src/cloudflare/types/zones/settings/zone_setting_websockets.py deleted file mode 100644 index 6faa560ef95..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_websockets.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ZoneSettingWebsockets"] - - -class ZoneSettingWebsockets(BaseModel): - id: Literal["websockets"] - """ID of the zone setting.""" - - value: Literal["off", "on"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/zone_setting_websockets_param.py b/src/cloudflare/types/zones/settings/zone_setting_websockets_param.py deleted file mode 100644 index ab2fdbbc8ac..00000000000 --- a/src/cloudflare/types/zones/settings/zone_setting_websockets_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__ = ["ZoneSettingWebsocketsParam"] - - -class ZoneSettingWebsocketsParam(TypedDict, total=False): - id: Required[Literal["websockets"]] - """ID of the zone setting.""" - - value: Required[Literal["off", "on"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/subscription_create_params.py b/src/cloudflare/types/zones/subscription_create_params.py index b345c7a8b90..362a204da34 100644 --- a/src/cloudflare/types/zones/subscription_create_params.py +++ b/src/cloudflare/types/zones/subscription_create_params.py @@ -2,69 +2,32 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import Literal, TypedDict -__all__ = ["SubscriptionCreateParams", "App", "ComponentValue", "RatePlan", "Zone"] +from ..user.rate_plan_param import RatePlanParam +from ..user.subscription_zone_param import SubscriptionZoneParam +from ..user.subscription_component_param import SubscriptionComponentParam + +__all__ = ["SubscriptionCreateParams", "App"] class SubscriptionCreateParams(TypedDict, total=False): app: App - component_values: Iterable[ComponentValue] + component_values: Iterable[SubscriptionComponentParam] """The list of add-ons subscribed to.""" frequency: Literal["weekly", "monthly", "quarterly", "yearly"] """How often the subscription is renewed automatically.""" - rate_plan: RatePlan + rate_plan: RatePlanParam """The rate plan applied to the subscription.""" - zone: Zone + zone: SubscriptionZoneParam """A simple zone object. May have null properties if not a zone subscription.""" class App(TypedDict, total=False): install_id: str """app install id.""" - - -class ComponentValue(TypedDict, total=False): - default: float - """The default amount assigned.""" - - name: str - """The name of the component value.""" - - price: float - """The unit price for the component value.""" - - value: float - """The amount of the component value assigned.""" - - -class RatePlan(TypedDict, total=False): - id: str - """The ID of the rate plan.""" - - currency: str - """The currency applied to the rate plan subscription.""" - - externally_managed: bool - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: bool - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: str - """The full name of the rate plan.""" - - scope: str - """The scope that this rate plan applies to.""" - - sets: List[str] - """The list of sets this rate plan applies to.""" - - -class Zone(TypedDict, total=False): - pass diff --git a/src/cloudflare/types/zones/subscription_list_response.py b/src/cloudflare/types/zones/subscription_list_response.py deleted file mode 100644 index 7ba0172a53f..00000000000 --- a/src/cloudflare/types/zones/subscription_list_response.py +++ /dev/null @@ -1,96 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["SubscriptionListResponse", "App", "ComponentValue", "RatePlan", "Zone"] - - -class App(BaseModel): - install_id: Optional[str] = None - """app install id.""" - - -class ComponentValue(BaseModel): - default: Optional[float] = None - """The default amount assigned.""" - - name: Optional[str] = None - """The name of the component value.""" - - price: Optional[float] = None - """The unit price for the component value.""" - - value: Optional[float] = None - """The amount of the component value assigned.""" - - -class RatePlan(BaseModel): - id: Optional[str] = None - """The ID of the rate plan.""" - - currency: Optional[str] = None - """The currency applied to the rate plan subscription.""" - - externally_managed: Optional[bool] = None - """Whether this rate plan is managed externally from Cloudflare.""" - - is_contract: Optional[bool] = None - """Whether a rate plan is enterprise-based (or newly adopted term contract).""" - - public_name: Optional[str] = None - """The full name of the rate plan.""" - - scope: Optional[str] = None - """The scope that this rate plan applies to.""" - - sets: Optional[List[str]] = None - """The list of sets this rate plan applies to.""" - - -class Zone(BaseModel): - id: Optional[str] = None - """Identifier""" - - name: Optional[str] = None - """The domain name""" - - -class SubscriptionListResponse(BaseModel): - id: Optional[str] = None - """Subscription identifier tag.""" - - app: Optional[App] = None - - component_values: Optional[List[ComponentValue]] = None - """The list of add-ons subscribed to.""" - - currency: Optional[str] = None - """The monetary unit in which pricing information is displayed.""" - - current_period_end: Optional[datetime] = None - """The end of the current period and also when the next billing is due.""" - - current_period_start: Optional[datetime] = None - """When the current billing period started. - - May match initial_period_start if this is the first period. - """ - - frequency: Optional[Literal["weekly", "monthly", "quarterly", "yearly"]] = None - """How often the subscription is renewed automatically.""" - - price: Optional[float] = None - """The price of the subscription that will be billed, in US dollars.""" - - rate_plan: Optional[RatePlan] = None - """The rate plan applied to the subscription.""" - - state: Optional[Literal["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]] = None - """The state that the subscription is in.""" - - zone: Optional[Zone] = None - """A simple zone object. May have null properties if not a zone subscription.""" diff --git a/src/cloudflare/types/zones/workers/__init__.py b/src/cloudflare/types/zones/workers/__init__.py deleted file mode 100644 index 8088e77b6c9..00000000000 --- a/src/cloudflare/types/zones/workers/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .script_update_response import ScriptUpdateResponse as ScriptUpdateResponse diff --git a/src/cloudflare/types/zones/workers/script_update_response.py b/src/cloudflare/types/zones/workers/script_update_response.py deleted file mode 100644 index 969aa308536..00000000000 --- a/src/cloudflare/types/zones/workers/script_update_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union - -__all__ = ["ScriptUpdateResponse"] - -ScriptUpdateResponse = Union[str, object] diff --git a/src/cloudflare/types/zone.py b/src/cloudflare/types/zones/zone.py similarity index 98% rename from src/cloudflare/types/zone.py rename to src/cloudflare/types/zones/zone.py index d32a80cf5a6..74e8da2e9ef 100644 --- a/src/cloudflare/types/zone.py +++ b/src/cloudflare/types/zones/zone.py @@ -3,7 +3,7 @@ from typing import List, Optional from datetime import datetime -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["Zone", "Account", "Meta", "Owner"] diff --git a/src/cloudflare/types/zone_create_params.py b/src/cloudflare/types/zones/zone_create_params.py similarity index 100% rename from src/cloudflare/types/zone_create_params.py rename to src/cloudflare/types/zones/zone_create_params.py diff --git a/src/cloudflare/types/zone_delete_response.py b/src/cloudflare/types/zones/zone_delete_response.py similarity index 85% rename from src/cloudflare/types/zone_delete_response.py rename to src/cloudflare/types/zones/zone_delete_response.py index b18810c4606..8c55f4a3e09 100644 --- a/src/cloudflare/types/zone_delete_response.py +++ b/src/cloudflare/types/zones/zone_delete_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["ZoneDeleteResponse"] diff --git a/src/cloudflare/types/zone_edit_params.py b/src/cloudflare/types/zones/zone_edit_params.py similarity index 100% rename from src/cloudflare/types/zone_edit_params.py rename to src/cloudflare/types/zones/zone_edit_params.py diff --git a/src/cloudflare/types/zones/zone_hold.py b/src/cloudflare/types/zones/zone_hold.py new file mode 100644 index 00000000000..d56375bbb94 --- /dev/null +++ b/src/cloudflare/types/zones/zone_hold.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__ = ["ZoneHold"] + + +class ZoneHold(BaseModel): + hold: Optional[bool] = None + + hold_after: Optional[str] = None + + include_subdomains: Optional[str] = None diff --git a/src/cloudflare/types/zone_list_params.py b/src/cloudflare/types/zones/zone_list_params.py similarity index 100% rename from src/cloudflare/types/zone_list_params.py rename to src/cloudflare/types/zones/zone_list_params.py diff --git a/src/cloudflare/types/zones_pagerule.py b/src/cloudflare/types/zones_pagerule.py deleted file mode 100644 index 2a6f1eb0d64..00000000000 --- a/src/cloudflare/types/zones_pagerule.py +++ /dev/null @@ -1,83 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["ZonesPagerule", "Action", "ActionValue", "Target", "TargetConstraint"] - - -class ActionValue(BaseModel): - type: Optional[Literal["temporary", "permanent"]] = None - """The response type for the URL redirect.""" - - url: Optional[str] = None - """ - The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' - in the constraint value. - """ - - -class Action(BaseModel): - modified_on: Optional[datetime] = None - """The timestamp of when the override was last modified.""" - - name: Optional[Literal["forward_url"]] = None - """The type of route.""" - - value: Optional[ActionValue] = None - - -class TargetConstraint(BaseModel): - operator: Literal["matches", "contains", "equals", "not_equal", "not_contain"] - """ - The matches operator can use asterisks and pipes as wildcard and 'or' operators. - """ - - value: str - """The URL pattern to match against the current request. - - The pattern may contain up to four asterisks ('\\**') as placeholders. - """ - - -class Target(BaseModel): - constraint: TargetConstraint - """String constraint.""" - - target: Literal["url"] - """A target based on the URL of the request.""" - - -class ZonesPagerule(BaseModel): - id: str - """Identifier""" - - actions: List[Action] - """The set of actions to perform if the targets of this rule match the request. - - Actions can redirect to another URL or override settings, but not both. - """ - - created_on: datetime - """The timestamp of when the Page Rule was created.""" - - modified_on: datetime - """The timestamp of when the Page Rule was last modified.""" - - priority: int - """ - The priority of the rule, used to define which Page Rule is processed over - another. A higher number indicates a higher priority. For example, if you have a - catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to - take precedence (rule B: `/images/special/*`), specify a higher priority for - rule B so it overrides rule A. - """ - - status: Literal["active", "disabled"] - """The status of the Page Rule.""" - - targets: List[Target] - """The rule targets to evaluate on each request.""" diff --git a/tests/api_resources/accounts/test_members.py b/tests/api_resources/accounts/test_members.py index 43b22608ca2..9aa9ad36804 100644 --- a/tests/api_resources/accounts/test_members.py +++ b/tests/api_resources/accounts/test_members.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.accounts import ( - AccountMember, - MemberListResponse, - AccountMemberWithID, - MemberDeleteResponse, -) +from cloudflare.types.shared.member import Member +from cloudflare.types.accounts.member_list_response import MemberListResponse +from cloudflare.types.accounts.user_with_invite_code import UserWithInviteCode +from cloudflare.types.accounts.member_delete_response import MemberDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -35,7 +33,7 @@ def test_method_create(self, client: Cloudflare) -> None: "3536bcfad5faccb999b47003c79917fb", ], ) - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(UserWithInviteCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +48,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ], status="accepted", ) - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(UserWithInviteCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +66,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" member = response.parse() - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(UserWithInviteCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +84,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(UserWithInviteCode, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -102,7 +100,7 @@ def test_method_update(self, client: Cloudflare) -> None: {"id": "3536bcfad5faccb999b47003c79917fb"}, ], ) - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -120,7 +118,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +136,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,6 +207,7 @@ def test_method_delete(self, client: Cloudflare) -> None: member = client.accounts.members.delete( "4536bcfad5faccb111b47003c79917fa", account_id={}, + body={}, ) assert_matches_type(Optional[MemberDeleteResponse], member, path=["response"]) @@ -218,6 +217,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.accounts.members.with_raw_response.delete( "4536bcfad5faccb111b47003c79917fa", account_id={}, + body={}, ) assert response.is_closed is True @@ -231,6 +231,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.accounts.members.with_streaming_response.delete( "4536bcfad5faccb111b47003c79917fa", account_id={}, + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -247,6 +248,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.accounts.members.with_raw_response.delete( "", account_id={}, + body={}, ) @pytest.mark.skip() @@ -256,7 +258,7 @@ def test_method_get(self, client: Cloudflare) -> None: "4536bcfad5faccb111b47003c79917fa", account_id={}, ) - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -269,7 +271,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" member = response.parse() - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -282,7 +284,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -311,7 +313,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "3536bcfad5faccb999b47003c79917fb", ], ) - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(UserWithInviteCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +328,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ], status="accepted", ) - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(UserWithInviteCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -344,7 +346,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" member = await response.parse() - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(UserWithInviteCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +364,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(UserWithInviteCode, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -378,7 +380,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: {"id": "3536bcfad5faccb999b47003c79917fb"}, ], ) - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -396,7 +398,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -414,7 +416,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -485,6 +487,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: member = await async_client.accounts.members.delete( "4536bcfad5faccb111b47003c79917fa", account_id={}, + body={}, ) assert_matches_type(Optional[MemberDeleteResponse], member, path=["response"]) @@ -494,6 +497,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.members.with_raw_response.delete( "4536bcfad5faccb111b47003c79917fa", account_id={}, + body={}, ) assert response.is_closed is True @@ -507,6 +511,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.accounts.members.with_streaming_response.delete( "4536bcfad5faccb111b47003c79917fa", account_id={}, + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -523,6 +528,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.accounts.members.with_raw_response.delete( "", account_id={}, + body={}, ) @pytest.mark.skip() @@ -532,7 +538,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "4536bcfad5faccb111b47003c79917fa", account_id={}, ) - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -545,7 +551,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" member = await response.parse() - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -558,7 +564,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/accounts/test_roles.py b/tests/api_resources/accounts/test_roles.py index 53121acc6ff..0012acf6de2 100644 --- a/tests/api_resources/accounts/test_roles.py +++ b/tests/api_resources/accounts/test_roles.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.accounts import Role, RoleGetResponse +from cloudflare.types.shared.role import Role +from cloudflare.types.accounts.role_get_response import RoleGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/acm/test_total_tls.py b/tests/api_resources/acm/test_total_tls.py index 1f0db8a87a6..252f2eeaeaf 100644 --- a/tests/api_resources/acm/test_total_tls.py +++ b/tests/api_resources/acm/test_total_tls.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.acm import TotalTLSGetResponse, TotalTLSCreateResponse +from cloudflare.types.acm.total_tls_get_response import TotalTLSGetResponse +from cloudflare.types.acm.total_tls_create_response import TotalTLSCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/addressing/address_maps/test_accounts.py b/tests/api_resources/addressing/address_maps/test_accounts.py index 08b9ff080cf..78926097266 100644 --- a/tests/api_resources/addressing/address_maps/test_accounts.py +++ b/tests/api_resources/addressing/address_maps/test_accounts.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.addressing.address_maps import AccountDeleteResponse, AccountUpdateResponse +from cloudflare.types.addressing.address_maps.account_delete_response import AccountDeleteResponse +from cloudflare.types.addressing.address_maps.account_update_response import AccountUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,6 +24,7 @@ def test_method_update(self, client: Cloudflare) -> None: account = client.addressing.address_maps.accounts.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[AccountUpdateResponse], account, path=["response"]) @@ -32,6 +34,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: response = client.addressing.address_maps.accounts.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -45,6 +48,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: with client.addressing.address_maps.accounts.with_streaming_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -61,12 +65,14 @@ def test_path_params_update(self, client: Cloudflare) -> None: client.addressing.address_maps.accounts.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) 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( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -75,6 +81,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account = client.addressing.address_maps.accounts.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[AccountDeleteResponse], account, path=["response"]) @@ -84,6 +91,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.address_maps.accounts.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -97,6 +105,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.address_maps.accounts.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -113,12 +122,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.addressing.address_maps.accounts.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) 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( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @@ -131,6 +142,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account = await async_client.addressing.address_maps.accounts.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[AccountUpdateResponse], account, path=["response"]) @@ -140,6 +152,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.accounts.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -153,6 +166,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> async with async_client.addressing.address_maps.accounts.with_streaming_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -169,12 +183,14 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: await async_client.addressing.address_maps.accounts.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) 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( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -183,6 +199,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account = await async_client.addressing.address_maps.accounts.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[AccountDeleteResponse], account, path=["response"]) @@ -192,6 +209,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.accounts.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -205,6 +223,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.addressing.address_maps.accounts.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -221,10 +240,12 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.addressing.address_maps.accounts.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) 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( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) diff --git a/tests/api_resources/addressing/address_maps/test_ips.py b/tests/api_resources/addressing/address_maps/test_ips.py index 834f7e4a021..f7d5578d9b9 100644 --- a/tests/api_resources/addressing/address_maps/test_ips.py +++ b/tests/api_resources/addressing/address_maps/test_ips.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.addressing.address_maps import IPDeleteResponse, IPUpdateResponse +from cloudflare.types.addressing.address_maps.ip_delete_response import IPDeleteResponse +from cloudflare.types.addressing.address_maps.ip_update_response import IPUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,6 +25,7 @@ def test_method_update(self, client: Cloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[IPUpdateResponse], ip, path=["response"]) @@ -34,6 +36,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -48,6 +51,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -65,6 +69,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: "192.0.2.1", account_id="", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): @@ -72,6 +77,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_address` but received ''"): @@ -79,6 +85,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -88,6 +95,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[IPDeleteResponse], ip, path=["response"]) @@ -98,6 +106,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -112,6 +121,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -129,6 +139,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "192.0.2.1", account_id="", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): @@ -136,6 +147,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_address` but received ''"): @@ -143,6 +155,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @@ -156,6 +169,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[IPUpdateResponse], ip, path=["response"]) @@ -166,6 +180,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -180,6 +195,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -197,6 +213,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "192.0.2.1", account_id="", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): @@ -204,6 +221,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_address` but received ''"): @@ -211,6 +229,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -220,6 +239,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[IPDeleteResponse], ip, path=["response"]) @@ -230,6 +250,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -244,6 +265,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -261,6 +283,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "192.0.2.1", account_id="", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): @@ -268,6 +291,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "192.0.2.1", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_address` but received ''"): @@ -275,4 +299,5 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", address_map_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) diff --git a/tests/api_resources/addressing/address_maps/test_zones.py b/tests/api_resources/addressing/address_maps/test_zones.py index 20cd76f7245..0d555264b02 100644 --- a/tests/api_resources/addressing/address_maps/test_zones.py +++ b/tests/api_resources/addressing/address_maps/test_zones.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.addressing.address_maps import ZoneDeleteResponse, ZoneUpdateResponse +from cloudflare.types.addressing.address_maps.zone_delete_response import ZoneDeleteResponse +from cloudflare.types.addressing.address_maps.zone_update_response import ZoneUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,6 +25,7 @@ def test_method_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[ZoneUpdateResponse], zone, path=["response"]) @@ -34,6 +36,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -48,6 +51,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -65,6 +69,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -72,6 +77,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): @@ -79,6 +85,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -88,6 +95,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[ZoneDeleteResponse], zone, path=["response"]) @@ -98,6 +106,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -112,6 +121,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -129,6 +139,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -136,6 +147,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): @@ -143,6 +155,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @@ -156,6 +169,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[ZoneUpdateResponse], zone, path=["response"]) @@ -166,6 +180,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -180,6 +195,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -197,6 +213,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -204,6 +221,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): @@ -211,6 +229,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -220,6 +239,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[ZoneDeleteResponse], zone, path=["response"]) @@ -230,6 +250,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -244,6 +265,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -261,6 +283,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -268,6 +291,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `address_map_id` but received ''"): @@ -275,4 +299,5 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) diff --git a/tests/api_resources/addressing/prefixes/bgp/test_bindings.py b/tests/api_resources/addressing/prefixes/bgp/test_bindings.py index d73e8c6eb13..3d1dc415316 100644 --- a/tests/api_resources/addressing/prefixes/bgp/test_bindings.py +++ b/tests/api_resources/addressing/prefixes/bgp/test_bindings.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.addressing.prefixes.bgp import ( - BindingDeleteResponse, - AddressingServiceBinding, -) +from cloudflare.types.addressing.prefixes.bgp.service_binding import ServiceBinding +from cloudflare.types.addressing.prefixes.bgp.binding_delete_response import BindingDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: cidr="192.0.2.0/24", service_id="2db684ee7ca04e159946fd05b99e1bcd", ) - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -52,7 +50,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" binding = response.parse() - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -65,7 +63,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -91,7 +89,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[AddressingServiceBinding], binding, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +102,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(SyncSinglePage[AddressingServiceBinding], binding, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +115,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(SyncSinglePage[AddressingServiceBinding], binding, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -208,7 +206,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -222,7 +220,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" binding = response.parse() - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -236,7 +234,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -275,7 +273,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -286,7 +284,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare cidr="192.0.2.0/24", service_id="2db684ee7ca04e159946fd05b99e1bcd", ) - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -299,7 +297,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" binding = await response.parse() - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -312,7 +310,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -338,7 +336,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[AddressingServiceBinding], binding, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -351,7 +349,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingServiceBinding], binding, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -364,7 +362,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingServiceBinding], binding, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -455,7 +453,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -469,7 +467,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" binding = await response.parse() - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -483,7 +481,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(AddressingServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py b/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py index 48beb73c29d..ce4a9a2793e 100644 --- a/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py +++ b/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py @@ -3,14 +3,14 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.addressing.prefixes.bgp import AddressingIpamBGPPrefixes +from cloudflare.types.addressing.prefixes.bgp.bgp_prefix import BGPPrefix base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +38,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(SyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(SyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +78,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +89,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: prefix_id="023e105f4ecef8ad9ca31a8372d0c353", on_demand={"advertised": True}, ) - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +103,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" prefix = response.parse() - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +117,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -153,7 +153,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -167,7 +167,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" prefix = response.parse() - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -181,7 +181,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -220,7 +220,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +233,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -246,7 +246,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -273,7 +273,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -284,7 +284,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) prefix_id="023e105f4ecef8ad9ca31a8372d0c353", on_demand={"advertised": True}, ) - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +298,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" prefix = await response.parse() - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -312,7 +312,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -348,7 +348,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +362,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" prefix = await response.parse() - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -376,7 +376,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AddressingIpamBGPPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/bgp/test_statuses.py b/tests/api_resources/addressing/prefixes/bgp/test_statuses.py index a54d8bb4d77..c136cf59840 100644 --- a/tests/api_resources/addressing/prefixes/bgp/test_statuses.py +++ b/tests/api_resources/addressing/prefixes/bgp/test_statuses.py @@ -3,13 +3,14 @@ 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.addressing.prefixes.bgp import StatusGetResponse, StatusEditResponse +from cloudflare.types.addressing.prefixes.bgp.status_get_response import StatusGetResponse +from cloudflare.types.addressing.prefixes.bgp.status_edit_response import StatusEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", advertised=True, ) - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,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" status = response.parse() - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +54,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +82,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +95,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" status = response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +108,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) assert cast(Any, response.is_closed) is True @@ -138,7 +139,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", advertised=True, ) - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +153,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" status = await response.parse() - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +167,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) assert cast(Any, response.is_closed) is True @@ -194,7 +195,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +208,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" status = await response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -220,7 +221,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/test_delegations.py b/tests/api_resources/addressing/prefixes/test_delegations.py index a915d91accc..36319156092 100644 --- a/tests/api_resources/addressing/prefixes/test_delegations.py +++ b/tests/api_resources/addressing/prefixes/test_delegations.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.addressing.prefixes import ( - DelegationDeleteResponse, - AddressingIpamDelegations, -) +from cloudflare.types.addressing.prefixes.delegations import Delegations +from cloudflare.types.addressing.prefixes.delegation_delete_response import DelegationDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) - assert_matches_type(AddressingIpamDelegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +43,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" delegation = response.parse() - assert_matches_type(AddressingIpamDelegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +58,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(AddressingIpamDelegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,7 +88,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) + assert_matches_type(SyncSinglePage[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +101,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(SyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) + assert_matches_type(SyncSinglePage[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +114,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(SyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) + assert_matches_type(SyncSinglePage[Delegations], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -142,8 +140,9 @@ def test_method_delete(self, client: Cloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,12 +151,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,12 +166,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -183,6 +184,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): @@ -190,6 +192,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `delegation_id` but received ''"): @@ -197,6 +200,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @@ -212,7 +216,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) - assert_matches_type(AddressingIpamDelegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -227,7 +231,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" delegation = await response.parse() - assert_matches_type(AddressingIpamDelegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +246,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(AddressingIpamDelegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -272,7 +276,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) + assert_matches_type(AsyncSinglePage[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +289,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) + assert_matches_type(AsyncSinglePage[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +302,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) + assert_matches_type(AsyncSinglePage[Delegations], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -324,8 +328,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -334,12 +339,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -348,12 +354,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -365,6 +372,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): @@ -372,6 +380,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `delegation_id` but received ''"): @@ -379,4 +388,5 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) diff --git a/tests/api_resources/addressing/test_address_maps.py b/tests/api_resources/addressing/test_address_maps.py index d45b35475fd..f86b0bfbdcd 100644 --- a/tests/api_resources/addressing/test_address_maps.py +++ b/tests/api_resources/addressing/test_address_maps.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.addressing import ( - AddressingAddressMaps, - AddressMapGetResponse, - AddressMapCreateResponse, - AddressMapDeleteResponse, -) +from cloudflare.types.addressing.address_map import AddressMap +from cloudflare.types.addressing.address_map_get_response import AddressMapGetResponse +from cloudflare.types.addressing.address_map_create_response import AddressMapCreateResponse +from cloudflare.types.addressing.address_map_delete_response import AddressMapDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: description="My Ecommerce zones", enabled=True, ) - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +49,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" address_map = response.parse() - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +79,7 @@ def test_method_list(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) + assert_matches_type(SyncSinglePage[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +91,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(SyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) + assert_matches_type(SyncSinglePage[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +103,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(SyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) + assert_matches_type(SyncSinglePage[AddressMap], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -123,6 +121,7 @@ def test_method_delete(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[AddressMapDeleteResponse], address_map, path=["response"]) @@ -132,6 +131,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.address_maps.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -145,6 +145,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.address_maps.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -161,12 +162,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.addressing.address_maps.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) 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( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -176,7 +179,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingAddressMaps, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +191,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: description="My Ecommerce zones", enabled=True, ) - assert_matches_type(AddressingAddressMaps, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +204,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" address_map = response.parse() - assert_matches_type(AddressingAddressMaps, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -214,7 +217,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressingAddressMaps, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -240,7 +243,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -253,7 +256,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" address_map = response.parse() - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -266,7 +269,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -295,7 +298,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -305,7 +308,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare description="My Ecommerce zones", enabled=True, ) - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -317,7 +320,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" address_map = await response.parse() - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -329,7 +332,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -347,7 +350,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -359,7 +362,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -371,7 +374,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressMap], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -389,6 +392,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[AddressMapDeleteResponse], address_map, path=["response"]) @@ -398,6 +402,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.address_maps.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -411,6 +416,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.addressing.address_maps.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -427,12 +433,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.addressing.address_maps.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) 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( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -442,7 +450,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingAddressMaps, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -454,7 +462,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) description="My Ecommerce zones", enabled=True, ) - assert_matches_type(AddressingAddressMaps, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -467,7 +475,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" address_map = await response.parse() - assert_matches_type(AddressingAddressMaps, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -480,7 +488,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressingAddressMaps, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -506,7 +514,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -519,7 +527,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" address_map = await response.parse() - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -532,7 +540,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_loa_documents.py b/tests/api_resources/addressing/test_loa_documents.py index c2e4033f38e..e30e833227b 100644 --- a/tests/api_resources/addressing/test_loa_documents.py +++ b/tests/api_resources/addressing/test_loa_documents.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.addressing import LOADocumentCreateResponse +from cloudflare.types.addressing.loa_document_create_response import LOADocumentCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", loa_document="@document.pdf", ) - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" loa_document = response.parse() - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" loa_document = response.parse() - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +74,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", loa_document="@document.pdf", ) - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,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" loa_document = await response.parse() - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" loa_document = await response.parse() - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_prefixes.py b/tests/api_resources/addressing/test_prefixes.py index a77715e5a73..6002ebc12b1 100644 --- a/tests/api_resources/addressing/test_prefixes.py +++ b/tests/api_resources/addressing/test_prefixes.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.addressing import ( - PrefixDeleteResponse, - AddressingIpamPrefixes, -) +from cloudflare.types.addressing.prefix import Prefix +from cloudflare.types.addressing.prefix_delete_response import PrefixDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", ) - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +43,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" prefix = response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +58,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +79,7 @@ def test_method_list(self, client: Cloudflare) -> None: prefix = client.addressing.prefixes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +91,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(SyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +103,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(SyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -123,6 +121,7 @@ def test_method_delete(self, client: Cloudflare) -> None: prefix = client.addressing.prefixes.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[PrefixDeleteResponse], prefix, path=["response"]) @@ -132,6 +131,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.addressing.prefixes.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -145,6 +145,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.addressing.prefixes.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -161,12 +162,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.addressing.prefixes.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `prefix_id` but received ''"): client.addressing.prefixes.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -177,7 +180,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", description="Internal test prefix", ) - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -191,7 +194,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" prefix = response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,7 +208,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -233,7 +236,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -246,7 +249,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" prefix = response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -259,7 +262,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -291,7 +294,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", ) - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -306,7 +309,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" prefix = await response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -321,7 +324,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +345,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: prefix = await async_client.addressing.prefixes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -354,7 +357,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -366,7 +369,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AsyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -384,6 +387,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: prefix = await async_client.addressing.prefixes.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[PrefixDeleteResponse], prefix, path=["response"]) @@ -393,6 +397,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.addressing.prefixes.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -406,6 +411,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.addressing.prefixes.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -422,12 +428,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.addressing.prefixes.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) 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( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -438,7 +446,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", description="Internal test prefix", ) - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -452,7 +460,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" prefix = await response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -466,7 +474,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -494,7 +502,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -507,7 +515,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" prefix = await response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -520,7 +528,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(AddressingIpamPrefixes, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_services.py b/tests/api_resources/addressing/test_services.py index bab9eef74b0..76a7f62b536 100644 --- a/tests/api_resources/addressing/test_services.py +++ b/tests/api_resources/addressing/test_services.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.addressing import ServiceListResponse +from cloudflare.types.addressing.service_list_response import ServiceListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/alerting/destinations/test_eligible.py b/tests/api_resources/alerting/destinations/test_eligible.py index ef1a207dbd4..72cd31f1b77 100644 --- a/tests/api_resources/alerting/destinations/test_eligible.py +++ b/tests/api_resources/alerting/destinations/test_eligible.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.alerting.destinations import EligibleGetResponse +from cloudflare.types.alerting.destinations.eligible_get_response import EligibleGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/alerting/destinations/test_pagerduty.py b/tests/api_resources/alerting/destinations/test_pagerduty.py index 07b1cb56436..06db14e6021 100644 --- a/tests/api_resources/alerting/destinations/test_pagerduty.py +++ b/tests/api_resources/alerting/destinations/test_pagerduty.py @@ -9,12 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.alerting.destinations import ( - PagerdutyGetResponse, - PagerdutyLinkResponse, - PagerdutyCreateResponse, - PagerdutyDeleteResponse, -) +from cloudflare.types.alerting.destinations.pagerduty_get_response import PagerdutyGetResponse +from cloudflare.types.alerting.destinations.pagerduty_link_response import PagerdutyLinkResponse +from cloudflare.types.alerting.destinations.pagerduty_create_response import PagerdutyCreateResponse +from cloudflare.types.alerting.destinations.pagerduty_delete_response import PagerdutyDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/alerting/destinations/test_webhooks.py b/tests/api_resources/alerting/destinations/test_webhooks.py index 315b3c36ea4..98bd0ec8991 100644 --- a/tests/api_resources/alerting/destinations/test_webhooks.py +++ b/tests/api_resources/alerting/destinations/test_webhooks.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.alerting.destinations import ( - AlertingWebhooks, - WebhookCreateResponse, - WebhookDeleteResponse, - WebhookUpdateResponse, -) +from cloudflare.types.alerting.destinations.webhooks import Webhooks +from cloudflare.types.alerting.destinations.webhook_create_response import WebhookCreateResponse +from cloudflare.types.alerting.destinations.webhook_delete_response import WebhookDeleteResponse +from cloudflare.types.alerting.destinations.webhook_update_response import WebhookUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -164,7 +162,7 @@ def test_method_list(self, client: Cloudflare) -> None: webhook = client.alerting.destinations.webhooks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[AlertingWebhooks], webhook, path=["response"]) + assert_matches_type(SyncSinglePage[Webhooks], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +174,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(SyncSinglePage[AlertingWebhooks], webhook, path=["response"]) + assert_matches_type(SyncSinglePage[Webhooks], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +186,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(SyncSinglePage[AlertingWebhooks], webhook, path=["response"]) + assert_matches_type(SyncSinglePage[Webhooks], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -259,7 +257,7 @@ def test_method_get(self, client: Cloudflare) -> None: "b115d5ec-15c6-41ee-8b76-92c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AlertingWebhooks, webhook, path=["response"]) + assert_matches_type(Webhooks, webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -272,7 +270,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(AlertingWebhooks, webhook, path=["response"]) + assert_matches_type(Webhooks, webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +283,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(AlertingWebhooks, webhook, path=["response"]) + assert_matches_type(Webhooks, webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -449,7 +447,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.alerting.destinations.webhooks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[AlertingWebhooks], webhook, path=["response"]) + assert_matches_type(AsyncSinglePage[Webhooks], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +459,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(AsyncSinglePage[AlertingWebhooks], webhook, path=["response"]) + assert_matches_type(AsyncSinglePage[Webhooks], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -473,7 +471,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(AsyncSinglePage[AlertingWebhooks], webhook, path=["response"]) + assert_matches_type(AsyncSinglePage[Webhooks], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -544,7 +542,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "b115d5ec-15c6-41ee-8b76-92c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AlertingWebhooks, webhook, path=["response"]) + assert_matches_type(Webhooks, webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -557,7 +555,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(AlertingWebhooks, webhook, path=["response"]) + assert_matches_type(Webhooks, webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -570,7 +568,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(AlertingWebhooks, webhook, path=["response"]) + assert_matches_type(Webhooks, webhook, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/alerting/test_available_alerts.py b/tests/api_resources/alerting/test_available_alerts.py index c3c5c6dc2fe..a788c4241c6 100644 --- a/tests/api_resources/alerting/test_available_alerts.py +++ b/tests/api_resources/alerting/test_available_alerts.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.alerting import AvailableAlertListResponse +from cloudflare.types.alerting.available_alert_list_response import AvailableAlertListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/alerting/test_history.py b/tests/api_resources/alerting/test_history.py index 7fe38ffcb56..33daab848a8 100644 --- a/tests/api_resources/alerting/test_history.py +++ b/tests/api_resources/alerting/test_history.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.alerting import AlertingHistory +from cloudflare.types.alerting.history import History base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: history = client.alerting.history.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[AlertingHistory], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[History], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: per_page=5, since=parse_datetime("2022-05-19T20:29:58.679897Z"), ) - assert_matches_type(SyncV4PagePaginationArray[AlertingHistory], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[History], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AlertingHistory], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[History], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AlertingHistory], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[History], history, path=["response"]) assert cast(Any, response.is_closed) is True @@ -83,7 +83,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: history = await async_client.alerting.history.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[AlertingHistory], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[History], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -95,7 +95,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) per_page=5, since=parse_datetime("2022-05-19T20:29:58.679897Z"), ) - assert_matches_type(AsyncV4PagePaginationArray[AlertingHistory], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[History], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AlertingHistory], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[History], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,7 +119,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AlertingHistory], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[History], history, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/alerting/test_policies.py b/tests/api_resources/alerting/test_policies.py index 3668367e996..b776db81ba2 100644 --- a/tests/api_resources/alerting/test_policies.py +++ b/tests/api_resources/alerting/test_policies.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.alerting import ( - AlertingPolicies, - PolicyCreateResponse, - PolicyDeleteResponse, - PolicyUpdateResponse, -) +from cloudflare.types.alerting.policy import Policy +from cloudflare.types.alerting.policy_create_response import PolicyCreateResponse +from cloudflare.types.alerting.policy_delete_response import PolicyDeleteResponse +from cloudflare.types.alerting.policy_update_response import PolicyUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -274,7 +272,7 @@ def test_method_list(self, client: Cloudflare) -> None: policy = client.alerting.policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -286,7 +284,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +296,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -369,7 +367,7 @@ def test_method_get(self, client: Cloudflare) -> None: "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -382,7 +380,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +393,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -669,7 +667,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: policy = await async_client.alerting.policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -681,7 +679,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -693,7 +691,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -764,7 +762,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -777,7 +775,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -790,7 +788,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AlertingPolicies, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/argo/test_smart_routing.py b/tests/api_resources/argo/test_smart_routing.py index 27d13739d4c..c5080d0ba11 100644 --- a/tests/api_resources/argo/test_smart_routing.py +++ b/tests/api_resources/argo/test_smart_routing.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.argo import SmartRoutingGetResponse, SmartRoutingEditResponse +from cloudflare.types.argo.smart_routing_get_response import SmartRoutingGetResponse +from cloudflare.types.argo.smart_routing_edit_response import SmartRoutingEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/argo/test_tiered_caching.py b/tests/api_resources/argo/test_tiered_caching.py index 13d8943f000..e9c0d454595 100644 --- a/tests/api_resources/argo/test_tiered_caching.py +++ b/tests/api_resources/argo/test_tiered_caching.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.argo import TieredCachingGetResponse, TieredCachingEditResponse +from cloudflare.types.argo.tiered_caching_get_response import TieredCachingGetResponse +from cloudflare.types.argo.tiered_caching_edit_response import TieredCachingEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/billing/test_profiles.py b/tests/api_resources/billing/test_profiles.py index 63e0a0eca24..4b9416d2dbf 100644 --- a/tests/api_resources/billing/test_profiles.py +++ b/tests/api_resources/billing/test_profiles.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.billing import ProfileGetResponse +from cloudflare.types.billing.profile_get_response import ProfileGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/cache/test_cache_reserve.py b/tests/api_resources/cache/test_cache_reserve.py index 8ab59cae091..ba5feb7dc37 100644 --- a/tests/api_resources/cache/test_cache_reserve.py +++ b/tests/api_resources/cache/test_cache_reserve.py @@ -9,12 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.cache import ( - CacheReserveGetResponse, - CacheReserveEditResponse, - CacheReserveClearResponse, - CacheReserveStatusResponse, -) +from cloudflare.types.cache.cache_reserve_get_response import CacheReserveGetResponse +from cloudflare.types.cache.cache_reserve_edit_response import CacheReserveEditResponse +from cloudflare.types.cache.cache_reserve_clear_response import CacheReserveClearResponse +from cloudflare.types.cache.cache_reserve_status_response import CacheReserveStatusResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,6 +25,7 @@ class TestCacheReserve: def test_method_clear(self, client: Cloudflare) -> None: cache_reserve = client.cache.cache_reserve.clear( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body="{}", ) assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) @@ -35,6 +34,7 @@ def test_method_clear(self, client: Cloudflare) -> None: def test_raw_response_clear(self, client: Cloudflare) -> None: response = client.cache.cache_reserve.with_raw_response.clear( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body="{}", ) assert response.is_closed is True @@ -47,6 +47,7 @@ def test_raw_response_clear(self, client: Cloudflare) -> None: def test_streaming_response_clear(self, client: Cloudflare) -> None: with client.cache.cache_reserve.with_streaming_response.clear( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body="{}", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -62,6 +63,7 @@ def test_path_params_clear(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.cache.cache_reserve.with_raw_response.clear( zone_id="", + body="{}", ) @pytest.mark.skip() @@ -203,6 +205,7 @@ class TestAsyncCacheReserve: async def test_method_clear(self, async_client: AsyncCloudflare) -> None: cache_reserve = await async_client.cache.cache_reserve.clear( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body="{}", ) assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) @@ -211,6 +214,7 @@ async def test_method_clear(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_clear(self, async_client: AsyncCloudflare) -> None: response = await async_client.cache.cache_reserve.with_raw_response.clear( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body="{}", ) assert response.is_closed is True @@ -223,6 +227,7 @@ async def test_raw_response_clear(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_clear(self, async_client: AsyncCloudflare) -> None: async with async_client.cache.cache_reserve.with_streaming_response.clear( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body="{}", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -238,6 +243,7 @@ async def test_path_params_clear(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.cache.cache_reserve.with_raw_response.clear( zone_id="", + body="{}", ) @pytest.mark.skip() diff --git a/tests/api_resources/cache/test_regional_tiered_cache.py b/tests/api_resources/cache/test_regional_tiered_cache.py index 0a440eaae86..74247e9092d 100644 --- a/tests/api_resources/cache/test_regional_tiered_cache.py +++ b/tests/api_resources/cache/test_regional_tiered_cache.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.cache import ( - RegionalTieredCacheGetResponse, - RegionalTieredCacheEditResponse, -) +from cloudflare.types.cache.regional_tiered_cache_get_response import RegionalTieredCacheGetResponse +from cloudflare.types.cache.regional_tiered_cache_edit_response import RegionalTieredCacheEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/cache/test_smart_tiered_cache.py b/tests/api_resources/cache/test_smart_tiered_cache.py index 2ebc31bf1e4..4b8df77a630 100644 --- a/tests/api_resources/cache/test_smart_tiered_cache.py +++ b/tests/api_resources/cache/test_smart_tiered_cache.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.cache import ( - SmartTieredCacheGetResponse, - SmartTieredCacheEditResponse, - SmartTieredCacheDeleteResponse, -) +from cloudflare.types.cache.smart_tiered_cache_get_response import SmartTieredCacheGetResponse +from cloudflare.types.cache.smart_tiered_cache_edit_response import SmartTieredCacheEditResponse +from cloudflare.types.cache.smart_tiered_cache_delete_response import SmartTieredCacheDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,6 +24,7 @@ class TestSmartTieredCache: def test_method_delete(self, client: Cloudflare) -> None: smart_tiered_cache = client.cache.smart_tiered_cache.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) @@ -34,6 +33,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.cache.smart_tiered_cache.with_raw_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -46,6 +46,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.cache.smart_tiered_cache.with_streaming_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -61,6 +62,7 @@ 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.cache.smart_tiered_cache.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -160,6 +162,7 @@ class TestAsyncSmartTieredCache: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: smart_tiered_cache = await async_client.cache.smart_tiered_cache.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) @@ -168,6 +171,7 @@ 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.cache.smart_tiered_cache.with_raw_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -180,6 +184,7 @@ 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.cache.smart_tiered_cache.with_streaming_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -195,6 +200,7 @@ 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.cache.smart_tiered_cache.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/cache/test_variants.py b/tests/api_resources/cache/test_variants.py index 3e2a199f3ab..a790a25d6c6 100644 --- a/tests/api_resources/cache/test_variants.py +++ b/tests/api_resources/cache/test_variants.py @@ -9,7 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.cache import CacheVariants, VariantGetResponse, VariantEditResponse +from cloudflare.types.cache.cache_variant import CacheVariant +from cloudflare.types.cache.variant_get_response import VariantGetResponse +from cloudflare.types.cache.variant_edit_response import VariantEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,32 +24,35 @@ class TestVariants: def test_method_delete(self, client: Cloudflare) -> None: variant = client.cache.variants.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(CacheVariants, variant, path=["response"]) + assert_matches_type(CacheVariant, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.cache.variants.with_raw_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(CacheVariants, variant, path=["response"]) + assert_matches_type(CacheVariant, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.cache.variants.with_streaming_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(CacheVariants, variant, path=["response"]) + assert_matches_type(CacheVariant, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -57,6 +62,7 @@ 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.cache.variants.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -177,32 +183,35 @@ class TestAsyncVariants: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: variant = await async_client.cache.variants.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(CacheVariants, variant, path=["response"]) + assert_matches_type(CacheVariant, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.cache.variants.with_raw_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(CacheVariants, variant, path=["response"]) + assert_matches_type(CacheVariant, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.cache.variants.with_streaming_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(CacheVariants, variant, path=["response"]) + assert_matches_type(CacheVariant, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -212,6 +221,7 @@ 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.cache.variants.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/certificate_authorities/test_hostname_associations.py b/tests/api_resources/certificate_authorities/test_hostname_associations.py index 58ba5b38106..ce33f3b87ff 100644 --- a/tests/api_resources/certificate_authorities/test_hostname_associations.py +++ b/tests/api_resources/certificate_authorities/test_hostname_associations.py @@ -9,8 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.certificate_authorities import ( - TLSHostnameAssociation, +from cloudflare.types.certificate_authorities.hostname_association_get_response import HostnameAssociationGetResponse +from cloudflare.types.certificate_authorities.hostname_association_update_response import ( + HostnameAssociationUpdateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None: hostname_association = client.certificate_authorities.hostname_associations.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: hostnames=["api.example.com", "api.example.com", "api.example.com"], mtls_certificate_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +60,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) assert cast(Any, response.is_closed) is True @@ -77,7 +78,7 @@ def test_method_get(self, client: Cloudflare) -> None: hostname_association = client.certificate_authorities.hostname_associations.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +87,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", mtls_certificate_id="b2134436-2555-4acf-be5b-26c48136575e", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +99,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" hostname_association = response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +111,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) assert cast(Any, response.is_closed) is True @@ -132,7 +133,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: hostname_association = await async_client.certificate_authorities.hostname_associations.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +143,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare hostnames=["api.example.com", "api.example.com", "api.example.com"], mtls_certificate_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -154,7 +155,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = await response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +167,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = await response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) assert cast(Any, response.is_closed) is True @@ -184,7 +185,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: hostname_association = await async_client.certificate_authorities.hostname_associations.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +194,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - zone_id="023e105f4ecef8ad9ca31a8372d0c353", mtls_certificate_id="b2134436-2555-4acf-be5b-26c48136575e", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,7 +206,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" hostname_association = await response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +218,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = await response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/challenges/test_widgets.py b/tests/api_resources/challenges/test_widgets.py index 9a6efa429ee..a87a1021b16 100644 --- a/tests/api_resources/challenges/test_widgets.py +++ b/tests/api_resources/challenges/test_widgets.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.challenges import ( - ChallengesWidget, - ChallengesWidgetList, -) +from cloudflare.types.challenges.widget import Widget +from cloudflare.types.challenges.widget_list_response import WidgetListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: mode="invisible", name="blog.cloudflare.com login form", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +47,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: offlabel=False, region="world", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +62,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" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -79,7 +77,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -104,7 +102,7 @@ def test_method_update(self, client: Cloudflare) -> None: mode="invisible", name="blog.cloudflare.com login form", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,7 +117,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: clearance_level="interactive", offlabel=False, ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -135,7 +133,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -151,7 +149,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -182,7 +180,7 @@ def test_method_list(self, client: Cloudflare) -> None: widget = client.challenges.widgets.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[ChallengesWidgetList], widget, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -194,7 +192,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=5, ) - assert_matches_type(SyncV4PagePaginationArray[ChallengesWidgetList], widget, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +204,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(SyncV4PagePaginationArray[ChallengesWidgetList], widget, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -218,7 +216,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(SyncV4PagePaginationArray[ChallengesWidgetList], widget, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -237,7 +235,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "0x4AAF00AAAABn0R22HWm-YUc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -250,7 +248,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" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -263,7 +261,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -289,7 +287,7 @@ def test_method_get(self, client: Cloudflare) -> None: "0x4AAF00AAAABn0R22HWm-YUc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -302,7 +300,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" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -315,7 +313,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -341,7 +339,7 @@ def test_method_rotate_secret(self, client: Cloudflare) -> None: "0x4AAF00AAAABn0R22HWm-YUc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -351,7 +349,7 @@ def test_method_rotate_secret_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", invalidate_immediately=True, ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -364,7 +362,7 @@ def test_raw_response_rotate_secret(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -377,7 +375,7 @@ def test_streaming_response_rotate_secret(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -409,7 +407,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: mode="invisible", name="blog.cloudflare.com login form", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -428,7 +426,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare offlabel=False, region="world", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -443,7 +441,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" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -458,7 +456,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -483,7 +481,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: mode="invisible", name="blog.cloudflare.com login form", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -498,7 +496,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare clearance_level="interactive", offlabel=False, ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -514,7 +512,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -530,7 +528,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -561,7 +559,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: widget = await async_client.challenges.widgets.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[ChallengesWidgetList], widget, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -573,7 +571,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=5, ) - assert_matches_type(AsyncV4PagePaginationArray[ChallengesWidgetList], widget, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -585,7 +583,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[ChallengesWidgetList], widget, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -597,7 +595,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[ChallengesWidgetList], widget, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -616,7 +614,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "0x4AAF00AAAABn0R22HWm-YUc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -629,7 +627,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" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -642,7 +640,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -668,7 +666,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "0x4AAF00AAAABn0R22HWm-YUc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -681,7 +679,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" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -694,7 +692,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True @@ -720,7 +718,7 @@ async def test_method_rotate_secret(self, async_client: AsyncCloudflare) -> None "0x4AAF00AAAABn0R22HWm-YUc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -730,7 +728,7 @@ async def test_method_rotate_secret_with_all_params(self, async_client: AsyncClo account_id="023e105f4ecef8ad9ca31a8372d0c353", invalidate_immediately=True, ) - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -743,7 +741,7 @@ async def test_raw_response_rotate_secret(self, async_client: AsyncCloudflare) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) @pytest.mark.skip() @parametrize @@ -756,7 +754,7 @@ async def test_streaming_response_rotate_secret(self, async_client: AsyncCloudfl assert response.http_request.headers.get("X-Stainless-Lang") == "python" widget = await response.parse() - assert_matches_type(Optional[ChallengesWidget], widget, path=["response"]) + assert_matches_type(Optional[Widget], widget, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloudforce_one/requests/test_message.py b/tests/api_resources/cloudforce_one/requests/test_message.py index 6188545183d..54822be59d5 100644 --- a/tests/api_resources/cloudforce_one/requests/test_message.py +++ b/tests/api_resources/cloudforce_one/requests/test_message.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.cloudforce_one.requests import ( - MessageGetResponse, - MessageDeleteResponse, - CloudforceOneRequestMessageItem, -) +from cloudflare.types.cloudforce_one.requests.message import Message +from cloudflare.types.cloudforce_one.requests.message_get_response import MessageGetResponse +from cloudflare.types.cloudforce_one.requests.message_delete_response import MessageDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", content="Can you elaborate on the type of DoS that occurred?", ) - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -52,7 +50,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" message = response.parse() - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -65,7 +63,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -92,7 +90,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", request_identifier="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +105,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +119,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -135,7 +133,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -301,7 +299,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +309,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_identifier="023e105f4ecef8ad9ca31a8372d0c353", content="Can you elaborate on the type of DoS that occurred?", ) - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -324,7 +322,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" message = await response.parse() - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -337,7 +335,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -364,7 +362,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", request_identifier="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -379,7 +377,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -393,7 +391,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @pytest.mark.skip() @parametrize @@ -407,7 +405,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(CloudforceOneRequestMessageItem, message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloudforce_one/requests/test_priority.py b/tests/api_resources/cloudforce_one/requests/test_priority.py index 4e5af43cf25..9b3aa3fffdc 100644 --- a/tests/api_resources/cloudforce_one/requests/test_priority.py +++ b/tests/api_resources/cloudforce_one/requests/test_priority.py @@ -9,11 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.cloudforce_one import CloudforceOneQuota, CloudforceOneRequestItem -from cloudflare.types.cloudforce_one.requests import ( - PriorityDeleteResponse, - CloudforceOnePriorityItem, -) +from cloudflare.types.cloudforce_one.item import Item +from cloudflare.types.cloudforce_one.quota import Quota +from cloudflare.types.cloudforce_one.requests.priority import Priority +from cloudflare.types.cloudforce_one.requests.priority_delete_response import PriorityDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(CloudforceOnePriorityItem, priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +46,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" priority = response.parse() - assert_matches_type(CloudforceOnePriorityItem, priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +62,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(CloudforceOnePriorityItem, priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,7 +89,7 @@ def test_method_update(self, client: Cloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +106,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -124,7 +123,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -210,7 +209,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -223,7 +222,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" priority = response.parse() - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -236,7 +235,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -261,7 +260,7 @@ def test_method_quota(self, client: Cloudflare) -> None: priority = client.cloudforce_one.requests.priority.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneQuota, priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +272,7 @@ def test_raw_response_quota(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(CloudforceOneQuota, priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +284,7 @@ def test_streaming_response_quota(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(CloudforceOneQuota, priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -311,7 +310,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(CloudforceOnePriorityItem, priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -327,7 +326,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" priority = await response.parse() - assert_matches_type(CloudforceOnePriorityItem, priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -343,7 +342,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(CloudforceOnePriorityItem, priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -370,7 +369,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -387,7 +386,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -404,7 +403,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -490,7 +489,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -503,7 +502,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" priority = await response.parse() - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -516,7 +515,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(CloudforceOneRequestItem, priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -541,7 +540,7 @@ async def test_method_quota(self, async_client: AsyncCloudflare) -> None: priority = await async_client.cloudforce_one.requests.priority.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneQuota, priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -553,7 +552,7 @@ async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(CloudforceOneQuota, priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) @pytest.mark.skip() @parametrize @@ -565,7 +564,7 @@ async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(CloudforceOneQuota, priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloudforce_one/test_requests.py b/tests/api_resources/cloudforce_one/test_requests.py index 999e7f97b71..c39acd3c50c 100644 --- a/tests/api_resources/cloudforce_one/test_requests.py +++ b/tests/api_resources/cloudforce_one/test_requests.py @@ -11,14 +11,12 @@ from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.cloudforce_one import ( - CloudforceOneQuota, - RequestDeleteResponse, - CloudforceOneRequestItem, - CloudforceOneRequestTypes, - CloudforceOneRequestListItem, - CloudforceOneRequestConstants, -) +from cloudflare.types.cloudforce_one.item import Item +from cloudflare.types.cloudforce_one.quota import Quota +from cloudflare.types.cloudforce_one.list_item import ListItem +from cloudflare.types.cloudforce_one.request_types import RequestTypes +from cloudflare.types.cloudforce_one.request_constants import RequestConstants +from cloudflare.types.cloudforce_one.request_delete_response import RequestDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -32,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.create( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +43,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +55,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" request = response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +67,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -88,7 +86,7 @@ def test_method_update(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +100,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +113,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -128,7 +126,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -155,7 +153,7 @@ def test_method_list(self, client: Cloudflare) -> None: page=0, per_page=10, ) - assert_matches_type(SyncV4PagePaginationArray[CloudforceOneRequestListItem], request, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +171,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: sort_order="asc", status="open", ) - assert_matches_type(SyncV4PagePaginationArray[CloudforceOneRequestListItem], request, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +185,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(SyncV4PagePaginationArray[CloudforceOneRequestListItem], request, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +199,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(SyncV4PagePaginationArray[CloudforceOneRequestListItem], request, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[ListItem], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -273,7 +271,7 @@ def test_method_constants(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.constants( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestConstants, request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +283,7 @@ def test_raw_response_constants(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneRequestConstants, request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -297,7 +295,7 @@ def test_streaming_response_constants(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneRequestConstants, request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -316,7 +314,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -329,7 +327,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" request = response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -342,7 +340,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -367,7 +365,7 @@ def test_method_quota(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneQuota, request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -379,7 +377,7 @@ def test_raw_response_quota(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneQuota, request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,7 +389,7 @@ def test_streaming_response_quota(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneQuota, request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -409,7 +407,7 @@ def test_method_types(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.types( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestTypes, request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -421,7 +419,7 @@ def test_raw_response_types(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneRequestTypes, request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -433,7 +431,7 @@ def test_streaming_response_types(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(CloudforceOneRequestTypes, request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -455,7 +453,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.create( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -468,7 +466,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -480,7 +478,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" request = await response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -492,7 +490,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -511,7 +509,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -525,7 +523,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -538,7 +536,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -551,7 +549,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -578,7 +576,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: page=0, per_page=10, ) - assert_matches_type(AsyncV4PagePaginationArray[CloudforceOneRequestListItem], request, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -596,7 +594,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) sort_order="asc", status="open", ) - assert_matches_type(AsyncV4PagePaginationArray[CloudforceOneRequestListItem], request, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -610,7 +608,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[CloudforceOneRequestListItem], request, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -624,7 +622,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[CloudforceOneRequestListItem], request, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[ListItem], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -696,7 +694,7 @@ async def test_method_constants(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.constants( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestConstants, request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -708,7 +706,7 @@ async def test_raw_response_constants(self, async_client: AsyncCloudflare) -> No assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneRequestConstants, request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -720,7 +718,7 @@ async def test_streaming_response_constants(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneRequestConstants, request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -739,7 +737,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -752,7 +750,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" request = await response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -765,7 +763,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneRequestItem, request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -790,7 +788,7 @@ async def test_method_quota(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneQuota, request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -802,7 +800,7 @@ async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneQuota, request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -814,7 +812,7 @@ async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneQuota, request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -832,7 +830,7 @@ async def test_method_types(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.types( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CloudforceOneRequestTypes, request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -844,7 +842,7 @@ async def test_raw_response_types(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneRequestTypes, request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) @pytest.mark.skip() @parametrize @@ -856,7 +854,7 @@ async def test_streaming_response_types(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(CloudforceOneRequestTypes, request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/custom_certificates/test_prioritize.py b/tests/api_resources/custom_certificates/test_prioritize.py index 06419cda056..74cd185a801 100644 --- a/tests/api_resources/custom_certificates/test_prioritize.py +++ b/tests/api_resources/custom_certificates/test_prioritize.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.custom_certificates import PrioritizeUpdateResponse +from cloudflare.types.custom_certificates.prioritize_update_response import PrioritizeUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/custom_hostnames/test_fallback_origin.py b/tests/api_resources/custom_hostnames/test_fallback_origin.py index 4f78b579830..67c87c3bbb3 100644 --- a/tests/api_resources/custom_hostnames/test_fallback_origin.py +++ b/tests/api_resources/custom_hostnames/test_fallback_origin.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.custom_hostnames import ( - FallbackOriginGetResponse, - FallbackOriginDeleteResponse, - FallbackOriginUpdateResponse, -) +from cloudflare.types.custom_hostnames.fallback_origin_get_response import FallbackOriginGetResponse +from cloudflare.types.custom_hostnames.fallback_origin_delete_response import FallbackOriginDeleteResponse +from cloudflare.types.custom_hostnames.fallback_origin_update_response import FallbackOriginUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -72,6 +70,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: fallback_origin = client.custom_hostnames.fallback_origin.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(FallbackOriginDeleteResponse, fallback_origin, path=["response"]) @@ -80,6 +79,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.custom_hostnames.fallback_origin.with_raw_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -92,6 +92,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.custom_hostnames.fallback_origin.with_streaming_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -107,6 +108,7 @@ 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.custom_hostnames.fallback_origin.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -206,6 +208,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: fallback_origin = await async_client.custom_hostnames.fallback_origin.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(FallbackOriginDeleteResponse, fallback_origin, path=["response"]) @@ -214,6 +217,7 @@ 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.custom_hostnames.fallback_origin.with_raw_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -226,6 +230,7 @@ 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.custom_hostnames.fallback_origin.with_streaming_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -241,6 +246,7 @@ 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.custom_hostnames.fallback_origin.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/d1/test_database.py b/tests/api_resources/d1/test_database.py index 0fab88b9fd1..e651a529153 100644 --- a/tests/api_resources/d1/test_database.py +++ b/tests/api_resources/d1/test_database.py @@ -3,19 +3,18 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.d1 import ( - D1CreateDatabase, - D1DatabaseDetails, - DatabaseQueryResponse, - DatabaseDeleteResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.d1.d1 import D1 +from cloudflare.types.d1.database_list_response import DatabaseListResponse +from cloudflare.types.d1.database_query_response import DatabaseQueryResponse +from cloudflare.types.d1.database_create_response import DatabaseCreateResponse +from cloudflare.types.d1.database_delete_response import DatabaseDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="my-database", ) - assert_matches_type(D1CreateDatabase, database, path=["response"]) + assert_matches_type(DatabaseCreateResponse, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +42,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" database = response.parse() - assert_matches_type(D1CreateDatabase, database, path=["response"]) + assert_matches_type(DatabaseCreateResponse, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +55,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = response.parse() - assert_matches_type(D1CreateDatabase, database, path=["response"]) + assert_matches_type(DatabaseCreateResponse, database, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +74,7 @@ def test_method_list(self, client: Cloudflare) -> None: database = client.d1.database.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[D1CreateDatabase], database, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DatabaseListResponse], database, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +85,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=10, ) - assert_matches_type(SyncV4PagePaginationArray[D1CreateDatabase], database, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DatabaseListResponse], database, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +97,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = response.parse() - assert_matches_type(SyncV4PagePaginationArray[D1CreateDatabase], database, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DatabaseListResponse], database, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +109,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = response.parse() - assert_matches_type(SyncV4PagePaginationArray[D1CreateDatabase], database, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DatabaseListResponse], database, path=["response"]) assert cast(Any, response.is_closed) is True @@ -129,7 +128,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DatabaseDeleteResponse], database, path=["response"]) + assert_matches_type(DatabaseDeleteResponse, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +141,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" database = response.parse() - assert_matches_type(Optional[DatabaseDeleteResponse], database, path=["response"]) + assert_matches_type(DatabaseDeleteResponse, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +154,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = response.parse() - assert_matches_type(Optional[DatabaseDeleteResponse], database, path=["response"]) + assert_matches_type(DatabaseDeleteResponse, database, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +180,7 @@ def test_method_get(self, client: Cloudflare) -> None: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(D1DatabaseDetails, database, path=["response"]) + assert_matches_type(D1, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -194,7 +193,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" database = response.parse() - assert_matches_type(D1DatabaseDetails, database, path=["response"]) + assert_matches_type(D1, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +206,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = response.parse() - assert_matches_type(D1DatabaseDetails, database, path=["response"]) + assert_matches_type(D1, database, path=["response"]) assert cast(Any, response.is_closed) is True @@ -305,7 +304,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="my-database", ) - assert_matches_type(D1CreateDatabase, database, path=["response"]) + assert_matches_type(DatabaseCreateResponse, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -318,7 +317,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" database = await response.parse() - assert_matches_type(D1CreateDatabase, database, path=["response"]) + assert_matches_type(DatabaseCreateResponse, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -331,7 +330,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = await response.parse() - assert_matches_type(D1CreateDatabase, database, path=["response"]) + assert_matches_type(DatabaseCreateResponse, database, path=["response"]) assert cast(Any, response.is_closed) is True @@ -350,7 +349,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: database = await async_client.d1.database.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[D1CreateDatabase], database, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DatabaseListResponse], database, path=["response"]) @pytest.mark.skip() @parametrize @@ -361,7 +360,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=10, ) - assert_matches_type(AsyncV4PagePaginationArray[D1CreateDatabase], database, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DatabaseListResponse], database, path=["response"]) @pytest.mark.skip() @parametrize @@ -373,7 +372,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[D1CreateDatabase], database, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DatabaseListResponse], database, path=["response"]) @pytest.mark.skip() @parametrize @@ -385,7 +384,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[D1CreateDatabase], database, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DatabaseListResponse], database, path=["response"]) assert cast(Any, response.is_closed) is True @@ -404,7 +403,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DatabaseDeleteResponse], database, path=["response"]) + assert_matches_type(DatabaseDeleteResponse, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,7 +416,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" database = await response.parse() - assert_matches_type(Optional[DatabaseDeleteResponse], database, path=["response"]) + assert_matches_type(DatabaseDeleteResponse, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -430,7 +429,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = await response.parse() - assert_matches_type(Optional[DatabaseDeleteResponse], database, path=["response"]) + assert_matches_type(DatabaseDeleteResponse, database, path=["response"]) assert cast(Any, response.is_closed) is True @@ -456,7 +455,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(D1DatabaseDetails, database, path=["response"]) + assert_matches_type(D1, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -469,7 +468,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" database = await response.parse() - assert_matches_type(D1DatabaseDetails, database, path=["response"]) + assert_matches_type(D1, database, path=["response"]) @pytest.mark.skip() @parametrize @@ -482,7 +481,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" database = await response.parse() - assert_matches_type(D1DatabaseDetails, database, path=["response"]) + assert_matches_type(D1, database, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dcv_delegation/test_uuid.py b/tests/api_resources/dcv_delegation/test_uuid.py index 0bb10895bed..b579d630a43 100644 --- a/tests/api_resources/dcv_delegation/test_uuid.py +++ b/tests/api_resources/dcv_delegation/test_uuid.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.dcv_delegation import DCVDelegationUUID +from cloudflare.types.dcv_delegation.dcv_delegation_uuid import DCVDelegationUUID base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/diagnostics/test_traceroutes.py b/tests/api_resources/diagnostics/test_traceroutes.py index 748aa9cc8d5..016476eebe5 100644 --- a/tests/api_resources/diagnostics/test_traceroutes.py +++ b/tests/api_resources/diagnostics/test_traceroutes.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.diagnostics import TracerouteCreateResponse +from cloudflare.types.diagnostics.traceroute_create_response import TracerouteCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/dns/analytics/reports/test_bytimes.py b/tests/api_resources/dns/analytics/reports/test_bytimes.py index ddd7f707f9d..5959ed99263 100644 --- a/tests/api_resources/dns/analytics/reports/test_bytimes.py +++ b/tests/api_resources/dns/analytics/reports/test_bytimes.py @@ -3,14 +3,14 @@ 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._utils import parse_datetime -from cloudflare.types.dns.analytics.reports import DNSAnalyticsReportByTime +from cloudflare.types.dns.analytics.reports.by_time import ByTime base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: bytime = client.dns.analytics.reports.bytimes.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +40,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: time_delta="hour", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -52,7 +52,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" bytime = response.parse() - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +64,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = response.parse() - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,7 +86,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: bytime = await async_client.dns.analytics.reports.bytimes.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +102,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - time_delta="hour", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -114,7 +114,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" bytime = await response.parse() - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = await response.parse() - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/analytics/test_reports.py b/tests/api_resources/dns/analytics/test_reports.py index 2667a082de7..bdf0584439e 100644 --- a/tests/api_resources/dns/analytics/test_reports.py +++ b/tests/api_resources/dns/analytics/test_reports.py @@ -3,14 +3,14 @@ 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._utils import parse_datetime -from cloudflare.types.dns.analytics import DNSAnalyticsReport +from cloudflare.types.dns.analytics.report import Report base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: report = client.dns.analytics.reports.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: sort="+responseCode,-queryName", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,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" report = response.parse() - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = response.parse() - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +85,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: report = await async_client.dns.analytics.reports.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - sort="+responseCode,-queryName", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,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" report = await response.parse() - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -124,7 +124,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = await response.parse() - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py b/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py index a2d0f8a7b6d..afa2d3787af 100644 --- a/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py +++ b/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py @@ -3,14 +3,14 @@ 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._utils import parse_datetime -from cloudflare.types.dns.analytics.reports import DNSAnalyticsReportByTime +from cloudflare.types.dns.analytics.reports.by_time import ByTime base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +42,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: time_delta="hour", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +55,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" bytime = response.parse() - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +68,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = response.parse() - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) assert cast(Any, response.is_closed) is True @@ -98,7 +98,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +115,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - time_delta="hour", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -128,7 +128,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" bytime = await response.parse() - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -141,7 +141,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = await response.parse() - assert_matches_type(DNSAnalyticsReportByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/firewall/analytics/test_reports.py b/tests/api_resources/dns/firewall/analytics/test_reports.py index e36cb3033ac..3229cd5a8ac 100644 --- a/tests/api_resources/dns/firewall/analytics/test_reports.py +++ b/tests/api_resources/dns/firewall/analytics/test_reports.py @@ -3,14 +3,14 @@ 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._utils import parse_datetime -from cloudflare.types.dns.analytics import DNSAnalyticsReport +from cloudflare.types.dns.analytics.report import Report base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +41,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: sort="+responseCode,-queryName", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,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" report = response.parse() - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -67,7 +67,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = response.parse() - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) assert cast(Any, response.is_closed) is True @@ -97,7 +97,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +113,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - sort="+responseCode,-queryName", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,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" report = await response.parse() - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +139,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = await response.parse() - assert_matches_type(DNSAnalyticsReport, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/test_firewall.py b/tests/api_resources/dns/test_firewall.py index 736b3bf0e5f..e6b536e9e09 100644 --- a/tests/api_resources/dns/test_firewall.py +++ b/tests/api_resources/dns/test_firewall.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.dns import ( - DNSFirewall, - FirewallDeleteResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.dns.firewall.firewall import Firewall +from cloudflare.types.dns.firewall_delete_response import FirewallDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="My Awesome DNS Firewall cluster", upstream_ips=["192.0.2.1", "198.51.100.1", "2001:DB8:100::CF"], ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +48,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ratelimit=600, retries=2, ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +62,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" firewall = response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -78,7 +76,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -98,7 +96,7 @@ def test_method_list(self, client: Cloudflare) -> None: firewall = client.dns.firewall.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[DNSFirewall], firewall, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Firewall], firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -108,7 +106,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=1, ) - assert_matches_type(SyncV4PagePaginationArray[DNSFirewall], firewall, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Firewall], firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -120,7 +118,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = response.parse() - assert_matches_type(SyncV4PagePaginationArray[DNSFirewall], firewall, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Firewall], firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -132,7 +130,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = response.parse() - assert_matches_type(SyncV4PagePaginationArray[DNSFirewall], firewall, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Firewall], firewall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -150,6 +148,7 @@ def test_method_delete(self, client: Cloudflare) -> None: firewall = client.dns.firewall.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(FirewallDeleteResponse, firewall, path=["response"]) @@ -159,6 +158,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.dns.firewall.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -172,6 +172,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.dns.firewall.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -188,12 +189,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.dns.firewall.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dns_firewall_id` but received ''"): client.dns.firewall.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -210,7 +213,7 @@ def test_method_edit(self, client: Cloudflare) -> None: name="My Awesome DNS Firewall cluster", upstream_ips=["192.0.2.1", "198.51.100.1", "2001:DB8:100::CF"], ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +236,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: ratelimit=600, retries=2, ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -253,7 +256,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" firewall = response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +276,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -313,7 +316,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +329,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" firewall = response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -339,7 +342,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -370,7 +373,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="My Awesome DNS Firewall cluster", upstream_ips=["192.0.2.1", "198.51.100.1", "2001:DB8:100::CF"], ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,7 +394,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ratelimit=600, retries=2, ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -405,7 +408,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" firewall = await response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -419,7 +422,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = await response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -439,7 +442,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: firewall = await async_client.dns.firewall.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[DNSFirewall], firewall, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Firewall], firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -449,7 +452,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=1, ) - assert_matches_type(AsyncV4PagePaginationArray[DNSFirewall], firewall, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Firewall], firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +464,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[DNSFirewall], firewall, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Firewall], firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -473,7 +476,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[DNSFirewall], firewall, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Firewall], firewall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -491,6 +494,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: firewall = await async_client.dns.firewall.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(FirewallDeleteResponse, firewall, path=["response"]) @@ -500,6 +504,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.dns.firewall.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -513,6 +518,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.dns.firewall.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -529,12 +535,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.dns.firewall.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dns_firewall_id` but received ''"): await async_client.dns.firewall.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -551,7 +559,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: name="My Awesome DNS Firewall cluster", upstream_ips=["192.0.2.1", "198.51.100.1", "2001:DB8:100::CF"], ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -574,7 +582,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) ratelimit=600, retries=2, ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -594,7 +602,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" firewall = await response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -614,7 +622,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = await response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -654,7 +662,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -667,7 +675,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" firewall = await response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) @pytest.mark.skip() @parametrize @@ -680,7 +688,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall = await response.parse() - assert_matches_type(DNSFirewall, firewall, path=["response"]) + assert_matches_type(Firewall, firewall, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/test_records.py b/tests/api_resources/dns/test_records.py index 3ef9bf993d8..6999945188d 100644 --- a/tests/api_resources/dns/test_records.py +++ b/tests/api_resources/dns/test_records.py @@ -9,13 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.dns import ( - DNSRecord, - RecordScanResponse, - RecordDeleteResponse, - RecordImportResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.dns.record import Record +from cloudflare.types.dns.record_scan_response import RecordScanResponse +from cloudflare.types.dns.record_delete_response import RecordDeleteResponse +from cloudflare.types.dns.record_import_response import RecordImportResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -32,7 +30,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: name="example.com", type="A", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +45,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +60,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -77,7 +75,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -101,7 +99,7 @@ def test_method_create_overload_2(self, client: Cloudflare) -> None: name="example.com", type="AAAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +114,7 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +129,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -146,7 +144,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -170,7 +168,7 @@ def test_method_create_overload_3(self, client: Cloudflare) -> None: name="example.com", type="CAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +186,7 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +201,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -218,7 +216,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -242,7 +240,7 @@ def test_method_create_overload_4(self, client: Cloudflare) -> None: name="example.com", type="CERT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -261,7 +259,7 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -276,7 +274,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -291,7 +289,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -315,7 +313,7 @@ def test_method_create_overload_5(self, client: Cloudflare) -> None: name="example.com", type="CNAME", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -330,7 +328,7 @@ def test_method_create_with_all_params_overload_5(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -345,7 +343,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -360,7 +358,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -384,7 +382,7 @@ def test_method_create_overload_6(self, client: Cloudflare) -> None: name="example.com", type="DNSKEY", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -403,7 +401,7 @@ def test_method_create_with_all_params_overload_6(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -418,7 +416,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -433,7 +431,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -457,7 +455,7 @@ def test_method_create_overload_7(self, client: Cloudflare) -> None: name="example.com", type="DS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -476,7 +474,7 @@ def test_method_create_with_all_params_overload_7(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -491,7 +489,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -506,7 +504,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -530,7 +528,7 @@ def test_method_create_overload_8(self, client: Cloudflare) -> None: name="example.com", type="HTTPS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -548,7 +546,7 @@ def test_method_create_with_all_params_overload_8(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -563,7 +561,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -578,7 +576,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -602,7 +600,7 @@ def test_method_create_overload_9(self, client: Cloudflare) -> None: name="example.com", type="LOC", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -629,7 +627,7 @@ def test_method_create_with_all_params_overload_9(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -644,7 +642,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -659,7 +657,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -684,7 +682,7 @@ def test_method_create_overload_10(self, client: Cloudflare) -> None: priority=10, type="MX", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -699,7 +697,7 @@ def test_method_create_with_all_params_overload_10(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -715,7 +713,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -731,7 +729,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -756,7 +754,7 @@ def test_method_create_overload_11(self, client: Cloudflare) -> None: name="example.com", type="NAPTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -777,7 +775,7 @@ def test_method_create_with_all_params_overload_11(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -792,7 +790,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -807,7 +805,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -831,7 +829,7 @@ def test_method_create_overload_12(self, client: Cloudflare) -> None: name="example.com", type="NS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -845,7 +843,7 @@ def test_method_create_with_all_params_overload_12(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -860,7 +858,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -875,7 +873,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -899,7 +897,7 @@ def test_method_create_overload_13(self, client: Cloudflare) -> None: name="example.com", type="PTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -913,7 +911,7 @@ def test_method_create_with_all_params_overload_13(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -928,7 +926,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -943,7 +941,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -967,7 +965,7 @@ def test_method_create_overload_14(self, client: Cloudflare) -> None: name="example.com", type="SMIMEA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -986,7 +984,7 @@ def test_method_create_with_all_params_overload_14(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1001,7 +999,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1016,7 +1014,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1040,7 +1038,7 @@ def test_method_create_overload_15(self, client: Cloudflare) -> None: name="_sip._tcp.example.com", type="SRV", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1062,7 +1060,7 @@ def test_method_create_with_all_params_overload_15(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1077,7 +1075,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1092,7 +1090,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1116,7 +1114,7 @@ def test_method_create_overload_16(self, client: Cloudflare) -> None: name="example.com", type="SSHFP", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1134,7 +1132,7 @@ def test_method_create_with_all_params_overload_16(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1149,7 +1147,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1164,7 +1162,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1188,7 +1186,7 @@ def test_method_create_overload_17(self, client: Cloudflare) -> None: name="example.com", type="SVCB", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1206,7 +1204,7 @@ def test_method_create_with_all_params_overload_17(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1221,7 +1219,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1236,7 +1234,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1260,7 +1258,7 @@ def test_method_create_overload_18(self, client: Cloudflare) -> None: name="example.com", type="TLSA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1279,7 +1277,7 @@ def test_method_create_with_all_params_overload_18(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1294,7 +1292,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1309,7 +1307,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1333,7 +1331,7 @@ def test_method_create_overload_19(self, client: Cloudflare) -> None: name="example.com", type="TXT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1347,7 +1345,7 @@ def test_method_create_with_all_params_overload_19(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1362,7 +1360,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1377,7 +1375,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1402,7 +1400,7 @@ def test_method_create_overload_20(self, client: Cloudflare) -> None: priority=10, type="URI", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1420,7 +1418,7 @@ def test_method_create_with_all_params_overload_20(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1436,7 +1434,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1452,7 +1450,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1478,7 +1476,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: name="example.com", type="A", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1494,7 +1492,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1510,7 +1508,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1526,7 +1524,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1561,7 +1559,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: name="example.com", type="AAAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1577,7 +1575,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1593,7 +1591,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1609,7 +1607,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1644,7 +1642,7 @@ def test_method_update_overload_3(self, client: Cloudflare) -> None: name="example.com", type="CAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1663,7 +1661,7 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1679,7 +1677,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1695,7 +1693,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1730,7 +1728,7 @@ def test_method_update_overload_4(self, client: Cloudflare) -> None: name="example.com", type="CERT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1750,7 +1748,7 @@ def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1766,7 +1764,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1782,7 +1780,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1817,7 +1815,7 @@ def test_method_update_overload_5(self, client: Cloudflare) -> None: name="example.com", type="CNAME", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1833,7 +1831,7 @@ def test_method_update_with_all_params_overload_5(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1849,7 +1847,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1865,7 +1863,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1900,7 +1898,7 @@ def test_method_update_overload_6(self, client: Cloudflare) -> None: name="example.com", type="DNSKEY", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1920,7 +1918,7 @@ def test_method_update_with_all_params_overload_6(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1936,7 +1934,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -1952,7 +1950,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1987,7 +1985,7 @@ def test_method_update_overload_7(self, client: Cloudflare) -> None: name="example.com", type="DS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2007,7 +2005,7 @@ def test_method_update_with_all_params_overload_7(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2023,7 +2021,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2039,7 +2037,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2074,7 +2072,7 @@ def test_method_update_overload_8(self, client: Cloudflare) -> None: name="example.com", type="HTTPS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2093,7 +2091,7 @@ def test_method_update_with_all_params_overload_8(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2109,7 +2107,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2125,7 +2123,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2160,7 +2158,7 @@ def test_method_update_overload_9(self, client: Cloudflare) -> None: name="example.com", type="LOC", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2188,7 +2186,7 @@ def test_method_update_with_all_params_overload_9(self, client: Cloudflare) -> N tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2204,7 +2202,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2220,7 +2218,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2256,7 +2254,7 @@ def test_method_update_overload_10(self, client: Cloudflare) -> None: priority=10, type="MX", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2272,7 +2270,7 @@ def test_method_update_with_all_params_overload_10(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2289,7 +2287,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2306,7 +2304,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2343,7 +2341,7 @@ def test_method_update_overload_11(self, client: Cloudflare) -> None: name="example.com", type="NAPTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2365,7 +2363,7 @@ def test_method_update_with_all_params_overload_11(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2381,7 +2379,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2397,7 +2395,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2432,7 +2430,7 @@ def test_method_update_overload_12(self, client: Cloudflare) -> None: name="example.com", type="NS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2447,7 +2445,7 @@ def test_method_update_with_all_params_overload_12(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2463,7 +2461,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2479,7 +2477,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2514,7 +2512,7 @@ def test_method_update_overload_13(self, client: Cloudflare) -> None: name="example.com", type="PTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2529,7 +2527,7 @@ def test_method_update_with_all_params_overload_13(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2545,7 +2543,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2561,7 +2559,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2596,7 +2594,7 @@ def test_method_update_overload_14(self, client: Cloudflare) -> None: name="example.com", type="SMIMEA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2616,7 +2614,7 @@ def test_method_update_with_all_params_overload_14(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2632,7 +2630,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2648,7 +2646,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2683,7 +2681,7 @@ def test_method_update_overload_15(self, client: Cloudflare) -> None: name="_sip._tcp.example.com", type="SRV", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2706,7 +2704,7 @@ def test_method_update_with_all_params_overload_15(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2722,7 +2720,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2738,7 +2736,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2773,7 +2771,7 @@ def test_method_update_overload_16(self, client: Cloudflare) -> None: name="example.com", type="SSHFP", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2792,7 +2790,7 @@ def test_method_update_with_all_params_overload_16(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2808,7 +2806,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2824,7 +2822,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2859,7 +2857,7 @@ def test_method_update_overload_17(self, client: Cloudflare) -> None: name="example.com", type="SVCB", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2878,7 +2876,7 @@ def test_method_update_with_all_params_overload_17(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2894,7 +2892,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2910,7 +2908,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2945,7 +2943,7 @@ def test_method_update_overload_18(self, client: Cloudflare) -> None: name="example.com", type="TLSA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2965,7 +2963,7 @@ def test_method_update_with_all_params_overload_18(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2981,7 +2979,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -2997,7 +2995,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3032,7 +3030,7 @@ def test_method_update_overload_19(self, client: Cloudflare) -> None: name="example.com", type="TXT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3047,7 +3045,7 @@ def test_method_update_with_all_params_overload_19(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3063,7 +3061,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3079,7 +3077,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3115,7 +3113,7 @@ def test_method_update_overload_20(self, client: Cloudflare) -> None: priority=10, type="URI", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3134,7 +3132,7 @@ def test_method_update_with_all_params_overload_20(self, client: Cloudflare) -> tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3151,7 +3149,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3168,7 +3166,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3201,7 +3199,7 @@ def test_method_list(self, client: Cloudflare) -> None: record = client.dns.records.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[DNSRecord], record, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3236,7 +3234,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: tag_match="any", type="A", ) - assert_matches_type(SyncV4PagePaginationArray[DNSRecord], record, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3248,7 +3246,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(SyncV4PagePaginationArray[DNSRecord], record, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3260,7 +3258,7 @@ 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[DNSRecord], record, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3278,6 +3276,7 @@ def test_method_delete(self, client: Cloudflare) -> None: record = client.dns.records.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[RecordDeleteResponse], record, path=["response"]) @@ -3287,6 +3286,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.dns.records.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -3300,6 +3300,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.dns.records.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3316,12 +3317,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.dns.records.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dns_record_id` but received ''"): client.dns.records.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -3334,7 +3337,7 @@ def test_method_edit_overload_1(self, client: Cloudflare) -> None: name="example.com", type="A", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3350,7 +3353,7 @@ def test_method_edit_with_all_params_overload_1(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3366,7 +3369,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3382,7 +3385,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3417,7 +3420,7 @@ def test_method_edit_overload_2(self, client: Cloudflare) -> None: name="example.com", type="AAAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3433,7 +3436,7 @@ def test_method_edit_with_all_params_overload_2(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3449,7 +3452,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3465,7 +3468,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3500,7 +3503,7 @@ def test_method_edit_overload_3(self, client: Cloudflare) -> None: name="example.com", type="CAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3519,7 +3522,7 @@ def test_method_edit_with_all_params_overload_3(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3535,7 +3538,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3551,7 +3554,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3586,7 +3589,7 @@ def test_method_edit_overload_4(self, client: Cloudflare) -> None: name="example.com", type="CERT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3606,7 +3609,7 @@ def test_method_edit_with_all_params_overload_4(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3622,7 +3625,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3638,7 +3641,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3673,7 +3676,7 @@ def test_method_edit_overload_5(self, client: Cloudflare) -> None: name="example.com", type="CNAME", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3689,7 +3692,7 @@ def test_method_edit_with_all_params_overload_5(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3705,7 +3708,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3721,7 +3724,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3756,7 +3759,7 @@ def test_method_edit_overload_6(self, client: Cloudflare) -> None: name="example.com", type="DNSKEY", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3776,7 +3779,7 @@ def test_method_edit_with_all_params_overload_6(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3792,7 +3795,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3808,7 +3811,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3843,7 +3846,7 @@ def test_method_edit_overload_7(self, client: Cloudflare) -> None: name="example.com", type="DS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3863,7 +3866,7 @@ def test_method_edit_with_all_params_overload_7(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3879,7 +3882,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3895,7 +3898,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3930,7 +3933,7 @@ def test_method_edit_overload_8(self, client: Cloudflare) -> None: name="example.com", type="HTTPS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3949,7 +3952,7 @@ def test_method_edit_with_all_params_overload_8(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3965,7 +3968,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -3981,7 +3984,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4016,7 +4019,7 @@ def test_method_edit_overload_9(self, client: Cloudflare) -> None: name="example.com", type="LOC", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4044,7 +4047,7 @@ def test_method_edit_with_all_params_overload_9(self, client: Cloudflare) -> Non tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4060,7 +4063,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4076,7 +4079,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4112,7 +4115,7 @@ def test_method_edit_overload_10(self, client: Cloudflare) -> None: priority=10, type="MX", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4128,7 +4131,7 @@ def test_method_edit_with_all_params_overload_10(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4145,7 +4148,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4162,7 +4165,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4199,7 +4202,7 @@ def test_method_edit_overload_11(self, client: Cloudflare) -> None: name="example.com", type="NAPTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4221,7 +4224,7 @@ def test_method_edit_with_all_params_overload_11(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4237,7 +4240,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4253,7 +4256,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4288,7 +4291,7 @@ def test_method_edit_overload_12(self, client: Cloudflare) -> None: name="example.com", type="NS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4303,7 +4306,7 @@ def test_method_edit_with_all_params_overload_12(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4319,7 +4322,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4335,7 +4338,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4370,7 +4373,7 @@ def test_method_edit_overload_13(self, client: Cloudflare) -> None: name="example.com", type="PTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4385,7 +4388,7 @@ def test_method_edit_with_all_params_overload_13(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4401,7 +4404,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4417,7 +4420,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4452,7 +4455,7 @@ def test_method_edit_overload_14(self, client: Cloudflare) -> None: name="example.com", type="SMIMEA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4472,7 +4475,7 @@ def test_method_edit_with_all_params_overload_14(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4488,7 +4491,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4504,7 +4507,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4539,7 +4542,7 @@ def test_method_edit_overload_15(self, client: Cloudflare) -> None: name="_sip._tcp.example.com", type="SRV", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4562,7 +4565,7 @@ def test_method_edit_with_all_params_overload_15(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4578,7 +4581,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4594,7 +4597,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4629,7 +4632,7 @@ def test_method_edit_overload_16(self, client: Cloudflare) -> None: name="example.com", type="SSHFP", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4648,7 +4651,7 @@ def test_method_edit_with_all_params_overload_16(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4664,7 +4667,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4680,7 +4683,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4715,7 +4718,7 @@ def test_method_edit_overload_17(self, client: Cloudflare) -> None: name="example.com", type="SVCB", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4734,7 +4737,7 @@ def test_method_edit_with_all_params_overload_17(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4750,7 +4753,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4766,7 +4769,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4801,7 +4804,7 @@ def test_method_edit_overload_18(self, client: Cloudflare) -> None: name="example.com", type="TLSA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4821,7 +4824,7 @@ def test_method_edit_with_all_params_overload_18(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4837,7 +4840,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4853,7 +4856,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4888,7 +4891,7 @@ def test_method_edit_overload_19(self, client: Cloudflare) -> None: name="example.com", type="TXT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4903,7 +4906,7 @@ def test_method_edit_with_all_params_overload_19(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4919,7 +4922,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4935,7 +4938,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4971,7 +4974,7 @@ def test_method_edit_overload_20(self, client: Cloudflare) -> None: priority=10, type="URI", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -4990,7 +4993,7 @@ def test_method_edit_with_all_params_overload_20(self, client: Cloudflare) -> No tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5007,7 +5010,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5024,7 +5027,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5100,7 +5103,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5113,7 +5116,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" record = response.parse() - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5126,7 +5129,7 @@ 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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5152,7 +5155,7 @@ def test_method_import(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", file="www.example.com. 300 IN A 127.0.0.1", ) - assert_matches_type(RecordImportResponse, record, path=["response"]) + assert_matches_type(Optional[RecordImportResponse], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5162,7 +5165,7 @@ def test_method_import_with_all_params(self, client: Cloudflare) -> None: file="www.example.com. 300 IN A 127.0.0.1", proxied="true", ) - assert_matches_type(RecordImportResponse, record, path=["response"]) + assert_matches_type(Optional[RecordImportResponse], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5175,7 +5178,7 @@ def test_raw_response_import(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(RecordImportResponse, record, path=["response"]) + assert_matches_type(Optional[RecordImportResponse], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5188,7 +5191,7 @@ def test_streaming_response_import(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(RecordImportResponse, record, path=["response"]) + assert_matches_type(Optional[RecordImportResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5206,32 +5209,35 @@ def test_path_params_import(self, client: Cloudflare) -> None: def test_method_scan(self, client: Cloudflare) -> None: record = client.dns.records.scan( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(RecordScanResponse, record, path=["response"]) + assert_matches_type(Optional[RecordScanResponse], record, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_scan(self, client: Cloudflare) -> None: response = client.dns.records.with_raw_response.scan( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(RecordScanResponse, record, path=["response"]) + assert_matches_type(Optional[RecordScanResponse], record, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_scan(self, client: Cloudflare) -> None: with client.dns.records.with_streaming_response.scan( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = response.parse() - assert_matches_type(RecordScanResponse, record, path=["response"]) + assert_matches_type(Optional[RecordScanResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5241,6 +5247,7 @@ def test_path_params_scan(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.dns.records.with_raw_response.scan( zone_id="", + body={}, ) @@ -5256,7 +5263,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> name="example.com", type="A", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5271,7 +5278,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5286,7 +5293,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5301,7 +5308,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5325,7 +5332,7 @@ async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> name="example.com", type="AAAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5340,7 +5347,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5355,7 +5362,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5370,7 +5377,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5394,7 +5401,7 @@ async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> name="example.com", type="CAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5412,7 +5419,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5427,7 +5434,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5442,7 +5449,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5466,7 +5473,7 @@ async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> name="example.com", type="CERT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5485,7 +5492,7 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5500,7 +5507,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5515,7 +5522,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5539,7 +5546,7 @@ async def test_method_create_overload_5(self, async_client: AsyncCloudflare) -> name="example.com", type="CNAME", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5554,7 +5561,7 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5569,7 +5576,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5584,7 +5591,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5608,7 +5615,7 @@ async def test_method_create_overload_6(self, async_client: AsyncCloudflare) -> name="example.com", type="DNSKEY", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5627,7 +5634,7 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5642,7 +5649,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5657,7 +5664,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5681,7 +5688,7 @@ async def test_method_create_overload_7(self, async_client: AsyncCloudflare) -> name="example.com", type="DS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5700,7 +5707,7 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5715,7 +5722,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5730,7 +5737,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5754,7 +5761,7 @@ async def test_method_create_overload_8(self, async_client: AsyncCloudflare) -> name="example.com", type="HTTPS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5772,7 +5779,7 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5787,7 +5794,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5802,7 +5809,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5826,7 +5833,7 @@ async def test_method_create_overload_9(self, async_client: AsyncCloudflare) -> name="example.com", type="LOC", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5853,7 +5860,7 @@ async def test_method_create_with_all_params_overload_9(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5868,7 +5875,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5883,7 +5890,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5908,7 +5915,7 @@ async def test_method_create_overload_10(self, async_client: AsyncCloudflare) -> priority=10, type="MX", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5923,7 +5930,7 @@ async def test_method_create_with_all_params_overload_10(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5939,7 +5946,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -5955,7 +5962,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5980,7 +5987,7 @@ async def test_method_create_overload_11(self, async_client: AsyncCloudflare) -> name="example.com", type="NAPTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6001,7 +6008,7 @@ async def test_method_create_with_all_params_overload_11(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6016,7 +6023,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6031,7 +6038,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6055,7 +6062,7 @@ async def test_method_create_overload_12(self, async_client: AsyncCloudflare) -> name="example.com", type="NS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6069,7 +6076,7 @@ async def test_method_create_with_all_params_overload_12(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6084,7 +6091,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6099,7 +6106,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6123,7 +6130,7 @@ async def test_method_create_overload_13(self, async_client: AsyncCloudflare) -> name="example.com", type="PTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6137,7 +6144,7 @@ async def test_method_create_with_all_params_overload_13(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6152,7 +6159,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6167,7 +6174,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6191,7 +6198,7 @@ async def test_method_create_overload_14(self, async_client: AsyncCloudflare) -> name="example.com", type="SMIMEA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6210,7 +6217,7 @@ async def test_method_create_with_all_params_overload_14(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6225,7 +6232,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6240,7 +6247,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6264,7 +6271,7 @@ async def test_method_create_overload_15(self, async_client: AsyncCloudflare) -> name="_sip._tcp.example.com", type="SRV", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6286,7 +6293,7 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6301,7 +6308,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6316,7 +6323,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6340,7 +6347,7 @@ async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> name="example.com", type="SSHFP", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6358,7 +6365,7 @@ async def test_method_create_with_all_params_overload_16(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6373,7 +6380,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6388,7 +6395,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6412,7 +6419,7 @@ async def test_method_create_overload_17(self, async_client: AsyncCloudflare) -> name="example.com", type="SVCB", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6430,7 +6437,7 @@ async def test_method_create_with_all_params_overload_17(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6445,7 +6452,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6460,7 +6467,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6484,7 +6491,7 @@ async def test_method_create_overload_18(self, async_client: AsyncCloudflare) -> name="example.com", type="TLSA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6503,7 +6510,7 @@ async def test_method_create_with_all_params_overload_18(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6518,7 +6525,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6533,7 +6540,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6557,7 +6564,7 @@ async def test_method_create_overload_19(self, async_client: AsyncCloudflare) -> name="example.com", type="TXT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6571,7 +6578,7 @@ async def test_method_create_with_all_params_overload_19(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6586,7 +6593,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6601,7 +6608,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6626,7 +6633,7 @@ async def test_method_create_overload_20(self, async_client: AsyncCloudflare) -> priority=10, type="URI", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6644,7 +6651,7 @@ async def test_method_create_with_all_params_overload_20(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6660,7 +6667,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6676,7 +6683,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6702,7 +6709,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> name="example.com", type="A", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6718,7 +6725,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6734,7 +6741,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6750,7 +6757,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6785,7 +6792,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> name="example.com", type="AAAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6801,7 +6808,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6817,7 +6824,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6833,7 +6840,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6868,7 +6875,7 @@ async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> name="example.com", type="CAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6887,7 +6894,7 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6903,7 +6910,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6919,7 +6926,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -6954,7 +6961,7 @@ async def test_method_update_overload_4(self, async_client: AsyncCloudflare) -> name="example.com", type="CERT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6974,7 +6981,7 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -6990,7 +6997,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7006,7 +7013,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7041,7 +7048,7 @@ async def test_method_update_overload_5(self, async_client: AsyncCloudflare) -> name="example.com", type="CNAME", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7057,7 +7064,7 @@ async def test_method_update_with_all_params_overload_5(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7073,7 +7080,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7089,7 +7096,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7124,7 +7131,7 @@ async def test_method_update_overload_6(self, async_client: AsyncCloudflare) -> name="example.com", type="DNSKEY", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7144,7 +7151,7 @@ async def test_method_update_with_all_params_overload_6(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7160,7 +7167,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7176,7 +7183,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7211,7 +7218,7 @@ async def test_method_update_overload_7(self, async_client: AsyncCloudflare) -> name="example.com", type="DS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7231,7 +7238,7 @@ async def test_method_update_with_all_params_overload_7(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7247,7 +7254,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7263,7 +7270,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7298,7 +7305,7 @@ async def test_method_update_overload_8(self, async_client: AsyncCloudflare) -> name="example.com", type="HTTPS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7317,7 +7324,7 @@ async def test_method_update_with_all_params_overload_8(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7333,7 +7340,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7349,7 +7356,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7384,7 +7391,7 @@ async def test_method_update_overload_9(self, async_client: AsyncCloudflare) -> name="example.com", type="LOC", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7412,7 +7419,7 @@ async def test_method_update_with_all_params_overload_9(self, async_client: Asyn tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7428,7 +7435,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7444,7 +7451,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7480,7 +7487,7 @@ async def test_method_update_overload_10(self, async_client: AsyncCloudflare) -> priority=10, type="MX", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7496,7 +7503,7 @@ async def test_method_update_with_all_params_overload_10(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7513,7 +7520,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7530,7 +7537,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7567,7 +7574,7 @@ async def test_method_update_overload_11(self, async_client: AsyncCloudflare) -> name="example.com", type="NAPTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7589,7 +7596,7 @@ async def test_method_update_with_all_params_overload_11(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7605,7 +7612,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7621,7 +7628,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7656,7 +7663,7 @@ async def test_method_update_overload_12(self, async_client: AsyncCloudflare) -> name="example.com", type="NS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7671,7 +7678,7 @@ async def test_method_update_with_all_params_overload_12(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7687,7 +7694,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7703,7 +7710,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7738,7 +7745,7 @@ async def test_method_update_overload_13(self, async_client: AsyncCloudflare) -> name="example.com", type="PTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7753,7 +7760,7 @@ async def test_method_update_with_all_params_overload_13(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7769,7 +7776,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7785,7 +7792,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7820,7 +7827,7 @@ async def test_method_update_overload_14(self, async_client: AsyncCloudflare) -> name="example.com", type="SMIMEA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7840,7 +7847,7 @@ async def test_method_update_with_all_params_overload_14(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7856,7 +7863,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7872,7 +7879,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7907,7 +7914,7 @@ async def test_method_update_overload_15(self, async_client: AsyncCloudflare) -> name="_sip._tcp.example.com", type="SRV", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7930,7 +7937,7 @@ async def test_method_update_with_all_params_overload_15(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7946,7 +7953,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -7962,7 +7969,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -7997,7 +8004,7 @@ async def test_method_update_overload_16(self, async_client: AsyncCloudflare) -> name="example.com", type="SSHFP", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8016,7 +8023,7 @@ async def test_method_update_with_all_params_overload_16(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8032,7 +8039,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8048,7 +8055,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8083,7 +8090,7 @@ async def test_method_update_overload_17(self, async_client: AsyncCloudflare) -> name="example.com", type="SVCB", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8102,7 +8109,7 @@ async def test_method_update_with_all_params_overload_17(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8118,7 +8125,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8134,7 +8141,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8169,7 +8176,7 @@ async def test_method_update_overload_18(self, async_client: AsyncCloudflare) -> name="example.com", type="TLSA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8189,7 +8196,7 @@ async def test_method_update_with_all_params_overload_18(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8205,7 +8212,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8221,7 +8228,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8256,7 +8263,7 @@ async def test_method_update_overload_19(self, async_client: AsyncCloudflare) -> name="example.com", type="TXT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8271,7 +8278,7 @@ async def test_method_update_with_all_params_overload_19(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8287,7 +8294,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8303,7 +8310,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8339,7 +8346,7 @@ async def test_method_update_overload_20(self, async_client: AsyncCloudflare) -> priority=10, type="URI", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8358,7 +8365,7 @@ async def test_method_update_with_all_params_overload_20(self, async_client: Asy tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8375,7 +8382,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8392,7 +8399,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8425,7 +8432,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: record = await async_client.dns.records.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[DNSRecord], record, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8460,7 +8467,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) tag_match="any", type="A", ) - assert_matches_type(AsyncV4PagePaginationArray[DNSRecord], record, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8472,7 +8479,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[DNSRecord], record, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8484,7 +8491,7 @@ 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[DNSRecord], record, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8502,6 +8509,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: record = await async_client.dns.records.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[RecordDeleteResponse], record, path=["response"]) @@ -8511,6 +8519,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.dns.records.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -8524,6 +8533,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.dns.records.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -8540,12 +8550,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.dns.records.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dns_record_id` but received ''"): await async_client.dns.records.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -8558,7 +8570,7 @@ async def test_method_edit_overload_1(self, async_client: AsyncCloudflare) -> No name="example.com", type="A", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8574,7 +8586,7 @@ async def test_method_edit_with_all_params_overload_1(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8590,7 +8602,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8606,7 +8618,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8641,7 +8653,7 @@ async def test_method_edit_overload_2(self, async_client: AsyncCloudflare) -> No name="example.com", type="AAAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8657,7 +8669,7 @@ async def test_method_edit_with_all_params_overload_2(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8673,7 +8685,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8689,7 +8701,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8724,7 +8736,7 @@ async def test_method_edit_overload_3(self, async_client: AsyncCloudflare) -> No name="example.com", type="CAA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8743,7 +8755,7 @@ async def test_method_edit_with_all_params_overload_3(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8759,7 +8771,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8775,7 +8787,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8810,7 +8822,7 @@ async def test_method_edit_overload_4(self, async_client: AsyncCloudflare) -> No name="example.com", type="CERT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8830,7 +8842,7 @@ async def test_method_edit_with_all_params_overload_4(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8846,7 +8858,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8862,7 +8874,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8897,7 +8909,7 @@ async def test_method_edit_overload_5(self, async_client: AsyncCloudflare) -> No name="example.com", type="CNAME", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8913,7 +8925,7 @@ async def test_method_edit_with_all_params_overload_5(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8929,7 +8941,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -8945,7 +8957,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -8980,7 +8992,7 @@ async def test_method_edit_overload_6(self, async_client: AsyncCloudflare) -> No name="example.com", type="DNSKEY", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9000,7 +9012,7 @@ async def test_method_edit_with_all_params_overload_6(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9016,7 +9028,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9032,7 +9044,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9067,7 +9079,7 @@ async def test_method_edit_overload_7(self, async_client: AsyncCloudflare) -> No name="example.com", type="DS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9087,7 +9099,7 @@ async def test_method_edit_with_all_params_overload_7(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9103,7 +9115,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9119,7 +9131,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9154,7 +9166,7 @@ async def test_method_edit_overload_8(self, async_client: AsyncCloudflare) -> No name="example.com", type="HTTPS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9173,7 +9185,7 @@ async def test_method_edit_with_all_params_overload_8(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9189,7 +9201,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9205,7 +9217,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9240,7 +9252,7 @@ async def test_method_edit_overload_9(self, async_client: AsyncCloudflare) -> No name="example.com", type="LOC", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9268,7 +9280,7 @@ async def test_method_edit_with_all_params_overload_9(self, async_client: AsyncC tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9284,7 +9296,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9300,7 +9312,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9336,7 +9348,7 @@ async def test_method_edit_overload_10(self, async_client: AsyncCloudflare) -> N priority=10, type="MX", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9352,7 +9364,7 @@ async def test_method_edit_with_all_params_overload_10(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9369,7 +9381,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9386,7 +9398,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9423,7 +9435,7 @@ async def test_method_edit_overload_11(self, async_client: AsyncCloudflare) -> N name="example.com", type="NAPTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9445,7 +9457,7 @@ async def test_method_edit_with_all_params_overload_11(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9461,7 +9473,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9477,7 +9489,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9512,7 +9524,7 @@ async def test_method_edit_overload_12(self, async_client: AsyncCloudflare) -> N name="example.com", type="NS", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9527,7 +9539,7 @@ async def test_method_edit_with_all_params_overload_12(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9543,7 +9555,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9559,7 +9571,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9594,7 +9606,7 @@ async def test_method_edit_overload_13(self, async_client: AsyncCloudflare) -> N name="example.com", type="PTR", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9609,7 +9621,7 @@ async def test_method_edit_with_all_params_overload_13(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9625,7 +9637,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9641,7 +9653,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9676,7 +9688,7 @@ async def test_method_edit_overload_14(self, async_client: AsyncCloudflare) -> N name="example.com", type="SMIMEA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9696,7 +9708,7 @@ async def test_method_edit_with_all_params_overload_14(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9712,7 +9724,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9728,7 +9740,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9763,7 +9775,7 @@ async def test_method_edit_overload_15(self, async_client: AsyncCloudflare) -> N name="_sip._tcp.example.com", type="SRV", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9786,7 +9798,7 @@ async def test_method_edit_with_all_params_overload_15(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9802,7 +9814,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9818,7 +9830,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9853,7 +9865,7 @@ async def test_method_edit_overload_16(self, async_client: AsyncCloudflare) -> N name="example.com", type="SSHFP", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9872,7 +9884,7 @@ async def test_method_edit_with_all_params_overload_16(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9888,7 +9900,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9904,7 +9916,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -9939,7 +9951,7 @@ async def test_method_edit_overload_17(self, async_client: AsyncCloudflare) -> N name="example.com", type="SVCB", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9958,7 +9970,7 @@ async def test_method_edit_with_all_params_overload_17(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9974,7 +9986,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -9990,7 +10002,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -10025,7 +10037,7 @@ async def test_method_edit_overload_18(self, async_client: AsyncCloudflare) -> N name="example.com", type="TLSA", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10045,7 +10057,7 @@ async def test_method_edit_with_all_params_overload_18(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10061,7 +10073,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10077,7 +10089,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -10112,7 +10124,7 @@ async def test_method_edit_overload_19(self, async_client: AsyncCloudflare) -> N name="example.com", type="TXT", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10127,7 +10139,7 @@ async def test_method_edit_with_all_params_overload_19(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10143,7 +10155,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10159,7 +10171,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -10195,7 +10207,7 @@ async def test_method_edit_overload_20(self, async_client: AsyncCloudflare) -> N priority=10, type="URI", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10214,7 +10226,7 @@ async def test_method_edit_with_all_params_overload_20(self, async_client: Async tags=["owner:dns-team", "owner:dns-team", "owner:dns-team"], ttl=3600, ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10231,7 +10243,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10248,7 +10260,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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -10324,7 +10336,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10337,7 +10349,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" record = await response.parse() - assert_matches_type(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10350,7 +10362,7 @@ 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(DNSRecord, record, path=["response"]) + assert_matches_type(Optional[Record], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -10376,7 +10388,7 @@ async def test_method_import(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", file="www.example.com. 300 IN A 127.0.0.1", ) - assert_matches_type(RecordImportResponse, record, path=["response"]) + assert_matches_type(Optional[RecordImportResponse], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10386,7 +10398,7 @@ async def test_method_import_with_all_params(self, async_client: AsyncCloudflare file="www.example.com. 300 IN A 127.0.0.1", proxied="true", ) - assert_matches_type(RecordImportResponse, record, path=["response"]) + assert_matches_type(Optional[RecordImportResponse], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10399,7 +10411,7 @@ async def test_raw_response_import(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(RecordImportResponse, record, path=["response"]) + assert_matches_type(Optional[RecordImportResponse], record, path=["response"]) @pytest.mark.skip() @parametrize @@ -10412,7 +10424,7 @@ async def test_streaming_response_import(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(RecordImportResponse, record, path=["response"]) + assert_matches_type(Optional[RecordImportResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -10430,32 +10442,35 @@ async def test_path_params_import(self, async_client: AsyncCloudflare) -> None: async def test_method_scan(self, async_client: AsyncCloudflare) -> None: record = await async_client.dns.records.scan( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(RecordScanResponse, record, path=["response"]) + assert_matches_type(Optional[RecordScanResponse], record, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_scan(self, async_client: AsyncCloudflare) -> None: response = await async_client.dns.records.with_raw_response.scan( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(RecordScanResponse, record, path=["response"]) + assert_matches_type(Optional[RecordScanResponse], record, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_scan(self, async_client: AsyncCloudflare) -> None: async with async_client.dns.records.with_streaming_response.scan( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" record = await response.parse() - assert_matches_type(RecordScanResponse, record, path=["response"]) + assert_matches_type(Optional[RecordScanResponse], record, path=["response"]) assert cast(Any, response.is_closed) is True @@ -10465,4 +10480,5 @@ async def test_path_params_scan(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.dns.records.with_raw_response.scan( zone_id="", + body={}, ) diff --git a/tests/api_resources/durable_objects/namespaces/test_objects.py b/tests/api_resources/durable_objects/namespaces/test_objects.py index 3273c4e5eda..61c1048c00e 100644 --- a/tests/api_resources/durable_objects/namespaces/test_objects.py +++ b/tests/api_resources/durable_objects/namespaces/test_objects.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncCursorLimitPagination, AsyncCursorLimitPagination -from cloudflare.types.durable_objects.namespaces import DurableObject +from cloudflare.types.durable_objects.namespaces.durable_object import DurableObject base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/durable_objects/test_namespaces.py b/tests/api_resources/durable_objects/test_namespaces.py index 75327428664..f983ae2a822 100644 --- a/tests/api_resources/durable_objects/test_namespaces.py +++ b/tests/api_resources/durable_objects/test_namespaces.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.durable_objects import DurableObjectNamespace +from cloudflare.types.durable_objects.namespace import Namespace base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: namespace = client.durable_objects.namespaces.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) + assert_matches_type(SyncSinglePage[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(SyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) + assert_matches_type(SyncSinglePage[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(SyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) + assert_matches_type(SyncSinglePage[Namespace], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: namespace = await async_client.durable_objects.namespaces.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -82,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(AsyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(AsyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[Namespace], namespace, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/email_routing/rules/test_catch_alls.py b/tests/api_resources/email_routing/rules/test_catch_alls.py index 43476d56695..94505eb592c 100644 --- a/tests/api_resources/email_routing/rules/test_catch_alls.py +++ b/tests/api_resources/email_routing/rules/test_catch_alls.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.email_routing.rules import EmailCatchAllRule +from cloudflare.types.email_routing.rules.catch_all_get_response import CatchAllGetResponse +from cloudflare.types.email_routing.rules.catch_all_update_response import CatchAllUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None: actions=[{"type": "forward"}, {"type": "forward"}, {"type": "forward"}], matchers=[{"type": "all"}, {"type": "all"}, {"type": "all"}], ) - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +63,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: enabled=True, name="Send to user@example.net rule.", ) - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -76,7 +77,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = response.parse() - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -90,7 +91,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = response.parse() - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) assert cast(Any, response.is_closed) is True @@ -110,7 +111,7 @@ def test_method_get(self, client: Cloudflare) -> None: catch_all = client.email_routing.rules.catch_alls.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +123,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" catch_all = response.parse() - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +135,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = response.parse() - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) assert cast(Any, response.is_closed) is True @@ -158,7 +159,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: actions=[{"type": "forward"}, {"type": "forward"}, {"type": "forward"}], matchers=[{"type": "all"}, {"type": "all"}, {"type": "all"}], ) - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -195,7 +196,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare enabled=True, name="Send to user@example.net rule.", ) - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -209,7 +210,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = await response.parse() - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -223,7 +224,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = await response.parse() - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) assert cast(Any, response.is_closed) is True @@ -243,7 +244,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: catch_all = await async_client.email_routing.rules.catch_alls.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +256,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" catch_all = await response.parse() - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) @pytest.mark.skip() @parametrize @@ -267,7 +268,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = await response.parse() - assert_matches_type(EmailCatchAllRule, catch_all, path=["response"]) + assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/email_routing/test_addresses.py b/tests/api_resources/email_routing/test_addresses.py index 5c2ba2fe99c..e362ccaa7f2 100644 --- a/tests/api_resources/email_routing/test_addresses.py +++ b/tests/api_resources/email_routing/test_addresses.py @@ -10,12 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.email_routing import ( - AddressGetResponse, - AddressListResponse, - AddressCreateResponse, - AddressDeleteResponse, -) +from cloudflare.types.email_routing.address import Address base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", email="user@example.com", ) - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +38,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" address = response.parse() - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +51,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +70,7 @@ def test_method_list(self, client: Cloudflare) -> None: address = client.email_routing.addresses.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Address], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +82,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: per_page=5, verified=True, ) - assert_matches_type(SyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Address], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +94,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Address], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +106,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Address], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -130,7 +125,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +138,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" address = response.parse() - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +151,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -184,7 +179,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +192,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" address = response.parse() - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +205,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -242,7 +237,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", email="user@example.com", ) - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +250,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" address = await response.parse() - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +263,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressCreateResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -287,7 +282,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: address = await async_client.email_routing.addresses.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Address], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -299,7 +294,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) per_page=5, verified=True, ) - assert_matches_type(AsyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Address], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +306,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Address], address, path=["response"]) @pytest.mark.skip() @parametrize @@ -323,7 +318,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AddressListResponse], address, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Address], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +337,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -355,7 +350,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" address = await response.parse() - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -368,7 +363,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressDeleteResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -396,7 +391,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -409,7 +404,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" address = await response.parse() - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) @pytest.mark.skip() @parametrize @@ -422,7 +417,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(AddressGetResponse, address, path=["response"]) + assert_matches_type(Address, address, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/email_routing/test_dns.py b/tests/api_resources/email_routing/test_dns.py index c4831f6464d..0a5b5b2d451 100644 --- a/tests/api_resources/email_routing/test_dns.py +++ b/tests/api_resources/email_routing/test_dns.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.email_routing import DNSGetResponse +from cloudflare.types.email_routing.dns_get_response import DNSGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/email_routing/test_rules.py b/tests/api_resources/email_routing/test_rules.py index 1cef90e4b86..4e8e84f075a 100644 --- a/tests/api_resources/email_routing/test_rules.py +++ b/tests/api_resources/email_routing/test_rules.py @@ -10,13 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.email_routing import ( - RuleGetResponse, - RuleListResponse, - RuleCreateResponse, - RuleDeleteResponse, - RuleUpdateResponse, -) +from cloudflare.types.email_routing.email_routing_rule import EmailRoutingRule base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -73,7 +67,7 @@ def test_method_create(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +121,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +176,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" rule = response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -237,7 +231,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +336,7 @@ def test_method_update(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -397,7 +391,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -453,7 +447,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -509,7 +503,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -620,7 +614,7 @@ def test_method_list(self, client: Cloudflare) -> None: rule = client.email_routing.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[EmailRoutingRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -631,7 +625,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=5, ) - assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[EmailRoutingRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -643,7 +637,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[EmailRoutingRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -655,7 +649,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -674,7 +668,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -687,7 +681,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" rule = response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -700,7 +694,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -726,7 +720,7 @@ def test_method_get(self, client: Cloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -739,7 +733,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" rule = response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -752,7 +746,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -824,7 +818,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: }, ], ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -878,7 +872,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -933,7 +927,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" rule = await response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -988,7 +982,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1093,7 +1087,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: }, ], ) - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1148,7 +1142,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1204,7 +1198,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1260,7 +1254,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1371,7 +1365,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: rule = await async_client.email_routing.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[EmailRoutingRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1382,7 +1376,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=5, ) - assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[EmailRoutingRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1394,7 +1388,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[EmailRoutingRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1406,7 +1400,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1425,7 +1419,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1438,7 +1432,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" rule = await response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1451,7 +1445,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1477,7 +1471,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1490,7 +1484,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" rule = await response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -1503,7 +1497,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(EmailRoutingRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/firewall/__init__.py b/tests/api_resources/event_notifications/__init__.py similarity index 100% rename from tests/api_resources/user/firewall/__init__.py rename to tests/api_resources/event_notifications/__init__.py diff --git a/tests/api_resources/user/load_balancers/__init__.py b/tests/api_resources/event_notifications/r2/__init__.py similarity index 100% rename from tests/api_resources/user/load_balancers/__init__.py rename to tests/api_resources/event_notifications/r2/__init__.py diff --git a/tests/api_resources/user/load_balancers/analytics/__init__.py b/tests/api_resources/event_notifications/r2/configuration/__init__.py similarity index 100% rename from tests/api_resources/user/load_balancers/analytics/__init__.py rename to tests/api_resources/event_notifications/r2/configuration/__init__.py diff --git a/tests/api_resources/event_notifications/r2/configuration/test_queues.py b/tests/api_resources/event_notifications/r2/configuration/test_queues.py new file mode 100644 index 00000000000..1f9bd041955 --- /dev/null +++ b/tests/api_resources/event_notifications/r2/configuration/test_queues.py @@ -0,0 +1,333 @@ +# 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.event_notifications.r2.configuration.queue_delete_response import QueueDeleteResponse +from cloudflare.types.event_notifications.r2.configuration.queue_update_response import QueueUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestQueues: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + queue = client.event_notifications.r2.configuration.queues.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(QueueUpdateResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + queue = client.event_notifications.r2.configuration.queues.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + rules=[ + { + "actions": ["PutObject", "CopyObject"], + "prefix": "img/", + "suffix": ".jpeg", + }, + { + "actions": ["PutObject", "CopyObject"], + "prefix": "img/", + "suffix": ".jpeg", + }, + { + "actions": ["PutObject", "CopyObject"], + "prefix": "img/", + "suffix": ".jpeg", + }, + ], + ) + assert_matches_type(QueueUpdateResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.event_notifications.r2.configuration.queues.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + queue = response.parse() + assert_matches_type(QueueUpdateResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.event_notifications.r2.configuration.queues.with_streaming_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + queue = response.parse() + assert_matches_type(QueueUpdateResponse, queue, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.event_notifications.r2.configuration.queues.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.event_notifications.r2.configuration.queues.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `queue_id` but received ''"): + client.event_notifications.r2.configuration.queues.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + queue = client.event_notifications.r2.configuration.queues.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(QueueDeleteResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.event_notifications.r2.configuration.queues.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + queue = response.parse() + assert_matches_type(QueueDeleteResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.event_notifications.r2.configuration.queues.with_streaming_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + queue = response.parse() + assert_matches_type(QueueDeleteResponse, queue, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.event_notifications.r2.configuration.queues.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.event_notifications.r2.configuration.queues.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `queue_id` but received ''"): + client.event_notifications.r2.configuration.queues.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncQueues: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + queue = await async_client.event_notifications.r2.configuration.queues.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(QueueUpdateResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + queue = await async_client.event_notifications.r2.configuration.queues.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + rules=[ + { + "actions": ["PutObject", "CopyObject"], + "prefix": "img/", + "suffix": ".jpeg", + }, + { + "actions": ["PutObject", "CopyObject"], + "prefix": "img/", + "suffix": ".jpeg", + }, + { + "actions": ["PutObject", "CopyObject"], + "prefix": "img/", + "suffix": ".jpeg", + }, + ], + ) + assert_matches_type(QueueUpdateResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.event_notifications.r2.configuration.queues.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + queue = await response.parse() + assert_matches_type(QueueUpdateResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.event_notifications.r2.configuration.queues.with_streaming_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + queue = await response.parse() + assert_matches_type(QueueUpdateResponse, queue, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.event_notifications.r2.configuration.queues.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.event_notifications.r2.configuration.queues.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `queue_id` but received ''"): + await async_client.event_notifications.r2.configuration.queues.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + queue = await async_client.event_notifications.r2.configuration.queues.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(QueueDeleteResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.event_notifications.r2.configuration.queues.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + queue = await response.parse() + assert_matches_type(QueueDeleteResponse, queue, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.event_notifications.r2.configuration.queues.with_streaming_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + queue = await response.parse() + assert_matches_type(QueueDeleteResponse, queue, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.event_notifications.r2.configuration.queues.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.event_notifications.r2.configuration.queues.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `queue_id` but received ''"): + await async_client.event_notifications.r2.configuration.queues.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket_name="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/event_notifications/r2/test_configuration.py b/tests/api_resources/event_notifications/r2/test_configuration.py new file mode 100644 index 00000000000..0ce207dd3c6 --- /dev/null +++ b/tests/api_resources/event_notifications/r2/test_configuration.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.types.event_notifications.r2.configuration_get_response import ConfigurationGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestConfiguration: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + configuration = client.event_notifications.r2.configuration.get( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.event_notifications.r2.configuration.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = response.parse() + assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.event_notifications.r2.configuration.with_streaming_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + configuration = response.parse() + assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.event_notifications.r2.configuration.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.event_notifications.r2.configuration.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncConfiguration: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + configuration = await async_client.event_notifications.r2.configuration.get( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.event_notifications.r2.configuration.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = await response.parse() + assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.event_notifications.r2.configuration.with_streaming_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + configuration = await response.parse() + assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.event_notifications.r2.configuration.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.event_notifications.r2.configuration.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/firewall/test_access_rules.py b/tests/api_resources/firewall/test_access_rules.py index bf341bcad2e..ae4f4f43e6a 100644 --- a/tests/api_resources/firewall/test_access_rules.py +++ b/tests/api_resources/firewall/test_access_rules.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.firewall import ( - AccessRuleGetResponse, - AccessRuleEditResponse, - AccessRuleCreateResponse, - AccessRuleDeleteResponse, -) +from cloudflare.types.firewall.access_rule_get_response import AccessRuleGetResponse +from cloudflare.types.firewall.access_rule_edit_response import AccessRuleEditResponse +from cloudflare.types.firewall.access_rule_create_response import AccessRuleCreateResponse +from cloudflare.types.firewall.access_rule_delete_response import AccessRuleDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -32,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[AccessRuleCreateResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleCreateResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +45,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: zone_id="string", notes="This rule is enabled because of an event that occurred on date X.", ) - assert_matches_type(Optional[AccessRuleCreateResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleCreateResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +60,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" access_rule = response.parse() - assert_matches_type(Optional[AccessRuleCreateResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleCreateResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -77,7 +75,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" access_rule = response.parse() - assert_matches_type(Optional[AccessRuleCreateResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleCreateResponse, access_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -183,6 +181,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: access_rule = client.firewall.access_rules.delete( {}, + body={}, account_id="string", zone_id="string", ) @@ -193,6 +192,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_method_delete_with_all_params(self, client: Cloudflare) -> None: access_rule = client.firewall.access_rules.delete( {}, + body={}, account_id="string", zone_id="string", ) @@ -203,6 +203,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.firewall.access_rules.with_raw_response.delete( {}, + body={}, account_id="string", zone_id="string", ) @@ -217,6 +218,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.firewall.access_rules.with_streaming_response.delete( {}, + body={}, account_id="string", zone_id="string", ) as response: @@ -234,6 +236,7 @@ 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.firewall.access_rules.with_raw_response.delete( {}, + body={}, account_id="", zone_id="string", ) @@ -241,6 +244,7 @@ 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.firewall.access_rules.with_raw_response.delete( {}, + body={}, account_id="string", zone_id="", ) @@ -255,7 +259,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[AccessRuleEditResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleEditResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -271,7 +275,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: zone_id="string", notes="This rule is enabled because of an event that occurred on date X.", ) - assert_matches_type(Optional[AccessRuleEditResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleEditResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -287,7 +291,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" access_rule = response.parse() - assert_matches_type(Optional[AccessRuleEditResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleEditResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -303,7 +307,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" access_rule = response.parse() - assert_matches_type(Optional[AccessRuleEditResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleEditResponse, access_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -336,7 +340,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[AccessRuleGetResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleGetResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -346,7 +350,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[AccessRuleGetResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleGetResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -360,7 +364,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" access_rule = response.parse() - assert_matches_type(Optional[AccessRuleGetResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleGetResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -374,7 +378,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" access_rule = response.parse() - assert_matches_type(Optional[AccessRuleGetResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleGetResponse, access_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -408,7 +412,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[AccessRuleCreateResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleCreateResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -423,7 +427,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare zone_id="string", notes="This rule is enabled because of an event that occurred on date X.", ) - assert_matches_type(Optional[AccessRuleCreateResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleCreateResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -438,7 +442,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" access_rule = await response.parse() - assert_matches_type(Optional[AccessRuleCreateResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleCreateResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -453,7 +457,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" access_rule = await response.parse() - assert_matches_type(Optional[AccessRuleCreateResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleCreateResponse, access_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -559,6 +563,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: access_rule = await async_client.firewall.access_rules.delete( {}, + body={}, account_id="string", zone_id="string", ) @@ -569,6 +574,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: access_rule = await async_client.firewall.access_rules.delete( {}, + body={}, account_id="string", zone_id="string", ) @@ -579,6 +585,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.firewall.access_rules.with_raw_response.delete( {}, + body={}, account_id="string", zone_id="string", ) @@ -593,6 +600,7 @@ 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.firewall.access_rules.with_streaming_response.delete( {}, + body={}, account_id="string", zone_id="string", ) as response: @@ -610,6 +618,7 @@ 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.firewall.access_rules.with_raw_response.delete( {}, + body={}, account_id="", zone_id="string", ) @@ -617,6 +626,7 @@ 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.firewall.access_rules.with_raw_response.delete( {}, + body={}, account_id="string", zone_id="", ) @@ -631,7 +641,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[AccessRuleEditResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleEditResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -647,7 +657,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) zone_id="string", notes="This rule is enabled because of an event that occurred on date X.", ) - assert_matches_type(Optional[AccessRuleEditResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleEditResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -663,7 +673,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" access_rule = await response.parse() - assert_matches_type(Optional[AccessRuleEditResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleEditResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -679,7 +689,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" access_rule = await response.parse() - assert_matches_type(Optional[AccessRuleEditResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleEditResponse, access_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -712,7 +722,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[AccessRuleGetResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleGetResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -722,7 +732,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(Optional[AccessRuleGetResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleGetResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -736,7 +746,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" access_rule = await response.parse() - assert_matches_type(Optional[AccessRuleGetResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleGetResponse, access_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -750,7 +760,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" access_rule = await response.parse() - assert_matches_type(Optional[AccessRuleGetResponse], access_rule, path=["response"]) + assert_matches_type(AccessRuleGetResponse, access_rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/firewall/test_lockdowns.py b/tests/api_resources/firewall/test_lockdowns.py index 16e5b7909e4..0afdb920d28 100644 --- a/tests/api_resources/firewall/test_lockdowns.py +++ b/tests/api_resources/firewall/test_lockdowns.py @@ -9,11 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.firewall import ( - FirewallZoneLockdown, - LockdownDeleteResponse, -) +from cloudflare.types.firewall.lockdown import Lockdown +from cloudflare.types.firewall.lockdown_delete_response import LockdownDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +40,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" lockdown = response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +53,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +74,7 @@ def test_method_update(self, client: Cloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +88,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +102,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) assert cast(Any, response.is_closed) is True @@ -130,24 +129,26 @@ def test_method_list(self, client: Cloudflare) -> None: lockdown = client.firewall.lockdowns.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Lockdown], lockdown, path=["response"]) @pytest.mark.skip() @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: lockdown = client.firewall.lockdowns.list( "023e105f4ecef8ad9ca31a8372d0c353", + created_on=parse_datetime("2014-01-01T05:20:00.12345Z"), description="endpoints", description_search="endpoints", ip="1.2.3.4", ip_range_search="1.2.3.0/16", ip_search="1.2.3.4", + modified_on=parse_datetime("2014-01-01T05:20:00.12345Z"), page=1, per_page=1, priority=5, uri_search="/some/path", ) - assert_matches_type(SyncV4PagePaginationArray[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Lockdown], lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +160,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = response.parse() - assert_matches_type(SyncV4PagePaginationArray[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Lockdown], lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +172,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = response.parse() - assert_matches_type(SyncV4PagePaginationArray[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Lockdown], lockdown, path=["response"]) assert cast(Any, response.is_closed) is True @@ -189,6 +190,7 @@ def test_method_delete(self, client: Cloudflare) -> None: lockdown = client.firewall.lockdowns.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[LockdownDeleteResponse], lockdown, path=["response"]) @@ -198,6 +200,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.firewall.lockdowns.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -211,6 +214,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.firewall.lockdowns.with_streaming_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -227,12 +231,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.firewall.lockdowns.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.firewall.lockdowns.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -242,7 +248,7 @@ def test_method_get(self, client: Cloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +261,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" lockdown = response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +274,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) assert cast(Any, response.is_closed) is True @@ -298,7 +304,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +317,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" lockdown = await response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -324,7 +330,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = await response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) assert cast(Any, response.is_closed) is True @@ -345,7 +351,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -359,7 +365,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = await response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -373,7 +379,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = await response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) assert cast(Any, response.is_closed) is True @@ -400,24 +406,26 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: lockdown = await async_client.firewall.lockdowns.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Lockdown], lockdown, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: lockdown = await async_client.firewall.lockdowns.list( "023e105f4ecef8ad9ca31a8372d0c353", + created_on=parse_datetime("2014-01-01T05:20:00.12345Z"), description="endpoints", description_search="endpoints", ip="1.2.3.4", ip_range_search="1.2.3.0/16", ip_search="1.2.3.4", + modified_on=parse_datetime("2014-01-01T05:20:00.12345Z"), page=1, per_page=1, priority=5, uri_search="/some/path", ) - assert_matches_type(AsyncV4PagePaginationArray[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Lockdown], lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -429,7 +437,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Lockdown], lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -441,7 +449,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Lockdown], lockdown, path=["response"]) assert cast(Any, response.is_closed) is True @@ -459,6 +467,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: lockdown = await async_client.firewall.lockdowns.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[LockdownDeleteResponse], lockdown, path=["response"]) @@ -468,6 +477,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.firewall.lockdowns.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -481,6 +491,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.firewall.lockdowns.with_streaming_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -497,12 +508,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.firewall.lockdowns.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.firewall.lockdowns.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -512,7 +525,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -525,7 +538,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" lockdown = await response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) @pytest.mark.skip() @parametrize @@ -538,7 +551,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" lockdown = await response.parse() - assert_matches_type(Optional[FirewallZoneLockdown], lockdown, path=["response"]) + assert_matches_type(Lockdown, lockdown, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/firewall/test_rules.py b/tests/api_resources/firewall/test_rules.py index aefacf8cab2..7bd380f77e1 100644 --- a/tests/api_resources/firewall/test_rules.py +++ b/tests/api_resources/firewall/test_rules.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.firewall import ( - RuleEditResponse, - FirewallFilterRule, - RuleCreateResponse, -) +from cloudflare.types.firewall.firewall_rule import FirewallRule +from cloudflare.types.firewall.rule_edit_response import RuleEditResponse +from cloudflare.types.firewall.rule_create_response import RuleCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -76,7 +74,7 @@ def test_method_update(self, client: Cloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -90,7 +88,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +102,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -131,20 +129,21 @@ def test_method_list(self, client: Cloudflare) -> None: rule = client.firewall.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @pytest.mark.skip() @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: rule = client.firewall.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", + id="372e67954025e0ba6aaa6d586b9e0b60", action="block", description="mir", page=1, paused=False, per_page=5, ) - assert_matches_type(SyncV4PagePaginationArray[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +155,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -168,7 +167,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,7 +186,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b60", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +196,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", delete_filter_if_unused=True, ) - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +209,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" rule = response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -223,7 +222,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -303,52 +302,63 @@ def test_path_params_edit(self, client: Cloudflare) -> None: @parametrize def test_method_get(self, client: Cloudflare) -> None: rule = client.firewall.rules.get( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", ) - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + rule = client.firewall.rules.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + query_id="372e67954025e0ba6aaa6d586b9e0b60", + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.firewall.rules.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.firewall.rules.with_streaming_response.get( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): client.firewall.rules.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="", + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="", + query_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): client.firewall.rules.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", ) @@ -409,7 +419,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -423,7 +433,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -437,7 +447,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -464,20 +474,21 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: rule = await async_client.firewall.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: rule = await async_client.firewall.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", + id="372e67954025e0ba6aaa6d586b9e0b60", action="block", description="mir", page=1, paused=False, per_page=5, ) - assert_matches_type(AsyncV4PagePaginationArray[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -489,7 +500,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -501,7 +512,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -520,7 +531,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b60", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -530,7 +541,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", delete_filter_if_unused=True, ) - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -543,7 +554,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" rule = await response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -556,7 +567,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -636,50 +647,61 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: rule = await async_client.firewall.rules.get( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", ) - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.firewall.rules.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + query_id="372e67954025e0ba6aaa6d586b9e0b60", + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.firewall.rules.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.firewall.rules.with_streaming_response.get( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", ) 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[FirewallFilterRule], rule, path=["response"]) + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): await async_client.firewall.rules.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="", + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="", + query_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): await async_client.firewall.rules.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", ) diff --git a/tests/api_resources/firewall/test_ua_rules.py b/tests/api_resources/firewall/test_ua_rules.py index abfd4e9c3ca..4b9c99603c2 100644 --- a/tests/api_resources/firewall/test_ua_rules.py +++ b/tests/api_resources/firewall/test_ua_rules.py @@ -3,20 +3,18 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +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 -from cloudflare.types.firewall import ( - UARuleGetResponse, - UARuleListResponse, - UARuleCreateResponse, - UARuleDeleteResponse, - UARuleUpdateResponse, -) +from cloudflare.types.firewall.ua_rule_get_response import UARuleGetResponse +from cloudflare.types.firewall.ua_rule_list_response import UARuleListResponse +from cloudflare.types.firewall.ua_rule_create_response import UARuleCreateResponse +from cloudflare.types.firewall.ua_rule_delete_response import UARuleDeleteResponse +from cloudflare.types.firewall.ua_rule_update_response import UARuleUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[UARuleCreateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleCreateResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +42,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" ua_rule = response.parse() - assert_matches_type(Optional[UARuleCreateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleCreateResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +55,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = response.parse() - assert_matches_type(Optional[UARuleCreateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleCreateResponse, ua_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +76,7 @@ def test_method_update(self, client: Cloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[UARuleUpdateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleUpdateResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,7 +90,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = response.parse() - assert_matches_type(Optional[UARuleUpdateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleUpdateResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +104,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = response.parse() - assert_matches_type(Optional[UARuleUpdateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleUpdateResponse, ua_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -188,8 +186,9 @@ def test_method_delete(self, client: Cloudflare) -> None: ua_rule = client.firewall.ua_rules.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[UARuleDeleteResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleDeleteResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,12 +196,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.firewall.ua_rules.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = response.parse() - assert_matches_type(Optional[UARuleDeleteResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleDeleteResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,12 +210,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.firewall.ua_rules.with_streaming_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = response.parse() - assert_matches_type(Optional[UARuleDeleteResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleDeleteResponse, ua_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -226,12 +227,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.firewall.ua_rules.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.firewall.ua_rules.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -241,7 +244,7 @@ def test_method_get(self, client: Cloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[UARuleGetResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleGetResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -254,7 +257,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" ua_rule = response.parse() - assert_matches_type(Optional[UARuleGetResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleGetResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -267,7 +270,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = response.parse() - assert_matches_type(Optional[UARuleGetResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleGetResponse, ua_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -297,7 +300,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[UARuleCreateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleCreateResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -310,7 +313,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" ua_rule = await response.parse() - assert_matches_type(Optional[UARuleCreateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleCreateResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -323,7 +326,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = await response.parse() - assert_matches_type(Optional[UARuleCreateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleCreateResponse, ua_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -344,7 +347,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[UARuleUpdateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleUpdateResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -358,7 +361,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = await response.parse() - assert_matches_type(Optional[UARuleUpdateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleUpdateResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -372,7 +375,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = await response.parse() - assert_matches_type(Optional[UARuleUpdateResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleUpdateResponse, ua_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -454,8 +457,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: ua_rule = await async_client.firewall.ua_rules.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[UARuleDeleteResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleDeleteResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -463,12 +467,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.firewall.ua_rules.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = await response.parse() - assert_matches_type(Optional[UARuleDeleteResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleDeleteResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -476,12 +481,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.firewall.ua_rules.with_streaming_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = await response.parse() - assert_matches_type(Optional[UARuleDeleteResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleDeleteResponse, ua_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -492,12 +498,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.firewall.ua_rules.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.firewall.ua_rules.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -507,7 +515,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[UARuleGetResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleGetResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -520,7 +528,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" ua_rule = await response.parse() - assert_matches_type(Optional[UARuleGetResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleGetResponse, ua_rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -533,7 +541,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" ua_rule = await response.parse() - assert_matches_type(Optional[UARuleGetResponse], ua_rule, path=["response"]) + assert_matches_type(UARuleGetResponse, ua_rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/firewall/waf/packages/test_groups.py b/tests/api_resources/firewall/waf/packages/test_groups.py index 78d0a147146..6297b160c03 100644 --- a/tests/api_resources/firewall/waf/packages/test_groups.py +++ b/tests/api_resources/firewall/waf/packages/test_groups.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.firewall.waf.packages import ( - GroupGetResponse, - GroupEditResponse, - WAFManagedRulesGroup, -) +from cloudflare.types.firewall.waf.packages.group import Group +from cloudflare.types.firewall.waf.packages.group_get_response import GroupGetResponse +from cloudflare.types.firewall.waf.packages.group_edit_response import GroupEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None: "a25a9a7e9c00afc1fb2e0245519d725b", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[WAFManagedRulesGroup], group, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,11 +38,13 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: direction="desc", match="any", mode="on", + name="Project Honey Pot", order="mode", page=1, per_page=5, + rules_count=10, ) - assert_matches_type(SyncV4PagePaginationArray[WAFManagedRulesGroup], group, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WAFManagedRulesGroup], group, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -70,7 +70,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WAFManagedRulesGroup], group, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Group], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -239,7 +239,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "a25a9a7e9c00afc1fb2e0245519d725b", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[WAFManagedRulesGroup], group, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -250,11 +250,13 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) direction="desc", match="any", mode="on", + name="Project Honey Pot", order="mode", page=1, per_page=5, + rules_count=10, ) - assert_matches_type(AsyncV4PagePaginationArray[WAFManagedRulesGroup], group, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -267,7 +269,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WAFManagedRulesGroup], group, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -280,7 +282,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WAFManagedRulesGroup], group, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Group], group, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/firewall/waf/packages/test_rules.py b/tests/api_resources/firewall/waf/packages/test_rules.py index 232e8abea4f..710c1f57117 100644 --- a/tests/api_resources/firewall/waf/packages/test_rules.py +++ b/tests/api_resources/firewall/waf/packages/test_rules.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.firewall.waf.packages import ( - RuleGetResponse, - RuleEditResponse, - WAFManagedRulesRule, -) +from cloudflare.types.firewall.waf.packages.rule_get_response import RuleGetResponse +from cloudflare.types.firewall.waf.packages.rule_edit_response import RuleEditResponse +from cloudflare.types.firewall.waf.packages.rule_list_response import RuleListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None: "a25a9a7e9c00afc1fb2e0245519d725b", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[WAFManagedRulesRule], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,14 +35,17 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: rule = client.firewall.waf.packages.rules.list( "a25a9a7e9c00afc1fb2e0245519d725b", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + description="SQL injection prevention for SELECT statements", direction="desc", + group_id="de677e5818985db1285d0e80225f06e5", match="any", mode="CHL", order="priority", page=1, per_page=5, + priority="string", ) - assert_matches_type(SyncV4PagePaginationArray[WAFManagedRulesRule], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +58,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WAFManagedRulesRule], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -70,7 +71,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WAFManagedRulesRule], rule, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -239,7 +240,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "a25a9a7e9c00afc1fb2e0245519d725b", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[WAFManagedRulesRule], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -247,14 +248,17 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) rule = await async_client.firewall.waf.packages.rules.list( "a25a9a7e9c00afc1fb2e0245519d725b", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + description="SQL injection prevention for SELECT statements", direction="desc", + group_id="de677e5818985db1285d0e80225f06e5", match="any", mode="CHL", order="priority", page=1, per_page=5, + priority="string", ) - assert_matches_type(AsyncV4PagePaginationArray[WAFManagedRulesRule], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -267,7 +271,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WAFManagedRulesRule], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -280,7 +284,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WAFManagedRulesRule], rule, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RuleListResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/firewall/waf/test_overrides.py b/tests/api_resources/firewall/waf/test_overrides.py index 54cbdacc6d0..d522f91966e 100644 --- a/tests/api_resources/firewall/waf/test_overrides.py +++ b/tests/api_resources/firewall/waf/test_overrides.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.firewall.waf import ( - WAFOverride, - OverrideDeleteResponse, -) +from cloudflare.types.firewall.waf.override import Override +from cloudflare.types.firewall.waf.override_delete_response import OverrideDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +39,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" override = response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +52,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +73,7 @@ def test_method_update(self, client: Cloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +87,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +101,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) assert cast(Any, response.is_closed) is True @@ -130,7 +128,7 @@ def test_method_list(self, client: Cloudflare) -> None: override = client.firewall.waf.overrides.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[WAFOverride], override, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Override], override, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,7 +138,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=5, ) - assert_matches_type(SyncV4PagePaginationArray[WAFOverride], override, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Override], override, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +150,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WAFOverride], override, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Override], override, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +162,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WAFOverride], override, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Override], override, path=["response"]) assert cast(Any, response.is_closed) is True @@ -182,6 +180,7 @@ def test_method_delete(self, client: Cloudflare) -> None: override = client.firewall.waf.overrides.delete( "de677e5818985db1285d0e80225f06e5", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[OverrideDeleteResponse], override, path=["response"]) @@ -191,6 +190,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.firewall.waf.overrides.with_raw_response.delete( "de677e5818985db1285d0e80225f06e5", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -204,6 +204,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.firewall.waf.overrides.with_streaming_response.delete( "de677e5818985db1285d0e80225f06e5", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -220,12 +221,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.firewall.waf.overrides.with_raw_response.delete( "de677e5818985db1285d0e80225f06e5", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.firewall.waf.overrides.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -235,7 +238,7 @@ def test_method_get(self, client: Cloudflare) -> None: "de677e5818985db1285d0e80225f06e5", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,7 +251,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" override = response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -261,7 +264,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) assert cast(Any, response.is_closed) is True @@ -291,7 +294,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -304,7 +307,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" override = await response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -317,7 +320,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = await response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) assert cast(Any, response.is_closed) is True @@ -338,7 +341,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -352,7 +355,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = await response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -366,7 +369,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = await response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) assert cast(Any, response.is_closed) is True @@ -393,7 +396,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: override = await async_client.firewall.waf.overrides.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[WAFOverride], override, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Override], override, path=["response"]) @pytest.mark.skip() @parametrize @@ -403,7 +406,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=5, ) - assert_matches_type(AsyncV4PagePaginationArray[WAFOverride], override, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Override], override, path=["response"]) @pytest.mark.skip() @parametrize @@ -415,7 +418,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WAFOverride], override, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Override], override, path=["response"]) @pytest.mark.skip() @parametrize @@ -427,7 +430,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WAFOverride], override, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Override], override, path=["response"]) assert cast(Any, response.is_closed) is True @@ -445,6 +448,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: override = await async_client.firewall.waf.overrides.delete( "de677e5818985db1285d0e80225f06e5", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[OverrideDeleteResponse], override, path=["response"]) @@ -454,6 +458,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.firewall.waf.overrides.with_raw_response.delete( "de677e5818985db1285d0e80225f06e5", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -467,6 +472,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.firewall.waf.overrides.with_streaming_response.delete( "de677e5818985db1285d0e80225f06e5", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -483,12 +489,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.firewall.waf.overrides.with_raw_response.delete( "de677e5818985db1285d0e80225f06e5", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.firewall.waf.overrides.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -498,7 +506,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "de677e5818985db1285d0e80225f06e5", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -511,7 +519,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" override = await response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) @pytest.mark.skip() @parametrize @@ -524,7 +532,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" override = await response.parse() - assert_matches_type(Optional[WAFOverride], override, path=["response"]) + assert_matches_type(Override, override, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/firewall/waf/test_packages.py b/tests/api_resources/firewall/waf/test_packages.py index 759f76e4317..360c75560ee 100644 --- a/tests/api_resources/firewall/waf/test_packages.py +++ b/tests/api_resources/firewall/waf/test_packages.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.firewall.waf import PackageGetResponse, PackageListResponse +from cloudflare.types.firewall.waf.package_get_response import PackageGetResponse +from cloudflare.types.firewall.waf.package_list_response import PackageListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -33,6 +34,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", direction="desc", match="any", + name="USER", order="name", page=1, per_page=5, @@ -77,7 +79,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_get(self, client: Cloudflare) -> None: package = client.firewall.waf.packages.get( - "a25a9a7e9c00afc1fb2e0245519d725b", + "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(PackageGetResponse, package, path=["response"]) @@ -86,7 +88,7 @@ def test_method_get(self, client: Cloudflare) -> None: @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.firewall.waf.packages.with_raw_response.get( - "a25a9a7e9c00afc1fb2e0245519d725b", + "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -99,7 +101,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.firewall.waf.packages.with_streaming_response.get( - "a25a9a7e9c00afc1fb2e0245519d725b", + "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -115,7 +117,7 @@ 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 `zone_identifier` but received ''"): client.firewall.waf.packages.with_raw_response.get( - "a25a9a7e9c00afc1fb2e0245519d725b", + "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="", ) @@ -144,6 +146,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) "023e105f4ecef8ad9ca31a8372d0c353", direction="desc", match="any", + name="USER", order="name", page=1, per_page=5, @@ -188,7 +191,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: package = await async_client.firewall.waf.packages.get( - "a25a9a7e9c00afc1fb2e0245519d725b", + "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(PackageGetResponse, package, path=["response"]) @@ -197,7 +200,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.firewall.waf.packages.with_raw_response.get( - "a25a9a7e9c00afc1fb2e0245519d725b", + "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -210,7 +213,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.firewall.waf.packages.with_streaming_response.get( - "a25a9a7e9c00afc1fb2e0245519d725b", + "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -226,7 +229,7 @@ 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 `zone_identifier` but received ''"): await async_client.firewall.waf.packages.with_raw_response.get( - "a25a9a7e9c00afc1fb2e0245519d725b", + "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="", ) diff --git a/tests/api_resources/healthchecks/test_previews.py b/tests/api_resources/healthchecks/test_previews.py index f6a16e32539..83cc4499eb4 100644 --- a/tests/api_resources/healthchecks/test_previews.py +++ b/tests/api_resources/healthchecks/test_previews.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Healthcheck -from cloudflare.types.healthchecks import PreviewDeleteResponse +from cloudflare.types.healthchecks.healthcheck import Healthcheck +from cloudflare.types.healthchecks.preview_delete_response import PreviewDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -110,6 +110,7 @@ def test_method_delete(self, client: Cloudflare) -> None: preview = client.healthchecks.previews.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(PreviewDeleteResponse, preview, path=["response"]) @@ -119,6 +120,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.healthchecks.previews.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -132,6 +134,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.healthchecks.previews.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -148,12 +151,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.healthchecks.previews.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `healthcheck_id` but received ''"): client.healthchecks.previews.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -304,6 +309,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: preview = await async_client.healthchecks.previews.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(PreviewDeleteResponse, preview, path=["response"]) @@ -313,6 +319,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.healthchecks.previews.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -326,6 +333,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.healthchecks.previews.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -342,12 +350,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.healthchecks.previews.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `healthcheck_id` but received ''"): await async_client.healthchecks.previews.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/hostnames/settings/test_tls.py b/tests/api_resources/hostnames/settings/test_tls.py index 36b390abae3..abe5159537a 100644 --- a/tests/api_resources/hostnames/settings/test_tls.py +++ b/tests/api_resources/hostnames/settings/test_tls.py @@ -9,7 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.hostnames.settings import HostnameStting, TLSGetResponse, HostnameSettingDelete +from cloudflare.types.hostnames.settings.setting import Setting +from cloudflare.types.hostnames.settings.tls_get_response import TLSGetResponse +from cloudflare.types.hostnames.settings.tls_delete_response import TLSDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +28,7 @@ def test_method_update(self, client: Cloudflare) -> None: setting_id="ciphers", value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"], ) - assert_matches_type(HostnameStting, tls, path=["response"]) + assert_matches_type(Setting, tls, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +43,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls = response.parse() - assert_matches_type(HostnameStting, tls, path=["response"]) + assert_matches_type(Setting, tls, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +58,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls = response.parse() - assert_matches_type(HostnameStting, tls, path=["response"]) + assert_matches_type(Setting, tls, path=["response"]) assert cast(Any, response.is_closed) is True @@ -87,7 +89,7 @@ def test_method_delete(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", setting_id="ciphers", ) - assert_matches_type(HostnameSettingDelete, tls, path=["response"]) + assert_matches_type(TLSDeleteResponse, tls, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,7 +103,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" tls = response.parse() - assert_matches_type(HostnameSettingDelete, tls, path=["response"]) + assert_matches_type(TLSDeleteResponse, tls, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +117,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls = response.parse() - assert_matches_type(HostnameSettingDelete, tls, path=["response"]) + assert_matches_type(TLSDeleteResponse, tls, path=["response"]) assert cast(Any, response.is_closed) is True @@ -195,7 +197,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: setting_id="ciphers", value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"], ) - assert_matches_type(HostnameStting, tls, path=["response"]) + assert_matches_type(Setting, tls, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +212,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls = await response.parse() - assert_matches_type(HostnameStting, tls, path=["response"]) + assert_matches_type(Setting, tls, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +227,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls = await response.parse() - assert_matches_type(HostnameStting, tls, path=["response"]) + assert_matches_type(Setting, tls, path=["response"]) assert cast(Any, response.is_closed) is True @@ -256,7 +258,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", setting_id="ciphers", ) - assert_matches_type(HostnameSettingDelete, tls, path=["response"]) + assert_matches_type(TLSDeleteResponse, tls, path=["response"]) @pytest.mark.skip() @parametrize @@ -270,7 +272,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" tls = await response.parse() - assert_matches_type(HostnameSettingDelete, tls, path=["response"]) + assert_matches_type(TLSDeleteResponse, tls, path=["response"]) @pytest.mark.skip() @parametrize @@ -284,7 +286,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls = await response.parse() - assert_matches_type(HostnameSettingDelete, tls, path=["response"]) + assert_matches_type(TLSDeleteResponse, tls, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/hyperdrive/test_configs.py b/tests/api_resources/hyperdrive/test_configs.py index 5871ea95f2f..66cfb2bf678 100644 --- a/tests/api_resources/hyperdrive/test_configs.py +++ b/tests/api_resources/hyperdrive/test_configs.py @@ -10,14 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.hyperdrive import ( - ConfigGetResponse, - ConfigEditResponse, - ConfigListResponse, - ConfigCreateResponse, - ConfigDeleteResponse, - ConfigUpdateResponse, -) +from cloudflare.types.hyperdrive.hyperdrive import Hyperdrive +from cloudflare.types.hyperdrive.config_delete_response import ConfigDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,35 +24,77 @@ class TestConfigs: def test_method_create(self, client: Cloudflare) -> None: config = client.hyperdrive.configs.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) - assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + config = client.hyperdrive.configs.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, + caching={ + "disabled": False, + "max_age": 60, + "stale_while_revalidate": 15, + }, + ) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.hyperdrive.configs.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.hyperdrive.configs.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -68,7 +104,14 @@ 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.hyperdrive.configs.with_raw_response.create( account_id="", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) @pytest.mark.skip() @@ -77,9 +120,38 @@ def test_method_update(self, client: Cloudflare) -> None: config = client.hyperdrive.configs.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, + ) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + config = client.hyperdrive.configs.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, + caching={ + "disabled": False, + "max_age": 60, + "stale_while_revalidate": 15, + }, ) - assert_matches_type(Optional[ConfigUpdateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,13 +159,20 @@ def test_raw_response_update(self, client: Cloudflare) -> None: response = client.hyperdrive.configs.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigUpdateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,13 +180,20 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: with client.hyperdrive.configs.with_streaming_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigUpdateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -118,14 +204,28 @@ def test_path_params_update(self, client: Cloudflare) -> None: client.hyperdrive.configs.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `hyperdrive_id` but received ''"): client.hyperdrive.configs.with_raw_response.update( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) @pytest.mark.skip() @@ -134,7 +234,7 @@ def test_method_list(self, client: Cloudflare) -> None: config = client.hyperdrive.configs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"]) + assert_matches_type(SyncSinglePage[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -146,7 +246,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"]) + assert_matches_type(SyncSinglePage[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -158,7 +258,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"]) + assert_matches_type(SyncSinglePage[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -177,7 +277,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(ConfigDeleteResponse, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -190,7 +290,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" config = response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(ConfigDeleteResponse, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +303,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(ConfigDeleteResponse, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -229,7 +329,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ConfigEditResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -237,9 +337,21 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: config = client.hyperdrive.configs.edit( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + caching={ + "disabled": False, + "max_age": 60, + "stale_while_revalidate": 15, + }, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) - assert_matches_type(Optional[ConfigEditResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -252,7 +364,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" config = response.parse() - assert_matches_type(Optional[ConfigEditResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -265,7 +377,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigEditResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -291,7 +403,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ConfigGetResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -304,7 +416,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" config = response.parse() - assert_matches_type(Optional[ConfigGetResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -317,7 +429,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigGetResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -345,35 +457,77 @@ class TestAsyncConfigs: async def test_method_create(self, async_client: AsyncCloudflare) -> None: config = await async_client.hyperdrive.configs.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) - assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + config = await async_client.hyperdrive.configs.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, + caching={ + "disabled": False, + "max_age": 60, + "stale_while_revalidate": 15, + }, + ) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.hyperdrive.configs.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.hyperdrive.configs.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -383,7 +537,14 @@ 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.hyperdrive.configs.with_raw_response.create( account_id="", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) @pytest.mark.skip() @@ -392,9 +553,38 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: config = await async_client.hyperdrive.configs.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, + ) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + config = await async_client.hyperdrive.configs.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, + caching={ + "disabled": False, + "max_age": 60, + "stale_while_revalidate": 15, + }, ) - assert_matches_type(Optional[ConfigUpdateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -402,13 +592,20 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.hyperdrive.configs.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigUpdateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -416,13 +613,20 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> async with async_client.hyperdrive.configs.with_streaming_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigUpdateResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -433,14 +637,28 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: await async_client.hyperdrive.configs.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `hyperdrive_id` but received ''"): await async_client.hyperdrive.configs.with_raw_response.update( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) @pytest.mark.skip() @@ -449,7 +667,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: config = await async_client.hyperdrive.configs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"]) + assert_matches_type(AsyncSinglePage[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +679,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"]) + assert_matches_type(AsyncSinglePage[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -473,7 +691,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"]) + assert_matches_type(AsyncSinglePage[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -492,7 +710,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(ConfigDeleteResponse, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -505,7 +723,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" config = await response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(ConfigDeleteResponse, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -518,7 +736,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(ConfigDeleteResponse, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -544,7 +762,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ConfigEditResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -552,9 +770,21 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) config = await async_client.hyperdrive.configs.edit( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - origin={"password": "password1234!"}, + caching={ + "disabled": False, + "max_age": 60, + "stale_while_revalidate": 15, + }, + name="example-hyperdrive", + origin={ + "database": "postgres", + "host": "database.example.com", + "port": 0, + "scheme": "postgres", + "user": "postgres", + }, ) - assert_matches_type(Optional[ConfigEditResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -567,7 +797,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" config = await response.parse() - assert_matches_type(Optional[ConfigEditResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -580,7 +810,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigEditResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -606,7 +836,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ConfigGetResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -619,7 +849,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" config = await response.parse() - assert_matches_type(Optional[ConfigGetResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -632,7 +862,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigGetResponse], config, path=["response"]) + assert_matches_type(Optional[Hyperdrive], config, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/images/test_v1.py b/tests/api_resources/images/test_v1.py index f3420a94005..fc6ab9d69f0 100644 --- a/tests/api_resources/images/test_v1.py +++ b/tests/api_resources/images/test_v1.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination -from cloudflare.types.images import ( - Image, - V1ListResponse, - V1DeleteResponse, -) +from cloudflare.types.images.image import Image +from cloudflare.types.images.v1_list_response import V1ListResponse +from cloudflare.types.images.v1_delete_response import V1DeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,65 +22,29 @@ class TestV1: @pytest.mark.skip() @parametrize - def test_method_create_overload_1(self, client: Cloudflare) -> None: + def test_method_create(self, client: Cloudflare) -> None: v1 = client.images.v1.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - file={}, - ) - assert_matches_type(Image, v1, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: - response = client.images.v1.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - file={}, ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() assert_matches_type(Image, v1, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: - with client.images.v1.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - file={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - v1 = response.parse() - assert_matches_type(Image, v1, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @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 ''"): - client.images.v1.with_raw_response.create( - account_id="", - file={}, - ) - - @pytest.mark.skip() - @parametrize - def test_method_create_overload_2(self, client: Cloudflare) -> None: + def test_method_create_with_all_params(self, client: Cloudflare) -> None: v1 = client.images.v1.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + file={}, + metadata={}, + require_signed_urls=True, url="https://example.com/path/to/logo.png", ) assert_matches_type(Image, v1, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: + def test_raw_response_create(self, client: Cloudflare) -> None: response = client.images.v1.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - url="https://example.com/path/to/logo.png", ) assert response.is_closed is True @@ -92,10 +54,9 @@ def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: + def test_streaming_response_create(self, client: Cloudflare) -> None: with client.images.v1.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - url="https://example.com/path/to/logo.png", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -107,11 +68,10 @@ def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_path_params_create_overload_2(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.images.v1.with_raw_response.create( account_id="", - url="https://example.com/path/to/logo.png", ) @pytest.mark.skip() @@ -172,6 +132,7 @@ def test_method_delete(self, client: Cloudflare) -> None: v1 = client.images.v1.delete( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(V1DeleteResponse, v1, path=["response"]) @@ -181,6 +142,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.images.v1.with_raw_response.delete( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -194,6 +156,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.images.v1.with_streaming_response.delete( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -210,12 +173,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.images.v1.with_raw_response.delete( "string", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): client.images.v1.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -339,65 +304,29 @@ class TestAsyncV1: @pytest.mark.skip() @parametrize - async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_create(self, async_client: AsyncCloudflare) -> None: v1 = await async_client.images.v1.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - file={}, - ) - assert_matches_type(Image, v1, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: - response = await async_client.images.v1.with_raw_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - file={}, ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() assert_matches_type(Image, v1, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: - async with async_client.images.v1.with_streaming_response.create( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - file={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - v1 = await response.parse() - assert_matches_type(Image, v1, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @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 ''"): - await async_client.images.v1.with_raw_response.create( - account_id="", - file={}, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: v1 = await async_client.images.v1.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + file={}, + metadata={}, + require_signed_urls=True, url="https://example.com/path/to/logo.png", ) assert_matches_type(Image, v1, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.images.v1.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - url="https://example.com/path/to/logo.png", ) assert response.is_closed is True @@ -407,10 +336,9 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflar @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.images.v1.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - url="https://example.com/path/to/logo.png", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -422,11 +350,10 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncClo @pytest.mark.skip() @parametrize - async def test_path_params_create_overload_2(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.images.v1.with_raw_response.create( account_id="", - url="https://example.com/path/to/logo.png", ) @pytest.mark.skip() @@ -487,6 +414,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: v1 = await async_client.images.v1.delete( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(V1DeleteResponse, v1, path=["response"]) @@ -496,6 +424,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.images.v1.with_raw_response.delete( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -509,6 +438,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.images.v1.with_streaming_response.delete( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -525,12 +455,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.images.v1.with_raw_response.delete( "string", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): await async_client.images.v1.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/images/test_v2.py b/tests/api_resources/images/test_v2.py index b40c7c1b94a..cad004cfc42 100644 --- a/tests/api_resources/images/test_v2.py +++ b/tests/api_resources/images/test_v2.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.images import V2ListResponse +from cloudflare.types.images.v2_list_response import V2ListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/images/v1/test_keys.py b/tests/api_resources/images/v1/test_keys.py index 699e3a2ccba..24ec699ed7c 100644 --- a/tests/api_resources/images/v1/test_keys.py +++ b/tests/api_resources/images/v1/test_keys.py @@ -9,7 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.images.v1 import ImagesImageKeys +from cloudflare.types.images.v1.key_list_response import KeyListResponse +from cloudflare.types.images.v1.key_delete_response import KeyDeleteResponse +from cloudflare.types.images.v1.key_update_response import KeyUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,36 +23,36 @@ class TestKeys: @parametrize def test_method_update(self, client: Cloudflare) -> None: key = client.images.v1.keys.update( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyUpdateResponse, key, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.images.v1.keys.with_raw_response.update( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyUpdateResponse, key, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.images.v1.keys.with_streaming_response.update( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyUpdateResponse, key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -59,7 +61,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.images.v1.keys.with_raw_response.update( - "string", + "someKey", account_id="", ) @@ -75,7 +77,7 @@ def test_method_list(self, client: Cloudflare) -> None: key = client.images.v1.keys.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyListResponse, key, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +89,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyListResponse, key, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +101,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyListResponse, key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -115,36 +117,36 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_delete(self, client: Cloudflare) -> None: key = client.images.v1.keys.delete( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyDeleteResponse, key, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.images.v1.keys.with_raw_response.delete( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyDeleteResponse, key, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.images.v1.keys.with_streaming_response.delete( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyDeleteResponse, key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -153,7 +155,7 @@ 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.images.v1.keys.with_raw_response.delete( - "string", + "someKey", account_id="", ) @@ -171,36 +173,36 @@ class TestAsyncKeys: @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: key = await async_client.images.v1.keys.update( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyUpdateResponse, key, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.images.v1.keys.with_raw_response.update( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyUpdateResponse, key, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.images.v1.keys.with_streaming_response.update( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyUpdateResponse, key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +211,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.images.v1.keys.with_raw_response.update( - "string", + "someKey", account_id="", ) @@ -225,7 +227,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: key = await async_client.images.v1.keys.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyListResponse, key, path=["response"]) @pytest.mark.skip() @parametrize @@ -237,7 +239,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyListResponse, key, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,7 +251,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyListResponse, key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -265,36 +267,36 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: key = await async_client.images.v1.keys.delete( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyDeleteResponse, key, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.images.v1.keys.with_raw_response.delete( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyDeleteResponse, key, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.images.v1.keys.with_streaming_response.delete( - "string", + "someKey", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(ImagesImageKeys, key, path=["response"]) + assert_matches_type(KeyDeleteResponse, key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -303,7 +305,7 @@ 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.images.v1.keys.with_raw_response.delete( - "string", + "someKey", account_id="", ) diff --git a/tests/api_resources/images/v1/test_stats.py b/tests/api_resources/images/v1/test_stats.py index 9c5496d66db..bc63e4b3200 100644 --- a/tests/api_resources/images/v1/test_stats.py +++ b/tests/api_resources/images/v1/test_stats.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.images.v1 import ImagesImagesStats +from cloudflare.types.images.v1.stat import Stat base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_get(self, client: Cloudflare) -> None: stat = client.images.v1.stats.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ImagesImagesStats, stat, path=["response"]) + assert_matches_type(Stat, stat, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,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" stat = response.parse() - assert_matches_type(ImagesImagesStats, stat, path=["response"]) + assert_matches_type(Stat, stat, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" stat = response.parse() - assert_matches_type(ImagesImagesStats, stat, path=["response"]) + assert_matches_type(Stat, stat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: stat = await async_client.images.v1.stats.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ImagesImagesStats, stat, path=["response"]) + assert_matches_type(Stat, stat, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" stat = await response.parse() - assert_matches_type(ImagesImagesStats, stat, path=["response"]) + assert_matches_type(Stat, stat, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" stat = await response.parse() - assert_matches_type(ImagesImagesStats, stat, path=["response"]) + assert_matches_type(Stat, stat, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/images/v1/test_variants.py b/tests/api_resources/images/v1/test_variants.py index c1635eadd07..f0b82621cf7 100644 --- a/tests/api_resources/images/v1/test_variants.py +++ b/tests/api_resources/images/v1/test_variants.py @@ -9,11 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.images.v1 import ( - V1ImageVariant, - V1ImageVariants, - VariantDeleteResponse, -) +from cloudflare.types.images.v1.variant import Variant +from cloudflare.types.images.v1.variant_get_response import VariantGetResponse +from cloudflare.types.images.v1.variant_edit_response import VariantEditResponse +from cloudflare.types.images.v1.variant_create_response import VariantCreateResponse +from cloudflare.types.images.v1.variant_delete_response import VariantDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +26,7 @@ class TestVariants: def test_method_create(self, client: Cloudflare) -> None: variant = client.images.v1.variants.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -34,14 +34,14 @@ def test_method_create(self, client: Cloudflare) -> None: "width": 1366, }, ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantCreateResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: variant = client.images.v1.variants.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -50,14 +50,14 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: }, never_require_signed_urls=True, ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantCreateResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.images.v1.variants.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -69,14 +69,14 @@ 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" variant = response.parse() - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantCreateResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.images.v1.variants.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -88,7 +88,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantCreateResponse, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -98,7 +98,7 @@ 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.images.v1.variants.with_raw_response.create( account_id="", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -113,7 +113,7 @@ def test_method_list(self, client: Cloudflare) -> None: variant = client.images.v1.variants.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(V1ImageVariants, variant, path=["response"]) + assert_matches_type(Variant, variant, path=["response"]) @pytest.mark.skip() @parametrize @@ -125,7 +125,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(V1ImageVariants, variant, path=["response"]) + assert_matches_type(Variant, variant, path=["response"]) @pytest.mark.skip() @parametrize @@ -137,7 +137,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(V1ImageVariants, variant, path=["response"]) + assert_matches_type(Variant, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -153,8 +153,9 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_delete(self, client: Cloudflare) -> None: variant = client.images.v1.variants.delete( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(VariantDeleteResponse, variant, path=["response"]) @@ -162,8 +163,9 @@ def test_method_delete(self, client: Cloudflare) -> None: @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.images.v1.variants.with_raw_response.delete( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -175,8 +177,9 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.images.v1.variants.with_streaming_response.delete( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -191,21 +194,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 `account_id` but received ''"): client.images.v1.variants.with_raw_response.delete( - "string", + "hero", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `variant_id` but received ''"): client.images.v1.variants.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @parametrize def test_method_edit(self, client: Cloudflare) -> None: variant = client.images.v1.variants.edit( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", options={ "fit": "scale-down", @@ -214,13 +219,13 @@ def test_method_edit(self, client: Cloudflare) -> None: "width": 1366, }, ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantEditResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: variant = client.images.v1.variants.edit( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", options={ "fit": "scale-down", @@ -230,13 +235,13 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: }, never_require_signed_urls=True, ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantEditResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.images.v1.variants.with_raw_response.edit( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", options={ "fit": "scale-down", @@ -249,13 +254,13 @@ 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(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantEditResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.images.v1.variants.with_streaming_response.edit( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", options={ "fit": "scale-down", @@ -268,7 +273,7 @@ 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(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantEditResponse, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -277,7 +282,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.images.v1.variants.with_raw_response.edit( - "string", + "hero", account_id="", options={ "fit": "scale-down", @@ -303,36 +308,36 @@ def test_path_params_edit(self, client: Cloudflare) -> None: @parametrize def test_method_get(self, client: Cloudflare) -> None: variant = client.images.v1.variants.get( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantGetResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.images.v1.variants.with_raw_response.get( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantGetResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.images.v1.variants.with_streaming_response.get( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantGetResponse, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -341,7 +346,7 @@ 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.images.v1.variants.with_raw_response.get( - "string", + "hero", account_id="", ) @@ -360,7 +365,7 @@ class TestAsyncVariants: async def test_method_create(self, async_client: AsyncCloudflare) -> None: variant = await async_client.images.v1.variants.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -368,14 +373,14 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "width": 1366, }, ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantCreateResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: variant = await async_client.images.v1.variants.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -384,14 +389,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare }, never_require_signed_urls=True, ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantCreateResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.images.v1.variants.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -403,14 +408,14 @@ 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" variant = await response.parse() - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantCreateResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.images.v1.variants.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -422,7 +427,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantCreateResponse, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -432,7 +437,7 @@ 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.images.v1.variants.with_raw_response.create( account_id="", - id="string", + id="hero", options={ "fit": "scale-down", "height": 768, @@ -447,7 +452,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: variant = await async_client.images.v1.variants.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(V1ImageVariants, variant, path=["response"]) + assert_matches_type(Variant, variant, path=["response"]) @pytest.mark.skip() @parametrize @@ -459,7 +464,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(V1ImageVariants, variant, path=["response"]) + assert_matches_type(Variant, variant, path=["response"]) @pytest.mark.skip() @parametrize @@ -471,7 +476,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(V1ImageVariants, variant, path=["response"]) + assert_matches_type(Variant, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -487,8 +492,9 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: variant = await async_client.images.v1.variants.delete( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(VariantDeleteResponse, variant, path=["response"]) @@ -496,8 +502,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.images.v1.variants.with_raw_response.delete( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -509,8 +516,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.images.v1.variants.with_streaming_response.delete( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -525,21 +533,23 @@ 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.images.v1.variants.with_raw_response.delete( - "string", + "hero", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `variant_id` but received ''"): await async_client.images.v1.variants.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: variant = await async_client.images.v1.variants.edit( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", options={ "fit": "scale-down", @@ -548,13 +558,13 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "width": 1366, }, ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantEditResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: variant = await async_client.images.v1.variants.edit( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", options={ "fit": "scale-down", @@ -564,13 +574,13 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) }, never_require_signed_urls=True, ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantEditResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.images.v1.variants.with_raw_response.edit( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", options={ "fit": "scale-down", @@ -583,13 +593,13 @@ 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(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantEditResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.images.v1.variants.with_streaming_response.edit( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", options={ "fit": "scale-down", @@ -602,7 +612,7 @@ 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(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantEditResponse, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -611,7 +621,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.images.v1.variants.with_raw_response.edit( - "string", + "hero", account_id="", options={ "fit": "scale-down", @@ -637,36 +647,36 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: variant = await async_client.images.v1.variants.get( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantGetResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.images.v1.variants.with_raw_response.get( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantGetResponse, variant, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.images.v1.variants.with_streaming_response.get( - "string", + "hero", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(V1ImageVariant, variant, path=["response"]) + assert_matches_type(VariantGetResponse, variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -675,7 +685,7 @@ 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.images.v1.variants.with_raw_response.get( - "string", + "hero", account_id="", ) diff --git a/tests/api_resources/images/v2/test_direct_uploads.py b/tests/api_resources/images/v2/test_direct_uploads.py index 8a826f37875..43d7ea9735b 100644 --- a/tests/api_resources/images/v2/test_direct_uploads.py +++ b/tests/api_resources/images/v2/test_direct_uploads.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.images.v2 import DirectUploadCreateResponse +from cloudflare.types.images.v2.direct_upload_create_response import DirectUploadCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,6 +31,7 @@ def test_method_create(self, client: Cloudflare) -> None: def test_method_create_with_all_params(self, client: Cloudflare) -> None: direct_upload = client.images.v2.direct_uploads.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + id="this/is/my-customid", expiry=parse_datetime("2021-01-02T02:20:00Z"), metadata={}, require_signed_urls=True, @@ -88,6 +89,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: direct_upload = await async_client.images.v2.direct_uploads.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + id="this/is/my-customid", expiry=parse_datetime("2021-01-02T02:20:00Z"), metadata={}, require_signed_urls=True, diff --git a/tests/api_resources/intel/asn/test_subnets.py b/tests/api_resources/intel/asn/test_subnets.py index 3014e7984ef..569fbd0a4fe 100644 --- a/tests/api_resources/intel/asn/test_subnets.py +++ b/tests/api_resources/intel/asn/test_subnets.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel.asn import SubnetGetResponse +from cloudflare.types.intel.asn.subnet_get_response import SubnetGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/attack_surface_report/test_issue_types.py b/tests/api_resources/intel/attack_surface_report/test_issue_types.py index 1274cb4c67d..8bc0538f087 100644 --- a/tests/api_resources/intel/attack_surface_report/test_issue_types.py +++ b/tests/api_resources/intel/attack_surface_report/test_issue_types.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel.attack_surface_report import IssueTypeGetResponse +from cloudflare.types.intel.attack_surface_report.issue_type_get_response import IssueTypeGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/attack_surface_report/test_issues.py b/tests/api_resources/intel/attack_surface_report/test_issues.py index 31bd421e533..52094c38239 100644 --- a/tests/api_resources/intel/attack_surface_report/test_issues.py +++ b/tests/api_resources/intel/attack_surface_report/test_issues.py @@ -10,13 +10,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination -from cloudflare.types.intel.attack_surface_report import ( - IssueListResponse, - IssueTypeResponse, - IssueClassResponse, - IssueDismissResponse, - IssueSeverityResponse, -) +from cloudflare.types.intel.attack_surface_report.issue_list_response import IssueListResponse +from cloudflare.types.intel.attack_surface_report.issue_type_response import IssueTypeResponse +from cloudflare.types.intel.attack_surface_report.issue_class_response import IssueClassResponse +from cloudflare.types.intel.attack_surface_report.issue_dismiss_response import IssueDismissResponse +from cloudflare.types.intel.attack_surface_report.issue_severity_response import IssueSeverityResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/domains/test_bulks.py b/tests/api_resources/intel/domains/test_bulks.py index 10054a63d1c..219c656996e 100644 --- a/tests/api_resources/intel/domains/test_bulks.py +++ b/tests/api_resources/intel/domains/test_bulks.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel.domains import BulkGetResponse +from cloudflare.types.intel.domains.bulk_get_response import BulkGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/indicator_feeds/test_permissions.py b/tests/api_resources/intel/indicator_feeds/test_permissions.py index f7da59f2cda..dc86ad524b0 100644 --- a/tests/api_resources/intel/indicator_feeds/test_permissions.py +++ b/tests/api_resources/intel/indicator_feeds/test_permissions.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel.indicator_feeds import ( - PermissionListResponse, - PermissionCreateResponse, - PermissionDeleteResponse, -) +from cloudflare.types.intel.indicator_feeds.permission_list_response import PermissionListResponse +from cloudflare.types.intel.indicator_feeds.permission_create_response import PermissionCreateResponse +from cloudflare.types.intel.indicator_feeds.permission_delete_response import PermissionDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/test_asn.py b/tests/api_resources/intel/test_asn.py index 75191ec2eb7..e6422689e81 100644 --- a/tests/api_resources/intel/test_asn.py +++ b/tests/api_resources/intel/test_asn.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import IntelASN +from cloudflare.types.shared.asn import ASN base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: 0, account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" asn = response.parse() - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" asn = response.parse() - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +74,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: 0, account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,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" asn = await response.parse() - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" asn = await response.parse() - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_dns.py b/tests/api_resources/intel/test_dns.py index febfa756ec3..16030078128 100644 --- a/tests/api_resources/intel/test_dns.py +++ b/tests/api_resources/intel/test_dns.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_date -from cloudflare.types.intel import IntelPassiveDNSByIP +from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination +from cloudflare.types.intel.dns_list_response import DNSListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,16 +21,16 @@ class TestDNS: @pytest.mark.skip() @parametrize - def test_method_get(self, client: Cloudflare) -> None: - dns = client.intel.dns.get( + def test_method_list(self, client: Cloudflare) -> None: + dns = client.intel.dns.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelPassiveDNSByIP, dns, path=["response"]) + assert_matches_type(SyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - dns = client.intel.dns.get( + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + dns = client.intel.dns.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ipv4="string", page=1, @@ -39,39 +40,39 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "start": parse_date("2021-04-01"), }, ) - assert_matches_type(IntelPassiveDNSByIP, dns, path=["response"]) + assert_matches_type(SyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.intel.dns.with_raw_response.get( + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.intel.dns.with_raw_response.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns = response.parse() - assert_matches_type(IntelPassiveDNSByIP, dns, path=["response"]) + assert_matches_type(SyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.intel.dns.with_streaming_response.get( + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.intel.dns.with_streaming_response.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns = response.parse() - assert_matches_type(IntelPassiveDNSByIP, dns, path=["response"]) + assert_matches_type(SyncV4PagePagination[DNSListResponse], dns, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_get(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.intel.dns.with_raw_response.get( + client.intel.dns.with_raw_response.list( account_id="", ) @@ -81,16 +82,16 @@ class TestAsyncDNS: @pytest.mark.skip() @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - dns = await async_client.intel.dns.get( + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + dns = await async_client.intel.dns.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelPassiveDNSByIP, dns, path=["response"]) + assert_matches_type(AsyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - dns = await async_client.intel.dns.get( + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + dns = await async_client.intel.dns.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ipv4="string", page=1, @@ -100,38 +101,38 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "start": parse_date("2021-04-01"), }, ) - assert_matches_type(IntelPassiveDNSByIP, dns, path=["response"]) + assert_matches_type(AsyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.intel.dns.with_raw_response.get( + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.intel.dns.with_raw_response.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns = await response.parse() - assert_matches_type(IntelPassiveDNSByIP, dns, path=["response"]) + assert_matches_type(AsyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.intel.dns.with_streaming_response.get( + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.intel.dns.with_streaming_response.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns = await response.parse() - assert_matches_type(IntelPassiveDNSByIP, dns, path=["response"]) + assert_matches_type(AsyncV4PagePagination[DNSListResponse], dns, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.intel.dns.with_raw_response.get( + await async_client.intel.dns.with_raw_response.list( account_id="", ) diff --git a/tests/api_resources/intel/test_domain_history.py b/tests/api_resources/intel/test_domain_history.py index 811ded0a843..f3393ae4f65 100644 --- a/tests/api_resources/intel/test_domain_history.py +++ b/tests/api_resources/intel/test_domain_history.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import DomainHistoryGetResponse +from cloudflare.types.intel.domain_history_get_response import DomainHistoryGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/test_domains.py b/tests/api_resources/intel/test_domains.py index edfc243062d..181c005a139 100644 --- a/tests/api_resources/intel/test_domains.py +++ b/tests/api_resources/intel/test_domains.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import IntelDomain +from cloudflare.types.intel.domain import Domain base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_get(self, client: Cloudflare) -> None: domain = client.intel.domains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelDomain, domain, path=["response"]) + assert_matches_type(Domain, domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,7 +32,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(IntelDomain, domain, path=["response"]) + assert_matches_type(Domain, domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,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" domain = response.parse() - assert_matches_type(IntelDomain, domain, path=["response"]) + assert_matches_type(Domain, domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(IntelDomain, domain, path=["response"]) + assert_matches_type(Domain, domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +78,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: domain = await async_client.intel.domains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelDomain, domain, path=["response"]) + assert_matches_type(Domain, domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(IntelDomain, domain, path=["response"]) + assert_matches_type(Domain, domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +99,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" domain = await response.parse() - assert_matches_type(IntelDomain, domain, path=["response"]) + assert_matches_type(Domain, domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +111,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(IntelDomain, domain, path=["response"]) + assert_matches_type(Domain, domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_indicator_feeds.py b/tests/api_resources/intel/test_indicator_feeds.py index 956f15c0233..11ae20c41d6 100644 --- a/tests/api_resources/intel/test_indicator_feeds.py +++ b/tests/api_resources/intel/test_indicator_feeds.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.intel import ( - IndicatorFeedGetResponse, - IndicatorFeedListResponse, - IndicatorFeedCreateResponse, - IndicatorFeedUpdateResponse, -) +from cloudflare.types.intel.indicator_feed_get_response import IndicatorFeedGetResponse +from cloudflare.types.intel.indicator_feed_list_response import IndicatorFeedListResponse +from cloudflare.types.intel.indicator_feed_create_response import IndicatorFeedCreateResponse +from cloudflare.types.intel.indicator_feed_update_response import IndicatorFeedUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/test_ip_lists.py b/tests/api_resources/intel/test_ip_lists.py index 2adbe284b62..a65b25a285a 100644 --- a/tests/api_resources/intel/test_ip_lists.py +++ b/tests/api_resources/intel/test_ip_lists.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import IPListGetResponse +from cloudflare.types.intel.ip_list_get_response import IPListGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/test_ips.py b/tests/api_resources/intel/test_ips.py index 8956bb8c5fa..4abc4a1db52 100644 --- a/tests/api_resources/intel/test_ips.py +++ b/tests/api_resources/intel/test_ips.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import IPGetResponse +from cloudflare.types.intel.ip_get_response import IPGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/test_miscategorizations.py b/tests/api_resources/intel/test_miscategorizations.py index 8231ba952c5..8e769f28565 100644 --- a/tests/api_resources/intel/test_miscategorizations.py +++ b/tests/api_resources/intel/test_miscategorizations.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import MiscategorizationCreateResponse +from cloudflare.types.intel.miscategorization_create_response import MiscategorizationCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/intel/test_sinkholes.py b/tests/api_resources/intel/test_sinkholes.py index 7486df7c274..e9086908383 100644 --- a/tests/api_resources/intel/test_sinkholes.py +++ b/tests/api_resources/intel/test_sinkholes.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.intel import IntelSinkholeItem +from cloudflare.types.intel.sinkhole import Sinkhole base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: sinkhole = client.intel.sinkholes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) + assert_matches_type(SyncSinglePage[Sinkhole], sinkhole, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" sinkhole = response.parse() - assert_matches_type(SyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) + assert_matches_type(SyncSinglePage[Sinkhole], sinkhole, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sinkhole = response.parse() - assert_matches_type(SyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) + assert_matches_type(SyncSinglePage[Sinkhole], sinkhole, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: sinkhole = await async_client.intel.sinkholes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) + assert_matches_type(AsyncSinglePage[Sinkhole], sinkhole, path=["response"]) @pytest.mark.skip() @parametrize @@ -82,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" sinkhole = await response.parse() - assert_matches_type(AsyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) + assert_matches_type(AsyncSinglePage[Sinkhole], sinkhole, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" sinkhole = await response.parse() - assert_matches_type(AsyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) + assert_matches_type(AsyncSinglePage[Sinkhole], sinkhole, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_whois.py b/tests/api_resources/intel/test_whois.py index 81060ff3119..00343224cdb 100644 --- a/tests/api_resources/intel/test_whois.py +++ b/tests/api_resources/intel/test_whois.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import IntelWhois +from cloudflare.types.intel.whois import Whois base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_get(self, client: Cloudflare) -> None: whois = client.intel.whois.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelWhois, whois, path=["response"]) + assert_matches_type(Whois, whois, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,7 +32,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(IntelWhois, whois, path=["response"]) + assert_matches_type(Whois, whois, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,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" whois = response.parse() - assert_matches_type(IntelWhois, whois, path=["response"]) + assert_matches_type(Whois, whois, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = response.parse() - assert_matches_type(IntelWhois, whois, path=["response"]) + assert_matches_type(Whois, whois, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +78,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: whois = await async_client.intel.whois.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelWhois, whois, path=["response"]) + assert_matches_type(Whois, whois, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(IntelWhois, whois, path=["response"]) + assert_matches_type(Whois, whois, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +99,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" whois = await response.parse() - assert_matches_type(IntelWhois, whois, path=["response"]) + assert_matches_type(Whois, whois, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +111,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = await response.parse() - assert_matches_type(IntelWhois, whois, path=["response"]) + assert_matches_type(Whois, whois, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/kv/namespaces/test_bulk.py b/tests/api_resources/kv/namespaces/test_bulk.py index 50d6d3c6d99..9732acf1d42 100644 --- a/tests/api_resources/kv/namespaces/test_bulk.py +++ b/tests/api_resources/kv/namespaces/test_bulk.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.kv.namespaces import ( - BulkDeleteResponse, - BulkUpdateResponse, -) +from cloudflare.types.kv.namespaces.bulk_delete_response import BulkDeleteResponse +from cloudflare.types.kv.namespaces.bulk_update_response import BulkUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/kv/namespaces/test_keys.py b/tests/api_resources/kv/namespaces/test_keys.py index 69d2cf6aa3c..e7fcfee6fb5 100644 --- a/tests/api_resources/kv/namespaces/test_keys.py +++ b/tests/api_resources/kv/namespaces/test_keys.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncCursorLimitPagination, AsyncCursorLimitPagination -from cloudflare.types.kv.namespaces import WorkersKVKey +from cloudflare.types.kv.namespaces.key import Key base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncCursorLimitPagination[WorkersKVKey], key, path=["response"]) + assert_matches_type(SyncCursorLimitPagination[Key], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: limit=10, prefix="My-Prefix", ) - assert_matches_type(SyncCursorLimitPagination[WorkersKVKey], key, path=["response"]) + assert_matches_type(SyncCursorLimitPagination[Key], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(SyncCursorLimitPagination[WorkersKVKey], key, path=["response"]) + assert_matches_type(SyncCursorLimitPagination[Key], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(SyncCursorLimitPagination[WorkersKVKey], key, path=["response"]) + assert_matches_type(SyncCursorLimitPagination[Key], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +93,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncCursorLimitPagination[WorkersKVKey], key, path=["response"]) + assert_matches_type(AsyncCursorLimitPagination[Key], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +105,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) limit=10, prefix="My-Prefix", ) - assert_matches_type(AsyncCursorLimitPagination[WorkersKVKey], key, path=["response"]) + assert_matches_type(AsyncCursorLimitPagination[Key], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +118,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(AsyncCursorLimitPagination[WorkersKVKey], key, path=["response"]) + assert_matches_type(AsyncCursorLimitPagination[Key], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +131,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(AsyncCursorLimitPagination[WorkersKVKey], key, path=["response"]) + assert_matches_type(AsyncCursorLimitPagination[Key], key, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/kv/namespaces/test_values.py b/tests/api_resources/kv/namespaces/test_values.py index 0327c01e662..d6800fec3f8 100644 --- a/tests/api_resources/kv/namespaces/test_values.py +++ b/tests/api_resources/kv/namespaces/test_values.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.kv.namespaces import ( - ValueDeleteResponse, - ValueUpdateResponse, -) +from cloudflare.types.kv.namespaces.value_delete_response import ValueDeleteResponse +from cloudflare.types.kv.namespaces.value_update_response import ValueUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -103,6 +101,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) assert_matches_type(ValueDeleteResponse, value, path=["response"]) @@ -113,6 +112,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) assert response.is_closed is True @@ -127,6 +127,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -144,6 +145,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "My-Key", account_id="", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `namespace_id` but received ''"): @@ -151,6 +153,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_name` but received ''"): @@ -158,6 +161,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) @pytest.mark.skip() @@ -311,6 +315,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) assert_matches_type(ValueDeleteResponse, value, path=["response"]) @@ -321,6 +326,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) assert response.is_closed is True @@ -335,6 +341,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -352,6 +359,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "My-Key", account_id="", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `namespace_id` but received ''"): @@ -359,6 +367,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_name` but received ''"): @@ -366,6 +375,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/kv/test_namespaces.py b/tests/api_resources/kv/test_namespaces.py index 4378cf98d84..8ef7b4acd76 100644 --- a/tests/api_resources/kv/test_namespaces.py +++ b/tests/api_resources/kv/test_namespaces.py @@ -9,12 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.kv import ( - WorkersKVNamespace, - NamespaceDeleteResponse, - NamespaceUpdateResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.kv.namespace import Namespace +from cloudflare.types.kv.namespace_delete_response import NamespaceDeleteResponse +from cloudflare.types.kv.namespace_update_response import NamespaceUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", title="My Own Namespace", ) - assert_matches_type(WorkersKVNamespace, namespace, path=["response"]) + assert_matches_type(Namespace, namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +40,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" namespace = response.parse() - assert_matches_type(WorkersKVNamespace, namespace, path=["response"]) + assert_matches_type(Namespace, namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +53,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(WorkersKVNamespace, namespace, path=["response"]) + assert_matches_type(Namespace, namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -131,7 +129,7 @@ def test_method_list(self, client: Cloudflare) -> None: namespace = client.kv.namespaces.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[WorkersKVNamespace], namespace, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +141,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=5, ) - assert_matches_type(SyncV4PagePaginationArray[WorkersKVNamespace], namespace, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +153,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WorkersKVNamespace], namespace, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -167,7 +165,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WorkersKVNamespace], namespace, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Namespace], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -185,6 +183,7 @@ def test_method_delete(self, client: Cloudflare) -> None: namespace = client.kv.namespaces.delete( "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(NamespaceDeleteResponse, namespace, path=["response"]) @@ -194,6 +193,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.kv.namespaces.with_raw_response.delete( "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -207,6 +207,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.kv.namespaces.with_streaming_response.delete( "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -223,12 +224,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.kv.namespaces.with_raw_response.delete( "0f2ac74b498b48028cb68387c421e279", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `namespace_id` but received ''"): client.kv.namespaces.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @@ -242,7 +245,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", title="My Own Namespace", ) - assert_matches_type(WorkersKVNamespace, namespace, path=["response"]) + assert_matches_type(Namespace, namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +258,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" namespace = await response.parse() - assert_matches_type(WorkersKVNamespace, namespace, path=["response"]) + assert_matches_type(Namespace, namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +271,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(WorkersKVNamespace, namespace, path=["response"]) + assert_matches_type(Namespace, namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -344,7 +347,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: namespace = await async_client.kv.namespaces.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[WorkersKVNamespace], namespace, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -356,7 +359,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=5, ) - assert_matches_type(AsyncV4PagePaginationArray[WorkersKVNamespace], namespace, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -368,7 +371,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WorkersKVNamespace], namespace, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Namespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -380,7 +383,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WorkersKVNamespace], namespace, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Namespace], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -398,6 +401,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: namespace = await async_client.kv.namespaces.delete( "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(NamespaceDeleteResponse, namespace, path=["response"]) @@ -407,6 +411,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.kv.namespaces.with_raw_response.delete( "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -420,6 +425,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.kv.namespaces.with_streaming_response.delete( "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -436,10 +442,12 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.kv.namespaces.with_raw_response.delete( "0f2ac74b498b48028cb68387c421e279", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `namespace_id` but received ''"): await async_client.kv.namespaces.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) diff --git a/tests/api_resources/load_balancers/monitors/test_previews.py b/tests/api_resources/load_balancers/monitors/test_previews.py index 791b255f075..3a5e48aedad 100644 --- a/tests/api_resources/load_balancers/monitors/test_previews.py +++ b/tests/api_resources/load_balancers/monitors/test_previews.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.load_balancers.monitors import PreviewCreateResponse +from cloudflare.types.load_balancers.monitors.preview_create_response import PreviewCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/load_balancers/monitors/test_references.py b/tests/api_resources/load_balancers/monitors/test_references.py index ac893043fec..ceeaa7015c9 100644 --- a/tests/api_resources/load_balancers/monitors/test_references.py +++ b/tests/api_resources/load_balancers/monitors/test_references.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.load_balancers.monitors import ReferenceGetResponse +from cloudflare.types.load_balancers.monitors.reference_get_response import ReferenceGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/load_balancers/pools/test_health.py b/tests/api_resources/load_balancers/pools/test_health.py index 13c1108bf5d..b10caa8c54c 100644 --- a/tests/api_resources/load_balancers/pools/test_health.py +++ b/tests/api_resources/load_balancers/pools/test_health.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.load_balancers.pools import HealthGetResponse, HealthCreateResponse +from cloudflare.types.load_balancers.pools.health_get_response import HealthGetResponse +from cloudflare.types.load_balancers.pools.health_create_response import HealthCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/load_balancers/pools/test_references.py b/tests/api_resources/load_balancers/pools/test_references.py index 723f890e4e7..c45476633ba 100644 --- a/tests/api_resources/load_balancers/pools/test_references.py +++ b/tests/api_resources/load_balancers/pools/test_references.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.load_balancers.pools import ReferenceGetResponse +from cloudflare.types.load_balancers.pools.reference_get_response import ReferenceGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/load_balancers/test_monitors.py b/tests/api_resources/load_balancers/test_monitors.py index 3fb7491a8c8..946c94fbb58 100644 --- a/tests/api_resources/load_balancers/test_monitors.py +++ b/tests/api_resources/load_balancers/test_monitors.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.load_balancers import ( - MonitorDeleteResponse, -) -from cloudflare.types.user.load_balancers import LoadBalancingMonitor +from cloudflare.types.load_balancers.monitor import Monitor +from cloudflare.types.load_balancers.monitor_delete_response import MonitorDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", expected_codes="2xx", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +53,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: load_balancer_monitor_timeout=0, type="https", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +66,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" monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +79,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -102,7 +100,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", expected_codes="2xx", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +128,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: load_balancer_monitor_timeout=0, type="https", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -144,7 +142,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -158,7 +156,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -185,7 +183,7 @@ def test_method_list(self, client: Cloudflare) -> None: monitor = client.load_balancers.monitors.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[Monitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +195,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[Monitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -209,7 +207,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[Monitor], monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -227,6 +225,7 @@ def test_method_delete(self, client: Cloudflare) -> None: monitor = client.load_balancers.monitors.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(MonitorDeleteResponse, monitor, path=["response"]) @@ -236,6 +235,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.load_balancers.monitors.with_raw_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -249,6 +249,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.load_balancers.monitors.with_streaming_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -265,12 +266,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.load_balancers.monitors.with_raw_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): client.load_balancers.monitors.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -281,7 +284,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", expected_codes="2xx", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -309,7 +312,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: load_balancer_monitor_timeout=0, type="https", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -323,7 +326,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" monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -337,7 +340,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -365,7 +368,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -378,7 +381,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" monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,7 +394,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -421,7 +424,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", expected_codes="2xx", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -448,7 +451,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare load_balancer_monitor_timeout=0, type="https", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +464,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" monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -474,7 +477,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -495,7 +498,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", expected_codes="2xx", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -523,7 +526,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare load_balancer_monitor_timeout=0, type="https", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -537,7 +540,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -551,7 +554,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -578,7 +581,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: monitor = await async_client.load_balancers.monitors.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[Monitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -590,7 +593,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[Monitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -602,7 +605,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[Monitor], monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -620,6 +623,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: monitor = await async_client.load_balancers.monitors.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(MonitorDeleteResponse, monitor, path=["response"]) @@ -629,6 +633,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.load_balancers.monitors.with_raw_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -642,6 +647,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.load_balancers.monitors.with_streaming_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -658,12 +664,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.load_balancers.monitors.with_raw_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): await async_client.load_balancers.monitors.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -674,7 +682,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", expected_codes="2xx", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -702,7 +710,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) load_balancer_monitor_timeout=0, type="https", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -716,7 +724,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" monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -730,7 +738,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -758,7 +766,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -771,7 +779,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" monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -784,7 +792,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) + assert_matches_type(Monitor, monitor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/load_balancers/test_pools.py b/tests/api_resources/load_balancers/test_pools.py index ee970e0cc7e..b0a3a6e5c88 100644 --- a/tests/api_resources/load_balancers/test_pools.py +++ b/tests/api_resources/load_balancers/test_pools.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.load_balancers import ( - PoolDeleteResponse, -) -from cloudflare.types.user.load_balancers import LoadBalancingPool +from cloudflare.types.load_balancers.pool import Pool +from cloudflare.types.load_balancers.pool_delete_response import PoolDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="primary-dc-1", origins=[{}, {}, {}], ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,7 +86,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: }, origin_steering={"policy": "random"}, ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +100,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" pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +114,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -139,7 +137,7 @@ def test_method_update(self, client: Cloudflare) -> None: name="primary-dc-1", origins=[{}, {}, {}], ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -200,7 +198,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, origin_steering={"policy": "random"}, ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +213,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -230,7 +228,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -259,7 +257,7 @@ def test_method_list(self, client: Cloudflare) -> None: pool = client.load_balancers.pools.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) + assert_matches_type(SyncSinglePage[Pool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +266,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", monitor={}, ) - assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) + assert_matches_type(SyncSinglePage[Pool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -280,7 +278,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) + assert_matches_type(SyncSinglePage[Pool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -292,7 +290,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) + assert_matches_type(SyncSinglePage[Pool], pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -310,6 +308,7 @@ def test_method_delete(self, client: Cloudflare) -> None: pool = client.load_balancers.pools.delete( "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(PoolDeleteResponse, pool, path=["response"]) @@ -319,6 +318,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.load_balancers.pools.with_raw_response.delete( "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -332,6 +332,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.load_balancers.pools.with_streaming_response.delete( "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -348,12 +349,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.load_balancers.pools.with_raw_response.delete( "17b5962d775c646f3f9725cbc7a53df4", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): client.load_balancers.pools.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -363,7 +366,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -424,7 +427,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -437,7 +440,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" pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -450,7 +453,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -476,7 +479,7 @@ def test_method_get(self, client: Cloudflare) -> None: "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -489,7 +492,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" pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -502,7 +505,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -533,7 +536,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="primary-dc-1", origins=[{}, {}, {}], ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -592,7 +595,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare }, origin_steering={"policy": "random"}, ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -606,7 +609,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" pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -620,7 +623,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -643,7 +646,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: name="primary-dc-1", origins=[{}, {}, {}], ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -704,7 +707,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, origin_steering={"policy": "random"}, ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -719,7 +722,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -734,7 +737,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -763,7 +766,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: pool = await async_client.load_balancers.pools.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[Pool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -772,7 +775,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="023e105f4ecef8ad9ca31a8372d0c353", monitor={}, ) - assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[Pool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -784,7 +787,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[Pool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -796,7 +799,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[Pool], pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -814,6 +817,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: pool = await async_client.load_balancers.pools.delete( "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(PoolDeleteResponse, pool, path=["response"]) @@ -823,6 +827,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.load_balancers.pools.with_raw_response.delete( "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -836,6 +841,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.load_balancers.pools.with_streaming_response.delete( "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -852,12 +858,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.load_balancers.pools.with_raw_response.delete( "17b5962d775c646f3f9725cbc7a53df4", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): await async_client.load_balancers.pools.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -867,7 +875,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -928,7 +936,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) }, ], ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -941,7 +949,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" pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -954,7 +962,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -980,7 +988,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "17b5962d775c646f3f9725cbc7a53df4", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -993,7 +1001,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" pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -1006,7 +1014,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) + assert_matches_type(Pool, pool, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/load_balancers/test_previews.py b/tests/api_resources/load_balancers/test_previews.py index de8e142121c..7be32ceecb9 100644 --- a/tests/api_resources/load_balancers/test_previews.py +++ b/tests/api_resources/load_balancers/test_previews.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.user.load_balancers import LoadBalancingPreview +from cloudflare.types.load_balancers.preview_get_response import PreviewGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: "p1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" preview = response.parse() - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" preview = response.parse() - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) assert cast(Any, response.is_closed) is True @@ -80,7 +80,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "p1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,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" preview = await response.parse() - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" preview = await response.parse() - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/load_balancers/test_regions.py b/tests/api_resources/load_balancers/test_regions.py index ae7e7b8f3d4..55063ddc005 100644 --- a/tests/api_resources/load_balancers/test_regions.py +++ b/tests/api_resources/load_balancers/test_regions.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.load_balancers import RegionGetResponse, RegionListResponse +from cloudflare.types.load_balancers.region_get_response import RegionGetResponse +from cloudflare.types.load_balancers.region_list_response import RegionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/load_balancers/test_searches.py b/tests/api_resources/load_balancers/test_searches.py index 22949e8c586..6ab871c3021 100644 --- a/tests/api_resources/load_balancers/test_searches.py +++ b/tests/api_resources/load_balancers/test_searches.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.load_balancers import SearchGetResponse +from cloudflare.types.load_balancers.search_get_response import SearchGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/logpush/datasets/test_jobs.py b/tests/api_resources/logpush/datasets/test_jobs.py index 39c7401990e..e65ea0b6394 100644 --- a/tests/api_resources/logpush/datasets/test_jobs.py +++ b/tests/api_resources/logpush/datasets/test_jobs.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.logpush.datasets import JobGetResponse +from cloudflare.types.logpush.datasets.job_get_response import JobGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,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" job = response.parse() - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) assert cast(Any, response.is_closed) is True @@ -103,7 +103,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +113,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +127,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" job = await response.parse() - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -141,7 +141,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/logpush/test_edge.py b/tests/api_resources/logpush/test_edge.py index 3c0826f48f8..a26292567a3 100644 --- a/tests/api_resources/logpush/test_edge.py +++ b/tests/api_resources/logpush/test_edge.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logpush import EdgeGetResponse, InstantLogpushJob +from cloudflare.types.logpush.edge_get_response import EdgeGetResponse +from cloudflare.types.logpush.instant_logpush_job import InstantLogpushJob base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -76,7 +77,7 @@ def test_method_get(self, client: Cloudflare) -> None: edge = client.logpush.edge.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,7 +89,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" edge = response.parse() - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +101,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" edge = response.parse() - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) assert cast(Any, response.is_closed) is True @@ -175,7 +176,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: edge = await async_client.logpush.edge.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,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" edge = await response.parse() - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) @pytest.mark.skip() @parametrize @@ -199,7 +200,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" edge = await response.parse() - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/logpush/test_jobs.py b/tests/api_resources/logpush/test_jobs.py index a8239d273d1..3d243709d0e 100644 --- a/tests/api_resources/logpush/test_jobs.py +++ b/tests/api_resources/logpush/test_jobs.py @@ -10,8 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.logpush import JobDeleteResponse -from cloudflare.types.logpush.datasets import LogpushJob +from cloudflare.types.logpush.logpush_job import LogpushJob base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -258,26 +257,29 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: job = client.logpush.jobs.delete( 1, + body={}, account_id="string", zone_id="string", ) - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize def test_method_delete_with_all_params(self, client: Cloudflare) -> None: job = client.logpush.jobs.delete( 1, + body={}, account_id="string", zone_id="string", ) - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.logpush.jobs.with_raw_response.delete( 1, + body={}, account_id="string", zone_id="string", ) @@ -285,13 +287,14 @@ 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" job = response.parse() - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.logpush.jobs.with_streaming_response.delete( 1, + body={}, account_id="string", zone_id="string", ) as response: @@ -299,7 +302,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) assert cast(Any, response.is_closed) is True @@ -309,6 +312,7 @@ 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.logpush.jobs.with_raw_response.delete( 1, + body={}, account_id="", zone_id="string", ) @@ -316,6 +320,7 @@ 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.logpush.jobs.with_raw_response.delete( 1, + body={}, account_id="string", zone_id="", ) @@ -630,26 +635,29 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: job = await async_client.logpush.jobs.delete( 1, + body={}, account_id="string", zone_id="string", ) - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: job = await async_client.logpush.jobs.delete( 1, + body={}, account_id="string", zone_id="string", ) - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.logpush.jobs.with_raw_response.delete( 1, + body={}, account_id="string", zone_id="string", ) @@ -657,13 +665,14 @@ 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" job = await response.parse() - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.logpush.jobs.with_streaming_response.delete( 1, + body={}, account_id="string", zone_id="string", ) as response: @@ -671,7 +680,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) assert cast(Any, response.is_closed) is True @@ -681,6 +690,7 @@ 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.logpush.jobs.with_raw_response.delete( 1, + body={}, account_id="", zone_id="string", ) @@ -688,6 +698,7 @@ 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.logpush.jobs.with_raw_response.delete( 1, + body={}, account_id="string", zone_id="", ) diff --git a/tests/api_resources/logpush/test_ownership.py b/tests/api_resources/logpush/test_ownership.py index cf96d023ce6..21ff01d1960 100644 --- a/tests/api_resources/logpush/test_ownership.py +++ b/tests/api_resources/logpush/test_ownership.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logpush import ( - OwnershipCreateResponse, - OwnershipValidateResponse, -) +from cloudflare.types.logpush.ownership_validation import OwnershipValidation +from cloudflare.types.logpush.ownership_create_response import OwnershipCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -96,7 +94,7 @@ def test_method_validate(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[OwnershipValidateResponse], ownership, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +105,7 @@ def test_method_validate_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[OwnershipValidateResponse], ownership, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +120,7 @@ def test_raw_response_validate(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(Optional[OwnershipValidateResponse], ownership, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -137,7 +135,7 @@ def test_streaming_response_validate(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(Optional[OwnershipValidateResponse], ownership, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], ownership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -240,7 +238,7 @@ async def test_method_validate(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[OwnershipValidateResponse], ownership, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -251,7 +249,7 @@ async def test_method_validate_with_all_params(self, async_client: AsyncCloudfla account_id="string", zone_id="string", ) - assert_matches_type(Optional[OwnershipValidateResponse], ownership, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -266,7 +264,7 @@ async def test_raw_response_validate(self, async_client: AsyncCloudflare) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(Optional[OwnershipValidateResponse], ownership, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -281,7 +279,7 @@ async def test_streaming_response_validate(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(Optional[OwnershipValidateResponse], ownership, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], ownership, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/logpush/test_validate.py b/tests/api_resources/logpush/test_validate.py index c56ba0f660c..51aad1568b6 100644 --- a/tests/api_resources/logpush/test_validate.py +++ b/tests/api_resources/logpush/test_validate.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logpush import ( - ValidateOriginResponse, - ValidateDestinationResponse, -) +from cloudflare.types.logpush.validate_origin_response import ValidateOriginResponse +from cloudflare.types.logpush.validate_destination_response import ValidateDestinationResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/logs/control/cmb/test_config.py b/tests/api_resources/logs/control/cmb/test_config.py index 4792cc9ed77..6849b57fe85 100644 --- a/tests/api_resources/logs/control/cmb/test_config.py +++ b/tests/api_resources/logs/control/cmb/test_config.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logs.control.cmb import CmbConfig, ConfigDeleteResponse +from cloudflare.types.logs.control.cmb.cmb_config import CmbConfig base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -73,32 +73,35 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: config = client.logs.control.cmb.config.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.logs.control.cmb.config.with_raw_response.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.logs.control.cmb.config.with_streaming_response.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -108,6 +111,7 @@ 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.logs.control.cmb.config.with_raw_response.delete( account_id="", + body={}, ) @pytest.mark.skip() @@ -212,32 +216,35 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: config = await async_client.logs.control.cmb.config.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.logs.control.cmb.config.with_raw_response.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.logs.control.cmb.config.with_streaming_response.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -247,6 +254,7 @@ 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.logs.control.cmb.config.with_raw_response.delete( account_id="", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/logs/control/retention/test_flag.py b/tests/api_resources/logs/control/retention/test_flag.py index a6fce61750f..d1fe897bdbc 100644 --- a/tests/api_resources/logs/control/retention/test_flag.py +++ b/tests/api_resources/logs/control/retention/test_flag.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logs.control.retention import FlagGetResponse, FlagCreateResponse +from cloudflare.types.logs.control.retention.flag_get_response import FlagGetResponse +from cloudflare.types.logs.control.retention.flag_create_response import FlagCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/logs/received/test_fields.py b/tests/api_resources/logs/received/test_fields.py index 38a6509bf56..db946844262 100644 --- a/tests/api_resources/logs/received/test_fields.py +++ b/tests/api_resources/logs/received/test_fields.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logs.received import FieldGetResponse +from cloudflare.types.logs.received.field_get_response import FieldGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/logs/test_rayid.py b/tests/api_resources/logs/test_rayid.py index a5264c4450a..a52b54fc51f 100644 --- a/tests/api_resources/logs/test_rayid.py +++ b/tests/api_resources/logs/test_rayid.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logs import RayIDGetResponse +from cloudflare.types.logs.rayid_get_response import RayIDGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/logs/test_received.py b/tests/api_resources/logs/test_received.py index 38002e7e0f9..e47ab7841cb 100644 --- a/tests/api_resources/logs/test_received.py +++ b/tests/api_resources/logs/test_received.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logs import ReceivedGetResponse +from cloudflare.types.logs.received_get_response import ReceivedGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/magic_network_monitoring/configs/test_full.py b/tests/api_resources/magic_network_monitoring/configs/test_full.py index 79aa9f510d5..19edd6942e9 100644 --- a/tests/api_resources/magic_network_monitoring/configs/test_full.py +++ b/tests/api_resources/magic_network_monitoring/configs/test_full.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_network_monitoring import MagicNetworkMonitoringConfig +from cloudflare.types.magic_network_monitoring.configuration import Configuration base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_get(self, client: Cloudflare) -> None: full = client.magic_network_monitoring.configs.full.get( account_id="6f91088a406011ed95aed352566e8d4c", ) - assert_matches_type(MagicNetworkMonitoringConfig, full, path=["response"]) + assert_matches_type(Configuration, full, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,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" full = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, full, path=["response"]) + assert_matches_type(Configuration, full, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" full = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, full, path=["response"]) + assert_matches_type(Configuration, full, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: full = await async_client.magic_network_monitoring.configs.full.get( account_id="6f91088a406011ed95aed352566e8d4c", ) - assert_matches_type(MagicNetworkMonitoringConfig, full, path=["response"]) + assert_matches_type(Configuration, full, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" full = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, full, path=["response"]) + assert_matches_type(Configuration, full, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" full = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, full, path=["response"]) + assert_matches_type(Configuration, full, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_network_monitoring/rules/test_advertisements.py b/tests/api_resources/magic_network_monitoring/rules/test_advertisements.py index a1a24e48efe..ecd103ef496 100644 --- a/tests/api_resources/magic_network_monitoring/rules/test_advertisements.py +++ b/tests/api_resources/magic_network_monitoring/rules/test_advertisements.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_network_monitoring.rules import MagicNetworkMonitoringRuleAdvertisable +from cloudflare.types.magic_network_monitoring.rules.advertisement import Advertisement base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,8 +23,9 @@ def test_method_edit(self, client: Cloudflare) -> None: advertisement = client.magic_network_monitoring.rules.advertisements.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(Optional[MagicNetworkMonitoringRuleAdvertisable], advertisement, path=["response"]) + assert_matches_type(Optional[Advertisement], advertisement, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,12 +33,13 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.rules.advertisements.with_raw_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" advertisement = response.parse() - assert_matches_type(Optional[MagicNetworkMonitoringRuleAdvertisable], advertisement, path=["response"]) + assert_matches_type(Optional[Advertisement], advertisement, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,12 +47,13 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.magic_network_monitoring.rules.advertisements.with_streaming_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" advertisement = response.parse() - assert_matches_type(Optional[MagicNetworkMonitoringRuleAdvertisable], advertisement, path=["response"]) + assert_matches_type(Optional[Advertisement], advertisement, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,12 +64,14 @@ def test_path_params_edit(self, client: Cloudflare) -> None: client.magic_network_monitoring.rules.advertisements.with_raw_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.magic_network_monitoring.rules.advertisements.with_raw_response.edit( "", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) @@ -79,8 +84,9 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: advertisement = await async_client.magic_network_monitoring.rules.advertisements.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(Optional[MagicNetworkMonitoringRuleAdvertisable], advertisement, path=["response"]) + assert_matches_type(Optional[Advertisement], advertisement, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,12 +94,13 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_network_monitoring.rules.advertisements.with_raw_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" advertisement = await response.parse() - assert_matches_type(Optional[MagicNetworkMonitoringRuleAdvertisable], advertisement, path=["response"]) + assert_matches_type(Optional[Advertisement], advertisement, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,12 +108,13 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N async with async_client.magic_network_monitoring.rules.advertisements.with_streaming_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" advertisement = await response.parse() - assert_matches_type(Optional[MagicNetworkMonitoringRuleAdvertisable], advertisement, path=["response"]) + assert_matches_type(Optional[Advertisement], advertisement, path=["response"]) assert cast(Any, response.is_closed) is True @@ -117,10 +125,12 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: await async_client.magic_network_monitoring.rules.advertisements.with_raw_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.magic_network_monitoring.rules.advertisements.with_raw_response.edit( "", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) diff --git a/tests/api_resources/magic_network_monitoring/test_configs.py b/tests/api_resources/magic_network_monitoring/test_configs.py index 47cd42f94e8..d1354b7f9cc 100644 --- a/tests/api_resources/magic_network_monitoring/test_configs.py +++ b/tests/api_resources/magic_network_monitoring/test_configs.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_network_monitoring import MagicNetworkMonitoringConfig +from cloudflare.types.magic_network_monitoring.configuration import Configuration base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,32 +22,35 @@ class TestConfigs: def test_method_create(self, client: Cloudflare) -> None: config = client.magic_network_monitoring.configs.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.configs.with_raw_response.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_network_monitoring.configs.with_streaming_response.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -57,6 +60,7 @@ 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.magic_network_monitoring.configs.with_raw_response.create( account_id="", + body={}, ) @pytest.mark.skip() @@ -64,32 +68,35 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: config = client.magic_network_monitoring.configs.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.configs.with_raw_response.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.magic_network_monitoring.configs.with_streaming_response.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -99,6 +106,7 @@ 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.magic_network_monitoring.configs.with_raw_response.update( account_id="", + body={}, ) @pytest.mark.skip() @@ -106,32 +114,35 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: config = client.magic_network_monitoring.configs.delete( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.configs.with_raw_response.delete( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.magic_network_monitoring.configs.with_streaming_response.delete( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -141,6 +152,7 @@ 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.magic_network_monitoring.configs.with_raw_response.delete( account_id="", + body={}, ) @pytest.mark.skip() @@ -148,32 +160,35 @@ def test_path_params_delete(self, client: Cloudflare) -> None: def test_method_edit(self, client: Cloudflare) -> None: config = client.magic_network_monitoring.configs.edit( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.configs.with_raw_response.edit( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.magic_network_monitoring.configs.with_streaming_response.edit( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -183,6 +198,7 @@ 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.magic_network_monitoring.configs.with_raw_response.edit( account_id="", + body={}, ) @pytest.mark.skip() @@ -191,7 +207,7 @@ def test_method_get(self, client: Cloudflare) -> None: config = client.magic_network_monitoring.configs.get( account_id="6f91088a406011ed95aed352566e8d4c", ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +219,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" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +231,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -236,32 +252,35 @@ class TestAsyncConfigs: async def test_method_create(self, async_client: AsyncCloudflare) -> None: config = await async_client.magic_network_monitoring.configs.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_network_monitoring.configs.with_raw_response.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.magic_network_monitoring.configs.with_streaming_response.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -271,6 +290,7 @@ 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.magic_network_monitoring.configs.with_raw_response.create( account_id="", + body={}, ) @pytest.mark.skip() @@ -278,32 +298,35 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: config = await async_client.magic_network_monitoring.configs.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_network_monitoring.configs.with_raw_response.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.magic_network_monitoring.configs.with_streaming_response.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -313,6 +336,7 @@ 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.magic_network_monitoring.configs.with_raw_response.update( account_id="", + body={}, ) @pytest.mark.skip() @@ -320,32 +344,35 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: config = await async_client.magic_network_monitoring.configs.delete( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_network_monitoring.configs.with_raw_response.delete( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.magic_network_monitoring.configs.with_streaming_response.delete( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -355,6 +382,7 @@ 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.magic_network_monitoring.configs.with_raw_response.delete( account_id="", + body={}, ) @pytest.mark.skip() @@ -362,32 +390,35 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_edit(self, async_client: AsyncCloudflare) -> None: config = await async_client.magic_network_monitoring.configs.edit( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_network_monitoring.configs.with_raw_response.edit( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.magic_network_monitoring.configs.with_streaming_response.edit( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -397,6 +428,7 @@ 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.magic_network_monitoring.configs.with_raw_response.edit( account_id="", + body={}, ) @pytest.mark.skip() @@ -405,7 +437,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: config = await async_client.magic_network_monitoring.configs.get( account_id="6f91088a406011ed95aed352566e8d4c", ) - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,7 +449,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" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -429,7 +461,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(MagicNetworkMonitoringConfig, config, path=["response"]) + assert_matches_type(Configuration, config, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_network_monitoring/test_rules.py b/tests/api_resources/magic_network_monitoring/test_rules.py index f5002da51fa..fb02399bc0c 100644 --- a/tests/api_resources/magic_network_monitoring/test_rules.py +++ b/tests/api_resources/magic_network_monitoring/test_rules.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.magic_network_monitoring import MagicNetworkMonitoringRule +from cloudflare.types.magic_network_monitoring.magic_network_monitoring_rule import MagicNetworkMonitoringRule base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,6 +23,7 @@ class TestRules: def test_method_create(self, client: Cloudflare) -> None: rule = client.magic_network_monitoring.rules.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert_matches_type(Optional[MagicNetworkMonitoringRule], rule, path=["response"]) @@ -31,6 +32,7 @@ def test_method_create(self, client: Cloudflare) -> None: def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.rules.with_raw_response.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True @@ -43,6 +45,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_network_monitoring.rules.with_streaming_response.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -58,6 +61,7 @@ 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.magic_network_monitoring.rules.with_raw_response.create( account_id="", + body={}, ) @pytest.mark.skip() @@ -65,6 +69,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: rule = client.magic_network_monitoring.rules.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert_matches_type(Optional[MagicNetworkMonitoringRule], rule, path=["response"]) @@ -73,6 +78,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.rules.with_raw_response.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True @@ -85,6 +91,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.magic_network_monitoring.rules.with_streaming_response.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -100,6 +107,7 @@ 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.magic_network_monitoring.rules.with_raw_response.update( account_id="", + body={}, ) @pytest.mark.skip() @@ -150,6 +158,7 @@ def test_method_delete(self, client: Cloudflare) -> None: rule = client.magic_network_monitoring.rules.delete( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert_matches_type(Optional[MagicNetworkMonitoringRule], rule, path=["response"]) @@ -159,6 +168,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.rules.with_raw_response.delete( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True @@ -172,6 +182,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.magic_network_monitoring.rules.with_streaming_response.delete( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -188,12 +199,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.magic_network_monitoring.rules.with_raw_response.delete( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.magic_network_monitoring.rules.with_raw_response.delete( "", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) @pytest.mark.skip() @@ -202,6 +215,7 @@ def test_method_edit(self, client: Cloudflare) -> None: rule = client.magic_network_monitoring.rules.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert_matches_type(Optional[MagicNetworkMonitoringRule], rule, path=["response"]) @@ -211,6 +225,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.magic_network_monitoring.rules.with_raw_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True @@ -224,6 +239,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.magic_network_monitoring.rules.with_streaming_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -240,12 +256,14 @@ def test_path_params_edit(self, client: Cloudflare) -> None: client.magic_network_monitoring.rules.with_raw_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.magic_network_monitoring.rules.with_raw_response.edit( "", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) @pytest.mark.skip() @@ -309,6 +327,7 @@ class TestAsyncRules: async def test_method_create(self, async_client: AsyncCloudflare) -> None: rule = await async_client.magic_network_monitoring.rules.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert_matches_type(Optional[MagicNetworkMonitoringRule], rule, path=["response"]) @@ -317,6 +336,7 @@ 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.magic_network_monitoring.rules.with_raw_response.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True @@ -329,6 +349,7 @@ 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.magic_network_monitoring.rules.with_streaming_response.create( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -344,6 +365,7 @@ 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.magic_network_monitoring.rules.with_raw_response.create( account_id="", + body={}, ) @pytest.mark.skip() @@ -351,6 +373,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: rule = await async_client.magic_network_monitoring.rules.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert_matches_type(Optional[MagicNetworkMonitoringRule], rule, path=["response"]) @@ -359,6 +382,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.magic_network_monitoring.rules.with_raw_response.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True @@ -371,6 +395,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.magic_network_monitoring.rules.with_streaming_response.update( account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -386,6 +411,7 @@ 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.magic_network_monitoring.rules.with_raw_response.update( account_id="", + body={}, ) @pytest.mark.skip() @@ -436,6 +462,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: rule = await async_client.magic_network_monitoring.rules.delete( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert_matches_type(Optional[MagicNetworkMonitoringRule], rule, path=["response"]) @@ -445,6 +472,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_network_monitoring.rules.with_raw_response.delete( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True @@ -458,6 +486,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.magic_network_monitoring.rules.with_streaming_response.delete( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -474,12 +503,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.magic_network_monitoring.rules.with_raw_response.delete( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.magic_network_monitoring.rules.with_raw_response.delete( "", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) @pytest.mark.skip() @@ -488,6 +519,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: rule = await async_client.magic_network_monitoring.rules.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert_matches_type(Optional[MagicNetworkMonitoringRule], rule, path=["response"]) @@ -497,6 +529,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_network_monitoring.rules.with_raw_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) assert response.is_closed is True @@ -510,6 +543,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N async with async_client.magic_network_monitoring.rules.with_streaming_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -526,12 +560,14 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: await async_client.magic_network_monitoring.rules.with_raw_response.edit( "2890e6fa406311ed9b5a23f70f6fb8cf", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.magic_network_monitoring.rules.with_raw_response.edit( "", account_id="6f91088a406011ed95aed352566e8d4c", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/magic_transit/sites/test_acls.py b/tests/api_resources/magic_transit/sites/test_acls.py index bcb8aae447b..3cc7bbdf247 100644 --- a/tests/api_resources/magic_transit/sites/test_acls.py +++ b/tests/api_resources/magic_transit/sites/test_acls.py @@ -9,13 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_transit.sites import ( - ACLGetResponse, - ACLListResponse, - ACLCreateResponse, - ACLDeleteResponse, - ACLUpdateResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.magic_transit.sites.acl import ACL base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,8 +24,11 @@ def test_method_create(self, client: Cloudflare) -> None: acl = client.magic_transit.sites.acls.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,25 +36,24 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: acl = client.magic_transit.sites.acls.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - acl={ - "description": "Allows local traffic between PIN pads and cash register.", - "lan_1": { - "lan_id": "string", - "lan_name": "string", - "ports": [1, 1, 1], - "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], - }, - "lan_2": { - "lan_id": "string", - "lan_name": "string", - "ports": [1, 1, 1], - "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], - }, - "name": "PIN Pad - Cash Register", - "protocols": ["tcp", "udp", "icmp"], + lan_1={ + "lan_id": "string", + "lan_name": "string", + "ports": [1, 1, 1], + "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], }, + lan_2={ + "lan_id": "string", + "lan_name": "string", + "ports": [1, 1, 1], + "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], + }, + name="PIN Pad - Cash Register", + description="Allows local traffic between PIN pads and cash register.", + forward_locally=True, + protocols=["tcp", "udp", "icmp"], ) - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,12 +61,15 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_transit.sites.acls.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -77,12 +77,15 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_transit.sites.acls.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,12 +96,18 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.magic_transit.sites.acls.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): client.magic_transit.sites.acls.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) @pytest.mark.skip() @@ -109,7 +118,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,25 +127,24 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - acl={ - "description": "Allows local traffic between PIN pads and cash register.", - "lan_1": { - "lan_id": "string", - "lan_name": "string", - "ports": [1, 1, 1], - "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], - }, - "lan_2": { - "lan_id": "string", - "lan_name": "string", - "ports": [1, 1, 1], - "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], - }, - "name": "PIN Pad - Cash Register", - "protocols": ["tcp", "udp", "icmp"], + description="Allows local traffic between PIN pads and cash register.", + forward_locally=True, + lan_1={ + "lan_id": "string", + "lan_name": "string", + "ports": [1, 1, 1], + "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], + }, + lan_2={ + "lan_id": "string", + "lan_name": "string", + "ports": [1, 1, 1], + "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], }, + name="PIN Pad - Cash Register", + protocols=["tcp", "udp", "icmp"], ) - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +158,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +172,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -199,7 +207,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -212,7 +220,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +233,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -251,8 +259,9 @@ def test_method_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -261,12 +270,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -275,12 +285,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -292,6 +303,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): @@ -299,6 +311,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"): @@ -306,6 +319,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -316,7 +330,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -330,7 +344,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" acl = response.parse() - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -344,7 +358,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -382,8 +396,11 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: acl = await async_client.magic_transit.sites.acls.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,25 +408,24 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare acl = await async_client.magic_transit.sites.acls.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - acl={ - "description": "Allows local traffic between PIN pads and cash register.", - "lan_1": { - "lan_id": "string", - "lan_name": "string", - "ports": [1, 1, 1], - "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], - }, - "lan_2": { - "lan_id": "string", - "lan_name": "string", - "ports": [1, 1, 1], - "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], - }, - "name": "PIN Pad - Cash Register", - "protocols": ["tcp", "udp", "icmp"], + lan_1={ + "lan_id": "string", + "lan_name": "string", + "ports": [1, 1, 1], + "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], }, + lan_2={ + "lan_id": "string", + "lan_name": "string", + "ports": [1, 1, 1], + "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], + }, + name="PIN Pad - Cash Register", + description="Allows local traffic between PIN pads and cash register.", + forward_locally=True, + protocols=["tcp", "udp", "icmp"], ) - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,12 +433,15 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.acls.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -430,12 +449,15 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.sites.acls.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -446,12 +468,18 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.sites.acls.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): await async_client.magic_transit.sites.acls.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) @pytest.mark.skip() @@ -462,7 +490,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -471,25 +499,24 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - acl={ - "description": "Allows local traffic between PIN pads and cash register.", - "lan_1": { - "lan_id": "string", - "lan_name": "string", - "ports": [1, 1, 1], - "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], - }, - "lan_2": { - "lan_id": "string", - "lan_name": "string", - "ports": [1, 1, 1], - "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], - }, - "name": "PIN Pad - Cash Register", - "protocols": ["tcp", "udp", "icmp"], + description="Allows local traffic between PIN pads and cash register.", + forward_locally=True, + lan_1={ + "lan_id": "string", + "lan_name": "string", + "ports": [1, 1, 1], + "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], + }, + lan_2={ + "lan_id": "string", + "lan_name": "string", + "ports": [1, 1, 1], + "subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"], }, + name="PIN Pad - Cash Register", + protocols=["tcp", "udp", "icmp"], ) - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -503,7 +530,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -517,7 +544,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -552,7 +579,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -565,7 +592,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -578,7 +605,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -604,8 +631,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -614,12 +642,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -628,12 +657,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -645,6 +675,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): @@ -652,6 +683,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"): @@ -659,6 +691,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -669,7 +702,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -683,7 +716,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" acl = await response.parse() - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -697,7 +730,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_transit/sites/test_lans.py b/tests/api_resources/magic_transit/sites/test_lans.py index 8b75553ed95..9ab10d2780b 100644 --- a/tests/api_resources/magic_transit/sites/test_lans.py +++ b/tests/api_resources/magic_transit/sites/test_lans.py @@ -9,13 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_transit.sites import ( - LANGetResponse, - LANListResponse, - LANCreateResponse, - LANDeleteResponse, - LANUpdateResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.magic_transit.sites.lan import LAN +from cloudflare.types.magic_transit.sites.lan_create_response import LANCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,6 +25,8 @@ def test_method_create(self, client: Cloudflare) -> None: lan = client.magic_transit.sites.lans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert_matches_type(LANCreateResponse, lan, path=["response"]) @@ -38,44 +36,42 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: lan = client.magic_transit.sites.lans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - lan={ - "description": "string", - "ha_link": True, - "nat": {"static_prefix": "192.0.2.0/24"}, - "physport": 1, - "routed_subnets": [ - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - ], - "static_addressing": { - "address": "192.0.2.0/24", - "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, - "dhcp_server": { - "dhcp_pool_end": "192.0.2.1", - "dhcp_pool_start": "192.0.2.1", - "dns_server": "192.0.2.1", - "reservations": { - "00:11:22:33:44:55": "192.0.2.100", - "AA:BB:CC:DD:EE:FF": "192.168.1.101", - }, + physport=1, + vlan_tag=0, + ha_link=True, + name="string", + nat={"static_prefix": "192.0.2.0/24"}, + routed_subnets=[ + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + ], + static_addressing={ + "address": "192.0.2.0/24", + "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, + "dhcp_server": { + "dhcp_pool_end": "192.0.2.1", + "dhcp_pool_start": "192.0.2.1", + "dns_server": "192.0.2.1", + "reservations": { + "00:11:22:33:44:55": "192.0.2.100", + "AA:BB:CC:DD:EE:FF": "192.168.1.101", }, - "secondary_address": "192.0.2.0/24", - "virtual_address": "192.0.2.0/24", }, - "vlan_tag": 0, + "secondary_address": "192.0.2.0/24", + "virtual_address": "192.0.2.0/24", }, ) assert_matches_type(LANCreateResponse, lan, path=["response"]) @@ -86,6 +82,8 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_transit.sites.lans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert response.is_closed is True @@ -99,6 +97,8 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_transit.sites.lans.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -115,12 +115,16 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.magic_transit.sites.lans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + physport=1, + vlan_tag=0, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): client.magic_transit.sites.lans.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) @pytest.mark.skip() @@ -131,7 +135,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,46 +144,44 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - lan={ - "description": "string", - "nat": {"static_prefix": "192.0.2.0/24"}, - "physport": 1, - "routed_subnets": [ - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - ], - "static_addressing": { - "address": "192.0.2.0/24", - "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, - "dhcp_server": { - "dhcp_pool_end": "192.0.2.1", - "dhcp_pool_start": "192.0.2.1", - "dns_server": "192.0.2.1", - "reservations": { - "00:11:22:33:44:55": "192.0.2.100", - "AA:BB:CC:DD:EE:FF": "192.168.1.101", - }, + name="string", + nat={"static_prefix": "192.0.2.0/24"}, + physport=1, + routed_subnets=[ + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + ], + static_addressing={ + "address": "192.0.2.0/24", + "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, + "dhcp_server": { + "dhcp_pool_end": "192.0.2.1", + "dhcp_pool_start": "192.0.2.1", + "dns_server": "192.0.2.1", + "reservations": { + "00:11:22:33:44:55": "192.0.2.100", + "AA:BB:CC:DD:EE:FF": "192.168.1.101", }, - "secondary_address": "192.0.2.0/24", - "virtual_address": "192.0.2.0/24", }, - "vlan_tag": 0, + "secondary_address": "192.0.2.0/24", + "virtual_address": "192.0.2.0/24", }, + vlan_tag=0, ) - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +195,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +209,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -242,7 +244,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(SyncSinglePage[LAN], lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +257,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(SyncSinglePage[LAN], lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +270,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(SyncSinglePage[LAN], lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -294,8 +296,9 @@ def test_method_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -304,12 +307,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -318,12 +322,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -335,6 +340,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): @@ -342,6 +348,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_id` but received ''"): @@ -349,6 +356,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -359,7 +367,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -373,7 +381,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" lan = response.parse() - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -387,7 +395,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -425,6 +433,8 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: lan = await async_client.magic_transit.sites.lans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert_matches_type(LANCreateResponse, lan, path=["response"]) @@ -434,44 +444,42 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare lan = await async_client.magic_transit.sites.lans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - lan={ - "description": "string", - "ha_link": True, - "nat": {"static_prefix": "192.0.2.0/24"}, - "physport": 1, - "routed_subnets": [ - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - ], - "static_addressing": { - "address": "192.0.2.0/24", - "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, - "dhcp_server": { - "dhcp_pool_end": "192.0.2.1", - "dhcp_pool_start": "192.0.2.1", - "dns_server": "192.0.2.1", - "reservations": { - "00:11:22:33:44:55": "192.0.2.100", - "AA:BB:CC:DD:EE:FF": "192.168.1.101", - }, + physport=1, + vlan_tag=0, + ha_link=True, + name="string", + nat={"static_prefix": "192.0.2.0/24"}, + routed_subnets=[ + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + ], + static_addressing={ + "address": "192.0.2.0/24", + "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, + "dhcp_server": { + "dhcp_pool_end": "192.0.2.1", + "dhcp_pool_start": "192.0.2.1", + "dns_server": "192.0.2.1", + "reservations": { + "00:11:22:33:44:55": "192.0.2.100", + "AA:BB:CC:DD:EE:FF": "192.168.1.101", }, - "secondary_address": "192.0.2.0/24", - "virtual_address": "192.0.2.0/24", }, - "vlan_tag": 0, + "secondary_address": "192.0.2.0/24", + "virtual_address": "192.0.2.0/24", }, ) assert_matches_type(LANCreateResponse, lan, path=["response"]) @@ -482,6 +490,8 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.lans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert response.is_closed is True @@ -495,6 +505,8 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.sites.lans.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -511,12 +523,16 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.sites.lans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + physport=1, + vlan_tag=0, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): await async_client.magic_transit.sites.lans.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) @pytest.mark.skip() @@ -527,7 +543,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -536,46 +552,44 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - lan={ - "description": "string", - "nat": {"static_prefix": "192.0.2.0/24"}, - "physport": 1, - "routed_subnets": [ - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - ], - "static_addressing": { - "address": "192.0.2.0/24", - "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, - "dhcp_server": { - "dhcp_pool_end": "192.0.2.1", - "dhcp_pool_start": "192.0.2.1", - "dns_server": "192.0.2.1", - "reservations": { - "00:11:22:33:44:55": "192.0.2.100", - "AA:BB:CC:DD:EE:FF": "192.168.1.101", - }, + name="string", + nat={"static_prefix": "192.0.2.0/24"}, + physport=1, + routed_subnets=[ + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + ], + static_addressing={ + "address": "192.0.2.0/24", + "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, + "dhcp_server": { + "dhcp_pool_end": "192.0.2.1", + "dhcp_pool_start": "192.0.2.1", + "dns_server": "192.0.2.1", + "reservations": { + "00:11:22:33:44:55": "192.0.2.100", + "AA:BB:CC:DD:EE:FF": "192.168.1.101", }, - "secondary_address": "192.0.2.0/24", - "virtual_address": "192.0.2.0/24", }, - "vlan_tag": 0, + "secondary_address": "192.0.2.0/24", + "virtual_address": "192.0.2.0/24", }, + vlan_tag=0, ) - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -589,7 +603,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -603,7 +617,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -638,7 +652,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(AsyncSinglePage[LAN], lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -651,7 +665,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(AsyncSinglePage[LAN], lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -664,7 +678,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(AsyncSinglePage[LAN], lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -690,8 +704,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -700,12 +715,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -714,12 +730,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -731,6 +748,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): @@ -738,6 +756,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_id` but received ''"): @@ -745,6 +764,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -755,7 +775,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -769,7 +789,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" lan = await response.parse() - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -783,7 +803,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_transit/sites/test_wans.py b/tests/api_resources/magic_transit/sites/test_wans.py index e7b7728e024..08eb99c288c 100644 --- a/tests/api_resources/magic_transit/sites/test_wans.py +++ b/tests/api_resources/magic_transit/sites/test_wans.py @@ -9,13 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_transit.sites import ( - WANGetResponse, - WANListResponse, - WANCreateResponse, - WANDeleteResponse, - WANUpdateResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.magic_transit.sites.wan import WAN +from cloudflare.types.magic_transit.sites.wan_create_response import WANCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,6 +25,8 @@ def test_method_create(self, client: Cloudflare) -> None: wan = client.magic_transit.sites.wans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert_matches_type(WANCreateResponse, wan, path=["response"]) @@ -38,16 +36,14 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: wan = client.magic_transit.sites.wans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - wan={ - "description": "string", - "physport": 1, - "priority": 0, - "static_addressing": { - "address": "192.0.2.0/24", - "gateway_address": "192.0.2.1", - "secondary_address": "192.0.2.0/24", - }, - "vlan_tag": 0, + physport=1, + vlan_tag=0, + name="string", + priority=0, + static_addressing={ + "address": "192.0.2.0/24", + "gateway_address": "192.0.2.1", + "secondary_address": "192.0.2.0/24", }, ) assert_matches_type(WANCreateResponse, wan, path=["response"]) @@ -58,6 +54,8 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_transit.sites.wans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert response.is_closed is True @@ -71,6 +69,8 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_transit.sites.wans.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -87,12 +87,16 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.magic_transit.sites.wans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + physport=1, + vlan_tag=0, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): client.magic_transit.sites.wans.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) @pytest.mark.skip() @@ -103,7 +107,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,19 +116,17 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - wan={ - "description": "string", - "physport": 1, - "priority": 0, - "static_addressing": { - "address": "192.0.2.0/24", - "gateway_address": "192.0.2.1", - "secondary_address": "192.0.2.0/24", - }, - "vlan_tag": 0, + name="string", + physport=1, + priority=0, + static_addressing={ + "address": "192.0.2.0/24", + "gateway_address": "192.0.2.1", + "secondary_address": "192.0.2.0/24", }, + vlan_tag=0, ) - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +140,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +154,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,7 +189,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(SyncSinglePage[WAN], wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -200,7 +202,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(SyncSinglePage[WAN], wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -213,7 +215,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(SyncSinglePage[WAN], wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -239,8 +241,9 @@ def test_method_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,12 +252,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -263,12 +267,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -280,6 +285,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): @@ -287,6 +293,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_id` but received ''"): @@ -294,6 +301,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -304,7 +312,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -318,7 +326,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" wan = response.parse() - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -332,7 +340,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -370,6 +378,8 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: wan = await async_client.magic_transit.sites.wans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert_matches_type(WANCreateResponse, wan, path=["response"]) @@ -379,16 +389,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare wan = await async_client.magic_transit.sites.wans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - wan={ - "description": "string", - "physport": 1, - "priority": 0, - "static_addressing": { - "address": "192.0.2.0/24", - "gateway_address": "192.0.2.1", - "secondary_address": "192.0.2.0/24", - }, - "vlan_tag": 0, + physport=1, + vlan_tag=0, + name="string", + priority=0, + static_addressing={ + "address": "192.0.2.0/24", + "gateway_address": "192.0.2.1", + "secondary_address": "192.0.2.0/24", }, ) assert_matches_type(WANCreateResponse, wan, path=["response"]) @@ -399,6 +407,8 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.wans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert response.is_closed is True @@ -412,6 +422,8 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.sites.wans.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -428,12 +440,16 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.sites.wans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + physport=1, + vlan_tag=0, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): await async_client.magic_transit.sites.wans.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) @pytest.mark.skip() @@ -444,7 +460,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -453,19 +469,17 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - wan={ - "description": "string", - "physport": 1, - "priority": 0, - "static_addressing": { - "address": "192.0.2.0/24", - "gateway_address": "192.0.2.1", - "secondary_address": "192.0.2.0/24", - }, - "vlan_tag": 0, + name="string", + physport=1, + priority=0, + static_addressing={ + "address": "192.0.2.0/24", + "gateway_address": "192.0.2.1", + "secondary_address": "192.0.2.0/24", }, + vlan_tag=0, ) - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -479,7 +493,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -493,7 +507,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -528,7 +542,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(AsyncSinglePage[WAN], wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -541,7 +555,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(AsyncSinglePage[WAN], wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -554,7 +568,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(AsyncSinglePage[WAN], wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -580,8 +594,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -590,12 +605,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -604,12 +620,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -621,6 +638,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): @@ -628,6 +646,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_id` but received ''"): @@ -635,6 +654,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -645,7 +665,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -659,7 +679,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" wan = await response.parse() - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -673,7 +693,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_transit/test_cf_interconnects.py b/tests/api_resources/magic_transit/test_cf_interconnects.py index 1c04dbbae9f..0bc70ae2298 100644 --- a/tests/api_resources/magic_transit/test_cf_interconnects.py +++ b/tests/api_resources/magic_transit/test_cf_interconnects.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_transit import ( - CfInterconnectGetResponse, - CfInterconnectListResponse, - CfInterconnectUpdateResponse, -) +from cloudflare.types.magic_transit.cf_interconnect_get_response import CfInterconnectGetResponse +from cloudflare.types.magic_transit.cf_interconnect_list_response import CfInterconnectListResponse +from cloudflare.types.magic_transit.cf_interconnect_update_response import CfInterconnectUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/magic_transit/test_gre_tunnels.py b/tests/api_resources/magic_transit/test_gre_tunnels.py index 31d91baf984..ceec2e94870 100644 --- a/tests/api_resources/magic_transit/test_gre_tunnels.py +++ b/tests/api_resources/magic_transit/test_gre_tunnels.py @@ -9,13 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_transit import ( - GRETunnelGetResponse, - GRETunnelListResponse, - GRETunnelCreateResponse, - GRETunnelDeleteResponse, - GRETunnelUpdateResponse, -) +from cloudflare.types.magic_transit.gre_tunnel_get_response import GRETunnelGetResponse +from cloudflare.types.magic_transit.gre_tunnel_list_response import GRETunnelListResponse +from cloudflare.types.magic_transit.gre_tunnel_create_response import GRETunnelCreateResponse +from cloudflare.types.magic_transit.gre_tunnel_delete_response import GRETunnelDeleteResponse +from cloudflare.types.magic_transit.gre_tunnel_update_response import GRETunnelUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -212,6 +210,7 @@ def test_method_delete(self, client: Cloudflare) -> None: gre_tunnel = client.magic_transit.gre_tunnels.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(GRETunnelDeleteResponse, gre_tunnel, path=["response"]) @@ -221,6 +220,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.magic_transit.gre_tunnels.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -234,6 +234,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.magic_transit.gre_tunnels.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -250,12 +251,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.magic_transit.gre_tunnels.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"): client.magic_transit.gre_tunnels.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -503,6 +506,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: gre_tunnel = await async_client.magic_transit.gre_tunnels.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(GRETunnelDeleteResponse, gre_tunnel, path=["response"]) @@ -512,6 +516,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.gre_tunnels.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -525,6 +530,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.gre_tunnels.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -541,12 +547,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.gre_tunnels.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"): await async_client.magic_transit.gre_tunnels.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/magic_transit/test_ipsec_tunnels.py b/tests/api_resources/magic_transit/test_ipsec_tunnels.py index 10fb20f2edc..c5b0736f9d9 100644 --- a/tests/api_resources/magic_transit/test_ipsec_tunnels.py +++ b/tests/api_resources/magic_transit/test_ipsec_tunnels.py @@ -9,14 +9,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_transit import ( - IPSECTunnelGetResponse, - IPSECTunnelListResponse, - IPSECTunnelCreateResponse, - IPSECTunnelDeleteResponse, - IPSECTunnelUpdateResponse, - IPSECTunnelPSKGenerateResponse, -) +from cloudflare.types.magic_transit.ipsec_tunnel_get_response import IPSECTunnelGetResponse +from cloudflare.types.magic_transit.ipsec_tunnel_list_response import IPSECTunnelListResponse +from cloudflare.types.magic_transit.ipsec_tunnel_create_response import IPSECTunnelCreateResponse +from cloudflare.types.magic_transit.ipsec_tunnel_delete_response import IPSECTunnelDeleteResponse +from cloudflare.types.magic_transit.ipsec_tunnel_update_response import IPSECTunnelUpdateResponse +from cloudflare.types.magic_transit.ipsec_tunnel_psk_generate_response import IPSECTunnelPSKGenerateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -238,6 +236,7 @@ def test_method_delete(self, client: Cloudflare) -> None: ipsec_tunnel = client.magic_transit.ipsec_tunnels.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(IPSECTunnelDeleteResponse, ipsec_tunnel, path=["response"]) @@ -247,6 +246,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.magic_transit.ipsec_tunnels.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -260,6 +260,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.magic_transit.ipsec_tunnels.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -276,12 +277,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.magic_transit.ipsec_tunnels.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"): client.magic_transit.ipsec_tunnels.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -342,6 +345,7 @@ def test_method_psk_generate(self, client: Cloudflare) -> None: ipsec_tunnel = client.magic_transit.ipsec_tunnels.psk_generate( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(IPSECTunnelPSKGenerateResponse, ipsec_tunnel, path=["response"]) @@ -351,6 +355,7 @@ def test_raw_response_psk_generate(self, client: Cloudflare) -> None: response = client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -364,6 +369,7 @@ def test_streaming_response_psk_generate(self, client: Cloudflare) -> None: with client.magic_transit.ipsec_tunnels.with_streaming_response.psk_generate( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -380,12 +386,14 @@ def test_path_params_psk_generate(self, client: Cloudflare) -> None: client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"): client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @@ -606,6 +614,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: ipsec_tunnel = await async_client.magic_transit.ipsec_tunnels.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(IPSECTunnelDeleteResponse, ipsec_tunnel, path=["response"]) @@ -615,6 +624,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.ipsec_tunnels.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -628,6 +638,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.ipsec_tunnels.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -644,12 +655,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.ipsec_tunnels.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"): await async_client.magic_transit.ipsec_tunnels.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -710,6 +723,7 @@ async def test_method_psk_generate(self, async_client: AsyncCloudflare) -> None: ipsec_tunnel = await async_client.magic_transit.ipsec_tunnels.psk_generate( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(IPSECTunnelPSKGenerateResponse, ipsec_tunnel, path=["response"]) @@ -719,6 +733,7 @@ async def test_raw_response_psk_generate(self, async_client: AsyncCloudflare) -> response = await async_client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -732,6 +747,7 @@ async def test_streaming_response_psk_generate(self, async_client: AsyncCloudfla async with async_client.magic_transit.ipsec_tunnels.with_streaming_response.psk_generate( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -748,10 +764,12 @@ async def test_path_params_psk_generate(self, async_client: AsyncCloudflare) -> await async_client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"): await async_client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) diff --git a/tests/api_resources/magic_transit/test_routes.py b/tests/api_resources/magic_transit/test_routes.py index aa6fb26e1f7..f6d14e34638 100644 --- a/tests/api_resources/magic_transit/test_routes.py +++ b/tests/api_resources/magic_transit/test_routes.py @@ -9,14 +9,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_transit import ( - RouteGetResponse, - RouteListResponse, - RouteEmptyResponse, - RouteCreateResponse, - RouteDeleteResponse, - RouteUpdateResponse, -) +from cloudflare.types.magic_transit.route_get_response import RouteGetResponse +from cloudflare.types.magic_transit.route_list_response import RouteListResponse +from cloudflare.types.magic_transit.route_empty_response import RouteEmptyResponse +from cloudflare.types.magic_transit.route_create_response import RouteCreateResponse +from cloudflare.types.magic_transit.route_delete_response import RouteDeleteResponse +from cloudflare.types.magic_transit.route_update_response import RouteUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -203,6 +201,7 @@ def test_method_delete(self, client: Cloudflare) -> None: route = client.magic_transit.routes.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(RouteDeleteResponse, route, path=["response"]) @@ -212,6 +211,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.magic_transit.routes.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -225,6 +225,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.magic_transit.routes.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -241,12 +242,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.magic_transit.routes.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_identifier` but received ''"): client.magic_transit.routes.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -530,6 +533,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: route = await async_client.magic_transit.routes.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(RouteDeleteResponse, route, path=["response"]) @@ -539,6 +543,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.routes.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -552,6 +557,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.routes.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -568,12 +574,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.routes.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_identifier` but received ''"): await async_client.magic_transit.routes.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/magic_transit/test_sites.py b/tests/api_resources/magic_transit/test_sites.py index 28df8c5d1a7..95204348147 100644 --- a/tests/api_resources/magic_transit/test_sites.py +++ b/tests/api_resources/magic_transit/test_sites.py @@ -9,13 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_transit import ( - SiteGetResponse, - SiteListResponse, - SiteCreateResponse, - SiteDeleteResponse, - SiteUpdateResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.magic_transit.site import Site base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,51 +23,52 @@ class TestSites: def test_method_create(self, client: Cloudflare) -> None: site = client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: site = client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - site={ - "connector_id": "ac60d3d0435248289d446cedd870bcf4", - "description": "string", - "ha_mode": True, - "location": { - "lat": "string", - "lon": "string", - }, - "name": "site_1", - "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482", + name="site_1", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + ha_mode=True, + location={ + "lat": "string", + "lon": "string", }, + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", ) - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_transit.sites.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_transit.sites.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,6 +78,7 @@ 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.magic_transit.sites.with_raw_response.create( account_id="", + name="site_1", ) @pytest.mark.skip() @@ -91,7 +88,7 @@ def test_method_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,18 +96,16 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: site = client.magic_transit.sites.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - site={ - "connector_id": "ac60d3d0435248289d446cedd870bcf4", - "description": "string", - "location": { - "lat": "string", - "lon": "string", - }, - "name": "site_1", - "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + location={ + "lat": "string", + "lon": "string", }, + name="site_1", + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", ) - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +118,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -136,7 +131,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +156,16 @@ def test_method_list(self, client: Cloudflare) -> None: site = client.magic_transit.sites.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(SyncSinglePage[Site], site, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + site = client.magic_transit.sites.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + connector_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +177,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(SyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +189,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(SyncSinglePage[Site], site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -203,8 +207,9 @@ def test_method_delete(self, client: Cloudflare) -> None: site = client.magic_transit.sites.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -212,12 +217,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.magic_transit.sites.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,12 +231,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.magic_transit.sites.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -241,12 +248,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.magic_transit.sites.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): client.magic_transit.sites.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -256,7 +265,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -269,7 +278,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" site = response.parse() - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -282,7 +291,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -310,51 +319,52 @@ class TestAsyncSites: async def test_method_create(self, async_client: AsyncCloudflare) -> None: site = await async_client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: site = await async_client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - site={ - "connector_id": "ac60d3d0435248289d446cedd870bcf4", - "description": "string", - "ha_mode": True, - "location": { - "lat": "string", - "lon": "string", - }, - "name": "site_1", - "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482", + name="site_1", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + ha_mode=True, + location={ + "lat": "string", + "lon": "string", }, + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", ) - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.magic_transit.sites.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -364,6 +374,7 @@ 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.magic_transit.sites.with_raw_response.create( account_id="", + name="site_1", ) @pytest.mark.skip() @@ -373,7 +384,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -381,18 +392,16 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare site = await async_client.magic_transit.sites.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - site={ - "connector_id": "ac60d3d0435248289d446cedd870bcf4", - "description": "string", - "location": { - "lat": "string", - "lon": "string", - }, - "name": "site_1", - "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + location={ + "lat": "string", + "lon": "string", }, + name="site_1", + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", ) - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -405,7 +414,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -418,7 +427,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -443,7 +452,16 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: site = await async_client.magic_transit.sites.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(AsyncSinglePage[Site], site, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + site = await async_client.magic_transit.sites.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + connector_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -455,7 +473,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(AsyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -467,7 +485,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(AsyncSinglePage[Site], site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -485,8 +503,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: site = await async_client.magic_transit.sites.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -494,12 +513,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -507,12 +527,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.sites.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -523,12 +544,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.sites.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): await async_client.magic_transit.sites.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -538,7 +561,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -551,7 +574,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" site = await response.parse() - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -564,7 +587,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/mtls_certificates/test_associations.py b/tests/api_resources/mtls_certificates/test_associations.py index a253daa651a..68a4e567393 100644 --- a/tests/api_resources/mtls_certificates/test_associations.py +++ b/tests/api_resources/mtls_certificates/test_associations.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.mtls_certificates import AssociationGetResponse +from cloudflare.types.mtls_certificates.association_get_response import AssociationGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/origin_tls_client_auth/hostnames/test_certificates.py b/tests/api_resources/origin_tls_client_auth/hostnames/test_certificates.py index dbbd7ee9e78..70cc49a745d 100644 --- a/tests/api_resources/origin_tls_client_auth/hostnames/test_certificates.py +++ b/tests/api_resources/origin_tls_client_auth/hostnames/test_certificates.py @@ -10,8 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.origin_tls_client_auth import OriginTLSClientCertificateID -from cloudflare.types.origin_tls_client_auth.hostnames import OriginTLSClientCertificate +from cloudflare.types.origin_tls_client_auth.authenticated_origin_pull import AuthenticatedOriginPull +from cloudflare.types.origin_tls_client_auth.hostnames.certificate_get_response import CertificateGetResponse +from cloudflare.types.origin_tls_client_auth.hostnames.certificate_create_response import CertificateCreateResponse +from cloudflare.types.origin_tls_client_auth.hostnames.certificate_delete_response import CertificateDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: certificate="-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n", private_key="-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n", ) - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateCreateResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +43,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" certificate = response.parse() - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateCreateResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +57,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateCreateResponse, certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +77,7 @@ def test_method_list(self, client: Cloudflare) -> None: certificate = client.origin_tls_client_auth.hostnames.certificates.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[AuthenticatedOriginPull], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +89,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(SyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[AuthenticatedOriginPull], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +101,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(SyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[AuthenticatedOriginPull], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -117,8 +119,9 @@ def test_method_delete(self, client: Cloudflare) -> None: certificate = client.origin_tls_client_auth.hostnames.certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,12 +129,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.origin_tls_client_auth.hostnames.certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,12 +143,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.origin_tls_client_auth.hostnames.certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -155,12 +160,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.origin_tls_client_auth.hostnames.certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): client.origin_tls_client_auth.hostnames.certificates.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -170,7 +177,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateGetResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -183,7 +190,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(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateGetResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,7 +203,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(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateGetResponse, certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -227,7 +234,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: certificate="-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n", private_key="-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n", ) - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateCreateResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -241,7 +248,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" certificate = await response.parse() - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateCreateResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +262,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateCreateResponse, certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -275,7 +282,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: certificate = await async_client.origin_tls_client_auth.hostnames.certificates.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[AuthenticatedOriginPull], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -287,7 +294,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(AsyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[AuthenticatedOriginPull], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -299,7 +306,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(AsyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[AuthenticatedOriginPull], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -317,8 +324,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: certificate = await async_client.origin_tls_client_auth.hostnames.certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,12 +334,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.origin_tls_client_auth.hostnames.certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -339,12 +348,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.origin_tls_client_auth.hostnames.certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -355,12 +365,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.origin_tls_client_auth.hostnames.certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): await async_client.origin_tls_client_auth.hostnames.certificates.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -370,7 +382,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateGetResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -383,7 +395,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(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateGetResponse, certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -396,7 +408,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(OriginTLSClientCertificate, certificate, path=["response"]) + assert_matches_type(CertificateGetResponse, certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/origin_tls_client_auth/test_hostnames.py b/tests/api_resources/origin_tls_client_auth/test_hostnames.py index 1cbcd2e6440..6576aedf513 100644 --- a/tests/api_resources/origin_tls_client_auth/test_hostnames.py +++ b/tests/api_resources/origin_tls_client_auth/test_hostnames.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.origin_tls_client_auth import ( - HostnameUpdateResponse, - OriginTLSClientCertificateID, -) +from cloudflare.types.origin_tls_client_auth.hostname_update_response import HostnameUpdateResponse +from cloudflare.types.origin_tls_client_auth.authenticated_origin_pull import AuthenticatedOriginPull base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -73,7 +71,7 @@ def test_method_get(self, client: Cloudflare) -> None: "app.example.com", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OriginTLSClientCertificateID, hostname, path=["response"]) + assert_matches_type(AuthenticatedOriginPull, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +84,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" hostname = response.parse() - assert_matches_type(OriginTLSClientCertificateID, hostname, path=["response"]) + assert_matches_type(AuthenticatedOriginPull, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +97,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = response.parse() - assert_matches_type(OriginTLSClientCertificateID, hostname, path=["response"]) + assert_matches_type(AuthenticatedOriginPull, hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -175,7 +173,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "app.example.com", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OriginTLSClientCertificateID, hostname, path=["response"]) + assert_matches_type(AuthenticatedOriginPull, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +186,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" hostname = await response.parse() - assert_matches_type(OriginTLSClientCertificateID, hostname, path=["response"]) + assert_matches_type(AuthenticatedOriginPull, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +199,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = await response.parse() - assert_matches_type(OriginTLSClientCertificateID, hostname, path=["response"]) + assert_matches_type(AuthenticatedOriginPull, hostname, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/origin_tls_client_auth/test_settings.py b/tests/api_resources/origin_tls_client_auth/test_settings.py index 009e48b2779..4c35bbd0427 100644 --- a/tests/api_resources/origin_tls_client_auth/test_settings.py +++ b/tests/api_resources/origin_tls_client_auth/test_settings.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.origin_tls_client_auth import SettingGetResponse, SettingUpdateResponse +from cloudflare.types.origin_tls_client_auth.setting_get_response import SettingGetResponse +from cloudflare.types.origin_tls_client_auth.setting_update_response import SettingUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/page_shield/test_connections.py b/tests/api_resources/page_shield/test_connections.py index bf65f2d82ac..7af1088e528 100644 --- a/tests/api_resources/page_shield/test_connections.py +++ b/tests/api_resources/page_shield/test_connections.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.page_shield import PageShieldConnection +from cloudflare.types.page_shield.connection import Connection base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: connection = client.page_shield.connections.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[PageShieldConnection], connection, path=["response"]) + assert_matches_type(SyncSinglePage[Connection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: status="active,inactive", urls="blog.cloudflare.com,www.example", ) - assert_matches_type(SyncSinglePage[PageShieldConnection], connection, path=["response"]) + assert_matches_type(SyncSinglePage[Connection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(SyncSinglePage[PageShieldConnection], connection, path=["response"]) + assert_matches_type(SyncSinglePage[Connection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +68,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(SyncSinglePage[PageShieldConnection], connection, path=["response"]) + assert_matches_type(SyncSinglePage[Connection], connection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -87,7 +87,7 @@ def test_method_get(self, client: Cloudflare) -> None: "c9ef84a6bf5e47138c75d95e2f933e8f", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldConnection, connection, path=["response"]) + assert_matches_type(Connection, connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,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" connection = response.parse() - assert_matches_type(PageShieldConnection, connection, path=["response"]) + assert_matches_type(Connection, connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +113,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(PageShieldConnection, connection, path=["response"]) + assert_matches_type(Connection, connection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -142,7 +142,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: connection = await async_client.page_shield.connections.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[PageShieldConnection], connection, path=["response"]) + assert_matches_type(AsyncSinglePage[Connection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -162,7 +162,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) status="active,inactive", urls="blog.cloudflare.com,www.example", ) - assert_matches_type(AsyncSinglePage[PageShieldConnection], connection, path=["response"]) + assert_matches_type(AsyncSinglePage[Connection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +174,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(AsyncSinglePage[PageShieldConnection], connection, path=["response"]) + assert_matches_type(AsyncSinglePage[Connection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,7 +186,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(AsyncSinglePage[PageShieldConnection], connection, path=["response"]) + assert_matches_type(AsyncSinglePage[Connection], connection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -205,7 +205,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "c9ef84a6bf5e47138c75d95e2f933e8f", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldConnection, connection, path=["response"]) + assert_matches_type(Connection, connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -218,7 +218,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" connection = await response.parse() - assert_matches_type(PageShieldConnection, connection, path=["response"]) + assert_matches_type(Connection, connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -231,7 +231,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(PageShieldConnection, connection, path=["response"]) + assert_matches_type(Connection, connection, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/page_shield/test_policies.py b/tests/api_resources/page_shield/test_policies.py index 6a3a5dc7153..c81f6dda008 100644 --- a/tests/api_resources/page_shield/test_policies.py +++ b/tests/api_resources/page_shield/test_policies.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.page_shield import PageShieldPolicy +from cloudflare.types.page_shield.policy import Policy base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: policy = client.page_shield.policies.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: expression='ends_with(http.request.uri.path, "/checkout")', value="script-src 'none';", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,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" policy = response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -80,7 +80,7 @@ def test_method_update(self, client: Cloudflare) -> None: "c9ef84a6bf5e47138c75d95e2f933e8f", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: expression='ends_with(http.request.uri.path, "/checkout")', value="script-src 'none';", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -120,7 +120,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -145,7 +145,7 @@ def test_method_list(self, client: Cloudflare) -> None: policy = client.page_shield.policies.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[PageShieldPolicy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -157,7 +157,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[PageShieldPolicy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -169,7 +169,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[PageShieldPolicy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -240,7 +240,7 @@ def test_method_get(self, client: Cloudflare) -> None: "c9ef84a6bf5e47138c75d95e2f933e8f", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -253,7 +253,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -266,7 +266,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -295,7 +295,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: policy = await async_client.page_shield.policies.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -308,7 +308,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare expression='ends_with(http.request.uri.path, "/checkout")', value="script-src 'none';", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -320,7 +320,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" policy = await response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -332,7 +332,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -351,7 +351,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "c9ef84a6bf5e47138c75d95e2f933e8f", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -365,7 +365,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare expression='ends_with(http.request.uri.path, "/checkout")', value="script-src 'none';", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -378,7 +378,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,7 +391,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -416,7 +416,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: policy = await async_client.page_shield.policies.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[PageShieldPolicy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -428,7 +428,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[PageShieldPolicy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -440,7 +440,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[PageShieldPolicy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -511,7 +511,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "c9ef84a6bf5e47138c75d95e2f933e8f", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -524,7 +524,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -537,7 +537,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(PageShieldPolicy, policy, path=["response"]) + assert_matches_type(Policy, policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/page_shield/test_scripts.py b/tests/api_resources/page_shield/test_scripts.py index 832d6445cf0..04693a1aa4c 100644 --- a/tests/api_resources/page_shield/test_scripts.py +++ b/tests/api_resources/page_shield/test_scripts.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.page_shield import PageShieldScript, ScriptGetResponse +from cloudflare.types.page_shield.script import Script +from cloudflare.types.page_shield.script_get_response import ScriptGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: script = client.page_shield.scripts.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[PageShieldScript], script, path=["response"]) + assert_matches_type(SyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +46,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: status="active,inactive", urls="blog.cloudflare.com,www.example", ) - assert_matches_type(SyncSinglePage[PageShieldScript], script, path=["response"]) + assert_matches_type(SyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +58,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(SyncSinglePage[PageShieldScript], script, path=["response"]) + assert_matches_type(SyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +70,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(SyncSinglePage[PageShieldScript], script, path=["response"]) + assert_matches_type(SyncSinglePage[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +144,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: script = await async_client.page_shield.scripts.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[PageShieldScript], script, path=["response"]) + assert_matches_type(AsyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +165,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) status="active,inactive", urls="blog.cloudflare.com,www.example", ) - assert_matches_type(AsyncSinglePage[PageShieldScript], script, path=["response"]) + assert_matches_type(AsyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +177,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(AsyncSinglePage[PageShieldScript], script, path=["response"]) + assert_matches_type(AsyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +189,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(AsyncSinglePage[PageShieldScript], script, path=["response"]) + assert_matches_type(AsyncSinglePage[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/pagerules/test_settings.py b/tests/api_resources/pagerules/test_settings.py index 47bfe3f3456..6e5c917c33a 100644 --- a/tests/api_resources/pagerules/test_settings.py +++ b/tests/api_resources/pagerules/test_settings.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.pagerules import ZonePageruleSettings +from cloudflare.types.pagerules.setting_list_response import SettingListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Cloudflare) -> None: setting = client.pagerules.settings.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZonePageruleSettings, setting, path=["response"]) + assert_matches_type(SettingListResponse, setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(ZonePageruleSettings, setting, path=["response"]) + assert_matches_type(SettingListResponse, setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(ZonePageruleSettings, setting, path=["response"]) + assert_matches_type(SettingListResponse, setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: setting = await async_client.pagerules.settings.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZonePageruleSettings, setting, path=["response"]) + assert_matches_type(SettingListResponse, setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(ZonePageruleSettings, setting, path=["response"]) + assert_matches_type(SettingListResponse, setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(ZonePageruleSettings, setting, path=["response"]) + assert_matches_type(SettingListResponse, setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/pages/projects/deployments/history/test_logs.py b/tests/api_resources/pages/projects/deployments/history/test_logs.py index 7e59a77f9b2..229d9086dc6 100644 --- a/tests/api_resources/pages/projects/deployments/history/test_logs.py +++ b/tests/api_resources/pages/projects/deployments/history/test_logs.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.pages.projects.deployments.history import LogGetResponse +from cloudflare.types.pages.projects.deployments.history.log_get_response import LogGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/pages/projects/test_deployments.py b/tests/api_resources/pages/projects/test_deployments.py index 8cfb0f16fbe..028df3f39b9 100644 --- a/tests/api_resources/pages/projects/test_deployments.py +++ b/tests/api_resources/pages/projects/test_deployments.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.pages import PagesDeployments +from cloudflare.types.pages.deployment import Deployment base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", branch="staging", ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,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" deployment = response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -87,7 +87,7 @@ def test_method_list(self, client: Cloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[PagesDeployments], deployment, path=["response"]) + assert_matches_type(SyncSinglePage[Deployment], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +97,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", env="preview", ) - assert_matches_type(SyncSinglePage[PagesDeployments], deployment, path=["response"]) + assert_matches_type(SyncSinglePage[Deployment], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +110,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(SyncSinglePage[PagesDeployments], deployment, path=["response"]) + assert_matches_type(SyncSinglePage[Deployment], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +123,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(SyncSinglePage[PagesDeployments], deployment, path=["response"]) + assert_matches_type(SyncSinglePage[Deployment], deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,6 +149,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert_matches_type(object, deployment, path=["response"]) @@ -159,6 +160,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True @@ -173,6 +175,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -190,6 +193,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): @@ -197,6 +201,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): @@ -204,6 +209,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @pytest.mark.skip() @@ -214,7 +220,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -228,7 +234,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" deployment = response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +248,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -277,8 +283,9 @@ def test_method_retry(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -287,12 +294,13 @@ def test_raw_response_retry(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -301,12 +309,13 @@ def test_streaming_response_retry(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -318,6 +327,7 @@ def test_path_params_retry(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): @@ -325,6 +335,7 @@ def test_path_params_retry(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): @@ -332,6 +343,7 @@ def test_path_params_retry(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @pytest.mark.skip() @@ -341,8 +353,9 @@ def test_method_rollback(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -351,12 +364,13 @@ def test_raw_response_rollback(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -365,12 +379,13 @@ def test_streaming_response_rollback(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -382,6 +397,7 @@ def test_path_params_rollback(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): @@ -389,6 +405,7 @@ def test_path_params_rollback(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): @@ -396,6 +413,7 @@ def test_path_params_rollback(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @@ -409,7 +427,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -419,7 +437,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", branch="staging", ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -432,7 +450,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" deployment = await response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -445,7 +463,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -471,7 +489,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[PagesDeployments], deployment, path=["response"]) + assert_matches_type(AsyncSinglePage[Deployment], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -481,7 +499,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="023e105f4ecef8ad9ca31a8372d0c353", env="preview", ) - assert_matches_type(AsyncSinglePage[PagesDeployments], deployment, path=["response"]) + assert_matches_type(AsyncSinglePage[Deployment], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -494,7 +512,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(AsyncSinglePage[PagesDeployments], deployment, path=["response"]) + assert_matches_type(AsyncSinglePage[Deployment], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -507,7 +525,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(AsyncSinglePage[PagesDeployments], deployment, path=["response"]) + assert_matches_type(AsyncSinglePage[Deployment], deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -533,6 +551,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert_matches_type(object, deployment, path=["response"]) @@ -543,6 +562,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True @@ -557,6 +577,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -574,6 +595,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): @@ -581,6 +603,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): @@ -588,6 +611,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @pytest.mark.skip() @@ -598,7 +622,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -612,7 +636,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" deployment = await response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -626,7 +650,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -661,8 +685,9 @@ async def test_method_retry(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -671,12 +696,13 @@ async def test_raw_response_retry(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -685,12 +711,13 @@ async def test_streaming_response_retry(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -702,6 +729,7 @@ async def test_path_params_retry(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): @@ -709,6 +737,7 @@ async def test_path_params_retry(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): @@ -716,6 +745,7 @@ async def test_path_params_retry(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @pytest.mark.skip() @@ -725,8 +755,9 @@ async def test_method_rollback(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -735,12 +766,13 @@ async def test_raw_response_rollback(self, async_client: AsyncCloudflare) -> Non "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -749,12 +781,13 @@ async def test_streaming_response_rollback(self, async_client: AsyncCloudflare) "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(PagesDeployments, deployment, path=["response"]) + assert_matches_type(Deployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -766,6 +799,7 @@ async def test_path_params_rollback(self, async_client: AsyncCloudflare) -> None "023e105f4ecef8ad9ca31a8372d0c353", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): @@ -773,6 +807,7 @@ async def test_path_params_rollback(self, async_client: AsyncCloudflare) -> None "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): @@ -780,4 +815,5 @@ async def test_path_params_rollback(self, async_client: AsyncCloudflare) -> None "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) diff --git a/tests/api_resources/pages/projects/test_domains.py b/tests/api_resources/pages/projects/test_domains.py index 2bd272a95f0..2d52464334a 100644 --- a/tests/api_resources/pages/projects/test_domains.py +++ b/tests/api_resources/pages/projects/test_domains.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.pages.projects import ( - DomainGetResponse, - DomainEditResponse, - DomainCreateResponse, -) +from cloudflare.types.pages.projects.domain_get_response import DomainGetResponse +from cloudflare.types.pages.projects.domain_edit_response import DomainEditResponse +from cloudflare.types.pages.projects.domain_create_response import DomainCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -135,9 +133,10 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_delete(self, client: Cloudflare) -> None: domain = client.pages.projects.domains.delete( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert_matches_type(object, domain, path=["response"]) @@ -145,9 +144,10 @@ def test_method_delete(self, client: Cloudflare) -> None: @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.pages.projects.domains.with_raw_response.delete( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True @@ -159,9 +159,10 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.pages.projects.domains.with_streaming_response.delete( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -176,16 +177,18 @@ 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.pages.projects.domains.with_raw_response.delete( - "string", + "this-is-my-domain-01.com", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): client.pages.projects.domains.with_raw_response.delete( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `domain_name` but received ''"): @@ -193,15 +196,17 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @pytest.mark.skip() @parametrize def test_method_edit(self, client: Cloudflare) -> None: domain = client.pages.projects.domains.edit( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert_matches_type(Optional[DomainEditResponse], domain, path=["response"]) @@ -209,9 +214,10 @@ def test_method_edit(self, client: Cloudflare) -> None: @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.pages.projects.domains.with_raw_response.edit( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True @@ -223,9 +229,10 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.pages.projects.domains.with_streaming_response.edit( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -240,16 +247,18 @@ 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.pages.projects.domains.with_raw_response.edit( - "string", + "this-is-my-domain-01.com", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): client.pages.projects.domains.with_raw_response.edit( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `domain_name` but received ''"): @@ -257,13 +266,14 @@ def test_path_params_edit(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: domain = client.pages.projects.domains.get( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", ) @@ -273,7 +283,7 @@ def test_method_get(self, client: Cloudflare) -> None: @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.pages.projects.domains.with_raw_response.get( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", ) @@ -287,7 +297,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.pages.projects.domains.with_streaming_response.get( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", ) as response: @@ -304,14 +314,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.pages.projects.domains.with_raw_response.get( - "string", + "this-is-my-domain-01.com", account_id="", project_name="this-is-my-project-01", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): client.pages.projects.domains.with_raw_response.get( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", ) @@ -440,9 +450,10 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: domain = await async_client.pages.projects.domains.delete( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert_matches_type(object, domain, path=["response"]) @@ -450,9 +461,10 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.pages.projects.domains.with_raw_response.delete( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True @@ -464,9 +476,10 @@ 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.pages.projects.domains.with_streaming_response.delete( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -481,16 +494,18 @@ 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.pages.projects.domains.with_raw_response.delete( - "string", + "this-is-my-domain-01.com", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): await async_client.pages.projects.domains.with_raw_response.delete( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `domain_name` but received ''"): @@ -498,15 +513,17 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @pytest.mark.skip() @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: domain = await async_client.pages.projects.domains.edit( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert_matches_type(Optional[DomainEditResponse], domain, path=["response"]) @@ -514,9 +531,10 @@ 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.pages.projects.domains.with_raw_response.edit( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) assert response.is_closed is True @@ -528,9 +546,10 @@ 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.pages.projects.domains.with_streaming_response.edit( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -545,16 +564,18 @@ 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.pages.projects.domains.with_raw_response.edit( - "string", + "this-is-my-domain-01.com", account_id="", project_name="this-is-my-project-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): await async_client.pages.projects.domains.with_raw_response.edit( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `domain_name` but received ''"): @@ -562,13 +583,14 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", + body={}, ) @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: domain = await async_client.pages.projects.domains.get( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", ) @@ -578,7 +600,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.pages.projects.domains.with_raw_response.get( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", ) @@ -592,7 +614,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.pages.projects.domains.with_streaming_response.get( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="this-is-my-project-01", ) as response: @@ -609,14 +631,14 @@ 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.pages.projects.domains.with_raw_response.get( - "string", + "this-is-my-domain-01.com", account_id="", project_name="this-is-my-project-01", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): await async_client.pages.projects.domains.with_raw_response.get( - "string", + "this-is-my-domain-01.com", account_id="023e105f4ecef8ad9ca31a8372d0c353", project_name="", ) diff --git a/tests/api_resources/pages/test_projects.py b/tests/api_resources/pages/test_projects.py index cb7cb108582..b21809e1159 100644 --- a/tests/api_resources/pages/test_projects.py +++ b/tests/api_resources/pages/test_projects.py @@ -10,12 +10,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.pages import ( - PagesProjects, - PagesDeployments, - ProjectEditResponse, - ProjectCreateResponse, -) +from cloudflare.types.pages import Deployment +from cloudflare.types.pages.project import Project +from cloudflare.types.pages.deployment import Deployment +from cloudflare.types.pages.project_edit_response import ProjectEditResponse +from cloudflare.types.pages.project_create_response import ProjectCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -151,7 +150,7 @@ def test_method_list(self, client: Cloudflare) -> None: project = client.pages.projects.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[PagesDeployments], project, path=["response"]) + assert_matches_type(SyncSinglePage[Deployment], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -163,7 +162,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(SyncSinglePage[PagesDeployments], project, path=["response"]) + assert_matches_type(SyncSinglePage[Deployment], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -175,7 +174,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(SyncSinglePage[PagesDeployments], project, path=["response"]) + assert_matches_type(SyncSinglePage[Deployment], project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -193,6 +192,7 @@ def test_method_delete(self, client: Cloudflare) -> None: project = client.pages.projects.delete( "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(object, project, path=["response"]) @@ -202,6 +202,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.pages.projects.with_raw_response.delete( "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -215,6 +216,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.pages.projects.with_streaming_response.delete( "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -231,12 +233,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.pages.projects.with_raw_response.delete( "this-is-my-project-01", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): client.pages.projects.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -378,7 +382,7 @@ def test_method_get(self, client: Cloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PagesProjects, project, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,7 +395,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" project = response.parse() - assert_matches_type(PagesProjects, project, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @pytest.mark.skip() @parametrize @@ -404,7 +408,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(PagesProjects, project, path=["response"]) + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -607,7 +611,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: project = await async_client.pages.projects.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[PagesDeployments], project, path=["response"]) + assert_matches_type(AsyncSinglePage[Deployment], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -619,7 +623,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(AsyncSinglePage[PagesDeployments], project, path=["response"]) + assert_matches_type(AsyncSinglePage[Deployment], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -631,7 +635,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(AsyncSinglePage[PagesDeployments], project, path=["response"]) + assert_matches_type(AsyncSinglePage[Deployment], project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -649,6 +653,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: project = await async_client.pages.projects.delete( "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(object, project, path=["response"]) @@ -658,6 +663,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.pages.projects.with_raw_response.delete( "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -671,6 +677,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.pages.projects.with_streaming_response.delete( "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -687,12 +694,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.pages.projects.with_raw_response.delete( "this-is-my-project-01", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_name` but received ''"): await async_client.pages.projects.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -834,7 +843,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PagesProjects, project, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @pytest.mark.skip() @parametrize @@ -847,7 +856,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" project = await response.parse() - assert_matches_type(PagesProjects, project, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @pytest.mark.skip() @parametrize @@ -860,7 +869,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(PagesProjects, project, path=["response"]) + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/pcaps/test_ownership.py b/tests/api_resources/pcaps/test_ownership.py index 47fd90cc6bf..ea09f6d7e9b 100644 --- a/tests/api_resources/pcaps/test_ownership.py +++ b/tests/api_resources/pcaps/test_ownership.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.pcaps import ( - OwnershipGetResponse, - MagicVisibilityPCAPsOwnership, -) +from cloudflare.types.pcaps.ownership import Ownership +from cloudflare.types.pcaps.ownership_get_response import OwnershipGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", destination_conf="s3://pcaps-bucket?region=us-east-1", ) - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +38,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" ownership = response.parse() - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +51,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -168,7 +166,7 @@ def test_method_validate(self, client: Cloudflare) -> None: destination_conf="s3://pcaps-bucket?region=us-east-1", ownership_challenge="ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", ) - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +180,7 @@ def test_raw_response_validate(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,7 +194,7 @@ def test_streaming_response_validate(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -221,7 +219,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", destination_conf="s3://pcaps-bucket?region=us-east-1", ) - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -234,7 +232,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" ownership = await response.parse() - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -247,7 +245,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -362,7 +360,7 @@ async def test_method_validate(self, async_client: AsyncCloudflare) -> None: destination_conf="s3://pcaps-bucket?region=us-east-1", ownership_challenge="ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", ) - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -376,7 +374,7 @@ async def test_raw_response_validate(self, async_client: AsyncCloudflare) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @pytest.mark.skip() @parametrize @@ -390,7 +388,7 @@ async def test_streaming_response_validate(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(MagicVisibilityPCAPsOwnership, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/queues/test_consumers.py b/tests/api_resources/queues/test_consumers.py index 7c1c4a3c952..34cfa593ec9 100644 --- a/tests/api_resources/queues/test_consumers.py +++ b/tests/api_resources/queues/test_consumers.py @@ -9,12 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.queues import ( - ConsumerGetResponse, - ConsumerCreateResponse, - ConsumerDeleteResponse, - ConsumerUpdateResponse, -) +from cloudflare.types.queues.consumer_get_response import ConsumerGetResponse +from cloudflare.types.queues.consumer_create_response import ConsumerCreateResponse +from cloudflare.types.queues.consumer_delete_response import ConsumerDeleteResponse +from cloudflare.types.queues.consumer_update_response import ConsumerUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -37,6 +35,7 @@ def test_method_create(self, client: Cloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) assert_matches_type(Optional[ConsumerCreateResponse], consumer, path=["response"]) @@ -56,6 +55,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) @@ -79,6 +79,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) as response: assert not response.is_closed @@ -105,6 +106,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) @@ -121,6 +123,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) @@ -231,6 +234,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[ConsumerDeleteResponse], consumer, path=["response"]) @@ -241,6 +245,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -255,6 +260,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -272,6 +278,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `queue_id` but received ''"): @@ -279,6 +286,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `consumer_id` but received ''"): @@ -286,6 +294,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -359,6 +368,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) assert_matches_type(Optional[ConsumerCreateResponse], consumer, path=["response"]) @@ -378,6 +388,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) @@ -401,6 +412,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) as response: assert not response.is_closed @@ -427,6 +439,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) @@ -443,6 +456,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: "max_retries": 3, "max_wait_time_ms": 5000, }, + "type": "worker", }, ) @@ -553,6 +567,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[ConsumerDeleteResponse], consumer, path=["response"]) @@ -563,6 +578,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -577,6 +593,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -594,6 +611,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `queue_id` but received ''"): @@ -601,6 +619,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `consumer_id` but received ''"): @@ -608,6 +627,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/queues/test_messages.py b/tests/api_resources/queues/test_messages.py index 1e24941e1b8..e9d079c14c6 100644 --- a/tests/api_resources/queues/test_messages.py +++ b/tests/api_resources/queues/test_messages.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.queues import MessageAckResponse, MessagePullResponse +from cloudflare.types.queues.message_ack_response import MessageAckResponse +from cloudflare.types.queues.message_pull_response import MessagePullResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/r2/test_buckets.py b/tests/api_resources/r2/test_buckets.py index 572433a0ffd..86527042892 100644 --- a/tests/api_resources/r2/test_buckets.py +++ b/tests/api_resources/r2/test_buckets.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.r2 import R2Bucket from cloudflare.pagination import SyncCursorPagination, AsyncCursorPagination +from cloudflare.types.r2.bucket import Bucket base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="example-bucket", ) - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="example-bucket", location_hint="apac", ) - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,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" bucket = response.parse() - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = response.parse() - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -80,7 +80,7 @@ def test_method_list(self, client: Cloudflare) -> None: bucket = client.r2.buckets.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncCursorPagination[R2Bucket], bucket, path=["response"]) + assert_matches_type(SyncCursorPagination[Bucket], bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: per_page=1, start_after="my-bucket", ) - assert_matches_type(SyncCursorPagination[R2Bucket], bucket, path=["response"]) + assert_matches_type(SyncCursorPagination[Bucket], bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = response.parse() - assert_matches_type(SyncCursorPagination[R2Bucket], bucket, path=["response"]) + assert_matches_type(SyncCursorPagination[Bucket], bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +118,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = response.parse() - assert_matches_type(SyncCursorPagination[R2Bucket], bucket, path=["response"]) + assert_matches_type(SyncCursorPagination[Bucket], bucket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -189,7 +189,7 @@ def test_method_get(self, client: Cloudflare) -> None: "example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -202,7 +202,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" bucket = response.parse() - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +215,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = response.parse() - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -245,7 +245,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="example-bucket", ) - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +255,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="example-bucket", location_hint="apac", ) - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +268,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" bucket = await response.parse() - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -281,7 +281,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = await response.parse() - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -300,7 +300,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: bucket = await async_client.r2.buckets.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncCursorPagination[R2Bucket], bucket, path=["response"]) + assert_matches_type(AsyncCursorPagination[Bucket], bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -314,7 +314,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) per_page=1, start_after="my-bucket", ) - assert_matches_type(AsyncCursorPagination[R2Bucket], bucket, path=["response"]) + assert_matches_type(AsyncCursorPagination[Bucket], bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +326,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = await response.parse() - assert_matches_type(AsyncCursorPagination[R2Bucket], bucket, path=["response"]) + assert_matches_type(AsyncCursorPagination[Bucket], bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -338,7 +338,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = await response.parse() - assert_matches_type(AsyncCursorPagination[R2Bucket], bucket, path=["response"]) + assert_matches_type(AsyncCursorPagination[Bucket], bucket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -409,7 +409,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -422,7 +422,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" bucket = await response.parse() - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) @pytest.mark.skip() @parametrize @@ -435,7 +435,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = await response.parse() - assert_matches_type(R2Bucket, bucket, path=["response"]) + assert_matches_type(Bucket, bucket, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/r2/test_sippy.py b/tests/api_resources/r2/test_sippy.py index c4b84c6282f..28ea8a332f9 100644 --- a/tests/api_resources/r2/test_sippy.py +++ b/tests/api_resources/r2/test_sippy.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.r2 import R2Sippy, SippyDeleteResponse +from cloudflare.types.r2.sippy import Sippy +from cloudflare.types.r2.sippy_delete_response import SippyDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: "example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +46,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "secret_access_key": "string", }, ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +59,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" sippy = response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +72,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sippy = response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -97,7 +98,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: "example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N "provider": "gcs", }, ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +131,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" sippy = response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +144,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sippy = response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -221,7 +222,7 @@ def test_method_get(self, client: Cloudflare) -> None: "example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -234,7 +235,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" sippy = response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -247,7 +248,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sippy = response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -277,7 +278,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> "example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +299,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "secret_access_key": "string", }, ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +312,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" sippy = await response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -324,7 +325,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" sippy = await response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -350,7 +351,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> "example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -370,7 +371,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn "provider": "gcs", }, ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -383,7 +384,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" sippy = await response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -396,7 +397,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" sippy = await response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -474,7 +475,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "example-bucket", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -487,7 +488,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" sippy = await response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) @pytest.mark.skip() @parametrize @@ -500,7 +501,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" sippy = await response.parse() - assert_matches_type(R2Sippy, sippy, path=["response"]) + assert_matches_type(Sippy, sippy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/radar/annotations/test_outages.py b/tests/api_resources/radar/annotations/test_outages.py index 98c8d58fec8..6e01d1086b1 100644 --- a/tests/api_resources/radar/annotations/test_outages.py +++ b/tests/api_resources/radar/annotations/test_outages.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.annotations import ( - OutageGetResponse, - OutageLocationsResponse, -) +from cloudflare.types.radar.annotations.outage_get_response import OutageGetResponse +from cloudflare.types.radar.annotations.outage_locations_response import OutageLocationsResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/as112/test_summary.py b/tests/api_resources/radar/as112/test_summary.py index 1f6f7128b01..0f5c33d4dda 100644 --- a/tests/api_resources/radar/as112/test_summary.py +++ b/tests/api_resources/radar/as112/test_summary.py @@ -10,14 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.as112 import ( - SummaryEdnsResponse, - SummaryDNSSECResponse, - SummaryProtocolResponse, - SummaryIPVersionResponse, - SummaryQueryTypeResponse, - SummaryResponseCodesResponse, -) +from cloudflare.types.radar.as112.summary_edns_response import SummaryEdnsResponse +from cloudflare.types.radar.as112.summary_dnssec_response import SummaryDNSSECResponse +from cloudflare.types.radar.as112.summary_protocol_response import SummaryProtocolResponse +from cloudflare.types.radar.as112.summary_ip_version_response import SummaryIPVersionResponse +from cloudflare.types.radar.as112.summary_query_type_response import SummaryQueryTypeResponse +from cloudflare.types.radar.as112.summary_response_codes_response import SummaryResponseCodesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/as112/test_timeseries_groups.py b/tests/api_resources/radar/as112/test_timeseries_groups.py index ed291ceed6b..1d58cb77806 100644 --- a/tests/api_resources/radar/as112/test_timeseries_groups.py +++ b/tests/api_resources/radar/as112/test_timeseries_groups.py @@ -10,14 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.as112 import ( - TimeseriesGroupEdnsResponse, - TimeseriesGroupDNSSECResponse, - TimeseriesGroupProtocolResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupQueryTypeResponse, - TimeseriesGroupResponseCodesResponse, -) +from cloudflare.types.radar.as112.timeseries_group_edns_response import TimeseriesGroupEdnsResponse +from cloudflare.types.radar.as112.timeseries_group_dnssec_response import TimeseriesGroupDNSSECResponse +from cloudflare.types.radar.as112.timeseries_group_protocol_response import TimeseriesGroupProtocolResponse +from cloudflare.types.radar.as112.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse +from cloudflare.types.radar.as112.timeseries_group_query_type_response import TimeseriesGroupQueryTypeResponse +from cloudflare.types.radar.as112.timeseries_group_response_codes_response import TimeseriesGroupResponseCodesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/as112/test_top.py b/tests/api_resources/radar/as112/test_top.py index 9dcda9b638d..8b96e7e9fbe 100644 --- a/tests/api_resources/radar/as112/test_top.py +++ b/tests/api_resources/radar/as112/test_top.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.as112 import ( - TopEdnsResponse, - TopDNSSECResponse, - TopIPVersionResponse, - TopLocationsResponse, -) +from cloudflare.types.radar.as112.top_edns_response import TopEdnsResponse +from cloudflare.types.radar.as112.top_dnssec_response import TopDNSSECResponse +from cloudflare.types.radar.as112.top_locations_response import TopLocationsResponse +from cloudflare.types.radar.as112.top_ip_version_response import TopIPVersionResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/attacks/layer3/test_summary.py b/tests/api_resources/radar/attacks/layer3/test_summary.py index fa77a34344f..82a2922ffb2 100644 --- a/tests/api_resources/radar/attacks/layer3/test_summary.py +++ b/tests/api_resources/radar/attacks/layer3/test_summary.py @@ -10,14 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer3 import ( - SummaryGetResponse, - SummaryVectorResponse, - SummaryBitrateResponse, - SummaryDurationResponse, - SummaryProtocolResponse, - SummaryIPVersionResponse, -) +from cloudflare.types.radar.attacks.layer3.summary_get_response import SummaryGetResponse +from cloudflare.types.radar.attacks.layer3.summary_vector_response import SummaryVectorResponse +from cloudflare.types.radar.attacks.layer3.summary_bitrate_response import SummaryBitrateResponse +from cloudflare.types.radar.attacks.layer3.summary_duration_response import SummaryDurationResponse +from cloudflare.types.radar.attacks.layer3.summary_protocol_response import SummaryProtocolResponse +from cloudflare.types.radar.attacks.layer3.summary_ip_version_response import SummaryIPVersionResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") 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 67738ff175e..02d5501344c 100644 --- a/tests/api_resources/radar/attacks/layer3/test_timeseries_groups.py +++ b/tests/api_resources/radar/attacks/layer3/test_timeseries_groups.py @@ -10,16 +10,14 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer3 import ( - TimeseriesGroupGetResponse, - TimeseriesGroupVectorResponse, - TimeseriesGroupBitrateResponse, - TimeseriesGroupDurationResponse, - TimeseriesGroupIndustryResponse, - TimeseriesGroupProtocolResponse, - TimeseriesGroupVerticalResponse, - TimeseriesGroupIPVersionResponse, -) +from cloudflare.types.radar.attacks.layer3.timeseries_group_get_response import TimeseriesGroupGetResponse +from cloudflare.types.radar.attacks.layer3.timeseries_group_vector_response import TimeseriesGroupVectorResponse +from cloudflare.types.radar.attacks.layer3.timeseries_group_bitrate_response import TimeseriesGroupBitrateResponse +from cloudflare.types.radar.attacks.layer3.timeseries_group_duration_response import TimeseriesGroupDurationResponse +from cloudflare.types.radar.attacks.layer3.timeseries_group_industry_response import TimeseriesGroupIndustryResponse +from cloudflare.types.radar.attacks.layer3.timeseries_group_protocol_response import TimeseriesGroupProtocolResponse +from cloudflare.types.radar.attacks.layer3.timeseries_group_vertical_response import TimeseriesGroupVerticalResponse +from cloudflare.types.radar.attacks.layer3.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/attacks/layer3/test_top.py b/tests/api_resources/radar/attacks/layer3/test_top.py index d48011bdd67..d1af74044c4 100644 --- a/tests/api_resources/radar/attacks/layer3/test_top.py +++ b/tests/api_resources/radar/attacks/layer3/test_top.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer3 import ( - TopAttacksResponse, - TopIndustryResponse, - TopVerticalResponse, -) +from cloudflare.types.radar.attacks.layer3.top_attacks_response import TopAttacksResponse +from cloudflare.types.radar.attacks.layer3.top_industry_response import TopIndustryResponse +from cloudflare.types.radar.attacks.layer3.top_vertical_response import TopVerticalResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/attacks/layer3/top/test_locations.py b/tests/api_resources/radar/attacks/layer3/top/test_locations.py index 194c19f4bcd..0b3c0f450b9 100644 --- a/tests/api_resources/radar/attacks/layer3/top/test_locations.py +++ b/tests/api_resources/radar/attacks/layer3/top/test_locations.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer3.top import ( - LocationOriginResponse, - LocationTargetResponse, -) +from cloudflare.types.radar.attacks.layer3.top.location_origin_response import LocationOriginResponse +from cloudflare.types.radar.attacks.layer3.top.location_target_response import LocationTargetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/attacks/layer7/test_summary.py b/tests/api_resources/radar/attacks/layer7/test_summary.py index 387fa63e663..04f966d65f7 100644 --- a/tests/api_resources/radar/attacks/layer7/test_summary.py +++ b/tests/api_resources/radar/attacks/layer7/test_summary.py @@ -10,14 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer7 import ( - SummaryGetResponse, - SummaryIPVersionResponse, - SummaryHTTPMethodResponse, - SummaryHTTPVersionResponse, - SummaryManagedRulesResponse, - SummaryMitigationProductResponse, -) +from cloudflare.types.radar.attacks.layer7.summary_get_response import SummaryGetResponse +from cloudflare.types.radar.attacks.layer7.summary_ip_version_response import SummaryIPVersionResponse +from cloudflare.types.radar.attacks.layer7.summary_http_method_response import SummaryHTTPMethodResponse +from cloudflare.types.radar.attacks.layer7.summary_http_version_response import SummaryHTTPVersionResponse +from cloudflare.types.radar.attacks.layer7.summary_managed_rules_response import SummaryManagedRulesResponse +from cloudflare.types.radar.attacks.layer7.summary_mitigation_product_response import SummaryMitigationProductResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") 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 e019a3d76fd..6ddbc689255 100644 --- a/tests/api_resources/radar/attacks/layer7/test_timeseries_groups.py +++ b/tests/api_resources/radar/attacks/layer7/test_timeseries_groups.py @@ -10,14 +10,20 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer7 import ( - TimeseriesGroupGetResponse, - TimeseriesGroupIndustryResponse, - TimeseriesGroupVerticalResponse, - TimeseriesGroupIPVersionResponse, +from cloudflare.types.radar.attacks.layer7.timeseries_group_get_response import TimeseriesGroupGetResponse +from cloudflare.types.radar.attacks.layer7.timeseries_group_industry_response import TimeseriesGroupIndustryResponse +from cloudflare.types.radar.attacks.layer7.timeseries_group_vertical_response import TimeseriesGroupVerticalResponse +from cloudflare.types.radar.attacks.layer7.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse +from cloudflare.types.radar.attacks.layer7.timeseries_group_http_method_response import ( TimeseriesGroupHTTPMethodResponse, +) +from cloudflare.types.radar.attacks.layer7.timeseries_group_http_version_response import ( TimeseriesGroupHTTPVersionResponse, +) +from cloudflare.types.radar.attacks.layer7.timeseries_group_managed_rules_response import ( TimeseriesGroupManagedRulesResponse, +) +from cloudflare.types.radar.attacks.layer7.timeseries_group_mitigation_product_response import ( TimeseriesGroupMitigationProductResponse, ) diff --git a/tests/api_resources/radar/attacks/layer7/test_top.py b/tests/api_resources/radar/attacks/layer7/test_top.py index 6f0a9adb0a9..e42d7e3911e 100644 --- a/tests/api_resources/radar/attacks/layer7/test_top.py +++ b/tests/api_resources/radar/attacks/layer7/test_top.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer7 import ( - TopAttacksResponse, - TopIndustryResponse, - TopVerticalResponse, -) +from cloudflare.types.radar.attacks.layer7.top_attacks_response import TopAttacksResponse +from cloudflare.types.radar.attacks.layer7.top_industry_response import TopIndustryResponse +from cloudflare.types.radar.attacks.layer7.top_vertical_response import TopVerticalResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/attacks/layer7/top/test_ases.py b/tests/api_resources/radar/attacks/layer7/top/test_ases.py index cf12547e615..837a20eb43a 100644 --- a/tests/api_resources/radar/attacks/layer7/top/test_ases.py +++ b/tests/api_resources/radar/attacks/layer7/top/test_ases.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer7.top import AseOriginResponse +from cloudflare.types.radar.attacks.layer7.top.ase_origin_response import AseOriginResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/attacks/layer7/top/test_locations.py b/tests/api_resources/radar/attacks/layer7/top/test_locations.py index 0752c790d23..8fc1f872afe 100644 --- a/tests/api_resources/radar/attacks/layer7/top/test_locations.py +++ b/tests/api_resources/radar/attacks/layer7/top/test_locations.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks.layer7.top import ( - LocationOriginResponse, - LocationTargetResponse, -) +from cloudflare.types.radar.attacks.layer7.top.location_origin_response import LocationOriginResponse +from cloudflare.types.radar.attacks.layer7.top.location_target_response import LocationTargetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/attacks/test_layer3.py b/tests/api_resources/radar/attacks/test_layer3.py index cc21487946f..046f8f55624 100644 --- a/tests/api_resources/radar/attacks/test_layer3.py +++ b/tests/api_resources/radar/attacks/test_layer3.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks import Layer3TimeseriesResponse +from cloudflare.types.radar.attacks.layer3_timeseries_response import Layer3TimeseriesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/attacks/test_layer7.py b/tests/api_resources/radar/attacks/test_layer7.py index 45528ada5ac..8c9bb815231 100644 --- a/tests/api_resources/radar/attacks/test_layer7.py +++ b/tests/api_resources/radar/attacks/test_layer7.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.attacks import Layer7TimeseriesResponse +from cloudflare.types.radar.attacks.layer7_timeseries_response import Layer7TimeseriesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/workers/deployments/__init__.py b/tests/api_resources/radar/bgp/hijacks/__init__.py similarity index 100% rename from tests/api_resources/workers/deployments/__init__.py rename to tests/api_resources/radar/bgp/hijacks/__init__.py diff --git a/tests/api_resources/radar/bgp/hijacks/test_events.py b/tests/api_resources/radar/bgp/hijacks/test_events.py new file mode 100644 index 00000000000..ff34479ed22 --- /dev/null +++ b/tests/api_resources/radar/bgp/hijacks/test_events.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._utils import parse_datetime +from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination +from cloudflare.types.radar.bgp.hijacks.event_list_response import EventListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEvents: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + event = client.radar.bgp.hijacks.events.list() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + event = client.radar.bgp.hijacks.events.list( + date_end=parse_datetime("2023-09-01T11:41:33.782Z"), + date_range="7d", + date_start=parse_datetime("2023-09-01T11:41:33.782Z"), + event_id=0, + format="JSON", + hijacker_asn=0, + involved_asn=0, + involved_country="string", + max_confidence=0, + min_confidence=0, + page=0, + per_page=0, + prefix="string", + sort_by="TIME", + sort_order="DESC", + victim_asn=0, + ) + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.radar.bgp.hijacks.events.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = response.parse() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.radar.bgp.hijacks.events.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = response.parse() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncEvents: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + event = await async_client.radar.bgp.hijacks.events.list() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + event = await async_client.radar.bgp.hijacks.events.list( + date_end=parse_datetime("2023-09-01T11:41:33.782Z"), + date_range="7d", + date_start=parse_datetime("2023-09-01T11:41:33.782Z"), + event_id=0, + format="JSON", + hijacker_asn=0, + involved_asn=0, + involved_country="string", + max_confidence=0, + min_confidence=0, + page=0, + per_page=0, + prefix="string", + sort_by="TIME", + sort_order="DESC", + victim_asn=0, + ) + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.bgp.hijacks.events.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = await response.parse() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.bgp.hijacks.events.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = await response.parse() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/deployments/by_scripts/__init__.py b/tests/api_resources/radar/bgp/leaks/__init__.py similarity index 100% rename from tests/api_resources/workers/deployments/by_scripts/__init__.py rename to tests/api_resources/radar/bgp/leaks/__init__.py diff --git a/tests/api_resources/radar/bgp/leaks/test_events.py b/tests/api_resources/radar/bgp/leaks/test_events.py new file mode 100644 index 00000000000..5a98a3b965f --- /dev/null +++ b/tests/api_resources/radar/bgp/leaks/test_events.py @@ -0,0 +1,118 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare._utils import parse_datetime +from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination +from cloudflare.types.radar.bgp.leaks.event_list_response import EventListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEvents: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + event = client.radar.bgp.leaks.events.list() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + event = client.radar.bgp.leaks.events.list( + date_end=parse_datetime("2023-09-01T11:41:33.782Z"), + date_range="7d", + date_start=parse_datetime("2023-09-01T11:41:33.782Z"), + event_id=0, + format="JSON", + involved_asn=0, + involved_country="string", + leak_asn=0, + page=0, + per_page=0, + sort_by="TIME", + sort_order="DESC", + ) + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.radar.bgp.leaks.events.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = response.parse() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.radar.bgp.leaks.events.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = response.parse() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncEvents: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + event = await async_client.radar.bgp.leaks.events.list() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + event = await async_client.radar.bgp.leaks.events.list( + date_end=parse_datetime("2023-09-01T11:41:33.782Z"), + date_range="7d", + date_start=parse_datetime("2023-09-01T11:41:33.782Z"), + event_id=0, + format="JSON", + involved_asn=0, + involved_country="string", + leak_asn=0, + page=0, + per_page=0, + sort_by="TIME", + sort_order="DESC", + ) + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.bgp.leaks.events.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = await response.parse() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.bgp.leaks.events.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = await response.parse() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/radar/bgp/test_hijacks.py b/tests/api_resources/radar/bgp/test_hijacks.py deleted file mode 100644 index e7f5bc847d6..00000000000 --- a/tests/api_resources/radar/bgp/test_hijacks.py +++ /dev/null @@ -1,125 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime -from cloudflare.types.radar.bgp import HijackEventsResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestHijacks: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_events(self, client: Cloudflare) -> None: - hijack = client.radar.bgp.hijacks.events() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_events_with_all_params(self, client: Cloudflare) -> None: - hijack = client.radar.bgp.hijacks.events( - date_end=parse_datetime("2023-09-01T11:41:33.782Z"), - date_range="7d", - date_start=parse_datetime("2023-09-01T11:41:33.782Z"), - event_id=0, - format="JSON", - hijacker_asn=0, - involved_asn=0, - involved_country="string", - max_confidence=0, - min_confidence=0, - page=0, - per_page=0, - prefix="string", - sort_by="TIME", - sort_order="DESC", - victim_asn=0, - ) - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_events(self, client: Cloudflare) -> None: - response = client.radar.bgp.hijacks.with_raw_response.events() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hijack = response.parse() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_events(self, client: Cloudflare) -> None: - with client.radar.bgp.hijacks.with_streaming_response.events() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hijack = response.parse() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncHijacks: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_events(self, async_client: AsyncCloudflare) -> None: - hijack = await async_client.radar.bgp.hijacks.events() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_events_with_all_params(self, async_client: AsyncCloudflare) -> None: - hijack = await async_client.radar.bgp.hijacks.events( - date_end=parse_datetime("2023-09-01T11:41:33.782Z"), - date_range="7d", - date_start=parse_datetime("2023-09-01T11:41:33.782Z"), - event_id=0, - format="JSON", - hijacker_asn=0, - involved_asn=0, - involved_country="string", - max_confidence=0, - min_confidence=0, - page=0, - per_page=0, - prefix="string", - sort_by="TIME", - sort_order="DESC", - victim_asn=0, - ) - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_events(self, async_client: AsyncCloudflare) -> None: - response = await async_client.radar.bgp.hijacks.with_raw_response.events() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hijack = await response.parse() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_events(self, async_client: AsyncCloudflare) -> None: - async with async_client.radar.bgp.hijacks.with_streaming_response.events() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hijack = await response.parse() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/radar/bgp/test_leaks.py b/tests/api_resources/radar/bgp/test_leaks.py deleted file mode 100644 index eb7d85f2290..00000000000 --- a/tests/api_resources/radar/bgp/test_leaks.py +++ /dev/null @@ -1,117 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime -from cloudflare.types.radar.bgp import LeakEventsResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestLeaks: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_events(self, client: Cloudflare) -> None: - leak = client.radar.bgp.leaks.events() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_events_with_all_params(self, client: Cloudflare) -> None: - leak = client.radar.bgp.leaks.events( - date_end=parse_datetime("2023-09-01T11:41:33.782Z"), - date_range="7d", - date_start=parse_datetime("2023-09-01T11:41:33.782Z"), - event_id=0, - format="JSON", - involved_asn=0, - involved_country="string", - leak_asn=0, - page=0, - per_page=0, - sort_by="TIME", - sort_order="DESC", - ) - assert_matches_type(LeakEventsResponse, leak, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_events(self, client: Cloudflare) -> None: - response = client.radar.bgp.leaks.with_raw_response.events() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - leak = response.parse() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_events(self, client: Cloudflare) -> None: - with client.radar.bgp.leaks.with_streaming_response.events() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - leak = response.parse() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncLeaks: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_events(self, async_client: AsyncCloudflare) -> None: - leak = await async_client.radar.bgp.leaks.events() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_events_with_all_params(self, async_client: AsyncCloudflare) -> None: - leak = await async_client.radar.bgp.leaks.events( - date_end=parse_datetime("2023-09-01T11:41:33.782Z"), - date_range="7d", - date_start=parse_datetime("2023-09-01T11:41:33.782Z"), - event_id=0, - format="JSON", - involved_asn=0, - involved_country="string", - leak_asn=0, - page=0, - per_page=0, - sort_by="TIME", - sort_order="DESC", - ) - assert_matches_type(LeakEventsResponse, leak, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_events(self, async_client: AsyncCloudflare) -> None: - response = await async_client.radar.bgp.leaks.with_raw_response.events() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - leak = await response.parse() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_events(self, async_client: AsyncCloudflare) -> None: - async with async_client.radar.bgp.leaks.with_streaming_response.events() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - leak = await response.parse() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/radar/bgp/test_routes.py b/tests/api_resources/radar/bgp/test_routes.py index c0a2b5b6a1f..73f6f629fe7 100644 --- a/tests/api_resources/radar/bgp/test_routes.py +++ b/tests/api_resources/radar/bgp/test_routes.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.bgp import ( - RouteMoasResponse, - RouteStatsResponse, - RoutePfx2asResponse, - RouteTimeseriesResponse, -) +from cloudflare.types.radar.bgp.route_moas_response import RouteMoasResponse +from cloudflare.types.radar.bgp.route_stats_response import RouteStatsResponse +from cloudflare.types.radar.bgp.route_pfx2as_response import RoutePfx2asResponse +from cloudflare.types.radar.bgp.route_timeseries_response import RouteTimeseriesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -155,6 +153,7 @@ def test_method_timeseries_with_all_params(self, client: Cloudflare) -> None: date_range="7d", date_start=parse_datetime("2023-09-01T11:41:33.782Z"), format="JSON", + include_delay=True, location="US", ) assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) @@ -317,6 +316,7 @@ async def test_method_timeseries_with_all_params(self, async_client: AsyncCloudf date_range="7d", date_start=parse_datetime("2023-09-01T11:41:33.782Z"), format="JSON", + include_delay=True, location="US", ) assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) diff --git a/tests/api_resources/radar/bgp/test_top.py b/tests/api_resources/radar/bgp/test_top.py index 7f8f9d2cccd..8a7e33da87e 100644 --- a/tests/api_resources/radar/bgp/test_top.py +++ b/tests/api_resources/radar/bgp/test_top.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.bgp import TopPrefixesResponse +from cloudflare.types.radar.bgp.top_prefixes_response import TopPrefixesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/bgp/top/test_ases.py b/tests/api_resources/radar/bgp/top/test_ases.py index 515a06046a6..3ed5a561ce7 100644 --- a/tests/api_resources/radar/bgp/top/test_ases.py +++ b/tests/api_resources/radar/bgp/top/test_ases.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.bgp.top import AseGetResponse, AsePrefixesResponse +from cloudflare.types.radar.bgp.top.ase_get_response import AseGetResponse +from cloudflare.types.radar.bgp.top.ase_prefixes_response import AsePrefixesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/dns/test_top.py b/tests/api_resources/radar/dns/test_top.py index e9e4494a4b1..ebdc9f1f3c5 100644 --- a/tests/api_resources/radar/dns/test_top.py +++ b/tests/api_resources/radar/dns/test_top.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.dns import TopAsesResponse, TopLocationsResponse +from cloudflare.types.radar.dns.top_ases_response import TopAsesResponse +from cloudflare.types.radar.dns.top_locations_response import TopLocationsResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/email/routing/test_summary.py b/tests/api_resources/radar/email/routing/test_summary.py index f44308cbcb4..f308e6ebe35 100644 --- a/tests/api_resources/radar/email/routing/test_summary.py +++ b/tests/api_resources/radar/email/routing/test_summary.py @@ -10,14 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.email.routing import ( - SummaryARCResponse, - SummarySPFResponse, - SummaryDKIMResponse, - SummaryDMARCResponse, - SummaryEncryptedResponse, - SummaryIPVersionResponse, -) +from cloudflare.types.radar.email.routing.summary_arc_response import SummaryARCResponse +from cloudflare.types.radar.email.routing.summary_spf_response import SummarySPFResponse +from cloudflare.types.radar.email.routing.summary_dkim_response import SummaryDKIMResponse +from cloudflare.types.radar.email.routing.summary_dmarc_response import SummaryDMARCResponse +from cloudflare.types.radar.email.routing.summary_encrypted_response import SummaryEncryptedResponse +from cloudflare.types.radar.email.routing.summary_ip_version_response import SummaryIPVersionResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/email/routing/test_timeseries_groups.py b/tests/api_resources/radar/email/routing/test_timeseries_groups.py index cc4f249e4c3..87384aa42a4 100644 --- a/tests/api_resources/radar/email/routing/test_timeseries_groups.py +++ b/tests/api_resources/radar/email/routing/test_timeseries_groups.py @@ -10,14 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.email.routing import ( - TimeseriesGroupARCResponse, - TimeseriesGroupSPFResponse, - TimeseriesGroupDKIMResponse, - TimeseriesGroupDMARCResponse, - TimeseriesGroupEncryptedResponse, - TimeseriesGroupIPVersionResponse, -) +from cloudflare.types.radar.email.routing.timeseries_group_arc_response import TimeseriesGroupARCResponse +from cloudflare.types.radar.email.routing.timeseries_group_spf_response import TimeseriesGroupSPFResponse +from cloudflare.types.radar.email.routing.timeseries_group_dkim_response import TimeseriesGroupDKIMResponse +from cloudflare.types.radar.email.routing.timeseries_group_dmarc_response import TimeseriesGroupDMARCResponse +from cloudflare.types.radar.email.routing.timeseries_group_encrypted_response import TimeseriesGroupEncryptedResponse +from cloudflare.types.radar.email.routing.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/email/security/test_summary.py b/tests/api_resources/radar/email/security/test_summary.py index e3df2f5670c..184499e541f 100644 --- a/tests/api_resources/radar/email/security/test_summary.py +++ b/tests/api_resources/radar/email/security/test_summary.py @@ -10,17 +10,15 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.email.security import ( - SummaryARCResponse, - SummarySPFResponse, - SummaryDKIMResponse, - SummarySpamResponse, - SummaryDMARCResponse, - SummarySpoofResponse, - SummaryMaliciousResponse, - SummaryTLSVersionResponse, - SummaryThreatCategoryResponse, -) +from cloudflare.types.radar.email.security.summary_arc_response import SummaryARCResponse +from cloudflare.types.radar.email.security.summary_spf_response import SummarySPFResponse +from cloudflare.types.radar.email.security.summary_dkim_response import SummaryDKIMResponse +from cloudflare.types.radar.email.security.summary_spam_response import SummarySpamResponse +from cloudflare.types.radar.email.security.summary_dmarc_response import SummaryDMARCResponse +from cloudflare.types.radar.email.security.summary_spoof_response import SummarySpoofResponse +from cloudflare.types.radar.email.security.summary_malicious_response import SummaryMaliciousResponse +from cloudflare.types.radar.email.security.summary_tls_version_response import SummaryTLSVersionResponse +from cloudflare.types.radar.email.security.summary_threat_category_response import SummaryThreatCategoryResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/email/security/test_timeseries_groups.py b/tests/api_resources/radar/email/security/test_timeseries_groups.py index 4af4404daa9..ddb4b23599e 100644 --- a/tests/api_resources/radar/email/security/test_timeseries_groups.py +++ b/tests/api_resources/radar/email/security/test_timeseries_groups.py @@ -10,15 +10,17 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.email.security import ( - TimeseriesGroupARCResponse, - TimeseriesGroupSPFResponse, - TimeseriesGroupDKIMResponse, - TimeseriesGroupSpamResponse, - TimeseriesGroupDMARCResponse, - TimeseriesGroupSpoofResponse, - TimeseriesGroupMaliciousResponse, +from cloudflare.types.radar.email.security.timeseries_group_arc_response import TimeseriesGroupARCResponse +from cloudflare.types.radar.email.security.timeseries_group_spf_response import TimeseriesGroupSPFResponse +from cloudflare.types.radar.email.security.timeseries_group_dkim_response import TimeseriesGroupDKIMResponse +from cloudflare.types.radar.email.security.timeseries_group_spam_response import TimeseriesGroupSpamResponse +from cloudflare.types.radar.email.security.timeseries_group_dmarc_response import TimeseriesGroupDMARCResponse +from cloudflare.types.radar.email.security.timeseries_group_spoof_response import TimeseriesGroupSpoofResponse +from cloudflare.types.radar.email.security.timeseries_group_malicious_response import TimeseriesGroupMaliciousResponse +from cloudflare.types.radar.email.security.timeseries_group_tls_version_response import ( TimeseriesGroupTLSVersionResponse, +) +from cloudflare.types.radar.email.security.timeseries_group_threat_category_response import ( TimeseriesGroupThreatCategoryResponse, ) diff --git a/tests/api_resources/radar/email/security/top/test_tlds.py b/tests/api_resources/radar/email/security/top/test_tlds.py index 218f134cedf..def47cffc7b 100644 --- a/tests/api_resources/radar/email/security/top/test_tlds.py +++ b/tests/api_resources/radar/email/security/top/test_tlds.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.email.security.top import TldGetResponse +from cloudflare.types.radar.email.security.top.tld_get_response import TldGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/email/security/top/tlds/test_malicious.py b/tests/api_resources/radar/email/security/top/tlds/test_malicious.py index 22bf1dfcb8f..705b7b82018 100644 --- a/tests/api_resources/radar/email/security/top/tlds/test_malicious.py +++ b/tests/api_resources/radar/email/security/top/tlds/test_malicious.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.email.security.top.tlds import MaliciousGetResponse +from cloudflare.types.radar.email.security.top.tlds.malicious_get_response import MaliciousGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/email/security/top/tlds/test_spam.py b/tests/api_resources/radar/email/security/top/tlds/test_spam.py index 62b1b969239..0a98e2f14ed 100644 --- a/tests/api_resources/radar/email/security/top/tlds/test_spam.py +++ b/tests/api_resources/radar/email/security/top/tlds/test_spam.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.email.security.top.tlds import SpamGetResponse +from cloudflare.types.radar.email.security.top.tlds.spam_get_response import SpamGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/email/security/top/tlds/test_spoof.py b/tests/api_resources/radar/email/security/top/tlds/test_spoof.py index 185a4306397..15a09dc7c6b 100644 --- a/tests/api_resources/radar/email/security/top/tlds/test_spoof.py +++ b/tests/api_resources/radar/email/security/top/tlds/test_spoof.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.email.security.top.tlds import SpoofGetResponse +from cloudflare.types.radar.email.security.top.tlds.spoof_get_response import SpoofGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/entities/test_asns.py b/tests/api_resources/radar/entities/test_asns.py index 8273d3fc87e..958e4fb3ea6 100644 --- a/tests/api_resources/radar/entities/test_asns.py +++ b/tests/api_resources/radar/entities/test_asns.py @@ -9,12 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.radar.entities import ( - ASNIPResponse, - ASNGetResponse, - ASNRelResponse, - ASNListResponse, -) +from cloudflare.types.radar.entities.asn_ip_response import ASNIPResponse +from cloudflare.types.radar.entities.asn_get_response import ASNGetResponse +from cloudflare.types.radar.entities.asn_rel_response import ASNRelResponse +from cloudflare.types.radar.entities.asn_list_response import ASNListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/entities/test_locations.py b/tests/api_resources/radar/entities/test_locations.py index 59e8a6ff915..36ae6224790 100644 --- a/tests/api_resources/radar/entities/test_locations.py +++ b/tests/api_resources/radar/entities/test_locations.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.radar.entities import ( - LocationGetResponse, - LocationListResponse, -) +from cloudflare.types.radar.entities.location_get_response import LocationGetResponse +from cloudflare.types.radar.entities.location_list_response import LocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/ases/test_bot_class.py b/tests/api_resources/radar/http/ases/test_bot_class.py index 177775b9dc4..a804ae8a959 100644 --- a/tests/api_resources/radar/http/ases/test_bot_class.py +++ b/tests/api_resources/radar/http/ases/test_bot_class.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.ases import BotClassGetResponse +from cloudflare.types.radar.http.ases.bot_class_get_response import BotClassGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/ases/test_device_type.py b/tests/api_resources/radar/http/ases/test_device_type.py index 15dde782973..391e750c55e 100644 --- a/tests/api_resources/radar/http/ases/test_device_type.py +++ b/tests/api_resources/radar/http/ases/test_device_type.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.ases import DeviceTypeGetResponse +from cloudflare.types.radar.http.ases.device_type_get_response import DeviceTypeGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/ases/test_http_method.py b/tests/api_resources/radar/http/ases/test_http_method.py index 4ad2abaf200..03efb0c4ff9 100644 --- a/tests/api_resources/radar/http/ases/test_http_method.py +++ b/tests/api_resources/radar/http/ases/test_http_method.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.ases import HTTPMethodGetResponse +from cloudflare.types.radar.http.ases.http_method_get_response import HTTPMethodGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/ases/test_http_protocol.py b/tests/api_resources/radar/http/ases/test_http_protocol.py index 91b9272418a..16d31c48ba6 100644 --- a/tests/api_resources/radar/http/ases/test_http_protocol.py +++ b/tests/api_resources/radar/http/ases/test_http_protocol.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.ases import HTTPProtocolGetResponse +from cloudflare.types.radar.http.ases.http_protocol_get_response import HTTPProtocolGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/ases/test_ip_version.py b/tests/api_resources/radar/http/ases/test_ip_version.py index 6926a2d80a9..395fc8f4668 100644 --- a/tests/api_resources/radar/http/ases/test_ip_version.py +++ b/tests/api_resources/radar/http/ases/test_ip_version.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.ases import IPVersionGetResponse +from cloudflare.types.radar.http.ases.ip_version_get_response import IPVersionGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/ases/test_os.py b/tests/api_resources/radar/http/ases/test_os.py index aee0b72ed62..57df70a027a 100644 --- a/tests/api_resources/radar/http/ases/test_os.py +++ b/tests/api_resources/radar/http/ases/test_os.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.ases import OSGetResponse +from cloudflare.types.radar.http.ases.os_get_response import OSGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/ases/test_tls_version.py b/tests/api_resources/radar/http/ases/test_tls_version.py index 1d6e229862d..18b2a467775 100644 --- a/tests/api_resources/radar/http/ases/test_tls_version.py +++ b/tests/api_resources/radar/http/ases/test_tls_version.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.ases import TLSVersionGetResponse +from cloudflare.types.radar.http.ases.tls_version_get_response import TLSVersionGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/locations/test_bot_class.py b/tests/api_resources/radar/http/locations/test_bot_class.py index 2494f445a5b..2e0daafb45a 100644 --- a/tests/api_resources/radar/http/locations/test_bot_class.py +++ b/tests/api_resources/radar/http/locations/test_bot_class.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.locations import BotClassGetResponse +from cloudflare.types.radar.http.locations.bot_class_get_response import BotClassGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/locations/test_device_type.py b/tests/api_resources/radar/http/locations/test_device_type.py index 30431de0cd8..412200f90b4 100644 --- a/tests/api_resources/radar/http/locations/test_device_type.py +++ b/tests/api_resources/radar/http/locations/test_device_type.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.locations import DeviceTypeGetResponse +from cloudflare.types.radar.http.locations.device_type_get_response import DeviceTypeGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/locations/test_http_method.py b/tests/api_resources/radar/http/locations/test_http_method.py index 6a78bd7867a..c657fceb244 100644 --- a/tests/api_resources/radar/http/locations/test_http_method.py +++ b/tests/api_resources/radar/http/locations/test_http_method.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.locations import HTTPMethodGetResponse +from cloudflare.types.radar.http.locations.http_method_get_response import HTTPMethodGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/locations/test_http_protocol.py b/tests/api_resources/radar/http/locations/test_http_protocol.py index 6dbb5bf0b0a..268a2cdfc18 100644 --- a/tests/api_resources/radar/http/locations/test_http_protocol.py +++ b/tests/api_resources/radar/http/locations/test_http_protocol.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.locations import HTTPProtocolGetResponse +from cloudflare.types.radar.http.locations.http_protocol_get_response import HTTPProtocolGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/locations/test_ip_version.py b/tests/api_resources/radar/http/locations/test_ip_version.py index 0a01d8af6df..19995d31358 100644 --- a/tests/api_resources/radar/http/locations/test_ip_version.py +++ b/tests/api_resources/radar/http/locations/test_ip_version.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.locations import IPVersionGetResponse +from cloudflare.types.radar.http.locations.ip_version_get_response import IPVersionGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/locations/test_os.py b/tests/api_resources/radar/http/locations/test_os.py index a2975b8b9a3..2b42985d9f1 100644 --- a/tests/api_resources/radar/http/locations/test_os.py +++ b/tests/api_resources/radar/http/locations/test_os.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.locations import OSGetResponse +from cloudflare.types.radar.http.locations.os_get_response import OSGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/locations/test_tls_version.py b/tests/api_resources/radar/http/locations/test_tls_version.py index e504f1110c1..535fc2b26d0 100644 --- a/tests/api_resources/radar/http/locations/test_tls_version.py +++ b/tests/api_resources/radar/http/locations/test_tls_version.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http.locations import TLSVersionGetResponse +from cloudflare.types.radar.http.locations.tls_version_get_response import TLSVersionGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/test_ases.py b/tests/api_resources/radar/http/test_ases.py index 650376b1d3d..51b99a48a50 100644 --- a/tests/api_resources/radar/http/test_ases.py +++ b/tests/api_resources/radar/http/test_ases.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http import AseGetResponse +from cloudflare.types.radar.http.ase_get_response import AseGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/test_locations.py b/tests/api_resources/radar/http/test_locations.py index f0dd6fbeaa7..32c696738f8 100644 --- a/tests/api_resources/radar/http/test_locations.py +++ b/tests/api_resources/radar/http/test_locations.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http import LocationGetResponse +from cloudflare.types.radar.http.location_get_response import LocationGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/test_summary.py b/tests/api_resources/radar/http/test_summary.py index 3b06744b0a9..ff51e8f27a1 100644 --- a/tests/api_resources/radar/http/test_summary.py +++ b/tests/api_resources/radar/http/test_summary.py @@ -10,15 +10,13 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http import ( - SummaryOSResponse, - SummaryBotClassResponse, - SummaryIPVersionResponse, - SummaryDeviceTypeResponse, - SummaryTLSVersionResponse, - SummaryHTTPVersionResponse, - SummaryHTTPProtocolResponse, -) +from cloudflare.types.radar.http.summary_os_response import SummaryOSResponse +from cloudflare.types.radar.http.summary_bot_class_response import SummaryBotClassResponse +from cloudflare.types.radar.http.summary_ip_version_response import SummaryIPVersionResponse +from cloudflare.types.radar.http.summary_device_type_response import SummaryDeviceTypeResponse +from cloudflare.types.radar.http.summary_tls_version_response import SummaryTLSVersionResponse +from cloudflare.types.radar.http.summary_http_version_response import SummaryHTTPVersionResponse +from cloudflare.types.radar.http.summary_http_protocol_response import SummaryHTTPProtocolResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/test_timeseries_groups.py b/tests/api_resources/radar/http/test_timeseries_groups.py index cb362d3ff23..eeb307b56ec 100644 --- a/tests/api_resources/radar/http/test_timeseries_groups.py +++ b/tests/api_resources/radar/http/test_timeseries_groups.py @@ -10,17 +10,15 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http import ( - TimeseriesGroupOSResponse, - TimeseriesGroupBrowserResponse, - TimeseriesGroupBotClassResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupDeviceTypeResponse, - TimeseriesGroupTLSVersionResponse, - TimeseriesGroupHTTPVersionResponse, - TimeseriesGroupHTTPProtocolResponse, - TimeseriesGroupBrowserFamilyResponse, -) +from cloudflare.types.radar.http.timeseries_group_os_response import TimeseriesGroupOSResponse +from cloudflare.types.radar.http.timeseries_group_browser_response import TimeseriesGroupBrowserResponse +from cloudflare.types.radar.http.timeseries_group_bot_class_response import TimeseriesGroupBotClassResponse +from cloudflare.types.radar.http.timeseries_group_ip_version_response import TimeseriesGroupIPVersionResponse +from cloudflare.types.radar.http.timeseries_group_device_type_response import TimeseriesGroupDeviceTypeResponse +from cloudflare.types.radar.http.timeseries_group_tls_version_response import TimeseriesGroupTLSVersionResponse +from cloudflare.types.radar.http.timeseries_group_http_version_response import TimeseriesGroupHTTPVersionResponse +from cloudflare.types.radar.http.timeseries_group_http_protocol_response import TimeseriesGroupHTTPProtocolResponse +from cloudflare.types.radar.http.timeseries_group_browser_family_response import TimeseriesGroupBrowserFamilyResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/http/test_top.py b/tests/api_resources/radar/http/test_top.py index 6f5d3213d99..3b356cc5326 100644 --- a/tests/api_resources/radar/http/test_top.py +++ b/tests/api_resources/radar/http/test_top.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.http import ( - TopBrowsersResponse, - TopBrowserFamiliesResponse, -) +from cloudflare.types.radar.http.top_browsers_response import TopBrowsersResponse +from cloudflare.types.radar.http.top_browser_families_response import TopBrowserFamiliesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/netflows/test_top.py b/tests/api_resources/radar/netflows/test_top.py index 8535abc7465..a0476609222 100644 --- a/tests/api_resources/radar/netflows/test_top.py +++ b/tests/api_resources/radar/netflows/test_top.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.netflows import TopAsesResponse, TopLocationsResponse +from cloudflare.types.radar.netflows.top_ases_response import TopAsesResponse +from cloudflare.types.radar.netflows.top_locations_response import TopLocationsResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/quality/speed/test_top.py b/tests/api_resources/radar/quality/speed/test_top.py index 27ff511eecb..ed60dd3d125 100644 --- a/tests/api_resources/radar/quality/speed/test_top.py +++ b/tests/api_resources/radar/quality/speed/test_top.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.quality.speed import ( - TopAsesResponse, - TopLocationsResponse, -) +from cloudflare.types.radar.quality.speed.top_ases_response import TopAsesResponse +from cloudflare.types.radar.quality.speed.top_locations_response import TopLocationsResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/quality/test_iqi.py b/tests/api_resources/radar/quality/test_iqi.py index 06a57e35778..dc22a1944d5 100644 --- a/tests/api_resources/radar/quality/test_iqi.py +++ b/tests/api_resources/radar/quality/test_iqi.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.quality import ( - IQISummaryResponse, - IQITimeseriesGroupsResponse, -) +from cloudflare.types.radar.quality.iqi_summary_response import IQISummaryResponse +from cloudflare.types.radar.quality.iqi_timeseries_groups_response import IQITimeseriesGroupsResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/quality/test_speed.py b/tests/api_resources/radar/quality/test_speed.py index 00683ae6c18..3019b6d3a8b 100644 --- a/tests/api_resources/radar/quality/test_speed.py +++ b/tests/api_resources/radar/quality/test_speed.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.quality import ( - SpeedSummaryResponse, - SpeedHistogramResponse, -) +from cloudflare.types.radar.quality.speed_summary_response import SpeedSummaryResponse +from cloudflare.types.radar.quality.speed_histogram_response import SpeedHistogramResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/ranking/test_domain.py b/tests/api_resources/radar/ranking/test_domain.py index 44269df75ae..cbaa37decfd 100644 --- a/tests/api_resources/radar/ranking/test_domain.py +++ b/tests/api_resources/radar/ranking/test_domain.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.radar.ranking import DomainGetResponse +from cloudflare.types.radar.ranking.domain_get_response import DomainGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/test_as112.py b/tests/api_resources/radar/test_as112.py index a6dde128ac6..47ee30050e5 100644 --- a/tests/api_resources/radar/test_as112.py +++ b/tests/api_resources/radar/test_as112.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar import AS112TimeseriesResponse +from cloudflare.types.radar.as112_timeseries_response import AS112TimeseriesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/test_bgp.py b/tests/api_resources/radar/test_bgp.py index ab993f872e2..c86c2e4db70 100644 --- a/tests/api_resources/radar/test_bgp.py +++ b/tests/api_resources/radar/test_bgp.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar import BGPTimeseriesResponse +from cloudflare.types.radar.bgp_timeseries_response import BGPTimeseriesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/test_connection_tampering.py b/tests/api_resources/radar/test_connection_tampering.py index d36693462b8..c91e8f1312b 100644 --- a/tests/api_resources/radar/test_connection_tampering.py +++ b/tests/api_resources/radar/test_connection_tampering.py @@ -10,8 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar import ( - ConnectionTamperingSummaryResponse, +from cloudflare.types.radar.connection_tampering_summary_response import ConnectionTamperingSummaryResponse +from cloudflare.types.radar.connection_tampering_timeseries_groups_response import ( ConnectionTamperingTimeseriesGroupsResponse, ) diff --git a/tests/api_resources/radar/test_datasets.py b/tests/api_resources/radar/test_datasets.py index 006dca3cb20..291fd3b8c9d 100644 --- a/tests/api_resources/radar/test_datasets.py +++ b/tests/api_resources/radar/test_datasets.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.radar import ( - DatasetListResponse, - DatasetDownloadResponse, -) +from cloudflare.types.radar.dataset_list_response import DatasetListResponse +from cloudflare.types.radar.dataset_download_response import DatasetDownloadResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/test_entities.py b/tests/api_resources/radar/test_entities.py index fc22e4c3f65..656495e08a7 100644 --- a/tests/api_resources/radar/test_entities.py +++ b/tests/api_resources/radar/test_entities.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.radar import EntityGetResponse +from cloudflare.types.radar.entity_get_response import EntityGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/test_netflows.py b/tests/api_resources/radar/test_netflows.py index 79002a4a227..fc8550d43b1 100644 --- a/tests/api_resources/radar/test_netflows.py +++ b/tests/api_resources/radar/test_netflows.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar import NetflowTimeseriesResponse +from cloudflare.types.radar.netflow_timeseries_response import NetflowTimeseriesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/test_ranking.py b/tests/api_resources/radar/test_ranking.py index 9aeac63890b..a2fed566e61 100644 --- a/tests/api_resources/radar/test_ranking.py +++ b/tests/api_resources/radar/test_ranking.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar import ( - RankingTopResponse, - RankingTimeseriesGroupsResponse, -) +from cloudflare.types.radar.ranking_top_response import RankingTopResponse +from cloudflare.types.radar.ranking_timeseries_groups_response import RankingTimeseriesGroupsResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/test_search.py b/tests/api_resources/radar/test_search.py index fbc22c27dff..2a3270d0761 100644 --- a/tests/api_resources/radar/test_search.py +++ b/tests/api_resources/radar/test_search.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.radar import SearchGlobalResponse +from cloudflare.types.radar.search_global_response import SearchGlobalResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/test_traffic_anomalies.py b/tests/api_resources/radar/test_traffic_anomalies.py index ab42d798d32..e4b6ac48ed1 100644 --- a/tests/api_resources/radar/test_traffic_anomalies.py +++ b/tests/api_resources/radar/test_traffic_anomalies.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar import TrafficAnomalyGetResponse +from cloudflare.types.radar.traffic_anomaly_get_response import TrafficAnomalyGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/traffic_anomalies/test_locations.py b/tests/api_resources/radar/traffic_anomalies/test_locations.py index ba164303c0b..db7461986c4 100644 --- a/tests/api_resources/radar/traffic_anomalies/test_locations.py +++ b/tests/api_resources/radar/traffic_anomalies/test_locations.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.traffic_anomalies import LocationGetResponse +from cloudflare.types.radar.traffic_anomalies.location_get_response import LocationGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/radar/verified_bots/test_top.py b/tests/api_resources/radar/verified_bots/test_top.py index 8ed74c070bd..76b20f090c3 100644 --- a/tests/api_resources/radar/verified_bots/test_top.py +++ b/tests/api_resources/radar/verified_bots/test_top.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.verified_bots import ( - TopBotsResponse, - TopCategoriesResponse, -) +from cloudflare.types.radar.verified_bots.top_bots_response import TopBotsResponse +from cloudflare.types.radar.verified_bots.top_categories_response import TopCategoriesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/registrar/test_domains.py b/tests/api_resources/registrar/test_domains.py index 69435a7178b..a405f94ec25 100644 --- a/tests/api_resources/registrar/test_domains.py +++ b/tests/api_resources/registrar/test_domains.py @@ -10,7 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.registrar import DomainGetResponse, DomainListResponse, DomainUpdateResponse +from cloudflare.types.registrar.domain import Domain +from cloudflare.types.registrar.domain_get_response import DomainGetResponse +from cloudflare.types.registrar.domain_update_response import DomainUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -88,7 +90,7 @@ def test_method_list(self, client: Cloudflare) -> None: domain = client.registrar.domains.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[DomainListResponse], domain, path=["response"]) + assert_matches_type(SyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +102,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(SyncSinglePage[DomainListResponse], domain, path=["response"]) + assert_matches_type(SyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +114,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(SyncSinglePage[DomainListResponse], domain, path=["response"]) + assert_matches_type(SyncSinglePage[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -250,7 +252,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: domain = await async_client.registrar.domains.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[DomainListResponse], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +264,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(AsyncSinglePage[DomainListResponse], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -274,7 +276,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(AsyncSinglePage[DomainListResponse], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/request_tracers/test_traces.py b/tests/api_resources/request_tracers/test_traces.py index a8deb3bbce2..b62bb594f36 100644 --- a/tests/api_resources/request_tracers/test_traces.py +++ b/tests/api_resources/request_tracers/test_traces.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.request_tracers import TraceCreateResponse +from cloudflare.types.request_tracers.trace_create_response import TraceCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,17 +21,17 @@ class TestTraces: @parametrize def test_method_create(self, client: Cloudflare) -> None: trace = client.request_tracers.traces.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", method="PUT", url="https://some.zone/some_path", ) - assert_matches_type(TraceCreateResponse, trace, path=["response"]) + assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"]) @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: trace = client.request_tracers.traces.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", method="PUT", url="https://some.zone/some_path", body={ @@ -67,13 +67,13 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: protocol="HTTP/1.1", skip_response=True, ) - assert_matches_type(TraceCreateResponse, trace, path=["response"]) + assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.request_tracers.traces.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", method="PUT", url="https://some.zone/some_path", ) @@ -81,13 +81,13 @@ 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" trace = response.parse() - assert_matches_type(TraceCreateResponse, trace, path=["response"]) + assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.request_tracers.traces.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", method="PUT", url="https://some.zone/some_path", ) as response: @@ -95,16 +95,16 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" trace = response.parse() - assert_matches_type(TraceCreateResponse, trace, path=["response"]) + assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.request_tracers.traces.with_raw_response.create( - "", + account_id="", method="PUT", url="https://some.zone/some_path", ) @@ -117,17 +117,17 @@ class TestAsyncTraces: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: trace = await async_client.request_tracers.traces.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", method="PUT", url="https://some.zone/some_path", ) - assert_matches_type(TraceCreateResponse, trace, path=["response"]) + assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: trace = await async_client.request_tracers.traces.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", method="PUT", url="https://some.zone/some_path", body={ @@ -163,13 +163,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare protocol="HTTP/1.1", skip_response=True, ) - assert_matches_type(TraceCreateResponse, trace, path=["response"]) + assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.request_tracers.traces.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", method="PUT", url="https://some.zone/some_path", ) @@ -177,13 +177,13 @@ 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" trace = await response.parse() - assert_matches_type(TraceCreateResponse, trace, path=["response"]) + assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.request_tracers.traces.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", method="PUT", url="https://some.zone/some_path", ) as response: @@ -191,16 +191,16 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" trace = await response.parse() - assert_matches_type(TraceCreateResponse, trace, path=["response"]) + assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.request_tracers.traces.with_raw_response.create( - "", + account_id="", method="PUT", url="https://some.zone/some_path", ) diff --git a/tests/api_resources/rules/lists/test_bulk_operations.py b/tests/api_resources/rules/lists/test_bulk_operations.py index afc1fac33f2..c692c4c21a2 100644 --- a/tests/api_resources/rules/lists/test_bulk_operations.py +++ b/tests/api_resources/rules/lists/test_bulk_operations.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.rules.lists import BulkOperationGetResponse +from cloudflare.types.rules.lists.bulk_operation_get_response import BulkOperationGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/rules/lists/test_items.py b/tests/api_resources/rules/lists/test_items.py index c2efab25330..7b5888b8e83 100644 --- a/tests/api_resources/rules/lists/test_items.py +++ b/tests/api_resources/rules/lists/test_items.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncCursorPagination, AsyncCursorPagination -from cloudflare.types.rules.lists import ( - ItemGetResponse, - ItemCreateResponse, - ItemDeleteResponse, - ItemUpdateResponse, -) +from cloudflare.types.rules.lists.item_get_response import ItemGetResponse +from cloudflare.types.rules.lists.item_create_response import ItemCreateResponse +from cloudflare.types.rules.lists.item_delete_response import ItemDeleteResponse +from cloudflare.types.rules.lists.item_update_response import ItemUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/rules/test_lists.py b/tests/api_resources/rules/test_lists.py index a3284737579..928a53d89c3 100644 --- a/tests/api_resources/rules/test_lists.py +++ b/tests/api_resources/rules/test_lists.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.rules import ListsList, ListDeleteResponse +from cloudflare.types.rules.lists_list import ListsList +from cloudflare.types.rules.list_delete_response import ListDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -189,6 +190,7 @@ def test_method_delete(self, client: Cloudflare) -> None: list = client.rules.lists.delete( "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[ListDeleteResponse], list, path=["response"]) @@ -198,6 +200,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.rules.lists.with_raw_response.delete( "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -211,6 +214,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.rules.lists.with_streaming_response.delete( "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -227,12 +231,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.rules.lists.with_raw_response.delete( "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `list_id` but received ''"): client.rules.lists.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -462,6 +468,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: list = await async_client.rules.lists.delete( "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[ListDeleteResponse], list, path=["response"]) @@ -471,6 +478,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.rules.lists.with_raw_response.delete( "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -484,6 +492,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.rules.lists.with_streaming_response.delete( "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -500,12 +509,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.rules.lists.with_raw_response.delete( "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `list_id` but received ''"): await async_client.rules.lists.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/rulesets/phases/test_versions.py b/tests/api_resources/rulesets/phases/test_versions.py index 621104eb9da..e8db8adaf1e 100644 --- a/tests/api_resources/rulesets/phases/test_versions.py +++ b/tests/api_resources/rulesets/phases/test_versions.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Ruleset from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.rulesets.phases import VersionListResponse +from cloudflare.types.rulesets.ruleset import Ruleset +from cloudflare.types.rulesets.phases.version_get_response import VersionGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -65,7 +65,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -95,7 +95,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +121,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" version = response.parse() - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -136,7 +136,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -179,7 +179,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -189,7 +189,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +203,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +217,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -247,7 +247,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -258,7 +258,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +273,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" version = await response.parse() - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -288,7 +288,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rulesets/test_phases.py b/tests/api_resources/rulesets/test_phases.py index 114168a5d5e..043b1b5e3b4 100644 --- a/tests/api_resources/rulesets/test_phases.py +++ b/tests/api_resources/rulesets/test_phases.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Ruleset +from cloudflare.types.rulesets.phase_get_response import PhaseGetResponse +from cloudflare.types.rulesets.phase_update_response import PhaseUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,19 +23,17 @@ class TestPhases: def test_method_update(self, client: Cloudflare) -> None: phase = client.rulesets.phases.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: phase = client.rulesets.phases.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[ { "action": "block", @@ -92,14 +91,13 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: name="My ruleset", phase="http_request_firewall_custom", ) - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.rulesets.phases.with_raw_response.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -108,14 +106,13 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" phase = response.parse() - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.rulesets.phases.with_streaming_response.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -124,7 +121,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" phase = response.parse() - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) assert cast(Any, response.is_closed) is True @@ -134,7 +131,6 @@ 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.rulesets.phases.with_raw_response.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="", zone_id="string", @@ -143,7 +139,6 @@ 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.rulesets.phases.with_raw_response.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="", @@ -157,7 +152,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseGetResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize @@ -167,7 +162,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseGetResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize @@ -181,7 +176,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" phase = response.parse() - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseGetResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize @@ -195,7 +190,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" phase = response.parse() - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseGetResponse, phase, path=["response"]) assert cast(Any, response.is_closed) is True @@ -225,19 +220,17 @@ class TestAsyncPhases: async def test_method_update(self, async_client: AsyncCloudflare) -> None: phase = await async_client.rulesets.phases.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: phase = await async_client.rulesets.phases.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[ { "action": "block", @@ -295,14 +288,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare name="My ruleset", phase="http_request_firewall_custom", ) - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.phases.with_raw_response.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -311,14 +303,13 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" phase = await response.parse() - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.phases.with_streaming_response.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -327,7 +318,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" phase = await response.parse() - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) assert cast(Any, response.is_closed) is True @@ -337,7 +328,6 @@ 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.rulesets.phases.with_raw_response.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="", zone_id="string", @@ -346,7 +336,6 @@ 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.rulesets.phases.with_raw_response.update( "http_request_firewall_custom", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="", @@ -360,7 +349,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseGetResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize @@ -370,7 +359,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseGetResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize @@ -384,7 +373,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" phase = await response.parse() - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseGetResponse, phase, path=["response"]) @pytest.mark.skip() @parametrize @@ -398,7 +387,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" phase = await response.parse() - assert_matches_type(Ruleset, phase, path=["response"]) + assert_matches_type(PhaseGetResponse, phase, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rulesets/test_rules.py b/tests/api_resources/rulesets/test_rules.py index b508825c027..f8d39340c0b 100644 --- a/tests/api_resources/rulesets/test_rules.py +++ b/tests/api_resources/rulesets/test_rules.py @@ -9,7 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Ruleset +from cloudflare.types.rulesets.rule_edit_response import RuleEditResponse +from cloudflare.types.rulesets.rule_create_response import RuleCreateResponse +from cloudflare.types.rulesets.rule_delete_response import RuleDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +27,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +51,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +65,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" rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -77,7 +79,7 @@ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -113,11 +115,175 @@ def test_method_create_overload_2(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="challenge", + action_parameters={}, + description="Issue an Interactive Challenge if the visitor had not solved an Interactive Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_2(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_3(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="compress_response", + action_parameters={"algorithms": [{"name": "none"}]}, + description="Disable compression when address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_3(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_3(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_3(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_4(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> None: rule = client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -156,11 +322,11 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: + def test_raw_response_create_overload_4(self, client: Cloudflare) -> None: response = client.rulesets.rules.with_raw_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -170,11 +336,11 @@ 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" rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: + def test_streaming_response_create_overload_4(self, client: Cloudflare) -> None: with client.rulesets.rules.with_streaming_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -184,13 +350,13 @@ def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_create_overload_2(self, client: Cloudflare) -> None: + def test_path_params_create_overload_4(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): client.rulesets.rules.with_raw_response.create( "", @@ -214,35 +380,35 @@ def test_path_params_create_overload_2(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_method_create_overload_3(self, client: Cloudflare) -> None: + def test_method_create_overload_5(self, client: Cloudflare) -> None: rule = client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> None: + def test_method_create_with_all_params_overload_5(self, client: Cloudflare) -> None: rule = client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="log", + action="js_challenge", action_parameters={}, - description="Log when the IP address is not 1.1.1.1", + description="Issue a non-interactive Javascript Challenge if the visitor had not solved a Interactive Challenge, Managed Challenge, or Javascript Challenge prior to the request when the address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_create_overload_3(self, client: Cloudflare) -> None: + def test_raw_response_create_overload_5(self, client: Cloudflare) -> None: response = client.rulesets.rules.with_raw_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -252,11 +418,11 @@ 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" rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_create_overload_3(self, client: Cloudflare) -> None: + def test_streaming_response_create_overload_5(self, client: Cloudflare) -> None: with client.rulesets.rules.with_streaming_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -266,13 +432,13 @@ def test_streaming_response_create_overload_3(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_create_overload_3(self, client: Cloudflare) -> None: + def test_path_params_create_overload_5(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): client.rulesets.rules.with_raw_response.create( "", @@ -296,41 +462,35 @@ def test_path_params_create_overload_3(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_method_create_overload_4(self, client: Cloudflare) -> None: + def test_method_create_overload_6(self, client: Cloudflare) -> None: rule = client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> None: + def test_method_create_with_all_params_overload_6(self, client: Cloudflare) -> None: rule = client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="skip", - action_parameters={ - "phases": ["http_request_firewall_custom"], - "products": ["bic"], - "rules": {"4814384a9e5d4991b9815dcfc25d2f1f": ["8ac8bc2a661e475d940980f9317f28e1"]}, - "ruleset": "current", - "rulesets": ["4814384a9e5d4991b9815dcfc25d2f1f"], - }, - description="Skip the current ruleset when the IP address is not 1.1.1.1", + action="log", + action_parameters={}, + description="Log when the IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_create_overload_4(self, client: Cloudflare) -> None: + def test_raw_response_create_overload_6(self, client: Cloudflare) -> None: response = client.rulesets.rules.with_raw_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -340,11 +500,11 @@ 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" rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_create_overload_4(self, client: Cloudflare) -> None: + def test_streaming_response_create_overload_6(self, client: Cloudflare) -> None: with client.rulesets.rules.with_streaming_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -354,13 +514,13 @@ def test_streaming_response_create_overload_4(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_create_overload_4(self, client: Cloudflare) -> None: + def test_path_params_create_overload_6(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): client.rulesets.rules.with_raw_response.create( "", @@ -384,30 +544,4216 @@ def test_path_params_create_overload_4(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.delete( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", + def test_method_create_overload_7(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.delete( - "3a03d665bac047339bb530ecb439a90d", - ruleset_id="2f2feab2026849078ba485f918791bdc", + def test_method_create_with_all_params_overload_7(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="managed_challenge", + action_parameters={}, + description="Issue a Managed Challenge if the visitor had not solved a Managed Challenge or Interactive Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_7(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_7(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_7(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_8(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_8(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="redirect", + action_parameters={ + "from_list": { + "key": "http.request.full_uri", + "name": "list1", + }, + "from_value": { + "preserve_query_string": True, + "status_code": 301, + "target_url": {"value": "x"}, + }, + }, + description="Redirect when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_8(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_8(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_8(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_9(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_9(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="rewrite", + action_parameters={ + "headers": { + "client-http-version": { + "expression": "http.request.version", + "operation": "set", + } + }, + "uri": { + "path": {"expression": 'regex_replace(http.request.uri.path, "/bar$", "/baz")'}, + "query": {"expression": 'regex_replace(http.request.uri.query, "foo=bar", "")'}, + }, + }, + description="Add a header when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_9(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_9(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_9(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_10(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_10(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="route", + action_parameters={ + "host_header": "static.example.com", + "origin": { + "host": "static.example.com", + "port": 1, + }, + "sni": {"value": "static.example.com"}, + }, + description="Select origin server when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_10(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_10(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_10(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_11(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_11(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="score", + action_parameters={"increment": 3}, + description="Increment score when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_11(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_11(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_11(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_12(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_12(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="serve_error", + action_parameters={ + "content": '{"error": "1xxx error occurred"}\n', + "content_type": "application/json", + "status_code": 500, + }, + description="Serve a JSON response to api users on error", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_12(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_12(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_12(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_13(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_13(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="set_config", + action_parameters={ + "automatic_https_rewrites": True, + "autominify": { + "css": True, + "html": True, + "js": True, + }, + "bic": True, + "disable_apps": True, + "disable_zaraz": True, + "email_obfuscation": True, + "hotlink_protection": True, + "mirage": True, + "opportunistic_encryption": True, + "polish": "off", + "rocket_loader": True, + "security_level": "off", + "server_side_excludes": True, + "ssl": "off", + "sxg": True, + }, + description="Disable Zaraz when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_13(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_13(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_13(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_14(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_14(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="skip", + action_parameters={ + "phases": ["http_request_firewall_custom"], + "products": ["bic"], + "rules": {"4814384a9e5d4991b9815dcfc25d2f1f": ["8ac8bc2a661e475d940980f9317f28e1"]}, + "ruleset": "current", + "rulesets": ["4814384a9e5d4991b9815dcfc25d2f1f"], + }, + description="Skip the current ruleset when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_14(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_14(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_14(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_create_overload_15(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params_overload_15(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="set_cache_settings", + action_parameters={ + "additional_cacheable_ports": [0, 0, 0], + "browser_ttl": { + "default": 0, + "mode": "respect_origin", + }, + "cache": True, + "cache_key": { + "cache_by_device_type": True, + "cache_deception_armor": True, + "custom_key": { + "cookie": { + "check_presence": ["string", "string", "string"], + "include": ["string", "string", "string"], + }, + "header": { + "check_presence": ["string", "string", "string"], + "exclude_origin": True, + "include": ["string", "string", "string"], + }, + "host": {"resolved": True}, + "query_string": { + "exclude": { + "all": True, + "list": ["string", "string", "string"], + }, + "include": { + "all": True, + "list": ["string", "string", "string"], + }, + }, + "user": { + "device_type": True, + "geo": True, + "lang": True, + }, + }, + "ignore_query_strings_order": True, + }, + "cache_reserve": { + "eligible": True, + "min_file_size": 0, + }, + "edge_ttl": { + "default": 1, + "mode": "respect_origin", + "status_code_ttl": [ + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + ], + }, + "origin_cache_control": True, + "origin_error_page_passthru": True, + "read_timeout": 900, + "respect_strong_etags": True, + "serve_stale": {"disable_stale_while_updating": True}, + }, + description="Set cache settings when the hostname address is not example.com", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_overload_15(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_overload_15(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create_overload_15(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_delete_with_all_params(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.delete( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_1(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_1(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="block", + action_parameters={ + "response": { + "content": '{\n "success": false,\n "error": "you have been blocked"\n}', + "content_type": "application/json", + "status_code": 400, + } + }, + description="Block when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_1(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_1(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_1(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_2(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_2(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="challenge", + action_parameters={}, + description="Issue an Interactive Challenge if the visitor had not solved an Interactive Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_2(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_2(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_2(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_3(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_3(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="compress_response", + action_parameters={"algorithms": [{"name": "none"}]}, + description="Disable compression when address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_3(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_3(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_3(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_4(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_4(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="execute", + action_parameters={ + "id": "4814384a9e5d4991b9815dcfc25d2f1f", + "matched_data": {"public_key": "iGqBmyIUxuWt1rvxoAharN9FUXneUBxA/Y19PyyrEG0="}, + "overrides": { + "action": "log", + "categories": [ + { + "action": "log", + "category": "directory-traversal", + "enabled": True, + "sensitivity_level": "default", + } + ], + "enabled": True, + "rules": [ + { + "action": "log", + "enabled": True, + "id": "8ac8bc2a661e475d940980f9317f28e1", + "score_threshold": 0, + "sensitivity_level": "default", + } + ], + "sensitivity_level": "default", + }, + }, + description="Execute the OWASP ruleset when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_4(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_4(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_4(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_5(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_5(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="js_challenge", + action_parameters={}, + description="Issue a non-interactive Javascript Challenge if the visitor had not solved a Interactive Challenge, Managed Challenge, or Javascript Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_5(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_5(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_5(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_6(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_6(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="log", + action_parameters={}, + description="Log when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_6(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_6(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_6(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_7(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_7(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="managed_challenge", + action_parameters={}, + description="Issue a Managed Challenge if the visitor had not solved a Managed Challenge or Interactive Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_7(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_7(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_7(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_8(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_8(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="redirect", + action_parameters={ + "from_list": { + "key": "http.request.full_uri", + "name": "list1", + }, + "from_value": { + "preserve_query_string": True, + "status_code": 301, + "target_url": {"value": "x"}, + }, + }, + description="Redirect when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_8(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_8(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_8(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_9(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_9(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="rewrite", + action_parameters={ + "headers": { + "client-http-version": { + "expression": "http.request.version", + "operation": "set", + } + }, + "uri": { + "path": {"expression": 'regex_replace(http.request.uri.path, "/bar$", "/baz")'}, + "query": {"expression": 'regex_replace(http.request.uri.query, "foo=bar", "")'}, + }, + }, + description="Add a header when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_9(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_9(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_9(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_10(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_10(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="route", + action_parameters={ + "host_header": "static.example.com", + "origin": { + "host": "static.example.com", + "port": 1, + }, + "sni": {"value": "static.example.com"}, + }, + description="Select origin server when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_10(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_10(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_10(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_11(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_11(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="score", + action_parameters={"increment": 3}, + description="Increment score when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_11(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_11(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_11(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_12(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_12(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="serve_error", + action_parameters={ + "content": '{"error": "1xxx error occurred"}\n', + "content_type": "application/json", + "status_code": 500, + }, + description="Serve a JSON response to api users on error", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_12(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_12(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_12(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_13(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_13(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="set_config", + action_parameters={ + "automatic_https_rewrites": True, + "autominify": { + "css": True, + "html": True, + "js": True, + }, + "bic": True, + "disable_apps": True, + "disable_zaraz": True, + "email_obfuscation": True, + "hotlink_protection": True, + "mirage": True, + "opportunistic_encryption": True, + "polish": "off", + "rocket_loader": True, + "security_level": "off", + "server_side_excludes": True, + "ssl": "off", + "sxg": True, + }, + description="Disable Zaraz when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_13(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_13(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_13(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_14(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_14(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="skip", + action_parameters={ + "phases": ["http_request_firewall_custom"], + "products": ["bic"], + "rules": {"4814384a9e5d4991b9815dcfc25d2f1f": ["8ac8bc2a661e475d940980f9317f28e1"]}, + "ruleset": "current", + "rulesets": ["4814384a9e5d4991b9815dcfc25d2f1f"], + }, + description="Skip the current ruleset when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_14(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_14(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_14(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + def test_method_edit_overload_15(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_edit_with_all_params_overload_15(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="set_cache_settings", + action_parameters={ + "additional_cacheable_ports": [0, 0, 0], + "browser_ttl": { + "default": 0, + "mode": "respect_origin", + }, + "cache": True, + "cache_key": { + "cache_by_device_type": True, + "cache_deception_armor": True, + "custom_key": { + "cookie": { + "check_presence": ["string", "string", "string"], + "include": ["string", "string", "string"], + }, + "header": { + "check_presence": ["string", "string", "string"], + "exclude_origin": True, + "include": ["string", "string", "string"], + }, + "host": {"resolved": True}, + "query_string": { + "exclude": { + "all": True, + "list": ["string", "string", "string"], + }, + "include": { + "all": True, + "list": ["string", "string", "string"], + }, + }, + "user": { + "device_type": True, + "geo": True, + "lang": True, + }, + }, + "ignore_query_strings_order": True, + }, + "cache_reserve": { + "eligible": True, + "min_file_size": 0, + }, + "edge_ttl": { + "default": 1, + "mode": "respect_origin", + "status_code_ttl": [ + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + ], + }, + "origin_cache_control": True, + "origin_error_page_passthru": True, + "read_timeout": 900, + "respect_strong_etags": True, + "serve_stale": {"disable_stale_while_updating": True}, + }, + description="Set cache settings when the hostname address is not example.com", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_edit_overload_15(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_edit_overload_15(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_edit_overload_15(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + +class TestAsyncRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="block", + action_parameters={ + "response": { + "content": '{\n "success": false,\n "error": "you have been blocked"\n}', + "content_type": "application/json", + "status_code": 400, + } + }, + description="Block when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @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 `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="challenge", + action_parameters={}, + description="Issue an Interactive Challenge if the visitor had not solved an Interactive Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @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 `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="compress_response", + action_parameters={"algorithms": [{"name": "none"}]}, + description="Disable compression when address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_3(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_3(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_3(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_4(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="execute", + action_parameters={ + "id": "4814384a9e5d4991b9815dcfc25d2f1f", + "matched_data": {"public_key": "iGqBmyIUxuWt1rvxoAharN9FUXneUBxA/Y19PyyrEG0="}, + "overrides": { + "action": "log", + "categories": [ + { + "action": "log", + "category": "directory-traversal", + "enabled": True, + "sensitivity_level": "default", + } + ], + "enabled": True, + "rules": [ + { + "action": "log", + "enabled": True, + "id": "8ac8bc2a661e475d940980f9317f28e1", + "score_threshold": 0, + "sensitivity_level": "default", + } + ], + "sensitivity_level": "default", + }, + }, + description="Execute the OWASP ruleset when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_4(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_4(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_4(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_5(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_5(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="js_challenge", + action_parameters={}, + description="Issue a non-interactive Javascript Challenge if the visitor had not solved a Interactive Challenge, Managed Challenge, or Javascript Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_5(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_5(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_5(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_6(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_6(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="log", + action_parameters={}, + description="Log when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_6(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_6(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_6(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_7(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_7(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="managed_challenge", + action_parameters={}, + description="Issue a Managed Challenge if the visitor had not solved a Managed Challenge or Interactive Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_7(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_7(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_7(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_8(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_8(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="redirect", + action_parameters={ + "from_list": { + "key": "http.request.full_uri", + "name": "list1", + }, + "from_value": { + "preserve_query_string": True, + "status_code": 301, + "target_url": {"value": "x"}, + }, + }, + description="Redirect when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_8(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_8(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_8(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_9(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_9(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="rewrite", + action_parameters={ + "headers": { + "client-http-version": { + "expression": "http.request.version", + "operation": "set", + } + }, + "uri": { + "path": {"expression": 'regex_replace(http.request.uri.path, "/bar$", "/baz")'}, + "query": {"expression": 'regex_replace(http.request.uri.query, "foo=bar", "")'}, + }, + }, + description="Add a header when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_9(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_9(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_9(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_10(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_10(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="route", + action_parameters={ + "host_header": "static.example.com", + "origin": { + "host": "static.example.com", + "port": 1, + }, + "sni": {"value": "static.example.com"}, + }, + description="Select origin server when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_10(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_10(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_10(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_11(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_11(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="score", + action_parameters={"increment": 3}, + description="Increment score when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_11(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_11(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_11(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_12(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_12(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="serve_error", + action_parameters={ + "content": '{"error": "1xxx error occurred"}\n', + "content_type": "application/json", + "status_code": 500, + }, + description="Serve a JSON response to api users on error", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_12(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_12(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_12(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_13(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_13(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="set_config", + action_parameters={ + "automatic_https_rewrites": True, + "autominify": { + "css": True, + "html": True, + "js": True, + }, + "bic": True, + "disable_apps": True, + "disable_zaraz": True, + "email_obfuscation": True, + "hotlink_protection": True, + "mirage": True, + "opportunistic_encryption": True, + "polish": "off", + "rocket_loader": True, + "security_level": "off", + "server_side_excludes": True, + "ssl": "off", + "sxg": True, + }, + description="Disable Zaraz when IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_13(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_13(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_13(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_14(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_14(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="skip", + action_parameters={ + "phases": ["http_request_firewall_custom"], + "products": ["bic"], + "rules": {"4814384a9e5d4991b9815dcfc25d2f1f": ["8ac8bc2a661e475d940980f9317f28e1"]}, + "ruleset": "current", + "rulesets": ["4814384a9e5d4991b9815dcfc25d2f1f"], + }, + description="Skip the current ruleset when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_14(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_14(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_14(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_create_overload_15(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params_overload_15(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="set_cache_settings", + action_parameters={ + "additional_cacheable_ports": [0, 0, 0], + "browser_ttl": { + "default": 0, + "mode": "respect_origin", + }, + "cache": True, + "cache_key": { + "cache_by_device_type": True, + "cache_deception_armor": True, + "custom_key": { + "cookie": { + "check_presence": ["string", "string", "string"], + "include": ["string", "string", "string"], + }, + "header": { + "check_presence": ["string", "string", "string"], + "exclude_origin": True, + "include": ["string", "string", "string"], + }, + "host": {"resolved": True}, + "query_string": { + "exclude": { + "all": True, + "list": ["string", "string", "string"], + }, + "include": { + "all": True, + "list": ["string", "string", "string"], + }, + }, + "user": { + "device_type": True, + "geo": True, + "lang": True, + }, + }, + "ignore_query_strings_order": True, + }, + "cache_reserve": { + "eligible": True, + "min_file_size": 0, + }, + "edge_ttl": { + "default": 1, + "mode": "respect_origin", + "status_code_ttl": [ + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + ], + }, + "origin_cache_control": True, + "origin_error_page_passthru": True, + "read_timeout": 900, + "respect_strong_etags": True, + "serve_stale": {"disable_stale_while_updating": True}, + }, + description="Set cache settings when the hostname address is not example.com", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create_overload_15(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.delete( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.delete( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_edit_overload_1(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_edit_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="block", + action_parameters={ + "response": { + "content": '{\n "success": false,\n "error": "you have been blocked"\n}', + "content_type": "application/json", + "status_code": 400, + } + }, + description="Block when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_edit_overload_1(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_edit_overload_1(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_edit_overload_1(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_edit_overload_2(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_edit_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="challenge", + action_parameters={}, + description="Issue an Interactive Challenge if the visitor had not solved an Interactive Challenge prior to the request when the address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.delete( + async def test_raw_response_edit_overload_2(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -416,13 +4762,13 @@ 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" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.delete( + async def test_streaming_response_edit_overload_2(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -431,16 +4777,16 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: + async def test_path_params_edit_overload_2(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.delete( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="", account_id="string", @@ -448,7 +4794,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.rulesets.rules.with_raw_response.delete( + await async_client.rulesets.rules.with_raw_response.edit( "", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -456,7 +4802,7 @@ 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.rulesets.rules.with_raw_response.delete( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", @@ -464,7 +4810,7 @@ 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.rulesets.rules.with_raw_response.delete( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -473,44 +4819,38 @@ def test_path_params_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_method_edit_overload_1(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( + async def test_method_edit_overload_3(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_edit_with_all_params_overload_1(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( + async def test_method_edit_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="block", - action_parameters={ - "response": { - "content": '{\n "success": false,\n "error": "you have been blocked"\n}', - "content_type": "application/json", - "status_code": 400, - } - }, - description="Block when the IP address is not 1.1.1.1", + action="compress_response", + action_parameters={"algorithms": [{"name": "none"}]}, + description="Disable compression when address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_edit_overload_1(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.edit( + async def test_raw_response_edit_overload_3(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -519,13 +4859,13 @@ 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" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_edit_overload_1(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.edit( + async def test_streaming_response_edit_overload_3(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -534,16 +4874,16 @@ def test_streaming_response_edit_overload_1(self, client: Cloudflare) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_edit_overload_1(self, client: Cloudflare) -> None: + async def test_path_params_edit_overload_3(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="", account_id="string", @@ -551,7 +4891,7 @@ def test_path_params_edit_overload_1(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -559,7 +4899,7 @@ def test_path_params_edit_overload_1(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", @@ -567,7 +4907,7 @@ def test_path_params_edit_overload_1(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -576,19 +4916,19 @@ def test_path_params_edit_overload_1(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_method_edit_overload_2(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( + async def test_method_edit_overload_4(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_edit_with_all_params_overload_2(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( + async def test_method_edit_with_all_params_overload_4(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -627,12 +4967,12 @@ def test_method_edit_with_all_params_overload_2(self, client: Cloudflare) -> Non logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_edit_overload_2(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.edit( + async def test_raw_response_edit_overload_4(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -641,13 +4981,13 @@ 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" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_edit_overload_2(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.edit( + async def test_streaming_response_edit_overload_4(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -656,16 +4996,16 @@ def test_streaming_response_edit_overload_2(self, client: Cloudflare) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_edit_overload_2(self, client: Cloudflare) -> None: + async def test_path_params_edit_overload_4(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="", account_id="string", @@ -673,7 +5013,7 @@ def test_path_params_edit_overload_2(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -681,7 +5021,7 @@ def test_path_params_edit_overload_2(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", @@ -689,7 +5029,7 @@ def test_path_params_edit_overload_2(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -698,38 +5038,38 @@ def test_path_params_edit_overload_2(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_method_edit_overload_3(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( + async def test_method_edit_overload_5(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_edit_with_all_params_overload_3(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( + async def test_method_edit_with_all_params_overload_5(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="log", + action="js_challenge", action_parameters={}, - description="Log when the IP address is not 1.1.1.1", + description="Issue a non-interactive Javascript Challenge if the visitor had not solved a Interactive Challenge, Managed Challenge, or Javascript Challenge prior to the request when the address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_edit_overload_3(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.edit( + async def test_raw_response_edit_overload_5(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -738,13 +5078,13 @@ 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" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_edit_overload_3(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.edit( + async def test_streaming_response_edit_overload_5(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -753,16 +5093,16 @@ def test_streaming_response_edit_overload_3(self, client: Cloudflare) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_edit_overload_3(self, client: Cloudflare) -> None: + async def test_path_params_edit_overload_5(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="", account_id="string", @@ -770,7 +5110,7 @@ def test_path_params_edit_overload_3(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -778,7 +5118,7 @@ def test_path_params_edit_overload_3(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", @@ -786,7 +5126,7 @@ def test_path_params_edit_overload_3(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -795,44 +5135,38 @@ def test_path_params_edit_overload_3(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_method_edit_overload_4(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( + async def test_method_edit_overload_6(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_edit_with_all_params_overload_4(self, client: Cloudflare) -> None: - rule = client.rulesets.rules.edit( + async def test_method_edit_with_all_params_overload_6(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="skip", - action_parameters={ - "phases": ["http_request_firewall_custom"], - "products": ["bic"], - "rules": {"4814384a9e5d4991b9815dcfc25d2f1f": ["8ac8bc2a661e475d940980f9317f28e1"]}, - "ruleset": "current", - "rulesets": ["4814384a9e5d4991b9815dcfc25d2f1f"], - }, - description="Skip the current ruleset when the IP address is not 1.1.1.1", + action="log", + action_parameters={}, + description="Log when the IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_edit_overload_4(self, client: Cloudflare) -> None: - response = client.rulesets.rules.with_raw_response.edit( + async def test_raw_response_edit_overload_6(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -841,13 +5175,13 @@ 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" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_edit_overload_4(self, client: Cloudflare) -> None: - with client.rulesets.rules.with_streaming_response.edit( + async def test_streaming_response_edit_overload_6(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -856,16 +5190,16 @@ def test_streaming_response_edit_overload_4(self, client: Cloudflare) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_edit_overload_4(self, client: Cloudflare) -> None: + async def test_path_params_edit_overload_6(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="", account_id="string", @@ -873,7 +5207,7 @@ def test_path_params_edit_overload_4(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -881,7 +5215,7 @@ def test_path_params_edit_overload_4(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", @@ -889,56 +5223,49 @@ def test_path_params_edit_overload_4(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.rulesets.rules.with_raw_response.edit( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="", ) - -class TestAsyncRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip() @parametrize - async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + async def test_method_edit_overload_7(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + async def test_method_edit_with_all_params_overload_7(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="block", - action_parameters={ - "response": { - "content": '{\n "success": false,\n "error": "you have been blocked"\n}', - "content_type": "application/json", - "status_code": 400, - } - }, - description="Block when the IP address is not 1.1.1.1", + action="managed_challenge", + action_parameters={}, + description="Issue a Managed Challenge if the visitor had not solved a Managed Challenge or Interactive Challenge prior to the request when the address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + async def test_raw_response_edit_overload_7(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) @@ -946,13 +5273,14 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.create( - "2f2feab2026849078ba485f918791bdc", + async def test_streaming_response_edit_overload_7(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) as response: @@ -960,92 +5288,91 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_7(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( "", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="", ) @pytest.mark.skip() @parametrize - async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + async def test_method_edit_overload_8(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", - account_id="string", - zone_id="string", - id="3a03d665bac047339bb530ecb439a90d", - action="execute", - action_parameters={ - "id": "4814384a9e5d4991b9815dcfc25d2f1f", - "matched_data": {"public_key": "iGqBmyIUxuWt1rvxoAharN9FUXneUBxA/Y19PyyrEG0="}, - "overrides": { - "action": "log", - "categories": [ - { - "action": "log", - "category": "directory-traversal", - "enabled": True, - "sensitivity_level": "default", - } - ], - "enabled": True, - "rules": [ - { - "action": "log", - "enabled": True, - "id": "8ac8bc2a661e475d940980f9317f28e1", - "score_threshold": 0, - "sensitivity_level": "default", - } - ], - "sensitivity_level": "default", + @parametrize + async def test_method_edit_with_all_params_overload_8(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="redirect", + action_parameters={ + "from_list": { + "key": "http.request.full_uri", + "name": "list1", + }, + "from_value": { + "preserve_query_string": True, + "status_code": 301, + "target_url": {"value": "x"}, }, }, - description="Execute the OWASP ruleset when the IP address is not 1.1.1.1", + description="Redirect when IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + async def test_raw_response_edit_overload_8(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) @@ -1053,13 +5380,14 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.create( - "2f2feab2026849078ba485f918791bdc", + async def test_streaming_response_edit_overload_8(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) as response: @@ -1067,67 +5395,92 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_8(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( "", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="", ) @pytest.mark.skip() @parametrize - async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + async def test_method_edit_overload_9(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_create_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + async def test_method_edit_with_all_params_overload_9(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="log", - action_parameters={}, - description="Log when the IP address is not 1.1.1.1", + action="rewrite", + action_parameters={ + "headers": { + "client-http-version": { + "expression": "http.request.version", + "operation": "set", + } + }, + "uri": { + "path": {"expression": 'regex_replace(http.request.uri.path, "/bar$", "/baz")'}, + "query": {"expression": 'regex_replace(http.request.uri.query, "foo=bar", "")'}, + }, + }, + description="Add a header when the IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_create_overload_3(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + async def test_raw_response_edit_overload_9(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) @@ -1135,13 +5488,14 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_3(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.create( - "2f2feab2026849078ba485f918791bdc", + async def test_streaming_response_edit_overload_9(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) as response: @@ -1149,73 +5503,88 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_create_overload_3(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_9(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( "", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="", ) @pytest.mark.skip() @parametrize - async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + async def test_method_edit_overload_10(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_create_with_all_params_overload_4(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + async def test_method_edit_with_all_params_overload_10(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="skip", + action="route", action_parameters={ - "phases": ["http_request_firewall_custom"], - "products": ["bic"], - "rules": {"4814384a9e5d4991b9815dcfc25d2f1f": ["8ac8bc2a661e475d940980f9317f28e1"]}, - "ruleset": "current", - "rulesets": ["4814384a9e5d4991b9815dcfc25d2f1f"], + "host_header": "static.example.com", + "origin": { + "host": "static.example.com", + "port": 1, + }, + "sni": {"value": "static.example.com"}, }, - description="Skip the current ruleset when the IP address is not 1.1.1.1", + description="Select origin server when IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_create_overload_4(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + async def test_raw_response_edit_overload_10(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) @@ -1223,13 +5592,14 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_4(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.create( - "2f2feab2026849078ba485f918791bdc", + async def test_streaming_response_edit_overload_10(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) as response: @@ -1237,60 +5607,79 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_create_overload_4(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_10(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + zone_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( "", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.create( - "2f2feab2026849078ba485f918791bdc", + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="", ) @pytest.mark.skip() @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.delete( + async def test_method_edit_overload_11(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.delete( + async def test_method_edit_with_all_params_overload_11(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="score", + action_parameters={"increment": 3}, + description="Increment score when the IP address is not 1.1.1.1", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rulesets.rules.with_raw_response.delete( + async def test_raw_response_edit_overload_11(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -1300,12 +5689,12 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.rulesets.rules.with_streaming_response.delete( + async def test_streaming_response_edit_overload_11(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -1315,15 +5704,15 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_11(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.delete( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="", account_id="string", @@ -1331,7 +5720,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - await async_client.rulesets.rules.with_raw_response.delete( + await async_client.rulesets.rules.with_raw_response.edit( "", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -1339,7 +5728,7 @@ 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.rulesets.rules.with_raw_response.delete( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="", @@ -1347,7 +5736,7 @@ 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.rulesets.rules.with_raw_response.delete( + await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", @@ -1356,43 +5745,41 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize - async def test_method_edit_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_edit_overload_12(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_edit_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_method_edit_with_all_params_overload_12(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="block", + action="serve_error", action_parameters={ - "response": { - "content": '{\n "success": false,\n "error": "you have been blocked"\n}', - "content_type": "application/json", - "status_code": 400, - } + "content": '{"error": "1xxx error occurred"}\n', + "content_type": "application/json", + "status_code": 500, }, - description="Block when the IP address is not 1.1.1.1", + description="Serve a JSON response to api users on error", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_edit_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_edit_overload_12(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", @@ -1403,11 +5790,11 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_edit_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_edit_overload_12(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", @@ -1418,13 +5805,13 @@ async def test_streaming_response_edit_overload_1(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_edit_overload_1(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_12(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", @@ -1459,62 +5846,57 @@ async def test_path_params_edit_overload_1(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_method_edit_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_method_edit_overload_13(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_edit_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_method_edit_with_all_params_overload_13(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="execute", + action="set_config", action_parameters={ - "id": "4814384a9e5d4991b9815dcfc25d2f1f", - "matched_data": {"public_key": "iGqBmyIUxuWt1rvxoAharN9FUXneUBxA/Y19PyyrEG0="}, - "overrides": { - "action": "log", - "categories": [ - { - "action": "log", - "category": "directory-traversal", - "enabled": True, - "sensitivity_level": "default", - } - ], - "enabled": True, - "rules": [ - { - "action": "log", - "enabled": True, - "id": "8ac8bc2a661e475d940980f9317f28e1", - "score_threshold": 0, - "sensitivity_level": "default", - } - ], - "sensitivity_level": "default", + "automatic_https_rewrites": True, + "autominify": { + "css": True, + "html": True, + "js": True, }, + "bic": True, + "disable_apps": True, + "disable_zaraz": True, + "email_obfuscation": True, + "hotlink_protection": True, + "mirage": True, + "opportunistic_encryption": True, + "polish": "off", + "rocket_loader": True, + "security_level": "off", + "server_side_excludes": True, + "ssl": "off", + "sxg": True, }, - description="Execute the OWASP ruleset when the IP address is not 1.1.1.1", + description="Disable Zaraz when IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_edit_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_edit_overload_13(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", @@ -1525,11 +5907,11 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_edit_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_edit_overload_13(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", @@ -1540,13 +5922,13 @@ async def test_streaming_response_edit_overload_2(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_edit_overload_2(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_13(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", @@ -1581,37 +5963,43 @@ async def test_path_params_edit_overload_2(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_method_edit_overload_3(self, async_client: AsyncCloudflare) -> None: + async def test_method_edit_overload_14(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_edit_with_all_params_overload_3(self, async_client: AsyncCloudflare) -> None: + async def test_method_edit_with_all_params_overload_14(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="log", - action_parameters={}, - description="Log when the IP address is not 1.1.1.1", + action="skip", + action_parameters={ + "phases": ["http_request_firewall_custom"], + "products": ["bic"], + "rules": {"4814384a9e5d4991b9815dcfc25d2f1f": ["8ac8bc2a661e475d940980f9317f28e1"]}, + "ruleset": "current", + "rulesets": ["4814384a9e5d4991b9815dcfc25d2f1f"], + }, + description="Skip the current ruleset when the IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_edit_overload_3(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_edit_overload_14(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", @@ -1622,11 +6010,11 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_edit_overload_3(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_edit_overload_14(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", @@ -1637,13 +6025,13 @@ async def test_streaming_response_edit_overload_3(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_edit_overload_3(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_14(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", @@ -1678,43 +6066,115 @@ async def test_path_params_edit_overload_3(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_method_edit_overload_4(self, async_client: AsyncCloudflare) -> None: + async def test_method_edit_overload_15(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_edit_with_all_params_overload_4(self, async_client: AsyncCloudflare) -> None: + async def test_method_edit_with_all_params_overload_15(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", zone_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="skip", + action="set_cache_settings", action_parameters={ - "phases": ["http_request_firewall_custom"], - "products": ["bic"], - "rules": {"4814384a9e5d4991b9815dcfc25d2f1f": ["8ac8bc2a661e475d940980f9317f28e1"]}, - "ruleset": "current", - "rulesets": ["4814384a9e5d4991b9815dcfc25d2f1f"], + "additional_cacheable_ports": [0, 0, 0], + "browser_ttl": { + "default": 0, + "mode": "respect_origin", + }, + "cache": True, + "cache_key": { + "cache_by_device_type": True, + "cache_deception_armor": True, + "custom_key": { + "cookie": { + "check_presence": ["string", "string", "string"], + "include": ["string", "string", "string"], + }, + "header": { + "check_presence": ["string", "string", "string"], + "exclude_origin": True, + "include": ["string", "string", "string"], + }, + "host": {"resolved": True}, + "query_string": { + "exclude": { + "all": True, + "list": ["string", "string", "string"], + }, + "include": { + "all": True, + "list": ["string", "string", "string"], + }, + }, + "user": { + "device_type": True, + "geo": True, + "lang": True, + }, + }, + "ignore_query_strings_order": True, + }, + "cache_reserve": { + "eligible": True, + "min_file_size": 0, + }, + "edge_ttl": { + "default": 1, + "mode": "respect_origin", + "status_code_ttl": [ + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + { + "status_code_range": { + "from": 0, + "to": 0, + }, + "status_code_value": 0, + "value": 0, + }, + ], + }, + "origin_cache_control": True, + "origin_error_page_passthru": True, + "read_timeout": 900, + "respect_strong_etags": True, + "serve_stale": {"disable_stale_while_updating": True}, }, - description="Skip the current ruleset when the IP address is not 1.1.1.1", + description="Set cache settings when the hostname address is not example.com", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, ref="my_ref", ) - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_edit_overload_4(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_edit_overload_15(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", @@ -1725,11 +6185,11 @@ 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" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_edit_overload_4(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_edit_overload_15(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.edit( "3a03d665bac047339bb530ecb439a90d", ruleset_id="2f2feab2026849078ba485f918791bdc", @@ -1740,13 +6200,13 @@ async def test_streaming_response_edit_overload_4(self, async_client: AsyncCloud assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Ruleset, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_edit_overload_4(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_edit_overload_15(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.rules.with_raw_response.edit( "3a03d665bac047339bb530ecb439a90d", diff --git a/tests/api_resources/rulesets/test_versions.py b/tests/api_resources/rulesets/test_versions.py index 59d53feb980..10a620f81c8 100644 --- a/tests/api_resources/rulesets/test_versions.py +++ b/tests/api_resources/rulesets/test_versions.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Ruleset from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.rulesets import VersionListResponse +from cloudflare.types.rulesets.ruleset import Ruleset +from cloudflare.types.rulesets.version_get_response import VersionGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -65,7 +65,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -191,7 +191,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -202,7 +202,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +217,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" version = response.parse() - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -232,7 +232,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -283,7 +283,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -293,7 +293,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -307,7 +307,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -321,7 +321,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -447,7 +447,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -458,7 +458,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -473,7 +473,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" version = await response.parse() - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) @pytest.mark.skip() @parametrize @@ -488,7 +488,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(Ruleset, version, path=["response"]) + assert_matches_type(VersionGetResponse, version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rulesets/versions/test_by_tag.py b/tests/api_resources/rulesets/versions/test_by_tag.py index e3632bf6314..029f0e86bcd 100644 --- a/tests/api_resources/rulesets/versions/test_by_tag.py +++ b/tests/api_resources/rulesets/versions/test_by_tag.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Ruleset +from cloudflare.types.rulesets.versions.by_tag_get_response import ByTagGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +26,7 @@ def test_method_get(self, client: Cloudflare) -> None: ruleset_id="2f2feab2026849078ba485f918791bdc", ruleset_version="1", ) - assert_matches_type(Ruleset, by_tag, path=["response"]) + assert_matches_type(ByTagGetResponse, by_tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +41,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" by_tag = response.parse() - assert_matches_type(Ruleset, by_tag, path=["response"]) + assert_matches_type(ByTagGetResponse, by_tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" by_tag = response.parse() - assert_matches_type(Ruleset, by_tag, path=["response"]) + assert_matches_type(ByTagGetResponse, by_tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -108,7 +108,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: ruleset_id="2f2feab2026849078ba485f918791bdc", ruleset_version="1", ) - assert_matches_type(Ruleset, by_tag, path=["response"]) + assert_matches_type(ByTagGetResponse, by_tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +123,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" by_tag = await response.parse() - assert_matches_type(Ruleset, by_tag, path=["response"]) + assert_matches_type(ByTagGetResponse, by_tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +138,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" by_tag = await response.parse() - assert_matches_type(Ruleset, by_tag, path=["response"]) + assert_matches_type(ByTagGetResponse, by_tag, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rum/test_rules.py b/tests/api_resources/rum/test_rules.py index 0250949fba5..42de0030a31 100644 --- a/tests/api_resources/rum/test_rules.py +++ b/tests/api_resources/rum/test_rules.py @@ -9,7 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.rum import RUMRule, RuleListResponse, RuleDeleteResponse +from cloudflare.types.rum.rum_rule import RUMRule +from cloudflare.types.rum.rule_list_response import RuleListResponse +from cloudflare.types.rum.rule_delete_response import RuleDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/rum/test_site_info.py b/tests/api_resources/rum/test_site_info.py index 3b611004ca6..44282f4fff2 100644 --- a/tests/api_resources/rum/test_site_info.py +++ b/tests/api_resources/rum/test_site_info.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.rum import ( - RUMSite, - SiteInfoDeleteResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.rum.site import Site +from cloudflare.types.rum.site_info_delete_response import SiteInfoDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: site_info = client.rum.site_info.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +36,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: host="example.com", zone_tag="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +48,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" site_info = response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +60,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +79,7 @@ def test_method_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +91,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: host="example.com", zone_tag="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +104,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,7 +117,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -144,7 +142,7 @@ def test_method_list(self, client: Cloudflare) -> None: site_info = client.rum.site_info.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[RUMSite], site_info, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +153,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=10, ) - assert_matches_type(SyncV4PagePaginationArray[RUMSite], site_info, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -167,7 +165,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RUMSite], site_info, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -179,7 +177,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RUMSite], site_info, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Site], site_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -250,7 +248,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -263,7 +261,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" site_info = response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -276,7 +274,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -305,7 +303,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: site_info = await async_client.rum.site_info.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -316,7 +314,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare host="example.com", zone_tag="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -328,7 +326,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" site_info = await response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -340,7 +338,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = await response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -359,7 +357,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -371,7 +369,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare host="example.com", zone_tag="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -384,7 +382,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = await response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -397,7 +395,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = await response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -422,7 +420,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: site_info = await async_client.rum.site_info.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[RUMSite], site_info, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -433,7 +431,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=10, ) - assert_matches_type(AsyncV4PagePaginationArray[RUMSite], site_info, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -445,7 +443,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RUMSite], site_info, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -457,7 +455,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RUMSite], site_info, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Site], site_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -528,7 +526,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -541,7 +539,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" site_info = await response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) @pytest.mark.skip() @parametrize @@ -554,7 +552,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" site_info = await response.parse() - assert_matches_type(Optional[RUMSite], site_info, path=["response"]) + assert_matches_type(Optional[Site], site_info, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/secondary_dns/test_acls.py b/tests/api_resources/secondary_dns/test_acls.py index 81e4b8297c0..3ad485b79c3 100644 --- a/tests/api_resources/secondary_dns/test_acls.py +++ b/tests/api_resources/secondary_dns/test_acls.py @@ -3,14 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.secondary_dns import SecondaryDNSACL, ACLDeleteResponse +from cloudflare.types.secondary_dns.acl import ACL +from cloudflare.types.secondary_dns.acl_delete_response import ACLDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="01a7362d577a6c3019a474fd6f485823", body={}, ) - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +39,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" acl = response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +52,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -73,7 +74,7 @@ def test_method_update(self, client: Cloudflare) -> None: ip_range="192.0.2.53/28", name="my-acl-1", ) - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,7 +89,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +104,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -132,7 +133,7 @@ def test_method_list(self, client: Cloudflare) -> None: acl = client.secondary_dns.acls.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SyncSinglePage[SecondaryDNSACL], acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -144,7 +145,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(SyncSinglePage[SecondaryDNSACL], acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +157,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(SyncSinglePage[SecondaryDNSACL], acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -174,8 +175,9 @@ def test_method_delete(self, client: Cloudflare) -> None: acl = client.secondary_dns.acls.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(Optional[ACLDeleteResponse], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -183,12 +185,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.secondary_dns.acls.with_raw_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(Optional[ACLDeleteResponse], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,12 +199,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.secondary_dns.acls.with_streaming_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(Optional[ACLDeleteResponse], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -212,12 +216,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.secondary_dns.acls.with_raw_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_id` but received ''"): client.secondary_dns.acls.with_raw_response.delete( "", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) @pytest.mark.skip() @@ -227,7 +233,7 @@ def test_method_get(self, client: Cloudflare) -> None: "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -240,7 +246,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" acl = response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -253,7 +259,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -283,7 +289,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="01a7362d577a6c3019a474fd6f485823", body={}, ) - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -296,7 +302,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" acl = await response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -309,7 +315,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -331,7 +337,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: ip_range="192.0.2.53/28", name="my-acl-1", ) - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -346,7 +352,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -361,7 +367,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -390,7 +396,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: acl = await async_client.secondary_dns.acls.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(AsyncSinglePage[SecondaryDNSACL], acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -402,7 +408,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(AsyncSinglePage[SecondaryDNSACL], acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -414,7 +420,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(AsyncSinglePage[SecondaryDNSACL], acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -432,8 +438,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: acl = await async_client.secondary_dns.acls.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(Optional[ACLDeleteResponse], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -441,12 +448,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.secondary_dns.acls.with_raw_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(Optional[ACLDeleteResponse], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -454,12 +462,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.secondary_dns.acls.with_streaming_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(Optional[ACLDeleteResponse], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -470,12 +479,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.secondary_dns.acls.with_raw_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_id` but received ''"): await async_client.secondary_dns.acls.with_raw_response.delete( "", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) @pytest.mark.skip() @@ -485,7 +496,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -498,7 +509,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" acl = await response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -511,7 +522,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(SecondaryDNSACL, acl, path=["response"]) + assert_matches_type(Optional[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/secondary_dns/test_force_axfr.py b/tests/api_resources/secondary_dns/test_force_axfr.py index 11d35c2f830..dee1012a5a1 100644 --- a/tests/api_resources/secondary_dns/test_force_axfr.py +++ b/tests/api_resources/secondary_dns/test_force_axfr.py @@ -21,6 +21,7 @@ class TestForceAXFR: def test_method_create(self, client: Cloudflare) -> None: force_axfr = client.secondary_dns.force_axfr.create( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert_matches_type(str, force_axfr, path=["response"]) @@ -29,6 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: def test_raw_response_create(self, client: Cloudflare) -> None: response = client.secondary_dns.force_axfr.with_raw_response.create( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True @@ -41,6 +43,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: def test_streaming_response_create(self, client: Cloudflare) -> None: with client.secondary_dns.force_axfr.with_streaming_response.create( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,6 +59,7 @@ 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.secondary_dns.force_axfr.with_raw_response.create( zone_id="", + body={}, ) @@ -67,6 +71,7 @@ class TestAsyncForceAXFR: async def test_method_create(self, async_client: AsyncCloudflare) -> None: force_axfr = await async_client.secondary_dns.force_axfr.create( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert_matches_type(str, force_axfr, path=["response"]) @@ -75,6 +80,7 @@ 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.secondary_dns.force_axfr.with_raw_response.create( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True @@ -87,6 +93,7 @@ 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.secondary_dns.force_axfr.with_streaming_response.create( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -102,4 +109,5 @@ 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.secondary_dns.force_axfr.with_raw_response.create( zone_id="", + body={}, ) diff --git a/tests/api_resources/secondary_dns/test_incoming.py b/tests/api_resources/secondary_dns/test_incoming.py index 565a200a7ba..849ca7e321a 100644 --- a/tests/api_resources/secondary_dns/test_incoming.py +++ b/tests/api_resources/secondary_dns/test_incoming.py @@ -3,18 +3,16 @@ 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.secondary_dns import ( - IncomingGetResponse, - IncomingCreateResponse, - IncomingDeleteResponse, - IncomingUpdateResponse, -) +from cloudflare.types.secondary_dns.incoming_get_response import IncomingGetResponse +from cloudflare.types.secondary_dns.incoming_create_response import IncomingCreateResponse +from cloudflare.types.secondary_dns.incoming_delete_response import IncomingDeleteResponse +from cloudflare.types.secondary_dns.incoming_update_response import IncomingUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="www.example.com.", peers=["23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"], ) - assert_matches_type(IncomingCreateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingCreateResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -46,7 +44,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" incoming = response.parse() - assert_matches_type(IncomingCreateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingCreateResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +59,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = response.parse() - assert_matches_type(IncomingCreateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingCreateResponse], incoming, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +83,7 @@ def test_method_update(self, client: Cloudflare) -> None: name="www.example.com.", peers=["23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"], ) - assert_matches_type(IncomingUpdateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingUpdateResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +98,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = response.parse() - assert_matches_type(IncomingUpdateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingUpdateResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +113,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = response.parse() - assert_matches_type(IncomingUpdateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingUpdateResponse], incoming, path=["response"]) assert cast(Any, response.is_closed) is True @@ -135,32 +133,35 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: incoming = client.secondary_dns.incoming.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) - assert_matches_type(IncomingDeleteResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingDeleteResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.secondary_dns.incoming.with_raw_response.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = response.parse() - assert_matches_type(IncomingDeleteResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingDeleteResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.secondary_dns.incoming.with_streaming_response.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = response.parse() - assert_matches_type(IncomingDeleteResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingDeleteResponse], incoming, path=["response"]) assert cast(Any, response.is_closed) is True @@ -170,6 +171,7 @@ 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.secondary_dns.incoming.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -178,7 +180,7 @@ def test_method_get(self, client: Cloudflare) -> None: incoming = client.secondary_dns.incoming.get( zone_id="269d8f4853475ca241c4e730be286b20", ) - assert_matches_type(IncomingGetResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingGetResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -190,7 +192,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" incoming = response.parse() - assert_matches_type(IncomingGetResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingGetResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -202,7 +204,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = response.parse() - assert_matches_type(IncomingGetResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingGetResponse], incoming, path=["response"]) assert cast(Any, response.is_closed) is True @@ -227,7 +229,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="www.example.com.", peers=["23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"], ) - assert_matches_type(IncomingCreateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingCreateResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +244,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" incoming = await response.parse() - assert_matches_type(IncomingCreateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingCreateResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -257,7 +259,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = await response.parse() - assert_matches_type(IncomingCreateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingCreateResponse], incoming, path=["response"]) assert cast(Any, response.is_closed) is True @@ -281,7 +283,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: name="www.example.com.", peers=["23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"], ) - assert_matches_type(IncomingUpdateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingUpdateResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -296,7 +298,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = await response.parse() - assert_matches_type(IncomingUpdateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingUpdateResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +313,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = await response.parse() - assert_matches_type(IncomingUpdateResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingUpdateResponse], incoming, path=["response"]) assert cast(Any, response.is_closed) is True @@ -331,32 +333,35 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: incoming = await async_client.secondary_dns.incoming.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) - assert_matches_type(IncomingDeleteResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingDeleteResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.secondary_dns.incoming.with_raw_response.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = await response.parse() - assert_matches_type(IncomingDeleteResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingDeleteResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.secondary_dns.incoming.with_streaming_response.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = await response.parse() - assert_matches_type(IncomingDeleteResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingDeleteResponse], incoming, path=["response"]) assert cast(Any, response.is_closed) is True @@ -366,6 +371,7 @@ 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.secondary_dns.incoming.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -374,7 +380,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: incoming = await async_client.secondary_dns.incoming.get( zone_id="269d8f4853475ca241c4e730be286b20", ) - assert_matches_type(IncomingGetResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingGetResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -386,7 +392,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" incoming = await response.parse() - assert_matches_type(IncomingGetResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingGetResponse], incoming, path=["response"]) @pytest.mark.skip() @parametrize @@ -398,7 +404,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" incoming = await response.parse() - assert_matches_type(IncomingGetResponse, incoming, path=["response"]) + assert_matches_type(Optional[IncomingGetResponse], incoming, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/secondary_dns/test_outgoing.py b/tests/api_resources/secondary_dns/test_outgoing.py index 48fd0ac4c31..161b2a57386 100644 --- a/tests/api_resources/secondary_dns/test_outgoing.py +++ b/tests/api_resources/secondary_dns/test_outgoing.py @@ -3,18 +3,16 @@ 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.secondary_dns import ( - OutgoingGetResponse, - OutgoingCreateResponse, - OutgoingDeleteResponse, - OutgoingUpdateResponse, -) +from cloudflare.types.secondary_dns.outgoing_get_response import OutgoingGetResponse +from cloudflare.types.secondary_dns.outgoing_create_response import OutgoingCreateResponse +from cloudflare.types.secondary_dns.outgoing_delete_response import OutgoingDeleteResponse +from cloudflare.types.secondary_dns.outgoing_update_response import OutgoingUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="www.example.com.", peers=["23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"], ) - assert_matches_type(OutgoingCreateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingCreateResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +42,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" outgoing = response.parse() - assert_matches_type(OutgoingCreateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingCreateResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +56,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = response.parse() - assert_matches_type(OutgoingCreateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingCreateResponse], outgoing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -80,7 +78,7 @@ def test_method_update(self, client: Cloudflare) -> None: name="www.example.com.", peers=["23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"], ) - assert_matches_type(OutgoingUpdateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingUpdateResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +92,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = response.parse() - assert_matches_type(OutgoingUpdateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingUpdateResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -108,7 +106,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = response.parse() - assert_matches_type(OutgoingUpdateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingUpdateResponse], outgoing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -127,32 +125,35 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: outgoing = client.secondary_dns.outgoing.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) - assert_matches_type(OutgoingDeleteResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingDeleteResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.secondary_dns.outgoing.with_raw_response.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = response.parse() - assert_matches_type(OutgoingDeleteResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingDeleteResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.secondary_dns.outgoing.with_streaming_response.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = response.parse() - assert_matches_type(OutgoingDeleteResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingDeleteResponse], outgoing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -162,6 +163,7 @@ 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.secondary_dns.outgoing.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -169,6 +171,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: def test_method_disable(self, client: Cloudflare) -> None: outgoing = client.secondary_dns.outgoing.disable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert_matches_type(str, outgoing, path=["response"]) @@ -177,6 +180,7 @@ def test_method_disable(self, client: Cloudflare) -> None: def test_raw_response_disable(self, client: Cloudflare) -> None: response = client.secondary_dns.outgoing.with_raw_response.disable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True @@ -189,6 +193,7 @@ def test_raw_response_disable(self, client: Cloudflare) -> None: def test_streaming_response_disable(self, client: Cloudflare) -> None: with client.secondary_dns.outgoing.with_streaming_response.disable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -204,6 +209,7 @@ def test_path_params_disable(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.secondary_dns.outgoing.with_raw_response.disable( zone_id="", + body={}, ) @pytest.mark.skip() @@ -211,6 +217,7 @@ def test_path_params_disable(self, client: Cloudflare) -> None: def test_method_enable(self, client: Cloudflare) -> None: outgoing = client.secondary_dns.outgoing.enable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert_matches_type(str, outgoing, path=["response"]) @@ -219,6 +226,7 @@ def test_method_enable(self, client: Cloudflare) -> None: def test_raw_response_enable(self, client: Cloudflare) -> None: response = client.secondary_dns.outgoing.with_raw_response.enable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True @@ -231,6 +239,7 @@ def test_raw_response_enable(self, client: Cloudflare) -> None: def test_streaming_response_enable(self, client: Cloudflare) -> None: with client.secondary_dns.outgoing.with_streaming_response.enable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -246,6 +255,7 @@ def test_path_params_enable(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.secondary_dns.outgoing.with_raw_response.enable( zone_id="", + body={}, ) @pytest.mark.skip() @@ -253,6 +263,7 @@ def test_path_params_enable(self, client: Cloudflare) -> None: def test_method_force_notify(self, client: Cloudflare) -> None: outgoing = client.secondary_dns.outgoing.force_notify( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert_matches_type(str, outgoing, path=["response"]) @@ -261,6 +272,7 @@ def test_method_force_notify(self, client: Cloudflare) -> None: def test_raw_response_force_notify(self, client: Cloudflare) -> None: response = client.secondary_dns.outgoing.with_raw_response.force_notify( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True @@ -273,6 +285,7 @@ def test_raw_response_force_notify(self, client: Cloudflare) -> None: def test_streaming_response_force_notify(self, client: Cloudflare) -> None: with client.secondary_dns.outgoing.with_streaming_response.force_notify( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -288,6 +301,7 @@ def test_path_params_force_notify(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.secondary_dns.outgoing.with_raw_response.force_notify( zone_id="", + body={}, ) @pytest.mark.skip() @@ -296,7 +310,7 @@ def test_method_get(self, client: Cloudflare) -> None: outgoing = client.secondary_dns.outgoing.get( zone_id="269d8f4853475ca241c4e730be286b20", ) - assert_matches_type(OutgoingGetResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingGetResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -308,7 +322,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" outgoing = response.parse() - assert_matches_type(OutgoingGetResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingGetResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -320,7 +334,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = response.parse() - assert_matches_type(OutgoingGetResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingGetResponse], outgoing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -344,7 +358,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="www.example.com.", peers=["23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"], ) - assert_matches_type(OutgoingCreateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingCreateResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -358,7 +372,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" outgoing = await response.parse() - assert_matches_type(OutgoingCreateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingCreateResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -372,7 +386,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = await response.parse() - assert_matches_type(OutgoingCreateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingCreateResponse], outgoing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -394,7 +408,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: name="www.example.com.", peers=["23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"], ) - assert_matches_type(OutgoingUpdateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingUpdateResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -408,7 +422,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = await response.parse() - assert_matches_type(OutgoingUpdateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingUpdateResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -422,7 +436,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = await response.parse() - assert_matches_type(OutgoingUpdateResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingUpdateResponse], outgoing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -441,32 +455,35 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: outgoing = await async_client.secondary_dns.outgoing.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) - assert_matches_type(OutgoingDeleteResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingDeleteResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.secondary_dns.outgoing.with_raw_response.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = await response.parse() - assert_matches_type(OutgoingDeleteResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingDeleteResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.secondary_dns.outgoing.with_streaming_response.delete( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = await response.parse() - assert_matches_type(OutgoingDeleteResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingDeleteResponse], outgoing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -476,6 +493,7 @@ 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.secondary_dns.outgoing.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -483,6 +501,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_disable(self, async_client: AsyncCloudflare) -> None: outgoing = await async_client.secondary_dns.outgoing.disable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert_matches_type(str, outgoing, path=["response"]) @@ -491,6 +510,7 @@ async def test_method_disable(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_disable(self, async_client: AsyncCloudflare) -> None: response = await async_client.secondary_dns.outgoing.with_raw_response.disable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True @@ -503,6 +523,7 @@ async def test_raw_response_disable(self, async_client: AsyncCloudflare) -> None async def test_streaming_response_disable(self, async_client: AsyncCloudflare) -> None: async with async_client.secondary_dns.outgoing.with_streaming_response.disable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -518,6 +539,7 @@ async def test_path_params_disable(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.secondary_dns.outgoing.with_raw_response.disable( zone_id="", + body={}, ) @pytest.mark.skip() @@ -525,6 +547,7 @@ async def test_path_params_disable(self, async_client: AsyncCloudflare) -> None: async def test_method_enable(self, async_client: AsyncCloudflare) -> None: outgoing = await async_client.secondary_dns.outgoing.enable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert_matches_type(str, outgoing, path=["response"]) @@ -533,6 +556,7 @@ async def test_method_enable(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_enable(self, async_client: AsyncCloudflare) -> None: response = await async_client.secondary_dns.outgoing.with_raw_response.enable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True @@ -545,6 +569,7 @@ async def test_raw_response_enable(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_enable(self, async_client: AsyncCloudflare) -> None: async with async_client.secondary_dns.outgoing.with_streaming_response.enable( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -560,6 +585,7 @@ async def test_path_params_enable(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.secondary_dns.outgoing.with_raw_response.enable( zone_id="", + body={}, ) @pytest.mark.skip() @@ -567,6 +593,7 @@ async def test_path_params_enable(self, async_client: AsyncCloudflare) -> None: async def test_method_force_notify(self, async_client: AsyncCloudflare) -> None: outgoing = await async_client.secondary_dns.outgoing.force_notify( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert_matches_type(str, outgoing, path=["response"]) @@ -575,6 +602,7 @@ async def test_method_force_notify(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_force_notify(self, async_client: AsyncCloudflare) -> None: response = await async_client.secondary_dns.outgoing.with_raw_response.force_notify( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) assert response.is_closed is True @@ -587,6 +615,7 @@ async def test_raw_response_force_notify(self, async_client: AsyncCloudflare) -> async def test_streaming_response_force_notify(self, async_client: AsyncCloudflare) -> None: async with async_client.secondary_dns.outgoing.with_streaming_response.force_notify( zone_id="269d8f4853475ca241c4e730be286b20", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -602,6 +631,7 @@ async def test_path_params_force_notify(self, async_client: AsyncCloudflare) -> with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.secondary_dns.outgoing.with_raw_response.force_notify( zone_id="", + body={}, ) @pytest.mark.skip() @@ -610,7 +640,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: outgoing = await async_client.secondary_dns.outgoing.get( zone_id="269d8f4853475ca241c4e730be286b20", ) - assert_matches_type(OutgoingGetResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingGetResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -622,7 +652,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" outgoing = await response.parse() - assert_matches_type(OutgoingGetResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingGetResponse], outgoing, path=["response"]) @pytest.mark.skip() @parametrize @@ -634,7 +664,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" outgoing = await response.parse() - assert_matches_type(OutgoingGetResponse, outgoing, path=["response"]) + assert_matches_type(Optional[OutgoingGetResponse], outgoing, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/secondary_dns/test_peers.py b/tests/api_resources/secondary_dns/test_peers.py index ac16741dc7a..5b42901b1a2 100644 --- a/tests/api_resources/secondary_dns/test_peers.py +++ b/tests/api_resources/secondary_dns/test_peers.py @@ -3,14 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.secondary_dns import SecondaryDNSPeer, PeerDeleteResponse +from cloudflare.types.secondary_dns.peer import Peer +from cloudflare.types.secondary_dns.peer_delete_response import PeerDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="01a7362d577a6c3019a474fd6f485823", body={}, ) - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +39,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" peer = response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +52,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +73,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="01a7362d577a6c3019a474fd6f485823", name="my-peer-1", ) - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +87,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: port=53, tsig_id="69cd1e104af3e6ed3cb344f263fd0d5a", ) - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +101,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -114,7 +115,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -141,7 +142,7 @@ def test_method_list(self, client: Cloudflare) -> None: peer = client.secondary_dns.peers.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) + assert_matches_type(SyncSinglePage[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -153,7 +154,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(SyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) + assert_matches_type(SyncSinglePage[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -165,7 +166,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(SyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) + assert_matches_type(SyncSinglePage[Peer], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -183,8 +184,9 @@ def test_method_delete(self, client: Cloudflare) -> None: peer = client.secondary_dns.peers.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) - assert_matches_type(PeerDeleteResponse, peer, path=["response"]) + assert_matches_type(Optional[PeerDeleteResponse], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -192,12 +194,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.secondary_dns.peers.with_raw_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(PeerDeleteResponse, peer, path=["response"]) + assert_matches_type(Optional[PeerDeleteResponse], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,12 +208,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.secondary_dns.peers.with_streaming_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(PeerDeleteResponse, peer, path=["response"]) + assert_matches_type(Optional[PeerDeleteResponse], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -221,12 +225,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.secondary_dns.peers.with_raw_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `peer_id` but received ''"): client.secondary_dns.peers.with_raw_response.delete( "", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) @pytest.mark.skip() @@ -236,7 +242,7 @@ def test_method_get(self, client: Cloudflare) -> None: "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,7 +255,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" peer = response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +268,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -292,7 +298,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="01a7362d577a6c3019a474fd6f485823", body={}, ) - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -305,7 +311,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" peer = await response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -318,7 +324,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +345,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="01a7362d577a6c3019a474fd6f485823", name="my-peer-1", ) - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -353,7 +359,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare port=53, tsig_id="69cd1e104af3e6ed3cb344f263fd0d5a", ) - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -367,7 +373,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -381,7 +387,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -408,7 +414,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: peer = await async_client.secondary_dns.peers.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(AsyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) + assert_matches_type(AsyncSinglePage[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -420,7 +426,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(AsyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) + assert_matches_type(AsyncSinglePage[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -432,7 +438,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(AsyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) + assert_matches_type(AsyncSinglePage[Peer], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -450,8 +456,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: peer = await async_client.secondary_dns.peers.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) - assert_matches_type(PeerDeleteResponse, peer, path=["response"]) + assert_matches_type(Optional[PeerDeleteResponse], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -459,12 +466,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.secondary_dns.peers.with_raw_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(PeerDeleteResponse, peer, path=["response"]) + assert_matches_type(Optional[PeerDeleteResponse], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -472,12 +480,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.secondary_dns.peers.with_streaming_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(PeerDeleteResponse, peer, path=["response"]) + assert_matches_type(Optional[PeerDeleteResponse], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -488,12 +497,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.secondary_dns.peers.with_raw_response.delete( "23ff594956f20c2a721606e94745a8aa", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `peer_id` but received ''"): await async_client.secondary_dns.peers.with_raw_response.delete( "", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) @pytest.mark.skip() @@ -503,7 +514,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "23ff594956f20c2a721606e94745a8aa", account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -516,7 +527,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" peer = await response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -529,7 +540,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(SecondaryDNSPeer, peer, path=["response"]) + assert_matches_type(Optional[Peer], peer, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/secondary_dns/test_tsigs.py b/tests/api_resources/secondary_dns/test_tsigs.py index b80d8acaf5e..95e6828e389 100644 --- a/tests/api_resources/secondary_dns/test_tsigs.py +++ b/tests/api_resources/secondary_dns/test_tsigs.py @@ -3,14 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.secondary_dns import SecondaryDNSTSIG, TSIGDeleteResponse +from cloudflare.types.secondary_dns.tsig import TSIG +from cloudflare.types.secondary_dns.tsig_delete_response import TSIGDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="tsig.customer.cf.", secret="caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c", ) - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +43,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" tsig = response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +58,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,7 +83,7 @@ def test_method_update(self, client: Cloudflare) -> None: name="tsig.customer.cf.", secret="caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c", ) - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +99,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -114,7 +115,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -145,7 +146,7 @@ def test_method_list(self, client: Cloudflare) -> None: tsig = client.secondary_dns.tsigs.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) + assert_matches_type(SyncSinglePage[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -157,7 +158,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(SyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) + assert_matches_type(SyncSinglePage[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -169,7 +170,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(SyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) + assert_matches_type(SyncSinglePage[TSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,8 +188,9 @@ def test_method_delete(self, client: Cloudflare) -> None: tsig = client.secondary_dns.tsigs.delete( "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) - assert_matches_type(TSIGDeleteResponse, tsig, path=["response"]) + assert_matches_type(Optional[TSIGDeleteResponse], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,12 +198,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.secondary_dns.tsigs.with_raw_response.delete( "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(TSIGDeleteResponse, tsig, path=["response"]) + assert_matches_type(Optional[TSIGDeleteResponse], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -209,12 +212,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.secondary_dns.tsigs.with_streaming_response.delete( "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(TSIGDeleteResponse, tsig, path=["response"]) + assert_matches_type(Optional[TSIGDeleteResponse], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -225,12 +229,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.secondary_dns.tsigs.with_raw_response.delete( "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tsig_id` but received ''"): client.secondary_dns.tsigs.with_raw_response.delete( "", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) @pytest.mark.skip() @@ -240,7 +246,7 @@ def test_method_get(self, client: Cloudflare) -> None: "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -253,7 +259,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" tsig = response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -266,7 +272,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -298,7 +304,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="tsig.customer.cf.", secret="caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c", ) - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -313,7 +319,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" tsig = await response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -328,7 +334,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -353,7 +359,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: name="tsig.customer.cf.", secret="caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c", ) - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -369,7 +375,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -385,7 +391,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -416,7 +422,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: tsig = await async_client.secondary_dns.tsigs.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(AsyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) + assert_matches_type(AsyncSinglePage[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -428,7 +434,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(AsyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) + assert_matches_type(AsyncSinglePage[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -440,7 +446,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(AsyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) + assert_matches_type(AsyncSinglePage[TSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -458,8 +464,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: tsig = await async_client.secondary_dns.tsigs.delete( "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) - assert_matches_type(TSIGDeleteResponse, tsig, path=["response"]) + assert_matches_type(Optional[TSIGDeleteResponse], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -467,12 +474,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.secondary_dns.tsigs.with_raw_response.delete( "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(TSIGDeleteResponse, tsig, path=["response"]) + assert_matches_type(Optional[TSIGDeleteResponse], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -480,12 +488,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.secondary_dns.tsigs.with_streaming_response.delete( "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(TSIGDeleteResponse, tsig, path=["response"]) + assert_matches_type(Optional[TSIGDeleteResponse], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -496,12 +505,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.secondary_dns.tsigs.with_raw_response.delete( "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tsig_id` but received ''"): await async_client.secondary_dns.tsigs.with_raw_response.delete( "", account_id="01a7362d577a6c3019a474fd6f485823", + body={}, ) @pytest.mark.skip() @@ -511,7 +522,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "69cd1e104af3e6ed3cb344f263fd0d5a", account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -524,7 +535,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" tsig = await response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -537,7 +548,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(SecondaryDNSTSIG, tsig, path=["response"]) + assert_matches_type(Optional[TSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/snippets/test_rules.py b/tests/api_resources/snippets/test_rules.py index 83e10168142..0a54c1b008c 100644 --- a/tests/api_resources/snippets/test_rules.py +++ b/tests/api_resources/snippets/test_rules.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.snippets import RuleListResponse, RuleUpdateResponse +from cloudflare.types.snippets.rule_list_response import RuleListResponse +from cloudflare.types.snippets.rule_update_response import RuleUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/spectrum/analytics/aggregates/test_currents.py b/tests/api_resources/spectrum/analytics/aggregates/test_currents.py index 637e44bfece..93e2b964a2a 100644 --- a/tests/api_resources/spectrum/analytics/aggregates/test_currents.py +++ b/tests/api_resources/spectrum/analytics/aggregates/test_currents.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.spectrum.analytics.aggregates import CurrentGetResponse +from cloudflare.types.spectrum.analytics.aggregates.current_get_response import CurrentGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/spectrum/analytics/events/test_bytimes.py b/tests/api_resources/spectrum/analytics/events/test_bytimes.py index 9afdcf9b72a..969bfefbfd0 100644 --- a/tests/api_resources/spectrum/analytics/events/test_bytimes.py +++ b/tests/api_resources/spectrum/analytics/events/test_bytimes.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.spectrum.analytics.events import BytimeGetResponse +from cloudflare.types.spectrum.analytics.events.bytime_get_response import BytimeGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/spectrum/analytics/events/test_summaries.py b/tests/api_resources/spectrum/analytics/events/test_summaries.py index 5f19bf08707..9b81d31b467 100644 --- a/tests/api_resources/spectrum/analytics/events/test_summaries.py +++ b/tests/api_resources/spectrum/analytics/events/test_summaries.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.spectrum.analytics.events import SummaryGetResponse +from cloudflare.types.spectrum.analytics.events.summary_get_response import SummaryGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/spectrum/test_apps.py b/tests/api_resources/spectrum/test_apps.py index 8659482ce66..ebd8c1e2746 100644 --- a/tests/api_resources/spectrum/test_apps.py +++ b/tests/api_resources/spectrum/test_apps.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.spectrum import ( - AppGetResponse, - AppCreateResponse, - AppDeleteResponse, - AppUpdateResponse, -) +from cloudflare.types.spectrum.app_get_response import AppGetResponse +from cloudflare.types.spectrum.app_create_response import AppCreateResponse +from cloudflare.types.spectrum.app_delete_response import AppDeleteResponse +from cloudflare.types.spectrum.app_update_response import AppUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -270,6 +268,7 @@ def test_method_delete(self, client: Cloudflare) -> None: app = client.spectrum.apps.delete( "ea95132c15732412d22c1476fa83f27a", zone="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[AppDeleteResponse], app, path=["response"]) @@ -279,6 +278,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.spectrum.apps.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", zone="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -292,6 +292,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.spectrum.apps.with_streaming_response.delete( "ea95132c15732412d22c1476fa83f27a", zone="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -308,12 +309,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.spectrum.apps.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", zone="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.spectrum.apps.with_raw_response.delete( "", zone="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -323,7 +326,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", zone="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[AppGetResponse], app, path=["response"]) + assert_matches_type(AppGetResponse, app, path=["response"]) @pytest.mark.skip() @parametrize @@ -336,7 +339,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" app = response.parse() - assert_matches_type(Optional[AppGetResponse], app, path=["response"]) + assert_matches_type(AppGetResponse, app, path=["response"]) @pytest.mark.skip() @parametrize @@ -349,7 +352,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" app = response.parse() - assert_matches_type(Optional[AppGetResponse], app, path=["response"]) + assert_matches_type(AppGetResponse, app, path=["response"]) assert cast(Any, response.is_closed) is True @@ -619,6 +622,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: app = await async_client.spectrum.apps.delete( "ea95132c15732412d22c1476fa83f27a", zone="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[AppDeleteResponse], app, path=["response"]) @@ -628,6 +632,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.spectrum.apps.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", zone="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -641,6 +646,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.spectrum.apps.with_streaming_response.delete( "ea95132c15732412d22c1476fa83f27a", zone="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -657,12 +663,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.spectrum.apps.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", zone="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.spectrum.apps.with_raw_response.delete( "", zone="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -672,7 +680,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", zone="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[AppGetResponse], app, path=["response"]) + assert_matches_type(AppGetResponse, app, path=["response"]) @pytest.mark.skip() @parametrize @@ -685,7 +693,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" app = await response.parse() - assert_matches_type(Optional[AppGetResponse], app, path=["response"]) + assert_matches_type(AppGetResponse, app, path=["response"]) @pytest.mark.skip() @parametrize @@ -698,7 +706,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" app = await response.parse() - assert_matches_type(Optional[AppGetResponse], app, path=["response"]) + assert_matches_type(AppGetResponse, app, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/speed/test_availabilities.py b/tests/api_resources/speed/test_availabilities.py index 5c38c4e5ca1..47b6e89cc3d 100644 --- a/tests/api_resources/speed/test_availabilities.py +++ b/tests/api_resources/speed/test_availabilities.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.speed import ObservatoryAvailabilities +from cloudflare.types.speed.availability import Availability base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Cloudflare) -> None: availability = client.speed.availabilities.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ObservatoryAvailabilities], availability, path=["response"]) + assert_matches_type(Optional[Availability], availability, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" availability = response.parse() - assert_matches_type(Optional[ObservatoryAvailabilities], availability, path=["response"]) + assert_matches_type(Optional[Availability], availability, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" availability = response.parse() - assert_matches_type(Optional[ObservatoryAvailabilities], availability, path=["response"]) + assert_matches_type(Optional[Availability], availability, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: availability = await async_client.speed.availabilities.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ObservatoryAvailabilities], availability, path=["response"]) + assert_matches_type(Optional[Availability], availability, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" availability = await response.parse() - assert_matches_type(Optional[ObservatoryAvailabilities], availability, path=["response"]) + assert_matches_type(Optional[Availability], availability, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" availability = await response.parse() - assert_matches_type(Optional[ObservatoryAvailabilities], availability, path=["response"]) + assert_matches_type(Optional[Availability], availability, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/speed/test_pages.py b/tests/api_resources/speed/test_pages.py index cee5ec5833e..6fbcf9fde3b 100644 --- a/tests/api_resources/speed/test_pages.py +++ b/tests/api_resources/speed/test_pages.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.speed import PageListResponse +from cloudflare.types.speed.page_list_response import PageListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/speed/test_schedule.py b/tests/api_resources/speed/test_schedule.py index 99d2657e184..4806abe3b57 100644 --- a/tests/api_resources/speed/test_schedule.py +++ b/tests/api_resources/speed/test_schedule.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.speed import ScheduleCreateResponse +from cloudflare.types.speed.schedule_create_response import ScheduleCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/speed/test_tests.py b/tests/api_resources/speed/test_tests.py index 8cd7b1dec63..6ee2a270944 100644 --- a/tests/api_resources/speed/test_tests.py +++ b/tests/api_resources/speed/test_tests.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.speed import ( - TestListResponse, - TestDeleteResponse, - ObservatoryPageTest, -) +from cloudflare.types.speed.test import Test +from cloudflare.types.speed.test_list_response import TestListResponse +from cloudflare.types.speed.test_delete_response import TestDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: "example.com", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +36,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", region="us-central1", ) - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +49,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" test = response.parse() - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +62,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" test = response.parse() - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -217,7 +215,7 @@ def test_method_get(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", url="example.com", ) - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -231,7 +229,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" test = response.parse() - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -245,7 +243,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" test = response.parse() - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -284,7 +282,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "example.com", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -294,7 +292,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare zone_id="023e105f4ecef8ad9ca31a8372d0c353", region="us-central1", ) - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -307,7 +305,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" test = await response.parse() - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -320,7 +318,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" test = await response.parse() - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -473,7 +471,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", url="example.com", ) - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -487,7 +485,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" test = await response.parse() - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) @pytest.mark.skip() @parametrize @@ -501,7 +499,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" test = await response.parse() - assert_matches_type(Optional[ObservatoryPageTest], test, path=["response"]) + assert_matches_type(Optional[Test], test, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/ssl/certificate_packs/test_order.py b/tests/api_resources/ssl/certificate_packs/test_order.py index 5ad50e00c71..d50810563ee 100644 --- a/tests/api_resources/ssl/certificate_packs/test_order.py +++ b/tests/api_resources/ssl/certificate_packs/test_order.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.ssl.certificate_packs import OrderCreateResponse +from cloudflare.types.ssl.certificate_packs.order_create_response import OrderCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/ssl/certificate_packs/test_quota.py b/tests/api_resources/ssl/certificate_packs/test_quota.py index 22d983db7f1..8d9e3d161a0 100644 --- a/tests/api_resources/ssl/certificate_packs/test_quota.py +++ b/tests/api_resources/ssl/certificate_packs/test_quota.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.ssl.certificate_packs import QuotaGetResponse +from cloudflare.types.ssl.certificate_packs.quota_get_response import QuotaGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/ssl/test_analyze.py b/tests/api_resources/ssl/test_analyze.py index ce96ca2df0c..4eaa1a711c4 100644 --- a/tests/api_resources/ssl/test_analyze.py +++ b/tests/api_resources/ssl/test_analyze.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.ssl import AnalyzeCreateResponse +from cloudflare.types.ssl.analyze_create_response import AnalyzeCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/ssl/test_certificate_packs.py b/tests/api_resources/ssl/test_certificate_packs.py index 20180cc88f5..ae9070a08c5 100644 --- a/tests/api_resources/ssl/test_certificate_packs.py +++ b/tests/api_resources/ssl/test_certificate_packs.py @@ -9,12 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.ssl import ( - CertificatePackGetResponse, - CertificatePackEditResponse, - CertificatePackDeleteResponse, -) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.ssl.certificate_pack_get_response import CertificatePackGetResponse +from cloudflare.types.ssl.certificate_pack_edit_response import CertificatePackEditResponse +from cloudflare.types.ssl.certificate_pack_delete_response import CertificatePackDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -79,6 +77,7 @@ def test_method_delete(self, client: Cloudflare) -> None: certificate_pack = client.ssl.certificate_packs.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CertificatePackDeleteResponse, certificate_pack, path=["response"]) @@ -88,6 +87,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.ssl.certificate_packs.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -101,6 +101,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.ssl.certificate_packs.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -117,12 +118,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.ssl.certificate_packs.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_pack_id` but received ''"): client.ssl.certificate_packs.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -131,6 +134,7 @@ def test_method_edit(self, client: Cloudflare) -> None: certificate_pack = client.ssl.certificate_packs.edit( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CertificatePackEditResponse, certificate_pack, path=["response"]) @@ -140,6 +144,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.ssl.certificate_packs.with_raw_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -153,6 +158,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.ssl.certificate_packs.with_streaming_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -169,12 +175,14 @@ def test_path_params_edit(self, client: Cloudflare) -> None: client.ssl.certificate_packs.with_raw_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_pack_id` but received ''"): client.ssl.certificate_packs.with_raw_response.edit( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -290,6 +298,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: certificate_pack = await async_client.ssl.certificate_packs.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CertificatePackDeleteResponse, certificate_pack, path=["response"]) @@ -299,6 +308,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.ssl.certificate_packs.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -312,6 +322,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.ssl.certificate_packs.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -328,12 +339,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.ssl.certificate_packs.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_pack_id` but received ''"): await async_client.ssl.certificate_packs.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -342,6 +355,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: certificate_pack = await async_client.ssl.certificate_packs.edit( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CertificatePackEditResponse, certificate_pack, path=["response"]) @@ -351,6 +365,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.ssl.certificate_packs.with_raw_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -364,6 +379,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N async with async_client.ssl.certificate_packs.with_streaming_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -380,12 +396,14 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: await async_client.ssl.certificate_packs.with_raw_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_pack_id` but received ''"): await async_client.ssl.certificate_packs.with_raw_response.edit( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/ssl/test_recommendations.py b/tests/api_resources/ssl/test_recommendations.py index 31e42e5ed46..f164d6d5e05 100644 --- a/tests/api_resources/ssl/test_recommendations.py +++ b/tests/api_resources/ssl/test_recommendations.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.ssl import RecommendationGetResponse +from cloudflare.types.ssl.recommendation_get_response import RecommendationGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/ssl/test_verification.py b/tests/api_resources/ssl/test_verification.py index e93667109d1..aa8d2e07f04 100644 --- a/tests/api_resources/ssl/test_verification.py +++ b/tests/api_resources/ssl/test_verification.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.ssl import ( - VerificationGetResponse, - VerificationEditResponse, -) +from cloudflare.types.ssl.verification_get_response import VerificationGetResponse +from cloudflare.types.ssl.verification_edit_response import VerificationEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/ssl/universal/test_settings.py b/tests/api_resources/ssl/universal/test_settings.py index 027e556f715..2d808b06815 100644 --- a/tests/api_resources/ssl/universal/test_settings.py +++ b/tests/api_resources/ssl/universal/test_settings.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.ssl.universal import UniversalSSLSettings +from cloudflare.types.ssl.universal.universal_ssl_settings import UniversalSSLSettings base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/storage/test_analytics.py b/tests/api_resources/storage/test_analytics.py index 22f2f3db517..3b29ccbcaaf 100644 --- a/tests/api_resources/storage/test_analytics.py +++ b/tests/api_resources/storage/test_analytics.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.storage import ( - WorkersKVSchemasResult, - WorkersKVComponentsSchemasResult, -) +from cloudflare.types.storage.schema import Schema +from cloudflare.types.storage.components import Components base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: analytics = client.storage.analytics.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersKVSchemasResult, analytics, path=["response"]) + assert_matches_type(Schema, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +42,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: "until": parse_datetime("2019-01-02T03:20:00Z"), }, ) - assert_matches_type(WorkersKVSchemasResult, analytics, path=["response"]) + assert_matches_type(Schema, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +54,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" analytics = response.parse() - assert_matches_type(WorkersKVSchemasResult, analytics, path=["response"]) + assert_matches_type(Schema, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +66,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" analytics = response.parse() - assert_matches_type(WorkersKVSchemasResult, analytics, path=["response"]) + assert_matches_type(Schema, analytics, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,7 +84,7 @@ def test_method_stored(self, client: Cloudflare) -> None: analytics = client.storage.analytics.stored( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersKVComponentsSchemasResult, analytics, path=["response"]) + assert_matches_type(Components, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +101,7 @@ def test_method_stored_with_all_params(self, client: Cloudflare) -> None: "until": parse_datetime("2019-01-02T03:20:00Z"), }, ) - assert_matches_type(WorkersKVComponentsSchemasResult, analytics, path=["response"]) + assert_matches_type(Components, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +113,7 @@ def test_raw_response_stored(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" analytics = response.parse() - assert_matches_type(WorkersKVComponentsSchemasResult, analytics, path=["response"]) + assert_matches_type(Components, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +125,7 @@ def test_streaming_response_stored(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" analytics = response.parse() - assert_matches_type(WorkersKVComponentsSchemasResult, analytics, path=["response"]) + assert_matches_type(Components, analytics, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,7 +147,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: analytics = await async_client.storage.analytics.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersKVSchemasResult, analytics, path=["response"]) + assert_matches_type(Schema, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +164,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) "until": parse_datetime("2019-01-02T03:20:00Z"), }, ) - assert_matches_type(WorkersKVSchemasResult, analytics, path=["response"]) + assert_matches_type(Schema, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -178,7 +176,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" analytics = await response.parse() - assert_matches_type(WorkersKVSchemasResult, analytics, path=["response"]) + assert_matches_type(Schema, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -190,7 +188,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" analytics = await response.parse() - assert_matches_type(WorkersKVSchemasResult, analytics, path=["response"]) + assert_matches_type(Schema, analytics, path=["response"]) assert cast(Any, response.is_closed) is True @@ -208,7 +206,7 @@ async def test_method_stored(self, async_client: AsyncCloudflare) -> None: analytics = await async_client.storage.analytics.stored( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersKVComponentsSchemasResult, analytics, path=["response"]) + assert_matches_type(Components, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +223,7 @@ async def test_method_stored_with_all_params(self, async_client: AsyncCloudflare "until": parse_datetime("2019-01-02T03:20:00Z"), }, ) - assert_matches_type(WorkersKVComponentsSchemasResult, analytics, path=["response"]) + assert_matches_type(Components, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -237,7 +235,7 @@ async def test_raw_response_stored(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" analytics = await response.parse() - assert_matches_type(WorkersKVComponentsSchemasResult, analytics, path=["response"]) + assert_matches_type(Components, analytics, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,7 +247,7 @@ async def test_streaming_response_stored(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" analytics = await response.parse() - assert_matches_type(WorkersKVComponentsSchemasResult, analytics, path=["response"]) + assert_matches_type(Components, analytics, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/services/__init__.py b/tests/api_resources/stream/captions/__init__.py similarity index 100% rename from tests/api_resources/workers/services/__init__.py rename to tests/api_resources/stream/captions/__init__.py diff --git a/tests/api_resources/workers/services/environments/__init__.py b/tests/api_resources/stream/captions/language/__init__.py similarity index 100% rename from tests/api_resources/workers/services/environments/__init__.py rename to tests/api_resources/stream/captions/language/__init__.py diff --git a/tests/api_resources/stream/captions/language/test_vtt.py b/tests/api_resources/stream/captions/language/test_vtt.py new file mode 100644 index 00000000000..aeb7c403fee --- /dev/null +++ b/tests/api_resources/stream/captions/language/test_vtt.py @@ -0,0 +1,149 @@ +# 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 TestVtt: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + vtt = client.stream.captions.language.vtt.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + assert_matches_type(str, vtt, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.stream.captions.language.vtt.with_raw_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vtt = response.parse() + assert_matches_type(str, vtt, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.stream.captions.language.vtt.with_streaming_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vtt = response.parse() + assert_matches_type(str, vtt, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.stream.captions.language.vtt.with_raw_response.get( + "tr", + account_id="", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + client.stream.captions.language.vtt.with_raw_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): + client.stream.captions.language.vtt.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + +class TestAsyncVtt: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + vtt = await async_client.stream.captions.language.vtt.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + assert_matches_type(str, vtt, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.stream.captions.language.vtt.with_raw_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vtt = await response.parse() + assert_matches_type(str, vtt, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.stream.captions.language.vtt.with_streaming_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vtt = await response.parse() + assert_matches_type(str, vtt, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.stream.captions.language.vtt.with_raw_response.get( + "tr", + account_id="", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + await async_client.stream.captions.language.vtt.with_raw_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): + await async_client.stream.captions.language.vtt.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) diff --git a/tests/api_resources/stream/captions/test_language.py b/tests/api_resources/stream/captions/test_language.py new file mode 100644 index 00000000000..21ca8abb7f0 --- /dev/null +++ b/tests/api_resources/stream/captions/test_language.py @@ -0,0 +1,430 @@ +# 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.stream.caption import Caption + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLanguage: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + language = client.stream.captions.language.update( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) + assert_matches_type(Optional[Caption], language, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.stream.captions.language.with_raw_response.update( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = response.parse() + assert_matches_type(Optional[Caption], language, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.stream.captions.language.with_streaming_response.update( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = response.parse() + assert_matches_type(Optional[Caption], language, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.stream.captions.language.with_raw_response.update( + "tr", + account_id="", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + client.stream.captions.language.with_raw_response.update( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="", + file="@/Users/kyle/Desktop/tr.vtt", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): + client.stream.captions.language.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) + + @pytest.mark.skip() + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + language = client.stream.captions.language.delete( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) + assert_matches_type(str, language, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.stream.captions.language.with_raw_response.delete( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = response.parse() + assert_matches_type(str, language, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.stream.captions.language.with_streaming_response.delete( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = response.parse() + assert_matches_type(str, language, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.stream.captions.language.with_raw_response.delete( + "tr", + account_id="", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + client.stream.captions.language.with_raw_response.delete( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): + client.stream.captions.language.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + language = client.stream.captions.language.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + assert_matches_type(Optional[Caption], language, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.stream.captions.language.with_raw_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = response.parse() + assert_matches_type(Optional[Caption], language, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.stream.captions.language.with_streaming_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = response.parse() + assert_matches_type(Optional[Caption], language, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.stream.captions.language.with_raw_response.get( + "tr", + account_id="", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + client.stream.captions.language.with_raw_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): + client.stream.captions.language.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + +class TestAsyncLanguage: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + language = await async_client.stream.captions.language.update( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) + assert_matches_type(Optional[Caption], language, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.stream.captions.language.with_raw_response.update( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = await response.parse() + assert_matches_type(Optional[Caption], language, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.stream.captions.language.with_streaming_response.update( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = await response.parse() + assert_matches_type(Optional[Caption], language, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.stream.captions.language.with_raw_response.update( + "tr", + account_id="", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + await async_client.stream.captions.language.with_raw_response.update( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="", + file="@/Users/kyle/Desktop/tr.vtt", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): + await async_client.stream.captions.language.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + file="@/Users/kyle/Desktop/tr.vtt", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + language = await async_client.stream.captions.language.delete( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) + assert_matches_type(str, language, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.stream.captions.language.with_raw_response.delete( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = await response.parse() + assert_matches_type(str, language, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.stream.captions.language.with_streaming_response.delete( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = await response.parse() + assert_matches_type(str, language, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.stream.captions.language.with_raw_response.delete( + "tr", + account_id="", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + await async_client.stream.captions.language.with_raw_response.delete( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): + await async_client.stream.captions.language.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + body={}, + ) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + language = await async_client.stream.captions.language.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + assert_matches_type(Optional[Caption], language, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.stream.captions.language.with_raw_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = await response.parse() + assert_matches_type(Optional[Caption], language, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.stream.captions.language.with_streaming_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = await response.parse() + assert_matches_type(Optional[Caption], language, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.stream.captions.language.with_raw_response.get( + "tr", + account_id="", + identifier="ea95132c15732412d22c1476fa83f27a", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + await async_client.stream.captions.language.with_raw_response.get( + "tr", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): + await async_client.stream.captions.language.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + identifier="ea95132c15732412d22c1476fa83f27a", + ) diff --git a/tests/api_resources/stream/live_inputs/test_outputs.py b/tests/api_resources/stream/live_inputs/test_outputs.py index 486e740b60b..c65c0428bdf 100644 --- a/tests/api_resources/stream/live_inputs/test_outputs.py +++ b/tests/api_resources/stream/live_inputs/test_outputs.py @@ -3,14 +3,14 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.stream.live_inputs import StreamOutput +from cloudflare.types.stream.live_inputs.output import Output base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: stream_key="uzya-f19y-g2g9-a2ee-51j2", url="rtmp://a.rtmp.youtube.com/live2", ) - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: url="rtmp://a.rtmp.youtube.com/live2", enabled=True, ) - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,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" output = response.parse() - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +69,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -101,7 +101,7 @@ def test_method_update(self, client: Cloudflare) -> None: live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", enabled=True, ) - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +116,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +131,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -169,7 +169,7 @@ def test_method_list(self, client: Cloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[StreamOutput], output, path=["response"]) + assert_matches_type(SyncSinglePage[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +182,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(SyncSinglePage[StreamOutput], output, path=["response"]) + assert_matches_type(SyncSinglePage[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -195,7 +195,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(SyncSinglePage[StreamOutput], output, path=["response"]) + assert_matches_type(SyncSinglePage[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -221,6 +221,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) assert output is None @@ -231,6 +232,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) assert response.is_closed is True @@ -245,6 +247,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -262,6 +265,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `live_input_identifier` but received ''"): @@ -269,6 +273,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `output_identifier` but received ''"): @@ -276,6 +281,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) @@ -291,7 +297,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: stream_key="uzya-f19y-g2g9-a2ee-51j2", url="rtmp://a.rtmp.youtube.com/live2", ) - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -303,7 +309,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare url="rtmp://a.rtmp.youtube.com/live2", enabled=True, ) - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -318,7 +324,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" output = await response.parse() - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -333,7 +339,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -365,7 +371,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", enabled=True, ) - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -380,7 +386,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +401,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(StreamOutput, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -433,7 +439,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[StreamOutput], output, path=["response"]) + assert_matches_type(AsyncSinglePage[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -446,7 +452,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(AsyncSinglePage[StreamOutput], output, path=["response"]) + assert_matches_type(AsyncSinglePage[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -459,7 +465,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(AsyncSinglePage[StreamOutput], output, path=["response"]) + assert_matches_type(AsyncSinglePage[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -485,6 +491,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) assert output is None @@ -495,6 +502,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) assert response.is_closed is True @@ -509,6 +517,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -526,6 +535,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `live_input_identifier` but received ''"): @@ -533,6 +543,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `output_identifier` but received ''"): @@ -540,4 +551,5 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", + body={}, ) diff --git a/tests/api_resources/stream/test_audio_tracks.py b/tests/api_resources/stream/test_audio_tracks.py index ed0b79fd777..891eb6ea9e0 100644 --- a/tests/api_resources/stream/test_audio_tracks.py +++ b/tests/api_resources/stream/test_audio_tracks.py @@ -3,17 +3,15 @@ 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.stream import ( - StreamAudio, - AudioTrackGetResponse, - AudioTrackDeleteResponse, -) +from cloudflare.types.stream.audio import Audio +from cloudflare.types.stream.audio_track_get_response import AudioTrackGetResponse +from cloudflare.types.stream.audio_track_delete_response import AudioTrackDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", identifier="ea95132c15732412d22c1476fa83f27a", ) - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +41,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" audio_track = response.parse() - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +55,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +91,7 @@ def test_method_copy(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", label="director commentary", ) - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +102,7 @@ def test_method_copy_with_all_params(self, client: Cloudflare) -> None: label="director commentary", url="https://www.examplestorage.com/audio_file.mp3", ) - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +116,7 @@ def test_raw_response_copy(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -132,7 +130,7 @@ def test_streaming_response_copy(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +159,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", identifier="ea95132c15732412d22c1476fa83f27a", ) - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +171,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: default=True, label="director commentary", ) - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +185,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" audio_track = response.parse() - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +199,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -236,7 +234,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,7 +247,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" audio_track = response.parse() - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +260,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -293,7 +291,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", identifier="ea95132c15732412d22c1476fa83f27a", ) - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -307,7 +305,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" audio_track = await response.parse() - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -321,7 +319,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -357,7 +355,7 @@ async def test_method_copy(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", label="director commentary", ) - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -368,7 +366,7 @@ async def test_method_copy_with_all_params(self, async_client: AsyncCloudflare) label="director commentary", url="https://www.examplestorage.com/audio_file.mp3", ) - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -382,7 +380,7 @@ async def test_raw_response_copy(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -396,7 +394,7 @@ async def test_streaming_response_copy(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -425,7 +423,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", identifier="ea95132c15732412d22c1476fa83f27a", ) - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -437,7 +435,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) default=True, label="director commentary", ) - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -451,7 +449,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" audio_track = await response.parse() - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -465,7 +463,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(StreamAudio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -500,7 +498,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -513,7 +511,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" audio_track = await response.parse() - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -526,7 +524,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_captions.py b/tests/api_resources/stream/test_captions.py index a5370a76f4b..9afa84a290e 100644 --- a/tests/api_resources/stream/test_captions.py +++ b/tests/api_resources/stream/test_captions.py @@ -3,17 +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.stream import ( - CaptionGetResponse, - CaptionDeleteResponse, - CaptionUpdateResponse, -) +from cloudflare.types.stream.caption_get_response import CaptionGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,140 +17,6 @@ class TestCaptions: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - caption = client.stream.captions.update( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.stream.captions.with_raw_response.update( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - caption = response.parse() - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.stream.captions.with_streaming_response.update( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - caption = response.parse() - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.stream.captions.with_raw_response.update( - "tr", - account_id="", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.stream.captions.with_raw_response.update( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="", - file="@/Users/kyle/Desktop/tr.vtt", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): - client.stream.captions.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - caption = client.stream.captions.delete( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - ) - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.stream.captions.with_raw_response.delete( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - caption = response.parse() - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.stream.captions.with_streaming_response.delete( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - caption = response.parse() - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.stream.captions.with_raw_response.delete( - "tr", - account_id="", - identifier="ea95132c15732412d22c1476fa83f27a", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.stream.captions.with_raw_response.delete( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): - client.stream.captions.with_raw_response.delete( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - ) - @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: @@ -162,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -175,7 +37,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" caption = response.parse() - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +50,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = response.parse() - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -211,140 +73,6 @@ def test_path_params_get(self, client: Cloudflare) -> None: class TestAsyncCaptions: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - caption = await async_client.stream.captions.update( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.stream.captions.with_raw_response.update( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - caption = await response.parse() - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.stream.captions.with_streaming_response.update( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - caption = await response.parse() - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.stream.captions.with_raw_response.update( - "tr", - account_id="", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.stream.captions.with_raw_response.update( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="", - file="@/Users/kyle/Desktop/tr.vtt", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): - await async_client.stream.captions.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - file="@/Users/kyle/Desktop/tr.vtt", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - caption = await async_client.stream.captions.delete( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - ) - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.stream.captions.with_raw_response.delete( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - caption = await response.parse() - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.stream.captions.with_streaming_response.delete( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - caption = await response.parse() - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.stream.captions.with_raw_response.delete( - "tr", - account_id="", - identifier="ea95132c15732412d22c1476fa83f27a", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.stream.captions.with_raw_response.delete( - "tr", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"): - await async_client.stream.captions.with_raw_response.delete( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - identifier="ea95132c15732412d22c1476fa83f27a", - ) - @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: @@ -352,7 +80,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -365,7 +93,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" caption = await response.parse() - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -378,7 +106,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = await response.parse() - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_clip.py b/tests/api_resources/stream/test_clip.py index 7a39bd3d338..2a96300b3da 100644 --- a/tests/api_resources/stream/test_clip.py +++ b/tests/api_resources/stream/test_clip.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.stream import StreamClipping +from cloudflare.types.stream.clip import Clip base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: end_time_seconds=0, start_time_seconds=0, ) - assert_matches_type(StreamClipping, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +43,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(StreamClipping, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +58,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" clip = response.parse() - assert_matches_type(StreamClipping, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -73,7 +73,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" clip = response.parse() - assert_matches_type(StreamClipping, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) assert cast(Any, response.is_closed) is True @@ -101,7 +101,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: end_time_seconds=0, start_time_seconds=0, ) - assert_matches_type(StreamClipping, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +118,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(StreamClipping, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +133,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" clip = await response.parse() - assert_matches_type(StreamClipping, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -148,7 +148,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" clip = await response.parse() - assert_matches_type(StreamClipping, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_copy.py b/tests/api_resources/stream/test_copy.py index 84ecfc0a992..2aff75a9dea 100644 --- a/tests/api_resources/stream/test_copy.py +++ b/tests/api_resources/stream/test_copy.py @@ -3,14 +3,14 @@ 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 import StreamVideos from cloudflare._utils import parse_datetime +from cloudflare.types.stream.video import Video base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", url="https://example.com/myvideo.mp4", ) - assert_matches_type(StreamVideos, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +41,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(StreamVideos, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,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" copy = response.parse() - assert_matches_type(StreamVideos, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -67,7 +67,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" copy = response.parse() - assert_matches_type(StreamVideos, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -91,7 +91,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", url="https://example.com/myvideo.mp4", ) - assert_matches_type(StreamVideos, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(StreamVideos, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -120,7 +120,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" copy = await response.parse() - assert_matches_type(StreamVideos, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +133,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" copy = await response.parse() - assert_matches_type(StreamVideos, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_direct_upload.py b/tests/api_resources/stream/test_direct_upload.py index e01a1a24cf5..c28073f73e8 100644 --- a/tests/api_resources/stream/test_direct_upload.py +++ b/tests/api_resources/stream/test_direct_upload.py @@ -3,14 +3,14 @@ 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._utils import parse_datetime -from cloudflare.types.stream import DirectUploadCreateResponse +from cloudflare.types.stream.direct_upload_create_response import DirectUploadCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", max_duration_seconds=1, ) - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +42,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +55,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" direct_upload = response.parse() - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +68,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" direct_upload = response.parse() - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -92,7 +92,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", max_duration_seconds=1, ) - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -109,7 +109,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +122,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" direct_upload = await response.parse() - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -135,7 +135,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" direct_upload = await response.parse() - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_downloads.py b/tests/api_resources/stream/test_downloads.py index 6550b00db06..ed715f7aa37 100644 --- a/tests/api_resources/stream/test_downloads.py +++ b/tests/api_resources/stream/test_downloads.py @@ -3,13 +3,15 @@ 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.stream import DownloadGetResponse, DownloadCreateResponse, DownloadDeleteResponse +from cloudflare.types.stream.download_get_response import DownloadGetResponse +from cloudflare.types.stream.download_create_response import DownloadCreateResponse +from cloudflare.types.stream.download_delete_response import DownloadDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,8 +25,9 @@ def test_method_create(self, client: Cloudflare) -> None: download = client.stream.downloads.create( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,12 +35,13 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.stream.downloads.with_raw_response.create( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,12 +49,13 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.stream.downloads.with_streaming_response.create( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,12 +66,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.stream.downloads.with_raw_response.create( "ea95132c15732412d22c1476fa83f27a", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): client.stream.downloads.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -76,7 +83,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +96,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" download = response.parse() - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +109,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -128,7 +135,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -141,7 +148,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" download = response.parse() - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -154,7 +161,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -183,8 +190,9 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: download = await async_client.stream.downloads.create( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -192,12 +200,13 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.stream.downloads.with_raw_response.create( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,12 +214,13 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.stream.downloads.with_streaming_response.create( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -221,12 +231,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.stream.downloads.with_raw_response.create( "ea95132c15732412d22c1476fa83f27a", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): await async_client.stream.downloads.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -236,7 +248,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,7 +261,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" download = await response.parse() - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +274,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -288,7 +300,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -301,7 +313,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" download = await response.parse() - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -314,7 +326,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_keys.py b/tests/api_resources/stream/test_keys.py index 24e6e0af681..ceaa98aa080 100644 --- a/tests/api_resources/stream/test_keys.py +++ b/tests/api_resources/stream/test_keys.py @@ -3,13 +3,15 @@ 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.stream import StreamKeys, KeyGetResponse, KeyDeleteResponse +from cloudflare.types.stream.keys import Keys +from cloudflare.types.stream.key_get_response import KeyGetResponse +from cloudflare.types.stream.key_delete_response import KeyDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,32 +24,35 @@ class TestKeys: def test_method_create(self, client: Cloudflare) -> None: key = client.stream.keys.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(StreamKeys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.stream.keys.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(StreamKeys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.stream.keys.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(StreamKeys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -57,6 +62,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.stream.keys.with_raw_response.create( account_id="", + body={}, ) @pytest.mark.skip() @@ -65,8 +71,9 @@ def test_method_delete(self, client: Cloudflare) -> None: key = client.stream.keys.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -74,12 +81,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.stream.keys.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,12 +95,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.stream.keys.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -103,12 +112,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.stream.keys.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): client.stream.keys.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -117,7 +128,7 @@ def test_method_get(self, client: Cloudflare) -> None: key = client.stream.keys.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +140,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" key = response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -141,7 +152,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -162,32 +173,35 @@ class TestAsyncKeys: async def test_method_create(self, async_client: AsyncCloudflare) -> None: key = await async_client.stream.keys.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(StreamKeys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.stream.keys.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(StreamKeys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.stream.keys.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(StreamKeys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,6 +211,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.stream.keys.with_raw_response.create( account_id="", + body={}, ) @pytest.mark.skip() @@ -205,8 +220,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: key = await async_client.stream.keys.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -214,12 +230,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.stream.keys.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -227,12 +244,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.stream.keys.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -243,12 +261,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.stream.keys.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): await async_client.stream.keys.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -257,7 +277,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: key = await async_client.stream.keys.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -269,7 +289,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" key = await response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -281,7 +301,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_live_inputs.py b/tests/api_resources/stream/test_live_inputs.py index 4bdb29bce6c..9b3f0b4e00b 100644 --- a/tests/api_resources/stream/test_live_inputs.py +++ b/tests/api_resources/stream/test_live_inputs.py @@ -3,16 +3,14 @@ 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.stream import ( - StreamLiveInput, - LiveInputListResponse, -) +from cloudflare.types.stream.live_input import LiveInput +from cloudflare.types.stream.live_input_list_response import LiveInputListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: live_input = client.stream.live_inputs.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +41,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "timeout_seconds": 0, }, ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +53,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" live_input = response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -67,7 +65,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,7 +84,7 @@ def test_method_update(self, client: Cloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +102,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "timeout_seconds": 0, }, ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +115,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +128,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -155,7 +153,7 @@ def test_method_list(self, client: Cloudflare) -> None: live_input = client.stream.live_inputs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +162,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", include_counts=True, ) - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +174,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +186,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -206,6 +204,7 @@ def test_method_delete(self, client: Cloudflare) -> None: live_input = client.stream.live_inputs.delete( "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert live_input is None @@ -215,6 +214,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.stream.live_inputs.with_raw_response.delete( "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -228,6 +228,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.stream.live_inputs.with_streaming_response.delete( "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -244,12 +245,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.stream.live_inputs.with_raw_response.delete( "66be4bf738797e01e1fca35a7bdecdcd", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `live_input_identifier` but received ''"): client.stream.live_inputs.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -259,7 +262,7 @@ def test_method_get(self, client: Cloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -272,7 +275,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" live_input = response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +288,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -314,7 +317,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: live_input = await async_client.stream.live_inputs.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -331,7 +334,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "timeout_seconds": 0, }, ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -343,7 +346,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" live_input = await response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -355,7 +358,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -374,7 +377,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -392,7 +395,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "timeout_seconds": 0, }, ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -405,7 +408,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -418,7 +421,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -443,7 +446,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: live_input = await async_client.stream.live_inputs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -452,7 +455,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="023e105f4ecef8ad9ca31a8372d0c353", include_counts=True, ) - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -464,7 +467,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -476,7 +479,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -494,6 +497,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: live_input = await async_client.stream.live_inputs.delete( "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert live_input is None @@ -503,6 +507,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.stream.live_inputs.with_raw_response.delete( "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -516,6 +521,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.stream.live_inputs.with_streaming_response.delete( "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -532,12 +538,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.stream.live_inputs.with_raw_response.delete( "66be4bf738797e01e1fca35a7bdecdcd", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `live_input_identifier` but received ''"): await async_client.stream.live_inputs.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -547,7 +555,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -560,7 +568,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" live_input = await response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -573,7 +581,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(StreamLiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_token.py b/tests/api_resources/stream/test_token.py index e4202e63622..511470e6f7f 100644 --- a/tests/api_resources/stream/test_token.py +++ b/tests/api_resources/stream/test_token.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.stream import TokenCreateResponse +from cloudflare.types.stream.token_create_response import TokenCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +58,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: nbf=0, pem="LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBc284dnBvOFpEWXRkOUgzbWlPaW1qYXAzVXlVM0oyZ3kwTUYvN1R4blJuRnkwRHpDCkxqUk9naFZsQ0hPQmxsd3NVaE9GU0lyYnN4K05tUTdBeS90TFpXSGxuVGF3UWJ5WGZGOStJeDhVSnNlSHBGV1oKNVF5Z1JYd2liSjh1MVVsZ2xlcmZHMkpueldjVXpZTzEySktZN3doSkw1ajROMWgxZFJNUXQ5Q1pkZFlCQWRzOQpCdk02cjRFMDcxQkhQekhWeDMrUTI1VWtubGdUNXIwS3FiM1E1Y0dlTlBXY1JreW1ybkJEWWR0OXR4eFFMb1dPCllzNXdsMnVYWFVYL0VGcDMwajU0Nmp6czllWExLYlNDbjJjTDZFVE96Y2x3aG9DRGx2a2VQT05rUE9LMDVKNUMKTm1TdFdhMG9hV1VGRzM0MFl3cVVrWGt4OU9tNndXd1JldU1uU1FJREFRQUJBb0lCQUFJOHo1ck5kOEdtOGJBMgo1S3pxQjI1R2lOVENwbUNJeW53NXRJWHZTQmNHcEdydUcvdlN2WG9kVlFVSVY0TWdHQkVXUEFrVzdsNWVBcHI4CnA1ZFd5SkRXYTNkdklFSE9vSEpYU3dBYksxZzZEMTNVa2NkZ1EyRGpoNVhuWDhHZCtBY2c2SmRTQWgxOWtYSHEKMk54RUtBVDB6Ri83a1g2MkRkREFBcWxmQkpGSXJodVIvZUdEVWh4L2piTTRhQ2JCcFdiM0pnRE9OYm5tS1ZoMwpxS2ZwZmRZZENZU1lzWUxrNTlxRDF2VFNwUVFUQ0VadW9VKzNzRVNhdkJzaUs1bU0vTzY5ZkRMRXNURG1MeTVQCmhEK3BMQXI0SlhNNjFwRGVBS0l3cUVqWWJybXlDRHRXTUdJNnZzZ0E1eXQzUUJaME9vV2w5QUkwdWxoZ3p4dXQKZ2ZFNTRRRUNnWUVBN0F3a0lhVEEzYmQ4Nk9jSVZnNFlrWGk1cm5aNDdsM1k4V24zcjIzUmVISXhLdkllRUtSbgp5bUlFNDFtRVBBSmlGWFpLK1VPTXdkeS9EcnFJUithT1JiT2NiV01jWUg2QzgvbG1wdVJFaXE3SW1Ub3VWcnA4CnlnUkprMWprVDA4cTIvNmg4eTBEdjJqMitsaHFXNzRNOUt0cmwxcTRlWmZRUFREL01tR1NnTWtDZ1lFQXdhY04KaSttN1p6dnJtL3NuekF2VlZ5SEtwZHVUUjNERk1naC9maC9tZ0ZHZ1RwZWtUOVV5b3FleGNYQXdwMVlhL01iQQoyNTVJVDZRbXZZTm5yNXp6Wmxic2tMV0hsYllvbWhmWnVXTHhXR3hRaEFORWdaMFVVdUVTRGMvbWx2UXZHbEtSCkZoaGhBUWlVSmdDamhPaHk1SlBiNGFldGRKd0UxK09lVWRFaE1vRUNnWUVBNG8yZ25CM1o4ck5xa3NzemlBek4KYmNuMlJVbDJOaW9pejBwS3JMaDFaT29NNE5BekpQdjJsaHRQMzdtS0htS1hLMHczRjFqTEgwSTBxZmxFVmVZbQpSU1huakdHazJjUnpBYUVzOGgrQzNheDE0Z01pZUtGU3BqNUpNOEFNbVVZOXQ1cUVhN2FYc3o0V1ZoOUlMYmVTCkRiNzlhKzVwd21LQVBrcnBsTHhyZFdrQ2dZQlNNSHVBWVdBbmJYZ1BDS2FZWklGVWJNUWNacmY0ZnpWQ2lmYksKYWZHampvRlNPZXdEOGdGK3BWdWJRTGwxbkFieU44ek1xVDRaaHhybUhpcFlqMjJDaHV2NmN3RXJtbGRiSnpwQwpBMnRaVXdkTk1ESFlMUG5lUHlZeGRJWnlsUXFVeW14SGkydElUQUxNcWtLOGV3ZWdXZHpkeGhQSlJScU5JazhrCmZIVHhnUUtCZ1FEUFc2UXIxY3F3QjNUdnVWdWR4WGRqUTdIcDFodXhrNEVWaEFJZllKNFhSTW1NUE5YS28wdHUKdUt6LzE0QW14R0dvSWJxYVc1bDMzeFNteUxhem84clNUN0tSTjVKME9JSHcrZkR5SFgxdHpVSjZCTldDcEFTcwpjbWdNK0htSzVON0w2bkNaZFJQY2IwU1hGaVRQUGhCUG1PVWFDUnpER0ZMK2JYM1VwajJKbWc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +71,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" token = response.parse() - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -84,7 +84,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = response.parse() - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -114,7 +114,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -148,7 +148,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare nbf=0, pem="LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBc284dnBvOFpEWXRkOUgzbWlPaW1qYXAzVXlVM0oyZ3kwTUYvN1R4blJuRnkwRHpDCkxqUk9naFZsQ0hPQmxsd3NVaE9GU0lyYnN4K05tUTdBeS90TFpXSGxuVGF3UWJ5WGZGOStJeDhVSnNlSHBGV1oKNVF5Z1JYd2liSjh1MVVsZ2xlcmZHMkpueldjVXpZTzEySktZN3doSkw1ajROMWgxZFJNUXQ5Q1pkZFlCQWRzOQpCdk02cjRFMDcxQkhQekhWeDMrUTI1VWtubGdUNXIwS3FiM1E1Y0dlTlBXY1JreW1ybkJEWWR0OXR4eFFMb1dPCllzNXdsMnVYWFVYL0VGcDMwajU0Nmp6czllWExLYlNDbjJjTDZFVE96Y2x3aG9DRGx2a2VQT05rUE9LMDVKNUMKTm1TdFdhMG9hV1VGRzM0MFl3cVVrWGt4OU9tNndXd1JldU1uU1FJREFRQUJBb0lCQUFJOHo1ck5kOEdtOGJBMgo1S3pxQjI1R2lOVENwbUNJeW53NXRJWHZTQmNHcEdydUcvdlN2WG9kVlFVSVY0TWdHQkVXUEFrVzdsNWVBcHI4CnA1ZFd5SkRXYTNkdklFSE9vSEpYU3dBYksxZzZEMTNVa2NkZ1EyRGpoNVhuWDhHZCtBY2c2SmRTQWgxOWtYSHEKMk54RUtBVDB6Ri83a1g2MkRkREFBcWxmQkpGSXJodVIvZUdEVWh4L2piTTRhQ2JCcFdiM0pnRE9OYm5tS1ZoMwpxS2ZwZmRZZENZU1lzWUxrNTlxRDF2VFNwUVFUQ0VadW9VKzNzRVNhdkJzaUs1bU0vTzY5ZkRMRXNURG1MeTVQCmhEK3BMQXI0SlhNNjFwRGVBS0l3cUVqWWJybXlDRHRXTUdJNnZzZ0E1eXQzUUJaME9vV2w5QUkwdWxoZ3p4dXQKZ2ZFNTRRRUNnWUVBN0F3a0lhVEEzYmQ4Nk9jSVZnNFlrWGk1cm5aNDdsM1k4V24zcjIzUmVISXhLdkllRUtSbgp5bUlFNDFtRVBBSmlGWFpLK1VPTXdkeS9EcnFJUithT1JiT2NiV01jWUg2QzgvbG1wdVJFaXE3SW1Ub3VWcnA4CnlnUkprMWprVDA4cTIvNmg4eTBEdjJqMitsaHFXNzRNOUt0cmwxcTRlWmZRUFREL01tR1NnTWtDZ1lFQXdhY04KaSttN1p6dnJtL3NuekF2VlZ5SEtwZHVUUjNERk1naC9maC9tZ0ZHZ1RwZWtUOVV5b3FleGNYQXdwMVlhL01iQQoyNTVJVDZRbXZZTm5yNXp6Wmxic2tMV0hsYllvbWhmWnVXTHhXR3hRaEFORWdaMFVVdUVTRGMvbWx2UXZHbEtSCkZoaGhBUWlVSmdDamhPaHk1SlBiNGFldGRKd0UxK09lVWRFaE1vRUNnWUVBNG8yZ25CM1o4ck5xa3NzemlBek4KYmNuMlJVbDJOaW9pejBwS3JMaDFaT29NNE5BekpQdjJsaHRQMzdtS0htS1hLMHczRjFqTEgwSTBxZmxFVmVZbQpSU1huakdHazJjUnpBYUVzOGgrQzNheDE0Z01pZUtGU3BqNUpNOEFNbVVZOXQ1cUVhN2FYc3o0V1ZoOUlMYmVTCkRiNzlhKzVwd21LQVBrcnBsTHhyZFdrQ2dZQlNNSHVBWVdBbmJYZ1BDS2FZWklGVWJNUWNacmY0ZnpWQ2lmYksKYWZHampvRlNPZXdEOGdGK3BWdWJRTGwxbkFieU44ek1xVDRaaHhybUhpcFlqMjJDaHV2NmN3RXJtbGRiSnpwQwpBMnRaVXdkTk1ESFlMUG5lUHlZeGRJWnlsUXFVeW14SGkydElUQUxNcWtLOGV3ZWdXZHpkeGhQSlJScU5JazhrCmZIVHhnUUtCZ1FEUFc2UXIxY3F3QjNUdnVWdWR4WGRqUTdIcDFodXhrNEVWaEFJZllKNFhSTW1NUE5YS28wdHUKdUt6LzE0QW14R0dvSWJxYVc1bDMzeFNteUxhem84clNUN0tSTjVKME9JSHcrZkR5SFgxdHpVSjZCTldDcEFTcwpjbWdNK0htSzVON0w2bkNaZFJQY2IwU1hGaVRQUGhCUG1PVWFDUnpER0ZMK2JYM1VwajJKbWc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -161,7 +161,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" token = await response.parse() - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +174,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = await response.parse() - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_videos.py b/tests/api_resources/stream/test_videos.py index 3742bbcd71a..40da5c76df6 100644 --- a/tests/api_resources/stream/test_videos.py +++ b/tests/api_resources/stream/test_videos.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.stream import VideoStorageUsageResponse +from cloudflare.types.stream.video_storage_usage_response import VideoStorageUsageResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_storage_usage(self, client: Cloudflare) -> None: video = client.stream.videos.storage_usage( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,7 +32,7 @@ def test_method_storage_usage_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", creator="creator-id_abcde12345", ) - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,7 @@ def test_raw_response_storage_usage(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" video = response.parse() - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_streaming_response_storage_usage(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" video = response.parse() - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +78,7 @@ async def test_method_storage_usage(self, async_client: AsyncCloudflare) -> None video = await async_client.stream.videos.storage_usage( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ async def test_method_storage_usage_with_all_params(self, async_client: AsyncClo account_id="023e105f4ecef8ad9ca31a8372d0c353", creator="creator-id_abcde12345", ) - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +99,7 @@ async def test_raw_response_storage_usage(self, async_client: AsyncCloudflare) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" video = await response.parse() - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +111,7 @@ async def test_streaming_response_storage_usage(self, async_client: AsyncCloudfl assert response.http_request.headers.get("X-Stainless-Lang") == "python" video = await response.parse() - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_watermarks.py b/tests/api_resources/stream/test_watermarks.py index 80af89c021d..98dda7d2eea 100644 --- a/tests/api_resources/stream/test_watermarks.py +++ b/tests/api_resources/stream/test_watermarks.py @@ -3,19 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.stream import ( - StreamWatermarks, - WatermarkGetResponse, - WatermarkCreateResponse, - WatermarkDeleteResponse, -) +from cloudflare.types.stream.watermark import Watermark +from cloudflare.types.stream.watermark_delete_response import WatermarkDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", file="@/Users/rchen/Downloads/watermark.png", ) - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +40,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: position="center", scale=0.1, ) - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +53,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" watermark = response.parse() - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -70,7 +66,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -89,7 +85,7 @@ def test_method_list(self, client: Cloudflare) -> None: watermark = client.stream.watermarks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[StreamWatermarks], watermark, path=["response"]) + assert_matches_type(SyncSinglePage[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,7 +97,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(SyncSinglePage[StreamWatermarks], watermark, path=["response"]) + assert_matches_type(SyncSinglePage[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +109,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(SyncSinglePage[StreamWatermarks], watermark, path=["response"]) + assert_matches_type(SyncSinglePage[Watermark], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -131,8 +127,9 @@ def test_method_delete(self, client: Cloudflare) -> None: watermark = client.stream.watermarks.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,12 +137,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.stream.watermarks.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -153,12 +151,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.stream.watermarks.with_streaming_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -169,12 +168,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.stream.watermarks.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): client.stream.watermarks.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -184,7 +185,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +198,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" watermark = response.parse() - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +211,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -240,7 +241,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", file="@/Users/rchen/Downloads/watermark.png", ) - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -254,7 +255,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare position="center", scale=0.1, ) - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -267,7 +268,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" watermark = await response.parse() - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -280,7 +281,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -299,7 +300,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: watermark = await async_client.stream.watermarks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[StreamWatermarks], watermark, path=["response"]) + assert_matches_type(AsyncSinglePage[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +312,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(AsyncSinglePage[StreamWatermarks], watermark, path=["response"]) + assert_matches_type(AsyncSinglePage[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -323,7 +324,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(AsyncSinglePage[StreamWatermarks], watermark, path=["response"]) + assert_matches_type(AsyncSinglePage[Watermark], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -341,8 +342,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: watermark = await async_client.stream.watermarks.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -350,12 +352,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.stream.watermarks.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -363,12 +366,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.stream.watermarks.with_streaming_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -379,12 +383,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.stream.watermarks.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): await async_client.stream.watermarks.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -394,7 +400,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -407,7 +413,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" watermark = await response.parse() - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -420,7 +426,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[Watermark], watermark, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_webhooks.py b/tests/api_resources/stream/test_webhooks.py index 05fd3b060ee..1d12486dc4d 100644 --- a/tests/api_resources/stream/test_webhooks.py +++ b/tests/api_resources/stream/test_webhooks.py @@ -3,17 +3,15 @@ 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.stream import ( - WebhookGetResponse, - WebhookDeleteResponse, - WebhookUpdateResponse, -) +from cloudflare.types.stream.webhook_get_response import WebhookGetResponse +from cloudflare.types.stream.webhook_delete_response import WebhookDeleteResponse +from cloudflare.types.stream.webhook_update_response import WebhookUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", notification_url="https://example.com", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +39,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +52,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,32 +70,35 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: webhook = client.stream.webhooks.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.stream.webhooks.with_raw_response.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.stream.webhooks.with_streaming_response.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -107,6 +108,7 @@ 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.stream.webhooks.with_raw_response.delete( account_id="", + body={}, ) @pytest.mark.skip() @@ -115,7 +117,7 @@ def test_method_get(self, client: Cloudflare) -> None: webhook = client.stream.webhooks.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +129,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +141,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -162,7 +164,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", notification_url="https://example.com", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -175,7 +177,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +190,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -206,32 +208,35 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.stream.webhooks.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.stream.webhooks.with_raw_response.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.stream.webhooks.with_streaming_response.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -241,6 +246,7 @@ 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.stream.webhooks.with_raw_response.delete( account_id="", + body={}, ) @pytest.mark.skip() @@ -249,7 +255,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.stream.webhooks.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -261,7 +267,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +279,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_accounts.py b/tests/api_resources/test_accounts.py index 2d1c482cae3..51e98532e61 100644 --- a/tests/api_resources/test_accounts.py +++ b/tests/api_resources/test_accounts.py @@ -9,8 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import AccountGetResponse, AccountUpdateResponse from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.accounts.account_get_response import AccountGetResponse +from cloudflare.types.accounts.account_update_response import AccountUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -80,6 +81,7 @@ def test_method_list(self, client: Cloudflare) -> None: def test_method_list_with_all_params(self, client: Cloudflare) -> None: account = client.accounts.list( direction="desc", + name="example.com", page=1, per_page=5, ) @@ -207,6 +209,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: account = await async_client.accounts.list( direction="desc", + name="example.com", page=1, per_page=5, ) diff --git a/tests/api_resources/test_audit_logs.py b/tests/api_resources/test_audit_logs.py index 305e7cc8894..23d4ac0f501 100644 --- a/tests/api_resources/test_audit_logs.py +++ b/tests/api_resources/test_audit_logs.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import AuditLogListResponse from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.shared.audit_log import AuditLog base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: audit_log = client.audit_logs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: since=parse_datetime("2019-04-30T01:12:20Z"), zone={"name": "example.com"}, ) - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +59,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +71,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +93,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: audit_log = await async_client.audit_logs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +115,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) since=parse_datetime("2019-04-30T01:12:20Z"), zone={"name": "example.com"}, ) - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +127,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +139,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_bot_management.py b/tests/api_resources/test_bot_management.py index 631f4206a83..c5973199ca4 100644 --- a/tests/api_resources/test_bot_management.py +++ b/tests/api_resources/test_bot_management.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import BotManagementGetResponse, BotManagementUpdateResponse +from cloudflare.types.bot_management.bot_management_get_response import BotManagementGetResponse +from cloudflare.types.bot_management.bot_management_update_response import BotManagementUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_brand_protection.py b/tests/api_resources/test_brand_protection.py index cd7a5c57245..c2650214b0c 100644 --- a/tests/api_resources/test_brand_protection.py +++ b/tests/api_resources/test_brand_protection.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - IntelPhishingURLInfo, - IntelPhishingURLSubmit, -) +from cloudflare.types.brand_protection.info import Info +from cloudflare.types.brand_protection.submit import Submit base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +24,7 @@ def test_method_submit(self, client: Cloudflare) -> None: brand_protection = client.brand_protection.submit( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelPhishingURLSubmit, brand_protection, path=["response"]) + assert_matches_type(Submit, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +33,7 @@ def test_method_submit_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", url="https://www.cloudflare.com", ) - assert_matches_type(IntelPhishingURLSubmit, brand_protection, path=["response"]) + assert_matches_type(Submit, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +45,7 @@ def test_raw_response_submit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = response.parse() - assert_matches_type(IntelPhishingURLSubmit, brand_protection, path=["response"]) + assert_matches_type(Submit, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +57,7 @@ def test_streaming_response_submit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = response.parse() - assert_matches_type(IntelPhishingURLSubmit, brand_protection, path=["response"]) + assert_matches_type(Submit, brand_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -77,7 +75,7 @@ def test_method_url_info(self, client: Cloudflare) -> None: brand_protection = client.brand_protection.url_info( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelPhishingURLInfo, brand_protection, path=["response"]) + assert_matches_type(Info, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +85,7 @@ def test_method_url_info_with_all_params(self, client: Cloudflare) -> None: url="string", url_id_param={"url_id": 0}, ) - assert_matches_type(IntelPhishingURLInfo, brand_protection, path=["response"]) + assert_matches_type(Info, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +97,7 @@ def test_raw_response_url_info(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = response.parse() - assert_matches_type(IntelPhishingURLInfo, brand_protection, path=["response"]) + assert_matches_type(Info, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +109,7 @@ def test_streaming_response_url_info(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = response.parse() - assert_matches_type(IntelPhishingURLInfo, brand_protection, path=["response"]) + assert_matches_type(Info, brand_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -133,7 +131,7 @@ async def test_method_submit(self, async_client: AsyncCloudflare) -> None: brand_protection = await async_client.brand_protection.submit( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelPhishingURLSubmit, brand_protection, path=["response"]) + assert_matches_type(Submit, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +140,7 @@ async def test_method_submit_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", url="https://www.cloudflare.com", ) - assert_matches_type(IntelPhishingURLSubmit, brand_protection, path=["response"]) + assert_matches_type(Submit, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -154,7 +152,7 @@ async def test_raw_response_submit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = await response.parse() - assert_matches_type(IntelPhishingURLSubmit, brand_protection, path=["response"]) + assert_matches_type(Submit, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +164,7 @@ async def test_streaming_response_submit(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = await response.parse() - assert_matches_type(IntelPhishingURLSubmit, brand_protection, path=["response"]) + assert_matches_type(Submit, brand_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -184,7 +182,7 @@ async def test_method_url_info(self, async_client: AsyncCloudflare) -> None: brand_protection = await async_client.brand_protection.url_info( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelPhishingURLInfo, brand_protection, path=["response"]) + assert_matches_type(Info, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -194,7 +192,7 @@ async def test_method_url_info_with_all_params(self, async_client: AsyncCloudfla url="string", url_id_param={"url_id": 0}, ) - assert_matches_type(IntelPhishingURLInfo, brand_protection, path=["response"]) + assert_matches_type(Info, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +204,7 @@ async def test_raw_response_url_info(self, async_client: AsyncCloudflare) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = await response.parse() - assert_matches_type(IntelPhishingURLInfo, brand_protection, path=["response"]) + assert_matches_type(Info, brand_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -218,7 +216,7 @@ async def test_streaming_response_url_info(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = await response.parse() - assert_matches_type(IntelPhishingURLInfo, brand_protection, path=["response"]) + assert_matches_type(Info, brand_protection, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_cache.py b/tests/api_resources/test_cache.py index e3e932d5a24..46117860cef 100644 --- a/tests/api_resources/test_cache.py +++ b/tests/api_resources/test_cache.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import CachePurgeResponse +from cloudflare.types.cache.cache_purge_response import CachePurgeResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_calls.py b/tests/api_resources/test_calls.py index 49df39e2a8b..74cdb30b81f 100644 --- a/tests/api_resources/test_calls.py +++ b/tests/api_resources/test_calls.py @@ -3,14 +3,15 @@ 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 import CallsApp, CallsAppWithSecret from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.calls.calls_app import CallsApp +from cloudflare.types.calls.calls_app_with_secret import CallsAppWithSecret base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: call = client.calls.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -33,7 +34,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="production-realtime-app", ) - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +46,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" call = response.parse() - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +58,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +77,7 @@ def test_method_update(self, client: Cloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +87,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="production-realtime-app", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +100,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +113,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -180,7 +181,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +194,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" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +207,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -232,7 +233,7 @@ def test_method_get(self, client: Cloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -245,7 +246,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" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -258,7 +259,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -287,7 +288,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: call = await async_client.calls.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -296,7 +297,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", name="production-realtime-app", ) - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -308,7 +309,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" call = await response.parse() - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -320,7 +321,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +340,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -349,7 +350,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", name="production-realtime-app", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +363,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -375,7 +376,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -443,7 +444,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -456,7 +457,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" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -469,7 +470,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -495,7 +496,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -508,7 +509,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" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -521,7 +522,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_client_certificates.py b/tests/api_resources/test_client_certificates.py index 1f3fb7fbd8f..b94b604167d 100644 --- a/tests/api_resources/test_client_certificates.py +++ b/tests/api_resources/test_client_certificates.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ClientCertificate from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.client_certificates.client_certificate import ClientCertificate base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_custom_certificates.py b/tests/api_resources/test_custom_certificates.py index 139dc561d9a..a8344aafafc 100644 --- a/tests/api_resources/test_custom_certificates.py +++ b/tests/api_resources/test_custom_certificates.py @@ -9,14 +9,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - CustomCertificate, - CustomCertificateGetResponse, - CustomCertificateEditResponse, - CustomCertificateCreateResponse, - CustomCertificateDeleteResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.custom_certificates.custom_certificate import CustomCertificate +from cloudflare.types.custom_certificates.custom_certificate_get_response import CustomCertificateGetResponse +from cloudflare.types.custom_certificates.custom_certificate_edit_response import CustomCertificateEditResponse +from cloudflare.types.custom_certificates.custom_certificate_create_response import CustomCertificateCreateResponse +from cloudflare.types.custom_certificates.custom_certificate_delete_response import CustomCertificateDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -104,6 +102,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: match="any", page=1, per_page=5, + status="active", ) assert_matches_type(SyncV4PagePaginationArray[CustomCertificate], custom_certificate, path=["response"]) @@ -147,6 +146,7 @@ def test_method_delete(self, client: Cloudflare) -> None: custom_certificate = client.custom_certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CustomCertificateDeleteResponse, custom_certificate, path=["response"]) @@ -156,6 +156,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.custom_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -169,6 +170,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.custom_certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -185,12 +187,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.custom_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_certificate_id` but received ''"): client.custom_certificates.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -395,6 +399,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) match="any", page=1, per_page=5, + status="active", ) assert_matches_type(AsyncV4PagePaginationArray[CustomCertificate], custom_certificate, path=["response"]) @@ -438,6 +443,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: custom_certificate = await async_client.custom_certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CustomCertificateDeleteResponse, custom_certificate, path=["response"]) @@ -447,6 +453,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.custom_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -460,6 +467,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.custom_certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -476,12 +484,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.custom_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_certificate_id` but received ''"): await async_client.custom_certificates.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_custom_hostnames.py b/tests/api_resources/test_custom_hostnames.py index d14eb055d34..57e45edfece 100644 --- a/tests/api_resources/test_custom_hostnames.py +++ b/tests/api_resources/test_custom_hostnames.py @@ -9,14 +9,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - CustomHostnameGetResponse, - CustomHostnameEditResponse, - CustomHostnameListResponse, - CustomHostnameCreateResponse, - CustomHostnameDeleteResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.custom_hostnames.custom_hostname_get_response import CustomHostnameGetResponse +from cloudflare.types.custom_hostnames.custom_hostname_edit_response import CustomHostnameEditResponse +from cloudflare.types.custom_hostnames.custom_hostname_list_response import CustomHostnameListResponse +from cloudflare.types.custom_hostnames.custom_hostname_create_response import CustomHostnameCreateResponse +from cloudflare.types.custom_hostnames.custom_hostname_delete_response import CustomHostnameDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -165,6 +163,7 @@ def test_method_delete(self, client: Cloudflare) -> None: custom_hostname = client.custom_hostnames.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CustomHostnameDeleteResponse, custom_hostname, path=["response"]) @@ -174,6 +173,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.custom_hostnames.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -187,6 +187,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.custom_hostnames.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -203,12 +204,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.custom_hostnames.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_hostname_id` but received ''"): client.custom_hostnames.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -488,6 +491,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: custom_hostname = await async_client.custom_hostnames.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CustomHostnameDeleteResponse, custom_hostname, path=["response"]) @@ -497,6 +501,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.custom_hostnames.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -510,6 +515,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.custom_hostnames.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -526,12 +532,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.custom_hostnames.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_hostname_id` but received ''"): await async_client.custom_hostnames.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_custom_nameservers.py b/tests/api_resources/test_custom_nameservers.py index 28b14dca1e2..02602c51933 100644 --- a/tests/api_resources/test_custom_nameservers.py +++ b/tests/api_resources/test_custom_nameservers.py @@ -9,11 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - CustomNameserver, - CustomNameserverGetResponse, - CustomNameserverDeleteResponse, - CustomNameserverVerifyResponse, +from cloudflare.types.custom_nameservers.custom_nameserver import CustomNameserver +from cloudflare.types.custom_nameservers.custom_nameserver_get_response import CustomNameserverGetResponse +from cloudflare.types.custom_nameservers.custom_nameserver_delete_response import CustomNameserverDeleteResponse +from cloudflare.types.custom_nameservers.custom_nameserver_verify_response import CustomNameserverVerifyResponse +from cloudflare.types.custom_nameservers.custom_nameserver_availabilty_response import ( CustomNameserverAvailabiltyResponse, ) @@ -85,6 +85,7 @@ def test_method_delete(self, client: Cloudflare) -> None: custom_nameserver = client.custom_nameservers.delete( "ns1.example.com", account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) assert_matches_type(Optional[CustomNameserverDeleteResponse], custom_nameserver, path=["response"]) @@ -94,6 +95,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.custom_nameservers.with_raw_response.delete( "ns1.example.com", account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) assert response.is_closed is True @@ -107,6 +109,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.custom_nameservers.with_streaming_response.delete( "ns1.example.com", account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -123,12 +126,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.custom_nameservers.with_raw_response.delete( "ns1.example.com", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_ns_id` but received ''"): client.custom_nameservers.with_raw_response.delete( "", account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) @pytest.mark.skip() @@ -220,6 +225,7 @@ def test_path_params_get(self, client: Cloudflare) -> None: def test_method_verify(self, client: Cloudflare) -> None: custom_nameserver = client.custom_nameservers.verify( account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) assert_matches_type(Optional[CustomNameserverVerifyResponse], custom_nameserver, path=["response"]) @@ -228,6 +234,7 @@ def test_method_verify(self, client: Cloudflare) -> None: def test_raw_response_verify(self, client: Cloudflare) -> None: response = client.custom_nameservers.with_raw_response.verify( account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) assert response.is_closed is True @@ -240,6 +247,7 @@ def test_raw_response_verify(self, client: Cloudflare) -> None: def test_streaming_response_verify(self, client: Cloudflare) -> None: with client.custom_nameservers.with_streaming_response.verify( account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -255,6 +263,7 @@ def test_path_params_verify(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.custom_nameservers.with_raw_response.verify( account_id="", + body={}, ) @@ -323,6 +332,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: custom_nameserver = await async_client.custom_nameservers.delete( "ns1.example.com", account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) assert_matches_type(Optional[CustomNameserverDeleteResponse], custom_nameserver, path=["response"]) @@ -332,6 +342,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.custom_nameservers.with_raw_response.delete( "ns1.example.com", account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) assert response.is_closed is True @@ -345,6 +356,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.custom_nameservers.with_streaming_response.delete( "ns1.example.com", account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -361,12 +373,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.custom_nameservers.with_raw_response.delete( "ns1.example.com", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_ns_id` but received ''"): await async_client.custom_nameservers.with_raw_response.delete( "", account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) @pytest.mark.skip() @@ -458,6 +472,7 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: async def test_method_verify(self, async_client: AsyncCloudflare) -> None: custom_nameserver = await async_client.custom_nameservers.verify( account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) assert_matches_type(Optional[CustomNameserverVerifyResponse], custom_nameserver, path=["response"]) @@ -466,6 +481,7 @@ async def test_method_verify(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_verify(self, async_client: AsyncCloudflare) -> None: response = await async_client.custom_nameservers.with_raw_response.verify( account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) assert response.is_closed is True @@ -478,6 +494,7 @@ async def test_raw_response_verify(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_verify(self, async_client: AsyncCloudflare) -> None: async with async_client.custom_nameservers.with_streaming_response.verify( account_id="372e67954025e0ba6aaa6d586b9e0b59", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -493,4 +510,5 @@ async def test_path_params_verify(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.custom_nameservers.with_raw_response.verify( account_id="", + body={}, ) diff --git a/tests/api_resources/test_dnssec.py b/tests/api_resources/test_dnssec.py index 9e45b478ef2..6d2766683d3 100644 --- a/tests/api_resources/test_dnssec.py +++ b/tests/api_resources/test_dnssec.py @@ -3,13 +3,14 @@ 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 import DNSSEC, DNSSECDeleteResponse +from cloudflare.types.dnssec.dnssec import DNSSEC +from cloudflare.types.dnssec.dnssec_delete_response import DNSSECDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,32 +23,35 @@ class TestDNSSEC: def test_method_delete(self, client: Cloudflare) -> None: dnssec = client.dnssec.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(DNSSECDeleteResponse, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.dnssec.with_raw_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = response.parse() - assert_matches_type(DNSSECDeleteResponse, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.dnssec.with_streaming_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = response.parse() - assert_matches_type(DNSSECDeleteResponse, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) assert cast(Any, response.is_closed) is True @@ -57,6 +61,7 @@ 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.dnssec.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -65,7 +70,7 @@ def test_method_edit(self, client: Cloudflare) -> None: dnssec = client.dnssec.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -76,7 +81,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: dnssec_presigned=True, status="active", ) - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,7 +93,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" dnssec = response.parse() - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +105,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = response.parse() - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) assert cast(Any, response.is_closed) is True @@ -118,7 +123,7 @@ def test_method_get(self, client: Cloudflare) -> None: dnssec = client.dnssec.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +135,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" dnssec = response.parse() - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +147,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = response.parse() - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) assert cast(Any, response.is_closed) is True @@ -163,32 +168,35 @@ class TestAsyncDNSSEC: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: dnssec = await async_client.dnssec.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(DNSSECDeleteResponse, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.dnssec.with_raw_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = await response.parse() - assert_matches_type(DNSSECDeleteResponse, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.dnssec.with_streaming_response.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = await response.parse() - assert_matches_type(DNSSECDeleteResponse, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) assert cast(Any, response.is_closed) is True @@ -198,6 +206,7 @@ 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.dnssec.with_raw_response.delete( zone_id="", + body={}, ) @pytest.mark.skip() @@ -206,7 +215,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: dnssec = await async_client.dnssec.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +226,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) dnssec_presigned=True, status="active", ) - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -229,7 +238,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" dnssec = await response.parse() - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -241,7 +250,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = await response.parse() - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) assert cast(Any, response.is_closed) is True @@ -259,7 +268,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: dnssec = await async_client.dnssec.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -271,7 +280,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" dnssec = await response.parse() - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) @pytest.mark.skip() @parametrize @@ -283,7 +292,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = await response.parse() - assert_matches_type(DNSSEC, dnssec, path=["response"]) + assert_matches_type(Optional[DNSSEC], dnssec, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_email_routing.py b/tests/api_resources/test_email_routing.py index bf77cca2685..9ee514a81ce 100644 --- a/tests/api_resources/test_email_routing.py +++ b/tests/api_resources/test_email_routing.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import EmailRoutingGetResponse, EmailRoutingEnableResponse, EmailRoutingDisableResponse +from cloudflare.types.email_routing.settings import Settings base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,32 +22,35 @@ class TestEmailRouting: def test_method_disable(self, client: Cloudflare) -> None: email_routing = client.email_routing.disable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_disable(self, client: Cloudflare) -> None: response = client.email_routing.with_raw_response.disable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_disable(self, client: Cloudflare) -> None: with client.email_routing.with_streaming_response.disable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -57,6 +60,7 @@ def test_path_params_disable(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): client.email_routing.with_raw_response.disable( "", + body={}, ) @pytest.mark.skip() @@ -64,32 +68,35 @@ def test_path_params_disable(self, client: Cloudflare) -> None: def test_method_enable(self, client: Cloudflare) -> None: email_routing = client.email_routing.enable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_enable(self, client: Cloudflare) -> None: response = client.email_routing.with_raw_response.enable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_enable(self, client: Cloudflare) -> None: with client.email_routing.with_streaming_response.enable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -99,6 +106,7 @@ def test_path_params_enable(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): client.email_routing.with_raw_response.enable( "", + body={}, ) @pytest.mark.skip() @@ -107,7 +115,7 @@ def test_method_get(self, client: Cloudflare) -> None: email_routing = client.email_routing.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,7 +127,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" email_routing = response.parse() - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +139,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -152,32 +160,35 @@ class TestAsyncEmailRouting: async def test_method_disable(self, async_client: AsyncCloudflare) -> None: email_routing = await async_client.email_routing.disable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_disable(self, async_client: AsyncCloudflare) -> None: response = await async_client.email_routing.with_raw_response.disable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_disable(self, async_client: AsyncCloudflare) -> None: async with async_client.email_routing.with_streaming_response.disable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingDisableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,6 +198,7 @@ async def test_path_params_disable(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): await async_client.email_routing.with_raw_response.disable( "", + body={}, ) @pytest.mark.skip() @@ -194,32 +206,35 @@ async def test_path_params_disable(self, async_client: AsyncCloudflare) -> None: async def test_method_enable(self, async_client: AsyncCloudflare) -> None: email_routing = await async_client.email_routing.enable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_enable(self, async_client: AsyncCloudflare) -> None: response = await async_client.email_routing.with_raw_response.enable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_enable(self, async_client: AsyncCloudflare) -> None: async with async_client.email_routing.with_streaming_response.enable( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingEnableResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -229,6 +244,7 @@ async def test_path_params_enable(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): await async_client.email_routing.with_raw_response.enable( "", + body={}, ) @pytest.mark.skip() @@ -237,7 +253,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: email_routing = await async_client.email_routing.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,7 +265,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" email_routing = await response.parse() - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) @pytest.mark.skip() @parametrize @@ -261,7 +277,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(EmailRoutingGetResponse, email_routing, path=["response"]) + assert_matches_type(Settings, email_routing, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_filters.py b/tests/api_resources/test_filters.py index dfd37057490..bea75db8e20 100644 --- a/tests/api_resources/test_filters.py +++ b/tests/api_resources/test_filters.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - FirewallFilter, - FilterCreateResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.filters.firewall_filter import FirewallFilter +from cloudflare.types.filters.filter_create_response import FilterCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -75,7 +73,7 @@ def test_method_update(self, client: Cloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +87,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +101,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @@ -137,6 +135,7 @@ def test_method_list(self, client: Cloudflare) -> None: def test_method_list_with_all_params(self, client: Cloudflare) -> None: filter = client.filters.list( "023e105f4ecef8ad9ca31a8372d0c353", + id="372e67954025e0ba6aaa6d586b9e0b61", description="browsers", expression="php", page=1, @@ -186,8 +185,9 @@ def test_method_delete(self, client: Cloudflare) -> None: filter = client.filters.delete( "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -195,12 +195,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.filters.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,12 +209,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.filters.with_streaming_response.delete( "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @@ -224,12 +226,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.filters.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.filters.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -239,7 +243,7 @@ def test_method_get(self, client: Cloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -252,7 +256,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" filter = response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -265,7 +269,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +346,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -356,7 +360,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = await response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -370,7 +374,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = await response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @@ -404,6 +408,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: filter = await async_client.filters.list( "023e105f4ecef8ad9ca31a8372d0c353", + id="372e67954025e0ba6aaa6d586b9e0b61", description="browsers", expression="php", page=1, @@ -453,8 +458,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: filter = await async_client.filters.delete( "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -462,12 +468,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.filters.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = await response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -475,12 +482,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.filters.with_streaming_response.delete( "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = await response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @@ -491,12 +499,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.filters.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.filters.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -506,7 +516,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b61", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -519,7 +529,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" filter = await response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -532,7 +542,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = await response.parse() - assert_matches_type(Optional[FirewallFilter], filter, path=["response"]) + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_healthchecks.py b/tests/api_resources/test_healthchecks.py index 7e5754cb6c0..bb7bba49016 100644 --- a/tests/api_resources/test_healthchecks.py +++ b/tests/api_resources/test_healthchecks.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - Healthcheck, - HealthcheckDeleteResponse, -) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.healthchecks.healthcheck import Healthcheck +from cloudflare.types.healthchecks.healthcheck_delete_response import HealthcheckDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -214,6 +212,16 @@ def test_method_list(self, client: Cloudflare) -> None: ) assert_matches_type(SyncSinglePage[Healthcheck], healthcheck, path=["response"]) + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + healthcheck = client.healthchecks.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(SyncSinglePage[Healthcheck], healthcheck, path=["response"]) + @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -254,6 +262,7 @@ def test_method_delete(self, client: Cloudflare) -> None: healthcheck = client.healthchecks.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(HealthcheckDeleteResponse, healthcheck, path=["response"]) @@ -263,6 +272,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.healthchecks.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -276,6 +286,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.healthchecks.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -292,12 +303,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.healthchecks.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `healthcheck_id` but received ''"): client.healthchecks.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -648,6 +661,16 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(AsyncSinglePage[Healthcheck], healthcheck, path=["response"]) + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + healthcheck = await async_client.healthchecks.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(AsyncSinglePage[Healthcheck], healthcheck, path=["response"]) + @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -688,6 +711,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: healthcheck = await async_client.healthchecks.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(HealthcheckDeleteResponse, healthcheck, path=["response"]) @@ -697,6 +721,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.healthchecks.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -710,6 +735,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.healthchecks.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -726,12 +752,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.healthchecks.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `healthcheck_id` but received ''"): await async_client.healthchecks.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_ips.py b/tests/api_resources/test_ips.py index cfbc33fa51f..6a5ecb6eced 100644 --- a/tests/api_resources/test_ips.py +++ b/tests/api_resources/test_ips.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 import IPListResponse +from cloudflare.types.ips.ip_list_response import IPListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +21,7 @@ class TestIPs: @parametrize def test_method_list(self, client: Cloudflare) -> None: ip = client.ips.list() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -29,7 +29,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: ip = client.ips.list( networks="string", ) - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = response.parse() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = response.parse() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,7 +61,7 @@ class TestAsyncIPs: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: ip = await async_client.ips.list() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +69,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) ip = await async_client.ips.list( networks="string", ) - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -79,7 +79,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = await response.parse() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,6 +89,6 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = await response.parse() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_keyless_certificates.py b/tests/api_resources/test_keyless_certificates.py index 6003a52d371..0125ed3cc7a 100644 --- a/tests/api_resources/test_keyless_certificates.py +++ b/tests/api_resources/test_keyless_certificates.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - KeylessCertificateHostname, - KeylessCertificateDeleteResponse, -) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.keyless_certificates.keyless_certificate import KeylessCertificate +from cloudflare.types.keyless_certificates.keyless_certificate_delete_response import KeylessCertificateDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: host="example.com", port=24008, ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +45,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "vnet_id": "7365377a-85a4-4390-9480-531ef7dc7a3c", }, ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +60,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" keyless_certificate = response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -77,7 +75,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -98,7 +96,7 @@ def test_method_list(self, client: Cloudflare) -> None: keyless_certificate = client.keyless_certificates.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[KeylessCertificate], keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +108,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = response.parse() - assert_matches_type(SyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[KeylessCertificate], keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +120,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = response.parse() - assert_matches_type(SyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[KeylessCertificate], keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -140,6 +138,7 @@ def test_method_delete(self, client: Cloudflare) -> None: keyless_certificate = client.keyless_certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(KeylessCertificateDeleteResponse, keyless_certificate, path=["response"]) @@ -149,6 +148,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.keyless_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -162,6 +162,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.keyless_certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -178,6 +179,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.keyless_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises( @@ -186,6 +188,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.keyless_certificates.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -195,7 +198,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -212,7 +215,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "vnet_id": "7365377a-85a4-4390-9480-531ef7dc7a3c", }, ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +228,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" keyless_certificate = response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -238,7 +241,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -266,7 +269,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -279,7 +282,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" keyless_certificate = response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -292,7 +295,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -326,7 +329,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: host="example.com", port=24008, ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -343,7 +346,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "vnet_id": "7365377a-85a4-4390-9480-531ef7dc7a3c", }, ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -358,7 +361,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" keyless_certificate = await response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -373,7 +376,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = await response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -394,7 +397,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: keyless_certificate = await async_client.keyless_certificates.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[KeylessCertificate], keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -406,7 +409,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = await response.parse() - assert_matches_type(AsyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[KeylessCertificate], keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -418,7 +421,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = await response.parse() - assert_matches_type(AsyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[KeylessCertificate], keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -436,6 +439,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: keyless_certificate = await async_client.keyless_certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(KeylessCertificateDeleteResponse, keyless_certificate, path=["response"]) @@ -445,6 +449,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.keyless_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -458,6 +463,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.keyless_certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -474,6 +480,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.keyless_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises( @@ -482,6 +489,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.keyless_certificates.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -491,7 +499,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -508,7 +516,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "vnet_id": "7365377a-85a4-4390-9480-531ef7dc7a3c", }, ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -521,7 +529,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" keyless_certificate = await response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -534,7 +542,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = await response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -562,7 +570,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -575,7 +583,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" keyless_certificate = await response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -588,7 +596,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = await response.parse() - assert_matches_type(KeylessCertificateHostname, keyless_certificate, path=["response"]) + assert_matches_type(KeylessCertificate, keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_load_balancers.py b/tests/api_resources/test_load_balancers.py index 6ef827e239a..c34be32b75e 100644 --- a/tests/api_resources/test_load_balancers.py +++ b/tests/api_resources/test_load_balancers.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - LoadBalancer, - LoadBalancerDeleteResponse, -) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.load_balancers.load_balancer import LoadBalancer +from cloudflare.types.load_balancers.load_balancer_delete_response import LoadBalancerDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -688,6 +686,7 @@ def test_method_delete(self, client: Cloudflare) -> None: load_balancer = client.load_balancers.delete( "699d98642c564d2e855e9661899b7252", zone_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(LoadBalancerDeleteResponse, load_balancer, path=["response"]) @@ -697,6 +696,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.load_balancers.with_raw_response.delete( "699d98642c564d2e855e9661899b7252", zone_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -710,6 +710,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.load_balancers.with_streaming_response.delete( "699d98642c564d2e855e9661899b7252", zone_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -726,12 +727,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.load_balancers.with_raw_response.delete( "699d98642c564d2e855e9661899b7252", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.load_balancers.with_raw_response.delete( "", zone_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -1741,6 +1744,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: load_balancer = await async_client.load_balancers.delete( "699d98642c564d2e855e9661899b7252", zone_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(LoadBalancerDeleteResponse, load_balancer, path=["response"]) @@ -1750,6 +1754,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.load_balancers.with_raw_response.delete( "699d98642c564d2e855e9661899b7252", zone_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -1763,6 +1768,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.load_balancers.with_streaming_response.delete( "699d98642c564d2e855e9661899b7252", zone_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1779,12 +1785,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.load_balancers.with_raw_response.delete( "699d98642c564d2e855e9661899b7252", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.load_balancers.with_raw_response.delete( "", zone_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_managed_headers.py b/tests/api_resources/test_managed_headers.py index 73f304ba56a..0c1ddcaa5db 100644 --- a/tests/api_resources/test_managed_headers.py +++ b/tests/api_resources/test_managed_headers.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ManagedHeaderEditResponse, ManagedHeaderListResponse +from cloudflare.types.managed_headers.managed_header_edit_response import ManagedHeaderEditResponse +from cloudflare.types.managed_headers.managed_header_list_response import ManagedHeaderListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_memberships.py b/tests/api_resources/test_memberships.py index a61d32f96f0..09458896e93 100644 --- a/tests/api_resources/test_memberships.py +++ b/tests/api_resources/test_memberships.py @@ -9,13 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - Membership, - MembershipGetResponse, - MembershipDeleteResponse, - MembershipUpdateResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.memberships.membership import Membership +from cloudflare.types.memberships.membership_get_response import MembershipGetResponse +from cloudflare.types.memberships.membership_delete_response import MembershipDeleteResponse +from cloudflare.types.memberships.membership_update_response import MembershipUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -116,6 +114,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: membership = client.memberships.delete( "4536bcfad5faccb111b47003c79917fa", + body={}, ) assert_matches_type(MembershipDeleteResponse, membership, path=["response"]) @@ -124,6 +123,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.memberships.with_raw_response.delete( "4536bcfad5faccb111b47003c79917fa", + body={}, ) assert response.is_closed is True @@ -136,6 +136,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.memberships.with_streaming_response.delete( "4536bcfad5faccb111b47003c79917fa", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -151,6 +152,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `membership_id` but received ''"): client.memberships.with_raw_response.delete( "", + body={}, ) @pytest.mark.skip() @@ -292,6 +294,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N async def test_method_delete(self, async_client: AsyncCloudflare) -> None: membership = await async_client.memberships.delete( "4536bcfad5faccb111b47003c79917fa", + body={}, ) assert_matches_type(MembershipDeleteResponse, membership, path=["response"]) @@ -300,6 +303,7 @@ 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.memberships.with_raw_response.delete( "4536bcfad5faccb111b47003c79917fa", + body={}, ) assert response.is_closed is True @@ -312,6 +316,7 @@ 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.memberships.with_streaming_response.delete( "4536bcfad5faccb111b47003c79917fa", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -327,6 +332,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `membership_id` but received ''"): await async_client.memberships.with_raw_response.delete( "", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_mtls_certificates.py b/tests/api_resources/test_mtls_certificates.py index ca3dbc38d35..4367b45bac9 100644 --- a/tests/api_resources/test_mtls_certificates.py +++ b/tests/api_resources/test_mtls_certificates.py @@ -9,8 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import MTLSCertificate, MTLSCertificateUpdate from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.mtls_certificates.mtls_certificate import MTLSCertificate +from cloudflare.types.mtls_certificates.mtls_certificate_create_response import MTLSCertificateCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: ca=True, certificates="-----BEGIN CERTIFICATE-----\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\n-----END CERTIFICATE-----", ) - assert_matches_type(MTLSCertificateUpdate, mtls_certificate, path=["response"]) + assert_matches_type(MTLSCertificateCreateResponse, mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +39,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="example_ca_cert", private_key="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDEXDkcICRU3XBv9hiiPnBWIjgTQyowmVFxDr11mONgZB/cMYjE/OvQjvnpwNcOaSK16MOpAjNbELKRx2lZiVJaLRDCccqCxXwP/CrdRChcqGzo7mbNksMlcidrErb0LlEBKLFC2QjRmRKqB+YOs4TD8WsZu2S667A2fZmjRlaqOxFi1h62ee0P+TLU628UC/nl41JifSt5Evt7hMDHakemdwZblNYr2p6T3NQjdhjYXTtP4UmOGJBhJ7i7Kicg3d3CIgdTMbggSeGWqjndr4ldVnD96FN3cVT5uDFsn2CJXTFgdeBWoUnMS4VnUZzPWGf4vSBXC8qV7Ls+w46yT7T1AgMBAAECggEAQZnp/oqCeNPOR6l5S2L+1tfx0gWjZ78hJVteUpZ0iHSK7F6kKeOxyOird7vUXV0kmo+cJq+0hp0Ke4eam640FCpwKfYoSQ4/R3vgujGWJnaihCN5tv5sMet0XeJPuz5qE7ALoKCvwI6aXLHs20aAeZIDTQJ9QbGSGnJVzOWn+JDTidIgZpN57RpXfSAwnJPTQK/PN8i5z108hsaDOdEgGmxYZ7kYqMqzX20KXmth58LDfPixs5JGtS60iiKC/wOcGzkB2/AdTSojR76oEU77cANP/3zO25NG//whUdYlW0t0d7PgXxIeJe+xgYnamDQJx3qonVyt4H77ha0ObRAj9QKBgQDicZr+VTwFMnELP3a+FXGnjehRiuS1i7MXGKxNweCD+dFlML0FplSQS8Ro2n+d8lu8BBXGx0qm6VXu8Rhn7TAUL6q+PCgfarzxfIhacb/TZCqfieIHsMlVBfhV5HCXnk+kis0tuC/PRArcWTwDHJUJXkBhvkUsNswvQzavDPI7KwKBgQDd/WgLkj7A3X5fgIHZH/GbDSBiXwzKb+rF4ZCT2XFgG/OAW7vapfcX/w+v+5lBLyrocmOAS3PGGAhM5T3HLnUCQfnK4qgps1Lqibkc9Tmnsn60LanUjuUMsYv/zSw70tozbzhJ0pioEpWfRxRZBztO2Rr8Ntm7h6Fk701EXGNAXwKBgQCD1xsjy2J3sCerIdcz0u5qXLAPkeuZW+34m4/ucdwTWwc0gEz9lhsULFj9p4G351zLuiEnq+7mAWLcDJlmIO3mQt6JhiLiL9Y0T4pgBmxmWqKKYtAsJB0EmMY+1BNN44mBRqMxZFTJu1cLdhT/xstrOeoIPqytknYNanfTMZlzIwKBgHrLXe5oq0XMP8dcMneEcAUwsaU4pr6kQd3L9EmUkl5zl7J9C+DaxWAEuwzBw/iGutlxzRB+rD/7szu14wJ29EqXbDGKRzMp+se5/yfBjm7xEZ1hVPw7PwBShfqt57X/4Ktq7lwHnmH6RcGhc+P7WBc5iO/S94YAdIp8xOT3pf9JAoGAE0QkqJUY+5Mgr+fBO0VNV72ZoPveGpW+De59uhKAOnu1zljQCUtk59m6+DXfm0tNYKtawa5n8iN71Zh+s62xXSt3pYi1Y5CCCmv8Y4BhwIcPwXKk3zEvLgSHVTpC0bayA9aSO4bbZgVXa5w+Z0w/vvfp9DWo1IS3EnQRrz6WMYA=\n-----END PRIVATE KEY-----", ) - assert_matches_type(MTLSCertificateUpdate, mtls_certificate, path=["response"]) + assert_matches_type(MTLSCertificateCreateResponse, mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -52,7 +53,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" mtls_certificate = response.parse() - assert_matches_type(MTLSCertificateUpdate, mtls_certificate, path=["response"]) + assert_matches_type(MTLSCertificateCreateResponse, mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -66,7 +67,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" mtls_certificate = response.parse() - assert_matches_type(MTLSCertificateUpdate, mtls_certificate, path=["response"]) + assert_matches_type(MTLSCertificateCreateResponse, mtls_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -128,6 +129,7 @@ def test_method_delete(self, client: Cloudflare) -> None: mtls_certificate = client.mtls_certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(MTLSCertificate, mtls_certificate, path=["response"]) @@ -137,6 +139,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.mtls_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -150,6 +153,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.mtls_certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,12 +170,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.mtls_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `mtls_certificate_id` but received ''"): client.mtls_certificates.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -238,7 +244,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: ca=True, certificates="-----BEGIN CERTIFICATE-----\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\n-----END CERTIFICATE-----", ) - assert_matches_type(MTLSCertificateUpdate, mtls_certificate, path=["response"]) + assert_matches_type(MTLSCertificateCreateResponse, mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -250,7 +256,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="example_ca_cert", private_key="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDEXDkcICRU3XBv9hiiPnBWIjgTQyowmVFxDr11mONgZB/cMYjE/OvQjvnpwNcOaSK16MOpAjNbELKRx2lZiVJaLRDCccqCxXwP/CrdRChcqGzo7mbNksMlcidrErb0LlEBKLFC2QjRmRKqB+YOs4TD8WsZu2S667A2fZmjRlaqOxFi1h62ee0P+TLU628UC/nl41JifSt5Evt7hMDHakemdwZblNYr2p6T3NQjdhjYXTtP4UmOGJBhJ7i7Kicg3d3CIgdTMbggSeGWqjndr4ldVnD96FN3cVT5uDFsn2CJXTFgdeBWoUnMS4VnUZzPWGf4vSBXC8qV7Ls+w46yT7T1AgMBAAECggEAQZnp/oqCeNPOR6l5S2L+1tfx0gWjZ78hJVteUpZ0iHSK7F6kKeOxyOird7vUXV0kmo+cJq+0hp0Ke4eam640FCpwKfYoSQ4/R3vgujGWJnaihCN5tv5sMet0XeJPuz5qE7ALoKCvwI6aXLHs20aAeZIDTQJ9QbGSGnJVzOWn+JDTidIgZpN57RpXfSAwnJPTQK/PN8i5z108hsaDOdEgGmxYZ7kYqMqzX20KXmth58LDfPixs5JGtS60iiKC/wOcGzkB2/AdTSojR76oEU77cANP/3zO25NG//whUdYlW0t0d7PgXxIeJe+xgYnamDQJx3qonVyt4H77ha0ObRAj9QKBgQDicZr+VTwFMnELP3a+FXGnjehRiuS1i7MXGKxNweCD+dFlML0FplSQS8Ro2n+d8lu8BBXGx0qm6VXu8Rhn7TAUL6q+PCgfarzxfIhacb/TZCqfieIHsMlVBfhV5HCXnk+kis0tuC/PRArcWTwDHJUJXkBhvkUsNswvQzavDPI7KwKBgQDd/WgLkj7A3X5fgIHZH/GbDSBiXwzKb+rF4ZCT2XFgG/OAW7vapfcX/w+v+5lBLyrocmOAS3PGGAhM5T3HLnUCQfnK4qgps1Lqibkc9Tmnsn60LanUjuUMsYv/zSw70tozbzhJ0pioEpWfRxRZBztO2Rr8Ntm7h6Fk701EXGNAXwKBgQCD1xsjy2J3sCerIdcz0u5qXLAPkeuZW+34m4/ucdwTWwc0gEz9lhsULFj9p4G351zLuiEnq+7mAWLcDJlmIO3mQt6JhiLiL9Y0T4pgBmxmWqKKYtAsJB0EmMY+1BNN44mBRqMxZFTJu1cLdhT/xstrOeoIPqytknYNanfTMZlzIwKBgHrLXe5oq0XMP8dcMneEcAUwsaU4pr6kQd3L9EmUkl5zl7J9C+DaxWAEuwzBw/iGutlxzRB+rD/7szu14wJ29EqXbDGKRzMp+se5/yfBjm7xEZ1hVPw7PwBShfqt57X/4Ktq7lwHnmH6RcGhc+P7WBc5iO/S94YAdIp8xOT3pf9JAoGAE0QkqJUY+5Mgr+fBO0VNV72ZoPveGpW+De59uhKAOnu1zljQCUtk59m6+DXfm0tNYKtawa5n8iN71Zh+s62xXSt3pYi1Y5CCCmv8Y4BhwIcPwXKk3zEvLgSHVTpC0bayA9aSO4bbZgVXa5w+Z0w/vvfp9DWo1IS3EnQRrz6WMYA=\n-----END PRIVATE KEY-----", ) - assert_matches_type(MTLSCertificateUpdate, mtls_certificate, path=["response"]) + assert_matches_type(MTLSCertificateCreateResponse, mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -264,7 +270,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" mtls_certificate = await response.parse() - assert_matches_type(MTLSCertificateUpdate, mtls_certificate, path=["response"]) + assert_matches_type(MTLSCertificateCreateResponse, mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -278,7 +284,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" mtls_certificate = await response.parse() - assert_matches_type(MTLSCertificateUpdate, mtls_certificate, path=["response"]) + assert_matches_type(MTLSCertificateCreateResponse, mtls_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -340,6 +346,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: mtls_certificate = await async_client.mtls_certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(MTLSCertificate, mtls_certificate, path=["response"]) @@ -349,6 +356,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.mtls_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -362,6 +370,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.mtls_certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -378,12 +387,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.mtls_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `mtls_certificate_id` but received ''"): await async_client.mtls_certificates.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_origin_ca_certificates.py b/tests/api_resources/test_origin_ca_certificates.py index b20f9c59221..1634e513180 100644 --- a/tests/api_resources/test_origin_ca_certificates.py +++ b/tests/api_resources/test_origin_ca_certificates.py @@ -9,13 +9,15 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - OriginCACertificate, - OriginCACertificateGetResponse, +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.origin_ca_certificates.origin_ca_certificate import OriginCACertificate +from cloudflare.types.origin_ca_certificates.origin_ca_certificate_get_response import OriginCACertificateGetResponse +from cloudflare.types.origin_ca_certificates.origin_ca_certificate_create_response import ( OriginCACertificateCreateResponse, +) +from cloudflare.types.origin_ca_certificates.origin_ca_certificate_delete_response import ( OriginCACertificateDeleteResponse, ) -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -68,6 +70,14 @@ def test_method_list(self, client: Cloudflare) -> None: origin_ca_certificate = client.origin_ca_certificates.list() assert_matches_type(SyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + origin_ca_certificate = client.origin_ca_certificates.list( + identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) + @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -95,6 +105,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: origin_ca_certificate = client.origin_ca_certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(OriginCACertificateDeleteResponse, origin_ca_certificate, path=["response"]) @@ -103,6 +114,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.origin_ca_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -115,6 +127,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.origin_ca_certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -130,6 +143,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): client.origin_ca_certificates.with_raw_response.delete( "", + body={}, ) @pytest.mark.skip() @@ -223,6 +237,14 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: origin_ca_certificate = await async_client.origin_ca_certificates.list() assert_matches_type(AsyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + origin_ca_certificate = await async_client.origin_ca_certificates.list( + identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) + @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -250,6 +272,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N async def test_method_delete(self, async_client: AsyncCloudflare) -> None: origin_ca_certificate = await async_client.origin_ca_certificates.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(OriginCACertificateDeleteResponse, origin_ca_certificate, path=["response"]) @@ -258,6 +281,7 @@ 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.origin_ca_certificates.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -270,6 +294,7 @@ 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.origin_ca_certificates.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -285,6 +310,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): await async_client.origin_ca_certificates.with_raw_response.delete( "", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_origin_post_quantum_encryption.py b/tests/api_resources/test_origin_post_quantum_encryption.py index 794b93f5d90..019ff719faf 100644 --- a/tests/api_resources/test_origin_post_quantum_encryption.py +++ b/tests/api_resources/test_origin_post_quantum_encryption.py @@ -9,8 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( +from cloudflare.types.origin_post_quantum_encryption.origin_post_quantum_encryption_get_response import ( OriginPostQuantumEncryptionGetResponse, +) +from cloudflare.types.origin_post_quantum_encryption.origin_post_quantum_encryption_update_response import ( OriginPostQuantumEncryptionUpdateResponse, ) diff --git a/tests/api_resources/test_origin_tls_client_auth.py b/tests/api_resources/test_origin_tls_client_auth.py index e75e32b30bc..7e98d804bb6 100644 --- a/tests/api_resources/test_origin_tls_client_auth.py +++ b/tests/api_resources/test_origin_tls_client_auth.py @@ -9,13 +9,15 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - OriginTLSClientAuthGetResponse, - OriginTLSClientAuthListResponse, +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.origin_tls_client_auth.zone_authenticated_origin_pull import ZoneAuthenticatedOriginPull +from cloudflare.types.origin_tls_client_auth.origin_tls_client_auth_get_response import OriginTLSClientAuthGetResponse +from cloudflare.types.origin_tls_client_auth.origin_tls_client_auth_create_response import ( OriginTLSClientAuthCreateResponse, +) +from cloudflare.types.origin_tls_client_auth.origin_tls_client_auth_delete_response import ( OriginTLSClientAuthDeleteResponse, ) -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -79,7 +81,7 @@ def test_method_list(self, client: Cloudflare) -> None: origin_tls_client_auth = client.origin_tls_client_auth.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type(SyncSinglePage[ZoneAuthenticatedOriginPull], origin_tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -91,7 +93,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_tls_client_auth = response.parse() - assert_matches_type(SyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type(SyncSinglePage[ZoneAuthenticatedOriginPull], origin_tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,9 +105,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_tls_client_auth = response.parse() - assert_matches_type( - SyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"] - ) + assert_matches_type(SyncSinglePage[ZoneAuthenticatedOriginPull], origin_tls_client_auth, path=["response"]) assert cast(Any, response.is_closed) is True @@ -123,6 +123,7 @@ def test_method_delete(self, client: Cloudflare) -> None: origin_tls_client_auth = client.origin_tls_client_auth.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(OriginTLSClientAuthDeleteResponse, origin_tls_client_auth, path=["response"]) @@ -132,6 +133,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.origin_tls_client_auth.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -145,6 +147,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.origin_tls_client_auth.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -161,12 +164,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.origin_tls_client_auth.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): client.origin_tls_client_auth.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -281,7 +286,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: origin_tls_client_auth = await async_client.origin_tls_client_auth.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type(AsyncSinglePage[ZoneAuthenticatedOriginPull], origin_tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -293,7 +298,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_tls_client_auth = await response.parse() - assert_matches_type(AsyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type(AsyncSinglePage[ZoneAuthenticatedOriginPull], origin_tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -305,9 +310,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_tls_client_auth = await response.parse() - assert_matches_type( - AsyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"] - ) + assert_matches_type(AsyncSinglePage[ZoneAuthenticatedOriginPull], origin_tls_client_auth, path=["response"]) assert cast(Any, response.is_closed) is True @@ -325,6 +328,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: origin_tls_client_auth = await async_client.origin_tls_client_auth.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(OriginTLSClientAuthDeleteResponse, origin_tls_client_auth, path=["response"]) @@ -334,6 +338,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.origin_tls_client_auth.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -347,6 +352,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.origin_tls_client_auth.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -363,12 +369,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.origin_tls_client_auth.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): await async_client.origin_tls_client_auth.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_page_shield.py b/tests/api_resources/test_page_shield.py index f8bbeaa1a85..49a129e9177 100644 --- a/tests/api_resources/test_page_shield.py +++ b/tests/api_resources/test_page_shield.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import PageShieldSetting, PageShieldUpdateResponse +from cloudflare.types.page_shield.setting import Setting +from cloudflare.types.page_shield.page_shield_update_response import PageShieldUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -76,7 +77,7 @@ def test_method_get(self, client: Cloudflare) -> None: page_shield = client.page_shield.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldSetting, page_shield, path=["response"]) + assert_matches_type(Setting, page_shield, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,7 +89,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" page_shield = response.parse() - assert_matches_type(PageShieldSetting, page_shield, path=["response"]) + assert_matches_type(Setting, page_shield, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +101,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" page_shield = response.parse() - assert_matches_type(PageShieldSetting, page_shield, path=["response"]) + assert_matches_type(Setting, page_shield, path=["response"]) assert cast(Any, response.is_closed) is True @@ -175,7 +176,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: page_shield = await async_client.page_shield.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldSetting, page_shield, path=["response"]) + assert_matches_type(Setting, page_shield, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,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" page_shield = await response.parse() - assert_matches_type(PageShieldSetting, page_shield, path=["response"]) + assert_matches_type(Setting, page_shield, path=["response"]) @pytest.mark.skip() @parametrize @@ -199,7 +200,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" page_shield = await response.parse() - assert_matches_type(PageShieldSetting, page_shield, path=["response"]) + assert_matches_type(Setting, page_shield, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_pagerules.py b/tests/api_resources/test_pagerules.py index 42de780f1d1..6e18728f43e 100644 --- a/tests/api_resources/test_pagerules.py +++ b/tests/api_resources/test_pagerules.py @@ -9,14 +9,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - PageruleGetResponse, - PageruleEditResponse, - PageruleListResponse, - PageruleCreateResponse, - PageruleDeleteResponse, - PageruleUpdateResponse, -) +from cloudflare.types.pagerules.pagerule_get_response import PageruleGetResponse +from cloudflare.types.pagerules.pagerule_edit_response import PageruleEditResponse +from cloudflare.types.pagerules.pagerule_list_response import PageruleListResponse +from cloudflare.types.pagerules.pagerule_create_response import PageruleCreateResponse +from cloudflare.types.pagerules.pagerule_delete_response import PageruleDeleteResponse +from cloudflare.types.pagerules.pagerule_update_response import PageruleUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -325,6 +323,7 @@ def test_method_delete(self, client: Cloudflare) -> None: pagerule = client.pagerules.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) @@ -334,6 +333,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.pagerules.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -347,6 +347,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.pagerules.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -363,12 +364,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.pagerules.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): client.pagerules.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -809,6 +812,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: pagerule = await async_client.pagerules.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) @@ -818,6 +822,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.pagerules.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -831,6 +836,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.pagerules.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -847,12 +853,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.pagerules.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): await async_client.pagerules.with_raw_response.delete( "", zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_pcaps.py b/tests/api_resources/test_pcaps.py index 2db05d99367..13dd094bf71 100644 --- a/tests/api_resources/test_pcaps.py +++ b/tests/api_resources/test_pcaps.py @@ -9,8 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import PCAPGetResponse, PCAPListResponse, PCAPCreateResponse from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.pcaps.pcap_get_response import PCAPGetResponse +from cloudflare.types.pcaps.pcap_list_response import PCAPListResponse +from cloudflare.types.pcaps.pcap_create_response import PCAPCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 68d14414ec9..48423bb43e1 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import AvailableRatePlan from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.plans.available_rate_plan import AvailableRatePlan base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_queues.py b/tests/api_resources/test_queues.py index 2204fc81cdb..6080c4a15dd 100644 --- a/tests/api_resources/test_queues.py +++ b/tests/api_resources/test_queues.py @@ -9,14 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - QueueGetResponse, - QueueListResponse, - QueueCreateResponse, - QueueDeleteResponse, - QueueUpdateResponse, -) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.queues.queue import Queue +from cloudflare.types.queues.queue_created import QueueCreated +from cloudflare.types.queues.queue_updated import QueueUpdated +from cloudflare.types.queues.queue_delete_response import QueueDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={"queue_name": "example-queue"}, ) - assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueCreated], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +41,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" queue = response.parse() - assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueCreated], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +54,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = response.parse() - assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueCreated], queue, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +75,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={"queue_name": "renamed-example-queue"}, ) - assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueUpdated], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,7 +89,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = response.parse() - assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueUpdated], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +103,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = response.parse() - assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueUpdated], queue, path=["response"]) assert cast(Any, response.is_closed) is True @@ -133,7 +130,7 @@ def test_method_list(self, client: Cloudflare) -> None: queue = client.queues.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"]) + assert_matches_type(SyncSinglePage[Queue], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -145,7 +142,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = response.parse() - assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"]) + assert_matches_type(SyncSinglePage[Queue], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -157,7 +154,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = response.parse() - assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"]) + assert_matches_type(SyncSinglePage[Queue], queue, path=["response"]) assert cast(Any, response.is_closed) is True @@ -175,6 +172,7 @@ def test_method_delete(self, client: Cloudflare) -> None: queue = client.queues.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[QueueDeleteResponse], queue, path=["response"]) @@ -184,6 +182,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.queues.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -197,6 +196,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.queues.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -213,12 +213,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.queues.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `queue_id` but received ''"): client.queues.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -228,7 +230,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[QueueGetResponse], queue, path=["response"]) + assert_matches_type(Optional[Queue], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -241,7 +243,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" queue = response.parse() - assert_matches_type(Optional[QueueGetResponse], queue, path=["response"]) + assert_matches_type(Optional[Queue], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -254,7 +256,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = response.parse() - assert_matches_type(Optional[QueueGetResponse], queue, path=["response"]) + assert_matches_type(Optional[Queue], queue, path=["response"]) assert cast(Any, response.is_closed) is True @@ -284,7 +286,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={"queue_name": "example-queue"}, ) - assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueCreated], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -297,7 +299,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" queue = await response.parse() - assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueCreated], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -310,7 +312,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = await response.parse() - assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueCreated], queue, path=["response"]) assert cast(Any, response.is_closed) is True @@ -331,7 +333,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={"queue_name": "renamed-example-queue"}, ) - assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueUpdated], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -345,7 +347,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = await response.parse() - assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueUpdated], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -359,7 +361,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = await response.parse() - assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"]) + assert_matches_type(Optional[QueueUpdated], queue, path=["response"]) assert cast(Any, response.is_closed) is True @@ -386,7 +388,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: queue = await async_client.queues.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"]) + assert_matches_type(AsyncSinglePage[Queue], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -398,7 +400,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = await response.parse() - assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"]) + assert_matches_type(AsyncSinglePage[Queue], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -410,7 +412,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = await response.parse() - assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"]) + assert_matches_type(AsyncSinglePage[Queue], queue, path=["response"]) assert cast(Any, response.is_closed) is True @@ -428,6 +430,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: queue = await async_client.queues.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[QueueDeleteResponse], queue, path=["response"]) @@ -437,6 +440,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.queues.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -450,6 +454,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.queues.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -466,12 +471,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.queues.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `queue_id` but received ''"): await async_client.queues.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -481,7 +488,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[QueueGetResponse], queue, path=["response"]) + assert_matches_type(Optional[Queue], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -494,7 +501,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" queue = await response.parse() - assert_matches_type(Optional[QueueGetResponse], queue, path=["response"]) + assert_matches_type(Optional[Queue], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -507,7 +514,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = await response.parse() - assert_matches_type(Optional[QueueGetResponse], queue, path=["response"]) + assert_matches_type(Optional[Queue], queue, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_rate_limits.py b/tests/api_resources/test_rate_limits.py index aedc8ca0305..1b462297bb4 100644 --- a/tests/api_resources/test_rate_limits.py +++ b/tests/api_resources/test_rate_limits.py @@ -3,20 +3,18 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - RateLimitGetResponse, - RateLimitEditResponse, - RateLimitListResponse, - RateLimitCreateResponse, - RateLimitDeleteResponse, -) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.rate_limits.rate_limit import RateLimit +from cloudflare.types.rate_limits.rate_limit_get_response import RateLimitGetResponse +from cloudflare.types.rate_limits.rate_limit_edit_response import RateLimitEditResponse +from cloudflare.types.rate_limits.rate_limit_create_response import RateLimitCreateResponse +from cloudflare.types.rate_limits.rate_limit_delete_response import RateLimitDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[RateLimitCreateResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +42,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" rate_limit = response.parse() - assert_matches_type(Optional[RateLimitCreateResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +55,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = response.parse() - assert_matches_type(Optional[RateLimitCreateResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +74,7 @@ def test_method_list(self, client: Cloudflare) -> None: rate_limit = client.rate_limits.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[RateLimitListResponse], rate_limit, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +84,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=1, ) - assert_matches_type(SyncV4PagePaginationArray[RateLimitListResponse], rate_limit, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +96,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RateLimitListResponse], rate_limit, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +108,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RateLimitListResponse], rate_limit, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -128,8 +126,9 @@ def test_method_delete(self, client: Cloudflare) -> None: rate_limit = client.rate_limits.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[RateLimitDeleteResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -137,12 +136,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.rate_limits.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = response.parse() - assert_matches_type(Optional[RateLimitDeleteResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,12 +150,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.rate_limits.with_streaming_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = response.parse() - assert_matches_type(Optional[RateLimitDeleteResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -166,12 +167,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.rate_limits.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.rate_limits.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -182,7 +185,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[RateLimitEditResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,7 +199,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" rate_limit = response.parse() - assert_matches_type(Optional[RateLimitEditResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +213,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = response.parse() - assert_matches_type(Optional[RateLimitEditResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,7 +241,7 @@ def test_method_get(self, client: Cloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RateLimitGetResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -251,7 +254,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" rate_limit = response.parse() - assert_matches_type(Optional[RateLimitGetResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -264,7 +267,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = response.parse() - assert_matches_type(Optional[RateLimitGetResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -294,7 +297,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[RateLimitCreateResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -307,7 +310,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" rate_limit = await response.parse() - assert_matches_type(Optional[RateLimitCreateResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -320,7 +323,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = await response.parse() - assert_matches_type(Optional[RateLimitCreateResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +342,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: rate_limit = await async_client.rate_limits.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[RateLimitListResponse], rate_limit, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -349,7 +352,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=1, ) - assert_matches_type(AsyncV4PagePaginationArray[RateLimitListResponse], rate_limit, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -361,7 +364,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RateLimitListResponse], rate_limit, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -373,7 +376,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[RateLimitListResponse], rate_limit, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -391,8 +394,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: rate_limit = await async_client.rate_limits.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[RateLimitDeleteResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -400,12 +404,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.rate_limits.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = await response.parse() - assert_matches_type(Optional[RateLimitDeleteResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -413,12 +418,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.rate_limits.with_streaming_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = await response.parse() - assert_matches_type(Optional[RateLimitDeleteResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -429,12 +435,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.rate_limits.with_raw_response.delete( "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.rate_limits.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -445,7 +453,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[RateLimitEditResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -459,7 +467,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" rate_limit = await response.parse() - assert_matches_type(Optional[RateLimitEditResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -473,7 +481,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = await response.parse() - assert_matches_type(Optional[RateLimitEditResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @@ -501,7 +509,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RateLimitGetResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -514,7 +522,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" rate_limit = await response.parse() - assert_matches_type(Optional[RateLimitGetResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) @pytest.mark.skip() @parametrize @@ -527,7 +535,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" rate_limit = await response.parse() - assert_matches_type(Optional[RateLimitGetResponse], rate_limit, path=["response"]) + assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_rate_plans.py b/tests/api_resources/test_rate_plans.py index a4cb7576276..23955bcb03f 100644 --- a/tests/api_resources/test_rate_plans.py +++ b/tests/api_resources/test_rate_plans.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import RatePlanGetResponse +from cloudflare.types.rate_plans.rate_plan_get_response import RatePlanGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_rulesets.py b/tests/api_resources/test_rulesets.py index 285259542bf..b949d47af75 100644 --- a/tests/api_resources/test_rulesets.py +++ b/tests/api_resources/test_rulesets.py @@ -9,8 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Ruleset, RulesetListResponse from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.rulesets.ruleset import Ruleset +from cloudflare.types.rulesets.ruleset_get_response import RulesetGetResponse +from cloudflare.types.rulesets.ruleset_create_response import RulesetCreateResponse +from cloudflare.types.rulesets.ruleset_update_response import RulesetUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +32,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetCreateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,7 +95,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: zone_id="string", description="My ruleset to execute managed rulesets", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetCreateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -109,7 +112,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" ruleset = response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetCreateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +129,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetCreateResponse, ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -158,19 +161,17 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: ruleset = client.rulesets.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: ruleset = client.rulesets.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[ { "action": "block", @@ -228,14 +229,13 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: name="My ruleset", phase="http_request_firewall_custom", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.rulesets.with_raw_response.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -244,14 +244,13 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.rulesets.with_streaming_response.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -260,7 +259,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -270,7 +269,6 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): client.rulesets.with_raw_response.update( "", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -279,7 +277,6 @@ 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.rulesets.with_raw_response.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="", zone_id="string", @@ -288,7 +285,6 @@ 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.rulesets.with_raw_response.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="", @@ -301,7 +297,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -310,7 +306,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -323,7 +319,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -336,7 +332,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -437,7 +433,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetGetResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -447,7 +443,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetGetResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +457,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" ruleset = response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetGetResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -475,7 +471,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetGetResponse, ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -518,7 +514,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetCreateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -581,7 +577,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare zone_id="string", description="My ruleset to execute managed rulesets", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetCreateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -598,7 +594,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" ruleset = await response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetCreateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -615,7 +611,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetCreateResponse, ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -647,19 +643,17 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: ruleset = await async_client.rulesets.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: ruleset = await async_client.rulesets.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[ { "action": "block", @@ -717,14 +711,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare name="My ruleset", phase="http_request_firewall_custom", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.with_raw_response.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -733,14 +726,13 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.with_streaming_response.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -749,7 +741,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -759,7 +751,6 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.with_raw_response.update( "", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="string", @@ -768,7 +759,6 @@ 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.rulesets.with_raw_response.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="", zone_id="string", @@ -777,7 +767,6 @@ 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.rulesets.with_raw_response.update( "2f2feab2026849078ba485f918791bdc", - id="2f2feab2026849078ba485f918791bdc", rules=[{}, {}, {}], account_id="string", zone_id="", @@ -790,7 +779,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -799,7 +788,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -812,7 +801,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -825,7 +814,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -926,7 +915,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetGetResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -936,7 +925,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetGetResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -950,7 +939,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" ruleset = await response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetGetResponse, ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -964,7 +953,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(Ruleset, ruleset, path=["response"]) + assert_matches_type(RulesetGetResponse, ruleset, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_snippets.py b/tests/api_resources/test_snippets.py index a47c07cf315..687cda032c0 100644 --- a/tests/api_resources/test_snippets.py +++ b/tests/api_resources/test_snippets.py @@ -9,8 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Snippet, SnippetDeleteResponse from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.snippets.snippet import Snippet +from cloudflare.types.snippets.snippet_delete_response import SnippetDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_speed.py b/tests/api_resources/test_speed.py index 5afa7238430..219140f913c 100644 --- a/tests/api_resources/test_speed.py +++ b/tests/api_resources/test_speed.py @@ -9,11 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - ObservatoryTrend, - ObservatorySchedule, - SpeedDeleteResponse, -) +from cloudflare._utils import parse_datetime +from cloudflare.types.speed.trend import Trend +from cloudflare.types.speed.schedule import Schedule +from cloudflare.types.speed.speed_delete_response import SpeedDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -90,7 +89,7 @@ def test_method_schedule_get(self, client: Cloudflare) -> None: "example.com", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ObservatorySchedule], speed, path=["response"]) + assert_matches_type(Optional[Schedule], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +99,7 @@ def test_method_schedule_get_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", region="us-central1", ) - assert_matches_type(Optional[ObservatorySchedule], speed, path=["response"]) + assert_matches_type(Optional[Schedule], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +112,7 @@ def test_raw_response_schedule_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" speed = response.parse() - assert_matches_type(Optional[ObservatorySchedule], speed, path=["response"]) + assert_matches_type(Optional[Schedule], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +125,7 @@ def test_streaming_response_schedule_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" speed = response.parse() - assert_matches_type(Optional[ObservatorySchedule], speed, path=["response"]) + assert_matches_type(Optional[Schedule], speed, path=["response"]) assert cast(Any, response.is_closed) is True @@ -154,9 +153,25 @@ def test_method_trends_list(self, client: Cloudflare) -> None: device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) - assert_matches_type(Optional[ObservatoryTrend], speed, path=["response"]) + assert_matches_type(Optional[Trend], speed, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_trends_list_with_all_params(self, client: Cloudflare) -> None: + speed = client.speed.trends_list( + "example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + device_type="DESKTOP", + metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", + region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), + tz="string", + end=parse_datetime("2014-01-01T05:20:00.12345Z"), + ) + assert_matches_type(Optional[Trend], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -167,13 +182,14 @@ def test_raw_response_trends_list(self, client: Cloudflare) -> None: device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" speed = response.parse() - assert_matches_type(Optional[ObservatoryTrend], speed, path=["response"]) + assert_matches_type(Optional[Trend], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -184,13 +200,14 @@ def test_streaming_response_trends_list(self, client: Cloudflare) -> None: device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" speed = response.parse() - assert_matches_type(Optional[ObservatoryTrend], speed, path=["response"]) + assert_matches_type(Optional[Trend], speed, path=["response"]) assert cast(Any, response.is_closed) is True @@ -204,6 +221,7 @@ def test_path_params_trends_list(self, client: Cloudflare) -> None: device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) @@ -214,6 +232,7 @@ def test_path_params_trends_list(self, client: Cloudflare) -> None: device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) @@ -290,7 +309,7 @@ async def test_method_schedule_get(self, async_client: AsyncCloudflare) -> None: "example.com", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ObservatorySchedule], speed, path=["response"]) + assert_matches_type(Optional[Schedule], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -300,7 +319,7 @@ async def test_method_schedule_get_with_all_params(self, async_client: AsyncClou zone_id="023e105f4ecef8ad9ca31a8372d0c353", region="us-central1", ) - assert_matches_type(Optional[ObservatorySchedule], speed, path=["response"]) + assert_matches_type(Optional[Schedule], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -313,7 +332,7 @@ async def test_raw_response_schedule_get(self, async_client: AsyncCloudflare) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" speed = await response.parse() - assert_matches_type(Optional[ObservatorySchedule], speed, path=["response"]) + assert_matches_type(Optional[Schedule], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +345,7 @@ async def test_streaming_response_schedule_get(self, async_client: AsyncCloudfla assert response.http_request.headers.get("X-Stainless-Lang") == "python" speed = await response.parse() - assert_matches_type(Optional[ObservatorySchedule], speed, path=["response"]) + assert_matches_type(Optional[Schedule], speed, path=["response"]) assert cast(Any, response.is_closed) is True @@ -354,9 +373,25 @@ async def test_method_trends_list(self, async_client: AsyncCloudflare) -> None: device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), + tz="string", + ) + assert_matches_type(Optional[Trend], speed, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_trends_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + speed = await async_client.speed.trends_list( + "example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + device_type="DESKTOP", + metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", + region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", + end=parse_datetime("2014-01-01T05:20:00.12345Z"), ) - assert_matches_type(Optional[ObservatoryTrend], speed, path=["response"]) + assert_matches_type(Optional[Trend], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -367,13 +402,14 @@ async def test_raw_response_trends_list(self, async_client: AsyncCloudflare) -> device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" speed = await response.parse() - assert_matches_type(Optional[ObservatoryTrend], speed, path=["response"]) + assert_matches_type(Optional[Trend], speed, path=["response"]) @pytest.mark.skip() @parametrize @@ -384,13 +420,14 @@ async def test_streaming_response_trends_list(self, async_client: AsyncCloudflar device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" speed = await response.parse() - assert_matches_type(Optional[ObservatoryTrend], speed, path=["response"]) + assert_matches_type(Optional[Trend], speed, path=["response"]) assert cast(Any, response.is_closed) is True @@ -404,6 +441,7 @@ async def test_path_params_trends_list(self, async_client: AsyncCloudflare) -> N device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) @@ -414,5 +452,6 @@ async def test_path_params_trends_list(self, async_client: AsyncCloudflare) -> N device_type="DESKTOP", metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls", region="us-central1", + start=parse_datetime("2014-01-01T05:20:00.12345Z"), tz="string", ) diff --git a/tests/api_resources/test_stream.py b/tests/api_resources/test_stream.py index 118641ae1d8..df25de66aae 100644 --- a/tests/api_resources/test_stream.py +++ b/tests/api_resources/test_stream.py @@ -3,15 +3,15 @@ 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 import StreamVideos from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.stream.video import Video base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,6 +24,7 @@ class TestStream: def test_method_create(self, client: Cloudflare) -> None: stream = client.stream.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert stream is None @@ -32,6 +33,7 @@ def test_method_create(self, client: Cloudflare) -> None: def test_raw_response_create(self, client: Cloudflare) -> None: response = client.stream.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -44,6 +46,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: def test_streaming_response_create(self, client: Cloudflare) -> None: with client.stream.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -59,6 +62,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.stream.with_raw_response.create( account_id="", + body={}, ) @pytest.mark.skip() @@ -67,7 +71,7 @@ def test_method_list(self, client: Cloudflare) -> None: stream = client.stream.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[StreamVideos], stream, path=["response"]) + assert_matches_type(SyncSinglePage[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -83,7 +87,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: status="inprogress", type="live", ) - assert_matches_type(SyncSinglePage[StreamVideos], stream, path=["response"]) + assert_matches_type(SyncSinglePage[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -95,7 +99,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = response.parse() - assert_matches_type(SyncSinglePage[StreamVideos], stream, path=["response"]) + assert_matches_type(SyncSinglePage[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +111,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = response.parse() - assert_matches_type(SyncSinglePage[StreamVideos], stream, path=["response"]) + assert_matches_type(SyncSinglePage[Video], stream, path=["response"]) assert cast(Any, response.is_closed) is True @@ -125,6 +129,7 @@ def test_method_delete(self, client: Cloudflare) -> None: stream = client.stream.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert stream is None @@ -134,6 +139,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.stream.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -147,6 +153,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.stream.with_streaming_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -163,12 +170,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.stream.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): client.stream.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -178,7 +187,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamVideos, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -191,7 +200,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" stream = response.parse() - assert_matches_type(StreamVideos, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -204,7 +213,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = response.parse() - assert_matches_type(StreamVideos, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) assert cast(Any, response.is_closed) is True @@ -232,6 +241,7 @@ class TestAsyncStream: async def test_method_create(self, async_client: AsyncCloudflare) -> None: stream = await async_client.stream.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert stream is None @@ -240,6 +250,7 @@ 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.stream.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -252,6 +263,7 @@ 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.stream.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -267,6 +279,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.stream.with_raw_response.create( account_id="", + body={}, ) @pytest.mark.skip() @@ -275,7 +288,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: stream = await async_client.stream.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[StreamVideos], stream, path=["response"]) + assert_matches_type(AsyncSinglePage[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -291,7 +304,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) status="inprogress", type="live", ) - assert_matches_type(AsyncSinglePage[StreamVideos], stream, path=["response"]) + assert_matches_type(AsyncSinglePage[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -303,7 +316,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = await response.parse() - assert_matches_type(AsyncSinglePage[StreamVideos], stream, path=["response"]) + assert_matches_type(AsyncSinglePage[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -315,7 +328,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = await response.parse() - assert_matches_type(AsyncSinglePage[StreamVideos], stream, path=["response"]) + assert_matches_type(AsyncSinglePage[Video], stream, path=["response"]) assert cast(Any, response.is_closed) is True @@ -333,6 +346,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: stream = await async_client.stream.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert stream is None @@ -342,6 +356,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.stream.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -355,6 +370,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.stream.with_streaming_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -371,12 +387,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.stream.with_raw_response.delete( "ea95132c15732412d22c1476fa83f27a", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): await async_client.stream.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -386,7 +404,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamVideos, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -399,7 +417,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" stream = await response.parse() - assert_matches_type(StreamVideos, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -412,7 +430,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = await response.parse() - assert_matches_type(StreamVideos, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index ed9927ed618..d0d2c1d2eb1 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -9,14 +9,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - SubscriptionGetResponse, - SubscriptionListResponse, - SubscriptionCreateResponse, - SubscriptionDeleteResponse, - SubscriptionUpdateResponse, -) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.user.subscription import Subscription +from cloudflare.types.subscriptions.subscription_get_response import SubscriptionGetResponse +from cloudflare.types.subscriptions.subscription_create_response import SubscriptionCreateResponse +from cloudflare.types.subscriptions.subscription_delete_response import SubscriptionDeleteResponse +from cloudflare.types.subscriptions.subscription_update_response import SubscriptionUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -207,7 +205,7 @@ def test_method_list(self, client: Cloudflare) -> None: subscription = client.subscriptions.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[Subscription], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -219,7 +217,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = response.parse() - assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[Subscription], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -231,7 +229,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = response.parse() - assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[Subscription], subscription, path=["response"]) assert cast(Any, response.is_closed) is True @@ -249,6 +247,7 @@ def test_method_delete(self, client: Cloudflare) -> None: subscription = client.subscriptions.delete( "506e3185e9c882d175a2d0cb0093d9f2", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(SubscriptionDeleteResponse, subscription, path=["response"]) @@ -258,6 +257,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.subscriptions.with_raw_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -271,6 +271,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.subscriptions.with_streaming_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -287,6 +288,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.subscriptions.with_raw_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", account_identifier="", + body={}, ) with pytest.raises( @@ -295,6 +297,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.subscriptions.with_raw_response.delete( "", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -526,7 +529,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: subscription = await async_client.subscriptions.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[Subscription], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -538,7 +541,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = await response.parse() - assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[Subscription], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -550,7 +553,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = await response.parse() - assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[Subscription], subscription, path=["response"]) assert cast(Any, response.is_closed) is True @@ -568,6 +571,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: subscription = await async_client.subscriptions.delete( "506e3185e9c882d175a2d0cb0093d9f2", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(SubscriptionDeleteResponse, subscription, path=["response"]) @@ -577,6 +581,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.subscriptions.with_raw_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -590,6 +595,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.subscriptions.with_streaming_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -606,6 +612,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.subscriptions.with_raw_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", account_identifier="", + body={}, ) with pytest.raises( @@ -614,6 +621,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.subscriptions.with_raw_response.delete( "", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/test_url_normalization.py b/tests/api_resources/test_url_normalization.py index a97f75691b2..fb9e08f1bc5 100644 --- a/tests/api_resources/test_url_normalization.py +++ b/tests/api_resources/test_url_normalization.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - URLNormalizationGetResponse, - URLNormalizationUpdateResponse, -) +from cloudflare.types.url_normalization.url_normalization_get_response import URLNormalizationGetResponse +from cloudflare.types.url_normalization.url_normalization_update_response import URLNormalizationUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_url_scanner.py b/tests/api_resources/test_url_scanner.py index d1c66aed261..2c9ca0c4e1c 100644 --- a/tests/api_resources/test_url_scanner.py +++ b/tests/api_resources/test_url_scanner.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import URLScannerScanResponse from cloudflare._utils import parse_datetime +from cloudflare.types.url_scanner.url_scanner_scan_response import URLScannerScanResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_user.py b/tests/api_resources/test_user.py index 0d384f15858..a0177d27b31 100644 --- a/tests/api_resources/test_user.py +++ b/tests/api_resources/test_user.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import UserGetResponse, UserEditResponse +from cloudflare.types.user.user_get_response import UserGetResponse +from cloudflare.types.user.user_edit_response import UserEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_waiting_rooms.py b/tests/api_resources/test_waiting_rooms.py index b1cbfb03038..3ea7e7ca327 100644 --- a/tests/api_resources/test_waiting_rooms.py +++ b/tests/api_resources/test_waiting_rooms.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - WaitingRoom, - WaitingRoomDeleteResponse, -) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.waiting_rooms.waiting_room import WaitingRoom +from cloudflare.types.waiting_rooms.waiting_room_delete_response import WaitingRoomDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +23,7 @@ class TestWaitingRooms: @parametrize def test_method_create(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.create( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -37,7 +35,7 @@ def test_method_create(self, client: Cloudflare) -> None: @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.create( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -79,7 +77,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.waiting_rooms.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -95,7 +93,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.waiting_rooms.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -112,9 +110,9 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.with_raw_response.create( - "", + zone_id="", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -126,7 +124,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -139,7 +137,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_method_update_with_all_params(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -182,7 +180,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.waiting_rooms.with_raw_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -199,7 +197,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.waiting_rooms.with_streaming_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -216,10 +214,10 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.with_raw_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -229,7 +227,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.with_raw_response.update( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -240,7 +238,17 @@ def test_path_params_update(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.list( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + waiting_room = client.waiting_rooms.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, ) assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) @@ -248,7 +256,7 @@ def test_method_list(self, client: Cloudflare) -> None: @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.waiting_rooms.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -260,7 +268,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.waiting_rooms.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -273,9 +281,9 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.with_raw_response.list( - "", + zone_id="", ) @pytest.mark.skip() @@ -283,7 +291,8 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.delete( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(WaitingRoomDeleteResponse, waiting_room, path=["response"]) @@ -292,7 +301,8 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.waiting_rooms.with_raw_response.delete( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -305,7 +315,8 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.waiting_rooms.with_streaming_response.delete( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -318,16 +329,18 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.with_raw_response.delete( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.with_raw_response.delete( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -335,7 +348,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: def test_method_edit(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -348,7 +361,7 @@ def test_method_edit(self, client: Cloudflare) -> None: def test_method_edit_with_all_params(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -391,7 +404,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.waiting_rooms.with_raw_response.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -408,7 +421,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.waiting_rooms.with_streaming_response.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -425,10 +438,10 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.with_raw_response.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -438,7 +451,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.with_raw_response.edit( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -450,7 +463,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: def test_method_get(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(WaitingRoom, waiting_room, path=["response"]) @@ -459,7 +472,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.waiting_rooms.with_raw_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -472,7 +485,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.waiting_rooms.with_streaming_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -485,16 +498,16 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.with_raw_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -505,7 +518,7 @@ class TestAsyncWaitingRooms: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.create( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -517,7 +530,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: waiting_room = await async_client.waiting_rooms.create( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -559,7 +572,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.waiting_rooms.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -575,7 +588,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.waiting_rooms.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -592,9 +605,9 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.with_raw_response.create( - "", + zone_id="", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -606,7 +619,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -619,7 +632,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -662,7 +675,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.with_raw_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -679,7 +692,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.waiting_rooms.with_streaming_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -696,10 +709,10 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.with_raw_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -709,7 +722,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.with_raw_response.update( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -720,7 +733,17 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.list( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + waiting_room = await async_client.waiting_rooms.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, ) assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) @@ -728,7 +751,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -740,7 +763,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.waiting_rooms.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -753,9 +776,9 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.with_raw_response.list( - "", + zone_id="", ) @pytest.mark.skip() @@ -763,7 +786,8 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.delete( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(WaitingRoomDeleteResponse, waiting_room, path=["response"]) @@ -772,7 +796,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.waiting_rooms.with_raw_response.delete( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -785,7 +810,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.waiting_rooms.with_streaming_response.delete( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -798,16 +824,18 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.with_raw_response.delete( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.with_raw_response.delete( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -815,7 +843,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_edit(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -828,7 +856,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -871,7 +899,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.with_raw_response.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -888,7 +916,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.with_streaming_response.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -905,10 +933,10 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @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_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.with_raw_response.edit( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -918,7 +946,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.with_raw_response.edit( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", host="shop.example.com", name="production_webinar", new_users_per_minute=200, @@ -930,7 +958,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: async def test_method_get(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(WaitingRoom, waiting_room, path=["response"]) @@ -939,7 +967,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.with_raw_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -952,7 +980,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.with_streaming_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -965,14 +993,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip() @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.with_raw_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) diff --git a/tests/api_resources/test_warp_connector.py b/tests/api_resources/test_warp_connector.py index cf665427be7..a239db28f3b 100644 --- a/tests/api_resources/test_warp_connector.py +++ b/tests/api_resources/test_warp_connector.py @@ -9,16 +9,14 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - WARPConnectorGetResponse, - WARPConnectorEditResponse, - WARPConnectorListResponse, - WARPConnectorTokenResponse, - WARPConnectorCreateResponse, - WARPConnectorDeleteResponse, -) from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.warp_connector.warp_connector_get_response import WARPConnectorGetResponse +from cloudflare.types.warp_connector.warp_connector_edit_response import WARPConnectorEditResponse +from cloudflare.types.warp_connector.warp_connector_list_response import WARPConnectorListResponse +from cloudflare.types.warp_connector.warp_connector_token_response import WARPConnectorTokenResponse +from cloudflare.types.warp_connector.warp_connector_create_response import WARPConnectorCreateResponse +from cloudflare.types.warp_connector.warp_connector_delete_response import WARPConnectorDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -92,6 +90,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: name="blog", page=1, per_page=1, + uuid="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", was_active_at=parse_datetime("2009-11-10T23:00:00Z"), was_inactive_at=parse_datetime("2009-11-10T23:00:00Z"), ) @@ -425,6 +424,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) name="blog", page=1, per_page=1, + uuid="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", was_active_at=parse_datetime("2009-11-10T23:00:00Z"), was_inactive_at=parse_datetime("2009-11-10T23:00:00Z"), ) diff --git a/tests/api_resources/test_zones.py b/tests/api_resources/test_zones.py index a0fc3e6f431..71c8435ad40 100644 --- a/tests/api_resources/test_zones.py +++ b/tests/api_resources/test_zones.py @@ -9,8 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Zone, ZoneDeleteResponse from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.zones.zone import Zone +from cloudflare.types.zones.zone_delete_response import ZoneDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/url_scanner/test_scans.py b/tests/api_resources/url_scanner/test_scans.py index d0e817fddf5..720e7e936b7 100644 --- a/tests/api_resources/url_scanner/test_scans.py +++ b/tests/api_resources/url_scanner/test_scans.py @@ -17,11 +17,9 @@ StreamedBinaryAPIResponse, AsyncStreamedBinaryAPIResponse, ) -from cloudflare.types.url_scanner import ( - ScanGetResponse, - ScanHarResponse, - ScanCreateResponse, -) +from cloudflare.types.url_scanner.scan_get_response import ScanGetResponse +from cloudflare.types.url_scanner.scan_har_response import ScanHarResponse +from cloudflare.types.url_scanner.scan_create_response import ScanCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/user/billing/test_history.py b/tests/api_resources/user/billing/test_history.py index 69f5c9ab004..ec9b3cd5e2f 100644 --- a/tests/api_resources/user/billing/test_history.py +++ b/tests/api_resources/user/billing/test_history.py @@ -3,13 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.user.billing import HistoryGetResponse +from cloudflare._utils import parse_datetime +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.user.billing.billing_history import BillingHistory base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,39 +21,43 @@ class TestHistory: @pytest.mark.skip() @parametrize - def test_method_get(self, client: Cloudflare) -> None: - history = client.user.billing.history.get() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + def test_method_list(self, client: Cloudflare) -> None: + history = client.user.billing.history.list() + assert_matches_type(SyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - history = client.user.billing.history.get( + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + history = client.user.billing.history.list( + action="subscription", + occured_at=parse_datetime("2014-03-01T12:21:59.3456Z"), + occurred_at=parse_datetime("2014-03-01T12:21:59.3456Z"), order="occured_at", page=1, per_page=5, + type="charge", ) - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.user.billing.history.with_raw_response.get() + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.user.billing.history.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.user.billing.history.with_streaming_response.get() as response: + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.user.billing.history.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[BillingHistory], history, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,38 +67,42 @@ class TestAsyncHistory: @pytest.mark.skip() @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - history = await async_client.user.billing.history.get() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + history = await async_client.user.billing.history.list() + assert_matches_type(AsyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - history = await async_client.user.billing.history.get( + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + history = await async_client.user.billing.history.list( + action="subscription", + occured_at=parse_datetime("2014-03-01T12:21:59.3456Z"), + occurred_at=parse_datetime("2014-03-01T12:21:59.3456Z"), order="occured_at", page=1, per_page=5, + type="charge", ) - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.billing.history.with_raw_response.get() + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.user.billing.history.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.billing.history.with_streaming_response.get() as response: + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.user.billing.history.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[BillingHistory], history, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/billing/test_profile.py b/tests/api_resources/user/billing/test_profile.py index fdeecb4384e..ad5eea8b0c2 100644 --- a/tests/api_resources/user/billing/test_profile.py +++ b/tests/api_resources/user/billing/test_profile.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.user.billing import ProfileGetResponse +from cloudflare.types.user.billing.profile_get_response import ProfileGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/user/firewall/test_access_rules.py b/tests/api_resources/user/firewall/test_access_rules.py deleted file mode 100644 index a20ec3c2db9..00000000000 --- a/tests/api_resources/user/firewall/test_access_rules.py +++ /dev/null @@ -1,418 +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 SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.user.firewall import ( - FirewallRule, - AccessRuleDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAccessRules: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - access_rule = client.user.firewall.access_rules.create( - configuration={}, - mode="challenge", - ) - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - access_rule = client.user.firewall.access_rules.create( - configuration={ - "target": "ip", - "value": "198.51.100.4", - }, - mode="challenge", - notes="This rule is enabled because of an event that occurred on date X.", - ) - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.user.firewall.access_rules.with_raw_response.create( - configuration={}, - mode="challenge", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_rule = response.parse() - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.user.firewall.access_rules.with_streaming_response.create( - configuration={}, - mode="challenge", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_rule = response.parse() - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - access_rule = client.user.firewall.access_rules.list() - assert_matches_type(SyncV4PagePaginationArray[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_list_with_all_params(self, client: Cloudflare) -> None: - access_rule = client.user.firewall.access_rules.list( - direction="desc", - egs_pagination={ - "json": { - "page": 1, - "per_page": 1, - } - }, - filters={ - "configuration_target": "ip", - "configuration_value": "198.51.100.4", - "match": "any", - "mode": "challenge", - "notes": "my note", - }, - order="mode", - page=1, - per_page=20, - ) - assert_matches_type(SyncV4PagePaginationArray[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.user.firewall.access_rules.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.user.firewall.access_rules.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[FirewallRule], access_rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - access_rule = client.user.firewall.access_rules.delete( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) - assert_matches_type(Optional[AccessRuleDeleteResponse], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.user.firewall.access_rules.with_raw_response.delete( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_rule = response.parse() - assert_matches_type(Optional[AccessRuleDeleteResponse], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.user.firewall.access_rules.with_streaming_response.delete( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_rule = response.parse() - assert_matches_type(Optional[AccessRuleDeleteResponse], access_rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.user.firewall.access_rules.with_raw_response.delete( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - access_rule = client.user.firewall.access_rules.edit( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - access_rule = client.user.firewall.access_rules.edit( - "92f17202ed8bd63d69a66b86a49a8f6b", - mode="challenge", - notes="This rule is enabled because of an event that occurred on date X.", - ) - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.user.firewall.access_rules.with_raw_response.edit( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_rule = response.parse() - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.user.firewall.access_rules.with_streaming_response.edit( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_rule = response.parse() - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.user.firewall.access_rules.with_raw_response.edit( - "", - ) - - -class TestAsyncAccessRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - access_rule = await async_client.user.firewall.access_rules.create( - configuration={}, - mode="challenge", - ) - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - access_rule = await async_client.user.firewall.access_rules.create( - configuration={ - "target": "ip", - "value": "198.51.100.4", - }, - mode="challenge", - notes="This rule is enabled because of an event that occurred on date X.", - ) - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.firewall.access_rules.with_raw_response.create( - configuration={}, - mode="challenge", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_rule = await response.parse() - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.firewall.access_rules.with_streaming_response.create( - configuration={}, - mode="challenge", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_rule = await response.parse() - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - access_rule = await async_client.user.firewall.access_rules.list() - assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - access_rule = await async_client.user.firewall.access_rules.list( - direction="desc", - egs_pagination={ - "json": { - "page": 1, - "per_page": 1, - } - }, - filters={ - "configuration_target": "ip", - "configuration_value": "198.51.100.4", - "match": "any", - "mode": "challenge", - "notes": "my note", - }, - order="mode", - page=1, - per_page=20, - ) - assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.firewall.access_rules.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.firewall.access_rules.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_rule = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], access_rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - access_rule = await async_client.user.firewall.access_rules.delete( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) - assert_matches_type(Optional[AccessRuleDeleteResponse], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.firewall.access_rules.with_raw_response.delete( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_rule = await response.parse() - assert_matches_type(Optional[AccessRuleDeleteResponse], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.firewall.access_rules.with_streaming_response.delete( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_rule = await response.parse() - assert_matches_type(Optional[AccessRuleDeleteResponse], access_rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.user.firewall.access_rules.with_raw_response.delete( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - access_rule = await async_client.user.firewall.access_rules.edit( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - access_rule = await async_client.user.firewall.access_rules.edit( - "92f17202ed8bd63d69a66b86a49a8f6b", - mode="challenge", - notes="This rule is enabled because of an event that occurred on date X.", - ) - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.firewall.access_rules.with_raw_response.edit( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - access_rule = await response.parse() - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.firewall.access_rules.with_streaming_response.edit( - "92f17202ed8bd63d69a66b86a49a8f6b", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - access_rule = await response.parse() - assert_matches_type(Optional[FirewallRule], access_rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.user.firewall.access_rules.with_raw_response.edit( - "", - ) diff --git a/tests/api_resources/user/load_balancers/analytics/test_events.py b/tests/api_resources/user/load_balancers/analytics/test_events.py deleted file mode 100644 index 26e4e169ef3..00000000000 --- a/tests/api_resources/user/load_balancers/analytics/test_events.py +++ /dev/null @@ -1,108 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.user.load_balancers.analytics import LoadBalancingAnalytics - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEvents: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - event = client.user.load_balancers.analytics.events.list() - assert_matches_type(SyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_list_with_all_params(self, client: Cloudflare) -> None: - event = client.user.load_balancers.analytics.events.list( - origin_healthy=True, - origin_name="primary-dc-1", - pool_healthy=True, - pool_id="17b5962d775c646f3f9725cbc7a53df4", - pool_name="primary-dc", - since=parse_datetime("2016-11-11T12:00:00Z"), - until=parse_datetime("2016-11-11T13:00:00Z"), - ) - assert_matches_type(SyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.user.load_balancers.analytics.events.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.user.load_balancers.analytics.events.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncEvents: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - event = await async_client.user.load_balancers.analytics.events.list() - assert_matches_type(AsyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - event = await async_client.user.load_balancers.analytics.events.list( - origin_healthy=True, - origin_name="primary-dc-1", - pool_healthy=True, - pool_id="17b5962d775c646f3f9725cbc7a53df4", - pool_name="primary-dc", - since=parse_datetime("2016-11-11T12:00:00Z"), - until=parse_datetime("2016-11-11T13:00:00Z"), - ) - assert_matches_type(AsyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.analytics.events.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.analytics.events.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/load_balancers/test_monitors.py b/tests/api_resources/user/load_balancers/test_monitors.py deleted file mode 100644 index 359d83209c7..00000000000 --- a/tests/api_resources/user/load_balancers/test_monitors.py +++ /dev/null @@ -1,894 +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.user.load_balancers import ( - LoadBalancingMonitor, - MonitorDeleteResponse, - MonitorPreviewResponse, - MonitorReferencesResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestMonitors: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.create( - expected_codes="2xx", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.create( - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.create( - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.create( - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.update( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.update( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.update( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.update( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.update( - "", - expected_codes="2xx", - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.list() - assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.delete( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - assert_matches_type(MonitorDeleteResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.delete( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = response.parse() - assert_matches_type(MonitorDeleteResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.delete( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = response.parse() - assert_matches_type(MonitorDeleteResponse, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.delete( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.edit( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.edit( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.edit( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.edit( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.edit( - "", - expected_codes="2xx", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.get( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_preview(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.preview( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - assert_matches_type(MonitorPreviewResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_preview_with_all_params(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.preview( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(MonitorPreviewResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_preview(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.preview( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = response.parse() - assert_matches_type(MonitorPreviewResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_preview(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.preview( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = response.parse() - assert_matches_type(MonitorPreviewResponse, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_preview(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.preview( - "", - expected_codes="2xx", - ) - - @pytest.mark.skip() - @parametrize - def test_method_references(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.references( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - assert_matches_type(Optional[MonitorReferencesResponse], monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_references(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.references( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = response.parse() - assert_matches_type(Optional[MonitorReferencesResponse], monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_references(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.references( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = response.parse() - assert_matches_type(Optional[MonitorReferencesResponse], monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_references(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.references( - "", - ) - - -class TestAsyncMonitors: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.create( - expected_codes="2xx", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.create( - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.create( - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.create( - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.update( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.update( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.update( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.update( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.update( - "", - expected_codes="2xx", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.list() - assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.delete( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - assert_matches_type(MonitorDeleteResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.delete( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = await response.parse() - assert_matches_type(MonitorDeleteResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.delete( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = await response.parse() - assert_matches_type(MonitorDeleteResponse, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.delete( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.edit( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.edit( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.edit( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.edit( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.edit( - "", - expected_codes="2xx", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = await response.parse() - assert_matches_type(LoadBalancingMonitor, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.get( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_preview(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.preview( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - assert_matches_type(MonitorPreviewResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_preview_with_all_params(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.preview( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(MonitorPreviewResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.preview( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = await response.parse() - assert_matches_type(MonitorPreviewResponse, monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_preview(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.preview( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = await response.parse() - assert_matches_type(MonitorPreviewResponse, monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_preview(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.preview( - "", - expected_codes="2xx", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_references(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.references( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - assert_matches_type(Optional[MonitorReferencesResponse], monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_references(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.references( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - monitor = await response.parse() - assert_matches_type(Optional[MonitorReferencesResponse], monitor, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_references(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.references( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - monitor = await response.parse() - assert_matches_type(Optional[MonitorReferencesResponse], monitor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_references(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.references( - "", - ) diff --git a/tests/api_resources/user/load_balancers/test_pools.py b/tests/api_resources/user/load_balancers/test_pools.py deleted file mode 100644 index 213bc1b0df2..00000000000 --- a/tests/api_resources/user/load_balancers/test_pools.py +++ /dev/null @@ -1,1199 +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.user.load_balancers import ( - LoadBalancingPool, - PoolDeleteResponse, - PoolHealthResponse, - PoolPreviewResponse, - PoolReferencesResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPools: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.create( - name="primary-dc-1", - origins=[{}, {}, {}], - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.create( - name="primary-dc-1", - origins=[ - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - ], - check_regions=["WEU", "ENAM"], - description="Primary data center - Provider XYZ", - enabled=False, - latitude=0, - load_shedding={ - "default_percent": 0, - "default_policy": "random", - "session_percent": 0, - "session_policy": "hash", - }, - longitude=0, - minimum_origins=0, - monitor={}, - notification_email="someone@example.com,sometwo@example.com", - notification_filter={ - "origin": { - "disable": True, - "healthy": True, - }, - "pool": { - "disable": True, - "healthy": False, - }, - }, - origin_steering={"policy": "random"}, - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.create( - name="primary-dc-1", - origins=[{}, {}, {}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.create( - name="primary-dc-1", - origins=[{}, {}, {}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.update( - "17b5962d775c646f3f9725cbc7a53df4", - name="primary-dc-1", - origins=[{}, {}, {}], - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.update( - "17b5962d775c646f3f9725cbc7a53df4", - name="primary-dc-1", - origins=[ - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - ], - check_regions=["WEU", "ENAM"], - description="Primary data center - Provider XYZ", - enabled=False, - latitude=0, - load_shedding={ - "default_percent": 0, - "default_policy": "random", - "session_percent": 0, - "session_policy": "hash", - }, - longitude=0, - minimum_origins=0, - monitor={}, - notification_email="someone@example.com,sometwo@example.com", - notification_filter={ - "origin": { - "disable": True, - "healthy": True, - }, - "pool": { - "disable": True, - "healthy": False, - }, - }, - origin_steering={"policy": "random"}, - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.update( - "17b5962d775c646f3f9725cbc7a53df4", - name="primary-dc-1", - origins=[{}, {}, {}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.update( - "17b5962d775c646f3f9725cbc7a53df4", - name="primary-dc-1", - origins=[{}, {}, {}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.update( - "", - name="primary-dc-1", - origins=[{}, {}, {}], - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.list() - assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_list_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.list( - monitor={}, - ) - assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.delete( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(PoolDeleteResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.delete( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(PoolDeleteResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.delete( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(PoolDeleteResponse, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.delete( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.edit( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.edit( - "17b5962d775c646f3f9725cbc7a53df4", - check_regions=["WEU", "ENAM"], - description="Primary data center - Provider XYZ", - enabled=False, - latitude=0, - load_shedding={ - "default_percent": 0, - "default_policy": "random", - "session_percent": 0, - "session_policy": "hash", - }, - longitude=0, - minimum_origins=0, - monitor={}, - name="primary-dc-1", - notification_email="someone@example.com,sometwo@example.com", - notification_filter={ - "origin": { - "disable": True, - "healthy": True, - }, - "pool": { - "disable": True, - "healthy": False, - }, - }, - origin_steering={"policy": "random"}, - origins=[ - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - ], - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.edit( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.edit( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.edit( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.get( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.get( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.get( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.get( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_health(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.health( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(PoolHealthResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_health(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.health( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(PoolHealthResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_health(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.health( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(PoolHealthResponse, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_health(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.health( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_preview(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.preview( - "17b5962d775c646f3f9725cbc7a53df4", - expected_codes="2xx", - ) - assert_matches_type(PoolPreviewResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_preview_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.preview( - "17b5962d775c646f3f9725cbc7a53df4", - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(PoolPreviewResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_preview(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.preview( - "17b5962d775c646f3f9725cbc7a53df4", - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(PoolPreviewResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_preview(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.preview( - "17b5962d775c646f3f9725cbc7a53df4", - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(PoolPreviewResponse, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_preview(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.preview( - "", - expected_codes="2xx", - ) - - @pytest.mark.skip() - @parametrize - def test_method_references(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.references( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(Optional[PoolReferencesResponse], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_references(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.references( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = response.parse() - assert_matches_type(Optional[PoolReferencesResponse], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_references(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.references( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = response.parse() - assert_matches_type(Optional[PoolReferencesResponse], pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_references(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.references( - "", - ) - - -class TestAsyncPools: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.create( - name="primary-dc-1", - origins=[{}, {}, {}], - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.create( - name="primary-dc-1", - origins=[ - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - ], - check_regions=["WEU", "ENAM"], - description="Primary data center - Provider XYZ", - enabled=False, - latitude=0, - load_shedding={ - "default_percent": 0, - "default_policy": "random", - "session_percent": 0, - "session_policy": "hash", - }, - longitude=0, - minimum_origins=0, - monitor={}, - notification_email="someone@example.com,sometwo@example.com", - notification_filter={ - "origin": { - "disable": True, - "healthy": True, - }, - "pool": { - "disable": True, - "healthy": False, - }, - }, - origin_steering={"policy": "random"}, - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.create( - name="primary-dc-1", - origins=[{}, {}, {}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.create( - name="primary-dc-1", - origins=[{}, {}, {}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.update( - "17b5962d775c646f3f9725cbc7a53df4", - name="primary-dc-1", - origins=[{}, {}, {}], - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.update( - "17b5962d775c646f3f9725cbc7a53df4", - name="primary-dc-1", - origins=[ - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - ], - check_regions=["WEU", "ENAM"], - description="Primary data center - Provider XYZ", - enabled=False, - latitude=0, - load_shedding={ - "default_percent": 0, - "default_policy": "random", - "session_percent": 0, - "session_policy": "hash", - }, - longitude=0, - minimum_origins=0, - monitor={}, - notification_email="someone@example.com,sometwo@example.com", - notification_filter={ - "origin": { - "disable": True, - "healthy": True, - }, - "pool": { - "disable": True, - "healthy": False, - }, - }, - origin_steering={"policy": "random"}, - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.update( - "17b5962d775c646f3f9725cbc7a53df4", - name="primary-dc-1", - origins=[{}, {}, {}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.update( - "17b5962d775c646f3f9725cbc7a53df4", - name="primary-dc-1", - origins=[{}, {}, {}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.update( - "", - name="primary-dc-1", - origins=[{}, {}, {}], - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.list() - assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.list( - monitor={}, - ) - assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.delete( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(PoolDeleteResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.delete( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(PoolDeleteResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.delete( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(PoolDeleteResponse, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.delete( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.edit( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.edit( - "17b5962d775c646f3f9725cbc7a53df4", - check_regions=["WEU", "ENAM"], - description="Primary data center - Provider XYZ", - enabled=False, - latitude=0, - load_shedding={ - "default_percent": 0, - "default_policy": "random", - "session_percent": 0, - "session_policy": "hash", - }, - longitude=0, - minimum_origins=0, - monitor={}, - name="primary-dc-1", - notification_email="someone@example.com,sometwo@example.com", - notification_filter={ - "origin": { - "disable": True, - "healthy": True, - }, - "pool": { - "disable": True, - "healthy": False, - }, - }, - origin_steering={"policy": "random"}, - origins=[ - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - { - "address": "0.0.0.0", - "enabled": True, - "header": {"host": ["example.com", "example.com", "example.com"]}, - "name": "app-server-1", - "virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4", - "weight": 0.6, - }, - ], - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.edit( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.edit( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.edit( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.get( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.get( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.get( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(LoadBalancingPool, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.get( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_health(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.health( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(PoolHealthResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_health(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.health( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(PoolHealthResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_health(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.health( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(PoolHealthResponse, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_health(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.health( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_preview(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.preview( - "17b5962d775c646f3f9725cbc7a53df4", - expected_codes="2xx", - ) - assert_matches_type(PoolPreviewResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_preview_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.preview( - "17b5962d775c646f3f9725cbc7a53df4", - expected_codes="2xx", - allow_insecure=True, - consecutive_down=0, - consecutive_up=0, - description="Login page monitor", - expected_body="alive", - follow_redirects=True, - header={ - "Host": ["example.com"], - "X-App-ID": ["abc123"], - }, - interval=0, - method="GET", - path="/health", - port=0, - probe_zone="example.com", - retries=0, - load_balancer_monitor_timeout=0, - type="https", - ) - assert_matches_type(PoolPreviewResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.preview( - "17b5962d775c646f3f9725cbc7a53df4", - expected_codes="2xx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(PoolPreviewResponse, pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_preview(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.preview( - "17b5962d775c646f3f9725cbc7a53df4", - expected_codes="2xx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(PoolPreviewResponse, pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_preview(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.preview( - "", - expected_codes="2xx", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_references(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.references( - "17b5962d775c646f3f9725cbc7a53df4", - ) - assert_matches_type(Optional[PoolReferencesResponse], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_references(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.references( - "17b5962d775c646f3f9725cbc7a53df4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pool = await response.parse() - assert_matches_type(Optional[PoolReferencesResponse], pool, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_references(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.references( - "17b5962d775c646f3f9725cbc7a53df4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pool = await response.parse() - assert_matches_type(Optional[PoolReferencesResponse], pool, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_references(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.references( - "", - ) diff --git a/tests/api_resources/user/load_balancers/test_preview.py b/tests/api_resources/user/load_balancers/test_preview.py deleted file mode 100644 index a5da3f9e2c9..00000000000 --- a/tests/api_resources/user/load_balancers/test_preview.py +++ /dev/null @@ -1,106 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.user.load_balancers import LoadBalancingPreview - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPreview: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - preview = client.user.load_balancers.preview.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.user.load_balancers.preview.with_raw_response.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preview = response.parse() - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.user.load_balancers.preview.with_streaming_response.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - preview = response.parse() - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `preview_id` but received ''"): - client.user.load_balancers.preview.with_raw_response.get( - "", - ) - - -class TestAsyncPreview: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - preview = await async_client.user.load_balancers.preview.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.preview.with_raw_response.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preview = await response.parse() - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.preview.with_streaming_response.get( - "f1aba936b94213e5b8dca0c0dbf1f9cc", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - preview = await response.parse() - assert_matches_type(LoadBalancingPreview, preview, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `preview_id` but received ''"): - await async_client.user.load_balancers.preview.with_raw_response.get( - "", - ) diff --git a/tests/api_resources/user/test_audit_logs.py b/tests/api_resources/user/test_audit_logs.py index 6d0b5089a82..9e0cc79a68c 100644 --- a/tests/api_resources/user/test_audit_logs.py +++ b/tests/api_resources/user/test_audit_logs.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.user import AuditLogListResponse +from cloudflare.types.shared.audit_log import AuditLog base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ class TestAuditLogs: @parametrize def test_method_list(self, client: Cloudflare) -> None: audit_log = client.user.audit_logs.list() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: since=parse_datetime("2019-04-30T01:12:20Z"), zone={"name": "example.com"}, ) - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +64,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +76,7 @@ class TestAsyncAuditLogs: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: audit_log = await async_client.user.audit_logs.list() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +97,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) since=parse_datetime("2019-04-30T01:12:20Z"), zone={"name": "example.com"}, ) - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,6 +117,6 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[AuditLog], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/test_invites.py b/tests/api_resources/user/test_invites.py index 9527cdf4a38..c188cf81082 100644 --- a/tests/api_resources/user/test_invites.py +++ b/tests/api_resources/user/test_invites.py @@ -10,7 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.user import InviteGetResponse, InviteEditResponse, InviteListResponse +from cloudflare.types.user.invite import Invite +from cloudflare.types.user.invite_get_response import InviteGetResponse +from cloudflare.types.user.invite_edit_response import InviteEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +24,7 @@ class TestInvites: @parametrize def test_method_list(self, client: Cloudflare) -> None: invite = client.user.invites.list() - assert_matches_type(SyncSinglePage[InviteListResponse], invite, path=["response"]) + assert_matches_type(SyncSinglePage[Invite], invite, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,7 +34,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(SyncSinglePage[InviteListResponse], invite, path=["response"]) + assert_matches_type(SyncSinglePage[Invite], invite, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +44,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(SyncSinglePage[InviteListResponse], invite, path=["response"]) + assert_matches_type(SyncSinglePage[Invite], invite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -142,7 +144,7 @@ class TestAsyncInvites: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: invite = await async_client.user.invites.list() - assert_matches_type(AsyncSinglePage[InviteListResponse], invite, path=["response"]) + assert_matches_type(AsyncSinglePage[Invite], invite, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +154,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(AsyncSinglePage[InviteListResponse], invite, path=["response"]) + assert_matches_type(AsyncSinglePage[Invite], invite, path=["response"]) @pytest.mark.skip() @parametrize @@ -162,7 +164,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(AsyncSinglePage[InviteListResponse], invite, path=["response"]) + assert_matches_type(AsyncSinglePage[Invite], invite, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/test_organizations.py b/tests/api_resources/user/test_organizations.py index b0b008cc682..0745c8cd46f 100644 --- a/tests/api_resources/user/test_organizations.py +++ b/tests/api_resources/user/test_organizations.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.user import ( - Organization, - OrganizationGetResponse, - OrganizationDeleteResponse, -) +from cloudflare.types.user.organization import Organization +from cloudflare.types.user.organization_get_response import OrganizationGetResponse +from cloudflare.types.user.organization_delete_response import OrganizationDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -69,6 +67,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: organization = client.user.organizations.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(OrganizationDeleteResponse, organization, path=["response"]) @@ -77,6 +76,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.user.organizations.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -89,6 +89,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.user.organizations.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -104,6 +105,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `organization_id` but received ''"): client.user.organizations.with_raw_response.delete( "", + body={}, ) @pytest.mark.skip() @@ -199,6 +201,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N async def test_method_delete(self, async_client: AsyncCloudflare) -> None: organization = await async_client.user.organizations.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(OrganizationDeleteResponse, organization, path=["response"]) @@ -207,6 +210,7 @@ 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.user.organizations.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -219,6 +223,7 @@ 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.user.organizations.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -234,6 +239,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `organization_id` but received ''"): await async_client.user.organizations.with_raw_response.delete( "", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/user/test_subscriptions.py b/tests/api_resources/user/test_subscriptions.py index 916a255ac11..1cd6b742671 100644 --- a/tests/api_resources/user/test_subscriptions.py +++ b/tests/api_resources/user/test_subscriptions.py @@ -9,12 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.user import ( - SubscriptionGetResponse, - SubscriptionEditResponse, - SubscriptionDeleteResponse, - SubscriptionUpdateResponse, -) +from cloudflare.types.user.subscription_get_response import SubscriptionGetResponse +from cloudflare.types.user.subscription_edit_response import SubscriptionEditResponse +from cloudflare.types.user.subscription_delete_response import SubscriptionDeleteResponse +from cloudflare.types.user.subscription_update_response import SubscriptionUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -109,6 +107,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: subscription = client.user.subscriptions.delete( "506e3185e9c882d175a2d0cb0093d9f2", + body={}, ) assert_matches_type(SubscriptionDeleteResponse, subscription, path=["response"]) @@ -117,6 +116,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.user.subscriptions.with_raw_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", + body={}, ) assert response.is_closed is True @@ -129,6 +129,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.user.subscriptions.with_streaming_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -144,6 +145,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): client.user.subscriptions.with_raw_response.delete( "", + body={}, ) @pytest.mark.skip() @@ -347,6 +349,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: subscription = await async_client.user.subscriptions.delete( "506e3185e9c882d175a2d0cb0093d9f2", + body={}, ) assert_matches_type(SubscriptionDeleteResponse, subscription, path=["response"]) @@ -355,6 +358,7 @@ 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.user.subscriptions.with_raw_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", + body={}, ) assert response.is_closed is True @@ -367,6 +371,7 @@ 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.user.subscriptions.with_streaming_response.delete( "506e3185e9c882d175a2d0cb0093d9f2", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -382,6 +387,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): await async_client.user.subscriptions.with_raw_response.delete( "", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/user/test_tokens.py b/tests/api_resources/user/test_tokens.py index 3016556574a..42faf189580 100644 --- a/tests/api_resources/user/test_tokens.py +++ b/tests/api_resources/user/test_tokens.py @@ -11,13 +11,11 @@ from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.user import ( - TokenGetResponse, - TokenCreateResponse, - TokenDeleteResponse, - TokenUpdateResponse, - TokenVerifyResponse, -) +from cloudflare.types.user.token_get_response import TokenGetResponse +from cloudflare.types.user.token_create_response import TokenCreateResponse +from cloudflare.types.user.token_delete_response import TokenDeleteResponse +from cloudflare.types.user.token_update_response import TokenUpdateResponse +from cloudflare.types.user.token_verify_response import TokenVerifyResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -384,6 +382,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: token = client.user.tokens.delete( {}, + body={}, ) assert_matches_type(Optional[TokenDeleteResponse], token, path=["response"]) @@ -392,6 +391,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.user.tokens.with_raw_response.delete( {}, + body={}, ) assert response.is_closed is True @@ -404,6 +404,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.user.tokens.with_streaming_response.delete( {}, + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -838,6 +839,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N async def test_method_delete(self, async_client: AsyncCloudflare) -> None: token = await async_client.user.tokens.delete( {}, + body={}, ) assert_matches_type(Optional[TokenDeleteResponse], token, path=["response"]) @@ -846,6 +848,7 @@ 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.user.tokens.with_raw_response.delete( {}, + body={}, ) assert response.is_closed is True @@ -858,6 +861,7 @@ 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.user.tokens.with_streaming_response.delete( {}, + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/vectorize/test_indexes.py b/tests/api_resources/vectorize/test_indexes.py index 019423f0773..2ede6c609fd 100644 --- a/tests/api_resources/vectorize/test_indexes.py +++ b/tests/api_resources/vectorize/test_indexes.py @@ -10,14 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.vectorize import ( - IndexDeleteResponse, - VectorizeIndexQuery, - VectorizeCreateIndex, - VectorizeIndexInsert, - VectorizeIndexUpsert, - VectorizeIndexDeleteVectorsByID, -) +from cloudflare.types.vectorize.index_query import IndexQuery +from cloudflare.types.vectorize.create_index import CreateIndex +from cloudflare.types.vectorize.index_insert import IndexInsert +from cloudflare.types.vectorize.index_upsert import IndexUpsert +from cloudflare.types.vectorize.index_delete_response import IndexDeleteResponse +from cloudflare.types.vectorize.index_delete_vectors_by_id import IndexDeleteVectorsByID base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,60 +27,75 @@ class TestIndexes: @parametrize def test_method_create(self, client: Cloudflare) -> None: index = client.vectorize.indexes.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", ) - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: index = client.vectorize.indexes.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", description="This is my example index.", ) - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.create( - "", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", ) @@ -91,55 +104,55 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: index = client.vectorize.indexes.update( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is my example index.", ) - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.update( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is my example index.", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.update( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is my example index.", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.update( "example-index", - account_identifier="", + account_id="", description="This is my example index.", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.update( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is my example index.", ) @@ -147,42 +160,42 @@ def test_path_params_update(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: index = client.vectorize.indexes.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(SyncSinglePage[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(SyncSinglePage[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(SyncSinglePage[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(SyncSinglePage[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(SyncSinglePage[CreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.list( - "", + account_id="", ) @pytest.mark.skip() @@ -190,51 +203,51 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: index = client.vectorize.indexes.delete( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) + assert_matches_type(IndexDeleteResponse, index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.delete( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) + assert_matches_type(IndexDeleteResponse, index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.delete( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) + assert_matches_type(IndexDeleteResponse, index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.delete( "example-index", - account_identifier="", + account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.delete( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -242,61 +255,61 @@ def test_path_params_delete(self, client: Cloudflare) -> None: def test_method_delete_by_ids(self, client: Cloudflare) -> None: index = client.vectorize.indexes.delete_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[VectorizeIndexDeleteVectorsByID], index, path=["response"]) + assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) @pytest.mark.skip() @parametrize def test_method_delete_by_ids_with_all_params(self, client: Cloudflare) -> None: index = client.vectorize.indexes.delete_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ids=["5121db81354a40c6aedc3fe1ace51c59", "f90eb49c2107486abdfd78c67e853430"], ) - assert_matches_type(Optional[VectorizeIndexDeleteVectorsByID], index, path=["response"]) + assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_delete_by_ids(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.delete_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeIndexDeleteVectorsByID], index, path=["response"]) + assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_delete_by_ids(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.delete_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeIndexDeleteVectorsByID], index, path=["response"]) + assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_delete_by_ids(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.delete_by_ids( "example-index", - account_identifier="", + account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.delete_by_ids( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -304,51 +317,51 @@ def test_path_params_delete_by_ids(self, client: Cloudflare) -> None: def test_method_get(self, client: Cloudflare) -> None: index = client.vectorize.indexes.get( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.get( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.get( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.get( "example-index", - account_identifier="", + account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.get( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -356,7 +369,7 @@ def test_path_params_get(self, client: Cloudflare) -> None: def test_method_get_by_ids(self, client: Cloudflare) -> None: index = client.vectorize.indexes.get_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(object, index, path=["response"]) @@ -365,7 +378,7 @@ def test_method_get_by_ids(self, client: Cloudflare) -> None: def test_method_get_by_ids_with_all_params(self, client: Cloudflare) -> None: index = client.vectorize.indexes.get_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ids=["5121db81354a40c6aedc3fe1ace51c59", "f90eb49c2107486abdfd78c67e853430"], ) assert_matches_type(object, index, path=["response"]) @@ -375,7 +388,7 @@ def test_method_get_by_ids_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_get_by_ids(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.get_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -388,7 +401,7 @@ def test_raw_response_get_by_ids(self, client: Cloudflare) -> None: def test_streaming_response_get_by_ids(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.get_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -401,16 +414,16 @@ def test_streaming_response_get_by_ids(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_get_by_ids(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.get_by_ids( "example-index", - account_identifier="", + account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.get_by_ids( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -418,51 +431,56 @@ def test_path_params_get_by_ids(self, client: Cloudflare) -> None: def test_method_insert(self, client: Cloudflare) -> None: index = client.vectorize.indexes.insert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[VectorizeIndexInsert], index, path=["response"]) + assert_matches_type(Optional[IndexInsert], index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_insert(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.insert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeIndexInsert], index, path=["response"]) + assert_matches_type(Optional[IndexInsert], index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_insert(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.insert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeIndexInsert], index, path=["response"]) + assert_matches_type(Optional[IndexInsert], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_insert(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.insert( "example-index", - account_identifier="", + account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.insert( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -470,64 +488,73 @@ def test_path_params_insert(self, client: Cloudflare) -> None: def test_method_query(self, client: Cloudflare) -> None: index = client.vectorize.indexes.query( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], ) - assert_matches_type(Optional[VectorizeIndexQuery], index, path=["response"]) + assert_matches_type(Optional[IndexQuery], index, path=["response"]) @pytest.mark.skip() @parametrize def test_method_query_with_all_params(self, client: Cloudflare) -> None: index = client.vectorize.indexes.query( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], + filter={ + "has_viewed": {"$ne": True}, + "streaming_platform": "netflix", + }, return_metadata=True, return_values=True, top_k=5, - vector=[0.5, 0.5, 0.5], ) - assert_matches_type(Optional[VectorizeIndexQuery], index, path=["response"]) + assert_matches_type(Optional[IndexQuery], index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_query(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.query( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeIndexQuery], index, path=["response"]) + assert_matches_type(Optional[IndexQuery], index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_query(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.query( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeIndexQuery], index, path=["response"]) + assert_matches_type(Optional[IndexQuery], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_query(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.query( "example-index", - account_identifier="", + account_id="", + vector=[0.5, 0.5, 0.5], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.query( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], ) @pytest.mark.skip() @@ -535,51 +562,56 @@ def test_path_params_query(self, client: Cloudflare) -> None: def test_method_upsert(self, client: Cloudflare) -> None: index = client.vectorize.indexes.upsert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[VectorizeIndexUpsert], index, path=["response"]) + assert_matches_type(Optional[IndexUpsert], index, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_upsert(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.upsert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeIndexUpsert], index, path=["response"]) + assert_matches_type(Optional[IndexUpsert], index, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_upsert(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.upsert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(Optional[VectorizeIndexUpsert], index, path=["response"]) + assert_matches_type(Optional[IndexUpsert], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_upsert(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.vectorize.indexes.with_raw_response.upsert( "example-index", - account_identifier="", + account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.upsert( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @@ -590,60 +622,75 @@ class TestAsyncIndexes: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", ) - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", description="This is my example index.", ) - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.create( - "", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, + account_id="", + config={ + "dimensions": 768, + "metric": "cosine", + }, name="example-index", ) @@ -652,55 +699,55 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.update( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is my example index.", ) - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.update( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is my example index.", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.update( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is my example index.", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.update( "example-index", - account_identifier="", + account_id="", description="This is my example index.", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): await async_client.vectorize.indexes.with_raw_response.update( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is my example index.", ) @@ -708,42 +755,42 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(AsyncSinglePage[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(AsyncSinglePage[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(AsyncSinglePage[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(AsyncSinglePage[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(AsyncSinglePage[CreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.list( - "", + account_id="", ) @pytest.mark.skip() @@ -751,51 +798,51 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.delete( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) + assert_matches_type(IndexDeleteResponse, index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.delete( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) + assert_matches_type(IndexDeleteResponse, index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.delete( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) + assert_matches_type(IndexDeleteResponse, index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.delete( "example-index", - account_identifier="", + account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): await async_client.vectorize.indexes.with_raw_response.delete( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -803,61 +850,61 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_delete_by_ids(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.delete_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[VectorizeIndexDeleteVectorsByID], index, path=["response"]) + assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_delete_by_ids_with_all_params(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.delete_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ids=["5121db81354a40c6aedc3fe1ace51c59", "f90eb49c2107486abdfd78c67e853430"], ) - assert_matches_type(Optional[VectorizeIndexDeleteVectorsByID], index, path=["response"]) + assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_delete_by_ids(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.delete_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeIndexDeleteVectorsByID], index, path=["response"]) + assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_delete_by_ids(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.delete_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeIndexDeleteVectorsByID], index, path=["response"]) + assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_delete_by_ids(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.delete_by_ids( "example-index", - account_identifier="", + account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): await async_client.vectorize.indexes.with_raw_response.delete_by_ids( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -865,51 +912,51 @@ async def test_path_params_delete_by_ids(self, async_client: AsyncCloudflare) -> async def test_method_get(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.get( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.get( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.get( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeCreateIndex], index, path=["response"]) + assert_matches_type(Optional[CreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.get( "example-index", - account_identifier="", + account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): await async_client.vectorize.indexes.with_raw_response.get( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -917,7 +964,7 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: async def test_method_get_by_ids(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.get_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(object, index, path=["response"]) @@ -926,7 +973,7 @@ async def test_method_get_by_ids(self, async_client: AsyncCloudflare) -> None: async def test_method_get_by_ids_with_all_params(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.get_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ids=["5121db81354a40c6aedc3fe1ace51c59", "f90eb49c2107486abdfd78c67e853430"], ) assert_matches_type(object, index, path=["response"]) @@ -936,7 +983,7 @@ async def test_method_get_by_ids_with_all_params(self, async_client: AsyncCloudf async def test_raw_response_get_by_ids(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.get_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -949,7 +996,7 @@ async def test_raw_response_get_by_ids(self, async_client: AsyncCloudflare) -> N async def test_streaming_response_get_by_ids(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.get_by_ids( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -962,16 +1009,16 @@ async def test_streaming_response_get_by_ids(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_path_params_get_by_ids(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.get_by_ids( "example-index", - account_identifier="", + account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): await async_client.vectorize.indexes.with_raw_response.get_by_ids( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -979,51 +1026,56 @@ async def test_path_params_get_by_ids(self, async_client: AsyncCloudflare) -> No async def test_method_insert(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.insert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[VectorizeIndexInsert], index, path=["response"]) + assert_matches_type(Optional[IndexInsert], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_insert(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.insert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeIndexInsert], index, path=["response"]) + assert_matches_type(Optional[IndexInsert], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_insert(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.insert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeIndexInsert], index, path=["response"]) + assert_matches_type(Optional[IndexInsert], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_insert(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.insert( "example-index", - account_identifier="", + account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): await async_client.vectorize.indexes.with_raw_response.insert( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -1031,64 +1083,73 @@ async def test_path_params_insert(self, async_client: AsyncCloudflare) -> None: async def test_method_query(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.query( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], ) - assert_matches_type(Optional[VectorizeIndexQuery], index, path=["response"]) + assert_matches_type(Optional[IndexQuery], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_query_with_all_params(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.query( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], + filter={ + "has_viewed": {"$ne": True}, + "streaming_platform": "netflix", + }, return_metadata=True, return_values=True, top_k=5, - vector=[0.5, 0.5, 0.5], ) - assert_matches_type(Optional[VectorizeIndexQuery], index, path=["response"]) + assert_matches_type(Optional[IndexQuery], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_query(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.query( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeIndexQuery], index, path=["response"]) + assert_matches_type(Optional[IndexQuery], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_query(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.query( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeIndexQuery], index, path=["response"]) + assert_matches_type(Optional[IndexQuery], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_query(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.query( "example-index", - account_identifier="", + account_id="", + vector=[0.5, 0.5, 0.5], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): await async_client.vectorize.indexes.with_raw_response.query( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + vector=[0.5, 0.5, 0.5], ) @pytest.mark.skip() @@ -1096,49 +1157,54 @@ async def test_path_params_query(self, async_client: AsyncCloudflare) -> None: async def test_method_upsert(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.upsert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(Optional[VectorizeIndexUpsert], index, path=["response"]) + assert_matches_type(Optional[IndexUpsert], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_upsert(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.upsert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeIndexUpsert], index, path=["response"]) + assert_matches_type(Optional[IndexUpsert], index, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_upsert(self, async_client: AsyncCloudflare) -> None: async with async_client.vectorize.indexes.with_streaming_response.upsert( "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(Optional[VectorizeIndexUpsert], index, path=["response"]) + assert_matches_type(Optional[IndexUpsert], index, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_upsert(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.vectorize.indexes.with_raw_response.upsert( "example-index", - account_identifier="", + account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): await async_client.vectorize.indexes.with_raw_response.upsert( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) diff --git a/tests/api_resources/waiting_rooms/events/test_details.py b/tests/api_resources/waiting_rooms/events/test_details.py index 0de30ba6d50..8d9a4fbf531 100644 --- a/tests/api_resources/waiting_rooms/events/test_details.py +++ b/tests/api_resources/waiting_rooms/events/test_details.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.waiting_rooms.events import WaitingroomEventDetails +from cloudflare.types.waiting_rooms.events.detail_get_response import DetailGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,62 +22,62 @@ class TestDetails: def test_method_get(self, client: Cloudflare) -> None: detail = client.waiting_rooms.events.details.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) + assert_matches_type(DetailGetResponse, detail, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.waiting_rooms.events.details.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" detail = response.parse() - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) + assert_matches_type(DetailGetResponse, detail, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.waiting_rooms.events.details.with_streaming_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" detail = response.parse() - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) + assert_matches_type(DetailGetResponse, detail, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.events.details.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.events.details.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): client.waiting_rooms.events.details.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) @@ -90,61 +90,61 @@ class TestAsyncDetails: async def test_method_get(self, async_client: AsyncCloudflare) -> None: detail = await async_client.waiting_rooms.events.details.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) + assert_matches_type(DetailGetResponse, detail, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.events.details.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" detail = await response.parse() - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) + assert_matches_type(DetailGetResponse, detail, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.events.details.with_streaming_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" detail = await response.parse() - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) + assert_matches_type(DetailGetResponse, detail, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.events.details.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.events.details.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): await async_client.waiting_rooms.events.details.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) diff --git a/tests/api_resources/waiting_rooms/test_events.py b/tests/api_resources/waiting_rooms/test_events.py index 85413cb8950..901ca61d711 100644 --- a/tests/api_resources/waiting_rooms/test_events.py +++ b/tests/api_resources/waiting_rooms/test_events.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.waiting_rooms import ( - WaitingroomEvent, - EventDeleteResponse, -) +from cloudflare.types.waiting_rooms.event import Event +from cloudflare.types.waiting_rooms.event_delete_response import EventDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,19 +24,19 @@ class TestEvents: def test_method_create(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -53,14 +51,14 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: suspended=True, total_active_users=200, ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.waiting_rooms.events.with_raw_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -69,14 +67,14 @@ 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" event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.waiting_rooms.events.with_streaming_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -85,17 +83,17 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.events.with_raw_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -104,7 +102,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.events.with_raw_response.create( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -115,20 +113,20 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -144,14 +142,14 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: suspended=True, total_active_users=200, ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.waiting_rooms.events.with_raw_response.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -161,14 +159,14 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.waiting_rooms.events.with_streaming_response.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -178,17 +176,17 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.events.with_raw_response.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -198,7 +196,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.events.with_raw_response.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -208,7 +206,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): client.waiting_rooms.events.with_raw_response.update( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -220,51 +218,62 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_list(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) + assert_matches_type(SyncSinglePage[Event], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + event = client.waiting_rooms.events.list( + "699d98642c564d2e855e9661899b7252", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(SyncSinglePage[Event], event, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.waiting_rooms.events.with_raw_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) + assert_matches_type(SyncSinglePage[Event], event, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.waiting_rooms.events.with_streaming_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) + assert_matches_type(SyncSinglePage[Event], event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.events.with_raw_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.events.with_raw_response.list( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -272,8 +281,9 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(EventDeleteResponse, event, path=["response"]) @@ -282,8 +292,9 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.waiting_rooms.events.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -296,8 +307,9 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.waiting_rooms.events.with_streaming_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -310,25 +322,28 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.events.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.events.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): client.waiting_rooms.events.with_raw_response.delete( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -336,20 +351,20 @@ def test_path_params_delete(self, client: Cloudflare) -> None: def test_method_edit(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -365,14 +380,14 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: suspended=True, total_active_users=200, ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.waiting_rooms.events.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -382,14 +397,14 @@ 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" event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.waiting_rooms.events.with_streaming_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -399,17 +414,17 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.events.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -419,7 +434,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.events.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -429,7 +444,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): client.waiting_rooms.events.with_raw_response.edit( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -441,62 +456,62 @@ def test_path_params_edit(self, client: Cloudflare) -> None: def test_method_get(self, client: Cloudflare) -> None: event = client.waiting_rooms.events.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.waiting_rooms.events.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.waiting_rooms.events.with_streaming_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.events.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.events.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): client.waiting_rooms.events.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) @@ -509,19 +524,19 @@ class TestAsyncEvents: async def test_method_create(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -536,14 +551,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare suspended=True, total_active_users=200, ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.events.with_raw_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -552,14 +567,14 @@ 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" event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.events.with_streaming_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -568,17 +583,17 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -587,7 +602,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.create( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", @@ -598,20 +613,20 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -627,14 +642,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare suspended=True, total_active_users=200, ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.events.with_raw_response.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -644,14 +659,14 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.events.with_streaming_response.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -661,17 +676,17 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -681,7 +696,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.update( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -691,7 +706,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.update( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -703,51 +718,62 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_list(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[Event], event, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + event = await async_client.waiting_rooms.events.list( + "699d98642c564d2e855e9661899b7252", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, ) - assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) + assert_matches_type(AsyncSinglePage[Event], event, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.events.with_raw_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) + assert_matches_type(AsyncSinglePage[Event], event, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.events.with_streaming_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) + assert_matches_type(AsyncSinglePage[Event], event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.list( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -755,8 +781,9 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(EventDeleteResponse, event, path=["response"]) @@ -765,8 +792,9 @@ 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.waiting_rooms.events.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -779,8 +807,9 @@ 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.waiting_rooms.events.with_streaming_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -793,25 +822,28 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.delete( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -819,20 +851,20 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_edit(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", name="production_webinar_event", ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -848,14 +880,14 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) suspended=True, total_active_users=200, ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.events.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -865,14 +897,14 @@ 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" event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.events.with_streaming_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -882,17 +914,17 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @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_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -902,7 +934,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -912,7 +944,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.edit( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", event_end_time="2021-09-28T17:00:00.000Z", event_start_time="2021-09-28T15:30:00.000Z", @@ -924,61 +956,61 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: async def test_method_get(self, async_client: AsyncCloudflare) -> None: event = await async_client.waiting_rooms.events.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.events.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.events.with_streaming_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) + assert_matches_type(Event, event, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.get( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): await async_client.waiting_rooms.events.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", ) diff --git a/tests/api_resources/waiting_rooms/test_page.py b/tests/api_resources/waiting_rooms/test_page.py index 5a53a2ac826..ead6c6eff3a 100644 --- a/tests/api_resources/waiting_rooms/test_page.py +++ b/tests/api_resources/waiting_rooms/test_page.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.waiting_rooms import PagePreviewResponse +from cloudflare.types.waiting_rooms.page_preview_response import PagePreviewResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +21,7 @@ class TestPage: @parametrize def test_method_preview(self, client: Cloudflare) -> None: page = client.waiting_rooms.page.preview( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", ) assert_matches_type(PagePreviewResponse, page, path=["response"]) @@ -30,7 +30,7 @@ def test_method_preview(self, client: Cloudflare) -> None: @parametrize def test_raw_response_preview(self, client: Cloudflare) -> None: response = client.waiting_rooms.page.with_raw_response.preview( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", ) @@ -43,7 +43,7 @@ def test_raw_response_preview(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_preview(self, client: Cloudflare) -> None: with client.waiting_rooms.page.with_streaming_response.preview( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", ) as response: assert not response.is_closed @@ -57,9 +57,9 @@ def test_streaming_response_preview(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_preview(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.page.with_raw_response.preview( - "", + zone_id="", custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", ) @@ -71,7 +71,7 @@ class TestAsyncPage: @parametrize async def test_method_preview(self, async_client: AsyncCloudflare) -> None: page = await async_client.waiting_rooms.page.preview( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", ) assert_matches_type(PagePreviewResponse, page, path=["response"]) @@ -80,7 +80,7 @@ async def test_method_preview(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.page.with_raw_response.preview( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", ) @@ -93,7 +93,7 @@ async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None @parametrize async def test_streaming_response_preview(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.page.with_streaming_response.preview( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", ) as response: assert not response.is_closed @@ -107,8 +107,8 @@ async def test_streaming_response_preview(self, async_client: AsyncCloudflare) - @pytest.mark.skip() @parametrize async def test_path_params_preview(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.page.with_raw_response.preview( - "", + zone_id="", custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", ) diff --git a/tests/api_resources/waiting_rooms/test_rules.py b/tests/api_resources/waiting_rooms/test_rules.py index cbd401c1043..fa27b73753a 100644 --- a/tests/api_resources/waiting_rooms/test_rules.py +++ b/tests/api_resources/waiting_rooms/test_rules.py @@ -10,13 +10,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.waiting_rooms import ( - WaitingroomRule, - RuleEditResponse, - RuleCreateResponse, - RuleDeleteResponse, - RuleUpdateResponse, -) +from cloudflare.types.waiting_rooms.waiting_room_rule import WaitingRoomRule +from cloudflare.types.waiting_rooms.rule_edit_response import RuleEditResponse +from cloudflare.types.waiting_rooms.rule_create_response import RuleCreateResponse +from cloudflare.types.waiting_rooms.rule_delete_response import RuleDeleteResponse +from cloudflare.types.waiting_rooms.rule_update_response import RuleUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ class TestRules: def test_method_create(self, client: Cloudflare) -> None: rule = client.waiting_rooms.rules.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) @@ -40,7 +38,7 @@ def test_method_create(self, client: Cloudflare) -> None: def test_method_create_with_all_params(self, client: Cloudflare) -> None: rule = client.waiting_rooms.rules.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", description="allow all traffic from 10.20.30.40", @@ -53,7 +51,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_create(self, client: Cloudflare) -> None: response = client.waiting_rooms.rules.with_raw_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) @@ -68,7 +66,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: def test_streaming_response_create(self, client: Cloudflare) -> None: with client.waiting_rooms.rules.with_streaming_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) as response: @@ -83,10 +81,10 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.rules.with_raw_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) @@ -94,7 +92,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.rules.with_raw_response.create( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) @@ -104,7 +102,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: rule = client.waiting_rooms.rules.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[ { "action": "bypass_waiting_room", @@ -127,7 +125,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.waiting_rooms.rules.with_raw_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[ { "action": "bypass_waiting_room", @@ -154,7 +152,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.waiting_rooms.rules.with_streaming_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[ { "action": "bypass_waiting_room", @@ -181,10 +179,10 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.rules.with_raw_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", body=[ { "action": "bypass_waiting_room", @@ -204,7 +202,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.rules.with_raw_response.update( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[ { "action": "bypass_waiting_room", @@ -226,51 +224,51 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_list(self, client: Cloudflare) -> None: rule = client.waiting_rooms.rules.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingRoomRule], rule, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.waiting_rooms.rules.with_raw_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingRoomRule], rule, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.waiting_rooms.rules.with_streaming_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingRoomRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.rules.with_raw_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.rules.with_raw_response.list( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -278,8 +276,9 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: rule = client.waiting_rooms.rules.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) @@ -288,8 +287,9 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.waiting_rooms.rules.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -302,8 +302,9 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.waiting_rooms.rules.with_streaming_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -316,25 +317,28 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.rules.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.rules.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.waiting_rooms.rules.with_raw_response.delete( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -342,7 +346,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: def test_method_edit(self, client: Cloudflare) -> None: rule = client.waiting_rooms.rules.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -354,7 +358,7 @@ def test_method_edit(self, client: Cloudflare) -> None: def test_method_edit_with_all_params(self, client: Cloudflare) -> None: rule = client.waiting_rooms.rules.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -369,7 +373,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.waiting_rooms.rules.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -385,7 +389,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.waiting_rooms.rules.with_streaming_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -401,10 +405,10 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.rules.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -413,7 +417,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.rules.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -422,7 +426,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.waiting_rooms.rules.with_raw_response.edit( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -437,7 +441,7 @@ class TestAsyncRules: async def test_method_create(self, async_client: AsyncCloudflare) -> None: rule = await async_client.waiting_rooms.rules.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) @@ -448,7 +452,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: rule = await async_client.waiting_rooms.rules.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", description="allow all traffic from 10.20.30.40", @@ -461,7 +465,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.rules.with_raw_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) @@ -476,7 +480,7 @@ 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.waiting_rooms.rules.with_streaming_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) as response: @@ -491,10 +495,10 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.create( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) @@ -502,7 +506,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.create( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", ) @@ -512,7 +516,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: rule = await async_client.waiting_rooms.rules.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[ { "action": "bypass_waiting_room", @@ -535,7 +539,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.waiting_rooms.rules.with_raw_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[ { "action": "bypass_waiting_room", @@ -562,7 +566,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.waiting_rooms.rules.with_streaming_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[ { "action": "bypass_waiting_room", @@ -589,10 +593,10 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.update( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", body=[ { "action": "bypass_waiting_room", @@ -612,7 +616,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.update( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[ { "action": "bypass_waiting_room", @@ -634,51 +638,51 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_list(self, async_client: AsyncCloudflare) -> None: rule = await async_client.waiting_rooms.rules.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[WaitingroomRule], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingRoomRule], rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.rules.with_raw_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingroomRule], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingRoomRule], rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.rules.with_streaming_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) 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[WaitingroomRule], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingRoomRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.list( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.list( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @pytest.mark.skip() @@ -686,8 +690,9 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: rule = await async_client.waiting_rooms.rules.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) @@ -696,8 +701,9 @@ 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.waiting_rooms.rules.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -710,8 +716,9 @@ 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.waiting_rooms.rules.with_streaming_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -724,25 +731,28 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.delete( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.delete( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -750,7 +760,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_edit(self, async_client: AsyncCloudflare) -> None: rule = await async_client.waiting_rooms.rules.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -762,7 +772,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: rule = await async_client.waiting_rooms.rules.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -777,7 +787,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.rules.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -793,7 +803,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.rules.with_streaming_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -809,10 +819,10 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @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_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="", + zone_id="", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -821,7 +831,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.edit( "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", @@ -830,7 +840,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.waiting_rooms.rules.with_raw_response.edit( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", waiting_room_id="699d98642c564d2e855e9661899b7252", action="bypass_waiting_room", expression="ip.src in {10.20.30.40}", diff --git a/tests/api_resources/waiting_rooms/test_settings.py b/tests/api_resources/waiting_rooms/test_settings.py index 1610b9935cf..3dd457a6ed5 100644 --- a/tests/api_resources/waiting_rooms/test_settings.py +++ b/tests/api_resources/waiting_rooms/test_settings.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.waiting_rooms import ( - SettingGetResponse, - SettingEditResponse, - SettingUpdateResponse, -) +from cloudflare.types.waiting_rooms.setting_get_response import SettingGetResponse +from cloudflare.types.waiting_rooms.setting_edit_response import SettingEditResponse +from cloudflare.types.waiting_rooms.setting_update_response import SettingUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +23,7 @@ class TestSettings: @parametrize def test_method_update(self, client: Cloudflare) -> None: setting = client.waiting_rooms.settings.update( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SettingUpdateResponse, setting, path=["response"]) @@ -33,7 +31,7 @@ def test_method_update(self, client: Cloudflare) -> None: @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: setting = client.waiting_rooms.settings.update( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", search_engine_crawler_bypass=True, ) assert_matches_type(SettingUpdateResponse, setting, path=["response"]) @@ -42,7 +40,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.waiting_rooms.settings.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -54,7 +52,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.waiting_rooms.settings.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,16 +65,16 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.settings.with_raw_response.update( - "", + zone_id="", ) @pytest.mark.skip() @parametrize def test_method_edit(self, client: Cloudflare) -> None: setting = client.waiting_rooms.settings.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SettingEditResponse, setting, path=["response"]) @@ -84,7 +82,7 @@ def test_method_edit(self, client: Cloudflare) -> None: @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: setting = client.waiting_rooms.settings.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", search_engine_crawler_bypass=True, ) assert_matches_type(SettingEditResponse, setting, path=["response"]) @@ -93,7 +91,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.waiting_rooms.settings.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -105,7 +103,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.waiting_rooms.settings.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -118,16 +116,16 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.settings.with_raw_response.edit( - "", + zone_id="", ) @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: setting = client.waiting_rooms.settings.get( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SettingGetResponse, setting, path=["response"]) @@ -135,7 +133,7 @@ def test_method_get(self, client: Cloudflare) -> None: @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.waiting_rooms.settings.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -147,7 +145,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.waiting_rooms.settings.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -160,9 +158,9 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.settings.with_raw_response.get( - "", + zone_id="", ) @@ -173,7 +171,7 @@ class TestAsyncSettings: @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: setting = await async_client.waiting_rooms.settings.update( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SettingUpdateResponse, setting, path=["response"]) @@ -181,7 +179,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: setting = await async_client.waiting_rooms.settings.update( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", search_engine_crawler_bypass=True, ) assert_matches_type(SettingUpdateResponse, setting, path=["response"]) @@ -190,7 +188,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.settings.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -202,7 +200,7 @@ 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.waiting_rooms.settings.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -215,16 +213,16 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.settings.with_raw_response.update( - "", + zone_id="", ) @pytest.mark.skip() @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: setting = await async_client.waiting_rooms.settings.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SettingEditResponse, setting, path=["response"]) @@ -232,7 +230,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: setting = await async_client.waiting_rooms.settings.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", search_engine_crawler_bypass=True, ) assert_matches_type(SettingEditResponse, setting, path=["response"]) @@ -241,7 +239,7 @@ 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.waiting_rooms.settings.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -253,7 +251,7 @@ 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.waiting_rooms.settings.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -266,16 +264,16 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @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_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.settings.with_raw_response.edit( - "", + zone_id="", ) @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: setting = await async_client.waiting_rooms.settings.get( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SettingGetResponse, setting, path=["response"]) @@ -283,7 +281,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.waiting_rooms.settings.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -295,7 +293,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.waiting_rooms.settings.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -308,7 +306,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip() @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.settings.with_raw_response.get( - "", + zone_id="", ) diff --git a/tests/api_resources/waiting_rooms/test_statuses.py b/tests/api_resources/waiting_rooms/test_statuses.py index 2e33c51c5cd..43709499dee 100644 --- a/tests/api_resources/waiting_rooms/test_statuses.py +++ b/tests/api_resources/waiting_rooms/test_statuses.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.waiting_rooms import StatusGetResponse +from cloudflare.types.waiting_rooms.status_get_response import StatusGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +22,7 @@ class TestStatuses: def test_method_get(self, client: Cloudflare) -> None: status = client.waiting_rooms.statuses.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(StatusGetResponse, status, path=["response"]) @@ -31,7 +31,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.waiting_rooms.statuses.with_raw_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -44,7 +44,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.waiting_rooms.statuses.with_streaming_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -57,16 +57,16 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.waiting_rooms.statuses.with_raw_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): client.waiting_rooms.statuses.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -78,7 +78,7 @@ class TestAsyncStatuses: async def test_method_get(self, async_client: AsyncCloudflare) -> None: status = await async_client.waiting_rooms.statuses.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(StatusGetResponse, status, path=["response"]) @@ -87,7 +87,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.waiting_rooms.statuses.with_raw_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -100,7 +100,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.waiting_rooms.statuses.with_streaming_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -113,14 +113,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip() @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.waiting_rooms.statuses.with_raw_response.get( "699d98642c564d2e855e9661899b7252", - zone_identifier="", + zone_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): await async_client.waiting_rooms.statuses.with_raw_response.get( "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) diff --git a/tests/api_resources/web3/hostnames/ipfs_universal_paths/content_lists/test_entries.py b/tests/api_resources/web3/hostnames/ipfs_universal_paths/content_lists/test_entries.py index fea633985d2..56f419d6fc7 100644 --- a/tests/api_resources/web3/hostnames/ipfs_universal_paths/content_lists/test_entries.py +++ b/tests/api_resources/web3/hostnames/ipfs_universal_paths/content_lists/test_entries.py @@ -9,11 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.web3.hostnames.ipfs_universal_paths.content_lists import ( - EntryListResponse, - EntryDeleteResponse, - DistributedWebConfigContentListEntry, -) +from cloudflare.types.web3.hostnames.ipfs_universal_paths.content_lists.entry_get_response import EntryGetResponse +from cloudflare.types.web3.hostnames.ipfs_universal_paths.content_lists.entry_list_response import EntryListResponse +from cloudflare.types.web3.hostnames.ipfs_universal_paths.content_lists.entry_create_response import EntryCreateResponse +from cloudflare.types.web3.hostnames.ipfs_universal_paths.content_lists.entry_delete_response import EntryDeleteResponse +from cloudflare.types.web3.hostnames.ipfs_universal_paths.content_lists.entry_update_response import EntryUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: content="QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB", type="cid", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryCreateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +42,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: type="cid", description="this is my content list entry", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryCreateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,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" entry = response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryCreateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -72,7 +72,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" entry = response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryCreateResponse, entry, path=["response"]) assert cast(Any, response.is_closed) is True @@ -105,7 +105,7 @@ def test_method_update(self, client: Cloudflare) -> None: content="QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB", type="cid", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryUpdateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +118,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: type="cid", description="this is my content list entry", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryUpdateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +134,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" entry = response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryUpdateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +150,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" entry = response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryUpdateResponse, entry, path=["response"]) assert cast(Any, response.is_closed) is True @@ -245,6 +245,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[EntryDeleteResponse], entry, path=["response"]) @@ -255,6 +256,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -269,6 +271,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -286,6 +289,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): @@ -293,6 +297,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="", + body={}, ) with pytest.raises( @@ -302,6 +307,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -312,7 +318,7 @@ def test_method_get(self, client: Cloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryGetResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +332,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" entry = response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryGetResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -340,7 +346,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" entry = response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryGetResponse, entry, path=["response"]) assert cast(Any, response.is_closed) is True @@ -383,7 +389,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: content="QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB", type="cid", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryCreateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +401,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare type="cid", description="this is my content list entry", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryCreateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -412,7 +418,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" entry = await response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryCreateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -427,7 +433,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" entry = await response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryCreateResponse, entry, path=["response"]) assert cast(Any, response.is_closed) is True @@ -460,7 +466,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: content="QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB", type="cid", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryUpdateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -473,7 +479,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare type="cid", description="this is my content list entry", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryUpdateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -491,7 +497,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" entry = await response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryUpdateResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -507,7 +513,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" entry = await response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryUpdateResponse, entry, path=["response"]) assert cast(Any, response.is_closed) is True @@ -602,6 +608,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[EntryDeleteResponse], entry, path=["response"]) @@ -613,6 +620,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) ) @@ -628,6 +636,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -645,6 +654,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): @@ -652,6 +662,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="", + body={}, ) with pytest.raises( @@ -661,6 +672,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -671,7 +683,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryGetResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -685,7 +697,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" entry = await response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryGetResponse, entry, path=["response"]) @pytest.mark.skip() @parametrize @@ -699,7 +711,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" entry = await response.parse() - assert_matches_type(DistributedWebConfigContentListEntry, entry, path=["response"]) + assert_matches_type(EntryGetResponse, entry, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/web3/hostnames/ipfs_universal_paths/test_content_lists.py b/tests/api_resources/web3/hostnames/ipfs_universal_paths/test_content_lists.py index 62cab2a7d3a..b0be6a6b877 100644 --- a/tests/api_resources/web3/hostnames/ipfs_universal_paths/test_content_lists.py +++ b/tests/api_resources/web3/hostnames/ipfs_universal_paths/test_content_lists.py @@ -9,9 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.web3.hostnames.ipfs_universal_paths import ( - DistributedWebConfigContentList, -) +from cloudflare.types.web3.hostnames.ipfs_universal_paths.content_list import ContentList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None: action="block", entries=[{}, {}, {}], ) - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +41,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" content_list = response.parse() - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +56,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" content_list = response.parse() - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -88,7 +86,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,7 +99,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" content_list = response.parse() - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) @pytest.mark.skip() @parametrize @@ -114,7 +112,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" content_list = response.parse() - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -146,7 +144,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: action="block", entries=[{}, {}, {}], ) - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) @pytest.mark.skip() @parametrize @@ -161,7 +159,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" content_list = await response.parse() - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +174,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" content_list = await response.parse() - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -206,7 +204,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) @pytest.mark.skip() @parametrize @@ -219,7 +217,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" content_list = await response.parse() - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) @pytest.mark.skip() @parametrize @@ -232,7 +230,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" content_list = await response.parse() - assert_matches_type(DistributedWebConfigContentList, content_list, path=["response"]) + assert_matches_type(ContentList, content_list, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/web3/test_hostnames.py b/tests/api_resources/web3/test_hostnames.py index 8b90939ee6c..2a66e443c93 100644 --- a/tests/api_resources/web3/test_hostnames.py +++ b/tests/api_resources/web3/test_hostnames.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.web3 import ( - DistributedWebHostname, - HostnameDeleteResponse, -) +from cloudflare.types.web3.hostname import Hostname +from cloudflare.types.web3.hostname_delete_response import HostnameDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", target="ipfs", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: description="This is my IPFS gateway.", dnslink="/ipns/onboarding.ipfs.cloudflare.com", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -52,7 +50,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" hostname = response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -65,7 +63,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -84,7 +82,7 @@ def test_method_list(self, client: Cloudflare) -> None: hostname = client.web3.hostnames.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[DistributedWebHostname], hostname, path=["response"]) + assert_matches_type(SyncSinglePage[Hostname], hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -96,7 +94,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = response.parse() - assert_matches_type(SyncSinglePage[DistributedWebHostname], hostname, path=["response"]) + assert_matches_type(SyncSinglePage[Hostname], hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -108,7 +106,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = response.parse() - assert_matches_type(SyncSinglePage[DistributedWebHostname], hostname, path=["response"]) + assert_matches_type(SyncSinglePage[Hostname], hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -126,6 +124,7 @@ def test_method_delete(self, client: Cloudflare) -> None: hostname = client.web3.hostnames.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[HostnameDeleteResponse], hostname, path=["response"]) @@ -135,6 +134,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.web3.hostnames.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -148,6 +148,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.web3.hostnames.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -164,12 +165,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.web3.hostnames.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): client.web3.hostnames.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -179,7 +182,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -190,7 +193,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: description="This is my IPFS gateway.", dnslink="/ipns/onboarding.ipfs.cloudflare.com", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +206,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" hostname = response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -216,7 +219,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -242,7 +245,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +258,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" hostname = response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +271,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -298,7 +301,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", target="ipfs", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -309,7 +312,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare description="This is my IPFS gateway.", dnslink="/ipns/onboarding.ipfs.cloudflare.com", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -322,7 +325,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" hostname = await response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -335,7 +338,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = await response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -354,7 +357,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: hostname = await async_client.web3.hostnames.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[DistributedWebHostname], hostname, path=["response"]) + assert_matches_type(AsyncSinglePage[Hostname], hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -366,7 +369,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = await response.parse() - assert_matches_type(AsyncSinglePage[DistributedWebHostname], hostname, path=["response"]) + assert_matches_type(AsyncSinglePage[Hostname], hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -378,7 +381,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = await response.parse() - assert_matches_type(AsyncSinglePage[DistributedWebHostname], hostname, path=["response"]) + assert_matches_type(AsyncSinglePage[Hostname], hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -396,6 +399,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: hostname = await async_client.web3.hostnames.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(Optional[HostnameDeleteResponse], hostname, path=["response"]) @@ -405,6 +409,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.web3.hostnames.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -418,6 +423,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.web3.hostnames.with_streaming_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -434,12 +440,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.web3.hostnames.with_raw_response.delete( "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): await async_client.web3.hostnames.with_raw_response.delete( "", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -449,7 +457,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -460,7 +468,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) description="This is my IPFS gateway.", dnslink="/ipns/onboarding.ipfs.cloudflare.com", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -473,7 +481,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" hostname = await response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -486,7 +494,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = await response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -512,7 +520,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -525,7 +533,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" hostname = await response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -538,7 +546,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = await response.parse() - assert_matches_type(DistributedWebHostname, hostname, path=["response"]) + assert_matches_type(Hostname, hostname, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/deployments/by_scripts/test_details.py b/tests/api_resources/workers/deployments/by_scripts/test_details.py deleted file mode 100644 index 24c8b7ed6f5..00000000000 --- a/tests/api_resources/workers/deployments/by_scripts/test_details.py +++ /dev/null @@ -1,150 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.workers.deployments.by_scripts import DetailGetResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDetails: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - detail = client.workers.deployments.by_scripts.details.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - detail = response.parse() - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.deployments.by_scripts.details.with_streaming_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - detail = response.parse() - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_id` but received ''"): - client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): - client.workers.deployments.by_scripts.details.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - -class TestAsyncDetails: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - detail = await async_client.workers.deployments.by_scripts.details.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - detail = await response.parse() - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.deployments.by_scripts.details.with_streaming_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - detail = await response.parse() - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_id` but received ''"): - await async_client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): - await async_client.workers.deployments.by_scripts.details.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) diff --git a/tests/api_resources/workers/deployments/test_by_scripts.py b/tests/api_resources/workers/deployments/test_by_scripts.py deleted file mode 100644 index e47639477f3..00000000000 --- a/tests/api_resources/workers/deployments/test_by_scripts.py +++ /dev/null @@ -1,126 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.workers.deployments import ByScriptGetResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestByScripts: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - by_script = client.workers.deployments.by_scripts.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.deployments.by_scripts.with_raw_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - by_script = response.parse() - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.deployments.by_scripts.with_streaming_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - by_script = response.parse() - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.deployments.by_scripts.with_raw_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_id` but received ''"): - client.workers.deployments.by_scripts.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncByScripts: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - by_script = await async_client.workers.deployments.by_scripts.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.deployments.by_scripts.with_raw_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - by_script = await response.parse() - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.deployments.by_scripts.with_streaming_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - by_script = await response.parse() - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.deployments.by_scripts.with_raw_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_id` but received ''"): - await async_client.workers.deployments.by_scripts.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/scripts/test_bindings.py b/tests/api_resources/workers/scripts/test_bindings.py deleted file mode 100644 index 7bbf34efc37..00000000000 --- a/tests/api_resources/workers/scripts/test_bindings.py +++ /dev/null @@ -1,106 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.workers.scripts import BindingGetResponse - -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"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - binding = client.workers.scripts.bindings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(BindingGetResponse, binding, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.scripts.bindings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.scripts.bindings.with_streaming_response.get( - zone_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(BindingGetResponse, binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.scripts.bindings.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncBindings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - binding = await async_client.workers.scripts.bindings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(BindingGetResponse, binding, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.bindings.with_raw_response.get( - zone_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(BindingGetResponse, binding, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.bindings.with_streaming_response.get( - zone_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(BindingGetResponse, binding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.scripts.bindings.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/workers/scripts/test_content.py b/tests/api_resources/workers/scripts/test_content.py index 2bbce51cfa3..7ace8aa2329 100644 --- a/tests/api_resources/workers/scripts/test_content.py +++ b/tests/api_resources/workers/scripts/test_content.py @@ -3,13 +3,21 @@ from __future__ import annotations import os -from typing import Any, cast +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.types.workers import WorkersScript +from cloudflare._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, +) +from cloudflare.types.workers.script import Script base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +32,7 @@ def test_method_update(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +46,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "main_module": "worker.js", }, ) - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +59,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +72,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) assert cast(Any, response.is_closed) is True @@ -83,6 +91,76 @@ def test_path_params_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @pytest.mark.skip() + @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/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + content = client.workers.scripts.content.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert content.is_closed + assert content.json() == {"foo": "bar"} + assert cast(Any, content.is_closed) is True + assert isinstance(content, BinaryAPIResponse) + + @pytest.mark.skip() + @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/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + content = client.workers.scripts.content.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert content.is_closed is True + assert content.http_request.headers.get("X-Stainless-Lang") == "python" + assert content.json() == {"foo": "bar"} + assert isinstance(content, BinaryAPIResponse) + + @pytest.mark.skip() + @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/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + with client.workers.scripts.content.with_streaming_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as content: + assert not content.is_closed + assert content.http_request.headers.get("X-Stainless-Lang") == "python" + + assert content.json() == {"foo": "bar"} + assert cast(Any, content.is_closed) is True + assert isinstance(content, StreamedBinaryAPIResponse) + + assert cast(Any, content.is_closed) is True + + @pytest.mark.skip() + @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.content.with_raw_response.get( + "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.content.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + class TestAsyncContent: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -94,7 +172,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -108,7 +186,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "main_module": "worker.js", }, ) - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +199,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = await response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +212,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = await response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) assert cast(Any, response.is_closed) is True @@ -152,3 +230,73 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + + @pytest.mark.skip() + @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/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + content = await async_client.workers.scripts.content.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert content.is_closed + assert await content.json() == {"foo": "bar"} + assert cast(Any, content.is_closed) is True + assert isinstance(content, AsyncBinaryAPIResponse) + + @pytest.mark.skip() + @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/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + content = await async_client.workers.scripts.content.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert content.is_closed is True + assert content.http_request.headers.get("X-Stainless-Lang") == "python" + assert await content.json() == {"foo": "bar"} + assert isinstance(content, AsyncBinaryAPIResponse) + + @pytest.mark.skip() + @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/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + async with async_client.workers.scripts.content.with_streaming_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as content: + assert not content.is_closed + assert content.http_request.headers.get("X-Stainless-Lang") == "python" + + assert await content.json() == {"foo": "bar"} + assert cast(Any, content.is_closed) is True + assert isinstance(content, AsyncStreamedBinaryAPIResponse) + + assert cast(Any, content.is_closed) is True + + @pytest.mark.skip() + @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.content.with_raw_response.get( + "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.content.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/workers/scripts/test_content_v2.py b/tests/api_resources/workers/scripts/test_content_v2.py deleted file mode 100644 index 31016e26535..00000000000 --- a/tests/api_resources/workers/scripts/test_content_v2.py +++ /dev/null @@ -1,168 +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 TestContentV2: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @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/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content_v2 = client.workers.scripts.content_v2.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert content_v2.is_closed - assert content_v2.json() == {"foo": "bar"} - assert cast(Any, content_v2.is_closed) is True - assert isinstance(content_v2, BinaryAPIResponse) - - @pytest.mark.skip() - @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/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - content_v2 = client.workers.scripts.content_v2.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert content_v2.is_closed is True - assert content_v2.http_request.headers.get("X-Stainless-Lang") == "python" - assert content_v2.json() == {"foo": "bar"} - assert isinstance(content_v2, BinaryAPIResponse) - - @pytest.mark.skip() - @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/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - with client.workers.scripts.content_v2.with_streaming_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as content_v2: - assert not content_v2.is_closed - assert content_v2.http_request.headers.get("X-Stainless-Lang") == "python" - - assert content_v2.json() == {"foo": "bar"} - assert cast(Any, content_v2.is_closed) is True - assert isinstance(content_v2, StreamedBinaryAPIResponse) - - assert cast(Any, content_v2.is_closed) is True - - @pytest.mark.skip() - @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.content_v2.with_raw_response.get( - "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.content_v2.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncContentV2: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @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/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content_v2 = await async_client.workers.scripts.content_v2.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert content_v2.is_closed - assert await content_v2.json() == {"foo": "bar"} - assert cast(Any, content_v2.is_closed) is True - assert isinstance(content_v2, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @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/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - content_v2 = await async_client.workers.scripts.content_v2.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert content_v2.is_closed is True - assert content_v2.http_request.headers.get("X-Stainless-Lang") == "python" - assert await content_v2.json() == {"foo": "bar"} - assert isinstance(content_v2, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @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/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - async with async_client.workers.scripts.content_v2.with_streaming_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as content_v2: - assert not content_v2.is_closed - assert content_v2.http_request.headers.get("X-Stainless-Lang") == "python" - - assert await content_v2.json() == {"foo": "bar"} - assert cast(Any, content_v2.is_closed) is True - assert isinstance(content_v2, AsyncStreamedBinaryAPIResponse) - - assert cast(Any, content_v2.is_closed) is True - - @pytest.mark.skip() - @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.content_v2.with_raw_response.get( - "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.content_v2.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/scripts/test_deployments.py b/tests/api_resources/workers/scripts/test_deployments.py new file mode 100644 index 00000000000..e28875a538e --- /dev/null +++ b/tests/api_resources/workers/scripts/test_deployments.py @@ -0,0 +1,253 @@ +# 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.scripts.deployment_get_response import DeploymentGetResponse +from cloudflare.types.workers.scripts.deployment_create_response import DeploymentCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDeployments: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + deployment = client.workers.scripts.deployments.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + deployment = client.workers.scripts.deployments.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + annotations={"workers_message": "Deploy bug fix."}, + strategy="string", + ) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.workers.scripts.deployments.with_raw_response.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.workers.scripts.deployments.with_streaming_response.create( + "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" + + deployment = response.parse() + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers.scripts.deployments.with_raw_response.create( + "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.deployments.with_raw_response.create( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + deployment = client.workers.scripts.deployments.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.workers.scripts.deployments.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.workers.scripts.deployments.with_streaming_response.get( + "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" + + deployment = response.parse() + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers.scripts.deployments.with_raw_response.get( + "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.deployments.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncDeployments: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + deployment = await async_client.workers.scripts.deployments.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + deployment = await async_client.workers.scripts.deployments.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + annotations={"workers_message": "Deploy bug fix."}, + strategy="string", + ) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.scripts.deployments.with_raw_response.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.scripts.deployments.with_streaming_response.create( + "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" + + deployment = await response.parse() + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers.scripts.deployments.with_raw_response.create( + "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.deployments.with_raw_response.create( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + deployment = await async_client.workers.scripts.deployments.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.scripts.deployments.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.scripts.deployments.with_streaming_response.get( + "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" + + deployment = await response.parse() + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers.scripts.deployments.with_raw_response.get( + "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.deployments.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/workers/scripts/test_schedules.py b/tests/api_resources/workers/scripts/test_schedules.py index 7ecc4f2629d..819dd9d202d 100644 --- a/tests/api_resources/workers/scripts/test_schedules.py +++ b/tests/api_resources/workers/scripts/test_schedules.py @@ -3,13 +3,14 @@ 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.workers.scripts import ScheduleGetResponse, ScheduleUpdateResponse +from cloudflare.types.workers.scripts.schedule_get_response import ScheduleGetResponse +from cloudflare.types.workers.scripts.schedule_update_response import ScheduleUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="[{'cron': '*/30 * * * *'}]", ) - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = response.parse() - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +54,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = response.parse() - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +82,7 @@ def test_method_get(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +95,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" schedule = response.parse() - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +108,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = response.parse() - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -138,7 +139,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="[{'cron': '*/30 * * * *'}]", ) - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +153,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = await response.parse() - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +167,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = await response.parse() - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -194,7 +195,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +208,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" schedule = await response.parse() - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -220,7 +221,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = await response.parse() - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_settings.py b/tests/api_resources/workers/scripts/test_settings.py index 93a924099d2..82e55e0a563 100644 --- a/tests/api_resources/workers/scripts/test_settings.py +++ b/tests/api_resources/workers/scripts/test_settings.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.workers.scripts import SettingGetResponse, SettingEditResponse +from cloudflare.types.workers.script_setting import ScriptSetting base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,106 +32,26 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: setting = client.workers.scripts.settings.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - settings={ - "errors": [ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - "messages": [ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - "result": { - "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": [ - "formdata_parser_supports_files", - "formdata_parser_supports_files", - "formdata_parser_supports_files", - ], - "logpush": False, - "migrations": { - "new_tag": "v2", - "old_tag": "v1", - "deleted_classes": ["string", "string", "string"], - "new_classes": ["string", "string", "string"], - "renamed_classes": [ - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - ], - "transferred_classes": [ - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - ], - }, - "placement": {"mode": "smart"}, - "tags": ["my-tag", "my-tag", "my-tag"], - "tail_consumers": [ - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - ], - "usage_model": "unbound", + logpush=False, + tail_consumers=[ + { + "environment": "production", + "namespace": "my-namespace", + "service": "my-log-consumer", }, - "success": True, - }, + { + "environment": "production", + "namespace": "my-namespace", + "service": "my-log-consumer", + }, + { + "environment": "production", + "namespace": "my-namespace", + "service": "my-log-consumer", + }, + ], ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -144,7 +64,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" setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -157,7 +77,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -183,7 +103,7 @@ def test_method_get(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,7 +116,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" setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -209,7 +129,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -239,7 +159,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -247,106 +167,26 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) setting = await async_client.workers.scripts.settings.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - settings={ - "errors": [ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - "messages": [ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - "result": { - "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": [ - "formdata_parser_supports_files", - "formdata_parser_supports_files", - "formdata_parser_supports_files", - ], - "logpush": False, - "migrations": { - "new_tag": "v2", - "old_tag": "v1", - "deleted_classes": ["string", "string", "string"], - "new_classes": ["string", "string", "string"], - "renamed_classes": [ - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - ], - "transferred_classes": [ - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - ], - }, - "placement": {"mode": "smart"}, - "tags": ["my-tag", "my-tag", "my-tag"], - "tail_consumers": [ - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - ], - "usage_model": "unbound", + logpush=False, + tail_consumers=[ + { + "environment": "production", + "namespace": "my-namespace", + "service": "my-log-consumer", + }, + { + "environment": "production", + "namespace": "my-namespace", + "service": "my-log-consumer", + }, + { + "environment": "production", + "namespace": "my-namespace", + "service": "my-log-consumer", }, - "success": True, - }, + ], ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -359,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" setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -372,7 +212,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -398,7 +238,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -411,7 +251,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" setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -424,7 +264,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_tail.py b/tests/api_resources/workers/scripts/test_tail.py index aef0b5b58e2..9088693f5b9 100644 --- a/tests/api_resources/workers/scripts/test_tail.py +++ b/tests/api_resources/workers/scripts/test_tail.py @@ -3,13 +3,15 @@ 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.workers.scripts import TailGetResponse, TailCreateResponse, TailDeleteResponse +from cloudflare.types.workers.scripts.tail_get_response import TailGetResponse +from cloudflare.types.workers.scripts.tail_create_response import TailCreateResponse +from cloudflare.types.workers.scripts.tail_delete_response import TailDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,8 +25,9 @@ def test_method_create(self, client: Cloudflare) -> None: tail = client.workers.scripts.tail.create( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,12 +35,13 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.workers.scripts.tail.with_raw_response.create( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = response.parse() - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,12 +49,13 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.workers.scripts.tail.with_streaming_response.create( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = response.parse() - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,12 +66,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.workers.scripts.tail.with_raw_response.create( "this-is_my_script-01", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.tail.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -76,6 +83,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", + body={}, ) assert_matches_type(TailDeleteResponse, tail, path=["response"]) @@ -86,6 +94,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", + body={}, ) assert response.is_closed is True @@ -100,6 +109,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -117,6 +127,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="", script_name="this-is_my_script-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -124,6 +135,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): @@ -131,6 +143,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", + body={}, ) @pytest.mark.skip() @@ -140,7 +153,7 @@ def test_method_get(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -153,7 +166,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" tail = response.parse() - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +179,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = response.parse() - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) assert cast(Any, response.is_closed) is True @@ -195,8 +208,9 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: tail = await async_client.workers.scripts.tail.create( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -204,12 +218,13 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.scripts.tail.with_raw_response.create( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = await response.parse() - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,12 +232,13 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.workers.scripts.tail.with_streaming_response.create( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = await response.parse() - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) assert cast(Any, response.is_closed) is True @@ -233,12 +249,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.workers.scripts.tail.with_raw_response.create( "this-is_my_script-01", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.tail.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -248,6 +266,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", + body={}, ) assert_matches_type(TailDeleteResponse, tail, path=["response"]) @@ -258,6 +277,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", + body={}, ) assert response.is_closed is True @@ -272,6 +292,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "03dc9f77817b488fb26c5861ec18f791", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -289,6 +310,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="", script_name="this-is_my_script-01", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -296,6 +318,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "03dc9f77817b488fb26c5861ec18f791", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): @@ -303,6 +326,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", + body={}, ) @pytest.mark.skip() @@ -312,7 +336,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -325,7 +349,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" tail = await response.parse() - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -338,7 +362,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = await response.parse() - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_usage_model.py b/tests/api_resources/workers/scripts/test_usage_model.py deleted file mode 100644 index a4a646e937c..00000000000 --- a/tests/api_resources/workers/scripts/test_usage_model.py +++ /dev/null @@ -1,240 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.workers.scripts import UsageModelGetResponse, UsageModelUpdateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUsageModel: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - usage_model = client.workers.scripts.usage_model.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.scripts.usage_model.with_raw_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage_model = response.parse() - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.scripts.usage_model.with_streaming_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage_model = response.parse() - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.scripts.usage_model.with_raw_response.update( - "this-is_my_script-01", - account_id="", - body="{'usage_model': 'unbound'}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.scripts.usage_model.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - usage_model = client.workers.scripts.usage_model.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.scripts.usage_model.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage_model = response.parse() - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.scripts.usage_model.with_streaming_response.get( - "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" - - usage_model = response.parse() - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.scripts.usage_model.with_raw_response.get( - "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.usage_model.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncUsageModel: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - usage_model = await async_client.workers.scripts.usage_model.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.usage_model.with_raw_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage_model = await response.parse() - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.usage_model.with_streaming_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage_model = await response.parse() - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.scripts.usage_model.with_raw_response.update( - "this-is_my_script-01", - account_id="", - body="{'usage_model': 'unbound'}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.scripts.usage_model.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - usage_model = await async_client.workers.scripts.usage_model.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.usage_model.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage_model = await response.parse() - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.usage_model.with_streaming_response.get( - "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" - - usage_model = await response.parse() - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.scripts.usage_model.with_raw_response.get( - "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.usage_model.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/scripts/test_versions.py b/tests/api_resources/workers/scripts/test_versions.py new file mode 100644 index 00000000000..428b8e53911 --- /dev/null +++ b/tests/api_resources/workers/scripts/test_versions.py @@ -0,0 +1,416 @@ +# 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.scripts.version_get_response import VersionGetResponse +from cloudflare.types.workers.scripts.version_list_response import VersionListResponse +from cloudflare.types.workers.scripts.version_create_response import VersionCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVersions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + version = client.workers.scripts.versions.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + version = client.workers.scripts.versions.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"], + metadata={ + "annotations": { + "workers_message": "Fixed worker code.", + "workers_tag": "string", + }, + "bindings": [ + { + "name": "MY_ENV_VAR", + "text": "my_data", + "type": "plain_text", + } + ], + "compatibility_date": "2023-07-25", + "compatibility_flags": ["string", "string", "string"], + "keep_bindings": ["string", "string", "string"], + "main_module": "worker.js", + "usage_model": "standard", + }, + ) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.workers.scripts.versions.with_raw_response.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = response.parse() + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.workers.scripts.versions.with_streaming_response.create( + "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" + + version = response.parse() + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers.scripts.versions.with_raw_response.create( + "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.versions.with_raw_response.create( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + version = client.workers.scripts.versions.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.workers.scripts.versions.with_raw_response.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = response.parse() + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.workers.scripts.versions.with_streaming_response.list( + "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" + + version = response.parse() + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers.scripts.versions.with_raw_response.list( + "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.versions.with_raw_response.list( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + version = client.workers.scripts.versions.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="this-is_my_script-01", + ) + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.workers.scripts.versions.with_raw_response.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="this-is_my_script-01", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = response.parse() + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.workers.scripts.versions.with_streaming_response.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="this-is_my_script-01", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = response.parse() + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers.scripts.versions.with_raw_response.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="", + script_name="this-is_my_script-01", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): + client.workers.scripts.versions.with_raw_response.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"): + client.workers.scripts.versions.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="this-is_my_script-01", + ) + + +class TestAsyncVersions: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + version = await async_client.workers.scripts.versions.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + version = await async_client.workers.scripts.versions.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"], + metadata={ + "annotations": { + "workers_message": "Fixed worker code.", + "workers_tag": "string", + }, + "bindings": [ + { + "name": "MY_ENV_VAR", + "text": "my_data", + "type": "plain_text", + } + ], + "compatibility_date": "2023-07-25", + "compatibility_flags": ["string", "string", "string"], + "keep_bindings": ["string", "string", "string"], + "main_module": "worker.js", + "usage_model": "standard", + }, + ) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.scripts.versions.with_raw_response.create( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = await response.parse() + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.scripts.versions.with_streaming_response.create( + "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" + + version = await response.parse() + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers.scripts.versions.with_raw_response.create( + "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.versions.with_raw_response.create( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + version = await async_client.workers.scripts.versions.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.scripts.versions.with_raw_response.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = await response.parse() + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.scripts.versions.with_streaming_response.list( + "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" + + version = await response.parse() + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers.scripts.versions.with_raw_response.list( + "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.versions.with_raw_response.list( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + version = await async_client.workers.scripts.versions.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="this-is_my_script-01", + ) + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.scripts.versions.with_raw_response.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="this-is_my_script-01", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = await response.parse() + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.scripts.versions.with_streaming_response.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="this-is_my_script-01", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = await response.parse() + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers.scripts.versions.with_raw_response.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="", + script_name="this-is_my_script-01", + ) + + 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.get( + "bcf48806-b317-4351-9ee7-36e7d557d4de", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"): + await async_client.workers.scripts.versions.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + script_name="this-is_my_script-01", + ) diff --git a/tests/api_resources/workers/services/environments/test_content.py b/tests/api_resources/workers/services/environments/test_content.py deleted file mode 100644 index 48d8d171dd4..00000000000 --- a/tests/api_resources/workers/services/environments/test_content.py +++ /dev/null @@ -1,352 +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 tests.utils import assert_matches_type -from cloudflare._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, -) -from cloudflare.types.workers import WorkersScript - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestContent: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - content = client.workers.services.environments.content.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert_matches_type(WorkersScript, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - content = client.workers.services.environments.content.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"], - metadata={ - "body_part": "worker.js", - "main_module": "worker.js", - }, - ) - assert_matches_type(WorkersScript, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.services.environments.content.with_streaming_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - content = response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - client.workers.services.environments.content.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - @pytest.mark.skip() - @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/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content = client.workers.services.environments.content.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert content.is_closed - assert content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, BinaryAPIResponse) - - @pytest.mark.skip() - @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/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - content = client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert content.is_closed is True - assert content.http_request.headers.get("X-Stainless-Lang") == "python" - assert content.json() == {"foo": "bar"} - assert isinstance(content, BinaryAPIResponse) - - @pytest.mark.skip() - @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/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - with client.workers.services.environments.content.with_streaming_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as content: - assert not content.is_closed - assert content.http_request.headers.get("X-Stainless-Lang") == "python" - - assert content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, StreamedBinaryAPIResponse) - - assert cast(Any, content.is_closed) is True - - @pytest.mark.skip() - @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.services.environments.content.with_raw_response.get( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - client.workers.services.environments.content.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - -class TestAsyncContent: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - content = await async_client.workers.services.environments.content.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert_matches_type(WorkersScript, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - content = await async_client.workers.services.environments.content.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"], - metadata={ - "body_part": "worker.js", - "main_module": "worker.js", - }, - ) - assert_matches_type(WorkersScript, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = await response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.services.environments.content.with_streaming_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - content = await response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - @pytest.mark.skip() - @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/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content = await async_client.workers.services.environments.content.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert content.is_closed - assert await content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @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/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - content = await async_client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert content.is_closed is True - assert content.http_request.headers.get("X-Stainless-Lang") == "python" - assert await content.json() == {"foo": "bar"} - assert isinstance(content, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @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/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - async with async_client.workers.services.environments.content.with_streaming_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as content: - assert not content.is_closed - assert content.http_request.headers.get("X-Stainless-Lang") == "python" - - assert await content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, AsyncStreamedBinaryAPIResponse) - - assert cast(Any, content.is_closed) is True - - @pytest.mark.skip() - @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.services.environments.content.with_raw_response.get( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) diff --git a/tests/api_resources/workers/services/environments/test_settings.py b/tests/api_resources/workers/services/environments/test_settings.py deleted file mode 100644 index 49ef9121dae..00000000000 --- a/tests/api_resources/workers/services/environments/test_settings.py +++ /dev/null @@ -1,850 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.workers.services.environments import SettingGetResponse, SettingEditResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSettings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - setting = client.workers.services.environments.settings.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - setting = client.workers.services.environments.settings.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={ - "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": [ - "formdata_parser_supports_files", - "formdata_parser_supports_files", - "formdata_parser_supports_files", - ], - "logpush": False, - "migrations": { - "new_tag": "v2", - "old_tag": "v1", - "deleted_classes": ["string", "string", "string"], - "new_classes": ["string", "string", "string"], - "renamed_classes": [ - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - ], - "transferred_classes": [ - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - ], - }, - "placement": {"mode": "smart"}, - "tags": ["my-tag", "my-tag", "my-tag"], - "tail_consumers": [ - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - ], - "usage_model": "unbound", - }, - success=True, - ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.workers.services.environments.settings.with_streaming_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @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.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - client.workers.services.environments.settings.with_raw_response.edit( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - setting = client.workers.services.environments.settings.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.services.environments.settings.with_streaming_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - client.workers.services.environments.settings.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - -class TestAsyncSettings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.services.environments.settings.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.services.environments.settings.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={ - "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": [ - "formdata_parser_supports_files", - "formdata_parser_supports_files", - "formdata_parser_supports_files", - ], - "logpush": False, - "migrations": { - "new_tag": "v2", - "old_tag": "v1", - "deleted_classes": ["string", "string", "string"], - "new_classes": ["string", "string", "string"], - "renamed_classes": [ - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - ], - "transferred_classes": [ - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - ], - }, - "placement": {"mode": "smart"}, - "tags": ["my-tag", "my-tag", "my-tag"], - "tail_consumers": [ - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - ], - "usage_model": "unbound", - }, - success=True, - ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.services.environments.settings.with_streaming_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @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.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.edit( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.services.environments.settings.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.services.environments.settings.with_streaming_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) diff --git a/tests/api_resources/workers/test_account_settings.py b/tests/api_resources/workers/test_account_settings.py index e3a0c6fece3..a50f539dd43 100644 --- a/tests/api_resources/workers/test_account_settings.py +++ b/tests/api_resources/workers/test_account_settings.py @@ -3,16 +3,14 @@ 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.workers import ( - AccountSettingGetResponse, - AccountSettingUpdateResponse, -) +from cloudflare.types.workers.account_setting_get_response import AccountSettingGetResponse +from cloudflare.types.workers.account_setting_update_response import AccountSettingUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +25,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="{'default_usage_model': 'unbound'}", ) - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +38,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = response.parse() - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +51,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = response.parse() - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +70,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_setting = client.workers.account_settings.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -84,7 +82,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" account_setting = response.parse() - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -96,7 +94,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = response.parse() - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -119,7 +117,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="{'default_usage_model': 'unbound'}", ) - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -132,7 +130,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = await response.parse() - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -145,7 +143,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = await response.parse() - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -164,7 +162,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_setting = await async_client.workers.account_settings.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +174,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" account_setting = await response.parse() - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +186,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = await response.parse() - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_ai.py b/tests/api_resources/workers/test_ai.py index 3ad76d766d6..0958f116c5b 100644 --- a/tests/api_resources/workers/test_ai.py +++ b/tests/api_resources/workers/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.workers.ai_run_response import AIRunResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -679,6 +679,7 @@ def test_method_run_overload_11(self, client: Cloudflare) -> None: ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -690,7 +691,23 @@ def test_method_run_with_all_params_overload_11(self, client: Cloudflare) -> Non account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0, 0, 0], max_tokens=0, + messages=[ + { + "content": "string", + "role": "string", + }, + { + "content": "string", + "role": "string", + }, + { + "content": "string", + "role": "string", + }, + ], prompt="string", + raw=True, + temperature=0, ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -700,6 +717,7 @@ def test_raw_response_run_overload_11(self, client: Cloudflare) -> None: response = client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) assert response.is_closed is True @@ -713,6 +731,7 @@ def test_streaming_response_run_overload_11(self, client: Cloudflare) -> None: with client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -729,12 +748,14 @@ def test_path_params_run_overload_11(self, client: Cloudflare) -> None: client.workers.ai.with_raw_response.run( "string", account_id="", + image=[0, 0, 0], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) @@ -1403,6 +1424,7 @@ async def test_method_run_overload_11(self, async_client: AsyncCloudflare) -> No ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -1414,7 +1436,23 @@ async def test_method_run_with_all_params_overload_11(self, async_client: AsyncC account_id="023e105f4ecef8ad9ca31a8372d0c353", image=[0, 0, 0], max_tokens=0, + messages=[ + { + "content": "string", + "role": "string", + }, + { + "content": "string", + "role": "string", + }, + { + "content": "string", + "role": "string", + }, + ], prompt="string", + raw=True, + temperature=0, ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -1424,6 +1462,7 @@ async def test_raw_response_run_overload_11(self, async_client: AsyncCloudflare) response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) assert response.is_closed is True @@ -1437,6 +1476,7 @@ async def test_streaming_response_run_overload_11(self, async_client: AsyncCloud async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1453,10 +1493,12 @@ async def test_path_params_run_overload_11(self, async_client: AsyncCloudflare) await async_client.workers.ai.with_raw_response.run( "string", account_id="", + image=[0, 0, 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( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) diff --git a/tests/api_resources/workers/test_domains.py b/tests/api_resources/workers/test_domains.py index f96dbc6dbbb..040392d1008 100644 --- a/tests/api_resources/workers/test_domains.py +++ b/tests/api_resources/workers/test_domains.py @@ -3,14 +3,14 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.workers import WorkersDomain +from cloudflare.types.workers.domain import Domain base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +28,7 @@ def test_method_update(self, client: Cloudflare) -> None: service="foo", zone_id="593c9c94de529bbbfaac7c53ced0447d", ) - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +60,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,7 +82,7 @@ def test_method_list(self, client: Cloudflare) -> None: domain = client.workers.domains.list( account_id="9a7806061c88ada191ed06f989cc3dac", ) - assert_matches_type(SyncSinglePage[WorkersDomain], domain, path=["response"]) + assert_matches_type(SyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -95,7 +95,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: zone_id="593c9c94de529bbbfaac7c53ced0447d", zone_name="example.com", ) - assert_matches_type(SyncSinglePage[WorkersDomain], domain, path=["response"]) + assert_matches_type(SyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(SyncSinglePage[WorkersDomain], domain, path=["response"]) + assert_matches_type(SyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,7 +119,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(SyncSinglePage[WorkersDomain], domain, path=["response"]) + assert_matches_type(SyncSinglePage[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -137,6 +137,7 @@ def test_method_delete(self, client: Cloudflare) -> None: domain = client.workers.domains.delete( "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", + body={}, ) assert domain is None @@ -146,6 +147,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.workers.domains.with_raw_response.delete( "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", + body={}, ) assert response.is_closed is True @@ -159,6 +161,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.workers.domains.with_streaming_response.delete( "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -175,12 +178,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.workers.domains.with_raw_response.delete( "dbe10b4bc17c295377eabd600e1787fd", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `domain_id` but received ''"): client.workers.domains.with_raw_response.delete( "", account_id="9a7806061c88ada191ed06f989cc3dac", + body={}, ) @pytest.mark.skip() @@ -190,7 +195,7 @@ def test_method_get(self, client: Cloudflare) -> None: "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", ) - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +208,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" domain = response.parse() - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -216,7 +221,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -249,7 +254,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: service="foo", zone_id="593c9c94de529bbbfaac7c53ced0447d", ) - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -265,7 +270,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -281,7 +286,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -303,7 +308,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: domain = await async_client.workers.domains.list( account_id="9a7806061c88ada191ed06f989cc3dac", ) - assert_matches_type(AsyncSinglePage[WorkersDomain], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -316,7 +321,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) zone_id="593c9c94de529bbbfaac7c53ced0447d", zone_name="example.com", ) - assert_matches_type(AsyncSinglePage[WorkersDomain], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -328,7 +333,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(AsyncSinglePage[WorkersDomain], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -340,7 +345,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(AsyncSinglePage[WorkersDomain], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -358,6 +363,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: domain = await async_client.workers.domains.delete( "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", + body={}, ) assert domain is None @@ -367,6 +373,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.domains.with_raw_response.delete( "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", + body={}, ) assert response.is_closed is True @@ -380,6 +387,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.workers.domains.with_streaming_response.delete( "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -396,12 +404,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.workers.domains.with_raw_response.delete( "dbe10b4bc17c295377eabd600e1787fd", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `domain_id` but received ''"): await async_client.workers.domains.with_raw_response.delete( "", account_id="9a7806061c88ada191ed06f989cc3dac", + body={}, ) @pytest.mark.skip() @@ -411,7 +421,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", ) - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -424,7 +434,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" domain = await response.parse() - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -437,7 +447,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(WorkersDomain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_filters.py b/tests/api_resources/workers/test_filters.py deleted file mode 100644 index 8b1f32106c5..00000000000 --- a/tests/api_resources/workers/test_filters.py +++ /dev/null @@ -1,439 +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.workers import ( - WorkersFilter, - FilterCreateResponse, - FilterDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFilters: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - filter = client.workers.filters.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.workers.filters.with_raw_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.workers.filters.with_streaming_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = response.parse() - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.filters.with_raw_response.create( - zone_id="", - enabled=True, - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - filter = client.workers.filters.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - assert_matches_type(WorkersFilter, filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.filters.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(WorkersFilter, filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.filters.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = response.parse() - assert_matches_type(WorkersFilter, filter, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.filters.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - enabled=True, - pattern="example.net/*", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `filter_id` but received ''"): - client.workers.filters.with_raw_response.update( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - filter = client.workers.filters.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[WorkersFilter], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.workers.filters.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(SyncSinglePage[WorkersFilter], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.workers.filters.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = response.parse() - assert_matches_type(SyncSinglePage[WorkersFilter], filter, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.filters.with_raw_response.list( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - filter = client.workers.filters.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.workers.filters.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.workers.filters.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = response.parse() - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.filters.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `filter_id` but received ''"): - client.workers.filters.with_raw_response.delete( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncFilters: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.workers.filters.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.filters.with_raw_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = await response.parse() - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.filters.with_streaming_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = await response.parse() - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.filters.with_raw_response.create( - zone_id="", - enabled=True, - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.workers.filters.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - assert_matches_type(WorkersFilter, filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.filters.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = await response.parse() - assert_matches_type(WorkersFilter, filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.filters.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = await response.parse() - assert_matches_type(WorkersFilter, filter, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.filters.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - enabled=True, - pattern="example.net/*", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `filter_id` but received ''"): - await async_client.workers.filters.with_raw_response.update( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.workers.filters.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[WorkersFilter], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.filters.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = await response.parse() - assert_matches_type(AsyncSinglePage[WorkersFilter], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.filters.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = await response.parse() - assert_matches_type(AsyncSinglePage[WorkersFilter], filter, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.filters.with_raw_response.list( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.workers.filters.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.filters.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = await response.parse() - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.filters.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = await response.parse() - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.filters.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `filter_id` but received ''"): - await async_client.workers.filters.with_raw_response.delete( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/test_routes.py b/tests/api_resources/workers/test_routes.py deleted file mode 100644 index 96ec8968fa7..00000000000 --- a/tests/api_resources/workers/test_routes.py +++ /dev/null @@ -1,567 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.workers import ( - WorkersRoute, - RouteCreateResponse, - RouteDeleteResponse, -) - -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"]) - - @pytest.mark.skip() - @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"]) - - @pytest.mark.skip() - @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"]) - - @pytest.mark.skip() - @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"]) - - @pytest.mark.skip() - @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 - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.routes.with_raw_response.create( - zone_id="", - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - route = client.workers.routes.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - route = client.workers.routes.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - script="this-is_my_script-01", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.routes.with_raw_response.update( - "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(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.routes.with_streaming_response.update( - "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(WorkersRoute, route, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.routes.with_raw_response.update( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - route = client.workers.routes.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[WorkersRoute], route, path=["response"]) - - @pytest.mark.skip() - @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[WorkersRoute], route, path=["response"]) - - @pytest.mark.skip() - @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[WorkersRoute], route, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.routes.with_raw_response.list( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - route = client.workers.routes.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(RouteDeleteResponse, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.workers.routes.with_raw_response.delete( - "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"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.workers.routes.with_streaming_response.delete( - "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 - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.routes.with_raw_response.delete( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - route = client.workers.routes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.routes.with_raw_response.get( - "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(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.routes.with_streaming_response.get( - "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(WorkersRoute, route, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.workers.routes.with_raw_response.get( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncRoutes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - assert_matches_type(RouteCreateResponse, route, path=["response"]) - - @pytest.mark.skip() - @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"]) - - @pytest.mark.skip() - @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"]) - - @pytest.mark.skip() - @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 - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.routes.with_raw_response.create( - zone_id="", - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - script="this-is_my_script-01", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.routes.with_raw_response.update( - "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(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.routes.with_streaming_response.update( - "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(WorkersRoute, route, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.routes.with_raw_response.update( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - - @pytest.mark.skip() - @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[WorkersRoute], route, path=["response"]) - - @pytest.mark.skip() - @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[WorkersRoute], route, path=["response"]) - - @pytest.mark.skip() - @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[WorkersRoute], route, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.routes.with_raw_response.list( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(RouteDeleteResponse, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.routes.with_raw_response.delete( - "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"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.routes.with_streaming_response.delete( - "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 - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.routes.with_raw_response.delete( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.routes.with_raw_response.get( - "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(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.routes.with_streaming_response.get( - "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(WorkersRoute, route, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.workers.routes.with_raw_response.get( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/test_scripts.py b/tests/api_resources/workers/test_scripts.py index e6cb951422b..64fb9e37a6a 100644 --- a/tests/api_resources/workers/test_scripts.py +++ b/tests/api_resources/workers/test_scripts.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import httpx import pytest @@ -18,7 +18,7 @@ AsyncStreamedBinaryAPIResponse, ) from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.workers import WorkersScript +from cloudflare.types.workers.script import Script base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -33,7 +33,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +117,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "version_tags": {}, }, ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +130,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" script = response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +143,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -169,7 +169,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -180,7 +180,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", message="string", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +193,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" script = response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +206,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -231,7 +231,7 @@ def test_method_list(self, client: Cloudflare) -> None: script = client.workers.scripts.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[WorkersScript], script, path=["response"]) + assert_matches_type(SyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -243,7 +243,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(SyncSinglePage[WorkersScript], script, path=["response"]) + assert_matches_type(SyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +255,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(SyncSinglePage[WorkersScript], script, path=["response"]) + assert_matches_type(SyncSinglePage[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -273,6 +273,7 @@ def test_method_delete(self, client: Cloudflare) -> None: script = client.workers.scripts.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert script is None @@ -282,6 +283,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: script = client.workers.scripts.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, force=True, ) assert script is None @@ -292,6 +294,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.workers.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -305,6 +308,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.workers.scripts.with_streaming_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -321,12 +325,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.workers.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -410,7 +416,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -494,7 +500,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "version_tags": {}, }, ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -507,7 +513,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" script = await response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -520,7 +526,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -546,7 +552,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -557,7 +563,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", message="string", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -570,7 +576,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" script = await response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -583,7 +589,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -608,7 +614,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: script = await async_client.workers.scripts.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[WorkersScript], script, path=["response"]) + assert_matches_type(AsyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -620,7 +626,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(AsyncSinglePage[WorkersScript], script, path=["response"]) + assert_matches_type(AsyncSinglePage[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -632,7 +638,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(AsyncSinglePage[WorkersScript], script, path=["response"]) + assert_matches_type(AsyncSinglePage[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -650,6 +656,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: script = await async_client.workers.scripts.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert script is None @@ -659,6 +666,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare script = await async_client.workers.scripts.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, force=True, ) assert script is None @@ -669,6 +677,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -682,6 +691,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.workers.scripts.with_streaming_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -698,12 +708,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.workers.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/workers/test_subdomains.py b/tests/api_resources/workers/test_subdomains.py index 24b36b21408..b695557c469 100644 --- a/tests/api_resources/workers/test_subdomains.py +++ b/tests/api_resources/workers/test_subdomains.py @@ -3,13 +3,14 @@ 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.workers import SubdomainGetResponse, SubdomainUpdateResponse +from cloudflare.types.workers.subdomain_get_response import SubdomainGetResponse +from cloudflare.types.workers.subdomain_update_response import SubdomainUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="{'subdomain': 'example-subdomain'}", ) - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +38,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = response.parse() - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +51,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = response.parse() - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +70,7 @@ def test_method_get(self, client: Cloudflare) -> None: subdomain = client.workers.subdomains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +82,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" subdomain = response.parse() - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = response.parse() - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +117,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="{'subdomain': 'example-subdomain'}", ) - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +130,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = await response.parse() - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +143,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = await response.parse() - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +162,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: subdomain = await async_client.workers.subdomains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +174,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" subdomain = await response.parse() - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +186,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = await response.parse() - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py index e11447ac29a..0b7b218871d 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.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.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.binding_get_response import BindingGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,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" binding = response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +53,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +93,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,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" binding = await response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +121,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) assert cast(Any, response.is_closed) is True 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 2044f5b05b8..40d878f790d 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 @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import httpx import pytest @@ -17,7 +17,7 @@ StreamedBinaryAPIResponse, AsyncStreamedBinaryAPIResponse, ) -from cloudflare.types.workers import WorkersScript +from cloudflare.types.workers.script import Script base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -33,7 +33,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "main_module": "worker.js", }, ) - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +62,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -76,7 +76,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) assert cast(Any, response.is_closed) is True @@ -198,7 +198,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -213,7 +213,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "main_module": "worker.js", }, ) - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -229,7 +229,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = await response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -243,7 +243,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = await response.parse() - assert_matches_type(WorkersScript, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py new file mode 100644 index 00000000000..a268b18bd51 --- /dev/null +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py @@ -0,0 +1,310 @@ +# 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_for_platforms.dispatch.namespaces.scripts.secret_list_response import SecretListResponse +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.secret_update_response import ( + SecretUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSecrets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + secret = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + secret = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + name="MY_SECRET", + text="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", + type="secret_text", + ) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update( + "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" + secret = response.parse() + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_streaming_response.update( + "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" + + secret = response.parse() + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update( + "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.secrets.with_raw_response.update( + "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.secrets.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + + @pytest.mark.skip() + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + secret = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + assert_matches_type(SyncSinglePage[SecretListResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list( + "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" + secret = response.parse() + assert_matches_type(SyncSinglePage[SecretListResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_streaming_response.list( + "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" + + secret = response.parse() + assert_matches_type(SyncSinglePage[SecretListResponse], secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list( + "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.secrets.with_raw_response.list( + "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.secrets.with_raw_response.list( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + + +class TestAsyncSecrets: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + secret = await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + secret = await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + name="MY_SECRET", + text="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", + type="secret_text", + ) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = ( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update( + "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" + secret = await response.parse() + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_streaming_response.update( + "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" + + secret = await response.parse() + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update( + "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.secrets.with_raw_response.update( + "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.secrets.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + secret = await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + assert_matches_type(AsyncSinglePage[SecretListResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list( + "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" + secret = await response.parse() + assert_matches_type(AsyncSinglePage[SecretListResponse], secret, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_streaming_response.list( + "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" + + secret = await response.parse() + assert_matches_type(AsyncSinglePage[SecretListResponse], secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list( + "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.secrets.with_raw_response.list( + "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.secrets.with_raw_response.list( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) 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 e1abbb919d1..227235e8b47 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 @@ -3,16 +3,14 @@ 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.workers_for_platforms.dispatch.namespaces.scripts import ( - SettingGetResponse, - SettingEditResponse, -) +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.setting_get_response import SettingGetResponse +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.setting_edit_response import SettingEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,38 +25,8 @@ def test_method_edit(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -67,35 +35,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={ + settings={ "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}], "compatibility_date": "2022-04-05", "compatibility_flags": [ @@ -103,6 +43,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "formdata_parser_supports_files", "formdata_parser_supports_files", ], + "limits": {"cpu_ms": 50}, "logpush": False, "migrations": { "new_tag": "v2", @@ -162,9 +103,8 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: ], "usage_model": "unbound", }, - success=True, ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,42 +113,12 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,42 +127,12 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -264,36 +144,6 @@ def test_path_params_edit(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -301,36 +151,6 @@ def test_path_params_edit(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -338,36 +158,6 @@ def test_path_params_edit(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) @pytest.mark.skip() @@ -378,7 +168,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -392,7 +182,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" setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -406,7 +196,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -445,38 +235,8 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -485,35 +245,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={ + settings={ "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}], "compatibility_date": "2022-04-05", "compatibility_flags": [ @@ -521,6 +253,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "formdata_parser_supports_files", "formdata_parser_supports_files", ], + "limits": {"cpu_ms": 50}, "logpush": False, "migrations": { "new_tag": "v2", @@ -580,9 +313,8 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) ], "usage_model": "unbound", }, - success=True, ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -591,42 +323,12 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -635,42 +337,12 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -682,36 +354,6 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -719,36 +361,6 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -756,36 +368,6 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, ) @pytest.mark.skip() @@ -796,7 +378,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -810,7 +392,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" setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -824,7 +406,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py new file mode 100644 index 00000000000..7b6b13efd80 --- /dev/null +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py @@ -0,0 +1,448 @@ +# 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_for_platforms.dispatch.namespaces.scripts.tag_list_response import TagListResponse +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.tag_update_response import TagUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTags: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + tag = client.workers_for_platforms.dispatch.namespaces.scripts.tags.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tag = response.parse() + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tag = response.parse() + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update( + "this-is_my_script-01", + account_id="", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="", + body=["my-tag", "my-tag", "my-tag"], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) + + @pytest.mark.skip() + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + tag = client.workers_for_platforms.dispatch.namespaces.scripts.tags.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + assert_matches_type(SyncSinglePage[TagListResponse], tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list( + "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" + tag = response.parse() + assert_matches_type(SyncSinglePage[TagListResponse], tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.list( + "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" + + tag = response.parse() + assert_matches_type(SyncSinglePage[TagListResponse], tag, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list( + "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.tags.with_raw_response.list( + "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.tags.with_raw_response.list( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + + @pytest.mark.skip() + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + tag = client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) + assert_matches_type(object, tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tag = response.parse() + assert_matches_type(object, tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tag = response.parse() + assert_matches_type(object, tag, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete( + "my-tag", + account_id="", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="", + script_name="this-is_my_script-01", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag` but received ''"): + client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) + + +class TestAsyncTags: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + tag = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tag = await response.parse() + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tag = await response.parse() + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update( + "this-is_my_script-01", + account_id="", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) + + 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.tags.with_raw_response.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="", + body=["my-tag", "my-tag", "my-tag"], + ) + + 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.tags.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + body=["my-tag", "my-tag", "my-tag"], + ) + + @pytest.mark.skip() + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + tag = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + assert_matches_type(AsyncSinglePage[TagListResponse], tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list( + "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" + tag = await response.parse() + assert_matches_type(AsyncSinglePage[TagListResponse], tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.list( + "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" + + tag = await response.parse() + assert_matches_type(AsyncSinglePage[TagListResponse], tag, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list( + "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.tags.with_raw_response.list( + "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.tags.with_raw_response.list( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + tag = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) + assert_matches_type(object, tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tag = await response.parse() + assert_matches_type(object, tag, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tag = await response.parse() + assert_matches_type(object, tag, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete( + "my-tag", + account_id="", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) + + 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.tags.with_raw_response.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="", + script_name="this-is_my_script-01", + ) + + 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.tags.with_raw_response.delete( + "my-tag", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag` but received ''"): + await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + script_name="this-is_my_script-01", + ) 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 6689db85892..b9d28ce6a0d 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 @@ -3,16 +3,14 @@ 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.workers import WorkersScript -from cloudflare.types.workers_for_platforms.dispatch.namespaces import ( - WorkersForPlatformsNamespaceScript, -) +from cloudflare.types.workers.script import Script as WorkersScript +from cloudflare.types.workers_for_platforms.dispatch.namespaces.script import Script as NamespacesScript base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +110,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "version_tags": {}, }, ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +124,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" script = response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,7 +138,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -176,7 +174,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +185,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N dispatch_namespace="my-dispatch-namespace", message="string", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +199,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" script = response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +213,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -250,6 +248,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, ) assert script is None @@ -260,6 +259,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, force=True, ) assert script is None @@ -271,6 +271,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, ) assert response.is_closed is True @@ -285,6 +286,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -302,6 +304,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -309,6 +312,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -316,6 +320,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, ) @pytest.mark.skip() @@ -326,7 +331,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(WorkersForPlatformsNamespaceScript, script, path=["response"]) + assert_matches_type(Optional[NamespacesScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -340,7 +345,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" script = response.parse() - assert_matches_type(WorkersForPlatformsNamespaceScript, script, path=["response"]) + assert_matches_type(Optional[NamespacesScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -354,7 +359,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(WorkersForPlatformsNamespaceScript, script, path=["response"]) + assert_matches_type(Optional[NamespacesScript], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -394,7 +399,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -478,7 +483,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "version_tags": {}, }, ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -492,7 +497,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" script = await response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -506,7 +511,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -542,7 +547,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -553,7 +558,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn dispatch_namespace="my-dispatch-namespace", message="string", ) - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -567,7 +572,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" script = await response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -581,7 +586,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(WorkersScript, script, path=["response"]) + assert_matches_type(Optional[WorkersScript], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -616,6 +621,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, ) assert script is None @@ -626,6 +632,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, force=True, ) assert script is None @@ -637,6 +644,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, ) assert response.is_closed is True @@ -651,6 +659,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -668,6 +677,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -675,6 +685,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -682,6 +693,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + body={}, ) @pytest.mark.skip() @@ -692,7 +704,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(WorkersForPlatformsNamespaceScript, script, path=["response"]) + assert_matches_type(Optional[NamespacesScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -706,7 +718,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" script = await response.parse() - assert_matches_type(WorkersForPlatformsNamespaceScript, script, path=["response"]) + assert_matches_type(Optional[NamespacesScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -720,7 +732,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(WorkersForPlatformsNamespaceScript, script, path=["response"]) + assert_matches_type(Optional[NamespacesScript], script, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py b/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py index f4a211a5829..d5eb35b1ce4 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py +++ b/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py @@ -3,18 +3,16 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.workers_for_platforms.dispatch import ( - NamespaceGetResponse, - NamespaceListResponse, - NamespaceCreateResponse, -) +from cloudflare.types.workers_for_platforms.dispatch.namespace_get_response import NamespaceGetResponse +from cloudflare.types.workers_for_platforms.dispatch.namespace_list_response import NamespaceListResponse +from cloudflare.types.workers_for_platforms.dispatch.namespace_create_response import NamespaceCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: namespace = client.workers_for_platforms.dispatch.namespaces.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +35,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="my-dispatch-namespace", ) - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +47,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" namespace = response.parse() - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +59,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -174,7 +172,7 @@ def test_method_get(self, client: Cloudflare) -> None: "my-dispatch-namespace", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +185,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" namespace = response.parse() - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -200,7 +198,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -229,7 +227,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: namespace = await async_client.workers_for_platforms.dispatch.namespaces.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -238,7 +236,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", name="my-dispatch-namespace", ) - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -250,7 +248,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" namespace = await response.parse() - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +260,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -375,7 +373,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "my-dispatch-namespace", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -388,7 +386,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" namespace = await response.parse() - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -401,7 +399,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/applications/test_cas.py b/tests/api_resources/zero_trust/access/applications/test_cas.py index 3ac1aafb0b7..810d4b337a2 100644 --- a/tests/api_resources/zero_trust/access/applications/test_cas.py +++ b/tests/api_resources/zero_trust/access/applications/test_cas.py @@ -3,19 +3,17 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access.applications import ( - ZeroTrustCA, - CAGetResponse, - CACreateResponse, - CADeleteResponse, -) +from cloudflare.types.zero_trust.access.applications.ca import CA +from cloudflare.types.zero_trust.access.applications.ca_get_response import CAGetResponse +from cloudflare.types.zero_trust.access.applications.ca_create_response import CACreateResponse +from cloudflare.types.zero_trust.access.applications.ca_delete_response import CADeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CACreateResponse, ca, path=["response"]) + assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +39,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CACreateResponse, ca, path=["response"]) + assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +53,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" ca = response.parse() - assert_matches_type(CACreateResponse, ca, path=["response"]) + assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +67,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = response.parse() - assert_matches_type(CACreateResponse, ca, path=["response"]) + assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) assert cast(Any, response.is_closed) is True @@ -104,7 +102,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustCA], ca, path=["response"]) + assert_matches_type(SyncSinglePage[CA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +111,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustCA], ca, path=["response"]) + assert_matches_type(SyncSinglePage[CA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +124,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustCA], ca, path=["response"]) + assert_matches_type(SyncSinglePage[CA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +137,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustCA], ca, path=["response"]) + assert_matches_type(SyncSinglePage[CA], ca, path=["response"]) assert cast(Any, response.is_closed) is True @@ -166,7 +164,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CADeleteResponse, ca, path=["response"]) + assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +174,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CADeleteResponse, ca, path=["response"]) + assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -190,7 +188,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" ca = response.parse() - assert_matches_type(CADeleteResponse, ca, path=["response"]) + assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -204,7 +202,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = response.parse() - assert_matches_type(CADeleteResponse, ca, path=["response"]) + assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) assert cast(Any, response.is_closed) is True @@ -240,7 +238,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CAGetResponse, ca, path=["response"]) + assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -250,7 +248,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CAGetResponse, ca, path=["response"]) + assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -264,7 +262,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" ca = response.parse() - assert_matches_type(CAGetResponse, ca, path=["response"]) + assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -278,7 +276,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = response.parse() - assert_matches_type(CAGetResponse, ca, path=["response"]) + assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) assert cast(Any, response.is_closed) is True @@ -318,7 +316,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CACreateResponse, ca, path=["response"]) + assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -328,7 +326,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(CACreateResponse, ca, path=["response"]) + assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -342,7 +340,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" ca = await response.parse() - assert_matches_type(CACreateResponse, ca, path=["response"]) + assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -356,7 +354,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = await response.parse() - assert_matches_type(CACreateResponse, ca, path=["response"]) + assert_matches_type(Optional[CACreateResponse], ca, path=["response"]) assert cast(Any, response.is_closed) is True @@ -391,7 +389,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustCA], ca, path=["response"]) + assert_matches_type(AsyncSinglePage[CA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -400,7 +398,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustCA], ca, path=["response"]) + assert_matches_type(AsyncSinglePage[CA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -413,7 +411,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustCA], ca, path=["response"]) + assert_matches_type(AsyncSinglePage[CA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -426,7 +424,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustCA], ca, path=["response"]) + assert_matches_type(AsyncSinglePage[CA], ca, path=["response"]) assert cast(Any, response.is_closed) is True @@ -453,7 +451,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CADeleteResponse, ca, path=["response"]) + assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -463,7 +461,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(CADeleteResponse, ca, path=["response"]) + assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -477,7 +475,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" ca = await response.parse() - assert_matches_type(CADeleteResponse, ca, path=["response"]) + assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -491,7 +489,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = await response.parse() - assert_matches_type(CADeleteResponse, ca, path=["response"]) + assert_matches_type(Optional[CADeleteResponse], ca, path=["response"]) assert cast(Any, response.is_closed) is True @@ -527,7 +525,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CAGetResponse, ca, path=["response"]) + assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -537,7 +535,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(CAGetResponse, ca, path=["response"]) + assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -551,7 +549,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" ca = await response.parse() - assert_matches_type(CAGetResponse, ca, path=["response"]) + assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -565,7 +563,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = await response.parse() - assert_matches_type(CAGetResponse, ca, path=["response"]) + assert_matches_type(Optional[CAGetResponse], ca, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/applications/test_policies.py b/tests/api_resources/zero_trust/access/applications/test_policies.py index be668123b97..29c70fa87cf 100644 --- a/tests/api_resources/zero_trust/access/applications/test_policies.py +++ b/tests/api_resources/zero_trust/access/applications/test_policies.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access.applications import ( - ZeroTrustPolicies, - PolicyDeleteResponse, -) +from cloudflare.types.zero_trust.access.applications.policy import Policy +from cloudflare.types.zero_trust.access.applications.policy_delete_response import PolicyDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -36,7 +34,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +79,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ], session_duration="24h", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +100,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" policy = response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +121,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -188,7 +186,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -234,7 +232,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: ], session_duration="24h", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -256,7 +254,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -278,7 +276,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -353,7 +351,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -363,7 +361,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -377,7 +375,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,7 +389,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) + assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -428,7 +426,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -439,7 +437,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -454,7 +452,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" policy = response.parse() - assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -469,7 +467,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -517,7 +515,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -528,7 +526,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -543,7 +541,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -558,7 +556,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -616,7 +614,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -661,7 +659,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ], session_duration="24h", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -682,7 +680,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" policy = await response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -703,7 +701,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -768,7 +766,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -814,7 +812,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare ], session_duration="24h", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -836,7 +834,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -858,7 +856,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -933,7 +931,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -943,7 +941,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -957,7 +955,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -971,7 +969,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1008,7 +1006,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -1019,7 +1017,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -1034,7 +1032,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" policy = await response.parse() - assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -1049,7 +1047,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1097,7 +1095,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -1108,7 +1106,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -1123,7 +1121,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -1138,7 +1136,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(ZeroTrustPolicies, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/applications/test_user_policy_checks.py b/tests/api_resources/zero_trust/access/applications/test_user_policy_checks.py index 4747aba182f..5cd0fdf9dde 100644 --- a/tests/api_resources/zero_trust/access/applications/test_user_policy_checks.py +++ b/tests/api_resources/zero_trust/access/applications/test_user_policy_checks.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.zero_trust.access.applications import UserPolicyCheckListResponse +from cloudflare.types.zero_trust.access.applications.user_policy_check_list_response import UserPolicyCheckListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(UserPolicyCheckListResponse, user_policy_check, path=["response"]) + assert_matches_type(Optional[UserPolicyCheckListResponse], user_policy_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(UserPolicyCheckListResponse, user_policy_check, path=["response"]) + assert_matches_type(Optional[UserPolicyCheckListResponse], user_policy_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user_policy_check = response.parse() - assert_matches_type(UserPolicyCheckListResponse, user_policy_check, path=["response"]) + assert_matches_type(Optional[UserPolicyCheckListResponse], user_policy_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user_policy_check = response.parse() - assert_matches_type(UserPolicyCheckListResponse, user_policy_check, path=["response"]) + assert_matches_type(Optional[UserPolicyCheckListResponse], user_policy_check, path=["response"]) assert cast(Any, response.is_closed) is True @@ -96,7 +96,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(UserPolicyCheckListResponse, user_policy_check, path=["response"]) + assert_matches_type(Optional[UserPolicyCheckListResponse], user_policy_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(UserPolicyCheckListResponse, user_policy_check, path=["response"]) + assert_matches_type(Optional[UserPolicyCheckListResponse], user_policy_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -120,7 +120,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user_policy_check = await response.parse() - assert_matches_type(UserPolicyCheckListResponse, user_policy_check, path=["response"]) + assert_matches_type(Optional[UserPolicyCheckListResponse], user_policy_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +134,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" user_policy_check = await response.parse() - assert_matches_type(UserPolicyCheckListResponse, user_policy_check, path=["response"]) + assert_matches_type(Optional[UserPolicyCheckListResponse], user_policy_check, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/certificates/test_settings.py b/tests/api_resources/zero_trust/access/certificates/test_settings.py index 112ab10b6e4..755db1f1b4f 100644 --- a/tests/api_resources/zero_trust/access/certificates/test_settings.py +++ b/tests/api_resources/zero_trust/access/certificates/test_settings.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access.certificates import ( - SettingGetResponse, - SettingUpdateResponse, -) +from cloudflare.types.zero_trust.access.certificates.setting_get_response import SettingGetResponse +from cloudflare.types.zero_trust.access.certificates.setting_update_response import SettingUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/access/logs/test_access_requests.py b/tests/api_resources/zero_trust/access/logs/test_access_requests.py index 411964d255b..0f06c8982ef 100644 --- a/tests/api_resources/zero_trust/access/logs/test_access_requests.py +++ b/tests/api_resources/zero_trust/access/logs/test_access_requests.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access.logs import AccessRequestListResponse +from cloudflare.types.zero_trust.access.logs.access_request_list_response import AccessRequestListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/access/test_applications.py b/tests/api_resources/zero_trust/access/test_applications.py index 8902c1dc5df..9d22888966a 100644 --- a/tests/api_resources/zero_trust/access/test_applications.py +++ b/tests/api_resources/zero_trust/access/test_applications.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - ZeroTrustApps, - ApplicationDeleteResponse, -) +from cloudflare.types.zero_trust.access.application import Application +from cloudflare.types.zero_trust.access.application_delete_response import ApplicationDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -70,6 +68,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -78,7 +77,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +92,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -108,7 +107,7 @@ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -138,7 +137,7 @@ def test_method_create_overload_2(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,9 +163,17 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N "auth_type": "saml", "consumer_service_url": "https://example.com", "custom_attributes": { + "friendly_name": "Last Name", "name": "family_name", "name_format": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic", - "source": {"name": "last_name"}, + "required": True, + "source": { + "name": "last_name", + "name_by_idp": { + "exampleIdPID1": "AttributeName1", + "exampleIdPID2": "AttributeName2", + }, + }, }, "default_relay_state": "https://example.com", "idp_entity_id": "https://example.cloudflareaccess.com", @@ -180,7 +187,7 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N tags=["engineers", "engineers", "engineers"], type="saas", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +200,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +213,7 @@ def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -234,7 +241,7 @@ def test_method_create_overload_3(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -274,6 +281,7 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -282,7 +290,7 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -297,7 +305,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -312,7 +320,7 @@ def test_streaming_response_create_overload_3(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -344,7 +352,7 @@ def test_method_create_overload_4(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -384,6 +392,7 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -392,7 +401,7 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -407,7 +416,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -422,7 +431,7 @@ def test_streaming_response_create_overload_4(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -453,7 +462,7 @@ def test_method_create_overload_5(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -470,7 +479,7 @@ def test_method_create_with_all_params_overload_5(self, client: Cloudflare) -> N auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -484,7 +493,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -498,7 +507,7 @@ def test_streaming_response_create_overload_5(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -527,7 +536,7 @@ def test_method_create_overload_6(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -544,7 +553,7 @@ def test_method_create_with_all_params_overload_6(self, client: Cloudflare) -> N auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -558,7 +567,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -572,7 +581,7 @@ def test_streaming_response_create_overload_6(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -601,7 +610,7 @@ def test_method_create_overload_7(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -618,7 +627,7 @@ def test_method_create_with_all_params_overload_7(self, client: Cloudflare) -> N auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -632,7 +641,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -646,7 +655,7 @@ def test_streaming_response_create_overload_7(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -674,7 +683,7 @@ def test_method_create_overload_8(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -689,7 +698,7 @@ def test_method_create_with_all_params_overload_8(self, client: Cloudflare) -> N tags=["engineers", "engineers", "engineers"], type="bookmark", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -702,7 +711,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -715,7 +724,7 @@ def test_streaming_response_create_overload_8(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -744,7 +753,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -785,6 +794,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -793,7 +803,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -809,7 +819,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -825,7 +835,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -858,7 +868,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -885,9 +895,17 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N "auth_type": "saml", "consumer_service_url": "https://example.com", "custom_attributes": { + "friendly_name": "Last Name", "name": "family_name", "name_format": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic", - "source": {"name": "last_name"}, + "required": True, + "source": { + "name": "last_name", + "name_by_idp": { + "exampleIdPID1": "AttributeName1", + "exampleIdPID2": "AttributeName2", + }, + }, }, "default_relay_state": "https://example.com", "idp_entity_id": "https://example.cloudflareaccess.com", @@ -901,7 +919,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N tags=["engineers", "engineers", "engineers"], type="saas", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -915,7 +933,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -929,7 +947,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -960,7 +978,7 @@ def test_method_update_overload_3(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1001,6 +1019,7 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -1009,7 +1028,7 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1025,7 +1044,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1041,7 +1060,7 @@ def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1076,7 +1095,7 @@ def test_method_update_overload_4(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1117,6 +1136,7 @@ def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> N http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -1125,7 +1145,7 @@ def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> N skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1141,7 +1161,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1157,7 +1177,7 @@ def test_streaming_response_update_overload_4(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1191,7 +1211,7 @@ def test_method_update_overload_5(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1209,7 +1229,7 @@ def test_method_update_with_all_params_overload_5(self, client: Cloudflare) -> N auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1224,7 +1244,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1239,7 +1259,7 @@ def test_streaming_response_update_overload_5(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1271,7 +1291,7 @@ def test_method_update_overload_6(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1289,7 +1309,7 @@ def test_method_update_with_all_params_overload_6(self, client: Cloudflare) -> N auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1304,7 +1324,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1319,7 +1339,7 @@ def test_streaming_response_update_overload_6(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1351,7 +1371,7 @@ def test_method_update_overload_7(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1369,7 +1389,7 @@ def test_method_update_with_all_params_overload_7(self, client: Cloudflare) -> N auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1384,7 +1404,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1399,7 +1419,7 @@ def test_streaming_response_update_overload_7(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1430,7 +1450,7 @@ def test_method_update_overload_8(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1446,7 +1466,7 @@ def test_method_update_with_all_params_overload_8(self, client: Cloudflare) -> N tags=["engineers", "engineers", "engineers"], type="bookmark", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1460,7 +1480,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1474,7 +1494,7 @@ def test_streaming_response_update_overload_8(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1502,7 +1522,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustApps], application, path=["response"]) + assert_matches_type(SyncSinglePage[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1511,7 +1531,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustApps], application, path=["response"]) + assert_matches_type(SyncSinglePage[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1524,7 +1544,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustApps], application, path=["response"]) + assert_matches_type(SyncSinglePage[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1537,7 +1557,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustApps], application, path=["response"]) + assert_matches_type(SyncSinglePage[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1564,7 +1584,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ApplicationDeleteResponse, application, path=["response"]) + assert_matches_type(Optional[ApplicationDeleteResponse], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1574,7 +1594,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ApplicationDeleteResponse, application, path=["response"]) + assert_matches_type(Optional[ApplicationDeleteResponse], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1588,7 +1608,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" application = response.parse() - assert_matches_type(ApplicationDeleteResponse, application, path=["response"]) + assert_matches_type(Optional[ApplicationDeleteResponse], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1602,7 +1622,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ApplicationDeleteResponse, application, path=["response"]) + assert_matches_type(Optional[ApplicationDeleteResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1631,7 +1651,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1641,7 +1661,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1655,7 +1675,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" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1669,7 +1689,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1770,7 +1790,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1810,6 +1830,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -1818,7 +1839,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1833,7 +1854,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1848,7 +1869,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1878,7 +1899,7 @@ async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1904,9 +1925,17 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn "auth_type": "saml", "consumer_service_url": "https://example.com", "custom_attributes": { + "friendly_name": "Last Name", "name": "family_name", "name_format": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic", - "source": {"name": "last_name"}, + "required": True, + "source": { + "name": "last_name", + "name_by_idp": { + "exampleIdPID1": "AttributeName1", + "exampleIdPID2": "AttributeName2", + }, + }, }, "default_relay_state": "https://example.com", "idp_entity_id": "https://example.cloudflareaccess.com", @@ -1920,7 +1949,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn tags=["engineers", "engineers", "engineers"], type="saas", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1933,7 +1962,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1946,7 +1975,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1974,7 +2003,7 @@ async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2014,6 +2043,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -2022,7 +2052,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2037,7 +2067,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2052,7 +2082,7 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2084,7 +2114,7 @@ async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2124,6 +2154,7 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -2132,7 +2163,7 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2147,7 +2178,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2162,7 +2193,7 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2193,7 +2224,7 @@ async def test_method_create_overload_5(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2210,7 +2241,7 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2224,7 +2255,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2238,7 +2269,7 @@ async def test_streaming_response_create_overload_5(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2267,7 +2298,7 @@ async def test_method_create_overload_6(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2284,7 +2315,7 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2298,7 +2329,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2312,7 +2343,7 @@ async def test_streaming_response_create_overload_6(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2341,7 +2372,7 @@ async def test_method_create_overload_7(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2358,7 +2389,7 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2372,7 +2403,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2386,7 +2417,7 @@ async def test_streaming_response_create_overload_7(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2414,7 +2445,7 @@ async def test_method_create_overload_8(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2429,7 +2460,7 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn tags=["engineers", "engineers", "engineers"], type="bookmark", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2442,7 +2473,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2455,7 +2486,7 @@ async def test_streaming_response_create_overload_8(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2484,7 +2515,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2525,6 +2556,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -2533,7 +2565,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2549,7 +2581,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2565,7 +2597,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2598,7 +2630,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2625,9 +2657,17 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn "auth_type": "saml", "consumer_service_url": "https://example.com", "custom_attributes": { + "friendly_name": "Last Name", "name": "family_name", "name_format": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic", - "source": {"name": "last_name"}, + "required": True, + "source": { + "name": "last_name", + "name_by_idp": { + "exampleIdPID1": "AttributeName1", + "exampleIdPID2": "AttributeName2", + }, + }, }, "default_relay_state": "https://example.com", "idp_entity_id": "https://example.cloudflareaccess.com", @@ -2641,7 +2681,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn tags=["engineers", "engineers", "engineers"], type="saas", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2655,7 +2695,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2669,7 +2709,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2700,7 +2740,7 @@ async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2741,6 +2781,7 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -2749,7 +2790,7 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2765,7 +2806,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2781,7 +2822,7 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2816,7 +2857,7 @@ async def test_method_update_overload_4(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2857,6 +2898,7 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn http_only_cookie_attribute=True, logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + options_preflight_bypass=True, path_cookie_attribute=True, same_site_cookie_attribute="strict", self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], @@ -2865,7 +2907,7 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2881,7 +2923,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2897,7 +2939,7 @@ async def test_streaming_response_update_overload_4(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2931,7 +2973,7 @@ async def test_method_update_overload_5(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2949,7 +2991,7 @@ async def test_method_update_with_all_params_overload_5(self, async_client: Asyn auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2964,7 +3006,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -2979,7 +3021,7 @@ async def test_streaming_response_update_overload_5(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3011,7 +3053,7 @@ async def test_method_update_overload_6(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3029,7 +3071,7 @@ async def test_method_update_with_all_params_overload_6(self, async_client: Asyn auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3044,7 +3086,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3059,7 +3101,7 @@ async def test_streaming_response_update_overload_6(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3091,7 +3133,7 @@ async def test_method_update_overload_7(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3109,7 +3151,7 @@ async def test_method_update_with_all_params_overload_7(self, async_client: Asyn auto_redirect_to_identity=True, session_duration="24h", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3124,7 +3166,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3139,7 +3181,7 @@ async def test_streaming_response_update_overload_7(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3170,7 +3212,7 @@ async def test_method_update_overload_8(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3186,7 +3228,7 @@ async def test_method_update_with_all_params_overload_8(self, async_client: Asyn tags=["engineers", "engineers", "engineers"], type="bookmark", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3200,7 +3242,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3214,7 +3256,7 @@ async def test_streaming_response_update_overload_8(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3242,7 +3284,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustApps], application, path=["response"]) + assert_matches_type(AsyncSinglePage[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3251,7 +3293,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustApps], application, path=["response"]) + assert_matches_type(AsyncSinglePage[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3264,7 +3306,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustApps], application, path=["response"]) + assert_matches_type(AsyncSinglePage[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3277,7 +3319,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustApps], application, path=["response"]) + assert_matches_type(AsyncSinglePage[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3304,7 +3346,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ApplicationDeleteResponse, application, path=["response"]) + assert_matches_type(Optional[ApplicationDeleteResponse], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3314,7 +3356,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(ApplicationDeleteResponse, application, path=["response"]) + assert_matches_type(Optional[ApplicationDeleteResponse], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3328,7 +3370,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" application = await response.parse() - assert_matches_type(ApplicationDeleteResponse, application, path=["response"]) + assert_matches_type(Optional[ApplicationDeleteResponse], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3342,7 +3384,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ApplicationDeleteResponse, application, path=["response"]) + assert_matches_type(Optional[ApplicationDeleteResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3371,7 +3413,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3381,7 +3423,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3395,7 +3437,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" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3409,7 +3451,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(ZeroTrustApps, application, path=["response"]) + assert_matches_type(Optional[Application], application, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_bookmarks.py b/tests/api_resources/zero_trust/access/test_bookmarks.py index 64a3451ab3c..0c40732bd39 100644 --- a/tests/api_resources/zero_trust/access/test_bookmarks.py +++ b/tests/api_resources/zero_trust/access/test_bookmarks.py @@ -3,14 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ZeroTrustBookmarks, BookmarkDeleteResponse +from cloudflare.types.zero_trust.access.bookmark import Bookmark +from cloudflare.types.zero_trust.access.bookmark_delete_response import BookmarkDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,8 +25,9 @@ def test_method_create(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -33,12 +35,13 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.access.bookmarks.with_raw_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -46,12 +49,13 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.access.bookmarks.with_streaming_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -62,12 +66,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.zero_trust.access.bookmarks.with_raw_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.create( "", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -76,8 +82,9 @@ def test_method_update(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -85,12 +92,13 @@ def test_raw_response_update(self, client: Cloudflare) -> None: response = client.zero_trust.access.bookmarks.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,12 +106,13 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: with client.zero_trust.access.bookmarks.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -114,12 +123,14 @@ def test_path_params_update(self, client: Cloudflare) -> None: client.zero_trust.access.bookmarks.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.update( "", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -128,7 +139,7 @@ def test_method_list(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.list( "699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) + assert_matches_type(SyncSinglePage[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,7 +151,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) + assert_matches_type(SyncSinglePage[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +163,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) + assert_matches_type(SyncSinglePage[Bookmark], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -170,8 +181,9 @@ def test_method_delete(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(BookmarkDeleteResponse, bookmark, path=["response"]) + assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -179,12 +191,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.access.bookmarks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(BookmarkDeleteResponse, bookmark, path=["response"]) + assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -192,12 +205,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.access.bookmarks.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(BookmarkDeleteResponse, bookmark, path=["response"]) + assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -208,12 +222,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.access.bookmarks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.delete( "", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -223,7 +239,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -236,7 +252,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" bookmark = response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,7 +265,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -278,8 +294,9 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: bookmark = await async_client.zero_trust.access.bookmarks.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -287,12 +304,13 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.bookmarks.with_raw_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -300,12 +318,13 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.access.bookmarks.with_streaming_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -316,12 +335,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.access.bookmarks.with_raw_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.create( "", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -330,8 +351,9 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: bookmark = await async_client.zero_trust.access.bookmarks.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -339,12 +361,13 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.bookmarks.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -352,12 +375,13 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.access.bookmarks.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -368,12 +392,14 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.access.bookmarks.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.update( "", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -382,7 +408,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: bookmark = await async_client.zero_trust.access.bookmarks.list( "699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) + assert_matches_type(AsyncSinglePage[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -394,7 +420,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) + assert_matches_type(AsyncSinglePage[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -406,7 +432,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) + assert_matches_type(AsyncSinglePage[Bookmark], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -424,8 +450,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: bookmark = await async_client.zero_trust.access.bookmarks.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(BookmarkDeleteResponse, bookmark, path=["response"]) + assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -433,12 +460,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.bookmarks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(BookmarkDeleteResponse, bookmark, path=["response"]) + assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -446,12 +474,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.access.bookmarks.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(BookmarkDeleteResponse, bookmark, path=["response"]) + assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -462,12 +491,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.access.bookmarks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.delete( "", identifier="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -477,7 +508,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -490,7 +521,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" bookmark = await response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -503,7 +534,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(ZeroTrustBookmarks, bookmark, path=["response"]) + assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_certificates.py b/tests/api_resources/zero_trust/access/test_certificates.py index 2a92155a407..dd00efffe9e 100644 --- a/tests/api_resources/zero_trust/access/test_certificates.py +++ b/tests/api_resources/zero_trust/access/test_certificates.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - ZeroTrustCertificates, - CertificateDeleteResponse, -) +from cloudflare.types.zero_trust.access.certificate import Certificate +from cloudflare.types.zero_trust.access.certificate_delete_response import CertificateDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +40,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: zone_id="string", associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +55,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" certificate = response.parse() - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -72,7 +70,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -104,7 +102,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +114,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: zone_id="string", name="Allow devs", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +129,7 @@ def test_raw_response_update(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(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -146,7 +144,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -184,7 +182,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +191,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +204,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -219,7 +217,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[Certificate], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -246,7 +244,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -256,7 +254,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -270,7 +268,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" certificate = response.parse() - assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -284,7 +282,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -320,7 +318,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -330,7 +328,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -344,7 +342,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(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -358,7 +356,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(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -399,7 +397,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -411,7 +409,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare zone_id="string", associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -426,7 +424,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" certificate = await response.parse() - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -441,7 +439,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -473,7 +471,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -485,7 +483,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare zone_id="string", name="Allow devs", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -500,7 +498,7 @@ async def test_raw_response_update(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(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -515,7 +513,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -553,7 +551,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -562,7 +560,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -575,7 +573,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -588,7 +586,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[Certificate], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -615,7 +613,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -625,7 +623,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -639,7 +637,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" certificate = await response.parse() - assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -653,7 +651,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(CertificateDeleteResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -689,7 +687,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -699,7 +697,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -713,7 +711,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(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -727,7 +725,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(ZeroTrustCertificates, certificate, path=["response"]) + assert_matches_type(Optional[Certificate], certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_custom_pages.py b/tests/api_resources/zero_trust/access/test_custom_pages.py index ccd44ae7fe9..42205be72fe 100644 --- a/tests/api_resources/zero_trust/access/test_custom_pages.py +++ b/tests/api_resources/zero_trust/access/test_custom_pages.py @@ -3,18 +3,16 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - ZeroTrustCustomPage, - CustomPageDeleteResponse, - ZeroTrustCustomPageWithoutHTML, -) +from cloudflare.types.zero_trust.access.custom_page import CustomPage +from cloudflare.types.zero_trust.access.custom_page_without_html import CustomPageWithoutHTML +from cloudflare.types.zero_trust.access.custom_page_delete_response import CustomPageDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="string", type="identity_denied", ) - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +41,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: type="identity_denied", app_count=0, ) - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +56,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" custom_page = response.parse() - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -73,7 +71,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -98,7 +96,7 @@ def test_method_update(self, client: Cloudflare) -> None: name="string", type="identity_denied", ) - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +109,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: type="identity_denied", app_count=0, ) - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +125,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +141,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -174,7 +172,7 @@ def test_method_list(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) + assert_matches_type(SyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,7 +184,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) + assert_matches_type(SyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -198,7 +196,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) + assert_matches_type(SyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -217,7 +215,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CustomPageDeleteResponse, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -230,7 +228,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" custom_page = response.parse() - assert_matches_type(CustomPageDeleteResponse, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -243,7 +241,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(CustomPageDeleteResponse, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -269,7 +267,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZeroTrustCustomPage, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -282,7 +280,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" custom_page = response.parse() - assert_matches_type(ZeroTrustCustomPage, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -295,7 +293,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(ZeroTrustCustomPage, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -327,7 +325,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="string", type="identity_denied", ) - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -339,7 +337,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare type="identity_denied", app_count=0, ) - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -354,7 +352,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" custom_page = await response.parse() - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -369,7 +367,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -394,7 +392,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: name="string", type="identity_denied", ) - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -407,7 +405,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare type="identity_denied", app_count=0, ) - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -423,7 +421,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -439,7 +437,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(ZeroTrustCustomPageWithoutHTML, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageWithoutHTML], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -470,7 +468,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: custom_page = await async_client.zero_trust.access.custom_pages.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) + assert_matches_type(AsyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -482,7 +480,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) + assert_matches_type(AsyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -494,7 +492,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) + assert_matches_type(AsyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -513,7 +511,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CustomPageDeleteResponse, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -526,7 +524,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" custom_page = await response.parse() - assert_matches_type(CustomPageDeleteResponse, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -539,7 +537,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(CustomPageDeleteResponse, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -565,7 +563,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZeroTrustCustomPage, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -578,7 +576,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" custom_page = await response.parse() - assert_matches_type(ZeroTrustCustomPage, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -591,7 +589,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(ZeroTrustCustomPage, custom_page, path=["response"]) + assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_groups.py b/tests/api_resources/zero_trust/access/test_groups.py index ab5b3adbc4e..4c55c3fca81 100644 --- a/tests/api_resources/zero_trust/access/test_groups.py +++ b/tests/api_resources/zero_trust/access/test_groups.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - ZeroTrustGroups, - GroupDeleteResponse, -) +from cloudflare.types.zero_trust.access.zero_trust_group import ZeroTrustGroup +from cloudflare.types.zero_trust.access.group_delete_response import GroupDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -34,7 +32,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +58,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: {"email": {"email": "test@example.com"}}, ], ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -79,7 +77,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" group = response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +96,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +141,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +168,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: {"email": {"email": "test@example.com"}}, ], ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -190,7 +188,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +208,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -263,7 +261,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustGroups], group, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -272,7 +270,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustGroups], group, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +283,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGroups], group, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +296,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGroups], group, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGroup], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -325,7 +323,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(GroupDeleteResponse, group, path=["response"]) + assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -335,7 +333,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(GroupDeleteResponse, group, path=["response"]) + assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -349,7 +347,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" group = response.parse() - assert_matches_type(GroupDeleteResponse, group, path=["response"]) + assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -363,7 +361,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(GroupDeleteResponse, group, path=["response"]) + assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -399,7 +397,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -409,7 +407,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -423,7 +421,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" group = response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -437,7 +435,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -482,7 +480,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -508,7 +506,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare {"email": {"email": "test@example.com"}}, ], ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -527,7 +525,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" group = await response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -546,7 +544,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -591,7 +589,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -618,7 +616,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare {"email": {"email": "test@example.com"}}, ], ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -638,7 +636,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -658,7 +656,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -711,7 +709,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustGroups], group, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -720,7 +718,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustGroups], group, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -733,7 +731,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGroups], group, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -746,7 +744,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGroups], group, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGroup], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -773,7 +771,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(GroupDeleteResponse, group, path=["response"]) + assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -783,7 +781,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(GroupDeleteResponse, group, path=["response"]) + assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -797,7 +795,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" group = await response.parse() - assert_matches_type(GroupDeleteResponse, group, path=["response"]) + assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -811,7 +809,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(GroupDeleteResponse, group, path=["response"]) + assert_matches_type(Optional[GroupDeleteResponse], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -847,7 +845,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -857,7 +855,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -871,7 +869,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" group = await response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -885,7 +883,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(ZeroTrustGroups, group, path=["response"]) + assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_keys.py b/tests/api_resources/zero_trust/access/test_keys.py index 3485f9113bb..6b2ebb382a8 100644 --- a/tests/api_resources/zero_trust/access/test_keys.py +++ b/tests/api_resources/zero_trust/access/test_keys.py @@ -3,13 +3,15 @@ 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.zero_trust.access import KeyGetResponse, KeyRotateResponse, KeyUpdateResponse +from cloudflare.types.zero_trust.access.key_get_response import KeyGetResponse +from cloudflare.types.zero_trust.access.key_rotate_response import KeyRotateResponse +from cloudflare.types.zero_trust.access.key_update_response import KeyUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", key_rotation_interval_days=30, ) - assert_matches_type(KeyUpdateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +39,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyUpdateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +52,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyUpdateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +71,7 @@ def test_method_get(self, client: Cloudflare) -> None: key = client.zero_trust.access.keys.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +83,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" key = response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +95,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -111,7 +113,7 @@ def test_method_rotate(self, client: Cloudflare) -> None: key = client.zero_trust.access.keys.rotate( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeyRotateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +125,7 @@ def test_raw_response_rotate(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyRotateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -135,7 +137,7 @@ def test_streaming_response_rotate(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyRotateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -158,7 +160,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", key_rotation_interval_days=30, ) - assert_matches_type(KeyUpdateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +173,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyUpdateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -184,7 +186,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyUpdateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -203,7 +205,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: key = await async_client.zero_trust.access.keys.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +217,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" key = await response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -227,7 +229,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -245,7 +247,7 @@ async def test_method_rotate(self, async_client: AsyncCloudflare) -> None: key = await async_client.zero_trust.access.keys.rotate( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeyRotateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -257,7 +259,7 @@ async def test_raw_response_rotate(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyRotateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -269,7 +271,7 @@ async def test_streaming_response_rotate(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyRotateResponse, key, path=["response"]) + assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_service_tokens.py b/tests/api_resources/zero_trust/access/test_service_tokens.py index 4815e282fff..b35650734ab 100644 --- a/tests/api_resources/zero_trust/access/test_service_tokens.py +++ b/tests/api_resources/zero_trust/access/test_service_tokens.py @@ -3,18 +3,16 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ( - ZeroTrustServiceTokens, - ServiceTokenCreateResponse, - ServiceTokenRotateResponse, -) +from cloudflare.types.zero_trust.access.service_token import ServiceToken +from cloudflare.types.zero_trust.access.service_token_create_response import ServiceTokenCreateResponse +from cloudflare.types.zero_trust.access.service_token_rotate_response import ServiceTokenRotateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ServiceTokenCreateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenCreateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +39,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: zone_id="string", duration="60m", ) - assert_matches_type(ServiceTokenCreateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenCreateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +53,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" service_token = response.parse() - assert_matches_type(ServiceTokenCreateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenCreateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +67,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(ServiceTokenCreateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenCreateResponse], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -98,7 +96,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +108,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: duration="60m", name="CI/CD token", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -124,7 +122,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +136,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -173,7 +171,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +180,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(SyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -195,7 +193,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,7 +206,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceToken], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -235,7 +233,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -245,7 +243,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -259,7 +257,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" service_token = response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +271,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -308,7 +306,7 @@ def test_method_refresh(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -321,7 +319,7 @@ def test_raw_response_refresh(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -334,7 +332,7 @@ def test_streaming_response_refresh(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -360,7 +358,7 @@ def test_method_rotate(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ServiceTokenRotateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -373,7 +371,7 @@ def test_raw_response_rotate(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(ServiceTokenRotateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -386,7 +384,7 @@ def test_streaming_response_rotate(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(ServiceTokenRotateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -417,7 +415,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ServiceTokenCreateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenCreateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -428,7 +426,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare zone_id="string", duration="60m", ) - assert_matches_type(ServiceTokenCreateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenCreateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -442,7 +440,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" service_token = await response.parse() - assert_matches_type(ServiceTokenCreateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenCreateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -456,7 +454,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(ServiceTokenCreateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenCreateResponse], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -485,7 +483,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -497,7 +495,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare duration="60m", name="CI/CD token", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -511,7 +509,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -525,7 +523,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -560,7 +558,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -569,7 +567,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(AsyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -582,7 +580,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -595,7 +593,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceToken], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -622,7 +620,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -632,7 +630,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -646,7 +644,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" service_token = await response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -660,7 +658,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -695,7 +693,7 @@ async def test_method_refresh(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -708,7 +706,7 @@ async def test_raw_response_refresh(self, async_client: AsyncCloudflare) -> None assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -721,7 +719,7 @@ async def test_streaming_response_refresh(self, async_client: AsyncCloudflare) - assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(ZeroTrustServiceTokens, service_token, path=["response"]) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -747,7 +745,7 @@ async def test_method_rotate(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ServiceTokenRotateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -760,7 +758,7 @@ async def test_raw_response_rotate(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(ServiceTokenRotateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -773,7 +771,7 @@ async def test_streaming_response_rotate(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(ServiceTokenRotateResponse, service_token, path=["response"]) + assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_tags.py b/tests/api_resources/zero_trust/access/test_tags.py index 57c7961ae67..0f7d13bba95 100644 --- a/tests/api_resources/zero_trust/access/test_tags.py +++ b/tests/api_resources/zero_trust/access/test_tags.py @@ -3,14 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access import ZeroTrustTag, TagDeleteResponse +from cloudflare.types.zero_trust.access.tag import Tag +from cloudflare.types.zero_trust.access.tag_delete_response import TagDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +39,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" tag = response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +52,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +73,7 @@ def test_method_update(self, client: Cloudflare) -> None: identifier="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +87,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +101,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -127,7 +128,7 @@ def test_method_list(self, client: Cloudflare) -> None: tag = client.zero_trust.access.tags.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[ZeroTrustTag], tag, path=["response"]) + assert_matches_type(SyncSinglePage[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +140,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustTag], tag, path=["response"]) + assert_matches_type(SyncSinglePage[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -151,7 +152,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustTag], tag, path=["response"]) + assert_matches_type(SyncSinglePage[Tag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -170,7 +171,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "engineers", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TagDeleteResponse, tag, path=["response"]) + assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -183,7 +184,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" tag = response.parse() - assert_matches_type(TagDeleteResponse, tag, path=["response"]) + assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,7 +197,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(TagDeleteResponse, tag, path=["response"]) + assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -222,7 +223,7 @@ def test_method_get(self, client: Cloudflare) -> None: "engineers", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -235,7 +236,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" tag = response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,7 +249,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -278,7 +279,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -291,7 +292,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" tag = await response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -304,7 +305,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -325,7 +326,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: identifier="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -339,7 +340,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -353,7 +354,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -380,7 +381,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: tag = await async_client.zero_trust.access.tags.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[ZeroTrustTag], tag, path=["response"]) + assert_matches_type(AsyncSinglePage[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -392,7 +393,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustTag], tag, path=["response"]) + assert_matches_type(AsyncSinglePage[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -404,7 +405,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustTag], tag, path=["response"]) + assert_matches_type(AsyncSinglePage[Tag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -423,7 +424,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "engineers", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TagDeleteResponse, tag, path=["response"]) + assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -436,7 +437,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" tag = await response.parse() - assert_matches_type(TagDeleteResponse, tag, path=["response"]) + assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -449,7 +450,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(TagDeleteResponse, tag, path=["response"]) + assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -475,7 +476,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "engineers", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -488,7 +489,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" tag = await response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -501,7 +502,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(ZeroTrustTag, tag, path=["response"]) + assert_matches_type(Optional[Tag], tag, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_users.py b/tests/api_resources/zero_trust/access/test_users.py index 5787f3daf8b..91e89a0c449 100644 --- a/tests/api_resources/zero_trust/access/test_users.py +++ b/tests/api_resources/zero_trust/access/test_users.py @@ -10,7 +10,7 @@ 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 ZeroTrustUsers +from cloudflare.types.zero_trust.access.access_user import AccessUser base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: user = client.zero_trust.access.users.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[ZeroTrustUsers], user, path=["response"]) + assert_matches_type(SyncSinglePage[AccessUser], user, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustUsers], user, path=["response"]) + assert_matches_type(SyncSinglePage[AccessUser], user, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustUsers], user, path=["response"]) + assert_matches_type(SyncSinglePage[AccessUser], user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: user = await async_client.zero_trust.access.users.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[ZeroTrustUsers], user, path=["response"]) + assert_matches_type(AsyncSinglePage[AccessUser], user, path=["response"]) @pytest.mark.skip() @parametrize @@ -82,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustUsers], user, path=["response"]) + assert_matches_type(AsyncSinglePage[AccessUser], user, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustUsers], user, path=["response"]) + assert_matches_type(AsyncSinglePage[AccessUser], user, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/users/test_active_sessions.py b/tests/api_resources/zero_trust/access/users/test_active_sessions.py index 724da335d7c..8c769851b4b 100644 --- a/tests/api_resources/zero_trust/access/users/test_active_sessions.py +++ b/tests/api_resources/zero_trust/access/users/test_active_sessions.py @@ -3,14 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access.users import ActiveSessionGetResponse, ActiveSessionListResponse +from cloudflare.types.zero_trust.access.users.active_session_get_response import ActiveSessionGetResponse +from cloudflare.types.zero_trust.access.users.active_session_list_response import ActiveSessionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -78,7 +79,7 @@ def test_method_get(self, client: Cloudflare) -> None: identifier="023e105f4ecef8ad9ca31a8372d0c353", id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(ActiveSessionGetResponse, active_session, path=["response"]) + assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,7 +93,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" active_session = response.parse() - assert_matches_type(ActiveSessionGetResponse, active_session, path=["response"]) + assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +107,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" active_session = response.parse() - assert_matches_type(ActiveSessionGetResponse, active_session, path=["response"]) + assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) assert cast(Any, response.is_closed) is True @@ -198,7 +199,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: identifier="023e105f4ecef8ad9ca31a8372d0c353", id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(ActiveSessionGetResponse, active_session, path=["response"]) + assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) @pytest.mark.skip() @parametrize @@ -212,7 +213,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" active_session = await response.parse() - assert_matches_type(ActiveSessionGetResponse, active_session, path=["response"]) + assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) @pytest.mark.skip() @parametrize @@ -226,7 +227,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" active_session = await response.parse() - assert_matches_type(ActiveSessionGetResponse, active_session, path=["response"]) + assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/users/test_failed_logins.py b/tests/api_resources/zero_trust/access/users/test_failed_logins.py index 34259b8225d..dbecf1080b5 100644 --- a/tests/api_resources/zero_trust/access/users/test_failed_logins.py +++ b/tests/api_resources/zero_trust/access/users/test_failed_logins.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.access.users import FailedLoginListResponse +from cloudflare.types.zero_trust.access.users.failed_login_list_response import FailedLoginListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/access/users/test_last_seen_identity.py b/tests/api_resources/zero_trust/access/users/test_last_seen_identity.py index b721c3213cb..14ec1729a0f 100644 --- a/tests/api_resources/zero_trust/access/users/test_last_seen_identity.py +++ b/tests/api_resources/zero_trust/access/users/test_last_seen_identity.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.zero_trust.access.users import ZeroTrustIdentity +from cloudflare.types.zero_trust.access.users.identity import Identity base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZeroTrustIdentity, last_seen_identity, path=["response"]) + assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" last_seen_identity = response.parse() - assert_matches_type(ZeroTrustIdentity, last_seen_identity, path=["response"]) + assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" last_seen_identity = response.parse() - assert_matches_type(ZeroTrustIdentity, last_seen_identity, path=["response"]) + assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) assert cast(Any, response.is_closed) is True @@ -80,7 +80,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ZeroTrustIdentity, last_seen_identity, path=["response"]) + assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,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" last_seen_identity = await response.parse() - assert_matches_type(ZeroTrustIdentity, last_seen_identity, path=["response"]) + assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" last_seen_identity = await response.parse() - assert_matches_type(ZeroTrustIdentity, last_seen_identity, path=["response"]) + assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/policies/test_default_policy.py b/tests/api_resources/zero_trust/devices/policies/test_default_policy.py index 2257cd23f41..de33297f451 100644 --- a/tests/api_resources/zero_trust/devices/policies/test_default_policy.py +++ b/tests/api_resources/zero_trust/devices/policies/test_default_policy.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.devices.policies import DefaultPolicyGetResponse +from cloudflare.types.zero_trust.devices.policies.default_policy_get_response import DefaultPolicyGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/devices/policies/test_excludes.py b/tests/api_resources/zero_trust/devices/policies/test_excludes.py index b154f08001b..8f08940c2de 100644 --- a/tests/api_resources/zero_trust/devices/policies/test_excludes.py +++ b/tests/api_resources/zero_trust/devices/policies/test_excludes.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices.policies import ( - DevicesSplitTunnel, - ExcludeGetResponse, - ExcludeUpdateResponse, -) +from cloudflare.types.zero_trust.devices.policies.exclude_get_response import ExcludeGetResponse +from cloudflare.types.zero_trust.devices.policies.split_tunnel_exclude import SplitTunnelExclude +from cloudflare.types.zero_trust.devices.policies.exclude_update_response import ExcludeUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -126,7 +124,7 @@ def test_method_list(self, client: Cloudflare) -> None: exclude = client.zero_trust.devices.policies.excludes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) + assert_matches_type(SyncSinglePage[SplitTunnelExclude], exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +136,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" exclude = response.parse() - assert_matches_type(SyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) + assert_matches_type(SyncSinglePage[SplitTunnelExclude], exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +148,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" exclude = response.parse() - assert_matches_type(SyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) + assert_matches_type(SyncSinglePage[SplitTunnelExclude], exclude, path=["response"]) assert cast(Any, response.is_closed) is True @@ -322,7 +320,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: exclude = await async_client.zero_trust.devices.policies.excludes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) + assert_matches_type(AsyncSinglePage[SplitTunnelExclude], exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -334,7 +332,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" exclude = await response.parse() - assert_matches_type(AsyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) + assert_matches_type(AsyncSinglePage[SplitTunnelExclude], exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -346,7 +344,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" exclude = await response.parse() - assert_matches_type(AsyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) + assert_matches_type(AsyncSinglePage[SplitTunnelExclude], exclude, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/policies/test_fallback_domains.py b/tests/api_resources/zero_trust/devices/policies/test_fallback_domains.py index 1fb852868b0..f5482786d61 100644 --- a/tests/api_resources/zero_trust/devices/policies/test_fallback_domains.py +++ b/tests/api_resources/zero_trust/devices/policies/test_fallback_domains.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices.policies import ( - DevicesFallbackDomain, - FallbackDomainGetResponse, - FallbackDomainUpdateResponse, -) +from cloudflare.types.zero_trust.devices.policies.fallback_domain import FallbackDomain +from cloudflare.types.zero_trust.devices.policies.fallback_domain_get_response import FallbackDomainGetResponse +from cloudflare.types.zero_trust.devices.policies.fallback_domain_update_response import FallbackDomainUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -85,7 +83,7 @@ def test_method_list(self, client: Cloudflare) -> None: fallback_domain = client.zero_trust.devices.policies.fallback_domains.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) + assert_matches_type(SyncSinglePage[FallbackDomain], fallback_domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +95,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" fallback_domain = response.parse() - assert_matches_type(SyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) + assert_matches_type(SyncSinglePage[FallbackDomain], fallback_domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -109,7 +107,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" fallback_domain = response.parse() - assert_matches_type(SyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) + assert_matches_type(SyncSinglePage[FallbackDomain], fallback_domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -240,7 +238,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: fallback_domain = await async_client.zero_trust.devices.policies.fallback_domains.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) + assert_matches_type(AsyncSinglePage[FallbackDomain], fallback_domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -252,7 +250,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" fallback_domain = await response.parse() - assert_matches_type(AsyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) + assert_matches_type(AsyncSinglePage[FallbackDomain], fallback_domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -264,7 +262,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" fallback_domain = await response.parse() - assert_matches_type(AsyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) + assert_matches_type(AsyncSinglePage[FallbackDomain], fallback_domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/policies/test_includes.py b/tests/api_resources/zero_trust/devices/policies/test_includes.py index 41d15bd2c83..26b065c0f39 100644 --- a/tests/api_resources/zero_trust/devices/policies/test_includes.py +++ b/tests/api_resources/zero_trust/devices/policies/test_includes.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices.policies import ( - IncludeGetResponse, - IncludeUpdateResponse, - DevicesSplitTunnelInclude, -) +from cloudflare.types.zero_trust.devices.policies.include_get_response import IncludeGetResponse +from cloudflare.types.zero_trust.devices.policies.split_tunnel_include import SplitTunnelInclude +from cloudflare.types.zero_trust.devices.policies.include_update_response import IncludeUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -126,7 +124,7 @@ def test_method_list(self, client: Cloudflare) -> None: include = client.zero_trust.devices.policies.includes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) + assert_matches_type(SyncSinglePage[SplitTunnelInclude], include, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +136,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" include = response.parse() - assert_matches_type(SyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) + assert_matches_type(SyncSinglePage[SplitTunnelInclude], include, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +148,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" include = response.parse() - assert_matches_type(SyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) + assert_matches_type(SyncSinglePage[SplitTunnelInclude], include, path=["response"]) assert cast(Any, response.is_closed) is True @@ -322,7 +320,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: include = await async_client.zero_trust.devices.policies.includes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) + assert_matches_type(AsyncSinglePage[SplitTunnelInclude], include, path=["response"]) @pytest.mark.skip() @parametrize @@ -334,7 +332,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" include = await response.parse() - assert_matches_type(AsyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) + assert_matches_type(AsyncSinglePage[SplitTunnelInclude], include, path=["response"]) @pytest.mark.skip() @parametrize @@ -346,7 +344,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" include = await response.parse() - assert_matches_type(AsyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) + assert_matches_type(AsyncSinglePage[SplitTunnelInclude], include, 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 2094d8b4161..25043b98783 100644 --- a/tests/api_resources/zero_trust/devices/posture/test_integrations.py +++ b/tests/api_resources/zero_trust/devices/posture/test_integrations.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices.posture import ( - DevicePostureIntegrations, - IntegrationDeleteResponse, -) +from cloudflare.types.zero_trust.devices.posture.integration import Integration +from cloudflare.types.zero_trust.devices.posture.integration_delete_response import IntegrationDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -36,7 +34,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="My Workspace One Integration", type="workspace_one", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +51,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="My Workspace One Integration", type="workspace_one", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -74,7 +72,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" integration = response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -95,7 +93,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -122,7 +120,7 @@ def test_method_list(self, client: Cloudflare) -> None: integration = client.zero_trust.devices.posture.integrations.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(SyncSinglePage[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +132,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(SyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(SyncSinglePage[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -146,7 +144,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(SyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(SyncSinglePage[Integration], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -164,8 +162,9 @@ def test_method_delete(self, client: Cloudflare) -> None: integration = client.zero_trust.devices.posture.integrations.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) + assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,12 +172,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.devices.posture.integrations.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) + assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,12 +186,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.devices.posture.integrations.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) + assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -202,12 +203,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.devices.posture.integrations.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `integration_id` but received ''"): client.zero_trust.devices.posture.integrations.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -217,7 +220,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -235,7 +238,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: name="My Workspace One Integration", type="workspace_one", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,7 +251,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" integration = response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -261,7 +264,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -287,7 +290,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -300,7 +303,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" integration = response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -313,7 +316,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -351,7 +354,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="My Workspace One Integration", type="workspace_one", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -368,7 +371,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="My Workspace One Integration", type="workspace_one", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -389,7 +392,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" integration = await response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -410,7 +413,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -437,7 +440,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: integration = await async_client.zero_trust.devices.posture.integrations.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(AsyncSinglePage[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -449,7 +452,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(AsyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(AsyncSinglePage[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +464,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(AsyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(AsyncSinglePage[Integration], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -479,8 +482,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: integration = await async_client.zero_trust.devices.posture.integrations.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) + assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -488,12 +492,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.devices.posture.integrations.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) + assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -501,12 +506,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.devices.posture.integrations.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) + assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -517,12 +523,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.devices.posture.integrations.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `integration_id` but received ''"): await async_client.zero_trust.devices.posture.integrations.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -532,7 +540,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -550,7 +558,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) name="My Workspace One Integration", type="workspace_one", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -563,7 +571,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" integration = await response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -576,7 +584,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -602,7 +610,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -615,7 +623,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" integration = await response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -628,7 +636,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Optional[DevicePostureIntegrations], integration, path=["response"]) + assert_matches_type(Optional[Integration], integration, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_dex_tests.py b/tests/api_resources/zero_trust/devices/test_dex_tests.py index 749e995456c..32788a4a1d0 100644 --- a/tests/api_resources/zero_trust/devices/test_dex_tests.py +++ b/tests/api_resources/zero_trust/devices/test_dex_tests.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices import ( - DEXTestSchemasHTTP, - DEXTestDeleteResponse, -) +from cloudflare.types.zero_trust.devices.schema_http import SchemaHTTP +from cloudflare.types.zero_trust.devices.dex_test_delete_response import DEXTestDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: interval="30m", name="HTTP dash health check", ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,8 +45,26 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: interval="30m", name="HTTP dash health check", description="Checks the dash endpoint every 30 minutes", + target_policies=[ + { + "default": True, + "id": "string", + "name": "string", + }, + { + "default": True, + "id": "string", + "name": "string", + }, + { + "default": True, + "id": "string", + "name": "string", + }, + ], + targeted=True, ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +80,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" dex_test = response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -80,7 +96,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -107,7 +123,7 @@ def test_method_update(self, client: Cloudflare) -> None: interval="30m", name="HTTP dash health check", ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -124,8 +140,26 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: interval="30m", name="HTTP dash health check", description="Checks the dash endpoint every 30 minutes", + target_policies=[ + { + "default": True, + "id": "string", + "name": "string", + }, + { + "default": True, + "id": "string", + "name": "string", + }, + { + "default": True, + "id": "string", + "name": "string", + }, + ], + targeted=True, ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +176,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +193,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -192,7 +226,7 @@ def test_method_list(self, client: Cloudflare) -> None: dex_test = client.zero_trust.devices.dex_tests.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(SyncSinglePage[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -204,7 +238,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = response.parse() - assert_matches_type(SyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(SyncSinglePage[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -216,7 +250,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = response.parse() - assert_matches_type(SyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(SyncSinglePage[SchemaHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -287,7 +321,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -300,7 +334,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" dex_test = response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -313,7 +347,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -346,7 +380,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: interval="30m", name="HTTP dash health check", ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,8 +396,26 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare interval="30m", name="HTTP dash health check", description="Checks the dash endpoint every 30 minutes", + target_policies=[ + { + "default": True, + "id": "string", + "name": "string", + }, + { + "default": True, + "id": "string", + "name": "string", + }, + { + "default": True, + "id": "string", + "name": "string", + }, + ], + targeted=True, ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -379,7 +431,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" dex_test = await response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +447,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = await response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -422,7 +474,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: interval="30m", name="HTTP dash health check", ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -439,8 +491,26 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare interval="30m", name="HTTP dash health check", description="Checks the dash endpoint every 30 minutes", + target_policies=[ + { + "default": True, + "id": "string", + "name": "string", + }, + { + "default": True, + "id": "string", + "name": "string", + }, + { + "default": True, + "id": "string", + "name": "string", + }, + ], + targeted=True, ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -457,7 +527,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = await response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -474,7 +544,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = await response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -507,7 +577,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: dex_test = await async_client.zero_trust.devices.dex_tests.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(AsyncSinglePage[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -519,7 +589,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = await response.parse() - assert_matches_type(AsyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(AsyncSinglePage[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -531,7 +601,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = await response.parse() - assert_matches_type(AsyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(AsyncSinglePage[SchemaHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -602,7 +672,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -615,7 +685,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" dex_test = await response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -628,7 +698,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = await response.parse() - assert_matches_type(Optional[DEXTestSchemasHTTP], dex_test, path=["response"]) + assert_matches_type(Optional[SchemaHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_networks.py b/tests/api_resources/zero_trust/devices/test_networks.py index 232e6be1425..30701ddf3ff 100644 --- a/tests/api_resources/zero_trust/devices/test_networks.py +++ b/tests/api_resources/zero_trust/devices/test_networks.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices import ( - DeviceManagedNetworks, - NetworkDeleteResponse, -) +from cloudflare.types.zero_trust.devices.device_network import DeviceNetwork +from cloudflare.types.zero_trust.devices.network_delete_response import NetworkDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="managed-network-1", type="tls", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +42,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="managed-network-1", type="tls", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +57,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" network = response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -74,7 +72,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -96,7 +94,7 @@ def test_method_update(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +109,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: name="managed-network-1", type="tls", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -124,7 +122,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -137,7 +135,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -162,7 +160,7 @@ def test_method_list(self, client: Cloudflare) -> None: network = client.zero_trust.devices.networks.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(SyncSinglePage[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +172,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(SyncSinglePage[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(SyncSinglePage[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,7 +184,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(SyncSinglePage[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(SyncSinglePage[DeviceNetwork], network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -204,6 +202,7 @@ def test_method_delete(self, client: Cloudflare) -> None: network = client.zero_trust.devices.networks.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(Optional[NetworkDeleteResponse], network, path=["response"]) @@ -213,6 +212,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.devices.networks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -226,6 +226,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.devices.networks.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -242,12 +243,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.devices.networks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): client.zero_trust.devices.networks.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -257,7 +260,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -270,7 +273,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" network = response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -283,7 +286,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -315,7 +318,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="managed-network-1", type="tls", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -329,7 +332,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="managed-network-1", type="tls", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -344,7 +347,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" network = await response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -359,7 +362,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -381,7 +384,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -396,7 +399,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare name="managed-network-1", type="tls", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -409,7 +412,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -422,7 +425,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -447,7 +450,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: network = await async_client.zero_trust.devices.networks.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(AsyncSinglePage[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -459,7 +462,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(AsyncSinglePage[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(AsyncSinglePage[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -471,7 +474,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(AsyncSinglePage[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(AsyncSinglePage[DeviceNetwork], network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -489,6 +492,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: network = await async_client.zero_trust.devices.networks.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(Optional[NetworkDeleteResponse], network, path=["response"]) @@ -498,6 +502,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.devices.networks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -511,6 +516,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.devices.networks.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -527,12 +533,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.devices.networks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): await async_client.zero_trust.devices.networks.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -542,7 +550,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -555,7 +563,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" network = await response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -568,7 +576,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(Optional[DeviceManagedNetworks], network, path=["response"]) + assert_matches_type(Optional[DeviceNetwork], network, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_override_codes.py b/tests/api_resources/zero_trust/devices/test_override_codes.py index dd12c6a6af2..fe5f06f0744 100644 --- a/tests/api_resources/zero_trust/devices/test_override_codes.py +++ b/tests/api_resources/zero_trust/devices/test_override_codes.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.devices import OverrideCodeListResponse +from cloudflare.types.zero_trust.devices.override_code_list_response import OverrideCodeListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/devices/test_policies.py b/tests/api_resources/zero_trust/devices/test_policies.py index 2fcbeec752d..af7e8c718c5 100644 --- a/tests/api_resources/zero_trust/devices/test_policies.py +++ b/tests/api_resources/zero_trust/devices/test_policies.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices import ( - PolicyDeleteResponse, - DevicesDeviceSettingsPolicy, -) +from cloudflare.types.zero_trust.devices.settings_policy import SettingsPolicy +from cloudflare.types.zero_trust.devices.policy_delete_response import PolicyDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="Allow Developers", precedence=100, ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +56,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: support_url="https://1.1.1.1/help", switch_locked=True, ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -73,7 +71,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" policy = response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,7 +86,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -109,7 +107,7 @@ def test_method_list(self, client: Cloudflare) -> None: policy = client.zero_trust.devices.policies.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +119,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +131,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[SettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -151,6 +149,7 @@ def test_method_delete(self, client: Cloudflare) -> None: policy = client.zero_trust.devices.policies.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @@ -160,6 +159,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.devices.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -173,6 +173,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.devices.policies.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -189,12 +190,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.devices.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): client.zero_trust.devices.policies.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -204,7 +207,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -231,7 +234,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: support_url="https://1.1.1.1/help", switch_locked=True, ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -244,7 +247,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" policy = response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -257,7 +260,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -283,7 +286,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -296,7 +299,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -309,7 +312,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -341,7 +344,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="Allow Developers", precedence=100, ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -369,7 +372,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare support_url="https://1.1.1.1/help", switch_locked=True, ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -384,7 +387,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" policy = await response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -399,7 +402,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -420,7 +423,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.devices.policies.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -432,7 +435,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -444,7 +447,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[SettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -462,6 +465,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.devices.policies.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @@ -471,6 +475,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.devices.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -484,6 +489,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.devices.policies.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -500,12 +506,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.devices.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): await async_client.zero_trust.devices.policies.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -515,7 +523,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -542,7 +550,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) support_url="https://1.1.1.1/help", switch_locked=True, ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -555,7 +563,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" policy = await response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -568,7 +576,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -594,7 +602,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -607,7 +615,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -620,7 +628,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[DevicesDeviceSettingsPolicy], policy, path=["response"]) + assert_matches_type(Optional[SettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_posture.py b/tests/api_resources/zero_trust/devices/test_posture.py index 22dc0343f2d..6fa27d73207 100644 --- a/tests/api_resources/zero_trust/devices/test_posture.py +++ b/tests/api_resources/zero_trust/devices/test_posture.py @@ -10,10 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices import ( - DevicePostureRules, - PostureDeleteResponse, -) +from cloudflare.types.zero_trust.devices.device_posture_rule import DevicePostureRule +from cloudflare.types.zero_trust.devices.posture_delete_response import PostureDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="Admin Serial Numbers", type="file", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +48,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: match=[{"platform": "windows"}, {"platform": "windows"}, {"platform": "windows"}], schedule="1h", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +62,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" posture = response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -78,7 +76,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) assert cast(Any, response.is_closed) is True @@ -101,7 +99,7 @@ def test_method_update(self, client: Cloudflare) -> None: name="Admin Serial Numbers", type="file", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +121,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: match=[{"platform": "windows"}, {"platform": "windows"}, {"platform": "windows"}], schedule="1h", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +136,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -153,7 +151,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) assert cast(Any, response.is_closed) is True @@ -182,7 +180,7 @@ def test_method_list(self, client: Cloudflare) -> None: posture = client.zero_trust.devices.posture.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[DevicePostureRules], posture, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -194,7 +192,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = response.parse() - assert_matches_type(SyncSinglePage[DevicePostureRules], posture, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +204,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = response.parse() - assert_matches_type(SyncSinglePage[DevicePostureRules], posture, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureRule], posture, path=["response"]) assert cast(Any, response.is_closed) is True @@ -224,6 +222,7 @@ def test_method_delete(self, client: Cloudflare) -> None: posture = client.zero_trust.devices.posture.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(Optional[PostureDeleteResponse], posture, path=["response"]) @@ -233,6 +232,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.devices.posture.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -246,6 +246,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.devices.posture.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -262,12 +263,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.devices.posture.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.zero_trust.devices.posture.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -277,7 +280,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -290,7 +293,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" posture = response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -303,7 +306,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) assert cast(Any, response.is_closed) is True @@ -334,7 +337,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="Admin Serial Numbers", type="file", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -355,7 +358,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare match=[{"platform": "windows"}, {"platform": "windows"}, {"platform": "windows"}], schedule="1h", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -369,7 +372,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" posture = await response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -383,7 +386,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = await response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) assert cast(Any, response.is_closed) is True @@ -406,7 +409,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: name="Admin Serial Numbers", type="file", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -428,7 +431,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare match=[{"platform": "windows"}, {"platform": "windows"}, {"platform": "windows"}], schedule="1h", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -443,7 +446,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = await response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -458,7 +461,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = await response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) assert cast(Any, response.is_closed) is True @@ -487,7 +490,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: posture = await async_client.zero_trust.devices.posture.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[DevicePostureRules], posture, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -499,7 +502,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = await response.parse() - assert_matches_type(AsyncSinglePage[DevicePostureRules], posture, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -511,7 +514,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = await response.parse() - assert_matches_type(AsyncSinglePage[DevicePostureRules], posture, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureRule], posture, path=["response"]) assert cast(Any, response.is_closed) is True @@ -529,6 +532,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: posture = await async_client.zero_trust.devices.posture.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(Optional[PostureDeleteResponse], posture, path=["response"]) @@ -538,6 +542,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.devices.posture.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -551,6 +556,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.devices.posture.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -567,12 +573,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.devices.posture.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.zero_trust.devices.posture.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -582,7 +590,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -595,7 +603,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" posture = await response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -608,7 +616,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = await response.parse() - assert_matches_type(Optional[DevicePostureRules], posture, path=["response"]) + assert_matches_type(Optional[DevicePostureRule], posture, 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 c31247f4e4b..0809adcd5b0 100644 --- a/tests/api_resources/zero_trust/devices/test_revoke.py +++ b/tests/api_resources/zero_trust/devices/test_revoke.py @@ -3,13 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.devices import RevokeCreateResponse +from cloudflare.types.zero_trust.devices.revoke_create_response import RevokeCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ], ) - assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) + assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +45,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(Optional[RevokeCreateResponse], revoke, path=["response"]) + assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +62,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(Optional[RevokeCreateResponse], revoke, path=["response"]) + assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) assert cast(Any, response.is_closed) is True @@ -94,7 +94,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ], ) - assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) + assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +111,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(Optional[RevokeCreateResponse], revoke, path=["response"]) + assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) @pytest.mark.skip() @parametrize @@ -128,7 +128,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(Optional[RevokeCreateResponse], revoke, path=["response"]) + assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_settings.py b/tests/api_resources/zero_trust/devices/test_settings.py index 76fe07fda54..4ce4bb96e6b 100644 --- a/tests/api_resources/zero_trust/devices/test_settings.py +++ b/tests/api_resources/zero_trust/devices/test_settings.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.devices import ZeroTrustAccountDeviceSettings +from cloudflare.types.zero_trust.devices.device_settings import DeviceSettings base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_update(self, client: Cloudflare) -> None: setting = client.zero_trust.devices.settings.update( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: root_certificate_installation_enabled=True, use_zt_virtual_ip=True, ) - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +59,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -77,7 +77,7 @@ def test_method_list(self, client: Cloudflare) -> None: setting = client.zero_trust.devices.settings.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +89,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,7 +101,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -123,7 +123,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: setting = await async_client.zero_trust.devices.settings.update( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -135,7 +135,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare root_certificate_installation_enabled=True, use_zt_virtual_ip=True, ) - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -147,7 +147,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +159,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -177,7 +177,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: setting = await async_client.zero_trust.devices.settings.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -189,7 +189,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +201,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(Optional[ZeroTrustAccountDeviceSettings], setting, path=["response"]) + assert_matches_type(Optional[DeviceSettings], setting, 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 17c702c7536..488d82eca21 100644 --- a/tests/api_resources/zero_trust/devices/test_unrevoke.py +++ b/tests/api_resources/zero_trust/devices/test_unrevoke.py @@ -3,13 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.devices import UnrevokeCreateResponse +from cloudflare.types.zero_trust.devices.unrevoke_create_response import UnrevokeCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ], ) - assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) + assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +45,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(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) + assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +62,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(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) + assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) assert cast(Any, response.is_closed) is True @@ -94,7 +94,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ], ) - assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) + assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +111,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(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) + assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) @pytest.mark.skip() @parametrize @@ -128,7 +128,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(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) + assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/fleet_status/test_devices.py b/tests/api_resources/zero_trust/dex/fleet_status/test_devices.py index 7343e66f48e..4ce0b0c2511 100644 --- a/tests/api_resources/zero_trust/dex/fleet_status/test_devices.py +++ b/tests/api_resources/zero_trust/dex/fleet_status/test_devices.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.zero_trust.dex.fleet_status import DigitalExperienceMonitoringDevice +from cloudflare.types.zero_trust.dex.fleet_status.device_list_response import DeviceListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +28,7 @@ def test_method_list(self, client: Cloudflare) -> None: time_end="2023-10-11T00:00:00Z", time_start="2023-10-11T00:00:00Z", ) - assert_matches_type(SyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], device, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: status="connected", version="1.0.0", ) - assert_matches_type(SyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], device, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(SyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], device, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -79,7 +79,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(SyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], device, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) assert cast(Any, response.is_closed) is True @@ -109,7 +109,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: time_end="2023-10-11T00:00:00Z", time_start="2023-10-11T00:00:00Z", ) - assert_matches_type(AsyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], device, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -128,7 +128,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) status="connected", version="1.0.0", ) - assert_matches_type(AsyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], device, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -144,7 +144,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], device, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -160,9 +160,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type( - AsyncV4PagePaginationArray[DigitalExperienceMonitoringDevice], device, path=["response"] - ) + assert_matches_type(AsyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/http_tests/test_percentiles.py b/tests/api_resources/zero_trust/dex/http_tests/test_percentiles.py index 9c4986bed9b..e74e9c6070c 100644 --- a/tests/api_resources/zero_trust/dex/http_tests/test_percentiles.py +++ b/tests/api_resources/zero_trust/dex/http_tests/test_percentiles.py @@ -3,15 +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.zero_trust.dex.http_tests import ( - DigitalExperienceMonitoringHTTPDetailsPercentiles, -) +from cloudflare.types.zero_trust.dex.http_tests.http_details_percentiles import HTTPDetailsPercentiles base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_get(self, client: Cloudflare) -> None: time_end="2023-09-20T17:00:00Z", time_start="2023-09-20T17:00:00Z", ) - assert_matches_type(DigitalExperienceMonitoringHTTPDetailsPercentiles, percentile, path=["response"]) + assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +39,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: colo="string", device_id=["string", "string", "string"], ) - assert_matches_type(DigitalExperienceMonitoringHTTPDetailsPercentiles, percentile, path=["response"]) + assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +54,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" percentile = response.parse() - assert_matches_type(DigitalExperienceMonitoringHTTPDetailsPercentiles, percentile, path=["response"]) + assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +69,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" percentile = response.parse() - assert_matches_type(DigitalExperienceMonitoringHTTPDetailsPercentiles, percentile, path=["response"]) + assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) assert cast(Any, response.is_closed) is True @@ -107,7 +105,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: time_end="2023-09-20T17:00:00Z", time_start="2023-09-20T17:00:00Z", ) - assert_matches_type(DigitalExperienceMonitoringHTTPDetailsPercentiles, percentile, path=["response"]) + assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) @pytest.mark.skip() @parametrize @@ -120,7 +118,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - colo="string", device_id=["string", "string", "string"], ) - assert_matches_type(DigitalExperienceMonitoringHTTPDetailsPercentiles, percentile, path=["response"]) + assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) @pytest.mark.skip() @parametrize @@ -135,7 +133,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" percentile = await response.parse() - assert_matches_type(DigitalExperienceMonitoringHTTPDetailsPercentiles, percentile, path=["response"]) + assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +148,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" percentile = await response.parse() - assert_matches_type(DigitalExperienceMonitoringHTTPDetailsPercentiles, percentile, path=["response"]) + assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/test_fleet_status.py b/tests/api_resources/zero_trust/dex/test_fleet_status.py index f613200ec2a..1712bcb2669 100644 --- a/tests/api_resources/zero_trust/dex/test_fleet_status.py +++ b/tests/api_resources/zero_trust/dex/test_fleet_status.py @@ -3,15 +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.zero_trust.dex import ( - FleetStatusLiveResponse, -) +from cloudflare.types.zero_trust.dex.fleet_status_live_response import FleetStatusLiveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +24,7 @@ def test_method_live(self, client: Cloudflare) -> None: account_id="01a7362d577a6c3019a474fd6f485823", since_minutes=10, ) - assert_matches_type(FleetStatusLiveResponse, fleet_status, path=["response"]) + assert_matches_type(Optional[FleetStatusLiveResponse], fleet_status, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +37,7 @@ def test_raw_response_live(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" fleet_status = response.parse() - assert_matches_type(FleetStatusLiveResponse, fleet_status, path=["response"]) + assert_matches_type(Optional[FleetStatusLiveResponse], fleet_status, path=["response"]) @pytest.mark.skip() @parametrize @@ -52,7 +50,7 @@ def test_streaming_response_live(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" fleet_status = response.parse() - assert_matches_type(FleetStatusLiveResponse, fleet_status, path=["response"]) + assert_matches_type(Optional[FleetStatusLiveResponse], fleet_status, path=["response"]) assert cast(Any, response.is_closed) is True @@ -138,7 +136,7 @@ async def test_method_live(self, async_client: AsyncCloudflare) -> None: account_id="01a7362d577a6c3019a474fd6f485823", since_minutes=10, ) - assert_matches_type(FleetStatusLiveResponse, fleet_status, path=["response"]) + assert_matches_type(Optional[FleetStatusLiveResponse], fleet_status, path=["response"]) @pytest.mark.skip() @parametrize @@ -151,7 +149,7 @@ async def test_raw_response_live(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" fleet_status = await response.parse() - assert_matches_type(FleetStatusLiveResponse, fleet_status, path=["response"]) + assert_matches_type(Optional[FleetStatusLiveResponse], fleet_status, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +162,7 @@ async def test_streaming_response_live(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" fleet_status = await response.parse() - assert_matches_type(FleetStatusLiveResponse, fleet_status, path=["response"]) + assert_matches_type(Optional[FleetStatusLiveResponse], fleet_status, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/test_http_tests.py b/tests/api_resources/zero_trust/dex/test_http_tests.py index 077eb4e96f4..0b852d34967 100644 --- a/tests/api_resources/zero_trust/dex/test_http_tests.py +++ b/tests/api_resources/zero_trust/dex/test_http_tests.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.zero_trust.dex import DigitalExperienceMonitoringHTTPDetails +from cloudflare.types.zero_trust.dex.http_details import HTTPDetails base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +27,7 @@ def test_method_get(self, client: Cloudflare) -> None: time_end="string", time_start="string", ) - assert_matches_type(DigitalExperienceMonitoringHTTPDetails, http_test, path=["response"]) + assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +41,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: colo="string", device_id=["string", "string", "string"], ) - assert_matches_type(DigitalExperienceMonitoringHTTPDetails, http_test, path=["response"]) + assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,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" http_test = response.parse() - assert_matches_type(DigitalExperienceMonitoringHTTPDetails, http_test, path=["response"]) + assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -73,7 +73,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" http_test = response.parse() - assert_matches_type(DigitalExperienceMonitoringHTTPDetails, http_test, path=["response"]) + assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -112,7 +112,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: time_end="string", time_start="string", ) - assert_matches_type(DigitalExperienceMonitoringHTTPDetails, http_test, path=["response"]) + assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - colo="string", device_id=["string", "string", "string"], ) - assert_matches_type(DigitalExperienceMonitoringHTTPDetails, http_test, path=["response"]) + assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,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" http_test = await response.parse() - assert_matches_type(DigitalExperienceMonitoringHTTPDetails, http_test, path=["response"]) + assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -158,7 +158,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" http_test = await response.parse() - assert_matches_type(DigitalExperienceMonitoringHTTPDetails, http_test, path=["response"]) + assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/test_tests.py b/tests/api_resources/zero_trust/dex/test_tests.py index 654803068c2..4b1bd5ec38f 100644 --- a/tests/api_resources/zero_trust/dex/test_tests.py +++ b/tests/api_resources/zero_trust/dex/test_tests.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination -from cloudflare.types.zero_trust.dex import TestListResponse +from cloudflare.types.zero_trust.dex.test_list_response import TestListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/dex/test_traceroute_tests.py b/tests/api_resources/zero_trust/dex/test_traceroute_tests.py index fd3069d4944..ea3673d3c1e 100644 --- a/tests/api_resources/zero_trust/dex/test_traceroute_tests.py +++ b/tests/api_resources/zero_trust/dex/test_traceroute_tests.py @@ -3,17 +3,15 @@ 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.zero_trust.dex import ( - DigitalExperienceMonitoringTracerouteDetails, - DigitalExperienceMonitoringTracerouteTestNetworkPath, - DigitalExperienceMonitoringTracerouteDetailsPercentiles, -) +from cloudflare.types.zero_trust.dex.traceroute import Traceroute +from cloudflare.types.zero_trust.network_path_response import NetworkPathResponse +from cloudflare.types.zero_trust.dex.traceroute_test_percentiles_response import TracerouteTestPercentilesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +29,7 @@ def test_method_get(self, client: Cloudflare) -> None: time_end="string", time_start="string", ) - assert_matches_type(DigitalExperienceMonitoringTracerouteDetails, traceroute_test, path=["response"]) + assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +43,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: colo="string", device_id=["string", "string", "string"], ) - assert_matches_type(DigitalExperienceMonitoringTracerouteDetails, traceroute_test, path=["response"]) + assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +59,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" traceroute_test = response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteDetails, traceroute_test, path=["response"]) + assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -77,7 +75,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteDetails, traceroute_test, path=["response"]) + assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -113,7 +111,7 @@ def test_method_network_path(self, client: Cloudflare) -> None: time_end="string", time_start="string", ) - assert_matches_type(DigitalExperienceMonitoringTracerouteTestNetworkPath, traceroute_test, path=["response"]) + assert_matches_type(Optional[NetworkPathResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +128,7 @@ def test_raw_response_network_path(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteTestNetworkPath, traceroute_test, path=["response"]) + assert_matches_type(Optional[NetworkPathResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -147,9 +145,7 @@ def test_streaming_response_network_path(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = response.parse() - assert_matches_type( - DigitalExperienceMonitoringTracerouteTestNetworkPath, traceroute_test, path=["response"] - ) + assert_matches_type(Optional[NetworkPathResponse], traceroute_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -185,7 +181,7 @@ def test_method_percentiles(self, client: Cloudflare) -> None: time_end="2023-09-20T17:00:00Z", time_start="2023-09-20T17:00:00Z", ) - assert_matches_type(DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test, path=["response"]) + assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -198,7 +194,7 @@ def test_method_percentiles_with_all_params(self, client: Cloudflare) -> None: colo="string", device_id=["string", "string", "string"], ) - assert_matches_type(DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test, path=["response"]) + assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -213,7 +209,7 @@ def test_raw_response_percentiles(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test, path=["response"]) + assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -228,9 +224,7 @@ def test_streaming_response_percentiles(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = response.parse() - assert_matches_type( - DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test, path=["response"] - ) + assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -267,7 +261,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: time_end="string", time_start="string", ) - assert_matches_type(DigitalExperienceMonitoringTracerouteDetails, traceroute_test, path=["response"]) + assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -281,7 +275,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - colo="string", device_id=["string", "string", "string"], ) - assert_matches_type(DigitalExperienceMonitoringTracerouteDetails, traceroute_test, path=["response"]) + assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -297,7 +291,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" traceroute_test = await response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteDetails, traceroute_test, path=["response"]) + assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -313,7 +307,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = await response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteDetails, traceroute_test, path=["response"]) + assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -349,7 +343,7 @@ async def test_method_network_path(self, async_client: AsyncCloudflare) -> None: time_end="string", time_start="string", ) - assert_matches_type(DigitalExperienceMonitoringTracerouteTestNetworkPath, traceroute_test, path=["response"]) + assert_matches_type(Optional[NetworkPathResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -366,7 +360,7 @@ async def test_raw_response_network_path(self, async_client: AsyncCloudflare) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = await response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteTestNetworkPath, traceroute_test, path=["response"]) + assert_matches_type(Optional[NetworkPathResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -383,9 +377,7 @@ async def test_streaming_response_network_path(self, async_client: AsyncCloudfla assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = await response.parse() - assert_matches_type( - DigitalExperienceMonitoringTracerouteTestNetworkPath, traceroute_test, path=["response"] - ) + assert_matches_type(Optional[NetworkPathResponse], traceroute_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -421,7 +413,7 @@ async def test_method_percentiles(self, async_client: AsyncCloudflare) -> None: time_end="2023-09-20T17:00:00Z", time_start="2023-09-20T17:00:00Z", ) - assert_matches_type(DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test, path=["response"]) + assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -434,7 +426,7 @@ async def test_method_percentiles_with_all_params(self, async_client: AsyncCloud colo="string", device_id=["string", "string", "string"], ) - assert_matches_type(DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test, path=["response"]) + assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -449,7 +441,7 @@ async def test_raw_response_percentiles(self, async_client: AsyncCloudflare) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = await response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test, path=["response"]) + assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -464,9 +456,7 @@ async def test_streaming_response_percentiles(self, async_client: AsyncCloudflar assert response.http_request.headers.get("X-Stainless-Lang") == "python" traceroute_test = await response.parse() - assert_matches_type( - DigitalExperienceMonitoringTracerouteDetailsPercentiles, traceroute_test, path=["response"] - ) + assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/tests/test_unique_devices.py b/tests/api_resources/zero_trust/dex/tests/test_unique_devices.py index c8e9e0cf3bf..182a51a8a51 100644 --- a/tests/api_resources/zero_trust/dex/tests/test_unique_devices.py +++ b/tests/api_resources/zero_trust/dex/tests/test_unique_devices.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.zero_trust.dex.tests import DigitalExperienceMonitoringUniqueDevices +from cloudflare.types.zero_trust.dex.tests.unique_devices import UniqueDevices base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Cloudflare) -> None: unique_device = client.zero_trust.dex.tests.unique_devices.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(DigitalExperienceMonitoringUniqueDevices, unique_device, path=["response"]) + assert_matches_type(Optional[UniqueDevices], unique_device, path=["response"]) @pytest.mark.skip() @parametrize @@ -33,7 +33,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: device_id=["string", "string", "string"], test_name="string", ) - assert_matches_type(DigitalExperienceMonitoringUniqueDevices, unique_device, path=["response"]) + assert_matches_type(Optional[UniqueDevices], unique_device, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +45,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" unique_device = response.parse() - assert_matches_type(DigitalExperienceMonitoringUniqueDevices, unique_device, path=["response"]) + assert_matches_type(Optional[UniqueDevices], unique_device, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" unique_device = response.parse() - assert_matches_type(DigitalExperienceMonitoringUniqueDevices, unique_device, path=["response"]) + assert_matches_type(Optional[UniqueDevices], unique_device, path=["response"]) assert cast(Any, response.is_closed) is True @@ -79,7 +79,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: unique_device = await async_client.zero_trust.dex.tests.unique_devices.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(DigitalExperienceMonitoringUniqueDevices, unique_device, path=["response"]) + assert_matches_type(Optional[UniqueDevices], unique_device, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +89,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) device_id=["string", "string", "string"], test_name="string", ) - assert_matches_type(DigitalExperienceMonitoringUniqueDevices, unique_device, path=["response"]) + assert_matches_type(Optional[UniqueDevices], unique_device, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,7 +101,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" unique_device = await response.parse() - assert_matches_type(DigitalExperienceMonitoringUniqueDevices, unique_device, path=["response"]) + assert_matches_type(Optional[UniqueDevices], unique_device, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +113,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" unique_device = await response.parse() - assert_matches_type(DigitalExperienceMonitoringUniqueDevices, unique_device, path=["response"]) + assert_matches_type(Optional[UniqueDevices], unique_device, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/traceroute_test_results/test_network_path.py b/tests/api_resources/zero_trust/dex/traceroute_test_results/test_network_path.py index 203bee82cdf..d9f51e98cfe 100644 --- a/tests/api_resources/zero_trust/dex/traceroute_test_results/test_network_path.py +++ b/tests/api_resources/zero_trust/dex/traceroute_test_results/test_network_path.py @@ -3,15 +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.zero_trust.dex.traceroute_test_results import ( - DigitalExperienceMonitoringTracerouteTestResultNetworkPath, -) +from cloudflare.types.zero_trust.dex.traceroute_test_results.network_path_get_response import NetworkPathGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(DigitalExperienceMonitoringTracerouteTestResultNetworkPath, network_path, path=["response"]) + assert_matches_type(Optional[NetworkPathGetResponse], network_path, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +37,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" network_path = response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteTestResultNetworkPath, network_path, path=["response"]) + assert_matches_type(Optional[NetworkPathGetResponse], network_path, path=["response"]) @pytest.mark.skip() @parametrize @@ -52,9 +50,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network_path = response.parse() - assert_matches_type( - DigitalExperienceMonitoringTracerouteTestResultNetworkPath, network_path, path=["response"] - ) + assert_matches_type(Optional[NetworkPathGetResponse], network_path, path=["response"]) assert cast(Any, response.is_closed) is True @@ -84,7 +80,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(DigitalExperienceMonitoringTracerouteTestResultNetworkPath, network_path, path=["response"]) + assert_matches_type(Optional[NetworkPathGetResponse], network_path, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +93,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" network_path = await response.parse() - assert_matches_type(DigitalExperienceMonitoringTracerouteTestResultNetworkPath, network_path, path=["response"]) + assert_matches_type(Optional[NetworkPathGetResponse], network_path, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,9 +106,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" network_path = await response.parse() - assert_matches_type( - DigitalExperienceMonitoringTracerouteTestResultNetworkPath, network_path, path=["response"] - ) + assert_matches_type(Optional[NetworkPathGetResponse], network_path, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dlp/datasets/test_upload.py b/tests/api_resources/zero_trust/dlp/datasets/test_upload.py index 27b4ce8f3f5..4664f9456fb 100644 --- a/tests/api_resources/zero_trust/dlp/datasets/test_upload.py +++ b/tests/api_resources/zero_trust/dlp/datasets/test_upload.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.dlp import DLPDataset -from cloudflare.types.zero_trust.dlp.datasets import DLPDatasetNewVersion +from cloudflare.types.zero_trust.dlp.dataset import Dataset +from cloudflare.types.zero_trust.dlp.datasets.new_version import NewVersion base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", account_id="string", ) - assert_matches_type(Optional[DLPDatasetNewVersion], upload, path=["response"]) + assert_matches_type(Optional[NewVersion], upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +38,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" upload = response.parse() - assert_matches_type(Optional[DLPDatasetNewVersion], upload, path=["response"]) + assert_matches_type(Optional[NewVersion], upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload = response.parse() - assert_matches_type(Optional[DLPDatasetNewVersion], upload, path=["response"]) + assert_matches_type(Optional[NewVersion], upload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -77,8 +77,9 @@ def test_method_edit(self, client: Cloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + body={}, ) - assert_matches_type(Optional[DLPDataset], upload, path=["response"]) + assert_matches_type(Optional[Dataset], upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,12 +88,13 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload = response.parse() - assert_matches_type(Optional[DLPDataset], upload, path=["response"]) + assert_matches_type(Optional[Dataset], upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,12 +103,13 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload = response.parse() - assert_matches_type(Optional[DLPDataset], upload, path=["response"]) + assert_matches_type(Optional[Dataset], upload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -118,6 +121,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: 0, account_id="", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dataset_id` but received ''"): @@ -125,6 +129,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: 0, account_id="string", dataset_id="", + body={}, ) @@ -138,7 +143,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", account_id="string", ) - assert_matches_type(Optional[DLPDatasetNewVersion], upload, path=["response"]) + assert_matches_type(Optional[NewVersion], upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -151,7 +156,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" upload = await response.parse() - assert_matches_type(Optional[DLPDatasetNewVersion], upload, path=["response"]) + assert_matches_type(Optional[NewVersion], upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +169,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload = await response.parse() - assert_matches_type(Optional[DLPDatasetNewVersion], upload, path=["response"]) + assert_matches_type(Optional[NewVersion], upload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -190,8 +195,9 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + body={}, ) - assert_matches_type(Optional[DLPDataset], upload, path=["response"]) + assert_matches_type(Optional[Dataset], upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -200,12 +206,13 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload = await response.parse() - assert_matches_type(Optional[DLPDataset], upload, path=["response"]) + assert_matches_type(Optional[Dataset], upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -214,12 +221,13 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload = await response.parse() - assert_matches_type(Optional[DLPDataset], upload, path=["response"]) + assert_matches_type(Optional[Dataset], upload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -231,6 +239,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: 0, account_id="", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dataset_id` but received ''"): @@ -238,4 +247,5 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: 0, account_id="string", dataset_id="", + body={}, ) diff --git a/tests/api_resources/zero_trust/dlp/profiles/test_custom.py b/tests/api_resources/zero_trust/dlp/profiles/test_custom.py index 6fe7f1aadbf..e0ca3b9e2da 100644 --- a/tests/api_resources/zero_trust/dlp/profiles/test_custom.py +++ b/tests/api_resources/zero_trust/dlp/profiles/test_custom.py @@ -9,11 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.dlp.profiles import ( - DLPCustomProfile, - CustomCreateResponse, - CustomDeleteResponse, -) +from cloudflare.types.zero_trust.dlp.profiles.custom_profile import CustomProfile +from cloudflare.types.zero_trust.dlp.profiles.custom_create_response import CustomCreateResponse +from cloudflare.types.zero_trust.dlp.profiles.custom_delete_response import CustomDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -74,7 +72,7 @@ def test_method_update(self, client: Cloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +119,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: ocr_enabled=True, shared_entries=[{"enabled": True}, {"enabled": True}, {"enabled": True}], ) - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +132,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom = response.parse() - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -147,7 +145,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom = response.parse() - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) assert cast(Any, response.is_closed) is True @@ -172,6 +170,7 @@ def test_method_delete(self, client: Cloudflare) -> None: custom = client.zero_trust.dlp.profiles.custom.delete( "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CustomDeleteResponse, custom, path=["response"]) @@ -181,6 +180,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.dlp.profiles.custom.with_raw_response.delete( "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -194,6 +194,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.dlp.profiles.custom.with_streaming_response.delete( "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -210,12 +211,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.dlp.profiles.custom.with_raw_response.delete( "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.zero_trust.dlp.profiles.custom.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -225,7 +228,7 @@ def test_method_get(self, client: Cloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -238,7 +241,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" custom = response.parse() - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -251,7 +254,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom = response.parse() - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) assert cast(Any, response.is_closed) is True @@ -327,7 +330,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -374,7 +377,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare ocr_enabled=True, shared_entries=[{"enabled": True}, {"enabled": True}, {"enabled": True}], ) - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -387,7 +390,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom = await response.parse() - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -400,7 +403,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom = await response.parse() - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) assert cast(Any, response.is_closed) is True @@ -425,6 +428,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: custom = await async_client.zero_trust.dlp.profiles.custom.delete( "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert_matches_type(CustomDeleteResponse, custom, path=["response"]) @@ -434,6 +438,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dlp.profiles.custom.with_raw_response.delete( "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) assert response.is_closed is True @@ -447,6 +452,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.dlp.profiles.custom.with_streaming_response.delete( "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -463,12 +469,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.dlp.profiles.custom.with_raw_response.delete( "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.zero_trust.dlp.profiles.custom.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, ) @pytest.mark.skip() @@ -478,7 +486,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -491,7 +499,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" custom = await response.parse() - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) @pytest.mark.skip() @parametrize @@ -504,7 +512,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom = await response.parse() - assert_matches_type(DLPCustomProfile, custom, path=["response"]) + assert_matches_type(CustomProfile, custom, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dlp/profiles/test_predefined.py b/tests/api_resources/zero_trust/dlp/profiles/test_predefined.py index 9cc2978647c..85a2e4248c7 100644 --- a/tests/api_resources/zero_trust/dlp/profiles/test_predefined.py +++ b/tests/api_resources/zero_trust/dlp/profiles/test_predefined.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.dlp.profiles import DLPPredefinedProfile +from cloudflare.types.zero_trust.dlp.profiles.predefined_profile import PredefinedProfile base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_update(self, client: Cloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +40,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: entries=[{"enabled": True}, {"enabled": True}, {"enabled": True}], ocr_enabled=True, ) - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +53,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" predefined = response.parse() - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -66,7 +66,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" predefined = response.parse() - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) assert cast(Any, response.is_closed) is True @@ -92,7 +92,7 @@ def test_method_get(self, client: Cloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +105,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" predefined = response.parse() - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +118,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" predefined = response.parse() - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) assert cast(Any, response.is_closed) is True @@ -148,7 +148,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +164,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare entries=[{"enabled": True}, {"enabled": True}, {"enabled": True}], ocr_enabled=True, ) - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -177,7 +177,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" predefined = await response.parse() - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -190,7 +190,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" predefined = await response.parse() - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) assert cast(Any, response.is_closed) is True @@ -216,7 +216,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -229,7 +229,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" predefined = await response.parse() - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +242,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" predefined = await response.parse() - assert_matches_type(DLPPredefinedProfile, predefined, path=["response"]) + assert_matches_type(PredefinedProfile, predefined, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dlp/test_datasets.py b/tests/api_resources/zero_trust/dlp/test_datasets.py index 6a9e3a59c4e..59f4bdb519f 100644 --- a/tests/api_resources/zero_trust/dlp/test_datasets.py +++ b/tests/api_resources/zero_trust/dlp/test_datasets.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.dlp import DLPDataset, DLPDatasetCreation +from cloudflare.types.zero_trust.dlp.dataset import Dataset +from cloudflare.types.zero_trust.dlp.dataset_creation import DatasetCreation base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", name="string", ) - assert_matches_type(Optional[DLPDatasetCreation], dataset, path=["response"]) + assert_matches_type(Optional[DatasetCreation], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: description="string", secret=True, ) - assert_matches_type(Optional[DLPDatasetCreation], dataset, path=["response"]) + assert_matches_type(Optional[DatasetCreation], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +50,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" dataset = response.parse() - assert_matches_type(Optional[DLPDatasetCreation], dataset, path=["response"]) + assert_matches_type(Optional[DatasetCreation], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +63,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = response.parse() - assert_matches_type(Optional[DLPDatasetCreation], dataset, path=["response"]) + assert_matches_type(Optional[DatasetCreation], dataset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,7 +83,7 @@ def test_method_update(self, client: Cloudflare) -> None: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", account_id="string", ) - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: description="string", name="string", ) - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +107,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = response.parse() - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,7 +120,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = response.parse() - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -144,7 +145,7 @@ def test_method_list(self, client: Cloudflare) -> None: dataset = client.zero_trust.dlp.datasets.list( account_id="string", ) - assert_matches_type(SyncSinglePage[DLPDataset], dataset, path=["response"]) + assert_matches_type(SyncSinglePage[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +157,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = response.parse() - assert_matches_type(SyncSinglePage[DLPDataset], dataset, path=["response"]) + assert_matches_type(SyncSinglePage[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -168,7 +169,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = response.parse() - assert_matches_type(SyncSinglePage[DLPDataset], dataset, path=["response"]) + assert_matches_type(SyncSinglePage[Dataset], dataset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -239,7 +240,7 @@ def test_method_get(self, client: Cloudflare) -> None: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", account_id="string", ) - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -252,7 +253,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" dataset = response.parse() - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -265,7 +266,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = response.parse() - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -295,7 +296,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", name="string", ) - assert_matches_type(Optional[DLPDatasetCreation], dataset, path=["response"]) + assert_matches_type(Optional[DatasetCreation], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -306,7 +307,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare description="string", secret=True, ) - assert_matches_type(Optional[DLPDatasetCreation], dataset, path=["response"]) + assert_matches_type(Optional[DatasetCreation], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -319,7 +320,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" dataset = await response.parse() - assert_matches_type(Optional[DLPDatasetCreation], dataset, path=["response"]) + assert_matches_type(Optional[DatasetCreation], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -332,7 +333,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = await response.parse() - assert_matches_type(Optional[DLPDatasetCreation], dataset, path=["response"]) + assert_matches_type(Optional[DatasetCreation], dataset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -352,7 +353,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", account_id="string", ) - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -363,7 +364,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare description="string", name="string", ) - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -376,7 +377,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = await response.parse() - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -389,7 +390,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = await response.parse() - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -414,7 +415,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: dataset = await async_client.zero_trust.dlp.datasets.list( account_id="string", ) - assert_matches_type(AsyncSinglePage[DLPDataset], dataset, path=["response"]) + assert_matches_type(AsyncSinglePage[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -426,7 +427,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = await response.parse() - assert_matches_type(AsyncSinglePage[DLPDataset], dataset, path=["response"]) + assert_matches_type(AsyncSinglePage[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -438,7 +439,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = await response.parse() - assert_matches_type(AsyncSinglePage[DLPDataset], dataset, path=["response"]) + assert_matches_type(AsyncSinglePage[Dataset], dataset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -509,7 +510,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", account_id="string", ) - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -522,7 +523,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" dataset = await response.parse() - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -535,7 +536,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = await response.parse() - assert_matches_type(Optional[DLPDataset], dataset, path=["response"]) + assert_matches_type(Optional[Dataset], dataset, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dlp/test_patterns.py b/tests/api_resources/zero_trust/dlp/test_patterns.py index 78006df2495..8f2493a8767 100644 --- a/tests/api_resources/zero_trust/dlp/test_patterns.py +++ b/tests/api_resources/zero_trust/dlp/test_patterns.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.zero_trust.dlp import PatternValidateResponse +from cloudflare.types.logpush.ownership_validation import OwnershipValidation base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_validate(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", regex="^4[0-9]{6,}$", ) - assert_matches_type(PatternValidateResponse, pattern, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], pattern, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_raw_response_validate(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pattern = response.parse() - assert_matches_type(PatternValidateResponse, pattern, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], pattern, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_validate(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pattern = response.parse() - assert_matches_type(PatternValidateResponse, pattern, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], pattern, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +74,7 @@ async def test_method_validate(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", regex="^4[0-9]{6,}$", ) - assert_matches_type(PatternValidateResponse, pattern, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], pattern, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ async def test_raw_response_validate(self, async_client: AsyncCloudflare) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pattern = await response.parse() - assert_matches_type(PatternValidateResponse, pattern, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], pattern, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ async def test_streaming_response_validate(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" pattern = await response.parse() - assert_matches_type(PatternValidateResponse, pattern, path=["response"]) + assert_matches_type(Optional[OwnershipValidation], pattern, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dlp/test_payload_logs.py b/tests/api_resources/zero_trust/dlp/test_payload_logs.py index 0f18a2aa45e..10b34cadfef 100644 --- a/tests/api_resources/zero_trust/dlp/test_payload_logs.py +++ b/tests/api_resources/zero_trust/dlp/test_payload_logs.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.dlp import PayloadLogGetResponse, PayloadLogUpdateResponse +from cloudflare.types.zero_trust.dlp.payload_log_get_response import PayloadLogGetResponse +from cloudflare.types.zero_trust.dlp.payload_log_update_response import PayloadLogUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/dlp/test_profiles.py b/tests/api_resources/zero_trust/dlp/test_profiles.py index d4aba3617f9..a4f33dc2987 100644 --- a/tests/api_resources/zero_trust/dlp/test_profiles.py +++ b/tests/api_resources/zero_trust/dlp/test_profiles.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.dlp import DLPProfiles, ProfileGetResponse +from cloudflare.types.zero_trust.dlp.profile import Profile +from cloudflare.types.zero_trust.dlp.profile_get_response import ProfileGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: profile = client.zero_trust.dlp.profiles.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[DLPProfiles], profile, path=["response"]) + assert_matches_type(SyncSinglePage[Profile], profile, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +37,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" profile = response.parse() - assert_matches_type(SyncSinglePage[DLPProfiles], profile, path=["response"]) + assert_matches_type(SyncSinglePage[Profile], profile, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +49,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" profile = response.parse() - assert_matches_type(SyncSinglePage[DLPProfiles], profile, path=["response"]) + assert_matches_type(SyncSinglePage[Profile], profile, path=["response"]) assert cast(Any, response.is_closed) is True @@ -122,7 +123,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: profile = await async_client.zero_trust.dlp.profiles.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[DLPProfiles], profile, path=["response"]) + assert_matches_type(AsyncSinglePage[Profile], profile, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +135,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" profile = await response.parse() - assert_matches_type(AsyncSinglePage[DLPProfiles], profile, path=["response"]) + assert_matches_type(AsyncSinglePage[Profile], profile, path=["response"]) @pytest.mark.skip() @parametrize @@ -146,7 +147,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" profile = await response.parse() - assert_matches_type(AsyncSinglePage[DLPProfiles], profile, path=["response"]) + assert_matches_type(AsyncSinglePage[Profile], profile, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/lists/test_items.py b/tests/api_resources/zero_trust/gateway/lists/test_items.py index e16f44bd1ce..468ec04bab5 100644 --- a/tests/api_resources/zero_trust/gateway/lists/test_items.py +++ b/tests/api_resources/zero_trust/gateway/lists/test_items.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.gateway.lists import ItemListResponse +from cloudflare.types.zero_trust.gateway.lists.item_list_response import ItemListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/gateway/test_app_types.py b/tests/api_resources/zero_trust/gateway/test_app_types.py index 1c07ff95dc2..50cdc7d5443 100644 --- a/tests/api_resources/zero_trust/gateway/test_app_types.py +++ b/tests/api_resources/zero_trust/gateway/test_app_types.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayAppTypes +from cloudflare.types.zero_trust.gateway.app_type import AppType base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: app_type = client.zero_trust.gateway.app_types.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) + assert_matches_type(SyncSinglePage[AppType], app_type, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" app_type = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) + assert_matches_type(SyncSinglePage[AppType], app_type, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" app_type = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) + assert_matches_type(SyncSinglePage[AppType], app_type, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: app_type = await async_client.zero_trust.gateway.app_types.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) + assert_matches_type(AsyncSinglePage[AppType], app_type, path=["response"]) @pytest.mark.skip() @parametrize @@ -82,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" app_type = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) + assert_matches_type(AsyncSinglePage[AppType], app_type, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" app_type = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) + assert_matches_type(AsyncSinglePage[AppType], app_type, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_audit_ssh_settings.py b/tests/api_resources/zero_trust/gateway/test_audit_ssh_settings.py index 41131b5b655..dfff2c64800 100644 --- a/tests/api_resources/zero_trust/gateway/test_audit_ssh_settings.py +++ b/tests/api_resources/zero_trust/gateway/test_audit_ssh_settings.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.zero_trust.gateway import ZeroTrustGatewaySettings +from cloudflare.types.zero_trust.gateway.gateway_settings import GatewaySettings base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", public_key="1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA=", ) - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -34,7 +34,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: public_key="1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA=", seed_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_ssh_setting = response.parse() - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +60,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_ssh_setting = response.parse() - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -79,7 +79,7 @@ def test_method_get(self, client: Cloudflare) -> None: audit_ssh_setting = client.zero_trust.gateway.audit_ssh_settings.get( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -91,7 +91,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" audit_ssh_setting = response.parse() - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +103,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_ssh_setting = response.parse() - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -126,7 +126,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", public_key="1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA=", ) - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -136,7 +136,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare public_key="1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA=", seed_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -149,7 +149,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_ssh_setting = await response.parse() - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -162,7 +162,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_ssh_setting = await response.parse() - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +181,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: audit_ssh_setting = await async_client.zero_trust.gateway.audit_ssh_settings.get( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +193,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" audit_ssh_setting = await response.parse() - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,7 +205,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_ssh_setting = await response.parse() - assert_matches_type(ZeroTrustGatewaySettings, audit_ssh_setting, path=["response"]) + assert_matches_type(Optional[GatewaySettings], audit_ssh_setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_categories.py b/tests/api_resources/zero_trust/gateway/test_categories.py index 597b08b3c5d..493145345f8 100644 --- a/tests/api_resources/zero_trust/gateway/test_categories.py +++ b/tests/api_resources/zero_trust/gateway/test_categories.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayCategories +from cloudflare.types.zero_trust.gateway.category import Category base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: category = client.zero_trust.gateway.categories.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) + assert_matches_type(SyncSinglePage[Category], category, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" category = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) + assert_matches_type(SyncSinglePage[Category], category, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" category = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) + assert_matches_type(SyncSinglePage[Category], category, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: category = await async_client.zero_trust.gateway.categories.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) + assert_matches_type(AsyncSinglePage[Category], category, path=["response"]) @pytest.mark.skip() @parametrize @@ -82,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" category = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) + assert_matches_type(AsyncSinglePage[Category], category, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" category = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) + assert_matches_type(AsyncSinglePage[Category], category, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_configurations.py b/tests/api_resources/zero_trust/gateway/test_configurations.py index 1f722987759..fdb2189a5ed 100644 --- a/tests/api_resources/zero_trust/gateway/test_configurations.py +++ b/tests/api_resources/zero_trust/gateway/test_configurations.py @@ -3,17 +3,15 @@ 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.zero_trust.gateway import ( - ConfigurationGetResponse, - ConfigurationEditResponse, - ConfigurationUpdateResponse, -) +from cloudflare.types.zero_trust.gateway.configuration_get_response import ConfigurationGetResponse +from cloudflare.types.zero_trust.gateway.configuration_edit_response import ConfigurationEditResponse +from cloudflare.types.zero_trust.gateway.configuration_update_response import ConfigurationUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +25,7 @@ def test_method_update(self, client: Cloudflare) -> None: configuration = client.zero_trust.gateway.configurations.update( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationUpdateResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -72,7 +70,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "tls_decrypt": {"enabled": True}, }, ) - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationUpdateResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -84,7 +82,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" configuration = response.parse() - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationUpdateResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -96,7 +94,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" configuration = response.parse() - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationUpdateResponse], configuration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -114,7 +112,7 @@ def test_method_edit(self, client: Cloudflare) -> None: configuration = client.zero_trust.gateway.configurations.edit( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ConfigurationEditResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationEditResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +157,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "tls_decrypt": {"enabled": True}, }, ) - assert_matches_type(ConfigurationEditResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationEditResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +169,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" configuration = response.parse() - assert_matches_type(ConfigurationEditResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationEditResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -183,7 +181,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" configuration = response.parse() - assert_matches_type(ConfigurationEditResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationEditResponse], configuration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -201,7 +199,7 @@ def test_method_get(self, client: Cloudflare) -> None: configuration = client.zero_trust.gateway.configurations.get( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationGetResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -213,7 +211,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" configuration = response.parse() - assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationGetResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +223,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" configuration = response.parse() - assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationGetResponse], configuration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -247,7 +245,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.gateway.configurations.update( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationUpdateResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -292,7 +290,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "tls_decrypt": {"enabled": True}, }, ) - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationUpdateResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -304,7 +302,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" configuration = await response.parse() - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationUpdateResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -316,7 +314,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" configuration = await response.parse() - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationUpdateResponse], configuration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -334,7 +332,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.gateway.configurations.edit( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ConfigurationEditResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationEditResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -379,7 +377,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "tls_decrypt": {"enabled": True}, }, ) - assert_matches_type(ConfigurationEditResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationEditResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,7 +389,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" configuration = await response.parse() - assert_matches_type(ConfigurationEditResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationEditResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -403,7 +401,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" configuration = await response.parse() - assert_matches_type(ConfigurationEditResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationEditResponse], configuration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -421,7 +419,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.gateway.configurations.get( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationGetResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -433,7 +431,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" configuration = await response.parse() - assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationGetResponse], configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -445,7 +443,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" configuration = await response.parse() - assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) + assert_matches_type(Optional[ConfigurationGetResponse], configuration, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_lists.py b/tests/api_resources/zero_trust/gateway/test_lists.py index 3744b856256..7881181bdad 100644 --- a/tests/api_resources/zero_trust/gateway/test_lists.py +++ b/tests/api_resources/zero_trust/gateway/test_lists.py @@ -3,18 +3,16 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.gateway import ( - ListCreateResponse, - ListDeleteResponse, - ZeroTrustGatewayLists, -) +from cloudflare.types.zero_trust.gateway.gateway_list import GatewayList +from cloudflare.types.zero_trust.gateway.list_create_response import ListCreateResponse +from cloudflare.types.zero_trust.gateway.list_delete_response import ListDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="Admin Serial Numbers", type="SERIAL", ) - assert_matches_type(ListCreateResponse, list, path=["response"]) + assert_matches_type(Optional[ListCreateResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +40,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: description="The serial numbers for administrators", items=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}], ) - assert_matches_type(ListCreateResponse, list, path=["response"]) + assert_matches_type(Optional[ListCreateResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +54,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" list = response.parse() - assert_matches_type(ListCreateResponse, list, path=["response"]) + assert_matches_type(Optional[ListCreateResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -70,7 +68,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(ListCreateResponse, list, path=["response"]) + assert_matches_type(Optional[ListCreateResponse], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -92,7 +90,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Admin Serial Numbers", ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +101,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: name="Admin Serial Numbers", description="The serial numbers for administrators", ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +115,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +129,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -158,7 +156,7 @@ def test_method_list(self, client: Cloudflare) -> None: list = client.zero_trust.gateway.lists.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) + assert_matches_type(SyncSinglePage[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +168,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) + assert_matches_type(SyncSinglePage[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +180,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) + assert_matches_type(SyncSinglePage[GatewayList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -200,8 +198,9 @@ def test_method_delete(self, client: Cloudflare) -> None: list = client.zero_trust.gateway.lists.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(ListDeleteResponse, list, path=["response"]) + assert_matches_type(Optional[ListDeleteResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -209,12 +208,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.gateway.lists.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(ListDeleteResponse, list, path=["response"]) + assert_matches_type(Optional[ListDeleteResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -222,12 +222,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.gateway.lists.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(ListDeleteResponse, list, path=["response"]) + assert_matches_type(Optional[ListDeleteResponse], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,12 +239,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.gateway.lists.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `list_id` but received ''"): client.zero_trust.gateway.lists.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -253,7 +256,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -264,7 +267,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: append=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}], remove=["8GE8721REF", "8GE8721REF", "8GE8721REF"], ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -277,7 +280,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" list = response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -290,7 +293,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -316,7 +319,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -329,7 +332,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" list = response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -342,7 +345,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -373,7 +376,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="Admin Serial Numbers", type="SERIAL", ) - assert_matches_type(ListCreateResponse, list, path=["response"]) + assert_matches_type(Optional[ListCreateResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -385,7 +388,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare description="The serial numbers for administrators", items=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}], ) - assert_matches_type(ListCreateResponse, list, path=["response"]) + assert_matches_type(Optional[ListCreateResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -399,7 +402,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" list = await response.parse() - assert_matches_type(ListCreateResponse, list, path=["response"]) + assert_matches_type(Optional[ListCreateResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -413,7 +416,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(ListCreateResponse, list, path=["response"]) + assert_matches_type(Optional[ListCreateResponse], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -435,7 +438,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Admin Serial Numbers", ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -446,7 +449,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare name="Admin Serial Numbers", description="The serial numbers for administrators", ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -460,7 +463,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -474,7 +477,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -501,7 +504,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: list = await async_client.zero_trust.gateway.lists.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) + assert_matches_type(AsyncSinglePage[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -513,7 +516,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) + assert_matches_type(AsyncSinglePage[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -525,7 +528,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) + assert_matches_type(AsyncSinglePage[GatewayList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -543,8 +546,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: list = await async_client.zero_trust.gateway.lists.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(ListDeleteResponse, list, path=["response"]) + assert_matches_type(Optional[ListDeleteResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -552,12 +556,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.gateway.lists.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(ListDeleteResponse, list, path=["response"]) + assert_matches_type(Optional[ListDeleteResponse], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -565,12 +570,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.gateway.lists.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(ListDeleteResponse, list, path=["response"]) + assert_matches_type(Optional[ListDeleteResponse], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -581,12 +587,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.gateway.lists.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `list_id` but received ''"): await async_client.zero_trust.gateway.lists.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -596,7 +604,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -607,7 +615,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) append=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}], remove=["8GE8721REF", "8GE8721REF", "8GE8721REF"], ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -620,7 +628,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" list = await response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -633,7 +641,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -659,7 +667,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -672,7 +680,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" list = await response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -685,7 +693,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(ZeroTrustGatewayLists, list, path=["response"]) + assert_matches_type(Optional[GatewayList], list, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_locations.py b/tests/api_resources/zero_trust/gateway/test_locations.py index fcc448b5063..4049a984b30 100644 --- a/tests/api_resources/zero_trust/gateway/test_locations.py +++ b/tests/api_resources/zero_trust/gateway/test_locations.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.gateway import ( - LocationDeleteResponse, - ZeroTrustGatewayLocations, -) +from cloudflare.types.zero_trust.gateway.location import Location +from cloudflare.types.zero_trust.gateway.location_delete_response import LocationDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +38,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ecs_support=False, networks=[{"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}], ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +51,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" location = response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -66,7 +64,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -87,7 +85,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +98,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: ecs_support=False, networks=[{"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}], ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -114,7 +112,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -128,7 +126,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -155,7 +153,7 @@ def test_method_list(self, client: Cloudflare) -> None: location = client.zero_trust.gateway.locations.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) + assert_matches_type(SyncSinglePage[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -167,7 +165,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) + assert_matches_type(SyncSinglePage[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -179,7 +177,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) + assert_matches_type(SyncSinglePage[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,8 +195,9 @@ def test_method_delete(self, client: Cloudflare) -> None: location = client.zero_trust.gateway.locations.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(LocationDeleteResponse, location, path=["response"]) + assert_matches_type(Optional[LocationDeleteResponse], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,12 +205,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.gateway.locations.with_raw_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(LocationDeleteResponse, location, path=["response"]) + assert_matches_type(Optional[LocationDeleteResponse], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -219,12 +219,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.gateway.locations.with_streaming_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(LocationDeleteResponse, location, path=["response"]) + assert_matches_type(Optional[LocationDeleteResponse], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -235,12 +236,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.gateway.locations.with_raw_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `location_id` but received ''"): client.zero_trust.gateway.locations.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -250,7 +253,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -263,7 +266,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" location = response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -276,7 +279,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -306,7 +309,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -318,7 +321,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ecs_support=False, networks=[{"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}], ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -331,7 +334,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" location = await response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -344,7 +347,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -365,7 +368,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -378,7 +381,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare ecs_support=False, networks=[{"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}], ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -392,7 +395,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -406,7 +409,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -433,7 +436,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: location = await async_client.zero_trust.gateway.locations.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) + assert_matches_type(AsyncSinglePage[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -445,7 +448,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) + assert_matches_type(AsyncSinglePage[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -457,7 +460,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) + assert_matches_type(AsyncSinglePage[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -475,8 +478,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: location = await async_client.zero_trust.gateway.locations.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(LocationDeleteResponse, location, path=["response"]) + assert_matches_type(Optional[LocationDeleteResponse], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -484,12 +488,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.gateway.locations.with_raw_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(LocationDeleteResponse, location, path=["response"]) + assert_matches_type(Optional[LocationDeleteResponse], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -497,12 +502,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.gateway.locations.with_streaming_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(LocationDeleteResponse, location, path=["response"]) + assert_matches_type(Optional[LocationDeleteResponse], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -513,12 +519,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.gateway.locations.with_raw_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `location_id` but received ''"): await async_client.zero_trust.gateway.locations.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -528,7 +536,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -541,7 +549,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" location = await response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -554,7 +562,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(ZeroTrustGatewayLocations, location, path=["response"]) + assert_matches_type(Optional[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_logging.py b/tests/api_resources/zero_trust/gateway/test_logging.py index 605aea4d2f0..456b0289c8b 100644 --- a/tests/api_resources/zero_trust/gateway/test_logging.py +++ b/tests/api_resources/zero_trust/gateway/test_logging.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.zero_trust.gateway import ZeroTrustGatewayGatewayAccountLoggingSettings +from cloudflare.types.zero_trust.gateway.logging_setting import LoggingSetting base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_update(self, client: Cloudflare) -> None: logging = client.zero_trust.gateway.logging.update( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "l4": {}, }, ) - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" logging = response.parse() - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" logging = response.parse() - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) assert cast(Any, response.is_closed) is True @@ -79,7 +79,7 @@ def test_method_get(self, client: Cloudflare) -> None: logging = client.zero_trust.gateway.logging.get( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -91,7 +91,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" logging = response.parse() - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +103,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" logging = response.parse() - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) assert cast(Any, response.is_closed) is True @@ -125,7 +125,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: logging = await async_client.zero_trust.gateway.logging.update( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +139,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "l4": {}, }, ) - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -151,7 +151,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" logging = await response.parse() - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -163,7 +163,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" logging = await response.parse() - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +181,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: logging = await async_client.zero_trust.gateway.logging.get( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +193,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" logging = await response.parse() - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,7 +205,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" logging = await response.parse() - assert_matches_type(ZeroTrustGatewayGatewayAccountLoggingSettings, logging, path=["response"]) + assert_matches_type(Optional[LoggingSetting], logging, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py b/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py index 8b9d29867c4..ebc9df85eb6 100644 --- a/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py +++ b/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.gateway import ( - ProxyEndpointDeleteResponse, - ZeroTrustGatewayProxyEndpoints, -) +from cloudflare.types.zero_trust.gateway.proxy_endpoint import ProxyEndpoint +from cloudflare.types.zero_trust.gateway.proxy_endpoint_delete_response import ProxyEndpointDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,18 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: ips=["192.0.2.1/32", "192.0.2.1/32", "192.0.2.1/32"], name="Devops team", ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.create( - account_id="699d98642c564d2e855e9661899b7252", - ips=["192.0.2.1/32", "192.0.2.1/32", "192.0.2.1/32"], - name="Devops team", - subdomain="oli3n9zkz5.proxy.cloudflare-gateway.com", - ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +41,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" proxy_endpoint = response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +55,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -88,7 +75,7 @@ def test_method_list(self, client: Cloudflare) -> None: proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) + assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +87,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) + assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +99,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) + assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -130,8 +117,9 @@ def test_method_delete(self, client: Cloudflare) -> None: proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(ProxyEndpointDeleteResponse, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointDeleteResponse], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,12 +127,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.gateway.proxy_endpoints.with_raw_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(ProxyEndpointDeleteResponse, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointDeleteResponse], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,12 +141,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.gateway.proxy_endpoints.with_streaming_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(ProxyEndpointDeleteResponse, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointDeleteResponse], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -168,12 +158,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.gateway.proxy_endpoints.with_raw_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `proxy_endpoint_id` but received ''"): client.zero_trust.gateway.proxy_endpoints.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -183,7 +175,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,9 +185,8 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", ips=["192.0.2.1/32", "192.0.2.1/32", "192.0.2.1/32"], name="Devops team", - subdomain="oli3n9zkz5.proxy.cloudflare-gateway.com", ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,7 +199,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" proxy_endpoint = response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +212,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -247,7 +238,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -260,7 +251,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" proxy_endpoint = response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +264,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -304,18 +295,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: ips=["192.0.2.1/32", "192.0.2.1/32", "192.0.2.1/32"], name="Devops team", ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - proxy_endpoint = await async_client.zero_trust.gateway.proxy_endpoints.create( - account_id="699d98642c564d2e855e9661899b7252", - ips=["192.0.2.1/32", "192.0.2.1/32", "192.0.2.1/32"], - name="Devops team", - subdomain="oli3n9zkz5.proxy.cloudflare-gateway.com", - ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -329,7 +309,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" proxy_endpoint = await response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -343,7 +323,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -363,7 +343,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: proxy_endpoint = await async_client.zero_trust.gateway.proxy_endpoints.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) + assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -375,7 +355,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) + assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -387,7 +367,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) + assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -405,8 +385,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: proxy_endpoint = await async_client.zero_trust.gateway.proxy_endpoints.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(ProxyEndpointDeleteResponse, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointDeleteResponse], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -414,12 +395,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.gateway.proxy_endpoints.with_raw_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(ProxyEndpointDeleteResponse, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointDeleteResponse], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -427,12 +409,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.gateway.proxy_endpoints.with_streaming_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(ProxyEndpointDeleteResponse, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointDeleteResponse], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -443,12 +426,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.gateway.proxy_endpoints.with_raw_response.delete( "ed35569b41ce4d1facfe683550f54086", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `proxy_endpoint_id` but received ''"): await async_client.zero_trust.gateway.proxy_endpoints.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -458,7 +443,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -468,9 +453,8 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) account_id="699d98642c564d2e855e9661899b7252", ips=["192.0.2.1/32", "192.0.2.1/32", "192.0.2.1/32"], name="Devops team", - subdomain="oli3n9zkz5.proxy.cloudflare-gateway.com", ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -483,7 +467,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" proxy_endpoint = await response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -496,7 +480,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -522,7 +506,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -535,7 +519,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" proxy_endpoint = await response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -548,7 +532,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(ZeroTrustGatewayProxyEndpoints, proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_rules.py b/tests/api_resources/zero_trust/gateway/test_rules.py index c6ba3450655..06386fffc8a 100644 --- a/tests/api_resources/zero_trust/gateway/test_rules.py +++ b/tests/api_resources/zero_trust/gateway/test_rules.py @@ -3,17 +3,15 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.gateway import ( - RuleDeleteResponse, - ZeroTrustGatewayRules, -) +from cloudflare.types.zero_trust.gateway.gateway_rule import GatewayRule +from cloudflare.types.zero_trust.gateway.rule_delete_response import RuleDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: action="allow", name="block bad websites", ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,19 +66,19 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "dns_resolvers": { "ipv4": [ { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", @@ -88,19 +86,19 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ], "ipv6": [ { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", @@ -142,7 +140,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: }, traffic='http.request.uri matches ".*a/partial/uri.*" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10', ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +154,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" rule = response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +168,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -193,7 +191,7 @@ def test_method_update(self, client: Cloudflare) -> None: action="allow", name="block bad websites", ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,19 +231,19 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "dns_resolvers": { "ipv4": [ { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", @@ -253,19 +251,19 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: ], "ipv6": [ { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", @@ -307,7 +305,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, traffic='http.request.uri matches ".*a/partial/uri.*" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10', ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -322,7 +320,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -337,7 +335,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -366,7 +364,7 @@ def test_method_list(self, client: Cloudflare) -> None: rule = client.zero_trust.gateway.rules.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) + assert_matches_type(SyncSinglePage[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -378,7 +376,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) + assert_matches_type(SyncSinglePage[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -390,7 +388,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) + assert_matches_type(SyncSinglePage[GatewayRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -408,8 +406,9 @@ def test_method_delete(self, client: Cloudflare) -> None: rule = client.zero_trust.gateway.rules.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,12 +416,13 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.gateway.rules.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -430,12 +430,13 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.gateway.rules.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -446,12 +447,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.gateway.rules.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.zero_trust.gateway.rules.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -461,7 +464,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -474,7 +477,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" rule = response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -487,7 +490,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -518,7 +521,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: action="allow", name="block bad websites", ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -557,19 +560,19 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "dns_resolvers": { "ipv4": [ { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", @@ -577,19 +580,19 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ], "ipv6": [ { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", @@ -631,7 +634,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare }, traffic='http.request.uri matches ".*a/partial/uri.*" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10', ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -645,7 +648,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" rule = await response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -659,7 +662,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -682,7 +685,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: action="allow", name="block bad websites", ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -722,19 +725,19 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "dns_resolvers": { "ipv4": [ { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2.2.2.2", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", @@ -742,19 +745,19 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare ], "ipv6": [ { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { - "ip": "2001:DB8::/64", + "ip": "2001:DB8::", "port": 5053, "route_through_private_network": True, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", @@ -796,7 +799,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, traffic='http.request.uri matches ".*a/partial/uri.*" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10', ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -811,7 +814,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -826,7 +829,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -855,7 +858,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: rule = await async_client.zero_trust.gateway.rules.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -867,7 +870,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -879,7 +882,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[GatewayRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -897,8 +900,9 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: rule = await async_client.zero_trust.gateway.rules.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -906,12 +910,13 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.gateway.rules.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -919,12 +924,13 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.gateway.rules.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -935,12 +941,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.gateway.rules.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.zero_trust.gateway.rules.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -950,7 +958,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -963,7 +971,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" rule = await response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -976,7 +984,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(ZeroTrustGatewayRules, rule, path=["response"]) + assert_matches_type(Optional[GatewayRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/networks/routes/test_ips.py b/tests/api_resources/zero_trust/networks/routes/test_ips.py index e27958f7424..a9e502c1168 100644 --- a/tests/api_resources/zero_trust/networks/routes/test_ips.py +++ b/tests/api_resources/zero_trust/networks/routes/test_ips.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.networks import TunnelTeamnet +from cloudflare.types.zero_trust.networks.teamnet import Teamnet base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: "10.1.0.137", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelTeamnet, ip, path=["response"]) + assert_matches_type(Teamnet, ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,9 +32,9 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: ip = client.zero_trust.networks.routes.ips.get( "10.1.0.137", account_id="699d98642c564d2e855e9661899b7252", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelTeamnet, ip, path=["response"]) + assert_matches_type(Teamnet, ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,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" ip = response.parse() - assert_matches_type(TunnelTeamnet, ip, path=["response"]) + assert_matches_type(Teamnet, ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +60,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = response.parse() - assert_matches_type(TunnelTeamnet, ip, path=["response"]) + assert_matches_type(Teamnet, ip, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,7 +90,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "10.1.0.137", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelTeamnet, ip, path=["response"]) + assert_matches_type(Teamnet, ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,9 +98,9 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - ip = await async_client.zero_trust.networks.routes.ips.get( "10.1.0.137", account_id="699d98642c564d2e855e9661899b7252", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelTeamnet, ip, path=["response"]) + assert_matches_type(Teamnet, ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +113,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" ip = await response.parse() - assert_matches_type(TunnelTeamnet, ip, path=["response"]) + assert_matches_type(Teamnet, ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = await response.parse() - assert_matches_type(TunnelTeamnet, ip, path=["response"]) + assert_matches_type(Teamnet, ip, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/networks/routes/test_networks.py b/tests/api_resources/zero_trust/networks/routes/test_networks.py index 2a450b423f4..080b8b57b6b 100644 --- a/tests/api_resources/zero_trust/networks/routes/test_networks.py +++ b/tests/api_resources/zero_trust/networks/routes/test_networks.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.networks import TunnelRoute +from cloudflare.types.zero_trust.networks.route import Route base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -33,9 +33,9 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,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" network = response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -87,7 +87,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -96,8 +96,10 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", tun_type="cfd_tunnel", + tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +112,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" network = response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +125,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,7 +151,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -162,7 +164,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" network = response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -175,7 +177,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -205,7 +207,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -214,9 +216,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -229,7 +231,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" network = await response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +244,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -268,7 +270,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -277,8 +279,10 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", tun_type="cfd_tunnel", + tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -291,7 +295,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" network = await response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -304,7 +308,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -330,7 +334,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -343,7 +347,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" network = await response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) @pytest.mark.skip() @parametrize @@ -356,7 +360,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(TunnelRoute, network, path=["response"]) + assert_matches_type(Route, network, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/networks/test_routes.py b/tests/api_resources/zero_trust/networks/test_routes.py index fd55a14edef..ce54749d1d8 100644 --- a/tests/api_resources/zero_trust/networks/test_routes.py +++ b/tests/api_resources/zero_trust/networks/test_routes.py @@ -9,11 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.zero_trust.networks import ( - TunnelRoute, - TunnelTeamnet, -) +from cloudflare.types.zero_trust.networks.route import Route +from cloudflare.types.zero_trust.networks.teamnet import Teamnet base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,46 +25,46 @@ class TestRoutes: def test_method_create(self, client: Cloudflare) -> None: route = client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: route = client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", comment="Example comment for this route.", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.networks.routes.with_raw_response.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.networks.routes.with_streaming_response.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +74,7 @@ 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.networks.routes.with_raw_response.create( account_id="", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) @pytest.mark.skip() @@ -84,7 +83,7 @@ def test_method_list(self, client: Cloudflare) -> None: route = client.zero_trust.networks.routes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncV4PagePaginationArray[TunnelTeamnet], route, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Teamnet], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,17 +91,18 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: route = client.zero_trust.networks.routes.list( account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", - existed_at={}, - is_deleted={}, - network_subset={}, - network_superset={}, + existed_at=parse_datetime("2019-10-12T07:20:50.52Z"), + is_deleted=True, + network_subset="172.16.0.0/16", + network_superset="172.16.0.0/16", page=1, per_page=1, + route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", tun_types="cfd_tunnel,warp_connector", - tunnel_id={}, - virtual_network_id={}, + tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(SyncV4PagePaginationArray[TunnelTeamnet], route, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Teamnet], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -114,7 +114,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(SyncV4PagePaginationArray[TunnelTeamnet], route, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Teamnet], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(SyncV4PagePaginationArray[TunnelTeamnet], route, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[Teamnet], route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -145,7 +145,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -158,7 +158,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" route = response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +171,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,7 +197,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,11 +207,9 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", network="172.16.0.0/16", - tun_type="cfd_tunnel", - tunnel_id={}, - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -224,7 +222,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" route = response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -237,7 +235,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -265,46 +263,46 @@ class TestAsyncRoutes: async def test_method_create(self, async_client: AsyncCloudflare) -> None: route = await async_client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: route = await async_client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", comment="Example comment for this route.", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.networks.routes.with_raw_response.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.networks.routes.with_streaming_response.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -314,7 +312,7 @@ 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.networks.routes.with_raw_response.create( account_id="", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) @pytest.mark.skip() @@ -323,7 +321,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: route = await async_client.zero_trust.networks.routes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncV4PagePaginationArray[TunnelTeamnet], route, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Teamnet], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -331,17 +329,18 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) route = await async_client.zero_trust.networks.routes.list( account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", - existed_at={}, - is_deleted={}, - network_subset={}, - network_superset={}, + existed_at=parse_datetime("2019-10-12T07:20:50.52Z"), + is_deleted=True, + network_subset="172.16.0.0/16", + network_superset="172.16.0.0/16", page=1, per_page=1, + route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", tun_types="cfd_tunnel,warp_connector", - tunnel_id={}, - virtual_network_id={}, + tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(AsyncV4PagePaginationArray[TunnelTeamnet], route, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Teamnet], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -353,7 +352,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[TunnelTeamnet], route, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Teamnet], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -365,7 +364,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[TunnelTeamnet], route, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[Teamnet], route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -384,7 +383,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -397,7 +396,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" route = await response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -410,7 +409,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -436,7 +435,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -446,11 +445,9 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", network="172.16.0.0/16", - tun_type="cfd_tunnel", - tunnel_id={}, - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -463,7 +460,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" route = await response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) @pytest.mark.skip() @parametrize @@ -476,7 +473,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(TunnelRoute, route, path=["response"]) + assert_matches_type(Route, route, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/networks/test_virtual_networks.py b/tests/api_resources/zero_trust/networks/test_virtual_networks.py index 0f9798517cb..0605b0ea6c5 100644 --- a/tests/api_resources/zero_trust/networks/test_virtual_networks.py +++ b/tests/api_resources/zero_trust/networks/test_virtual_networks.py @@ -10,12 +10,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.networks import ( - TunnelVirtualNetwork, - VirtualNetworkEditResponse, - VirtualNetworkCreateResponse, - VirtualNetworkDeleteResponse, -) +from cloudflare.types.zero_trust.networks.virtual_network import VirtualNetwork +from cloudflare.types.zero_trust.networks.virtual_network_edit_response import VirtualNetworkEditResponse +from cloudflare.types.zero_trust.networks.virtual_network_create_response import VirtualNetworkCreateResponse +from cloudflare.types.zero_trust.networks.virtual_network_delete_response import VirtualNetworkDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -86,19 +84,19 @@ def test_method_list(self, client: Cloudflare) -> None: virtual_network = client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) + assert_matches_type(SyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: virtual_network = client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", - is_default={}, - is_deleted={}, + id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + is_default=True, + is_deleted=True, name="us-east-1-vpc", - vnet_name="us-east-1-vpc", ) - assert_matches_type(SyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) + assert_matches_type(SyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +108,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" virtual_network = response.parse() - assert_matches_type(SyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) + assert_matches_type(SyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +120,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" virtual_network = response.parse() - assert_matches_type(SyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) + assert_matches_type(SyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -140,6 +138,7 @@ def test_method_delete(self, client: Cloudflare) -> None: virtual_network = client.zero_trust.networks.virtual_networks.delete( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(VirtualNetworkDeleteResponse, virtual_network, path=["response"]) @@ -149,6 +148,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.networks.virtual_networks.with_raw_response.delete( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -162,6 +162,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.networks.virtual_networks.with_streaming_response.delete( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -178,12 +179,14 @@ def test_path_params_delete(self, client: Cloudflare) -> None: client.zero_trust.networks.virtual_networks.with_raw_response.delete( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `virtual_network_id` but received ''"): client.zero_trust.networks.virtual_networks.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() @@ -317,19 +320,19 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: virtual_network = await async_client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) + assert_matches_type(AsyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: virtual_network = await async_client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", - is_default={}, - is_deleted={}, + id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + is_default=True, + is_deleted=True, name="us-east-1-vpc", - vnet_name="us-east-1-vpc", ) - assert_matches_type(AsyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) + assert_matches_type(AsyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -341,7 +344,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" virtual_network = await response.parse() - assert_matches_type(AsyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) + assert_matches_type(AsyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -353,7 +356,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" virtual_network = await response.parse() - assert_matches_type(AsyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) + assert_matches_type(AsyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -371,6 +374,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: virtual_network = await async_client.zero_trust.networks.virtual_networks.delete( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert_matches_type(VirtualNetworkDeleteResponse, virtual_network, path=["response"]) @@ -380,6 +384,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.networks.virtual_networks.with_raw_response.delete( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) assert response.is_closed is True @@ -393,6 +398,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.networks.virtual_networks.with_streaming_response.delete( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -409,12 +415,14 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.networks.virtual_networks.with_raw_response.delete( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="", + body={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `virtual_network_id` but received ''"): await async_client.zero_trust.networks.virtual_networks.with_raw_response.delete( "", account_id="699d98642c564d2e855e9661899b7252", + body={}, ) @pytest.mark.skip() diff --git a/tests/api_resources/zones/workers/__init__.py b/tests/api_resources/zero_trust/risk_scoring/__init__.py similarity index 100% rename from tests/api_resources/zones/workers/__init__.py rename to tests/api_resources/zero_trust/risk_scoring/__init__.py diff --git a/tests/api_resources/zero_trust/risk_scoring/test_behaviours.py b/tests/api_resources/zero_trust/risk_scoring/test_behaviours.py new file mode 100644 index 00000000000..b3a3f782a81 --- /dev/null +++ b/tests/api_resources/zero_trust/risk_scoring/test_behaviours.py @@ -0,0 +1,219 @@ +# 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.zero_trust.risk_scoring.behaviour_get_response import BehaviourGetResponse +from cloudflare.types.zero_trust.risk_scoring.behaviour_update_response import BehaviourUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBehaviours: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + behaviour = client.zero_trust.risk_scoring.behaviours.update( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(BehaviourUpdateResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + behaviour = client.zero_trust.risk_scoring.behaviours.update( + "023e105f4ecef8ad9ca31a8372d0c353", + behaviors={ + "foo": { + "enabled": True, + "risk_level": "low", + } + }, + ) + assert_matches_type(BehaviourUpdateResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.behaviours.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + behaviour = response.parse() + assert_matches_type(BehaviourUpdateResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.behaviours.with_streaming_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + behaviour = response.parse() + assert_matches_type(BehaviourUpdateResponse, behaviour, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + client.zero_trust.risk_scoring.behaviours.with_raw_response.update( + "", + ) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + behaviour = client.zero_trust.risk_scoring.behaviours.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(BehaviourGetResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.behaviours.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + behaviour = response.parse() + assert_matches_type(BehaviourGetResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.behaviours.with_streaming_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + behaviour = response.parse() + assert_matches_type(BehaviourGetResponse, behaviour, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + client.zero_trust.risk_scoring.behaviours.with_raw_response.get( + "", + ) + + +class TestAsyncBehaviours: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + behaviour = await async_client.zero_trust.risk_scoring.behaviours.update( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(BehaviourUpdateResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + behaviour = await async_client.zero_trust.risk_scoring.behaviours.update( + "023e105f4ecef8ad9ca31a8372d0c353", + behaviors={ + "foo": { + "enabled": True, + "risk_level": "low", + } + }, + ) + assert_matches_type(BehaviourUpdateResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.behaviours.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + behaviour = await response.parse() + assert_matches_type(BehaviourUpdateResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.behaviours.with_streaming_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + behaviour = await response.parse() + assert_matches_type(BehaviourUpdateResponse, behaviour, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + await async_client.zero_trust.risk_scoring.behaviours.with_raw_response.update( + "", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + behaviour = await async_client.zero_trust.risk_scoring.behaviours.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(BehaviourGetResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.behaviours.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + behaviour = await response.parse() + assert_matches_type(BehaviourGetResponse, behaviour, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.behaviours.with_streaming_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + behaviour = await response.parse() + assert_matches_type(BehaviourGetResponse, behaviour, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + await async_client.zero_trust.risk_scoring.behaviours.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/zero_trust/risk_scoring/test_summary.py b/tests/api_resources/zero_trust/risk_scoring/test_summary.py new file mode 100644 index 00000000000..b10f5fe4b9c --- /dev/null +++ b/tests/api_resources/zero_trust/risk_scoring/test_summary.py @@ -0,0 +1,130 @@ +# 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.zero_trust.risk_scoring.summary_get_response import SummaryGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSummary: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + summary = client.zero_trust.risk_scoring.summary.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SummaryGetResponse, summary, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + summary = client.zero_trust.risk_scoring.summary.get( + "023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + order_by="timestamp", + page=0, + per_page=0, + ) + assert_matches_type(SummaryGetResponse, summary, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.summary.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + summary = response.parse() + assert_matches_type(SummaryGetResponse, summary, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.summary.with_streaming_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + summary = response.parse() + assert_matches_type(SummaryGetResponse, summary, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + client.zero_trust.risk_scoring.summary.with_raw_response.get( + "", + ) + + +class TestAsyncSummary: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + summary = await async_client.zero_trust.risk_scoring.summary.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SummaryGetResponse, summary, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + summary = await async_client.zero_trust.risk_scoring.summary.get( + "023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + order_by="timestamp", + page=0, + per_page=0, + ) + assert_matches_type(SummaryGetResponse, summary, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.summary.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + summary = await response.parse() + assert_matches_type(SummaryGetResponse, summary, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.summary.with_streaming_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + summary = await response.parse() + assert_matches_type(SummaryGetResponse, summary, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + await async_client.zero_trust.risk_scoring.summary.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/zero_trust/test_connectivity_settings.py b/tests/api_resources/zero_trust/test_connectivity_settings.py index 001080cf070..5c129dd44c4 100644 --- a/tests/api_resources/zero_trust/test_connectivity_settings.py +++ b/tests/api_resources/zero_trust/test_connectivity_settings.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust import ( - ConnectivitySettingGetResponse, - ConnectivitySettingEditResponse, -) +from cloudflare.types.zero_trust.connectivity_setting_get_response import ConnectivitySettingGetResponse +from cloudflare.types.zero_trust.connectivity_setting_edit_response import ConnectivitySettingEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/test_devices.py b/tests/api_resources/zero_trust/test_devices.py index bdc426140f6..9e3bbc48c25 100644 --- a/tests/api_resources/zero_trust/test_devices.py +++ b/tests/api_resources/zero_trust/test_devices.py @@ -3,14 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +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.zero_trust import ZeroTrustDevices, DeviceGetResponse +from cloudflare.types.zero_trust.device import Device +from cloudflare.types.zero_trust.device_get_response import DeviceGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: device = client.zero_trust.devices.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[ZeroTrustDevices], device, path=["response"]) + assert_matches_type(SyncSinglePage[Device], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +37,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustDevices], device, path=["response"]) + assert_matches_type(SyncSinglePage[Device], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +49,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(SyncSinglePage[ZeroTrustDevices], device, path=["response"]) + assert_matches_type(SyncSinglePage[Device], device, path=["response"]) assert cast(Any, response.is_closed) is True @@ -67,7 +68,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) + assert_matches_type(DeviceGetResponse, device, path=["response"]) @pytest.mark.skip() @parametrize @@ -80,7 +81,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(Optional[DeviceGetResponse], device, path=["response"]) + assert_matches_type(DeviceGetResponse, device, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,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(Optional[DeviceGetResponse], device, path=["response"]) + assert_matches_type(DeviceGetResponse, device, path=["response"]) assert cast(Any, response.is_closed) is True @@ -122,7 +123,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: device = await async_client.zero_trust.devices.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[ZeroTrustDevices], device, path=["response"]) + assert_matches_type(AsyncSinglePage[Device], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +135,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustDevices], device, path=["response"]) + assert_matches_type(AsyncSinglePage[Device], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -146,7 +147,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type(AsyncSinglePage[ZeroTrustDevices], device, path=["response"]) + assert_matches_type(AsyncSinglePage[Device], device, path=["response"]) assert cast(Any, response.is_closed) is True @@ -165,7 +166,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) + assert_matches_type(DeviceGetResponse, device, path=["response"]) @pytest.mark.skip() @parametrize @@ -178,7 +179,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(Optional[DeviceGetResponse], device, path=["response"]) + assert_matches_type(DeviceGetResponse, device, path=["response"]) @pytest.mark.skip() @parametrize @@ -191,7 +192,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(Optional[DeviceGetResponse], device, path=["response"]) + assert_matches_type(DeviceGetResponse, device, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/test_gateway.py b/tests/api_resources/zero_trust/test_gateway.py index 30d75733653..9089bb0f26d 100644 --- a/tests/api_resources/zero_trust/test_gateway.py +++ b/tests/api_resources/zero_trust/test_gateway.py @@ -3,13 +3,14 @@ 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.zero_trust import GatewayListResponse, GatewayCreateResponse +from cloudflare.types.zero_trust.gateway_list_response import GatewayListResponse +from cloudflare.types.zero_trust.gateway_create_response import GatewayCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: gateway = client.zero_trust.gateway.create( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(GatewayCreateResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayCreateResponse], gateway, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,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" gateway = response.parse() - assert_matches_type(GatewayCreateResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayCreateResponse], gateway, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" gateway = response.parse() - assert_matches_type(GatewayCreateResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayCreateResponse], gateway, path=["response"]) assert cast(Any, response.is_closed) is True @@ -65,7 +66,7 @@ def test_method_list(self, client: Cloudflare) -> None: gateway = client.zero_trust.gateway.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(GatewayListResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayListResponse], gateway, path=["response"]) @pytest.mark.skip() @parametrize @@ -77,7 +78,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gateway = response.parse() - assert_matches_type(GatewayListResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayListResponse], gateway, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +90,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" gateway = response.parse() - assert_matches_type(GatewayListResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayListResponse], gateway, path=["response"]) assert cast(Any, response.is_closed) is True @@ -111,7 +112,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: gateway = await async_client.zero_trust.gateway.create( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(GatewayCreateResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayCreateResponse], gateway, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +124,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" gateway = await response.parse() - assert_matches_type(GatewayCreateResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayCreateResponse], gateway, path=["response"]) @pytest.mark.skip() @parametrize @@ -135,7 +136,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" gateway = await response.parse() - assert_matches_type(GatewayCreateResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayCreateResponse], gateway, path=["response"]) assert cast(Any, response.is_closed) is True @@ -153,7 +154,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: gateway = await async_client.zero_trust.gateway.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(GatewayListResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayListResponse], gateway, path=["response"]) @pytest.mark.skip() @parametrize @@ -165,7 +166,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gateway = await response.parse() - assert_matches_type(GatewayListResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayListResponse], gateway, path=["response"]) @pytest.mark.skip() @parametrize @@ -177,7 +178,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" gateway = await response.parse() - assert_matches_type(GatewayListResponse, gateway, path=["response"]) + assert_matches_type(Optional[GatewayListResponse], gateway, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/test_identity_providers.py b/tests/api_resources/zero_trust/test_identity_providers.py index 39ad381c741..82ace384f03 100644 --- a/tests/api_resources/zero_trust/test_identity_providers.py +++ b/tests/api_resources/zero_trust/test_identity_providers.py @@ -3,18 +3,16 @@ 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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust import ( - ZeroTrustIdentityProviders, - IdentityProviderListResponse, - IdentityProviderDeleteResponse, -) +from cloudflare.types.zero_trust.identity_provider import IdentityProvider +from cloudflare.types.zero_trust.identity_provider_list_response import IdentityProviderListResponse +from cloudflare.types.zero_trust.identity_provider_delete_response import IdentityProviderDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -32,7 +30,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +58,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -76,7 +74,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,7 +90,7 @@ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -127,7 +125,7 @@ def test_method_create_overload_2(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -153,7 +151,7 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -169,7 +167,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +183,7 @@ def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -220,7 +218,7 @@ def test_method_create_overload_3(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +240,7 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -258,7 +256,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -274,7 +272,7 @@ def test_streaming_response_create_overload_3(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -309,7 +307,7 @@ def test_method_create_overload_4(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -331,7 +329,7 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -347,7 +345,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -363,7 +361,7 @@ def test_streaming_response_create_overload_4(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -398,7 +396,7 @@ def test_method_create_overload_5(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -422,7 +420,7 @@ def test_method_create_with_all_params_overload_5(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -438,7 +436,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -454,7 +452,7 @@ def test_streaming_response_create_overload_5(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -489,7 +487,7 @@ def test_method_create_overload_6(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -514,7 +512,7 @@ def test_method_create_with_all_params_overload_6(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -530,7 +528,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -546,7 +544,7 @@ def test_streaming_response_create_overload_6(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -581,7 +579,7 @@ def test_method_create_overload_7(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -603,7 +601,7 @@ def test_method_create_with_all_params_overload_7(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -619,7 +617,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -635,7 +633,7 @@ def test_streaming_response_create_overload_7(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -670,7 +668,7 @@ def test_method_create_overload_8(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -698,7 +696,7 @@ def test_method_create_with_all_params_overload_8(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -714,7 +712,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -730,7 +728,7 @@ def test_streaming_response_create_overload_8(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -765,7 +763,7 @@ def test_method_create_overload_9(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -791,7 +789,7 @@ def test_method_create_with_all_params_overload_9(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -807,7 +805,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -823,7 +821,7 @@ def test_streaming_response_create_overload_9(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -858,7 +856,7 @@ def test_method_create_overload_10(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -883,7 +881,7 @@ def test_method_create_with_all_params_overload_10(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -899,7 +897,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -915,7 +913,7 @@ def test_streaming_response_create_overload_10(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -950,7 +948,7 @@ def test_method_create_overload_11(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -975,7 +973,7 @@ def test_method_create_with_all_params_overload_11(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -991,7 +989,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1007,7 +1005,7 @@ def test_streaming_response_create_overload_11(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1042,7 +1040,7 @@ def test_method_create_overload_12(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1082,7 +1080,7 @@ def test_method_create_with_all_params_overload_12(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1098,7 +1096,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1114,7 +1112,7 @@ def test_streaming_response_create_overload_12(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1149,7 +1147,7 @@ def test_method_create_overload_13(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1171,7 +1169,7 @@ def test_method_create_with_all_params_overload_13(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1187,7 +1185,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1203,7 +1201,7 @@ def test_streaming_response_create_overload_13(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1238,7 +1236,7 @@ def test_method_create_overload_14(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1257,7 +1255,7 @@ def test_method_create_with_all_params_overload_14(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1273,7 +1271,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1289,7 +1287,7 @@ def test_streaming_response_create_overload_14(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1325,7 +1323,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1354,7 +1352,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1371,7 +1369,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1388,7 +1386,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1436,7 +1434,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1463,7 +1461,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1480,7 +1478,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1497,7 +1495,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1545,7 +1543,7 @@ def test_method_update_overload_3(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1568,7 +1566,7 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1585,7 +1583,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1602,7 +1600,7 @@ def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1650,7 +1648,7 @@ def test_method_update_overload_4(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1673,7 +1671,7 @@ def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1690,7 +1688,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1707,7 +1705,7 @@ def test_streaming_response_update_overload_4(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1755,7 +1753,7 @@ def test_method_update_overload_5(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1780,7 +1778,7 @@ def test_method_update_with_all_params_overload_5(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1797,7 +1795,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1814,7 +1812,7 @@ def test_streaming_response_update_overload_5(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1862,7 +1860,7 @@ def test_method_update_overload_6(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1888,7 +1886,7 @@ def test_method_update_with_all_params_overload_6(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1905,7 +1903,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1922,7 +1920,7 @@ def test_streaming_response_update_overload_6(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1970,7 +1968,7 @@ def test_method_update_overload_7(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -1993,7 +1991,7 @@ def test_method_update_with_all_params_overload_7(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2010,7 +2008,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2027,7 +2025,7 @@ def test_streaming_response_update_overload_7(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2075,7 +2073,7 @@ def test_method_update_overload_8(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2104,7 +2102,7 @@ def test_method_update_with_all_params_overload_8(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2121,7 +2119,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2138,7 +2136,7 @@ def test_streaming_response_update_overload_8(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2186,7 +2184,7 @@ def test_method_update_overload_9(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2213,7 +2211,7 @@ def test_method_update_with_all_params_overload_9(self, client: Cloudflare) -> N "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2230,7 +2228,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2247,7 +2245,7 @@ def test_streaming_response_update_overload_9(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2295,7 +2293,7 @@ def test_method_update_overload_10(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2321,7 +2319,7 @@ def test_method_update_with_all_params_overload_10(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2338,7 +2336,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2355,7 +2353,7 @@ def test_streaming_response_update_overload_10(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2403,7 +2401,7 @@ def test_method_update_overload_11(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2429,7 +2427,7 @@ def test_method_update_with_all_params_overload_11(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2446,7 +2444,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2463,7 +2461,7 @@ def test_streaming_response_update_overload_11(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2511,7 +2509,7 @@ def test_method_update_overload_12(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2552,7 +2550,7 @@ def test_method_update_with_all_params_overload_12(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2569,7 +2567,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2586,7 +2584,7 @@ def test_streaming_response_update_overload_12(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2634,7 +2632,7 @@ def test_method_update_overload_13(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2657,7 +2655,7 @@ def test_method_update_with_all_params_overload_13(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2674,7 +2672,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2691,7 +2689,7 @@ def test_streaming_response_update_overload_13(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2739,7 +2737,7 @@ def test_method_update_overload_14(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2759,7 +2757,7 @@ def test_method_update_with_all_params_overload_14(self, client: Cloudflare) -> "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2776,7 +2774,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2793,7 +2791,7 @@ def test_streaming_response_update_overload_14(self, client: Cloudflare) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2899,7 +2897,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(IdentityProviderDeleteResponse, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2909,7 +2907,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(IdentityProviderDeleteResponse, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2923,7 +2921,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" identity_provider = response.parse() - assert_matches_type(IdentityProviderDeleteResponse, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2937,7 +2935,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(IdentityProviderDeleteResponse, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2973,7 +2971,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2983,7 +2981,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2997,7 +2995,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" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3011,7 +3009,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3053,7 +3051,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3081,7 +3079,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3097,7 +3095,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3113,7 +3111,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3148,7 +3146,7 @@ async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3174,7 +3172,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3190,7 +3188,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3206,7 +3204,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3241,7 +3239,7 @@ async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3263,7 +3261,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3279,7 +3277,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3295,7 +3293,7 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3330,7 +3328,7 @@ async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3352,7 +3350,7 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3368,7 +3366,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3384,7 +3382,7 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3419,7 +3417,7 @@ async def test_method_create_overload_5(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3443,7 +3441,7 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3459,7 +3457,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3475,7 +3473,7 @@ async def test_streaming_response_create_overload_5(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3510,7 +3508,7 @@ async def test_method_create_overload_6(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3535,7 +3533,7 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3551,7 +3549,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3567,7 +3565,7 @@ async def test_streaming_response_create_overload_6(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3602,7 +3600,7 @@ async def test_method_create_overload_7(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3624,7 +3622,7 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3640,7 +3638,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3656,7 +3654,7 @@ async def test_streaming_response_create_overload_7(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3691,7 +3689,7 @@ async def test_method_create_overload_8(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3719,7 +3717,7 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3735,7 +3733,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3751,7 +3749,7 @@ async def test_streaming_response_create_overload_8(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3786,7 +3784,7 @@ async def test_method_create_overload_9(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3812,7 +3810,7 @@ async def test_method_create_with_all_params_overload_9(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3828,7 +3826,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3844,7 +3842,7 @@ async def test_streaming_response_create_overload_9(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3879,7 +3877,7 @@ async def test_method_create_overload_10(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3904,7 +3902,7 @@ async def test_method_create_with_all_params_overload_10(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3920,7 +3918,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3936,7 +3934,7 @@ async def test_streaming_response_create_overload_10(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3971,7 +3969,7 @@ async def test_method_create_overload_11(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -3996,7 +3994,7 @@ async def test_method_create_with_all_params_overload_11(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4012,7 +4010,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4028,7 +4026,7 @@ async def test_streaming_response_create_overload_11(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4063,7 +4061,7 @@ async def test_method_create_overload_12(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4103,7 +4101,7 @@ async def test_method_create_with_all_params_overload_12(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4119,7 +4117,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4135,7 +4133,7 @@ async def test_streaming_response_create_overload_12(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4170,7 +4168,7 @@ async def test_method_create_overload_13(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4192,7 +4190,7 @@ async def test_method_create_with_all_params_overload_13(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4208,7 +4206,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4224,7 +4222,7 @@ async def test_streaming_response_create_overload_13(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4259,7 +4257,7 @@ async def test_method_create_overload_14(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4278,7 +4276,7 @@ async def test_method_create_with_all_params_overload_14(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4294,7 +4292,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4310,7 +4308,7 @@ async def test_streaming_response_create_overload_14(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4346,7 +4344,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4375,7 +4373,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4392,7 +4390,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4409,7 +4407,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4457,7 +4455,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4484,7 +4482,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4501,7 +4499,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4518,7 +4516,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4566,7 +4564,7 @@ async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4589,7 +4587,7 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4606,7 +4604,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4623,7 +4621,7 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4671,7 +4669,7 @@ async def test_method_update_overload_4(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4694,7 +4692,7 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4711,7 +4709,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4728,7 +4726,7 @@ async def test_streaming_response_update_overload_4(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4776,7 +4774,7 @@ async def test_method_update_overload_5(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4801,7 +4799,7 @@ async def test_method_update_with_all_params_overload_5(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4818,7 +4816,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4835,7 +4833,7 @@ async def test_streaming_response_update_overload_5(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4883,7 +4881,7 @@ async def test_method_update_overload_6(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4909,7 +4907,7 @@ async def test_method_update_with_all_params_overload_6(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4926,7 +4924,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -4943,7 +4941,7 @@ async def test_streaming_response_update_overload_6(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -4991,7 +4989,7 @@ async def test_method_update_overload_7(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5014,7 +5012,7 @@ async def test_method_update_with_all_params_overload_7(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5031,7 +5029,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5048,7 +5046,7 @@ async def test_streaming_response_update_overload_7(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5096,7 +5094,7 @@ async def test_method_update_overload_8(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5125,7 +5123,7 @@ async def test_method_update_with_all_params_overload_8(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5142,7 +5140,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5159,7 +5157,7 @@ async def test_streaming_response_update_overload_8(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5207,7 +5205,7 @@ async def test_method_update_overload_9(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5234,7 +5232,7 @@ async def test_method_update_with_all_params_overload_9(self, async_client: Asyn "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5251,7 +5249,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5268,7 +5266,7 @@ async def test_streaming_response_update_overload_9(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5316,7 +5314,7 @@ async def test_method_update_overload_10(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5342,7 +5340,7 @@ async def test_method_update_with_all_params_overload_10(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5359,7 +5357,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5376,7 +5374,7 @@ async def test_streaming_response_update_overload_10(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5424,7 +5422,7 @@ async def test_method_update_overload_11(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5450,7 +5448,7 @@ async def test_method_update_with_all_params_overload_11(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5467,7 +5465,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5484,7 +5482,7 @@ async def test_streaming_response_update_overload_11(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5532,7 +5530,7 @@ async def test_method_update_overload_12(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5573,7 +5571,7 @@ async def test_method_update_with_all_params_overload_12(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5590,7 +5588,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5607,7 +5605,7 @@ async def test_streaming_response_update_overload_12(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5655,7 +5653,7 @@ async def test_method_update_overload_13(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5678,7 +5676,7 @@ async def test_method_update_with_all_params_overload_13(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5695,7 +5693,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5712,7 +5710,7 @@ async def test_streaming_response_update_overload_13(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5760,7 +5758,7 @@ async def test_method_update_overload_14(self, async_client: AsyncCloudflare) -> account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5780,7 +5778,7 @@ async def test_method_update_with_all_params_overload_14(self, async_client: Asy "user_deprovision": True, }, ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5797,7 +5795,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5814,7 +5812,7 @@ async def test_streaming_response_update_overload_14(self, async_client: AsyncCl assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5920,7 +5918,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(IdentityProviderDeleteResponse, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5930,7 +5928,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(IdentityProviderDeleteResponse, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5944,7 +5942,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" identity_provider = await response.parse() - assert_matches_type(IdentityProviderDeleteResponse, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5958,7 +5956,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(IdentityProviderDeleteResponse, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProviderDeleteResponse], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5994,7 +5992,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -6004,7 +6002,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -6018,7 +6016,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" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -6032,7 +6030,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(ZeroTrustIdentityProviders, identity_provider, path=["response"]) + assert_matches_type(Optional[IdentityProvider], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/test_organizations.py b/tests/api_resources/zero_trust/test_organizations.py index e0fee873f5f..8610b2484c8 100644 --- a/tests/api_resources/zero_trust/test_organizations.py +++ b/tests/api_resources/zero_trust/test_organizations.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust import ( - ZeroTrustOrganizations, - OrganizationRevokeUsersResponse, -) +from cloudflare.types.zero_trust.organization import Organization +from cloudflare.types.zero_trust.organization_revoke_users_response import OrganizationRevokeUsersResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +52,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: user_seat_expiration_inactive_time="720h", warp_auth_session_duration="24h", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +67,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" organization = response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -84,7 +82,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -114,7 +112,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +141,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: user_seat_expiration_inactive_time="720h", warp_auth_session_duration="24h", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +154,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -169,7 +167,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -195,7 +193,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -204,7 +202,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +215,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -230,7 +228,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -329,7 +327,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -354,7 +352,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare user_seat_expiration_inactive_time="720h", warp_auth_session_duration="24h", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -369,7 +367,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" organization = await response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -384,7 +382,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -414,7 +412,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -443,7 +441,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare user_seat_expiration_inactive_time="720h", warp_auth_session_duration="24h", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -456,7 +454,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -469,7 +467,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -495,7 +493,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -504,7 +502,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -517,7 +515,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -530,7 +528,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(ZeroTrustOrganizations, organization, path=["response"]) + assert_matches_type(Optional[Organization], organization, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/test_risk_scoring.py b/tests/api_resources/zero_trust/test_risk_scoring.py new file mode 100644 index 00000000000..9211f77cafd --- /dev/null +++ b/tests/api_resources/zero_trust/test_risk_scoring.py @@ -0,0 +1,257 @@ +# 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.zero_trust.risk_scoring_get_response import RiskScoringGetResponse +from cloudflare.types.zero_trust.risk_scoring_reset_response import RiskScoringResetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRiskScoring: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + risk_scoring = client.zero_trust.risk_scoring.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RiskScoringGetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + risk_scoring = client.zero_trust.risk_scoring.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + order_by="timestamp", + page=0, + per_page=0, + ) + assert_matches_type(RiskScoringGetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.with_raw_response.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + risk_scoring = response.parse() + assert_matches_type(RiskScoringGetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.with_streaming_response.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + risk_scoring = response.parse() + assert_matches_type(RiskScoringGetResponse, risk_scoring, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + client.zero_trust.risk_scoring.with_raw_response.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + client.zero_trust.risk_scoring.with_raw_response.get( + "", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + def test_method_reset(self, client: Cloudflare) -> None: + risk_scoring = client.zero_trust.risk_scoring.reset( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RiskScoringResetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_reset(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.with_raw_response.reset( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + risk_scoring = response.parse() + assert_matches_type(RiskScoringResetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_reset(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.with_streaming_response.reset( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + risk_scoring = response.parse() + assert_matches_type(RiskScoringResetResponse, risk_scoring, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_path_params_reset(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + client.zero_trust.risk_scoring.with_raw_response.reset( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + client.zero_trust.risk_scoring.with_raw_response.reset( + "", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncRiskScoring: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + risk_scoring = await async_client.zero_trust.risk_scoring.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RiskScoringGetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + risk_scoring = await async_client.zero_trust.risk_scoring.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + order_by="timestamp", + page=0, + per_page=0, + ) + assert_matches_type(RiskScoringGetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.with_raw_response.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + risk_scoring = await response.parse() + assert_matches_type(RiskScoringGetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.with_streaming_response.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + risk_scoring = await response.parse() + assert_matches_type(RiskScoringGetResponse, risk_scoring, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + await async_client.zero_trust.risk_scoring.with_raw_response.get( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + await async_client.zero_trust.risk_scoring.with_raw_response.get( + "", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_reset(self, async_client: AsyncCloudflare) -> None: + risk_scoring = await async_client.zero_trust.risk_scoring.reset( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RiskScoringResetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_reset(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.with_raw_response.reset( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + risk_scoring = await response.parse() + assert_matches_type(RiskScoringResetResponse, risk_scoring, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_reset(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.with_streaming_response.reset( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + risk_scoring = await response.parse() + assert_matches_type(RiskScoringResetResponse, risk_scoring, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_path_params_reset(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + await async_client.zero_trust.risk_scoring.with_raw_response.reset( + "f2108713-1206-4e84-8b80-0e71a6a1c67b", + account_identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + await async_client.zero_trust.risk_scoring.with_raw_response.reset( + "", + account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/zero_trust/test_seats.py b/tests/api_resources/zero_trust/test_seats.py index f1b797fd45a..224caa6609e 100644 --- a/tests/api_resources/zero_trust/test_seats.py +++ b/tests/api_resources/zero_trust/test_seats.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust import SeatEditResponse +from cloudflare.types.zero_trust.seat_edit_response import SeatEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/test_tunnels.py b/tests/api_resources/zero_trust/test_tunnels.py index c9419f09206..4a10e8cb8e1 100644 --- a/tests/api_resources/zero_trust/test_tunnels.py +++ b/tests/api_resources/zero_trust/test_tunnels.py @@ -11,11 +11,11 @@ from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.zero_trust import ( - TunnelArgoTunnel, - TunnelEditResponse, - TunnelListResponse, -) +from cloudflare.types.zero_trust.tunnel_get_response import TunnelGetResponse +from cloudflare.types.zero_trust.tunnel_edit_response import TunnelEditResponse +from cloudflare.types.zero_trust.tunnel_list_response import TunnelListResponse +from cloudflare.types.zero_trust.tunnel_create_response import TunnelCreateResponse +from cloudflare.types.zero_trust.tunnel_delete_response import TunnelDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,9 +29,9 @@ def test_method_create(self, client: Cloudflare) -> None: tunnel = client.zero_trust.tunnels.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,13 +39,13 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.tunnels.with_raw_response.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,13 +53,13 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.tunnels.with_streaming_response.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.zero_trust.tunnels.with_raw_response.create( account_id="", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) @pytest.mark.skip() @@ -94,6 +94,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=1, tun_types="cfd_tunnel,warp_connector", + uuid="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", was_active_at=parse_datetime("2009-11-10T23:00:00Z"), was_inactive_at=parse_datetime("2009-11-10T23:00:00Z"), ) @@ -141,7 +142,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body={}, ) - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +156,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" tunnel = response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -169,7 +170,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -260,7 +261,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +274,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" tunnel = response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -286,7 +287,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -315,9 +316,9 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: tunnel = await async_client.zero_trust.tunnels.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -325,13 +326,13 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.tunnels.with_raw_response.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -339,13 +340,13 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.tunnels.with_streaming_response.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -356,7 +357,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.tunnels.with_raw_response.create( account_id="", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) @pytest.mark.skip() @@ -380,6 +381,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=1, tun_types="cfd_tunnel,warp_connector", + uuid="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", was_active_at=parse_datetime("2009-11-10T23:00:00Z"), was_inactive_at=parse_datetime("2009-11-10T23:00:00Z"), ) @@ -427,7 +429,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body={}, ) - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -441,7 +443,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" tunnel = await response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -455,7 +457,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -546,7 +548,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -559,7 +561,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" tunnel = await response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -572,7 +574,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(TunnelArgoTunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/tunnels/test_configurations.py b/tests/api_resources/zero_trust/tunnels/test_configurations.py index 3b66ce60c1d..b79fa1154ca 100644 --- a/tests/api_resources/zero_trust/tunnels/test_configurations.py +++ b/tests/api_resources/zero_trust/tunnels/test_configurations.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.tunnels import ( - ConfigurationGetResponse, - ConfigurationUpdateResponse, -) +from cloudflare.types.zero_trust.tunnels.configuration_get_response import ConfigurationGetResponse +from cloudflare.types.zero_trust.tunnels.configuration_update_response import ConfigurationUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +23,7 @@ class TestConfigurations: def test_method_update(self, client: Cloudflare) -> None: configuration = client.zero_trust.tunnels.configurations.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) @@ -34,7 +32,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_method_update_with_all_params(self, client: Cloudflare) -> None: configuration = client.zero_trust.tunnels.configurations.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", config={ "ingress": [ { @@ -143,7 +141,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.zero_trust.tunnels.configurations.with_raw_response.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -156,7 +154,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.zero_trust.tunnels.configurations.with_streaming_response.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -178,7 +176,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): client.zero_trust.tunnels.configurations.with_raw_response.update( "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) @pytest.mark.skip() @@ -186,7 +184,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_get(self, client: Cloudflare) -> None: configuration = client.zero_trust.tunnels.configurations.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) @@ -195,7 +193,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.tunnels.configurations.with_raw_response.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -208,7 +206,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.tunnels.configurations.with_streaming_response.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -230,7 +228,7 @@ def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): client.zero_trust.tunnels.configurations.with_raw_response.get( "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) @@ -242,7 +240,7 @@ class TestAsyncConfigurations: async def test_method_update(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.tunnels.configurations.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) @@ -251,7 +249,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.tunnels.configurations.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", config={ "ingress": [ { @@ -360,7 +358,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.tunnels.configurations.with_raw_response.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -373,7 +371,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.zero_trust.tunnels.configurations.with_streaming_response.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -395,7 +393,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): await async_client.zero_trust.tunnels.configurations.with_raw_response.update( "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) @pytest.mark.skip() @@ -403,7 +401,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_get(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.tunnels.configurations.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) @@ -412,7 +410,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.tunnels.configurations.with_raw_response.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -425,7 +423,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.tunnels.configurations.with_streaming_response.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -447,5 +445,5 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): await async_client.zero_trust.tunnels.configurations.with_raw_response.get( "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) diff --git a/tests/api_resources/zero_trust/tunnels/test_connections.py b/tests/api_resources/zero_trust/tunnels/test_connections.py index d7d2ec576f3..26310f54f50 100644 --- a/tests/api_resources/zero_trust/tunnels/test_connections.py +++ b/tests/api_resources/zero_trust/tunnels/test_connections.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.tunnels import ( - ConnectionGetResponse, - ConnectionDeleteResponse, -) +from cloudflare.types.zero_trust.tunnels.connection_get_response import ConnectionGetResponse +from cloudflare.types.zero_trust.tunnels.connection_delete_response import ConnectionDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/tunnels/test_connectors.py b/tests/api_resources/zero_trust/tunnels/test_connectors.py index fda4d0fd22a..d7932897680 100644 --- a/tests/api_resources/zero_trust/tunnels/test_connectors.py +++ b/tests/api_resources/zero_trust/tunnels/test_connectors.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.tunnels import TunnelTunnelClient +from cloudflare.types.zero_trust.tunnels.client import Client base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelTunnelClient, connector, path=["response"]) + assert_matches_type(Client, connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,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" connector = response.parse() - assert_matches_type(TunnelTunnelClient, connector, path=["response"]) + assert_matches_type(Client, connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +53,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connector = response.parse() - assert_matches_type(TunnelTunnelClient, connector, path=["response"]) + assert_matches_type(Client, connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +93,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(TunnelTunnelClient, connector, path=["response"]) + assert_matches_type(Client, connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,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" connector = await response.parse() - assert_matches_type(TunnelTunnelClient, connector, path=["response"]) + assert_matches_type(Client, connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +121,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" connector = await response.parse() - assert_matches_type(TunnelTunnelClient, connector, path=["response"]) + assert_matches_type(Client, connector, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/tunnels/test_management.py b/tests/api_resources/zero_trust/tunnels/test_management.py index 4fe9fafa2bf..7649ed32b24 100644 --- a/tests/api_resources/zero_trust/tunnels/test_management.py +++ b/tests/api_resources/zero_trust/tunnels/test_management.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.tunnels import ManagementCreateResponse +from cloudflare.types.zero_trust.tunnels.management_create_response import ManagementCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zero_trust/tunnels/test_token.py b/tests/api_resources/zero_trust/tunnels/test_token.py index c4535952c3f..e9706ef7ec1 100644 --- a/tests/api_resources/zero_trust/tunnels/test_token.py +++ b/tests/api_resources/zero_trust/tunnels/test_token.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.tunnels import TokenGetResponse +from cloudflare.types.zero_trust.tunnels.token_get_response import TokenGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zones/settings/test_advanced_ddos.py b/tests/api_resources/zones/settings/test_advanced_ddos.py index 891653faed3..fc550681946 100644 --- a/tests/api_resources/zones/settings/test_advanced_ddos.py +++ b/tests/api_resources/zones/settings/test_advanced_ddos.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingAdvancedDDoS +from cloudflare.types.zones.settings.advanced_ddos import AdvancedDDoS base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_get(self, client: Cloudflare) -> None: advanced_ddos = client.zones.settings.advanced_ddos.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingAdvancedDDoS], advanced_ddos, path=["response"]) + assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,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" advanced_ddos = response.parse() - assert_matches_type(Optional[ZoneSettingAdvancedDDoS], advanced_ddos, path=["response"]) + assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_ddos = response.parse() - assert_matches_type(Optional[ZoneSettingAdvancedDDoS], advanced_ddos, path=["response"]) + assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: advanced_ddos = await async_client.zones.settings.advanced_ddos.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingAdvancedDDoS], advanced_ddos, path=["response"]) + assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" advanced_ddos = await response.parse() - assert_matches_type(Optional[ZoneSettingAdvancedDDoS], advanced_ddos, path=["response"]) + assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_ddos = await response.parse() - assert_matches_type(Optional[ZoneSettingAdvancedDDoS], advanced_ddos, path=["response"]) + assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_always_online.py b/tests/api_resources/zones/settings/test_always_online.py index a9bf66a4608..34d3444f3ca 100644 --- a/tests/api_resources/zones/settings/test_always_online.py +++ b/tests/api_resources/zones/settings/test_always_online.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingAlwaysOnline +from cloudflare.types.zones.settings.always_online import AlwaysOnline base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" always_online = response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" always_online = response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: always_online = client.zones.settings.always_online.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" always_online = response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" always_online = response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" always_online = await response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" always_online = await response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: always_online = await async_client.zones.settings.always_online.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" always_online = await response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" always_online = await response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysOnline], always_online, path=["response"]) + assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_always_use_https.py b/tests/api_resources/zones/settings/test_always_use_https.py index 6353ba32c8c..b62a3d41140 100644 --- a/tests/api_resources/zones/settings/test_always_use_https.py +++ b/tests/api_resources/zones/settings/test_always_use_https.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingAlwaysUseHTTPS +from cloudflare.types.zones.settings.always_use_https import AlwaysUseHTTPS base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" always_use_https = response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" always_use_https = response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: always_use_https = client.zones.settings.always_use_https.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" always_use_https = response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" always_use_https = response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" always_use_https = await response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" always_use_https = await response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: always_use_https = await async_client.zones.settings.always_use_https.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" always_use_https = await response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" always_use_https = await response.parse() - assert_matches_type(Optional[ZoneSettingAlwaysUseHTTPS], always_use_https, path=["response"]) + assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_automatic_https_rewrites.py b/tests/api_resources/zones/settings/test_automatic_https_rewrites.py index 4e952b6088d..7eb774fb8d6 100644 --- a/tests/api_resources/zones/settings/test_automatic_https_rewrites.py +++ b/tests/api_resources/zones/settings/test_automatic_https_rewrites.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingAutomaticHTTPSRewrites +from cloudflare.types.zones.settings.automatic_https_rewrites import AutomaticHTTPSRewrites base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" automatic_https_rewrite = response.parse() - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" automatic_https_rewrite = response.parse() - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: automatic_https_rewrite = client.zones.settings.automatic_https_rewrites.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" automatic_https_rewrite = response.parse() - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" automatic_https_rewrite = response.parse() - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" automatic_https_rewrite = await response.parse() - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" automatic_https_rewrite = await response.parse() - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: automatic_https_rewrite = await async_client.zones.settings.automatic_https_rewrites.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" automatic_https_rewrite = await response.parse() - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" automatic_https_rewrite = await response.parse() - assert_matches_type(Optional[ZoneSettingAutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) + assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_automatic_platform_optimization.py b/tests/api_resources/zones/settings/test_automatic_platform_optimization.py index 70d171a60df..7249757a4c3 100644 --- a/tests/api_resources/zones/settings/test_automatic_platform_optimization.py +++ b/tests/api_resources/zones/settings/test_automatic_platform_optimization.py @@ -9,9 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ( - ZoneSettingAutomaticPlatformOptimization, -) +from cloudflare.types.zones.settings import AutomaticPlatformOptimization +from cloudflare.types.zones.settings.automatic_platform_optimization import AutomaticPlatformOptimization base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -33,9 +32,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "wp_plugin": True, }, ) - assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) + assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,9 +52,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" automatic_platform_optimization = response.parse() - assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) + assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) @pytest.mark.skip() @parametrize @@ -78,7 +73,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: automatic_platform_optimization = response.parse() assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] + Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] ) assert cast(Any, response.is_closed) is True @@ -105,9 +100,7 @@ def test_method_get(self, client: Cloudflare) -> None: automatic_platform_optimization = client.zones.settings.automatic_platform_optimization.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) + assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,9 +112,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" automatic_platform_optimization = response.parse() - assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) + assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +125,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: automatic_platform_optimization = response.parse() assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] + Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] ) assert cast(Any, response.is_closed) is True @@ -165,9 +156,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "wp_plugin": True, }, ) - assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) + assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,9 +176,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" automatic_platform_optimization = await response.parse() - assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) + assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +197,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N automatic_platform_optimization = await response.parse() assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] + Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] ) assert cast(Any, response.is_closed) is True @@ -237,9 +224,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: automatic_platform_optimization = await async_client.zones.settings.automatic_platform_optimization.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) + assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) @pytest.mark.skip() @parametrize @@ -251,9 +236,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" automatic_platform_optimization = await response.parse() - assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) + assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) @pytest.mark.skip() @parametrize @@ -266,7 +249,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No automatic_platform_optimization = await response.parse() assert_matches_type( - Optional[ZoneSettingAutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] + Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] ) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_brotli.py b/tests/api_resources/zones/settings/test_brotli.py index 73766d4c64a..38e2dec2bd5 100644 --- a/tests/api_resources/zones/settings/test_brotli.py +++ b/tests/api_resources/zones/settings/test_brotli.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingBrotli +from cloudflare.types.zones.settings.brotli import Brotli base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" brotli = response.parse() - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" brotli = response.parse() - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: brotli = client.zones.settings.brotli.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" brotli = response.parse() - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" brotli = response.parse() - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" brotli = await response.parse() - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" brotli = await response.parse() - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: brotli = await async_client.zones.settings.brotli.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" brotli = await response.parse() - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" brotli = await response.parse() - assert_matches_type(Optional[ZoneSettingBrotli], brotli, path=["response"]) + assert_matches_type(Optional[Brotli], brotli, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_browser_cache_ttl.py b/tests/api_resources/zones/settings/test_browser_cache_ttl.py index 8d268c3ef36..b3cba09de3a 100644 --- a/tests/api_resources/zones/settings/test_browser_cache_ttl.py +++ b/tests/api_resources/zones/settings/test_browser_cache_ttl.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingBrowserCacheTTL +from cloudflare.types.zones.settings.browser_cache_ttl import BrowserCacheTTL base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value=0, ) - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" browser_cache_ttl = response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" browser_cache_ttl = response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: browser_cache_ttl = client.zones.settings.browser_cache_ttl.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" browser_cache_ttl = response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" browser_cache_ttl = response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value=0, ) - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" browser_cache_ttl = await response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" browser_cache_ttl = await response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: browser_cache_ttl = await async_client.zones.settings.browser_cache_ttl.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" browser_cache_ttl = await response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" browser_cache_ttl = await response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCacheTTL], browser_cache_ttl, path=["response"]) + assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_browser_check.py b/tests/api_resources/zones/settings/test_browser_check.py index 61272e97eea..d15b4289cc0 100644 --- a/tests/api_resources/zones/settings/test_browser_check.py +++ b/tests/api_resources/zones/settings/test_browser_check.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingBrowserCheck +from cloudflare.types.zones.settings.browser_check import BrowserCheck base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" browser_check = response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" browser_check = response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: browser_check = client.zones.settings.browser_check.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" browser_check = response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" browser_check = response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" browser_check = await response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" browser_check = await response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: browser_check = await async_client.zones.settings.browser_check.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" browser_check = await response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" browser_check = await response.parse() - assert_matches_type(Optional[ZoneSettingBrowserCheck], browser_check, path=["response"]) + assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_cache_level.py b/tests/api_resources/zones/settings/test_cache_level.py index a0a28636295..e5d8076c2f7 100644 --- a/tests/api_resources/zones/settings/test_cache_level.py +++ b/tests/api_resources/zones/settings/test_cache_level.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingCacheLevel +from cloudflare.types.zones.settings.cache_level import CacheLevel base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="aggressive", ) - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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_level = response.parse() - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_level = response.parse() - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: cache_level = client.zones.settings.cache_level.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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_level = response.parse() - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_level = response.parse() - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="aggressive", ) - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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_level = await response.parse() - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_level = await response.parse() - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: cache_level = await async_client.zones.settings.cache_level.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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_level = await response.parse() - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_level = await response.parse() - assert_matches_type(Optional[ZoneSettingCacheLevel], cache_level, path=["response"]) + assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_challenge_ttl.py b/tests/api_resources/zones/settings/test_challenge_ttl.py index a65a5f5acc5..0ce0ad8750f 100644 --- a/tests/api_resources/zones/settings/test_challenge_ttl.py +++ b/tests/api_resources/zones/settings/test_challenge_ttl.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingChallengeTTL +from cloudflare.types.zones.settings.challenge_ttl import ChallengeTTL base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value=300, ) - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" challenge_ttl = response.parse() - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" challenge_ttl = response.parse() - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: challenge_ttl = client.zones.settings.challenge_ttl.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" challenge_ttl = response.parse() - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" challenge_ttl = response.parse() - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value=300, ) - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" challenge_ttl = await response.parse() - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" challenge_ttl = await response.parse() - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: challenge_ttl = await async_client.zones.settings.challenge_ttl.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" challenge_ttl = await response.parse() - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" challenge_ttl = await response.parse() - assert_matches_type(Optional[ZoneSettingChallengeTTL], challenge_ttl, path=["response"]) + assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_ciphers.py b/tests/api_resources/zones/settings/test_ciphers.py index db8234f0cb0..7e309733907 100644 --- a/tests/api_resources/zones/settings/test_ciphers.py +++ b/tests/api_resources/zones/settings/test_ciphers.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingCiphers +from cloudflare.types.zones.settings.ciphers import Ciphers base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], ) - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" cipher = response.parse() - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cipher = response.parse() - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: cipher = client.zones.settings.ciphers.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" cipher = response.parse() - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cipher = response.parse() - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], ) - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" cipher = await response.parse() - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" cipher = await response.parse() - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: cipher = await async_client.zones.settings.ciphers.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" cipher = await response.parse() - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" cipher = await response.parse() - assert_matches_type(Optional[ZoneSettingCiphers], cipher, path=["response"]) + assert_matches_type(Optional[Ciphers], cipher, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_development_mode.py b/tests/api_resources/zones/settings/test_development_mode.py index da544ae4902..dbac3f8bf9b 100644 --- a/tests/api_resources/zones/settings/test_development_mode.py +++ b/tests/api_resources/zones/settings/test_development_mode.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingDevelopmentMode +from cloudflare.types.zones.settings.development_mode import DevelopmentMode base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" development_mode = response.parse() - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" development_mode = response.parse() - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: development_mode = client.zones.settings.development_mode.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" development_mode = response.parse() - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" development_mode = response.parse() - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" development_mode = await response.parse() - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" development_mode = await response.parse() - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: development_mode = await async_client.zones.settings.development_mode.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" development_mode = await response.parse() - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" development_mode = await response.parse() - assert_matches_type(Optional[ZoneSettingDevelopmentMode], development_mode, path=["response"]) + assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_early_hints.py b/tests/api_resources/zones/settings/test_early_hints.py index 22f8fc291c6..7991d96c9c8 100644 --- a/tests/api_resources/zones/settings/test_early_hints.py +++ b/tests/api_resources/zones/settings/test_early_hints.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingEarlyHints +from cloudflare.types.zones.settings.early_hints import EarlyHints base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" early_hint = response.parse() - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" early_hint = response.parse() - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: early_hint = client.zones.settings.early_hints.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" early_hint = response.parse() - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" early_hint = response.parse() - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" early_hint = await response.parse() - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" early_hint = await response.parse() - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: early_hint = await async_client.zones.settings.early_hints.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" early_hint = await response.parse() - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" early_hint = await response.parse() - assert_matches_type(Optional[ZoneSettingEarlyHints], early_hint, path=["response"]) + assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_email_obfuscation.py b/tests/api_resources/zones/settings/test_email_obfuscation.py index 21e99a91238..386dd32f76d 100644 --- a/tests/api_resources/zones/settings/test_email_obfuscation.py +++ b/tests/api_resources/zones/settings/test_email_obfuscation.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingEmailObfuscation +from cloudflare.types.zones.settings.email_obfuscation import EmailObfuscation base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" email_obfuscation = response.parse() - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_obfuscation = response.parse() - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: email_obfuscation = client.zones.settings.email_obfuscation.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" email_obfuscation = response.parse() - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_obfuscation = response.parse() - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" email_obfuscation = await response.parse() - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_obfuscation = await response.parse() - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: email_obfuscation = await async_client.zones.settings.email_obfuscation.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" email_obfuscation = await response.parse() - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_obfuscation = await response.parse() - assert_matches_type(Optional[ZoneSettingEmailObfuscation], email_obfuscation, path=["response"]) + assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_font_settings.py b/tests/api_resources/zones/settings/test_font_settings.py index a67a18b8281..4e4a033836a 100644 --- a/tests/api_resources/zones/settings/test_font_settings.py +++ b/tests/api_resources/zones/settings/test_font_settings.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingFonts +from cloudflare.types.zones.settings.font_settings import FontSettings base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" font_setting = response.parse() - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" font_setting = response.parse() - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: font_setting = client.zones.settings.font_settings.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" font_setting = response.parse() - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" font_setting = response.parse() - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" font_setting = await response.parse() - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" font_setting = await response.parse() - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: font_setting = await async_client.zones.settings.font_settings.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" font_setting = await response.parse() - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" font_setting = await response.parse() - assert_matches_type(Optional[ZoneSettingFonts], font_setting, path=["response"]) + assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_h2_prioritization.py b/tests/api_resources/zones/settings/test_h2_prioritization.py index b6d774deea1..cbd4afc631b 100644 --- a/tests/api_resources/zones/settings/test_h2_prioritization.py +++ b/tests/api_resources/zones/settings/test_h2_prioritization.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingH2Prioritization +from cloudflare.types.zones.settings import H2Prioritization +from cloudflare.types.zones.settings.h2_prioritization import H2Prioritization base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +28,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +56,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" h2_prioritization = response.parse() - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +72,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" h2_prioritization = response.parse() - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +94,7 @@ def test_method_get(self, client: Cloudflare) -> None: h2_prioritization = client.zones.settings.h2_prioritization.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,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" h2_prioritization = response.parse() - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" h2_prioritization = response.parse() - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +144,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +156,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +172,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" h2_prioritization = await response.parse() - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" h2_prioritization = await response.parse() - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +210,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: h2_prioritization = await async_client.zones.settings.h2_prioritization.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,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" h2_prioritization = await response.parse() - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" h2_prioritization = await response.parse() - assert_matches_type(Optional[ZoneSettingH2Prioritization], h2_prioritization, path=["response"]) + assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_hotlink_protection.py b/tests/api_resources/zones/settings/test_hotlink_protection.py index 8373f4e3e14..369e33ef10a 100644 --- a/tests/api_resources/zones/settings/test_hotlink_protection.py +++ b/tests/api_resources/zones/settings/test_hotlink_protection.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingHotlinkProtection +from cloudflare.types.zones.settings.hotlink_protection import HotlinkProtection base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" hotlink_protection = response.parse() - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hotlink_protection = response.parse() - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: hotlink_protection = client.zones.settings.hotlink_protection.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" hotlink_protection = response.parse() - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hotlink_protection = response.parse() - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" hotlink_protection = await response.parse() - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" hotlink_protection = await response.parse() - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: hotlink_protection = await async_client.zones.settings.hotlink_protection.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" hotlink_protection = await response.parse() - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" hotlink_protection = await response.parse() - assert_matches_type(Optional[ZoneSettingHotlinkProtection], hotlink_protection, path=["response"]) + assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_http2.py b/tests/api_resources/zones/settings/test_http2.py index d4158ff76db..fad9257b0bd 100644 --- a/tests/api_resources/zones/settings/test_http2.py +++ b/tests/api_resources/zones/settings/test_http2.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingHTTP2 +from cloudflare.types.zones.settings.http2 import HTTP2 base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" http2 = response.parse() - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" http2 = response.parse() - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: http2 = client.zones.settings.http2.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" http2 = response.parse() - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" http2 = response.parse() - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" http2 = await response.parse() - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" http2 = await response.parse() - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: http2 = await async_client.zones.settings.http2.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" http2 = await response.parse() - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" http2 = await response.parse() - assert_matches_type(Optional[ZoneSettingHTTP2], http2, path=["response"]) + assert_matches_type(Optional[HTTP2], http2, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_http3.py b/tests/api_resources/zones/settings/test_http3.py index 9bf0e153a66..639bb0bbc20 100644 --- a/tests/api_resources/zones/settings/test_http3.py +++ b/tests/api_resources/zones/settings/test_http3.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingHTTP3 +from cloudflare.types.zones.settings.http3 import HTTP3 base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" http3 = response.parse() - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" http3 = response.parse() - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: http3 = client.zones.settings.http3.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" http3 = response.parse() - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" http3 = response.parse() - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" http3 = await response.parse() - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" http3 = await response.parse() - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: http3 = await async_client.zones.settings.http3.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" http3 = await response.parse() - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" http3 = await response.parse() - assert_matches_type(Optional[ZoneSettingHTTP3], http3, path=["response"]) + assert_matches_type(Optional[HTTP3], http3, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_image_resizing.py b/tests/api_resources/zones/settings/test_image_resizing.py index 14e1f4bdedb..ff978b988a8 100644 --- a/tests/api_resources/zones/settings/test_image_resizing.py +++ b/tests/api_resources/zones/settings/test_image_resizing.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingImageResizing +from cloudflare.types.zones.settings import ImageResizing +from cloudflare.types.zones.settings.image_resizing import ImageResizing base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +28,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +56,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" image_resizing = response.parse() - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +72,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image_resizing = response.parse() - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +94,7 @@ def test_method_get(self, client: Cloudflare) -> None: image_resizing = client.zones.settings.image_resizing.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,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" image_resizing = response.parse() - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image_resizing = response.parse() - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +144,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +156,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +172,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" image_resizing = await response.parse() - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" image_resizing = await response.parse() - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +210,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: image_resizing = await async_client.zones.settings.image_resizing.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,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" image_resizing = await response.parse() - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" image_resizing = await response.parse() - assert_matches_type(Optional[ZoneSettingImageResizing], image_resizing, path=["response"]) + assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_ip_geolocation.py b/tests/api_resources/zones/settings/test_ip_geolocation.py index 3bd9a3caadf..ecd99d6945b 100644 --- a/tests/api_resources/zones/settings/test_ip_geolocation.py +++ b/tests/api_resources/zones/settings/test_ip_geolocation.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingIPGeolocation +from cloudflare.types.zones.settings.ip_geolocation import IPGeolocation base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" ip_geolocation = response.parse() - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_geolocation = response.parse() - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: ip_geolocation = client.zones.settings.ip_geolocation.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" ip_geolocation = response.parse() - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_geolocation = response.parse() - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" ip_geolocation = await response.parse() - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_geolocation = await response.parse() - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: ip_geolocation = await async_client.zones.settings.ip_geolocation.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" ip_geolocation = await response.parse() - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_geolocation = await response.parse() - assert_matches_type(Optional[ZoneSettingIPGeolocation], ip_geolocation, path=["response"]) + assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_ipv6.py b/tests/api_resources/zones/settings/test_ipv6.py index 7022d02d058..21f94f4fad4 100644 --- a/tests/api_resources/zones/settings/test_ipv6.py +++ b/tests/api_resources/zones/settings/test_ipv6.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingIPV6 +from cloudflare.types.zones.settings.ipv6 import IPV6 base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" ipv6 = response.parse() - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ipv6 = response.parse() - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: ipv6 = client.zones.settings.ipv6.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" ipv6 = response.parse() - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ipv6 = response.parse() - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" ipv6 = await response.parse() - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ipv6 = await response.parse() - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: ipv6 = await async_client.zones.settings.ipv6.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" ipv6 = await response.parse() - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" ipv6 = await response.parse() - assert_matches_type(Optional[ZoneSettingIPV6], ipv6, path=["response"]) + assert_matches_type(Optional[IPV6], ipv6, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_min_tls_version.py b/tests/api_resources/zones/settings/test_min_tls_version.py index 77dcffe9737..ba6a0078318 100644 --- a/tests/api_resources/zones/settings/test_min_tls_version.py +++ b/tests/api_resources/zones/settings/test_min_tls_version.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingMinTLSVersion +from cloudflare.types.zones.settings.min_tls_version import MinTLSVersion base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="1.0", ) - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" min_tls_version = response.parse() - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" min_tls_version = response.parse() - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: min_tls_version = client.zones.settings.min_tls_version.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" min_tls_version = response.parse() - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" min_tls_version = response.parse() - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="1.0", ) - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" min_tls_version = await response.parse() - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" min_tls_version = await response.parse() - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: min_tls_version = await async_client.zones.settings.min_tls_version.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" min_tls_version = await response.parse() - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" min_tls_version = await response.parse() - assert_matches_type(Optional[ZoneSettingMinTLSVersion], min_tls_version, path=["response"]) + assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_minify.py b/tests/api_resources/zones/settings/test_minify.py index ccd289fcaeb..e32be9f8a1d 100644 --- a/tests/api_resources/zones/settings/test_minify.py +++ b/tests/api_resources/zones/settings/test_minify.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingMinify +from cloudflare.types.zones.settings.minify import Minify base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "js": "on", }, ) - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,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" minify = response.parse() - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" minify = response.parse() - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,7 +82,7 @@ def test_method_get(self, client: Cloudflare) -> None: minify = client.zones.settings.minify.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,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" minify = response.parse() - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" minify = response.parse() - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) assert cast(Any, response.is_closed) is True @@ -129,7 +129,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "js": "on", }, ) - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +155,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" minify = await response.parse() - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -168,7 +168,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" minify = await response.parse() - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,7 +187,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: minify = await async_client.zones.settings.minify.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -199,7 +199,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" minify = await response.parse() - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) @pytest.mark.skip() @parametrize @@ -211,7 +211,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" minify = await response.parse() - assert_matches_type(Optional[ZoneSettingMinify], minify, path=["response"]) + assert_matches_type(Optional[Minify], minify, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_mirage.py b/tests/api_resources/zones/settings/test_mirage.py index 26681ffdbef..df7e84f8584 100644 --- a/tests/api_resources/zones/settings/test_mirage.py +++ b/tests/api_resources/zones/settings/test_mirage.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingMirage +from cloudflare.types.zones.settings.mirage import Mirage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" mirage = response.parse() - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" mirage = response.parse() - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: mirage = client.zones.settings.mirage.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" mirage = response.parse() - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" mirage = response.parse() - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" mirage = await response.parse() - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" mirage = await response.parse() - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: mirage = await async_client.zones.settings.mirage.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" mirage = await response.parse() - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" mirage = await response.parse() - assert_matches_type(Optional[ZoneSettingMirage], mirage, path=["response"]) + assert_matches_type(Optional[Mirage], mirage, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_mobile_redirect.py b/tests/api_resources/zones/settings/test_mobile_redirect.py index dd3ddd992ac..5fd6a2731c5 100644 --- a/tests/api_resources/zones/settings/test_mobile_redirect.py +++ b/tests/api_resources/zones/settings/test_mobile_redirect.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingMobileRedirect +from cloudflare.types.zones.settings.mobile_redirect import MobileRedirect base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "strip_uri": False, }, ) - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,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" mobile_redirect = response.parse() - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" mobile_redirect = response.parse() - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,7 +82,7 @@ def test_method_get(self, client: Cloudflare) -> None: mobile_redirect = client.zones.settings.mobile_redirect.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,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" mobile_redirect = response.parse() - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" mobile_redirect = response.parse() - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) assert cast(Any, response.is_closed) is True @@ -129,7 +129,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "strip_uri": False, }, ) - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +155,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" mobile_redirect = await response.parse() - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -168,7 +168,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" mobile_redirect = await response.parse() - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,7 +187,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: mobile_redirect = await async_client.zones.settings.mobile_redirect.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -199,7 +199,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" mobile_redirect = await response.parse() - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) @pytest.mark.skip() @parametrize @@ -211,7 +211,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" mobile_redirect = await response.parse() - assert_matches_type(Optional[ZoneSettingMobileRedirect], mobile_redirect, path=["response"]) + assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_nel.py b/tests/api_resources/zones/settings/test_nel.py index a15a85d9be0..5879cf8888c 100644 --- a/tests/api_resources/zones/settings/test_nel.py +++ b/tests/api_resources/zones/settings/test_nel.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingNEL +from cloudflare.types.zones.settings import NEL +from cloudflare.types.zones.settings.nel import NEL base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +28,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "value": {}, }, ) - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "value": {"enabled": False}, }, ) - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +56,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" nel = response.parse() - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +72,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" nel = response.parse() - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +94,7 @@ def test_method_get(self, client: Cloudflare) -> None: nel = client.zones.settings.nel.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,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" nel = response.parse() - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" nel = response.parse() - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +144,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "value": {}, }, ) - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +156,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "value": {"enabled": False}, }, ) - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +172,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" nel = await response.parse() - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" nel = await response.parse() - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +210,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: nel = await async_client.zones.settings.nel.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,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" nel = await response.parse() - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" nel = await response.parse() - assert_matches_type(Optional[ZoneSettingNEL], nel, path=["response"]) + assert_matches_type(Optional[NEL], nel, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_opportunistic_encryption.py b/tests/api_resources/zones/settings/test_opportunistic_encryption.py index 88126a49703..ea85bed6d1b 100644 --- a/tests/api_resources/zones/settings/test_opportunistic_encryption.py +++ b/tests/api_resources/zones/settings/test_opportunistic_encryption.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingOpportunisticEncryption +from cloudflare.types.zones.settings.opportunistic_encryption import OpportunisticEncryption base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"]) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" opportunistic_encryption = response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"]) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,9 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" opportunistic_encryption = response.parse() - assert_matches_type( - Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"] - ) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -71,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: opportunistic_encryption = client.zones.settings.opportunistic_encryption.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"]) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) @pytest.mark.skip() @parametrize @@ -83,7 +81,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" opportunistic_encryption = response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"]) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) @pytest.mark.skip() @parametrize @@ -95,9 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" opportunistic_encryption = response.parse() - assert_matches_type( - Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"] - ) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -120,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"]) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +129,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" opportunistic_encryption = await response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"]) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) @pytest.mark.skip() @parametrize @@ -146,9 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" opportunistic_encryption = await response.parse() - assert_matches_type( - Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"] - ) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -167,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: opportunistic_encryption = await async_client.zones.settings.opportunistic_encryption.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"]) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) @pytest.mark.skip() @parametrize @@ -179,7 +173,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" opportunistic_encryption = await response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"]) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) @pytest.mark.skip() @parametrize @@ -191,9 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" opportunistic_encryption = await response.parse() - assert_matches_type( - Optional[ZoneSettingOpportunisticEncryption], opportunistic_encryption, path=["response"] - ) + assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_opportunistic_onion.py b/tests/api_resources/zones/settings/test_opportunistic_onion.py index da6a2844d4f..2f5e4d340e4 100644 --- a/tests/api_resources/zones/settings/test_opportunistic_onion.py +++ b/tests/api_resources/zones/settings/test_opportunistic_onion.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingOpportunisticOnion +from cloudflare.types.zones.settings.opportunistic_onion import OpportunisticOnion base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" opportunistic_onion = response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" opportunistic_onion = response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: opportunistic_onion = client.zones.settings.opportunistic_onion.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" opportunistic_onion = response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" opportunistic_onion = response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" opportunistic_onion = await response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" opportunistic_onion = await response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: opportunistic_onion = await async_client.zones.settings.opportunistic_onion.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" opportunistic_onion = await response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" opportunistic_onion = await response.parse() - assert_matches_type(Optional[ZoneSettingOpportunisticOnion], opportunistic_onion, path=["response"]) + assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_orange_to_orange.py b/tests/api_resources/zones/settings/test_orange_to_orange.py index 1d4c32bd289..77f1b6c0d07 100644 --- a/tests/api_resources/zones/settings/test_orange_to_orange.py +++ b/tests/api_resources/zones/settings/test_orange_to_orange.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingOrangeToOrange +from cloudflare.types.zones.settings import OrangeToOrange +from cloudflare.types.zones.settings.orange_to_orange import OrangeToOrange base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +28,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +56,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" orange_to_orange = response.parse() - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +72,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" orange_to_orange = response.parse() - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +94,7 @@ def test_method_get(self, client: Cloudflare) -> None: orange_to_orange = client.zones.settings.orange_to_orange.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,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" orange_to_orange = response.parse() - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" orange_to_orange = response.parse() - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +144,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +156,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +172,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" orange_to_orange = await response.parse() - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" orange_to_orange = await response.parse() - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +210,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: orange_to_orange = await async_client.zones.settings.orange_to_orange.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,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" orange_to_orange = await response.parse() - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" orange_to_orange = await response.parse() - assert_matches_type(Optional[ZoneSettingOrangeToOrange], orange_to_orange, path=["response"]) + assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_origin_error_page_pass_thru.py b/tests/api_resources/zones/settings/test_origin_error_page_pass_thru.py index 1a12caea70f..5bd6bdfeabd 100644 --- a/tests/api_resources/zones/settings/test_origin_error_page_pass_thru.py +++ b/tests/api_resources/zones/settings/test_origin_error_page_pass_thru.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingOriginErrorPagePassThru +from cloudflare.types.zones.settings.origin_error_page_pass_thru import OriginErrorPagePassThru base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,9 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,9 +37,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" origin_error_page_pass_thru = response.parse() - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,9 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_error_page_pass_thru = response.parse() - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,9 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: origin_error_page_pass_thru = client.zones.settings.origin_error_page_pass_thru.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,9 +81,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" origin_error_page_pass_thru = response.parse() - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,9 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_error_page_pass_thru = response.parse() - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) assert cast(Any, response.is_closed) is True @@ -128,9 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,9 +129,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" origin_error_page_pass_thru = await response.parse() - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) @pytest.mark.skip() @parametrize @@ -158,9 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_error_page_pass_thru = await response.parse() - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) assert cast(Any, response.is_closed) is True @@ -179,9 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: origin_error_page_pass_thru = await async_client.zones.settings.origin_error_page_pass_thru.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,9 +173,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" origin_error_page_pass_thru = await response.parse() - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,9 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_error_page_pass_thru = await response.parse() - assert_matches_type( - Optional[ZoneSettingOriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"] - ) + assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_origin_max_http_version.py b/tests/api_resources/zones/settings/test_origin_max_http_version.py index 68024c905a6..39ddb11a280 100644 --- a/tests/api_resources/zones/settings/test_origin_max_http_version.py +++ b/tests/api_resources/zones/settings/test_origin_max_http_version.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ( - OriginMaxHTTPVersionGetResponse, - OriginMaxHTTPVersionEditResponse, -) +from cloudflare.types.zones.settings.origin_max_http_version_get_response import OriginMaxHTTPVersionGetResponse +from cloudflare.types.zones.settings.origin_max_http_version_edit_response import OriginMaxHTTPVersionEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zones/settings/test_polish.py b/tests/api_resources/zones/settings/test_polish.py index 81c7e82e6ae..f540a03c5ee 100644 --- a/tests/api_resources/zones/settings/test_polish.py +++ b/tests/api_resources/zones/settings/test_polish.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingPolish +from cloudflare.types.zones.settings import Polish +from cloudflare.types.zones.settings.polish import Polish base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +28,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "value": "off", }, ) - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "value": "off", }, ) - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +56,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" polish = response.parse() - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +72,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" polish = response.parse() - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +94,7 @@ def test_method_get(self, client: Cloudflare) -> None: polish = client.zones.settings.polish.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,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" polish = response.parse() - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" polish = response.parse() - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +144,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "value": "off", }, ) - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +156,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "value": "off", }, ) - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +172,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" polish = await response.parse() - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" polish = await response.parse() - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +210,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: polish = await async_client.zones.settings.polish.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,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" polish = await response.parse() - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" polish = await response.parse() - assert_matches_type(Optional[ZoneSettingPolish], polish, path=["response"]) + assert_matches_type(Optional[Polish], polish, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_prefetch_preload.py b/tests/api_resources/zones/settings/test_prefetch_preload.py index 64ef352ed41..89d23f4f328 100644 --- a/tests/api_resources/zones/settings/test_prefetch_preload.py +++ b/tests/api_resources/zones/settings/test_prefetch_preload.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingPrefetchPreload +from cloudflare.types.zones.settings.prefetch_preload import PrefetchPreload base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" prefetch_preload = response.parse() - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefetch_preload = response.parse() - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: prefetch_preload = client.zones.settings.prefetch_preload.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" prefetch_preload = response.parse() - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefetch_preload = response.parse() - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" prefetch_preload = await response.parse() - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefetch_preload = await response.parse() - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: prefetch_preload = await async_client.zones.settings.prefetch_preload.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" prefetch_preload = await response.parse() - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefetch_preload = await response.parse() - assert_matches_type(Optional[ZoneSettingPrefetchPreload], prefetch_preload, path=["response"]) + assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_proxy_read_timeout.py b/tests/api_resources/zones/settings/test_proxy_read_timeout.py index 0741ea010da..88ccb6cfeac 100644 --- a/tests/api_resources/zones/settings/test_proxy_read_timeout.py +++ b/tests/api_resources/zones/settings/test_proxy_read_timeout.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingProxyReadTimeout +from cloudflare.types.zones.settings import ProxyReadTimeout +from cloudflare.types.zones.settings.proxy_read_timeout import ProxyReadTimeout base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +28,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "value": 0, }, ) - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "value": 0, }, ) - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +56,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" proxy_read_timeout = response.parse() - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +72,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_read_timeout = response.parse() - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +94,7 @@ def test_method_get(self, client: Cloudflare) -> None: proxy_read_timeout = client.zones.settings.proxy_read_timeout.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,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" proxy_read_timeout = response.parse() - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_read_timeout = response.parse() - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +144,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "value": 0, }, ) - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +156,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "value": 0, }, ) - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +172,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" proxy_read_timeout = await response.parse() - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_read_timeout = await response.parse() - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +210,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: proxy_read_timeout = await async_client.zones.settings.proxy_read_timeout.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,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" proxy_read_timeout = await response.parse() - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_read_timeout = await response.parse() - assert_matches_type(Optional[ZoneSettingProxyReadTimeout], proxy_read_timeout, path=["response"]) + assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_pseudo_ipv4.py b/tests/api_resources/zones/settings/test_pseudo_ipv4.py index e0528d56434..3877f9edf90 100644 --- a/tests/api_resources/zones/settings/test_pseudo_ipv4.py +++ b/tests/api_resources/zones/settings/test_pseudo_ipv4.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingPseudoIPV4 +from cloudflare.types.zones.settings.pseudo_ipv4 import PseudoIPV4 base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" pseudo_ipv4 = response.parse() - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pseudo_ipv4 = response.parse() - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: pseudo_ipv4 = client.zones.settings.pseudo_ipv4.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" pseudo_ipv4 = response.parse() - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pseudo_ipv4 = response.parse() - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" pseudo_ipv4 = await response.parse() - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pseudo_ipv4 = await response.parse() - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: pseudo_ipv4 = await async_client.zones.settings.pseudo_ipv4.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" pseudo_ipv4 = await response.parse() - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" pseudo_ipv4 = await response.parse() - assert_matches_type(Optional[ZoneSettingPseudoIPV4], pseudo_ipv4, path=["response"]) + assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_response_buffering.py b/tests/api_resources/zones/settings/test_response_buffering.py index 5ffbb57322f..254e8ae809e 100644 --- a/tests/api_resources/zones/settings/test_response_buffering.py +++ b/tests/api_resources/zones/settings/test_response_buffering.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingBuffering +from cloudflare.types.zones.settings.response_buffering import ResponseBuffering base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" response_buffering = response.parse() - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" response_buffering = response.parse() - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: response_buffering = client.zones.settings.response_buffering.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" response_buffering = response.parse() - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" response_buffering = response.parse() - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" response_buffering = await response.parse() - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" response_buffering = await response.parse() - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: response_buffering = await async_client.zones.settings.response_buffering.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" response_buffering = await response.parse() - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" response_buffering = await response.parse() - assert_matches_type(Optional[ZoneSettingBuffering], response_buffering, path=["response"]) + assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_rocket_loader.py b/tests/api_resources/zones/settings/test_rocket_loader.py index 0b3c8e8bac3..ea7f19e20dc 100644 --- a/tests/api_resources/zones/settings/test_rocket_loader.py +++ b/tests/api_resources/zones/settings/test_rocket_loader.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingRocketLoader +from cloudflare.types.zones.settings import RocketLoader +from cloudflare.types.zones.settings.rocket_loader import RocketLoader base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +28,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +40,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +56,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" rocket_loader = response.parse() - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +72,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rocket_loader = response.parse() - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +94,7 @@ def test_method_get(self, client: Cloudflare) -> None: rocket_loader = client.zones.settings.rocket_loader.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,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" rocket_loader = response.parse() - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rocket_loader = response.parse() - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) assert cast(Any, response.is_closed) is True @@ -143,7 +144,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +156,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "value": "on", }, ) - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +172,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" rocket_loader = await response.parse() - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rocket_loader = await response.parse() - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +210,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: rocket_loader = await async_client.zones.settings.rocket_loader.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,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" rocket_loader = await response.parse() - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" rocket_loader = await response.parse() - assert_matches_type(Optional[ZoneSettingRocketLoader], rocket_loader, path=["response"]) + assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_security_headers.py b/tests/api_resources/zones/settings/test_security_headers.py index 824e612c0e8..301408e2228 100644 --- a/tests/api_resources/zones/settings/test_security_headers.py +++ b/tests/api_resources/zones/settings/test_security_headers.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingSecurityHeader +from cloudflare.types.zones.settings.security_headers import SecurityHeaders base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +40,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: } }, ) - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +53,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" security_header = response.parse() - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -66,7 +66,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_header = response.parse() - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +85,7 @@ def test_method_get(self, client: Cloudflare) -> None: security_header = client.zones.settings.security_headers.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +97,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" security_header = response.parse() - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -109,7 +109,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_header = response.parse() - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) assert cast(Any, response.is_closed) is True @@ -132,7 +132,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -148,7 +148,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) } }, ) - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -161,7 +161,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" security_header = await response.parse() - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +174,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_header = await response.parse() - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) assert cast(Any, response.is_closed) is True @@ -193,7 +193,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: security_header = await async_client.zones.settings.security_headers.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,7 +205,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" security_header = await response.parse() - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +217,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_header = await response.parse() - assert_matches_type(Optional[ZoneSettingSecurityHeader], security_header, path=["response"]) + assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_security_level.py b/tests/api_resources/zones/settings/test_security_level.py index 9cb8a9aedc3..46a85cf14e7 100644 --- a/tests/api_resources/zones/settings/test_security_level.py +++ b/tests/api_resources/zones/settings/test_security_level.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingSecurityLevel +from cloudflare.types.zones.settings.security_level import SecurityLevel base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" security_level = response.parse() - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_level = response.parse() - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: security_level = client.zones.settings.security_level.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" security_level = response.parse() - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_level = response.parse() - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" security_level = await response.parse() - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_level = await response.parse() - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: security_level = await async_client.zones.settings.security_level.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" security_level = await response.parse() - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_level = await response.parse() - assert_matches_type(Optional[ZoneSettingSecurityLevel], security_level, path=["response"]) + assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_server_side_excludes.py b/tests/api_resources/zones/settings/test_server_side_excludes.py index dcaed8d2853..3590c69cbf4 100644 --- a/tests/api_resources/zones/settings/test_server_side_excludes.py +++ b/tests/api_resources/zones/settings/test_server_side_excludes.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingServerSideExclude +from cloudflare.types.zones.settings.server_side_excludes import ServerSideExcludes base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" server_side_exclude = response.parse() - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" server_side_exclude = response.parse() - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: server_side_exclude = client.zones.settings.server_side_excludes.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" server_side_exclude = response.parse() - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" server_side_exclude = response.parse() - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" server_side_exclude = await response.parse() - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" server_side_exclude = await response.parse() - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: server_side_exclude = await async_client.zones.settings.server_side_excludes.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" server_side_exclude = await response.parse() - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" server_side_exclude = await response.parse() - assert_matches_type(Optional[ZoneSettingServerSideExclude], server_side_exclude, path=["response"]) + assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_sort_query_string_for_cache.py b/tests/api_resources/zones/settings/test_sort_query_string_for_cache.py index 170d7bec92c..76e531c39bb 100644 --- a/tests/api_resources/zones/settings/test_sort_query_string_for_cache.py +++ b/tests/api_resources/zones/settings/test_sort_query_string_for_cache.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingSortQueryStringForCache +from cloudflare.types.zones.settings.sort_query_string_for_cache import SortQueryStringForCache base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,9 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,9 +37,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" sort_query_string_for_cache = response.parse() - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,9 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sort_query_string_for_cache = response.parse() - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,9 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: sort_query_string_for_cache = client.zones.settings.sort_query_string_for_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,9 +81,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" sort_query_string_for_cache = response.parse() - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,9 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sort_query_string_for_cache = response.parse() - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -128,9 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,9 +129,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" sort_query_string_for_cache = await response.parse() - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) @pytest.mark.skip() @parametrize @@ -158,9 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" sort_query_string_for_cache = await response.parse() - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -179,9 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: sort_query_string_for_cache = await async_client.zones.settings.sort_query_string_for_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,9 +173,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" sort_query_string_for_cache = await response.parse() - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,9 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" sort_query_string_for_cache = await response.parse() - assert_matches_type( - Optional[ZoneSettingSortQueryStringForCache], sort_query_string_for_cache, path=["response"] - ) + assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_ssl.py b/tests/api_resources/zones/settings/test_ssl.py index 1a22aa81a7a..9bdb64ce54a 100644 --- a/tests/api_resources/zones/settings/test_ssl.py +++ b/tests/api_resources/zones/settings/test_ssl.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingSSL +from cloudflare.types.zones.settings.ssl import SSL base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" ssl = response.parse() - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssl = response.parse() - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: ssl = client.zones.settings.ssl.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" ssl = response.parse() - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssl = response.parse() - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" ssl = await response.parse() - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssl = await response.parse() - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: ssl = await async_client.zones.settings.ssl.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" ssl = await response.parse() - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssl = await response.parse() - assert_matches_type(Optional[ZoneSettingSSL], ssl, path=["response"]) + assert_matches_type(Optional[SSL], ssl, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_ssl_recommender.py b/tests/api_resources/zones/settings/test_ssl_recommender.py index 5fb5afb20c0..ba3e2259bd9 100644 --- a/tests/api_resources/zones/settings/test_ssl_recommender.py +++ b/tests/api_resources/zones/settings/test_ssl_recommender.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingSSLRecommender +from cloudflare.types.zones.settings import SSLRecommender +from cloudflare.types.zones.settings.ssl_recommender import SSLRecommender base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +37,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "id": "ssl_recommender", }, ) - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +50,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" ssl_recommender = response.parse() - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +63,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssl_recommender = response.parse() - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +82,7 @@ def test_method_get(self, client: Cloudflare) -> None: ssl_recommender = client.zones.settings.ssl_recommender.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,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" ssl_recommender = response.parse() - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssl_recommender = response.parse() - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) assert cast(Any, response.is_closed) is True @@ -128,7 +129,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,7 +141,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "id": "ssl_recommender", }, ) - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -153,7 +154,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" ssl_recommender = await response.parse() - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +167,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssl_recommender = await response.parse() - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) assert cast(Any, response.is_closed) is True @@ -185,7 +186,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: ssl_recommender = await async_client.zones.settings.ssl_recommender.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +198,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" ssl_recommender = await response.parse() - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) @pytest.mark.skip() @parametrize @@ -209,7 +210,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssl_recommender = await response.parse() - assert_matches_type(Optional[ZoneSettingSSLRecommender], ssl_recommender, path=["response"]) + assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_tls_1_3.py b/tests/api_resources/zones/settings/test_tls_1_3.py index 4cf09b010a6..feb7cd78fb6 100644 --- a/tests/api_resources/zones/settings/test_tls_1_3.py +++ b/tests/api_resources/zones/settings/test_tls_1_3.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingTLS1_3 +from cloudflare.types.zones.settings.tls_1_3 import TLS1_3 base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" tls_1_3 = response.parse() - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls_1_3 = response.parse() - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: tls_1_3 = client.zones.settings.tls_1_3.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" tls_1_3 = response.parse() - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls_1_3 = response.parse() - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" tls_1_3 = await response.parse() - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls_1_3 = await response.parse() - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: tls_1_3 = await async_client.zones.settings.tls_1_3.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" tls_1_3 = await response.parse() - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls_1_3 = await response.parse() - assert_matches_type(Optional[ZoneSettingTLS1_3], tls_1_3, path=["response"]) + assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_tls_client_auth.py b/tests/api_resources/zones/settings/test_tls_client_auth.py index b29d5c2a6f6..6e1b075bd04 100644 --- a/tests/api_resources/zones/settings/test_tls_client_auth.py +++ b/tests/api_resources/zones/settings/test_tls_client_auth.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingTLSClientAuth +from cloudflare.types.zones.settings.tls_client_auth import TLSClientAuth base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" tls_client_auth = response.parse() - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls_client_auth = response.parse() - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: tls_client_auth = client.zones.settings.tls_client_auth.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" tls_client_auth = response.parse() - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls_client_auth = response.parse() - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" tls_client_auth = await response.parse() - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls_client_auth = await response.parse() - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: tls_client_auth = await async_client.zones.settings.tls_client_auth.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" tls_client_auth = await response.parse() - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tls_client_auth = await response.parse() - assert_matches_type(Optional[ZoneSettingTLSClientAuth], tls_client_auth, path=["response"]) + assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_true_client_ip_header.py b/tests/api_resources/zones/settings/test_true_client_ip_header.py index 11556f8be2d..44ceac2ec06 100644 --- a/tests/api_resources/zones/settings/test_true_client_ip_header.py +++ b/tests/api_resources/zones/settings/test_true_client_ip_header.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingTrueClientIPHeader +from cloudflare.types.zones.settings.true_client_ip_header import TrueClientIPHeader base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" true_client_ip_header = response.parse() - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" true_client_ip_header = response.parse() - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: true_client_ip_header = client.zones.settings.true_client_ip_header.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" true_client_ip_header = response.parse() - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" true_client_ip_header = response.parse() - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" true_client_ip_header = await response.parse() - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" true_client_ip_header = await response.parse() - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: true_client_ip_header = await async_client.zones.settings.true_client_ip_header.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" true_client_ip_header = await response.parse() - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" true_client_ip_header = await response.parse() - assert_matches_type(Optional[ZoneSettingTrueClientIPHeader], true_client_ip_header, path=["response"]) + assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_waf.py b/tests/api_resources/zones/settings/test_waf.py index e573fa58ab5..c66f7baeea2 100644 --- a/tests/api_resources/zones/settings/test_waf.py +++ b/tests/api_resources/zones/settings/test_waf.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingWAF +from cloudflare.types.zones.settings.waf import WAF base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" waf = response.parse() - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" waf = response.parse() - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: waf = client.zones.settings.waf.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" waf = response.parse() - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" waf = response.parse() - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" waf = await response.parse() - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" waf = await response.parse() - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: waf = await async_client.zones.settings.waf.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" waf = await response.parse() - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" waf = await response.parse() - assert_matches_type(Optional[ZoneSettingWAF], waf, path=["response"]) + assert_matches_type(Optional[WAF], waf, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_webp.py b/tests/api_resources/zones/settings/test_webp.py index d8230d7b497..88db5d853bb 100644 --- a/tests/api_resources/zones/settings/test_webp.py +++ b/tests/api_resources/zones/settings/test_webp.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingWebP +from cloudflare.types.zones.settings.webp import WebP base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" webp = response.parse() - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webp = response.parse() - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: webp = client.zones.settings.webp.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" webp = response.parse() - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webp = response.parse() - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" webp = await response.parse() - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" webp = await response.parse() - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: webp = await async_client.zones.settings.webp.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" webp = await response.parse() - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" webp = await response.parse() - assert_matches_type(Optional[ZoneSettingWebP], webp, path=["response"]) + assert_matches_type(Optional[WebP], webp, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_websocket.py b/tests/api_resources/zones/settings/test_websocket.py index 7cac8f78a2c..17d0a61d126 100644 --- a/tests/api_resources/zones/settings/test_websocket.py +++ b/tests/api_resources/zones/settings/test_websocket.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSettingWebsockets +from cloudflare.types.zones.settings.websocket import Websocket base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" websocket = response.parse() - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" websocket = response.parse() - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: websocket = client.zones.settings.websocket.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" websocket = response.parse() - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" websocket = response.parse() - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="off", ) - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" websocket = await response.parse() - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" websocket = await response.parse() - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: websocket = await async_client.zones.settings.websocket.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" websocket = await response.parse() - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" websocket = await response.parse() - assert_matches_type(Optional[ZoneSettingWebsockets], websocket, path=["response"]) + assert_matches_type(Optional[Websocket], websocket, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/settings/test_zero_rtt.py b/tests/api_resources/zones/settings/test_zero_rtt.py index 3e05091750a..994e02751b6 100644 --- a/tests/api_resources/zones/settings/test_zero_rtt.py +++ b/tests/api_resources/zones/settings/test_zero_rtt.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZoneSetting0rtt +from cloudflare.types.zones.settings.zero_rtt import ZeroRTT base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" zero_rtt = response.parse() - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" zero_rtt = response.parse() - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: zero_rtt = client.zones.settings.zero_rtt.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" zero_rtt = response.parse() - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" zero_rtt = response.parse() - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" zero_rtt = await response.parse() - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" zero_rtt = await response.parse() - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: zero_rtt = await async_client.zones.settings.zero_rtt.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" zero_rtt = await response.parse() - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" zero_rtt = await response.parse() - assert_matches_type(Optional[ZoneSetting0rtt], zero_rtt, path=["response"]) + assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/test_activation_check.py b/tests/api_resources/zones/test_activation_check.py index 56199bb58be..254603ee6fa 100644 --- a/tests/api_resources/zones/test_activation_check.py +++ b/tests/api_resources/zones/test_activation_check.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.zones import ActivationCheckTriggerResponse +from cloudflare.types.zones.activation_check_trigger_response import ActivationCheckTriggerResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_trigger(self, client: Cloudflare) -> None: activation_check = client.zones.activation_check.trigger( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_raw_response_trigger(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" activation_check = response.parse() - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_streaming_response_trigger(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" activation_check = response.parse() - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_trigger(self, async_client: AsyncCloudflare) -> None: activation_check = await async_client.zones.activation_check.trigger( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,7 @@ async def test_raw_response_trigger(self, async_client: AsyncCloudflare) -> None assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" activation_check = await response.parse() - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ async def test_streaming_response_trigger(self, async_client: AsyncCloudflare) - assert response.http_request.headers.get("X-Stainless-Lang") == "python" activation_check = await response.parse() - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/test_custom_nameservers.py b/tests/api_resources/zones/test_custom_nameservers.py index 0d059a2b75b..11994140148 100644 --- a/tests/api_resources/zones/test_custom_nameservers.py +++ b/tests/api_resources/zones/test_custom_nameservers.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones import ( - CustomNameserverGetResponse, - CustomNameserverUpdateResponse, -) +from cloudflare.types.zones.custom_nameserver_get_response import CustomNameserverGetResponse +from cloudflare.types.zones.custom_nameserver_update_response import CustomNameserverUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/zones/test_dns_settings.py b/tests/api_resources/zones/test_dns_settings.py index 7f234aa2d37..3bb8a3c71c4 100644 --- a/tests/api_resources/zones/test_dns_settings.py +++ b/tests/api_resources/zones/test_dns_settings.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.zones import DNSSettingGetResponse, DNSSettingEditResponse +from cloudflare.types.zones.dns_setting import DNSSetting base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,16 +23,19 @@ def test_method_edit(self, client: Cloudflare) -> None: dns_setting = client.zones.dns_settings.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSSettingEditResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: dns_setting = client.zones.dns_settings.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + foundation_dns=False, + multi_provider=False, nameservers={"type": "cloudflare.standard"}, + secondary_overrides=False, ) - assert_matches_type(DNSSettingEditResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +47,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" dns_setting = response.parse() - assert_matches_type(DNSSettingEditResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +59,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns_setting = response.parse() - assert_matches_type(DNSSettingEditResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +77,7 @@ def test_method_get(self, client: Cloudflare) -> None: dns_setting = client.zones.dns_settings.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSSettingGetResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +89,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" dns_setting = response.parse() - assert_matches_type(DNSSettingGetResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +101,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns_setting = response.parse() - assert_matches_type(DNSSettingGetResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -120,16 +123,19 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: dns_setting = await async_client.zones.dns_settings.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSSettingEditResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: dns_setting = await async_client.zones.dns_settings.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + foundation_dns=False, + multi_provider=False, nameservers={"type": "cloudflare.standard"}, + secondary_overrides=False, ) - assert_matches_type(DNSSettingEditResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -141,7 +147,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" dns_setting = await response.parse() - assert_matches_type(DNSSettingEditResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -153,7 +159,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns_setting = await response.parse() - assert_matches_type(DNSSettingEditResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -171,7 +177,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: dns_setting = await async_client.zones.dns_settings.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNSSettingGetResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -183,7 +189,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" dns_setting = await response.parse() - assert_matches_type(DNSSettingGetResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -195,7 +201,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns_setting = await response.parse() - assert_matches_type(DNSSettingGetResponse, dns_setting, path=["response"]) + assert_matches_type(Optional[DNSSetting], dns_setting, 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 28c77cfd773..7ac16346ebb 100644 --- a/tests/api_resources/zones/test_holds.py +++ b/tests/api_resources/zones/test_holds.py @@ -9,11 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones import ( - HoldGetResponse, - HoldCreateResponse, - HoldDeleteResponse, -) +from cloudflare.types.zones.zone_hold import ZoneHold base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +23,7 @@ def test_method_create(self, client: Cloudflare) -> None: hold = client.zones.holds.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(HoldCreateResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +32,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", include_subdomains=True, ) - assert_matches_type(HoldCreateResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +44,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" hold = response.parse() - assert_matches_type(HoldCreateResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +56,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hold = response.parse() - assert_matches_type(HoldCreateResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +74,7 @@ def test_method_delete(self, client: Cloudflare) -> None: hold = client.zones.holds.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[HoldDeleteResponse], hold, path=["response"]) + assert_matches_type(Optional[ZoneHold], hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +83,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", hold_after="string", ) - assert_matches_type(Optional[HoldDeleteResponse], hold, path=["response"]) + assert_matches_type(Optional[ZoneHold], hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +95,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[HoldDeleteResponse], hold, path=["response"]) + assert_matches_type(Optional[ZoneHold], hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +107,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[HoldDeleteResponse], hold, path=["response"]) + assert_matches_type(Optional[ZoneHold], hold, path=["response"]) assert cast(Any, response.is_closed) is True @@ -129,7 +125,7 @@ def test_method_get(self, client: Cloudflare) -> None: hold = client.zones.holds.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(HoldGetResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -141,7 +137,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" hold = response.parse() - assert_matches_type(HoldGetResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -153,7 +149,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hold = response.parse() - assert_matches_type(HoldGetResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) assert cast(Any, response.is_closed) is True @@ -175,7 +171,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: hold = await async_client.zones.holds.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(HoldCreateResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -184,7 +180,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare zone_id="023e105f4ecef8ad9ca31a8372d0c353", include_subdomains=True, ) - assert_matches_type(HoldCreateResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,7 +192,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" hold = await response.parse() - assert_matches_type(HoldCreateResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,7 +204,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" hold = await response.parse() - assert_matches_type(HoldCreateResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) assert cast(Any, response.is_closed) is True @@ -226,7 +222,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[HoldDeleteResponse], hold, path=["response"]) + assert_matches_type(Optional[ZoneHold], hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -235,7 +231,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare zone_id="023e105f4ecef8ad9ca31a8372d0c353", hold_after="string", ) - assert_matches_type(Optional[HoldDeleteResponse], hold, path=["response"]) + assert_matches_type(Optional[ZoneHold], hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -247,7 +243,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[HoldDeleteResponse], hold, path=["response"]) + assert_matches_type(Optional[ZoneHold], hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -259,7 +255,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[HoldDeleteResponse], hold, path=["response"]) + assert_matches_type(Optional[ZoneHold], hold, path=["response"]) assert cast(Any, response.is_closed) is True @@ -277,7 +273,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: hold = await async_client.zones.holds.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(HoldGetResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -289,7 +285,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" hold = await response.parse() - assert_matches_type(HoldGetResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) @pytest.mark.skip() @parametrize @@ -301,7 +297,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" hold = await response.parse() - assert_matches_type(HoldGetResponse, hold, path=["response"]) + assert_matches_type(ZoneHold, hold, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/test_settings.py b/tests/api_resources/zones/test_settings.py deleted file mode 100644 index 0b1bb59c37e..00000000000 --- a/tests/api_resources/zones/test_settings.py +++ /dev/null @@ -1,302 +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.zones import SettingGetResponse, SettingEditResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSettings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="oneOf doesnt match") - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - setting = client.zones.settings.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - items=[ - { - "id": "always_online", - "value": "on", - }, - { - "id": "browser_cache_ttl", - "value": 18000, - }, - { - "id": "ip_geolocation", - "value": "off", - }, - ], - ) - assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) - - @pytest.mark.skip(reason="oneOf doesnt match") - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - items=[ - { - "id": "always_online", - "value": "on", - }, - { - "id": "browser_cache_ttl", - "value": 18000, - }, - { - "id": "ip_geolocation", - "value": "off", - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) - - @pytest.mark.skip(reason="oneOf doesnt match") - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - items=[ - { - "id": "always_online", - "value": "on", - }, - { - "id": "browser_cache_ttl", - "value": 18000, - }, - { - "id": "ip_geolocation", - "value": "off", - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="oneOf doesnt match") - @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.settings.with_raw_response.edit( - zone_id="", - items=[ - { - "id": "always_online", - "value": "on", - }, - { - "id": "browser_cache_ttl", - "value": 18000, - }, - { - "id": "ip_geolocation", - "value": "off", - }, - ], - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - setting = client.zones.settings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncSettings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="oneOf doesnt match") - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.zones.settings.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - items=[ - { - "id": "always_online", - "value": "on", - }, - { - "id": "browser_cache_ttl", - "value": 18000, - }, - { - "id": "ip_geolocation", - "value": "off", - }, - ], - ) - assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) - - @pytest.mark.skip(reason="oneOf doesnt match") - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - items=[ - { - "id": "always_online", - "value": "on", - }, - { - "id": "browser_cache_ttl", - "value": 18000, - }, - { - "id": "ip_geolocation", - "value": "off", - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) - - @pytest.mark.skip(reason="oneOf doesnt match") - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - items=[ - { - "id": "always_online", - "value": "on", - }, - { - "id": "browser_cache_ttl", - "value": 18000, - }, - { - "id": "ip_geolocation", - "value": "off", - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="oneOf doesnt match") - @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.settings.with_raw_response.edit( - zone_id="", - items=[ - { - "id": "always_online", - "value": "on", - }, - { - "id": "browser_cache_ttl", - "value": 18000, - }, - { - "id": "ip_geolocation", - "value": "off", - }, - ], - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.zones.settings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/test_subscriptions.py b/tests/api_resources/zones/test_subscriptions.py index 969e48d0ee7..d3ec269a7d8 100644 --- a/tests/api_resources/zones/test_subscriptions.py +++ b/tests/api_resources/zones/test_subscriptions.py @@ -10,11 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zones import ( - SubscriptionGetResponse, - SubscriptionListResponse, - SubscriptionCreateResponse, -) +from cloudflare.types.user.subscription import Subscription +from cloudflare.types.zones.subscription_get_response import SubscriptionGetResponse +from cloudflare.types.zones.subscription_create_response import SubscriptionCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -110,7 +108,7 @@ def test_method_list(self, client: Cloudflare) -> None: subscription = client.zones.subscriptions.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[Subscription], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +120,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = response.parse() - assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[Subscription], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +132,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = response.parse() - assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[Subscription], subscription, path=["response"]) assert cast(Any, response.is_closed) is True @@ -280,7 +278,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: subscription = await async_client.zones.subscriptions.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[Subscription], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -292,7 +290,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = await response.parse() - assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[Subscription], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -304,7 +302,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = await response.parse() - assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[Subscription], subscription, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/workers/test_script.py b/tests/api_resources/zones/workers/test_script.py deleted file mode 100644 index 386c937bba6..00000000000 --- a/tests/api_resources/zones/workers/test_script.py +++ /dev/null @@ -1,318 +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 tests.utils import assert_matches_type -from cloudflare._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, -) -from cloudflare.types.zones.workers import ScriptUpdateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestScript: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - script = client.zones.workers.script.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(ScriptUpdateResponse, script, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zones.workers.script.with_raw_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = response.parse() - assert_matches_type(ScriptUpdateResponse, script, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zones.workers.script.with_streaming_response.update( - zone_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(ScriptUpdateResponse, script, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.workers.script.with_raw_response.update( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - script = client.zones.workers.script.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert script is None - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zones.workers.script.with_raw_response.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = response.parse() - assert script is None - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zones.workers.script.with_streaming_response.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = response.parse() - assert script is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.workers.script.with_raw_response.delete( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - script = client.zones.workers.script.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert script.is_closed - assert script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, BinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - - script = client.zones.workers.script.with_raw_response.get( - zone_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) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - with client.zones.workers.script.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as script: - assert not script.is_closed - assert script.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) - - assert cast(Any, script.is_closed) is True - - @pytest.mark.skip() - @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 `zone_id` but received ''"): - client.zones.workers.script.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncScript: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - script = await async_client.zones.workers.script.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(ScriptUpdateResponse, script, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.workers.script.with_raw_response.update( - zone_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(ScriptUpdateResponse, script, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.workers.script.with_streaming_response.update( - zone_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(ScriptUpdateResponse, script, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.workers.script.with_raw_response.update( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - script = await async_client.zones.workers.script.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert script is None - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.workers.script.with_raw_response.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = await response.parse() - assert script is None - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.workers.script.with_streaming_response.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = await response.parse() - assert script is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.workers.script.with_raw_response.delete( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - script = await async_client.zones.workers.script.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert script.is_closed - assert await script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @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("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - - script = await async_client.zones.workers.script.with_raw_response.get( - zone_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) - - @pytest.mark.skip() - @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("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - async with async_client.zones.workers.script.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as script: - assert not script.is_closed - assert script.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) - - assert cast(Any, script.is_closed) is True - - @pytest.mark.skip() - @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 `zone_id` but received ''"): - await async_client.zones.workers.script.with_raw_response.get( - zone_id="", - ) diff --git a/tests/test_models.py b/tests/test_models.py index 0b80398977e..3e07792f3b5 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -501,6 +501,42 @@ class Model(BaseModel): assert "resource_id" in m.model_fields_set +def test_to_dict() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert m.to_dict() == {"FOO": "hello"} + assert m.to_dict(use_api_names=False) == {"foo": "hello"} + + m2 = Model() + assert m2.to_dict() == {} + assert m2.to_dict(exclude_unset=False) == {"FOO": None} + assert m2.to_dict(exclude_unset=False, exclude_none=True) == {} + assert m2.to_dict(exclude_unset=False, exclude_defaults=True) == {} + + m3 = Model(FOO=None) + assert m3.to_dict() == {"FOO": None} + assert m3.to_dict(exclude_none=True) == {} + assert m3.to_dict(exclude_defaults=True) == {} + + if PYDANTIC_V2: + + class Model2(BaseModel): + created_at: datetime + + time_str = "2024-03-21T11:39:01.275859" + m4 = Model2.construct(created_at=time_str) + assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} + assert m4.to_dict(mode="json") == {"created_at": time_str} + else: + with pytest.raises(ValueError, match="mode is only supported in Pydantic v2"): + m.to_dict(mode="json") + + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.to_dict(warnings=False) + + def test_forwards_compat_model_dump_method() -> None: class Model(BaseModel): foo: Optional[str] = Field(alias="FOO", default=None) @@ -532,6 +568,34 @@ class Model(BaseModel): m.model_dump(warnings=False) +def test_to_json() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert json.loads(m.to_json()) == {"FOO": "hello"} + assert json.loads(m.to_json(use_api_names=False)) == {"foo": "hello"} + + if PYDANTIC_V2: + assert m.to_json(indent=None) == '{"FOO":"hello"}' + else: + assert m.to_json(indent=None) == '{"FOO": "hello"}' + + m2 = Model() + assert json.loads(m2.to_json()) == {} + assert json.loads(m2.to_json(exclude_unset=False)) == {"FOO": None} + assert json.loads(m2.to_json(exclude_unset=False, exclude_none=True)) == {} + assert json.loads(m2.to_json(exclude_unset=False, exclude_defaults=True)) == {} + + m3 = Model(FOO=None) + assert json.loads(m3.to_json()) == {"FOO": None} + assert json.loads(m3.to_json(exclude_none=True)) == {} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.to_json(warnings=False) + + def test_forwards_compat_model_dump_json_method() -> None: class Model(BaseModel): foo: Optional[str] = Field(alias="FOO", default=None) diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 0ca088494ab..373dacc940f 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -1,104 +1,250 @@ +from __future__ import annotations + from typing import Iterator, AsyncIterator +import httpx import pytest -from cloudflare._streaming import SSEDecoder +from cloudflare import Cloudflare, AsyncCloudflare +from cloudflare._streaming import Stream, AsyncStream, ServerSentEvent @pytest.mark.asyncio -async def test_basic_async() -> None: - async def body() -> AsyncIterator[str]: - yield "event: completion" - yield 'data: {"foo":true}' - yield "" - - async for sse in SSEDecoder().aiter(body()): - assert sse.event == "completion" - assert sse.json() == {"foo": True} +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_basic(sync: bool, client: Cloudflare, async_client: AsyncCloudflare) -> None: + def body() -> Iterator[bytes]: + yield b"event: completion\n" + yield b'data: {"foo":true}\n' + yield b"\n" + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) -def test_basic() -> None: - def body() -> Iterator[str]: - yield "event: completion" - yield 'data: {"foo":true}' - yield "" - - it = SSEDecoder().iter(body()) - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "completion" assert sse.json() == {"foo": True} - with pytest.raises(StopIteration): - next(it) + await assert_empty_iter(iterator) -def test_data_missing_event() -> None: - def body() -> Iterator[str]: - yield 'data: {"foo":true}' - yield "" +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_data_missing_event(sync: bool, client: Cloudflare, async_client: AsyncCloudflare) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"foo":true}\n' + yield b"\n" - it = SSEDecoder().iter(body()) - sse = next(it) + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) assert sse.event is None assert sse.json() == {"foo": True} - with pytest.raises(StopIteration): - next(it) + await assert_empty_iter(iterator) + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_event_missing_data(sync: bool, client: Cloudflare, async_client: AsyncCloudflare) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"\n" -def test_event_missing_data() -> None: - def body() -> Iterator[str]: - yield "event: ping" - yield "" + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) - it = SSEDecoder().iter(body()) - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "ping" assert sse.data == "" - with pytest.raises(StopIteration): - next(it) + await assert_empty_iter(iterator) -def test_multiple_events() -> None: - def body() -> Iterator[str]: - yield "event: ping" - yield "" - yield "event: completion" - yield "" +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_events(sync: bool, client: Cloudflare, async_client: AsyncCloudflare) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"\n" + yield b"event: completion\n" + yield b"\n" - it = SSEDecoder().iter(body()) + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "ping" assert sse.data == "" - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "completion" assert sse.data == "" - with pytest.raises(StopIteration): - next(it) - - -def test_multiple_events_with_data() -> None: - def body() -> Iterator[str]: - yield "event: ping" - yield 'data: {"foo":true}' - yield "" - yield "event: completion" - yield 'data: {"bar":false}' - yield "" + await assert_empty_iter(iterator) - it = SSEDecoder().iter(body()) - sse = next(it) +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_events_with_data(sync: bool, client: Cloudflare, async_client: AsyncCloudflare) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b'data: {"foo":true}\n' + yield b"\n" + yield b"event: completion\n" + yield b'data: {"bar":false}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) assert sse.event == "ping" assert sse.json() == {"foo": True} - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "completion" assert sse.json() == {"bar": False} - with pytest.raises(StopIteration): - next(it) + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_data_lines_with_empty_line( + sync: bool, client: Cloudflare, async_client: AsyncCloudflare +) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"data: {\n" + yield b'data: "foo":\n' + yield b"data: \n" + yield b"data:\n" + yield b"data: true}\n" + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + assert sse.data == '{\n"foo":\n\n\ntrue}' + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_data_json_escaped_double_new_line(sync: bool, client: Cloudflare, async_client: AsyncCloudflare) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b'data: {"foo": "my long\\n\\ncontent"}' + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": "my long\n\ncontent"} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_data_lines(sync: bool, client: Cloudflare, async_client: AsyncCloudflare) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"data: {\n" + yield b'data: "foo":\n' + yield b"data: true}\n" + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + + await assert_empty_iter(iterator) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_special_new_line_character( + sync: bool, + client: Cloudflare, + async_client: AsyncCloudflare, +) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"content":" culpa"}\n' + yield b"\n" + yield b'data: {"content":" \xe2\x80\xa8"}\n' + yield b"\n" + yield b'data: {"content":"foo"}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": " culpa"} + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": " 
"} + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": "foo"} + + await assert_empty_iter(iterator) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multi_byte_character_multiple_chunks( + sync: bool, + client: Cloudflare, + async_client: AsyncCloudflare, +) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"content":"' + # bytes taken from the string 'известни' and arbitrarily split + # so that some multi-byte characters span multiple chunks + yield b"\xd0" + yield b"\xb8\xd0\xb7\xd0" + yield b"\xb2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbd\xd0\xb8" + yield b'"}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": "известни"} + + +async def to_aiter(iter: Iterator[bytes]) -> AsyncIterator[bytes]: + for chunk in iter: + yield chunk + + +async def iter_next(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]) -> ServerSentEvent: + if isinstance(iter, AsyncIterator): + return await iter.__anext__() + + return next(iter) + + +async def assert_empty_iter(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]) -> None: + with pytest.raises((StopAsyncIteration, RuntimeError)): + await iter_next(iter) + + +def make_event_iterator( + content: Iterator[bytes], + *, + sync: bool, + client: Cloudflare, + async_client: AsyncCloudflare, +) -> Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]: + if sync: + return Stream(cast_to=object, client=client, response=httpx.Response(200, content=content))._iter_events() + + return AsyncStream( + cast_to=object, client=async_client, response=httpx.Response(200, content=to_aiter(content)) + )._iter_events()